@motion-proto/live-tokens 0.67.0 → 0.68.1
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/CHANGELOG.md +54 -0
- package/README.md +67 -9
- package/bin/generate-theme.mjs +5 -4
- package/dist-plugin/adjust/index.d.cts +1 -1
- package/dist-plugin/adjust/index.d.ts +1 -1
- package/dist-plugin/{chunk-T4PMCFJN.js → chunk-2UX6EVVA.js} +30 -30
- package/dist-plugin/{dataPaths-DZUzVv8H.d.cts → dataPaths-bJTCEO4H.d.cts} +1 -1
- package/dist-plugin/{dataPaths-DZUzVv8H.d.ts → dataPaths-bJTCEO4H.d.ts} +1 -1
- package/dist-plugin/fontPairing/index.d.cts +1 -1
- package/dist-plugin/fontPairing/index.d.ts +1 -1
- package/dist-plugin/generateColorsAndType/index.d.cts +1 -1
- package/dist-plugin/generateColorsAndType/index.d.ts +1 -1
- package/dist-plugin/index.cjs +32 -32
- package/dist-plugin/index.d.cts +1 -1
- package/dist-plugin/index.d.ts +1 -1
- package/dist-plugin/index.js +5 -5
- package/dist-plugin/migrateData/index.cjs +30 -30
- package/dist-plugin/migrateData/index.d.cts +1 -1
- package/dist-plugin/migrateData/index.d.ts +1 -1
- package/dist-plugin/migrateData/index.js +1 -1
- package/dist-plugin/tokensCssMigrations/index.d.cts +1 -1
- package/dist-plugin/tokensCssMigrations/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/editor/bootstrap.ts +6 -6
- package/src/editor/component-editor/ImageLightboxEditor.svelte +1 -1
- package/src/editor/component-editor/scaffolding/ComponentFileManager.svelte +4 -4
- package/src/editor/core/fonts/fontLoader.ts +2 -2
- package/src/editor/core/preview/{lookPreview.ts → themePreview.ts} +27 -27
- package/src/editor/core/productionPulse.ts +3 -3
- package/src/editor/core/sketch/index.ts +52 -44
- package/src/editor/core/sketch/maskField.ts +9 -9
- package/src/editor/core/sketch/sketchLayer.ts +9 -9
- package/src/editor/core/sketch/sketchRegistry.ts +34 -34
- package/src/editor/core/sketch/sketchStore.ts +98 -83
- package/src/editor/core/sketch/sketchStyleService.ts +4 -4
- package/src/editor/core/sketch/sketchStyles.ts +28 -28
- package/src/editor/core/themes/colorsAndTypeService.ts +1 -1
- package/src/editor/core/themes/loadRows.ts +8 -8
- package/src/editor/core/themes/themeDocumentSync.ts +2 -2
- package/src/editor/core/themes/themeInit.ts +2 -2
- package/src/editor/core/themes/themeService.ts +17 -17
- package/src/editor/core/themes/{lookSummary.ts → themeSummary.ts} +9 -9
- package/src/editor/core/themes/themeTypes.ts +10 -6
- package/src/editor/docs/content/getting-started.md +1 -1
- package/src/editor/docs/content/sketch-mode.md +22 -17
- package/src/editor/docs/content/themes-workflow.md +11 -11
- package/src/editor/docs/content/where-themes-live.md +6 -6
- package/src/editor/docs/content.generated.ts +4 -4
- package/src/editor/index.ts +2 -2
- package/src/editor/ui/ThemePanel.svelte +52 -52
- package/src/editor/ui/sketch/SketchPreview.svelte +2 -2
- package/src/editor/ui/sketch/SketchTab.svelte +64 -38
- package/src/live-tokens/data/sketch-styles/dry.json +5 -5
- package/src/live-tokens/data/sketch-styles/hatched.json +9 -9
- package/src/live-tokens/data/sketch-styles/napkin.json +4 -4
- package/src/live-tokens/data/sketch-styles/pencil.json +2 -2
- package/src/live-tokens/data/themes/autumn.json +1 -1
- package/src/live-tokens/data/themes/halloween.json +1 -1
- package/src/live-tokens/data/themes/midnight-study.json +1 -1
- package/src/live-tokens/data/themes/ocean.json +1 -1
- package/src/live-tokens/data/themes/royal-velvet.json +1 -1
- package/src/live-tokens/data/themes/sketchy.json +1 -1
- package/src/live-tokens/data/themes/spring-meadow.json +1 -1
- package/src/live-tokens/data/themes/sunset.json +1 -1
- package/src/system/backdrop/backdrop.ts +1 -1
- package/src/system/components/SectionDivider.svelte +1 -1
package/dist-plugin/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
export { ComponentSource, MissingToken, RunResult, TOKENS_CSS_MIGRATIONS, TokensCssMigration, ValidateInput, runTokensCssMigrations, validateTokensCss } from './tokensCssMigrations/index.cjs';
|
|
3
|
-
import './dataPaths-
|
|
3
|
+
import './dataPaths-bJTCEO4H.cjs';
|
|
4
4
|
|
|
5
5
|
interface ThemeFileApiOptions {
|
|
6
6
|
tokensCssPath: string;
|
package/dist-plugin/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
export { ComponentSource, MissingToken, RunResult, TOKENS_CSS_MIGRATIONS, TokensCssMigration, ValidateInput, runTokensCssMigrations, validateTokensCss } from './tokensCssMigrations/index.js';
|
|
3
|
-
import './dataPaths-
|
|
3
|
+
import './dataPaths-bJTCEO4H.js';
|
|
4
4
|
|
|
5
5
|
interface ThemeFileApiOptions {
|
|
6
6
|
tokensCssPath: string;
|
package/dist-plugin/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
nextAvailableName,
|
|
14
14
|
normalizeTheme,
|
|
15
15
|
versionedFileResourceServer
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2UX6EVVA.js";
|
|
17
17
|
import {
|
|
18
18
|
CURRENT_COMPONENT_SCHEMA_VERSION
|
|
19
19
|
} from "./chunk-NE6N66EE.js";
|
|
@@ -620,7 +620,7 @@ ${lines.join("\n")}
|
|
|
620
620
|
}
|
|
621
621
|
function warnOnLegacyLayout(evidence, warn) {
|
|
622
622
|
warn(
|
|
623
|
-
`[live-tokens] This project still uses the data layout from 0.47 and earlier: ${evidence}. Since 0.48 the whole-
|
|
623
|
+
`[live-tokens] This project still uses the data layout from 0.47 and earlier: ${evidence}. Since 0.48 the whole-theme theme files live in \`themes/\` and the colors and type live in \`colors-and-type/\`. Nothing in the data directory was written, the editor cannot save, and ${path.basename(GENERATED_CSS_PATH)} is left exactly as it is. Run \`npx live-tokens migrate\` to move the directories and heal the tree, then restart the dev server.`
|
|
624
624
|
);
|
|
625
625
|
}
|
|
626
626
|
function warnOnUnmigratedSketchStyles(warn) {
|
|
@@ -1377,7 +1377,7 @@ ${lines.join("\n")}
|
|
|
1377
1377
|
filled
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
|
-
async function
|
|
1380
|
+
async function handleAdoptTheme({ res }) {
|
|
1381
1381
|
const activeName = themesResource.getActiveName();
|
|
1382
1382
|
if (activeName === "default") {
|
|
1383
1383
|
jsonResponse(res, 409, {
|
|
@@ -1542,7 +1542,7 @@ ${lines.join("\n")}
|
|
|
1542
1542
|
{ method: "GET", pattern: THEME_BY_NAME_REGEX, handler: handleThemeByName },
|
|
1543
1543
|
{ method: "PUT", pattern: THEME_BY_NAME_REGEX, handler: handleThemeByName },
|
|
1544
1544
|
{ method: "DELETE", pattern: THEME_BY_NAME_REGEX, handler: handleThemeByName },
|
|
1545
|
-
// Production — the whole-
|
|
1545
|
+
// Production — the whole-theme adopt door
|
|
1546
1546
|
{ method: "GET", pattern: SKETCH_STYLES_ROUTE, handler: handleListSketchStyles },
|
|
1547
1547
|
{ method: "PUT", pattern: SKETCH_STYLES_ROUTE, handler: methodNotAllowed },
|
|
1548
1548
|
{ method: "POST", pattern: SKETCH_STYLES_ROUTE, handler: methodNotAllowed },
|
|
@@ -1551,7 +1551,7 @@ ${lines.join("\n")}
|
|
|
1551
1551
|
{ method: "PUT", pattern: SKETCH_STYLE_BY_NAME_REGEX, handler: handleSketchStyleByName },
|
|
1552
1552
|
{ method: "DELETE", pattern: SKETCH_STYLE_BY_NAME_REGEX, handler: handleSketchStyleByName },
|
|
1553
1553
|
{ method: "POST", pattern: SKETCH_STYLE_BY_NAME_REGEX, handler: methodNotAllowed },
|
|
1554
|
-
{ method: "PUT", pattern: PRODUCTION_ROUTE, handler:
|
|
1554
|
+
{ method: "PUT", pattern: PRODUCTION_ROUTE, handler: handleAdoptTheme },
|
|
1555
1555
|
{ method: "GET", pattern: PRODUCTION_ROUTE, handler: methodNotAllowed },
|
|
1556
1556
|
{ method: "POST", pattern: PRODUCTION_ROUTE, handler: methodNotAllowed },
|
|
1557
1557
|
{ method: "DELETE", pattern: PRODUCTION_ROUTE, handler: methodNotAllowed }
|
|
@@ -1037,7 +1037,7 @@ function synthesizeSectionDividerGradients(stringPart, objectPart) {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
1039
|
// src/editor/core/themes/themeTypes.ts
|
|
1040
|
-
var THEME_SCHEMA_VERSION =
|
|
1040
|
+
var THEME_SCHEMA_VERSION = 5;
|
|
1041
1041
|
|
|
1042
1042
|
// src/editor/core/components/componentConfigKeys.ts
|
|
1043
1043
|
var KNOWN_COMPONENT_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -1058,7 +1058,7 @@ var pencil_default = {
|
|
|
1058
1058
|
name: "Pencil",
|
|
1059
1059
|
settings: {
|
|
1060
1060
|
label: "Pencil",
|
|
1061
|
-
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does.
|
|
1061
|
+
blurb: "Two graphite passes on their own seeds, so the outline disagrees with itself the way a hand coming back round does. The grain is drawn long and on the diagonal, the way a pencil shades.",
|
|
1062
1062
|
fillTravel: 0.75,
|
|
1063
1063
|
strokeTravel: 1.25,
|
|
1064
1064
|
wobble: 30,
|
|
@@ -1223,15 +1223,15 @@ var hatched_default = {
|
|
|
1223
1223
|
pressureMod: 0.45,
|
|
1224
1224
|
pooling: 0.8,
|
|
1225
1225
|
strokeInk: 1,
|
|
1226
|
-
maskOn:
|
|
1227
|
-
maskBlobX:
|
|
1228
|
-
maskBlobY:
|
|
1229
|
-
maskBlobLinked:
|
|
1230
|
-
maskAngle:
|
|
1231
|
-
maskOutputMin: 0.
|
|
1226
|
+
maskOn: true,
|
|
1227
|
+
maskBlobX: 10,
|
|
1228
|
+
maskBlobY: 600,
|
|
1229
|
+
maskBlobLinked: false,
|
|
1230
|
+
maskAngle: 150,
|
|
1231
|
+
maskOutputMin: 0.35,
|
|
1232
1232
|
maskOutputMax: 1,
|
|
1233
1233
|
maskOctaves: 2,
|
|
1234
|
-
maskGrain: "
|
|
1234
|
+
maskGrain: "turbulence",
|
|
1235
1235
|
maskPosterize: 1,
|
|
1236
1236
|
maskSoftness: 1.5,
|
|
1237
1237
|
jitterX: 1.5,
|
|
@@ -1245,7 +1245,7 @@ var hatched_default = {
|
|
|
1245
1245
|
iconMaskOn: false,
|
|
1246
1246
|
iconMaskScale: 1
|
|
1247
1247
|
},
|
|
1248
|
-
updatedAt: "2026-08-
|
|
1248
|
+
updatedAt: "2026-08-28T21:17:18.232Z",
|
|
1249
1249
|
createdAt: "2026-08-28T15:47:36.934Z"
|
|
1250
1250
|
};
|
|
1251
1251
|
|
|
@@ -1326,16 +1326,16 @@ var napkin_default = {
|
|
|
1326
1326
|
maskBlobY: 150,
|
|
1327
1327
|
maskBlobLinked: true,
|
|
1328
1328
|
maskAngle: 0,
|
|
1329
|
-
maskOutputMin: 0.
|
|
1330
|
-
maskOutputMax:
|
|
1329
|
+
maskOutputMin: 0.62,
|
|
1330
|
+
maskOutputMax: 1,
|
|
1331
1331
|
maskOctaves: 2,
|
|
1332
1332
|
maskGrain: "fractal",
|
|
1333
1333
|
maskPosterize: 2,
|
|
1334
|
-
maskSoftness:
|
|
1334
|
+
maskSoftness: 5,
|
|
1335
1335
|
jitterX: 6,
|
|
1336
1336
|
jitterY: 6,
|
|
1337
1337
|
jitterRot: 1.8,
|
|
1338
|
-
jitterScale: 0.
|
|
1338
|
+
jitterScale: 0.075,
|
|
1339
1339
|
cornerSpread: 20,
|
|
1340
1340
|
cornerTravel: 17,
|
|
1341
1341
|
iconTravel: 2.25,
|
|
@@ -1371,11 +1371,11 @@ var dry_default = {
|
|
|
1371
1371
|
pooling: 1.5,
|
|
1372
1372
|
strokeInk: 0.4,
|
|
1373
1373
|
maskOn: true,
|
|
1374
|
-
maskBlobX:
|
|
1375
|
-
maskBlobY:
|
|
1374
|
+
maskBlobX: 170,
|
|
1375
|
+
maskBlobY: 170,
|
|
1376
1376
|
maskBlobLinked: true,
|
|
1377
1377
|
maskAngle: 0,
|
|
1378
|
-
maskOutputMin: 0.
|
|
1378
|
+
maskOutputMin: 0.57,
|
|
1379
1379
|
maskOutputMax: 0.91,
|
|
1380
1380
|
maskOctaves: 2,
|
|
1381
1381
|
maskGrain: "fractal",
|
|
@@ -1392,18 +1392,18 @@ var dry_default = {
|
|
|
1392
1392
|
iconMaskOn: true,
|
|
1393
1393
|
iconMaskScale: 3.8
|
|
1394
1394
|
},
|
|
1395
|
-
updatedAt: "2026-08-
|
|
1395
|
+
updatedAt: "2026-08-28T21:19:51.383Z",
|
|
1396
1396
|
createdAt: "2026-08-28T15:47:36.934Z"
|
|
1397
1397
|
};
|
|
1398
1398
|
|
|
1399
1399
|
// src/editor/core/sketch/sketchStyles.ts
|
|
1400
1400
|
var SHIPPED_FILES = { pencil: pencil_default, marker: marker_default, whiteboard: whiteboard_default, hatched: hatched_default, dashed: dashed_default, napkin: napkin_default, dry: dry_default };
|
|
1401
|
-
var
|
|
1401
|
+
var SHIPPED_SKETCH_SETTINGS = Object.fromEntries(
|
|
1402
1402
|
Object.entries(SHIPPED_FILES).map(([id, file]) => [id, file.settings])
|
|
1403
1403
|
);
|
|
1404
1404
|
var DEFAULT_SKETCH_STYLE = "marker";
|
|
1405
|
-
function
|
|
1406
|
-
const base =
|
|
1405
|
+
function hydrateSketchSettings(raw) {
|
|
1406
|
+
const base = SHIPPED_SKETCH_SETTINGS[DEFAULT_SKETCH_STYLE];
|
|
1407
1407
|
const stored = raw ?? {};
|
|
1408
1408
|
const out = { ...base };
|
|
1409
1409
|
for (const key of Object.keys(base)) {
|
|
@@ -1567,10 +1567,10 @@ function normalizeTheme(raw, resolvers) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
const componentConfigs = {};
|
|
1569
1569
|
for (const [comp, value] of Object.entries(asObject(src.componentConfigs) ?? {})) {
|
|
1570
|
-
const
|
|
1570
|
+
const embedded2 = asObject(value);
|
|
1571
1571
|
let resolvedConfig;
|
|
1572
|
-
if (
|
|
1573
|
-
resolvedConfig = stripFileMarker(
|
|
1572
|
+
if (embedded2) {
|
|
1573
|
+
resolvedConfig = stripFileMarker(embedded2);
|
|
1574
1574
|
} else {
|
|
1575
1575
|
const configName = asString(value, "default");
|
|
1576
1576
|
const resolved = asObject(resolvers.readComponentConfig(comp, configName));
|
|
@@ -1605,8 +1605,8 @@ function normalizeTheme(raw, resolvers) {
|
|
|
1605
1605
|
if (!(key in baseAliases)) filled.orphans++;
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
|
-
const
|
|
1609
|
-
const
|
|
1608
|
+
const embedded = asObject(src.sketchSettings) ?? asObject(src.sketchStyle);
|
|
1609
|
+
const sketchSettings = embedded ? hydrateSketchSettings(embedded) : void 0;
|
|
1610
1610
|
return {
|
|
1611
1611
|
theme: {
|
|
1612
1612
|
name: asString(src.name, "Untitled"),
|
|
@@ -1616,7 +1616,7 @@ function normalizeTheme(raw, resolvers) {
|
|
|
1616
1616
|
colorsAndType,
|
|
1617
1617
|
componentConfigs,
|
|
1618
1618
|
componentSchemaVersion: CURRENT_COMPONENT_SCHEMA_VERSION,
|
|
1619
|
-
...
|
|
1619
|
+
...sketchSettings ? { sketchSettings } : {}
|
|
1620
1620
|
},
|
|
1621
1621
|
dropped,
|
|
1622
1622
|
migrated,
|
|
@@ -1671,7 +1671,7 @@ function detectLegacyLayout(input) {
|
|
|
1671
1671
|
const manifestsDir = input.configuredManifestsDir ?? import_path2.default.join(input.dataDir, "manifests");
|
|
1672
1672
|
const themesHoldAThemeFile = holdsATheme(input.themesDir);
|
|
1673
1673
|
if (isDirectory(manifestsDir) && !themesHoldAThemeFile) {
|
|
1674
|
-
return { manifestsDir, evidence: `${manifestsDir} is the pre-0.48 whole-
|
|
1674
|
+
return { manifestsDir, evidence: `${manifestsDir} is the pre-0.48 whole-theme directory` };
|
|
1675
1675
|
}
|
|
1676
1676
|
if (jsonFiles(input.colorsAndTypeDir).length > 0) return null;
|
|
1677
1677
|
for (const file of jsonFiles(input.themesDir)) {
|
|
@@ -1694,12 +1694,12 @@ function planLegacyRenames(layout, input) {
|
|
|
1694
1694
|
const defaultThemes = import_path2.default.join(input.dataDir, "themes");
|
|
1695
1695
|
if (input.configuredManifestsDir && import_path2.default.resolve(input.configuredManifestsDir) !== import_path2.default.join(input.dataDir, "manifests")) {
|
|
1696
1696
|
throw new Error(
|
|
1697
|
-
`This project uses the pre-0.48 data layout (${layout.evidence}), and live-tokens.config.json sets the retired "manifestsDir" key to ${input.configuredManifestsDir}. That directory holds the whole
|
|
1697
|
+
`This project uses the pre-0.48 data layout (${layout.evidence}), and live-tokens.config.json sets the retired "manifestsDir" key to ${input.configuredManifestsDir}. That directory holds the whole themes, which now belong in ${input.themesDir}. Move it there by hand, drop the "manifestsDir" key, then run the migration again.`
|
|
1698
1698
|
);
|
|
1699
1699
|
}
|
|
1700
1700
|
if (import_path2.default.resolve(input.colorsAndTypeDir) !== import_path2.default.resolve(defaultColorsAndType) || import_path2.default.resolve(input.themesDir) !== import_path2.default.resolve(defaultThemes)) {
|
|
1701
1701
|
throw new Error(
|
|
1702
|
-
`This project uses the pre-0.48 data layout (${layout.evidence}), and its data directories are configured to custom paths (colorsAndTypeDir=${input.colorsAndTypeDir}, themesDir=${input.themesDir}). The migration cannot tell which directory holds what. Move the old colors-and-type directory to ${input.colorsAndTypeDir} and the old whole-
|
|
1702
|
+
`This project uses the pre-0.48 data layout (${layout.evidence}), and its data directories are configured to custom paths (colorsAndTypeDir=${input.colorsAndTypeDir}, themesDir=${input.themesDir}). The migration cannot tell which directory holds what. Move the old colors-and-type directory to ${input.colorsAndTypeDir} and the old whole-theme directory to ${input.themesDir} by hand, then run the migration again.`
|
|
1703
1703
|
);
|
|
1704
1704
|
}
|
|
1705
1705
|
const renames = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motion-proto/live-tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Design token editor with live CSS variable editing. Svelte 5 + Vite 8.",
|
|
6
6
|
"keywords": [
|
|
@@ -123,9 +123,9 @@
|
|
|
123
123
|
"./app/fonts.css": "./src/system/styles/fonts.css"
|
|
124
124
|
},
|
|
125
125
|
"scripts": {
|
|
126
|
-
"dev": "vite",
|
|
127
|
-
"build": "vite build",
|
|
128
|
-
"preview": "vite preview",
|
|
126
|
+
"dev": "VITE_CONFIG_NATIVE_IGNORE_WARNING=true vite",
|
|
127
|
+
"build": "VITE_CONFIG_NATIVE_IGNORE_WARNING=true vite build",
|
|
128
|
+
"preview": "VITE_CONFIG_NATIVE_IGNORE_WARNING=true vite preview",
|
|
129
129
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
130
130
|
"test": "vitest run",
|
|
131
131
|
"test:watch": "vitest",
|
package/src/editor/bootstrap.ts
CHANGED
|
@@ -22,16 +22,16 @@ import * as editorStore from './core/store/editorStore';
|
|
|
22
22
|
import * as themeDocumentSync from './core/themes/themeDocumentSync';
|
|
23
23
|
import { initializeTheme } from './core/themes/themeInit';
|
|
24
24
|
import { registerComponent, type RegisterComponentEntry } from './component-editor/registry';
|
|
25
|
-
import {
|
|
25
|
+
import { registerSketchStyle, type RegisterSketchStyleInput } from './core/sketch/sketchRegistry';
|
|
26
26
|
|
|
27
27
|
export interface BootLiveTokensOptions {
|
|
28
28
|
/** Consumer-authored components to register with the editor before mount. Dev-only. */
|
|
29
29
|
components?: RegisterComponentEntry[];
|
|
30
|
-
/** Sketchstyles this project ships, joining the shipped
|
|
30
|
+
/** Sketchstyles this project ships, joining the shipped sketchstyles in every
|
|
31
31
|
picker. Registered in a build as well as in dev: carrying a customized
|
|
32
32
|
sketchstyle to a published site is the whole point, so these must not sit
|
|
33
33
|
behind the DEV guard `components` sits behind. */
|
|
34
|
-
|
|
34
|
+
sketchStyles?: RegisterSketchStyleInput[];
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export async function bootLiveTokens(
|
|
@@ -44,10 +44,10 @@ export async function bootLiveTokens(
|
|
|
44
44
|
columnsOverlay.init();
|
|
45
45
|
editorStore.init();
|
|
46
46
|
|
|
47
|
-
// Before the DEV block: `initializeTheme` recovers the open theme's
|
|
47
|
+
// Before the DEV block: `initializeTheme` recovers the open theme's style by
|
|
48
48
|
// name against the pool, so the pool has to be whole by the time it runs.
|
|
49
|
-
if (opts.
|
|
50
|
-
for (const
|
|
49
|
+
if (opts.sketchStyles) {
|
|
50
|
+
for (const style of opts.sketchStyles) registerSketchStyle(style);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (import.meta.env.DEV) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export const component = 'imagelightbox';
|
|
5
5
|
|
|
6
6
|
// Three parts: tile (closed inline + animated modal surface), overlay (scrim),
|
|
7
|
-
// chrome (shared toolbar + close-button
|
|
7
|
+
// chrome (shared toolbar + close-button styling). Chrome carries a hover state
|
|
8
8
|
// for the interactive controls. No second variant.
|
|
9
9
|
const states: Record<string, Token[]> = {
|
|
10
10
|
tile: [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
productionTheme,
|
|
30
30
|
} from '../../core/productionPulse';
|
|
31
31
|
import {
|
|
32
|
-
|
|
32
|
+
adoptTheme,
|
|
33
33
|
getActiveTheme,
|
|
34
34
|
getProductionTheme,
|
|
35
35
|
listThemes,
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
|
-
* Adopt ships the whole
|
|
242
|
+
* Adopt ships the whole theme, because production is one saved theme: flush
|
|
243
243
|
* this component, save the open theme, publish it. The protected Default
|
|
244
244
|
* theme cannot record what shipped, so it prompts for a theme name first and
|
|
245
245
|
* retries.
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
try {
|
|
262
262
|
if (wasDirty) await persist();
|
|
263
263
|
await saveActiveTheme();
|
|
264
|
-
await
|
|
264
|
+
await adoptTheme();
|
|
265
265
|
await refreshProduction();
|
|
266
266
|
bumpProductionRevision();
|
|
267
267
|
adoptFeedback = wasDirty
|
|
@@ -401,7 +401,7 @@
|
|
|
401
401
|
</UISquareButton>
|
|
402
402
|
<UIInfoPopover title="Component Configuration" ariaLabel="About Save and Adopt">
|
|
403
403
|
<p>
|
|
404
|
-
<strong>Save</strong> keeps your edits in the theme you have open. The theme carries a copy of every component you changed, so the
|
|
404
|
+
<strong>Save</strong> keeps your edits in the theme you have open. The theme carries a copy of every component you changed, so the theme travels as one file.
|
|
405
405
|
</p>
|
|
406
406
|
<p>
|
|
407
407
|
<strong>Save As</strong> writes the component's settings to a file of their own, ready to load into any theme.
|
|
@@ -131,10 +131,10 @@ export function resolveFontStackValues(
|
|
|
131
131
|
* in an iframe) via the same pipeline used for color variables.
|
|
132
132
|
*
|
|
133
133
|
* Returns the variables it set, so a caller tracking what it has applied — to
|
|
134
|
-
* tear those vars down when switching
|
|
134
|
+
* tear those vars down when switching themes — can record them without keeping
|
|
135
135
|
* its own copy of the stack list. A hand-maintained copy silently falls behind
|
|
136
136
|
* whenever a stack is added here, leaving the missed variable stuck at the
|
|
137
|
-
* outgoing
|
|
137
|
+
* outgoing theme's value; `--font-editorial` did exactly that.
|
|
138
138
|
*/
|
|
139
139
|
export function applyFontStacks(
|
|
140
140
|
stacks: FontStack[],
|
|
@@ -9,11 +9,11 @@ import { loadTheme } from '../themes/themeService';
|
|
|
9
9
|
import { previewSketchStyle, revertSketchStylePreview } from '../sketch/sketchStore';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Client-side rendering of a saved file, for browsing
|
|
13
|
-
* one. A theme previews as a whole
|
|
12
|
+
* Client-side rendering of a saved file, for browsing themes without committing
|
|
13
|
+
* one. A theme previews as a whole next; a colors-and-type file previews as
|
|
14
14
|
* colors and type over the components the user has right now. Nothing here writes to the server,
|
|
15
15
|
* mutates the editor store, or marks anything dirty: a preview is paint only.
|
|
16
|
-
* Save-As stays honest because `
|
|
16
|
+
* Save-As stays honest because `captureThemeContent` reads the server's active files,
|
|
17
17
|
* which a preview never touches.
|
|
18
18
|
*
|
|
19
19
|
* Both painting and reverting run the same derivation the renderer runs on
|
|
@@ -27,23 +27,23 @@ import { previewSketchStyle, revertSketchStylePreview } from '../sketch/sketchSt
|
|
|
27
27
|
* CSS vars do.
|
|
28
28
|
*
|
|
29
29
|
* One preview is live at a time, whichever kind it is: painting reverts first,
|
|
30
|
-
* so every
|
|
30
|
+
* so every next is a diff against the user's real state.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
/** Everything a
|
|
33
|
+
/** Everything a next puts on the page: the full var set (colors and type,
|
|
34
34
|
* components and the composed `--font-*` stacks) plus the sources its faces
|
|
35
35
|
* come from. */
|
|
36
|
-
export interface
|
|
36
|
+
export interface RenderedTheme {
|
|
37
37
|
vars: Record<string, string>;
|
|
38
38
|
fontSources: FontSource[];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The full var set a theme paints. Components the theme carries no config
|
|
43
|
-
* for render `defaults`' config, matching Apply's complete-
|
|
43
|
+
* for render `defaults`' config, matching Apply's complete-next semantics;
|
|
44
44
|
* configs for components this install lacks are skipped, as Apply skips them.
|
|
45
45
|
*/
|
|
46
|
-
export function
|
|
46
|
+
export function renderTheme(theme: Theme, defaults: Theme): RenderedTheme {
|
|
47
47
|
const colorsAndType = structuredClone(theme.colorsAndType);
|
|
48
48
|
migrateColorsAndTypeFonts(colorsAndType);
|
|
49
49
|
const state = colorsAndTypeToState(colorsAndType);
|
|
@@ -60,27 +60,27 @@ export function themeLook(theme: Theme, defaults: Theme): RenderedLook {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* The full var set colors and type paint on their own. They are not a whole
|
|
63
|
+
* The full var set colors and type paint on their own. They are not a whole next,
|
|
64
64
|
* so the components stay as the user has them: `colorsAndTypeToState` carries the live
|
|
65
65
|
* component slice forward (`loadComponentsFromVars`) and strips component-owned
|
|
66
66
|
* vars out of their own bag, which is exactly the composition a preview
|
|
67
67
|
* wants. No defaults fetch, no component reset.
|
|
68
68
|
*/
|
|
69
|
-
export function
|
|
69
|
+
export function renderColorsAndType(colorsAndType: ColorsAndType): RenderedTheme {
|
|
70
70
|
const next = structuredClone(colorsAndType);
|
|
71
71
|
migrateColorsAndTypeFonts(next);
|
|
72
72
|
const vars = deriveCssVars(colorsAndTypeToState(next));
|
|
73
73
|
return { vars, fontSources: next.fontSources ?? [] };
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/** The
|
|
77
|
-
export function
|
|
76
|
+
/** The next the editor store currently describes — the state a revert returns to. */
|
|
77
|
+
export function liveTheme(): RenderedTheme {
|
|
78
78
|
const state = get(editorState);
|
|
79
79
|
const vars = deriveCssVars(state);
|
|
80
80
|
return { vars, fontSources: state.fonts.sources };
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
let livePreview:
|
|
83
|
+
let livePreview: RenderedTheme | null = null;
|
|
84
84
|
let defaultsPromise: Promise<Theme> | null = null;
|
|
85
85
|
// Whether the current preview session has a sketchstyle painted over the live
|
|
86
86
|
// buffer, so a colors-only preview (which never previews sketch) and revert
|
|
@@ -101,7 +101,7 @@ function loadDefaults(): Promise<Theme> {
|
|
|
101
101
|
return defaultsPromise;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function paint(next:
|
|
104
|
+
function paint(next: RenderedTheme, from: RenderedTheme): void {
|
|
105
105
|
batchCssVarChanges(() => {
|
|
106
106
|
for (const [name, value] of Object.entries(next.vars)) {
|
|
107
107
|
if (from.vars[name] !== value) setCssVar(name, value);
|
|
@@ -114,33 +114,33 @@ function paint(next: RenderedLook, from: RenderedLook): void {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* Show `
|
|
117
|
+
* Show `next` on the page. Re-entrant previews diff directly from the next
|
|
118
118
|
* already painted; only Cancel restores the live store projection. This avoids
|
|
119
119
|
* repainting the live theme as an invisible intermediate on every picker row.
|
|
120
120
|
*/
|
|
121
|
-
function applyPreview(
|
|
122
|
-
paint(
|
|
123
|
-
livePreview =
|
|
121
|
+
function applyPreview(next: RenderedTheme): void {
|
|
122
|
+
paint(next, livePreview ?? liveTheme());
|
|
123
|
+
livePreview = next;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
/** Paint a whole
|
|
126
|
+
/** Paint a whole next: the theme's colors and type, every component config
|
|
127
127
|
* it carries, and its sketchstyle — present or not, since a theme with none
|
|
128
128
|
* paints crisp regardless of what is live (invariant 3). */
|
|
129
129
|
export async function previewTheme(theme: Theme): Promise<void> {
|
|
130
130
|
const gen = generation;
|
|
131
131
|
const defaults = await loadDefaults();
|
|
132
132
|
if (gen !== generation) return;
|
|
133
|
-
applyPreview(
|
|
134
|
-
previewSketchStyle(theme.
|
|
133
|
+
applyPreview(renderTheme(theme, defaults));
|
|
134
|
+
previewSketchStyle(theme.sketchSettings);
|
|
135
135
|
sketchPreviewActive = true;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/** Paint colors and type over the components as they stand. Not a whole
|
|
139
|
-
*
|
|
139
|
+
* next, so the sketchstyle stays live too — reverting a sketch preview a
|
|
140
140
|
* prior row left painted, if one is running. */
|
|
141
141
|
export function previewColorsAndType(colorsAndType: ColorsAndType): void {
|
|
142
142
|
generation++;
|
|
143
|
-
applyPreview(
|
|
143
|
+
applyPreview(renderColorsAndType(colorsAndType));
|
|
144
144
|
if (sketchPreviewActive) {
|
|
145
145
|
revertSketchStylePreview();
|
|
146
146
|
sketchPreviewActive = false;
|
|
@@ -151,7 +151,7 @@ export function previewColorsAndType(colorsAndType: ColorsAndType): void {
|
|
|
151
151
|
export function revertPreview(): void {
|
|
152
152
|
generation++;
|
|
153
153
|
if (!livePreview) return;
|
|
154
|
-
paint(
|
|
154
|
+
paint(liveTheme(), livePreview);
|
|
155
155
|
livePreview = null;
|
|
156
156
|
if (sketchPreviewActive) {
|
|
157
157
|
revertSketchStylePreview();
|
|
@@ -160,11 +160,11 @@ export function revertPreview(): void {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/** Release the preview without repainting. The caller must immediately load
|
|
163
|
-
* the exact
|
|
164
|
-
* selected theme is already on screen, so restoring the old live
|
|
163
|
+
* the exact next being previewed into the store. This is the Save handoff: the
|
|
164
|
+
* selected theme is already on screen, so restoring the old live next before
|
|
165
165
|
* applying it would add work and create a visible flash across the request.
|
|
166
166
|
* The sketchstyle stays painted for the same reason, though the handoff is not
|
|
167
|
-
* quite free: when the live state was crisp, `
|
|
167
|
+
* quite free: when the live state was crisp, `openThemeSketchSettings` writes the
|
|
168
168
|
* settings before the flag, so the sheet and the filter bank come down and go
|
|
169
169
|
* straight back up in between. That order is still the right one, since writing
|
|
170
170
|
* the flag first would paint the OLD dials for a frame. */
|
|
@@ -28,17 +28,17 @@ export function bumpComponentActiveRevision(): void {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* The live
|
|
31
|
+
* The live theme has moved past the last bake. Only Adopt bakes the CSS, so a
|
|
32
32
|
* buffer write or a theme save after one leaves production a version behind,
|
|
33
33
|
* and no pointer file records when the bake happened. Every surface reads the
|
|
34
34
|
* one signal: a component save has to reach the theme panel's Adopt, and a
|
|
35
35
|
* component editor's Adopt has to clear it for the panel.
|
|
36
36
|
*
|
|
37
|
-
* Set by the client writes that move the live
|
|
37
|
+
* Set by the client writes that move the live theme (`writeWorkingColorsAndType`,
|
|
38
38
|
* `writeWorkingComponentConfig`, `saveActiveTheme`, `saveAsTheme`, and every
|
|
39
39
|
* sketch gesture that changes what the effect paints: `setSketchEnabled`,
|
|
40
40
|
* `updateSketchSettings`, `selectSketchStyle`);
|
|
41
|
-
* cleared by `
|
|
41
|
+
* cleared by `adoptTheme` and by `hydrateAppliedTheme`, on this document and on
|
|
42
42
|
* every peer an Apply broadcasts to. Module-level, so it survives the
|
|
43
43
|
* remounts a view switch causes.
|
|
44
44
|
*/
|