mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
4fbbca6a99dfd80cca293edd9762c6206b1d93a5
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4fbbca6a99 |
refactor(go): adopt modern stdlib idioms and gate them (#7831)
* refactor(go): adopt modern stdlib idioms across kernel and desktop Mechanical sweep with golangci-lint's modernize/intrange/copyloopvar/ usestdlibvars fixers plus hand-fixes for what they could not rewrite: slices.Contains, min/max, slices.Backward, WaitGroup.Go, reflect.TypeFor, maps.Copy, strings.Cut/CutPrefix/SplitSeq, strings.Builder, range-over-int. Net -549 lines with no behavior change. Three loops in session.go stay index-based: slices.Backward yields element copies, so the fixer's rewrite silently dropped writes to DecisionReceipts and ToolCalls (caught by TestDelivery* and TestDependentSameBatch*). All 49 slices.Backward sites were audited for that shape; only these three write through the index, and they carry a nolint with the reason. CaptureAfter's scan loop had an empty body and never ran any logic, so the fixer could not express it. Drop it and the accessor it was the only caller of. omitzero is deliberately untouched: turning omitempty into omitzero changes the JSON written for nested structs, which is a wire-format change to session files and the extension protocol. * build(lint): gate the modern-idiom linters Nothing stopped the codebase from drifting back to pre-1.22 idioms. Both modules are now clean for modernize, intrange, copyloopvar, and usestdlibvars, so enable them rather than leaving the sweep as a one-off. omitzero stays disabled with the reason inline; usetesting, perfsprint, and errorlint still have residue and land separately. |
||
|
|
a144e55e41 |
feat(desktop): add pane opacity control and fix base style revert on custom theme save / 新增面板透明度控制,修复自定义主题保存后基础风格回退 (#6645)
* feat(desktop): add pane opacity control and fix base style revert on custom theme save New feature — per-scene pane opacity (面板透明度): - ThemePackBackground / ThemePackSceneBackground gain a paneOpacity field (0-1) that controls how transparent the shell panels render when a theme pack is active. Home defaults to 0.50, task defaults to 0.68. - Independent sliders in ThemeGallery editor for both scenes. - applyBackgroundCSSVars pre-computes CSS variables (--theme-pane-alpha, --theme-pane-shell-pct, --theme-pane-task-*) for color-mix rules. - CSS rules under :root[data-theme-pack] apply pane opacity to sidebar, topicbar, dock, statusbar, chat-pane, composer-card, and transcript with cascading opacity tiers (shell < card < inner). - ThemePreviewSurface preview cards now reflect pane opacity. - Task background opacity caps relaxed from 0.45 to 1.0 per user demand. - All 8 official mock themes include paneOpacity: 0.50. - Schema and docs (EN/ZH) updated with paneOpacity field. Bug fix — base style revert on Save & apply: When ThemeGallery.saveEditor(activate=true) called activateThemePack(), the downstream onExperienceChange callback passed exp.baseStyle (the config-file appearance, e.g. graphite) to the parent's onThemeStyle. The parent then called applyTheme(theme, OLD_style) which overwrote the pack's baseStyle (e.g. refined) that applyThemePack had just set on the DOM. Fixes: - AppearanceOverview.onExperienceChange now syncs exp.effectiveStyle instead of exp.baseStyle, and no longer calls onTheme (which reads stale themeStyle from its closure). - SettingsPanel.onThemeStyle now reads the current theme from the DOM via getTheme() instead of the React closure theme state. - ThemeGallery.saveEditor moves cancelThemePreview() to only the non-activate branch; the activate path must not restore the preview snapshot after the new pack is applied. - themeExperience.activateThemePack calls clearPreviewSnapshotOnly() first so endPreviewIfAny() cannot overwrite the newly activated pack. - Layout transparency CSS selectors gain .app:not(.app--creation) to exclude the creation-mode surface. Test contract: - TestTaskOpacityCapped renamed to TestOpacityClamped, now validates the new 0-1 clamping and PaneOpacity defaults for both scenes. - 'layout background transparent' contract test updated to a single flexible regex that tolerates intermediate selectors. - i18n: taskBackgroundHint adjusted (removed stale 45% cap reference); new paneOpacity label in EN/ZH/ZH-TW. * fix(desktop): preserve theme pane transparency state Problem: - Explicit 0% pane opacity was replaced by legacy defaults. - Token-only theme packs received background transparency rules. - Failed theme activation discarded the reversible preview snapshot. Root cause: - A scalar JSON field could not distinguish omission from an explicit zero. - Extended pane selectors were scoped to any theme pack instead of packs with backgrounds. - The preview snapshot was cleared before persistence succeeded. Fix: - Represent pane opacity as an optional persisted value and preserve explicit zero through normalization and JSON round trips. - Guard background and pane transparency CSS with data-theme-has-bg. - Commit preview state only after successful activation and add focused regressions. Verification: - cd desktop && go test ./... - cd desktop/frontend && pnpm run test - cd desktop/frontend && pnpm run build - Browser DOM/CSS checks for token-only and background theme previews * fix(desktop): separate theme base state from pack effects Problem: - Applying a theme pack mirrored its effective style into the configured base appearance, so direct theme reset restored the pack style. - Pane opacity previews changed while live card surfaces remained fixed at 88%. Root cause: - The gallery callback reused the configured-style owner callback for a temporary effective style. - Card-tier CSS variables were computed but not consumed, and preview offsets differed from live formulas. Fix: - Synchronize configured base style only when no active pack owns the effective style. - Consume scene-specific card opacity variables in live surfaces and use the same formulas in previews. - Remove unused pane variables and add regressions for direct reset and opacity consumers. Verification: - cd desktop/frontend && pnpm run test - cd desktop/frontend && pnpm run build - cd desktop && go test ./... - Browser: Sage/Slate reset restored Graphite; live and preview card opacity matched scene variables * fix(desktop): preserve theme preview lifecycle Problem: - Save and apply closed the theme editor before activation completed, allowing unmount cleanup to restore the old preview snapshot. - Base and token-only gallery previews received background pane transparency that live surfaces do not apply. Root cause: - Editor teardown occurred before activateThemePack committed the preview. - Preview opacity variables were derived without checking whether the pack had a background. Fix: - Activate or cancel the preview before closing the editor and reloading the gallery. - Keep pane previews opaque when no theme background is present. - Add regressions for lifecycle ordering and preview opacity. Verification: - cd desktop/frontend && pnpm run test - cd desktop/frontend && pnpm run build - cd desktop && go test ./... - Browser preview check: base previews stayed opaque while background previews retained configured alpha * fix(desktop): keep theme activation and previews consistent Problem: - Save and apply persisted activation twice, so a later activation failure could split persistent state from the reversible preview. - Browser official-theme mocks used 50% pane opacity while embedded manifests fell back to legacy defaults. - Legacy task scene payloads without pane opacity did not inherit the home setting. Root cause: - ThemeGallery delegated activation to SaveThemePack and then called the experience activation controller again. - Official manifests omitted the new field, and the task fallback tested object presence instead of field presence. Fix: - Make the experience controller the sole owner of active-theme pointer updates after saving. - Declare 50% pane opacity in every official manifest and verify Wails/browser parity. - Use nullish field fallback for legacy task scenes and add regression coverage. Verification: - pnpm exec tsx src/__tests__/theme-pack.test.ts (230 passed) - pnpm run typecheck - pnpm run check:css - pnpm run test - pnpm run build - go test ./... --------- Co-authored-by: SivanCola <[email protected]> |
||
|
|
7f00d2c260 |
feat(desktop): Redesign theme experience with official packs / 主题体验改造与官方主题 (#6614)
* feat(desktop): Add Theme Pack V1 engine with theme library / 新增 Theme Pack V1 引擎与主题库 Controlled, non-executable desktop skins: semantic color tokens, density and corner recipes, and an optional local background image with focus and safe area. Includes manifest validation, atomic import with replace confirmation, content-addressed asset serving, live preview with cancel restore, density consumers, transparent layout under backgrounds, contrast warnings, and safe-mode fallback to Graphite. / 受控不可执行的桌面皮肤:语义色令牌、密度 与圆角配方、可选本地背景图(焦点与安全区)。包含清单校验、原子导入与覆盖 确认、内容寻址资源服务、可取消的实时预览、密度消费者、背景下布局透明化、 对比度警告与安全模式回退 Graphite。 * feat(desktop): Redesign theme experience with official packs / 主题体验改造与官方主题 Problem: Appearance settings exposed two competing base-style pickers and applied theme packs immediately on card click, while activeThemeId could store base style ids. Official skins and a gallery/overview IA were still missing. Root cause: Theme Pack V1 layered packs on top of desktop.theme_style without a unified state model or select-then-apply UX, so base styles, official themes, and user packs competed for the same controls. Fix: - Bump desktop-theme-state to schema v2: activeThemeId is official/user only; migrate legacy base-style active ids into desktop.theme_style. - Add GetThemeExperience, ActivateBaseStyle, DisableThemePack, and RestoreGraphiteAppearance; reject base ids in ActivateThemePack. - Embed eight official themes with fixed order, asset routing, and budgets. - Ship AppearanceOverview + ThemeGallery (select ≠ apply, temp preview, immersive detail) driven by themeExperience.ts. - Document the IA and provenance; keep procedural art as placeholders. Verification: - cd desktop && go test ./... - cd desktop/frontend && pnpm typecheck && pnpm test:all && pnpm build - wails generate module (bindings match, no drift) * feat(desktop): complete the theme gallery and editor experience Problem: The theme gallery still had fragmented preview actions, placeholder flagship art, generic base-style previews, and a minimal custom-theme dialog that could not tune semantic colors or independent scenes. Root cause: Theme Pack V1 modeled one background and the gallery treated selection, preview, and persistence as separate interactions without a shared localized editor state. Fix: Upgrade the pack contract compatibly to V2 with independent home and workspace scenes, rebuild the gallery around immediate reversible preview and explicit apply, add localized semantic color and scene controls, replace the eight official artworks, and align base-style previews and actions with the settings UI. Verification: - cd desktop && go test ./... - cd desktop/frontend && pnpm test:all - cd desktop/frontend && pnpm typecheck - cd desktop/frontend && pnpm check:css - cd desktop/frontend && pnpm build - Browser-verified Chinese and English labels, live preview, scene switching, and cancel restoration * fix(desktop): satisfy the full-module formatting gate Problem: The desktop CI job stopped before tests because its repository-wide gofmt check reported main.go and theme_assets.go. Root cause: The earlier theme integration left one struct field with manual alignment and one extra trailing blank line; package tests compile these files but do not enforce gofmt byte formatting. Fix: Run gofmt on both reported files without changing runtime behavior. Verification: - cd desktop && gofmt -l . - cd desktop && go test ./... * fix(desktop): clarify theme scene content placement Problem: The scene editor exposed a vague content-safe-area label without explaining that it controls foreground text and card placement. The desktop CI lint gate also found four empty or unused Theme Pack leftovers. Root cause: The persisted safeArea field was surfaced directly as user-facing copy, while placeholder branches and helpers remained after the Theme Pack integration. Fix: Rename the control to Interface content area, add localized guidance and radio semantics, and remove or complete the four lint findings without changing theme behavior. Verification: - cd desktop && go test ./... - cd desktop && go vet ./... - cd desktop/frontend && pnpm typecheck - cd desktop/frontend && pnpm check:css - cd desktop/frontend && pnpm test:all - cd desktop/frontend && pnpm build - Theme Pack contract: 195 passed - Verified the localized control in the running browser UI * fix(desktop): unify theme confirmation dialogs Problem: Theme deletion, replacement imports, and export-rights checks used window.confirm, which surfaced platform-native dialogs that did not match the Reasonix settings UI. Root cause: The Theme Pack flows lacked a reusable in-app confirmation primitive, so both the gallery and legacy library called the browser API directly. Fix: Add an accessible portal-based Reasonix confirmation dialog with danger styling, safe focus behavior, Escape and backdrop cancellation, and focus restoration. Migrate all six theme confirmation call sites and localize their titles and actions. Verification: - pnpm typecheck - pnpm check:css - pnpm test:all - pnpm build - Browser: delete confirmation stayed in-app, Cancel received focus, Escape restored focus, and the temporary theme was deleted without a native dialog * fix(desktop): restore theme preview and custom fonts Problem: - Custom UI and monospace fonts could no longer be configured from the redesigned appearance page. - Selecting a user theme updated details without starting the advertised global preview. Root cause: - AppearanceOverview discarded both custom font name callbacks and omitted their editors. - ThemeGallery limited non-immersive previews to the catalog tab. Fix: - Restore localized custom font editors and their persistence callbacks. - Preview every non-immersive theme selection, including user packs. - Add focused source-contract coverage for both behaviors. Verification: - pnpm test:all - pnpm build - pnpm check:css - Browser verification of custom font variables, user-pack preview, and Back restoration |