@unpunnyfuns/swatchbook-blocks 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/host-e2nSv-sA.mjs +791 -0
- package/dist/host-e2nSv-sA.mjs.map +1 -0
- package/dist/host.d.mts +57 -0
- package/dist/host.mjs +2 -0
- package/dist/index.d.mts +273 -328
- package/dist/index.mjs +536 -1112
- package/dist/index.mjs.map +1 -1
- package/dist/registry-Dm25Go94.d.mts +244 -0
- package/dist/style.css +237 -240
- package/package.json +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-e2nSv-sA.mjs","names":["subscribe","DEFAULT_SAMPLE","DEFAULT_SAMPLE","clsx"],"sources":["../src/internal/value-to-css.ts","../src/border-preview/BorderSample.tsx","../src/presenters/ColorSwatch.tsx","../src/dimension-scale/dimension-px.ts","../src/internal/use-root-font-size.ts","../src/dimension-scale/DimensionSample.tsx","../src/presenters/FontFamilySpecimen.tsx","../src/internal/css-var-style.ts","../src/presenters/FontWeightSpecimen.tsx","../src/presenters/GradientSwatch.tsx","../src/internal/prefers-reduced-motion.ts","../src/motion-preview/MotionSample.tsx","../src/presenters/OpacitySwatch.tsx","../src/presenters/StrokeSample.tsx","../src/presenters/TypeSpecimen.tsx","../src/shadow-preview/ShadowSample.tsx","../src/presenters/registry.ts","../src/host.ts"],"sourcesContent":["import type { ColorFormat } from '#/format-color.ts';\n\n/**\n * Formats a DTCG dimension-shaped raw value (`number`, pre-formatted\n * string, or `{ value, unit }`) as a CSS length. Shared by the border and\n * shadow presenters, whose `$value` shapes both carry raw dimension fields.\n */\nexport function formatLength(raw: unknown): string {\n if (typeof raw === 'number') return `${raw}px`;\n if (typeof raw === 'string') return raw;\n if (raw && typeof raw === 'object') {\n const v = raw as { value?: unknown; unit?: unknown };\n if (typeof v.value === 'number' && typeof v.unit === 'string') return `${v.value}${v.unit}`;\n }\n return '0px';\n}\n\n/**\n * Maps a display `ColorFormat` to one CSS can actually render as a color\n * value. `raw` renders a JSON debug string (core's `formatColor`), which\n * isn't valid CSS: the border and shadow presenters substitute `hex` for\n * that one format so the swatch still paints; every other format\n * (rgb/hsl/oklch/hex) is already valid CSS.\n */\nexport function cssColorFormat(format: ColorFormat): Exclude<ColorFormat, 'raw'> {\n return format === 'raw' ? 'hex' : format;\n}\n","import type { ReactElement } from 'react';\nimport './BorderSample.css';\nimport type { ColorFormat } from '#/format-color.ts';\nimport { formatColor } from '#/format-color.ts';\nimport type { BorderValue } from '#/internal/composite-types.ts';\nimport { cssColorFormat, formatLength } from '#/internal/value-to-css.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the connected {@link BorderSample} block. */\nexport type BorderSampleProps = PresenterProps<'border'>;\n\nexport interface BorderSampleData {\n /** CSS var reference for the token's border, or the realised `border` text. */\n cssVar: string;\n}\n\nexport type BorderSampleViewProps = BorderSampleData;\n\n/** Pure presentation for a single border token's sample. Renders from plain props. */\nexport function BorderSampleView({ cssVar }: BorderSampleViewProps): ReactElement {\n return <div className=\"sb-border-sample\" style={{ border: cssVar }} aria-hidden />;\n}\n\n/**\n * Builds a valid `border` shorthand value straight from a realised\n * `border.$value`. Distinct from core's `formatTokenValue`, whose `raw`\n * color branch emits a display-only JSON string that the browser would\n * reject as a border color.\n */\nfunction borderValueToCss(value: BorderValue, colorFormat: ColorFormat): string {\n if (!value || typeof value !== 'object') return '';\n const width = formatLength(value.width);\n const style = typeof value.style === 'string' ? value.style : 'solid';\n const color = formatColor(value.color, cssColorFormat(colorFormat)).value;\n return [width, style, color].join(' ');\n}\n\nexport function BorderSample({ token, cssVar, colorFormat }: BorderSampleProps): ReactElement {\n const visual = cssVar ?? borderValueToCss(token.$value, colorFormat);\n return <BorderSampleView cssVar={visual} />;\n}\n","import type { ReactElement } from 'react';\nimport './ColorSwatch.css';\nimport { formatColor } from '#/format-color.ts';\nimport { cssColorFormat } from '#/internal/value-to-css.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the {@link ColorSwatch} presenter. */\nexport type ColorSwatchProps = PresenterProps<'color'>;\n\n// Last dot-segment of a token path, used as the swatch's leaf label.\nfunction leafOf(path: string): string {\n return path.split('.').at(-1) ?? path;\n}\n\n/**\n * Presenter for `$type: color` tokens: a color chip, leaf label, and\n * formatted value with an out-of-gamut marker. The chip's background is\n * `cssVar` when supplied (R3); otherwise it is computed straight from\n * `token.$value`, with `raw` guarded to `hex` (`cssColorFormat`) so the chip\n * always paints a real color even when the display format is a JSON debug\n * string. The value text below the chip uses the actual `colorFormat`,\n * `raw` included. `options.label` lets a grouped consumer (e.g.\n * `ColorPalette`) supply a group-relative label instead of the bare leaf\n * segment, so context lost to grouping (`blue` in `color.palette.blue.50`)\n * still reads on the swatch; standalone usage falls back to `leafOf(path)`.\n */\nexport function ColorSwatch({\n path,\n token,\n cssVar,\n colorFormat,\n options,\n}: ColorSwatchProps): ReactElement {\n const chipBackground = cssVar ?? formatColor(token.$value, cssColorFormat(colorFormat)).value;\n const { value, outOfGamut } = formatColor(token.$value, colorFormat);\n const label = typeof options?.['label'] === 'string' ? options['label'] : leafOf(path);\n return (\n <div className=\"sb-color-swatch\">\n <div className=\"sb-color-swatch__chip\" style={{ background: chipBackground }} aria-hidden />\n <div className=\"sb-color-swatch__meta\">\n <span className=\"sb-color-swatch__leaf\">{label}</span>\n <span className=\"sb-color-swatch__value\">\n {value}\n {outOfGamut && (\n <span\n title=\"Out of sRGB gamut for this format\"\n aria-label=\"out of gamut\"\n className=\"sb-color-swatch__gamut-warn\"\n >\n {' '}\n ⚠\n </span>\n )}\n </span>\n </div>\n </div>\n );\n}\n","/** Max rendered pixel size for a dimension bar/sample before it's capped. */\nexport const MAX_RENDER_PX = 480;\n\n/**\n * Convert a DTCG dimension `$value` (`{ value, unit }`) to pixels for the\n * purpose of deciding whether to cap the rendered size. `rootFontSizePx`\n * scales `rem` against the rendering context's actual root font-size\n * (default 16 for the no-DOM / SSR path); the bar paints at the same\n * context's `var()`, so passing the measured root keeps the cap decision\n * aligned with what's drawn. Returns `NaN` for anything other than `px` /\n * `rem` — `ex` / `ch` / `%`, and the non-DTCG `em` (the `dimension` type\n * permits only `px | rem`) — which the caller treats as \"render at cssVar\n * but don't cap\".\n */\nexport function toPixels(raw: unknown, rootFontSizePx = 16): number {\n if (raw == null || typeof raw !== 'object') return Number.NaN;\n const v = raw as { value?: unknown; unit?: unknown };\n if (typeof v.value !== 'number' || typeof v.unit !== 'string') return Number.NaN;\n switch (v.unit) {\n case 'px':\n return v.value;\n case 'rem':\n return v.value * rootFontSizePx;\n default:\n return Number.NaN;\n }\n}\n","import { useSyncExternalStore } from 'react';\n\n// Read the rendering context's root font-size in px; 16 with no DOM or an\n// unparseable value (SSR, hand-built snapshots).\nfunction readRootFontSize(): number {\n if (typeof document === 'undefined') return 16;\n const fontSize = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);\n return Number.isFinite(fontSize) && fontSize > 0 ? fontSize : 16;\n}\n\n// Re-read on viewport resize: a responsive root (a media query swapping\n// `html { font-size }` at a breakpoint) changes the root after mount, and the\n// `var()`-based bar re-resolves with it. `useSyncExternalStore` bails out when\n// the value is unchanged, so a resize that doesn't move the root is a no-op.\nfunction subscribe(onChange: () => void): () => void {\n if (typeof window === 'undefined') return () => {};\n window.addEventListener('resize', onChange);\n return () => window.removeEventListener('resize', onChange);\n}\n\n/**\n * Root font-size (px) of the context a block renders in, tracked across\n * viewport changes. `rem` dimension values resolve their `var()` against this\n * root, so the cap math (`toPixels`) and value sort (`sortTokens`) must scale\n * `rem` by it rather than a literal 16: a Storybook Docs page, or a responsive\n * desktop/tablet/mobile breakpoint, can apply a different root to the same\n * token. Falls back to 16 with no DOM.\n */\nexport function useRootFontSize(): number {\n return useSyncExternalStore(subscribe, readRootFontSize, () => 16);\n}\n","import type { ReactElement } from 'react';\nimport './DimensionSample.css';\nimport { MAX_RENDER_PX, toPixels } from '#/dimension-scale/dimension-px.ts';\nimport { formatTokenValue } from '@unpunnyfuns/swatchbook-core/token-value-css';\nimport { useRootFontSize } from '#/internal/use-root-font-size.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** The visual treatment for a dimension sample: a length bar, a radius square, or a sized square. */\nexport type DimensionVisual = 'length' | 'radius' | 'size';\n\n/** Props for the connected {@link DimensionSample} block. `options.visual` selects the visualization kind (see {@link DimensionVisual}); defaults to `'length'`. */\nexport type DimensionSampleProps = PresenterProps<'dimension'>;\n\n// A consumer-supplied `options.visual` is untyped at the call site; an\n// unrecognized value (or a non-string) falls back to 'length' rather than\n// propagating a bogus visual into the switch below.\nfunction asDimensionVisual(raw: unknown): DimensionVisual {\n return raw === 'length' || raw === 'radius' || raw === 'size' ? raw : 'length';\n}\n\nexport interface DimensionSampleData {\n /** CSS var reference, or the realised `$value` as a `px`/`rem` literal. */\n cssVar: string;\n /** The resolved value in pixels, for cap comparison against {@link MAX_RENDER_PX}. `NaN` for non-`px`/`rem` units. */\n pxValue: number;\n /** Whether the resolved px exceeds {@link MAX_RENDER_PX}. */\n capped: boolean;\n /** The style value to render: `cssVar`, or the capped px literal when `capped`. */\n cappedValue: string;\n}\n\n/**\n * Pure derivation of a single dimension token's sample geometry from its\n * realised `$value`. The cap decision always reads the numeric `$value` (so\n * it holds regardless of whether `cssVar` is present); `cssVar`, when given,\n * wins as the rendered value up to that cap.\n */\nexport function deriveDimensionSample(\n props: Pick<PresenterProps<'dimension'>, 'token' | 'cssVar' | 'colorFormat'>,\n rootFontSizePx: number,\n): DimensionSampleData {\n const realised = formatTokenValue(props.token.$value, 'dimension', props.colorFormat);\n const cssVar = props.cssVar ?? realised;\n const pxValue = toPixels(props.token.$value, rootFontSizePx);\n const capped = Number.isFinite(pxValue) && pxValue > MAX_RENDER_PX;\n const cappedValue = capped ? `${MAX_RENDER_PX}px` : cssVar;\n return { cssVar, pxValue, capped, cappedValue };\n}\n\n// Wrap a clamped visual with the cap affordance so every consumer (the scale\n// block and TokenNavigator) surfaces truncation identically. The visual itself\n// is decorative — the token's real value is shown as adjacent text — so the\n// marker is aria-hidden and the title carries the hint for sighted hover.\nfunction withCap(visual: ReactElement): ReactElement {\n return (\n <span\n className=\"sb-dimension-sample sb-dimension-sample--capped\"\n title={`capped at ${MAX_RENDER_PX}px`}\n >\n {visual}\n <span className=\"sb-dimension-sample__cap\" aria-hidden>\n …\n </span>\n </span>\n );\n}\n\n/** Props for the pure {@link DimensionSampleView} presenter, derived from the resolved sample data. */\nexport type DimensionSampleViewProps = Pick<\n DimensionSampleData,\n 'cssVar' | 'capped' | 'cappedValue'\n> & {\n visual: DimensionVisual;\n};\n\n/** Pure presentation for a single dimension token's bar/sample. Renders from plain props. */\nexport function DimensionSampleView({\n cssVar,\n capped,\n cappedValue,\n visual,\n}: DimensionSampleViewProps): ReactElement {\n switch (visual) {\n // A fixed 56×56 box: border-radius can't overflow it, so the cap never\n // applies to the radius sample.\n case 'radius':\n return (\n <div\n className=\"sb-dimension-sample__radius-sample\"\n style={{ borderRadius: cssVar }}\n aria-hidden\n />\n );\n case 'size': {\n const sample = (\n <div\n className=\"sb-dimension-sample__size-sample\"\n style={{ width: cappedValue, height: cappedValue }}\n aria-hidden\n />\n );\n return capped ? withCap(sample) : sample;\n }\n case 'length':\n default: {\n const bar = (\n <div className=\"sb-dimension-sample__bar\" style={{ width: cappedValue }} aria-hidden />\n );\n return capped ? withCap(bar) : bar;\n }\n }\n}\n\n/** Connected block: renders a realised dimension token's sample, capped for oversized values. */\nexport function DimensionSample({\n token,\n cssVar,\n colorFormat,\n options,\n}: DimensionSampleProps): ReactElement {\n const visual = asDimensionVisual(options?.['visual']);\n const rootFontSize = useRootFontSize();\n const derived = deriveDimensionSample({ token, cssVar, colorFormat }, rootFontSize);\n return (\n <DimensionSampleView\n cssVar={derived.cssVar}\n capped={derived.capped}\n cappedValue={derived.cappedValue}\n visual={visual}\n />\n );\n}\n","import type { CSSProperties, ReactElement } from 'react';\nimport './FontFamilySpecimen.css';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the {@link FontFamilySpecimen} presenter. `options.sample` overrides the rendered sample text; defaults to a pangram. */\nexport type FontFamilySpecimenProps = PresenterProps<'fontFamily'>;\n\nconst DEFAULT_SAMPLE = 'The quick brown fox jumps over the lazy dog.';\n\n// A fontFamily $value is either a single font name or a stack; joins the\n// array form the same way a CSS `font-family` list-value reads.\nfunction stackString(raw: unknown): string {\n if (typeof raw === 'string') return raw;\n if (Array.isArray(raw)) return raw.map(String).join(', ');\n return '';\n}\n\n/**\n * Presenter for `$type: fontFamily` tokens: path, resolved stack, a sample\n * line styled per R3, and the css var in use.\n */\nexport function FontFamilySpecimen({\n path,\n token,\n cssVar,\n options,\n}: FontFamilySpecimenProps): ReactElement {\n const rawSample = options?.['sample'];\n const sample = typeof rawSample === 'string' ? rawSample : DEFAULT_SAMPLE;\n const stack = stackString(token.$value);\n const sampleStyle: CSSProperties = { fontFamily: cssVar ?? stack };\n return (\n <div className=\"sb-font-family-specimen__row\">\n <div className=\"sb-font-family-specimen__meta\">\n <span className=\"sb-font-family-specimen__path\">{path}</span>\n <span className=\"sb-font-family-specimen__stack\">{stack}</span>\n </div>\n <div className=\"sb-font-family-specimen__sample\" style={sampleStyle}>\n {sample}\n </div>\n {cssVar && <span className=\"sb-font-family-specimen__css-var\">{cssVar}</span>}\n </div>\n );\n}\n","/**\n * Coerce a CSS `var(--…)` reference into the numeric slot of a React\n * inline-style property.\n *\n * React's `CSSProperties` types unitless properties (`fontWeight`,\n * `lineHeight`, `zIndex`, …) as `number`. The DOM accepts a string at\n * runtime — the rendered stylesheet just receives whatever React passes —\n * so a `var(--font-weight)` reference works functionally. TypeScript still\n * complains. Centralising the type assertion in one named helper keeps\n * the gap visible (and greppable) instead of scattering casts across\n * block components that want CSS-var-driven typography or layout values.\n */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-expect-error — React's CSSProperties slot is `number`; the DOM tolerates a CSS var string.\nexport const cssVarAsNumber = (varRef: string): number => varRef;\n","import type { CSSProperties, ReactElement } from 'react';\nimport './FontWeightSpecimen.css';\nimport { cssVarAsNumber } from '#/internal/css-var-style.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the {@link FontWeightSpecimen} presenter. `options.sample` overrides the rendered sample text; defaults to `'Aa'`. */\nexport type FontWeightSpecimenProps = PresenterProps<'fontWeight'>;\n\nconst DEFAULT_SAMPLE = 'Aa';\n\n/**\n * Presenter for `$type: fontWeight` tokens: path, the raw weight value, a\n * sample glyph styled per R3, and the css var in use.\n */\nexport function FontWeightSpecimen({\n path,\n token,\n cssVar,\n options,\n}: FontWeightSpecimenProps): ReactElement {\n const rawSample = options?.['sample'];\n const sample = typeof rawSample === 'string' ? rawSample : DEFAULT_SAMPLE;\n const display = token.$value == null ? '' : String(token.$value);\n const sampleStyle: CSSProperties = {\n fontWeight: cssVar ? cssVarAsNumber(cssVar) : (display as CSSProperties['fontWeight']),\n };\n return (\n <div className=\"sb-font-weight-specimen__row\">\n <div className=\"sb-font-weight-specimen__meta\">\n <span className=\"sb-font-weight-specimen__path\">{path}</span>\n <span className=\"sb-font-weight-specimen__value\">{display}</span>\n </div>\n <div className=\"sb-font-weight-specimen__sample\" style={sampleStyle}>\n {sample}\n </div>\n {cssVar && <span className=\"sb-font-weight-specimen__css-var\">{cssVar}</span>}\n </div>\n );\n}\n","import type { ReactElement } from 'react';\nimport type { GradientStop } from '@unpunnyfuns/swatchbook-core/token-value-types';\nimport './GradientSwatch.css';\nimport type { ColorFormat } from '#/format-color.ts';\nimport { formatColor } from '#/format-color.ts';\nimport { cssColorFormat } from '#/internal/value-to-css.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the {@link GradientSwatch} presenter. */\nexport type GradientSwatchProps = PresenterProps<'gradient'>;\n\n/**\n * Builds a valid `linear-gradient()` value straight from a realised\n * `gradient.$value` stop list. Distinct from core's `formatTokenValue`,\n * whose `raw` color branch emits a display-only JSON string per stop that\n * the browser would reject as a gradient color.\n */\nfunction gradientValueToCss(stops: readonly GradientStop[], colorFormat: ColorFormat): string {\n const format = cssColorFormat(colorFormat);\n const stopsCss = stops\n .map((stop) => {\n const color = formatColor(stop.color, format).value;\n const position = typeof stop.position === 'number' ? stop.position : 0;\n return `${color} ${(position * 100).toFixed(0)}%`;\n })\n .join(', ');\n return `linear-gradient(90deg, ${stopsCss})`;\n}\n\n/**\n * Presenter for `$type: gradient` tokens: a gradient chip. Unlike the\n * other composite presenters, a gradient's css var (per Terrazzo's\n * `transformGradient`) resolves to a bare `<color> <pct>, ...` stop list,\n * not a complete property value: DTCG gradients carry no direction, so\n * both branches need one supplied at render time. `90deg` (`to right`)\n * matches the direction the standalone block previously hard-coded.\n */\nexport function GradientSwatch({ token, cssVar, colorFormat }: GradientSwatchProps): ReactElement {\n const stops = Array.isArray(token.$value) ? token.$value : [];\n const background = cssVar\n ? `linear-gradient(90deg, ${cssVar})`\n : gradientValueToCss(stops, colorFormat);\n return <div className=\"sb-gradient-swatch__chip\" style={{ background }} aria-hidden />;\n}\n","import { useEffect, useState } from 'react';\n\n// True when rendering inside Chromatic's snapshot runner. Chromatic's\n// browser ships a recognisable user-agent string; checked here so\n// motion-looping components can fall back to their static state for\n// deterministic snapshots. Per-component detection rather than the\n// global `chromatic.prefersReducedMotion: true` parameter — that\n// parameter is incompatible with Chromatic's verification parser.\nfunction isChromatic(): boolean {\n if (typeof navigator === 'undefined') return false;\n return navigator.userAgent.includes('Chromatic');\n}\n\n/**\n * Reactive `prefers-reduced-motion: reduce` detector. Returns the current\n * match and updates if the user toggles the OS-level preference. Also\n * returns `true` under Chromatic to keep animated samples deterministic\n * during visual regression capture.\n */\nexport function usePrefersReducedMotion(): boolean {\n const [reduced, setReduced] = useState(false);\n useEffect(() => {\n if (typeof window === 'undefined') return;\n if (isChromatic()) {\n setReduced(true);\n return;\n }\n const query = window.matchMedia('(prefers-reduced-motion: reduce)');\n setReduced(query.matches);\n const onChange = (e: MediaQueryListEvent): void => setReduced(e.matches);\n query.addEventListener('change', onChange);\n return () => query.removeEventListener('change', onChange);\n }, []);\n return reduced;\n}\n","import type { ReactElement } from 'react';\nimport './MotionSample.css';\nimport clsx from 'clsx';\nimport { useEffect, useState } from 'react';\nimport type { TransitionValue } from '#/internal/composite-types.ts';\nimport { usePrefersReducedMotion } from '#/internal/prefers-reduced-motion.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\nexport type MotionSpeed = 0.25 | 0.5 | 1 | 2;\n\n/**\n * Props for the connected {@link MotionSample} block. `token` accepts any\n * of the three motion `$type`s (`transition`, `duration`, `cubicBezier`) —\n * looser than a single-type `PresenterProps<'transition'>` because\n * `resolveMotionSpec` dispatches on the realised `$type` at runtime and\n * TokenNavigator/MotionPreview feed it all three from one call site.\n * `options.speed` is the playback speed multiplier (defaults to `1`);\n * `options.runKey` forces the animation to restart when changed, e.g. from\n * an outer block's \"replay\" button re-triggering every sample at once.\n */\nexport type MotionSampleProps = PresenterProps;\n\nconst DEFAULT_DURATION_MS = 300;\nconst DEFAULT_EASING = 'cubic-bezier(0.2, 0, 0, 1)';\n\nexport interface Spec {\n durationMs: number;\n easing: string;\n}\n\nfunction extractDurationMs(raw: unknown): number {\n if (raw == null) return Number.NaN;\n if (typeof raw === 'object') {\n const v = raw as { value?: unknown; unit?: unknown };\n if (typeof v.value === 'number' && typeof v.unit === 'string') {\n if (v.unit === 'ms') return v.value;\n if (v.unit === 's') return v.value * 1000;\n }\n }\n return Number.NaN;\n}\n\nfunction extractCubicBezier(raw: unknown): string | null {\n if (Array.isArray(raw) && raw.length === 4 && raw.every((n) => typeof n === 'number')) {\n return `cubic-bezier(${raw.map((n) => Number(n).toFixed(3)).join(', ')})`;\n }\n return null;\n}\n\nfunction asDuration(\n raw: unknown,\n themeTokens: Record<string, { $value?: unknown }>,\n fallback: number,\n): number {\n const direct = extractDurationMs(raw);\n if (Number.isFinite(direct)) return direct;\n if (typeof raw === 'string') {\n const match = raw.match(/^\\{([^}]+)\\}$/);\n if (match && match[1]) {\n const referenced = themeTokens[match[1]];\n const resolved = extractDurationMs(referenced?.$value);\n if (Number.isFinite(resolved)) return resolved;\n }\n }\n return fallback;\n}\n\nfunction asEasing(\n raw: unknown,\n themeTokens: Record<string, { $value?: unknown }>,\n fallback: string,\n): string {\n const direct = extractCubicBezier(raw);\n if (direct) return direct;\n if (typeof raw === 'string') {\n const match = raw.match(/^\\{([^}]+)\\}$/);\n if (match && match[1]) {\n const referenced = themeTokens[match[1]];\n const resolved = extractCubicBezier(referenced?.$value);\n if (resolved) return resolved;\n }\n }\n return fallback;\n}\n\n/**\n * Extracts a duration/easing `Spec` from a token's `$value`, dispatching on\n * `$type` (`transition` / `duration` / `cubicBezier`). `themeTokens` backs\n * `{path}`-form sub-value alias resolution for callers still walking a raw\n * (not-yet-realised) project map; pass `{}` when `token` is already a\n * realised leaf (no alias strings survive resolution).\n */\nexport function resolveMotionSpec(\n token: { $type?: string | undefined; $value?: unknown } | undefined,\n themeTokens: Record<string, { $value?: unknown }>,\n): Spec | null {\n if (!token) return null;\n const type = token.$type;\n if (type === 'transition') {\n const v = (token.$value ?? {}) as TransitionValue;\n return {\n durationMs: asDuration(v.duration, themeTokens, DEFAULT_DURATION_MS),\n easing: asEasing(v.timingFunction, themeTokens, DEFAULT_EASING),\n };\n }\n if (type === 'duration') {\n const durationMs = extractDurationMs(token.$value);\n if (!Number.isFinite(durationMs)) return null;\n return { durationMs, easing: DEFAULT_EASING };\n }\n if (type === 'cubicBezier') {\n const easing = extractCubicBezier(token.$value);\n if (!easing) return null;\n return { durationMs: DEFAULT_DURATION_MS, easing };\n }\n return null;\n}\n\nexport interface MotionSampleViewProps {\n spec: Spec | null;\n speed: MotionSpeed;\n runKey: number;\n}\n\n/** Pure presentation + animation for a single motion token's sample. Renders from plain props. */\nexport function MotionSampleView({ spec, speed, runKey }: MotionSampleViewProps): ReactElement {\n const reducedMotion = usePrefersReducedMotion();\n\n const durationMs = spec?.durationMs ?? DEFAULT_DURATION_MS;\n const easing = spec?.easing ?? DEFAULT_EASING;\n const scaledDuration = Math.max(1, durationMs / speed);\n\n const [phase, setPhase] = useState<0 | 1>(0);\n\n useEffect(() => {\n if (reducedMotion) return;\n setPhase(0);\n const id = requestAnimationFrame(() => setPhase(1));\n const loop = window.setInterval(() => {\n setPhase((p) => (p === 0 ? 1 : 0));\n }, scaledDuration * 2);\n return () => {\n cancelAnimationFrame(id);\n window.clearInterval(loop);\n };\n }, [scaledDuration, runKey, reducedMotion]);\n\n if (reducedMotion) {\n return (\n <div className=\"sb-motion-sample__reduced-motion\">\n Animation suppressed by <code>prefers-reduced-motion: reduce</code>.\n </div>\n );\n }\n\n return (\n <div className=\"sb-motion-sample__track\">\n <div\n className={clsx(\n 'sb-motion-sample__ball',\n phase === 1 ? 'sb-motion-sample__ball--end' : 'sb-motion-sample__ball--start',\n )}\n style={{ transition: `left ${scaledDuration}ms ${easing}` }}\n aria-hidden\n />\n </div>\n );\n}\n\n/**\n * Connected block: renders a realised motion token's animated sample. Both\n * `durationMs` and `easing` come from the realised `$value`; the ball's\n * setInterval loop needs a JS-readable duration, and (see the comment below)\n * `cssVar` cannot stand in for `easing` here. `cssVar` is still accepted, per\n * the uniform `PresenterProps` contract every presenter shares, but this\n * View has nowhere safe to apply it.\n */\nexport function MotionSample({ token, cssVar: _cssVar, options }: MotionSampleProps): ReactElement {\n const rawSpeed = options?.['speed'];\n const speed = (typeof rawSpeed === 'number' ? rawSpeed : 1) as MotionSpeed;\n const rawRunKey = options?.['runKey'];\n const runKey = typeof rawRunKey === 'number' ? rawRunKey : 0;\n // The token's transition CSS var is a full duration+delay+easing\n // shorthand (e.g. `--sb-transition-enter: 200ms 0ms ease-out`), not an\n // easing-only value. Substituting it into this sample's\n // `left ${scaledDuration}ms ${easing}` template would leave two <time>\n // components in the shorthand, which is invalid at computed-value time:\n // the declaration falls back to `transition: none` and the ball stops\n // animating. Render both duration and easing from the realised value\n // instead; there is no sub-var this View can consume.\n const spec = resolveMotionSpec(token, {});\n return <MotionSampleView spec={spec} speed={speed} runKey={runKey} />;\n}\n","import type { ReactElement } from 'react';\nimport './OpacitySwatch.css';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/**\n * Props for the {@link OpacitySwatch} presenter. `options.sampleColorVar`\n * sets the chip's fill color (a resolved css var or literal); defaults to\n * the swatchbook accent surface.\n */\nexport type OpacitySwatchProps = PresenterProps<'number'>;\n\nconst DEFAULT_SAMPLE_COLOR_VAR = 'var(--swatchbook-accent-bg)';\n\n// A non-numeric $value (an opacity token whose value failed to resolve to a\n// number) still renders a visible chip rather than a silently blank one.\nfunction opacityValueToCss(value: unknown): string {\n return typeof value === 'number' ? String(value) : '1';\n}\n\nexport interface OpacitySwatchViewProps {\n /** CSS var reference for the opacity, or the realised `$value` as a numeric string literal. */\n opacity: string;\n /** Color painted behind the checkerboard so the alpha reads visually. */\n sampleColorVar: string;\n}\n\n/** Pure presentation for a single opacity token's chip. Renders from plain props. */\nexport function OpacitySwatchView({\n opacity,\n sampleColorVar,\n}: OpacitySwatchViewProps): ReactElement {\n return (\n <div className=\"sb-opacity-swatch\">\n <div\n className=\"sb-opacity-swatch__chip\"\n style={{ opacity, background: sampleColorVar }}\n aria-hidden\n />\n </div>\n );\n}\n\n/**\n * Presenter for `$type: number` opacity tokens: a colored chip over a\n * checkerboard backdrop, with the chip's `opacity` set from the token per\n * R3. The number alone (`0.4`) doesn't convey what the token looks like\n * applied to a surface; the chip does.\n */\nexport function OpacitySwatch({ token, cssVar, options }: OpacitySwatchProps): ReactElement {\n const opacity = cssVar ?? opacityValueToCss(token.$value);\n const rawSampleColorVar = options?.['sampleColorVar'];\n const sampleColorVar =\n typeof rawSampleColorVar === 'string' ? rawSampleColorVar : DEFAULT_SAMPLE_COLOR_VAR;\n return <OpacitySwatchView opacity={opacity} sampleColorVar={sampleColorVar} />;\n}\n","import type { CSSProperties, ReactElement } from 'react';\nimport './StrokeSample.css';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the {@link StrokeSample} presenter. */\nexport type StrokeSampleProps = PresenterProps<'strokeStyle'>;\n\nconst STRING_STYLES = new Set([\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n 'inset',\n]);\n\n// The object dash-pattern form (`{ dashArray?, lineCap? }`) has no pure CSS\n// `border-style` equivalent; only the literal string keywords map directly.\n// Independent of `cssVar`: a resolved var for an unrepresentable value isn't\n// a border-style either, so the fallback message wins regardless.\nfunction isCssStyleKeyword(value: unknown): value is string {\n return typeof value === 'string' && STRING_STYLES.has(value);\n}\n\nexport interface StrokeSampleViewProps {\n /** CSS var reference for the stroke style, or the realised keyword; `null` for the dash-object form. */\n cssStyle: string | null;\n}\n\n/** Pure presentation for a single stroke-style token's line. Renders from plain props. */\nexport function StrokeSampleView({ cssStyle }: StrokeSampleViewProps): ReactElement {\n if (!cssStyle) {\n return (\n <span className=\"sb-stroke-sample__object-fallback\">\n Object-form (dashArray + lineCap) — no pure CSS `border-style` equivalent.\n </span>\n );\n }\n return (\n <div\n className=\"sb-stroke-sample__line\"\n style={{ borderTopStyle: cssStyle as CSSProperties['borderTopStyle'] }}\n aria-hidden\n />\n );\n}\n\n/**\n * Presenter for `$type: strokeStyle` tokens: a line styled with the\n * token's `border-top-style` per R3, or the object-form fallback message\n * when `$value` is a dash pattern with no pure CSS equivalent.\n */\nexport function StrokeSample({ token, cssVar }: StrokeSampleProps): ReactElement {\n const cssStyle = isCssStyleKeyword(token.$value) ? (cssVar ?? token.$value) : null;\n return <StrokeSampleView cssStyle={cssStyle} />;\n}\n","import type { CSSProperties, ReactElement } from 'react';\nimport './TypeSpecimen.css';\nimport type { TypographyValue } from '@unpunnyfuns/swatchbook-core/token-value-types';\nimport { formatLength } from '#/internal/value-to-css.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the connected {@link TypeSpecimen} block. `options.sample` overrides the rendered sample text; defaults to a pangram. */\nexport type TypeSpecimenProps = PresenterProps<'typography'>;\n\nconst DEFAULT_SAMPLE = 'The quick brown fox jumps over the lazy dog.';\n\nfunction asFontFamily(raw: unknown): string | undefined {\n if (typeof raw === 'string') return raw;\n if (Array.isArray(raw)) return raw.map(String).join(', ');\n return undefined;\n}\n\n/**\n * Builds the sample's inline style straight from a realised\n * `typography.$value`. `fontSize`/`letterSpacing` share `formatLength` with\n * the border/shadow presenters (same DTCG `{ value, unit }` dimension\n * envelope); `fontWeight`/`lineHeight` are unitless and cast to strings\n * directly.\n */\nfunction styleFromValue(value: TypographyValue): CSSProperties {\n const style: CSSProperties = {};\n const fontFamily = asFontFamily(value.fontFamily);\n if (fontFamily) style.fontFamily = fontFamily;\n if (value.fontSize != null) style.fontSize = formatLength(value.fontSize);\n if (value.fontWeight != null) {\n style.fontWeight = String(value.fontWeight) as CSSProperties['fontWeight'];\n }\n if (value.lineHeight != null) style.lineHeight = String(value.lineHeight);\n if (value.letterSpacing != null) style.letterSpacing = formatLength(value.letterSpacing);\n return style;\n}\n\n// Compact spec summary always shown above the sample: size, weight, and\n// line-height are the dimensions a reader scans a type scale for, and no\n// $description (which is prose, not a spec) may take its place.\nfunction describeValue(value: TypographyValue): string {\n const fontSize = value.fontSize != null ? formatLength(value.fontSize) : undefined;\n const fontWeight = value.fontWeight != null ? `w${String(value.fontWeight)}` : undefined;\n const lineHeight = value.lineHeight != null ? `lh ${String(value.lineHeight)}` : undefined;\n return [fontSize, fontWeight, lineHeight].filter(Boolean).join(' · ');\n}\n\n/**\n * Presenter for `$type: typography` tokens: a spec summary and a sample line\n * styled per R3. Token identity (the path) is the consuming block's\n * responsibility, not this presenter's; see `TypographyScale`.\n */\nexport function TypeSpecimen({ token, cssVar: _cssVar, options }: TypeSpecimenProps): ReactElement {\n const rawSample = options?.['sample'];\n const sample = typeof rawSample === 'string' ? rawSample : DEFAULT_SAMPLE;\n const value = token.$value ?? {};\n // Terrazzo emits typography sub-properties (font-family/size/weight/\n // line-height) as individual custom properties, never a composite `font`\n // shorthand var. `font: var(--sb-typography-<name>)` references an\n // undefined variable, and the `font` shorthand is all-or-nothing, so the\n // whole declaration drops and the sample falls back to base size. Render\n // from the realised `$value` instead; it stays correct across axis flips\n // because the block re-resolves and re-renders.\n const sampleStyle: CSSProperties = styleFromValue(value);\n const specs = describeValue(value);\n return (\n <div className=\"sb-type-specimen\">\n {specs && <span className=\"sb-type-specimen__description\">{specs}</span>}\n <div className=\"sb-type-specimen__sample\" style={sampleStyle}>\n {sample}\n </div>\n </div>\n );\n}\n","import type { ReactElement } from 'react';\nimport './ShadowSample.css';\nimport type { ColorFormat } from '#/format-color.ts';\nimport { formatColor } from '#/format-color.ts';\nimport type { ShadowLayer } from '#/internal/composite-types.ts';\nimport { cssColorFormat, formatLength } from '#/internal/value-to-css.ts';\nimport type { PresenterProps } from '#/presenters/types.ts';\n\n/** Props for the connected {@link ShadowSample} block. */\nexport type ShadowSampleProps = PresenterProps<'shadow'>;\n\nexport interface ShadowSampleData {\n /** CSS var reference for the token's shadow, or the realised `box-shadow` text. */\n cssVar: string;\n}\n\nexport type ShadowSampleViewProps = ShadowSampleData;\n\n/** Pure presentation for a single shadow token's sample. Renders from plain props. */\nexport function ShadowSampleView({ cssVar }: ShadowSampleViewProps): ReactElement {\n return <div className=\"sb-shadow-sample\" style={{ boxShadow: cssVar }} aria-hidden />;\n}\n\n/**\n * Builds a valid `box-shadow` value straight from a realised `shadow.$value`\n * (single layer or array). Distinct from core's `formatTokenValue`, whose\n * `raw` color branch emits a display-only JSON string that the browser\n * would reject as a box-shadow color.\n */\nfunction shadowValueToCss(value: unknown, colorFormat: ColorFormat): string {\n const layers = Array.isArray(value) ? value : [value];\n const format = cssColorFormat(colorFormat);\n return layers\n .map((layer) => {\n if (!layer || typeof layer !== 'object') return '';\n const s = layer as ShadowLayer;\n const pieces = [\n formatLength(s.offsetX),\n formatLength(s.offsetY),\n formatLength(s.blur),\n formatLength(s.spread),\n formatColor(s.color, format).value,\n ];\n if (s.inset) pieces.push('inset');\n return pieces.join(' ');\n })\n .filter((layer) => layer !== '')\n .join(', ');\n}\n\nexport function ShadowSample({ token, cssVar, colorFormat }: ShadowSampleProps): ReactElement {\n const visual = cssVar ?? shadowValueToCss(token.$value, colorFormat);\n return <ShadowSampleView cssVar={visual} />;\n}\n","import { createContext, useContext } from 'react';\nimport type { TokenType } from '@unpunnyfuns/swatchbook-core/token-value-types';\nimport { BorderSample } from '#/border-preview/BorderSample.tsx';\nimport { ColorSwatch } from '#/presenters/ColorSwatch.tsx';\nimport { DimensionSample } from '#/dimension-scale/DimensionSample.tsx';\nimport { FontFamilySpecimen } from '#/presenters/FontFamilySpecimen.tsx';\nimport { FontWeightSpecimen } from '#/presenters/FontWeightSpecimen.tsx';\nimport { GradientSwatch } from '#/presenters/GradientSwatch.tsx';\nimport { MotionSample } from '#/motion-preview/MotionSample.tsx';\nimport { OpacitySwatch } from '#/presenters/OpacitySwatch.tsx';\nimport type { PresenterComponent, PresenterRegistry } from '#/presenters/types.ts';\nimport { StrokeSample } from '#/presenters/StrokeSample.tsx';\nimport { TypeSpecimen } from '#/presenters/TypeSpecimen.tsx';\nimport { ShadowSample } from '#/shadow-preview/ShadowSample.tsx';\n\n/**\n * Built-in presenters, keyed by DTCG `$type`. Phase C registers each entry as\n * its presenter lands. A consumer's `presenters` override merges over this.\n */\nexport const DEFAULT_PRESENTERS: PresenterRegistry = {\n color: ColorSwatch as PresenterComponent,\n shadow: ShadowSample as PresenterComponent,\n border: BorderSample as PresenterComponent,\n dimension: DimensionSample as PresenterComponent,\n gradient: GradientSwatch as PresenterComponent,\n transition: MotionSample as PresenterComponent,\n typography: TypeSpecimen as PresenterComponent,\n fontFamily: FontFamilySpecimen as PresenterComponent,\n fontWeight: FontWeightSpecimen as PresenterComponent,\n number: OpacitySwatch as PresenterComponent,\n strokeStyle: StrokeSample as PresenterComponent,\n};\n\n/** Overrides win per `$type`; unlisted types keep the built-in. */\nexport function mergePresenters(overrides?: PresenterRegistry): PresenterRegistry {\n return overrides ? { ...DEFAULT_PRESENTERS, ...overrides } : DEFAULT_PRESENTERS;\n}\n\n/** The active merged registry for the subtree. */\nexport const PresenterContext = createContext<PresenterRegistry>(DEFAULT_PRESENTERS);\n\nlet ambientPresenters: PresenterRegistry = DEFAULT_PRESENTERS;\n\n/**\n * Set the ambient presenter registry consulted by blocks that render with\n * no `SwatchbookProvider` or `PresenterContext.Provider` above them (MDX\n * doc blocks, autodocs). A host registers this once at preview-init; it is\n * NOT reactive, so register before first render. Passing no argument (or\n * `undefined`) resets to the built-ins. An explicit provider/context\n * override still wins for its subtree; this only fills the provider-less\n * gap.\n */\nexport function registerPresenters(overrides?: PresenterRegistry): void {\n ambientPresenters = mergePresenters(overrides);\n}\n\n/** The ambient registry for the provider-less fallback. */\nexport function getAmbientPresenters(): PresenterRegistry {\n return ambientPresenters;\n}\n\n/** The presenter for `type`, or `undefined` if none is registered. */\nexport function usePresenter(type: TokenType): PresenterComponent | undefined {\n const ctx = useContext(PresenterContext);\n // An explicit provider/context override replaces the default reference, so\n // identity distinguishes \"no override present\" (fall to ambient) from\n // \"override present\" (honor it).\n const registry = ctx === DEFAULT_PRESENTERS ? ambientPresenters : ctx;\n return registry[type];\n}\n","import { useSyncExternalStore } from 'react';\nimport type { VirtualTokenGraph, VirtualTokenListing } from '#/contexts.ts';\nimport type { ColorFormat } from '#/format-color.ts';\nimport type { VirtualAxis, VirtualDiagnostic } from '#/types.ts';\n\n/**\n * Host adapter API: generic ambient project source. A host (an addon,\n * a plugin, a CLI preview server) decodes its own transport (Storybook\n * channel, WebSocket, whatever) and pushes decoded snapshots in via\n * {@link registerProjectSource}. This module carries no transport or\n * decoding logic of its own; that keeps blocks importable standalone\n * (outside Storybook, in unit tests, in the docs site) with no host\n * dependency. Until a host registers a source, blocks render from empty\n * defaults.\n */\n\n/** Host adapter API: see {@link registerProjectSource}. */\nexport interface ProjectSource {\n readonly axes: readonly VirtualAxis[];\n readonly presets: readonly {\n name: string;\n axes: Partial<Record<string, string>>;\n description?: string;\n }[];\n readonly diagnostics: readonly VirtualDiagnostic[];\n readonly css: string;\n readonly cssVarPrefix: string;\n /** Project-wide baseline for the row-indicator strip from `config.indicators`. */\n readonly indicators: Readonly<Record<string, boolean>>;\n readonly listing: Readonly<Record<string, VirtualTokenListing>>;\n readonly tokenGraph: VirtualTokenGraph;\n readonly defaultTuple: Record<string, string>;\n /**\n * Starting color format for blocks that display color values:\n * `config.defaultColorFormat` from core, forwarded by the host.\n * `useColorFormat()` falls back to this on the provider-less\n * (MDX/autodocs) path when no `ColorFormatContext`/channel-globals\n * override is active.\n */\n readonly defaultColorFormat: ColorFormat;\n /** The host's currently active axis tuple, or null before a host reports one. */\n readonly activeAxes: Record<string, string> | null;\n /** Monotonic counter, bumped on each update. Useful as a React key. */\n readonly version: number;\n}\n\nconst EMPTY_TOKEN_GRAPH: VirtualTokenGraph = {\n nodes: {},\n axes: [],\n axisDefaults: {},\n axisContexts: {},\n};\n\nconst EMPTY_SOURCE: ProjectSource = {\n axes: [],\n presets: [],\n diagnostics: [],\n css: '',\n cssVarPrefix: '',\n indicators: {},\n listing: {},\n tokenGraph: EMPTY_TOKEN_GRAPH,\n defaultTuple: {},\n defaultColorFormat: 'hex',\n activeAxes: null,\n version: 0,\n};\n\nlet source: ProjectSource = EMPTY_SOURCE;\n\nconst listeners = new Set<() => void>();\n\n/**\n * Host adapter API. Push a (partial) project snapshot into the ambient\n * store. Omitted fields fall back to the current source, so a host can\n * call this repeatedly with incremental patches (e.g. one per HMR event\n * or axis flip) without re-sending the whole snapshot each time.\n */\nexport function registerProjectSource(patch: Partial<ProjectSource>): void {\n source = {\n axes: patch.axes ?? source.axes,\n presets: patch.presets ?? source.presets,\n diagnostics: patch.diagnostics ?? source.diagnostics,\n css: patch.css ?? source.css,\n cssVarPrefix: patch.cssVarPrefix ?? source.cssVarPrefix,\n indicators: patch.indicators ?? source.indicators,\n listing: patch.listing ?? source.listing,\n tokenGraph: patch.tokenGraph ?? source.tokenGraph,\n defaultTuple: patch.defaultTuple ?? source.defaultTuple,\n defaultColorFormat: patch.defaultColorFormat ?? source.defaultColorFormat,\n // activeAxes distinguishes omitted (fall back to current) from an\n // explicit null (clear the tuple); `??` alone can't express that.\n activeAxes: 'activeAxes' in patch ? (patch.activeAxes ?? null) : source.activeAxes,\n version: source.version + 1,\n };\n for (const cb of listeners) cb();\n}\n\nfunction subscribe(cb: () => void): () => void {\n listeners.add(cb);\n return () => {\n listeners.delete(cb);\n };\n}\n\nfunction getSnapshot(): ProjectSource {\n return source;\n}\n\nfunction getServerSnapshot(): ProjectSource {\n return source;\n}\n\n/**\n * Host adapter API. Read the live, ambient project source. Re-renders in\n * place on each {@link registerProjectSource} call.\n */\nexport function useProjectSource(): ProjectSource {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\n/**\n * Host adapter API. Register the ambient presenter registry consulted by\n * provider-less blocks (MDX doc blocks, autodocs). A host calls this once at\n * preview-init; an explicit `SwatchbookProvider presenters` prop or a local\n * `PresenterContext.Provider` still wins for its own subtree.\n */\nexport { registerPresenters } from '#/presenters/registry.ts';\n"],"mappings":";;;;;;;;;;;;AAOA,SAAgB,aAAa,KAAsB;AACjD,KAAI,OAAO,QAAQ,SAAU,QAAO,GAAG,IAAI;AAC3C,KAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,KAAI,OAAO,OAAO,QAAQ,UAAU;EAClC,MAAM,IAAI;AACV,MAAI,OAAO,EAAE,UAAU,YAAY,OAAO,EAAE,SAAS,SAAU,QAAO,GAAG,EAAE,QAAQ,EAAE;;AAEvF,QAAO;;;;;;;;;AAUT,SAAgB,eAAe,QAAkD;AAC/E,QAAO,WAAW,QAAQ,QAAQ;;;;;ACNpC,SAAgB,iBAAiB,EAAE,UAA+C;AAChF,QAAO,oBAAC,OAAD;EAAK,WAAU;EAAmB,OAAO,EAAE,QAAQ,QAAQ;EAAE,eAAA;EAAc,CAAA;;;;;;;;AASpF,SAAS,iBAAiB,OAAoB,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OAAO;EACjC,YAAY,MAAM,cAAc,OAAO;EACvC,cAAc,MAAM,gBAAgB,OAAO;EAC3C,oBAAoB,MAAM,sBAAsB,OAAO;EAGvD,YAAY,gBAAgB,QAAS,MAAM,cAAc,OAAQ,OAAO;EACxE,SAAS,OAAO,UAAU;EAC3B;AACD,MAAK,MAAM,MAAM,UAAW,KAAI;;AAGlC,SAAS,UAAU,IAA4B;AAC7C,WAAU,IAAI,GAAG;AACjB,cAAa;AACX,YAAU,OAAO,GAAG;;;AAIxB,SAAS,cAA6B;AACpC,QAAO;;AAGT,SAAS,oBAAmC;AAC1C,QAAO;;;;;;AAOT,SAAgB,mBAAkC;AAChD,QAAO,qBAAqB,WAAW,aAAa,kBAAkB"}
|
package/dist/host.d.mts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { T as ColorFormat, _ as VirtualTokenGraph, h as VirtualDiagnosticShape, i as registerPresenters, m as VirtualAxisShape, v as VirtualTokenListing } from "./registry-Dm25Go94.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/host.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Host adapter API: generic ambient project source. A host (an addon,
|
|
6
|
+
* a plugin, a CLI preview server) decodes its own transport (Storybook
|
|
7
|
+
* channel, WebSocket, whatever) and pushes decoded snapshots in via
|
|
8
|
+
* {@link registerProjectSource}. This module carries no transport or
|
|
9
|
+
* decoding logic of its own; that keeps blocks importable standalone
|
|
10
|
+
* (outside Storybook, in unit tests, in the docs site) with no host
|
|
11
|
+
* dependency. Until a host registers a source, blocks render from empty
|
|
12
|
+
* defaults.
|
|
13
|
+
*/
|
|
14
|
+
/** Host adapter API: see {@link registerProjectSource}. */
|
|
15
|
+
interface ProjectSource {
|
|
16
|
+
readonly axes: readonly VirtualAxisShape[];
|
|
17
|
+
readonly presets: readonly {
|
|
18
|
+
name: string;
|
|
19
|
+
axes: Partial<Record<string, string>>;
|
|
20
|
+
description?: string;
|
|
21
|
+
}[];
|
|
22
|
+
readonly diagnostics: readonly VirtualDiagnosticShape[];
|
|
23
|
+
readonly css: string;
|
|
24
|
+
readonly cssVarPrefix: string;
|
|
25
|
+
/** Project-wide baseline for the row-indicator strip from `config.indicators`. */
|
|
26
|
+
readonly indicators: Readonly<Record<string, boolean>>;
|
|
27
|
+
readonly listing: Readonly<Record<string, VirtualTokenListing>>;
|
|
28
|
+
readonly tokenGraph: VirtualTokenGraph;
|
|
29
|
+
readonly defaultTuple: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Starting color format for blocks that display color values:
|
|
32
|
+
* `config.defaultColorFormat` from core, forwarded by the host.
|
|
33
|
+
* `useColorFormat()` falls back to this on the provider-less
|
|
34
|
+
* (MDX/autodocs) path when no `ColorFormatContext`/channel-globals
|
|
35
|
+
* override is active.
|
|
36
|
+
*/
|
|
37
|
+
readonly defaultColorFormat: ColorFormat;
|
|
38
|
+
/** The host's currently active axis tuple, or null before a host reports one. */
|
|
39
|
+
readonly activeAxes: Record<string, string> | null;
|
|
40
|
+
/** Monotonic counter, bumped on each update. Useful as a React key. */
|
|
41
|
+
readonly version: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Host adapter API. Push a (partial) project snapshot into the ambient
|
|
45
|
+
* store. Omitted fields fall back to the current source, so a host can
|
|
46
|
+
* call this repeatedly with incremental patches (e.g. one per HMR event
|
|
47
|
+
* or axis flip) without re-sending the whole snapshot each time.
|
|
48
|
+
*/
|
|
49
|
+
declare function registerProjectSource(patch: Partial<ProjectSource>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Host adapter API. Read the live, ambient project source. Re-renders in
|
|
52
|
+
* place on each {@link registerProjectSource} call.
|
|
53
|
+
*/
|
|
54
|
+
declare function useProjectSource(): ProjectSource;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { ProjectSource, registerPresenters, registerProjectSource, useProjectSource };
|
|
57
|
+
//# sourceMappingURL=host.d.mts.map
|
package/dist/host.mjs
ADDED