Skip to content

Commit 656d122

Browse files
committed
Add web project
1 parent 66e667f commit 656d122

23 files changed

+752
-1
lines changed

.github/workflows/pages.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
deploy-to-github-pages:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Setup .NET Core SDK
14+
uses: actions/[email protected]
15+
16+
- name: Install wasm-tools
17+
run: dotnet workload install wasm-tools
18+
19+
- name: Publish .NET Project
20+
run: dotnet publish src/Core2D.Web/Core2D.Web.csproj -c Release -o release --nologo
21+
22+
- name: Change base-tag in index.html from / to Core2D
23+
run: sed -i 's/<base href="\/" \/>/<base href="\/Core2D\/" \/>/g' release/wwwroot/index.html
24+
25+
- name: copy index.html to 404.html
26+
run: cp release/wwwroot/index.html release/wwwroot/404.html
27+
28+
- name: Add .nojekyll file
29+
run: touch release/wwwroot/.nojekyll
30+
31+
- name: Commit wwwroot to GitHub Pages
32+
uses: JamesIves/[email protected]
33+
with:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
BRANCH: gh-pages
36+
FOLDER: release/wwwroot

Core2D.sln

+30
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "build\build\_buil
8888
EndProject
8989
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTest", "samples\IntegrationTest\IntegrationTest.csproj", "{502CF795-06DF-4E16-96A9-6BA58F988D62}"
9090
EndProject
91+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core2D.Web.Base", "src\Core2D.Web.Base\Core2D.Web.Base.csproj", "{922B84B5-D81C-4F3A-B570-07EAC318D3F9}"
92+
EndProject
93+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core2D.Web", "src\Core2D.Web\Core2D.Web.csproj", "{FF36305E-27AC-404C-9EE1-459FB160FA19}"
94+
EndProject
9195
Global
9296
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9397
Debug|Any CPU = Debug|Any CPU
@@ -470,6 +474,30 @@ Global
470474
{502CF795-06DF-4E16-96A9-6BA58F988D62}.Release|x64.Build.0 = Release|Any CPU
471475
{502CF795-06DF-4E16-96A9-6BA58F988D62}.Release|x86.ActiveCfg = Release|Any CPU
472476
{502CF795-06DF-4E16-96A9-6BA58F988D62}.Release|x86.Build.0 = Release|Any CPU
477+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
478+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
479+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Debug|x64.ActiveCfg = Debug|Any CPU
480+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Debug|x64.Build.0 = Debug|Any CPU
481+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Debug|x86.ActiveCfg = Debug|Any CPU
482+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Debug|x86.Build.0 = Debug|Any CPU
483+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
484+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Release|Any CPU.Build.0 = Release|Any CPU
485+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Release|x64.ActiveCfg = Release|Any CPU
486+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Release|x64.Build.0 = Release|Any CPU
487+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Release|x86.ActiveCfg = Release|Any CPU
488+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9}.Release|x86.Build.0 = Release|Any CPU
489+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
490+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Debug|Any CPU.Build.0 = Debug|Any CPU
491+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Debug|x64.ActiveCfg = Debug|Any CPU
492+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Debug|x64.Build.0 = Debug|Any CPU
493+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Debug|x86.ActiveCfg = Debug|Any CPU
494+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Debug|x86.Build.0 = Debug|Any CPU
495+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Release|Any CPU.ActiveCfg = Release|Any CPU
496+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Release|Any CPU.Build.0 = Release|Any CPU
497+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Release|x64.ActiveCfg = Release|Any CPU
498+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Release|x64.Build.0 = Release|Any CPU
499+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Release|x86.ActiveCfg = Release|Any CPU
500+
{FF36305E-27AC-404C-9EE1-459FB160FA19}.Release|x86.Build.0 = Release|Any CPU
473501
EndGlobalSection
474502
GlobalSection(SolutionProperties) = preSolution
475503
HideSolutionNode = FALSE
@@ -507,6 +535,8 @@ Global
507535
{41864624-DF9B-4E24-821C-134C79C7E2B3} = {33116698-64BF-46E3-A655-86981600BFAD}
508536
{C43260E6-62B6-415F-9301-ED34DA1816D7} = {1AE10EDE-F6CB-4EE3-9096-FFBBA86B0627}
509537
{502CF795-06DF-4E16-96A9-6BA58F988D62} = {1E03FE6F-FA1D-422E-A0C1-A06AC959E4FC}
538+
{922B84B5-D81C-4F3A-B570-07EAC318D3F9} = {A5C9C74C-A503-4375-B56A-1411181B6E5A}
539+
{FF36305E-27AC-404C-9EE1-459FB160FA19} = {A5C9C74C-A503-4375-B56A-1411181B6E5A}
510540
EndGlobalSection
511541
GlobalSection(ExtensibilityGlobals) = postSolution
512542
SolutionGuid = {0720A3F0-7CD3-4F9C-8DFF-858B38D44C31}

