@vectoriox/iox-ui 5.13.1 → 5.15.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 +266 -33
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +494 -77
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +39 -6
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/index.d.ts +25 -4
- package/package.json +1 -1
- package/src/design-core/design-apply.ts +116 -0
- package/src/design-core/design-settings.ts +194 -0
- package/src/design-core/element-styles.ts +4 -20
- package/src/design-core/empty-image.ts +52 -0
- package/src/design-core/flavor-seed.ts +39 -13
- package/src/design-core/flavor-spec.generated.ts +12 -4
- package/src/design-core/flavor.ts +6 -5
- package/src/design-core/fonts.ts +45 -8
- package/src/design-core/node-classes.ts +82 -0
- package/src/design-core/public-api.ts +4 -0
- package/src/design-core/token-css.ts +32 -2
- package/src/design-core/token-names.ts +21 -0
- package/styles/iox-design.css +30 -0
package/design-core/index.d.ts
CHANGED
|
@@ -882,7 +882,7 @@ declare const SPEC_SPRINGS: {
|
|
|
882
882
|
};
|
|
883
883
|
};
|
|
884
884
|
declare const SPEC_FONTS: {
|
|
885
|
-
readonly Inter: "Inter:wght@400;500;600;700";
|
|
885
|
+
readonly Inter: "Inter:wght@300;400;500;600;700";
|
|
886
886
|
readonly "Inter Tight": "Inter+Tight:wght@500;600;700";
|
|
887
887
|
readonly Manrope: "Manrope:wght@400;500;600;700";
|
|
888
888
|
readonly "IBM Plex Sans": "IBM+Plex+Sans:wght@400;500;600;700";
|
|
@@ -897,12 +897,21 @@ declare const SPEC_FONTS: {
|
|
|
897
897
|
readonly Figtree: "Figtree:wght@400;500;600;700;800";
|
|
898
898
|
readonly "Google Sans Flex": "Google+Sans+Flex:wght@400;500;600;700";
|
|
899
899
|
readonly "Bricolage Grotesque": "Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700";
|
|
900
|
-
readonly Nunito: "Nunito:wght@400;600;700;800";
|
|
900
|
+
readonly Nunito: "Nunito:wght@300;400;600;700;800";
|
|
901
901
|
readonly "DM Sans": "DM+Sans:wght@400;500;700";
|
|
902
902
|
readonly Archivo: "Archivo:wght@400;500;700";
|
|
903
903
|
readonly "Archivo Black": "Archivo+Black";
|
|
904
904
|
readonly Syne: "Syne:wght@600;700;800";
|
|
905
905
|
readonly "Space Mono": "Space+Mono:wght@400;700";
|
|
906
|
+
readonly Poppins: "Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400";
|
|
907
|
+
readonly Roboto: "Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400";
|
|
908
|
+
readonly Lato: "Lato:ital,wght@0,300;0,400;0,700;1,400";
|
|
909
|
+
readonly "Open Sans": "Open+Sans:ital,wght@0,300;0,400;0,600;0,700;1,400";
|
|
910
|
+
readonly Montserrat: "Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400";
|
|
911
|
+
readonly Raleway: "Raleway:wght@300;400;500;600;700";
|
|
912
|
+
readonly "Playfair Display": "Playfair+Display:ital,wght@0,400;0,500;0,700;1,400";
|
|
913
|
+
readonly Oswald: "Oswald:wght@300;400;500;600;700";
|
|
914
|
+
readonly Ubuntu: "Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,400";
|
|
906
915
|
};
|
|
907
916
|
declare const SPEC_SCHEMES: {
|
|
908
917
|
readonly default: {
|
|
@@ -1464,7 +1473,6 @@ declare const SPEC_FIELD_CLASS_BASELINE: {
|
|
|
1464
1473
|
declare const SPEC_LEGACY_ALIASES: {
|
|
1465
1474
|
readonly "radius-control": "var(--iox-button-radius)";
|
|
1466
1475
|
readonly "radius-surface": "var(--iox-card-radius)";
|
|
1467
|
-
readonly "space-control": "var(--iox-button-pad)";
|
|
1468
1476
|
readonly "space-stack": "var(--iox-space-gap)";
|
|
1469
1477
|
};
|
|
1470
1478
|
declare const SPEC_FLAVOR_PACKS: readonly [{
|
|
@@ -8174,6 +8182,11 @@ declare function styleKeyToKebab(key: string): string;
|
|
|
8174
8182
|
* 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`
|
|
8175
8183
|
* 5. dark — LAST `@media (prefers-color-scheme: dark)`
|
|
8176
8184
|
*
|
|
8185
|
+
* MODE (design-system D6) is a compile choice, never a row change: `auto` is the visitor-following
|
|
8186
|
+
* order above; `light` compiles the base from light values and emits no dark block; `dark` compiles
|
|
8187
|
+
* the base from DARK values (schemes and placeholders resolved from them too) and emits no dark block —
|
|
8188
|
+
* so a Midnight site is dark for a light-OS visitor.
|
|
8189
|
+
*
|
|
8177
8190
|
* ⚠️ The appended-last contract: the dark block REDEFINES custom properties, so every consumer
|
|
8178
8191
|
* appends it AFTER all of its base rules — the engine pushes it after the page's css blocks, the
|
|
8179
8192
|
* builder registry keeps it as its last token rule (responsive A3 lesson).
|
|
@@ -8192,6 +8205,16 @@ interface DesignTokenLike {
|
|
|
8192
8205
|
interface TokenCssOptions {
|
|
8193
8206
|
/** Selector that carries the variables instead of `:root` — a preview wrapper, a specimen. */
|
|
8194
8207
|
scope?: string;
|
|
8208
|
+
/** The studio's colour mode (`settings.design.mode`). Absent = `auto`. */
|
|
8209
|
+
mode?: DesignMode;
|
|
8210
|
+
/**
|
|
8211
|
+
* Declare every SPEC token the rows lack as `initial` on the scope (the guaranteed-invalid value),
|
|
8212
|
+
* so a `var()` inside the scope cannot inherit a same-named property from an ANCESTOR. The builder
|
|
8213
|
+
* needs it: the admin's `:root` chrome tokens share names with org tokens (`accent`, `surface-2`…),
|
|
8214
|
+
* and a missing org row would silently paint the canvas in admin chrome. With it, the canvas
|
|
8215
|
+
* computes exactly what the live site computes for that row — unset.
|
|
8216
|
+
*/
|
|
8217
|
+
isolate?: boolean;
|
|
8195
8218
|
}
|
|
8196
8219
|
interface TokenCssBlocks {
|
|
8197
8220
|
/** Base, schemes and the two accessibility blocks — emitted BEFORE node rules. */
|
|
@@ -8241,8 +8264,9 @@ declare function compileTokenCss(tokens: ReadonlyArray<DesignTokenLike> | null |
|
|
|
8241
8264
|
* Flavors v1 (flavors-and-theming-plan.md, F1–F2): a pack is its TOKENS plus the accent hue
|
|
8242
8265
|
* opinion the brand derivation reads. The per-type `defaults` map and its resolvers are gone
|
|
8243
8266
|
* (design-system plan §3e, DS2): a new element is born wearing an ELEMENT STYLE
|
|
8244
|
-
* (`element-styles.ts`), which references tokens and is flavor-independent. Swiss
|
|
8245
|
-
*
|
|
8267
|
+
* (`element-styles.ts`), which references tokens and is flavor-independent. Swiss is retired (DS4
|
|
8268
|
+
* migrates `flavorId: swiss` orgs to Crisp); its pack stays as the migration's BASELINE — what F1/F2
|
|
8269
|
+
* wrote, so "untouched since seeding" stays a comparison (`design-apply.ts`).
|
|
8246
8270
|
*/
|
|
8247
8271
|
interface FlavorTokenDef {
|
|
8248
8272
|
name: string;
|
|
@@ -8268,9 +8292,9 @@ interface FlavorPack {
|
|
|
8268
8292
|
/** A pack's own sanity: every token row names itself and carries a value. Returns errors. */
|
|
8269
8293
|
declare function validateFlavorPack(pack: FlavorPack): string[];
|
|
8270
8294
|
/**
|
|
8271
|
-
* Swiss — the F1 pack: four tokens (control/surface radius, control/stack spacing) and the
|
|
8272
|
-
* opinion F2's brand step
|
|
8273
|
-
*
|
|
8295
|
+
* Swiss — the retired F1 pack: four tokens (control/surface radius, control/stack spacing) and the
|
|
8296
|
+
* hue opinion F2's brand step read. Three of its rows become the spec's `legacyAliases` on migration;
|
|
8297
|
+
* `space-control` is a v2 token in every pack and takes Crisp's value.
|
|
8274
8298
|
*/
|
|
8275
8299
|
declare const SWISS_FLAVOR: FlavorPack;
|
|
8276
8300
|
|
|
@@ -8379,23 +8403,14 @@ declare function ownedTraitStatus(target: ElementStyleTarget, id: string): Owned
|
|
|
8379
8403
|
declare function switchElementStyle(target: ElementStyleTarget, fromId: string | null | undefined, toId: string, baseline?: Readonly<Record<string, unknown>>): SwitchElementStyleResult;
|
|
8380
8404
|
/**
|
|
8381
8405
|
* The element-style MARKER (design-system §3b-bis, spec `elementStyleMarker`). A node that wears an
|
|
8382
|
-
* element style renders `iox-es iox-es-<id>` in BOTH renderers
|
|
8383
|
-
*
|
|
8384
|
-
*
|
|
8385
|
-
*
|
|
8406
|
+
* element style renders `iox-es iox-es-<id>` in BOTH renderers, through the one node-class helper
|
|
8407
|
+
* `nodeDesignClasses` (node-classes.ts); every piece of component CSS that carries the system look is
|
|
8408
|
+
* scoped to it, so a node saved before DS2 (no `elementStyle`) keeps its exact pre-DS2 component CSS
|
|
8409
|
+
* no matter which tokens the org holds.
|
|
8386
8410
|
*/
|
|
8387
8411
|
declare const ELEMENT_STYLE_MARKER_CLASS = "iox-es";
|
|
8388
8412
|
/** `iox-es-<id>` for a known style, else null — an unknown id never reaches a class attribute. */
|
|
8389
8413
|
declare function elementStyleClass(id: string | null | undefined): string | null;
|
|
8390
|
-
/** The marker classes a node renders: `'iox-es iox-es-<id>'`, or `''` for a node with no (known) style. */
|
|
8391
|
-
declare function elementStyleClasses(node: {
|
|
8392
|
-
elementStyle?: string | null;
|
|
8393
|
-
} | null | undefined): string;
|
|
8394
|
-
/** Make an element's marker match `elementStyle` — the live switch on the canvas, and the
|
|
8395
|
-
* component path's one-time stamp. Removes a stale `iox-es-<old>`; touches no other class. */
|
|
8396
|
-
declare function syncElementStyleMarker(el: {
|
|
8397
|
-
classList: DOMTokenList;
|
|
8398
|
-
} | null | undefined, elementStyle: string | null | undefined): void;
|
|
8399
8414
|
/**
|
|
8400
8415
|
* The spec's `headingLevelRule`: changing a Heading's level moves it to the new level's DEFAULT
|
|
8401
8416
|
* style only when it still wears its old level's default (author changes kept, via
|
|
@@ -8404,6 +8419,91 @@ declare function syncElementStyleMarker(el: {
|
|
|
8404
8419
|
*/
|
|
8405
8420
|
declare function applyHeadingLevelRule(target: ElementStyleTarget, oldLevel: string | null | undefined, newLevel: string | null | undefined, baseline?: Readonly<Record<string, unknown>>): SwitchElementStyleResult | null;
|
|
8406
8421
|
|
|
8422
|
+
/**
|
|
8423
|
+
* The design-system classes a node renders, in BOTH renderers (builder canvas, engine component
|
|
8424
|
+
* path, engine string path) — ONE helper, so the three can never disagree about which class a node
|
|
8425
|
+
* carries:
|
|
8426
|
+
*
|
|
8427
|
+
* - the element-style MARKER `iox-es iox-es-<id>` (design-system §3b-bis) — component CSS carrying
|
|
8428
|
+
* the system look is scoped to it, so a node saved before DS2 keeps its pre-DS2 look;
|
|
8429
|
+
* - the section colour scheme `iox-scheme-<id>` (§3c) for a non-default `colorScheme` — the class
|
|
8430
|
+
* `compileSchemeCss` re-declares tokens on, so everything inside re-resolves.
|
|
8431
|
+
*
|
|
8432
|
+
* Renderers read `elementStyle` and `colorScheme` for exactly this and nothing else.
|
|
8433
|
+
*/
|
|
8434
|
+
/** The section colour schemes — the contract's `schemes` keys. */
|
|
8435
|
+
declare enum ColorScheme {
|
|
8436
|
+
Default = "default",
|
|
8437
|
+
Subtle = "subtle",
|
|
8438
|
+
Inverse = "inverse",
|
|
8439
|
+
Accent = "accent"
|
|
8440
|
+
}
|
|
8441
|
+
/** The content trait (stored in `props`, not a style prop) that picks a node's scheme. */
|
|
8442
|
+
declare const COLOR_SCHEME_TRAIT = "colorScheme";
|
|
8443
|
+
/** The node types that offer a scheme (spec §3c: Section/Container; LinkedContainer is a Container that links). */
|
|
8444
|
+
declare const COLOR_SCHEME_TYPES: ReadonlyArray<string>;
|
|
8445
|
+
/** Every scheme in contract order, with the contract's label (Default · Subtle · Inverse · Brand). */
|
|
8446
|
+
declare const COLOR_SCHEMES: ReadonlyArray<{
|
|
8447
|
+
readonly id: ColorScheme;
|
|
8448
|
+
readonly label: string;
|
|
8449
|
+
}>;
|
|
8450
|
+
/** `iox-scheme-<id>` for a known NON-default scheme, else null — an unknown id never reaches a class attribute. */
|
|
8451
|
+
declare function colorSchemeClass(id: unknown): string | null;
|
|
8452
|
+
/** The node shapes this module reads: a serialized node (`props`) or a builder node (`traits[]`). */
|
|
8453
|
+
interface DesignClassSource {
|
|
8454
|
+
elementStyle?: string | null;
|
|
8455
|
+
props?: Readonly<Record<string, unknown>> | null;
|
|
8456
|
+
traits?: ReadonlyArray<{
|
|
8457
|
+
name?: string;
|
|
8458
|
+
default?: unknown;
|
|
8459
|
+
}> | null;
|
|
8460
|
+
}
|
|
8461
|
+
/** A node's `colorScheme`, from `props` (serialized) or its trait (builder). */
|
|
8462
|
+
declare function colorSchemeOf(node: DesignClassSource | null | undefined): string | null;
|
|
8463
|
+
/** True when the node wears a known element style — the marker is on it. */
|
|
8464
|
+
declare function hasElementStyleMarker(node: {
|
|
8465
|
+
elementStyle?: string | null;
|
|
8466
|
+
} | null | undefined): boolean;
|
|
8467
|
+
/** The classes a node renders: `'iox-es iox-es-card iox-scheme-inverse'`, or `''` for none. */
|
|
8468
|
+
declare function nodeDesignClasses(node: DesignClassSource | null | undefined): string;
|
|
8469
|
+
/** Make an element's design classes match the node — the live switch on the canvas and the
|
|
8470
|
+
* component path's one-time stamp. Removes stale ones; touches no other class. */
|
|
8471
|
+
declare function syncNodeDesignClasses(el: {
|
|
8472
|
+
classList: DOMTokenList;
|
|
8473
|
+
} | null | undefined, node: DesignClassSource | null | undefined): void;
|
|
8474
|
+
|
|
8475
|
+
/**
|
|
8476
|
+
* Empty images (design-system DS3). A MARKED Image (`.iox-es-media`) with no source renders a box in
|
|
8477
|
+
* the `surface-2` token with its aspect ratio kept — on the canvas with an "Add image" label, on the
|
|
8478
|
+
* live site with nothing in it. An UNMARKED empty Image renders exactly as before (no `src`).
|
|
8479
|
+
*
|
|
8480
|
+
* Why a placeholder `src` instead of a src-less `<img>`: Chromium paints a src-less image as a broken
|
|
8481
|
+
* image (a frame, an icon and the alt text) and ignores `aspect-ratio` once alt text is present, and no
|
|
8482
|
+
* pseudo-element paints on an `<img>`. A real image with no natural size of its own (an SVG with no
|
|
8483
|
+
* width/height) is a proper replaced element: `aspect-ratio`/`object-fit` apply, the background shows
|
|
8484
|
+
* through, and its default object size (300×150) is the SAME for the canvas label and the live blank,
|
|
8485
|
+
* so both renderers lay the box out identically. The fill itself is shared CSS (`iox-design.css`)
|
|
8486
|
+
* keyed on {@link EMPTY_IMAGE_ATTRIBUTE}.
|
|
8487
|
+
*/
|
|
8488
|
+
/** Set on a marked Image while it has no source — the hook the shared fill rule keys on. */
|
|
8489
|
+
declare const EMPTY_IMAGE_ATTRIBUTE = "data-iox-empty";
|
|
8490
|
+
/** The live site's blank: an SVG with no intrinsic size and nothing in it. */
|
|
8491
|
+
declare const EMPTY_IMAGE_SRC: string;
|
|
8492
|
+
/**
|
|
8493
|
+
* The canvas blank: the same no-size SVG with `label` centred as a chip. The chip carries its own
|
|
8494
|
+
* light ground, so it reads on every flavor's `surface-2`, light or dark; it is builder chrome, never
|
|
8495
|
+
* site content. Width is estimated from the label length (an image cannot measure text).
|
|
8496
|
+
*/
|
|
8497
|
+
declare function emptyImageLabelSrc(label: string): string;
|
|
8498
|
+
/**
|
|
8499
|
+
* The `src` a node's Image renders when its own source is empty: the canvas label (when `label` is
|
|
8500
|
+
* given) or the live blank for a MARKED node; `null` — render exactly as before — for an unmarked
|
|
8501
|
+
* node or one that has a source.
|
|
8502
|
+
*/
|
|
8503
|
+
declare function emptyImageSrc(node: {
|
|
8504
|
+
elementStyle?: string | null;
|
|
8505
|
+
} | null | undefined, src: unknown, label?: string | null): string | null;
|
|
8506
|
+
|
|
8407
8507
|
/**
|
|
8408
8508
|
* BRAND DERIVATION (flavors plan §6, F2): one colour in, an asserted accessible ramp out.
|
|
8409
8509
|
*
|
|
@@ -8529,17 +8629,29 @@ declare function revertAvailable(appliedAt: number | null | undefined, now: numb
|
|
|
8529
8629
|
* to touch — a revert undoes the FLAVOR, not the author's week.
|
|
8530
8630
|
*/
|
|
8531
8631
|
declare function planFlavorRevert(current: ReadonlyArray<StoredDesignTokenRow>, snapshot: FlavorRevertSnapshot['tokens']): FlavorRevertPlan;
|
|
8632
|
+
/** What a previous seed wrote for one row — the "untouched" comparison base. */
|
|
8633
|
+
interface SeedExpectation {
|
|
8634
|
+
value: string;
|
|
8635
|
+
dark?: string;
|
|
8636
|
+
}
|
|
8637
|
+
/**
|
|
8638
|
+
* What the PREVIOUS seed wrote, per row: a map by name, or a function of the stored row (a baseline
|
|
8639
|
+
* that depends on WHICH seed stamped the row — the Swiss → Crisp migration's case).
|
|
8640
|
+
*/
|
|
8641
|
+
type SeedBaseline = ReadonlyMap<string, SeedExpectation> | ((row: StoredDesignTokenRow) => SeedExpectation | undefined);
|
|
8532
8642
|
/**
|
|
8533
8643
|
* The seeding MERGE: desired tokens vs existing rows, deciding create / update / keep. The §10 C2
|
|
8534
8644
|
* rule — "an upgrade only rewrites untouched rows" — is a comparison against what the PREVIOUS
|
|
8535
|
-
* seed wrote (`
|
|
8536
|
-
* rewritten; any drift means the author took it over, and their hand wins. A row
|
|
8537
|
-
* `flavor:` stamp
|
|
8645
|
+
* seed wrote (`baseline`): a seeded row whose value still equals it is the machine's and may be
|
|
8646
|
+
* rewritten; any drift means the author took it over, and their hand wins. A row the design did not
|
|
8647
|
+
* write is never touched: no `flavor:` stamp, unless it is a `user` row (a font the author CHOSE in
|
|
8648
|
+
* the design) whose value is exactly what the previous design wrote — that row is the design's own
|
|
8649
|
+
* choice, so a new choice may replace it. `group`/`tier` ride every write; a desired row's own
|
|
8650
|
+
* `source` (a chosen font's `user`) wins over the pack stamp.
|
|
8538
8651
|
*/
|
|
8539
|
-
declare function planFlavorSeed(desired: ReadonlyArray<FlavorTokenDef
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
}> | null): FlavorSeedPlan;
|
|
8652
|
+
declare function planFlavorSeed(desired: ReadonlyArray<FlavorTokenDef & {
|
|
8653
|
+
source?: string;
|
|
8654
|
+
}>, existing: ReadonlyArray<StoredDesignTokenRow>, stamp: string, baseline: SeedBaseline | null): FlavorSeedPlan;
|
|
8543
8655
|
|
|
8544
8656
|
interface LinearSpring {
|
|
8545
8657
|
easing: string;
|
|
@@ -8576,11 +8688,27 @@ declare function cssString(value: string): string;
|
|
|
8576
8688
|
declare function buildFontFaceCss(descriptors: ReadonlyArray<FontDescriptor> | null | undefined): string;
|
|
8577
8689
|
/** The family names in a CSS `font-family` stack, unquoted, in order. */
|
|
8578
8690
|
declare function parseFontFamilies(stack: string): string[];
|
|
8691
|
+
/** Where Google serves the stylesheets, and the origin the font FILES come from (preconnect). */
|
|
8692
|
+
declare const GOOGLE_FONTS_CSS_ORIGIN = "https://fonts.googleapis.com";
|
|
8693
|
+
declare const GOOGLE_FONTS_FILE_ORIGIN = "https://fonts.gstatic.com";
|
|
8694
|
+
/** The ONE stylesheet URL for a catalog id — both renderers link exactly this (one per family, T7). */
|
|
8695
|
+
declare function googleFontHref(id: string): string;
|
|
8696
|
+
/** The catalog id of a family name (case-insensitive), or null — a system or uploaded face has none. */
|
|
8697
|
+
declare function catalogFontId(family: string | null | undefined): string | null;
|
|
8698
|
+
interface FontsForTokensOptions {
|
|
8699
|
+
/**
|
|
8700
|
+
* The CSS that will actually render (node rules, element styles). `font-mono` is loaded only when
|
|
8701
|
+
* something READS it — here or in another token's value — because no element style does: an org
|
|
8702
|
+
* would otherwise download a monospace face for a site with no code on it.
|
|
8703
|
+
*/
|
|
8704
|
+
usedCss?: string;
|
|
8705
|
+
}
|
|
8579
8706
|
/**
|
|
8580
|
-
* The Google css2 ids to load for a token set: every catalog family named by
|
|
8581
|
-
*
|
|
8707
|
+
* The Google css2 ids to load for a token set: every catalog family named by the display / body /
|
|
8708
|
+
* label roles, plus mono when referenced (above). One id per family (T7 — one `<link>` per family, so
|
|
8709
|
+
* one bad id cannot sink the others), in role order.
|
|
8582
8710
|
*/
|
|
8583
|
-
declare function fontsForTokens(tokens: ReadonlyArray<DesignTokenLike> | null | undefined): string[];
|
|
8711
|
+
declare function fontsForTokens(tokens: ReadonlyArray<DesignTokenLike> | null | undefined, opts?: FontsForTokensOptions): string[];
|
|
8584
8712
|
|
|
8585
8713
|
/**
|
|
8586
8714
|
* Which `--iox-<name>` a piece of COMPONENT CSS may reference (design-system §3b-bis: "component CSS
|
|
@@ -8595,6 +8723,111 @@ declare function specTokenNames(): ReadonlySet<string>;
|
|
|
8595
8723
|
declare function tokenReferences(css: string): string[];
|
|
8596
8724
|
/** The referenced names that are neither spec tokens nor in `alsoAllowed`. */
|
|
8597
8725
|
declare function unknownTokenReferences(css: string, alsoAllowed?: Iterable<string>): string[];
|
|
8726
|
+
/**
|
|
8727
|
+
* Tokens read by a LEGACY rule — any rule whose selector is scoped `:not(.iox-es)` (the pre-DS2 look
|
|
8728
|
+
* of a node that wears no element style, design-system §3b-bis). Such a rule must read NO token at
|
|
8729
|
+
* all: a token it reads repaints a pre-DS2 page the moment the org's rows are seeded or a flavor is
|
|
8730
|
+
* applied (D5). Returns `selector → names` for each offending rule; comments are ignored.
|
|
8731
|
+
*/
|
|
8732
|
+
declare function legacyRuleTokenReferences(css: string): Array<{
|
|
8733
|
+
selector: string;
|
|
8734
|
+
tokens: string[];
|
|
8735
|
+
}>;
|
|
8736
|
+
|
|
8737
|
+
/**
|
|
8738
|
+
* The `settings.design` row (design-system plan §3f), read and written by ONE pair of functions so
|
|
8739
|
+
* the builder, the server's public page read (the engine's mode) and the site build agree on what a
|
|
8740
|
+
* stored row MEANS. The row is the settings collection's generic `config: [{ key, value }]`; values
|
|
8741
|
+
* are strings there (Boolean "true"/"false", Object as JSON), but a reader also accepts the typed
|
|
8742
|
+
* value a client control may have sent.
|
|
8743
|
+
*/
|
|
8744
|
+
/** The look a studio wears until it picks one (DS2's interim seed, and DS6's first-run selection). */
|
|
8745
|
+
declare const DEFAULT_FLAVOR_ID = "crisp";
|
|
8746
|
+
/** One `config` entry of a settings row. */
|
|
8747
|
+
interface DesignConfigEntry {
|
|
8748
|
+
key: string;
|
|
8749
|
+
value: unknown;
|
|
8750
|
+
}
|
|
8751
|
+
declare enum DesignConfigKey {
|
|
8752
|
+
FlavorId = "flavorId",
|
|
8753
|
+
FlavorVersion = "flavorVersion",
|
|
8754
|
+
BrandSeed = "brandSeed",
|
|
8755
|
+
PairId = "pairId",
|
|
8756
|
+
Shape = "shape",
|
|
8757
|
+
Density = "density",
|
|
8758
|
+
Motion = "motion",
|
|
8759
|
+
PillButtons = "pillButtons",
|
|
8760
|
+
Mode = "mode",
|
|
8761
|
+
Fonts = "fonts",
|
|
8762
|
+
Revert = "revert"
|
|
8763
|
+
}
|
|
8764
|
+
/** A stored design, resolved: `choices` is ALWAYS complete and valid (pack defaults fill the gaps). */
|
|
8765
|
+
interface StoredDesign {
|
|
8766
|
+
choices: DesignChoices;
|
|
8767
|
+
/** The flavor id exactly as stored — `swiss` until the DS4 migration rewrites it; null when no row. */
|
|
8768
|
+
storedFlavorId: string | null;
|
|
8769
|
+
/** The seed exactly as stored (F2 orgs carry their brand colour here); null when absent. */
|
|
8770
|
+
storedSeed: string | null;
|
|
8771
|
+
flavorVersion: string | null;
|
|
8772
|
+
revert: FlavorRevertSnapshot | null;
|
|
8773
|
+
/** False when the org has never stored a design — DS6's first run. */
|
|
8774
|
+
hasRow: boolean;
|
|
8775
|
+
}
|
|
8776
|
+
/** The pack for an id; a retired id (Swiss) resolves to the pack that `replaces` it. */
|
|
8777
|
+
declare function flavorPackById(id: string | null | undefined): FlavorPackV2 | undefined;
|
|
8778
|
+
/** True when `id` names a retired flavor that a v2 pack replaces (Swiss → Crisp). */
|
|
8779
|
+
declare function isRetiredFlavorId(id: string | null | undefined): boolean;
|
|
8780
|
+
/**
|
|
8781
|
+
* A partial set of choices completed against its pack: every missing or invalid value falls back to
|
|
8782
|
+
* the pack's own default (an unknown pair → the pack's first, a bad seed → the pack's seed).
|
|
8783
|
+
*/
|
|
8784
|
+
declare function resolveDesignChoices(partial: Partial<DesignChoices> | null | undefined): DesignChoices;
|
|
8785
|
+
/** The pack's own defaults for `flavorId` — what picking a card means before anything is tuned. */
|
|
8786
|
+
declare function packDesignChoices(flavorId: string): DesignChoices;
|
|
8787
|
+
/** A stored `settings.design` config → the resolved design. No row (or no config) → Crisp's defaults. */
|
|
8788
|
+
declare function readDesignConfig(config: ReadonlyArray<DesignConfigEntry> | null | undefined, hasRow?: boolean): StoredDesign;
|
|
8789
|
+
/** The colour mode a stored config compiles in — what the public page read hands the engine. */
|
|
8790
|
+
declare function designModeOf(config: ReadonlyArray<DesignConfigEntry> | null | undefined): DesignMode;
|
|
8791
|
+
/** Resolved choices (+ the revert snapshot) → the config array a settings row stores. */
|
|
8792
|
+
declare function designConfigEntries(choices: DesignChoices, flavorVersion: string | number, revert?: FlavorRevertSnapshot | null): DesignConfigEntry[];
|
|
8793
|
+
/** Two choice sets describe the same look (fonts compared by role). */
|
|
8794
|
+
declare function sameDesignChoices(a: DesignChoices, b: DesignChoices): boolean;
|
|
8795
|
+
|
|
8796
|
+
/** Every row a design writes — `buildFlavorTokens` for its pack. Empty for an unknown pack. */
|
|
8797
|
+
declare function designTokenRows(choices: DesignChoices): DesignTokenRow[];
|
|
8798
|
+
/**
|
|
8799
|
+
* What the PREVIOUS design wrote, as a baseline keyed by the row's own stamp: a row Swiss stamped is
|
|
8800
|
+
* judged against what Swiss wrote, every other row against `buildFlavorTokens` of the stored choices
|
|
8801
|
+
* (for an org with no design row, Crisp's defaults — exactly what DS2's interim seed wrote). In a
|
|
8802
|
+
* Swiss org the only v2 rows are that interim seed's, so they are judged against Crisp's DEFAULTS,
|
|
8803
|
+
* never against the brand-seeded Crisp the migration is about to write.
|
|
8804
|
+
*/
|
|
8805
|
+
declare function designBaseline(previous: StoredDesign): SeedBaseline;
|
|
8806
|
+
/** Apply `next` over the org's rows, judged against `previous` — the plan FlavorApplyService runs. */
|
|
8807
|
+
declare function planDesignApply(existing: ReadonlyArray<StoredDesignTokenRow>, previous: StoredDesign, next: DesignChoices): FlavorSeedPlan;
|
|
8808
|
+
/** The rows a design is missing by name — the builder-load top-up (never touches an existing row). */
|
|
8809
|
+
declare function missingDesignRows(existing: ReadonlyArray<{
|
|
8810
|
+
name: string;
|
|
8811
|
+
}>, choices: DesignChoices): DesignTokenRow[];
|
|
8812
|
+
interface SwissMigration {
|
|
8813
|
+
/** The design the org now wears: Crisp, carrying the stored brand seed when it is a colour. */
|
|
8814
|
+
choices: DesignChoices;
|
|
8815
|
+
/** The token merge, the four legacy alias rewrites included. */
|
|
8816
|
+
plan: FlavorSeedPlan;
|
|
8817
|
+
}
|
|
8818
|
+
/**
|
|
8819
|
+
* Swiss → Crisp (spec `legacyAliases`; D1). Needed when the design row says a retired flavor, or when
|
|
8820
|
+
* there is no design row but the org holds Swiss-stamped alias rows (F1 seeded those before the row
|
|
8821
|
+
* existed). Idempotent: once the row says Crisp nothing is needed, and re-running the plan writes
|
|
8822
|
+
* nothing.
|
|
8823
|
+
*
|
|
8824
|
+
* - The look: `planDesignApply` from Swiss to Crisp — Swiss-stamped rows untouched since Swiss seeded
|
|
8825
|
+
* them (incl. F2's `surface` / `line` / `accent`) become Crisp's; edited ones are kept.
|
|
8826
|
+
* - The aliases: `radius-control` / `radius-surface` / `space-control` / `space-stack` are rewritten to
|
|
8827
|
+
* their alias reference ONLY while still machine-owned and untouched, so a node saved since F1 that
|
|
8828
|
+
* reads `var(--iox-radius-control)` keeps resolving — now to Crisp's button radius.
|
|
8829
|
+
*/
|
|
8830
|
+
declare function planSwissMigration(existing: ReadonlyArray<StoredDesignTokenRow>, stored: StoredDesign): SwissMigration | null;
|
|
8598
8831
|
|
|
8599
|
-
export { ACCENT_TOKEN_NAMES, BUTTON_VARIANT_TO_STYLE, DESIGN_TOKEN_GROUPS, DESIGN_TOKEN_TIERS, DESIGN_TOKEN_TYPES, ELEMENT_STYLES, ELEMENT_STYLE_MARKER_CLASS, ELEMENT_STYLE_STATES, ElementStyleState, FLAVOR_SPEC_VERSION, FONT_CATALOG, FONT_FAMILY_TOKENS, 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, compileSchemeCss, compileTokenCss, compileTokenCssBlocks, cssString, defaultDesignChoices, defaultElementStyleFor, deriveAccentTokens, deriveBrandTokens, elementStyleById, elementStyleClass,
|
|
8600
|
-
export type { AccentBackgrounds, AccentTokenName, ApplyElementStyleResult, DensityId, DesignChoices, DesignMode, DesignTokenGroup, DesignTokenLike, DesignTokenRow, DesignTokenTier, DesignTokenType, ElementStyle, ElementStyleTarget, ElementStyleTraitLike, FlavorPack, FlavorPackV2, FlavorRevertPlan, FlavorRevertSnapshot, FlavorSeedPlan, FlavorSpecToken, FlavorTokenDef, FontDescriptor, FontFormat, FontPair, FontRoleToken, FontStyle, LinearSpring, MotionId, OkLab, OwnedTrait, OwnedTraitStatus, PalettePreset, ResolvedMode, Rgb, SchemeId, ShapeId, StoredDesignTokenRow, SwitchElementStyleResult, TokenCssBlocks, TokenCssOptions };
|
|
8832
|
+
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, 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 };
|
|
8833
|
+
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 };
|