@adea-ai/app-framework 0.29.3 → 0.31.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/README.md +6 -3
- package/dist/app/application.js +4 -2
- package/dist/app/create-application.d.ts +2 -0
- package/dist/app/create-application.js +6 -0
- package/dist/appearance/appearance-host.js +6 -0
- package/dist/appearance/appearance-preferences.js +6 -2
- package/dist/appearance/composition.d.ts +1 -1
- package/dist/appearance/custom-theme-import.js +12 -19
- package/dist/appearance/custom-theme-library.d.ts +5 -4
- package/dist/appearance/custom-theme-library.js +20 -2
- package/dist/appearance/editor.js +4 -1
- package/dist/appearance/legacy-imported-theme-token-projection.d.ts +84 -0
- package/dist/appearance/legacy-imported-theme-token-projection.js +142 -0
- package/dist/appearance/theme-record-adapter.js +37 -9
- package/dist/cli/create-application-cli.js +6 -4
- package/dist/framework-source.json +1 -1
- package/dist/shell/app-shell.js +76 -48
- package/dist/shell/app-utilities.d.ts +5 -3
- package/dist/shell/app-utilities.js +15 -7
- package/dist/shell/help-shortcuts.d.ts +4 -0
- package/dist/shell/help-shortcuts.js +38 -7
- package/dist/shell/keyboard-target.d.ts +2 -0
- package/dist/shell/keyboard-target.js +54 -0
- package/dist/shell/settings-sections.d.ts +5 -0
- package/dist/shell/settings-shortcuts.d.ts +10 -0
- package/dist/shell/settings-shortcuts.js +67 -0
- package/dist/views/app-help.js +2 -1
- package/dist/views/app-settings.js +5 -2
- package/dist/views/appearance-surface.js +33 -19
- package/package.json +6 -4
- package/src/app/application.tsx +3 -1
- package/src/appearance/appearance-host.tsx +6 -0
- package/src/appearance/appearance-preferences.ts +7 -1
- package/src/appearance/composition.ts +3 -1
- package/src/appearance/custom-theme-import.ts +21 -37
- package/src/appearance/custom-theme-library.ts +21 -5
- package/src/appearance/editor.ts +7 -6
- package/src/appearance/legacy-imported-theme-token-projection.ts +51 -0
- package/src/appearance/theme-record-adapter.ts +58 -11
- package/src/shell/app-shell.tsx +88 -58
- package/src/shell/app-utilities.tsx +29 -17
- package/src/shell/help-shortcuts.ts +77 -6
- package/src/shell/keyboard-target.ts +74 -0
- package/src/shell/settings-sections.ts +5 -0
- package/src/shell/settings-shortcuts.ts +116 -0
- package/src/views/app-settings.tsx +5 -3
- package/src/views/appearance-surface.tsx +63 -27
- package/templates/application/.gitlab-ci.yml +19 -0
- package/templates/application/README.md +9 -0
package/README.md
CHANGED
|
@@ -398,9 +398,12 @@ can wrap the `construct` callback given to `desktop-host`.
|
|
|
398
398
|
The `create-adea-app` command generates a new application
|
|
399
399
|
from an identity, framework package specifier and renderer choice. The starter
|
|
400
400
|
provides the shared shell, appearance, one view and one desktop service. The
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
401
|
+
generated GitLab validation job accepts optional comma-separated
|
|
402
|
+
`--gitlab-runner-tags`; without them it requires an untagged Docker runner.
|
|
403
|
+
The generated GitLab job validates the app but does not publish releases.
|
|
404
|
+
The framework package specifier must refer to a distributable package available to
|
|
405
|
+
the new project. Its GitHub Actions release workflows call this framework release's
|
|
406
|
+
reusable workflows on the shared schedule (pinned to the release tag; run
|
|
404
407
|
`bunx adea-update-app-framework` to pin the commit) and stay off until the
|
|
405
408
|
repository sets `DESKTOP_RELEASES_ENABLED=true` with a release signing key.
|
|
406
409
|
Native application services and product-specific authorization must still be
|
package/dist/app/application.js
CHANGED
|
@@ -37,7 +37,8 @@ function Application(props) {
|
|
|
37
37
|
});
|
|
38
38
|
const view = createMemo(() => {
|
|
39
39
|
routerRevision();
|
|
40
|
-
|
|
40
|
+
const selected = props.router?.current() ?? localView();
|
|
41
|
+
return props.definition.views.find((item) => item.id === selected) ?? props.definition.views.find((item) => item.id === props.definition.initialView);
|
|
41
42
|
});
|
|
42
43
|
const navigate = (id) => {
|
|
43
44
|
if (!props.definition.views.some((item) => item.id === id)) return;
|
|
@@ -118,7 +119,8 @@ function Application(props) {
|
|
|
118
119
|
get help() {
|
|
119
120
|
return memo(() => !!props.utilities?.help)() && {
|
|
120
121
|
search: Boolean(props.onSearch),
|
|
121
|
-
...props.utilities.help
|
|
122
|
+
...props.utilities.help,
|
|
123
|
+
searchBinding: Boolean(props.onSearch)
|
|
122
124
|
};
|
|
123
125
|
},
|
|
124
126
|
get identity() {
|
|
@@ -11,6 +11,8 @@ export declare function createApplication(options: {
|
|
|
11
11
|
repository?: string;
|
|
12
12
|
frameworkSpecifier: string;
|
|
13
13
|
renderer?: DesktopRenderer;
|
|
14
|
+
/** Runner tags required by the generated GitLab validation job. */
|
|
15
|
+
gitlabRunnerTags?: readonly string[];
|
|
14
16
|
}, dependencies?: {
|
|
15
17
|
templateDirectory?: string;
|
|
16
18
|
/** Synchronize publish races in tests; app creation does not need this hook. */
|
|
@@ -75,6 +75,8 @@ async function createApplication(options, dependencies = {}) {
|
|
|
75
75
|
if (dependency.protocol !== "https:" || dependency.username || dependency.password || dependency.search) throw new Error("Invalid framework dependency");
|
|
76
76
|
}
|
|
77
77
|
const renderer = createRendererProfile(options.renderer).renderer;
|
|
78
|
+
const runnerTags = options.gitlabRunnerTags ?? [];
|
|
79
|
+
if (!Array.isArray(runnerTags) || runnerTags.length > 49 || runnerTags.some((tag) => typeof tag !== "string" || !/^[A-Za-z0-9_.-]{1,128}$/.test(tag)) || new Set(runnerTags).size !== runnerTags.length) throw new Error("Invalid GitLab runner tags");
|
|
78
80
|
const frameworkManifest = JSON.parse(await readFile(resolve(import.meta.dir, "../../package.json"), "utf8"));
|
|
79
81
|
const uiVersion = frameworkManifest.devDependencies?.["@adea-ai/ui"];
|
|
80
82
|
if (typeof uiVersion !== "string" || !/^\d+\.\d+\.\d+$/.test(uiVersion)) throw new Error("Framework UI version is unavailable");
|
|
@@ -100,6 +102,10 @@ async function createApplication(options, dependencies = {}) {
|
|
|
100
102
|
errorOnExist: true,
|
|
101
103
|
force: false
|
|
102
104
|
});
|
|
105
|
+
const gitlabPath = resolve(staging, ".gitlab-ci.yml");
|
|
106
|
+
const gitlabTemplate = await readFile(gitlabPath, "utf8");
|
|
107
|
+
const tags = runnerTags.length ? ` tags:\n${runnerTags.map((tag) => ` - ${JSON.stringify(tag)}\n`).join("")}` : "";
|
|
108
|
+
await writeFile(gitlabPath, gitlabTemplate.replace(" # {{GITLAB_RUNNER_TAGS}}\n", tags));
|
|
103
109
|
for (const name of [
|
|
104
110
|
"release.yml",
|
|
105
111
|
"release-assets.yml",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION } from "./legacy-imported-theme-token-projection.js";
|
|
1
2
|
import { appearanceThemeScript, createAppearancePersistence, selectionFromPreferences } from "./appearance-preferences.js";
|
|
2
3
|
import { customUiVariants, readCustomThemeLibrary, subscribeCustomThemes } from "./custom-theme-library.js";
|
|
3
4
|
import { createComponent, effect, mergeProps, template } from "solid-js/web";
|
|
4
5
|
import { createContext, createEffect, createSignal, useContext } from "solid-js";
|
|
5
6
|
import { ThemeProvider as ThemeProvider$1, useOptionalTheme } from "@adea-ai/ui/components/theme/lazy";
|
|
7
|
+
import { projectThemeTokens } from "@adea-ai/ui/components/theme/token-projection";
|
|
6
8
|
import { defaultPreferenceStorage } from "@adea-ai/ui/lib/preference-store";
|
|
7
9
|
import { tokensAsHex } from "@adea-ai/ui/lib/themes";
|
|
8
10
|
// src/appearance/appearance-host.tsx
|
|
@@ -30,6 +32,10 @@ function appearanceProviderProps(options = {}) {
|
|
|
30
32
|
palette: "stylesheet",
|
|
31
33
|
accentContrastFloor: 3,
|
|
32
34
|
editorRoles: "floor",
|
|
35
|
+
tokenProjection: {
|
|
36
|
+
rules: LEGACY_IMPORTED_THEME_TOKEN_PROJECTION,
|
|
37
|
+
project: projectThemeTokens
|
|
38
|
+
},
|
|
33
39
|
transformTokens: tokensAsHex,
|
|
34
40
|
disableTransitionOnChange: true,
|
|
35
41
|
fontZoom: true
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION, LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS } from "./legacy-imported-theme-token-projection.js";
|
|
2
|
+
import { createVersionedPersistence } from "@adea-ai/ui/components/theme/lazy";
|
|
2
3
|
import { isThemeAccentId } from "@adea-ai/ui/lib/themes";
|
|
3
4
|
import { getAccent } from "@adea-ai/ui/lib/accent-presets";
|
|
5
|
+
import { themeScript } from "@adea-ai/ui/components/theme/script-projection";
|
|
4
6
|
import { colorToHex, parseColor } from "@adea-ai/ui/lib/accent-roles";
|
|
5
7
|
import { DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, normalizeAppearanceEditorFontSettings } from "@adea-ai/ui/lib/appearance-font-settings";
|
|
6
8
|
import { normalizeSurface } from "@adea-ai/ui/lib/theme-surface";
|
|
@@ -169,7 +171,9 @@ function appearanceThemeScript() {
|
|
|
169
171
|
...appearanceSchema,
|
|
170
172
|
defaultAccent: DEFAULT_ACCENT_PRESET_ID,
|
|
171
173
|
surface: true,
|
|
172
|
-
palette: "stylesheet"
|
|
174
|
+
palette: "stylesheet",
|
|
175
|
+
tokenProjection: LEGACY_IMPORTED_THEME_TOKEN_PROJECTION,
|
|
176
|
+
tokenProjectionFallbacks: LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
179
|
export { APPEARANCE_ACCENT_CONTRAST_FLOOR, APPEARANCE_LIBRARY_STORAGE_KEY, APPEARANCE_RECOVERY_STORAGE_KEY, APPEARANCE_STORAGE_KEY, DEFAULT_ACCENT_PRESET_ID, adeaV2Codec, appearanceDocument, appearanceSchema, appearanceThemeScript, createAppearancePersistence, defaultAppearancePreferences, normalizeAppearancePreferences, preferencesFromSelection, selectionFromPreferences };
|
|
@@ -5,7 +5,7 @@ import type { AppearancePreferencesV2 } from './appearance-preferences';
|
|
|
5
5
|
* draft so the System split, Light, and Dark cards track unsaved theme picks
|
|
6
6
|
* the same instant the real chrome does.
|
|
7
7
|
*/
|
|
8
|
-
export declare function draftVariants(preferences: AppearancePreferencesV2): {
|
|
8
|
+
export declare function draftVariants(preferences: Pick<AppearancePreferencesV2, 'lightThemeId' | 'darkThemeId'>): {
|
|
9
9
|
light: ThemeVariant;
|
|
10
10
|
dark: ThemeVariant;
|
|
11
11
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION } from "./legacy-imported-theme-token-projection.js";
|
|
1
2
|
import { flatVariantTokens, mutateCustomThemeLibrary, validateThemeRegistry } from "./custom-theme-library.js";
|
|
3
|
+
import { projectThemeTokens } from "@adea-ai/ui/components/theme/token-projection";
|
|
2
4
|
import { colorToHex, contrastRatio, ensureContrast, parseColor } from "@adea-ai/ui/lib/accent-roles";
|
|
3
5
|
import { defaultThemeRecord, editorRolesHex, oklchToHex, parseOklchColor, shadcnDestructiveProjection, shadcnVariables, syntaxRolesHex, toXtermTheme } from "@adea-ai/ui/lib/theme-projection";
|
|
4
6
|
// src/appearance/custom-theme-import.ts
|
|
@@ -121,21 +123,6 @@ function repairComponentContrast(variant, notes) {
|
|
|
121
123
|
}
|
|
122
124
|
};
|
|
123
125
|
}
|
|
124
|
-
/** Preserve accessible sidebar pairs that the catalogue record would otherwise re-derive. */
|
|
125
|
-
function sidebarTokens(variant, notes) {
|
|
126
|
-
const colors = variant.colors;
|
|
127
|
-
return {
|
|
128
|
-
"--sidebar": colors.card,
|
|
129
|
-
"--sidebar-foreground": repairToFloor(colors.cardForeground, colors.card, notes, "sidebar foreground"),
|
|
130
|
-
"--sidebar-muted-foreground": repairToFloor(colors.mutedForeground, colors.card, notes, "sidebar muted foreground"),
|
|
131
|
-
"--sidebar-accent": colors.accent,
|
|
132
|
-
"--sidebar-accent-foreground": repairToFloor(colors.accentForeground, colors.accent, notes, "sidebar accent foreground"),
|
|
133
|
-
"--sidebar-border": colors.border,
|
|
134
|
-
"--sidebar-primary": colors.primary,
|
|
135
|
-
"--sidebar-primary-foreground": repairToFloor(colors.primaryForeground, colors.primary, notes, "sidebar primary foreground"),
|
|
136
|
-
"--sidebar-ring": colors.ring
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
126
|
function hexOf(value) {
|
|
140
127
|
const parsed = parseOklchColor(value);
|
|
141
128
|
return parsed ? oklchToHex(parsed) : value;
|
|
@@ -299,6 +286,15 @@ function prepareCustomTheme(text, existing) {
|
|
|
299
286
|
};
|
|
300
287
|
const issues = validateThemeRegistry([variant]).filter((issue) => issue.severity === "error");
|
|
301
288
|
for (const issue of issues) notes.push(`${issue.variantId}: ${issue.message}`);
|
|
289
|
+
const flatTokens = flatVariantTokens(variant);
|
|
290
|
+
const projectedTokens = projectThemeTokens(flatTokens, LEGACY_IMPORTED_THEME_TOKEN_PROJECTION);
|
|
291
|
+
for (const rule of LEGACY_IMPORTED_THEME_TOKEN_PROJECTION) {
|
|
292
|
+
const sourceValue = flatTokens[rule.source];
|
|
293
|
+
const projectedValue = projectedTokens[rule.target];
|
|
294
|
+
if (!("contrast" in rule) || flatTokens[rule.target] !== void 0 || sourceValue === void 0 || projectedValue === void 0 || projectedValue === sourceValue) continue;
|
|
295
|
+
const role = rule.target.slice(2).replaceAll("-", " ");
|
|
296
|
+
notes.push(`“${role}” was adjusted for readable contrast.`);
|
|
297
|
+
}
|
|
302
298
|
return {
|
|
303
299
|
ok: true,
|
|
304
300
|
theme: {
|
|
@@ -307,10 +303,7 @@ function prepareCustomTheme(text, existing) {
|
|
|
307
303
|
appearance,
|
|
308
304
|
importedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
309
305
|
variant,
|
|
310
|
-
flatTokens
|
|
311
|
-
...flatVariantTokens(variant),
|
|
312
|
-
...sidebarTokens(variant, notes)
|
|
313
|
-
},
|
|
306
|
+
flatTokens,
|
|
314
307
|
notes
|
|
315
308
|
}
|
|
316
309
|
};
|
|
@@ -9,8 +9,8 @@ import type { ThemeVariant as UiThemeVariant } from '@adea-ai/ui/lib/themes';
|
|
|
9
9
|
*
|
|
10
10
|
* The stored shape is a compatibility surface. Imported themes written by any
|
|
11
11
|
* earlier build keep resolving: `variant` stays in the host shape below and
|
|
12
|
-
* `flatTokens` stays the verbatim token map
|
|
13
|
-
*
|
|
12
|
+
* `flatTokens` stays the verbatim token map. Explicit entries remain authoritative;
|
|
13
|
+
* the sidebar projection recovers only absent source entries from `variant`.
|
|
14
14
|
*/
|
|
15
15
|
export type StoredThemeAppearance = 'light' | 'dark';
|
|
16
16
|
export type StoredThemeTerminal = Readonly<{
|
|
@@ -89,7 +89,7 @@ export type CustomThemeStored = Readonly<{
|
|
|
89
89
|
appearance: StoredThemeAppearance;
|
|
90
90
|
importedAt: string;
|
|
91
91
|
variant: StoredThemeVariant;
|
|
92
|
-
/** The
|
|
92
|
+
/** The verbatim imported map; projection may supply absent sources from `variant`. */
|
|
93
93
|
flatTokens: Readonly<Record<string, string>>;
|
|
94
94
|
/** Non-fatal adjustments made while normalizing the file, for the UI. */
|
|
95
95
|
notes: readonly string[];
|
|
@@ -146,7 +146,8 @@ export declare function flatVariantTokens(variant: StoredThemeVariant): Record<s
|
|
|
146
146
|
export declare function storedVariantRecord(variant: StoredThemeVariant): AdeaThemeRecord;
|
|
147
147
|
/**
|
|
148
148
|
* The shared-provider variant for a stored theme: derived roles from the
|
|
149
|
-
* reconstructed record,
|
|
149
|
+
* reconstructed record, missing sidebar projection sources from the stored variant,
|
|
150
|
+
* then every stored flat token verbatim.
|
|
150
151
|
*
|
|
151
152
|
* A record the shared projection cannot map falls back to the default theme of the
|
|
152
153
|
* same appearance under the stored identity, so an import that the projection
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS } from "./legacy-imported-theme-token-projection.js";
|
|
1
2
|
import { defaultPreferenceStorage, quarantineRecord } from "@adea-ai/ui/lib/preference-store";
|
|
2
3
|
import { contrastRatio } from "@adea-ai/ui/lib/accent-roles";
|
|
3
4
|
import { defaultVariantFor } from "@adea-ai/ui/lib/theme-defaults";
|
|
@@ -160,7 +161,8 @@ function storedVariantRecord(variant) {
|
|
|
160
161
|
}
|
|
161
162
|
/**
|
|
162
163
|
* The shared-provider variant for a stored theme: derived roles from the
|
|
163
|
-
* reconstructed record,
|
|
164
|
+
* reconstructed record, missing sidebar projection sources from the stored variant,
|
|
165
|
+
* then every stored flat token verbatim.
|
|
164
166
|
*
|
|
165
167
|
* A record the shared projection cannot map falls back to the default theme of the
|
|
166
168
|
* same appearance under the stored identity, so an import that the projection
|
|
@@ -186,9 +188,25 @@ function toUiVariant(stored) {
|
|
|
186
188
|
}
|
|
187
189
|
};
|
|
188
190
|
}
|
|
191
|
+
const projectionSources = {};
|
|
192
|
+
for (const fallback of LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS) {
|
|
193
|
+
if (Object.hasOwn(stored.flatTokens, fallback.token)) continue;
|
|
194
|
+
let value = stored;
|
|
195
|
+
for (const key of fallback.path) {
|
|
196
|
+
if (!value || typeof value !== "object" || !Object.hasOwn(value, key)) {
|
|
197
|
+
value = void 0;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
value = value[key];
|
|
201
|
+
}
|
|
202
|
+
if (typeof value === "string") projectionSources[fallback.token] = value;
|
|
203
|
+
}
|
|
189
204
|
return {
|
|
190
205
|
...base,
|
|
191
|
-
tokens:
|
|
206
|
+
tokens: {
|
|
207
|
+
...projectionSources,
|
|
208
|
+
...stored.flatTokens
|
|
209
|
+
}
|
|
192
210
|
};
|
|
193
211
|
}
|
|
194
212
|
var libraryHost = globalThis;
|
|
@@ -12,13 +12,16 @@ var scalarFields = Object.keys({
|
|
|
12
12
|
reduceTransparency: true
|
|
13
13
|
});
|
|
14
14
|
function samePreferences(left, right) {
|
|
15
|
+
if (left === right) return true;
|
|
16
|
+
if (!scalarFields.every((field) => left[field] === right[field])) return false;
|
|
17
|
+
if (left.fonts === right.fonts) return true;
|
|
15
18
|
const leftFonts = normalizeAppearanceEditorFontSettings(left.fonts).settings;
|
|
16
19
|
const rightFonts = normalizeAppearanceEditorFontSettings(right.fonts).settings;
|
|
17
20
|
return [
|
|
18
21
|
"ui",
|
|
19
22
|
"content",
|
|
20
23
|
"code"
|
|
21
|
-
].every((axis) => leftFonts[axis].family === rightFonts[axis].family && leftFonts[axis].size === rightFonts[axis].size)
|
|
24
|
+
].every((axis) => leftFonts[axis].family === rightFonts[axis].family && leftFonts[axis].size === rightFonts[axis].size);
|
|
22
25
|
}
|
|
23
26
|
function createAppearanceEditor(committed = defaultAppearancePreferences) {
|
|
24
27
|
const [draft, setDraft] = createSignal(committed);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar roles added after Framework first persisted imported theme records.
|
|
3
|
+
*
|
|
4
|
+
* Keep this as serializable data so the shared provider and its pre-paint script
|
|
5
|
+
* apply the same rules when they restore a legacy v1 record. The projection fills
|
|
6
|
+
* only absent sidebar tokens; values already stored in the user's library win.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LEGACY_IMPORTED_THEME_TOKEN_PROJECTION: readonly [{
|
|
9
|
+
readonly target: '--sidebar';
|
|
10
|
+
readonly source: '--card';
|
|
11
|
+
}, {
|
|
12
|
+
readonly target: '--sidebar-foreground';
|
|
13
|
+
readonly source: '--card-foreground';
|
|
14
|
+
readonly contrast: {
|
|
15
|
+
readonly against: '--sidebar';
|
|
16
|
+
readonly minimum: 4.5;
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
readonly target: '--sidebar-muted-foreground';
|
|
20
|
+
readonly source: '--muted-foreground';
|
|
21
|
+
readonly contrast: {
|
|
22
|
+
readonly against: '--sidebar';
|
|
23
|
+
readonly minimum: 4.5;
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
readonly target: '--sidebar-accent';
|
|
27
|
+
readonly source: '--accent';
|
|
28
|
+
}, {
|
|
29
|
+
readonly target: '--sidebar-accent-foreground';
|
|
30
|
+
readonly source: '--accent-foreground';
|
|
31
|
+
readonly contrast: {
|
|
32
|
+
readonly against: '--sidebar-accent';
|
|
33
|
+
readonly minimum: 4.5;
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
readonly target: '--sidebar-border';
|
|
37
|
+
readonly source: '--border';
|
|
38
|
+
}, {
|
|
39
|
+
readonly target: '--sidebar-primary';
|
|
40
|
+
readonly source: '--primary';
|
|
41
|
+
}, {
|
|
42
|
+
readonly target: '--sidebar-primary-foreground';
|
|
43
|
+
readonly source: '--primary-foreground';
|
|
44
|
+
readonly contrast: {
|
|
45
|
+
readonly against: '--sidebar-primary';
|
|
46
|
+
readonly minimum: 4.5;
|
|
47
|
+
};
|
|
48
|
+
}, {
|
|
49
|
+
readonly target: '--sidebar-ring';
|
|
50
|
+
readonly source: '--ring';
|
|
51
|
+
}];
|
|
52
|
+
/**
|
|
53
|
+
* Older accepted v1 records can omit base flat tokens while retaining their full
|
|
54
|
+
* variant. Both the provider adapter and opt-in prepaint script use these declared
|
|
55
|
+
* paths to recover only those absent projection sources from the unchanged record.
|
|
56
|
+
*/
|
|
57
|
+
export declare const LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS: readonly [{
|
|
58
|
+
readonly token: '--card';
|
|
59
|
+
readonly path: readonly ['variant', 'colors', 'card'];
|
|
60
|
+
}, {
|
|
61
|
+
readonly token: '--card-foreground';
|
|
62
|
+
readonly path: readonly ['variant', 'colors', 'cardForeground'];
|
|
63
|
+
}, {
|
|
64
|
+
readonly token: '--muted-foreground';
|
|
65
|
+
readonly path: readonly ['variant', 'colors', 'mutedForeground'];
|
|
66
|
+
}, {
|
|
67
|
+
readonly token: '--accent';
|
|
68
|
+
readonly path: readonly ['variant', 'colors', 'accent'];
|
|
69
|
+
}, {
|
|
70
|
+
readonly token: '--accent-foreground';
|
|
71
|
+
readonly path: readonly ['variant', 'colors', 'accentForeground'];
|
|
72
|
+
}, {
|
|
73
|
+
readonly token: '--border';
|
|
74
|
+
readonly path: readonly ['variant', 'colors', 'border'];
|
|
75
|
+
}, {
|
|
76
|
+
readonly token: '--primary';
|
|
77
|
+
readonly path: readonly ['variant', 'colors', 'primary'];
|
|
78
|
+
}, {
|
|
79
|
+
readonly token: '--primary-foreground';
|
|
80
|
+
readonly path: readonly ['variant', 'colors', 'primaryForeground'];
|
|
81
|
+
}, {
|
|
82
|
+
readonly token: '--ring';
|
|
83
|
+
readonly path: readonly ['variant', 'colors', 'ring'];
|
|
84
|
+
}];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/appearance/legacy-imported-theme-token-projection.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sidebar roles added after Framework first persisted imported theme records.
|
|
4
|
+
*
|
|
5
|
+
* Keep this as serializable data so the shared provider and its pre-paint script
|
|
6
|
+
* apply the same rules when they restore a legacy v1 record. The projection fills
|
|
7
|
+
* only absent sidebar tokens; values already stored in the user's library win.
|
|
8
|
+
*/
|
|
9
|
+
var LEGACY_IMPORTED_THEME_TOKEN_PROJECTION = [
|
|
10
|
+
{
|
|
11
|
+
target: "--sidebar",
|
|
12
|
+
source: "--card"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
target: "--sidebar-foreground",
|
|
16
|
+
source: "--card-foreground",
|
|
17
|
+
contrast: {
|
|
18
|
+
against: "--sidebar",
|
|
19
|
+
minimum: 4.5
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
target: "--sidebar-muted-foreground",
|
|
24
|
+
source: "--muted-foreground",
|
|
25
|
+
contrast: {
|
|
26
|
+
against: "--sidebar",
|
|
27
|
+
minimum: 4.5
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
target: "--sidebar-accent",
|
|
32
|
+
source: "--accent"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
target: "--sidebar-accent-foreground",
|
|
36
|
+
source: "--accent-foreground",
|
|
37
|
+
contrast: {
|
|
38
|
+
against: "--sidebar-accent",
|
|
39
|
+
minimum: 4.5
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
target: "--sidebar-border",
|
|
44
|
+
source: "--border"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
target: "--sidebar-primary",
|
|
48
|
+
source: "--primary"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
target: "--sidebar-primary-foreground",
|
|
52
|
+
source: "--primary-foreground",
|
|
53
|
+
contrast: {
|
|
54
|
+
against: "--sidebar-primary",
|
|
55
|
+
minimum: 4.5
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
target: "--sidebar-ring",
|
|
60
|
+
source: "--ring"
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Older accepted v1 records can omit base flat tokens while retaining their full
|
|
65
|
+
* variant. Both the provider adapter and opt-in prepaint script use these declared
|
|
66
|
+
* paths to recover only those absent projection sources from the unchanged record.
|
|
67
|
+
*/
|
|
68
|
+
var LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS = [
|
|
69
|
+
{
|
|
70
|
+
token: "--card",
|
|
71
|
+
path: [
|
|
72
|
+
"variant",
|
|
73
|
+
"colors",
|
|
74
|
+
"card"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
token: "--card-foreground",
|
|
79
|
+
path: [
|
|
80
|
+
"variant",
|
|
81
|
+
"colors",
|
|
82
|
+
"cardForeground"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
token: "--muted-foreground",
|
|
87
|
+
path: [
|
|
88
|
+
"variant",
|
|
89
|
+
"colors",
|
|
90
|
+
"mutedForeground"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
token: "--accent",
|
|
95
|
+
path: [
|
|
96
|
+
"variant",
|
|
97
|
+
"colors",
|
|
98
|
+
"accent"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
token: "--accent-foreground",
|
|
103
|
+
path: [
|
|
104
|
+
"variant",
|
|
105
|
+
"colors",
|
|
106
|
+
"accentForeground"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
token: "--border",
|
|
111
|
+
path: [
|
|
112
|
+
"variant",
|
|
113
|
+
"colors",
|
|
114
|
+
"border"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
token: "--primary",
|
|
119
|
+
path: [
|
|
120
|
+
"variant",
|
|
121
|
+
"colors",
|
|
122
|
+
"primary"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
token: "--primary-foreground",
|
|
127
|
+
path: [
|
|
128
|
+
"variant",
|
|
129
|
+
"colors",
|
|
130
|
+
"primaryForeground"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
token: "--ring",
|
|
135
|
+
path: [
|
|
136
|
+
"variant",
|
|
137
|
+
"colors",
|
|
138
|
+
"ring"
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
];
|
|
142
|
+
export { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION, LEGACY_IMPORTED_THEME_TOKEN_PROJECTION_FALLBACKS };
|
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
import "./appearance-preferences.js";
|
|
2
2
|
import { customThemeVariantById, customThemeVariants, storedVariantRecord } from "./custom-theme-library.js";
|
|
3
3
|
import { themeRegistry } from "./theme-registry.js";
|
|
4
|
-
import { accentRolesForSelection, themeRecordById, themeRecords } from "@adea-ai/ui/lib/themes";
|
|
4
|
+
import { accentRolesForSelection, themeRecordById, themeRecords, tokensAsHex } from "@adea-ai/ui/lib/themes";
|
|
5
5
|
import { getAccent } from "@adea-ai/ui/lib/accent-presets";
|
|
6
6
|
import { colorToHex, normalizeAccentValue, parseColor } from "@adea-ai/ui/lib/accent-roles";
|
|
7
7
|
import { defaultThemeRecord } from "@adea-ai/ui/lib/theme-projection";
|
|
8
8
|
// src/appearance/theme-record-adapter.ts
|
|
9
9
|
var adeaLight = defaultThemeRecord("light");
|
|
10
10
|
var adeaDark = defaultThemeRecord("dark");
|
|
11
|
+
var MAX_ACCENT_PREVIEWS_PER_THEME = 16;
|
|
12
|
+
var accentRolesByTheme = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
var importedRecordsByVariant = /* @__PURE__ */ new WeakMap();
|
|
11
14
|
/** The published blue preset is the host's default custom accent. */
|
|
12
15
|
var DEFAULT_CUSTOM_ACCENT = getAccent("blue")?.light ?? adeaLight.colors.accent;
|
|
13
16
|
/** Imported themes, re-projected on every registry change. */
|
|
14
17
|
function customThemeRecords() {
|
|
15
18
|
return customThemeVariants().map(storedVariantRecord);
|
|
16
19
|
}
|
|
20
|
+
function importedRecordForPreview(variant) {
|
|
21
|
+
const cached = importedRecordsByVariant.get(variant);
|
|
22
|
+
if (cached) return cached;
|
|
23
|
+
const record = storedVariantRecord(variant);
|
|
24
|
+
importedRecordsByVariant.set(variant, record);
|
|
25
|
+
return record;
|
|
26
|
+
}
|
|
27
|
+
function accentRolesForPreview(theme, key, resolve) {
|
|
28
|
+
if (!key) return resolve();
|
|
29
|
+
const cached = accentRolesByTheme.get(theme);
|
|
30
|
+
if (cached?.has(key)) return cached.get(key) ?? void 0;
|
|
31
|
+
const roles = resolve();
|
|
32
|
+
const byKey = cached ?? /* @__PURE__ */ new Map();
|
|
33
|
+
byKey.delete(key);
|
|
34
|
+
byKey.set(key, roles ?? null);
|
|
35
|
+
if (byKey.size > MAX_ACCENT_PREVIEWS_PER_THEME) {
|
|
36
|
+
const oldest = byKey.keys().next().value;
|
|
37
|
+
if (oldest !== void 0) byKey.delete(oldest);
|
|
38
|
+
}
|
|
39
|
+
accentRolesByTheme.set(theme, byKey);
|
|
40
|
+
return roles;
|
|
41
|
+
}
|
|
17
42
|
/** The built-in catalogue led by the published pair; import lives separately. */
|
|
18
43
|
var appearanceThemeRecords = Object.freeze([
|
|
19
44
|
adeaLight,
|
|
@@ -26,12 +51,14 @@ function allThemeRecords() {
|
|
|
26
51
|
}
|
|
27
52
|
function withAccent(theme, accent, pair) {
|
|
28
53
|
if (accent === "theme") return theme;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
54
|
+
const roles = accentRolesForPreview(theme, getAccent(accent) ? accent : void 0, () => {
|
|
55
|
+
const variant = themeRegistry().find((candidate) => candidate.id === theme.id);
|
|
56
|
+
if (!variant) return void 0;
|
|
57
|
+
return accentRolesForSelection(accent, theme.appearance, pair, {
|
|
58
|
+
background: variant.colors.background,
|
|
59
|
+
floor: 3,
|
|
60
|
+
variantId: variant.id
|
|
61
|
+
});
|
|
35
62
|
});
|
|
36
63
|
if (!roles) return theme;
|
|
37
64
|
return {
|
|
@@ -51,11 +78,12 @@ function withAccent(theme, accent, pair) {
|
|
|
51
78
|
function appearanceThemeForPreview(variant, accent, pair) {
|
|
52
79
|
const catalogueRecord = themeRecordById(variant.id);
|
|
53
80
|
const importedVariant = catalogueRecord ? void 0 : customThemeVariantById(variant.id);
|
|
54
|
-
return withAccent(catalogueRecord ?? (importedVariant ?
|
|
81
|
+
return withAccent(catalogueRecord ?? (importedVariant ? importedRecordForPreview(importedVariant) : variant.appearance === "dark" ? adeaDark : adeaLight), accent, pair);
|
|
55
82
|
}
|
|
56
83
|
/** Preserve the host's invalid-input behavior while feeding the pure editor. */
|
|
57
84
|
function normalizeCustomAccent(value, background) {
|
|
58
|
-
const
|
|
85
|
+
const canvas = tokensAsHex({ background }).background ?? background;
|
|
86
|
+
const normalized = normalizeAccentValue(value, canvas);
|
|
59
87
|
if (normalized === void 0) return { error: `“${value}” is not a hex color such as ${DEFAULT_CUSTOM_ACCENT}.` };
|
|
60
88
|
const parsed = parseColor(normalized);
|
|
61
89
|
return { value: parsed ? colorToHex({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createApplication } from "../app/create-application.js";
|
|
3
3
|
import { runCli } from "./cli-runner.js";
|
|
4
4
|
// src/cli/create-application-cli.ts
|
|
5
|
-
var usage = "Usage: create-adea-app --directory PATH --slug SLUG --name NAME --identifier REVERSE_DNS --source-url HTTPS_URL --framework SPECIFIER [--repository OWNER/NAME] [--renderer native|cef]";
|
|
5
|
+
var usage = "Usage: create-adea-app --directory PATH --slug SLUG --name NAME --identifier REVERSE_DNS --source-url HTTPS_URL --framework SPECIFIER [--repository OWNER/NAME] [--renderer native|cef] [--gitlab-runner-tags TAG,TAG]";
|
|
6
6
|
var allowed = /* @__PURE__ */ new Set([
|
|
7
7
|
"directory",
|
|
8
8
|
"slug",
|
|
@@ -11,7 +11,8 @@ var allowed = /* @__PURE__ */ new Set([
|
|
|
11
11
|
"source-url",
|
|
12
12
|
"framework",
|
|
13
13
|
"repository",
|
|
14
|
-
"renderer"
|
|
14
|
+
"renderer",
|
|
15
|
+
"gitlab-runner-tags"
|
|
15
16
|
]);
|
|
16
17
|
await runCli((error) => error instanceof Error ? error.message : "Could not create application", async () => {
|
|
17
18
|
const args = process.argv.slice(2);
|
|
@@ -26,7 +27,7 @@ await runCli((error) => error instanceof Error ? error.message : "Could not crea
|
|
|
26
27
|
if (!allowed.has(key) || values[key] !== void 0 || !value || value.startsWith("--")) throw new Error(usage);
|
|
27
28
|
values[key] = value;
|
|
28
29
|
}
|
|
29
|
-
const { directory, slug, name, identifier, "source-url": sourceUrl, framework, repository, renderer } = values;
|
|
30
|
+
const { directory, slug, name, identifier, "source-url": sourceUrl, framework, repository, renderer, "gitlab-runner-tags": gitlabRunnerTags } = values;
|
|
30
31
|
if (!directory || !slug || !name || !identifier || !sourceUrl || !framework || renderer && renderer !== "native" && renderer !== "cef") throw new Error(usage);
|
|
31
32
|
const result = await createApplication({
|
|
32
33
|
directory,
|
|
@@ -36,7 +37,8 @@ await runCli((error) => error instanceof Error ? error.message : "Could not crea
|
|
|
36
37
|
sourceUrl,
|
|
37
38
|
repository,
|
|
38
39
|
frameworkSpecifier: framework,
|
|
39
|
-
renderer
|
|
40
|
+
renderer,
|
|
41
|
+
gitlabRunnerTags: gitlabRunnerTags?.split(",").map((tag) => tag.trim())
|
|
40
42
|
});
|
|
41
43
|
console.log(`Created application at ${result.directory}`);
|
|
42
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.
|
|
1
|
+
{"version":"0.31.0","commit":"970131b382d646d07de21bdd58359188bf171df4"}
|