@wistia/kaleidoscope 0.0.8 → 0.0.9
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 +10 -0
- package/dist/{color-BuPhQjcd.js → color-BwvIDNP5.js} +3 -3
- package/dist/{color-BuPhQjcd.js.map → color-BwvIDNP5.js.map} +1 -1
- package/dist/{engine-CcU0Q8Jg.d.ts → engine-DI3tsQ5q.d.ts} +2 -2
- package/dist/{engine-CcU0Q8Jg.d.ts.map → engine-DI3tsQ5q.d.ts.map} +1 -1
- package/dist/{engine-6ocr431e.js → engine-DY848hAQ.js} +703 -428
- package/dist/engine-DY848hAQ.js.map +1 -0
- package/dist/entries/color.js +3 -3
- package/dist/entries/engine.d.ts +1 -1
- package/dist/entries/engine.js +2 -2
- package/dist/entries/styleRegistry.d.ts +1 -1
- package/dist/entries/styleRegistry.js +2 -2
- package/dist/entries/validate.d.ts +1 -1
- package/dist/entries/validate.js +2 -2
- package/dist/entries/vocabulary.d.ts +2 -2
- package/dist/entries/vocabulary.js +3 -3
- package/dist/{getColorLightnessClassification-Dgr8qirZ.js → getColorLightnessClassification-BkZcKrdi.js} +3 -3
- package/dist/getColorLightnessClassification-BkZcKrdi.js.map +1 -0
- package/dist/{guards-BPewjm9T.js → guards-Cyl-NUQX.js} +2 -2
- package/dist/{guards-BPewjm9T.js.map → guards-Cyl-NUQX.js.map} +1 -1
- package/dist/{index-BTumAeju.d.ts → index-L5x6rNF_.d.ts} +13 -9
- package/dist/{index-BTumAeju.d.ts.map → index-L5x6rNF_.d.ts.map} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/{styleRegistry-BqGmp-3z.js → styleRegistry-BQVgtgLT.js} +74 -74
- package/dist/styleRegistry-BQVgtgLT.js.map +1 -0
- package/dist/{styleRegistry-BsMmbH_0.d.ts → styleRegistry-C7HARIpw.d.ts} +2 -2
- package/dist/{styleRegistry-BsMmbH_0.d.ts.map → styleRegistry-C7HARIpw.d.ts.map} +1 -1
- package/dist/{styleVocabulary-CDTPCMhZ.js → styleVocabulary-BJuyoSBc.js} +2 -2
- package/dist/{styleVocabulary-CDTPCMhZ.js.map → styleVocabulary-BJuyoSBc.js.map} +1 -1
- package/dist/{typography-BCKqcNDx.js → typography-BpeDYjMz.js} +8 -3
- package/dist/typography-BpeDYjMz.js.map +1 -0
- package/dist/{validate-8Ow1tYvz.d.ts → validate-BzIATwDA.d.ts} +2 -2
- package/dist/{validate-8Ow1tYvz.d.ts.map → validate-BzIATwDA.d.ts.map} +1 -1
- package/dist/{validate-D_VsJM1q.js → validate-DcGjEAHf.js} +75 -37
- package/dist/validate-DcGjEAHf.js.map +1 -0
- package/package.json +1 -1
- package/schema/style-v1.json +70 -21
- package/styles/aurora-dark.json +8 -8
- package/styles/aurora-light.json +8 -8
- package/styles/glass-dark.json +8 -8
- package/styles/glass-light.json +8 -8
- package/styles/opaque-bright.json +8 -8
- package/styles/opaque-heavy.json +8 -8
- package/styles/opaque-light.json +8 -8
- package/styles/opaque-medium.json +8 -8
- package/styles/opaque-minimal.json +8 -8
- package/dist/engine-6ocr431e.js.map +0 -1
- package/dist/getColorLightnessClassification-Dgr8qirZ.js.map +0 -1
- package/dist/styleRegistry-BqGmp-3z.js.map +0 -1
- package/dist/typography-BCKqcNDx.js.map +0 -1
- package/dist/validate-D_VsJM1q.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleVocabulary-CDTPCMhZ.js","names":[],"sources":["../src/styleVocabulary/anchors.ts","../src/styleVocabulary/anchorValues.ts","../src/styleVocabulary/backgroundColor.ts","../src/styleVocabulary/elevation.ts","../src/styleVocabulary/gradientShape.ts","../src/styleVocabulary/motion.ts","../src/styleVocabulary/texture.ts","../src/styleVocabulary/treatment.ts","../src/styleVocabulary/index.ts"],"sourcesContent":["import type { Dimension, FontStack, SingleColor, BrandKitTokenRef } from './anchorValues';\nimport type { GradientStops } from './gradientShape';\nimport type { Treatment } from './treatment';\n\nexport const ANCHOR_GROUPS = ['dimensions', 'colors', 'fonts'] as const;\nexport type AnchorGroup = (typeof ANCHOR_GROUPS)[number];\n\n/**\n * Like the required color and font anchors, the required dimension anchors map up to Brand Kit\n * options. A Style may hard-code one instead: Glass does, because the glass effect needs\n * generous rounding.\n */\nexport const REQUIRED_DIMENSION_ANCHORS = ['borderRadius'] as const;\nexport type RequiredDimensionAnchor = (typeof REQUIRED_DIMENSION_ANCHORS)[number];\n\nexport const COLOR_ANCHOR_NAMES = ['pageBackground', 'primary', 'ground', 'gradientStops'] as const;\nexport type ColorAnchorName = (typeof COLOR_ANCHOR_NAMES)[number];\n\n/**\n * The required color anchors should correlate to whatever Brand Kit tokens exist,\n * currently pageBackgroundColor and primaryColor.\n * If an accentColor is supported in the future, we'll add it here.\n */\nexport const REQUIRED_COLOR_ANCHORS = ['pageBackground', 'primary'] as const;\nexport type RequiredColorAnchor = (typeof REQUIRED_COLOR_ANCHORS)[number];\n\n/**\n * These colors are optional, based on which Style and/or treatment is applied to a surface.\n * Glass styles use the ground color as the background for the glass effect: dark or light.\n * The aurora styles use the ground color as a hard-coded value for the backgrounds of cards and panels.\n */\nexport const OPTIONAL_COLOR_ANCHORS = ['ground', 'gradientStops'] as const;\nexport type OptionalColorAnchor = (typeof OPTIONAL_COLOR_ANCHORS)[number];\n\n/**\n * Like the required color anchors, the required font anchors map up to the options defined by Brand Kits.\n */\nexport const REQUIRED_FONT_ANCHORS = ['heading', 'body', 'button'] as const;\nexport type RequiredFontAnchor = (typeof REQUIRED_FONT_ANCHORS)[number];\n\n/**\n * The color anchors that hold one color. `gradientStops` holds a list, so only a gradient can read\n * it — every setting that resolves to a single color names one of these instead.\n */\nexport const SINGLE_COLOR_ANCHOR_NAMES = ['pageBackground', 'primary', 'ground'] as const;\nexport type SingleColorAnchorName = (typeof SINGLE_COLOR_ANCHOR_NAMES)[number];\n\nexport const ANCHOR_REF_PREFIX = 'anchors.';\n\nexport type ColorAnchorRef = `anchors.colors.${ColorAnchorName}`;\nexport type SingleColorAnchorRef = `anchors.colors.${SingleColorAnchorName}`;\nexport type FontAnchorRef = `anchors.fonts.${RequiredFontAnchor}`;\nexport type DimensionAnchorRef = `anchors.dimensions.${RequiredDimensionAnchor}`;\n\nexport type ColorAnchorValue<Name extends ColorAnchorName> = Name extends 'gradientStops'\n ? GradientStops\n : SingleColor;\n\nexport type ColorAnchors = Readonly<{ [Name in RequiredColorAnchor]: ColorAnchorValue<Name> }> &\n Readonly<{ [Name in OptionalColorAnchor]?: ColorAnchorValue<Name> }>;\n\nexport type DimensionAnchors = Readonly<Record<RequiredDimensionAnchor, Dimension>>;\n\n// check in about this type\nexport type FontAnchors = Readonly<Record<RequiredFontAnchor, FontStack | BrandKitTokenRef>>;\n\n/**\n * All the possible anchors referenced in a style doc. Options defined by the schema.\n */\nexport type Anchors = {\n readonly colors: ColorAnchors;\n readonly dimensions: DimensionAnchors;\n readonly fonts: FontAnchors;\n};\n\n/** Which colors a treatment cannot resolve without. Checked by `validateStyleDocument`. */\nexport const ANCHORS_REQUIRED_BY_TREATMENT: Readonly<\n Record<Treatment, readonly ColorAnchorName[]>\n> = {\n flat: [],\n glassy: ['ground'],\n gradient: ['gradientStops'],\n none: [],\n};\n","export type BrandKitTokenRef = `$${string}`;\n\nexport type LiteralColor = `#${string}` | `rgb(${string})` | `rgba(${string})`;\n\nexport const COLOR_RELATIONSHIPS = ['same', 'complementary', 'analogous', 'triad'] as const;\nexport type ColorRelationship = (typeof COLOR_RELATIONSHIPS)[number];\n\nexport const COLOR_TONES = ['dark', 'light'] as const;\nexport type ColorTone = (typeof COLOR_TONES)[number];\n\n/**\n * A color derived from a brand token. `relation` turns its hue, then `tone` takes the result to\n * the brand's dark or light background color. Both are optional; with neither, we use the token itself.\n */\nexport type RelatedColor = {\n readonly from: BrandKitTokenRef;\n readonly relation?: ColorRelationship;\n readonly tone?: ColorTone;\n};\n\nexport type SingleColor = LiteralColor | RelatedColor | BrandKitTokenRef;\n\n/**\n * The CSS generic families a hard-coded font stack must end in, so a face that fails to load\n * still falls back to the right kind of type.\n */\nexport const GENERIC_FONT_FAMILIES = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-monospace',\n 'ui-rounded',\n 'math',\n] as const;\nexport type GenericFontFamily = (typeof GENERIC_FONT_FAMILIES)[number];\n\nexport type FontStack = `${string}${GenericFontFamily}`;\n\n/** A length: a brand token, a number in pixels */\nexport type Dimension = BrandKitTokenRef | number;\n\nexport const MAX_COLOR_SCALE_OFFSET = 11;\nexport type ColorScaleOffset = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n","import type { SingleColorAnchorRef } from './anchors';\nimport type { ColorScaleOffset } from './anchorValues';\n\n/**\n * Where a background's `offset` starts counting from.\n *\n * - `source` — at the source color itself: `colors.primary · 2` is two steps off the primary color.\n * - `parent` — on the source's scale, at the step nearest the fill of the surface this one sits\n * on, stepping lighter if the parent is dark, and darker if it is light or midtone.\n *\n * The page sits on nothing, so it cannot count from `parent`.\n * A surface that sits on several\n * parents counts from the closest parent.\n */\nexport const OFFSET_ORIGINS = ['source', 'parent'] as const;\nexport type OffsetOrigin = (typeof OFFSET_ORIGINS)[number];\n\n/**\n * When a background color no longer meets accessible contrast against its parent surface, how do we handle that?\n *\n * - `never` — Do nothing. the fill is always what `backgroundColor` resolves to.\n *\n * - `when-indistinct` — Invert the background and foreground colors: the text color\n * becomes the fill and the fill becomes the text. The pair maintains accessible contrast\n * and compatibility with the color scheme.\n */\nexport const INVERT_RULES = ['never', 'when-indistinct'] as const;\nexport type InvertRule = (typeof INVERT_RULES)[number];\n\n/**\n * What color does this background fill reference--a color anchor or the parent surface's background color?\n */\nexport type BackgroundSource = SingleColorAnchorRef | 'parent';\n\n/**\n * A surface's own fill: where it steps from, how many steps along that source's scale it sits,\n * where those steps start counting ({@link OffsetOrigin}), and whether it may\n * {@link InvertRule | invert} with its text.\n *\n * A `flat` surface at `parent · 0` paints exactly its parent's fill and cannot be seen,\n * which works out to the same effect as `treatment: \"none\"` applied to a surface — unless\n * it inverts `when-indistinct`, since a fill identical to its parent is never distinct, so\n * the swap always fires and the surface paints its text color.\n */\nexport type BackgroundColor = {\n readonly from: OffsetOrigin;\n readonly invert: InvertRule;\n readonly offset: ColorScaleOffset;\n readonly source: BackgroundSource;\n};\n","// The `elevation` setting: how far a surface lifts off what is behind it, and in what color.\n\nimport type { SingleColorAnchorRef } from './anchors';\nimport type { SingleColor } from './anchorValues';\n\nexport const ELEVATION_DEPTHS = ['none', 'low', 'medium', 'high'] as const;\nexport type ElevationDepth = (typeof ELEVATION_DEPTHS)[number];\n\nexport const ELEVATION_HARDNESSES = ['soft', 'hard', 'glow'] as const;\nexport type ElevationHardness = (typeof ELEVATION_HARDNESSES)[number];\n\nexport const ELEVATION_COLOR_SOURCE_KEYWORDS = ['shade'] as const;\nexport type ElevationColorSourceKeyword = (typeof ELEVATION_COLOR_SOURCE_KEYWORDS)[number];\n\nexport type ElevationColorSource = ElevationColorSourceKeyword | SingleColorAnchorRef | SingleColor;\n\n/**\n * How a surface lifts against its backgroung to appear 3D, and in what color.\n * Alphas, blur radii and offsets are engine-owned based on the value of `hardness`.\n * When `depth` is `none` no shadow/elevation is rendered.\n */\nexport type Elevation = {\n readonly depth: ElevationDepth;\n readonly hardness: ElevationHardness;\n readonly source: ElevationColorSource;\n};\n","import type { SingleColor } from './anchorValues';\n\nexport const MIN_GRADIENT_STOPS = 2;\nexport const MAX_GRADIENT_STOPS = 6;\n\nexport type GradientStops = readonly SingleColor[];\n\nexport const GRADIENT_SHAPE_OPTIONS = ['glows', 'linear', 'radial', 'beams'] as const;\nexport type GradientShapeOption = (typeof GRADIENT_SHAPE_OPTIONS)[number];\n\nexport const GRADIENT_DIRECTIONS = [\n 'to-top',\n 'to-top-right',\n 'to-right',\n 'to-bottom-right',\n 'to-bottom',\n 'to-bottom-left',\n 'to-left',\n 'to-top-left',\n] as const;\nexport type GradientDirection = (typeof GRADIENT_DIRECTIONS)[number];\n\nexport const GRADIENT_POSITIONS = [\n 'center',\n 'top',\n 'top-right',\n 'right',\n 'bottom-right',\n 'bottom',\n 'bottom-left',\n 'left',\n 'top-left',\n] as const;\nexport type GradientPosition = (typeof GRADIENT_POSITIONS)[number];\n\n/**\n * How far a `radial` gradient's last stop reaches: `near` ends at the furthest edge, so the corners\n * beyond it hold the final color; `far` carries it to the furthest corner.\n */\nexport const GRADIENT_EXTENTS = ['near', 'far'] as const;\nexport type GradientExtent = (typeof GRADIENT_EXTENTS)[number];\n\n/**\n * A gradient shape and whatever supporting info required to draw it.\n * `glows` and `beams` are placed by the engine and take no other args\n * `linear` says which direction it runs\n * `radial` supports where it's centered and how far it reaches.\n * Any shape may carry its own `stops`, in place of `anchors.colors.gradientStops`.\n */\nexport type GradientShape = { readonly stops?: GradientStops } & (\n | { readonly kind: 'beams' }\n | { readonly kind: 'glows' }\n | { readonly direction: GradientDirection; readonly kind: 'linear' }\n | {\n readonly extent: GradientExtent;\n readonly kind: 'radial';\n readonly position: GradientPosition;\n }\n);\n","import type { SingleColorAnchorRef } from './anchors';\nimport type { SingleColor } from './anchorValues';\n\nexport const AMBIENT_MOTIONS = ['none', 'drift', 'pulse'] as const;\nexport type AmbientMotion = (typeof AMBIENT_MOTIONS)[number];\n\n/** Rate of ambient motion. Exact durations are owned by the engine. */\nexport const MOTION_SPEEDS = ['slow', 'medium', 'fast'] as const;\nexport type MotionSpeed = (typeof MOTION_SPEEDS)[number];\n\n/** How a surface moves between states — hover, focus, active. Easings are engine-owned. */\nexport const TRANSITIONS = ['none', 'quick', 'smooth'] as const;\nexport type Transition = (typeof TRANSITIONS)[number];\n\n/** How far a pulse's shadow reaches. Exact blur and spread are owned by the engine. */\nexport const PULSE_SIZES = ['small', 'medium', 'large'] as const;\nexport type PulseSize = (typeof PULSE_SIZES)[number];\n\n/**\n * The color a pulsing surface's border and shadow move towards. Its fill and text never change.\n * `derive` uses the color of the surface's `elevation`, whether or not it casts a shadow at rest.\n */\nexport type PulseColor = 'derive' | SingleColorAnchorRef | SingleColor;\n\n/**\n * Does this surface have any non-interactive animation?\n * `transition` is how it moves when its state changes. A card can transition smoothly on hover while sitting\n * perfectly still otherwise.\n * When `ambient` is `none`, no motion is rendered.\n * If `ambient` is `pulse`, `pulseColor` and `pulseSize` are required. Otherwise they must not be present.\n *\n * Every ambient motion will degrade according to the `prefers-reduced-motion` setting.\n * The engine owns this fallback so style docs do not have to provide this.\n */\nexport type Motion = {\n readonly speed: MotionSpeed;\n readonly transition: Transition;\n} & (\n | { readonly ambient: 'pulse'; readonly pulseColor: PulseColor; readonly pulseSize: PulseSize }\n | {\n readonly ambient: Exclude<AmbientMotion, 'pulse'>;\n readonly pulseColor?: never;\n readonly pulseSize?: never;\n }\n);\n","/**\n * - `grain` — fine, even film noise\n * - `static` — sharp, high-contrast speckles, like screen noise\n * - `halftone` — a regular dot screen, as in print\n */\nexport const TEXTURE_KINDS = ['none', 'grain', 'static', 'halftone'] as const;\nexport type TextureKind = (typeof TEXTURE_KINDS)[number];\n\nexport const TEXTURE_INTENSITIES = ['low', 'medium', 'high'] as const;\nexport type TextureIntensity = (typeof TEXTURE_INTENSITIES)[number];\n\n/**\n * A texture laid over the surface's fill: which one, and how strong it is.\n *\n * It is separate from `treatment` because textures can be stacked on top of treatments:\n * grain on glass, static on a gradient.\n *\n * When `kind` is `none`, no texture is applied.\n */\nexport type Texture = {\n readonly intensity: TextureIntensity;\n readonly kind: TextureKind;\n};\n","/**\n * What visual treatment is applied to a surface?\n * `gradient` renders `colors.gradientStops` based on the values provided in `gradientShape`\n * `glassy` renders a semi-translucent glass effect, best over a background with visual noise/texture as opposed to a flat color.\n * `flat` renders a flat color\n * `none` renders no background and lets the parent show through\n */\nexport const TREATMENTS = ['none', 'flat', 'glassy', 'gradient'] as const;\nexport type Treatment = (typeof TREATMENTS)[number];\n","/**\n * The shape of a Kaleidoscope Style document.\n *\n * A style document provides a set of instructions on how to render a set of surfaces,\n * based on abstractified representations of CSS rules.\n *\n * The engine takes these instructions and \"inflates\" them into actual CSS that can be applied\n * to embeds and/or hosted pages.\n */\nimport type { Anchors } from './anchors';\nimport type { Surfaces } from './surfaces';\nimport type { Typography } from './typography';\n\n/** The top-level keys in a Style document */\nexport const DOCUMENT_KEYS = [\n 'id',\n 'name',\n 'schemaVersion',\n 'typography',\n 'anchors',\n 'surfaces',\n] as const;\n\nexport type StyleDocument = {\n readonly anchors: Anchors;\n readonly id: string;\n readonly name: string;\n readonly schemaVersion: 1;\n readonly surfaces: Surfaces;\n readonly typography: Typography;\n};\n\nexport * from './anchors';\nexport * from './anchorValues';\nexport * from './backgroundColor';\nexport * from './border';\nexport * from './elevation';\nexport * from './gradientShape';\nexport * from './motion';\n// `radius` declares only types\nexport type * from './radius';\nexport * from './surfaces';\n// `textColor` declares only types\nexport type * from './textColor';\nexport * from './texture';\nexport * from './treatment';\nexport * from './typography';\n"],"mappings":";;;;;;;;;;AAIA,MAAa,gBAAgB;CAAC;CAAc;CAAU;AAAO;;;;;;AAQ7D,MAAa,6BAA6B,CAAC,cAAc;AAGzD,MAAa,qBAAqB;CAAC;CAAkB;CAAW;CAAU;AAAe;;;;;;AAQzF,MAAa,yBAAyB,CAAC,kBAAkB,SAAS;;;;;;AAQlE,MAAa,yBAAyB,CAAC,UAAU,eAAe;;;;AAMhE,MAAa,wBAAwB;CAAC;CAAW;CAAQ;AAAQ;;;;;AAOjE,MAAa,4BAA4B;CAAC;CAAkB;CAAW;AAAQ;AAG/E,MAAa,oBAAoB;;AA6BjC,MAAa,gCAET;CACF,MAAM,CAAC;CACP,QAAQ,CAAC,QAAQ;CACjB,UAAU,CAAC,eAAe;CAC1B,MAAM,CAAC;AACT;;AC/EA,MAAa,sBAAsB;CAAC;CAAQ;CAAiB;CAAa;AAAO;AAGjF,MAAa,cAAc,CAAC,QAAQ,OAAO;;;;;AAmB3C,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAQA,MAAa,yBAAyB;;;;;;;;;;;;;AChCtC,MAAa,iBAAiB,CAAC,UAAU,QAAQ;;;;;;;;;;AAYjD,MAAa,eAAe,CAAC,SAAS,iBAAiB;;ACrBvD,MAAa,mBAAmB;CAAC;CAAQ;CAAO;CAAU;AAAM;AAGhE,MAAa,uBAAuB;CAAC;CAAQ;CAAQ;AAAM;AAG3D,MAAa,kCAAkC,CAAC,OAAO;;ACTvD,MAAa,qBAAqB;AAClC,MAAa,qBAAqB;AAIlC,MAAa,yBAAyB;CAAC;CAAS;CAAU;CAAU;AAAO;AAG3E,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAOA,MAAa,mBAAmB,CAAC,QAAQ,KAAK;;ACpC9C,MAAa,kBAAkB;CAAC;CAAQ;CAAS;AAAO;;AAIxD,MAAa,gBAAgB;CAAC;CAAQ;CAAU;AAAM;;AAItD,MAAa,cAAc;CAAC;CAAQ;CAAS;AAAQ;;AAIrD,MAAa,cAAc;CAAC;CAAS;CAAU;AAAO;;;;;;;ACVtD,MAAa,gBAAgB;CAAC;CAAQ;CAAS;CAAU;AAAU;AAGnE,MAAa,sBAAsB;CAAC;CAAO;CAAU;AAAM;;;;;;;;;ACD3D,MAAa,aAAa;CAAC;CAAQ;CAAQ;CAAU;AAAU;;;ACO/D,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"styleVocabulary-BJuyoSBc.js","names":[],"sources":["../src/styleVocabulary/anchors.ts","../src/styleVocabulary/anchorValues.ts","../src/styleVocabulary/backgroundColor.ts","../src/styleVocabulary/elevation.ts","../src/styleVocabulary/gradientShape.ts","../src/styleVocabulary/motion.ts","../src/styleVocabulary/texture.ts","../src/styleVocabulary/treatment.ts","../src/styleVocabulary/index.ts"],"sourcesContent":["import type { Dimension, FontStack, SingleColor, BrandKitTokenRef } from './anchorValues';\nimport type { GradientStops } from './gradientShape';\nimport type { Treatment } from './treatment';\n\nexport const ANCHOR_GROUPS = ['dimensions', 'colors', 'fonts'] as const;\nexport type AnchorGroup = (typeof ANCHOR_GROUPS)[number];\n\n/**\n * Like the required color and font anchors, the required dimension anchors map up to Brand Kit\n * options. A Style may hard-code one instead: Glass does, because the glass effect needs\n * generous rounding.\n */\nexport const REQUIRED_DIMENSION_ANCHORS = ['borderRadius'] as const;\nexport type RequiredDimensionAnchor = (typeof REQUIRED_DIMENSION_ANCHORS)[number];\n\nexport const COLOR_ANCHOR_NAMES = ['pageBackground', 'primary', 'ground', 'gradientStops'] as const;\nexport type ColorAnchorName = (typeof COLOR_ANCHOR_NAMES)[number];\n\n/**\n * The required color anchors should correlate to whatever Brand Kit tokens exist,\n * currently pageBackgroundColor and primaryColor.\n * If an accentColor is supported in the future, we'll add it here.\n */\nexport const REQUIRED_COLOR_ANCHORS = ['pageBackground', 'primary'] as const;\nexport type RequiredColorAnchor = (typeof REQUIRED_COLOR_ANCHORS)[number];\n\n/**\n * These colors are optional, based on which Style and/or treatment is applied to a surface.\n * Glass styles use the ground color as the background for the glass effect: dark or light.\n * The aurora styles use the ground color as a hard-coded value for the backgrounds of cards and panels.\n */\nexport const OPTIONAL_COLOR_ANCHORS = ['ground', 'gradientStops'] as const;\nexport type OptionalColorAnchor = (typeof OPTIONAL_COLOR_ANCHORS)[number];\n\n/**\n * Like the required color anchors, the required font anchors map up to the options defined by Brand Kits.\n */\nexport const REQUIRED_FONT_ANCHORS = ['heading', 'body', 'button'] as const;\nexport type RequiredFontAnchor = (typeof REQUIRED_FONT_ANCHORS)[number];\n\n/**\n * The color anchors that hold one color. `gradientStops` holds a list, so only a gradient can read\n * it — every setting that resolves to a single color names one of these instead.\n */\nexport const SINGLE_COLOR_ANCHOR_NAMES = ['pageBackground', 'primary', 'ground'] as const;\nexport type SingleColorAnchorName = (typeof SINGLE_COLOR_ANCHOR_NAMES)[number];\n\nexport const ANCHOR_REF_PREFIX = 'anchors.';\n\nexport type ColorAnchorRef = `anchors.colors.${ColorAnchorName}`;\nexport type SingleColorAnchorRef = `anchors.colors.${SingleColorAnchorName}`;\nexport type FontAnchorRef = `anchors.fonts.${RequiredFontAnchor}`;\nexport type DimensionAnchorRef = `anchors.dimensions.${RequiredDimensionAnchor}`;\n\nexport type ColorAnchorValue<Name extends ColorAnchorName> = Name extends 'gradientStops'\n ? GradientStops\n : SingleColor;\n\nexport type ColorAnchors = Readonly<{ [Name in RequiredColorAnchor]: ColorAnchorValue<Name> }> &\n Readonly<{ [Name in OptionalColorAnchor]?: ColorAnchorValue<Name> }>;\n\nexport type DimensionAnchors = Readonly<Record<RequiredDimensionAnchor, Dimension>>;\n\n// check in about this type\nexport type FontAnchors = Readonly<Record<RequiredFontAnchor, FontStack | BrandKitTokenRef>>;\n\n/**\n * All the possible anchors referenced in a style doc. Options defined by the schema.\n */\nexport type Anchors = {\n readonly colors: ColorAnchors;\n readonly dimensions: DimensionAnchors;\n readonly fonts: FontAnchors;\n};\n\n/** Which colors a treatment cannot resolve without. Checked by `validateStyleDocument`. */\nexport const ANCHORS_REQUIRED_BY_TREATMENT: Readonly<\n Record<Treatment, readonly ColorAnchorName[]>\n> = {\n flat: [],\n glassy: ['ground'],\n gradient: ['gradientStops'],\n none: [],\n};\n","export type BrandKitTokenRef = `$${string}`;\n\nexport type LiteralColor = `#${string}` | `rgb(${string})` | `rgba(${string})`;\n\nexport const COLOR_RELATIONSHIPS = ['same', 'complementary', 'analogous', 'triad'] as const;\nexport type ColorRelationship = (typeof COLOR_RELATIONSHIPS)[number];\n\nexport const COLOR_TONES = ['dark', 'light'] as const;\nexport type ColorTone = (typeof COLOR_TONES)[number];\n\n/**\n * A color derived from a brand token. `relation` turns its hue, then `tone` takes the result to\n * the brand's dark or light background color. Both are optional; with neither, we use the token itself.\n */\nexport type RelatedColor = {\n readonly from: BrandKitTokenRef;\n readonly relation?: ColorRelationship;\n readonly tone?: ColorTone;\n};\n\nexport type SingleColor = LiteralColor | RelatedColor | BrandKitTokenRef;\n\n/**\n * The CSS generic families a hard-coded font stack must end in, so a face that fails to load\n * still falls back to the right kind of type.\n */\nexport const GENERIC_FONT_FAMILIES = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-monospace',\n 'ui-rounded',\n 'math',\n] as const;\nexport type GenericFontFamily = (typeof GENERIC_FONT_FAMILIES)[number];\n\nexport type FontStack = `${string}${GenericFontFamily}`;\n\n/** A length: a brand token, a number in pixels */\nexport type Dimension = BrandKitTokenRef | number;\n\nexport const MAX_COLOR_SCALE_OFFSET = 11;\nexport type ColorScaleOffset = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n","import type { SingleColorAnchorRef } from './anchors';\nimport type { ColorScaleOffset } from './anchorValues';\n\n/**\n * Where a background's `offset` starts counting from.\n *\n * - `source` — at the source color itself: `colors.primary · 2` is two steps off the primary color.\n * - `parent` — on the source's scale, at the step nearest the fill of the surface this one sits\n * on, stepping lighter if the parent is dark, and darker if it is light or midtone.\n *\n * The page sits on nothing, so it cannot count from `parent`.\n * A surface that sits on several\n * parents counts from the closest parent.\n */\nexport const OFFSET_ORIGINS = ['source', 'parent'] as const;\nexport type OffsetOrigin = (typeof OFFSET_ORIGINS)[number];\n\n/**\n * When a background color no longer meets accessible contrast against its parent surface, how do we handle that?\n *\n * - `never` — Do nothing. the fill is always what `backgroundColor` resolves to.\n *\n * - `when-indistinct` — Invert the background and foreground colors: the text color\n * becomes the fill and the fill becomes the text. The pair maintains accessible contrast\n * and compatibility with the color scheme.\n */\nexport const INVERT_RULES = ['never', 'when-indistinct'] as const;\nexport type InvertRule = (typeof INVERT_RULES)[number];\n\n/**\n * What color does this background fill reference--a color anchor or the parent surface's background color?\n */\nexport type BackgroundSource = SingleColorAnchorRef | 'parent';\n\n/**\n * A surface's own fill: where it steps from, how many steps along that source's scale it sits,\n * where those steps start counting ({@link OffsetOrigin}), and whether it may\n * {@link InvertRule | invert} with its text.\n *\n * A `flat` surface at `parent · 0` paints exactly its parent's fill and cannot be seen,\n * which works out to the same effect as `treatment: \"none\"` applied to a surface — unless\n * it inverts `when-indistinct`, since a fill identical to its parent is never distinct, so\n * the swap always fires and the surface paints its text color.\n */\nexport type BackgroundColor = {\n readonly from: OffsetOrigin;\n readonly invert: InvertRule;\n readonly offset: ColorScaleOffset;\n readonly source: BackgroundSource;\n};\n","// The `elevation` setting: how far a surface lifts off what is behind it, and in what color.\n\nimport type { SingleColorAnchorRef } from './anchors';\nimport type { SingleColor } from './anchorValues';\n\nexport const ELEVATION_DEPTHS = ['none', 'low', 'medium', 'high'] as const;\nexport type ElevationDepth = (typeof ELEVATION_DEPTHS)[number];\n\nexport const ELEVATION_HARDNESSES = ['soft', 'hard', 'glow'] as const;\nexport type ElevationHardness = (typeof ELEVATION_HARDNESSES)[number];\n\nexport const ELEVATION_COLOR_SOURCE_KEYWORDS = ['shade'] as const;\nexport type ElevationColorSourceKeyword = (typeof ELEVATION_COLOR_SOURCE_KEYWORDS)[number];\n\nexport type ElevationColorSource = ElevationColorSourceKeyword | SingleColorAnchorRef | SingleColor;\n\n/**\n * How a surface lifts against its backgroung to appear 3D, and in what color.\n * Alphas, blur radii and offsets are engine-owned based on the value of `hardness`.\n * When `depth` is `none` no shadow/elevation is rendered.\n */\nexport type Elevation = {\n readonly depth: ElevationDepth;\n readonly hardness: ElevationHardness;\n readonly source: ElevationColorSource;\n};\n","import type { SingleColor } from './anchorValues';\n\nexport const MIN_GRADIENT_STOPS = 2;\nexport const MAX_GRADIENT_STOPS = 6;\n\nexport type GradientStops = readonly SingleColor[];\n\nexport const GRADIENT_SHAPE_OPTIONS = ['glows', 'linear', 'radial', 'beams'] as const;\nexport type GradientShapeOption = (typeof GRADIENT_SHAPE_OPTIONS)[number];\n\nexport const GRADIENT_DIRECTIONS = [\n 'to-top',\n 'to-top-right',\n 'to-right',\n 'to-bottom-right',\n 'to-bottom',\n 'to-bottom-left',\n 'to-left',\n 'to-top-left',\n] as const;\nexport type GradientDirection = (typeof GRADIENT_DIRECTIONS)[number];\n\nexport const GRADIENT_POSITIONS = [\n 'center',\n 'top',\n 'top-right',\n 'right',\n 'bottom-right',\n 'bottom',\n 'bottom-left',\n 'left',\n 'top-left',\n] as const;\nexport type GradientPosition = (typeof GRADIENT_POSITIONS)[number];\n\n/**\n * How far a `radial` gradient's last stop reaches: `near` ends at the furthest edge, so the corners\n * beyond it hold the final color; `far` carries it to the furthest corner.\n */\nexport const GRADIENT_EXTENTS = ['near', 'far'] as const;\nexport type GradientExtent = (typeof GRADIENT_EXTENTS)[number];\n\n/**\n * A gradient shape and whatever supporting info required to draw it.\n * `glows` and `beams` are placed by the engine and take no other args\n * `linear` says which direction it runs\n * `radial` supports where it's centered and how far it reaches.\n * Any shape may carry its own `stops`, in place of `anchors.colors.gradientStops`.\n */\nexport type GradientShape = { readonly stops?: GradientStops } & (\n | { readonly kind: 'beams' }\n | { readonly kind: 'glows' }\n | { readonly direction: GradientDirection; readonly kind: 'linear' }\n | {\n readonly extent: GradientExtent;\n readonly kind: 'radial';\n readonly position: GradientPosition;\n }\n);\n","import type { SingleColorAnchorRef } from './anchors';\nimport type { SingleColor } from './anchorValues';\n\nexport const AMBIENT_MOTIONS = ['none', 'drift', 'pulse'] as const;\nexport type AmbientMotion = (typeof AMBIENT_MOTIONS)[number];\n\n/** Rate of ambient motion. Exact durations are owned by the engine. */\nexport const MOTION_SPEEDS = ['slow', 'medium', 'fast'] as const;\nexport type MotionSpeed = (typeof MOTION_SPEEDS)[number];\n\n/** How a surface moves between states — hover, focus, active. Easings are engine-owned. */\nexport const TRANSITIONS = ['none', 'quick', 'smooth'] as const;\nexport type Transition = (typeof TRANSITIONS)[number];\n\n/** How far a pulse's shadow reaches. Exact blur and spread are owned by the engine. */\nexport const PULSE_SIZES = ['small', 'medium', 'large'] as const;\nexport type PulseSize = (typeof PULSE_SIZES)[number];\n\n/**\n * The color a pulsing surface's border and shadow move towards. Its fill and text never change.\n * `derive` uses the color of the surface's `elevation`, whether or not it casts a shadow at rest.\n */\nexport type PulseColor = 'derive' | SingleColorAnchorRef | SingleColor;\n\n/**\n * Does this surface have any non-interactive animation?\n * `transition` is how it moves when its state changes. A card can transition smoothly on hover while sitting\n * perfectly still otherwise.\n * When `ambient` is `none`, no motion is rendered.\n * If `ambient` is `pulse`, `pulseColor` and `pulseSize` are required. Otherwise they must not be present.\n *\n * Every ambient motion will degrade according to the `prefers-reduced-motion` setting.\n * The engine owns this fallback so style docs do not have to provide this.\n */\nexport type Motion = {\n readonly speed: MotionSpeed;\n readonly transition: Transition;\n} & (\n | { readonly ambient: 'pulse'; readonly pulseColor: PulseColor; readonly pulseSize: PulseSize }\n | {\n readonly ambient: Exclude<AmbientMotion, 'pulse'>;\n readonly pulseColor?: never;\n readonly pulseSize?: never;\n }\n);\n","import type { SingleColor } from './anchorValues';\n\n/**\n * - `grain` — fine, even film noise\n * - `static` — sharp, high-contrast speckles, like screen noise\n * - `halftone` — a regular dot screen, as in print\n */\nexport const TEXTURE_KINDS = ['none', 'grain', 'static', 'halftone'] as const;\nexport type TextureKind = (typeof TEXTURE_KINDS)[number];\n\nexport const TEXTURE_INTENSITIES = ['low', 'medium', 'high'] as const;\nexport type TextureIntensity = (typeof TEXTURE_INTENSITIES)[number];\n\n/**\n * A texture laid over the surface's fill: which one, and how strong it is.\n *\n * It is separate from `treatment` because textures can be stacked on top of treatments:\n * grain on glass, static on a gradient.\n *\n * When `kind` is `none`, no texture is applied.\n *\n * `color` draws the texture in a color of its own. Without one it stays neutral: gray noise, and\n * black or white dots, whichever shows on the fill.\n */\nexport type Texture = {\n readonly color?: SingleColor;\n readonly intensity: TextureIntensity;\n readonly kind: TextureKind;\n};\n","/**\n * What visual treatment is applied to a surface?\n * `gradient` renders `colors.gradientStops` based on the values provided in `gradientShape`\n * `glassy` renders a semi-translucent glass effect, best over a background with visual noise/texture as opposed to a flat color.\n * `flat` renders a flat color\n * `none` renders no background and lets the parent show through\n */\nexport const TREATMENTS = ['none', 'flat', 'glassy', 'gradient'] as const;\nexport type Treatment = (typeof TREATMENTS)[number];\n","/**\n * The shape of a Kaleidoscope Style document.\n *\n * A style document provides a set of instructions on how to render a set of surfaces,\n * based on abstractified representations of CSS rules.\n *\n * The engine takes these instructions and \"inflates\" them into actual CSS that can be applied\n * to embeds and/or hosted pages.\n */\nimport type { Anchors } from './anchors';\nimport type { Surfaces } from './surfaces';\nimport type { Typography } from './typography';\n\n/** The top-level keys in a Style document */\nexport const DOCUMENT_KEYS = [\n 'id',\n 'name',\n 'schemaVersion',\n 'typography',\n 'anchors',\n 'surfaces',\n] as const;\n\nexport type StyleDocument = {\n readonly anchors: Anchors;\n readonly id: string;\n readonly name: string;\n readonly schemaVersion: 1;\n readonly surfaces: Surfaces;\n readonly typography: Typography;\n};\n\nexport * from './anchors';\nexport * from './anchorValues';\nexport * from './backgroundColor';\nexport * from './border';\nexport * from './elevation';\nexport * from './gradientShape';\nexport * from './motion';\n// `radius` declares only types\nexport type * from './radius';\nexport * from './surfaces';\n// `textColor` declares only types\nexport type * from './textColor';\nexport * from './texture';\nexport * from './treatment';\nexport * from './typography';\n"],"mappings":";;;;;;;;;;AAIA,MAAa,gBAAgB;CAAC;CAAc;CAAU;AAAO;;;;;;AAQ7D,MAAa,6BAA6B,CAAC,cAAc;AAGzD,MAAa,qBAAqB;CAAC;CAAkB;CAAW;CAAU;AAAe;;;;;;AAQzF,MAAa,yBAAyB,CAAC,kBAAkB,SAAS;;;;;;AAQlE,MAAa,yBAAyB,CAAC,UAAU,eAAe;;;;AAMhE,MAAa,wBAAwB;CAAC;CAAW;CAAQ;AAAQ;;;;;AAOjE,MAAa,4BAA4B;CAAC;CAAkB;CAAW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gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/kaleidoscope v0.0.
|
|
3
|
+
* @license @wistia/kaleidoscope v0.0.9
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -14,10 +14,15 @@ const BORDER_STYLES = [
|
|
|
14
14
|
"dotted",
|
|
15
15
|
"double",
|
|
16
16
|
"scalloped",
|
|
17
|
+
"zigzag",
|
|
17
18
|
"lace"
|
|
18
19
|
];
|
|
19
20
|
/** The border styles drawn as ornaments outside the edge, rather than as a CSS line. */
|
|
20
|
-
const ORNAMENTAL_BORDER_STYLES = [
|
|
21
|
+
const ORNAMENTAL_BORDER_STYLES = [
|
|
22
|
+
"scalloped",
|
|
23
|
+
"zigzag",
|
|
24
|
+
"lace"
|
|
25
|
+
];
|
|
21
26
|
// src/styleVocabulary/surfaces.ts
|
|
22
27
|
/** Surfaces every Style must define. A Style cannot add or opt out of any. */
|
|
23
28
|
const SURFACE_NAMES = [
|
|
@@ -62,4 +67,4 @@ const TYPE_ROLES = [
|
|
|
62
67
|
];
|
|
63
68
|
export { REQUIRED_SETTING_NAMES as a, BORDER_STYLES as c, OPTIONAL_SETTING_NAMES as i, ORNAMENTAL_BORDER_STYLES as l, TYPE_ROLES as n, STACKABLE_ON as o, ALL_SETTING_NAMES as r, SURFACE_NAMES as s, TYPE_CASES as t };
|
|
64
69
|
|
|
65
|
-
//# sourceMappingURL=typography-
|
|
70
|
+
//# sourceMappingURL=typography-BpeDYjMz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography-BpeDYjMz.js","names":[],"sources":["../src/styleVocabulary/border.ts","../src/styleVocabulary/surfaces.ts","../src/styleVocabulary/typography.ts"],"sourcesContent":["// The `border` setting: the line along a surface's edge, and the ornaments drawn just outside it.\n\nimport type { SingleColorAnchorRef } from './anchors';\nimport type { ColorScaleOffset } from './anchorValues';\n\nexport const BORDER_STYLES = [\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'scalloped',\n 'zigzag',\n 'lace',\n] as const;\nexport type BorderStyle = (typeof BORDER_STYLES)[number];\n\n/** The border styles drawn as ornaments outside the edge, rather than as a CSS line. */\nexport const ORNAMENTAL_BORDER_STYLES = ['scalloped', 'zigzag', 'lace'] as const;\n\nexport type BorderColorSource = SingleColorAnchorRef | 'surface';\n\n/**\n * A surface's border, expressed similarly to how CSS rules work.\n * `width` is provided in pixels, where `0` is effectively no border. Decimal values are acceptable.\n * `colorSource` indicates whether the border color is derived based on the surface background or a separate color value.\n * `colorOffset` is how many steps the border color sits from `colorSource` along its scale.\n * `style` supports all the definitions in the schema\n */\nexport type Border = {\n readonly colorOffset: ColorScaleOffset;\n readonly colorSource: BorderColorSource;\n readonly style: BorderStyle;\n readonly width: number;\n};\n","import type { BackgroundColor } from './backgroundColor';\nimport type { Border } from './border';\nimport type { Elevation } from './elevation';\nimport type { GradientShape } from './gradientShape';\nimport type { Motion } from './motion';\nimport type { Radius } from './radius';\nimport type { TextColor } from './textColor';\nimport type { Texture } from './texture';\nimport type { Treatment } from './treatment';\n\n/** Surfaces every Style must define. A Style cannot add or opt out of any. */\nexport const SURFACE_NAMES = ['page', 'panel', 'card', 'buttonPrimary', 'buttonSecondary'] as const;\nexport type SurfaceName = (typeof SURFACE_NAMES)[number];\n\nexport const STACKABLE_ON: Readonly<Record<SurfaceName, readonly SurfaceName[]>> = {\n page: [],\n panel: ['page'],\n card: ['page'],\n buttonPrimary: ['page', 'panel', 'card'],\n buttonSecondary: ['page', 'panel', 'card'],\n};\n\nexport const REQUIRED_SETTING_NAMES = [\n 'treatment',\n 'backgroundColor',\n 'textColor',\n 'elevation',\n 'motion',\n 'radius',\n 'texture',\n] as const;\nexport type RequiredSettingName = (typeof REQUIRED_SETTING_NAMES)[number];\n\nexport const OPTIONAL_SETTING_NAMES = ['border', 'gradientShape'] as const;\nexport type OptionalSettingName = (typeof OPTIONAL_SETTING_NAMES)[number];\n\nexport const ALL_SETTING_NAMES: readonly (RequiredSettingName | OptionalSettingName)[] = [\n ...REQUIRED_SETTING_NAMES,\n ...OPTIONAL_SETTING_NAMES,\n];\n\nexport type RequiredSettings = {\n readonly backgroundColor: BackgroundColor;\n readonly elevation: Elevation;\n readonly motion: Motion;\n readonly radius: Radius;\n readonly textColor: TextColor;\n readonly texture: Texture;\n};\n\n/**\n * If the treatment is `gradient`, `gradientShape` is required. Otherwise it must not be present.\n */\nexport type GradientAxis =\n | { readonly gradientShape: GradientShape; readonly treatment: 'gradient' }\n | { readonly gradientShape?: never; readonly treatment: Exclude<Treatment, 'gradient'> };\n\n/** A surface that sits on something, and so has an edge of its own to draw along. */\nexport type SurfaceSettings = RequiredSettings & { readonly border: Border } & GradientAxis;\n\n/**\n * The page sits on nothing. It has no edge of its own, so it carries no `border` at all.\n */\nexport type PageSettings = RequiredSettings & { readonly border?: never } & GradientAxis;\n\n/**\n * All possible surfaces and their settings, required to be provided by a Style document.\n */\nexport type Surfaces = Readonly<{ page: PageSettings }> &\n Readonly<Record<Exclude<SurfaceName, 'page'>, SurfaceSettings>>;\n","import type { FontAnchorRef } from './anchors';\n\nexport const TYPE_CASES = ['as-typed', 'upper'] as const;\nexport type TypeCase = (typeof TYPE_CASES)[number];\n\nexport const TYPE_ROLES = ['heading', 'body', 'button'] as const;\nexport type TypeRoleName = (typeof TYPE_ROLES)[number];\n\nexport type TypeRole = {\n readonly case: TypeCase;\n readonly font: FontAnchorRef;\n readonly fontSize: number;\n readonly fontWeight: number;\n};\n\n/**\n * Rules for the type face, weight, case, and size\n *\n * `fontSize` is provided in pixels\n * `fontWeight` is a CSS weight from 1 - 1000\n * `font` references an anchor. We don't support providing a custom font name here because we don't\n * have a mechanism to load that font into the DOM.\n */\nexport type Typography = Readonly<Record<TypeRoleName, TypeRole>>;\n"],"mappings":";;;;;;;;;;AAKA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAIA,MAAa,2BAA2B;CAAC;CAAa;CAAU;AAAM;;;ACNtE,MAAa,gBAAgB;CAAC;CAAQ;CAAS;CAAQ;CAAiB;AAAiB;AAGzF,MAAa,eAAsE;CACjF,MAAM,CAAC;CACP,OAAO,CAAC,MAAM;CACd,MAAM,CAAC,MAAM;CACb,eAAe;EAAC;EAAQ;EAAS;CAAM;CACvC,iBAAiB;EAAC;EAAQ;EAAS;CAAM;AAC3C;AAEA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,MAAa,yBAAyB,CAAC,UAAU,eAAe;AAGhE,MAAa,oBAA4E,CACvF,GAAG,wBACH,GAAG,sBACL;;ACrCA,MAAa,aAAa,CAAC,YAAY,OAAO;AAG9C,MAAa,aAAa;CAAC;CAAW;CAAQ;AAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as StyleDocument } from "./index-
|
|
2
|
+
import { n as StyleDocument } from "./index-L5x6rNF_.js";
|
|
3
3
|
/** One thing wrong with a document, addressed well enough to fix without hunting. */
|
|
4
4
|
type StyleDocumentIssue = {
|
|
5
5
|
readonly message: string;
|
|
@@ -53,4 +53,4 @@ declare const validateStyleDocument: (input: unknown) => readonly StyleDocumentI
|
|
|
53
53
|
/** Whether a value is a valid Style document. */
|
|
54
54
|
declare const isStyleDocument: (input: unknown) => input is StyleDocument;
|
|
55
55
|
export { StyleDocumentReport as a, StyleDocumentIssue as i, isStyleDocument as n, validateStyleDocument as r, checkStyleDocument as t };
|
|
56
|
-
//# sourceMappingURL=validate-
|
|
56
|
+
//# sourceMappingURL=validate-BzIATwDA.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-BzIATwDA.d.ts","names":[],"sources":["../src/validateStyleDocument/issues.ts","../src/validateStyleDocument/validateStyleDocument.ts"],"mappings":";;;KAGY;WACD;WACA;;;;;;;;KASC;WACD,iBAAiB;WACjB,mBAAmB;;;;;;;;;;;;;;;;;;;;cCYjB,qBAAsB,mBAAiB;;;;;;;;;;;;;;;;cAkDvC,wBAAyB,4BAA0B;;cAInD,kBAAmB,mBAAiB,SAAS"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/kaleidoscope v0.0.
|
|
3
|
+
* @license @wistia/kaleidoscope v0.0.9
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is unlicensed, all rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { A as REQUIRED_DIMENSION_ANCHORS, D as COLOR_ANCHOR_NAMES, E as ANCHOR_REF_PREFIX, M as SINGLE_COLOR_ANCHOR_NAMES, O as OPTIONAL_COLOR_ANCHORS, S as GENERIC_FONT_FAMILIES, T as ANCHOR_GROUPS, _ as ELEVATION_HARDNESSES, a as AMBIENT_MOTIONS, b as COLOR_RELATIONSHIPS, c as TRANSITIONS, d as GRADIENT_POSITIONS, f as GRADIENT_SHAPE_OPTIONS, g as ELEVATION_DEPTHS, h as ELEVATION_COLOR_SOURCE_KEYWORDS, i as TEXTURE_KINDS, j as REQUIRED_FONT_ANCHORS, k as REQUIRED_COLOR_ANCHORS, l as GRADIENT_DIRECTIONS, n as TREATMENTS, o as MOTION_SPEEDS, r as TEXTURE_INTENSITIES, s as PULSE_SIZES, t as DOCUMENT_KEYS, u as GRADIENT_EXTENTS, v as INVERT_RULES, w as ANCHORS_REQUIRED_BY_TREATMENT, x as COLOR_TONES, y as OFFSET_ORIGINS } from "./styleVocabulary-
|
|
11
|
-
import { c as BORDER_STYLES, n as TYPE_ROLES, o as STACKABLE_ON, r as ALL_SETTING_NAMES, s as SURFACE_NAMES, t as TYPE_CASES } from "./typography-
|
|
12
|
-
import { i as isString, n as isOneOf, r as isRecord, t as at } from "./guards-
|
|
10
|
+
import { A as REQUIRED_DIMENSION_ANCHORS, D as COLOR_ANCHOR_NAMES, E as ANCHOR_REF_PREFIX, M as SINGLE_COLOR_ANCHOR_NAMES, O as OPTIONAL_COLOR_ANCHORS, S as GENERIC_FONT_FAMILIES, T as ANCHOR_GROUPS, _ as ELEVATION_HARDNESSES, a as AMBIENT_MOTIONS, b as COLOR_RELATIONSHIPS, c as TRANSITIONS, d as GRADIENT_POSITIONS, f as GRADIENT_SHAPE_OPTIONS, g as ELEVATION_DEPTHS, h as ELEVATION_COLOR_SOURCE_KEYWORDS, i as TEXTURE_KINDS, j as REQUIRED_FONT_ANCHORS, k as REQUIRED_COLOR_ANCHORS, l as GRADIENT_DIRECTIONS, n as TREATMENTS, o as MOTION_SPEEDS, r as TEXTURE_INTENSITIES, s as PULSE_SIZES, t as DOCUMENT_KEYS, u as GRADIENT_EXTENTS, v as INVERT_RULES, w as ANCHORS_REQUIRED_BY_TREATMENT, x as COLOR_TONES, y as OFFSET_ORIGINS } from "./styleVocabulary-BJuyoSBc.js";
|
|
11
|
+
import { c as BORDER_STYLES, n as TYPE_ROLES, o as STACKABLE_ON, r as ALL_SETTING_NAMES, s as SURFACE_NAMES, t as TYPE_CASES } from "./typography-BpeDYjMz.js";
|
|
12
|
+
import { i as isString, n as isOneOf, r as isRecord, t as at } from "./guards-Cyl-NUQX.js";
|
|
13
13
|
// src/private/styleDocumentPatterns.ts
|
|
14
14
|
const ID_PATTERN = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
15
15
|
/** No dots: brand tokens are not namespaced. */
|
|
@@ -267,6 +267,10 @@ const checkBackgroundColor = (value, path, surface, treatment, collected) => {
|
|
|
267
267
|
message: `"parent" needs a surface to count from, and ${surface} sits on nothing — use "source"`,
|
|
268
268
|
path: `${path}.from`
|
|
269
269
|
});
|
|
270
|
+
else if (from === "parent" && treatment === "glassy") issues.push({
|
|
271
|
+
message: "glass has a fixed ground that its parent shows through, so it can't count from it — use \"source\"",
|
|
272
|
+
path: `${path}.from`
|
|
273
|
+
});
|
|
270
274
|
const invert = at(value, "invert");
|
|
271
275
|
if (!isOneOf(INVERT_RULES, invert)) issues.push({
|
|
272
276
|
message: `invert must be one of: ${list(INVERT_RULES)}`,
|
|
@@ -307,7 +311,7 @@ const checkBackgroundColor = (value, path, surface, treatment, collected) => {
|
|
|
307
311
|
return issues;
|
|
308
312
|
};
|
|
309
313
|
// src/validateStyleDocument/border.ts
|
|
310
|
-
const checkBorder = (value, surfacePath, surface,
|
|
314
|
+
const checkBorder = (value, surfacePath, surface, collected) => {
|
|
311
315
|
const path = `${surfacePath}.border`;
|
|
312
316
|
const declared = Object.hasOwn(value, "border");
|
|
313
317
|
if (STACKABLE_ON[surface].length === 0) return declared ? [{
|
|
@@ -325,8 +329,8 @@ const checkBorder = (value, surfacePath, surface, treatment, collected) => {
|
|
|
325
329
|
}];
|
|
326
330
|
const issues = [...checkNoUnknownKeys(border, [
|
|
327
331
|
"width",
|
|
328
|
-
"
|
|
329
|
-
"
|
|
332
|
+
"colorSource",
|
|
333
|
+
"colorOffset",
|
|
330
334
|
"style"
|
|
331
335
|
], path, "border key")];
|
|
332
336
|
const style = at(border, "style");
|
|
@@ -334,30 +338,26 @@ const checkBorder = (value, surfacePath, surface, treatment, collected) => {
|
|
|
334
338
|
message: `style must be one of: ${list(BORDER_STYLES)}`,
|
|
335
339
|
path: `${path}.style`
|
|
336
340
|
});
|
|
337
|
-
else if (style === "scalloped" && treatment === "none") issues.push({
|
|
338
|
-
message: "scallops are drawn in the surface's own fill, and treatment \"none\" paints none — give the surface a fill, or use \"lace\"",
|
|
339
|
-
path: `${path}.style`
|
|
340
|
-
});
|
|
341
341
|
const width = at(border, "width");
|
|
342
342
|
if (typeof width !== "number" || !Number.isFinite(width) || width < 0) issues.push({
|
|
343
343
|
message: "width must be a non-negative number of pixels, e.g. 1 or 0.5 (0 for none)",
|
|
344
344
|
path: `${path}.width`
|
|
345
345
|
});
|
|
346
|
-
const
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
else if (
|
|
350
|
-
message: `
|
|
351
|
-
path: `${path}.
|
|
346
|
+
const colorSource = at(border, "colorSource");
|
|
347
|
+
const colorAnchor = singleColorAnchorFromRef(colorSource);
|
|
348
|
+
if (colorAnchor !== void 0) collected.referenced.add(colorAnchor);
|
|
349
|
+
else if (colorSource !== "surface") issues.push({
|
|
350
|
+
message: `colorSource must be "surface" or one of: ${singleColorRefList()}`,
|
|
351
|
+
path: `${path}.colorSource`
|
|
352
352
|
});
|
|
353
|
-
if (!isScaleOffset(at(border, "
|
|
354
|
-
message: `
|
|
355
|
-
path: `${path}.
|
|
353
|
+
if (!isScaleOffset(at(border, "colorOffset"))) issues.push({
|
|
354
|
+
message: `colorOffset must be an integer 0-11`,
|
|
355
|
+
path: `${path}.colorOffset`
|
|
356
356
|
});
|
|
357
357
|
return issues;
|
|
358
358
|
};
|
|
359
359
|
// src/validateStyleDocument/elevation.ts
|
|
360
|
-
const checkElevation = (value, path, collected) => {
|
|
360
|
+
const checkElevation = (value, path, surface, collected) => {
|
|
361
361
|
if (!isRecord(value)) return [{
|
|
362
362
|
message: "must be an object",
|
|
363
363
|
path
|
|
@@ -367,10 +367,15 @@ const checkElevation = (value, path, collected) => {
|
|
|
367
367
|
"hardness",
|
|
368
368
|
"source"
|
|
369
369
|
], path, "elevation key")];
|
|
370
|
-
|
|
370
|
+
const depth = at(value, "depth");
|
|
371
|
+
if (!isOneOf(ELEVATION_DEPTHS, depth)) issues.push({
|
|
371
372
|
message: `depth must be one of: ${list(ELEVATION_DEPTHS)}`,
|
|
372
373
|
path: `${path}.depth`
|
|
373
374
|
});
|
|
375
|
+
else if (STACKABLE_ON[surface].length === 0 && depth !== "none") issues.push({
|
|
376
|
+
message: `${surface} sits on nothing, so it has nothing to cast a shadow on — use depth "none"`,
|
|
377
|
+
path: `${path}.depth`
|
|
378
|
+
});
|
|
374
379
|
if (!isOneOf(ELEVATION_HARDNESSES, at(value, "hardness"))) issues.push({
|
|
375
380
|
message: `hardness must be one of: ${list(ELEVATION_HARDNESSES)}`,
|
|
376
381
|
path: `${path}.hardness`
|
|
@@ -504,7 +509,7 @@ const checkPulseSize = (value, path) => {
|
|
|
504
509
|
path: pulseSizePath
|
|
505
510
|
}];
|
|
506
511
|
};
|
|
507
|
-
const checkMotion = (value, path, collected) => {
|
|
512
|
+
const checkMotion = (value, path, surface, collected) => {
|
|
508
513
|
if (!isRecord(value)) return [{
|
|
509
514
|
message: "must be an object",
|
|
510
515
|
path
|
|
@@ -520,10 +525,20 @@ const checkMotion = (value, path, collected) => {
|
|
|
520
525
|
...checkPulseColor(value, path, collected),
|
|
521
526
|
...checkPulseSize(value, path)
|
|
522
527
|
];
|
|
523
|
-
|
|
528
|
+
const ambient = at(value, "ambient");
|
|
529
|
+
const sitsOnNothing = STACKABLE_ON[surface].length === 0;
|
|
530
|
+
if (!isOneOf(AMBIENT_MOTIONS, ambient)) issues.push({
|
|
524
531
|
message: `ambient must be one of: ${list(AMBIENT_MOTIONS)}`,
|
|
525
532
|
path: `${path}.ambient`
|
|
526
533
|
});
|
|
534
|
+
else if (ambient === "drift" && !sitsOnNothing) issues.push({
|
|
535
|
+
message: `only the page drifts, and ${surface} sits on another surface — use "none" or "pulse"`,
|
|
536
|
+
path: `${path}.ambient`
|
|
537
|
+
});
|
|
538
|
+
else if (ambient === "pulse" && sitsOnNothing) issues.push({
|
|
539
|
+
message: `a pulse moves a surface's edge, and ${surface} sits on nothing so it has none — use "none" or "drift"`,
|
|
540
|
+
path: `${path}.ambient`
|
|
541
|
+
});
|
|
527
542
|
if (!isOneOf(MOTION_SPEEDS, at(value, "speed"))) issues.push({
|
|
528
543
|
message: `speed must be one of: ${list(MOTION_SPEEDS)}`,
|
|
529
544
|
path: `${path}.speed`
|
|
@@ -577,15 +592,20 @@ const checkTextColor = (value, path, collected) => {
|
|
|
577
592
|
};
|
|
578
593
|
// src/validateStyleDocument/texture.ts
|
|
579
594
|
/**
|
|
580
|
-
* A named texture at a named intensity. A surface that paints nothing has no
|
|
581
|
-
* texture over, so `treatment: "none"` requires `kind: "none"
|
|
595
|
+
* A named texture at a named intensity, in an optional color. A surface that paints nothing has no
|
|
596
|
+
* fill to lay a texture over, so `treatment: "none"` requires `kind: "none"`, and a texture of kind
|
|
597
|
+
* `none` takes no color.
|
|
582
598
|
*/
|
|
583
599
|
const checkTexture = (value, path, treatment) => {
|
|
584
600
|
if (!isRecord(value)) return [{
|
|
585
601
|
message: "must be an object",
|
|
586
602
|
path
|
|
587
603
|
}];
|
|
588
|
-
const issues = [...checkNoUnknownKeys(value, [
|
|
604
|
+
const issues = [...checkNoUnknownKeys(value, [
|
|
605
|
+
"kind",
|
|
606
|
+
"intensity",
|
|
607
|
+
"color"
|
|
608
|
+
], path, "texture key")];
|
|
589
609
|
const kind = at(value, "kind");
|
|
590
610
|
if (!isOneOf(TEXTURE_KINDS, kind)) issues.push({
|
|
591
611
|
message: `kind must be one of: ${list(TEXTURE_KINDS)}`,
|
|
@@ -595,6 +615,17 @@ const checkTexture = (value, path, treatment) => {
|
|
|
595
615
|
message: "a surface with treatment \"none\" paints no fill to texture — use kind \"none\", or give the surface a fill",
|
|
596
616
|
path: `${path}.kind`
|
|
597
617
|
});
|
|
618
|
+
const color = at(value, "color");
|
|
619
|
+
if (color !== void 0) {
|
|
620
|
+
if (kind === "none") issues.push({
|
|
621
|
+
message: "a texture of kind \"none\" draws nothing to color",
|
|
622
|
+
path: `${path}.color`
|
|
623
|
+
});
|
|
624
|
+
else if (!isColorForm(color)) issues.push({
|
|
625
|
+
message: COLOR_FORM_MESSAGE,
|
|
626
|
+
path: `${path}.color`
|
|
627
|
+
});
|
|
628
|
+
}
|
|
598
629
|
if (!isOneOf(TEXTURE_INTENSITIES, at(value, "intensity"))) issues.push({
|
|
599
630
|
message: `intensity must be one of: ${list(TEXTURE_INTENSITIES)}`,
|
|
600
631
|
path: `${path}.intensity`
|
|
@@ -602,6 +633,17 @@ const checkTexture = (value, path, treatment) => {
|
|
|
602
633
|
return issues;
|
|
603
634
|
};
|
|
604
635
|
// src/validateStyleDocument/surfaces.ts
|
|
636
|
+
/** Glass shows what sits behind it, and a surface that sits on nothing has nothing behind it. */
|
|
637
|
+
const checkTreatment = (treatment, path, name) => {
|
|
638
|
+
if (!isOneOf(TREATMENTS, treatment)) return [{
|
|
639
|
+
message: `treatment must be one of: ${list(TREATMENTS)}`,
|
|
640
|
+
path: `${path}.treatment`
|
|
641
|
+
}];
|
|
642
|
+
return treatment === "glassy" && STACKABLE_ON[name].length === 0 ? [{
|
|
643
|
+
message: `${name} sits on nothing, so glass would have nothing to show through it — use another treatment`,
|
|
644
|
+
path: `${path}.treatment`
|
|
645
|
+
}] : [];
|
|
646
|
+
};
|
|
605
647
|
const checkSurface = (value, name, collected) => {
|
|
606
648
|
const path = `surfaces.${name}`;
|
|
607
649
|
if (!isRecord(value)) return [{
|
|
@@ -609,22 +651,18 @@ const checkSurface = (value, name, collected) => {
|
|
|
609
651
|
path
|
|
610
652
|
}];
|
|
611
653
|
const treatment = at(value, "treatment");
|
|
612
|
-
|
|
613
|
-
if (namedTreatment && !(treatment === "gradient" && hasOwnGradientStops(value))) collected.treatments.add(treatment);
|
|
654
|
+
if (isOneOf(TREATMENTS, treatment) && !(treatment === "gradient" && hasOwnGradientStops(value))) collected.treatments.add(treatment);
|
|
614
655
|
return [
|
|
615
656
|
...checkNoUnknownKeys(value, ALL_SETTING_NAMES, path, "setting"),
|
|
616
|
-
...
|
|
617
|
-
message: `treatment must be one of: ${list(TREATMENTS)}`,
|
|
618
|
-
path: `${path}.treatment`
|
|
619
|
-
}],
|
|
657
|
+
...checkTreatment(treatment, path, name),
|
|
620
658
|
...checkGradientShape(value, path, treatment),
|
|
621
659
|
...checkBackgroundColor(at(value, "backgroundColor"), `${path}.backgroundColor`, name, treatment, collected),
|
|
622
660
|
...checkTextColor(at(value, "textColor"), `${path}.textColor`, collected),
|
|
623
|
-
...checkBorder(value, path, name,
|
|
624
|
-
...checkElevation(at(value, "elevation"), `${path}.elevation`, collected),
|
|
661
|
+
...checkBorder(value, path, name, collected),
|
|
662
|
+
...checkElevation(at(value, "elevation"), `${path}.elevation`, name, collected),
|
|
625
663
|
...checkRadius(at(value, "radius"), `${path}.radius`),
|
|
626
664
|
...checkTexture(at(value, "texture"), `${path}.texture`, treatment),
|
|
627
|
-
...checkMotion(at(value, "motion"), `${path}.motion`, collected)
|
|
665
|
+
...checkMotion(at(value, "motion"), `${path}.motion`, name, collected)
|
|
628
666
|
];
|
|
629
667
|
};
|
|
630
668
|
const checkSurfaces = (value, collected) => {
|
|
@@ -759,4 +797,4 @@ const validateStyleDocument = (input) => checkStyleDocument(input).errors;
|
|
|
759
797
|
const isStyleDocument = (input) => validateStyleDocument(input).length === 0;
|
|
760
798
|
export { isStyleDocument as n, validateStyleDocument as r, checkStyleDocument as t };
|
|
761
799
|
|
|
762
|
-
//# sourceMappingURL=validate-
|
|
800
|
+
//# sourceMappingURL=validate-DcGjEAHf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-DcGjEAHf.js","names":[],"sources":["../src/private/styleDocumentPatterns.ts","../src/validateStyleDocument/issues.ts","../src/validateStyleDocument/anchorValues.ts","../src/validateStyleDocument/anchors.ts","../src/validateStyleDocument/backgroundColor.ts","../src/validateStyleDocument/border.ts","../src/validateStyleDocument/elevation.ts","../src/validateStyleDocument/gradientShape.ts","../src/validateStyleDocument/motion.ts","../src/validateStyleDocument/radius.ts","../src/validateStyleDocument/textColor.ts","../src/validateStyleDocument/texture.ts","../src/validateStyleDocument/surfaces.ts","../src/validateStyleDocument/typography.ts","../src/validateStyleDocument/validateStyleDocument.ts"],"sourcesContent":["// oxlint-disable typescript/no-inferrable-types -- `isolatedDeclarations` (tsconfig.build.json)\n// requires an explicit annotation on every exported const, including ones oxlint considers\n// trivially inferable.\n\nimport { GENERIC_FONT_FAMILIES } from '../styleVocabulary';\n\nexport const ID_PATTERN: RegExp = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\n/** No dots: brand tokens are not namespaced. */\nexport const TOKEN_PATTERN: RegExp = /^\\$[A-Za-z][A-Za-z0-9]*$/;\n\nconst HEX_COLOR = String.raw`#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})`;\n\n/** One channel or alpha inside an `rgb()`: a number, or a percentage of the channel's range. */\nconst RGB_VALUE = String.raw`[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?`;\n\n/**\n * Legacy `rgb(41, 73, 229)` and modern `rgb(41 73 229 / 50%)`, each with an optional alpha.\n *\n * Kept in step with `parseColor`, which reads a document's literals at render time: a literal this\n * accepts must be one the parser can read, or validation approves a color that silently falls back.\n * The parser is the more forgiving of the two — it also takes a hex without its `#`, `RGB()` in any\n * case, and separators mixed within one function — so only that direction is guaranteed.\n */\nconst RGB_COLOR = String.raw`rgba?\\(\\s*(?:${RGB_VALUE}\\s*,\\s*${RGB_VALUE}\\s*,\\s*${RGB_VALUE}(?:\\s*,\\s*${RGB_VALUE})?|${RGB_VALUE}\\s+${RGB_VALUE}\\s+${RGB_VALUE}(?:\\s*/\\s*${RGB_VALUE})?)\\s*\\)`;\n\nexport const LITERAL_COLOR_PATTERN: RegExp = new RegExp(\n String.raw`^(?:${HEX_COLOR}|${RGB_COLOR})$`,\n);\n\nconst OPAQUE_HEX_COLOR = String.raw`#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})`;\n\nconst OPAQUE_RGB_COLOR = String.raw`rgba?\\(\\s*(?:${RGB_VALUE}\\s*,\\s*${RGB_VALUE}\\s*,\\s*${RGB_VALUE}|${RGB_VALUE}\\s+${RGB_VALUE}\\s+${RGB_VALUE})\\s*\\)`;\n\n/**\n * A literal with no alpha. A gradient's stops must be opaque: text is checked against them as\n * painted, and a see-through stop would show whatever is behind it instead.\n */\nexport const OPAQUE_LITERAL_COLOR_PATTERN: RegExp = new RegExp(\n String.raw`^(?:${OPAQUE_HEX_COLOR}|${OPAQUE_RGB_COLOR})$`,\n);\n\nconst NOT_IN_QUOTED_FAMILY = String.raw`$;{}()<>\\\\`;\n\n/** A comma delineates font families, but inside quotes it should be considered part of the name. */\nconst NOT_IN_FAMILY = `,${NOT_IN_QUOTED_FAMILY}`;\n\n/**\n * One family in a list, where each item is delineated by a comma.\n * No `$`, parentheses, braces, angle brackets, backslashes or semicolons allowed in the family\n * names. Any quotes must have a matching end quote.\n */\nconst FONT_FAMILY = [\n String.raw`\"[^\"${NOT_IN_QUOTED_FAMILY}]+\"`, // \"Segoe UI\", and may hold the other quote: \"Foo's Text\"\n String.raw`'[^'${NOT_IN_QUOTED_FAMILY}]+'`, // 'Fraunces', or with a comma: 'ACME, Inc'\n // Ends on a non-space so trailing spaces only match the separator\n String.raw`[^\\s\"'${NOT_IN_FAMILY}](?:[^\"'${NOT_IN_FAMILY}]*[^\\s\"'${NOT_IN_FAMILY}])?`, // Georgia, -apple-system, メイリオ\n].join('|');\n\n/**\n * A CSS font-family list that ends in a generic family, so a face that fails to load falls back\n * to something of the right kind rather than the browser default.\n *\n * Every family is matched in turn rather than the list being taken as one run of allowed\n * characters: a browser drops a whole `font-family` declaration over one empty family, so\n * `Georgia,, serif` renders nothing the document asked for and must not validate.\n */\nexport const FONT_STACK_PATTERN: RegExp = new RegExp(\n String.raw`^(?:(?:${FONT_FAMILY})\\s*,\\s*)*(?:${GENERIC_FONT_FAMILIES.join('|')})\\s*$`,\n);\n","import type { ColorAnchorName, Treatment } from '../styleVocabulary';\n\n/** One thing wrong with a document, addressed well enough to fix without hunting. */\nexport type StyleDocumentIssue = {\n readonly message: string;\n readonly path: string;\n};\n\n/**\n * Everything a check found, split by what it costs.\n *\n * An **error** is blocking and fails style validation\n * A **warning** is not blocking and only produces a warning message\n */\nexport type StyleDocumentReport = {\n readonly errors: readonly StyleDocumentIssue[];\n readonly warnings: readonly StyleDocumentIssue[];\n};\n\n/**\n * What a walk over the surfaces gathers for the checks that span subtrees: which color anchors a\n * surface named, and which treatments the document uses. Written here, read once anchor\n * completeness arrives.\n */\nexport type Collected = {\n readonly referenced: Set<ColorAnchorName>;\n readonly treatments: Set<Treatment>;\n};\n\nexport const list = (values: readonly string[]): string => values.join(', ');\n\nexport const checkNoUnknownKeys = (\n value: Readonly<Record<string, unknown>>,\n known: readonly string[],\n path: string,\n label: string,\n): readonly StyleDocumentIssue[] =>\n Object.keys(value)\n .filter((key) => !known.includes(key))\n .map((key) => ({\n message: `unknown ${label} — the set is fixed: ${list(known)}`,\n path: path === '' ? key : `${path}.${key}`,\n }));\n","import type { SingleColorAnchorName } from '../styleVocabulary';\nimport { at, isOneOf, isRecord, isString } from '../private/guards';\nimport {\n LITERAL_COLOR_PATTERN,\n OPAQUE_LITERAL_COLOR_PATTERN,\n TOKEN_PATTERN,\n} from '../private/styleDocumentPatterns';\nimport {\n ANCHOR_REF_PREFIX,\n COLOR_RELATIONSHIPS,\n COLOR_TONES,\n MAX_COLOR_SCALE_OFFSET,\n SINGLE_COLOR_ANCHOR_NAMES,\n} from '../styleVocabulary';\nimport { list } from './issues';\n\nexport const COLOR_FORM_MESSAGE =\n 'must be a hex or rgb() literal, a token reference like \"$primaryColor\", or { from, relation, tone }';\n\nexport const GRADIENT_STOP_MESSAGE =\n 'must be an opaque hex or rgb() literal, with no alpha, a token reference like \"$primaryColor\", or { from, relation, tone }';\n\nexport const isTokenRef = (value: unknown): boolean => isString(value) && TOKEN_PATTERN.test(value);\n\nconst RELATED_COLOR_KEYS: ReadonlySet<string> = new Set(['from', 'relation', 'tone']);\n\n/**\n * A `{ from, relation, tone }` color. `relation` and `tone` are optional, but an unknown one is rejected.\n */\nconst isRelatedColor = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n const relation = at(value, 'relation');\n const tone = at(value, 'tone');\n const unknownKeys = Object.keys(value).filter((key) => !RELATED_COLOR_KEYS.has(key));\n\n return (\n unknownKeys.length === 0 &&\n isTokenRef(at(value, 'from')) &&\n (relation === undefined || isOneOf(COLOR_RELATIONSHIPS, relation)) &&\n (tone === undefined || isOneOf(COLOR_TONES, tone))\n );\n};\n\n/** One color, in any of the three forms a document may write. */\nexport const isColorForm = (value: unknown): boolean =>\n (isString(value) && LITERAL_COLOR_PATTERN.test(value)) ||\n isTokenRef(value) ||\n isRelatedColor(value);\n\n/** One gradient stop: a color form whose literal, if it is one, has no alpha. */\nexport const isGradientStopForm = (value: unknown): boolean =>\n (isString(value) && OPAQUE_LITERAL_COLOR_PATTERN.test(value)) ||\n isTokenRef(value) ||\n isRelatedColor(value);\n\nconst COLOR_REF_PREFIX = `${ANCHOR_REF_PREFIX}colors.`;\n\n/**\n * The color anchor a reference names, when that anchor holds a single color.\n *\n * `anchors.colors.gradientStops` is a reference to a real anchor but resolves to a list, so it\n * cannot be used anywhere that a single color is expected.\n */\nexport const singleColorAnchorFromRef = (value: unknown): SingleColorAnchorName | undefined => {\n if (!isString(value) || !value.startsWith(COLOR_REF_PREFIX)) {\n return undefined;\n }\n const name = value.slice(COLOR_REF_PREFIX.length);\n return isOneOf(SINGLE_COLOR_ANCHOR_NAMES, name) ? name : undefined;\n};\n\nexport const singleColorRefList = (): string =>\n list(SINGLE_COLOR_ANCHOR_NAMES.map((name) => `${COLOR_REF_PREFIX}${name}`));\n\nexport const isScaleOffset = (value: unknown): boolean =>\n typeof value === 'number' &&\n Number.isInteger(value) &&\n value >= 0 &&\n value <= MAX_COLOR_SCALE_OFFSET;\n\n/** A non-negative number of CSS pixels — the same convention as `border.width`. */\nconst isPixelValue = (value: unknown): boolean =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0;\n\n/** A length: a brand token or a number of CSS pixels. */\nexport const isDimension = (value: unknown): boolean => isPixelValue(value) || isTokenRef(value);\n","import type { AnchorGroup } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue, StyleDocumentReport } from './issues';\nimport { at, isOneOf, isRecord, isString } from '../private/guards';\nimport { FONT_STACK_PATTERN } from '../private/styleDocumentPatterns';\nimport {\n ANCHOR_GROUPS,\n ANCHORS_REQUIRED_BY_TREATMENT,\n COLOR_ANCHOR_NAMES,\n MAX_GRADIENT_STOPS,\n MIN_GRADIENT_STOPS,\n OPTIONAL_COLOR_ANCHORS,\n REQUIRED_COLOR_ANCHORS,\n REQUIRED_DIMENSION_ANCHORS,\n REQUIRED_FONT_ANCHORS,\n} from '../styleVocabulary';\nimport {\n COLOR_FORM_MESSAGE,\n GRADIENT_STOP_MESSAGE,\n isColorForm,\n isDimension,\n isGradientStopForm,\n isTokenRef,\n} from './anchorValues';\nimport { checkNoUnknownKeys } from './issues';\n\nconst isFontStack = (value: unknown): boolean => isString(value) && FONT_STACK_PATTERN.test(value);\n\n/** A gradient interpolates between opaque colors, so its stops are always a list of them. */\nexport const checkGradientStops = (value: unknown, path: string): readonly StyleDocumentIssue[] => {\n if (!Array.isArray(value)) {\n return [\n { message: `must be a list of ${MIN_GRADIENT_STOPS}-${MAX_GRADIENT_STOPS} colors`, path },\n ];\n }\n\n const countMessage = `a gradient needs ${MIN_GRADIENT_STOPS}-${MAX_GRADIENT_STOPS} stops, not ${value.length}`;\n\n // A list over the limit has to be rewritten anyway, and its length may be far beyond its contents.\n if (value.length > MAX_GRADIENT_STOPS) {\n return [{ message: countMessage, path }];\n }\n\n const countIssues: readonly StyleDocumentIssue[] =\n value.length < MIN_GRADIENT_STOPS ? [{ message: countMessage, path }] : [];\n\n return [\n ...countIssues,\n ...Array.from(value, (stop: unknown, index: number): readonly StyleDocumentIssue[] =>\n isGradientStopForm(stop)\n ? []\n : [{ message: GRADIENT_STOP_MESSAGE, path: `${path}.${index}` }],\n ).flat(),\n ];\n};\n\n/**\n * `gradientStops` is always a list because a gradient interpolates between colors.\n * The other color anchors are always a single color.\n */\nconst checkColorAnchor = (\n value: unknown,\n path: string,\n { asStops = false }: { readonly asStops?: boolean } = {},\n): readonly StyleDocumentIssue[] => {\n if (asStops) {\n return checkGradientStops(value, path);\n }\n\n return isColorForm(value) ? [] : [{ message: COLOR_FORM_MESSAGE, path }];\n};\n\nconst ALWAYS_DECLARED_MESSAGE =\n 'mirrors a Brand Kit input, so every Style declares it, whether or not it is used';\n\nconst UNUSED_ANCHOR_MESSAGE =\n 'nothing references it and no treatment needs it, so the engine ignores it';\n\n/** A group's members once it is known to be present and shaped right, alongside what was wrong. */\ntype AnchorGroupResult = {\n readonly members: Readonly<Record<string, unknown>> | undefined;\n readonly issues: readonly StyleDocumentIssue[];\n};\n\nconst checkAnchorGroup = (\n anchors: Readonly<Record<string, unknown>>,\n group: AnchorGroup,\n members: readonly string[],\n label: string,\n): AnchorGroupResult => {\n const path = `anchors.${group}`;\n const value = at(anchors, group);\n\n if (value === undefined) {\n return {\n members: undefined,\n issues: [{ message: 'every Style declares every anchor group', path }],\n };\n }\n if (!isRecord(value)) {\n return { members: undefined, issues: [{ message: 'must be an object', path }] };\n }\n\n return { members: value, issues: checkNoUnknownKeys(value, members, path, label) };\n};\n\nconst checkDimensionAnchors = (\n dimensions: Readonly<Record<string, unknown>>,\n): readonly StyleDocumentIssue[] =>\n REQUIRED_DIMENSION_ANCHORS.flatMap((name): readonly StyleDocumentIssue[] => {\n const path = `anchors.dimensions.${name}`;\n const declared = at(dimensions, name);\n\n if (declared === undefined) {\n return [{ message: ALWAYS_DECLARED_MESSAGE, path }];\n }\n if (!isDimension(declared)) {\n return [\n { message: `${name} must be a token reference or a number of pixels, e.g. 20`, path },\n ];\n }\n\n return [];\n });\n\nconst checkFontAnchors = (\n fonts: Readonly<Record<string, unknown>>,\n): readonly StyleDocumentIssue[] =>\n REQUIRED_FONT_ANCHORS.flatMap((name): readonly StyleDocumentIssue[] => {\n const path = `anchors.fonts.${name}`;\n const declared = at(fonts, name);\n\n if (declared === undefined) {\n return [{ message: ALWAYS_DECLARED_MESSAGE, path }];\n }\n if (!isTokenRef(declared) && !isFontStack(declared)) {\n return [\n {\n message: `${name} must be a token reference, e.g. \"$${name}FontFamily\", or a font stack ending in a generic family, e.g. \"'Fraunces', Georgia, serif\"`,\n path,\n },\n ];\n }\n\n return [];\n });\n\nconst checkColorAnchors = (\n colors: Readonly<Record<string, unknown>>,\n collected: Collected,\n): StyleDocumentReport => {\n const declaredIssues = COLOR_ANCHOR_NAMES.flatMap((name): readonly StyleDocumentIssue[] => {\n const declared = at(colors, name);\n\n return declared === undefined\n ? []\n : checkColorAnchor(declared, `anchors.colors.${name}`, {\n asStops: name === 'gradientStops',\n });\n });\n\n // The brand's own colors are always declared, referenced or not.\n const missingRequired = REQUIRED_COLOR_ANCHORS.filter(\n (name) => at(colors, name) === undefined,\n ).map((name) => ({ message: ALWAYS_DECLARED_MESSAGE, path: `anchors.colors.${name}` }));\n\n // Treatment colors are declared only where they are needed — and must be, when they are.\n const needed = new Set(collected.referenced);\n for (const treatment of collected.treatments) {\n for (const anchor of ANCHORS_REQUIRED_BY_TREATMENT[treatment]) {\n needed.add(anchor);\n }\n }\n\n const missingNeeded = [...needed]\n .filter(\n (anchor) => !isOneOf(REQUIRED_COLOR_ANCHORS, anchor) && at(colors, anchor) === undefined,\n )\n .map((anchor) => ({\n message: 'referenced by a surface or required by a treatment, but not declared',\n path: `anchors.colors.${anchor}`,\n }));\n\n // And nowhere else: an unreachable treatment color is dead weight, usually a copied document.\n // It changes nothing about how the document renders, so it is a warning rather than an error.\n const warnings = OPTIONAL_COLOR_ANCHORS.filter(\n (anchor) => at(colors, anchor) !== undefined && !needed.has(anchor),\n ).map((anchor) => ({ message: UNUSED_ANCHOR_MESSAGE, path: `anchors.colors.${anchor}` }));\n\n return { errors: [...declaredIssues, ...missingRequired, ...missingNeeded], warnings };\n};\n\nexport const checkAnchors = (value: unknown, collected: Collected): StyleDocumentReport => {\n if (!isRecord(value)) {\n return { errors: [{ message: 'must be an object', path: 'anchors' }], warnings: [] };\n }\n\n const dimensions = checkAnchorGroup(\n value,\n 'dimensions',\n REQUIRED_DIMENSION_ANCHORS,\n 'dimension anchor',\n );\n const colors = checkAnchorGroup(value, 'colors', COLOR_ANCHOR_NAMES, 'color anchor');\n const fonts = checkAnchorGroup(value, 'fonts', REQUIRED_FONT_ANCHORS, 'font anchor');\n\n const colorReport: StyleDocumentReport =\n colors.members === undefined\n ? { errors: [], warnings: [] }\n : checkColorAnchors(colors.members, collected);\n\n return {\n errors: [\n ...checkNoUnknownKeys(value, ANCHOR_GROUPS, 'anchors', 'anchor group'),\n ...dimensions.issues,\n ...(dimensions.members === undefined ? [] : checkDimensionAnchors(dimensions.members)),\n ...colors.issues,\n ...colorReport.errors,\n ...fonts.issues,\n ...(fonts.members === undefined ? [] : checkFontAnchors(fonts.members)),\n ],\n warnings: colorReport.warnings,\n };\n};\n","import type { SurfaceName } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport {\n INVERT_RULES,\n MAX_COLOR_SCALE_OFFSET,\n OFFSET_ORIGINS,\n STACKABLE_ON,\n} from '../styleVocabulary';\nimport { isScaleOffset, singleColorAnchorFromRef, singleColorRefList } from './anchorValues';\nimport { checkNoUnknownKeys, list } from './issues';\n\n/**\n * A surface's fill: an anchor, or `parent` on a surface that sits on something.\n * Since a `flat` surface with an offset of `parent: 0` is essentially transparent,\n * we reject that syntax in favor of `treatment: \"none\"` — unless it inverts\n * `when-indistinct`, which always fires at that offset and paints the text color instead.\n */\nexport const checkBackgroundColor = (\n value: unknown,\n path: string,\n surface: SurfaceName,\n treatment: unknown,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(\n value,\n ['source', 'offset', 'from', 'invert'],\n path,\n 'backgroundColor key',\n ),\n ];\n\n const from = at(value, 'from');\n if (!isOneOf(OFFSET_ORIGINS, from)) {\n issues.push({ message: `from must be one of: ${list(OFFSET_ORIGINS)}`, path: `${path}.from` });\n } else if (from === 'parent' && STACKABLE_ON[surface].length === 0) {\n issues.push({\n message: `\"parent\" needs a surface to count from, and ${surface} sits on nothing — use \"source\"`,\n path: `${path}.from`,\n });\n } else if (from === 'parent' && treatment === 'glassy') {\n issues.push({\n message:\n 'glass has a fixed ground that its parent shows through, so it can\\'t count from it — use \"source\"',\n path: `${path}.from`,\n });\n }\n\n const invert = at(value, 'invert');\n if (!isOneOf(INVERT_RULES, invert)) {\n issues.push({\n message: `invert must be one of: ${list(INVERT_RULES)}`,\n path: `${path}.invert`,\n });\n } else if (invert === 'when-indistinct' && STACKABLE_ON[surface].length === 0) {\n issues.push({\n message: `\"when-indistinct\" compares a fill with what it sits on, and ${surface} sits on nothing — use \"never\"`,\n path: `${path}.invert`,\n });\n } else if (invert === 'when-indistinct' && treatment !== 'flat') {\n issues.push({\n message: 'only a flat fill can trade places with its text — use \"never\", or treatment \"flat\"',\n path: `${path}.invert`,\n });\n }\n\n const source = at(value, 'source');\n const offset = at(value, 'offset');\n const offsetIsValid = isScaleOffset(offset);\n\n if (source === 'parent') {\n if (STACKABLE_ON[surface].length === 0) {\n issues.push({\n message: `\"parent\" needs a surface to sit on, and ${surface} sits on nothing — use an anchor`,\n path: `${path}.source`,\n });\n } else if (treatment === 'flat' && invert === 'never' && offsetIsValid && offset === 0) {\n issues.push({\n message: `a flat surface at parent · 0 paints exactly its parent's fill and cannot be seen — step at least 1, invert \"when-indistinct\" to trade places with its text, or use treatment \"none\" to paint nothing`,\n path: `${path}.offset`,\n });\n }\n } else {\n const anchor = singleColorAnchorFromRef(source);\n if (anchor === undefined) {\n issues.push({\n message: `source must be \"parent\" or one of: ${singleColorRefList()}`,\n path: `${path}.source`,\n });\n } else {\n collected.referenced.add(anchor);\n }\n }\n\n if (!offsetIsValid) {\n issues.push({\n message: `offset must be an integer 0-${MAX_COLOR_SCALE_OFFSET}`,\n path: `${path}.offset`,\n });\n }\n\n return issues;\n};\n","import type { SurfaceName } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport { BORDER_STYLES, MAX_COLOR_SCALE_OFFSET, STACKABLE_ON } from '../styleVocabulary';\nimport { isScaleOffset, singleColorAnchorFromRef, singleColorRefList } from './anchorValues';\nimport { checkNoUnknownKeys, list } from './issues';\n\nexport const checkBorder = (\n value: Readonly<Record<string, unknown>>,\n surfacePath: string,\n surface: SurfaceName,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n const path = `${surfacePath}.border`;\n const declared = Object.hasOwn(value, 'border');\n\n if (STACKABLE_ON[surface].length === 0) {\n return declared\n ? [\n {\n message: `${surface} sits on nothing and has no edge of its own, so it carries no border`,\n path,\n },\n ]\n : [];\n }\n\n if (!declared) {\n return [\n {\n message: 'every surface with an edge of its own declares a border, even one of width 0',\n path,\n },\n ];\n }\n\n const border = at(value, 'border');\n\n if (!isRecord(border)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(\n border,\n ['width', 'colorSource', 'colorOffset', 'style'],\n path,\n 'border key',\n ),\n ];\n\n const style = at(border, 'style');\n if (!isOneOf(BORDER_STYLES, style)) {\n issues.push({ message: `style must be one of: ${list(BORDER_STYLES)}`, path: `${path}.style` });\n }\n\n const width = at(border, 'width');\n if (typeof width !== 'number' || !Number.isFinite(width) || width < 0) {\n issues.push({\n message: 'width must be a non-negative number of pixels, e.g. 1 or 0.5 (0 for none)',\n path: `${path}.width`,\n });\n }\n\n const colorSource = at(border, 'colorSource');\n const colorAnchor = singleColorAnchorFromRef(colorSource);\n if (colorAnchor !== undefined) {\n collected.referenced.add(colorAnchor);\n } else if (colorSource !== 'surface') {\n issues.push({\n message: `colorSource must be \"surface\" or one of: ${singleColorRefList()}`,\n path: `${path}.colorSource`,\n });\n }\n\n if (!isScaleOffset(at(border, 'colorOffset'))) {\n issues.push({\n message: `colorOffset must be an integer 0-${MAX_COLOR_SCALE_OFFSET}`,\n path: `${path}.colorOffset`,\n });\n }\n\n return issues;\n};\n","import type { SurfaceName } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport {\n ELEVATION_COLOR_SOURCE_KEYWORDS,\n ELEVATION_DEPTHS,\n ELEVATION_HARDNESSES,\n STACKABLE_ON,\n} from '../styleVocabulary';\nimport { isColorForm, singleColorAnchorFromRef, singleColorRefList } from './anchorValues';\nimport { checkNoUnknownKeys, list } from './issues';\n\nexport const checkElevation = (\n value: unknown,\n path: string,\n surface: SurfaceName,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(value, ['depth', 'hardness', 'source'], path, 'elevation key'),\n ];\n\n const depth = at(value, 'depth');\n if (!isOneOf(ELEVATION_DEPTHS, depth)) {\n issues.push({\n message: `depth must be one of: ${list(ELEVATION_DEPTHS)}`,\n path: `${path}.depth`,\n });\n } else if (STACKABLE_ON[surface].length === 0 && depth !== 'none') {\n issues.push({\n message: `${surface} sits on nothing, so it has nothing to cast a shadow on — use depth \"none\"`,\n path: `${path}.depth`,\n });\n }\n\n if (!isOneOf(ELEVATION_HARDNESSES, at(value, 'hardness'))) {\n issues.push({\n message: `hardness must be one of: ${list(ELEVATION_HARDNESSES)}`,\n path: `${path}.hardness`,\n });\n }\n\n const elevationSource = at(value, 'source');\n const elevationAnchor = singleColorAnchorFromRef(elevationSource);\n if (elevationAnchor !== undefined) {\n collected.referenced.add(elevationAnchor);\n } else if (\n !isOneOf(ELEVATION_COLOR_SOURCE_KEYWORDS, elevationSource) &&\n !isColorForm(elevationSource)\n ) {\n issues.push({\n message: `source must be one of: ${list(ELEVATION_COLOR_SOURCE_KEYWORDS)}, ${singleColorRefList()}, or a color — a hex or rgb() literal, a token reference like \"$primaryColor\", or { from, relation, tone }`,\n path: `${path}.source`,\n });\n }\n\n return issues;\n};\n","import type { GradientShapeOption } from '../styleVocabulary';\nimport type { StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport {\n GRADIENT_DIRECTIONS,\n GRADIENT_EXTENTS,\n GRADIENT_POSITIONS,\n GRADIENT_SHAPE_OPTIONS,\n} from '../styleVocabulary';\nimport { checkGradientStops } from './anchors';\nimport { checkNoUnknownKeys, list } from './issues';\n\n/** Every key a gradientShape may carry, and which kinds each option belongs to. */\nconst GRADIENT_SHAPE_KEYS = ['kind', 'direction', 'position', 'extent', 'stops'] as const;\nconst KIND_SPECIFIC_KEYS: readonly (readonly [\n key: string,\n kinds: readonly GradientShapeOption[],\n allowed: readonly string[],\n])[] = [\n ['direction', ['linear'], GRADIENT_DIRECTIONS],\n ['position', ['radial'], GRADIENT_POSITIONS],\n ['extent', ['radial'], GRADIENT_EXTENTS],\n];\n\n/** A gradient surface with its own stops draws them in place of `anchors.colors.gradientStops`. */\nexport const hasOwnGradientStops = (value: Record<string, unknown>): boolean => {\n const shape = at(value, 'gradientShape');\n\n return isRecord(shape) && Object.hasOwn(shape, 'stops');\n};\n\n/**\n * `gradientShape` is the one setting a surface carries conditionally: required when the treatment\n * is `gradient`, absent otherwise. Naming a shape on a surface that paints no gradient is an error\n * rather than a line that silently does nothing — the same reason unknown keys are caught.\n */\nexport const checkGradientShape = (\n value: Record<string, unknown>,\n path: string,\n treatment: unknown,\n): readonly StyleDocumentIssue[] => {\n const declared = Object.hasOwn(value, 'gradientShape');\n\n if (treatment !== 'gradient') {\n return declared\n ? [\n {\n message: 'only a surface with treatment \"gradient\" carries a gradientShape',\n path: `${path}.gradientShape`,\n },\n ]\n : [];\n }\n\n if (!declared) {\n return [\n {\n message: `a gradient surface must name its shape: ${list(GRADIENT_SHAPE_OPTIONS)}`,\n path: `${path}.gradientShape`,\n },\n ];\n }\n\n const shape = at(value, 'gradientShape');\n const shapePath = `${path}.gradientShape`;\n\n if (!isRecord(shape)) {\n return [{ message: 'must be an object', path: shapePath }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(shape, GRADIENT_SHAPE_KEYS, shapePath, 'setting'),\n ...(Object.hasOwn(shape, 'stops')\n ? checkGradientStops(at(shape, 'stops'), `${shapePath}.stops`)\n : []),\n ];\n\n const kind = at(shape, 'kind');\n\n if (!isOneOf(GRADIENT_SHAPE_OPTIONS, kind)) {\n issues.push({\n message: `kind must be one of: ${list(GRADIENT_SHAPE_OPTIONS)}`,\n path: `${shapePath}.kind`,\n });\n\n return issues;\n }\n\n /**\n * Each arrangement carries exactly what it needs to be drawn and nothing else, so a direction on\n * a radial gradient is an error rather than a line the engine quietly ignores.\n */\n for (const [key, kinds, allowed] of KIND_SPECIFIC_KEYS) {\n const wanted = kinds.includes(kind);\n const present = Object.hasOwn(shape, key);\n\n if (wanted && !present) {\n issues.push({\n message: `a ${kind} gradient must name its ${key}: ${list(allowed)}`,\n path: `${shapePath}.${key}`,\n });\n } else if (!wanted && present) {\n issues.push({\n message: `only a ${list(kinds)} gradient carries a ${key}`,\n path: `${shapePath}.${key}`,\n });\n } else if (wanted && !isOneOf(allowed, at(shape, key))) {\n issues.push({\n message: `${key} must be one of: ${list(allowed)}`,\n path: `${shapePath}.${key}`,\n });\n }\n }\n\n return issues;\n};\n","import type { SurfaceName } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport {\n AMBIENT_MOTIONS,\n MOTION_SPEEDS,\n PULSE_SIZES,\n STACKABLE_ON,\n TRANSITIONS,\n} from '../styleVocabulary';\nimport { COLOR_FORM_MESSAGE, isColorForm, singleColorAnchorFromRef } from './anchorValues';\nimport { checkNoUnknownKeys, list } from './issues';\n\n/** `pulseColor` is carried conditionally: required on a pulse, and meaningless on anything else. */\nconst checkPulseColor = (\n value: Readonly<Record<string, unknown>>,\n path: string,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n const pulseColor = at(value, 'pulseColor');\n const pulseColorPath = `${path}.pulseColor`;\n\n if (at(value, 'ambient') !== 'pulse') {\n return pulseColor === undefined\n ? []\n : [\n {\n message: 'only a surface with ambient \"pulse\" carries a pulseColor',\n path: pulseColorPath,\n },\n ];\n }\n\n if (pulseColor === undefined) {\n return [{ message: 'a surface with ambient \"pulse\" needs a pulseColor', path: pulseColorPath }];\n }\n\n if (pulseColor === 'derive') {\n return [];\n }\n\n const anchor = singleColorAnchorFromRef(pulseColor);\n\n if (anchor !== undefined) {\n collected.referenced.add(anchor);\n\n return [];\n }\n\n return isColorForm(pulseColor)\n ? []\n : [{ message: `must be \"derive\" or ${COLOR_FORM_MESSAGE}`, path: pulseColorPath }];\n};\n\n/** `pulseSize` is carried the same way as `pulseColor`. */\nconst checkPulseSize = (\n value: Readonly<Record<string, unknown>>,\n path: string,\n): readonly StyleDocumentIssue[] => {\n const pulseSize = at(value, 'pulseSize');\n const pulseSizePath = `${path}.pulseSize`;\n\n if (at(value, 'ambient') !== 'pulse') {\n return pulseSize === undefined\n ? []\n : [\n {\n message: 'only a surface with ambient \"pulse\" carries a pulseSize',\n path: pulseSizePath,\n },\n ];\n }\n\n return isOneOf(PULSE_SIZES, pulseSize)\n ? []\n : [{ message: `pulseSize must be one of: ${list(PULSE_SIZES)}`, path: pulseSizePath }];\n};\n\nexport const checkMotion = (\n value: unknown,\n path: string,\n surface: SurfaceName,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(\n value,\n ['ambient', 'speed', 'transition', 'pulseColor', 'pulseSize'],\n path,\n 'motion key',\n ),\n ...checkPulseColor(value, path, collected),\n ...checkPulseSize(value, path),\n ];\n\n const ambient = at(value, 'ambient');\n const sitsOnNothing = STACKABLE_ON[surface].length === 0;\n if (!isOneOf(AMBIENT_MOTIONS, ambient)) {\n issues.push({\n message: `ambient must be one of: ${list(AMBIENT_MOTIONS)}`,\n path: `${path}.ambient`,\n });\n } else if (ambient === 'drift' && !sitsOnNothing) {\n issues.push({\n message: `only the page drifts, and ${surface} sits on another surface — use \"none\" or \"pulse\"`,\n path: `${path}.ambient`,\n });\n } else if (ambient === 'pulse' && sitsOnNothing) {\n issues.push({\n message: `a pulse moves a surface's edge, and ${surface} sits on nothing so it has none — use \"none\" or \"drift\"`,\n path: `${path}.ambient`,\n });\n }\n if (!isOneOf(MOTION_SPEEDS, at(value, 'speed'))) {\n issues.push({\n message: `speed must be one of: ${list(MOTION_SPEEDS)}`,\n path: `${path}.speed`,\n });\n }\n if (!isOneOf(TRANSITIONS, at(value, 'transition'))) {\n issues.push({\n message: `transition must be one of: ${list(TRANSITIONS)}`,\n path: `${path}.transition`,\n });\n }\n\n return issues;\n};\n","import type { StyleDocumentIssue } from './issues';\nimport { at, isRecord } from '../private/guards';\nimport { ANCHOR_REF_PREFIX } from '../styleVocabulary';\nimport { isDimension } from './anchorValues';\nimport { checkNoUnknownKeys } from './issues';\n\nconst BORDER_RADIUS_REF = `${ANCHOR_REF_PREFIX}dimensions.borderRadius`;\n\n/** Only the border-radius anchor: any other length, such as a spacing value, is not a radius. */\nconst isRadiusSource = (value: unknown): boolean =>\n value === BORDER_RADIUS_REF || isDimension(value);\n\nexport const checkRadius = (value: unknown, path: string): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(value, ['source'], path, 'radius key'),\n ];\n\n if (!isRadiusSource(at(value, 'source'))) {\n issues.push({\n message: `source must be \"${BORDER_RADIUS_REF}\", a token reference, or a number of pixels`,\n path: `${path}.source`,\n });\n }\n\n return issues;\n};\n","import type { Collected, StyleDocumentIssue } from './issues';\nimport { at, isRecord } from '../private/guards';\nimport { MAX_COLOR_SCALE_OFFSET } from '../styleVocabulary';\nimport {\n isColorForm,\n isScaleOffset,\n singleColorAnchorFromRef,\n singleColorRefList,\n} from './anchorValues';\nimport { checkNoUnknownKeys } from './issues';\n\nexport const checkTextColor = (\n value: unknown,\n path: string,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n const anchor = singleColorAnchorFromRef(value);\n if (anchor !== undefined) {\n collected.referenced.add(anchor);\n return [];\n }\n if (value === 'derive' || isColorForm(value)) {\n return [];\n }\n if (!isRecord(value) || Object.hasOwn(value, 'from')) {\n return [\n {\n message: `textColor must be \"derive\", { source, offset }, one of: ${singleColorRefList()}, or a color — a hex or rgb() literal, a token reference like \"$primaryColor\", or { from, relation, tone }`,\n path,\n },\n ];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(value, ['source', 'offset'], path, 'textColor key'),\n ];\n\n const source = singleColorAnchorFromRef(at(value, 'source'));\n if (source === undefined) {\n issues.push({\n message: `source must be one of: ${singleColorRefList()}`,\n path: `${path}.source`,\n });\n } else {\n collected.referenced.add(source);\n }\n\n if (!isScaleOffset(at(value, 'offset'))) {\n issues.push({\n message: `offset must be an integer 0-${MAX_COLOR_SCALE_OFFSET}`,\n path: `${path}.offset`,\n });\n }\n\n return issues;\n};\n","import type { StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport { TEXTURE_INTENSITIES, TEXTURE_KINDS } from '../styleVocabulary';\nimport { COLOR_FORM_MESSAGE, isColorForm } from './anchorValues';\nimport { checkNoUnknownKeys, list } from './issues';\n\n/**\n * A named texture at a named intensity, in an optional color. A surface that paints nothing has no\n * fill to lay a texture over, so `treatment: \"none\"` requires `kind: \"none\"`, and a texture of kind\n * `none` takes no color.\n */\nexport const checkTexture = (\n value: unknown,\n path: string,\n treatment: unknown,\n): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(value, ['kind', 'intensity', 'color'], path, 'texture key'),\n ];\n\n const kind = at(value, 'kind');\n if (!isOneOf(TEXTURE_KINDS, kind)) {\n issues.push({ message: `kind must be one of: ${list(TEXTURE_KINDS)}`, path: `${path}.kind` });\n } else if (treatment === 'none' && kind !== 'none') {\n issues.push({\n message:\n 'a surface with treatment \"none\" paints no fill to texture — use kind \"none\", or give the surface a fill',\n path: `${path}.kind`,\n });\n }\n\n const color = at(value, 'color');\n if (color !== undefined) {\n if (kind === 'none') {\n issues.push({\n message: 'a texture of kind \"none\" draws nothing to color',\n path: `${path}.color`,\n });\n } else if (!isColorForm(color)) {\n issues.push({ message: COLOR_FORM_MESSAGE, path: `${path}.color` });\n }\n }\n\n if (!isOneOf(TEXTURE_INTENSITIES, at(value, 'intensity'))) {\n issues.push({\n message: `intensity must be one of: ${list(TEXTURE_INTENSITIES)}`,\n path: `${path}.intensity`,\n });\n }\n\n return issues;\n};\n","import type { SurfaceName } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport { ALL_SETTING_NAMES, STACKABLE_ON, SURFACE_NAMES, TREATMENTS } from '../styleVocabulary';\nimport { checkBackgroundColor } from './backgroundColor';\nimport { checkBorder } from './border';\nimport { checkElevation } from './elevation';\nimport { checkGradientShape, hasOwnGradientStops } from './gradientShape';\nimport { checkNoUnknownKeys, list } from './issues';\nimport { checkMotion } from './motion';\nimport { checkRadius } from './radius';\nimport { checkTextColor } from './textColor';\nimport { checkTexture } from './texture';\n\n/** Glass shows what sits behind it, and a surface that sits on nothing has nothing behind it. */\nconst checkTreatment = (\n treatment: unknown,\n path: string,\n name: SurfaceName,\n): readonly StyleDocumentIssue[] => {\n if (!isOneOf(TREATMENTS, treatment)) {\n return [\n { message: `treatment must be one of: ${list(TREATMENTS)}`, path: `${path}.treatment` },\n ];\n }\n\n return treatment === 'glassy' && STACKABLE_ON[name].length === 0\n ? [\n {\n message: `${name} sits on nothing, so glass would have nothing to show through it — use another treatment`,\n path: `${path}.treatment`,\n },\n ]\n : [];\n};\n\nconst checkSurface = (\n value: unknown,\n name: SurfaceName,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n const path = `surfaces.${name}`;\n\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const treatment = at(value, 'treatment');\n const namedTreatment = isOneOf(TREATMENTS, treatment);\n\n // A gradient with its own stops doesn't need the Style's, so it doesn't count toward the anchor.\n if (namedTreatment && !(treatment === 'gradient' && hasOwnGradientStops(value))) {\n collected.treatments.add(treatment);\n }\n\n return [\n ...checkNoUnknownKeys(value, ALL_SETTING_NAMES, path, 'setting'),\n ...checkTreatment(treatment, path, name),\n ...checkGradientShape(value, path, treatment),\n ...checkBackgroundColor(\n at(value, 'backgroundColor'),\n `${path}.backgroundColor`,\n name,\n treatment,\n collected,\n ),\n ...checkTextColor(at(value, 'textColor'), `${path}.textColor`, collected),\n ...checkBorder(value, path, name, collected),\n ...checkElevation(at(value, 'elevation'), `${path}.elevation`, name, collected),\n ...checkRadius(at(value, 'radius'), `${path}.radius`),\n ...checkTexture(at(value, 'texture'), `${path}.texture`, treatment),\n ...checkMotion(at(value, 'motion'), `${path}.motion`, name, collected),\n ];\n};\n\nexport const checkSurfaces = (\n value: unknown,\n collected: Collected,\n): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path: 'surfaces' }];\n }\n\n const unknown = Object.keys(value)\n .filter((key) => !isOneOf(SURFACE_NAMES, key))\n .map((key) => ({\n message: `unknown surface — the set is fixed: ${list(SURFACE_NAMES)}`,\n path: `surfaces.${key}`,\n }));\n\n return [\n ...unknown,\n ...SURFACE_NAMES.flatMap((name) => {\n const surface = at(value, name);\n\n return surface === undefined\n ? [{ message: 'every Style must define every surface', path: `surfaces.${name}` }]\n : checkSurface(surface, name, collected);\n }),\n ];\n};\n","import type { StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord, isString } from '../private/guards';\nimport {\n ANCHOR_REF_PREFIX,\n REQUIRED_FONT_ANCHORS,\n TYPE_CASES,\n TYPE_ROLES,\n} from '../styleVocabulary';\nimport { checkNoUnknownKeys, list } from './issues';\n\nconst FONT_REF_PREFIX = `${ANCHOR_REF_PREFIX}fonts.`;\n\nconst fontRefList = (): string =>\n list(REQUIRED_FONT_ANCHORS.map((name) => `${FONT_REF_PREFIX}${name}`));\n\nconst isFontAnchorRef = (value: unknown): boolean =>\n isString(value) &&\n value.startsWith(FONT_REF_PREFIX) &&\n isOneOf(REQUIRED_FONT_ANCHORS, value.slice(FONT_REF_PREFIX.length));\n\nconst checkTypeRole = (value: unknown, path: string): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path }];\n }\n\n const issues: StyleDocumentIssue[] = [\n ...checkNoUnknownKeys(value, ['font', 'fontSize', 'case', 'fontWeight'], path, 'type key'),\n ];\n\n if (!isFontAnchorRef(at(value, 'font'))) {\n issues.push({ message: `font must be one of: ${fontRefList()}`, path: `${path}.font` });\n }\n const fontSize = at(value, 'fontSize');\n if (typeof fontSize !== 'number' || !Number.isFinite(fontSize) || fontSize <= 0) {\n issues.push({\n message: 'fontSize must be a positive number of pixels, e.g. 16',\n path: `${path}.fontSize`,\n });\n }\n if (!isOneOf(TYPE_CASES, at(value, 'case'))) {\n issues.push({ message: `case must be one of: ${list(TYPE_CASES)}`, path: `${path}.case` });\n }\n const fontWeight = at(value, 'fontWeight');\n if (\n typeof fontWeight !== 'number' ||\n !Number.isFinite(fontWeight) ||\n fontWeight < 1 ||\n fontWeight > 1000\n ) {\n issues.push({\n message: 'fontWeight must be a CSS weight from 1 to 1000, e.g. 400 or 700',\n path: `${path}.fontWeight`,\n });\n }\n\n return issues;\n};\n\nexport const checkTypography = (value: unknown): readonly StyleDocumentIssue[] => {\n if (!isRecord(value)) {\n return [{ message: 'must be an object', path: 'typography' }];\n }\n\n return [\n ...checkNoUnknownKeys(value, TYPE_ROLES, 'typography', 'type role'),\n ...TYPE_ROLES.flatMap((role) => checkTypeRole(at(value, role), `typography.${role}`)),\n ];\n};\n","import type { StyleDocument } from '../styleVocabulary';\nimport type { Collected, StyleDocumentIssue, StyleDocumentReport } from './issues';\nimport { at, isRecord, isString } from '../private/guards';\nimport { ID_PATTERN } from '../private/styleDocumentPatterns';\nimport { DOCUMENT_KEYS } from '../styleVocabulary';\nimport { checkAnchors } from './anchors';\nimport { checkNoUnknownKeys } from './issues';\nimport { checkSurfaces } from './surfaces';\nimport { checkTypography } from './typography';\n\n/**\n * Structural validation for a Style document, based on the schema.\n *\n * @param input a parsed Style document, of unknown shape\n * @returns every problem found, split into errors, which make the document invalid, and\n * warnings, which do not\n *\n * @example\n * ```ts\n * const { errors, warnings } = checkStyleDocument(doc);\n * for (const { path, message } of warnings) {\n * console.warn(`${path}: ${message}`);\n * }\n * if (errors.length > 0) {\n * throw new Error(errors.map(({ path, message }) => `${path}: ${message}`).join('\\n'));\n * }\n * ```\n */\nexport const checkStyleDocument = (input: unknown): StyleDocumentReport => {\n if (!isRecord(input)) {\n return { errors: [{ message: 'a Style document must be an object', path: '' }], warnings: [] };\n }\n\n const issues: StyleDocumentIssue[] = [...checkNoUnknownKeys(input, DOCUMENT_KEYS, '', 'key')];\n const collected: Collected = { referenced: new Set(), treatments: new Set() };\n\n const id = at(input, 'id');\n if (!isString(id) || !ID_PATTERN.test(id)) {\n issues.push({ message: 'id must be lowercase kebab-case, e.g. \"glass-dark\"', path: 'id' });\n }\n\n const name = at(input, 'name');\n if (!isString(name) || name.length === 0) {\n issues.push({ message: 'name is required', path: 'name' });\n }\n\n if (at(input, 'schemaVersion') !== 1) {\n issues.push({ message: 'schemaVersion must be 1', path: 'schemaVersion' });\n }\n\n const surfaceIssues = [\n ...checkTypography(at(input, 'typography')),\n ...checkSurfaces(at(input, 'surfaces'), collected),\n ];\n\n // checkSurfaces fills `collected`, which anchor completeness reads, so anchors run last.\n const anchors = checkAnchors(at(input, 'anchors'), collected);\n\n issues.push(...surfaceIssues, ...anchors.errors);\n\n return { errors: issues, warnings: anchors.warnings };\n};\n\n/**\n * What makes a document invalid, and nothing else.\n *\n * Empty means the document is safe to render, so a caller can drop a document on a non-empty\n * result without reading it — the reason warnings are a separate channel rather than entries\n * here with a severity on them. Nothing inert should ever cost a customer their Style.\n *\n * @example\n * ```ts\n * const issues = validateStyleDocument(doc);\n * if (issues.length > 0) {\n * throw new Error(issues.map(({ path, message }) => `${path}: ${message}`).join('\\n'));\n * }\n * ```\n */\nexport const validateStyleDocument = (input: unknown): readonly StyleDocumentIssue[] =>\n checkStyleDocument(input).errors;\n\n/** Whether a value is a valid Style document. */\nexport const isStyleDocument = (input: unknown): input is StyleDocument =>\n validateStyleDocument(input).length === 0;\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAa,aAAqB;;AAGlC,MAAa,gBAAwB;AAErC,MAAM,YAAY,OAAO,GAAG;;AAG5B,MAAM,YAAY,OAAO,GAAG;;;;;;;;;AAU5B,MAAM,YAAY,OAAO,GAAG,gBAAgB,UAAU,SAAS,UAAU,SAAS,UAAU,YAAY,UAAU,KAAK,UAAU,KAAK,UAAU,KAAK,UAAU,YAAY,UAAU;AAErL,MAAa,wBAAgC,IAAI,OAC/C,OAAO,GAAG,OAAO,UAAU,GAAG,UAAU,GAC1C;AAEA,MAAM,mBAAmB,OAAO,GAAG;AAEnC,MAAM,mBAAmB,OAAO,GAAG,gBAAgB,UAAU,SAAS,UAAU,SAAS,UAAU,GAAG,UAAU,KAAK,UAAU,KAAK,UAAU;;;;;AAM9I,MAAa,+BAAuC,IAAI,OACtD,OAAO,GAAG,OAAO,iBAAiB,GAAG,iBAAiB,GACxD;AAEA,MAAM,uBAAuB,OAAO,GAAG;;AAGvC,MAAM,gBAAgB,IAAI;;;;;;AAO1B,MAAM,cAAc;CAClB,OAAO,GAAG,OAAO,qBAAqB;CACtC,OAAO,GAAG,OAAO,qBAAqB;CAEtC,OAAO,GAAG,SAAS,cAAc,UAAU,cAAc,UAAU,cAAc;AACnF,CAAC,CAAC,KAAK,GAAG;;;;;;;;;AAUV,MAAa,qBAA6B,IAAI,OAC5C,OAAO,GAAG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