@wistia/kaleidoscope 0.0.8-beta.f2dc5ca6.c2f8c88 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/dist/{color-D2SNSI_W.js → color-BwvIDNP5.js} +3 -3
- package/dist/{color-D2SNSI_W.js.map → color-BwvIDNP5.js.map} +1 -1
- package/dist/{engine-sznOocpz.d.ts → engine-DI3tsQ5q.d.ts} +2 -2
- package/dist/{engine-sznOocpz.d.ts.map → engine-DI3tsQ5q.d.ts.map} +1 -1
- package/dist/{engine-DPLJAH4D.js → engine-DY848hAQ.js} +662 -413
- package/dist/engine-DY848hAQ.js.map +1 -0
- package/dist/entries/color.js +3 -3
- package/dist/entries/engine.d.ts +1 -1
- package/dist/entries/engine.js +2 -2
- package/dist/entries/styleRegistry.d.ts +1 -1
- package/dist/entries/styleRegistry.js +2 -2
- package/dist/entries/validate.d.ts +1 -1
- package/dist/entries/validate.js +2 -2
- package/dist/entries/vocabulary.d.ts +2 -2
- package/dist/entries/vocabulary.js +3 -3
- package/dist/{getColorLightnessClassification-DvWhKjDO.js → getColorLightnessClassification-BkZcKrdi.js} +2 -2
- package/dist/{getColorLightnessClassification-DvWhKjDO.js.map → getColorLightnessClassification-BkZcKrdi.js.map} +1 -1
- package/dist/{guards-CCPttJfH.js → guards-Cyl-NUQX.js} +2 -2
- package/dist/{guards-CCPttJfH.js.map → guards-Cyl-NUQX.js.map} +1 -1
- package/dist/{index-1xRhKgqX.d.ts → index-L5x6rNF_.d.ts} +9 -9
- package/dist/{index-1xRhKgqX.d.ts.map → index-L5x6rNF_.d.ts.map} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/{styleRegistry-8kp2fPOI.js → styleRegistry-BQVgtgLT.js} +74 -74
- package/dist/styleRegistry-BQVgtgLT.js.map +1 -0
- package/dist/{styleRegistry-BXN0J8-z.d.ts → styleRegistry-C7HARIpw.d.ts} +2 -2
- package/dist/{styleRegistry-BXN0J8-z.d.ts.map → styleRegistry-C7HARIpw.d.ts.map} +1 -1
- package/dist/{styleVocabulary-2aioNq4D.js → styleVocabulary-BJuyoSBc.js} +2 -2
- package/dist/{styleVocabulary-2aioNq4D.js.map → styleVocabulary-BJuyoSBc.js.map} +1 -1
- package/dist/{typography-CfCeqJO6.js → typography-BpeDYjMz.js} +8 -3
- package/dist/typography-BpeDYjMz.js.map +1 -0
- package/dist/{validate-Cu-b5mX1.d.ts → validate-BzIATwDA.d.ts} +2 -2
- package/dist/{validate-Cu-b5mX1.d.ts.map → validate-BzIATwDA.d.ts.map} +1 -1
- package/dist/{validate-3O3e7XFT.js → validate-DcGjEAHf.js} +56 -34
- package/dist/validate-DcGjEAHf.js.map +1 -0
- package/package.json +4 -4
- package/schema/style-v1.json +53 -20
- package/styles/aurora-dark.json +8 -8
- package/styles/aurora-light.json +8 -8
- package/styles/glass-dark.json +8 -8
- package/styles/glass-light.json +8 -8
- package/styles/opaque-bright.json +8 -8
- package/styles/opaque-heavy.json +8 -8
- package/styles/opaque-light.json +8 -8
- package/styles/opaque-medium.json +8 -8
- package/styles/opaque-minimal.json +8 -8
- package/dist/engine-DPLJAH4D.js.map +0 -1
- package/dist/styleRegistry-8kp2fPOI.js.map +0 -1
- package/dist/typography-CfCeqJO6.js.map +0 -1
- package/dist/validate-3O3e7XFT.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @wistia/kaleidoscope
|
|
2
|
+
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4686](https://github.com/wistia/vhs/pull/4686) [`77dc97d`](https://github.com/wistia/vhs/commit/77dc97dbf6e011bcd520929f5bb435d620849510) Thanks [@bim-kryant](https://github.com/bim-kryant)! - A border sourced from a toned color anchor (one declared with `tone: dark` or `tone: light`) now steps `border.offset` along its Brand Kit token's scale, so it keeps the brand's hue, as text colors sourced from an anchor already do. Borders sourced from `surface` or from an untoned anchor are unchanged, as are the pre-defined Styles' values. The engine's resolution of `dashed`, `dotted` and `double` lines, anchor-sourced borders, and surface-sourced borders on flat, glassy and gradient surfaces is now covered by tests.
|
|
8
|
+
|
|
9
|
+
- [#4710](https://github.com/wistia/vhs/pull/4710) [`896078d`](https://github.com/wistia/vhs/commit/896078db6900bbd23a3a5fb3aa2a2b7cea7500c2) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The Style document schema and `validateStyleDocument()` now reject three combinations the engine never resolved: a glassy surface whose `backgroundColor.from` is `parent` (glass has a fixed ground that its parent shows through), an `ambient` of `drift` on any surface but the page, and an `ambient` of `pulse` on the page, which has no edge. A document using any of them was already refused by `getKaleidoscopeStyles()`; it now fails validation instead, with a message naming the field. None of the pre-defined Styles use them.
|
|
10
|
+
|
|
11
|
+
- [#4702](https://github.com/wistia/vhs/pull/4702) [`81e956d`](https://github.com/wistia/vhs/commit/81e956d2b86b08f2a9fb2d5f7510f917c5cf418f) Thanks [@bim-kryant](https://github.com/bim-kryant)! - A surface's `texture` can now carry an optional `color`: a literal, a token reference like `"$primaryColor"`, or `{ from, relation, tone }`. Grain and static tint their noise with it, and halftone draws its dots in it. Without a color a texture stays neutral, as before. A texture of kind `none` takes no color. No variables are added to the contract.
|
|
12
|
+
|
|
13
|
+
## 0.0.8
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#4671](https://github.com/wistia/vhs/pull/4671) [`f676e18`](https://github.com/wistia/vhs/commit/f676e184e41d344cec776da7ec30b44fbeb5e68e) Thanks [@bim-kryant](https://github.com/bim-kryant)! - The token engine now resolves `pulse` ambient motion on every surface except the page, where it's reported as unsupported. A pulsing surface sets the required `motion.pulseColor`: `derive` to use its elevation color, an anchor reference, or a color. It also sets the required `motion.pulseSize`: `small`, `medium` or `large`. The variable contract adds `--wistia-kaleidoscope-<surface>-pulse-duration`, which is `0s` when a surface doesn't pulse, `--wistia-kaleidoscope-<surface>-pulse-color` and `--wistia-kaleidoscope-<surface>-pulse-box-shadow`. As with drift, the package ships no keyframes: a consumer writes its own `@keyframes` and reads these values from the contract.
|
|
18
|
+
|
|
19
|
+
- [#4698](https://github.com/wistia/vhs/pull/4698) [`3a0a429`](https://github.com/wistia/vhs/commit/3a0a429f16222e3f0ba31c511a7051595b14949d) Thanks [@bim-kryant](https://github.com/bim-kryant)! - A surface's `gradientShape` can now carry its own `stops`, a list of 2-6 colors in the same forms as `anchors.colors.gradientStops`, which it draws in place of the Style's. A Style whose every gradient carries its own stops no longer needs `anchors.colors.gradientStops`, and declaring it then is warned about as unused. No variables are added to the contract.
|
|
20
|
+
|
|
21
|
+
- [#4699](https://github.com/wistia/vhs/pull/4699) [`4c1b941`](https://github.com/wistia/vhs/commit/4c1b941dc8675bdd66e0d33faad29e060eace301) Thanks [@bim-kryant](https://github.com/bim-kryant)! - Gradient stops must now be opaque, in `anchors.colors.gradientStops` and in a `gradientShape`'s own `stops` alike. A literal stop with alpha, such as `#00000000`, `#0008`, `rgba(0, 0, 0, 0.5)` or `rgb(0 0 0 / 50%)`, is rejected by the validator and the JSON schema. Text over a gradient is checked against its stops as painted, and a see-through stop would show whatever is behind it instead. Single-color anchors still accept alpha.
|
|
22
|
+
|
|
23
|
+
## 0.0.7
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [#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.
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
- [#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.
|
|
32
|
+
|
|
33
|
+
## 0.0.6
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [#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.
|
|
38
|
+
|
|
39
|
+
- [#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.
|
|
40
|
+
|
|
41
|
+
- [#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.
|
|
42
|
+
|
|
43
|
+
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`.
|
|
44
|
+
|
|
45
|
+
- [#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.
|
|
46
|
+
|
|
47
|
+
- [#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.
|
|
48
|
+
|
|
49
|
+
- [#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.
|
|
50
|
+
|
|
51
|
+
## 0.0.5
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- [#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`.
|
|
56
|
+
|
|
57
|
+
- [#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`.
|
|
58
|
+
|
|
59
|
+
- [#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`.
|
|
60
|
+
|
|
61
|
+
- [#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.
|
|
62
|
+
|
|
63
|
+
## 0.0.4
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- [#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 }`.
|
|
68
|
+
|
|
69
|
+
## 0.0.3
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- [#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.
|
|
74
|
+
|
|
75
|
+
Set up sub-path imports.
|
|
76
|
+
|
|
77
|
+
## 0.0.2
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- [#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
|
|
82
|
+
|
|
83
|
+
## 0.0.1
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- [#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.
|
|
3
|
+
* @license @wistia/kaleidoscope v0.0.9
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is unlicensed, all rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { a as maxChroma, f as Color, g as clamp, h as rgbToOklch, m as oklchToRgb, n as buildBrandedColorScale, r as perceivedLightness, t as getColorLightnessClassification } from "./getColorLightnessClassification-
|
|
10
|
+
import { a as maxChroma, f as Color, g as clamp, h as rgbToOklch, m as oklchToRgb, n as buildBrandedColorScale, r as perceivedLightness, t as getColorLightnessClassification } from "./getColorLightnessClassification-BkZcKrdi.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-
|
|
148
|
+
//# sourceMappingURL=color-BwvIDNP5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-D2SNSI_W.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-BwvIDNP5.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,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as StyleDocument } from "./index-
|
|
2
|
+
import { n as StyleDocument } from "./index-L5x6rNF_.js";
|
|
3
3
|
/** The Brand Kit tokens a Style document can reference, each as `$<name>`. */
|
|
4
4
|
declare const BRAND_TOKEN_NAMES: readonly ["primaryColor", "pageBackgroundColor", "borderRadius", "headingFontFamily", "bodyFontFamily", "buttonFontFamily"];
|
|
5
5
|
type BrandTokenName = (typeof BRAND_TOKEN_NAMES)[number];
|
|
@@ -84,4 +84,4 @@ declare const getKaleidoscopeStyles: (style: StyleDocument, brandTokens?: BrandT
|
|
|
84
84
|
*/
|
|
85
85
|
declare const serializeKaleidoscopeStyles: (variables: KaleidoscopeVariables, selector: string) => string;
|
|
86
86
|
export { KaleidoscopeVariables as a, BrandTokenName as c, KaleidoscopeVariableName as i, BrandTokens as l, getKaleidoscopeStyles as n, VARIABLE_PREFIX as o, KALEIDOSCOPE_CONTRACT as r, BRAND_TOKEN_NAMES as s, serializeKaleidoscopeStyles as t, DEFAULT_BRAND_TOKENS as u };
|
|
87
|
-
//# sourceMappingURL=engine-
|
|
87
|
+
//# sourceMappingURL=engine-DI3tsQ5q.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-
|
|
1
|
+
{"version":3,"file":"engine-DI3tsQ5q.d.ts","names":[],"sources":["../src/brandTokens.ts","../src/private/engine/slots.ts","../src/kaleidoscopeContract.ts","../src/getKaleidoscopeStyles.ts","../src/serializeKaleidoscopeStyles.ts"],"mappings":";;;cACa;KAQD,yBAAyB;;;;;;;;KASzB;WACD;WACA;WACA;WACA;WACA;WACA;;;cAIE,sBAAsB,SAAS;cCvB/B;KACD,yBAAyB;;KCAzB,2BAA2B;;;;;;KAO3B,wBAAwB,SAAS,OAAO;;;;;;;;;;;;;;;;;;cAmBvC,uBAAuB;;;;;;;;;;;;;;;;;cCFvB,wBACX,OAAO,eACP,cAAa,gBACZ;;;;;;;;;;;;;;;;;;cCgCU,8BACX,WAAW,uBACX"}
|