@wistia/kaleidoscope 0.0.7 → 0.0.8

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{color-BgYVUbOQ.js → color-BuPhQjcd.js} +3 -3
  3. package/dist/{color-BgYVUbOQ.js.map → color-BuPhQjcd.js.map} +1 -1
  4. package/dist/{engine-DHDkDPaV.js → engine-6ocr431e.js} +788 -374
  5. package/dist/engine-6ocr431e.js.map +1 -0
  6. package/dist/{engine-B00ZVZ0d.d.ts → engine-CcU0Q8Jg.d.ts} +5 -3
  7. package/dist/{engine-B00ZVZ0d.d.ts.map → engine-CcU0Q8Jg.d.ts.map} +1 -1
  8. package/dist/entries/color.js +3 -3
  9. package/dist/entries/engine.d.ts +1 -1
  10. package/dist/entries/engine.js +2 -2
  11. package/dist/entries/styleRegistry.d.ts +1 -1
  12. package/dist/entries/styleRegistry.js +2 -2
  13. package/dist/entries/validate.d.ts +1 -1
  14. package/dist/entries/validate.js +2 -2
  15. package/dist/entries/vocabulary.d.ts +2 -2
  16. package/dist/entries/vocabulary.js +4 -4
  17. package/dist/{getColorLightnessClassification-C6BXD8Da.js → getColorLightnessClassification-Dgr8qirZ.js} +2 -2
  18. package/dist/{getColorLightnessClassification-C6BXD8Da.js.map → getColorLightnessClassification-Dgr8qirZ.js.map} +1 -1
  19. package/dist/{guards-BJfumKYK.js → guards-BPewjm9T.js} +2 -2
  20. package/dist/{guards-BJfumKYK.js.map → guards-BPewjm9T.js.map} +1 -1
  21. package/dist/{index-BOJCY_MU.d.ts → index-BTumAeju.d.ts} +26 -7
  22. package/dist/index-BTumAeju.d.ts.map +1 -0
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +9 -9
  25. package/dist/{styleRegistry-Dcho9r3B.js → styleRegistry-BqGmp-3z.js} +5 -5
  26. package/dist/{styleRegistry-Dcho9r3B.js.map → styleRegistry-BqGmp-3z.js.map} +1 -1
  27. package/dist/{styleRegistry-A0nrsHk-.d.ts → styleRegistry-BsMmbH_0.d.ts} +2 -2
  28. package/dist/{styleRegistry-A0nrsHk-.d.ts.map → styleRegistry-BsMmbH_0.d.ts.map} +1 -1
  29. package/dist/{styleVocabulary-DMhXOr4F.js → styleVocabulary-CDTPCMhZ.js} +11 -5
  30. package/dist/{styleVocabulary-DMhXOr4F.js.map → styleVocabulary-CDTPCMhZ.js.map} +1 -1
  31. package/dist/{typography-BLPIIq_8.js → typography-BCKqcNDx.js} +2 -2
  32. package/dist/{typography-BLPIIq_8.js.map → typography-BCKqcNDx.js.map} +1 -1
  33. package/dist/{validate-Bqx__f3d.d.ts → validate-8Ow1tYvz.d.ts} +2 -2
  34. package/dist/{validate-Bqx__f3d.d.ts.map → validate-8Ow1tYvz.d.ts.map} +1 -1
  35. package/dist/{validate-BkOpEpch.js → validate-D_VsJM1q.js} +88 -26
  36. package/dist/validate-D_VsJM1q.js.map +1 -0
  37. package/package.json +7 -7
  38. package/schema/style-v1.json +128 -20
  39. package/styles/opaque-bright.json +1 -1
  40. package/styles/opaque-heavy.json +1 -1
  41. package/styles/opaque-minimal.json +1 -1
  42. package/dist/engine-DHDkDPaV.js.map +0 -1
  43. package/dist/index-BOJCY_MU.d.ts.map +0 -1
  44. package/dist/validate-BkOpEpch.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://fast.wistia.com/schemas/kaleidoscope/style-v1.json",
4
4
  "title": "Kaleidoscope Style document",
5
- "description": "A Wistia Kaleidoscope Style says how one brand’s audience-facing surfaces are painted, a player, a channel, a webinar page, or a video page, in a customizable JSON document.\n\nThe Style names abstract rules, as opposed to literal CSS. A surface says which anchor its color comes from and how far to step along that color’s scale; the engine resolves that into real values for the surface it is painting. Degrees, percentages, alphas, blur radii, shadow geometry and durations are all engine-owned, which is what lets one document read correctly across all sizes and shapes of embeds and app pages, handling color contrast for text and stacked surfaces.\n\nEvery surface in `surfaces` must be present and carry every setting. Colors live once in `anchors.colors` and surfaces reference them—same as fonts in `anchors.fonts` and measurements in `anchors.dimensions`. A treatment that cannot resolve without a particular anchor requires it: `glassy` needs `ground`, `gradient` needs `gradientStops`. Those are the conditional rules at the root, and each one carries a description explaining what it is for.\n\nYou may create a fully custom style based on the schema and some inspiration keywords, or you can start from a built-in Style rather than from scratch: `@wistia/kaleidoscope/style-registry` exports each one as a complete, valid document. Feel free to pick the closest one and make an edited copy. The package root and the `@wistia/kaleidoscope/validate` entry point both export `validateStyleDocument`, which reports problems as { path, message } and names the accepted values in the message. It catches everything this schema does, plus a few rules JSON Schema cannot express.",
5
+ "description": "A Wistia Kaleidoscope Style says how one brand’s audience-facing surfaces are painted, a player, a channel, a webinar page, or a video page, in a customizable JSON document.\n\nThe Style names abstract rules, as opposed to literal CSS. A surface says which anchor its color comes from and how far to step along that color’s scale; the engine resolves that into real values for the surface it is painting. Degrees, percentages, alphas, blur radii, shadow geometry and durations are all engine-owned, which is what lets one document read correctly across all sizes and shapes of embeds and app pages, handling color contrast for text and stacked surfaces.\n\nEvery surface in `surfaces` must be present and carry every setting. Colors live once in `anchors.colors` and surfaces reference them—same as fonts in `anchors.fonts` and measurements in `anchors.dimensions`. A treatment that cannot resolve without a particular anchor requires it: `glassy` needs `ground`, `gradient` needs `gradientStops` unless its `gradientShape` carries its own `stops`. Those are the conditional rules at the root, and each one carries a description explaining what it is for.\n\nYou may create a fully custom style based on the schema and some inspiration keywords, or you can start from a built-in Style rather than from scratch: `@wistia/kaleidoscope/style-registry` exports each one as a complete, valid document. Feel free to pick the closest one and make an edited copy. The package root and the `@wistia/kaleidoscope/validate` entry point both export `validateStyleDocument`, which reports problems as { path, message } and names the accepted values in the message. It catches everything this schema does, plus a few rules JSON Schema cannot express.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": [
@@ -227,7 +227,7 @@
227
227
  ],
228
228
  "properties": {
229
229
  "treatment": {
230
- "description": "'none' has no background of its own, so the parent shows through. 'gradient' draws anchors.colors.gradientStops in the arrangement named by gradientShape.",
230
+ "description": "'none' has no background of its own, so the parent shows through. 'gradient' draws its gradientShape's stops, or else anchors.colors.gradientStops, in the arrangement that shape names.",
231
231
  "enum": [
232
232
  "none",
233
233
  "flat",
@@ -463,11 +463,15 @@
463
463
  ]
464
464
  },
465
465
  "extent": {
466
- "description": "How far a 'radial' gradient's last stop travels. 'near' stays small and close to the origin position, whereas 'far' brings the gradient to the corners of the surface.",
466
+ "description": "How far a 'radial' gradient's last stop travels. 'near' reaches the furthest edge, leaving the corners beyond it in the last stop, whereas 'far' brings the gradient to the furthest corner of the surface.",
467
467
  "enum": [
468
468
  "near",
469
469
  "far"
470
470
  ]
471
+ },
472
+ "stops": {
473
+ "$ref": "#/$defs/gradientStops",
474
+ "description": "Stops for this surface alone, in place of anchors.colors.gradientStops. A Style whose every gradient carries its own stops need not declare the anchor."
471
475
  }
472
476
  },
473
477
  "allOf": [
@@ -756,6 +760,60 @@
756
760
  "quick",
757
761
  "smooth"
758
762
  ]
763
+ },
764
+ "pulseColor": {
765
+ "description": "The color the surface's border and shadow move towards as it pulses. Its fill and text never change. 'derive' uses the color of the surface's elevation.",
766
+ "oneOf": [
767
+ {
768
+ "const": "derive"
769
+ },
770
+ {
771
+ "$ref": "#/$defs/colorAnchorRef"
772
+ },
773
+ {
774
+ "$ref": "#/$defs/singleColor"
775
+ }
776
+ ]
777
+ },
778
+ "pulseSize": {
779
+ "description": "How far the surface's shadow reaches as it pulses. Blur and spread are engine-owned.",
780
+ "enum": [
781
+ "small",
782
+ "medium",
783
+ "large"
784
+ ]
785
+ }
786
+ },
787
+ "if": {
788
+ "required": [
789
+ "ambient"
790
+ ],
791
+ "properties": {
792
+ "ambient": {
793
+ "const": "pulse"
794
+ }
795
+ }
796
+ },
797
+ "then": {
798
+ "required": [
799
+ "pulseColor",
800
+ "pulseSize"
801
+ ]
802
+ },
803
+ "else": {
804
+ "not": {
805
+ "anyOf": [
806
+ {
807
+ "required": [
808
+ "pulseColor"
809
+ ]
810
+ },
811
+ {
812
+ "required": [
813
+ "pulseSize"
814
+ ]
815
+ }
816
+ ]
759
817
  }
760
818
  }
761
819
  },
@@ -769,7 +827,7 @@
769
827
  ],
