@wistia/kaleidoscope 0.0.6-beta.f342591f.779bf11 → 0.0.7

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 (28) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/{color-cbZDHync.js → color-BgYVUbOQ.js} +3 -3
  3. package/dist/{color-cbZDHync.js.map → color-BgYVUbOQ.js.map} +1 -1
  4. package/dist/{engine-BcKhqeRK.js → engine-DHDkDPaV.js} +209 -45
  5. package/dist/engine-DHDkDPaV.js.map +1 -0
  6. package/dist/entries/color.js +3 -3
  7. package/dist/entries/engine.js +2 -2
  8. package/dist/entries/styleRegistry.js +2 -2
  9. package/dist/entries/validate.js +2 -2
  10. package/dist/entries/vocabulary.js +3 -3
  11. package/dist/{getColorLightnessClassification-CiTvv0WA.js → getColorLightnessClassification-C6BXD8Da.js} +2 -2
  12. package/dist/{getColorLightnessClassification-CiTvv0WA.js.map → getColorLightnessClassification-C6BXD8Da.js.map} +1 -1
  13. package/dist/{guards-Clph1WZk.js → guards-BJfumKYK.js} +2 -2
  14. package/dist/{guards-Clph1WZk.js.map → guards-BJfumKYK.js.map} +1 -1
  15. package/dist/index.js +8 -8
  16. package/dist/{styleRegistry-hRUuknE2.js → styleRegistry-Dcho9r3B.js} +23 -23
  17. package/dist/styleRegistry-Dcho9r3B.js.map +1 -0
  18. package/dist/{styleVocabulary-BLX4XzpQ.js → styleVocabulary-DMhXOr4F.js} +2 -2
  19. package/dist/{styleVocabulary-BLX4XzpQ.js.map → styleVocabulary-DMhXOr4F.js.map} +1 -1
  20. package/dist/{typography-BsBMKPss.js → typography-BLPIIq_8.js} +2 -2
  21. package/dist/{typography-BsBMKPss.js.map → typography-BLPIIq_8.js.map} +1 -1
  22. package/dist/{validate-BIWiqsvZ.js → validate-BkOpEpch.js} +5 -5
  23. package/dist/{validate-BIWiqsvZ.js.map → validate-BkOpEpch.js.map} +1 -1
  24. package/package.json +4 -4
  25. package/styles/glass-dark.json +9 -9
  26. package/styles/glass-light.json +12 -12
  27. package/dist/engine-BcKhqeRK.js.map +0 -1
  28. package/dist/styleRegistry-hRUuknE2.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,67 @@
