@adea-ai/app-framework 0.0.0-stage → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +30 -0
- package/README.md +967 -2
- package/dist/app/application.d.ts +47 -0
- package/dist/app/application.js +115 -0
- package/dist/app/create-application.d.ts +13 -0
- package/dist/app/create-application.js +178 -0
- package/dist/app/service-registry.d.ts +44 -0
- package/dist/app/service-registry.js +116 -0
- package/dist/appearance/appearance-host.d.ts +62 -0
- package/dist/appearance/appearance-host.js +115 -0
- package/dist/appearance/appearance-preferences.d.ts +106 -0
- package/dist/appearance/appearance-preferences.js +175 -0
- package/dist/appearance/composition.d.ts +11 -0
- package/dist/appearance/composition.js +16 -0
- package/dist/appearance/custom-theme-import.d.ts +14 -0
- package/dist/appearance/custom-theme-import.js +315 -0
- package/dist/appearance/custom-theme-library.d.ts +146 -0
- package/dist/appearance/custom-theme-library.js +378 -0
- package/dist/appearance/editor.d.ts +20 -0
- package/dist/appearance/editor.js +47 -0
- package/dist/appearance/theme-file-importer.d.ts +23 -0
- package/dist/appearance/theme-file-importer.js +66 -0
- package/dist/appearance/theme-record-adapter.d.ts +26 -0
- package/dist/appearance/theme-record-adapter.js +64 -0
- package/dist/appearance/theme-registry.d.ts +10 -0
- package/dist/appearance/theme-registry.js +16 -0
- package/dist/appearance/window-surface.d.ts +5 -0
- package/dist/appearance/window-surface.js +9 -0
- package/dist/ci/toolchain-identity.d.ts +39 -0
- package/dist/ci/toolchain-identity.js +196 -0
- package/dist/cli/cef-helper-cli.d.ts +2 -0
- package/dist/cli/cef-helper-cli.js +18 -0
- package/dist/cli/cli-runner.d.ts +8 -0
- package/dist/cli/cli-runner.js +23 -0
- package/dist/cli/create-application-cli.d.ts +2 -0
- package/dist/cli/create-application-cli.js +40 -0
- package/dist/cli/electrobun-shortcut-patch-cli.d.ts +2 -0
- package/dist/cli/electrobun-shortcut-patch-cli.js +17 -0
- package/dist/cli/framework-update-cli.d.ts +2 -0
- package/dist/cli/framework-update-cli.js +40 -0
- package/dist/cli/release-assets-plan-cli.d.ts +2 -0
- package/dist/cli/release-assets-plan-cli.js +14 -0
- package/dist/cli/release-cut-cli.d.ts +2 -0
- package/dist/cli/release-cut-cli.js +27 -0
- package/dist/cli/release-descriptor-staging-cli.d.ts +2 -0
- package/dist/cli/release-descriptor-staging-cli.js +45 -0
- package/dist/cli/release-finalize-cli.d.ts +1 -0
- package/dist/cli/release-finalize-cli.js +30 -0
- package/dist/cli/release-promote-cli.d.ts +2 -0
- package/dist/cli/release-promote-cli.js +32 -0
- package/dist/cli/release-publish-cli.d.ts +2 -0
- package/dist/cli/release-publish-cli.js +48 -0
- package/dist/cli/release-sign-cli.d.ts +2 -0
- package/dist/cli/release-sign-cli.js +13 -0
- package/dist/cli/release-step-cli.d.ts +2 -0
- package/dist/cli/release-step-cli.js +44 -0
- package/dist/cli/toolchain-identity-cli.d.ts +2 -0
- package/dist/cli/toolchain-identity-cli.js +10 -0
- package/dist/cli/update-helper-cli.d.ts +1 -0
- package/dist/cli/update-helper-cli.js +10 -0
- package/dist/cli/windows-runtime-patch-cli.d.ts +2 -0
- package/dist/cli/windows-runtime-patch-cli.js +17 -0
- package/dist/desktop/application-command-client.d.ts +15 -0
- package/dist/desktop/application-command-client.js +21 -0
- package/dist/desktop/channel-handshake.d.ts +32 -0
- package/dist/desktop/channel-handshake.js +111 -0
- package/dist/desktop/channel-proof.d.ts +43 -0
- package/dist/desktop/channel-proof.js +85 -0
- package/dist/desktop/client-assets.d.ts +7 -0
- package/dist/desktop/client-assets.js +59 -0
- package/dist/desktop/desktop-client.d.ts +23 -0
- package/dist/desktop/desktop-client.js +231 -0
- package/dist/desktop/desktop-gateway.d.ts +18 -0
- package/dist/desktop/desktop-gateway.js +146 -0
- package/dist/desktop/desktop-host.d.ts +48 -0
- package/dist/desktop/desktop-host.js +208 -0
- package/dist/desktop/desktop-stream.d.ts +36 -0
- package/dist/desktop/desktop-stream.js +231 -0
- package/dist/desktop/loopback-policy.d.ts +19 -0
- package/dist/desktop/loopback-policy.js +23 -0
- package/dist/desktop/open-url-channel.d.ts +15 -0
- package/dist/desktop/open-url-channel.js +55 -0
- package/dist/desktop/string-policy.d.ts +2 -0
- package/dist/desktop/string-policy.js +11 -0
- package/dist/framework-source.json +1 -0
- package/dist/installer/archive-entry.d.ts +6 -0
- package/dist/installer/archive-entry.js +14 -0
- package/dist/installer/command-artifact.d.ts +47 -0
- package/dist/installer/command-artifact.js +261 -0
- package/dist/installer/command-qualification-command.d.ts +12 -0
- package/dist/installer/command-qualification-command.js +71 -0
- package/dist/installer/hosted-runner.d.ts +4 -0
- package/dist/installer/hosted-runner.js +10 -0
- package/dist/installer/installed-payload.d.ts +29 -0
- package/dist/installer/installed-payload.js +312 -0
- package/dist/installer/installer-ci-bootstrap.d.ts +26 -0
- package/dist/installer/installer-ci-bootstrap.js +160 -0
- package/dist/installer/installer-ci-preflight.d.ts +1 -0
- package/dist/installer/installer-ci-preflight.js +49 -0
- package/dist/installer/installer-ci-worker.d.ts +1 -0
- package/dist/installer/installer-ci-worker.js +105 -0
- package/dist/installer/installer-extraction.d.ts +14 -0
- package/dist/installer/installer-extraction.js +289 -0
- package/dist/installer/installer-fetch-guard.d.ts +15 -0
- package/dist/installer/installer-fetch-guard.js +50 -0
- package/dist/installer/installer-identity.d.ts +23 -0
- package/dist/installer/installer-identity.js +286 -0
- package/dist/installer/installer-layout.d.ts +21 -0
- package/dist/installer/installer-layout.js +89 -0
- package/dist/installer/installer-observation.d.ts +64 -0
- package/dist/installer/installer-observation.js +473 -0
- package/dist/installer/installer-process-cleanup.d.ts +18 -0
- package/dist/installer/installer-process-cleanup.js +158 -0
- package/dist/installer/installer-qualification-command.d.ts +11 -0
- package/dist/installer/installer-qualification-command.js +71 -0
- package/dist/installer/installer-renderer-evidence.d.ts +43 -0
- package/dist/installer/installer-renderer-evidence.js +136 -0
- package/dist/installer/installer-upgrade-command.d.ts +37 -0
- package/dist/installer/installer-upgrade-command.js +172 -0
- package/dist/installer/installer-worker-guard.d.ts +21 -0
- package/dist/installer/installer-worker-guard.js +72 -0
- package/dist/installer/native-executable.d.ts +5 -0
- package/dist/installer/native-executable.js +21 -0
- package/dist/installer/upgrade-asset-download.d.ts +13 -0
- package/dist/installer/upgrade-asset-download.js +41 -0
- package/dist/installer/write-all.d.ts +6 -0
- package/dist/installer/write-all.js +11 -0
- package/dist/native/app-bundle.d.ts +28 -0
- package/dist/native/app-bundle.js +60 -0
- package/dist/native/cef-helper.d.ts +28 -0
- package/dist/native/cef-helper.js +402 -0
- package/dist/native/desktop-build-hook.d.ts +7 -0
- package/dist/native/desktop-build-hook.js +20 -0
- package/dist/native/electrobun-source-patch.d.ts +25 -0
- package/dist/native/electrobun-source-patch.js +93 -0
- package/dist/native/linux-cef-links.d.ts +2 -0
- package/dist/native/linux-cef-links.js +15 -0
- package/dist/native/native-secret-store.d.ts +27 -0
- package/dist/native/native-secret-store.js +70 -0
- package/dist/native/native-utilities.d.ts +24 -0
- package/dist/native/native-utilities.js +85 -0
- package/dist/native/partitioned-window.d.ts +34 -0
- package/dist/native/partitioned-window.js +44 -0
- package/dist/native/renderer-profile.d.ts +53 -0
- package/dist/native/renderer-profile.js +30 -0
- package/dist/native/secure-window.d.ts +38 -0
- package/dist/native/secure-window.js +77 -0
- package/dist/native/sidecar-services.d.ts +23 -0
- package/dist/native/sidecar-services.js +46 -0
- package/dist/native/sidecar.d.ts +81 -0
- package/dist/native/sidecar.js +250 -0
- package/dist/native/window-bootstrap.d.ts +24 -0
- package/dist/native/window-bootstrap.js +63 -0
- package/dist/native/window-options.d.ts +32 -0
- package/dist/native/window-options.js +23 -0
- package/dist/native/windows-build-hook-internal.d.ts +2 -0
- package/dist/native/windows-build-hook-internal.js +32 -0
- package/dist/native/windows-build-hook.d.ts +2 -0
- package/dist/native/windows-build-hook.js +12 -0
- package/dist/native/windows-runtime-patch-internal.d.ts +3 -0
- package/dist/native/windows-runtime-patch-internal.js +20 -0
- package/dist/native/windows-runtime-patch.d.ts +4 -0
- package/dist/native/windows-runtime-patch.js +12 -0
- package/dist/release/feed-release-cut.d.ts +23 -0
- package/dist/release/feed-release-cut.js +93 -0
- package/dist/release/feed-state.d.ts +25 -0
- package/dist/release/feed-state.js +81 -0
- package/dist/release/framework-package-publish.d.ts +21 -0
- package/dist/release/framework-package-publish.js +125 -0
- package/dist/release/framework-update.d.ts +30 -0
- package/dist/release/framework-update.js +139 -0
- package/dist/release/github-cli.d.ts +6 -0
- package/dist/release/github-cli.js +16 -0
- package/dist/release/github-release-assets.d.ts +3 -0
- package/dist/release/github-release-assets.js +24 -0
- package/dist/release/github-release-cut.d.ts +14 -0
- package/dist/release/github-release-cut.js +174 -0
- package/dist/release/github-release-lookup.d.ts +7 -0
- package/dist/release/github-release-lookup.js +29 -0
- package/dist/release/github-release-promotion.d.ts +10 -0
- package/dist/release/github-release-promotion.js +78 -0
- package/dist/release/github-release-provenance.d.ts +9 -0
- package/dist/release/github-release-provenance.js +27 -0
- package/dist/release/github-release-publisher.d.ts +9 -0
- package/dist/release/github-release-publisher.js +63 -0
- package/dist/release/github-release-qualification.d.ts +12 -0
- package/dist/release/github-release-qualification.js +80 -0
- package/dist/release/local-provenance.d.ts +24 -0
- package/dist/release/local-provenance.js +72 -0
- package/dist/release/local-release.d.ts +133 -0
- package/dist/release/local-release.js +387 -0
- package/dist/release/macos-dmg.d.ts +22 -0
- package/dist/release/macos-dmg.js +91 -0
- package/dist/release/release-artifact.d.ts +6 -0
- package/dist/release/release-artifact.js +38 -0
- package/dist/release/release-assets-plan.d.ts +14 -0
- package/dist/release/release-assets-plan.js +65 -0
- package/dist/release/release-config.d.ts +76 -0
- package/dist/release/release-config.js +180 -0
- package/dist/release/release-cut-command.d.ts +13 -0
- package/dist/release/release-cut-command.js +39 -0
- package/dist/release/release-cut.d.ts +54 -0
- package/dist/release/release-cut.js +76 -0
- package/dist/release/release-descriptor-staging.d.ts +34 -0
- package/dist/release/release-descriptor-staging.js +147 -0
- package/dist/release/release-finalize.d.ts +16 -0
- package/dist/release/release-finalize.js +104 -0
- package/dist/release/release-promotion-command.d.ts +12 -0
- package/dist/release/release-promotion-command.js +28 -0
- package/dist/release/release-promotion.d.ts +29 -0
- package/dist/release/release-promotion.js +57 -0
- package/dist/release/release-publication.d.ts +33 -0
- package/dist/release/release-publication.js +138 -0
- package/dist/release/release-publish-command.d.ts +7 -0
- package/dist/release/release-publish-command.js +91 -0
- package/dist/release/release-qualification.d.ts +106 -0
- package/dist/release/release-qualification.js +135 -0
- package/dist/release/release-staging.d.ts +9 -0
- package/dist/release/release-staging.js +61 -0
- package/dist/release/release-steps.d.ts +38 -0
- package/dist/release/release-steps.js +147 -0
- package/dist/release/retained-release-build.d.ts +19 -0
- package/dist/release/retained-release-build.js +122 -0
- package/dist/shell/app-shell.d.ts +61 -0
- package/dist/shell/app-shell.js +318 -0
- package/dist/shell/app-utilities.d.ts +122 -0
- package/dist/shell/app-utilities.js +334 -0
- package/dist/shell/application-menu-commands.d.ts +5 -0
- package/dist/shell/application-menu-commands.js +11 -0
- package/dist/shell/application-menu.d.ts +61 -0
- package/dist/shell/application-menu.js +208 -0
- package/dist/shell/help-shortcuts.d.ts +12 -0
- package/dist/shell/help-shortcuts.js +22 -0
- package/dist/shell/settings-sections.d.ts +31 -0
- package/dist/shell/settings-sections.js +50 -0
- package/dist/shell/shortcut-platform.d.ts +17 -0
- package/dist/shell/shortcut-platform.js +25 -0
- package/dist/update-helper.bundle.js +260 -0
- package/dist/updates/channel-update-manager.d.ts +46 -0
- package/dist/updates/channel-update-manager.js +114 -0
- package/dist/updates/desktop-updater.d.ts +104 -0
- package/dist/updates/desktop-updater.js +345 -0
- package/dist/updates/release-feed.d.ts +61 -0
- package/dist/updates/release-feed.js +111 -0
- package/dist/updates/release-location.d.ts +9 -0
- package/dist/updates/release-location.js +80 -0
- package/dist/updates/release-version.d.ts +12 -0
- package/dist/updates/release-version.js +43 -0
- package/dist/updates/signed-release.d.ts +63 -0
- package/dist/updates/signed-release.js +162 -0
- package/dist/updates/stable-file.d.ts +10 -0
- package/dist/updates/stable-file.js +22 -0
- package/dist/updates/update-adapter.d.ts +57 -0
- package/dist/updates/update-adapter.js +72 -0
- package/dist/updates/update-arm.d.ts +24 -0
- package/dist/updates/update-arm.js +95 -0
- package/dist/updates/update-channel-store.d.ts +8 -0
- package/dist/updates/update-channel-store.js +72 -0
- package/dist/updates/update-discovery.d.ts +13 -0
- package/dist/updates/update-discovery.js +56 -0
- package/dist/updates/update-download.d.ts +14 -0
- package/dist/updates/update-download.js +67 -0
- package/dist/updates/update-exclusive-rename.d.ts +2 -0
- package/dist/updates/update-exclusive-rename.js +52 -0
- package/dist/updates/update-extraction.d.ts +18 -0
- package/dist/updates/update-extraction.js +183 -0
- package/dist/updates/update-handoff-plan.d.ts +22 -0
- package/dist/updates/update-handoff-plan.js +28 -0
- package/dist/updates/update-helper.d.ts +24 -0
- package/dist/updates/update-helper.js +56 -0
- package/dist/updates/update-launch.d.ts +5 -0
- package/dist/updates/update-launch.js +27 -0
- package/dist/updates/update-manager.d.ts +40 -0
- package/dist/updates/update-manager.js +83 -0
- package/dist/updates/update-process-fence.d.ts +10 -0
- package/dist/updates/update-process-fence.js +114 -0
- package/dist/updates/update-resume.d.ts +13 -0
- package/dist/updates/update-resume.js +34 -0
- package/dist/updates/update-shutdown.d.ts +15 -0
- package/dist/updates/update-shutdown.js +29 -0
- package/dist/updates/update-state.d.ts +30 -0
- package/dist/updates/update-state.js +18 -0
- package/dist/updates/update-swap-stage.d.ts +27 -0
- package/dist/updates/update-swap-stage.js +58 -0
- package/dist/updates/update-swap.d.ts +10 -0
- package/dist/updates/update-swap.js +30 -0
- package/dist/views/app-about.d.ts +22 -0
- package/dist/views/app-about.js +43 -0
- package/dist/views/app-appearance.d.ts +11 -0
- package/dist/views/app-appearance.js +42 -0
- package/dist/views/app-help.d.ts +17 -0
- package/dist/views/app-help.js +42 -0
- package/dist/views/app-settings.d.ts +26 -0
- package/dist/views/app-settings.js +97 -0
- package/dist/views/appearance-surface.d.ts +9 -0
- package/dist/views/appearance-surface.js +334 -0
- package/dist/views/update-surface.d.ts +34 -0
- package/dist/views/update-surface.js +64 -0
- package/package.json +363 -4
- package/src/app/application.tsx +138 -0
- package/src/app/create-application.ts +245 -0
- package/src/app/service-registry.ts +124 -0
- package/src/appearance/appearance-host.tsx +205 -0
- package/src/appearance/appearance-preferences.ts +287 -0
- package/src/appearance/composition.ts +29 -0
- package/src/appearance/custom-theme-import.ts +424 -0
- package/src/appearance/custom-theme-library.ts +600 -0
- package/src/appearance/editor.ts +94 -0
- package/src/appearance/theme-file-importer.ts +103 -0
- package/src/appearance/theme-record-adapter.ts +106 -0
- package/src/appearance/theme-registry.ts +20 -0
- package/src/appearance/window-surface.ts +18 -0
- package/src/ci/toolchain-identity.ts +244 -0
- package/src/cli/cef-helper-cli.ts +21 -0
- package/src/cli/cli-runner.ts +29 -0
- package/src/cli/create-application-cli.ts +62 -0
- package/src/cli/electrobun-shortcut-patch-cli.ts +24 -0
- package/src/cli/framework-update-cli.ts +41 -0
- package/src/cli/release-assets-plan-cli.ts +14 -0
- package/src/cli/release-cut-cli.ts +41 -0
- package/src/cli/release-descriptor-staging-cli.ts +57 -0
- package/src/cli/release-finalize-cli.ts +34 -0
- package/src/cli/release-promote-cli.ts +31 -0
- package/src/cli/release-publish-cli.ts +46 -0
- package/src/cli/release-sign-cli.ts +24 -0
- package/src/cli/release-step-cli.ts +71 -0
- package/src/cli/toolchain-identity-cli.ts +12 -0
- package/src/cli/update-helper-cli.ts +12 -0
- package/src/cli/windows-runtime-patch-cli.ts +17 -0
- package/src/desktop/application-command-client.ts +43 -0
- package/src/desktop/channel-handshake.ts +136 -0
- package/src/desktop/channel-proof.ts +122 -0
- package/src/desktop/client-assets.ts +75 -0
- package/src/desktop/desktop-client.ts +303 -0
- package/src/desktop/desktop-gateway.ts +189 -0
- package/src/desktop/desktop-host.ts +335 -0
- package/src/desktop/desktop-stream.ts +324 -0
- package/src/desktop/loopback-policy.ts +41 -0
- package/src/desktop/open-url-channel.ts +79 -0
- package/src/desktop/string-policy.ts +9 -0
- package/src/installer/archive-entry.ts +32 -0
- package/src/installer/command-artifact.ts +307 -0
- package/src/installer/command-qualification-command.ts +75 -0
- package/src/installer/hosted-runner.ts +11 -0
- package/src/installer/installed-payload.ts +408 -0
- package/src/installer/installer-ci-bootstrap.ts +199 -0
- package/src/installer/installer-ci-preflight.ts +61 -0
- package/src/installer/installer-ci-worker.ts +105 -0
- package/src/installer/installer-extraction.ts +367 -0
- package/src/installer/installer-fetch-guard.ts +75 -0
- package/src/installer/installer-identity.ts +331 -0
- package/src/installer/installer-layout.ts +167 -0
- package/src/installer/installer-observation.ts +671 -0
- package/src/installer/installer-process-cleanup.ts +167 -0
- package/src/installer/installer-qualification-command.ts +81 -0
- package/src/installer/installer-renderer-evidence.ts +268 -0
- package/src/installer/installer-upgrade-command.ts +226 -0
- package/src/installer/installer-worker-guard.ts +112 -0
- package/src/installer/native-executable.ts +37 -0
- package/src/installer/upgrade-asset-download.ts +72 -0
- package/src/installer/write-all.ts +19 -0
- package/src/native/app-bundle.ts +86 -0
- package/src/native/cef-helper.ts +471 -0
- package/src/native/desktop-build-hook.ts +21 -0
- package/src/native/electrobun-cef-main-frame-bridges.patch +63 -0
- package/src/native/electrobun-source-patch.ts +107 -0
- package/src/native/electrobun-windows-shortcut-com.patch +923 -0
- package/src/native/linux-cef-links.ts +14 -0
- package/src/native/native-secret-store.ts +99 -0
- package/src/native/native-utilities.ts +166 -0
- package/src/native/partitioned-window.ts +62 -0
- package/src/native/renderer-profile.ts +27 -0
- package/src/native/secure-window.ts +115 -0
- package/src/native/sidecar-services.ts +71 -0
- package/src/native/sidecar.ts +387 -0
- package/src/native/window-bootstrap.ts +77 -0
- package/src/native/window-options.ts +24 -0
- package/src/native/windows-build-hook-internal.ts +49 -0
- package/src/native/windows-build-hook.ts +12 -0
- package/src/native/windows-runtime-patch-internal.ts +48 -0
- package/src/native/windows-runtime-patch.ts +15 -0
- package/src/release/feed-release-cut.ts +110 -0
- package/src/release/feed-state.ts +135 -0
- package/src/release/framework-package-publish.ts +163 -0
- package/src/release/framework-update.ts +196 -0
- package/src/release/github-cli.ts +27 -0
- package/src/release/github-release-assets.ts +36 -0
- package/src/release/github-release-cut.ts +237 -0
- package/src/release/github-release-lookup.ts +39 -0
- package/src/release/github-release-promotion.ts +112 -0
- package/src/release/github-release-provenance.ts +65 -0
- package/src/release/github-release-publisher.ts +90 -0
- package/src/release/github-release-qualification.ts +144 -0
- package/src/release/local-provenance.ts +92 -0
- package/src/release/local-release.ts +525 -0
- package/src/release/macos-dmg.ts +113 -0
- package/src/release/release-artifact.ts +53 -0
- package/src/release/release-assets-plan.ts +118 -0
- package/src/release/release-config.ts +420 -0
- package/src/release/release-cut-command.ts +80 -0
- package/src/release/release-cut.ts +133 -0
- package/src/release/release-descriptor-staging.ts +242 -0
- package/src/release/release-finalize.ts +191 -0
- package/src/release/release-promotion-command.ts +36 -0
- package/src/release/release-promotion.ts +132 -0
- package/src/release/release-publication.ts +213 -0
- package/src/release/release-publish-command.ts +163 -0
- package/src/release/release-qualification.ts +397 -0
- package/src/release/release-staging.ts +87 -0
- package/src/release/release-steps.ts +173 -0
- package/src/release/retained-release-build.ts +217 -0
- package/src/shell/app-shell.tsx +285 -0
- package/src/shell/app-utilities.tsx +437 -0
- package/src/shell/application-menu-commands.ts +6 -0
- package/src/shell/application-menu.ts +250 -0
- package/src/shell/help-shortcuts.ts +24 -0
- package/src/shell/settings-sections.ts +74 -0
- package/src/shell/shortcut-platform.ts +35 -0
- package/src/updates/channel-update-manager.ts +127 -0
- package/src/updates/desktop-updater.ts +440 -0
- package/src/updates/release-feed.ts +187 -0
- package/src/updates/release-location.ts +101 -0
- package/src/updates/release-version.ts +57 -0
- package/src/updates/signed-release.ts +311 -0
- package/src/updates/stable-file.ts +32 -0
- package/src/updates/update-adapter.ts +129 -0
- package/src/updates/update-arm.ts +107 -0
- package/src/updates/update-channel-store.ts +86 -0
- package/src/updates/update-discovery.ts +113 -0
- package/src/updates/update-download.ts +82 -0
- package/src/updates/update-exclusive-rename.ts +58 -0
- package/src/updates/update-extraction.ts +261 -0
- package/src/updates/update-handoff-plan.ts +75 -0
- package/src/updates/update-helper.ts +87 -0
- package/src/updates/update-launch.ts +33 -0
- package/src/updates/update-manager.ts +130 -0
- package/src/updates/update-process-fence.ts +125 -0
- package/src/updates/update-resume.ts +34 -0
- package/src/updates/update-shutdown.ts +37 -0
- package/src/updates/update-state.ts +34 -0
- package/src/updates/update-swap-stage.ts +75 -0
- package/src/updates/update-swap.ts +30 -0
- package/src/views/app-about.tsx +44 -0
- package/src/views/app-appearance.tsx +32 -0
- package/src/views/app-help.tsx +43 -0
- package/src/views/app-settings.tsx +88 -0
- package/src/views/appearance-surface.tsx +427 -0
- package/src/views/update-surface.tsx +85 -0
- package/templates/application/.gitattributes +1 -0
- package/templates/application/.github/workflows/release-assets.yml +29 -0
- package/templates/application/.github/workflows/release-finalize.yml +29 -0
- package/templates/application/.github/workflows/release-please.yml +19 -0
- package/templates/application/.github/workflows/release.yml +29 -0
- package/templates/application/.github/workflows/validation.yml +28 -0
- package/templates/application/.oxfmtrc.json +6 -0
- package/templates/application/.oxlintrc.json +48 -0
- package/templates/application/.release-please-manifest.json +3 -0
- package/templates/application/README.md +47 -0
- package/templates/application/electrobun.config.ts +22 -0
- package/templates/application/release-please-config.json +12 -0
- package/templates/application/scripts/app-version.ts +9 -0
- package/templates/application/scripts/build-desktop.ts +34 -0
- package/templates/application/scripts/secure-build.ts +1 -0
- package/templates/application/scripts/stage-release.ts +21 -0
- package/templates/application/src/bun/index.ts +80 -0
- package/templates/application/src/electrobun.d.ts +27 -0
- package/templates/application/src/web/index.html +12 -0
- package/templates/application/src/web/main.tsx +97 -0
- package/templates/application/src/web/public/icon.svg +1 -0
- package/templates/application/src/web/style.css +3 -0
- package/templates/application/tests/app-config.test.ts +9 -0
- package/templates/application/tsconfig.json +15 -0
- package/templates/application/vite.config.ts +10 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Wing
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* The custom theme library keeps the registry-validation rules of Adea's accepted
|
|
6
|
+
* port of Zeron's theme registry (https://github.com/zeronsh/zeron). The library is
|
|
7
|
+
* Adea's own product schema (declared-license imports, a stored `variant` per
|
|
8
|
+
* theme); the shared ThemeProvider receives it as extra variants. See NOTICE and
|
|
9
|
+
* the repository history for source and behavior provenance.
|
|
10
|
+
*/
|
|
11
|
+
import type { AdeaTheme, AdeaThemeRecord } from '@adea-ai/ui/lib/theme-records'
|
|
12
|
+
|
|
13
|
+
import { contrastRatio } from '@adea-ai/ui/lib/accent-roles'
|
|
14
|
+
import { quarantineRecord } from '@adea-ai/ui/lib/preference-store'
|
|
15
|
+
import { defaultVariantFor } from '@adea-ai/ui/lib/theme-defaults'
|
|
16
|
+
import { variantFromRecord } from '@adea-ai/ui/lib/theme-records'
|
|
17
|
+
import type { ThemeVariant as UiThemeVariant } from '@adea-ai/ui/lib/themes'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The custom theme library: themes the user imported from a file, stored in
|
|
21
|
+
* `localStorage` and handed to the provider as extra variants. Import and
|
|
22
|
+
* projection live in dev-view (the lazy appearance chunk); this module owns the
|
|
23
|
+
* stored shape, the in-memory view, validation and the translation to the shared
|
|
24
|
+
* variant shape.
|
|
25
|
+
*
|
|
26
|
+
* The stored shape is a compatibility surface. Imported themes written by any
|
|
27
|
+
* earlier build keep resolving: `variant` stays in the host shape below and
|
|
28
|
+
* `flatTokens` stays the verbatim token map, so what a user imported is what is
|
|
29
|
+
* painted.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export type StoredThemeAppearance = 'light' | 'dark'
|
|
33
|
+
|
|
34
|
+
export type StoredThemeTerminal = Readonly<{
|
|
35
|
+
background: string
|
|
36
|
+
foreground: string
|
|
37
|
+
cursor: string
|
|
38
|
+
selection: string
|
|
39
|
+
/** The 16 xterm ANSI slots, in protocol order. */
|
|
40
|
+
ansi: readonly string[]
|
|
41
|
+
}>
|
|
42
|
+
|
|
43
|
+
export type StoredThemeEditorRoles = Readonly<{
|
|
44
|
+
keyword: string
|
|
45
|
+
string: string
|
|
46
|
+
number: string
|
|
47
|
+
comment: string
|
|
48
|
+
function: string
|
|
49
|
+
variable: string
|
|
50
|
+
type: string
|
|
51
|
+
tag: string
|
|
52
|
+
attribute: string
|
|
53
|
+
operator: string
|
|
54
|
+
heading: string
|
|
55
|
+
link: string
|
|
56
|
+
diffAdd: string
|
|
57
|
+
diffDelete: string
|
|
58
|
+
diffHunk: string
|
|
59
|
+
searchMatch: string
|
|
60
|
+
}>
|
|
61
|
+
|
|
62
|
+
export type StoredThemeChartRoles = Readonly<{
|
|
63
|
+
chart1: string
|
|
64
|
+
chart2: string
|
|
65
|
+
chart3: string
|
|
66
|
+
chart4: string
|
|
67
|
+
chart5: string
|
|
68
|
+
chart6: string
|
|
69
|
+
}>
|
|
70
|
+
|
|
71
|
+
export type StoredThemeColors = Readonly<{
|
|
72
|
+
background: string
|
|
73
|
+
foreground: string
|
|
74
|
+
card: string
|
|
75
|
+
cardForeground: string
|
|
76
|
+
popover: string
|
|
77
|
+
popoverForeground: string
|
|
78
|
+
primary: string
|
|
79
|
+
primaryForeground: string
|
|
80
|
+
secondary: string
|
|
81
|
+
secondaryForeground: string
|
|
82
|
+
muted: string
|
|
83
|
+
mutedForeground: string
|
|
84
|
+
accent: string
|
|
85
|
+
accentForeground: string
|
|
86
|
+
destructive: string
|
|
87
|
+
destructiveAction: string
|
|
88
|
+
destructiveActionForeground: string
|
|
89
|
+
success: string
|
|
90
|
+
border: string
|
|
91
|
+
input: string
|
|
92
|
+
ring: string
|
|
93
|
+
}>
|
|
94
|
+
|
|
95
|
+
/** The variant shape the library has always stored for an imported theme. */
|
|
96
|
+
export type StoredThemeVariant = Readonly<{
|
|
97
|
+
id: string
|
|
98
|
+
familyId: string
|
|
99
|
+
familyName: string
|
|
100
|
+
name: string
|
|
101
|
+
appearance: StoredThemeAppearance
|
|
102
|
+
colors: StoredThemeColors
|
|
103
|
+
terminal: StoredThemeTerminal
|
|
104
|
+
editor: StoredThemeEditorRoles
|
|
105
|
+
charts: StoredThemeChartRoles
|
|
106
|
+
}>
|
|
107
|
+
|
|
108
|
+
export type CustomThemeStored = Readonly<{
|
|
109
|
+
/** Stable id, namespaced so it can never collide with a catalogue id. */
|
|
110
|
+
id: string
|
|
111
|
+
name: string
|
|
112
|
+
appearance: StoredThemeAppearance
|
|
113
|
+
importedAt: string
|
|
114
|
+
variant: StoredThemeVariant
|
|
115
|
+
/** The flat token map the no-flash script applies for a stored selection. */
|
|
116
|
+
flatTokens: Readonly<Record<string, string>>
|
|
117
|
+
/** Non-fatal adjustments made while normalizing the file, for the UI. */
|
|
118
|
+
notes: readonly string[]
|
|
119
|
+
}>
|
|
120
|
+
|
|
121
|
+
export type AppearanceStorage = Pick<Storage, 'getItem' | 'setItem'>
|
|
122
|
+
|
|
123
|
+
export const CUSTOM_THEME_LIBRARY_STORAGE_KEY = 'appearance.library'
|
|
124
|
+
/**
|
|
125
|
+
* Where an unreadable library is quarantined. It is its own key: the library and
|
|
126
|
+
* the appearance preference used to share `appearance.recovery`, so one could
|
|
127
|
+
* overwrite the other's capture.
|
|
128
|
+
*/
|
|
129
|
+
export const CUSTOM_THEME_LIBRARY_RECOVERY_KEY = 'appearance.library.recovery'
|
|
130
|
+
const CUSTOM_THEME_LIBRARY_VERSION = 1
|
|
131
|
+
const CUSTOM_THEME_ID_PREFIX = 'custom-'
|
|
132
|
+
|
|
133
|
+
/*
|
|
134
|
+
* Registry validation, ported from Zeron `ThemeRegistry::validate`: core text and
|
|
135
|
+
* muted text must reach 4.5:1, the accent 3:1, on-accent 4.5:1, the terminal
|
|
136
|
+
* foreground 4.5:1, and every chromatic ANSI slot 3:1 (slots 0 and 8 are
|
|
137
|
+
* structural black/dim colors). Import runs it over the one variant it just built.
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
export type ValidationIssue = Readonly<{
|
|
141
|
+
variantId: string
|
|
142
|
+
severity: 'error' | 'warning'
|
|
143
|
+
message: string
|
|
144
|
+
}>
|
|
145
|
+
|
|
146
|
+
export function validateThemeRegistry(registry: readonly StoredThemeVariant[]): ValidationIssue[] {
|
|
147
|
+
const issues: ValidationIssue[] = []
|
|
148
|
+
const seen = new Set<string>()
|
|
149
|
+
for (const variant of registry) {
|
|
150
|
+
if (variant.id.trim().length === 0 || seen.has(variant.id)) {
|
|
151
|
+
issues.push({
|
|
152
|
+
variantId: variant.id,
|
|
153
|
+
severity: 'error',
|
|
154
|
+
message: 'variant id must be unique',
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
seen.add(variant.id)
|
|
158
|
+
const check = (role: string, foreground: string, background: string, minimum: number) => {
|
|
159
|
+
const actual = contrastRatio(foreground, background)
|
|
160
|
+
if (actual < minimum) {
|
|
161
|
+
issues.push({
|
|
162
|
+
variantId: variant.id,
|
|
163
|
+
severity: 'error',
|
|
164
|
+
message: `${role} contrast is ${actual.toFixed(2)}:1; expected ${minimum.toFixed(1)}:1`,
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
check('text', variant.colors.foreground, variant.colors.background, 4.5)
|
|
169
|
+
check('muted text', variant.colors.mutedForeground, variant.colors.background, 4.5)
|
|
170
|
+
check('primary', variant.colors.primary, variant.colors.background, 3)
|
|
171
|
+
check('on-primary', variant.colors.primaryForeground, variant.colors.primary, 4.5)
|
|
172
|
+
check('terminal foreground', variant.terminal.foreground, variant.terminal.background, 4.5)
|
|
173
|
+
for (const [index, color] of variant.terminal.ansi.entries()) {
|
|
174
|
+
if (index % 8 === 0) continue
|
|
175
|
+
const actual = contrastRatio(color, variant.terminal.background)
|
|
176
|
+
if (actual < 3) {
|
|
177
|
+
issues.push({
|
|
178
|
+
variantId: variant.id,
|
|
179
|
+
severity: 'warning',
|
|
180
|
+
message: `terminal ANSI slot ${index} is below 3:1`,
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
check('editor comment', variant.editor.comment, variant.colors.background, 4.5)
|
|
185
|
+
check('diff delete', variant.editor.diffDelete, variant.colors.background, 3)
|
|
186
|
+
check('diff add', variant.editor.diffAdd, variant.colors.background, 3)
|
|
187
|
+
}
|
|
188
|
+
return issues
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/*
|
|
192
|
+
* The flat token map: the custom properties an imported theme owns. It is stored
|
|
193
|
+
* with the theme (`flatTokens`) so the pre-paint script can apply it without the
|
|
194
|
+
* library's code, and the provider writes it verbatim over everything it derives.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
const ANSI_NAMES = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
|
|
198
|
+
|
|
199
|
+
function kebabCase(value: string): string {
|
|
200
|
+
return value.replaceAll(/[A-Z]/g, (character) => `-${character.toLocaleLowerCase()}`)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function terminalTokens(palette: StoredThemeTerminal): Record<string, string> {
|
|
204
|
+
const tokens: Record<string, string> = {
|
|
205
|
+
'--terminal-background': palette.background,
|
|
206
|
+
'--terminal-foreground': palette.foreground,
|
|
207
|
+
'--terminal-cursor': palette.cursor,
|
|
208
|
+
'--terminal-selection': palette.selection,
|
|
209
|
+
}
|
|
210
|
+
for (const [index, color] of palette.ansi.entries()) {
|
|
211
|
+
const name = ANSI_NAMES[index % 8]!
|
|
212
|
+
tokens[index < 8 ? `--terminal-ansi-${name}` : `--terminal-ansi-bright-${name}`] = color
|
|
213
|
+
}
|
|
214
|
+
return tokens
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** The custom properties an imported variant owns, as a flat map. */
|
|
218
|
+
export function flatVariantTokens(variant: StoredThemeVariant): Record<string, string> {
|
|
219
|
+
const tokens: Record<string, string> = {}
|
|
220
|
+
for (const [role, value] of Object.entries(variant.colors)) {
|
|
221
|
+
tokens[`--${kebabCase(role)}`] = value
|
|
222
|
+
}
|
|
223
|
+
Object.assign(tokens, terminalTokens(variant.terminal))
|
|
224
|
+
for (const [role, value] of Object.entries(variant.editor)) {
|
|
225
|
+
tokens[`--editor-${kebabCase(role)}`] = value
|
|
226
|
+
}
|
|
227
|
+
for (const [index, value] of Object.values(variant.charts).entries()) {
|
|
228
|
+
tokens[`--chart-${index + 1}`] = value
|
|
229
|
+
}
|
|
230
|
+
return tokens
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/*
|
|
234
|
+
* The shared variant for a stored theme.
|
|
235
|
+
*
|
|
236
|
+
* The stored variant is lossy against the catalogue's record shape (it has no
|
|
237
|
+
* warning, info or hover roles), so the record is reconstructed from it, the same
|
|
238
|
+
* reconstruction the appearance editor previews. The shared provider derives what
|
|
239
|
+
* the import never stored (status hues, sidebar, hover) from that record, and then
|
|
240
|
+
* writes `flatTokens` verbatim over the derivation: every stored key paints exactly
|
|
241
|
+
* what the user imported.
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
const IMPORTED_PROVENANCE = {
|
|
245
|
+
project: 'Adea themes catalogue',
|
|
246
|
+
url: 'https://github.com/adea-ai/themes',
|
|
247
|
+
license: 'Apache-2.0',
|
|
248
|
+
} as const
|
|
249
|
+
|
|
250
|
+
function ansiRamp(variant: StoredThemeVariant): AdeaTheme['ansi'] {
|
|
251
|
+
const [
|
|
252
|
+
black,
|
|
253
|
+
red,
|
|
254
|
+
green,
|
|
255
|
+
yellow,
|
|
256
|
+
blue,
|
|
257
|
+
magenta,
|
|
258
|
+
cyan,
|
|
259
|
+
white,
|
|
260
|
+
brightBlack,
|
|
261
|
+
brightRed,
|
|
262
|
+
brightGreen,
|
|
263
|
+
brightYellow,
|
|
264
|
+
brightBlue,
|
|
265
|
+
brightMagenta,
|
|
266
|
+
brightCyan,
|
|
267
|
+
brightWhite,
|
|
268
|
+
] = variant.terminal.ansi
|
|
269
|
+
return {
|
|
270
|
+
black: black!,
|
|
271
|
+
red: red!,
|
|
272
|
+
green: green!,
|
|
273
|
+
yellow: yellow!,
|
|
274
|
+
blue: blue!,
|
|
275
|
+
magenta: magenta!,
|
|
276
|
+
cyan: cyan!,
|
|
277
|
+
white: white!,
|
|
278
|
+
brightBlack: brightBlack!,
|
|
279
|
+
brightRed: brightRed!,
|
|
280
|
+
brightGreen: brightGreen!,
|
|
281
|
+
brightYellow: brightYellow!,
|
|
282
|
+
brightBlue: brightBlue!,
|
|
283
|
+
brightMagenta: brightMagenta!,
|
|
284
|
+
brightCyan: brightCyan!,
|
|
285
|
+
brightWhite: brightWhite!,
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The catalogue-shaped record for an imported variant. The editor reads only its
|
|
291
|
+
* surface, text, border and accent roles; warning and info are the ANSI yellow and
|
|
292
|
+
* blue because the stored variant has no such roles.
|
|
293
|
+
*/
|
|
294
|
+
export function storedVariantRecord(variant: StoredThemeVariant): AdeaThemeRecord {
|
|
295
|
+
const colors = variant.colors
|
|
296
|
+
const ansi = ansiRamp(variant)
|
|
297
|
+
const theme: AdeaTheme = {
|
|
298
|
+
id: variant.id,
|
|
299
|
+
name: variant.name,
|
|
300
|
+
appearance: variant.appearance,
|
|
301
|
+
colors: {
|
|
302
|
+
background: colors.background,
|
|
303
|
+
foreground: colors.foreground,
|
|
304
|
+
surface: colors.card,
|
|
305
|
+
surfaceElevated: colors.popover,
|
|
306
|
+
surfaceHover: colors.accent,
|
|
307
|
+
surfaceActive: colors.border,
|
|
308
|
+
border: colors.border,
|
|
309
|
+
borderMuted: colors.border,
|
|
310
|
+
text: colors.foreground,
|
|
311
|
+
textMuted: colors.mutedForeground,
|
|
312
|
+
textSubtle: colors.mutedForeground,
|
|
313
|
+
accent: colors.primary,
|
|
314
|
+
accentForeground: colors.primaryForeground,
|
|
315
|
+
success: colors.success,
|
|
316
|
+
warning: ansi.yellow,
|
|
317
|
+
error: colors.destructive,
|
|
318
|
+
info: ansi.blue,
|
|
319
|
+
},
|
|
320
|
+
ansi,
|
|
321
|
+
cursor: variant.terminal.cursor,
|
|
322
|
+
selection: variant.terminal.selection,
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
...theme,
|
|
326
|
+
family: variant.familyId,
|
|
327
|
+
familyLabel: variant.familyName,
|
|
328
|
+
label: variant.name,
|
|
329
|
+
description: `${variant.name}, imported into your library.`,
|
|
330
|
+
provenance: IMPORTED_PROVENANCE,
|
|
331
|
+
tags: ['imported', variant.appearance],
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* The shared-provider variant for a stored theme: derived roles from the
|
|
337
|
+
* reconstructed record, then `flatTokens` verbatim.
|
|
338
|
+
*
|
|
339
|
+
* A record the shared projection cannot map falls back to the default theme of the
|
|
340
|
+
* same appearance under the stored identity, so an import that the projection
|
|
341
|
+
* rejects still paints from its tokens instead of vanishing.
|
|
342
|
+
*/
|
|
343
|
+
export function toUiVariant(stored: CustomThemeStored): UiThemeVariant {
|
|
344
|
+
const { variant } = stored
|
|
345
|
+
let base: UiThemeVariant
|
|
346
|
+
try {
|
|
347
|
+
base = variantFromRecord(storedVariantRecord(variant))
|
|
348
|
+
} catch {
|
|
349
|
+
// The shipped default of the appearance: the provider's own start-up data, so the
|
|
350
|
+
// shell never imports the themes catalogue to repair an import.
|
|
351
|
+
base = {
|
|
352
|
+
...defaultVariantFor(variant.appearance),
|
|
353
|
+
id: variant.id,
|
|
354
|
+
family: variant.familyId,
|
|
355
|
+
familyLabel: variant.familyName,
|
|
356
|
+
label: variant.name,
|
|
357
|
+
description: `${variant.name}, imported into your library.`,
|
|
358
|
+
provenance: {
|
|
359
|
+
source: IMPORTED_PROVENANCE.project,
|
|
360
|
+
url: IMPORTED_PROVENANCE.url,
|
|
361
|
+
license: IMPORTED_PROVENANCE.license,
|
|
362
|
+
},
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return { ...base, tokens: stored.flatTokens }
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/*
|
|
369
|
+
* The in-memory library.
|
|
370
|
+
*
|
|
371
|
+
* It lives on the host object, not in module state: the dev graph (and any consumer
|
|
372
|
+
* graph) can legitimately load this module twice (a relative import and the
|
|
373
|
+
* components subpath are distinct module records), and a singleton array would fork
|
|
374
|
+
* the registry. The listeners live there too, so a change made through one instance
|
|
375
|
+
* reaches a subscriber registered through the other.
|
|
376
|
+
*/
|
|
377
|
+
type LibraryState = {
|
|
378
|
+
themes: readonly CustomThemeStored[]
|
|
379
|
+
/** Derived from `themes`; rebuilt on first read after each change. */
|
|
380
|
+
uiVariants?: readonly UiThemeVariant[]
|
|
381
|
+
listeners: Set<() => void>
|
|
382
|
+
}
|
|
383
|
+
type LibraryHost = typeof globalThis & { __ADEA_THEME_LIBRARY__?: Partial<LibraryState> }
|
|
384
|
+
const libraryHost = globalThis as LibraryHost
|
|
385
|
+
|
|
386
|
+
function library(): LibraryState {
|
|
387
|
+
const existing = libraryHost.__ADEA_THEME_LIBRARY__
|
|
388
|
+
if (existing && Array.isArray(existing.themes) && existing.listeners) {
|
|
389
|
+
return existing as LibraryState
|
|
390
|
+
}
|
|
391
|
+
// A host object written by an older module instance has another shape.
|
|
392
|
+
const created: LibraryState = { themes: [], listeners: existing?.listeners ?? new Set() }
|
|
393
|
+
libraryHost.__ADEA_THEME_LIBRARY__ = created
|
|
394
|
+
return created
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function replaceThemes(themes: readonly CustomThemeStored[]): void {
|
|
398
|
+
const state = library()
|
|
399
|
+
state.themes = Object.freeze([...themes])
|
|
400
|
+
state.uiVariants = undefined
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** The imported themes' stored variants, in import order. */
|
|
404
|
+
export function customThemeVariants(): readonly StoredThemeVariant[] {
|
|
405
|
+
return library().themes.map((theme) => theme.variant)
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** The imported themes as shared-provider variants: what the provider's `themes` takes. */
|
|
409
|
+
export function customUiVariants(): readonly UiThemeVariant[] {
|
|
410
|
+
const state = library()
|
|
411
|
+
state.uiVariants ??= Object.freeze(state.themes.map(toUiVariant))
|
|
412
|
+
return state.uiVariants
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export function subscribeCustomThemes(listener: () => void): () => void {
|
|
416
|
+
const { listeners } = library()
|
|
417
|
+
listeners.add(listener)
|
|
418
|
+
return () => listeners.delete(listener)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function notifyCustomThemes(): void {
|
|
422
|
+
for (const listener of library().listeners) listener()
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function isCustomThemeId(id: string): boolean {
|
|
426
|
+
return id.startsWith(CUSTOM_THEME_ID_PREFIX)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Replace the imported-theme set, persist it, and tell subscribers. A theme whose id
|
|
431
|
+
* is not custom-namespaced is namespaced here, so a library file can never shadow a
|
|
432
|
+
* catalogue id.
|
|
433
|
+
*/
|
|
434
|
+
export function setCustomThemes(
|
|
435
|
+
themes: readonly CustomThemeStored[],
|
|
436
|
+
storage: AppearanceStorage | undefined
|
|
437
|
+
): boolean {
|
|
438
|
+
const safe = themes.map((theme) => {
|
|
439
|
+
if (isCustomThemeId(theme.id)) return theme
|
|
440
|
+
const id = `${CUSTOM_THEME_ID_PREFIX}${theme.id}`
|
|
441
|
+
return { ...theme, id, variant: { ...theme.variant, id } }
|
|
442
|
+
})
|
|
443
|
+
try {
|
|
444
|
+
if (storage) {
|
|
445
|
+
const raw = storage.getItem(CUSTOM_THEME_LIBRARY_STORAGE_KEY)
|
|
446
|
+
if (raw) {
|
|
447
|
+
const result = parseLibrary(raw)
|
|
448
|
+
if (result.reason && !preserveLibrary(storage, raw, result.reason))
|
|
449
|
+
throw new Error('Library recovery unavailable')
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
storage?.setItem(
|
|
453
|
+
CUSTOM_THEME_LIBRARY_STORAGE_KEY,
|
|
454
|
+
JSON.stringify({ version: CUSTOM_THEME_LIBRARY_VERSION, themes: safe })
|
|
455
|
+
)
|
|
456
|
+
} catch {
|
|
457
|
+
return false
|
|
458
|
+
}
|
|
459
|
+
replaceThemes(safe)
|
|
460
|
+
notifyCustomThemes()
|
|
461
|
+
return true
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const object = (value: unknown): value is Record<string, unknown> =>
|
|
465
|
+
typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
466
|
+
const fields = (value: unknown, names: readonly string[]) =>
|
|
467
|
+
object(value) && names.every((name) => typeof value[name] === 'string')
|
|
468
|
+
|
|
469
|
+
function isStoredTheme(entry: unknown): entry is CustomThemeStored {
|
|
470
|
+
if (!object(entry) || !object(entry.variant)) return false
|
|
471
|
+
const theme = entry
|
|
472
|
+
const variant = entry.variant
|
|
473
|
+
return (
|
|
474
|
+
typeof theme.id === 'string' &&
|
|
475
|
+
typeof theme.name === 'string' &&
|
|
476
|
+
(theme.appearance === 'light' || theme.appearance === 'dark') &&
|
|
477
|
+
typeof theme.importedAt === 'string' &&
|
|
478
|
+
fields(variant, ['id', 'familyId', 'familyName', 'name']) &&
|
|
479
|
+
(variant.appearance === 'light' || variant.appearance === 'dark') &&
|
|
480
|
+
fields(variant.colors, [
|
|
481
|
+
'background',
|
|
482
|
+
'foreground',
|
|
483
|
+
'card',
|
|
484
|
+
'cardForeground',
|
|
485
|
+
'popover',
|
|
486
|
+
'popoverForeground',
|
|
487
|
+
'primary',
|
|
488
|
+
'primaryForeground',
|
|
489
|
+
'secondary',
|
|
490
|
+
'secondaryForeground',
|
|
491
|
+
'muted',
|
|
492
|
+
'mutedForeground',
|
|
493
|
+
'accent',
|
|
494
|
+
'accentForeground',
|
|
495
|
+
'destructive',
|
|
496
|
+
'destructiveAction',
|
|
497
|
+
'destructiveActionForeground',
|
|
498
|
+
'success',
|
|
499
|
+
'border',
|
|
500
|
+
'input',
|
|
501
|
+
'ring',
|
|
502
|
+
]) &&
|
|
503
|
+
fields(variant.terminal, ['background', 'foreground', 'cursor', 'selection']) &&
|
|
504
|
+
object(variant.terminal) &&
|
|
505
|
+
Array.isArray(variant.terminal.ansi) &&
|
|
506
|
+
variant.terminal.ansi.length === 16 &&
|
|
507
|
+
variant.terminal.ansi.every((color) => typeof color === 'string') &&
|
|
508
|
+
fields(variant.editor, [
|
|
509
|
+
'keyword',
|
|
510
|
+
'string',
|
|
511
|
+
'number',
|
|
512
|
+
'comment',
|
|
513
|
+
'function',
|
|
514
|
+
'variable',
|
|
515
|
+
'type',
|
|
516
|
+
'tag',
|
|
517
|
+
'attribute',
|
|
518
|
+
'operator',
|
|
519
|
+
'heading',
|
|
520
|
+
'link',
|
|
521
|
+
'diffAdd',
|
|
522
|
+
'diffDelete',
|
|
523
|
+
'diffHunk',
|
|
524
|
+
'searchMatch',
|
|
525
|
+
]) &&
|
|
526
|
+
fields(variant.charts, ['chart1', 'chart2', 'chart3', 'chart4', 'chart5', 'chart6']) &&
|
|
527
|
+
object(theme.flatTokens) &&
|
|
528
|
+
Object.values(theme.flatTokens).every((value) => typeof value === 'string') &&
|
|
529
|
+
Array.isArray(theme.notes) &&
|
|
530
|
+
theme.notes.every((note) => typeof note === 'string')
|
|
531
|
+
)
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function parseLibrary(raw: string): {
|
|
535
|
+
themes: CustomThemeStored[]
|
|
536
|
+
reason?: 'corrupt_json' | 'unsupported_record'
|
|
537
|
+
} {
|
|
538
|
+
let value: unknown
|
|
539
|
+
try {
|
|
540
|
+
value = JSON.parse(raw)
|
|
541
|
+
} catch {
|
|
542
|
+
return { themes: [], reason: 'corrupt_json' }
|
|
543
|
+
}
|
|
544
|
+
if (
|
|
545
|
+
!object(value) ||
|
|
546
|
+
value.version !== CUSTOM_THEME_LIBRARY_VERSION ||
|
|
547
|
+
!Array.isArray(value.themes)
|
|
548
|
+
)
|
|
549
|
+
return { themes: [], reason: 'unsupported_record' }
|
|
550
|
+
const themes = value.themes.filter(isStoredTheme)
|
|
551
|
+
return themes.length === value.themes.length
|
|
552
|
+
? { themes }
|
|
553
|
+
: { themes, reason: 'unsupported_record' }
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function preserveLibrary(
|
|
557
|
+
storage: AppearanceStorage,
|
|
558
|
+
raw: string,
|
|
559
|
+
reason: 'corrupt_json' | 'unsupported_record'
|
|
560
|
+
): boolean {
|
|
561
|
+
const existing = storage.getItem(CUSTOM_THEME_LIBRARY_RECOVERY_KEY)
|
|
562
|
+
if (!existing) quarantineRecord(storage, CUSTOM_THEME_LIBRARY_RECOVERY_KEY, raw, reason)
|
|
563
|
+
const saved = storage.getItem(CUSTOM_THEME_LIBRARY_RECOVERY_KEY)
|
|
564
|
+
try {
|
|
565
|
+
const capture: unknown = saved && JSON.parse(saved)
|
|
566
|
+
return object(capture) && capture.schemaVersion === 1 && capture.raw === raw
|
|
567
|
+
} catch {
|
|
568
|
+
return false
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Read the stored library. A malformed document starts an empty library and
|
|
574
|
+
* quarantines the raw bytes into the library's own recovery key, mirroring the
|
|
575
|
+
* appearance-preference recovery contract; individual invalid records are dropped,
|
|
576
|
+
* not fatal.
|
|
577
|
+
*/
|
|
578
|
+
export function readCustomThemeLibrary(
|
|
579
|
+
storage: AppearanceStorage | undefined
|
|
580
|
+
): readonly CustomThemeStored[] {
|
|
581
|
+
if (!storage) return []
|
|
582
|
+
try {
|
|
583
|
+
// An empty value is no library, not a corrupt one.
|
|
584
|
+
const raw = storage.getItem(CUSTOM_THEME_LIBRARY_STORAGE_KEY)
|
|
585
|
+
if (!raw) return []
|
|
586
|
+
const { themes, reason } = parseLibrary(raw)
|
|
587
|
+
if (reason) preserveLibrary(storage, raw, reason)
|
|
588
|
+
replaceThemes(themes)
|
|
589
|
+
return themes
|
|
590
|
+
} catch {
|
|
591
|
+
return []
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export function removeCustomTheme(id: string, storage: AppearanceStorage | undefined): boolean {
|
|
596
|
+
return setCustomThemes(
|
|
597
|
+
readCustomThemeLibrary(storage).filter((theme) => theme.id !== id),
|
|
598
|
+
storage
|
|
599
|
+
)
|
|
600
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Wing
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Draft/snapshot editing semantics substantially translated from Zeron
|
|
6
|
+
* crates/ui/src/appearance.rs (the `set_mode`/`set_theme`/`set_accent`/
|
|
7
|
+
* `set_surface` setter block), revision
|
|
8
|
+
* 30a9a9537c5ec96226c87f4bf349b6f77c5dfb59: unchanged values no-op, and every
|
|
9
|
+
* change resolves against the live palette immediately. Modified for Adea's
|
|
10
|
+
* explicit save/revert popover contract: an open snapshot, draft preview,
|
|
11
|
+
* Reset to defaults, Cancel back to the snapshot, Save to commit.
|
|
12
|
+
* See NOTICE for source and license provenance.
|
|
13
|
+
*/
|
|
14
|
+
import { createSignal } from 'solid-js'
|
|
15
|
+
import { normalizeAppearanceEditorFontSettings } from '@adea-ai/ui/lib/appearance-font-settings'
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
defaultAppearancePreferences,
|
|
19
|
+
normalizeAppearancePreferences,
|
|
20
|
+
type AppearancePreferencesV2,
|
|
21
|
+
} from './appearance-preferences'
|
|
22
|
+
|
|
23
|
+
export type AppearanceEditor = Readonly<{
|
|
24
|
+
/** The edited draft, reactive so dialog UI tracks every change. */
|
|
25
|
+
draft: () => AppearancePreferencesV2
|
|
26
|
+
/** True when the draft differs from the snapshot the editor opened with. */
|
|
27
|
+
dirty: () => boolean
|
|
28
|
+
/** True when the draft differs from the shipped defaults. */
|
|
29
|
+
differsFromDefaults: () => boolean
|
|
30
|
+
/** Begin editing: snapshot the committed preferences. */
|
|
31
|
+
open: (committed: AppearancePreferencesV2) => void
|
|
32
|
+
/** Set one or more draft fields; unchanged values no-op like Zeron's setters. */
|
|
33
|
+
set: (patch: Partial<AppearancePreferencesV2>) => void
|
|
34
|
+
/** Draft becomes the shipped defaults (still reversible until Save). */
|
|
35
|
+
reset: () => void
|
|
36
|
+
/** Discard the draft; the committed snapshot is authoritative again. */
|
|
37
|
+
revert: () => AppearancePreferencesV2
|
|
38
|
+
/** Commit the draft and clear the snapshot. */
|
|
39
|
+
save: () => AppearancePreferencesV2
|
|
40
|
+
}>
|
|
41
|
+
|
|
42
|
+
function samePreferences(left: AppearancePreferencesV2, right: AppearancePreferencesV2): boolean {
|
|
43
|
+
const leftFonts = normalizeAppearanceEditorFontSettings(left.fonts).settings
|
|
44
|
+
const rightFonts = normalizeAppearanceEditorFontSettings(right.fonts).settings
|
|
45
|
+
return (
|
|
46
|
+
(['ui', 'content', 'code'] as const).every(
|
|
47
|
+
(axis) =>
|
|
48
|
+
leftFonts[axis].family === rightFonts[axis].family &&
|
|
49
|
+
leftFonts[axis].size === rightFonts[axis].size
|
|
50
|
+
) &&
|
|
51
|
+
left.mode === right.mode &&
|
|
52
|
+
left.lightThemeId === right.lightThemeId &&
|
|
53
|
+
left.darkThemeId === right.darkThemeId &&
|
|
54
|
+
left.terminalThemeId === right.terminalThemeId &&
|
|
55
|
+
left.accent === right.accent &&
|
|
56
|
+
left.surface === right.surface &&
|
|
57
|
+
left.reduceTransparency === right.reduceTransparency
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createAppearanceEditor(
|
|
62
|
+
committed: AppearancePreferencesV2 = defaultAppearancePreferences
|
|
63
|
+
): AppearanceEditor {
|
|
64
|
+
const [draft, setDraft] = createSignal<AppearancePreferencesV2>(committed)
|
|
65
|
+
const [snapshot, setSnapshot] = createSignal<AppearancePreferencesV2>(committed)
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
draft,
|
|
69
|
+
dirty: () => !samePreferences(draft(), snapshot()),
|
|
70
|
+
differsFromDefaults: () => !samePreferences(draft(), defaultAppearancePreferences),
|
|
71
|
+
open: (value) => {
|
|
72
|
+
const normalized = normalizeAppearancePreferences(value).value
|
|
73
|
+
setSnapshot(normalized)
|
|
74
|
+
setDraft(normalized)
|
|
75
|
+
},
|
|
76
|
+
set: (patch) => {
|
|
77
|
+
const next = { ...draft(), ...patch }
|
|
78
|
+
// Zeron's setters return early when the value did not change.
|
|
79
|
+
if (samePreferences(next, draft())) return
|
|
80
|
+
setDraft(next)
|
|
81
|
+
},
|
|
82
|
+
reset: () => {
|
|
83
|
+
setDraft(defaultAppearancePreferences)
|
|
84
|
+
},
|
|
85
|
+
revert: () => {
|
|
86
|
+
setDraft(snapshot())
|
|
87
|
+
return snapshot()
|
|
88
|
+
},
|
|
89
|
+
save: () => {
|
|
90
|
+
setSnapshot(draft())
|
|
91
|
+
return draft()
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
}
|