Compare commits

..

1 Commits

Author SHA1 Message Date
Zhang Dian
496aef2126 feat: enhance navigation and UI structure in MainView and Application. 2026-04-24 14:32:48 +08:00
4 changed files with 5 additions and 103 deletions

View File

@@ -1,92 +0,0 @@
# 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

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

View File

@@ -14,8 +14,6 @@ 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",
@@ -46,7 +44,6 @@ public partial class PaletteDemoViewModel : ObservableObject
InitializePalette(); InitializePalette();
InitializeFunctionalColors(); InitializeFunctionalColors();
InitializeShadows(); InitializeShadows();
IsInitialized = true;
} }
private void InitializePalette() private void InitializePalette()
@@ -292,4 +289,4 @@ public partial class ShadowGroupViewModel : ObservableObject
} }
} }
} }
} }

View File

@@ -83,7 +83,6 @@
<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}"