1
+ # @wistia/kaleidoscope
2
+
3
+ ## 0.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4670](https://github.com/wistia/vhs/pull/4670) [`3d92481`](https://github.com/wistia/vhs/commit/3d92481a6785c8578f13a35d2c5c6cd4dfe0bb69) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The token engine now resolves Aurora Dark and Aurora Light, adding the `gradient` treatment with the `glows` shape, `anchors.colors.gradientStops` and ambient `drift` on the page.
8
+
9
+ The variable contract replaces `--wistia-kaleidoscope-page-animation` with `--wistia-kaleidoscope-page-animation-duration`, which is `0s` when the page is still, and removes the unused `animation` variable from every other surface. The package ships no keyframes: a consumer writes its own `@keyframes` and the layer that moves, and reads the duration from the contract.
10
+
11
+ - [#4669](https://github.com/wistia/vhs/pull/4669) [`140af06`](https://github.com/wistia/vhs/commit/140af06561a2bb8fef90932868300601a7b09a52) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The token engine now resolves the Glass Dark and Glass Light Styles, through the `glassy` treatment: a translucent ground under a sheen, with a blurred backdrop on panels and cards, and edge and specular highlights in `box-shadow`. Text on Glass Dark is always white and on Glass Light always black, except on the flat primary button, which still derives its text from the brand color. `textColor` can now be a literal color.
12
+
13
+ ## 0.0.6
14
+
15
+ ### Patch Changes
16
+
17
+ - [#4641](https://github.com/wistia/vhs/pull/4641) [`4706e76`](https://github.com/wistia/vhs/commit/4706e760675cbd224881fe76493e29414631cfce) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Add a `button` font anchor to Style documents. `anchors.fonts.button` is required, like `heading` and `body`, and takes a brand token or a font stack. The `button` type role can now reference it. Every built-in Style sets it to the new `$buttonFontFamily` Brand Kit token and uses it for button text, which previously used the heading font. A Style document without `anchors.fonts.button` no longer validates.
18
+
19
+ - [#4664](https://github.com/wistia/vhs/pull/4664) [`d797ea7`](https://github.com/wistia/vhs/commit/d797ea7f8237fa1347e38bcc9dbcc68bfd4996a9) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The token engine now resolves borders with a non-zero width, sourced from the surface's own fill or a color anchor. Ornamental border styles are still unsupported.
20
+
21
+ - [#4666](https://github.com/wistia/vhs/pull/4666) [`f10d21d`](https://github.com/wistia/vhs/commit/f10d21d6b5bb0d5a79501ee602a098898cd9c676) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The token engine now resolves Opaque Light. A surface's `backgroundColor.from: parent` counts its offset from its parent's fill rather than from the source color. A step now moves away from a color's own lightness, so midtones always step darker. This can change a Style's fills and hover colors for a Brand Kit with a midtone color, such as a saturated pink primary.
22
+
23
+ A hover fill now steps away from its surface's text, so a label that reads at rest keeps reading while hovered. A fill that would land too close to its resting color or its parent steps towards the text instead. Interactive surfaces also emit `text-color-hover`, and cards emit `heading-text-color-hover` and `low-emphasis-text-color-hover`, which move the text only as far as such a hover needs. Read these on `:hover` alongside `background-color-hover`.
24
+
25
+ - [#4667](https://github.com/wistia/vhs/pull/4667) [`5664957`](https://github.com/wistia/vhs/commit/5664957beb92f82d37ccdc590bcea06d9c9e2446) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The token engine now resolves Opaque Medium, Opaque Heavy and Opaque Bright. A `textColor` of `{ source, offset }` starts from that step of the anchor's scale and adjusts only as far as contrast requires, and `backgroundColor.invert: when-indistinct` swaps a flat fill with its text when the fill doesn't stand out from its parent.
26
+
27
+ - [#4642](https://github.com/wistia/vhs/pull/4642) [`20392c2`](https://github.com/wistia/vhs/commit/20392c25b273acf0d3404cf1b131850ebf92db8b) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added the token engine, starting with Opaque Minimal. `getKaleidoscopeStyles(style, brandTokens)` resolves a Style against Brand Kit tokens into `--wistia-kaleidoscope-*` CSS variables, including typography. `KALEIDOSCOPE_CONTRACT` lists every variable with the value it takes when a Style doesn't use it, and every Style emits exactly that set. A Brand Kit token the Style references but `brandTokens` leaves out falls back to `DEFAULT_BRAND_TOKENS`. Import from `@wistia/kaleidoscope/engine` or the package root. Other Styles throw until the engine supports them.
28
+
29
+ - [#4665](https://github.com/wistia/vhs/pull/4665) [`33752fa`](https://github.com/wistia/vhs/commit/33752faf98deb8113a55ad2133b0a20cae0fa00c) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added `serializeKaleidoscopeStyles(variables, selector)`, which writes the record from `getKaleidoscopeStyles()` as a CSS rule for server-rendered pages or runtime injection. It throws on a selector, variable name or value that could break out of its declaration, its rule or a `<style>` element, including a hostile font family from a Brand Kit. Import from `@wistia/kaleidoscope/engine` or the package root.
30
+
31
+ ## 0.0.5
32
+
33
+ ### Patch Changes
34
+
35
+ - [#4535](https://github.com/wistia/vhs/pull/4535) [`c34059a`](https://github.com/wistia/vhs/commit/c34059aa93196aaa9e16525c39f75f6751849377) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added the two Aurora built-in Styles, Light and Dark, as complete, valid Style documents. Each paints its page with a gradient. Import them from `@wistia/kaleidoscope/style-registry` or the package root, individually or as part of `BUILT_IN_STYLES`. Each also ships as JSON at `@wistia/kaleidoscope/styles/<id>.json`.
36
+
37
+ - [#4525](https://github.com/wistia/vhs/pull/4525) [`a237f87`](https://github.com/wistia/vhs/commit/a237f879dc07b57e9ce019ed82bb679c5055d749) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added the two Glass built-in Styles, Dark and Light, as complete, valid Style documents. Import them from `@wistia/kaleidoscope/style-registry` or the package root, individually or as part of `BUILT_IN_STYLES`. Each also ships as JSON at `@wistia/kaleidoscope/styles/<id>.json`.
38
+
39
+ - [#4521](https://github.com/wistia/vhs/pull/4521) [`8bd5719`](https://github.com/wistia/vhs/commit/8bd571973144df47e2f470a680f68889c6199dfe) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added the five Opaque built-in Styles — Minimal, Light, Medium, Heavy and Bright — as complete, valid Style documents. Import them from `@wistia/kaleidoscope/style-registry` or the package root, individually or as `BUILT_IN_STYLES`. Each also ships as JSON at `@wistia/kaleidoscope/styles/<id>.json`, and the Style JSON Schema at `@wistia/kaleidoscope/schema/style-v1.json`.
40
+
41
+ - [#4520](https://github.com/wistia/vhs/pull/4520) [`29409db`](https://github.com/wistia/vhs/commit/29409db97005ba63fe83952631d59bb951d42f2d) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Exported `validateStyleDocument` from the `@wistia/kaleidoscope` package root, alongside the existing `@wistia/kaleidoscope/validate` entry point.
42
+
43
+ ## 0.0.4
44
+
45
+ ### Patch Changes
46
+
47
+ - [#4336](https://github.com/wistia/vhs/pull/4336) [`7520120`](https://github.com/wistia/vhs/commit/752012078fc115ebc60f39d77f40befd5441f5b1) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added `@wistia/kaleidoscope/validate`: `validateStyleDocument` checks a Style document's own shape — that it is an object, that its set of top-level keys is closed, and that its identity fields are well formed — and reports every problem it finds as `{ path, message }`.
48
+
49
+ ## 0.0.3
50
+
51
+ ### Patch Changes
52
+
53
+ - [#4288](https://github.com/wistia/vhs/pull/4288) [`c1defa3`](https://github.com/wistia/vhs/commit/c1defa3b9b4fd4627a153f8420018c2b0c5e7e40) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added utilities to derive background colors from a primary color, and to derive accented versions of a background color.
54
+
55
+ Set up sub-path imports.
56
+
57
+ ## 0.0.2
58
+
59
+ ### Patch Changes
60
+
61
+ - [#4174](https://github.com/wistia/vhs/pull/4174) [`2797755`](https://github.com/wistia/vhs/commit/27977554f82fd390be1f64fa884523364df471d1) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added adjustColorForProperContrast and getBestColorForText
62
+
63
+ ## 0.0.1
64
+
65
+ ### Patch Changes
66
+
67
+ - [#4150](https://github.com/wistia/vhs/pull/4150) [`1b36fa3`](https://github.com/wistia/vhs/commit/1b36fa36cab47bb82c0e9b16231a74352924ab5e) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Added colorContrastRatiosByShape
@@ -1,13 +1,13 @@
1
1
 
2
2
  /*
3
- * @license @wistia/kaleidoscope v0.0.6-beta.f342591f.779bf11
3
+ * @license @wistia/kaleidoscope v0.0.7
4
4
  *
5
5
  * Copyright (c) 2026, Wistia, Inc. and its affiliates.
6
6
  *
7
7
  * This source code is unlicensed, all rights reserved.
8
8
  */
9
9
 
10
- import { a as maxChroma, f as Color, h as clamp, m as rgbToOklch, n as buildBrandedColorScale, p as oklchToRgb, r as perceivedLightness, t as getColorLightnessClassification } from "./getColorLightnessClassification-CiTvv0WA.js";
10
+ import { a as maxChroma, f as Color, h as clamp, m as rgbToOklch, n as buildBrandedColorScale, p as oklchToRgb, r as perceivedLightness, t as getColorLightnessClassification } from "./getColorLightnessClassification-C6BXD8Da.js";
11
11
  // src/getBrandedColorScale.ts
12
12
  /**
13
13
  * Builds a color scale using the derived light/dark background colors based on the given primary color,
@@ -145,4 +145,4 @@ const getSlightAccentedBackgroundColor = (_backgroundColor, { shouldReturnWhiteF
145
145
  };
146
146
  export { getHeavyAccentedBackgroundColor as n, getBrandedColorScale as r, getSlightAccentedBackgroundColor as t };
147
147
 
148
- //# sourceMappingURL=color-cbZDHync.js.map
148
+ //# sourceMappingURL=color-BgYVUbOQ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-cbZDHync.js","names":[],"sources":["../src/getBrandedColorScale.ts","../src/private/getAccentedBackgroundByLightness.ts","../src/private/getBackgroundAccentFromPrimaryColor.ts","../src/private/getAccentedBackground.ts","../src/getHeavyAccentedBackgroundColor.ts","../src/getSlightAccentedBackgroundColor.ts"],"sourcesContent":["import type { ColorInput } from './types';\nimport { Color } from './Color';\nimport {\n buildBrandedColorScale,\n DEFAULT_COLOR_SCALE_STEPS,\n} from './private/buildBrandedColorScale';\n\nexport type BrandColorScaleOptions = {\n /** How many steps the scale is divided into. */\n readonly steps?: number;\n};\n\n/**\n * Builds a color scale using the derived light/dark background colors based on the given primary color,\n * with the primary color slotted into the scale wherever it fits based on lightness.\n *\n * It's important to include the primary color in the scale because the light/dark derived background colors\n * do not have the same saturation as the primary color, and we want the scale to reflect the vibrancy\n * of the primary color.\n *\n * @example\n * ```ts\n * getBrandedColorScale('#2949e5').map((color) => color.toHex());\n * // ['#ebeefd', '#d4dbfa', '#bdc8f7', '#a5b5f4', '#8da2f1', '#748eef',\n * // '#5b7aec', '#4263e8', '#2949e5', '#2539ba', '#213080', '#171f45']\n * // ^ the primary, at its own lightness\n * ```\n */\nexport const getBrandedColorScale = (\n primaryColor: ColorInput,\n { steps = DEFAULT_COLOR_SCALE_STEPS }: BrandColorScaleOptions = {},\n): Color[] => {\n const scale = buildBrandedColorScale(new Color(primaryColor), { steps });\n\n return Array.from({ length: steps }, (_, index) => scale.atStep(index));\n};\n","import type { getBackgroundAccentFromPrimaryColor } from './getBackgroundAccentFromPrimaryColor';\nimport { Color } from '../Color';\nimport { getColorLightnessClassification } from '../getColorLightnessClassification';\nimport { DEFAULT_COLOR_SCALE_STEPS } from './buildBrandedColorScale';\nimport { clamp } from './clamp';\nimport { oklchToRgb, rgbToOklch } from './colorSpace';\nimport { ACHROMATIC_CHROMA, maxChroma } from './maxChroma';\nimport { perceivedLightness } from './perceivedLightness';\n\n/**\n * Get the total distance between the lightest and darkest page background colors, measured in lightness.\n * This determines the actual step size we'll use, which correlates to the size of the step between colors\n * in a branded color scale.\n */\nconst MAX_BACKGROUND_LIGHTNESS = 0.95;\nconst MIN_BACKGROUND_LIGHTNESS = 0.09;\nconst STEP_SIZE_IN_LIGHTNESS =\n (MAX_BACKGROUND_LIGHTNESS - MIN_BACKGROUND_LIGHTNESS) / (DEFAULT_COLOR_SCALE_STEPS - 1);\n\n/**\n * Move the background color by the given distance to generate an accented background color.\n * This is used when no primary color has been provided, meaning the background color was not derived from the primary color.\n * The size of the steps used by this utility should match the size of the steps used in the\n * corresponding {@link getBackgroundAccentFromPrimaryColor} utility.\n */\nexport const getAccentedBackgroundByLightness = (\n backgroundColor: Color,\n distanceInSteps: number,\n): Color => {\n const { chroma, hue, lightness } = rgbToOklch(\n backgroundColor.r,\n backgroundColor.g,\n backgroundColor.b,\n );\n const maxPossibleChroma = maxChroma(lightness, hue);\n\n // If there is no perceptible chroma for this color or for the max possible chroma for this hue/lightness,\n // don't try to add any chroma into the result.\n const share =\n chroma < ACHROMATIC_CHROMA || maxPossibleChroma < ACHROMATIC_CHROMA\n ? 0\n : Math.min(1, chroma / maxPossibleChroma);\n\n const atLightness = (candidate: number): Color => {\n const [red, green, blue] = oklchToRgb({\n chroma: share * maxChroma(candidate, hue),\n hue,\n lightness: candidate,\n });\n\n return new Color([red, green, blue, backgroundColor.a]);\n };\n\n const band = getColorLightnessClassification(backgroundColor);\n const towards = band === 'dark' || band === 'veryDark' ? 1 : -1;\n const target = clamp(\n perceivedLightness(backgroundColor) + towards * distanceInSteps * STEP_SIZE_IN_LIGHTNESS,\n 0,\n 1,\n );\n\n let low = 0;\n let high = 1;\n for (let iteration = 0; iteration < 30; iteration += 1) {\n const middle = (low + high) / 2;\n if (perceivedLightness(atLightness(middle)) < target) {\n low = middle;\n } else {\n high = middle;\n }\n }\n\n return atLightness((low + high) / 2);\n};\n","import type { Color } from '../Color';\nimport { getColorLightnessClassification } from '../getColorLightnessClassification';\nimport { buildBrandedColorScale } from './buildBrandedColorScale';\nimport { clamp } from './clamp';\n\n/**\n * Using a branded color scale based on the primary color,\n * move the given background color by the given distance along the scale\n * to generate an accented version of the background color.\n */\nexport const getBackgroundAccentFromPrimaryColor = (\n backgroundColor: Color,\n stepDistance: number,\n primaryColor: Color,\n): Color => {\n const scale = buildBrandedColorScale(primaryColor);\n const last = scale.steps - 1;\n const colorLightnessClass = getColorLightnessClassification(backgroundColor);\n const towards =\n colorLightnessClass === 'dark' || colorLightnessClass === 'veryDark'\n ? -stepDistance\n : stepDistance;\n const from = clamp(Math.round(scale.stepOf(backgroundColor)), 0, last);\n\n return scale.atStep(clamp(from + towards, 0, last));\n};\n","import type { Color } from '../Color';\nimport { getAccentedBackgroundByLightness } from './getAccentedBackgroundByLightness';\nimport { getBackgroundAccentFromPrimaryColor } from './getBackgroundAccentFromPrimaryColor';\n\nexport type AccentedBackgroundOptions = {\n readonly backgroundColor: Color;\n readonly primaryColor?: Color | undefined;\n readonly stepDistance: number;\n};\n\n/**\n * A background `distance` steps off `background`, always in the direction away from it:\n * darker when the background is light, lighter when it is dark.\n *\n * Gets a an accented color spaced apart from the given background color by the given distance.\n * If a primary color is included, we will derive the accent color using a color scale.\n */\nexport const getAccentedBackground = ({\n backgroundColor,\n stepDistance,\n primaryColor,\n}: AccentedBackgroundOptions): Color =>\n primaryColor === undefined\n ? getAccentedBackgroundByLightness(backgroundColor, stepDistance)\n : getBackgroundAccentFromPrimaryColor(backgroundColor, stepDistance, primaryColor);\n","import type { getBrandedColorScale } from './getBrandedColorScale';\nimport type { getSlightAccentedBackgroundColor } from './getSlightAccentedBackgroundColor';\nimport type { ColorInput } from './types';\nimport { Color } from './Color';\nimport { getAccentedBackground } from './private/getAccentedBackground';\n\nexport type HeavyAccentedBackgroundColorOptions = {\n readonly primaryColor?: ColorInput;\n};\n\n/**\n * Get an accented version of a background color that is a two steps lighter/darker.\n * Use this when the color contrast of the accented background color is not significant,\n * such as for card/panel background colors.\n * \n * Accepts an optional primary color, used when the background color has been derived from the primary color,\n * and we want the accented versions of the background color to come from the color scale, see {@link getBrandedColorScale}\n\n * See {@link getSlightAccentedBackgroundColor} for a single step away from the background color instead of two.\n\n *\n * @example\n * ```ts\n * getHeavyAccentedBackgroundColor('#f5f5f5').toHex(); // '#cbcbcb'\n * getHeavyAccentedBackgroundColor('#f5f5f5', { primaryColor: '#2949e5' }).toHex(); // '#adbbf5'\n * ```\n */\nexport const getHeavyAccentedBackgroundColor = (\n _backgroundColor: ColorInput,\n { primaryColor }: HeavyAccentedBackgroundColorOptions = {},\n): Color => {\n const backgroundColor = new Color(_backgroundColor);\n\n return getAccentedBackground({\n backgroundColor,\n stepDistance: 2,\n primaryColor: primaryColor === undefined ? undefined : new Color(primaryColor),\n });\n};\n","import type { getBrandedColorScale } from './getBrandedColorScale';\nimport type { getHeavyAccentedBackgroundColor } from './getHeavyAccentedBackgroundColor';\nimport type { ColorInput } from './types';\nimport { Color } from './Color';\nimport { getAccentedBackground } from './private/getAccentedBackground';\n\nconst WHITE = '#ffffff';\n\nexport type SlightAccentedBackgroundColorOptions = {\n readonly shouldReturnWhiteForWhiteBackground?: boolean;\n /**\n * Optional primary color, which is used when the background color is derived from the primary color,\n * so we'll calculate the accented background color using a color scale.\n */\n readonly primaryColor?: ColorInput;\n};\n\n/**\n * Get an accented version of a background color that is a single step lighter/darker.\n * Use this when the color contrast of the accented background color is not significant,\n * such as for card/panel background colors.\n * \n * Accepts an optional primary color, used when the background color has been derived from the primary color,\n * and we want the accented versions of the background color to come from the color scale, see {@link getBrandedColorScale}\n\n * See {@link getHeavyAccentedBackgroundColor} for two steps away from the background color instead of one.\n *\n * @example\n * ```ts\n * getSlightAccentedBackgroundColor('#f5f5f5').toHex(); // '#e0e0e0'\n * getSlightAccentedBackgroundColor('#f5f5f5', { primaryColor: '#2949e5' }).toHex(); // '#cdd5f9'\n * getSlightAccentedBackgroundColor('#ffffff', { shouldReturnWhiteForWhiteBackground: true }).toHex(); // '#ffffff'\n * ```\n */\nexport const getSlightAccentedBackgroundColor = (\n _backgroundColor: ColorInput,\n {\n shouldReturnWhiteForWhiteBackground = false,\n primaryColor,\n }: SlightAccentedBackgroundColorOptions = {},\n): Color => {\n const backgroundColor = new Color(_backgroundColor);\n\n if (shouldReturnWhiteForWhiteBackground && backgroundColor.toHex() === WHITE) {\n return backgroundColor;\n }\n\n return getAccentedBackground({\n backgroundColor,\n stepDistance: 1,\n primaryColor: primaryColor === undefined ? undefined : new Color(primaryColor),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,wBACX,cACA,EAAE,QAAA,OAA8D,CAAC,MACrD;CACZ,MAAM,QAAQ,uBAAuB,IAAI,MAAM,YAAY,GAAG,EAAE,MAAM,CAAC;CAEvE,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU,MAAM,OAAO,KAAK,CAAC;AACxE;;ACnBA,MAAM,yBACH,MAAA;;;;;;;AAQH,MAAa,oCACX,iBACA,oBACU;CACV,MAAM,EAAE,QAAQ,KAAK,cAAc,WACjC,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,CAClB;CACA,MAAM,oBAAoB,UAAU,WAAW,GAAG;CAIlD,MAAM,QACJ,SAAA,QAA8B,oBAAA,OAC1B,IACA,KAAK,IAAI,GAAG,SAAS,iBAAiB;CAE5C,MAAM,eAAe,cAA6B;EAChD,MAAM,CAAC,KAAK,OAAO,QAAQ,WAAW;GACpC,QAAQ,QAAQ,UAAU,WAAW,GAAG;GACxC;GACA,WAAW;EACb,CAAC;EAED,OAAO,IAAI,MAAM;GAAC;GAAK;GAAO;GAAM,gBAAgB;EAAC,CAAC;CACxD;CAEA,MAAM,OAAO,gCAAgC,eAAe;CAC5D,MAAM,UAAU,SAAS,UAAU,SAAS,aAAa,IAAI;CAC7D,MAAM,SAAS,MACb,mBAAmB,eAAe,IAAI,UAAU,kBAAkB,wBAClE,GACA,CACF;CAEA,IAAI,MAAM;CACV,IAAI,OAAO;CACX,KAAK,IAAI,YAAY,GAAG,YAAY,IAAI,aAAa,GAAG;EACtD,MAAM,UAAU,MAAM,QAAQ;EAC9B,IAAI,mBAAmB,YAAY,MAAM,CAAC,IAAI,QAC5C,MAAM;OAEN,OAAO;CAEX;CAEA,OAAO,aAAa,MAAM,QAAQ,CAAC;AACrC;;;;;;;AC/DA,MAAa,uCACX,iBACA,cACA,iBACU;CACV,MAAM,QAAQ,uBAAuB,YAAY;CACjD,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,sBAAsB,gCAAgC,eAAe;CAC3E,MAAM,UACJ,wBAAwB,UAAU,wBAAwB,aACtD,CAAC,eACD;CACN,MAAM,OAAO,MAAM,KAAK,MAAM,MAAM,OAAO,eAAe,CAAC,GAAG,GAAG,IAAI;CAErE,OAAO,MAAM,OAAO,MAAM,OAAO,SAAS,GAAG,IAAI,CAAC;AACpD;;;;;;;;;ACRA,MAAa,yBAAyB,EACpC,iBACA,cACA,mBAEA,iBAAiB,KAAA,IACb,iCAAiC,iBAAiB,YAAY,IAC9D,oCAAoC,iBAAiB,cAAc,YAAY;;;;;;;;;;;;;;;;;;;ACGrF,MAAa,mCACX,kBACA,EAAE,iBAAsD,CAAC,MAC/C;CACV,MAAM,kBAAkB,IAAI,MAAM,gBAAgB;CAElD,OAAO,sBAAsB;EAC3B;EACA,cAAc;EACd,cAAc,iBAAiB,KAAA,IAAY,KAAA,IAAY,IAAI,MAAM,YAAY;CAC/E,CAAC;AACH;;AChCA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;AA4Bd,MAAa,oCACX,kBACA,EACE,sCAAsC,OACtC,iBACwC,CAAC,MACjC;CACV,MAAM,kBAAkB,IAAI,MAAM,gBAAgB;CAElD,IAAI,uCAAuC,gBAAgB,MAAM,MAAM,OACrE,OAAO;CAGT,OAAO,sBAAsB;EAC3B;EACA,cAAc;EACd,cAAc,iBAAiB,KAAA,IAAY,KAAA,IAAY,IAAI,MAAM,YAAY;CAC/E,CAAC;AACH"}
1
+ {"version":3,"file":"color-BgYVUbOQ.js","names":[],"sources":["../src/getBrandedColorScale.ts","../src/private/getAccentedBackgroundByLightness.ts","../src/private/getBackgroundAccentFromPrimaryColor.ts","../src/private/getAccentedBackground.ts","../src/getHeavyAccentedBackgroundColor.ts","../src/getSlightAccentedBackgroundColor.ts"],"sourcesContent":["import type { ColorInput } from './types';\nimport { Color } from './Color';\nimport {\n buildBrandedColorScale,\n DEFAULT_COLOR_SCALE_STEPS,\n} from './private/buildBrandedColorScale';\n\nexport type BrandColorScaleOptions = {\n /** How many steps the scale is divided into. */\n readonly steps?: number;\n};\n\n/**\n * Builds a color scale using the derived light/dark background colors based on the given primary color,\n * with the primary color slotted into the scale wherever it fits based on lightness.\n *\n * It's important to include the primary color in the scale because the light/dark derived background colors\n * do not have the same saturation as the primary color, and we want the scale to reflect the vibrancy\n * of the primary color.\n *\n * @example\n * ```ts\n * getBrandedColorScale('#2949e5').map((color) => color.toHex());\n * // ['#ebeefd', '#d4dbfa', '#bdc8f7', '#a5b5f4', '#8da2f1', '#748eef',\n * // '#5b7aec', '#4263e8', '#2949e5', '#2539ba', '#213080', '#171f45']\n * // ^ the primary, at its own lightness\n * ```\n */\nexport const getBrandedColorScale = (\n primaryColor: ColorInput,\n { steps = DEFAULT_COLOR_SCALE_STEPS }: BrandColorScaleOptions = {},\n): Color[] => {\n const scale = buildBrandedColorScale(new Color(primaryColor), { steps });\n\n return Array.from({ length: steps }, (_, index) => scale.atStep(index));\n};\n","import type { getBackgroundAccentFromPrimaryColor } from './getBackgroundAccentFromPrimaryColor';\nimport { Color } from '../Color';\nimport { getColorLightnessClassification } from '../getColorLightnessClassification';\nimport { DEFAULT_COLOR_SCALE_STEPS } from './buildBrandedColorScale';\nimport { clamp } from './clamp';\nimport { oklchToRgb, rgbToOklch } from './colorSpace';\nimport { ACHROMATIC_CHROMA, maxChroma } from './maxChroma';\nimport { perceivedLightness } from './perceivedLightness';\n\n/**\n * Get the total distance between the lightest and darkest page background colors, measured in lightness.\n * This determines the actual step size we'll use, which correlates to the size of the step between colors\n * in a branded color scale.\n */\nconst MAX_BACKGROUND_LIGHTNESS = 0.95;\nconst MIN_BACKGROUND_LIGHTNESS = 0.09;\nconst STEP_SIZE_IN_LIGHTNESS =\n (MAX_BACKGROUND_LIGHTNESS - MIN_BACKGROUND_LIGHTNESS) / (DEFAULT_COLOR_SCALE_STEPS - 1);\n\n/**\n * Move the background color by the given distance to generate an accented background color.\n * This is used when no primary color has been provided, meaning the background color was not derived from the primary color.\n * The size of the steps used by this utility should match the size of the steps used in the\n * corresponding {@link getBackgroundAccentFromPrimaryColor} utility.\n */\nexport const getAccentedBackgroundByLightness = (\n backgroundColor: Color,\n distanceInSteps: number,\n): Color => {\n const { chroma, hue, lightness } = rgbToOklch(\n backgroundColor.r,\n backgroundColor.g,\n backgroundColor.b,\n );\n const maxPossibleChroma = maxChroma(lightness, hue);\n\n // If there is no perceptible chroma for this color or for the max possible chroma for this hue/lightness,\n // don't try to add any chroma into the result.\n const share =\n chroma < ACHROMATIC_CHROMA || maxPossibleChroma < ACHROMATIC_CHROMA\n ? 0\n : Math.min(1, chroma / maxPossibleChroma);\n\n const atLightness = (candidate: number): Color => {\n const [red, green, blue] = oklchToRgb({\n chroma: share * maxChroma(candidate, hue),\n hue,\n lightness: candidate,\n });\n\n return new Color([red, green, blue, backgroundColor.a]);\n };\n\n const band = getColorLightnessClassification(backgroundColor);\n const towards = band === 'dark' || band === 'veryDark' ? 1 : -1;\n const target = clamp(\n perceivedLightness(backgroundColor) + towards * distanceInSteps * STEP_SIZE_IN_LIGHTNESS,\n 0,\n 1,\n );\n\n let low = 0;\n let high = 1;\n for (let iteration = 0; iteration < 30; iteration += 1) {\n const middle = (low + high) / 2;\n if (perceivedLightness(atLightness(middle)) < target) {\n low = middle;\n } else {\n high = middle;\n }\n }\n\n return atLightness((low + high) / 2);\n};\n","import type { Color } from '../Color';\nimport { getColorLightnessClassification } from '../getColorLightnessClassification';\nimport { buildBrandedColorScale } from './buildBrandedColorScale';\nimport { clamp } from './clamp';\n\n/**\n * Using a branded color scale based on the primary color,\n * move the given background color by the given distance along the scale\n * to generate an accented version of the background color.\n */\nexport const getBackgroundAccentFromPrimaryColor = (\n backgroundColor: Color,\n stepDistance: number,\n primaryColor: Color,\n): Color => {\n const scale = buildBrandedColorScale(primaryColor);\n const last = scale.steps - 1;\n const colorLightnessClass = getColorLightnessClassification(backgroundColor);\n const towards =\n colorLightnessClass === 'dark' || colorLightnessClass === 'veryDark'\n ? -stepDistance\n : stepDistance;\n const from = clamp(Math.round(scale.stepOf(backgroundColor)), 0, last);\n\n return scale.atStep(clamp(from + towards, 0, last));\n};\n","import type { Color } from '../Color';\nimport { getAccentedBackgroundByLightness } from './getAccentedBackgroundByLightness';\nimport { getBackgroundAccentFromPrimaryColor } from './getBackgroundAccentFromPrimaryColor';\n\nexport type AccentedBackgroundOptions = {\n readonly backgroundColor: Color;\n readonly primaryColor?: Color | undefined;\n readonly stepDistance: number;\n};\n\n/**\n * A background `distance` steps off `background`, always in the direction away from it:\n * darker when the background is light, lighter when it is dark.\n *\n * Gets a an accented color spaced apart from the given background color by the given distance.\n * If a primary color is included, we will derive the accent color using a color scale.\n */\nexport const getAccentedBackground = ({\n backgroundColor,\n stepDistance,\n primaryColor,\n}: AccentedBackgroundOptions): Color =>\n primaryColor === undefined\n ? getAccentedBackgroundByLightness(backgroundColor, stepDistance)\n : getBackgroundAccentFromPrimaryColor(backgroundColor, stepDistance, primaryColor);\n","import type { getBrandedColorScale } from './getBrandedColorScale';\nimport type { getSlightAccentedBackgroundColor } from './getSlightAccentedBackgroundColor';\nimport type { ColorInput } from './types';\nimport { Color } from './Color';\nimport { getAccentedBackground } from './private/getAccentedBackground';\n\nexport type HeavyAccentedBackgroundColorOptions = {\n readonly primaryColor?: ColorInput;\n};\n\n/**\n * Get an accented version of a background color that is a two steps lighter/darker.\n * Use this when the color contrast of the accented background color is not significant,\n * such as for card/panel background colors.\n * \n * Accepts an optional primary color, used when the background color has been derived from the primary color,\n * and we want the accented versions of the background color to come from the color scale, see {@link getBrandedColorScale}\n\n * See {@link getSlightAccentedBackgroundColor} for a single step away from the background color instead of two.\n\n *\n * @example\n * ```ts\n * getHeavyAccentedBackgroundColor('#f5f5f5').toHex(); // '#cbcbcb'\n * getHeavyAccentedBackgroundColor('#f5f5f5', { primaryColor: '#2949e5' }).toHex(); // '#adbbf5'\n * ```\n */\nexport const getHeavyAccentedBackgroundColor = (\n _backgroundColor: ColorInput,\n { primaryColor }: HeavyAccentedBackgroundColorOptions = {},\n): Color => {\n const backgroundColor = new Color(_backgroundColor);\n\n return getAccentedBackground({\n backgroundColor,\n stepDistance: 2,\n primaryColor: primaryColor === undefined ? undefined : new Color(primaryColor),\n });\n};\n","import type { getBrandedColorScale } from './getBrandedColorScale';\nimport type { getHeavyAccentedBackgroundColor } from './getHeavyAccentedBackgroundColor';\nimport type { ColorInput } from './types';\nimport { Color } from './Color';\nimport { getAccentedBackground } from './private/getAccentedBackground';\n\nconst WHITE = '#ffffff';\n\nexport type SlightAccentedBackgroundColorOptions = {\n readonly shouldReturnWhiteForWhiteBackground?: boolean;\n /**\n * Optional primary color, which is used when the background color is derived from the primary color,\n * so we'll calculate the accented background color using a color scale.\n */\n readonly primaryColor?: ColorInput;\n};\n\n/**\n * Get an accented version of a background color that is a single step lighter/darker.\n * Use this when the color contrast of the accented background color is not significant,\n * such as for card/panel background colors.\n * \n * Accepts an optional primary color, used when the background color has been derived from the primary color,\n * and we want the accented versions of the background color to come from the color scale, see {@link getBrandedColorScale}\n\n * See {@link getHeavyAccentedBackgroundColor} for two steps away from the background color instead of one.\n *\n * @example\n * ```ts\n * getSlightAccentedBackgroundColor('#f5f5f5').toHex(); // '#e0e0e0'\n * getSlightAccentedBackgroundColor('#f5f5f5', { primaryColor: '#2949e5' }).toHex(); // '#cdd5f9'\n * getSlightAccentedBackgroundColor('#ffffff', { shouldReturnWhiteForWhiteBackground: true }).toHex(); // '#ffffff'\n * ```\n */\nexport const getSlightAccentedBackgroundColor = (\n _backgroundColor: ColorInput,\n {\n shouldReturnWhiteForWhiteBackground = false,\n primaryColor,\n }: SlightAccentedBackgroundColorOptions = {},\n): Color => {\n const backgroundColor = new Color(_backgroundColor);\n\n if (shouldReturnWhiteForWhiteBackground && backgroundColor.toHex() === WHITE) {\n return backgroundColor;\n }\n\n return getAccentedBackground({\n backgroundColor,\n stepDistance: 1,\n primaryColor: primaryColor === undefined ? undefined : new Color(primaryColor),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,wBACX,cACA,EAAE,QAAA,OAA8D,CAAC,MACrD;CACZ,MAAM,QAAQ,uBAAuB,IAAI,MAAM,YAAY,GAAG,EAAE,MAAM,CAAC;CAEvE,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU,MAAM,OAAO,KAAK,CAAC;AACxE;;ACnBA,MAAM,yBACH,MAAA;;;;;;;AAQH,MAAa,oCACX,iBACA,oBACU;CACV,MAAM,EAAE,QAAQ,KAAK,cAAc,WACjC,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,CAClB;CACA,MAAM,oBAAoB,UAAU,WAAW,GAAG;CAIlD,MAAM,QACJ,SAAA,QAA8B,oBAAA,OAC1B,IACA,KAAK,IAAI,GAAG,SAAS,iBAAiB;CAE5C,MAAM,eAAe,cAA6B;EAChD,MAAM,CAAC,KAAK,OAAO,QAAQ,WAAW;GACpC,QAAQ,QAAQ,UAAU,WAAW,GAAG;GACxC;GACA,WAAW;EACb,CAAC;EAED,OAAO,IAAI,MAAM;GAAC;GAAK;GAAO;GAAM,gBAAgB;EAAC,CAAC;CACxD;CAEA,MAAM,OAAO,gCAAgC,eAAe;CAC5D,MAAM,UAAU,SAAS,UAAU,SAAS,aAAa,IAAI;CAC7D,MAAM,SAAS,MACb,mBAAmB,eAAe,IAAI,UAAU,kBAAkB,wBAClE,GACA,CACF;CAEA,IAAI,MAAM;CACV,IAAI,OAAO;CACX,KAAK,IAAI,YAAY,GAAG,YAAY,IAAI,aAAa,GAAG;EACtD,MAAM,UAAU,MAAM,QAAQ;EAC9B,IAAI,mBAAmB,YAAY,MAAM,CAAC,IAAI,QAC5C,MAAM;OAEN,OAAO;CAEX;CAEA,OAAO,aAAa,MAAM,QAAQ,CAAC;AACrC;;;;;;;AC/DA,MAAa,uCACX,iBACA,cACA,iBACU;CACV,MAAM,QAAQ,uBAAuB,YAAY;CACjD,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,sBAAsB,gCAAgC,eAAe;CAC3E,MAAM,UACJ,wBAAwB,UAAU,wBAAwB,aACtD,CAAC,eACD;CACN,MAAM,OAAO,MAAM,KAAK,MAAM,MAAM,OAAO,eAAe,CAAC,GAAG,GAAG,IAAI;CAErE,OAAO,MAAM,OAAO,MAAM,OAAO,SAAS,GAAG,IAAI,CAAC;AACpD;;;;;;;;;ACRA,MAAa,yBAAyB,EACpC,iBACA,cACA,mBAEA,iBAAiB,KAAA,IACb,iCAAiC,iBAAiB,YAAY,IAC9D,oCAAoC,iBAAiB,cAAc,YAAY;;;;;;;;;;;;;;;;;;;ACGrF,MAAa,mCACX,kBACA,EAAE,iBAAsD,CAAC,MAC/C;CACV,MAAM,kBAAkB,IAAI,MAAM,gBAAgB;CAElD,OAAO,sBAAsB;EAC3B;EACA,cAAc;EACd,cAAc,iBAAiB,KAAA,IAAY,KAAA,IAAY,IAAI,MAAM,YAAY;CAC/E,CAAC;AACH;;AChCA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;AA4Bd,MAAa,oCACX,kBACA,EACE,sCAAsC,OACtC,iBACwC,CAAC,MACjC;CACV,MAAM,kBAAkB,IAAI,MAAM,gBAAgB;CAElD,IAAI,uCAAuC,gBAAgB,MAAM,MAAM,OACrE,OAAO;CAGT,OAAO,sBAAsB;EAC3B;EACA,cAAc;EACd,cAAc,iBAAiB,KAAA,IAAY,KAAA,IAAY,IAAI,MAAM,YAAY;CAC/E,CAAC;AACH"}
@@ -1,15 +1,15 @@
1
1
 
2
2
  /*
3
- * @license @wistia/kaleidoscope v0.0.6-beta.f342591f.779bf11
3
+ * @license @wistia/kaleidoscope v0.0.7
4
4
  *
5
5
  * Copyright (c) 2026, Wistia, Inc. and its affiliates.
6
6
  *
7
7
  * This source code is unlicensed, all rights reserved.
8
8
  */
9
9
 
10
- import { c as getBestColorForText, d as colorContrastRatiosByShape, f as Color, h as clamp, n as buildBrandedColorScale, o as getBrandLightBackgroundColor, s as getBrandDarkBackgroundColor, t as getColorLightnessClassification, u as adjustColorForProperContrast } from "./getColorLightnessClassification-CiTvv0WA.js";
11
- import { l as ORNAMENTAL_BORDER_STYLES, n as TYPE_ROLES, o as STACKABLE_ON, s as SURFACE_NAMES } from "./typography-BsBMKPss.js";
12
- import { n as isOneOf } from "./guards-Clph1WZk.js";
10
+ import { c as getBestColorForText, d as colorContrastRatiosByShape, f as Color, h as clamp, n as buildBrandedColorScale, o as getBrandLightBackgroundColor, s as getBrandDarkBackgroundColor, t as getColorLightnessClassification, u as adjustColorForProperContrast } from "./getColorLightnessClassification-C6BXD8Da.js";
11
+ import { l as ORNAMENTAL_BORDER_STYLES, n as TYPE_ROLES, o as STACKABLE_ON, s as SURFACE_NAMES } from "./typography-BLPIIq_8.js";
12
+ import { n as isOneOf } from "./guards-BJfumKYK.js";
13
13
  // src/brandTokens.ts
14
14
  /** The Brand Kit tokens a Style document can reference, each as `$<name>`. */
15
15
  const BRAND_TOKEN_NAMES = [
@@ -130,6 +130,7 @@ const resolveAnchors = (style, tokens) => {
130
130
  primary: resolveSingleColor(colors.primary, tokens),
131
131
  ground: colors.ground === void 0 ? null : resolveSingleColor(colors.ground, tokens)
132
132
  },
133
+ gradientStops: colors.gradientStops?.map((stop) => resolveSingleColor(stop, tokens)) ?? null,
133
134
  scales: {
134
135
  pageBackground: scaleBeforeTone(colors.pageBackground, tokens),
135
136
  primary: scaleBeforeTone(colors.primary, tokens),
@@ -289,6 +290,7 @@ const flat = ({ anchors, parent, settings }) => {
289
290
  };
290
291
  // src/private/engine/constants/glass.ts
291
292
  const GLASS_LIGHT_COLOR = "#ffffff";
293
+ const GLASS_SHADE_COLOR = "#000000";
292
294
  const GLASS_SHEEN_ANGLE = "135deg";
293
295
  const GLASS_SHEEN_STOPS = [
294
296
  0,
@@ -300,13 +302,18 @@ const GLASS_INPUT_ALPHA = .08;
300
302
  const GLASS_INPUT_FOCUS_ALPHA = .2;
301
303
  const BACKDROP_FILTER = "blur(10px) saturate(180%)";
302
304
  /** From the Phase 1 carousel sandbox. */
303
- const CONTAINER = {
305
+ const DARK_CONTAINER = {
304
306
  backdropFilter: BACKDROP_FILTER,
305
- edgeAlpha: .25,
306
- edgeWidth: 2,
307
+ counterEdge: ["inset -1px -1px 1px 0", .13],
308
+ edge: "inset 0 0 3px 0",
309
+ edgeAlpha: .3,
307
310
  groundAlpha: .25,
308
311
  hoverGroundAlpha: .25,
309
- innerShade: ["inset 0 4px 20px", .1],
312
+ innerShade: [
313
+ "inset 0 4px 20px",
314
+ GLASS_SHADE_COLOR,
315
+ .1
316
+ ],
310
317
  liftsParent: false,
311
318
  sheen: [
312
319
  .25,
@@ -316,27 +323,36 @@ const CONTAINER = {
316
323
  specular: ["inset 0 7px 2px -6px", "inset 10px 6px 3px -10px"],
317
324
  specularAlpha: .55
318
325
  };
319
- /** The design file gives panel and card one fill; a card has a finer edge and a denser hover. */
320
- const CARD = {
326
+ /**
327
+ * The design file gives panel and card one fill; a card has a finer edge and a denser hover. A
328
+ * shadow can't scale with its element, so the smaller tiers keep one soft highlight.
329
+ */
330
+ const DARK_CARD = {
321
331
  backdropFilter: BACKDROP_FILTER,
322
- edgeAlpha: .25,
323
- edgeWidth: 1,
332
+ counterEdge: ["inset -1px -1px 1px 0", .11],
333
+ edge: "inset 0 0 2px 0",
334
+ edgeAlpha: .28,
324
335
  groundAlpha: .25,
325
336
  hoverGroundAlpha: .37,
326
- innerShade: ["inset 0 4px 20px", .1],
337
+ innerShade: [
338
+ "inset 0 4px 20px",
339
+ GLASS_SHADE_COLOR,
340
+ .1
341
+ ],
327
342
  liftsParent: false,
328
343
  sheen: [
329
344
  .2,
330
345
  .08,
331
346
  .02
332
347
  ],
333
- specular: ["inset 0 1px 0 0", "inset 10px 0 0 -9px"],
334
- specularAlpha: .55
348
+ specular: ["inset 0 1px 2px 0"],
349
+ specularAlpha: .25
335
350
  };
336
- const CONTROL = {
351
+ const DARK_CONTROL = {
337
352
  backdropFilter: null,
338
- edgeAlpha: .25,
339
- edgeWidth: 1,
353
+ counterEdge: ["inset -1px -1px 1px 0", .09],
354
+ edge: "inset 0 0 2px 0",
355
+ edgeAlpha: .22,
340
356
  groundAlpha: .08,
341
357
  hoverGroundAlpha: .25,
342
358
  innerShade: null,
@@ -346,15 +362,61 @@ const CONTROL = {
346
362
  .08,
347
363
  .02
348
364
  ],
349
- specular: ["inset 0 1px 0 0", "inset 10px 0 0 -9px"],
350
- specularAlpha: .55
365
+ specular: ["inset 0 1px 2px 0"],
366
+ specularAlpha: .2
367
+ };
368
+ /** The design file has no light glass. A denser ground, and every shadow layer is white. */
369
+ const LIGHT_CONTAINER = {
370
+ ...DARK_CONTAINER,
371
+ counterEdge: ["inset -1px -1px 1px 0", .7],
372
+ edge: "inset 1px 1px 0 0",
373
+ edgeAlpha: .75,
374
+ groundAlpha: .45,
375
+ hoverGroundAlpha: .45,
376
+ innerShade: [
377
+ "inset 0 4px 20px",
378
+ GLASS_LIGHT_COLOR,
379
+ .35
380
+ ],
381
+ specularAlpha: .9
382
+ };
383
+ const LIGHT_CARD = {
384
+ ...DARK_CARD,
385
+ counterEdge: ["inset -1px -1px 1px 0", .6],
386
+ edgeAlpha: .85,
387
+ groundAlpha: .45,
388
+ hoverGroundAlpha: .62,
389
+ innerShade: [
390
+ "inset 0 4px 20px",
391
+ GLASS_LIGHT_COLOR,
392
+ .3
393
+ ],
394
+ specularAlpha: .8
395
+ };
396
+ const LIGHT_CONTROL = {
397
+ ...DARK_CONTROL,
398
+ counterEdge: ["inset -1px -1px 1px 0", .45],
399
+ edgeAlpha: .7,
400
+ groundAlpha: .35,
401
+ hoverGroundAlpha: .6,
402
+ liftsParent: false,
403
+ specularAlpha: .5
351
404
  };
352
405
  const GLASS_TIERS = {
353
- page: CONTAINER,
354
- panel: CONTAINER,
355
- card: CARD,
356
- buttonPrimary: CONTROL,
357
- buttonSecondary: CONTROL
406
+ dark: {
407
+ page: DARK_CONTAINER,
408
+ panel: DARK_CONTAINER,
409
+ card: DARK_CARD,
410
+ buttonPrimary: DARK_CONTROL,
411
+ buttonSecondary: DARK_CONTROL
412
+ },
413
+ light: {
414
+ page: LIGHT_CONTAINER,
415
+ panel: LIGHT_CONTAINER,
416
+ card: LIGHT_CARD,
417
+ buttonPrimary: LIGHT_CONTROL,
418
+ buttonSecondary: LIGHT_CONTROL
419
+ }
358
420
  };
359
421
  // src/private/engine/rules/text.ts
360
422
  const TEXT_SLOTS = {
@@ -416,7 +478,6 @@ const hoverTextSlots = (surface, textColor, text, solidHover) => {
416
478
  };
417
479
  const textGaps = ({ textColor }) => textColor === "derive" || isPreference(textColor) || isLiteral(textColor) ? [] : [`textColor: ${JSON.stringify(textColor)}`];
418
480
  // src/private/engine/treatments/glassy.ts
419
- const BLACK = new Color("#000000");
420
481
  const LIGHT = new Color(GLASS_LIGHT_COLOR);
421
482
  /** `top` laid over `under`, flattened to the opaque color the eye sees. */
422
483
  const composite = (top, under) => new Color([
@@ -429,20 +490,22 @@ const sheen = ({ sheen: alphas }) => {
429
490
  const stops = alphas.map((alpha, index) => `${LIGHT.withAlpha(alpha).toRgba()} ${GLASS_SHEEN_STOPS[index] ?? 100}%`);
430
491
  return `linear-gradient(${GLASS_SHEEN_ANGLE}, ${stops.join(", ")})`;
431
492
  };
432
- /** Inner shade, then the edge in the surface's text color, then the specular highlights. */
433
- const glassShadowLayers = (tier, text) => [
434
- ...tier.innerShade === null ? [] : [`${tier.innerShade[0]} ${BLACK.withAlpha(tier.innerShade[1]).toRgba()}`],
435
- `inset 0 0 0 ${tier.edgeWidth}px ${text.withAlpha(tier.edgeAlpha).toRgba()}`,
436
- ...tier.specular.map((geometry) => `${geometry} ${LIGHT.withAlpha(tier.specularAlpha).toRgba()}`)
493
+ /** Inner shade, then the edge, then the specular highlights and the fainter edge opposite them. */
494
+ const glassShadowLayers = (tier) => [
495
+ ...tier.innerShade === null ? [] : [`${tier.innerShade[0]} ${new Color(tier.innerShade[1]).withAlpha(tier.innerShade[2]).toRgba()}`],
496
+ `${tier.edge} ${LIGHT.withAlpha(tier.edgeAlpha).toRgba()}`,
497
+ ...tier.specular.map((geometry) => `${geometry} ${LIGHT.withAlpha(tier.specularAlpha).toRgba()}`),
498
+ `${tier.counterEdge[0]} ${LIGHT.withAlpha(tier.counterEdge[1]).toRgba()}`
437
499
  ];
438
500
  /**
439
501
  * A translucent ground under a sheen. `solid` is that ground flattened over the parent, so text and
440
502
  * children resolve against what the eye sees.
441
503
  */
442
504
  const glassy = ({ anchors, parent, settings, surface }) => {
443
- const tier = GLASS_TIERS[surface];
444
505
  const { offset, source } = settings.backgroundColor;
445
506
  const sourceColor = source === "parent" ? parent?.solid ?? anchorColor("anchors.colors.pageBackground", anchors) : anchorColor(source, anchors);
507
+ const tone = (anchors.colors.ground ?? sourceColor).luminance() < .2 ? "dark" : "light";
508
+ const tier = GLASS_TIERS[tone][surface];
446
509
  const inherited = source === "parent" ? parent?.scale ?? null : anchors.scales[anchorName(source)];
447
510
  const base = stepAlong(inherited ?? scaleOf(sourceColor), sourceColor, offset);
448
511
  const under = parent?.solid ?? base;
@@ -471,15 +534,85 @@ const glassy = ({ anchors, parent, settings, surface }) => {
471
534
  "input-background-color": text.withAlpha(GLASS_INPUT_ALPHA).toRgba(),
472
535
  "input-background-color-focus": text.withAlpha(GLASS_INPUT_FOCUS_ALPHA).toRgba()
473
536
  },
474
- shadowLayers: glassShadowLayers(tier, text)
537
+ shadowLayers: glassShadowLayers(tier)
538
+ })
539
+ };
540
+ };
541
+ // src/private/engine/constants/gradient.ts
542
+ /**
543
+ * `glows`: soft orbs in the stop colors over the surface's own fill. A dark fill swallows them, so
544
+ * there they are stronger and fuller. Placeholder.
545
+ */
546
+ const GLOWS = {
547
+ alpha: .42,
548
+ size: "62% 56%",
549
+ fadeStop: 70,
550
+ darkFillLuminance: .2,
551
+ dark: {
552
+ alpha: .72,
553
+ size: "72% 66%",
554
+ midAlphaFactor: .6,
555
+ midStop: 38,
556
+ fadeStop: 72
557
+ },
558
+ positions: [
559
+ "14% 16%",
560
+ "86% 22%",
561
+ "62% 92%",
562
+ "10% 80%",
563
+ "48% 50%",
564
+ "94% 66%"
565
+ ]
566
+ };
567
+ // src/private/engine/treatments/gradient.ts
568
+ const glowLayer = (stop, position, onDark) => {
569
+ if (onDark) {
570
+ const { alpha, fadeStop, midAlphaFactor, midStop, size } = GLOWS.dark;
571
+ return `radial-gradient(${size} at ${position}, ${stop.withAlpha(alpha).toRgba()} 0%, ${stop.withAlpha(alpha * midAlphaFactor).toRgba()} ${midStop}%, transparent ${fadeStop}%)`;
572
+ }
573
+ return `radial-gradient(${GLOWS.size} at ${position}, ${stop.withAlpha(GLOWS.alpha).toRgba()} 0%, transparent ${GLOWS.fadeStop}%)`;
574
+ };
575
+ const glowsImage = (stops, fill) => {
576
+ const onDark = fill.luminance() < GLOWS.darkFillLuminance;
577
+ return stops.map((stop, index) => glowLayer(stop, GLOWS.positions[index % GLOWS.positions.length] ?? "center", onDark)).join(", ");
578
+ };
579
+ /**
580
+ * Gradient layers over the surface's own fill. The fill is `solid`: it is what text is solved
581
+ * against, so nothing derives a color from the layers moving over it.
582
+ */
583
+ const gradient = ({ anchors, parent, settings }) => {
584
+ const { gradientStops } = anchors;
585
+ if (gradientStops === null) throw new Error("anchors.colors.gradientStops is referenced but not declared");
586
+ const { from, offset, source } = settings.backgroundColor;
587
+ const sourceColor = source === "parent" ? parent?.solid ?? anchorColor("anchors.colors.pageBackground", anchors) : anchorColor(source, anchors);
588
+ const scale = (source === "parent" ? parent?.scale ?? null : anchors.scales[anchorName(source)]) ?? scaleOf(sourceColor);
589
+ const start = from === "parent" && parent !== null ? parent.solid : sourceColor;
590
+ const solid = stepAlong(scale, start, offset);
591
+ const image = glowsImage(gradientStops, solid);
592
+ return {
593
+ solid,
594
+ scale,
595
+ fill: {
596
+ "background-color": solid.toHex(),
597
+ "background-image": image
598
+ },
599
+ hover: () => ({
600
+ solid,
601
+ slots: {
602
+ "background-color-hover": solid.toHex(),
603
+ "background-image-hover": image
604
+ }
475
605
  })
476
606
  };
477
607
  };
608
+ /** Only `glows` so far. */
609
+ const gradientGaps = ({ gradientShape }) => gradientShape === void 0 || gradientShape.kind === "glows" ? [] : [`gradientShape: ${gradientShape.kind}`];
478
610
  // src/private/engine/treatments/index.ts
479
611
  /** The treatments the engine can paint. A Style using any other is not supported yet. */
480
612
  const TREATMENT_FUNCTIONS = {
481
613
  flat,
482
- glassy
614
+ glassy,
615
+ gradient
483
616
  };
484
617
  // src/private/engine/rules/fill.ts
485
618
  /**
@@ -501,7 +634,18 @@ const HOVER_FILL_SLOTS = {
501
634
  "background-image-hover": "none"
502
635
  }
503
636
  };
504
- const fillGaps = ({ treatment }) => Object.hasOwn(TREATMENT_FUNCTIONS, treatment) ? [] : [`treatment: ${treatment}`];
637
+ /** Glass has a fixed ground that its parent shows through, so it can't count from its parent. */
638
+ const fromGaps = ({ backgroundColor: { from }, treatment }) => treatment === "glassy" && from === "parent" ? ["backgroundColor.from: parent"] : [];
639
+ /** Inverting repaints a surface as a flat fill, so no other treatment can invert. */
640
+ const invertGaps = ({ backgroundColor: { invert }, treatment }) => treatment === "flat" || invert === "never" ? [] : [`backgroundColor.invert: ${invert}`];
641
+ const fillGaps = (settings) => {
642
+ const { treatment } = settings;
643
+ return [
644
+ ...Object.hasOwn(TREATMENT_FUNCTIONS, treatment) ? [] : [`treatment: ${treatment}`],
645
+ ...fromGaps(settings),
646
+ ...invertGaps(settings)
647
+ ];
648
+ };
505
649
  // src/private/engine/constants/motion.ts
506
650
  /** How long a surface takes to move between states. Placeholder. */
507
651
  const TRANSITION_DURATIONS = {
@@ -517,21 +661,39 @@ const TRANSITIONED_PROPERTIES = [
517
661
  "color"
518
662
  ];
519
663
  const TRANSITION_EASING = "ease";
664
+ /** How long one drift takes per speed. */
665
+ const DRIFT_DURATIONS = {
666
+ slow: "10s",
667
+ medium: "6s",
668
+ fast: "3s"
669
+ };
520
670
  // src/private/engine/rules/motion.ts
521
671
  const MOTION_SLOTS = {
522
672
  surfaces: SURFACE_NAMES,
523
- initialValues: {
524
- transition: "none",
525
- animation: "none"
526
- }
673
+ initialValues: { transition: "none" }
527
674
  };
528
- const motionSlots = ({ transition }) => {
675
+ /**
676
+ * Only how long a page's drift takes. The contract is CSS variables only, so each consumer writes
677
+ * its own `@keyframes` and the layer that moves. `0s` means the page is still. Other surfaces have
678
+ * no animation slots until a Style first animates one.
679
+ */
680
+ const PAGE_ANIMATION_SLOTS = {
681
+ surfaces: ["page"],
682
+ initialValues: { "animation-duration": "0s" }
683
+ };
684
+ const transitionSlots = (transition) => {
529
685
  const duration = TRANSITION_DURATIONS[transition];
530
686
  if (duration === null) return {};
531
687
  return { transition: TRANSITIONED_PROPERTIES.map((property) => `${property} ${duration} ${TRANSITION_EASING}`).join(", ") };
532
688
  };
533
- /** No ambient motion yet. */
534
- const motionGaps = ({ motion: { ambient } }) => ambient === "none" ? [] : [`motion.ambient: ${ambient}`];
689
+ /** `motionGaps` only lets `drift` through on the page, so this never names another surface's slot. */
690
+ const driftSlots = ({ ambient, speed }) => ambient === "drift" ? { "animation-duration": DRIFT_DURATIONS[speed] } : {};
691
+ const motionSlots = (motion) => ({
692
+ ...transitionSlots(motion.transition),
693
+ ...driftSlots(motion)
694
+ });
695
+ /** Only the page drifts so far, and nothing pulses. */
696
+ const motionGaps = ({ motion: { ambient } }, surface) => ambient === "none" || ambient === "drift" && surface === "page" ? [] : [`motion.ambient: ${ambient}`];
535
697
  // src/private/engine/rules/panelInput.ts
536
698
  /** The form fields inside a panel. */
537
699
  const PANEL_INPUT_SLOTS = {
@@ -605,7 +767,8 @@ const SURFACE_SLOT_FRAGMENTS = [
605
767
  BORDER_SLOTS,
606
768
  ELEVATION_SLOTS,
607
769
  RADIUS_SLOTS,
608
- MOTION_SLOTS
770
+ MOTION_SLOTS,
771
+ PAGE_ANIMATION_SLOTS
609
772
  ];
610
773
  const surfaceContract = () => Object.fromEntries(SURFACE_GROUPS.flatMap(({ prefix, surface }) => SURFACE_SLOT_FRAGMENTS.filter(({ surfaces }) => surfaces.includes(surface)).flatMap(({ initialValues }) => Object.entries(initialValues).map(([slot, value]) => [surfaceVariable(prefix, slot), value]))));
611
774
  // src/kaleidoscopeContract.ts
@@ -705,6 +868,7 @@ const textureGaps = ({ texture: { kind } }) => kind === "none" ? [] : [`texture.
705
868
  // src/private/engine/support.ts
706
869
  const GAP_FINDERS = [
707
870
  fillGaps,
871
+ gradientGaps,
708
872
  textGaps,
709
873
  borderGaps,
710
874
  elevationGaps,
@@ -712,7 +876,7 @@ const GAP_FINDERS = [
712
876
  textureGaps
713
877
  ];
714
878
  /** The rules in `style` the engine cannot resolve yet, as `<surface>.<setting>: <value>`. */
715
- const findUnsupportedRules = (style) => SURFACE_NAMES.flatMap((surface) => GAP_FINDERS.flatMap((findGaps) => findGaps(style.surfaces[surface])).map((gap) => `${surface}.${gap}`));
879
+ const findUnsupportedRules = (style) => SURFACE_NAMES.flatMap((surface) => GAP_FINDERS.flatMap((findGaps) => findGaps(style.surfaces[surface], surface)).map((gap) => `${surface}.${gap}`));
716
880
  // src/getKaleidoscopeStyles.ts
717
881
  const resolveAgainstDefaultValues = (resolved) => ({
718
882
  ...KALEIDOSCOPE_CONTRACT,
@@ -799,4 +963,4 @@ const serializeKaleidoscopeStyles = (variables, selector) => {
799
963
  };
800
964
  export { BRAND_TOKEN_NAMES as a, VARIABLE_PREFIX as i, getKaleidoscopeStyles as n, DEFAULT_BRAND_TOKENS as o, KALEIDOSCOPE_CONTRACT as r, serializeKaleidoscopeStyles as t };
801
965
 
802
- //# sourceMappingURL=engine-BcKhqeRK.js.map
966
+ //# sourceMappingURL=engine-DHDkDPaV.js.map