@wistia/kaleidoscope 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{color-BuPhQjcd.js → color-BwvIDNP5.js} +3 -3
  3. package/dist/{color-BuPhQjcd.js.map → color-BwvIDNP5.js.map} +1 -1
  4. package/dist/{engine-CcU0Q8Jg.d.ts → engine-DI3tsQ5q.d.ts} +2 -2
  5. package/dist/{engine-CcU0Q8Jg.d.ts.map → engine-DI3tsQ5q.d.ts.map} +1 -1
  6. package/dist/{engine-6ocr431e.js → engine-DY848hAQ.js} +703 -428
  7. package/dist/engine-DY848hAQ.js.map +1 -0
  8. package/dist/entries/color.js +3 -3
  9. package/dist/entries/engine.d.ts +1 -1
  10. package/dist/entries/engine.js +2 -2
  11. package/dist/entries/styleRegistry.d.ts +1 -1
  12. package/dist/entries/styleRegistry.js +2 -2
  13. package/dist/entries/validate.d.ts +1 -1
  14. package/dist/entries/validate.js +2 -2
  15. package/dist/entries/vocabulary.d.ts +2 -2
  16. package/dist/entries/vocabulary.js +3 -3
  17. package/dist/{getColorLightnessClassification-Dgr8qirZ.js → getColorLightnessClassification-BkZcKrdi.js} +3 -3
  18. package/dist/getColorLightnessClassification-BkZcKrdi.js.map +1 -0
  19. package/dist/{guards-BPewjm9T.js → guards-Cyl-NUQX.js} +2 -2
  20. package/dist/{guards-BPewjm9T.js.map → guards-Cyl-NUQX.js.map} +1 -1
  21. package/dist/{index-BTumAeju.d.ts → index-L5x6rNF_.d.ts} +13 -9
  22. package/dist/{index-BTumAeju.d.ts.map → index-L5x6rNF_.d.ts.map} +1 -1
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +8 -8
  25. package/dist/{styleRegistry-BqGmp-3z.js → styleRegistry-BQVgtgLT.js} +74 -74
  26. package/dist/styleRegistry-BQVgtgLT.js.map +1 -0
  27. package/dist/{styleRegistry-BsMmbH_0.d.ts → styleRegistry-C7HARIpw.d.ts} +2 -2
  28. package/dist/{styleRegistry-BsMmbH_0.d.ts.map → styleRegistry-C7HARIpw.d.ts.map} +1 -1
  29. package/dist/{styleVocabulary-CDTPCMhZ.js → styleVocabulary-BJuyoSBc.js} +2 -2
  30. package/dist/{styleVocabulary-CDTPCMhZ.js.map → styleVocabulary-BJuyoSBc.js.map} +1 -1
  31. package/dist/{typography-BCKqcNDx.js → typography-BpeDYjMz.js} +8 -3
  32. package/dist/typography-BpeDYjMz.js.map +1 -0
  33. package/dist/{validate-8Ow1tYvz.d.ts → validate-BzIATwDA.d.ts} +2 -2
  34. package/dist/{validate-8Ow1tYvz.d.ts.map → validate-BzIATwDA.d.ts.map} +1 -1
  35. package/dist/{validate-D_VsJM1q.js → validate-DcGjEAHf.js} +75 -37
  36. package/dist/validate-DcGjEAHf.js.map +1 -0
  37. package/package.json +1 -1
  38. package/schema/style-v1.json +70 -21
  39. package/styles/aurora-dark.json +8 -8
  40. package/styles/aurora-light.json +8 -8
  41. package/styles/glass-dark.json +8 -8
  42. package/styles/glass-light.json +8 -8
  43. package/styles/opaque-bright.json +8 -8
  44. package/styles/opaque-heavy.json +8 -8
  45. package/styles/opaque-light.json +8 -8
  46. package/styles/opaque-medium.json +8 -8
  47. package/styles/opaque-minimal.json +8 -8
  48. package/dist/engine-6ocr431e.js.map +0 -1
  49. package/dist/getColorLightnessClassification-Dgr8qirZ.js.map +0 -1
  50. package/dist/styleRegistry-BqGmp-3z.js.map +0 -1
  51. package/dist/typography-BCKqcNDx.js.map +0 -1
  52. package/dist/validate-D_VsJM1q.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine-6ocr431e.js","names":[],"sources":["../src/brandTokens.ts","../src/private/engine/constants/color.ts","../src/private/engine/scale.ts","../src/private/engine/anchors.ts","../src/private/engine/rules/border.ts","../src/private/engine/constants/elevation.ts","../src/private/engine/kebab.ts","../src/private/engine/surfaces.ts","../src/private/engine/rules/elevation.ts","../src/private/engine/slots.ts","../src/private/engine/rules/fill.ts","../src/private/engine/constants/motion.ts","../src/private/engine/rules/motion.ts","../src/private/engine/rules/panelInput.ts","../src/private/engine/constants/radius.ts","../src/private/engine/rules/radius.ts","../src/private/engine/rules/text.ts","../src/private/engine/constants/texture.ts","../src/private/engine/rules/texture.ts","../src/private/engine/constants/typography.ts","../src/private/engine/rules/typography.ts","../src/private/engine/contract.ts","../src/kaleidoscopeContract.ts","../src/private/engine/treatments/flat.ts","../src/private/engine/rules/invert.ts","../src/private/engine/composite.ts","../src/private/engine/constants/glass.ts","../src/private/engine/constants/gradient.ts","../src/private/engine/constants/tuning.ts","../src/private/engine/treatments/glassy.ts","../src/private/engine/treatments/gradient.ts","../src/private/engine/treatments/none.ts","../src/private/engine/treatments/index.ts","../src/private/engine/evaluateSurfaces.ts","../src/private/engine/support.ts","../src/getKaleidoscopeStyles.ts","../src/serializeKaleidoscopeStyles.ts"],"sourcesContent":["/** The Brand Kit tokens a Style document can reference, each as `$<name>`. */\nexport const BRAND_TOKEN_NAMES = [\n 'primaryColor',\n 'pageBackgroundColor',\n 'borderRadius',\n 'headingFontFamily',\n 'bodyFontFamily',\n 'buttonFontFamily',\n] as const;\nexport type BrandTokenName = (typeof BRAND_TOKEN_NAMES)[number];\n\n/**\n * The Brand Kit values `getKaleidoscopeStyles()` resolves a Style against. Colors are CSS colors,\n * `borderRadius` is in pixels, and the font families are CSS `font-family` values.\n *\n * Every token is optional: a token the Style references but the Brand Kit leaves out takes its\n * {@link DEFAULT_BRAND_TOKENS | default}.\n */\nexport type BrandTokens = {\n readonly bodyFontFamily?: string;\n readonly borderRadius?: number;\n readonly buttonFontFamily?: string;\n readonly headingFontFamily?: string;\n readonly pageBackgroundColor?: string;\n readonly primaryColor?: string;\n};\n\n/** What a missing Brand Kit token falls back to: Wistia's own brand. */\nexport const DEFAULT_BRAND_TOKENS: Required<BrandTokens> = {\n primaryColor: '#2949e5',\n pageBackgroundColor: '#ffffff',\n borderRadius: 20,\n headingFontFamily: 'GT Walsheim',\n bodyFontFamily: 'Inter',\n buttonFontFamily: 'Inter',\n};\n","import type { ColorRelationship } from '../../../styleVocabulary';\nimport { colorContrastRatiosByShape } from '../../../colorContrastRatiosByShape';\n\n/** Degrees a `relation` turns a hue, measured around the Lab a/b plane. Placeholder. */\nexport const RELATION_HUE_DEGREES = {\n same: 0,\n analogous: 30,\n triad: 120,\n complementary: 180,\n} satisfies Record<ColorRelationship, number>;\n\n/** Contrast below which a flat fill is pushed one more step from its parent. Placeholder. */\nexport const SEPARATION_MIN_CONTRAST = 1.1;\n\n/** WCAG non-text contrast: below this a fill does not read as a shape against its parent. */\nexport const INVERT_BELOW_CONTRAST = colorContrastRatiosByShape.nonText;\n\n/** How far low-emphasis text fades from the surface's text color. Placeholder. */\nexport const LOW_EMPHASIS_TEXT_ALPHA = 0.7;\n\n/** How far a hover fill must sit from the resting fill and the parent to be seen. */\nexport const HOVER_MIN_CONTRAST = 1.1;\n\n/** How strongly a surface with no fill washes in its text color on hover. Placeholder. */\nexport const NONE_HOVER_WASH_ALPHA = 0.08;\n","import type { BrandedColorScale } from '../buildBrandedColorScale';\nimport { Color } from '../../Color';\nimport { getColorLightnessClassification } from '../../getColorLightnessClassification';\nimport { buildBrandedColorScale } from '../buildBrandedColorScale';\nimport { clamp } from '../clamp';\n\nexport type Scale = BrandedColorScale;\n\nconst MAX_CACHED_SCALES = 600;\nconst scaleCache = new Map<string, Scale>();\n\n/** The branded scale through `color`, cached because every surface of every Style asks for it. */\nexport const scaleOf = (color: Color): Scale => {\n const hex = color.toHex();\n let scale = scaleCache.get(hex);\n\n if (scale === undefined) {\n if (scaleCache.size >= MAX_CACHED_SCALES) {\n scaleCache.clear();\n }\n\n scale = buildBrandedColorScale(new Color(hex));\n scaleCache.set(hex, scale);\n }\n\n return scale;\n};\n\nconst lastStep = (scale: Scale): number => scale.steps - 1;\n\nconst stepAt = (scale: Scale, index: number): Color =>\n scale.atStep(clamp(index, 0, lastStep(scale)));\n\nconst nearestStep = (scale: Scale, color: Color): number =>\n clamp(Math.round(scale.stepOf(color)), 0, lastStep(scale));\n\n/**\n * `offset` steps along `scale` from `color`, away from its lightness: a dark color steps lighter,\n * and a light or midtone one steps darker. The color decides, not its place on the scale, so a\n * page steps the same way whatever the brand.\n */\nexport const stepAlong = (scale: Scale, color: Color, offset: number): Color => {\n const position = nearestStep(scale, color);\n const lightness = getColorLightnessClassification(color);\n const direction = lightness === 'dark' || lightness === 'veryDark' ? -1 : 1;\n\n return stepAt(scale, position + direction * offset);\n};\n\nexport const stepFrom = (color: Color, offset: number): Color =>\n stepAlong(scaleOf(color), color, offset);\n\n/**\n * `offset` steps from `color` along its scale, away from `text`, so their contrast grows; a negative\n * offset steps towards it. A color with no room left on that side steps the other way, so it still\n * visibly changes.\n */\nexport const stepAwayFrom = (color: Color, text: Color, offset: number): Color => {\n const scale = scaleOf(color);\n const position = nearestStep(scale, color);\n const away = position + (text.luminance() > color.luminance() ? offset : -offset);\n\n return stepAt(scale, away >= 0 && away <= lastStep(scale) ? away : position * 2 - away);\n};\n","import type { BrandTokens } from '../../brandTokens';\nimport type {\n BrandKitTokenRef,\n Dimension,\n FontAnchorRef,\n SingleColor,\n SingleColorAnchorName,\n SingleColorAnchorRef,\n StyleDocument,\n} from '../../styleVocabulary';\nimport type { Scale } from './scale';\nimport { BRAND_TOKEN_NAMES, DEFAULT_BRAND_TOKENS } from '../../brandTokens';\nimport { Color } from '../../Color';\nimport { getBrandDarkBackgroundColor } from '../../getBrandDarkBackgroundColor';\nimport { getBrandLightBackgroundColor } from '../../getBrandLightBackgroundColor';\nimport { isOneOf } from '../guards';\nimport { RELATION_HUE_DEGREES } from './constants/color';\nimport { scaleOf } from './scale';\n\n/** A Style document's anchors, resolved once against the Brand Kit. */\nexport type ResolvedAnchors = {\n readonly borderRadius: number;\n readonly colors: Readonly<Record<SingleColorAnchorName, Color | null>>;\n readonly dimension: (value: Dimension) => number;\n readonly fonts: Readonly<Record<FontAnchorRef, string>>;\n /** `anchors.colors.gradientStops`, when the Style declares them. */\n readonly gradientStops: readonly Color[] | null;\n /** For an anchor toned from a token, the token's own scale, so stepping keeps its hue. */\n readonly scales: Readonly<Record<SingleColorAnchorName, Scale | null>>;\n readonly tokens: BrandTokens;\n};\n\nconst isTokenRef = (value: string): value is BrandKitTokenRef => value.startsWith('$');\n\n/** A token the Brand Kit leaves out takes its default; a token no Brand Kit has is an error. */\nconst tokenValue = (tokens: BrandTokens, ref: BrandKitTokenRef): number | string => {\n const name = ref.slice(1);\n\n if (!isOneOf(BRAND_TOKEN_NAMES, name)) {\n throw new Error(`${ref} is not a Brand Kit token`);\n }\n\n return tokens[name] ?? DEFAULT_BRAND_TOKENS[name];\n};\n\nconst tokenColor = (tokens: BrandTokens, ref: BrandKitTokenRef): Color =>\n new Color(String(tokenValue(tokens, ref)));\n\n/** Turns a hue around the Lab a/b plane. */\nconst rotateHue = (color: Color, degrees: number): Color => {\n if (degrees === 0) {\n return color;\n }\n\n const lab = color.toLab();\n const radians = (degrees * Math.PI) / 180;\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n\n return Color.fromLab(\n {\n lightness: lab.lightness,\n // oxlint-disable-next-line id-length -- the Lab axes are named a and b\n a: lab.a * cos - lab.b * sin,\n // oxlint-disable-next-line id-length -- the Lab axes are named a and b\n b: lab.a * sin + lab.b * cos,\n },\n color.a,\n );\n};\n\nconst resolveSingleColor = (value: SingleColor, tokens: BrandTokens): Color => {\n if (typeof value === 'string') {\n return isTokenRef(value) ? tokenColor(tokens, value) : new Color(value);\n }\n\n const related = rotateHue(\n tokenColor(tokens, value.from),\n RELATION_HUE_DEGREES[value.relation ?? 'same'],\n );\n\n if (value.tone === 'dark') {\n return getBrandDarkBackgroundColor(related);\n }\n\n if (value.tone === 'light') {\n return getBrandLightBackgroundColor(related);\n }\n\n return related;\n};\n\n/**\n * A toned anchor is a point on its token's scale, so stepping from it should walk that scale.\n * Rebuilding a scale from a pale tone would keep almost none of the brand's hue.\n */\nconst scaleBeforeTone = (value: SingleColor | undefined, tokens: BrandTokens): Scale | null => {\n if (value === undefined || typeof value === 'string' || value.tone === undefined) {\n return null;\n }\n\n return scaleOf(\n rotateHue(tokenColor(tokens, value.from), RELATION_HUE_DEGREES[value.relation ?? 'same']),\n );\n};\n\nconst fontFrom = (value: string, tokens: BrandTokens): string =>\n isTokenRef(value) ? String(tokenValue(tokens, value)) : value;\n\nexport const resolveAnchors = (style: StyleDocument, tokens: BrandTokens): ResolvedAnchors => {\n const { colors, dimensions, fonts } = style.anchors;\n const dimension = (value: Dimension): number =>\n typeof value === 'number' ? value : Number(tokenValue(tokens, value));\n\n return {\n tokens,\n dimension,\n borderRadius: dimension(dimensions.borderRadius),\n colors: {\n pageBackground: resolveSingleColor(colors.pageBackground, tokens),\n primary: resolveSingleColor(colors.primary, tokens),\n ground: colors.ground === undefined ? null : resolveSingleColor(colors.ground, tokens),\n },\n gradientStops: colors.gradientStops?.map((stop) => resolveSingleColor(stop, tokens)) ?? null,\n scales: {\n pageBackground: scaleBeforeTone(colors.pageBackground, tokens),\n primary: scaleBeforeTone(colors.primary, tokens),\n ground: scaleBeforeTone(colors.ground, tokens),\n },\n fonts: {\n 'anchors.fonts.heading': fontFrom(fonts.heading, tokens),\n 'anchors.fonts.body': fontFrom(fonts.body, tokens),\n 'anchors.fonts.button': fontFrom(fonts.button, tokens),\n },\n };\n};\n\nconst ANCHOR_BY_REF: Readonly<Record<SingleColorAnchorRef, SingleColorAnchorName>> = {\n 'anchors.colors.pageBackground': 'pageBackground',\n 'anchors.colors.primary': 'primary',\n 'anchors.colors.ground': 'ground',\n};\n\nconst isAnchorRef = (value: string): value is SingleColorAnchorRef =>\n Object.hasOwn(ANCHOR_BY_REF, value);\n\nexport const anchorName = (ref: SingleColorAnchorRef): SingleColorAnchorName => ANCHOR_BY_REF[ref];\n\nexport const anchorColor = (ref: SingleColorAnchorRef, anchors: ResolvedAnchors): Color => {\n const color = anchors.colors[ANCHOR_BY_REF[ref]];\n\n if (color === null) {\n throw new Error(`${ref} is referenced but not declared`);\n }\n\n return color;\n};\n\n/** A setting that names a color either way: through an anchor, or written out. */\nexport const anchorOrSingleColor = (\n value: SingleColorAnchorRef | SingleColor,\n anchors: ResolvedAnchors,\n): Color =>\n typeof value === 'string' && isAnchorRef(value)\n ? anchorColor(value, anchors)\n : resolveSingleColor(value, anchors.tokens);\n\n/** The scale stepping from an anchor walks: its token's if it's toned, or else its own. */\nexport const anchorScale = (ref: SingleColorAnchorRef, anchors: ResolvedAnchors): Scale =>\n anchors.scales[anchorName(ref)] ?? scaleOf(anchorColor(ref, anchors));\n","import type { Color } from '../../../Color';\nimport type { Border } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { FindGaps } from './types';\nimport { ORNAMENTAL_BORDER_STYLES, SURFACE_NAMES } from '../../../styleVocabulary';\nimport { anchorColor } from '../anchors';\nimport { stepFrom } from '../scale';\n\n/** The page sits on nothing and has no edge, so it carries no border. */\nexport const BORDER_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES.filter((name) => name !== 'page'),\n initialValues: {\n 'border-width': '0',\n 'border-style': 'none',\n 'border-color': 'transparent',\n },\n};\n\n/** A `width` of 0 keeps the initial values, so the surface has no edge whatever its source. */\nexport const borderSlots = (\n border: Border | undefined,\n solid: Color,\n anchors: ResolvedAnchors,\n): Slots => {\n if (border === undefined || border.width === 0) {\n return {};\n }\n\n const { offset, source, style, width } = border;\n const from = source === 'surface' ? solid : anchorColor(source, anchors);\n\n return {\n 'border-width': `${width}px`,\n 'border-style': style,\n 'border-color': stepFrom(from, offset).toHex(),\n };\n};\n\n/** An ornament is a drawn tile rather than a CSS border, and draws whatever the width. */\nexport const borderGaps: FindGaps = ({ border }) =>\n ORNAMENTAL_BORDER_STYLES.some((ornament) => ornament === border?.style)\n ? [`border.style: ${border?.style}`]\n : [];\n","import type { ElevationDepth, ElevationHardness } from '../../../styleVocabulary';\n\nexport type Shadow = {\n readonly alpha: number;\n readonly blur: number;\n readonly x: number;\n readonly y: number;\n};\n\n/** What `elevation.source: shade` is before each shadow's alpha. */\nexport const SHADE_COLOR = '#000000';\n\n/**\n * The shadow each hardness casts at each depth. `soft · low` is from the Phase 1 carousel sandbox;\n * the rest are placeholders carried over from the Style Sampler prototype.\n */\nexport const SHADOWS: Readonly<\n Record<ElevationHardness, Readonly<Record<Exclude<ElevationDepth, 'none'>, Shadow>>>\n> = {\n soft: {\n low: { x: 0, y: 3, blur: 5, alpha: 0.125 },\n medium: { x: 0, y: 6, blur: 12, alpha: 0.2 },\n high: { x: 0, y: 8, blur: 18, alpha: 0.32 },\n },\n hard: {\n low: { x: 3, y: 3, blur: 0, alpha: 1 },\n medium: { x: 5, y: 5, blur: 0, alpha: 1 },\n high: { x: 8, y: 8, blur: 0, alpha: 1 },\n },\n glow: {\n low: { x: 0, y: 0, blur: 12, alpha: 0.65 },\n medium: { x: 0, y: 0, blur: 22, alpha: 0.72 },\n high: { x: 0, y: 0, blur: 36, alpha: 0.8 },\n },\n};\n\n/** A glow also draws a tight core, a little stronger than its halo, so the edge reads as lit. */\nexport const GLOW_CORES: Readonly<Record<Exclude<ElevationDepth, 'none'>, Shadow>> = {\n low: { x: 0, y: 0, blur: 3, alpha: 0.85 },\n medium: { x: 0, y: 0, blur: 3, alpha: 0.92 },\n high: { x: 0, y: 0, blur: 3, alpha: 1 },\n};\n","/** `buttonPrimary` → `button-primary`, as surface names appear in variable names. */\nexport const kebab = (name: string): string =>\n name.replaceAll(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);\n","import type { SurfaceName } from '../../styleVocabulary';\nimport { STACKABLE_ON, SURFACE_NAMES } from '../../styleVocabulary';\nimport { kebab } from './kebab';\n\nexport type SurfaceSpec = {\n /** Page, panel and card hold copy, so they carry heading and low-emphasis text; a button doesn't. */\n readonly holdsContent: boolean;\n /** Hover, focus and active states: only for surfaces a viewer acts on. */\n readonly interactive: boolean;\n /** Forms live only in panels, so only a panel carries input slots. */\n readonly mayContainForm: boolean;\n /** How much a surface's shadow offsets and blur scale, since a button is smaller than a panel. */\n readonly shadowScale: number;\n};\n\n/** What the engine knows about each surface beyond what a Style document says. */\nexport const SURFACES: Readonly<Record<SurfaceName, SurfaceSpec>> = {\n page: { holdsContent: true, interactive: false, mayContainForm: false, shadowScale: 1 },\n panel: { holdsContent: true, interactive: false, mayContainForm: true, shadowScale: 1.25 },\n card: { holdsContent: true, interactive: true, mayContainForm: false, shadowScale: 1 },\n buttonPrimary: {\n holdsContent: false,\n interactive: true,\n mayContainForm: false,\n shadowScale: 0.5,\n },\n buttonSecondary: {\n holdsContent: false,\n interactive: true,\n mayContainForm: false,\n shadowScale: 0.5,\n },\n};\n\n/**\n * One evaluation of a surface: the surface on its only parent, or once per parent for a surface\n * that can sit on several, named `<surface>-on-<parent>`.\n */\nexport type SurfaceGroup = {\n readonly parent: SurfaceName | null;\n readonly prefix: string;\n readonly surface: SurfaceName;\n};\n\n/** Every surface group, parents before the surfaces that sit on them. */\nexport const SURFACE_GROUPS: readonly SurfaceGroup[] = SURFACE_NAMES.flatMap((surface) => {\n const parents = STACKABLE_ON[surface];\n\n if (parents.length <= 1) {\n return [{ surface, parent: parents[0] ?? null, prefix: kebab(surface) }];\n }\n\n return parents.map((parent) => ({\n surface,\n parent,\n prefix: `${kebab(surface)}-on-${kebab(parent)}`,\n }));\n});\n","import type { Elevation, ElevationColorSource, SurfaceName } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Shadow } from '../constants/elevation';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport { Color } from '../../../Color';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { anchorOrSingleColor } from '../anchors';\nimport { GLOW_CORES, SHADE_COLOR, SHADOWS } from '../constants/elevation';\nimport { SURFACES } from '../surfaces';\n\nconst SHADE = new Color(SHADE_COLOR);\n\n/** The opaque color of an elevation. Each shadow sets its own alpha. */\nexport const elevationColor = (source: ElevationColorSource, anchors: ResolvedAnchors): Color =>\n source === 'shade' ? SHADE : anchorOrSingleColor(source, anchors);\n\nexport const ELEVATION_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'box-shadow': 'none' },\n};\n\nconst shadowLayer = ({ alpha, blur, x, y }: Shadow, color: Color): string =>\n `${x}px ${y}px ${blur}px ${color.withAlpha(alpha).toRgba()}`;\n\n/** Whole pixels, and an offset that was there stays at least 1px so a small hard shadow survives. */\nconst scaled = (length: number, scale: number): number =>\n length === 0 ? 0 : Math.max(1, Math.round(length * scale));\n\nconst scaleShadow = ({ alpha, blur, x, y }: Shadow, scale: number): Shadow => ({\n alpha,\n blur: scaled(blur, scale),\n x: scaled(x, scale),\n y: scaled(y, scale),\n});\n\n/** The glow's core stays tight on every surface, since it's what makes the edge read as lit. */\nconst castShadows = (\n surface: SurfaceName,\n { depth, hardness, source }: Elevation,\n anchors: ResolvedAnchors,\n): readonly string[] => {\n if (depth === 'none') {\n return [];\n }\n\n const color = elevationColor(source, anchors);\n const shadows = [\n scaleShadow(SHADOWS[hardness][depth], SURFACES[surface].shadowScale),\n ...(hardness === 'glow' ? [GLOW_CORES[depth]] : []),\n ];\n\n return shadows.map((shadow) => shadowLayer(shadow, color));\n};\n\n/**\n * The elevation's shadow, if it casts one, scaled to the surface, with any layers the treatment\n * draws after it.\n */\nexport const elevationSlots = (\n surface: SurfaceName,\n elevation: Elevation,\n anchors: ResolvedAnchors,\n treatmentLayers: readonly string[] = [],\n): Slots => {\n const layers = [...castShadows(surface, elevation, anchors), ...treatmentLayers];\n\n return layers.length === 0 ? {} : { 'box-shadow': layers.join(', ') };\n};\n","import type { SurfaceName, TypeRoleName } from '../../styleVocabulary';\nimport type { SurfaceSpec } from './surfaces';\nimport { SURFACE_NAMES } from '../../styleVocabulary';\nimport { SURFACES } from './surfaces';\n\nexport const VARIABLE_PREFIX = '--wistia-kaleidoscope-';\nexport type VariableName = `${typeof VARIABLE_PREFIX}${string}`;\n\n/** Slot name → CSS value, for one surface group or one type role. */\nexport type Slots = Readonly<Record<string, string>>;\n\n/**\n * One rule's share of the contract: the slots it emits on each surface it applies to, with the\n * value each takes when a Style doesn't use the rule — the CSS initial value of the property the\n * slot feeds, or the value that draws nothing where the property has no fixed one.\n */\nexport type SurfaceSlotFragment = {\n readonly initialValues: Slots;\n readonly surfaces: readonly SurfaceName[];\n};\n\nexport const surfacesWhere = (\n flag: Exclude<keyof SurfaceSpec, 'shadowScale'>,\n): readonly SurfaceName[] => SURFACE_NAMES.filter((name) => SURFACES[name][flag]);\n\nexport const surfaceVariable = (prefix: string, slot: string): VariableName =>\n `${VARIABLE_PREFIX}${prefix}-${slot}`;\n\nexport const typeVariable = (role: TypeRoleName, slot: string): VariableName =>\n `${VARIABLE_PREFIX}type-${role}-${slot}`;\n","import type { SurfaceSlotFragment } from '../slots';\nimport type { FindGaps } from './types';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { surfacesWhere } from '../slots';\n\n/**\n * A surface's fill. `background-image` holds layers drawn over `background-color` — glass sheens,\n * gradients — and `backdrop-filter` blurs what is behind a translucent fill.\n */\nexport const FILL_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: {\n 'background-color': 'transparent',\n 'background-image': 'none',\n 'backdrop-filter': 'none',\n },\n};\n\nexport const HOVER_FILL_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('interactive'),\n initialValues: {\n 'background-color-hover': 'transparent',\n 'background-image-hover': 'none',\n },\n};\n\n/** Inverting repaints a surface as a flat fill, so no other treatment can invert. */\nexport const fillGaps: FindGaps = ({ backgroundColor: { invert }, treatment }) =>\n treatment === 'flat' || invert === 'never' ? [] : [`backgroundColor.invert: ${invert}`];\n","import type { MotionSpeed, PulseSize, Transition } from '../../../styleVocabulary';\n\n/** How long a surface takes to move between states. Placeholder. */\nexport const TRANSITION_DURATIONS = {\n none: null,\n quick: '120ms',\n smooth: '240ms',\n} satisfies Record<Transition, string | null>;\n\n/** The properties a state change animates. */\nexport const TRANSITIONED_PROPERTIES = ['background-color', 'box-shadow', 'border-color', 'color'];\n\nexport const TRANSITION_EASING = 'ease';\n\n/** How long one drift takes per speed. */\nexport const DRIFT_DURATIONS = {\n slow: '10s',\n medium: '6s',\n fast: '3s',\n} satisfies Record<MotionSpeed, string>;\n\n/** How long one pulse takes per speed. Placeholder. */\nexport const PULSE_DURATIONS = {\n slow: '2.8s',\n medium: '1.6s',\n fast: '0.9s',\n} satisfies Record<MotionSpeed, string>;\n\n/** The shadow a pulse moves towards per size, in pixels. Placeholder. */\nexport const PULSE_SHADOWS = {\n small: { y: 1, blur: 6, spread: 1 },\n medium: { y: 2, blur: 14, spread: 2 },\n large: { y: 4, blur: 24, spread: 4 },\n} satisfies Record<\n PulseSize,\n { readonly blur: number; readonly spread: number; readonly y: number }\n>;\n\n/** How much of the pulse color its shadow shows. Placeholder. */\nexport const PULSE_SHADOW_ALPHA = 0.7;\n","import type { Motion } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { AnySurfaceSettings, FindGaps } from './types';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { anchorOrSingleColor } from '../anchors';\nimport {\n DRIFT_DURATIONS,\n PULSE_DURATIONS,\n PULSE_SHADOW_ALPHA,\n PULSE_SHADOWS,\n TRANSITION_DURATIONS,\n TRANSITION_EASING,\n TRANSITIONED_PROPERTIES,\n} from '../constants/motion';\nimport { elevationColor } from './elevation';\n\nexport const MOTION_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { transition: 'none' },\n};\n\n/**\n * How long a pulse takes, and the color and shadow it moves towards, so each consumer writes its\n * own `@keyframes`. `0s` means the surface doesn't pulse. A page can't pulse.\n */\nexport const PULSE_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES.filter((surface) => surface !== 'page'),\n initialValues: {\n 'pulse-duration': '0s',\n 'pulse-color': 'transparent',\n 'pulse-box-shadow': 'none',\n },\n};\n\n/**\n * Only how long a page's drift takes. The contract is CSS variables only, so each consumer writes\n * its own `@keyframes` and the layer that moves. `0s` means the page is still.\n */\nexport const PAGE_ANIMATION_SLOTS: SurfaceSlotFragment = {\n surfaces: ['page'],\n initialValues: { 'animation-duration': '0s' },\n};\n\nconst transitionSlots = (transition: Motion['transition']): Slots => {\n const duration = TRANSITION_DURATIONS[transition];\n\n if (duration === null) {\n return {};\n }\n\n return {\n transition: TRANSITIONED_PROPERTIES.map(\n (property) => `${property} ${duration} ${TRANSITION_EASING}`,\n ).join(', '),\n };\n};\n\n/** `motionGaps` only lets `drift` through on the page, so this never names another surface's slot. */\nconst driftSlots = ({ ambient, speed }: Motion): Slots =>\n ambient === 'drift' ? { 'animation-duration': DRIFT_DURATIONS[speed] } : {};\n\n/** `motionGaps` keeps a pulse off the page, so this never names a slot the page doesn't have. */\nconst pulseSlots = ({ elevation, motion }: AnySurfaceSettings, anchors: ResolvedAnchors): Slots => {\n if (motion.ambient !== 'pulse') {\n return {};\n }\n\n const color =\n motion.pulseColor === 'derive'\n ? elevationColor(elevation.source, anchors)\n : anchorOrSingleColor(motion.pulseColor, anchors);\n\n const { blur, spread, y } = PULSE_SHADOWS[motion.pulseSize];\n\n return {\n 'pulse-duration': PULSE_DURATIONS[motion.speed],\n 'pulse-color': color.toRgba(),\n 'pulse-box-shadow': `0 ${y}px ${blur}px ${spread}px ${color.withAlpha(PULSE_SHADOW_ALPHA).toRgba()}`,\n };\n};\n\nexport const motionSlots = (settings: AnySurfaceSettings, anchors: ResolvedAnchors): Slots => ({\n ...transitionSlots(settings.motion.transition),\n ...driftSlots(settings.motion),\n ...pulseSlots(settings, anchors),\n});\n\n/** Only the page drifts so far, and every surface but the page can pulse. */\nexport const motionGaps: FindGaps = ({ motion: { ambient } }, surface) =>\n (ambient === 'drift' && surface !== 'page') || (ambient === 'pulse' && surface === 'page')\n ? [`motion.ambient: ${ambient}`]\n : [];\n","import type { Color } from '../../../Color';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport { anchorColor } from '../anchors';\nimport { stepFrom } from '../scale';\nimport { surfacesWhere } from '../slots';\n\n/** The form fields inside a panel. */\nexport const PANEL_INPUT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('mayContainForm'),\n initialValues: {\n 'input-background-color': 'transparent',\n 'input-background-color-focus': 'transparent',\n 'input-border-color-focus': 'transparent',\n },\n};\n\n/** Inputs step off the panel's fill unless given `fills`, and take the primary color when focused. */\nexport const panelInputSlots = (solid: Color, anchors: ResolvedAnchors, fills?: Slots): Slots => ({\n ...(fills ?? {\n 'input-background-color': stepFrom(solid, 1).toHex(),\n 'input-background-color-focus': stepFrom(solid, 2).toHex(),\n }),\n 'input-border-color-focus': anchorColor('anchors.colors.primary', anchors).toHex(),\n});\n","import type { SurfaceName } from '../../../styleVocabulary';\n\n/** How the radius anchor scales on each surface. Placeholder. */\nexport const RADIUS_FACTORS = {\n page: 0,\n panel: 1,\n card: 0.7,\n buttonPrimary: 0.5,\n buttonSecondary: 0.5,\n} satisfies Record<SurfaceName, number>;\n","import type { Radius, SurfaceName } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { RADIUS_FACTORS } from '../constants/radius';\n\nexport const RADIUS_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'border-radius': '0' },\n};\n\nexport const radiusSlots = (\n surface: SurfaceName,\n { source }: Radius,\n anchors: ResolvedAnchors,\n): Slots => ({\n 'border-radius':\n source === 'anchors.dimensions.borderRadius'\n ? `${Math.round(anchors.borderRadius * RADIUS_FACTORS[surface])}px`\n : `${anchors.dimension(source)}px`,\n});\n","import type { Color } from '../../../Color';\nimport type {\n SingleColor,\n SingleColorAnchorRef,\n SurfaceName,\n TextColor,\n TextColorPreference,\n Treatment,\n} from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport type { ResolvedText } from '../treatments/types';\nimport { adjustColorForProperContrast } from '../../../adjustColorForProperContrast';\nimport { getBestColorForText } from '../../../getBestColorForText';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport { anchorColor, anchorOrSingleColor, anchorScale } from '../anchors';\nimport { LOW_EMPHASIS_TEXT_ALPHA } from '../constants/color';\nimport { stepAlong } from '../scale';\nimport { surfacesWhere } from '../slots';\nimport { SURFACES } from '../surfaces';\n\nexport const TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'text-color': 'canvastext' },\n};\n\nexport const CONTENT_TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('holdsContent'),\n initialValues: {\n 'heading-text-color': 'canvastext',\n 'low-emphasis-text-color': 'canvastext',\n },\n};\n\nexport const HOVER_TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('interactive'),\n initialValues: { 'text-color-hover': 'canvastext' },\n};\n\nexport const CONTENT_HOVER_TEXT_SLOTS: SurfaceSlotFragment = {\n surfaces: surfacesWhere('interactive').filter((surface) => SURFACES[surface].holdsContent),\n initialValues: {\n 'heading-text-color-hover': 'canvastext',\n 'low-emphasis-text-color-hover': 'canvastext',\n },\n};\n\nconst isPreference = (textColor: TextColor): textColor is TextColorPreference =>\n typeof textColor === 'object' && 'source' in textColor;\n\n/** A color anchor or a color, used as written. */\nconst isFixed = (textColor: TextColor): textColor is SingleColor | SingleColorAnchorRef =>\n textColor !== 'derive' && !isPreference(textColor);\n\n/**\n * `derive` allows text color to be calculated by the engine so we can pick a color with appropriate contrast.\n * A preferred color starts from a reference point (a color anchor) and adjusts it until it meets required contrast rule\n * A color anchor or a color is used as written, with no contrast guarantee.\n */\nexport const resolveTextColor = (\n textColor: TextColor,\n solid: Color,\n anchors: ResolvedAnchors,\n): Color => {\n if (isFixed(textColor)) {\n return anchorOrSingleColor(textColor, anchors);\n }\n\n if (textColor === 'derive') {\n return getBestColorForText({ backgroundColor: solid });\n }\n\n const { offset, source } = textColor;\n const preferred = stepAlong(anchorScale(source, anchors), anchorColor(source, anchors), offset);\n\n return adjustColorForProperContrast({ foregroundColor: preferred, backgroundColor: solid });\n};\n\n/**\n * A surface's text. One with no fill shows its parent, so it takes its parent's text and hover rule\n * in place of its own `textColor`.\n */\nexport const surfaceText = (\n { textColor, treatment }: { readonly textColor: TextColor; readonly treatment: Treatment },\n solid: Color,\n anchors: ResolvedAnchors,\n parent: ResolvedText | null,\n): ResolvedText =>\n treatment === 'none' && parent !== null\n ? { text: parent.text, textColor: parent.textColor }\n : { text: resolveTextColor(textColor, solid, anchors), textColor };\n\nexport const textSlots = (surface: SurfaceName, text: Color): Slots => ({\n 'text-color': text.toHex(),\n ...(SURFACES[surface].holdsContent\n ? {\n 'heading-text-color': text.toHex(),\n 'low-emphasis-text-color': text.withAlpha(LOW_EMPHASIS_TEXT_ALPHA).toRgba(),\n }\n : {}),\n});\n\n/**\n * The same text slots with a `-hover` suffix, moved only as far as the hovered fill needs. A fixed\n * color stays as written.\n */\nexport const hoverTextSlots = (\n surface: SurfaceName,\n textColor: TextColor,\n text: Color,\n solidHover: Color,\n): Slots => {\n const readable = isFixed(textColor)\n ? text\n : adjustColorForProperContrast({ foregroundColor: text, backgroundColor: solidHover });\n\n return Object.fromEntries(\n Object.entries(textSlots(surface, readable)).map(([slot, value]) => [`${slot}-hover`, value]),\n );\n};\n","import type { TextureIntensity } from '../../../styleVocabulary';\n\n/** How opaque each intensity draws a texture's tile. Placeholder. */\nexport const TEXTURE_OPACITY: Readonly<Record<TextureIntensity, number>> = {\n low: 0.35,\n medium: 0.6,\n high: 0.9,\n};\n\n/**\n * `soft-light` can't move pure black or pure white, so a texture vanishes on a fill near either\n * end. Darker than this, it draws only light specks or dots, with `screen`.\n */\nexport const TEXTURE_DARK_FILL_LUMINANCE = 0.2;\n\n/** Lighter than this, a texture draws only dark specks or dots, with `multiply`. */\nexport const TEXTURE_LIGHT_FILL_LUMINANCE = 0.9;\n\n/**\n * How much of its intensity's opacity a texture keeps near either end. Specks and dots that\n * `multiply` or `screen` show far more than `soft-light` does in between, so they draw fainter.\n * Placeholder.\n */\nexport const TEXTURE_EDGE_OPACITY = { dark: 0.6, light: 0.3 } as const;\n","import type { Color } from '../../../Color';\nimport type { Texture, TextureIntensity, TextureKind } from '../../../styleVocabulary';\nimport type { Slots, SurfaceSlotFragment } from '../slots';\nimport { SURFACE_NAMES } from '../../../styleVocabulary';\nimport {\n TEXTURE_DARK_FILL_LUMINANCE,\n TEXTURE_EDGE_OPACITY,\n TEXTURE_LIGHT_FILL_LUMINANCE,\n TEXTURE_OPACITY,\n} from '../constants/texture';\n\n/**\n * A texture is a tile laid over the fill. `texture-image` is a `background-image` that repeats at\n * the tile's own size, and `texture-blend-mode` blends it with the fill beneath.\n */\nexport const TEXTURE_SLOTS: SurfaceSlotFragment = {\n surfaces: SURFACE_NAMES,\n initialValues: { 'texture-image': 'none', 'texture-blend-mode': 'normal' },\n};\n\nconst svgTile = (size: number, body: string): string =>\n `url(\"data:image/svg+xml,${encodeURIComponent(\n `<svg xmlns='http://www.w3.org/2000/svg' width='${size}' height='${size}'>${body}</svg>`,\n )}\")`;\n\nconst SOFT_STRETCH = \"type='linear' slope='2.4' intercept='-0.7'\";\n/** Every pixel lands on black or white, like screen static. */\nconst HARD_THRESHOLD = \"type='discrete' tableValues='0 1'\";\n\n/**\n * Where the fill sits, which decides how a texture can show on it. `soft-light` works in between,\n * but leaves pure white and pure black untouched.\n */\ntype FillTone = 'dark' | 'light' | 'mid';\n\nconst toneOf = (solid: Color): FillTone => {\n const luminance = solid.luminance();\n\n if (luminance < TEXTURE_DARK_FILL_LUMINANCE) {\n return 'dark';\n }\n\n return luminance > TEXTURE_LIGHT_FILL_LUMINANCE ? 'light' : 'mid';\n};\n\n/**\n * What the gray noise becomes. On a mid fill it stays opaque gray, so the blend alone decides how it\n * shows. Near either end only its dark or light half survives, as black or white specks on a clear\n * tile, alpha running from 0 at middle gray.\n */\nconst NOISE_INK: Readonly<Record<FillTone, string>> = {\n mid: \"<feComponentTransfer><feFuncA type='table' tableValues='1 1'/></feComponentTransfer>\",\n light:\n \"<feColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.4252 -1.4304 -0.1444 0 1'/>\",\n dark: \"<feColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.4252 1.4304 0.1444 0 -1'/>\",\n};\n\nconst noise = (\n size: number,\n frequency: number,\n stretch: string,\n opacity: number,\n tone: FillTone,\n): string =>\n svgTile(\n size,\n `<filter id='t' x='0' y='0'><feTurbulence type='fractalNoise' baseFrequency='${frequency}' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncR ${stretch}/><feFuncG ${stretch}/><feFuncB ${stretch}/></feComponentTransfer>${NOISE_INK[tone]}</filter><rect width='100%' height='100%' filter='url(#t)' opacity='${opacity}'/>`,\n );\n\nconst dot = (color: string, opacity: number): string =>\n svgTile(\n 5,\n `<radialGradient id='d'><stop offset='.65' stop-color='${color}'/><stop offset='1' stop-color='${color}' stop-opacity='0'/></radialGradient><circle cx='2.5' cy='2.5' r='1.7' fill='url(#d)' opacity='${opacity}'/>`,\n );\n\nconst round = (value: number): number => Math.round(value * 1000) / 1000;\n\nconst TILES: Readonly<\n Record<Exclude<TextureKind, 'none'>, (opacity: number, tone: FillTone) => string>\n> = {\n grain: (opacity, tone) => noise(160, 0.9, SOFT_STRETCH, opacity, tone),\n static: (opacity, tone) => noise(200, 0.65, HARD_THRESHOLD, round(opacity * 0.75), tone),\n halftone: (opacity, tone) => dot(tone === 'dark' ? '#fff' : '#000', opacity),\n};\n\nconst opacityFor = (intensity: TextureIntensity, tone: FillTone): number =>\n tone === 'mid'\n ? TEXTURE_OPACITY[intensity]\n : round(TEXTURE_OPACITY[intensity] * TEXTURE_EDGE_OPACITY[tone]);\n\nconst BLEND_MODES: Readonly<Record<FillTone, string>> = {\n dark: 'screen',\n light: 'multiply',\n mid: 'soft-light',\n};\n\n/**\n * The texture's tile and blend for a fill. Near white it draws only dark specks or dots with\n * `multiply`, near black only light ones with `screen`, and `soft-light` in between.\n */\nexport const textureSlots = ({ intensity, kind }: Texture, solid: Color): Slots => {\n if (kind === 'none') {\n return {};\n }\n\n const tone = toneOf(solid);\n\n return {\n 'texture-image': TILES[kind](opacityFor(intensity, tone), tone),\n 'texture-blend-mode': BLEND_MODES[tone],\n };\n};\n","/** Letter spacing for `case: upper`, which reads cramped at the spacing set for mixed case. */\nexport const UPPERCASE_LETTER_SPACING = '0.05em';\n","import type { StyleDocument } from '../../../styleVocabulary';\nimport type { ResolvedAnchors } from '../anchors';\nimport type { VariableName } from '../slots';\nimport { TYPE_ROLES } from '../../../styleVocabulary';\nimport { UPPERCASE_LETTER_SPACING } from '../constants/typography';\nimport { typeVariable } from '../slots';\n\n/**\n * `font-family` has no fixed initial value — it is up to the browser — so its unused value is the\n * generic family instead.\n */\nconst TYPE_INITIAL_VALUES = {\n 'font-family': 'sans-serif',\n 'font-size': 'medium',\n 'font-weight': 'normal',\n 'text-transform': 'none',\n 'letter-spacing': 'normal',\n} as const;\n\nexport const TYPOGRAPHY_CONTRACT: Readonly<Record<VariableName, string>> = Object.fromEntries(\n TYPE_ROLES.flatMap((role) =>\n Object.entries(TYPE_INITIAL_VALUES).map(([slot, value]) => [typeVariable(role, slot), value]),\n ),\n);\n\nexport const typographyVariables = (\n { typography }: StyleDocument,\n anchors: ResolvedAnchors,\n): Readonly<Record<VariableName, string>> =>\n Object.fromEntries(\n TYPE_ROLES.flatMap((role) => {\n const type = typography[role];\n const upper = type.case === 'upper';\n\n return [\n [typeVariable(role, 'font-family'), anchors.fonts[type.font]],\n [typeVariable(role, 'font-size'), `${type.fontSize}px`],\n [typeVariable(role, 'font-weight'), String(type.fontWeight)],\n [typeVariable(role, 'text-transform'), upper ? 'uppercase' : 'none'],\n [typeVariable(role, 'letter-spacing'), upper ? UPPERCASE_LETTER_SPACING : 'normal'],\n ];\n }),\n );\n","import type { SurfaceSlotFragment, VariableName } from './slots';\nimport { BORDER_SLOTS } from './rules/border';\nimport { ELEVATION_SLOTS } from './rules/elevation';\nimport { FILL_SLOTS, HOVER_FILL_SLOTS } from './rules/fill';\nimport { MOTION_SLOTS, PAGE_ANIMATION_SLOTS, PULSE_SLOTS } from './rules/motion';\nimport { PANEL_INPUT_SLOTS } from './rules/panelInput';\nimport { RADIUS_SLOTS } from './rules/radius';\nimport {\n CONTENT_HOVER_TEXT_SLOTS,\n CONTENT_TEXT_SLOTS,\n HOVER_TEXT_SLOTS,\n TEXT_SLOTS,\n} from './rules/text';\nimport { TEXTURE_SLOTS } from './rules/texture';\nimport { TYPOGRAPHY_CONTRACT } from './rules/typography';\nimport { surfaceVariable } from './slots';\nimport { SURFACE_GROUPS } from './surfaces';\n\n/** Every rule's surface slots. A rule that adds slots adds its fragment here. */\nconst SURFACE_SLOT_FRAGMENTS: readonly SurfaceSlotFragment[] = [\n FILL_SLOTS,\n HOVER_FILL_SLOTS,\n TEXT_SLOTS,\n CONTENT_TEXT_SLOTS,\n HOVER_TEXT_SLOTS,\n CONTENT_HOVER_TEXT_SLOTS,\n PANEL_INPUT_SLOTS,\n BORDER_SLOTS,\n ELEVATION_SLOTS,\n RADIUS_SLOTS,\n MOTION_SLOTS,\n PULSE_SLOTS,\n PAGE_ANIMATION_SLOTS,\n TEXTURE_SLOTS,\n];\n\nconst surfaceContract = (): Readonly<Record<VariableName, string>> =>\n Object.fromEntries(\n SURFACE_GROUPS.flatMap(({ prefix, surface }) =>\n SURFACE_SLOT_FRAGMENTS.filter(({ surfaces }) => surfaces.includes(surface)).flatMap(\n ({ initialValues }) =>\n Object.entries(initialValues).map(([slot, value]) => [\n surfaceVariable(prefix, slot),\n value,\n ]),\n ),\n ),\n );\n\nexport const CONTRACT: Readonly<Record<VariableName, string>> = {\n ...surfaceContract(),\n ...TYPOGRAPHY_CONTRACT,\n};\n","import type { VariableName } from './private/engine/slots';\nimport { CONTRACT } from './private/engine/contract';\n\nexport { VARIABLE_PREFIX as KALEIDOSCOPE_VARIABLE_PREFIX } from './private/engine/slots';\n\n/** A `--wistia-kaleidoscope-*` custom property name. */\nexport type KaleidoscopeVariableName = VariableName;\n\n/**\n * The record `getKaleidoscopeStyles()` returns: every variable and its value. The type\n * only checks the `--wistia-kaleidoscope-` prefix, so a misspelled name still compiles. The names\n * themselves are defined by {@link KALEIDOSCOPE_CONTRACT} and pinned by its contract test.\n */\nexport type KaleidoscopeVariables = Readonly<Record<KaleidoscopeVariableName, string>>;\n\n/**\n * Every variable the engine emits, with the value it takes when a Style doesn't use the rule\n * behind it: the CSS initial value of the property it feeds, or the value that draws nothing.\n * Every Style emits exactly these names, so embeds and hosted pages can rely on each one.\n *\n * Surface variables are `--wistia-kaleidoscope-<surface>-<slot>`. A surface that can sit on several\n * parents is emitted once per parent, as `<surface>-on-<parent>`: `button-primary-on-panel`. Slots\n * are named after the CSS property they feed — `background-color`, `border-radius`, `box-shadow` —\n * with a `-hover` or `-focus` suffix for a state. There are two exceptions: `text-color`,\n * `heading-text-color` and `low-emphasis-text-color` all feed `color`, and a panel's input slots\n * carry an `input-` prefix, as in `input-background-color`. A texture is a layer of its own:\n * `texture-image` is a `background-image` to draw over the fill, and `texture-blend-mode` is the\n * blend mode to draw it with.\n *\n * Typography variables are `--wistia-kaleidoscope-type-<role>-<property>`, for the `heading`,\n * `body` and `button` roles.\n */\nexport const KALEIDOSCOPE_CONTRACT: KaleidoscopeVariables = CONTRACT;\n","import type { Scale } from '../scale';\nimport type { ResolvedFill, TreatmentFn, TreatmentResult } from './types';\nimport { Color } from '../../../Color';\nimport { anchorColor, anchorScale } from '../anchors';\nimport { HOVER_MIN_CONTRAST, SEPARATION_MIN_CONTRAST } from '../constants/color';\nimport { scaleOf, stepAlong, stepAwayFrom } from '../scale';\n\n/**\n * A step away from the text, unless that lands too close to the resting fill or the parent to be\n * seen. Then a step towards it, which relies on the hover text staying readable.\n */\nconst hoverFill = (solid: Color, text: Color, parent: ResolvedFill | null): Color => {\n // Measured as the hex it renders as, because a step can sit right on the threshold.\n const away = new Color(stepAwayFrom(solid, text, 1).toHex());\n const isVisible =\n away.contrast(solid) >= HOVER_MIN_CONTRAST &&\n (parent === null || away.contrast(parent.solid) >= HOVER_MIN_CONTRAST);\n\n return isVisible ? away : stepAwayFrom(solid, text, -1);\n};\n\n/** The slots that paint `solid` as a flat fill on `parent`. */\nexport const flatFill = (\n solid: Color,\n scale: Scale | null,\n parent: ResolvedFill | null,\n): TreatmentResult => ({\n solid,\n scale,\n fill: { 'background-color': solid.toHex() },\n hover: (text) => {\n const solidHover = hoverFill(solid, text, parent);\n\n return { solid: solidHover, slots: { 'background-color-hover': solidHover.toHex() } };\n },\n});\n\n/** A single opaque color, stepped along its source's scale. */\nexport const flat: TreatmentFn = ({ anchors, parent, settings }) => {\n const { from, offset, source } = settings.backgroundColor;\n const sourceColor =\n source === 'parent'\n ? (parent?.solid ?? anchorColor('anchors.colors.pageBackground', anchors))\n : anchorColor(source, anchors);\n const scale =\n source === 'parent' ? (parent?.scale ?? scaleOf(sourceColor)) : anchorScale(source, anchors);\n const start = from === 'parent' && parent !== null ? parent.solid : sourceColor;\n let solid = stepAlong(scale, start, offset);\n\n if (parent !== null && solid.contrast(parent.solid) < SEPARATION_MIN_CONTRAST) {\n solid = stepAlong(scale, start, offset + 1);\n }\n\n return flatFill(solid, scale, parent);\n};\n","import type { Color } from '../../../Color';\nimport type { ResolvedFill, TreatmentResult } from '../treatments/types';\nimport type { AnySurfaceSettings } from './types';\nimport { INVERT_BELOW_CONTRAST } from '../constants/color';\nimport { flatFill } from '../treatments/flat';\n\nexport type PaintedPair = {\n readonly text: Color;\n readonly treated: TreatmentResult;\n};\n\n/**\n * `invert: when-indistinct`: if a surface's background fill color is too close to its parent background fill,\n * invert: when-indistinct allows the fill and text color to be inverted. This provides better contrast between the surface\n * and its parent while also preserving legible contrast between the surface and its text color.\n */\nexport const invertWhenIndistinct = (\n { backgroundColor: { invert }, treatment }: AnySurfaceSettings,\n treated: TreatmentResult,\n text: Color,\n parent: ResolvedFill | null,\n): PaintedPair => {\n if (invert !== 'when-indistinct' || treatment !== 'flat' || parent === null) {\n return { text, treated };\n }\n\n const fillContrast = treated.solid.contrast(parent.solid);\n\n return fillContrast < INVERT_BELOW_CONTRAST && text.contrast(parent.solid) > fillContrast\n ? { text: treated.solid, treated: flatFill(text, null, parent) }\n : { text, treated };\n};\n","import { Color } from '../../Color';\n\n/** `top` laid over `under`, flattened to the opaque color the eye sees. */\nexport const composite = (top: Color, under: Color): Color =>\n new Color([\n top.r * top.a + under.r * (1 - top.a),\n top.g * top.a + under.g * (1 - top.a),\n top.b * top.a + under.b * (1 - top.a),\n 1,\n ]);\n","import type { ColorTone, SurfaceName } from '../../../styleVocabulary';\n\n/** One size of glass. */\nexport type GlassTier = {\n readonly backdropFilter: string | null;\n /** Geometry and alpha of the fainter light where the highlights' light leaves, at the bottom right. */\n readonly counterEdge: readonly [geometry: string, alpha: number];\n readonly edgeAlpha: number;\n /** Geometry of the edge. It's blurred, because an unblurred edge renders as a hard outline. */\n readonly edge: string;\n /** How opaque the ground is, over the blurred backdrop. */\n readonly groundAlpha: number;\n readonly hoverGroundAlpha: number;\n /** Geometry, color and alpha of an inner shadow, for tiers that have one. */\n readonly innerShade: readonly [geometry: string, color: string, alpha: number] | null;\n /** A control's ground is its text color, rather than the surface's source. */\n readonly liftsParent: boolean;\n /** Alphas of the sheen's three stops, at `GLASS_SHEEN_STOPS`. */\n readonly sheen: readonly [number, number, number];\n readonly specular: readonly string[];\n readonly specularAlpha: number;\n};\n\nexport const GLASS_LIGHT_COLOR = '#ffffff';\nconst GLASS_SHADE_COLOR = '#000000';\nexport const GLASS_SHEEN_ANGLE = '135deg';\nexport const GLASS_SHEEN_STOPS: readonly [number, number, number] = [0, 45, 100];\n\n/** Panel inputs are the panel's text color at these alphas. Placeholders. */\nexport const GLASS_INPUT_ALPHA = 0.08;\nexport const GLASS_INPUT_FOCUS_ALPHA = 0.2;\n\nconst BACKDROP_FILTER = 'blur(10px) saturate(180%)';\n\n/** From the Phase 1 carousel sandbox. */\nconst DARK_CONTAINER: GlassTier = {\n backdropFilter: BACKDROP_FILTER,\n counterEdge: ['inset -1px -1px 1px 0', 0.13],\n edge: 'inset 0 0 3px 0',\n edgeAlpha: 0.3,\n groundAlpha: 0.25,\n hoverGroundAlpha: 0.25,\n innerShade: ['inset 0 4px 20px', GLASS_SHADE_COLOR, 0.1],\n liftsParent: false,\n sheen: [0.25, 0.1, 0.02],\n specular: ['inset 0 7px 2px -6px', 'inset 10px 6px 3px -10px'],\n specularAlpha: 0.55,\n};\n\n/**\n * The design file gives panel and card one fill; a card has a finer edge and a denser hover. A\n * shadow can't scale with its element, so the smaller tiers keep one soft highlight.\n */\nconst DARK_CARD: GlassTier = {\n backdropFilter: BACKDROP_FILTER,\n counterEdge: ['inset -1px -1px 1px 0', 0.11],\n edge: 'inset 0 0 2px 0',\n edgeAlpha: 0.28,\n groundAlpha: 0.25,\n hoverGroundAlpha: 0.37,\n innerShade: ['inset 0 4px 20px', GLASS_SHADE_COLOR, 0.1],\n liftsParent: false,\n sheen: [0.2, 0.08, 0.02],\n specular: ['inset 0 1px 2px 0'],\n specularAlpha: 0.25,\n};\n\nconst DARK_CONTROL: GlassTier = {\n backdropFilter: null,\n counterEdge: ['inset -1px -1px 1px 0', 0.09],\n edge: 'inset 0 0 2px 0',\n edgeAlpha: 0.22,\n groundAlpha: 0.08,\n hoverGroundAlpha: 0.25,\n innerShade: null,\n liftsParent: true,\n sheen: [0.15, 0.08, 0.02],\n specular: ['inset 0 1px 2px 0'],\n specularAlpha: 0.2,\n};\n\n/** The design file has no light glass. A denser ground, and every shadow layer is white. */\nconst LIGHT_CONTAINER: GlassTier = {\n ...DARK_CONTAINER,\n counterEdge: ['inset -1px -1px 1px 0', 0.7],\n edge: 'inset 1px 1px 0 0',\n edgeAlpha: 0.75,\n groundAlpha: 0.45,\n hoverGroundAlpha: 0.45,\n innerShade: ['inset 0 4px 20px', GLASS_LIGHT_COLOR, 0.35],\n specularAlpha: 0.9,\n};\n\nconst LIGHT_CARD: GlassTier = {\n ...DARK_CARD,\n counterEdge: ['inset -1px -1px 1px 0', 0.6],\n edgeAlpha: 0.85,\n groundAlpha: 0.45,\n hoverGroundAlpha: 0.62,\n innerShade: ['inset 0 4px 20px', GLASS_LIGHT_COLOR, 0.3],\n specularAlpha: 0.8,\n};\n\nconst LIGHT_CONTROL: GlassTier = {\n ...DARK_CONTROL,\n counterEdge: ['inset -1px -1px 1px 0', 0.45],\n edgeAlpha: 0.7,\n groundAlpha: 0.35,\n hoverGroundAlpha: 0.6,\n liftsParent: false,\n specularAlpha: 0.5,\n};\n\n/** The three sizes of glass. Page and panel are containers; both buttons are controls. */\nexport type GlassTierName = 'container' | 'card' | 'control';\n\nexport type GlassTiers = Readonly<Record<ColorTone, Readonly<Record<GlassTierName, GlassTier>>>>;\n\nexport const GLASS_TIER_DEFAULTS: GlassTiers = {\n dark: { container: DARK_CONTAINER, card: DARK_CARD, control: DARK_CONTROL },\n light: { container: LIGHT_CONTAINER, card: LIGHT_CARD, control: LIGHT_CONTROL },\n};\n\nexport const GLASS_TIER_OF_SURFACE: Readonly<Record<SurfaceName, GlassTierName>> = {\n page: 'container',\n panel: 'container',\n card: 'card',\n buttonPrimary: 'control',\n buttonSecondary: 'control',\n};\n\n/** Glass over a ground anchor darker than this is dark glass. */\nexport const GLASS_DARK_BELOW_LUMINANCE = 0.2;\n","import type { GradientDirection, GradientExtent, GradientPosition } from '../../../styleVocabulary';\n\n/**\n * `glows`: soft orbs in the stop colors over the surface's own fill. A dark fill swallows them, so\n * there they are stronger and fuller. Placeholder.\n */\nexport type GlowsTuning = {\n readonly alpha: number;\n readonly size: string;\n readonly fadeStop: number;\n readonly darkFillLuminance: number;\n readonly dark: {\n readonly alpha: number;\n readonly size: string;\n readonly midAlphaFactor: number;\n readonly midStop: number;\n readonly fadeStop: number;\n };\n readonly positions: readonly string[];\n};\n\nexport const GLOWS: GlowsTuning = {\n alpha: 0.42,\n size: '62% 56%',\n fadeStop: 70,\n darkFillLuminance: 0.2,\n dark: { alpha: 0.72, size: '72% 66%', midAlphaFactor: 0.6, midStop: 38, fadeStop: 72 },\n positions: ['14% 16%', '86% 22%', '62% 92%', '10% 80%', '48% 50%', '94% 66%'],\n};\n\nexport const LINEAR_ANGLES = {\n 'to-top': 0,\n 'to-top-right': 45,\n 'to-right': 90,\n 'to-bottom-right': 135,\n 'to-bottom': 180,\n 'to-bottom-left': 225,\n 'to-left': 270,\n 'to-top-left': 315,\n} satisfies Record<GradientDirection, number>;\n\nexport const RADIAL_POSITIONS = {\n center: '50% 50%',\n top: '50% 0%',\n 'top-right': '100% 0%',\n right: '100% 50%',\n 'bottom-right': '100% 100%',\n bottom: '50% 100%',\n 'bottom-left': '0% 100%',\n left: '0% 50%',\n 'top-left': '0% 0%',\n} satisfies Record<GradientPosition, string>;\n\n/**\n * `near` is `farthest-side`, not `closest-side`: every position but `center` sits on an edge or a\n * corner, where the closest side is zero away, and a circle with no radius paints only its last stop.\n */\nexport const RADIAL_EXTENTS = {\n near: 'farthest-side',\n far: 'farthest-corner',\n} as const satisfies Record<GradientExtent, string>;\n\n/**\n * `beams`: crossed lines in the stop colors over the surface's own fill. Each line is a tinted\n * core inside a glow that falls off through `bands`, as px from its center and alpha, all scaled\n * by `opacity`. Two faint pools of the first and last stop sit beneath. Placeholder.\n */\nexport const BEAMS = {\n lines: [\n { angle: 64, at: 16, stop: 0 },\n { angle: 116, at: 34, stop: 1 },\n { angle: 76, at: 62, stop: 2 },\n { angle: 14, at: 40, stop: 1 },\n { angle: 164, at: 58, stop: 0 },\n ],\n bands: [\n [34, 0],\n [18, 0.07],\n [9, 0.18],\n [2.5, 0.34],\n ],\n core: [0.8, 0.55],\n coreTint: 0.45,\n opacity: 0.6,\n pools: [\n { first: true, alpha: 0.12, geometry: '70% 45% at 50% 100%' },\n { first: false, alpha: 0.096, geometry: '50% 35% at 10% 0%' },\n ],\n} as const;\n","import type { GlassTiers } from './glass';\nimport type { GlowsTuning } from './gradient';\nimport {\n GLASS_DARK_BELOW_LUMINANCE,\n GLASS_INPUT_ALPHA,\n GLASS_INPUT_FOCUS_ALPHA,\n GLASS_LIGHT_COLOR,\n GLASS_SHEEN_ANGLE,\n GLASS_SHEEN_STOPS,\n GLASS_TIER_DEFAULTS,\n} from './glass';\nimport { GLOWS } from './gradient';\n\nexport type GlassTuning = {\n readonly darkBelowLuminance: number;\n readonly inputAlpha: number;\n readonly inputFocusAlpha: number;\n readonly lightColor: string;\n readonly sheenAngle: string;\n readonly sheenStops: readonly [number, number, number];\n readonly tiers: GlassTiers;\n};\n\n/** The treatment constants the Storybook tuning jig edits. Style documents stay as they are. */\nexport type EngineTuning = {\n readonly glass: GlassTuning;\n readonly glows: GlowsTuning;\n};\n\nexport const DEFAULT_ENGINE_TUNING: EngineTuning = {\n glass: {\n darkBelowLuminance: GLASS_DARK_BELOW_LUMINANCE,\n inputAlpha: GLASS_INPUT_ALPHA,\n inputFocusAlpha: GLASS_INPUT_FOCUS_ALPHA,\n lightColor: GLASS_LIGHT_COLOR,\n sheenAngle: GLASS_SHEEN_ANGLE,\n sheenStops: GLASS_SHEEN_STOPS,\n tiers: GLASS_TIER_DEFAULTS,\n },\n glows: GLOWS,\n};\n\nlet current: EngineTuning = DEFAULT_ENGINE_TUNING;\n\n/** The tuning treatments read. The defaults, except inside `withEngineTuning`. */\nexport const engineTuning = (): EngineTuning => current;\n\n/**\n * Runs `run` with the treatments reading `tuning`, then puts the previous tuning back. Scoped so\n * a draft can never leak into styles computed outside it.\n */\nexport const withEngineTuning = <T>(tuning: EngineTuning, run: () => T): T => {\n const previous = current;\n\n current = tuning;\n\n try {\n return run();\n } finally {\n current = previous;\n }\n};\n","import type { GlassTier } from '../constants/glass';\nimport type { GlassTuning } from '../constants/tuning';\nimport type { FindGaps } from '../rules/types';\nimport type { TreatmentFn } from './types';\nimport { Color } from '../../../Color';\nimport { anchorColor, anchorName } from '../anchors';\nimport { composite } from '../composite';\nimport { GLASS_TIER_OF_SURFACE } from '../constants/glass';\nimport { engineTuning } from '../constants/tuning';\nimport { resolveTextColor } from '../rules/text';\nimport { scaleOf, stepAlong } from '../scale';\n\nconst sheen = ({ sheen: alphas }: GlassTier, glass: GlassTuning): string => {\n const light = new Color(glass.lightColor);\n const stops = alphas.map(\n (alpha, index) => `${light.withAlpha(alpha).toRgba()} ${glass.sheenStops[index] ?? 100}%`,\n );\n\n return `linear-gradient(${glass.sheenAngle}, ${stops.join(', ')})`;\n};\n\n/** Inner shade, then the edge, then the specular highlights and the fainter edge opposite them. */\nconst glassShadowLayers = (tier: GlassTier, light: Color): readonly string[] => [\n ...(tier.innerShade === null\n ? []\n : [\n `${tier.innerShade[0]} ${new Color(tier.innerShade[1]).withAlpha(tier.innerShade[2]).toRgba()}`,\n ]),\n `${tier.edge} ${light.withAlpha(tier.edgeAlpha).toRgba()}`,\n ...tier.specular.map((geometry) => `${geometry} ${light.withAlpha(tier.specularAlpha).toRgba()}`),\n `${tier.counterEdge[0]} ${light.withAlpha(tier.counterEdge[1]).toRgba()}`,\n];\n\n/**\n * A translucent ground under a sheen. `solid` is that ground flattened over the parent, so text and\n * children resolve against what the eye sees.\n */\nexport const glassy: TreatmentFn = ({ anchors, parent, settings, surface }) => {\n // Read once, so the hover and tint closures below draw with the same tuning as the fill.\n const { glass } = engineTuning();\n const { offset, source } = settings.backgroundColor;\n const sourceColor =\n source === 'parent'\n ? (parent?.solid ?? anchorColor('anchors.colors.pageBackground', anchors))\n : anchorColor(source, anchors);\n const tone =\n (anchors.colors.ground ?? sourceColor).luminance() < glass.darkBelowLuminance\n ? 'dark'\n : 'light';\n const tier = glass.tiers[tone][GLASS_TIER_OF_SURFACE[surface]];\n const inherited =\n source === 'parent' ? (parent?.scale ?? null) : anchors.scales[anchorName(source)];\n const base = stepAlong(inherited ?? scaleOf(sourceColor), sourceColor, offset);\n const under = parent?.solid ?? base;\n const ground = (\n tier.liftsParent ? resolveTextColor(settings.textColor, under, anchors) : base\n ).withAlpha(tier.groundAlpha);\n const image = sheen(tier, glass);\n\n return {\n solid: composite(ground, under),\n scale: null,\n fill: {\n 'background-color': ground.toRgba(),\n 'background-image': image,\n ...(tier.backdropFilter === null ? {} : { 'backdrop-filter': tier.backdropFilter }),\n },\n hover: () => {\n const groundHover = base.withAlpha(tier.hoverGroundAlpha);\n\n return {\n solid: composite(groundHover, under),\n slots: { 'background-color-hover': groundHover.toRgba(), 'background-image-hover': image },\n };\n },\n layersOver: (solid) =>\n tier.sheen.map((alpha) => composite(new Color(glass.lightColor).withAlpha(alpha), solid)),\n tintedBy: (text) => ({\n inputFills: {\n 'input-background-color': text.withAlpha(glass.inputAlpha).toRgba(),\n 'input-background-color-focus': text.withAlpha(glass.inputFocusAlpha).toRgba(),\n },\n shadowLayers: glassShadowLayers(tier, new Color(glass.lightColor)),\n }),\n };\n};\n\n/** Glass has a fixed ground that its parent shows through, so it can't count from its parent. */\nexport const glassyGaps: FindGaps = ({ backgroundColor: { from }, treatment }) =>\n treatment === 'glassy' && from === 'parent' ? ['backgroundColor.from: parent'] : [];\n","import type { GradientShape } from '../../../styleVocabulary';\nimport type { GlowsTuning } from '../constants/gradient';\nimport type { TreatmentFn } from './types';\nimport { Color } from '../../../Color';\nimport { anchorColor, anchorName, anchorOrSingleColor } from '../anchors';\nimport { BEAMS, LINEAR_ANGLES, RADIAL_EXTENTS, RADIAL_POSITIONS } from '../constants/gradient';\nimport { engineTuning } from '../constants/tuning';\nimport { scaleOf, stepAlong } from '../scale';\n\ntype ShapeKind = GradientShape['kind'];\ntype ShapeOf<Kind extends ShapeKind> = Extract<GradientShape, { kind: Kind }>;\ntype ShapeImage<Kind extends ShapeKind> = (\n shape: ShapeOf<Kind>,\n stops: readonly Color[],\n fill: Color,\n) => string;\n\nconst glowLayer = (glows: GlowsTuning, stop: Color, position: string, onDark: boolean): string => {\n if (onDark) {\n const { alpha, fadeStop, midAlphaFactor, midStop, size } = glows.dark;\n\n return `radial-gradient(${size} at ${position}, ${stop.withAlpha(alpha).toRgba()} 0%, ${stop.withAlpha(alpha * midAlphaFactor).toRgba()} ${midStop}%, transparent ${fadeStop}%)`;\n }\n\n return `radial-gradient(${glows.size} at ${position}, ${stop.withAlpha(glows.alpha).toRgba()} 0%, transparent ${glows.fadeStop}%)`;\n};\n\nconst glowsImage = (stops: readonly Color[], fill: Color): string => {\n const { glows } = engineTuning();\n const onDark = fill.luminance() < glows.darkFillLuminance;\n\n return stops\n .map((stop, index) =>\n glowLayer(glows, stop, glows.positions[index % glows.positions.length] ?? 'center', onDark),\n )\n .join(', ');\n};\n\nconst offsetFrom = (at: number, px: number): string =>\n `calc(${at}% ${px < 0 ? '-' : '+'} ${Math.abs(px)}px)`;\n\n/** One beam: its bands from the outside in, the core, and the same bands back out. */\nconst beamLayer = (color: Color, angle: number, at: number): string => {\n const [coreWidth, coreAlpha] = BEAMS.core;\n const core = color.tint(BEAMS.coreTint);\n const stopAt = (shade: Color, alpha: number, px: number): string =>\n `${shade.withAlpha(Number((alpha * BEAMS.opacity).toFixed(3))).toRgba()} ${offsetFrom(at, px)}`;\n const rising = BEAMS.bands.map(([px, alpha]) => stopAt(color, alpha, -px));\n const falling = BEAMS.bands.map(([px, alpha]) => stopAt(color, alpha, px)).toReversed();\n const [[edge]] = BEAMS.bands;\n\n return `linear-gradient(${angle}deg, transparent ${offsetFrom(at, -edge - 1)}, ${[\n ...rising,\n stopAt(core, coreAlpha, -coreWidth),\n stopAt(core, coreAlpha, coreWidth),\n ...falling,\n ].join(', ')}, transparent ${offsetFrom(at, edge + 1)})`;\n};\n\nconst beamsImage = (stops: readonly Color[], fill: Color): string => {\n const stopAt = (index: number): Color => stops[index % stops.length] ?? fill;\n\n return [\n ...BEAMS.lines.map(({ angle, at, stop }) => beamLayer(stopAt(stop), angle, at)),\n ...BEAMS.pools.map(\n ({ alpha, first, geometry }) =>\n `radial-gradient(${geometry}, ${stopAt(first ? 0 : stops.length - 1)\n .withAlpha(alpha)\n .toRgba()}, transparent 70%)`,\n ),\n ].join(', ');\n};\n\nconst evenStops = (stops: readonly Color[]): string =>\n stops\n .map((stop, index) => `${stop.toHex()} ${Math.round((index / (stops.length - 1)) * 100)}%`)\n .join(', ');\n\nconst SHAPE_IMAGES: { readonly [Kind in ShapeKind]: ShapeImage<Kind> } = {\n glows: (_shape, stops, fill) => glowsImage(stops, fill),\n beams: (_shape, stops, fill) => beamsImage(stops, fill),\n linear: ({ direction }, stops) =>\n `linear-gradient(${LINEAR_ANGLES[direction]}deg, ${evenStops(stops)})`,\n radial: ({ extent, position }, stops) =>\n `radial-gradient(circle ${RADIAL_EXTENTS[extent]} at ${RADIAL_POSITIONS[position]}, ${evenStops(stops)})`,\n};\n\nconst shapeImage = <Kind extends ShapeKind>(\n kind: Kind,\n shape: ShapeOf<Kind>,\n stops: readonly Color[],\n fill: Color,\n): string => SHAPE_IMAGES[kind](shape, stops, fill);\n\n/** `linear` and `radial` paint over the whole surface, so the fill under them never shows. */\nconst isCovering = (shape: GradientShape): boolean =>\n shape.kind === 'linear' || shape.kind === 'radial';\n\nconst meanOf = (stops: readonly Color[]): Color => {\n const mean = (channel: 'b' | 'g' | 'r'): number =>\n stops.reduce((sum, stop) => sum + stop[channel], 0) / stops.length;\n\n return new Color([mean('r'), mean('g'), mean('b'), 1]);\n};\n\n/**\n * Gradient layers in the stop colors: the shape's own `stops`, or else the Style's. `glows` and\n * `beams` move over the surface's own fill, which is `solid`, so nothing derives a color from the\n * layers. `linear` and `radial` cover the fill, so `solid`, what text is solved against, is the\n * stops' average instead.\n */\nexport const gradient: TreatmentFn = ({ anchors, parent, settings }) => {\n const shape: GradientShape = settings.gradientShape ?? { kind: 'glows' };\n const gradientStops =\n shape.stops?.map((stop) => anchorOrSingleColor(stop, anchors)) ?? anchors.gradientStops;\n\n if (gradientStops === null) {\n throw new Error('anchors.colors.gradientStops is referenced but not declared');\n }\n\n const { from, offset, source } = settings.backgroundColor;\n const sourceColor =\n source === 'parent'\n ? (parent?.solid ?? anchorColor('anchors.colors.pageBackground', anchors))\n : anchorColor(source, anchors);\n const inherited =\n source === 'parent' ? (parent?.scale ?? null) : anchors.scales[anchorName(source)];\n const start = from === 'parent' && parent !== null ? parent.solid : sourceColor;\n const fillScale = inherited ?? scaleOf(sourceColor);\n const covers = isCovering(shape);\n const solid = covers ? meanOf(gradientStops) : stepAlong(fillScale, start, offset);\n const image = shapeImage(shape.kind, shape, gradientStops, solid);\n\n return {\n solid,\n scale: covers ? null : fillScale,\n fill: { 'background-color': solid.toHex(), 'background-image': image },\n hover: () => ({\n solid,\n slots: { 'background-color-hover': solid.toHex(), 'background-image-hover': image },\n }),\n ...(covers ? { layersOver: () => gradientStops.map((stop) => stop.withAlpha(1)) } : {}),\n };\n};\n","import type { TreatmentFn } from './types';\nimport { anchorColor, anchorScale } from '../anchors';\nimport { composite } from '../composite';\nimport { NONE_HOVER_WASH_ALPHA } from '../constants/color';\n\nconst PAGE_BACKGROUND = 'anchors.colors.pageBackground';\n\n/**\n * No fill: the surface shows what it sits on, so its text and its children are solved against its\n * parent's fill and step along its parent's scale. It hovers with a wash of its own text color.\n */\nexport const none: TreatmentFn = ({ anchors, parent }) => {\n const solid = parent?.solid ?? anchorColor(PAGE_BACKGROUND, anchors);\n\n return {\n solid,\n scale: parent === null ? anchorScale(PAGE_BACKGROUND, anchors) : parent.scale,\n fill: { 'background-color': 'transparent' },\n hover: (text) => {\n const wash = text.withAlpha(NONE_HOVER_WASH_ALPHA);\n\n return {\n solid: composite(wash, solid),\n slots: { 'background-color-hover': wash.toRgba() },\n };\n },\n };\n};\n","import type { Treatment } from '../../../styleVocabulary';\nimport type { TreatmentFn } from './types';\nimport { flat } from './flat';\nimport { glassy } from './glassy';\nimport { gradient } from './gradient';\nimport { none } from './none';\n\n/** How the engine paints each treatment. */\nexport const TREATMENT_FUNCTIONS: Readonly<Record<Treatment, TreatmentFn>> = {\n none,\n flat,\n glassy,\n gradient,\n};\n","import type { Color } from '../../Color';\nimport type { StyleDocument, SurfaceName } from '../../styleVocabulary';\nimport type { ResolvedAnchors } from './anchors';\nimport type { Slots, VariableName } from './slots';\nimport type { ParentSurface, TreatmentResult } from './treatments/types';\nimport { borderSlots } from './rules/border';\nimport { elevationSlots } from './rules/elevation';\nimport { invertWhenIndistinct } from './rules/invert';\nimport { motionSlots } from './rules/motion';\nimport { panelInputSlots } from './rules/panelInput';\nimport { radiusSlots } from './rules/radius';\nimport { hoverTextSlots, surfaceText, textSlots } from './rules/text';\nimport { textureSlots } from './rules/texture';\nimport { surfaceVariable } from './slots';\nimport { SURFACE_GROUPS, SURFACES } from './surfaces';\nimport { TREATMENT_FUNCTIONS } from './treatments';\n\nexport type EvaluatedSurface = ParentSurface & {\n /** The opaque hovered fill, on a surface that has a hover. */\n readonly hoverSolid: Color | null;\n /** The hovered fill's image layers at each stop, flattened, on a surface that has a hover. */\n readonly hoverLayerSolids: readonly Color[];\n /** The fill's image layers (a glass sheen) at each stop, flattened over `solid`. */\n readonly layerSolids: readonly Color[];\n readonly slots: Slots;\n};\n\n/** One surface group, with the fills its text was solved against. */\nexport type EvaluatedSurfaceGroup = EvaluatedSurface & {\n readonly prefix: string;\n readonly surface: SurfaceName;\n};\n\n/** The fill's image layers flattened over its solid, and over its hover when it is interactive. */\nconst layerSolidsOf = (\n treated: TreatmentResult,\n hoverSolid: Color,\n interactive: boolean,\n): Pick<EvaluatedSurface, 'hoverLayerSolids' | 'layerSolids'> => {\n const over = (solid: Color): readonly Color[] => treated.layersOver?.(solid) ?? [];\n\n return {\n hoverLayerSolids: interactive ? over(hoverSolid) : [],\n layerSolids: over(treated.solid),\n };\n};\n\n/**\n * One surface on one parent. A slot a Style doesn't use is left out, so it keeps the contract's\n * initial value.\n */\nconst evaluateSurface = (\n style: StyleDocument,\n surface: SurfaceName,\n anchors: ResolvedAnchors,\n parent: ParentSurface | null,\n): EvaluatedSurface => {\n const settings = style.surfaces[surface];\n const painted = TREATMENT_FUNCTIONS[settings.treatment]({ anchors, parent, settings, surface });\n const own = surfaceText(settings, painted.solid, anchors, parent);\n const { text, treated } = invertWhenIndistinct(settings, painted, own.text, parent);\n const spec = SURFACES[surface];\n const hover = treated.hover(text);\n const tinted = treated.tintedBy?.(text);\n\n return {\n solid: treated.solid,\n scale: treated.scale,\n text,\n textColor: own.textColor,\n hoverSolid: spec.interactive ? hover.solid : null,\n ...layerSolidsOf(treated, hover.solid, spec.interactive),\n slots: {\n ...treated.fill,\n ...(spec.interactive\n ? { ...hover.slots, ...hoverTextSlots(surface, own.textColor, text, hover.solid) }\n : {}),\n ...textSlots(surface, text),\n ...(spec.mayContainForm ? panelInputSlots(treated.solid, anchors, tinted?.inputFills) : {}),\n ...borderSlots(settings.border, treated.solid, anchors),\n ...elevationSlots(surface, settings.elevation, anchors, tinted?.shadowLayers),\n ...radiusSlots(surface, settings.radius, anchors),\n ...motionSlots(settings, anchors),\n ...textureSlots(settings.texture, treated.solid),\n },\n };\n};\n\n/**\n * Evaluates every surface group parents first, so each surface knows the fill it sits on.\n */\nexport const evaluateSurfaceGroups = (\n style: StyleDocument,\n anchors: ResolvedAnchors,\n): readonly EvaluatedSurfaceGroup[] => {\n const containers = new Map<SurfaceName, ParentSurface>();\n const groups: EvaluatedSurfaceGroup[] = [];\n\n for (const { parent, prefix, surface } of SURFACE_GROUPS) {\n const evaluated = evaluateSurface(\n style,\n surface,\n anchors,\n parent === null ? null : (containers.get(parent) ?? null),\n );\n\n // A surface on several parents is never a container itself, so the last one evaluated is fine.\n containers.set(surface, evaluated);\n\n groups.push({ ...evaluated, prefix, surface });\n }\n\n return groups;\n};\n\n/** Every surface group's slots, each named after its group. */\nexport const evaluateSurfaces = (\n style: StyleDocument,\n anchors: ResolvedAnchors,\n): Readonly<Record<VariableName, string>> => {\n const variables: Record<VariableName, string> = {};\n\n for (const { prefix, slots } of evaluateSurfaceGroups(style, anchors)) {\n for (const [slot, value] of Object.entries(slots)) {\n variables[surfaceVariable(prefix, slot)] = value;\n }\n }\n\n return variables;\n};\n","import type { StyleDocument } from '../../styleVocabulary';\nimport type { FindGaps } from './rules/types';\nimport { SURFACE_NAMES } from '../../styleVocabulary';\nimport { borderGaps } from './rules/border';\nimport { fillGaps } from './rules/fill';\nimport { motionGaps } from './rules/motion';\nimport { glassyGaps } from './treatments/glassy';\n\nconst GAP_FINDERS: readonly FindGaps[] = [glassyGaps, fillGaps, borderGaps, motionGaps];\n\n/** The rules in `style` the engine cannot resolve yet, as `<surface>.<setting>: <value>`. */\nexport const findUnsupportedRules = (style: StyleDocument): readonly string[] =>\n SURFACE_NAMES.flatMap((surface) =>\n GAP_FINDERS.flatMap((findGaps) => findGaps(style.surfaces[surface], surface)).map(\n (gap) => `${surface}.${gap}`,\n ),\n );\n\n/**\n * Whether the engine resolves every rule `style` uses. The contract test and the Storybook's\n * engine-backed Styles both come from this, so a Style switches over as soon as the engine covers\n * it.\n */\nexport const isSupportedStyle = (style: StyleDocument): boolean =>\n findUnsupportedRules(style).length === 0;\n","import type { BrandTokens } from './brandTokens';\nimport type { KaleidoscopeVariables } from './kaleidoscopeContract';\nimport type { StyleDocument } from './styleVocabulary';\nimport { KALEIDOSCOPE_CONTRACT } from './kaleidoscopeContract';\nimport { resolveAnchors } from './private/engine/anchors';\nimport { evaluateSurfaces } from './private/engine/evaluateSurfaces';\nimport { typographyVariables } from './private/engine/rules/typography';\nimport { findUnsupportedRules } from './private/engine/support';\n\nconst resolveAgainstDefaultValues = (resolved: KaleidoscopeVariables): KaleidoscopeVariables => ({\n ...KALEIDOSCOPE_CONTRACT,\n ...resolved,\n});\n\n/**\n * Resolves a Style against a Brand Kit into the `--wistia-kaleidoscope-*` variables that style an\n * embed or hosted page. The record always holds every name in {@link KALEIDOSCOPE_CONTRACT}.\n *\n * A Brand Kit token the Style references but `brandTokens` leaves out takes its default from\n * `DEFAULT_BRAND_TOKENS`.\n *\n * @throws when the Style uses a rule the engine cannot resolve yet, or references a token that is\n * not a Brand Kit token.\n *\n * @example\n * ```ts\n * const variables = getKaleidoscopeStyles(OPAQUE_MINIMAL, { primaryColor: '#5b4cf0' });\n * variables['--wistia-kaleidoscope-button-primary-on-page-background-color']; // '#5b4cf0'\n * ```\n */\nexport const getKaleidoscopeStyles = (\n style: StyleDocument,\n brandTokens: BrandTokens = {},\n): KaleidoscopeVariables => {\n const unsupported = findUnsupportedRules(style);\n\n if (unsupported.length > 0) {\n throw new Error(`The engine cannot resolve \"${style.id}\" yet: ${unsupported.join(', ')}`);\n }\n\n const anchors = resolveAnchors(style, brandTokens);\n\n return resolveAgainstDefaultValues({\n ...evaluateSurfaces(style, anchors),\n ...typographyVariables(style, anchors),\n });\n};\n","import type { KaleidoscopeVariables } from './kaleidoscopeContract';\nimport { KALEIDOSCOPE_VARIABLE_PREFIX } from './kaleidoscopeContract';\n\nconst NAME_SUFFIX = /^[a-z0-9-]+$/;\n/** Ends the declaration or rule, or the `<style>` element, or escapes what follows, or `!important`. */\nconst UNSAFE_IN_VALUE = /[{};<\\\\!\\p{Cc}]|\\/\\*|\\*\\//u;\nconst UNSAFE_IN_SELECTOR = /[{};<\\\\@\\p{Cc}]|\\/\\*|\\*\\//u;\nconst QUOTED = /\"[^\"]*\"|'[^']*'/g;\nconst CLOSER_OF: Readonly<Record<string, string>> = { '(': ')', '[': ']' };\nconst CLOSERS = new Set(Object.values(CLOSER_OF));\n\n/** An unclosed quote or bracket swallows the declarations and rules after it. */\nconst isBalanced = (text: string): boolean => {\n const unquoted = text.replaceAll(QUOTED, '');\n const expected: string[] = [];\n\n if (/[\"']/.test(unquoted)) {\n return false;\n }\n\n for (const char of unquoted) {\n const closer = CLOSER_OF[char];\n\n if (closer !== undefined) {\n expected.push(closer);\n } else if (CLOSERS.has(char) && expected.pop() !== char) {\n return false;\n }\n }\n\n return expected.length === 0;\n};\n\nconst assertSafe = (label: string, text: string, unsafe: RegExp): void => {\n if (text.trim() === '' || unsafe.test(text) || !isBalanced(text)) {\n throw new Error(`Cannot serialize ${label} safely: ${JSON.stringify(text)}`);\n }\n};\n\nconst assertName = (name: string): void => {\n if (\n !name.startsWith(KALEIDOSCOPE_VARIABLE_PREFIX) ||\n !NAME_SUFFIX.test(name.slice(KALEIDOSCOPE_VARIABLE_PREFIX.length))\n ) {\n throw new Error(`Cannot serialize variable name safely: ${JSON.stringify(name)}`);\n }\n};\n\n/**\n * Writes the record from `getKaleidoscopeStyles()` as a CSS rule, for a server-rendered `<style>`\n * or for injecting at runtime.\n *\n * Text that could leave its declaration, its rule or the `<style>` element is refused rather than\n * escaped. The engine's own values never need it, so such text is a font family from a Brand Kit\n * that should not reach the page, and an escaped version would no longer name a real font.\n *\n * @throws when `selector`, a variable name or a value is unsafe. Callers rendering customer Brand\n * Kits should catch this and fall back.\n *\n * @example\n * ```ts\n * serializeKaleidoscopeStyles(getKaleidoscopeStyles(OPAQUE_MINIMAL), '.my-scope');\n * // '.my-scope {\\n --wistia-kaleidoscope-page-background-color: #ffffff;\\n …\\n}'\n * ```\n */\nexport const serializeKaleidoscopeStyles = (\n variables: KaleidoscopeVariables,\n selector: string,\n): string => {\n assertSafe('selector', selector, UNSAFE_IN_SELECTOR);\n\n const declarations = Object.entries(variables).map(([name, value]) => {\n assertName(name);\n assertSafe(`the value of ${name}`, value, UNSAFE_IN_VALUE);\n\n return ` ${name}: ${value};`;\n });\n\n return `${selector} {\\n${declarations.join('\\n')}\\n}`;\n};\n"],"mappings":";;;;;;;;;;;;;;AACA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;AACF;;AAoBA,MAAa,uBAA8C;CACzD,cAAc;CACd,qBAAqB;CACrB,cAAc;CACd,mBAAmB;CACnB,gBAAgB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C,GAEjE,MAAM,IAAI,MAAM,0CAA0C,KAAK,UAAU,IAAI,GAAG;AAEpF;;;;;;;;;;;;;;;;;;AAmBA,MAAa,+BACX,WACA,aACW;CACX,WAAW,YAAY,UAAU,kBAAkB;CASnD,OAAO,GAAG,SAAS,MAPE,OAAO,QAAQ,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW;EACpE,WAAW,IAAI;EACf,WAAW,gBAAgB,QAAQ,OAAO,eAAe;EAEzD,OAAO,KAAK,KAAK,IAAI,MAAM;CAC7B,CAEoC,CAAC,CAAC,KAAK,IAAI,EAAE;AACnD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getColorLightnessClassification-Dgr8qirZ.js","names":["HEX_RADIX","WHITE","BLACK","ACHROMATIC_CHROMA","WHITE","BLACK","ALMOST_BLACK","ALMOST_WHITE","FLARE"],"sources":["../src/private/clamp.ts","../src/private/colorSpace.ts","../src/private/parseColor.ts","../src/Color.ts","../src/colorContrastRatiosByShape.ts","../src/private/preciseContrast.ts","../src/adjustColorForProperContrast.ts","../src/ColorScale.ts","../src/getBestColorForText.ts","../src/getBrandDarkBackgroundColor.ts","../src/getBrandLightBackgroundColor.ts","../src/private/maxChroma.ts","../src/private/perceivedLightness.ts","../src/private/buildBrandedColorScale.ts","../src/getColorLightnessClassification.ts"],"sourcesContent":["/** Restrict `value` to the inclusive range between `min` and `max`. */\nexport const clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), max);\n","// oxlint-disable id-length -- single-letter names mirror the color-space formulas\nimport type { Hsl, Lab, RgbTuple } from '../types';\nimport { clamp } from './clamp';\n\nconst D65_WHITE_POINT = { x: 0.95047, y: 1, z: 1.08883 };\n\nconst DEGREES_PER_RADIAN = 180 / Math.PI;\n\n/** Slack allowed on a linear channel before a color counts as out of gamut. */\nconst GAMUT_EPSILON = 1e-6;\n\n/** Enough halvings to place the gamut boundary well inside a single 0–255 step. */\nconst GAMUT_SEARCH_ITERATIONS = 25;\n\n// CIE standard constants: 216/24389 and 24389/27. Their product, 8, is the L* below\n// which the Lab transfer function stays linear.\nconst LAB_EPSILON = 216 / 24389;\nconst LAB_KAPPA = 24389 / 27;\nconst LAB_LINEAR_LIGHTNESS_THRESHOLD = 8;\n\n/** Gamma-decode a 0–255 sRGB channel into linear light. */\nconst linearize = (channel: number): number => {\n const normalized = channel / 255;\n return normalized <= 0.04045 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;\n};\n\n/**\n * Gamma-encode linear light back into a 0–255 sRGB channel. The sign is carried through\n * the exponent so that out-of-gamut Lab values produce a negative channel rather than NaN.\n * Inverse of linearize.\n */\nconst compand = (linear: number): number => {\n const magnitude = Math.abs(linear);\n const encoded =\n magnitude <= 0.0031308 ? magnitude * 12.92 : 1.055 * magnitude ** (1 / 2.4) - 0.055;\n return encoded * Math.sign(linear) * 255;\n};\n\nconst pivot = (value: number): number =>\n value > LAB_EPSILON ? Math.cbrt(value) : (LAB_KAPPA * value + 16) / 116;\n\nconst hueToChannel = (start: number, end: number, givenHue: number): number => {\n let hue = givenHue;\n if (hue < 0) {\n hue += 1;\n }\n if (hue > 1) {\n hue -= 1;\n }\n if (hue < 1 / 6) {\n return start + (end - start) * 6 * hue;\n }\n if (hue < 1 / 2) {\n return end;\n }\n if (hue < 2 / 3) {\n return start + (end - start) * (2 / 3 - hue) * 6;\n }\n return start;\n};\n\n/**\n * WCAG relative luminance (0–1).\n *\n * @see https://www.w3.org/WAI/GL/wiki/Relative_luminance\n */\nexport const relativeLuminance = (red: number, green: number, blue: number): number =>\n 0.2126 * linearize(red) + 0.7152 * linearize(green) + 0.0722 * linearize(blue);\n\nexport const rgbToHsl = (red: number, green: number, blue: number): Hsl => {\n const r = red / 255;\n const g = green / 255;\n const b = blue / 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const lightness = (max + min) / 2;\n const delta = max - min;\n\n if (delta === 0) {\n return { hue: 0, lightness: lightness * 100, saturation: 0 };\n }\n\n const saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);\n\n let hue: number;\n if (max === r) {\n hue = (g - b) / delta + (g < b ? 6 : 0);\n } else if (max === g) {\n hue = (b - r) / delta + 2;\n } else {\n hue = (r - g) / delta + 4;\n }\n\n return { hue: (hue / 6) * 360, lightness: lightness * 100, saturation: saturation * 100 };\n};\n\nexport const hslToRgb = ({ hue, lightness, saturation }: Hsl): RgbTuple => {\n const h = hue / 360;\n const s = saturation / 100;\n const l = lightness / 100;\n const end = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const start = 2 * l - end;\n\n return [\n hueToChannel(start, end, h + 1 / 3) * 255,\n hueToChannel(start, end, h) * 255,\n hueToChannel(start, end, h - 1 / 3) * 255,\n ];\n};\n\nexport const rgbToLab = (red: number, green: number, blue: number): Lab => {\n const r = linearize(red);\n const g = linearize(green);\n const b = linearize(blue);\n\n const x = (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / D65_WHITE_POINT.x;\n const y = (0.2126729 * r + 0.7151522 * g + 0.072175 * b) / D65_WHITE_POINT.y;\n const z = (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / D65_WHITE_POINT.z;\n\n const fx = pivot(x);\n const fy = pivot(y);\n const fz = pivot(z);\n\n return { a: 500 * (fx - fy), b: 200 * (fy - fz), lightness: 116 * fy - 16 };\n};\n\n/**\n * OKLab in polar form: perceptual lightness (0–1), chroma (0 at gray, ~0.4 at the most\n * saturated sRGB colors) and hue in degrees. Unlike CIELAB, a fixed `hue` here reads as\n * one hue at every lightness — CIELAB's hue lines bend, which is why lightening a blue\n * along them walks it towards purple.\n *\n * @see https://bottosson.github.io/posts/oklab/\n */\nexport type Oklch = {\n readonly chroma: number;\n readonly hue: number;\n readonly lightness: number;\n};\n\nexport const rgbToOklch = (red: number, green: number, blue: number): Oklch => {\n const r = linearize(red);\n const g = linearize(green);\n const b = linearize(blue);\n\n const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);\n const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);\n const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);\n\n const aAxis = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;\n const bAxis = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;\n\n return {\n chroma: Math.hypot(aAxis, bAxis),\n hue: (Math.atan2(bAxis, aAxis) * DEGREES_PER_RADIAN + 360) % 360,\n lightness: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,\n };\n};\n\n/** Linear-light sRGB, which runs 0–1 and goes outside that range when out of gamut. */\nconst oklchToLinearRgb = ({ chroma, hue, lightness }: Oklch): RgbTuple => {\n const radians = hue / DEGREES_PER_RADIAN;\n const aAxis = Math.cos(radians) * chroma;\n const bAxis = Math.sin(radians) * chroma;\n\n const l = (lightness + 0.3963377774 * aAxis + 0.2158037573 * bAxis) ** 3;\n const m = (lightness - 0.1055613458 * aAxis - 0.0638541728 * bAxis) ** 3;\n const s = (lightness - 0.0894841775 * aAxis - 1.291485548 * bAxis) ** 3;\n\n return [\n 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n ];\n};\n\nconst fitsGamut = (oklch: Oklch): boolean =>\n oklchToLinearRgb(oklch).every(\n (channel) => channel >= -GAMUT_EPSILON && channel <= 1 + GAMUT_EPSILON,\n );\n\n/**\n * The most chroma this lightness and hue can hold inside sRGB, found by bisection. A hue\n * only gets so colorful before the gamut runs out, and that ceiling drops away sharply as\n * a color approaches white or black.\n */\nconst maximumChroma = (oklch: Oklch): number => {\n let low = 0;\n let high = oklch.chroma;\n\n for (let iteration = 0; iteration < GAMUT_SEARCH_ITERATIONS; iteration += 1) {\n const mid = (low + high) / 2;\n if (fitsGamut({ ...oklch, chroma: mid })) {\n low = mid;\n } else {\n high = mid;\n }\n }\n\n return low;\n};\n\n/**\n * Convert to sRGB, pulling chroma in until the color fits rather than clamping each\n * channel independently. Clamping is what bends the hue of an out-of-gamut color — a\n * lightened red whose red channel pins at 255 while green keeps climbing arrives at\n * yellow. Trading colorfulness for an exact hue and lightness keeps the family intact.\n */\nexport const oklchToRgb = (oklch: Oklch): RgbTuple => {\n const inGamut = fitsGamut(oklch) ? oklch : { ...oklch, chroma: maximumChroma(oklch) };\n const [red, green, blue] = oklchToLinearRgb(inGamut);\n\n return [compand(clamp(red, 0, 1)), compand(clamp(green, 0, 1)), compand(clamp(blue, 0, 1))];\n};\n\nexport const labToRgb = ({ a, b, lightness }: Lab): RgbTuple => {\n const fy = (lightness + 16) / 116;\n const fx = fy + a / 500;\n const fz = fy - b / 200;\n\n const x = (fx ** 3 > LAB_EPSILON ? fx ** 3 : (116 * fx - 16) / LAB_KAPPA) * D65_WHITE_POINT.x;\n const y =\n (lightness > LAB_LINEAR_LIGHTNESS_THRESHOLD ? fy ** 3 : lightness / LAB_KAPPA) *\n D65_WHITE_POINT.y;\n const z = (fz ** 3 > LAB_EPSILON ? fz ** 3 : (116 * fz - 16) / LAB_KAPPA) * D65_WHITE_POINT.z;\n\n return [\n compand(3.2404542 * x - 1.5371385 * y - 0.4985314 * z),\n compand(-0.969266 * x + 1.8760108 * y + 0.041556 * z),\n compand(0.0556434 * x - 0.2040259 * y + 1.0572252 * z),\n ];\n};\n","// oxlint-disable id-length -- r/g/b/a are the canonical names for color channels\nimport type { ColorInput, RgbaTuple } from '../types';\nimport { clamp } from './clamp';\n\nconst HEX_PATTERN = /^#?([\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$/i;\nconst RGB_FUNCTION_PATTERN = /^rgba?\\(([^)]*)\\)$/i;\nconst NUMBER_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/;\nconst PERCENTAGE_PATTERN = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)%$/;\nconst SEPARATOR_PATTERN = /[\\s,]+/;\n\nconst MAX_CHANNEL = 255;\nconst HEX_RADIX = 16;\n\nconst toChannel = (value: number): number => clamp(value, 0, MAX_CHANNEL);\nconst toAlpha = (value: number): number => clamp(value, 0, 1);\n\n/**\n * Read a numeric token, where a percentage is taken as a fraction of `percentageOf`. A\n * channel is `128` or `50%` (of 255); an alpha is `0.5` or `50%` (of 1).\n */\nconst parseNumericToken = (token: string | undefined, percentageOf: number): number | null => {\n if (token === undefined) {\n return null;\n }\n if (PERCENTAGE_PATTERN.test(token)) {\n return (Number(token.slice(0, -1)) / 100) * percentageOf;\n }\n if (NUMBER_PATTERN.test(token)) {\n return Number(token);\n }\n return null;\n};\n\nconst parseChannelToken = (token: string | undefined): number | null => {\n const value = parseNumericToken(token, MAX_CHANNEL);\n return value === null ? null : toChannel(value);\n};\n\nconst parseAlphaToken = (token: string | undefined): number | null => {\n const value = parseNumericToken(token, 1);\n return value === null ? null : toAlpha(value);\n};\n\nconst parseHex = (value: string): RgbaTuple | null => {\n const match = HEX_PATTERN.exec(value);\n const digits = match?.[1];\n if (digits === undefined) {\n return null;\n }\n\n // #rgb and #rgba are shorthand for each digit repeated: #1a2 -> #11aa22\n const expanded = digits.length <= 4 ? digits.replaceAll(/./g, '$&$&') : digits;\n\n return [\n Number.parseInt(expanded.slice(0, 2), HEX_RADIX),\n Number.parseInt(expanded.slice(2, 4), HEX_RADIX),\n Number.parseInt(expanded.slice(4, 6), HEX_RADIX),\n expanded.length === 8 ? Number.parseInt(expanded.slice(6, 8), HEX_RADIX) / MAX_CHANNEL : 1,\n ];\n};\n\nconst parseRgbFunction = (value: string): RgbaTuple | null => {\n const match = RGB_FUNCTION_PATTERN.exec(value);\n const body = match?.[1];\n if (body === undefined) {\n return null;\n }\n\n // Modern syntax puts alpha behind a slash: rgb(41 73 229 / 50%)\n const [channelSource, alphaSource, ...extraSources] = body.split('/');\n if (channelSource === undefined || extraSources.length > 0) {\n return null;\n }\n\n const tokens = channelSource.trim().split(SEPARATOR_PATTERN).filter(Boolean);\n const alphaTokens = (alphaSource ?? '').trim().split(SEPARATOR_PATTERN).filter(Boolean);\n if (alphaTokens.length > 1) {\n return null;\n }\n\n const [redToken, greenToken, blueToken, legacyAlphaToken, ...extraTokens] = tokens;\n if (extraTokens.length > 0) {\n return null;\n }\n if (alphaSource !== undefined && legacyAlphaToken !== undefined) {\n return null;\n }\n\n const red = parseChannelToken(redToken);\n const green = parseChannelToken(greenToken);\n const blue = parseChannelToken(blueToken);\n if (red === null || green === null || blue === null) {\n return null;\n }\n\n const alphaToken = alphaTokens[0] ?? legacyAlphaToken;\n if (alphaToken === undefined) {\n return [red, green, blue, 1];\n }\n\n const alpha = parseAlphaToken(alphaToken);\n return alpha === null ? null : [red, green, blue, alpha];\n};\n\n/**\n * Read any supported color representation into RGBA channels, or `null` when the input\n * is not a color this package understands.\n */\nexport const parseColor = (input: ColorInput): RgbaTuple | null => {\n if (typeof input === 'string') {\n const trimmed = input.trim();\n return parseHex(trimmed) ?? parseRgbFunction(trimmed);\n }\n\n if (Array.isArray(input)) {\n const [red, green, blue, alpha = 1] = input;\n if (![red, green, blue, alpha].every((value) => Number.isFinite(value))) {\n return null;\n }\n return [toChannel(red), toChannel(green), toChannel(blue), toAlpha(alpha)];\n }\n\n const { r, g, b, a = 1 } = input;\n if (![r, g, b, a].every((value) => Number.isFinite(value))) {\n return null;\n }\n return [toChannel(r), toChannel(g), toChannel(b), toAlpha(a)];\n};\n","import type { Oklch } from './private/colorSpace';\nimport type { ColorInput, Hsl, InterpolationMode, Lab, RgbaTuple } from './types';\n// oxlint-disable id-length -- r/g/b/a are the canonical names for color channels\nimport { clamp } from './private/clamp';\nimport {\n hslToRgb,\n labToRgb,\n oklchToRgb,\n relativeLuminance,\n rgbToHsl,\n rgbToLab,\n rgbToOklch,\n} from './private/colorSpace';\nimport { parseColor } from './private/parseColor';\n\nconst HEX_RADIX = 16;\n\n/** The ends of the OKLab lightness axis: white and black. */\nconst MAX_LIGHTNESS = 1;\nconst MIN_LIGHTNESS = 0;\n\nconst DEFAULT_INTERPOLATION_MODE: InterpolationMode = 'oklch';\n\nconst WHITE = '#ffffff';\nconst BLACK = '#000000';\n\n/** Wistia brand blue (`#2949e5`) — what an unreadable input resolves to. */\nconst FALLBACK_CHANNELS: RgbaTuple = [41, 73, 229, 1];\n\nconst toHexPair = (channel: number): string =>\n Math.round(channel).toString(HEX_RADIX).padStart(2, '0');\n\n/**\n * Truncated rather than rounded, so a ratio can never climb across a WCAG threshold on\n * its way to one decimal — 4.4501 reports as 4.4, not as a passing 4.5.\n */\nconst truncateToTenth = (ratio: number): number => Math.floor(ratio * 10) / 10;\n\nconst interpolate = (from: number, to: number, ratio: number): number => from + (to - from) * ratio;\n\n/**\n * Interpolate through linear light rather than gamma-encoded sRGB, which keeps blends\n * between saturated colors from sagging through a muddy midpoint.\n */\nconst interpolateLinear = (from: number, to: number, ratio: number): number =>\n Math.sqrt(from ** 2 * (1 - ratio) + to ** 2 * ratio);\n\n/** Below this much chroma a color reads as gray, and its hue stops meaning anything. */\nconst ACHROMATIC_CHROMA = 1e-4;\n\nconst HALF_TURN = 180;\nconst FULL_TURN = 360;\n\n/**\n * Interpolate hue the short way round the wheel — blue to yellow crosses green or magenta,\n * never both. A gray has no hue of its own to offer, so it borrows the other end's rather\n * than dragging the blend through unrelated hues on the way to white or black.\n */\nconst interpolateHue = (from: Oklch, to: Oklch, ratio: number): number => {\n if (from.chroma < ACHROMATIC_CHROMA) {\n return to.hue;\n }\n if (to.chroma < ACHROMATIC_CHROMA) {\n return from.hue;\n }\n\n const difference = ((to.hue - from.hue + HALF_TURN + FULL_TURN) % FULL_TURN) - HALF_TURN;\n return from.hue + difference * ratio;\n};\n\n/**\n * An immutable sRGB color with transformation methods like lighten, darken, tint, shade.\n * Also includes methods to calculate contrast ratio against another color, relative luminance, etc.\n *\n * @example\n * ```ts\n * new Color('#2949e5').lighten(0.5).toHex(); // '#89aaff'\n * new Color('#2949e5').withAlpha(0.5).toRgba(); // 'rgba(41, 73, 229, 0.5)'\n * new Color('#2949e5').contrast('#ffffff'); // 6.6\n * ```\n */\nexport class Color {\n /**\n * Read `input` into a color, returning `null` when it cannot be parsed.\n */\n static parse(input: ColorInput): Color | null {\n const channels = parseColor(input);\n return channels === null ? null : new Color(channels);\n }\n\n static fromHsl(hsl: Hsl, alpha = 1): Color {\n const [red, green, blue] = hslToRgb(hsl);\n return new Color([red, green, blue, alpha]);\n }\n\n static fromLab(lab: Lab, alpha = 1): Color {\n const [red, green, blue] = labToRgb(lab);\n return new Color([red, green, blue, alpha]);\n }\n\n /** Red channel, 0–255. Kept unrounded so that chained operations don't accumulate error. */\n readonly r: number;\n\n /** Green channel, 0–255. Kept unrounded so that chained operations don't accumulate error. */\n readonly g: number;\n\n /** Blue channel, 0–255. Kept unrounded so that chained operations don't accumulate error. */\n readonly b: number;\n\n /** Alpha channel, 0–1. */\n readonly a: number;\n\n /**\n * @param input - any supported color representation. Input that cannot be read as a\n * color resolves to brand blue rather than failing, so a malformed value degrades to\n * a usable color instead of interrupting a render.\n */\n constructor(input: ColorInput) {\n const [red, green, blue, alpha] = parseColor(input) ?? FALLBACK_CHANNELS;\n this.r = red;\n this.g = green;\n this.b = blue;\n this.a = alpha;\n }\n\n /** `#rrggbb`. Alpha is dropped — use {@link Color.toHexWithAlpha} to keep it. */\n toHex(): string {\n return `#${toHexPair(this.r)}${toHexPair(this.g)}${toHexPair(this.b)}`;\n }\n\n /** `#rrggbbaa`. */\n toHexWithAlpha(): string {\n return `${this.toHex()}${toHexPair(this.a * 255)}`;\n }\n\n /** `rgb(41, 73, 229)`. */\n toRgb(): string {\n return `rgb(${Math.round(this.r)}, ${Math.round(this.g)}, ${Math.round(this.b)})`;\n }\n\n /** `rgba(41, 73, 229, 0.5)`. */\n toRgba(): string {\n return `rgba(${Math.round(this.r)}, ${Math.round(this.g)}, ${Math.round(this.b)}, ${this.a})`;\n }\n\n /** Rounded channels, ready to hand to another color library. */\n toRgbaTuple(): RgbaTuple {\n return [Math.round(this.r), Math.round(this.g), Math.round(this.b), this.a];\n }\n\n toHsl(): Hsl {\n return rgbToHsl(this.r, this.g, this.b);\n }\n\n toLab(): Lab {\n return rgbToLab(this.r, this.g, this.b);\n }\n\n /** Hex when fully opaque, `rgba()` otherwise, so the alpha is never silently lost. */\n toString(): string {\n return this.a === 1 ? this.toHex() : this.toRgba();\n }\n\n /**\n * WCAG relative luminance, from 0 (black) to 1 (white). Alpha is ignored — luminance\n * is only meaningful once a color has been composited onto a background.\n */\n luminance(): number {\n return relativeLuminance(this.r, this.g, this.b);\n }\n\n /**\n * WCAG contrast ratio against `other`, from 1 (identical) to 21 (black on white),\n * reported to one decimal place.\n *\n * @see {@link colorContrastRatiosByShape} for the ratio each kind of content needs\n */\n contrast(other: ColorInput): number {\n const ownLuminance = this.luminance();\n const otherLuminance = new Color(other).luminance();\n const lighter = Math.max(ownLuminance, otherLuminance);\n const darker = Math.min(ownLuminance, otherLuminance);\n return truncateToTenth((lighter + 0.05) / (darker + 0.05));\n }\n\n /**\n * Raise perceptual lightness `ratio` (0–1) of the way to white, holding the hue steady.\n *\n * The hue is held in OKLCh, so a lightened color stays recognizably itself: a blue\n * lightens to a paler blue instead of drifting purple, and a red that runs out of sRGB\n * gives up colorfulness rather than sliding towards orange. That is the difference from\n * {@link Color.tint}, which stirs white into the channels and lets the hue land where it\n * may.\n */\n lighten(ratio: number): Color {\n return this.#towardsLightness(MAX_LIGHTNESS, ratio);\n }\n\n /** Lower perceptual lightness `ratio` (0–1) of the way to black, holding the hue steady. */\n darken(ratio: number): Color {\n return this.#towardsLightness(MIN_LIGHTNESS, ratio);\n }\n\n /** Mix `ratio` (0–1) of white in. */\n tint(ratio: number, mode: InterpolationMode = DEFAULT_INTERPOLATION_MODE): Color {\n return this.blend(WHITE, ratio, mode);\n }\n\n /** Mix `ratio` (0–1) of black in. */\n shade(ratio: number, mode: InterpolationMode = DEFAULT_INTERPOLATION_MODE): Color {\n return this.blend(BLACK, ratio, mode);\n }\n\n /**\n * Mix towards `other`, where `ratio` 0 keeps this color and 1 returns `other`. Alpha is\n * always interpolated linearly, whichever `mode` the channels travel through.\n */\n blend(\n other: ColorInput,\n ratio = 0.5,\n mode: InterpolationMode = DEFAULT_INTERPOLATION_MODE,\n ): Color {\n const target = new Color(other);\n const amount = clamp(ratio, 0, 1);\n const alpha = interpolate(this.a, target.a, amount);\n\n if (mode === 'oklch') {\n const from = rgbToOklch(this.r, this.g, this.b);\n const to = rgbToOklch(target.r, target.g, target.b);\n const [red, green, blue] = oklchToRgb({\n chroma: interpolate(from.chroma, to.chroma, amount),\n hue: interpolateHue(from, to, amount),\n lightness: interpolate(from.lightness, to.lightness, amount),\n });\n\n return new Color([red, green, blue, alpha]);\n }\n\n if (mode === 'lab') {\n const from = this.toLab();\n const to = target.toLab();\n return Color.fromLab(\n {\n a: interpolate(from.a, to.a, amount),\n b: interpolate(from.b, to.b, amount),\n lightness: interpolate(from.lightness, to.lightness, amount),\n },\n alpha,\n );\n }\n\n const blendChannel = mode === 'lrgb' ? interpolateLinear : interpolate;\n return new Color([\n blendChannel(this.r, target.r, amount),\n blendChannel(this.g, target.g, amount),\n blendChannel(this.b, target.b, amount),\n alpha,\n ]);\n }\n\n /** Replace the alpha channel with `alpha` (0–1). */\n withAlpha(alpha: number): Color {\n return new Color([this.r, this.g, this.b, alpha]);\n }\n\n /**\n * Replace HSL lightness with `lightness` (0–100), leaving hue and saturation alone.\n * Use this to hit an absolute lightness; use {@link Color.lighten} to step relative to\n * where the color already is.\n */\n withLightness(lightness: number): Color {\n const { hue, saturation } = this.toHsl();\n return Color.fromHsl({ hue, lightness: clamp(lightness, 0, 100), saturation }, this.a);\n }\n\n /**\n * Travel `ratio` of the way to `target` along the OKLab lightness axis, keeping hue and\n * as much colorfulness as the sRGB gamut has room for at the lightness we arrive at.\n */\n #towardsLightness(target: number, ratio: number): Color {\n const { chroma, hue, lightness } = rgbToOklch(this.r, this.g, this.b);\n const [red, green, blue] = oklchToRgb({\n chroma,\n hue,\n lightness: interpolate(lightness, target, clamp(ratio, 0, 1)),\n });\n\n return new Color([red, green, blue, this.a]);\n }\n}\n","export const colorContrastRatiosByShape = {\n nonText: 3.0, // 3.0:1 - https://www.w3.org/TR/WCAG21/#non-text-contrast\n largeText: 3.0, // 3.0:1 - https://www.w3.org/TR/WCAG21/#contrast-minimum\n paragraphText: 4.5, // 4.5:1 - https://www.w3.org/TR/WCAG21/#contrast-minimum\n smallText: 5.5, // We're making this up, but it should be more than the paragraph text\n} as const;\n\n/** The kind of content a color has to be legible as, which sets the ratio it has to clear. */\nexport type ColorShape = keyof typeof colorContrastRatiosByShape;\n","import type { Color } from '../Color';\n\n/**\n * The WCAG contrast ratio between two colors at full precision, unlike\n * {@link Color.contrast}, which truncates to one decimal.\n *\n * Use this to compare two ratios against each other; use `Color.contrast` to decide\n * whether one clears a required ratio. Truncation is fine for the second and ruinous for\n * the first: near-identical ratios collapse to the same tenth and tie, which sends a\n * direction probe the long way round or ranks two candidates arbitrarily.\n */\nexport const preciseContrast = (color: Color, other: Color): number => {\n const ownLuminance = color.luminance();\n const otherLuminance = other.luminance();\n return (\n (Math.max(ownLuminance, otherLuminance) + 0.05) /\n (Math.min(ownLuminance, otherLuminance) + 0.05)\n );\n};\n","import type { ColorShape } from './colorContrastRatiosByShape';\nimport type { ColorInput } from './types';\nimport { Color } from './Color';\nimport { colorContrastRatiosByShape } from './colorContrastRatiosByShape';\nimport { clamp } from './private/clamp';\nimport { preciseContrast } from './private/preciseContrast';\n\nconst WHITE = '#ffffff';\nconst BLACK = '#000000';\n\n/** One HSL lightness percentage point — the step the search walks the foreground by. */\nconst LIGHTNESS_STEP = 1;\n\n/** How far to probe each way when deciding which direction gains contrast faster. */\nconst PROBE_RATIO = 0.1;\n\n/** HSL lightness bands where a color is close enough to an extreme to have nowhere to go. */\nconst NEARLY_BLACK_LIGHTNESS = 10;\nconst NEARLY_WHITE_LIGHTNESS = 80;\n\n/** Contrast of a color against itself, and the floor of the WCAG ratio. */\nconst MIN_CONTRAST = 1.0;\n\n/** The ends of the luminance range: the search has run out of room once it lands on one. */\nconst MAX_LUMINANCE = 1;\nconst MIN_LUMINANCE = 0;\n\n/**\n * Backstop on the search. Flipping direction at the extremes should always converge well\n * before this, so reaching it means something is wrong, not that the budget was tight.\n */\nconst MAX_ITERATIONS = 1000;\n\nexport type AdjustColorForProperContrastOptions = {\n /** What the foreground sits on. Never adjusted. */\n readonly backgroundColor: ColorInput;\n\n /** The color to nudge until it is legible. Returned untouched if it already is. */\n readonly foregroundColor: ColorInput;\n\n /** What the foreground is. Defaults to `paragraphText` (4.5:1). */\n readonly shape?: ColorShape;\n};\n\n/**\n * Walk `foregroundColor` towards white or black until it clears the contrast ratio\n * `shape` requires against `backgroundColor`.\n *\n * Hue is pinned for the whole walk, so the result still reads as the color you passed in\n * — a washed-out brand blue stays blue rather than drifting towards its neighbors. The\n * direction is whichever gains contrast faster, reversing if it hits an extreme with the\n * ratio still unmet. Text-grade ratios that can't be met either way settle on plain white\n * or black, since at that point nothing else beats them.\n *\n * @example\n * ```ts\n * // Already legible, so nothing moves.\n * adjustColorForProperContrast({\n * foregroundColor: '#2949e5',\n * backgroundColor: '#ffffff',\n * }).toHex(); // '#2949e5'\n *\n * // A brand blue on itself, darkened until it separates.\n * adjustColorForProperContrast({\n * foregroundColor: '#2949e5',\n * backgroundColor: '#2949e5',\n * shape: 'nonText',\n * }).toHex();\n * ```\n */\nexport const adjustColorForProperContrast = ({\n backgroundColor,\n foregroundColor,\n shape = 'paragraphText',\n}: AdjustColorForProperContrastOptions): Color => {\n const background = new Color(backgroundColor);\n const foreground = new Color(foregroundColor);\n const requiredContrast = colorContrastRatiosByShape[shape];\n\n const initialContrast = foreground.contrast(background);\n if (initialContrast >= requiredContrast) {\n return foreground;\n }\n\n const { hue, lightness: initialLightness } = foreground.toHsl();\n\n let shouldBeLighter =\n initialLightness < NEARLY_BLACK_LIGHTNESS ||\n preciseContrast(foreground.tint(PROBE_RATIO, 'rgb'), background) >\n preciseContrast(foreground.shade(PROBE_RATIO, 'rgb'), background);\n\n // A nearly-white foreground gains a sliver of contrast by lightening, but can never gain\n // enough — the only way out is down.\n if (initialLightness > NEARLY_WHITE_LIGHTNESS && initialContrast === MIN_CONTRAST) {\n shouldBeLighter = false;\n }\n\n let adjusted = foreground;\n\n for (let iteration = 0; iteration < MAX_ITERATIONS; iteration += 1) {\n if (adjusted.contrast(background) >= requiredContrast) {\n return adjusted;\n }\n\n const luminance = adjusted.luminance();\n // Out of room at white or black with the ratio still unmet. Nothing beats an extreme\n // at the stricter text ratios, so take it; the looser ones get a second pass back the\n // other way, which may land on a color truer to the original than an extreme would be.\n if (iteration > 0 && (luminance === MAX_LUMINANCE || luminance === MIN_LUMINANCE)) {\n if (requiredContrast > colorContrastRatiosByShape.nonText) {\n const white = new Color(WHITE);\n const black = new Color(BLACK);\n return white.contrast(background) > black.contrast(background) ? white : black;\n }\n\n shouldBeLighter = !shouldBeLighter;\n adjusted = foreground;\n }\n\n const { lightness, saturation } = adjusted.toHsl();\n const stepped = Color.fromHsl(\n {\n hue,\n lightness: clamp(lightness + (shouldBeLighter ? LIGHTNESS_STEP : -LIGHTNESS_STEP), 0, 100),\n saturation,\n },\n adjusted.a,\n );\n\n // Snap to the 8-bit color the caller will actually render. Color keeps channels\n // unrounded, so measuring contrast on them can clear the ratio by a hair that\n // rounding to hex then gives back, handing back a color that doesn't actually pass the required contrast.\n adjusted = new Color(stepped.toRgbaTuple());\n }\n\n // Never converged. Hand back the closest we got rather than interrupting a render.\n return adjusted;\n};\n","import type { ColorInput, InterpolationMode } from './types';\nimport { Color } from './Color';\nimport { clamp } from './private/clamp';\n\ntype Stop = {\n readonly color: Color;\n readonly position: number;\n};\n\nconst DEFAULT_DOMAIN: [number, number] = [0, 1];\nconst DEFAULT_MODE: InterpolationMode = 'lrgb';\nconst DEFAULT_PADDING: [number, number] = [0, 0];\n\n/** Ceiling on the binary search in `correctLightness` */\nconst MAX_LIGHTNESS_ITERATIONS = 20;\nconst LIGHTNESS_TOLERANCE = 0.01;\n\nexport type ColorScaleOptions = {\n /**\n * Quantize the scale into bands instead of leaving it continuous: a count of equally sized\n * classes across the domain, or explicit class breaks.\n */\n readonly classes?: number | number[];\n\n /**\n * Redistribute stops so that perceived lightness moves evenly from end to end. Worth\n * turning on for any scale a reader is meant to rank by eye.\n */\n readonly correctLightness?: boolean;\n\n /**\n * The input range, `[0, 1]` by default. Two values set the ends; supply one value per\n * color to pin each color to a position, or more than two to warp the scale.\n */\n readonly domain?: number[];\n\n /** Bias the scale towards one end. Above 1 favors the start, below 1 the end. */\n readonly gamma?: number;\n\n /** The color space blends travel through. */\n readonly mode?: InterpolationMode;\n\n /** Trim `[start, end]` fractions off the scale, dropping its most extreme colors. */\n readonly padding?: [number, number] | number;\n};\n\nconst toPaddingPair = (padding: ColorScaleOptions['padding']): [number, number] => {\n const pair: [number, number] =\n typeof padding === 'number' ? [padding, padding] : (padding ?? DEFAULT_PADDING);\n return [clamp(pair[0], 0, 1), clamp(pair[1], 0, 1)];\n};\n\nconst toClassBreaks = (\n classes: ColorScaleOptions['classes'],\n min: number,\n max: number,\n): number[] | null => {\n if (classes === undefined) {\n return null;\n }\n if (Array.isArray(classes)) {\n return classes.length === 0 ? null : classes;\n }\n if (classes < 1) {\n return [min, max];\n }\n return Array.from({ length: classes + 1 }, (_, index) => min + (index / classes) * (max - min));\n};\n\n/** The index of the class `value` falls into, or -1 when it sits below the first break. */\nconst toClassIndex = (value: number, breaks: number[]): number => {\n let index = 0;\n while (index < breaks.length - 1 && value >= (breaks[index] ?? Number.POSITIVE_INFINITY)) {\n index += 1;\n }\n return index - 1;\n};\n\n/**\n * A continuous scale between two or more colors — the chroma.js `scale` model, as an\n * immutable class. Every configuration method returns a new scale, so a configured scale\n * is safe to hold onto and share.\n *\n * @example\n * ```ts\n * const scale = new ColorScale(['#2949e5', '#ffffff']);\n * scale.at(0.5).toHex(); // the midpoint color\n * scale.colors(5).map((color) => color.toHex()); // five evenly spaced colors\n * scale.correctLightness().domain([0, 100]).at(72); // perceptually even, read in %\n * ```\n */\nexport class ColorScale {\n readonly #classBreaks: number[] | null;\n readonly #colors: [Color, ...Color[]];\n readonly #correctLightness: boolean;\n readonly #domainBreaks: number[] | null;\n readonly #domainOutputs: number[] | null;\n readonly #gamma: number;\n readonly #max: number;\n readonly #min: number;\n readonly #mode: InterpolationMode;\n readonly #options: ColorScaleOptions;\n readonly #padding: [number, number];\n readonly #sampleRange: [number, number];\n readonly #stops: [Stop, ...Stop[]];\n\n /**\n * @param colors - the colors the scale runs through; a single color makes a flat scale\n * @throws {TypeError} when `colors` is empty or `domain` has fewer than two values\n */\n constructor(colors: readonly ColorInput[], options: ColorScaleOptions = {}) {\n const [firstColor, ...remainingColors] = colors.map((color) => new Color(color));\n if (firstColor === undefined) {\n throw new TypeError('A color scale needs at least one color.');\n }\n\n // A lone color still has to interpolate against something, so it becomes both ends.\n this.#colors =\n remainingColors.length === 0 ? [firstColor, firstColor] : [firstColor, ...remainingColors];\n this.#options = options;\n this.#mode = options.mode ?? DEFAULT_MODE;\n this.#gamma = options.gamma ?? 1;\n this.#padding = toPaddingPair(options.padding);\n this.#correctLightness = options.correctLightness ?? false;\n\n const domain = options.domain ?? DEFAULT_DOMAIN;\n const min = domain[0];\n const max = domain.at(-1);\n if (min === undefined || max === undefined || domain.length < 2) {\n throw new TypeError('A color scale domain needs at least two values.');\n }\n this.#min = min;\n this.#max = max;\n\n const count = this.#colors.length;\n let positions: number[];\n let domainBreaks: number[] | null = null;\n let domainOutputs: number[] | null = null;\n\n if (domain.length === count && min !== max) {\n // One domain value per color pins each color to its own position.\n positions = domain.map((value) => (value - min) / (max - min));\n } else {\n positions = this.#colors.map((_, index) => index / (count - 1));\n\n if (domain.length > 2 && min !== max) {\n const breaks = domain.map((value) => (value - min) / (max - min));\n const outputs = domain.map((_, index) => index / (domain.length - 1));\n // Only warp the scale when the intermediate values aren't already evenly spaced.\n if (!breaks.every((value, index) => outputs[index] === value)) {\n domainBreaks = breaks;\n domainOutputs = outputs;\n }\n }\n }\n\n this.#domainBreaks = domainBreaks;\n this.#domainOutputs = domainOutputs;\n\n const [firstStopColor, ...remainingStopColors] = this.#colors;\n this.#stops = [\n { color: firstStopColor, position: positions[0] ?? 0 },\n ...remainingStopColors.map((color, index) => ({\n color,\n position: positions[index + 1] ?? 1,\n })),\n ];\n\n this.#classBreaks = toClassBreaks(options.classes, min, max);\n const firstBreak = this.#classBreaks?.[0];\n const lastBreak = this.#classBreaks?.at(-1);\n this.#sampleRange =\n firstBreak === undefined || lastBreak === undefined ? [min, max] : [firstBreak, lastBreak];\n }\n\n /** The color at `value`, read through the scale's domain, classes, gamma and padding. */\n at(value: number): Color {\n if (!Number.isFinite(value)) {\n throw new TypeError(`A color scale cannot be sampled at ${String(value)}.`);\n }\n return this.#colorAt(value, false);\n }\n\n /** `count` colors spread evenly across the domain. */\n colors(count: number): Color[] {\n if (!Number.isInteger(count) || count < 0) {\n throw new TypeError(`A color scale cannot produce ${String(count)} colors.`);\n }\n if (count === 0) {\n return [];\n }\n\n const [start, end] = this.#sampleRange;\n if (count === 1) {\n return [this.at(start + (end - start) / 2)];\n }\n\n const span = end - start;\n return Array.from({ length: count }, (_, index) =>\n this.at(start + (index / (count - 1)) * span),\n );\n }\n\n mode(mode: InterpolationMode): ColorScale {\n return this.#withOptions({ mode });\n }\n\n domain(domain: number[]): ColorScale {\n return this.#withOptions({ domain });\n }\n\n gamma(gamma: number): ColorScale {\n return this.#withOptions({ gamma });\n }\n\n padding(padding: [number, number] | number): ColorScale {\n return this.#withOptions({ padding });\n }\n\n correctLightness(correctLightness = true): ColorScale {\n return this.#withOptions({ correctLightness });\n }\n\n classes(classes: number | number[]): ColorScale {\n return this.#withOptions({ classes });\n }\n\n #withOptions(overrides: ColorScaleOptions): ColorScale {\n return new ColorScale(this.#colors, { ...this.#options, ...overrides });\n }\n\n #colorAt(value: number, bypassValueMapping: boolean): Color {\n let position = clamp(\n this.#mapDomain(bypassValueMapping ? value : this.#toPosition(value)),\n 0,\n 1,\n );\n\n if (!bypassValueMapping && this.#correctLightness) {\n position = this.#correctPosition(position);\n }\n\n if (this.#gamma !== 1) {\n position **= this.#gamma;\n }\n\n const [paddingStart, paddingEnd] = this.#padding;\n position = paddingStart + position * (1 - paddingStart - paddingEnd);\n\n return this.#interpolateAt(clamp(position, 0, 1));\n }\n\n /** Map a domain value onto the scale's unpadded 0–1 range. */\n #toPosition(value: number): number {\n const breaks = this.#classBreaks;\n if (breaks !== null && breaks.length > 2) {\n return toClassIndex(value, breaks) / (breaks.length - 2);\n }\n if (this.#max === this.#min) {\n return 1;\n }\n return (value - this.#min) / (this.#max - this.#min);\n }\n\n /** Warp the scale so that intermediate domain values land where the caller placed them. */\n #mapDomain(position: number): number {\n const breaks = this.#domainBreaks;\n const outputs = this.#domainOutputs;\n if (breaks === null || outputs === null || position <= 0 || position >= 1) {\n return position;\n }\n\n let index = 0;\n while (index < breaks.length - 2 && position >= (breaks[index + 1] ?? 1)) {\n index += 1;\n }\n\n const start = breaks[index] ?? 0;\n const end = breaks[index + 1] ?? 1;\n const outputStart = outputs[index] ?? 0;\n const outputEnd = outputs[index + 1] ?? 1;\n if (end === start) {\n return outputStart;\n }\n return outputStart + ((position - start) / (end - start)) * (outputEnd - outputStart);\n }\n\n /**\n * Nudge `position` until the color there carries the Lab lightness an evenly lit scale\n * would have, by bisecting between the ends.\n */\n #correctPosition(position: number): number {\n const startLightness = this.#colorAt(0, true).toLab().lightness;\n const endLightness = this.#colorAt(1, true).toLab().lightness;\n const isDescending = startLightness > endLightness;\n const idealLightness = startLightness + (endLightness - startLightness) * position;\n\n let low = 0;\n let high = 1;\n let corrected = position;\n let difference = this.#colorAt(corrected, true).toLab().lightness - idealLightness;\n\n for (\n let iteration = 0;\n iteration < MAX_LIGHTNESS_ITERATIONS && Math.abs(difference) > LIGHTNESS_TOLERANCE;\n iteration += 1\n ) {\n // Already lighter than ideal: search the darker half, and vice versa.\n if (isDescending === difference < 0) {\n high = corrected;\n corrected += (low - corrected) / 2;\n } else {\n low = corrected;\n corrected += (high - corrected) / 2;\n }\n difference = this.#colorAt(corrected, true).toLab().lightness - idealLightness;\n }\n\n return corrected;\n }\n\n #interpolateAt(position: number): Color {\n const stops = this.#stops;\n\n for (const [index, stop] of stops.entries()) {\n if (position <= stop.position) {\n return stop.color;\n }\n\n const next = stops[index + 1];\n if (next === undefined) {\n return stop.color;\n }\n\n if (position < next.position) {\n const ratio = (position - stop.position) / (next.position - stop.position);\n return stop.color.blend(next.color, ratio, this.#mode);\n }\n }\n\n return stops[0].color;\n }\n}\n","import type { ColorShape } from './colorContrastRatiosByShape';\nimport type { ColorInput } from './types';\nimport { Color } from './Color';\nimport { colorContrastRatiosByShape } from './colorContrastRatiosByShape';\nimport { preciseContrast } from './private/preciseContrast';\n\nconst WHITE = '#ffffff';\nconst BLACK = '#000000';\n\nexport type BestColorForTextOptions = {\n /** Always excluded from the result.*/\n readonly backgroundColor: ColorInput;\n\n /**\n * Colors that are part of the palette but should not be considered as candidates.\n * Useful in scenarios like the webinar pages color derivation logic, where we might include derived colors\n * in the palette used by some fields, like `lowEmphasisTextColor`, but we want to exclude the derived colors\n * from other fields, like `mainTextColor`.\n */\n readonly exclude?: readonly ColorInput[];\n\n /**\n * The colors to choose from. Black and white are included automatically, so an empty/absent palette\n * still yields whichever of the two has best contrast against `backgroundColor`.\n */\n readonly palette?: readonly ColorInput[];\n\n /** The type of text/shape that will use the resulting color. Defaults to `paragraphText` (4.5:1). */\n readonly shape?: ColorShape;\n};\n\n/**\n * Picks a color most suitable for a given text (or non-text) shape against the given background color.\n * Accepts an optional color palette, but white and black are always included as options in addition to the palette.\n * Also accepts a set of colors from the palette that should be excluded from consideration.\n *\n * @example\n * ```ts\n * getBestColorForText({ backgroundColor: '#2949e5' }).toHex(); // '#ffffff'\n * ```\n */\nexport const getBestColorForText = ({\n backgroundColor,\n exclude = [],\n palette = [],\n shape = 'paragraphText',\n}: BestColorForTextOptions): Color => {\n const background = new Color(backgroundColor);\n const requiredContrast = colorContrastRatiosByShape[shape];\n\n const excluded = new Set(\n // Always exclude the background color in addition to the colorsToExclude\n [...exclude, background]\n .map((color) => new Color(color).toHex())\n // If one of the excluded colors is black or white, don't exclude it.\n // We always need black and white as potential text color options.\n .filter((hex) => hex !== WHITE && hex !== BLACK),\n );\n\n const candidates = [\n ...new Map(\n [WHITE, BLACK, ...palette].map((color) => {\n const candidate = new Color(color);\n return [candidate.toHex(), candidate];\n }),\n ).values(),\n ].filter((color) => !excluded.has(color.toHex()));\n\n const white = new Color(WHITE);\n const black = new Color(BLACK);\n\n // Rank candidates in order of least contrast first, otherwise we would always return either black or white.\n const ranked = candidates\n .map((color) => ({ color, ratio: preciseContrast(color, background) }))\n .toSorted((one, two) => one.ratio - two.ratio);\n\n // Which side of the background text belongs on: light text on a dark background, dark\n // text on a light one. Settled by measuring both extremes rather than by a lightness\n // threshold, so the crossover falls where contrast actually flips, near luminance 0.18.\n //\n // Worth preferring because the WCAG ratio is symmetric and cannot say that dark-on-dark\n // and light-on-dark read differently at the same number. Without this, a background\n // around luminance 0.12 takes black at 3.3:1 — enough to clear largeText, and murky to\n // read — over a light candidate that costs nothing.\n\n // Optically, should the text be lighter or darker than the background?\n const prefersLighterText =\n preciseContrast(white, background) > preciseContrast(black, background);\n const backgroundLuminance = background.luminance();\n const isPreferredSide = (color: Color): boolean =>\n prefersLighterText\n ? color.luminance() >= backgroundLuminance\n : color.luminance() <= backgroundLuminance;\n\n const passing = ranked.filter(({ color }) => color.contrast(background) >= requiredContrast);\n\n // The least-contrasting passing candidate on the preferred side. There is always one\n // when anything passes at all: the preferred side is the one whose extreme contrasts\n // more, and both extremes are always in the pool. So falling through means nothing\n // cleared the ratio, and the most contrast on offer is that same extreme.\n return (\n passing.find(({ color }) => isPreferredSide(color))?.color ??\n (prefersLighterText ? white : black)\n );\n};\n","import type { ColorInput } from './types';\nimport { Color } from './Color';\n\nconst MAX_PAGE_SATURATION = 50;\n\nconst ALMOST_BLACK = 5;\nconst ALMOST_WHITE = 95;\nconst DESIRED_BACKGROUND_LIGHTNESS = 18;\nconst MINIMUM_CONTRAST_BETWEEN_PRIMARY_AND_BACKGROUND = 1.5;\nconst SEARCH_INCREMENT = 0.5;\n\nconst constructColorWithNewSaturationAndLightness = (\n primaryColor: Color,\n saturation: number,\n lightness: number,\n): Color => Color.fromHsl({ hue: primaryColor.toHsl().hue, lightness, saturation }, primaryColor.a);\n\n/**\n * Generates a dark background color from a given primary color, preserving the hue of the primary color.\n *\n * @example\n * ```ts\n * getBrandDarkBackgroundColor('#2949e5').toHex(); // '#242942'\n * ```\n *\n * @see {@link getBrandLightBackgroundColor} for the light counterpart\n */\nexport const getBrandDarkBackgroundColor = (_primaryColor: ColorInput): Color => {\n const primaryColor = new Color(_primaryColor);\n const { lightness: brandLightness, saturation } = primaryColor.toHsl();\n\n // If the color is close to black or white, zero out the saturation so\n // we end up with gray instead of red\n const hasNoUsableHue = brandLightness < ALMOST_BLACK || brandLightness > ALMOST_WHITE;\n const pageSaturation = hasNoUsableHue ? 0 : Math.min(MAX_PAGE_SATURATION, saturation);\n\n const initialBackgroundColorOption = constructColorWithNewSaturationAndLightness(\n primaryColor,\n pageSaturation,\n DESIRED_BACKGROUND_LIGHTNESS,\n );\n\n // If the initial background color option meets our desired contrast, just use it.\n if (\n initialBackgroundColorOption.contrast(primaryColor) >=\n MINIMUM_CONTRAST_BETWEEN_PRIMARY_AND_BACKGROUND\n ) {\n return initialBackgroundColorOption;\n }\n\n // Otherwise if the initial background color option did not have the desired contrast,\n // tweak the lightness until we get a color that does meet the desired contrast.\n // Return black if we run out of options.\n let backgroundColorWithIncreasedContrast = initialBackgroundColorOption;\n for (\n let pageLightness = DESIRED_BACKGROUND_LIGHTNESS;\n pageLightness >= 0;\n pageLightness -= SEARCH_INCREMENT\n ) {\n const candidate = constructColorWithNewSaturationAndLightness(\n primaryColor,\n pageSaturation,\n pageLightness,\n );\n if (\n candidate.contrast(primaryColor) > backgroundColorWithIncreasedContrast.contrast(primaryColor)\n ) {\n backgroundColorWithIncreasedContrast = candidate;\n }\n if (\n backgroundColorWithIncreasedContrast.contrast(primaryColor) >=\n MINIMUM_CONTRAST_BETWEEN_PRIMARY_AND_BACKGROUND\n ) {\n break;\n }\n }\n\n return backgroundColorWithIncreasedContrast;\n};\n","import type { ColorInput } from './types';\nimport { Color } from './Color';\n\n/** Enough saturation for the brand hue to register, for a primary that has barely any. */\nconst MIN_SATURATION = 5;\n\n/** HSL lightness bands where a primary is close enough to an extreme to have no usable hue. */\nconst ALMOST_BLACK = 5;\nconst ALMOST_WHITE = 95;\n\n/**\n *\n * Generates a light background color from a given primary color, preserving the hue of the primary color.\n *\n * @example\n * ```ts\n * getBrandLightBackgroundColor('#2949e5').toHex(); // '#ebeefd'\n * ```\n *\n * @see {@link getBrandDarkBackgroundColor} for the dark counterpart\n */\nexport const getBrandLightBackgroundColor = (_primaryColor: ColorInput): Color => {\n const primaryColor = new Color(_primaryColor);\n const { lightness, saturation } = primaryColor.toHsl();\n\n // If the new color is close to black or white, zero out the saturation so\n // we end up with gray instead of pink\n const hasNoHue = saturation === 0 || lightness < ALMOST_BLACK || lightness > ALMOST_WHITE;\n const targetSaturation = hasNoHue ? 0 : Math.max(MIN_SATURATION, saturation);\n\n // Make the current color *almost* white and then darken it just a bit\n // to get a nice looking light background color based on the primary color\n const derived = primaryColor.tint(0.95, 'rgb').shade(0.02, 'rgb');\n\n return Color.fromHsl({ ...derived.toHsl(), saturation: targetSaturation }, derived.a);\n};\n","import { oklchToRgb, rgbToOklch } from './colorSpace';\n\n/**\n * Below this a color has no perceptible hue.\n */\nexport const ACHROMATIC_CHROMA = 1e-4;\n\n/**\n * More chroma than sRGB holds anywhere. The widest point is magenta at 0.32\n */\nconst UNREACHABLE_CHROMA = 0.5;\n\n/**\n * The most chroma sRGB can hold at the given lightness and hue.\n *\n * Read from {@link oklchToRgb}, which already clamps by max chroma so that we don't have to\n * re-implement searching for max possible chroma.\n */\nexport const maxChroma = (lightness: number, hue: number): number => {\n const [red, green, blue] = oklchToRgb({ chroma: UNREACHABLE_CHROMA, hue, lightness });\n\n return rgbToOklch(red, green, blue).chroma;\n};\n","import type { Color } from '../Color';\n\n/**\n * Flare is the ambient light reflecting off a screen, as defined by WCAG guidelines.\n * See https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum\n */\nconst FLARE = 0.05;\nconst FLOOR = Math.cbrt(FLARE);\nconst SPAN = Math.cbrt(1 + FLARE) - FLOOR;\n\n/**\n * Get the perceived lightness of a color, with ambient lighting factored in according\n * to WCAG guidelines.\n */\nexport const perceivedLightness = (color: Color): number =>\n (Math.cbrt(color.luminance() + FLARE) - FLOOR) / SPAN;\n","import { Color } from '../Color';\nimport { ColorScale } from '../ColorScale';\nimport { getBrandDarkBackgroundColor } from '../getBrandDarkBackgroundColor';\nimport { getBrandLightBackgroundColor } from '../getBrandLightBackgroundColor';\nimport { clamp } from './clamp';\nimport { oklchToRgb, rgbToOklch } from './colorSpace';\nimport { ACHROMATIC_CHROMA, maxChroma } from './maxChroma';\nimport { perceivedLightness } from './perceivedLightness';\n\nexport const DEFAULT_COLOR_SCALE_STEPS = 12;\n\n/**\n * Using the primary color, derive the light/dark variants of the background color,\n * and use these three colors as all the fixed stops on the scale.\n * Including the primary color in addition to the two background extremes allows the scale\n * to maintain the vibrancy of the primary color.\n * Sort stops by luminance, just in case.\n */\nconst brandScaleStops = (primary: Color): Color[] => {\n const stops = [\n getBrandLightBackgroundColor(primary),\n primary,\n getBrandDarkBackgroundColor(primary),\n ];\n\n return stops.toSorted((one, two) => two.luminance() - one.luminance());\n};\n\nconst ARC_SAMPLES = 128;\n\nconst DEGREES_TO_RADIANS = Math.PI / 180;\n\n/**\n * How far apart two colors look: perceived lightness versus OKLab's chroma.\n *\n * We use perceptual distance rather than a lightness calculation because the color scale\n * can cover a lot of ground without changing lightness significantly. Between an almost white color\n * and a light yellow there is not much lightness difference, but there is actually enough\n * \"distance\" between the colors to perceive more than one step between them.\n *\n * Contrast ratio does not matter significantly here because these are background colors.\n */\nconst perceptualDistance = (one: Color, two: Color): number => {\n const from = rgbToOklch(one.r, one.g, one.b);\n const to = rgbToOklch(two.r, two.g, two.b);\n\n return Math.hypot(\n perceivedLightness(one) - perceivedLightness(two),\n from.chroma * Math.cos(from.hue * DEGREES_TO_RADIANS) -\n to.chroma * Math.cos(to.hue * DEGREES_TO_RADIANS),\n from.chroma * Math.sin(from.hue * DEGREES_TO_RADIANS) -\n to.chroma * Math.sin(to.hue * DEGREES_TO_RADIANS),\n );\n};\n\n/**\n * Maps between a position on the scale and how far along its length that position sits.\n */\nconst arcLength = (colorAt: (position: number) => Color) => {\n const points = Array.from({ length: ARC_SAMPLES + 1 }, (_, index) =>\n colorAt(index / ARC_SAMPLES),\n );\n const travelled = [0];\n for (let index = 1; index <= ARC_SAMPLES; index += 1) {\n const from = points[index - 1];\n const to = points[index];\n const step = from === undefined || to === undefined ? 0 : perceptualDistance(from, to);\n\n travelled.push((travelled[index - 1] ?? 0) + step);\n }\n const total = travelled.at(-1) ?? 0;\n\n return {\n distanceOf: (position: number): number => {\n if (total === 0) {\n return position;\n }\n const scaled = clamp(position, 0, 1) * ARC_SAMPLES;\n const lower = Math.min(Math.floor(scaled), ARC_SAMPLES - 1);\n const within = scaled - lower;\n const from = travelled[lower] ?? 0;\n const to = travelled[lower + 1] ?? total;\n\n return (from + (to - from) * within) / total;\n },\n positionAt: (distance: number): number => {\n if (total === 0) {\n return distance;\n }\n const target = clamp(distance, 0, 1) * total;\n for (let index = 1; index <= ARC_SAMPLES; index += 1) {\n const to = travelled[index] ?? total;\n if (to >= target) {\n const from = travelled[index - 1] ?? 0;\n const span = to - from;\n\n return (index - 1 + (span === 0 ? 0 : (target - from) / span)) / ARC_SAMPLES;\n }\n }\n\n return 1;\n },\n };\n};\n\nexport type BrandScaleOptions = {\n /** How many steps the scale is divided into. */\n readonly steps?: number;\n};\n\n// Where `color` falls on the color scale, as a position from 0–1.\nconst positionOnScale = (scale: ColorScale, color: Color): number => {\n const target = color.luminance();\n let low = 0;\n let high = 1;\n\n for (let iteration = 0; iteration < 30; iteration += 1) {\n const middle = (low + high) / 2;\n if (scale.at(middle).luminance() > target) {\n low = middle;\n } else {\n high = middle;\n }\n }\n\n return (low + high) / 2;\n};\n\n/**\n * How colorful a color is as a share of the most sRGB allows at its lightness and hue.\n * 0 for a gray, 1 for a color that maxes out lightness/saturation.\n */\nconst gamutFraction = (color: Color): number => {\n const { chroma, hue, lightness } = rgbToOklch(color.r, color.g, color.b);\n const available = maxChroma(lightness, hue);\n\n return chroma < ACHROMATIC_CHROMA || available < ACHROMATIC_CHROMA\n ? 0\n : Math.min(1, chroma / available);\n};\n\ntype Anchor = {\n readonly fraction: number;\n readonly position: number;\n};\n\n/**\n * What fraction of the color gamut is represented by a given position\n */\nconst fractionAt = (anchors: readonly Anchor[], position: number): number => {\n const first = anchors.at(0);\n const last = anchors.at(-1);\n if (first === undefined || last === undefined) {\n return 0;\n }\n if (position <= first.position) {\n return first.fraction;\n }\n\n for (let index = 1; index < anchors.length; index += 1) {\n const previous = anchors[index - 1];\n const next = anchors[index];\n if (previous === undefined || next === undefined) {\n break;\n }\n if (position <= next.position) {\n const span = next.position - previous.position;\n const ratio = span === 0 ? 0 : (position - previous.position) / span;\n\n return previous.fraction + (next.fraction - previous.fraction) * ratio;\n }\n }\n\n return last.fraction;\n};\n\nexport type BrandedColorScale = {\n /** The color at a given position (0 - 1), from the scale. */\n readonly at: (position: number) => Color;\n /** The color at step `index` */\n readonly atStep: (index: number) => Color;\n readonly positionOf: (color: Color) => number;\n /** The step where the primary color falls. */\n readonly primaryStep: number;\n /** Where a given color falls, as a step index — fractional when it sits between two. */\n readonly stepOf: (color: Color) => number;\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 */\nexport const buildBrandedColorScale = (\n primary: Color,\n options: BrandScaleOptions = {},\n): BrandedColorScale => {\n const { steps = DEFAULT_COLOR_SCALE_STEPS } = options;\n const scale = new ColorScale(brandScaleStops(primary), { mode: 'oklch' });\n const stops = brandScaleStops(primary);\n const anchors = stops\n .map((stop) => ({ fraction: gamutFraction(stop), position: positionOnScale(scale, stop) }))\n .toSorted((one, two) => one.position - two.position);\n\n const colorAt = (position: number): Color => {\n const base = scale.at(position);\n const { hue, lightness } = rgbToOklch(base.r, base.g, base.b);\n const [red, green, blue] = oklchToRgb({\n chroma: fractionAt(anchors, position) * maxChroma(lightness, hue),\n hue,\n lightness,\n });\n\n return new Color([red, green, blue, base.a]);\n };\n\n const measured = arcLength(colorAt);\n\n const at = (distance: number): Color => colorAt(measured.positionAt(distance));\n const distanceOf = (color: Color): number => measured.distanceOf(positionOnScale(scale, color));\n\n const last = Math.max(0, steps - 1);\n const primaryDistance = distanceOf(primary);\n\n // The primary step should almost never be placed into either end of the scale.\n // This will only occur for primary colors that are truly extreme, like black or white.\n const ownsFirst = stops.at(0)?.toHex() === primary.toHex();\n const ownsLast = stops.at(-1)?.toHex() === primary.toHex();\n const lowest = ownsFirst ? 0 : Math.min(1, last);\n const highest = ownsLast ? last : Math.max(lowest, last - 1);\n const primaryStep = clamp(Math.round(primaryDistance * last), lowest, highest);\n\n const distanceOfStep = (index: number): number => {\n if (index === primaryStep) {\n return primaryDistance;\n }\n if (index < primaryStep) {\n return (index / primaryStep) * primaryDistance;\n }\n\n return primaryDistance + ((index - primaryStep) / (last - primaryStep)) * (1 - primaryDistance);\n };\n\n return {\n at,\n atStep: (index) => (index === primaryStep ? primary : at(distanceOfStep(index))),\n positionOf: distanceOf,\n primaryStep,\n stepOf: (color) => {\n const found = distanceOf(color);\n if (found <= primaryDistance) {\n return primaryDistance === 0 ? 0 : (found / primaryDistance) * primaryStep;\n }\n\n return (\n primaryStep + ((found - primaryDistance) / (1 - primaryDistance)) * (last - primaryStep)\n );\n },\n steps,\n };\n};\n","import type { ColorInput } from './types';\nimport { Color } from './Color';\n\nexport type ColorLightnessClassification = 'dark' | 'light' | 'midtone' | 'veryDark';\n\n/**\n * The WCAG value for typical ambient light causing flare on a screen\n * https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum\n */\nconst FLARE = 0.05;\n\n/**\n * Below this a background is close enough to black that there is no more visual\n * room to darken the color without reading as black.\n */\nconst VERY_DARK_MAX = 0.05;\n\n/**\n * This number represents the crossover where white stops having more contrast than black,\n * so any values with luminance greater than this value are no longer considered \"dark\".\n *\n * Don't round this number, otherwise we'll potentially classify some backgrounds as \"midtone\"\n * even though light content reads better on them, and we should always have light content on dark backgrounds.\n */\nconst DARK_MAX = Math.sqrt(FLARE * (1 + FLARE)) - FLARE;\n\n/** Above this a background is close enough to white that it needs no lightening at all. */\nconst LIGHT_MIN = 0.8;\n\n/**\n * Classify a color's lightness based on relative luminance.\n *\n * @example\n * ```ts\n * getColorLightnessClassification('#000000'); // 'veryDark'\n * getColorLightnessClassification('#2949e5'); // 'dark'\n * getColorLightnessClassification('#7f7f7f'); // 'midtone'\n * getColorLightnessClassification('#ffffff'); // 'light'\n * ```\n */\nexport const getColorLightnessClassification = (\n color: ColorInput,\n): ColorLightnessClassification => {\n const parsed = new Color(color);\n const luminance = parsed.luminance();\n\n if (luminance < VERY_DARK_MAX) {\n return 'veryDark';\n }\n if (luminance < DARK_MAX) {\n return 'dark';\n }\n\n return luminance < LIGHT_MIN ? 'midtone' : 'light';\n};\n"],"mappings":";;;;;;;;;;;AACA,MAAa,SAAS,OAAe,KAAa,QAChD,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;;ACEpC,MAAM,kBAAkB;CAAE,GAAG;CAAS,GAAG;CAAG,GAAG;AAAQ;AAEvD,MAAM,qBAAqB,MAAM,KAAK;;AAMtC,MAAM,0BAA0B;AAIhC,MAAM,cAAc,MAAM;AAC1B,M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