@vectoriox/iox-ui 5.16.0 → 5.17.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/design-core/index.d.ts +27 -6
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +103 -18
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/design-core/design-apply.ts +28 -3
- package/src/design-core/design-settings.ts +11 -0
- package/src/design-core/flavor-seed.ts +7 -4
- package/src/design-core/token-names.ts +50 -8
package/design-core/index.d.ts
CHANGED
|
@@ -8655,7 +8655,9 @@ type SeedBaseline = ReadonlyMap<string, SeedExpectation> | ((row: StoredDesignTo
|
|
|
8655
8655
|
* write is never touched: no `flavor:` stamp, unless it is a `user` row (a font the author CHOSE in
|
|
8656
8656
|
* the design) whose value is exactly what the previous design wrote — that row is the design's own
|
|
8657
8657
|
* choice, so a new choice may replace it. `group`/`tier` ride every write; a desired row's own
|
|
8658
|
-
* `source` (a chosen font's `user`) wins over the pack stamp.
|
|
8658
|
+
* `source` (a chosen font's `user`) wins over the pack stamp. A machine-owned row that already holds
|
|
8659
|
+
* the desired value but another pack's stamp is RE-STAMPED (§10 C2 provenance: the stamp names the
|
|
8660
|
+
* design that owns the row, so the next switch judges it against the right baseline).
|
|
8659
8661
|
*/
|
|
8660
8662
|
declare function planFlavorSeed(desired: ReadonlyArray<FlavorTokenDef & {
|
|
8661
8663
|
source?: string;
|
|
@@ -8735,7 +8737,9 @@ declare function unknownTokenReferences(css: string, alsoAllowed?: Iterable<stri
|
|
|
8735
8737
|
* Tokens read by a LEGACY rule — any rule whose selector is scoped `:not(.iox-es)` (the pre-DS2 look
|
|
8736
8738
|
* of a node that wears no element style, design-system §3b-bis). Such a rule must read NO token at
|
|
8737
8739
|
* all: a token it reads repaints a pre-DS2 page the moment the org's rows are seeded or a flavor is
|
|
8738
|
-
* applied (D5). Returns `selector → names` for each offending rule; comments are ignored.
|
|
8740
|
+
* applied (D5). Returns `selector → names` for each offending rule; comments are ignored. SCSS
|
|
8741
|
+
* nesting is resolved (DS4.1): `.x:where(:not(.iox-es)) { &:hover { … } }` is the legacy rule
|
|
8742
|
+
* `.x:where(:not(.iox-es)):hover`, and an at-rule (`@media`) between them does not break the chain.
|
|
8739
8743
|
*/
|
|
8740
8744
|
declare function legacyRuleTokenReferences(css: string): Array<{
|
|
8741
8745
|
selector: string;
|
|
@@ -8792,6 +8796,12 @@ declare function isRetiredFlavorId(id: string | null | undefined): boolean;
|
|
|
8792
8796
|
declare function resolveDesignChoices(partial: Partial<DesignChoices> | null | undefined): DesignChoices;
|
|
8793
8797
|
/** The pack's own defaults for `flavorId` — what picking a card means before anything is tuned. */
|
|
8794
8798
|
declare function packDesignChoices(flavorId: string): DesignChoices;
|
|
8799
|
+
/**
|
|
8800
|
+
* What picking a pack card means, given the design the studio wears: the applied pack → the applied
|
|
8801
|
+
* choices; another pack → that pack's defaults, CARRYING the author's chosen fonts (§5b — a font the
|
|
8802
|
+
* author chose survives a pack switch unless the author changes it). Both picker homes call this.
|
|
8803
|
+
*/
|
|
8804
|
+
declare function choicesForPack(flavorId: string, applied: DesignChoices | null | undefined): DesignChoices;
|
|
8795
8805
|
/** A stored `settings.design` config → the resolved design. No row (or no config) → Crisp's defaults. */
|
|
8796
8806
|
declare function readDesignConfig(config: ReadonlyArray<DesignConfigEntry> | null | undefined, hasRow?: boolean): StoredDesign;
|
|
8797
8807
|
/** The colour mode a stored config compiles in — what the public page read hands the engine. */
|
|
@@ -8817,6 +8827,15 @@ declare function planDesignApply(existing: ReadonlyArray<StoredDesignTokenRow>,
|
|
|
8817
8827
|
declare function missingDesignRows(existing: ReadonlyArray<{
|
|
8818
8828
|
name: string;
|
|
8819
8829
|
}>, choices: DesignChoices): DesignTokenRow[];
|
|
8830
|
+
/**
|
|
8831
|
+
* The builder-load REPAIR (DS4.1): rows the design owns and nobody touched — stamped by the current
|
|
8832
|
+
* pack, light value exactly the pack's — whose dark override differs from the pack's are rewritten.
|
|
8833
|
+
* iox-cms dropped `values.dark` on every write from F0 to DS4 (`values` was an implicit relation),
|
|
8834
|
+
* and a revert could leave the previous apply's dark behind; both leave a row whose light half is the
|
|
8835
|
+
* design's and whose dark half is not. No author edit can produce that shape — the Tokens panel edits
|
|
8836
|
+
* the light value only — so rewriting it heals existing orgs without the author doing anything.
|
|
8837
|
+
*/
|
|
8838
|
+
declare function designTokenRepairs(existing: ReadonlyArray<StoredDesignTokenRow>, choices: DesignChoices): FlavorSeedPlan['update'];
|
|
8820
8839
|
interface SwissMigration {
|
|
8821
8840
|
/** The design the org now wears: Crisp, carrying the stored brand seed when it is a colour. */
|
|
8822
8841
|
choices: DesignChoices;
|
|
@@ -8831,11 +8850,13 @@ interface SwissMigration {
|
|
|
8831
8850
|
*
|
|
8832
8851
|
* - The look: `planDesignApply` from Swiss to Crisp — Swiss-stamped rows untouched since Swiss seeded
|
|
8833
8852
|
* them (incl. F2's `surface` / `line` / `accent`) become Crisp's; edited ones are kept.
|
|
8834
|
-
* - The aliases
|
|
8835
|
-
* their alias reference ONLY while still machine-owned and untouched, so a node saved since F1 that
|
|
8836
|
-
* reads `var(--iox-radius-control)` keeps resolving — now to Crisp's button radius.
|
|
8853
|
+
* - The aliases (`SPEC_LEGACY_ALIASES`: `radius-control` / `radius-surface` / `space-stack`) are rewritten
|
|
8854
|
+
* to their alias reference ONLY while still machine-owned and untouched, so a node saved since F1 that
|
|
8855
|
+
* reads `var(--iox-radius-control)` keeps resolving — now to Crisp's button radius. `space-control` is
|
|
8856
|
+
* NOT an alias: it is a v2 semantic token (`button-pad` reads it), and aliasing it closed a `var()`
|
|
8857
|
+
* cycle; it migrates like any other Swiss row.
|
|
8837
8858
|
*/
|
|
8838
8859
|
declare function planSwissMigration(existing: ReadonlyArray<StoredDesignTokenRow>, stored: StoredDesign): SwissMigration | null;
|
|
8839
8860
|
|
|
8840
|
-
export { ACCENT_TOKEN_NAMES, BUTTON_VARIANT_TO_STYLE, COLOR_SCHEMES, COLOR_SCHEME_TRAIT, COLOR_SCHEME_TYPES, ColorScheme, DEFAULT_FLAVOR_ID, DESIGN_TOKEN_GROUPS, DESIGN_TOKEN_TIERS, DESIGN_TOKEN_TYPES, DesignConfigKey, ELEMENT_STYLES, ELEMENT_STYLE_MARKER_CLASS, ELEMENT_STYLE_STATES, EMPTY_IMAGE_ATTRIBUTE, EMPTY_IMAGE_SRC, ElementStyleState, FLAVOR_SPEC_VERSION, FONT_CATALOG, FONT_FAMILY_TOKENS, GOOGLE_FONTS_CSS_ORIGIN, GOOGLE_FONTS_FILE_ORIGIN, OwnedTraitLink, PALETTE_PRESETS, REDUCED_MOTION_OVERRIDES, REDUCED_TRANSPARENCY_OVERRIDES, REVERT_WINDOW_MS, SPEC_A11Y, SPEC_AXES, SPEC_BUTTON_VARIANT_TO_STYLE, SPEC_CONTRAST, SPEC_DEFAULT_ELEMENT_STYLE, SPEC_ELEMENT_STYLES, SPEC_FIELD_CLASS_BASELINE, SPEC_FLAVORS, SPEC_FLAVOR_PACKS, SPEC_FONTS, SPEC_FONT_ROLES, SPEC_LEGACY_ALIASES, SPEC_PALETTE_PRESETS, SPEC_SCHEMES, SPEC_SPRINGS, SPEC_TIERS, SPEC_TIER_IDS, SPEC_TOKEN_TYPES, SWISS_FLAVOR, USER_TOKEN_SOURCE, WCAG_AA_TEXT, apcaLc, applyElementStyle, applyHeadingLevelRule, buildFlavorTokens, buildFontFaceCss, catalogFontId, colorSchemeClass, colorSchemeOf, compileSchemeCss, compileTokenCss, compileTokenCssBlocks, cssString, defaultDesignChoices, defaultElementStyleFor, deriveAccentTokens, deriveBrandTokens, designBaseline, designConfigEntries, designModeOf, designTokenRows, elementStyleById, elementStyleClass, elementStylesFor, emptyImageLabelSrc, emptyImagePlaceholder, emptyImageSrc, flavorPackById, flavorSourceStamp, fontsForTokens, googleFontHref, hasElementStyleMarker, isDesignTokenGroup, isDesignTokenTier, isDesignTokenType, isRetiredFlavorId, legacyRuleTokenReferences, missingDesignRows, nodeDesignClasses, oklabToRgb, ownedTraitStatus, packDesignChoices, parseFontFamilies, parseHexColor, planDesignApply, planFlavorRevert, planFlavorSeed, planSwissMigration, readDesignConfig, relativeLuminance, resolveDesignChoices, resolveTokenReferences, resolveTokenValues, revertAvailable, rgbToOklab, sameDesignChoices, specTokenNames, springToLinear, styleKeyToKebab, switchElementStyle, syncNodeDesignClasses, toHexColor, tokenReferences, tokensToDarkVarMap, tokensToVarMap, unknownTokenReferences, userFontStack, validateFlavorPack, wcagContrastRatio };
|
|
8861
|
+
export { ACCENT_TOKEN_NAMES, BUTTON_VARIANT_TO_STYLE, COLOR_SCHEMES, COLOR_SCHEME_TRAIT, COLOR_SCHEME_TYPES, ColorScheme, DEFAULT_FLAVOR_ID, DESIGN_TOKEN_GROUPS, DESIGN_TOKEN_TIERS, DESIGN_TOKEN_TYPES, DesignConfigKey, ELEMENT_STYLES, ELEMENT_STYLE_MARKER_CLASS, ELEMENT_STYLE_STATES, EMPTY_IMAGE_ATTRIBUTE, EMPTY_IMAGE_SRC, ElementStyleState, FLAVOR_SPEC_VERSION, FONT_CATALOG, FONT_FAMILY_TOKENS, GOOGLE_FONTS_CSS_ORIGIN, GOOGLE_FONTS_FILE_ORIGIN, OwnedTraitLink, PALETTE_PRESETS, REDUCED_MOTION_OVERRIDES, REDUCED_TRANSPARENCY_OVERRIDES, REVERT_WINDOW_MS, SPEC_A11Y, SPEC_AXES, SPEC_BUTTON_VARIANT_TO_STYLE, SPEC_CONTRAST, SPEC_DEFAULT_ELEMENT_STYLE, SPEC_ELEMENT_STYLES, SPEC_FIELD_CLASS_BASELINE, SPEC_FLAVORS, SPEC_FLAVOR_PACKS, SPEC_FONTS, SPEC_FONT_ROLES, SPEC_LEGACY_ALIASES, SPEC_PALETTE_PRESETS, SPEC_SCHEMES, SPEC_SPRINGS, SPEC_TIERS, SPEC_TIER_IDS, SPEC_TOKEN_TYPES, SWISS_FLAVOR, USER_TOKEN_SOURCE, WCAG_AA_TEXT, apcaLc, applyElementStyle, applyHeadingLevelRule, buildFlavorTokens, buildFontFaceCss, catalogFontId, choicesForPack, colorSchemeClass, colorSchemeOf, compileSchemeCss, compileTokenCss, compileTokenCssBlocks, cssString, defaultDesignChoices, defaultElementStyleFor, deriveAccentTokens, deriveBrandTokens, designBaseline, designConfigEntries, designModeOf, designTokenRepairs, designTokenRows, elementStyleById, elementStyleClass, elementStylesFor, emptyImageLabelSrc, emptyImagePlaceholder, emptyImageSrc, flavorPackById, flavorSourceStamp, fontsForTokens, googleFontHref, hasElementStyleMarker, isDesignTokenGroup, isDesignTokenTier, isDesignTokenType, isRetiredFlavorId, legacyRuleTokenReferences, missingDesignRows, nodeDesignClasses, oklabToRgb, ownedTraitStatus, packDesignChoices, parseFontFamilies, parseHexColor, planDesignApply, planFlavorRevert, planFlavorSeed, planSwissMigration, readDesignConfig, relativeLuminance, resolveDesignChoices, resolveTokenReferences, resolveTokenValues, revertAvailable, rgbToOklab, sameDesignChoices, specTokenNames, springToLinear, styleKeyToKebab, switchElementStyle, syncNodeDesignClasses, toHexColor, tokenReferences, tokensToDarkVarMap, tokensToVarMap, unknownTokenReferences, userFontStack, validateFlavorPack, wcagContrastRatio };
|
|
8841
8862
|
export type { AccentBackgrounds, AccentTokenName, ApplyElementStyleResult, DensityId, DesignChoices, DesignClassSource, DesignConfigEntry, DesignMode, DesignTokenGroup, DesignTokenLike, DesignTokenRow, DesignTokenTier, DesignTokenType, ElementStyle, ElementStyleTarget, ElementStyleTraitLike, FlavorPack, FlavorPackV2, FlavorRevertPlan, FlavorRevertSnapshot, FlavorSeedPlan, FlavorSpecToken, FlavorTokenDef, FontDescriptor, FontFormat, FontPair, FontRoleToken, FontStyle, FontsForTokensOptions, LinearSpring, MotionId, OkLab, OwnedTrait, OwnedTraitStatus, PalettePreset, ResolvedMode, Rgb, SchemeId, SeedBaseline, SeedExpectation, ShapeId, StoredDesign, StoredDesignTokenRow, SwissMigration, SwitchElementStyleResult, TokenCssBlocks, TokenCssOptions };
|
|
@@ -9533,23 +9533,68 @@ function unknownTokenReferences(css, alsoAllowed = []) {
|
|
|
9533
9533
|
return tokenReferences(css).filter(name => !spec.has(name) && !extra.has(name));
|
|
9534
9534
|
}
|
|
9535
9535
|
const LEGACY_SCOPE = /:not\(\s*\.iox-es\s*\)/;
|
|
9536
|
-
|
|
9536
|
+
/** Comments out: block comments, and SCSS `//` line comments (never the `//` of a `url(https://…)`). */
|
|
9537
|
+
const stripComments = (css) => String(css ?? '')
|
|
9538
|
+
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
9539
|
+
.replace(/(^|[^:\\])\/\/[^\n]*/g, '$1');
|
|
9540
|
+
/** A nested SCSS selector against its parent's: `&` is the parent; no `&` means a descendant. */
|
|
9541
|
+
function resolveNested(parent, selector) {
|
|
9542
|
+
if (!parent)
|
|
9543
|
+
return selector;
|
|
9544
|
+
return selector.split(',').map(part => {
|
|
9545
|
+
const own = part.trim();
|
|
9546
|
+
return own.includes('&') ? own.replace(/&/g, parent) : `${parent} ${own}`;
|
|
9547
|
+
}).join(', ');
|
|
9548
|
+
}
|
|
9537
9549
|
/**
|
|
9538
9550
|
* Tokens read by a LEGACY rule — any rule whose selector is scoped `:not(.iox-es)` (the pre-DS2 look
|
|
9539
9551
|
* of a node that wears no element style, design-system §3b-bis). Such a rule must read NO token at
|
|
9540
9552
|
* all: a token it reads repaints a pre-DS2 page the moment the org's rows are seeded or a flavor is
|
|
9541
|
-
* applied (D5). Returns `selector → names` for each offending rule; comments are ignored.
|
|
9553
|
+
* applied (D5). Returns `selector → names` for each offending rule; comments are ignored. SCSS
|
|
9554
|
+
* nesting is resolved (DS4.1): `.x:where(:not(.iox-es)) { &:hover { … } }` is the legacy rule
|
|
9555
|
+
* `.x:where(:not(.iox-es)):hover`, and an at-rule (`@media`) between them does not break the chain.
|
|
9542
9556
|
*/
|
|
9543
9557
|
function legacyRuleTokenReferences(css) {
|
|
9544
|
-
const text =
|
|
9558
|
+
const text = stripComments(css);
|
|
9545
9559
|
const out = [];
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
if (!LEGACY_SCOPE.test(selector))
|
|
9549
|
-
|
|
9550
|
-
const tokens = tokenReferences(
|
|
9560
|
+
const stack = [];
|
|
9561
|
+
const report = (frame) => {
|
|
9562
|
+
if (!LEGACY_SCOPE.test(frame.selector))
|
|
9563
|
+
return;
|
|
9564
|
+
const tokens = tokenReferences(frame.body);
|
|
9551
9565
|
if (tokens.length)
|
|
9552
|
-
out.push({ selector, tokens });
|
|
9566
|
+
out.push({ selector: frame.selector, tokens });
|
|
9567
|
+
};
|
|
9568
|
+
let buffer = '';
|
|
9569
|
+
for (const ch of text) {
|
|
9570
|
+
if (ch === '{') {
|
|
9571
|
+
const head = buffer.trim().replace(/\s+/g, ' ');
|
|
9572
|
+
buffer = '';
|
|
9573
|
+
// Declarations before a nested block belong to the parent (`color: x; &:hover {`).
|
|
9574
|
+
const cut = head.lastIndexOf(';');
|
|
9575
|
+
const prelude = cut >= 0 ? head.slice(cut + 1).trim() : head;
|
|
9576
|
+
const parent = stack[stack.length - 1];
|
|
9577
|
+
if (parent && cut >= 0)
|
|
9578
|
+
parent.body += head.slice(0, cut + 1);
|
|
9579
|
+
const inherited = parent?.selector ?? '';
|
|
9580
|
+
const selector = prelude.startsWith('@') ? inherited : resolveNested(inherited, prelude);
|
|
9581
|
+
stack.push({ selector, body: '' });
|
|
9582
|
+
}
|
|
9583
|
+
else if (ch === '}') {
|
|
9584
|
+
const frame = stack.pop();
|
|
9585
|
+
if (frame) {
|
|
9586
|
+
frame.body += buffer;
|
|
9587
|
+
report(frame);
|
|
9588
|
+
}
|
|
9589
|
+
buffer = '';
|
|
9590
|
+
}
|
|
9591
|
+
else if (ch === ';' && stack.length) {
|
|
9592
|
+
stack[stack.length - 1].body += buffer + ch;
|
|
9593
|
+
buffer = '';
|
|
9594
|
+
}
|
|
9595
|
+
else {
|
|
9596
|
+
buffer += ch;
|
|
9597
|
+
}
|
|
9553
9598
|
}
|
|
9554
9599
|
return out;
|
|
9555
9600
|
}
|
|
@@ -10606,14 +10651,16 @@ function planFlavorRevert(current, snapshot) {
|
|
|
10606
10651
|
snapNames.add(snap.name);
|
|
10607
10652
|
const live = byName.get(snap.name);
|
|
10608
10653
|
if (!live) {
|
|
10609
|
-
plan.create.push({ name: snap.name, type: snap.type, value: snap.value, values: snap.values, source: snap.source, ...classification(snap) });
|
|
10654
|
+
plan.create.push({ name: snap.name, type: snap.type, value: snap.value, ...(snap.values?.dark ? { values: snap.values } : {}), source: snap.source, ...classification(snap) });
|
|
10610
10655
|
continue;
|
|
10611
10656
|
}
|
|
10612
10657
|
const differs = live.value !== snap.value
|
|
10613
10658
|
|| (live.values?.dark ?? null) !== (snap.values?.dark ?? null)
|
|
10614
10659
|
|| (live.source ?? null) !== (snap.source ?? null);
|
|
10660
|
+
// `values` is ALWAYS sent: an absent key is dropped by JSON and a `$set` then keeps the
|
|
10661
|
+
// apply's dark override — a snapshot row with no dark must clear it, so it sends `{}`.
|
|
10615
10662
|
if (differs && live._id) {
|
|
10616
|
-
plan.update.push({ id: live._id, data: { value: snap.value, values: snap.values, source: snap.source } });
|
|
10663
|
+
plan.update.push({ id: live._id, data: { value: snap.value, values: snap.values ?? {}, source: snap.source } });
|
|
10617
10664
|
}
|
|
10618
10665
|
}
|
|
10619
10666
|
for (const row of current ?? []) {
|
|
@@ -10632,7 +10679,9 @@ const sameValue = (row, e) => row.value === e.value && (row.values?.dark ?? '')
|
|
|
10632
10679
|
* write is never touched: no `flavor:` stamp, unless it is a `user` row (a font the author CHOSE in
|
|
10633
10680
|
* the design) whose value is exactly what the previous design wrote — that row is the design's own
|
|
10634
10681
|
* choice, so a new choice may replace it. `group`/`tier` ride every write; a desired row's own
|
|
10635
|
-
* `source` (a chosen font's `user`) wins over the pack stamp.
|
|
10682
|
+
* `source` (a chosen font's `user`) wins over the pack stamp. A machine-owned row that already holds
|
|
10683
|
+
* the desired value but another pack's stamp is RE-STAMPED (§10 C2 provenance: the stamp names the
|
|
10684
|
+
* design that owns the row, so the next switch judges it against the right baseline).
|
|
10636
10685
|
*/
|
|
10637
10686
|
function planFlavorSeed(desired, existing, stamp, baseline) {
|
|
10638
10687
|
const byName = new Map((existing ?? []).map(r => [r.name, r]));
|
|
@@ -10662,8 +10711,6 @@ function planFlavorSeed(desired, existing, stamp, baseline) {
|
|
|
10662
10711
|
const sameAsDesired = row.value === def.value && (row.values?.dark ?? '') === (def.values?.dark ?? '');
|
|
10663
10712
|
if (sameAsDesired && (row.source ?? '') === source)
|
|
10664
10713
|
continue; // already exactly this
|
|
10665
|
-
if (sameAsDesired && isSeeded(row) && source !== USER_TOKEN_SOURCE)
|
|
10666
|
-
continue; // same value, another pack's stamp — nothing to write
|
|
10667
10714
|
const untouched = !!old && sameValue(row, old);
|
|
10668
10715
|
if ((untouched || sameAsDesired) && row._id) {
|
|
10669
10716
|
plan.update.push({ id: row._id, data: { value: def.value, values: def.values ?? {}, source, ...classification(def) } });
|
|
@@ -10825,6 +10872,17 @@ function resolveDesignChoices(partial) {
|
|
|
10825
10872
|
function packDesignChoices(flavorId) {
|
|
10826
10873
|
return resolveDesignChoices({ flavorId });
|
|
10827
10874
|
}
|
|
10875
|
+
/**
|
|
10876
|
+
* What picking a pack card means, given the design the studio wears: the applied pack → the applied
|
|
10877
|
+
* choices; another pack → that pack's defaults, CARRYING the author's chosen fonts (§5b — a font the
|
|
10878
|
+
* author chose survives a pack switch unless the author changes it). Both picker homes call this.
|
|
10879
|
+
*/
|
|
10880
|
+
function choicesForPack(flavorId, applied) {
|
|
10881
|
+
const pack = flavorPackById(flavorId) ?? defaultPack();
|
|
10882
|
+
if (applied && resolveDesignChoices(applied).flavorId === pack.id)
|
|
10883
|
+
return resolveDesignChoices(applied);
|
|
10884
|
+
return resolveDesignChoices({ flavorId: pack.id, fonts: applied?.fonts });
|
|
10885
|
+
}
|
|
10828
10886
|
/** A stored `settings.design` config → the resolved design. No row (or no config) → Crisp's defaults. */
|
|
10829
10887
|
function readDesignConfig(config, hasRow = !!config) {
|
|
10830
10888
|
const map = configMap(config);
|
|
@@ -10934,6 +10992,31 @@ function missingDesignRows(existing, choices) {
|
|
|
10934
10992
|
const have = new Set((existing ?? []).map(r => r.name));
|
|
10935
10993
|
return designTokenRows(choices).filter(r => !have.has(r.name));
|
|
10936
10994
|
}
|
|
10995
|
+
/**
|
|
10996
|
+
* The builder-load REPAIR (DS4.1): rows the design owns and nobody touched — stamped by the current
|
|
10997
|
+
* pack, light value exactly the pack's — whose dark override differs from the pack's are rewritten.
|
|
10998
|
+
* iox-cms dropped `values.dark` on every write from F0 to DS4 (`values` was an implicit relation),
|
|
10999
|
+
* and a revert could leave the previous apply's dark behind; both leave a row whose light half is the
|
|
11000
|
+
* design's and whose dark half is not. No author edit can produce that shape — the Tokens panel edits
|
|
11001
|
+
* the light value only — so rewriting it heals existing orgs without the author doing anything.
|
|
11002
|
+
*/
|
|
11003
|
+
function designTokenRepairs(existing, choices) {
|
|
11004
|
+
const pack = flavorPackById(choices.flavorId);
|
|
11005
|
+
if (!pack)
|
|
11006
|
+
return [];
|
|
11007
|
+
const stamp = flavorSourceStamp(pack.id);
|
|
11008
|
+
const desired = new Map(designTokenRows(choices).map(r => [r.name, r]));
|
|
11009
|
+
const out = [];
|
|
11010
|
+
for (const row of existing ?? []) {
|
|
11011
|
+
const want = desired.get(row.name);
|
|
11012
|
+
if (!want || !row._id || row.source !== stamp || want.source !== stamp || row.value !== want.value)
|
|
11013
|
+
continue;
|
|
11014
|
+
if ((row.values?.dark ?? '') === (want.values?.dark ?? ''))
|
|
11015
|
+
continue;
|
|
11016
|
+
out.push({ id: row._id, data: { value: want.value, values: want.values ?? {}, source: stamp, ...(want.group ? { group: want.group } : {}), ...(want.tier ? { tier: want.tier } : {}) } });
|
|
11017
|
+
}
|
|
11018
|
+
return out;
|
|
11019
|
+
}
|
|
10937
11020
|
const LEGACY_ALIASES = SPEC_LEGACY_ALIASES;
|
|
10938
11021
|
/**
|
|
10939
11022
|
* Swiss → Crisp (spec `legacyAliases`; D1). Needed when the design row says a retired flavor, or when
|
|
@@ -10943,9 +11026,11 @@ const LEGACY_ALIASES = SPEC_LEGACY_ALIASES;
|
|
|
10943
11026
|
*
|
|
10944
11027
|
* - The look: `planDesignApply` from Swiss to Crisp — Swiss-stamped rows untouched since Swiss seeded
|
|
10945
11028
|
* them (incl. F2's `surface` / `line` / `accent`) become Crisp's; edited ones are kept.
|
|
10946
|
-
* - The aliases
|
|
10947
|
-
* their alias reference ONLY while still machine-owned and untouched, so a node saved since F1 that
|
|
10948
|
-
* reads `var(--iox-radius-control)` keeps resolving — now to Crisp's button radius.
|
|
11029
|
+
* - The aliases (`SPEC_LEGACY_ALIASES`: `radius-control` / `radius-surface` / `space-stack`) are rewritten
|
|
11030
|
+
* to their alias reference ONLY while still machine-owned and untouched, so a node saved since F1 that
|
|
11031
|
+
* reads `var(--iox-radius-control)` keeps resolving — now to Crisp's button radius. `space-control` is
|
|
11032
|
+
* NOT an alias: it is a v2 semantic token (`button-pad` reads it), and aliasing it closed a `var()`
|
|
11033
|
+
* cycle; it migrates like any other Swiss row.
|
|
10949
11034
|
*/
|
|
10950
11035
|
function planSwissMigration(existing, stored) {
|
|
10951
11036
|
const swissAliasRows = (existing ?? []).filter(r => r.name in LEGACY_ALIASES && SEED_STAMP.exec(r.source ?? '')?.[1] === SWISS_FLAVOR.id);
|
|
@@ -10988,5 +11073,5 @@ function planSwissMigration(existing, stored) {
|
|
|
10988
11073
|
* Generated bundle index. Do not edit.
|
|
10989
11074
|
*/
|
|
10990
11075
|
|
|
10991
|
-
export { ACCENT_TOKEN_NAMES, BUTTON_VARIANT_TO_STYLE, COLOR_SCHEMES, COLOR_SCHEME_TRAIT, COLOR_SCHEME_TYPES, ColorScheme, DEFAULT_FLAVOR_ID, DESIGN_TOKEN_GROUPS, DESIGN_TOKEN_TIERS, DESIGN_TOKEN_TYPES, DesignConfigKey, ELEMENT_STYLES, ELEMENT_STYLE_MARKER_CLASS, ELEMENT_STYLE_STATES, EMPTY_IMAGE_ATTRIBUTE, EMPTY_IMAGE_SRC, ElementStyleState, FLAVOR_SPEC_VERSION, FONT_CATALOG, FONT_FAMILY_TOKENS, GOOGLE_FONTS_CSS_ORIGIN, GOOGLE_FONTS_FILE_ORIGIN, OwnedTraitLink, PALETTE_PRESETS, REDUCED_MOTION_OVERRIDES, REDUCED_TRANSPARENCY_OVERRIDES, REVERT_WINDOW_MS, SPEC_A11Y, SPEC_AXES, SPEC_BUTTON_VARIANT_TO_STYLE, SPEC_CONTRAST, SPEC_DEFAULT_ELEMENT_STYLE, SPEC_ELEMENT_STYLES, SPEC_FIELD_CLASS_BASELINE, SPEC_FLAVORS, SPEC_FLAVOR_PACKS, SPEC_FONTS, SPEC_FONT_ROLES, SPEC_LEGACY_ALIASES, SPEC_PALETTE_PRESETS, SPEC_SCHEMES, SPEC_SPRINGS, SPEC_TIERS, SPEC_TIER_IDS, SPEC_TOKEN_TYPES, SWISS_FLAVOR, USER_TOKEN_SOURCE, WCAG_AA_TEXT, apcaLc, applyElementStyle, applyHeadingLevelRule, buildFlavorTokens, buildFontFaceCss, catalogFontId, colorSchemeClass, colorSchemeOf, compileSchemeCss, compileTokenCss, compileTokenCssBlocks, cssString, defaultDesignChoices, defaultElementStyleFor, deriveAccentTokens, deriveBrandTokens, designBaseline, designConfigEntries, designModeOf, designTokenRows, elementStyleById, elementStyleClass, elementStylesFor, emptyImageLabelSrc, emptyImagePlaceholder, emptyImageSrc, flavorPackById, flavorSourceStamp, fontsForTokens, googleFontHref, hasElementStyleMarker, isDesignTokenGroup, isDesignTokenTier, isDesignTokenType, isRetiredFlavorId, legacyRuleTokenReferences, missingDesignRows, nodeDesignClasses, oklabToRgb, ownedTraitStatus, packDesignChoices, parseFontFamilies, parseHexColor, planDesignApply, planFlavorRevert, planFlavorSeed, planSwissMigration, readDesignConfig, relativeLuminance, resolveDesignChoices, resolveTokenReferences, resolveTokenValues, revertAvailable, rgbToOklab, sameDesignChoices, specTokenNames, springToLinear, styleKeyToKebab, switchElementStyle, syncNodeDesignClasses, toHexColor, tokenReferences, tokensToDarkVarMap, tokensToVarMap, unknownTokenReferences, userFontStack, validateFlavorPack, wcagContrastRatio };
|
|
11076
|
+
export { ACCENT_TOKEN_NAMES, BUTTON_VARIANT_TO_STYLE, COLOR_SCHEMES, COLOR_SCHEME_TRAIT, COLOR_SCHEME_TYPES, ColorScheme, DEFAULT_FLAVOR_ID, DESIGN_TOKEN_GROUPS, DESIGN_TOKEN_TIERS, DESIGN_TOKEN_TYPES, DesignConfigKey, ELEMENT_STYLES, ELEMENT_STYLE_MARKER_CLASS, ELEMENT_STYLE_STATES, EMPTY_IMAGE_ATTRIBUTE, EMPTY_IMAGE_SRC, ElementStyleState, FLAVOR_SPEC_VERSION, FONT_CATALOG, FONT_FAMILY_TOKENS, GOOGLE_FONTS_CSS_ORIGIN, GOOGLE_FONTS_FILE_ORIGIN, OwnedTraitLink, PALETTE_PRESETS, REDUCED_MOTION_OVERRIDES, REDUCED_TRANSPARENCY_OVERRIDES, REVERT_WINDOW_MS, SPEC_A11Y, SPEC_AXES, SPEC_BUTTON_VARIANT_TO_STYLE, SPEC_CONTRAST, SPEC_DEFAULT_ELEMENT_STYLE, SPEC_ELEMENT_STYLES, SPEC_FIELD_CLASS_BASELINE, SPEC_FLAVORS, SPEC_FLAVOR_PACKS, SPEC_FONTS, SPEC_FONT_ROLES, SPEC_LEGACY_ALIASES, SPEC_PALETTE_PRESETS, SPEC_SCHEMES, SPEC_SPRINGS, SPEC_TIERS, SPEC_TIER_IDS, SPEC_TOKEN_TYPES, SWISS_FLAVOR, USER_TOKEN_SOURCE, WCAG_AA_TEXT, apcaLc, applyElementStyle, applyHeadingLevelRule, buildFlavorTokens, buildFontFaceCss, catalogFontId, choicesForPack, colorSchemeClass, colorSchemeOf, compileSchemeCss, compileTokenCss, compileTokenCssBlocks, cssString, defaultDesignChoices, defaultElementStyleFor, deriveAccentTokens, deriveBrandTokens, designBaseline, designConfigEntries, designModeOf, designTokenRepairs, designTokenRows, elementStyleById, elementStyleClass, elementStylesFor, emptyImageLabelSrc, emptyImagePlaceholder, emptyImageSrc, flavorPackById, flavorSourceStamp, fontsForTokens, googleFontHref, hasElementStyleMarker, isDesignTokenGroup, isDesignTokenTier, isDesignTokenType, isRetiredFlavorId, legacyRuleTokenReferences, missingDesignRows, nodeDesignClasses, oklabToRgb, ownedTraitStatus, packDesignChoices, parseFontFamilies, parseHexColor, planDesignApply, planFlavorRevert, planFlavorSeed, planSwissMigration, readDesignConfig, relativeLuminance, resolveDesignChoices, resolveTokenReferences, resolveTokenValues, revertAvailable, rgbToOklab, sameDesignChoices, specTokenNames, springToLinear, styleKeyToKebab, switchElementStyle, syncNodeDesignClasses, toHexColor, tokenReferences, tokensToDarkVarMap, tokensToVarMap, unknownTokenReferences, userFontStack, validateFlavorPack, wcagContrastRatio };
|
|
10992
11077
|
//# sourceMappingURL=vectoriox-iox-ui-design-core.mjs.map
|