Compare commits

..

5 Commits

Author SHA1 Message Date
Zhang Dian
1aa0099531 fix: fix copilot comments. 2026-04-29 22:35:23 +08:00
Zhang Dian
5fef248f73 chore: enable CPM with single file. 2026-04-29 22:00:45 +08:00
Copilot
d2f789bdbd Add scheduled workflow to auto-remove old CI artifacts (#815)
* Initial plan

* Add workflow to remove old artifacts

Agent-Logs-Url: https://github.com/irihitech/Semi.Avalonia/sessions/ac7e9f88-0a15-4dfe-aae7-64cda4c5ad1e

Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>

* ci: add workflow_dispatch trigger to remove-old-artifacts.yml.

* ci: add remove-old-artifacts.yml to solution file.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Co-authored-by: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
2026-04-28 11:10:34 +08:00
Zhang Dian
d164acea21 feat: enhance navigation and UI structure in MainView and Application. (#811)
* feat: enhance navigation and UI structure in MainView and Application.

* feat: implement singleton pattern for PaletteDemoViewModel and add initialization check

* feat: set FontWeight to Normal for navigation button in MainView

---------

Co-authored-by: Dong Bin <popmessiah@hotmail.com>
2026-04-24 19:58:27 +08:00
Copilot
1f10fd680f Add git commit message convention under .github (#789) 2026-04-24 14:48:16 +08:00
12 changed files with 189 additions and 51 deletions

92
.github/COMMIT_CONVENTION.md vendored Normal file
View File

@@ -0,0 +1,92 @@
# Git Commit Message Convention
This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages.
## Format
```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```
## Types
| Type | Description |
|------|-------------|
| `feat` | A new feature |
| `fix` | A bug fix |
| `docs` | Documentation only changes |
| `style` | Changes that do not affect the meaning of the code (formatting, missing semicolons, etc.) |
| `refactor` | A code change that neither fixes a bug nor adds a feature |
| `perf` | A code change that improves performance |
| `test` | Adding missing tests or correcting existing tests |
| `build` | Changes that affect the build system or external dependencies |
| `ci` | Changes to CI configuration files and scripts |
| `chore` | Other changes that don't modify source or test files |
| `revert` | Reverts a previous commit |
## Rules
1. **Limit the subject line to 50 characters** (72 character hard limit)
2. **Use the imperative mood** in the subject line (e.g., "add feature" not "added feature")
3. **Do not end the subject line with a period**
4. **Use lowercase** for the description (e.g., "add feature" not "Add feature")
5. **Separate subject from body with a blank line**
6. **Wrap the body at 72 characters**
7. **Use the body to explain what and why**, not how
8. **Reference issues and pull requests** in the footer
## Scope
The scope should be the name of the package or area affected (e.g., `button`, `datepicker`, `theme`, `demo`).
## Examples
### Simple commit
```
feat(button): add loading state support
```
### Commit with body
```
fix(datepicker): correct month navigation overflow
When navigating past December, the month index wrapped to a
negative value instead of rolling over to January of the next year.
```
### Commit with breaking change
```
feat(theme)!: rename SemiColorPrimary to SemiColorBrand
BREAKING CHANGE: The token SemiColorPrimary has been renamed to
SemiColorBrand. Update all references in your custom theme files.
```
### Commit referencing an issue
```
fix(textbox): placeholder not visible in dark mode
Closes #123
```
## Breaking Changes
Breaking changes must be indicated by appending a `!` after the type/scope, or by including a `BREAKING CHANGE:` footer. Both methods may be used together.
## Revert Commits
When reverting a previous commit, use the `revert` type and reference the reverted commit SHA in the footer:
```
revert: feat(button): add loading state support
Revert commit a1b2c3d.
```

View File

@@ -0,0 +1,25 @@
name: Remove old artifacts
on:
schedule:
# Every day at 1am
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
remove-old-artifacts:
runs-on: ubuntu-latest
timeout-minutes: 10
# For private repos
permissions:
actions: write
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '15 days' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js
# Optional inputs
skip-tags: true
skip-recent: 5

26
Directory.Packages.props Normal file
View File

@@ -0,0 +1,26 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageVersionOverrideEnabled>true</CentralPackageVersionOverrideEnabled>
<AvaloniaVersion>12.0.1</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<!--src-->
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0"/>
<!--demo-->
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2"/>
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.2"/>
</ItemGroup>
</Project>

View File

@@ -12,13 +12,18 @@
<File Path=".github/workflows/pack.yml"/> <File Path=".github/workflows/pack.yml"/>
<File Path=".github/workflows/publish.yml"/> <File Path=".github/workflows/publish.yml"/>
<File Path=".github/workflows/release-tag.yml"/> <File Path=".github/workflows/release-tag.yml"/>
<File Path=".github/workflows/remove-old-artifacts.yml"/>
</Folder>
<Folder Name="/Solution Items/">
<File Path="Directory.Packages.props"/>
<File Path="global.json"/>
<File Path="Nuget.Config"/>
</Folder> </Folder>
<Folder Name="/Solution Items/Demo/"> <Folder Name="/Solution Items/Demo/">
<File Path="demo/Directory.Packages.props"/> <File Path="demo/Directory.Build.targets"/>
<File Path="demo/global.json"/> <File Path="demo/global.json"/>
</Folder> </Folder>
<Folder Name="/Solution Items/Package/"> <Folder Name="/Solution Items/Src/">
<File Path="src/Directory.Packages.props"/>
<File Path="src/Directory.Build.props"/> <File Path="src/Directory.Build.props"/>
</Folder> </Folder>
<Project Path="src/Semi.Avalonia.ColorPicker/Semi.Avalonia.ColorPicker.csproj"/> <Project Path="src/Semi.Avalonia.ColorPicker/Semi.Avalonia.ColorPicker.csproj"/>

View File

@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>12.0.2</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Avalonia" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Android" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Browser" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Desktop" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.iOS" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.LinuxFramebuffer" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Controls.ColorPicker" VersionOverride="$(AvaloniaVersion)"/>
<PackageReference Update="Avalonia.Controls.DataGrid" VersionOverride="$(DataGridVersion)"/>
</ItemGroup>
</Project>

View File

@@ -1,26 +0,0 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.1</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
<SkiaSharpVersion>3.119.3-preview.1.1</SkiaSharpVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.0-beta3"/>
<PackageVersion Include="SkiaSharp" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="$(SkiaSharpVersion)"/>
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.2.0.2"/>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2"/>
</ItemGroup>
</Project>

View File

@@ -12,8 +12,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia.Browser"/> <PackageReference Include="Avalonia.Browser"/>
<PackageReference Include="SkiaSharp"/>
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -28,6 +28,15 @@
CommandParameter="{Binding $self.Header}" /> CommandParameter="{Binding $self.Header}" />
</NativeMenu> </NativeMenu>
</NativeMenu.Menu> </NativeMenu.Menu>
<NativeDock.Menu>
<NativeMenu>
<NativeMenuItem Header="New Window" />
<NativeMenuItemSeparator />
<NativeMenuItem Header="Show Main Window" />
<NativeMenuItemSeparator />
<NativeMenuItem Header="Add Dock Menu Item" />
</NativeMenu>
</NativeDock.Menu>
<TrayIcon.Icons> <TrayIcon.Icons>
<TrayIcons> <TrayIcons>
<TrayIcon <TrayIcon
@@ -49,4 +58,4 @@
</TrayIcon> </TrayIcon>
</TrayIcons> </TrayIcons>
</TrayIcon.Icons> </TrayIcon.Icons>
</Application> </Application>

View File

@@ -12,14 +12,16 @@ public partial class PaletteDemo : UserControl
public PaletteDemo() public PaletteDemo()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new PaletteDemoViewModel(); this.DataContext = PaletteDemoViewModel.Instance.Value;
} }
protected override async void OnApplyTemplate(TemplateAppliedEventArgs e) protected override async void OnApplyTemplate(TemplateAppliedEventArgs e)
{ {
base.OnApplyTemplate(e); base.OnApplyTemplate(e);
PaletteDemoViewModel? vm = this.DataContext as PaletteDemoViewModel; if (this.DataContext is PaletteDemoViewModel vm && !vm.IsInitialized)
await Dispatcher.UIThread.InvokeAsync(() => { vm?.InitializeResources(); }); {
await Dispatcher.UIThread.InvokeAsync(() => { vm?.InitializeResources(); });
}
} }
public async Task Copy(object? o) public async Task Copy(object? o)
@@ -31,4 +33,4 @@ public partial class PaletteDemo : UserControl
await c.SetTextAsync(o.ToString()); await c.SetTextAsync(o.ToString());
} }
} }
} }