770
828
  "properties": {
771
829
  "depth": {
772
- "description": "How far the surface is elevated along the Z axis. Offsets and blur radii are engine-owned and cannot be provided in the schema directly.",
830
+ "description": "How far the surface is elevated along the Z axis. Offsets and blur radii are engine-owned and cannot be provided in the schema directly, and scale with the surface: a button casts a smaller shadow than a panel at the same depth.",
773
831
  "enum": [
774
832
  "none",
775
833
  "low",
@@ -871,13 +929,31 @@
871
929
  "minItems": 2,
872
930
  "maxItems": 6,
873
931
  "items": {
874
- "$ref": "#/$defs/singleColor"
932
+ "$ref": "#/$defs/gradientStop"
875
933
  }
876
934
  },
935
+ "gradientStop": {
936
+ "description": "One stop: a color in any of the three forms, but a literal has no alpha. Text is checked against the stops as painted, and a see-through stop would show whatever is behind it instead.",
937
+ "oneOf": [
938
+ {
939
+ "$ref": "#/$defs/opaqueLiteralColor"
940
+ },
941
+ {
942
+ "$ref": "#/$defs/tokenRef"
943
+ },
944
+ {
945
+ "$ref": "#/$defs/relatedColor"
946
+ }
947
+ ]
948
+ },
877
949
  "literalColor": {
878
950
  "type": "string",
879
951
  "pattern": "^(?:#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\\(\\s*(?:[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s*,\\s*[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s*,\\s*[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?(?:\\s*,\\s*[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?)?|[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s+[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s+[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?(?:\\s*\\/\\s*[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?)?)\\s*\\))$"
880
952
  },
953
+ "opaqueLiteralColor": {
954
+ "type": "string",
955
+ "pattern": "^(?:#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})|rgba?\\(\\s*(?:[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s*,\\s*[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s*,\\s*[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?|[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s+[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?\\s+[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%?)\\s*\\))$"
956
+ },
881
957
  "tokenRef": {
882
958
  "description": "A brand-kit token, e.g. $primaryColor.",
883
959
  "type": "string",
@@ -935,14 +1011,20 @@
935
1011
  "surfaces": {
936
1012
  "not": {
937
1013
  "additionalProperties": {
938
- "properties": {
939
- "treatment": {
940
- "not": {
941
- "enum": [
942
- "glassy"
943
- ]
1014
+ "anyOf": [
1015
+ {
1016
+ "properties": {
1017
+ "treatment": {
1018
+ "not": {
1019
+ "enum": [
1020
+ "glassy"
1021
+ ]
1022
+ }
1023
+ }
944
1024
  }
945
- },
1025
+ }
1026
+ ],
1027
+ "properties": {
946
1028
  "backgroundColor": {
947
1029
  "properties": {
948
1030
  "source": {
@@ -981,6 +1063,15 @@
981
1063
  }
982
1064
  }
983
1065
  }
1066
+ },
1067
+ "motion": {
1068
+ "properties": {
1069
+ "pulseColor": {
1070
+ "not": {
1071
+ "const": "anchors.colors.ground"
1072
+ }
1073
+ }
1074
+ }
984
1075
  }
985
1076
  }
986
1077
  }
@@ -989,7 +1080,7 @@
989
1080
  }
990
1081
  },
991
1082
  "needsGradientStops": {
992
- "description": "True when at least one surface needs anchors.colors.gradientStops: its treatment is gradient. Written as a double negative — not every surface avoids it — because JSON Schema can say 'every property matches' but has no 'some property matches'. It also avoids naming the surfaces, so adding one needs no edit here.",
1083
+ "description": "True when at least one surface needs anchors.colors.gradientStops: its treatment is gradient and its gradientShape has no stops of its own. Written as a double negative — not every surface avoids it — because JSON Schema can say 'every property matches' but has no 'some property matches'. It also avoids naming the surfaces, so adding one needs no edit here.",
993
1084
  "required": [
994
1085
  "surfaces"
995
1086
  ],
@@ -997,15 +1088,32 @@
997
1088
  "surfaces": {
998
1089
  "not": {
999
1090
  "additionalProperties": {
1000
- "properties": {
1001
- "treatment": {
1002
- "not": {
1003
- "enum": [
1004
- "gradient"
1005
- ]
1091
+ "anyOf": [
1092
+ {
1093
+ "properties": {
1094
+ "treatment": {
1095
+ "not": {
1096
+ "enum": [
1097
+ "gradient"
1098
+ ]
1099
+ }
1100
+ }
1101
+ }
1102
+ },
1103
+ {
1104
+ "required": [
1105
+ "gradientShape"
1106
+ ],
1107
+ "properties": {
1108
+ "gradientShape": {
1109
+ "required": [
1110
+ "stops"
1111
+ ]
1112
+ }
1006
1113
  }
1007
1114
  }
1008
- }
1115
+ ],
1116
+ "properties": {}
1009
1117
  }
1010
1118
  }
1011
1119
  }
@@ -104,7 +104,7 @@
104
104
  "treatment": "flat",
105
105
  "backgroundColor": {
106
106
  "source": "parent",
107
- "offset": 2,
107
+ "offset": 1,
108
108
  "from": "source",
109
109
  "invert": "never"
110
110
  },
@@ -104,7 +104,7 @@
104
104
  "treatment": "flat",
105
105
  "backgroundColor": {
106
106
  "source": "parent",
107
- "offset": 2,
107
+ "offset": 1,
108
108
  "from": "source",
109
109
  "invert": "never"
110
110
  },
@@ -101,7 +101,7 @@
101
101
  "treatment": "flat",
102
102
  "backgroundColor": {
103
103
  "source": "anchors.colors.pageBackground",
104
- "offset": 2,
104
+ "offset": 1,
105
105
  "from": "source",
106
106
  "invert": "never"
107
107
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine-DHDkDPaV.js","names":[],"sources":["../src/brandTokens.ts","../src/private/engine/constants/color.ts","../src/private/engine/scale.ts","../src/private/engine/anchors.ts","../src/private/engine/rules/border.ts","../src/private/engine/constants/elevation.ts","../src/private/engine/rules/elevation.ts","../src/private/engine/kebab.ts","../src/private/engine/surfaces.ts","../src/private/engine/slots.ts","../src/private/engine/treatments/flat.ts","../src/private/engine/constants/glass.ts","../src/private/engine/rules/text.ts","../src/private/engine/treatments/glassy.ts","../src/private/engine/constants/gradient.ts","../src/private/engine/treatments/gradient.ts","../src/private/engine/treatments/index.ts","../src/private/engine/rules/fill.ts","../src/private/engine/constants/motion.ts","../src/private/engine/rules/motion.ts","../src/private/engine/rules/panelInput.ts","../src/private/engine/constants/radius.ts","../src/private/engine/rules/radius.ts","../src/private/engine/constants/typography.ts","../src/private/engine/rules/typography.ts","../src/private/engine/contract.ts","../src/kaleidoscopeContract.ts","../src/private/engine/rules/invert.ts","../src/private/engine/evaluateSurfaces.ts","../src/private/engine/rules/texture.ts","../src/private/engine/support.ts","../src/getKaleidoscopeStyles.ts","../src/serializeKaleidoscopeStyles.ts"],"sourcesContent":["/** The Brand Kit tokens a Style document can reference, each as `$<name>`. */\nexport const BRAND_TOKEN_NAMES = [\n 'primaryColor',\n 'pageBackgroundColor',\n 'borderRadius',\n 'headingFontFamily',\n 'bodyFontFamily',\n 'buttonFontFamily',\n] as const;\nexport type BrandTokenName = (typeof BRAND_TOKEN_NAMES)[number];\n\n/**\n * The Brand Kit values `getKaleidoscopeStyles()` resolves a Style against. Colors are CSS colors,\n * `borderRadius` is in pixels, and the font families are CSS `font-family` values.\n *\n * Every token is optional: a token the Style references but the Brand Kit leaves out takes its\n * {@link DEFAULT_BRAND_TOKENS | default}.\n */\nexport type BrandTokens = {\n readonly bodyFontFamily?: string;\n readonly borderRadius?: number;\n readonly buttonFontFamily?: string;\n readonly headingFontFamily?: string;\n readonly pageBackgroundColor?: string;\n readonly primaryColor?: string;\n};\n\n/** What a missing Brand Kit token falls back to: Wistia's own brand. */\nexport const DEFAULT_BRAND_TOKENS: Required<BrandTokens> = {\n primaryColor: '#2949e5',\n pageBackgroundColor: '#ffffff',\n borderRadius: 20,\n headingFontFamily: 'GT Walsheim',\n bodyFontFamily: 'Inter',\n buttonFontFamily: 'Inter',\n};\n","import type { ColorRelationship } from '../../../styleVocabulary';\nimport { colorContrastRatiosByShape } from '../../../colorContrastRatiosByShape';\n\n/** Degrees a `relation` turns a hue, measured around the Lab a/b plane. Placeholder. */\nexport const RELATION_HUE_DEGREES = {\n same: 0,\n analogous: 30,\n triad: 120,\n complementary: 180,\n} satisfies Record<ColorRelationship, number>;\n\n/** Contrast below which a flat fill is pushed one more step from its parent. Placeholder. */\nexport const SEPARATION_MIN_CONTRAST = 1.1;\n\n/** WCAG non-text contrast: below this a fill does not read as a shape against its parent. */\nexport const INVERT_BELOW_CONTRAST = colorContrastRatiosByShape.nonText;\n\n/** How far low-emphasis text fades from the surface's text color. Placeholder. */\nexport const LOW_EMPHASIS_TEXT_ALPHA = 0.7;\n\n/** How far a hover fill must sit from the resting fill and the parent to be seen. */\nexport const HOVER_MIN_CONTRAST = 1.1;\n","import type { BrandedColorScale } from '../buildBrandedColorScale';\nimport { Color } from '../../Color';\nimport { getColorLightnessClassification } from '../../getColorLightnessClassification';\nimport { buildBrandedColorScale } from '../buildBrandedColorScale';\nimport { clamp } from '../clamp';\n\nexport type Scale = BrandedColorScale;\n\nconst MAX_CACHED_SCALES = 600;\nconst scaleCache = new Map<string, Scale>();\n\n/** The branded scale through `color`, cached because every surface of every Style asks for it. */\nexport const scaleOf = (color: Color): Scale => {\n const hex = color.toHex();\n let scale = scaleCache.get(hex);\n\n if (scale === undefined) {\n if (scaleCache.size >= MAX_CACHED_SCALES) {\n scaleCache.clear();\n }\n\n scale = buildBrandedColorScale(new Color(hex));\n scaleCache.set(hex, scale);\n }\n\n return scale;\n};\n\nconst lastStep = (scale: Scale): number => scale.steps - 1;\n\nexport const stepAt = (scale: Scale, index: number): Color =>\n scale.atStep(clamp(index, 0, lastStep(scale)));\n\nconst nearestStep = (scale: Scale, color: Color): number =>\n clamp(Math.round(scale.stepOf(color)), 0, lastStep(scale));\n\n/**\n * `offset` steps along `scale` from `color`, away from its lightness: a dark color steps lighter,\n * and a light or midtone one steps darker. The color decides, not its place on the scale, so a\n * page steps the same way whatever the brand.\n */\nexport const stepAlong = (scale: Scale, color: Color, offset: number): Color => {\n const position = nearestStep(scale, color);\n const lightness = getColorLightnessClassification(color);\n const direction = lightness === 'dark' || lightness === 'veryDark' ? -1 : 1;\n\n return stepAt(scale, position + direction * offset);\n};\n\nexport const stepFrom = (color: Color, offset: number): Color =>\n stepAlong(scaleOf(color), color, offset);\n\n/**\n * `offset` steps from `color` along its scale, away from `text`, so their contrast grows; a negative\n * offset steps towards it. A color with no room left on that side steps the other way, so it still\n * visibly changes.\n */\nexport const stepAwayFrom = (color: Color, text: Color, offset: number): Color => {\n const scale = scaleOf(color);\n const position = nearestStep(scale, color);\n const away = position + (text.luminance() > color.luminance() ? offset : -offset);\n\n return stepAt(scale, away >= 0 && away <= lastStep(scale) ? away : position * 2 - away);\n};\n","import type { BrandTokens } from '../../brandTokens';\nimport type {\n BrandKitTokenRef,\n Dimension,\n FontAnchorRef,\n SingleColor,\n SingleColorAnchorName,\n SingleColorAnchorRef,\n StyleDocument,\n} from '../../styleVocabulary';\nimport type { Scale } from './scale';\nimport { BRAND_TOKEN_NAMES, DEFAULT_BRAND_TOKENS } from '../../brandTokens';\nimport { Color } from '../../Color';\nimport { getBrandDarkBackgroundColor } from '../../getBrandDarkBackgroundColor';\nimport { getBrandLightBackgroundColor } from '../../getBrandLightBackgroundColor';\nimport { isOneOf } from '../guards';\nimport { RELATION_HUE_DEGREES } from './constants/color';\nimport { scaleOf } from './scale';\n\n/** A Style document's anchors, resolved once against the Brand Kit. */\nexport type ResolvedAnchors = {\n readonly borderRadius: number;\n readonly colors: Readonly<Record<SingleColorAnchorName, Color | null>>;\n readonly dimension: (value: Dimension) => number;\n readonly fonts: Readonly<Record<FontAnchorRef, string>>;\n /** `anchors.colors.gradientStops`, when the Style declares them. */\n readonly gradientStops: readonly Color[] | null;\n /** For an anchor toned from a token, the token's own scale, so stepping keeps its hue. */\n readonly scales: Readonly<Record<SingleColorAnchorName, Scale | null>>;\n readonly tokens: BrandTokens;\n};\n\nconst isTokenRef = (value: string): value is BrandKitTokenRef => value.startsWith('$');\n\n/** A token the Brand Kit leaves out takes its default; a token no Brand Kit has is an error. */\nconst tokenValue = (tokens: BrandTokens, ref: BrandKitTokenRef): number | string => {\n const name = ref.slice(1);\n\n if (!isOneOf(BRAND_TOKEN_NAMES, name)) {\n throw new Error(`${ref} is not a Brand Kit token`);\n }\n\n return tokens[name] ?? DEFAULT_BRAND_TOKENS[name];\n};\n\nconst tokenColor = (tokens: BrandTokens, ref: BrandKitTokenRef): Color =>\n new Color(String(tokenValue(tokens, ref)));\n\n/** Turns a hue around the Lab a/b plane. */\nconst rotateHue = (color: Color, degrees: number): Color => {\n if (degrees === 0) {\n return color;\n }\n\n const lab = color.toLab();\n const radians = (degrees * Math.PI) / 180;\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n\n return Color.fromLab(\n {\n lightness: lab.lightness,\n // oxlint-disable-next-line id-length -- the Lab axes are named a and b\n a: lab.a * cos - lab.b * sin,\n // oxlint-disable-next-line id-length -- the Lab axes are named a and b\n b: lab.a * sin + lab.b * cos,\n },\n color.a,\n );\n};\n\nexport const resolveSingleColor = (value: SingleColor, tokens: BrandTokens): Color => {\n if (typeof value === 'string') {\n return isTokenRef(value) ? tokenColor(tokens, value) : new Color(value);\n }\n\n const related = rotateHue(\n tokenColor(tokens, value.from),\n RELATION_HUE_DEGREES[value.relation ?? 'same'],\n );\n\n if (value.tone === 'dark') {\n return getBrandDarkBackgroundColor(related);\n }\n\n if (value.tone === 'light') {\n return getBrandLightBackgroundColor(related);\n }\n\n return related;\n};\n\n/**\n * A toned anchor is a point on its token's scale, so stepping from it should walk that scale.\n * Rebuilding a scale from a pale tone would keep almost none of the brand's hue.\n */\nconst scaleBeforeTone = (value: SingleColor | undefined, tokens: BrandTokens): Scale | null => {\n if (value === undefined || typeof value === 'string' || value.tone === undefined) {\n return null;\n }\n\n return scaleOf(\n rotateHue(tokenColor(tokens, value.from), RELATION_HUE_DEGREES[value.relation ?? 'same']),\n );\n};\n\nconst fontFrom = (value: string, tokens: BrandTokens): string =>\n isTokenRef(value) ? String(tokenValue(tokens, value)) : value;\n\nexport const resolveAnchors = (style: StyleDocument, tokens: BrandTokens): ResolvedAnchors => {\n const { colors, dimensions, fonts } = style.anchors;\n const dimension = (value: Dimension): number =>\n typeof value === 'number' ? value : Number(tokenValue(tokens, value));\n\n return {\n tokens,\n dimension,\n borderRadius: dimension(dimensions.borderRadius),\n colors: {\n pageBackground: resolveSingleColor(colors.pageBackground, tokens),\n primary: resolveSingleColor(colors.primary, tokens),\n ground: colors.ground === undefined ? null : resolveSingleColor(colors.ground, tokens),\n },\n gradientStops: colors.gradientStops?.map((stop) => resolveSingleColor(stop, tokens)) ?? null,\n scales: {\n pageBackground: scaleBeforeTone(colors.pageBackground, tokens),\n primary: scaleBeforeTone(colors.primary, tokens),\n ground: scaleBeforeTone(colors.ground, tokens),\n },\n fonts: {\n 'anchors.fonts.heading': fontFrom(fonts.heading, tokens),\n 'anchors.fonts.body': fontFrom(fonts.body, tokens),\n 'anchors.fonts.button': fontFrom(fonts.button, tokens),\n },\n };\n};\n\nconst ANCHOR_BY_REF: Readonly<Record<SingleColorAnchorRef, SingleColorAnchorName>> = {\n 'anchors.colors.pageBackground': 'pageBackground',\n 'anchors.colors.primary': 'primary',\n 'anchors.colors.ground': 'ground',\n};\n\nexport const anchorName = (ref: SingleColorAnchorRef): SingleColorAnchorName => ANCHOR_BY_REF[ref];\n\nexport const anchorColor = (ref: SingleColorAnchorRef, anchors: ResolvedAnchors): Color => {\n const color = anchors.colors[ANCHOR_BY_REF[ref]];\n\n if (color === null) {\n throw new Error(`${ref} is referenced but not declared`);\n }\n\n return color;\n};\n\n/** The scale stepping from an anchor walks: its token's if it's toned, or else its own. */\nexport const anchorScale = (ref: SingleColorAnchorRef, anchors: ResolvedAnchors): Scale =>\n anchors.scales[anchorName(ref)] ?? scaleOf(anchorColor(ref, anchors));\n","import type { Color } from '../../../Color';\nimport type { Border } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { FindGaps } from './types';\nimport { ORNAMENTAL_BORDER_STYLES, SURFACE_NAMES } from '../../../styleVocabulary';\nimport { anchorColor } from '../anchors';\nimport { stepFrom } from '../scale';\n\n/** The page sits on nothing and has no edge, so it carries no border. */\nexport const BORDER_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES.filter((name) => name !== 'page'),\n initialValues: {\n 'border-width': '0',\n 'border-style': 'none',\n 'border-color': 'transparent',\n },\n};\n\n/** A `width` of 0 keeps the initial values, so the surface has no edge whatever its source. */\nexport const borderSlots = (\n border: Border | undefined,\n solid: Color,\n anchors: ResolvedAnchors,\n): Slots => {\n if (border === undefined || border.width === 0) {\n return {};\n }\n\n const { offset, source, style, width } = border;\n const from = source === 'surface' ? solid : anchorColor(source, anchors);\n\n return {\n 'border-width': `${width}px`,\n 'border-style': style,\n 'border-color': stepFrom(from, offset).toHex(),\n };\n};\n\n/** An ornament is a drawn tile rather than a CSS border, and draws whatever the width. */\nexport const borderGaps: FindGaps = ({ border }) =>\n ORNAMENTAL_BORDER_STYLES.some((ornament) => ornament === border?.style)\n ? [`border.style: ${border?.style}`]\n : [];\n","import type { ElevationDepth, ElevationHardness } from '../../../styleVocabulary';\n\nexport type Shadow = {\n readonly alpha: number;\n readonly blur: number;\n readonly x: number;\n readonly y: number;\n};\n\n/**\n * The shadow each hardness casts at each depth. A pairing missing here is one the engine does not\n * resolve yet. `soft · low` is from the Phase 1 carousel sandbox.\n */\nexport const SHADOWS: Readonly<\n Partial<Record<ElevationHardness, Partial<Record<Exclude<ElevationDepth, 'none'>, Shadow>>>>\n> = {\n soft: { low: { x: 0, y: 8, blur: 32, alpha: 0.2 } },\n};\n","import type { Elevation } from '../../../styleVocabulary';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { FindGaps } from './types';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { SHADOWS } from '../constants/elevation';\n\nexport const ELEVATION_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'box-shadow': 'none' },\n};\n\n/** The elevation's shadow, if it casts one, with any layers the treatment draws after it. */\nexport const elevationSlots = (\n { depth, hardness }: Elevation,\n treatmentLayers: readonly string[] = [],\n): Slots => {\n const shadow = depth === 'none' ? undefined : SHADOWS[hardness]?.[depth];\n const layers = [\n ...(shadow === undefined\n ? []\n : [`${shadow.x}px ${shadow.y}px ${shadow.blur}px rgba(0, 0, 0, ${shadow.alpha})`]),\n ...treatmentLayers,\n ];\n\n return layers.length === 0 ? {} : { 'box-shadow': layers.join(', ') };\n};\n\nexport const elevationGaps: FindGaps = ({ elevation: { depth, hardness, source } }) => {\n if (depth === 'none') {\n return [];\n }\n\n return [\n ...(SHADOWS[hardness]?.[depth] === undefined ? [`elevation: ${hardness} ${depth}`] : []),\n ...(source === 'shade' ? [] : [`elevation.source: ${JSON.stringify(source)}`]),\n ];\n};\n","/** `buttonPrimary` → `button-primary`, as surface names appear in variable names. */\nexport const kebab = (name: string): string =>\n name.replaceAll(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);\n","import type { SurfaceName } from '../../styleVocabulary';\nimport { STACKABLE_ON, SURFACE_NAMES } from '../../styleVocabulary';\nimport { kebab } from './kebab';\n\nexport type SurfaceSpec = {\n /** Page, panel and card hold copy, so they carry heading and low-emphasis text; a button doesn't. */\n readonly holdsContent: boolean;\n /** Hover, focus and active states: only for surfaces a viewer acts on. */\n readonly interactive: boolean;\n /** Forms live only in panels, so only a panel carries input slots. */\n readonly mayContainForm: boolean;\n};\n\n/** What the engine knows about each surface beyond what a Style document says. */\nexport const SURFACES: Readonly<Record<SurfaceName, SurfaceSpec>> = {\n page: { holdsContent: true, interactive: false, mayContainForm: false },\n panel: { holdsContent: true, interactive: false, mayContainForm: true },\n card: { holdsContent: true, interactive: true, mayContainForm: false },\n buttonPrimary: { holdsContent: false, interactive: true, mayContainForm: false },\n buttonSecondary: { holdsContent: false, interactive: true, mayContainForm: false },\n};\n\n/**\n * One evaluation of a surface: the surface on its only parent, or once per parent for a surface\n * that can sit on several, named `<surface>-on-<parent>`.\n */\nexport type SurfaceGroup = {\n readonly parent: SurfaceName | null;\n readonly prefix: string;\n readonly surface: SurfaceName;\n};\n\n/** Every surface group, parents before the surfaces that sit on them. */\nexport const SURFACE_GROUPS: readonly SurfaceGroup[] = SURFACE_NAMES.flatMap((surface) => {\n const parents = STACKABLE_ON[surface];\n\n if (parents.length <= 1) {\n return [{ surface, parent: parents[0] ?? null, prefix: kebab(surface) }];\n }\n\n return parents.map((parent) => ({\n surface,\n parent,\n prefix: `${kebab(surface)}-on-${kebab(parent)}`,\n }));\n});\n","import type { SurfaceName, TypeRoleName } from '../../styleVocabulary';\nimport type { SurfaceSpec } from './surfaces';\nimport { SURFACE_NAMES } from '../../styleVocabulary';\nimport { SURFACES } from './surfaces';\n\nexport const VARIABLE_PREFIX = '--wistia-kaleidoscope-';\nexport type VariableName = `${typeof VARIABLE_PREFIX}${string}`;\n\n/** Slot name → CSS value, for one surface group or one type role. */\nexport type Slots = Readonly<Record<string, string>>;\n\n/**\n * One rule's share of the contract: the slots it emits on each surface it applies to, with the\n * value each takes when a Style doesn't use the rule — the CSS initial value of the property the\n * slot feeds, or the value that draws nothing where the property has no fixed one.\n */\nexport type SurfaceSlotFragment = {\n readonly initialValues: Slots;\n readonly surfaces: readonly SurfaceName[];\n};\n\nexport const surfacesWhere = (flag: keyof SurfaceSpec): readonly SurfaceName[] =>\n SURFACE_NAMES.filter((name) => SURFACES[name][flag]);\n\nexport const surfaceVariable = (prefix: string, slot: string): VariableName =>\n `${VARIABLE_PREFIX}${prefix}-${slot}`;\n\nexport const typeVariable = (role: TypeRoleName, slot: string): VariableName =>\n `${VARIABLE_PREFIX}type-${role}-${slot}`;\n","import type { Scale } from '../scale';\nimport type { ResolvedFill, TreatmentFn, TreatmentResult } from './types';\nimport { Color } from '../../../Color';\nimport { anchorColor, anchorScale } from '../anchors';\nimport { HOVER_MIN_CONTRAST, SEPARATION_MIN_CONTRAST } from '../constants/color';\nimport { scaleOf, stepAlong, stepAwayFrom } from '../scale';\n\n/**\n * A step away from the text, unless that lands too close to the resting fill or the parent to be\n * seen. Then a step towards it, which relies on the hover text staying readable.\n */\nconst hoverFill = (solid: Color, text: Color, parent: ResolvedFill | null): Color => {\n // Measured as the hex it renders as, because a step can sit right on the threshold.\n const away = new Color(stepAwayFrom(solid, text, 1).toHex());\n const isVisible =\n away.contrast(solid) >= HOVER_MIN_CONTRAST &&\n (parent === null || away.contrast(parent.solid) >= HOVER_MIN_CONTRAST);\n\n return isVisible ? away : stepAwayFrom(solid, text, -1);\n};\n\n/** The slots that paint `solid` as a flat fill on `parent`. */\nexport const flatFill = (\n solid: Color,\n scale: Scale | null,\n parent: ResolvedFill | null,\n): TreatmentResult => ({\n solid,\n scale,\n fill: { 'background-color': solid.toHex() },\n hover: (text) => {\n const solidHover = hoverFill(solid, text, parent);\n\n return { solid: solidHover, slots: { 'background-color-hover': solidHover.toHex() } };\n },\n});\n\n/** A single opaque color, stepped along its source's scale. */\nexport const flat: TreatmentFn = ({ anchors, parent, settings }) => {\n const { from, offset, source } = settings.backgroundColor;\n const sourceColor =\n source === 'parent'\n ? (parent?.solid ?? anchorColor('anchors.colors.pageBackground', anchors))\n : anchorColor(source, anchors);\n const scale =\n source === 'parent' ? (parent?.scale ?? scaleOf(sourceColor)) : anchorScale(source, anchors);\n const start = from === 'parent' && parent !== null ? parent.solid : sourceColor;\n let solid = stepAlong(scale, start, offset);\n\n if (parent !== null && solid.contrast(parent.solid) < SEPARATION_MIN_CONTRAST) {\n solid = stepAlong(scale, start, offset + 1);\n }\n\n return flatFill(solid, scale, parent);\n};\n","import type { ColorTone, SurfaceName } from '../../../styleVocabulary';\n\n/** One size of glass. */\nexport type GlassTier = {\n readonly backdropFilter: string | null;\n /** Geometry and alpha of the fainter light where the highlights' light leaves, at the bottom right. */\n readonly counterEdge: readonly [geometry: string, alpha: number];\n readonly edgeAlpha: number;\n /** Geometry of the edge. It's blurred, because an unblurred edge renders as a hard outline. */\n readonly edge: string;\n /** How opaque the ground is, over the blurred backdrop. */\n readonly groundAlpha: number;\n readonly hoverGroundAlpha: number;\n /** Geometry, color and alpha of an inner shadow, for tiers that have one. */\n readonly innerShade: readonly [geometry: string, color: string, alpha: number] | null;\n /** A control's ground is its text color, rather than the surface's source. */\n readonly liftsParent: boolean;\n /** Alphas of the sheen's three stops, at `GLASS_SHEEN_STOPS`. */\n readonly sheen: readonly [number, number, number];\n readonly specular: readonly string[];\n readonly specularAlpha: number;\n};\n\nexport const GLASS_LIGHT_COLOR = '#ffffff';\nconst GLASS_SHADE_COLOR = '#000000';\nexport const GLASS_SHEEN_ANGLE = '135deg';\nexport const GLASS_SHEEN_STOPS = [0, 45, 100] as const;\n\n/** Panel inputs are the panel's text color at these alphas. Placeholders. */\nexport const GLASS_INPUT_ALPHA = 0.08;\nexport const GLASS_INPUT_FOCUS_ALPHA = 0.2;\n\nconst BACKDROP_FILTER = 'blur(10px) saturate(180%)';\n\n/** From the Phase 1 carousel sandbox. */\nconst DARK_CONTAINER: GlassTier = {\n backdropFilter: BACKDROP_FILTER,\n counterEdge: ['inset -1px -1px 1px 0', 0.13],\n edge: 'inset 0 0 3px 0',\n edgeAlpha: 0.3,\n groundAlpha: 0.25,\n hoverGroundAlpha: 0.25,\n innerShade: ['inset 0 4px 20px', GLASS_SHADE_COLOR, 0.1],\n liftsParent: false,\n sheen: [0.25, 0.1, 0.02],\n specular: ['inset 0 7px 2px -6px', 'inset 10px 6px 3px -10px'],\n specularAlpha: 0.55,\n};\n\n/**\n * The design file gives panel and card one fill; a card has a finer edge and a denser hover. A\n * shadow can't scale with its element, so the smaller tiers keep one soft highlight.\n */\nconst DARK_CARD: GlassTier = {\n backdropFilter: BACKDROP_FILTER,\n counterEdge: ['inset -1px -1px 1px 0', 0.11],\n edge: 'inset 0 0 2px 0',\n edgeAlpha: 0.28,\n groundAlpha: 0.25,\n hoverGroundAlpha: 0.37,\n innerShade: ['inset 0 4px 20px', GLASS_SHADE_COLOR, 0.1],\n liftsParent: false,\n sheen: [0.2, 0.08, 0.02],\n specular: ['inset 0 1px 2px 0'],\n specularAlpha: 0.25,\n};\n\nconst DARK_CONTROL: GlassTier = {\n backdropFilter: null,\n counterEdge: ['inset -1px -1px 1px 0', 0.09],\n edge: 'inset 0 0 2px 0',\n edgeAlpha: 0.22,\n groundAlpha: 0.08,\n hoverGroundAlpha: 0.25,\n innerShade: null,\n liftsParent: true,\n sheen: [0.15, 0.08, 0.02],\n specular: ['inset 0 1px 2px 0'],\n specularAlpha: 0.2,\n};\n\n/** The design file has no light glass. A denser ground, and every shadow layer is white. */\nconst LIGHT_CONTAINER: GlassTier = {\n ...DARK_CONTAINER,\n counterEdge: ['inset -1px -1px 1px 0', 0.7],\n edge: 'inset 1px 1px 0 0',\n edgeAlpha: 0.75,\n groundAlpha: 0.45,\n hoverGroundAlpha: 0.45,\n innerShade: ['inset 0 4px 20px', GLASS_LIGHT_COLOR, 0.35],\n specularAlpha: 0.9,\n};\n\nconst LIGHT_CARD: GlassTier = {\n ...DARK_CARD,\n counterEdge: ['inset -1px -1px 1px 0', 0.6],\n edgeAlpha: 0.85,\n groundAlpha: 0.45,\n hoverGroundAlpha: 0.62,\n innerShade: ['inset 0 4px 20px', GLASS_LIGHT_COLOR, 0.3],\n specularAlpha: 0.8,\n};\n\nconst LIGHT_CONTROL: GlassTier = {\n ...DARK_CONTROL,\n counterEdge: ['inset -1px -1px 1px 0', 0.45],\n edgeAlpha: 0.7,\n groundAlpha: 0.35,\n hoverGroundAlpha: 0.6,\n liftsParent: false,\n specularAlpha: 0.5,\n};\n\nexport const GLASS_TIERS: Readonly<Record<ColorTone, Readonly<Record<SurfaceName, GlassTier>>>> = {\n dark: {\n page: DARK_CONTAINER,\n panel: DARK_CONTAINER,\n card: DARK_CARD,\n buttonPrimary: DARK_CONTROL,\n buttonSecondary: DARK_CONTROL,\n },\n light: {\n page: LIGHT_CONTAINER,\n panel: LIGHT_CONTAINER,\n card: LIGHT_CARD,\n buttonPrimary: LIGHT_CONTROL,\n buttonSecondary: LIGHT_CONTROL,\n },\n};\n\n/** Glass over a ground anchor darker than this is dark glass. */\nexport const GLASS_DARK_BELOW_LUMINANCE = 0.2;\n","import type {\n LiteralColor,\n SurfaceName,\n TextColor,\n TextColorPreference,\n} from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { FindGaps } from './types';\nimport { adjustColorForProperContrast } from '../../../adjustColorForProperContrast';\nimport { Color } from '../../../Color';\nimport { getBestColorForText } from '../../../getBestColorForText';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { anchorColor, anchorScale } from '../anchors';\nimport { LOW_EMPHASIS_TEXT_ALPHA } from '../constants/color';\nimport { stepAlong } from '../scale';\nimport { surfacesWhere } from '../slots';\nimport { SURFACES } from '../surfaces';\n\nexport const TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'text-color': 'canvastext' },\n};\n\nexport const CONTENT_TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('holdsContent'),\n initialValues: {\n 'heading-text-color': 'canvastext',\n 'low-emphasis-text-color': 'canvastext',\n },\n};\n\nexport const HOVER_TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('interactive'),\n initialValues: { 'text-color-hover': 'canvastext' },\n};\n\nexport const CONTENT_HOVER_TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('interactive').filter((surface) => SURFACES[surface].holdsContent),\n initialValues: {\n 'heading-text-color-hover': 'canvastext',\n 'low-emphasis-text-color-hover': 'canvastext',\n },\n};\n\nconst isPreference = (textColor: TextColor): textColor is TextColorPreference =>\n typeof textColor === 'object' && 'source' in textColor;\n\nconst isLiteral = (textColor: TextColor): textColor is LiteralColor =>\n typeof textColor === 'string' && (textColor.startsWith('#') || textColor.startsWith('rgb'));\n\n/**\n * `derive` allows text color to be calculated by the engine so we can pick a color with appropriate contrast.\n * A preferred color starts from a reference point (a color anchor) and adjusts it until it meets required contrast rule\n * A literal is used as written, with no contrast guarantee.\n */\nexport const resolveTextColor = (\n textColor: TextColor,\n solid: Color,\n anchors: ResolvedAnchors,\n): Color => {\n if (isLiteral(textColor)) {\n return new Color(textColor);\n }\n\n if (!isPreference(textColor)) {\n return getBestColorForText({ backgroundColor: solid });\n }\n\n const { offset, source } = textColor;\n const preferred = stepAlong(anchorScale(source, anchors), anchorColor(source, anchors), offset);\n\n return adjustColorForProperContrast({ foregroundColor: preferred, backgroundColor: solid });\n};\n\nexport const textSlots = (surface: SurfaceName, text: Color): Slots => ({\n 'text-color': text.toHex(),\n ...(SURFACES[surface].holdsContent\n ? {\n 'heading-text-color': text.toHex(),\n 'low-emphasis-text-color': text.withAlpha(LOW_EMPHASIS_TEXT_ALPHA).toRgba(),\n }\n : {}),\n});\n\n/**\n * The same text slots with a `-hover` suffix, moved only as far as the hovered fill needs. A literal\n * stays as written.\n */\nexport const hoverTextSlots = (\n surface: SurfaceName,\n textColor: TextColor,\n text: Color,\n solidHover: Color,\n): Slots => {\n const readable = isLiteral(textColor)\n ? text\n : adjustColorForProperContrast({ foregroundColor: text, backgroundColor: solidHover });\n\n return Object.fromEntries(\n Object.entries(textSlots(surface, readable)).map(([slot, value]) => [`${slot}-hover`, value]),\n );\n};\n\nexport const textGaps: FindGaps = ({ textColor }) =>\n textColor === 'derive' || isPreference(textColor) || isLiteral(textColor)\n ? []\n : [`textColor: ${JSON.stringify(textColor)}`];\n","import type { GlassTier } from '../constants/glass';\nimport type { TreatmentFn } from './types';\nimport { Color } from '../../../Color';\nimport { anchorColor, anchorName } from '../anchors';\nimport {\n GLASS_DARK_BELOW_LUMINANCE,\n GLASS_INPUT_ALPHA,\n GLASS_INPUT_FOCUS_ALPHA,\n GLASS_LIGHT_COLOR,\n GLASS_SHEEN_ANGLE,\n GLASS_SHEEN_STOPS,\n GLASS_TIERS,\n} from '../constants/glass';\nimport { resolveTextColor } from '../rules/text';\nimport { scaleOf, stepAlong } from '../scale';\n\nconst LIGHT = new Color(GLASS_LIGHT_COLOR);\n\n/** `top` laid over `under`, flattened to the opaque color the eye sees. */\nconst composite = (top: Color, under: Color): Color =>\n new Color([\n top.r * top.a + under.r * (1 - top.a),\n top.g * top.a + under.g * (1 - top.a),\n top.b * top.a + under.b * (1 - top.a),\n 1,\n ]);\n\nconst sheen = ({ sheen: alphas }: GlassTier): string => {\n const stops = alphas.map(\n (alpha, index) => `${LIGHT.withAlpha(alpha).toRgba()} ${GLASS_SHEEN_STOPS[index] ?? 100}%`,\n );\n\n return `linear-gradient(${GLASS_SHEEN_ANGLE}, ${stops.join(', ')})`;\n};\n\n/** Inner shade, then the edge, then the specular highlights and the fainter edge opposite them. */\nconst glassShadowLayers = (tier: GlassTier): readonly string[] => [\n ...(tier.innerShade === null\n ? []\n : [\n `${tier.innerShade[0]} ${new Color(tier.innerShade[1]).withAlpha(tier.innerShade[2]).toRgba()}`,\n ]),\n `${tier.edge} ${LIGHT.withAlpha(tier.edgeAlpha).toRgba()}`,\n ...tier.specular.map((geometry) => `${geometry} ${LIGHT.withAlpha(tier.specularAlpha).toRgba()}`),\n `${tier.counterEdge[0]} ${LIGHT.withAlpha(tier.counterEdge[1]).toRgba()}`,\n];\n\n/**\n * A translucent ground under a sheen. `solid` is that ground flattened over the parent, so text and\n * children resolve against what the eye sees.\n */\nexport const glassy: TreatmentFn = ({ anchors, parent, settings, surface }) => {\n const { offset, source } = settings.backgroundColor;\n const sourceColor =\n source === 'parent'\n ? (parent?.solid ?? anchorColor('anchors.colors.pageBackground', anchors))\n : anchorColor(source, anchors);\n const tone =\n (anchors.colors.ground ?? sourceColor).luminance() < GLASS_DARK_BELOW_LUMINANCE\n ? 'dark'\n : 'light';\n const tier = GLASS_TIERS[tone][surface];\n const inherited =\n source === 'parent' ? (parent?.scale ?? null) : anchors.scales[anchorName(source)];\n const base = stepAlong(inherited ?? scaleOf(sourceColor), sourceColor, offset);\n const under = parent?.solid ?? base;\n const ground = (\n tier.liftsParent ? resolveTextColor(settings.textColor, under, anchors) : base\n ).withAlpha(tier.groundAlpha);\n const image = sheen(tier);\n\n return {\n solid: composite(ground, under),\n scale: null,\n fill: {\n 'background-color': ground.toRgba(),\n 'background-image': image,\n ...(tier.backdropFilter === null ? {} : { 'backdrop-filter': tier.backdropFilter }),\n },\n hover: () => {\n const groundHover = base.withAlpha(tier.hoverGroundAlpha);\n\n return {\n solid: composite(groundHover, under),\n slots: { 'background-color-hover': groundHover.toRgba(), 'background-image-hover': image },\n };\n },\n tintedBy: (text) => ({\n inputFills: {\n 'input-background-color': text.withAlpha(GLASS_INPUT_ALPHA).toRgba(),\n 'input-background-color-focus': text.withAlpha(GLASS_INPUT_FOCUS_ALPHA).toRgba(),\n },\n shadowLayers: glassShadowLayers(tier),\n }),\n };\n};\n","/**\n * `glows`: soft orbs in the stop colors over the surface's own fill. A dark fill swallows them, so\n * there they are stronger and fuller. Placeholder.\n */\nexport const GLOWS = {\n alpha: 0.42,\n size: '62% 56%',\n fadeStop: 70,\n darkFillLuminance: 0.2,\n dark: { alpha: 0.72, size: '72% 66%', midAlphaFactor: 0.6, midStop: 38, fadeStop: 72 },\n positions: ['14% 16%', '86% 22%', '62% 92%', '10% 80%', '48% 50%', '94% 66%'],\n} as const;\n","import type { Color } from '../../../Color';\nimport type { FindGaps } from '../rules/types';\nimport type { TreatmentFn } from './types';\nimport { anchorColor, anchorName } from '../anchors';\nimport { GLOWS } from '../constants/gradient';\nimport { scaleOf, stepAlong } from '../scale';\n\nconst glowLayer = (stop: Color, position: string, onDark: boolean): string => {\n if (onDark) {\n const { alpha, fadeStop, midAlphaFactor, midStop, size } = GLOWS.dark;\n\n return `radial-gradient(${size} at ${position}, ${stop.withAlpha(alpha).toRgba()} 0%, ${stop.withAlpha(alpha * midAlphaFactor).toRgba()} ${midStop}%, transparent ${fadeStop}%)`;\n }\n\n return `radial-gradient(${GLOWS.size} at ${position}, ${stop.withAlpha(GLOWS.alpha).toRgba()} 0%, transparent ${GLOWS.fadeStop}%)`;\n};\n\nconst glowsImage = (stops: readonly Color[], fill: Color): string => {\n const onDark = fill.luminance() < GLOWS.darkFillLuminance;\n\n return stops\n .map((stop, index) =>\n glowLayer(stop, GLOWS.positions[index % GLOWS.positions.length] ?? 'center', onDark),\n )\n .join(', ');\n};\n\n/**\n * Gradient layers over the surface's own fill. The fill is `solid`: it is what text is solved\n * against, so nothing derives a color from the layers moving over it.\n */\nexport const gradient: TreatmentFn = ({ anchors, parent, settings }) => {\n const { gradientStops } = anchors;\n\n if (gradientStops === null) {\n throw new Error('anchors.colors.gradientStops is referenced but not declared');\n }\n\n const { from, offset, source } = settings.backgroundColor;\n const sourceColor =\n source === 'parent'\n ? (parent?.solid ?? anchorColor('anchors.colors.pageBackground', anchors))\n : anchorColor(source, anchors);\n const inherited =\n source === 'parent' ? (parent?.scale ?? null) : anchors.scales[anchorName(source)];\n const scale = inherited ?? scaleOf(sourceColor);\n const start = from === 'parent' && parent !== null ? parent.solid : sourceColor;\n const solid = stepAlong(scale, start, offset);\n const image = glowsImage(gradientStops, solid);\n\n return {\n solid,\n scale,\n fill: { 'background-color': solid.toHex(), 'background-image': image },\n hover: () => ({\n solid,\n slots: { 'background-color-hover': solid.toHex(), 'background-image-hover': image },\n }),\n };\n};\n\n/** Only `glows` so far. */\nexport const gradientGaps: FindGaps = ({ gradientShape }) =>\n gradientShape === undefined || gradientShape.kind === 'glows'\n ? []\n : [`gradientShape: ${gradientShape.kind}`];\n","import type { Treatment } from '../../../styleVocabulary';\nimport type { TreatmentFn } from './types';\nimport { flat } from './flat';\nimport { glassy } from './glassy';\nimport { gradient } from './gradient';\n\n/** The treatments the engine can paint. A Style using any other is not supported yet. */\nexport const TREATMENT_FUNCTIONS: Readonly<Partial<Record<Treatment, TreatmentFn>>> = {\n flat,\n glassy,\n gradient,\n};\n","import type { SurfaceSlotFragment } from '../slots';\nimport type { AnySurfaceSettings, FindGaps } from './types';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { surfacesWhere } from '../slots';\nimport { TREATMENT_FUNCTIONS } from '../treatments';\n\n/**\n * A surface's fill. `background-image` holds layers drawn over `background-color` — glass sheens,\n * gradients — and `backdrop-filter` blurs what is behind a translucent fill.\n */\nexport const FILL_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: {\n 'background-color': 'transparent',\n 'background-image': 'none',\n 'backdrop-filter': 'none',\n },\n};\n\nexport const HOVER_FILL_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('interactive'),\n initialValues: {\n 'background-color-hover': 'transparent',\n 'background-image-hover': 'none',\n },\n};\n\n/** Glass has a fixed ground that its parent shows through, so it can't count from its parent. */\nconst fromGaps = ({\n backgroundColor: { from },\n treatment,\n}: AnySurfaceSettings): readonly string[] =>\n treatment === 'glassy' && from === 'parent' ? ['backgroundColor.from: parent'] : [];\n\n/** Inverting repaints a surface as a flat fill, so no other treatment can invert. */\nconst invertGaps = ({\n backgroundColor: { invert },\n treatment,\n}: AnySurfaceSettings): readonly string[] =>\n treatment === 'flat' || invert === 'never' ? [] : [`backgroundColor.invert: ${invert}`];\n\nexport const fillGaps: FindGaps = (settings) => {\n const { treatment } = settings;\n\n return [\n ...(Object.hasOwn(TREATMENT_FUNCTIONS, treatment) ? [] : [`treatment: ${treatment}`]),\n ...fromGaps(settings),\n ...invertGaps(settings),\n ];\n};\n","import type { MotionSpeed, Transition } from '../../../styleVocabulary';\n\n/** How long a surface takes to move between states. Placeholder. */\nexport const TRANSITION_DURATIONS = {\n none: null,\n quick: '120ms',\n smooth: '240ms',\n} satisfies Record<Transition, string | null>;\n\n/** The properties a state change animates. */\nexport const TRANSITIONED_PROPERTIES = ['background-color', 'box-shadow', 'border-color', 'color'];\n\nexport const TRANSITION_EASING = 'ease';\n\n/** How long one drift takes per speed. */\nexport const DRIFT_DURATIONS = {\n slow: '10s',\n medium: '6s',\n fast: '3s',\n} satisfies Record<MotionSpeed, string>;\n","import type { Motion } from '../../../styleVocabulary';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { FindGaps } from './types';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport {\n DRIFT_DURATIONS,\n TRANSITION_DURATIONS,\n TRANSITION_EASING,\n TRANSITIONED_PROPERTIES,\n} from '../constants/motion';\n\nexport const MOTION_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { transition: 'none' },\n};\n\n/**\n * Only how long a page's drift takes. The contract is CSS variables only, so each consumer writes\n * its own `@keyframes` and the layer that moves. `0s` means the page is still. Other surfaces have\n * no animation slots until a Style first animates one.\n */\nexport const PAGE_ANIMATION_SLOTS: SurfaceSlotFragment = {\n surfaces: ['page'],\n initialValues: { 'animation-duration': '0s' },\n};\n\nconst transitionSlots = (transition: Motion['transition']): Slots => {\n const duration = TRANSITION_DURATIONS[transition];\n\n if (duration === null) {\n return {};\n }\n\n return {\n transition: TRANSITIONED_PROPERTIES.map(\n (property) => `${property} ${duration} ${TRANSITION_EASING}`,\n ).join(', '),\n };\n};\n\n/** `motionGaps` only lets `drift` through on the page, so this never names another surface's slot. */\nconst driftSlots = ({ ambient, speed }: Motion): Slots =>\n ambient === 'drift' ? { 'animation-duration': DRIFT_DURATIONS[speed] } : {};\n\nexport const motionSlots = (motion: Motion): Slots => ({\n ...transitionSlots(motion.transition),\n ...driftSlots(motion),\n});\n\n/** Only the page drifts so far, and nothing pulses. */\nexport const motionGaps: FindGaps = ({ motion: { ambient } }, surface) =>\n ambient === 'none' || (ambient === 'drift' && surface === 'page')\n ? []\n : [`motion.ambient: ${ambient}`];\n","import type { Color } from '../../../Color';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport { anchorColor } from '../anchors';\nimport { stepFrom } from '../scale';\nimport { surfacesWhere } from '../slots';\n\n/** The form fields inside a panel. */\nexport const PANEL_INPUT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('mayContainForm'),\n initialValues: {\n 'input-background-color': 'transparent',\n 'input-background-color-focus': 'transparent',\n 'input-border-color-focus': 'transparent',\n },\n};\n\n/** Inputs step off the panel's fill unless given `fills`, and take the primary color when focused. */\nexport const panelInputSlots = (solid: Color, anchors: ResolvedAnchors, fills?: Slots): Slots => ({\n ...(fills ?? {\n 'input-background-color': stepFrom(solid, 1).toHex(),\n 'input-background-color-focus': stepFrom(solid, 2).toHex(),\n }),\n 'input-border-color-focus': anchorColor('anchors.colors.primary', anchors).toHex(),\n});\n","import type { SurfaceName } from '../../../styleVocabulary';\n\n/** How the radius anchor scales on each surface. Placeholder. */\nexport const RADIUS_FACTORS = {\n page: 0,\n panel: 1,\n card: 0.7,\n buttonPrimary: 0.5,\n buttonSecondary: 0.5,\n} satisfies Record<SurfaceName, number>;\n","import type { Radius, SurfaceName } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { RADIUS_FACTORS } from '../constants/radius';\n\nexport const RADIUS_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'border-radius': '0' },\n};\n\nexport const radiusSlots = (\n surface: SurfaceName,\n { source }: Radius,\n anchors: ResolvedAnchors,\n): Slots => ({\n 'border-radius':\n source === 'anchors.dimensions.borderRadius'\n ? `${Math.round(anchors.borderRadius * RADIUS_FACTORS[surface])}px`\n : `${anchors.dimension(source)}px`,\n});\n","/** Letter spacing for `case: upper`, which reads cramped at the spacing set for mixed case. */\nexport const UPPERCASE_LETTER_SPACING = '0.05em';\n","import type { StyleDocument } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { VariableName } from '../slots';\nimport { TYPE_ROLES } from '../../../styleVocabulary';\nimport { UPPERCASE_LETTER_SPACING } from '../constants/typography';\nimport { typeVariable } from '../slots';\n\n/**\n * `font-family` has no fixed initial value — it is up to the browser — so its unused value is the\n * generic family instead.\n */\nconst TYPE_INITIAL_VALUES = {\n 'font-family': 'sans-serif',\n 'font-size': 'medium',\n 'font-weight': 'normal',\n 'text-transform': 'none',\n 'letter-spacing': 'normal',\n} as const;\n\nexport const TYPOGRAPHY_CONTRACT: Readonly<Record<VariableName, string>> = Object.fromEntries(\n TYPE_ROLES.flatMap((role) =>\n Object.entries(TYPE_INITIAL_VALUES).map(([slot, value]) => [typeVariable(role, slot), value]),\n ),\n);\n\nexport const typographyVariables = (\n { typography }: StyleDocument,\n anchors: ResolvedAnchors,\n): Readonly<Record<VariableName, string>> =>\n Object.fromEntries(\n TYPE_ROLES.flatMap((role) => {\n const type = typography[role];\n const upper = type.case === 'upper';\n\n return [\n [typeVariable(role, 'font-family'), anchors.fonts[type.font]],\n [typeVariable(role, 'font-size'), `${type.fontSize}px`],\n [typeVariable(role, 'font-weight'), String(type.fontWeight)],\n [typeVariable(role, 'text-transform'), upper ? 'uppercase' : 'none'],\n [typeVariable(role, 'letter-spacing'), upper ? UPPERCASE_LETTER_SPACING : 'normal'],\n ];\n }),\n );\n","import type { SurfaceSlotFragment, VariableName } from './slots';\nimport { BORDER_SLOTS } from './rules/border';\nimport { ELEVATION_SLOTS } from './rules/elevation';\nimport { FILL_SLOTS, HOVER_FILL_SLOTS } from './rules/fill';\nimport { MOTION_SLOTS, PAGE_ANIMATION_SLOTS } from './rules/motion';\nimport { PANEL_INPUT_SLOTS } from './rules/panelInput';\nimport { RADIUS_SLOTS } from './rules/radius';\nimport {\n CONTENT_HOVER_TEXT_SLOTS,\n CONTENT_TEXT_SLOTS,\n HOVER_TEXT_SLOTS,\n TEXT_SLOTS,\n} from './rules/text';\nimport { TYPOGRAPHY_CONTRACT } from './rules/typography';\nimport { surfaceVariable } from './slots';\nimport { SURFACE_GROUPS } from './surfaces';\n\n/** Every rule's surface slots. A rule that adds slots adds its fragment here. */\nconst SURFACE_SLOT_FRAGMENTS: readonly SurfaceSlotFragment[] = [\n FILL_SLOTS,\n HOVER_FILL_SLOTS,\n TEXT_SLOTS,\n CONTENT_TEXT_SLOTS,\n HOVER_TEXT_SLOTS,\n CONTENT_HOVER_TEXT_SLOTS,\n PANEL_INPUT_SLOTS,\n BORDER_SLOTS,\n ELEVATION_SLOTS,\n RADIUS_SLOTS,\n MOTION_SLOTS,\n PAGE_ANIMATION_SLOTS,\n];\n\nconst surfaceContract = (): Readonly<Record<VariableName, string>> =>\n Object.fromEntries(\n SURFACE_GROUPS.flatMap(({ prefix, surface }) =>\n SURFACE_SLOT_FRAGMENTS.filter(({ surfaces }) => surfaces.includes(surface)).flatMap(\n ({ initialValues }) =>\n Object.entries(initialValues).map(([slot, value]) => [\n surfaceVariable(prefix, slot),\n value,\n ]),\n ),\n ),\n );\n\nexport const CONTRACT: Readonly<Record<VariableName, string>> = {\n ...surfaceContract(),\n ...TYPOGRAPHY_CONTRACT,\n};\n","import type { VariableName } from './private/engine/slots';\nimport { CONTRACT } from './private/engine/contract';\n\nexport { VARIABLE_PREFIX as KALEIDOSCOPE_VARIABLE_PREFIX } from './private/engine/slots';\n\n/** A `--wistia-kaleidoscope-*` custom property name. */\nexport type KaleidoscopeVariableName = VariableName;\n\n/**\n * The record `getKaleidoscopeStyles()` returns: every variable and its value. The type\n * only checks the `--wistia-kaleidoscope-` prefix, so a misspelled name still compiles. The names\n * themselves are defined by {@link KALEIDOSCOPE_CONTRACT} and pinned by its contract test.\n */\nexport type KaleidoscopeVariables = Readonly<Record<KaleidoscopeVariableName, string>>;\n\n/**\n * Every variable the engine emits, with the value it takes when a Style doesn't use the rule\n * behind it: the CSS initial value of the property it feeds, or the value that draws nothing.\n * Every Style emits exactly these names, so embeds and hosted pages can rely on each one.\n *\n * Surface variables are `--wistia-kaleidoscope-<surface>-<slot>`. A surface that can sit on several\n * parents is emitted once per parent, as `<surface>-on-<parent>`: `button-primary-on-panel`. Slots\n * are named after the CSS property they feed — `background-color`, `border-radius`, `box-shadow` —\n * with a `-hover` or `-focus` suffix for a state. There are two exceptions: `text-color`,\n * `heading-text-color` and `low-emphasis-text-color` all feed `color`, and a panel's input slots\n * carry an `input-` prefix, as in `input-background-color`.\n *\n * Typography variables are `--wistia-kaleidoscope-type-<role>-<property>`, for the `heading`,\n * `body` and `button` roles.\n */\nexport const KALEIDOSCOPE_CONTRACT: KaleidoscopeVariables = CONTRACT;\n","import type { Color } from '../../../Color';\nimport type { ResolvedFill, TreatmentResult } from '../treatments/types';\nimport type { AnySurfaceSettings } from './types';\nimport { INVERT_BELOW_CONTRAST } from '../constants/color';\nimport { flatFill } from '../treatments/flat';\n\nexport type PaintedPair = {\n readonly text: Color;\n readonly treated: TreatmentResult;\n};\n\n/**\n * `invert: when-indistinct`: if a surface's background fill color is too close to its parent background fill,\n * invert: when-indistinct allows the fill and text color to be inverted. This provides better contrast between the surface\n * and its parent while also preserving legible contrast between the surface and its text color.\n */\nexport const invertWhenIndistinct = (\n { backgroundColor: { invert }, treatment }: AnySurfaceSettings,\n treated: TreatmentResult,\n text: Color,\n parent: ResolvedFill | null,\n): PaintedPair => {\n if (invert !== 'when-indistinct' || treatment !== 'flat' || parent === null) {\n return { text, treated };\n }\n\n const fillContrast = treated.solid.contrast(parent.solid);\n\n return fillContrast < INVERT_BELOW_CONTRAST && text.contrast(parent.solid) > fillContrast\n ? { text: treated.solid, treated: flatFill(text, null, parent) }\n : { text, treated };\n};\n","import type { StyleDocument, SurfaceName } from '../../styleVocabulary';\nimport type { ResolvedAnchors } from './anchors';\nimport type { Slots, VariableName } from './slots';\nimport type { ResolvedFill } from './treatments/types';\nimport { borderSlots } from './rules/border';\nimport { elevationSlots } from './rules/elevation';\nimport { invertWhenIndistinct } from './rules/invert';\nimport { motionSlots } from './rules/motion';\nimport { panelInputSlots } from './rules/panelInput';\nimport { radiusSlots } from './rules/radius';\nimport { hoverTextSlots, resolveTextColor, textSlots } from './rules/text';\nimport { surfaceVariable } from './slots';\nimport { SURFACE_GROUPS, SURFACES } from './surfaces';\nimport { TREATMENT_FUNCTIONS } from './treatments';\n\ntype EvaluatedSurface = ResolvedFill & { readonly slots: Slots };\n\n/**\n * One surface on one parent. A slot a Style doesn't use is left out, so it keeps the contract's\n * initial value.\n */\nconst evaluateSurface = (\n style: StyleDocument,\n surface: SurfaceName,\n anchors: ResolvedAnchors,\n parent: ResolvedFill | null,\n): EvaluatedSurface => {\n const settings = style.surfaces[surface];\n const treatment = TREATMENT_FUNCTIONS[settings.treatment];\n\n if (treatment === undefined) {\n throw new Error(`The engine cannot paint a ${settings.treatment} ${surface} yet`);\n }\n\n const painted = treatment({ anchors, parent, settings, surface });\n const { text, treated } = invertWhenIndistinct(\n settings,\n painted,\n resolveTextColor(settings.textColor, painted.solid, anchors),\n parent,\n );\n const spec = SURFACES[surface];\n const hover = treated.hover(text);\n const tinted = treated.tintedBy?.(text);\n\n return {\n solid: treated.solid,\n scale: treated.scale,\n slots: {\n ...treated.fill,\n ...(spec.interactive\n ? { ...hover.slots, ...hoverTextSlots(surface, settings.textColor, text, hover.solid) }\n : {}),\n ...textSlots(surface, text),\n ...(spec.mayContainForm ? panelInputSlots(treated.solid, anchors, tinted?.inputFills) : {}),\n ...borderSlots(settings.border, treated.solid, anchors),\n ...elevationSlots(settings.elevation, tinted?.shadowLayers),\n ...radiusSlots(surface, settings.radius, anchors),\n ...motionSlots(settings.motion),\n },\n };\n};\n\n/**\n * Evaluates every surface group parents first, so each surface knows the fill it sits on, and\n * names each slot after its group.\n */\nexport const evaluateSurfaces = (\n style: StyleDocument,\n anchors: ResolvedAnchors,\n): Readonly<Record<VariableName, string>> => {\n const containers = new Map<SurfaceName, ResolvedFill>();\n const variables: Record<VariableName, string> = {};\n\n for (const { parent, prefix, surface } of SURFACE_GROUPS) {\n const evaluated = evaluateSurface(\n style,\n surface,\n anchors,\n parent === null ? null : (containers.get(parent) ?? null),\n );\n\n // A surface on several parents is never a container itself, so the last one evaluated is fine.\n containers.set(surface, evaluated);\n\n for (const [slot, value] of Object.entries(evaluated.slots)) {\n variables[surfaceVariable(prefix, slot)] = value;\n }\n }\n\n return variables;\n};\n","import type { FindGaps } from './types';\n\n/** No textures yet, so no texture slots: the Style that first uses one adds them. */\nexport const textureGaps: FindGaps = ({ texture: { kind } }) =>\n kind === 'none' ? [] : [`texture.kind: ${kind}`];\n","import type { StyleDocument } from '../../styleVocabulary';\nimport type { FindGaps } from './rules/types';\nimport { SURFACE_NAMES } from '../../styleVocabulary';\nimport { borderGaps } from './rules/border';\nimport { elevationGaps } from './rules/elevation';\nimport { fillGaps } from './rules/fill';\nimport { motionGaps } from './rules/motion';\nimport { textGaps } from './rules/text';\nimport { textureGaps } from './rules/texture';\nimport { gradientGaps } from './treatments/gradient';\n\nconst GAP_FINDERS: readonly FindGaps[] = [\n fillGaps,\n gradientGaps,\n textGaps,\n borderGaps,\n elevationGaps,\n motionGaps,\n textureGaps,\n];\n\n/** The rules in `style` the engine cannot resolve yet, as `<surface>.<setting>: <value>`. */\nexport const findUnsupportedRules = (style: StyleDocument): readonly string[] =>\n SURFACE_NAMES.flatMap((surface) =>\n GAP_FINDERS.flatMap((findGaps) => findGaps(style.surfaces[surface], surface)).map(\n (gap) => `${surface}.${gap}`,\n ),\n );\n\n/**\n * Whether the engine resolves every rule `style` uses. The contract test and the Storybook's\n * engine-backed Styles both come from this, so a Style switches over as soon as the engine covers\n * it.\n */\nexport const isSupportedStyle = (style: StyleDocument): boolean =>\n findUnsupportedRules(style).length === 0;\n","import type { BrandTokens } from './brandTokens';\nimport type { KaleidoscopeVariables } from './kaleidoscopeContract';\nimport type { StyleDocument } from './styleVocabulary';\nimport { KALEIDOSCOPE_CONTRACT } from './kaleidoscopeContract';\nimport { resolveAnchors } from './private/engine/anchors';\nimport { evaluateSurfaces } from './private/engine/evaluateSurfaces';\nimport { typographyVariables } from './private/engine/rules/typography';\nimport { findUnsupportedRules } from './private/engine/support';\n\nconst resolveAgainstDefaultValues = (resolved: KaleidoscopeVariables): KaleidoscopeVariables => ({\n ...KALEIDOSCOPE_CONTRACT,\n ...resolved,\n});\n\n/**\n * Resolves a Style against a Brand Kit into the `--wistia-kaleidoscope-*` variables that style an\n * embed or hosted page. The record always holds every name in {@link KALEIDOSCOPE_CONTRACT}.\n *\n * A Brand Kit token the Style references but `brandTokens` leaves out takes its default from\n * `DEFAULT_BRAND_TOKENS`.\n *\n * @throws when the Style uses a rule the engine cannot resolve yet, or references a token that is\n * not a Brand Kit token.\n *\n * @example\n * ```ts\n * const variables = getKaleidoscopeStyles(OPAQUE_MINIMAL, { primaryColor: '#5b4cf0' });\n * variables['--wistia-kaleidoscope-button-primary-on-page-background-color']; // '#5b4cf0'\n * ```\n */\nexport const getKaleidoscopeStyles = (\n style: StyleDocument,\n brandTokens: BrandTokens = {},\n): KaleidoscopeVariables => {\n const unsupported = findUnsupportedRules(style);\n\n if (unsupported.length > 0) {\n throw new Error(`The engine cannot resolve \"${style.id}\" yet: ${unsupported.join(', ')}`);\n }\n\n const anchors = resolveAnchors(style, brandTokens);\n\n return resolveAgainstDefaultValues({\n ...evaluateSurfaces(style, anchors),\n ...typographyVariables(style, anchors),\n });\n};\n","import type { KaleidoscopeVariables } from './kaleidoscopeContract';\nimport { KALEIDOSCOPE_VARIABLE_PREFIX } from './kaleidoscopeContract';\n\nconst NAME_SUFFIX = /^[a-z0-9-]+$/;\n/** Ends the declaration or rule, or the `<style>` element, or escapes what follows, or `!important`. */\nconst UNSAFE_IN_VALUE = /[{};<\\\\!\\p{Cc}]|\\/\\*|\\*\\//u;\nconst UNSAFE_IN_SELECTOR = /[{};<\\\\@\\p{Cc}]|\\/\\*|\\*\\//u;\nconst QUOTED = /\"[^\"]*\"|'[^']*'/g;\nconst CLOSER_OF: Readonly<Record<string, string>> = { '(': ')', '[': ']' };\nconst CLOSERS = new Set(Object.values(CLOSER_OF));\n\n/** An unclosed quote or bracket swallows the declarations and rules after it. */\nconst isBalanced = (text: string): boolean => {\n const unquoted = text.replaceAll(QUOTED, '');\n const expected: string[] = [];\n\n if (/[\"']/.test(unquoted)) {\n return false;\n }\n\n for (const char of unquoted) {\n const closer = CLOSER_OF[char];\n\n if (closer !== undefined) {\n expected.push(closer);\n } else if (CLOSERS.has(char) && expected.pop() !== char) {\n return false;\n }\n }\n\n return expected.length === 0;\n};\n\nconst assertSafe = (label: string, text: string, unsafe: RegExp): void => {\n if (text.trim() === '' || unsafe.test(text) || !isBalanced(text)) {\n throw new Error(`Cannot serialize ${label} safely: ${JSON.stringify(text)}`);\n }\n};\n\nconst assertName = (name: string): void => {\n if (\n !name.startsWith(KALEIDOSCOPE_VARIABLE_PREFIX) ||\n !NAME_SUFFIX.test(name.slice(KALEIDOSCOPE_VARIABLE_PREFIX.length))\n ) {\n throw new Error(`Cannot serialize variable name safely: ${JSON.stringify(name)}`);\n }\n};\n\n/**\n * Writes the record from `getKaleidoscopeStyles()` as a CSS rule, for a server-rendered `<style>`\n * or for injecting at runtime.\n *\n * Text that could leave its declaration, its rule or the `<style>` element is refused rather than\n * escaped. The engine's own values never need it, so such text is a font family from a Brand Kit\n * that should not reach the page, and an escaped version would no longer name a real font.\n *\n * @throws when `selector`, a variable name or a value is unsafe. Callers rendering customer Brand\n * Kits should catch this and fall back.\n *\n * @example\n * ```ts\n * serializeKaleidoscopeStyles(getKaleidoscopeStyles(OPAQUE_MINIMAL), '.my-scope');\n * // '.my-scope {\\n --wistia-kaleidoscope-page-background-color: #ffffff;\\n …\\n}'\n * ```\n */\nexport const serializeKaleidoscopeStyles = (\n variables: KaleidoscopeVariables,\n selector: string,\n): string => {\n assertSafe('selector', selector, UNSAFE_IN_SELECTOR);\n\n const declarations = Object.entries(variables).map(([name, value]) => {\n assertName(name);\n assertSafe(`the value of ${name}`, value, UNSAFE_IN_VALUE);\n\n return ` ${name}: ${value};`;\n });\n\n return `${selector} {\\n${declarations.join('\\n')}\\n}`;\n};\n"],"mappings":";;;;;;;;;;;;;;AACA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;AACF;;AAoBA,MAAa,uBAA8C;CACzD,cAAc;CACd,qBAAqB;CACrB,cAAc;CACd,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;AACpB;;;AC/BA,MAAa,uBAAuB;CAClC,MAAM;CACN,WAAW;CACX,OAAO;CACP,eAAe;AACjB;;AAMA,MAAa,wBAAwB,2BAA2B;;AAGhE,MAAa,0BAA0B;;ACVvC,MAAM,oBAAoB;AAC1B,MAAM,6BAAa,IAAI,IAAmB;;AAG1C,MAAa,WAAW,UAAwB;CAC9C,MAAM,MAAM,MAAM,MAAM;CACxB,IAAI,QAAQ,WAAW,IAAI,GAAG;CAE9B,IAAI,UAAU,KAAA,GAAW;EACvB,IAAI,WAAW,QAAQ,mBACrB,WAAW,MAAM;EAGnB,QAAQ,uBAAuB,IAAI,MAAM,GAAG,CAAC;EAC7C,WAAW,IAAI,KAAK,KAAK;CAC3B;CAEA,OAAO;AACT;AAEA,MAAM,YAAY,UAAyB,MAAM,QAAQ;AAEzD,MAAa,UAAU,OAAc,UACnC,MAAM,OAAO,MAAM,OAAO,GAAG,SAAS,KAAK,CAAC,CAAC;AAE/C,MAAM,eAAe,OAAc,UACjC,MAAM,KAAK,MAAM,MAAM,OAAO,KAAK,CAAC,GAAG,GAAG,SAAS,KAAK,CAAC;;;;;;AAO3D,MAAa,aAAa,OAAc,OAAc,WAA0B;CAC9E,MAAM,WAAW,YAAY,OAAO,KAAK;CACzC,MAAM,YAAY,gCAAgC,KAAK;CAGvD,OAAO,OAAO,OAAO,YAFH,cAAc,UAAU,cAAc,aAAa,KAAK,KAE9B,MAAM;AACpD;AAEA,MAAa,YAAY,OAAc,WACrC,UAAU,QAAQ,KAAK,GAAG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,0 @@
1
- {"version":3,"file":"index-BOJCY_MU.d.ts","names":[],"sources":["../src/styleVocabulary/anchorValues.ts","../src/styleVocabulary/gradientShape.ts","../src/styleVocabulary/treatment.ts","../src/styleVocabulary/anchors.ts","../src/styleVocabulary/backgroundColor.ts","../src/styleVocabulary/border.ts","../src/styleVocabulary/elevation.ts","../src/styleVocabulary/motion.ts","../src/styleVocabulary/radius.ts","../src/styleVocabulary/textColor.ts","../src/styleVocabulary/texture.ts","../src/styleVocabulary/surfaces.ts","../src/styleVocabulary/typography.ts","../src/styleVocabulary/index.ts"],"mappings":";A,KAAY;KAEA;cAEC;KACD,4BAA4B;cAE3B;KACD,oBAAoB;;;;;KAMpB;WACD,MAAM;WACN,WAAW;WACX,OAAO;;KAGN,cAAc,eAAe,eAAe;;;;;cAM3C;KAaD,4BAA4B;KAE5B,wBAAwB;;KAGxB,YAAY;cAEX;KACD;cC7CC;cACA;KAED,yBAAyB;cAExB;KACD,8BAA8B;cAE7B;KAUD,4BAA4B;cAE3B;KAWD,2BAA2B;;;;;cAM1B;KACD,yBAAyB;;;;;;;KAQzB;WACG;;WACA;;WACA,WAAW;WAA4B;;WAEvC,QAAQ;WACR;WACA,UAAU;;;;;;;;;cChDZ;KACD,oBAAoB;cCJnB;KACD,sBAAsB;;;;;;cAOrB;KACD,kCAAkC;cAEjC;KACD,0BAA0B;;;;;;cAOzB;KACD,8BAA8B;;;;;;cAO7B;KACD,8BAA8B;;;;cAK7B;KACD,6BAA6B;;;;;cAM5B;KACD,gCAAgC;cAE/B;KAED,mCAAmC;KACnC,yCAAyC;KACzC,iCAAiC;KACjC,2CAA2C;KAE3C,iBAAiB,aAAa,mBAAmB,+BACzD,gBACA;KAEQ,eAAe,YAAY,QAAQ,sBAAsB,iBAAiB,YACpF,YAAY,QAAQ,uBAAuB,iBAAiB;KAElD,mBAAmB,SAAS,OAAO,yBAAyB;KAG5D,cAAc,SAAS,OAAO,oBAAoB,YAAY;;;;KAK9D;WACD,QAAQ;WACR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;;;KAWC,aAAa,SAAS,OAAO,cAAc;;cCT1C;KASD;WACD,SAAS;WACT;WACA;WACA;WACA,UAAU;WACV,YAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-BkOpEpch.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 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 { LITERAL_COLOR_PATTERN, TOKEN_PATTERN } 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 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\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 { COLOR_FORM_MESSAGE, isColorForm, isDimension, isTokenRef } from './anchorValues';\nimport { checkNoUnknownKeys } from './issues';\n\nconst isFontStack = (value: unknown): boolean => isString(value) && FONT_STACK_PATTERN.test(value);\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 isColorForm(value) ? [] : [{ message: COLOR_FORM_MESSAGE, path }];\n }\n\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 isColorForm(stop) ? [] : [{ message: COLOR_FORM_MESSAGE, path: `${path}.${index}` }],\n ).flat(),\n ];\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 }\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 treatment: unknown,\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(border, ['width', 'source', 'offset', 'style'], path, 'border key'),\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 } else if (style === 'scalloped' && treatment === 'none') {\n issues.push({\n message:\n 'scallops are drawn in the surface\\'s own fill, and treatment \"none\" paints none — give the surface a fill, or use \"lace\"',\n path: `${path}.style`,\n });\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 borderSource = at(border, 'source');\n const borderAnchor = singleColorAnchorFromRef(borderSource);\n if (borderAnchor !== undefined) {\n collected.referenced.add(borderAnchor);\n } else if (borderSource !== 'surface') {\n issues.push({\n message: `source must be \"surface\" or one of: ${singleColorRefList()}`,\n path: `${path}.source`,\n });\n }\n\n if (!isScaleOffset(at(border, '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 { Collected, StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport {\n ELEVATION_COLOR_SOURCE_KEYWORDS,\n ELEVATION_DEPTHS,\n ELEVATION_HARDNESSES,\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 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 if (!isOneOf(ELEVATION_DEPTHS, at(value, 'depth'))) {\n issues.push({\n message: `depth must be one of: ${list(ELEVATION_DEPTHS)}`,\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 { 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'] 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/**\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 ];\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 { StyleDocumentIssue } from './issues';\nimport { at, isOneOf, isRecord } from '../private/guards';\nimport { AMBIENT_MOTIONS, MOTION_SPEEDS, TRANSITIONS } from '../styleVocabulary';\nimport { checkNoUnknownKeys, list } from './issues';\n\nexport const checkMotion = (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, ['ambient', 'speed', 'transition'], path, 'motion key'),\n ];\n\n if (!isOneOf(AMBIENT_MOTIONS, at(value, 'ambient'))) {\n issues.push({\n message: `ambient must be one of: ${list(AMBIENT_MOTIONS)}`,\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 { checkNoUnknownKeys, list } from './issues';\n\n/**\n * A named texture at a named intensity. A surface that paints nothing has no fill to lay a\n * texture over, so `treatment: \"none\"` requires `kind: \"none\"`.\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'], 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 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, SURFACE_NAMES, TREATMENTS } from '../styleVocabulary';\nimport { checkBackgroundColor } from './backgroundColor';\nimport { checkBorder } from './border';\nimport { checkElevation } from './elevation';\nimport { checkGradientShape } from './gradientShape';\nimport { checkNoUnknownKeys, list } from './issues';\nimport { checkMotion } from './motion';\nimport { checkRadius } from './radius';\nimport { checkTextColor } from './textColor';\nimport { checkTexture } from './texture';\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 if (namedTreatment) {\n collected.treatments.add(treatment);\n }\n\n return [\n ...checkNoUnknownKeys(value, ALL_SETTING_NAMES, path, 'setting'),\n ...(namedTreatment\n ? []\n : [\n {\n message: `treatment must be one of: ${list(TREATMENTS)}`,\n path: `${path}.treatment`,\n },\n ]),\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, treatment, collected),\n ...checkElevation(at(value, 'elevation'), `${path}.elevation`, collected),\n ...checkRadius(at(value, 'radius'), `${path}.radius`),\n ...checkTexture(at(value, 'texture'), `${path}.texture`, treatment),\n ...checkMotion(at(value, 'motion'), `${path}.motion`),\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 =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