src/Core2D.Desktop/App.axaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static AboutInfoViewModel CreateAboutInfo(IServiceProvider? serviceProvid
6161
return new AboutInfoViewModel(serviceProvider)
6262
{
6363
Title = "Core2D",
64-
Version = $"{Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}",
64+
Version = $"{Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}",
6565
Description = "A multi-platform data driven 2D diagram editor.",
6666
Copyright = "Copyright (c) Wiesław Šoltés. All rights reserved.",
6767
License = "Licensed under the MIT License. See LICENSE file in the project root for full license information.",

src/Core2D.Web.Base/App.axaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Application xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:local="clr-namespace:Core2D;assembly=Core2D"
4+
x:Class="Core2D.Web.Base.App"
5+
xmlns:vme="using:Core2D.ViewModels.Editor"
6+
x:DataType="vme:ProjectEditorViewModel" x:CompileBindings="True">
7+
8+
<Application.Resources>
9+
<FontFamily x:Key="UiFontFamily">Segoe UI, SF Pro Display, Noto Sans, Cantarel</FontFamily>
10+
<FontFamily x:Key="CodeFontFamily">Consolas, Menlo, Monaco, Courier, Courier New, Andale Mono, DejaVu Sans Mono</FontFamily>
11+
<StaticResource x:Key="ContentControlThemeFontFamily" ResourceKey="UiFontFamily" />
12+
</Application.Resources>
13+
14+
<Application.Styles>
15+
<StyleInclude Source="avares://Core2D/Themes/FluentDark.axaml" />
16+
<StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />
17+
<StyleInclude Source="avares://ThemeEditor.Controls.ColorPicker/ColorPicker.axaml" />
18+
<StyleInclude Source="avares://Core2D/Styles/Geometry.axaml" />
19+
<StyleInclude Source="avares://Core2D/Styles/Icons.axaml" />
20+
<StyleInclude Source="avares://Core2D/Styles/Dock.axaml" />
21+
<StyleInclude Source="avares://Core2D/Controls/EditableItem.axaml" />
22+
<StyleInclude Source="avares://Core2D/Controls/ToggleItem.axaml" />
23+
</Application.Styles>
24+
25+
<Application.DataTemplates>
26+
<local:ViewLocator />
27+
</Application.DataTemplates>
28+
29+
</Application>

src/Core2D.Web.Base/App.axaml.cs

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using System;
2+
using System.Linq;
3+
using System.Reflection;
4+
using Autofac;
5+
using Avalonia;
6+
using Avalonia.Controls.ApplicationLifetimes;
7+
using Avalonia.Markup.Xaml;
8+
using Avalonia.Platform;
9+
using Core2D.ViewModels;
10+
using Core2D.ViewModels.Docking;
11+
using Core2D.ViewModels.Editor;
12+
using Core2D.Views;
13+
using Dock.Model.Controls;
14+
using Dock.Model.Core;
15+
16+
namespace Core2D.Web.Base;
17+
18+
public class App : Application
19+
{
20+
public override void Initialize()
21+
{
22+
AvaloniaXamlLoader.Load(this);
23+
}
24+
25+
public static AboutInfoViewModel CreateAboutInfo(IServiceProvider? serviceProvider, RuntimePlatformInfo runtimeInfo, string? windowingSubsystem, string? renderingSubsystem)
26+
{
27+
return new AboutInfoViewModel(serviceProvider)
28+
{
29+
Title = "Core2D",
30+
Version = $"{Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}",
31+
Description = "A multi-platform data driven 2D diagram editor.",
32+
Copyright = "Copyright (c) Wiesław Šoltés. All rights reserved.",
33+
License = "Licensed under the MIT License. See LICENSE file in the project root for full license information.",
34+
OperatingSystem = $"{runtimeInfo.OperatingSystem}",
35+
IsDesktop = runtimeInfo.IsDesktop,
36+
IsMobile = runtimeInfo.IsMobile,
37+
IsCoreClr = runtimeInfo.IsCoreClr,
38+
IsMono = runtimeInfo.IsMono,
39+
IsDotNetFramework = runtimeInfo.IsDotNetFramework,
40+
IsUnix = runtimeInfo.IsUnix,
41+
WindowingSubsystemName = windowingSubsystem,
42+
RenderingSubsystemName = renderingSubsystem
43+
};
44+
}
45+
46+
private static void CreateLayout(ProjectEditorViewModel editor)
47+
{
48+
if (editor.DockFactory is IFactory dockFactory)
49+
{
50+
editor.RootDock = dockFactory.CreateLayout();
51+
52+
if (editor.RootDock is IDock dock)
53+
{
54+
dockFactory.InitLayout(dock);
55+
dockFactory.GetDockable<IDocumentDock>("Pages")?.CreateDocument?.Execute(null);
56+
57+
editor.NavigateTo = id => dock.Navigate.Execute(id);
58+
59+
dock.Navigate.Execute("Dashboard");
60+
}
61+
}
62+
}
63+
64+
public override void OnFrameworkInitializationCompleted()
65+
{
66+
var builder = new ContainerBuilder();
67+
builder.RegisterModule<CoreModule>();
68+
69+
var container = builder.Build();
70+
71+
var serviceProvider = container.Resolve<IServiceProvider>();
72+
73+
var editor = serviceProvider.GetService<ProjectEditorViewModel>();
74+
75+
if (editor is { })
76+
{
77+
editor.DockFactory = new DockFactory(editor);
78+
79+
CreateLayout(editor);
80+
81+
editor.CurrentTool = editor.Tools.FirstOrDefault(t => t.Title == "Selection");
82+
editor.CurrentPathTool = editor.PathTools.FirstOrDefault(t => t.Title == "Line");
83+
editor.IsToolIdle = true;
84+
85+
var runtimeInfo = AvaloniaLocator.Current.GetService<IRuntimePlatform>().GetRuntimeInfo();
86+
var windowingPlatform = AvaloniaLocator.Current.GetService<IWindowingPlatform>();
87+
var platformRenderInterface = AvaloniaLocator.Current.GetService<IPlatformRenderInterface>();
88+
var windowingSubsystemName = windowingPlatform.GetType().Assembly.GetName().Name;
89+
var renderingSubsystemName = platformRenderInterface.GetType().Assembly.GetName().Name;
90+
var aboutInfo = CreateAboutInfo(serviceProvider, runtimeInfo, windowingSubsystemName, renderingSubsystemName);
91+
editor.AboutInfo = aboutInfo;
92+
93+
94+
}
95+
96+
if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
97+
{
98+
singleViewPlatform.MainView = new MainView
99+
{
100+
DataContext = editor
101+
};
102+
}
103+
104+
base.OnFrameworkInitializationCompleted();
105+
}
106+
}

src/Core2D.Web.Base/Assets/Core2D.ico

99.9 KB
Binary file not shown.
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netstandard2.0</TargetFramework>
4+
<Nullable>enable</Nullable>
5+
<LangVersion>latest</LangVersion>
6+
<AvaloniaVersion>0.10.11-rc.2</AvaloniaVersion>
7+
<Core2DVersion>0.10.11-rc.2</Core2DVersion>
8+
<RootNamespace>Core2D.Web.Base</RootNamespace>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<AvaloniaResource Include="Assets\**" />
12+
</ItemGroup>
13+
<ItemGroup>
14+
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
15+
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
16+
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
17+
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
18+
</ItemGroup>
19+
<ItemGroup>
20+
<ProjectReference Include="..\Core2D\Core2D.csproj" />
21+
<ProjectReference Include="..\Core2D.Screenshot\Core2D.Screenshot.csproj" />
22+
<ProjectReference Include="..\Core2D.Core\Core2D.Core.csproj" />
23+
<ProjectReference Include="..\Core2D.Generators\Core2D.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
24+
<ProjectReference Include="..\Core2D.Modules.FileSystem.DotNet\Core2D.Modules.FileSystem.DotNet.csproj" />
25+
<ProjectReference Include="..\Core2D.Modules.FileWriter.Dxf\Core2D.Modules.FileWriter.Dxf.csproj" />
26+
<ProjectReference Include="..\Core2D.Modules.FileWriter.Emf\Core2D.Modules.FileWriter.Emf.csproj" />
27+
<ProjectReference Include="..\Core2D.Modules.FileWriter.SkiaSharp\Core2D.Modules.FileWriter.SkiaSharp.csproj" />
28+
<ProjectReference Include="..\Core2D.Modules.FileWriter.Svg\Core2D.Modules.FileWriter.Svg.csproj" />
29+
<ProjectReference Include="..\Core2D.Modules.FileWriter.Xaml\Core2D.Modules.FileWriter.Xaml.csproj" />
30+
<ProjectReference Include="..\Core2D.Modules.Log.Trace\Core2D.Modules.Log.Trace.csproj" />
31+
<ProjectReference Include="..\Core2D.Modules.Renderer.Avalonia\Core2D.Modules.Renderer.Avalonia.csproj" />
32+
<ProjectReference Include="..\Core2D.Modules.Renderer.Dxf\Core2D.Modules.Renderer.Dxf.csproj" />
33+
<ProjectReference Include="..\Core2D.Modules.Renderer.SkiaSharp\Core2D.Modules.Renderer.SkiaSharp.csproj" />
34+
<ProjectReference Include="..\Core2D.Modules.Renderer.WinForms\Core2D.Modules.Renderer.WinForms.csproj" />
35+
<ProjectReference Include="..\Core2D.Modules.ScriptRunner.Roslyn\Core2D.Modules.ScriptRunner.Roslyn.csproj" />
36+
<ProjectReference Include="..\Core2D.Modules.Serializer.Newtonsoft\Core2D.Modules.Serializer.Newtonsoft.csproj" />
37+
<ProjectReference Include="..\Core2D.Modules.ServiceProvider.Autofac\Core2D.Modules.ServiceProvider.Autofac.csproj" />
38+
<ProjectReference Include="..\Core2D.Modules.SvgExporter.Svg\Core2D.Modules.SvgExporter.Svg.csproj" />
39+
<ProjectReference Include="..\Core2D.Modules.TextFieldReader.CsvHelper\Core2D.Modules.TextFieldReader.CsvHelper.csproj" />
40+
<ProjectReference Include="..\Core2D.Modules.TextFieldReader.OpenXml\Core2D.Modules.TextFieldReader.OpenXml.csproj" />
41+
<ProjectReference Include="..\Core2D.Modules.TextFieldWriter.CsvHelper\Core2D.Modules.TextFieldWriter.CsvHelper.csproj" />
42+
<ProjectReference Include="..\Core2D.Modules.TextFieldWriter.OpenXml\Core2D.Modules.TextFieldWriter.OpenXml.csproj" />
43+
<ProjectReference Include="..\Core2D.Modules.XamlExporter.Avalonia\Core2D.Modules.XamlExporter.Avalonia.csproj" />
44+
</ItemGroup>
45+
</Project>

0 commit comments

Comments
 (0)