View File

@@ -14,6 +14,8 @@ namespace Semi.Avalonia.Demo.ViewModels;
public partial class PaletteDemoViewModel : ObservableObject public partial class PaletteDemoViewModel : ObservableObject
{ {
public static Lazy<PaletteDemoViewModel> Instance { get; } = new(() => new PaletteDemoViewModel());
public bool IsInitialized { get; private set; }
private readonly string[] _predefinedColorNames = private readonly string[] _predefinedColorNames =
[ [
"Red", "Pink", "Purple", "Violet", "Indigo", "Red", "Pink", "Purple", "Violet", "Indigo",
@@ -44,6 +46,7 @@ public partial class PaletteDemoViewModel : ObservableObject
InitializePalette(); InitializePalette();
InitializeFunctionalColors(); InitializeFunctionalColors();
InitializeShadows(); InitializeShadows();
IsInitialized = true;
} }
private void InitializePalette() private void InitializePalette()
@@ -289,4 +292,4 @@ public partial class ShadowGroupViewModel : ObservableObject
} }
} }
} }
} }

View File

@@ -83,6 +83,7 @@
<Border Classes="NavItemHost" Classes.Selected="{Binding IsSelected}"> <Border Classes="NavItemHost" Classes.Selected="{Binding IsSelected}">
<Button <Button
Classes="NavItem" Classes="NavItem"
FontWeight="Normal"
Classes.Selected="{Binding IsSelected}" Classes.Selected="{Binding IsSelected}"
Command="{Binding NavigateCommand}" Command="{Binding NavigateCommand}"
CommandParameter="{Binding}" CommandParameter="{Binding}"

View File

@@ -1,14 +0,0 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>12.0.1</AvaloniaVersion>
<DataGridVersion>12.0.0</DataGridVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)"/>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(DataGridVersion)"/>
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1"/>
<PackageVersion Include="Irihi.Avalonia.Shared" Version="0.4.0"/>
</ItemGroup>
</Project>