@unpunnyfuns/swatchbook-blocks 1.0.0-alpha.1 → 1.0.0-alpha.2

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/dist/index.d.mts CHANGED
@@ -62,7 +62,7 @@ interface VirtualTokenShape {
62
62
  * the single canonical wire shape; both the addon's plugin (server-side
63
63
  * emit) and blocks (consumer-side read) reference the same definition.
64
64
  */
65
- type VirtualTokenListingShape = SlimListedToken;
65
+ type VirtualTokenListing = SlimListedToken;
66
66
  type VirtualPresetShape = Preset;
67
67
  /**
68
68
  * Wire shape of the token graph — aliased from core's authoritative
@@ -88,7 +88,13 @@ interface ProjectSnapshot {
88
88
  */
89
89
  indicators?: Readonly<Record<string, boolean>>;
90
90
  diagnostics: readonly VirtualDiagnosticShape[];
91
- css: string;
91
+ /**
92
+ * Raw stylesheet text for the active theme. Optional — nothing on the
93
+ * `SwatchbookProvider` read path consumes it (`useProject()` never reads
94
+ * `snapshot.css`); the addon populates it incidentally when constructing
95
+ * its snapshot but injects CSS through its own independent mechanism.
96
+ */
97
+ css?: string;
92
98
  /**
93
99
  * Path-indexed Token Listing data produced by
94
100
  * `@terrazzo/plugin-token-listing`. Blocks prefer reading authoritative
@@ -96,7 +102,7 @@ interface ProjectSnapshot {
96
102
  * projects. Treat as enrichment — fall back gracefully when a path is
97
103
  * absent.
98
104
  */
99
- listing?: Readonly<Record<string, VirtualTokenListingShape>>;
105
+ listing?: Readonly<Record<string, VirtualTokenListing>>;
100
106
  /**
101
107
  * Pre-built token graph for the project. JSON-serializable; nodes
102
108
  * carry per-axis writes plus alias edges. The blocks hook backs
@@ -117,12 +123,6 @@ interface ProjectSnapshot {
117
123
  */
118
124
  resolveAt?: (tuple: Record<string, string>) => Record<string, VirtualTokenShape>;
119
125
  }
120
- /**
121
- * Context carrying the full {@link ProjectSnapshot}. `null` sentinel lets
122
- * `useSwatchbookData()` tell "provider present" from "fall back to the
123
- * virtual module".
124
- */
125
- declare const SwatchbookContext: _$react.Context<ProjectSnapshot | null>;
126
126
  declare function useOptionalSwatchbookData(): ProjectSnapshot | null;
127
127
  /**
128
128
  * Active swatchbook theme for the current story/docs render. Populated by
@@ -341,9 +341,11 @@ declare function Diagnostics({
341
341
  caption
342
342
  }?: DiagnosticsProps): ReactElement;
343
343
  //#endregion
344
- //#region src/dimension-scale/DimensionBar.d.ts
344
+ //#region src/dimension-scale/DimensionSample.d.ts
345
+ /** The visual treatment for a dimension sample: a length bar, a radius square, or a sized square. */
345
346
  type DimensionVisual = 'length' | 'radius' | 'size';
346
- interface DimensionBarProps {
347
+ /** Props for the connected {@link DimensionSample} block. */
348
+ interface DimensionSampleProps {
347
349
  /** Full dot-path of the dimension token to preview. */
348
350
  path: string;
349
351
  /**
@@ -354,10 +356,11 @@ interface DimensionBarProps {
354
356
  */
355
357
  visual?: DimensionVisual;
356
358
  }
357
- declare function DimensionBar({
359
+ /** Connected block: resolves `path` against the active project and renders its dimension sample. */
360
+ declare function DimensionSample({
358
361
  path,
359
362
  visual
360
- }: DimensionBarProps): ReactElement;
363
+ }: DimensionSampleProps): ReactElement;
361
364
  //#endregion
362
365
  //#region src/DimensionScale.d.ts
363
366
  interface DimensionScaleProps {
@@ -497,6 +500,13 @@ declare function MotionSample({
497
500
  }: MotionSampleProps): ReactElement;
498
501
  //#endregion
499
502
  //#region src/MotionPreview.d.ts
503
+ /**
504
+ * Unlike the other filter/caption/sortBy/sortDir blocks in this family,
505
+ * `MotionPreview` has no `sortBy`/`sortDir` — rows are always ordered by
506
+ * kind (`transition` / `duration` / `cubicBezier`) then path. There's no
507
+ * single numeric axis across the three kinds that a sort would meaningfully
508
+ * order by.
509
+ */
500
510
  interface MotionPreviewProps {
501
511
  /**
502
512
  * Token-path filter. Defaults to transition + duration + cubicBezier
@@ -580,6 +590,12 @@ declare function useChannelGlobals(): ChannelGlobals;
580
590
  //#endregion
581
591
  //#region src/internal/channel.d.ts
582
592
  /**
593
+ * Host adapter API — a distinct tier from the components/hooks/
594
+ * `SwatchbookProvider` surface that MDX/story authors use. This is how a
595
+ * host (Storybook's addon, or an alternative embedding) injects live data
596
+ * into blocks without blocks depending on that host. Most consumers never
597
+ * touch this; it exists for whoever builds the next integration.
598
+ *
583
599
  * Minimal event-source contract blocks need from their host. Storybook's
584
600
  * preview Channel satisfies it structurally; a plain emitter or a test double
585
601
  * does too. Blocks never import `storybook/preview-api` — the addon, which
@@ -591,13 +607,19 @@ interface BlockChannel {
591
607
  on<T>(event: string, listener: (payload: T) => void): void;
592
608
  }
593
609
  /**
594
- * Inject the host channel. Called once by the addon preview at init. Runs any
595
- * subscribers that registered before the channel existed, then clears the
596
- * queue. Idempotent for consumers: each subscriber guards its own attach, so a
597
- * re-register (HMR) does not double-wire.
610
+ * Host adapter API. The single most load-bearing function in the host
611
+ * contract the addon calls it once at preview init.
612
+ *
613
+ * Inject the host channel. Runs any subscribers that queued before the
614
+ * channel existed, then clears the queue. The host contract does NOT dedupe:
615
+ * on HMR a subscriber's module re-runs {@link onChannel}, which re-attaches
616
+ * immediately once the channel is set, so each subscriber MUST guard its own
617
+ * attach to stay single-wired.
598
618
  */
599
619
  declare function registerChannel(next: BlockChannel): void;
600
620
  /**
621
+ * Host adapter API — see {@link registerChannel}.
622
+ *
601
623
  * Attach a subscriber to the host channel now if one is registered, else queue
602
624
  * it to run the moment {@link registerChannel} fires. Blocks call this at
603
625
  * module load; the queue absorbs the gap until the addon injects the channel.
@@ -631,6 +653,12 @@ declare function useSwatchbookData(): ProjectSnapshot;
631
653
  //#endregion
632
654
  //#region src/internal/channel-tokens.d.ts
633
655
  /**
656
+ * Host adapter API — same integration tier as {@link BlockChannel} /
657
+ * {@link registerChannel} / {@link onChannel}, distinct from the
658
+ * components/hooks/`SwatchbookProvider` surface MDX/story authors use.
659
+ * Most consumers never touch this; it exists for whoever builds the next
660
+ * host integration.
661
+ *
634
662
  * Live token snapshot backed by the addon's preview dev-time HMR event.
635
663
  *
636
664
  * The initial snapshot is *injected* by the addon preview via
@@ -646,6 +674,7 @@ declare function useSwatchbookData(): ProjectSnapshot;
646
674
  * `useSyncExternalStore`, so hooks re-render in place on each token save.
647
675
  */
648
676
  declare const TOKENS_UPDATED_EVENT = "swatchbook/tokens-updated";
677
+ /** Host adapter API — see {@link registerTokenSource}. */
649
678
  interface TokenSnapshot {
650
679
  readonly axes: readonly VirtualAxisShape[];
651
680
  readonly presets: readonly {
@@ -658,13 +687,15 @@ interface TokenSnapshot {
658
687
  readonly cssVarPrefix: string;
659
688
  /** Project-wide baseline for the row-indicator strip from `config.indicators`. */
660
689
  readonly indicators: Readonly<Record<string, boolean>>;
661
- readonly listing: Readonly<Record<string, VirtualTokenListingShape>>;
690
+ readonly listing: Readonly<Record<string, VirtualTokenListing>>;
662
691
  readonly tokenGraph: VirtualTokenGraph;
663
692
  readonly defaultTuple: Record<string, string>;
664
693
  /** Monotonic counter, bumped on each update. Useful as a React key. */
665
694
  readonly version: number;
666
695
  }
667
696
  /**
697
+ * Host adapter API — same integration tier as {@link registerChannel}.
698
+ *
668
699
  * Seed the initial token snapshot. The addon preview calls this once at
669
700
  * init with the build-time `virtual:swatchbook/tokens` data. Keeping the
670
701
  * virtual-module read on the addon side (the package that owns it) lets
@@ -672,6 +703,12 @@ interface TokenSnapshot {
672
703
  * snapshot, so a partial source is safe.
673
704
  */
674
705
  declare function registerTokenSource(source: Partial<TokenSnapshot>): void;
706
+ /**
707
+ * Host adapter API — same integration tier as {@link registerChannel}. Most
708
+ * consumers read project data through `useSwatchbookData()` /
709
+ * `SwatchbookProvider` instead; this is the internal subscription
710
+ * `useProject()`'s fallback path uses to read the live channel-fed snapshot.
711
+ */
675
712
  declare function useTokenSnapshot(): TokenSnapshot;
676
713
  //#endregion
677
714
  //#region src/ShadowPreview.d.ts
@@ -822,7 +859,13 @@ declare function TokenUsageSnippet({
822
859
  //#endregion
823
860
  //#region src/TokenNavigator.d.ts
824
861
  interface TokenNavigatorProps {
825
- /** If provided, mount at this dot-path subtree and hide everything outside it. */
862
+ /**
863
+ * If provided, mount at this dot-path subtree and hide everything outside
864
+ * it. Unlike every other listing block's `filter` (a glob over paths,
865
+ * inclusion-only), `root` is a single literal path that also affects
866
+ * where the tree mounts and how breadcrumbs render — it re-roots the
867
+ * navigator, not just narrows its rows.
868
+ */
826
869
  root?: string;
827
870
  /**
828
871
  * Restrict the tree to tokens with the given DTCG `$type`(s). Pass a single
@@ -830,6 +873,10 @@ interface TokenNavigatorProps {
830
873
  * small-multiples view (`type={['duration', 'cubicBezier', 'transition']}`).
831
874
  * Composes with `root` — both constraints must hold. Group nodes that end
832
875
  * up with no surviving leaves collapse out.
876
+ *
877
+ * Accepts `string | readonly string[]` — wider than `TokenTableProps.type`
878
+ * (`string`-only) because a small-multiples tree view benefits from
879
+ * multi-type scoping in a way a flat table doesn't.
833
880
  */
834
881
  type?: string | readonly string[];
835
882
  /**
@@ -966,5 +1013,5 @@ declare function TypographyScale({
966
1013
  sortDir
967
1014
  }: TypographyScaleProps): ReactElement;
968
1015
  //#endregion
969
- export { AliasChain, type AliasChainProps, AliasedBy, type AliasedByProps, AxesContext, AxisVariance, type AxisVarianceProps, type BlockChannel, BorderPreview, type BorderPreviewProps, BorderSample, type BorderSampleProps, COLOR_FORMATS, type ChannelGlobals, type ColorFormat, ColorFormatContext, ColorPalette, type ColorPaletteProps, ColorTable, type ColorTableProps, CompositeBreakdown, type CompositeBreakdownProps, CompositePreview, type CompositePreviewProps, ConsumerOutput, type ConsumerOutputProps, Diagnostics, type DiagnosticsProps, DimensionBar, type DimensionBarProps, DimensionScale, type DimensionScaleProps, type DimensionVisual, FontFamilyPreview, type FontFamilyPreviewProps, FontWeightScale, type FontWeightScaleProps, type FormatColorResult, GradientPalette, type GradientPaletteProps, MotionPreview, type MotionPreviewProps, MotionSample, type MotionSampleProps, type MotionSpeed, type NormalizedColor, OpacityScale, type OpacityScaleProps, type ProjectSnapshot, ShadowPreview, type ShadowPreviewProps, ShadowSample, type ShadowSampleProps, StrokeStylePreview, type StrokeStylePreviewProps, SwatchbookContext, SwatchbookProvider, type SwatchbookProviderProps, TOKENS_UPDATED_EVENT, ThemeContext, TokenDetail, type TokenDetailProps, TokenHeader, type TokenHeaderProps, TokenNavigator, type TokenNavigatorProps, type TokenSnapshot, TokenTable, type TokenTableProps, TokenUsageSnippet, type TokenUsageSnippetProps, TypographyScale, type TypographyScaleProps, type VirtualAxisShape as VirtualAxis, type VirtualAxisShape, type VirtualDiagnosticShape as VirtualDiagnostic, type VirtualDiagnosticShape, type VirtualPresetShape as VirtualPreset, type VirtualPresetShape, type VirtualTokenShape as VirtualToken, type VirtualTokenShape, type VirtualTokenGraph, type VirtualTokenListingShape, formatColor, onChannel, registerChannel, registerTokenSource, useActiveAxes, useActiveTheme, useChannelGlobals, useColorFormat, useOptionalSwatchbookData, useSwatchbookData, useTokenSnapshot };
1016
+ export { AliasChain, type AliasChainProps, AliasedBy, type AliasedByProps, AxesContext, AxisVariance, type AxisVarianceProps, type BlockChannel, BorderPreview, type BorderPreviewProps, BorderSample, type BorderSampleProps, COLOR_FORMATS, type ChannelGlobals, type ColorFormat, ColorFormatContext, ColorPalette, type ColorPaletteProps, ColorTable, type ColorTableProps, CompositeBreakdown, type CompositeBreakdownProps, CompositePreview, type CompositePreviewProps, ConsumerOutput, type ConsumerOutputProps, Diagnostics, type DiagnosticsProps, DimensionSample, type DimensionSampleProps, DimensionScale, type DimensionScaleProps, type DimensionVisual, FontFamilyPreview, type FontFamilyPreviewProps, FontWeightScale, type FontWeightScaleProps, type FormatColorResult, GradientPalette, type GradientPaletteProps, type IndicatorName, type IndicatorsProp, MotionPreview, type MotionPreviewProps, MotionSample, type MotionSampleProps, type MotionSpeed, type NormalizedColor, OpacityScale, type OpacityScaleProps, type ProjectSnapshot, ShadowPreview, type ShadowPreviewProps, ShadowSample, type ShadowSampleProps, type SortBy, type SortDir, StrokeStylePreview, type StrokeStylePreviewProps, SwatchbookProvider, type SwatchbookProviderProps, TOKENS_UPDATED_EVENT, ThemeContext, TokenDetail, type TokenDetailProps, TokenHeader, type TokenHeaderProps, TokenNavigator, type TokenNavigatorProps, type TokenSnapshot, TokenTable, type TokenTableProps, TokenUsageSnippet, type TokenUsageSnippetProps, TypographyScale, type TypographyScaleProps, type VirtualAxisShape as VirtualAxis, type VirtualDiagnosticShape as VirtualDiagnostic, type VirtualPresetShape as VirtualPreset, type VirtualTokenShape as VirtualToken, type VirtualTokenGraph, type VirtualTokenListing, formatColor, onChannel, registerChannel, registerTokenSource, useActiveAxes, useActiveTheme, useChannelGlobals, useColorFormat, useOptionalSwatchbookData, useSwatchbookData, useTokenSnapshot };
970
1017
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { COLOR_FORMATS } from "@unpunnyfuns/swatchbook-core/color-formats";
3
3
  import { formatColor, parseColor } from "@unpunnyfuns/swatchbook-core/format-color";
4
4
  import { createContext, memo, useCallback, useContext, useDeferredValue, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
5
5
  import { getVariance, listPaths, resolveAllWithProvenanceAt } from "@unpunnyfuns/swatchbook-core/graph";
6
- import { makeCssVar } from "@unpunnyfuns/swatchbook-core/css-var";
6
+ import { cssVarRef } from "@unpunnyfuns/swatchbook-core/css-var";
7
7
  import { SWATCHBOOK_STYLE_ELEMENT_ID, ensureStyleElement } from "@unpunnyfuns/swatchbook-core/style-element";
8
8
  import { tupleToName } from "@unpunnyfuns/swatchbook-core/themes";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -16,10 +16,14 @@ import { useWindowVirtualizer } from "@tanstack/react-virtual";
16
16
  let channel = null;
17
17
  const pending = /* @__PURE__ */ new Set();
18
18
  /**
19
- * Inject the host channel. Called once by the addon preview at init. Runs any
20
- * subscribers that registered before the channel existed, then clears the
21
- * queue. Idempotent for consumers: each subscriber guards its own attach, so a
22
- * re-register (HMR) does not double-wire.
19
+ * Host adapter API. The single most load-bearing function in the host
20
+ * contract the addon calls it once at preview init.
21
+ *
22
+ * Inject the host channel. Runs any subscribers that queued before the
23
+ * channel existed, then clears the queue. The host contract does NOT dedupe:
24
+ * on HMR a subscriber's module re-runs {@link onChannel}, which re-attaches
25
+ * immediately once the channel is set, so each subscriber MUST guard its own
26
+ * attach to stay single-wired.
23
27
  */
24
28
  function registerChannel(next) {
25
29
  channel = next;
@@ -27,6 +31,8 @@ function registerChannel(next) {
27
31
  pending.clear();
28
32
  }
29
33
  /**
34
+ * Host adapter API — see {@link registerChannel}.
35
+ *
30
36
  * Attach a subscriber to the host channel now if one is registered, else queue
31
37
  * it to run the moment {@link registerChannel} fires. Blocks call this at
32
38
  * module load; the queue absorbs the gap until the addon injects the channel.
@@ -142,6 +148,12 @@ function useColorFormat() {
142
148
  //#endregion
143
149
  //#region src/internal/channel-tokens.ts
144
150
  /**
151
+ * Host adapter API — same integration tier as {@link BlockChannel} /
152
+ * {@link registerChannel} / {@link onChannel}, distinct from the
153
+ * components/hooks/`SwatchbookProvider` surface MDX/story authors use.
154
+ * Most consumers never touch this; it exists for whoever builds the next
155
+ * host integration.
156
+ *
145
157
  * Live token snapshot backed by the addon's preview dev-time HMR event.
146
158
  *
147
159
  * The initial snapshot is *injected* by the addon preview via
@@ -192,6 +204,8 @@ function applyPatch(patch) {
192
204
  for (const cb of listeners) cb();
193
205
  }
194
206
  /**
207
+ * Host adapter API — same integration tier as {@link registerChannel}.
208
+ *
195
209
  * Seed the initial token snapshot. The addon preview calls this once at
196
210
  * init with the build-time `virtual:swatchbook/tokens` data. Keeping the
197
211
  * virtual-module read on the addon side (the package that owns it) lets
@@ -221,6 +235,12 @@ function getSnapshot() {
221
235
  function getServerSnapshot() {
222
236
  return snapshot;
223
237
  }
238
+ /**
239
+ * Host adapter API — same integration tier as {@link registerChannel}. Most
240
+ * consumers read project data through `useSwatchbookData()` /
241
+ * `SwatchbookProvider` instead; this is the internal subscription
242
+ * `useProject()`'s fallback path uses to read the live channel-fed snapshot.
243
+ */
224
244
  function useTokenSnapshot() {
225
245
  return useSyncExternalStore(subscribe$1, getSnapshot, getServerSnapshot);
226
246
  }
@@ -351,14 +371,14 @@ function useVirtualModuleFallback(enabled) {
351
371
  * Resolve a token's CSS var reference, preferring the authoritative name
352
372
  * emitted by `@terrazzo/plugin-css` (as recorded by
353
373
  * `@terrazzo/plugin-token-listing` in the snapshot's `listing` field).
354
- * Falls back to `makeCssVar` when the listing lacks an entry for this
374
+ * Falls back to `cssVarRef` when the listing lacks an entry for this
355
375
  * path — covers non-resolver projects, hand-built snapshots, and any
356
376
  * listing-plugin miss.
357
377
  */
358
378
  function resolveCssVar(path, project) {
359
379
  const listed = project.listing[path]?.names?.["css"];
360
380
  if (listed) return `var(${listed})`;
361
- return makeCssVar(path, project.cssVarPrefix);
381
+ return cssVarRef(path, project.cssVarPrefix);
362
382
  }
363
383
  /**
364
384
  * Resolve a color value's display string + gamut flag, preferring the
@@ -1845,12 +1865,13 @@ function useRootFontSize() {
1845
1865
  return useSyncExternalStore(subscribe, readRootFontSize, () => 16);
1846
1866
  }
1847
1867
  //#endregion
1848
- //#region src/dimension-scale/DimensionBar.tsx
1868
+ //#region src/dimension-scale/DimensionSample.tsx
1849
1869
  /**
1850
- * Pure derivation of a single dimension token's bar geometry from resolved
1851
- * project data. Extracted so it is unit-testable without React or a store.
1870
+ * Pure derivation of a single dimension token's sample geometry from
1871
+ * resolved project data. Extracted so it is unit-testable without React or
1872
+ * a store.
1852
1873
  */
1853
- function deriveDimensionBar(path, project, rootFontSizePx) {
1874
+ function deriveDimensionSample(path, project, rootFontSizePx) {
1854
1875
  const cssVar = resolveCssVar(path, project);
1855
1876
  const token = project.resolved[path];
1856
1877
  const pxValue = toPixels(token?.$value, rootFontSizePx);
@@ -1864,26 +1885,26 @@ function deriveDimensionBar(path, project, rootFontSizePx) {
1864
1885
  }
1865
1886
  function withCap(visual) {
1866
1887
  return /* @__PURE__ */ jsxs("span", {
1867
- className: "sb-dimension-bar sb-dimension-bar--capped",
1888
+ className: "sb-dimension-sample sb-dimension-sample--capped",
1868
1889
  title: `capped at 480px`,
1869
1890
  children: [visual, /* @__PURE__ */ jsx("span", {
1870
- className: "sb-dimension-bar__cap",
1891
+ className: "sb-dimension-sample__cap",
1871
1892
  "aria-hidden": true,
1872
1893
  children: "…"
1873
1894
  })]
1874
1895
  });
1875
1896
  }
1876
1897
  /** Pure presentation for a single dimension token's bar/sample. Renders from plain props. */
1877
- function DimensionBarView({ cssVar, capped, cappedValue, visual }) {
1898
+ function DimensionSampleView({ cssVar, capped, cappedValue, visual }) {
1878
1899
  switch (visual) {
1879
1900
  case "radius": return /* @__PURE__ */ jsx("div", {
1880
- className: "sb-dimension-bar__radius-sample",
1901
+ className: "sb-dimension-sample__radius-sample",
1881
1902
  style: { borderRadius: cssVar },
1882
1903
  "aria-hidden": true
1883
1904
  });
1884
1905
  case "size": {
1885
1906
  const sample = /* @__PURE__ */ jsx("div", {
1886
- className: "sb-dimension-bar__size-sample",
1907
+ className: "sb-dimension-sample__size-sample",
1887
1908
  style: {
1888
1909
  width: cappedValue,
1889
1910
  height: cappedValue
@@ -1894,7 +1915,7 @@ function DimensionBarView({ cssVar, capped, cappedValue, visual }) {
1894
1915
  }
1895
1916
  default: {
1896
1917
  const bar = /* @__PURE__ */ jsx("div", {
1897
- className: "sb-dimension-bar__bar",
1918
+ className: "sb-dimension-sample__bar",
1898
1919
  style: { width: cappedValue },
1899
1920
  "aria-hidden": true
1900
1921
  });
@@ -1902,9 +1923,10 @@ function DimensionBarView({ cssVar, capped, cappedValue, visual }) {
1902
1923
  }
1903
1924
  }
1904
1925
  }
1905
- function DimensionBar({ path, visual = "length" }) {
1906
- const { cssVar, capped, cappedValue } = deriveDimensionBar(path, useProject(), useRootFontSize());
1907
- return /* @__PURE__ */ jsx(DimensionBarView, {
1926
+ /** Connected block: resolves `path` against the active project and renders its dimension sample. */
1927
+ function DimensionSample({ path, visual = "length" }) {
1928
+ const { cssVar, capped, cappedValue } = deriveDimensionSample(path, useProject(), useRootFontSize());
1929
+ return /* @__PURE__ */ jsx(DimensionSampleView, {
1908
1930
  cssVar,
1909
1931
  capped,
1910
1932
  cappedValue,
@@ -2035,7 +2057,7 @@ function deriveDimensionRows(resolved, project, { filter, sortBy, sortDir, rootF
2035
2057
  }
2036
2058
  /**
2037
2059
  * Pure presentation for the dimension scale. Renders from plain props;
2038
- * composes the connected `DimensionBar` as a child (that child reads the
2060
+ * composes the connected `DimensionSample` as a child (that child reads the
2039
2061
  * project itself).
2040
2062
  */
2041
2063
  function DimensionScaleView({ rows, activeTheme, cssVarPrefix, activeAxes, visual, filter, caption }) {
@@ -2067,7 +2089,7 @@ function DimensionScaleView({ rows, activeTheme, cssVarPrefix, activeAxes, visua
2067
2089
  }),
2068
2090
  /* @__PURE__ */ jsx("div", {
2069
2091
  className: "sb-dimension-scale__visual-cell",
2070
- children: /* @__PURE__ */ jsx(DimensionBar, {
2092
+ children: /* @__PURE__ */ jsx(DimensionSample, {
2071
2093
  path: row.path,
2072
2094
  visual
2073
2095
  })
@@ -4880,7 +4902,7 @@ const LeafPreview = memo(function LeafPreview({ path, token }) {
4880
4902
  children: formatTokenValue(token.$value, type, colorFormat, project.listing[path])
4881
4903
  }), /* @__PURE__ */ jsx("span", {
4882
4904
  className: "sb-token-navigator__preview-dimension",
4883
- children: /* @__PURE__ */ jsx(DimensionBar, {
4905
+ children: /* @__PURE__ */ jsx(DimensionSample, {
4884
4906
  path,
4885
4907
  visual: "length"
4886
4908
  })
@@ -5342,6 +5364,6 @@ function TypographyScale({ filter, sample = "The quick brown fox jumps over the
5342
5364
  });
5343
5365
  }
5344
5366
  //#endregion
5345
- export { AliasChain, AliasedBy, AxesContext, AxisVariance, BorderPreview, BorderSample, COLOR_FORMATS, ColorFormatContext, ColorPalette, ColorTable, CompositeBreakdown, CompositePreview, ConsumerOutput, Diagnostics, DimensionBar, DimensionScale, FontFamilyPreview, FontWeightScale, GradientPalette, MotionPreview, MotionSample, OpacityScale, ShadowPreview, ShadowSample, StrokeStylePreview, SwatchbookContext, SwatchbookProvider, TOKENS_UPDATED_EVENT, ThemeContext, TokenDetail, TokenHeader, TokenNavigator, TokenTable, TokenUsageSnippet, TypographyScale, formatColor, onChannel, registerChannel, registerTokenSource, useActiveAxes, useActiveTheme, useChannelGlobals, useColorFormat, useOptionalSwatchbookData, useSwatchbookData, useTokenSnapshot };
5367
+ export { AliasChain, AliasedBy, AxesContext, AxisVariance, BorderPreview, BorderSample, COLOR_FORMATS, ColorFormatContext, ColorPalette, ColorTable, CompositeBreakdown, CompositePreview, ConsumerOutput, Diagnostics, DimensionSample, DimensionScale, FontFamilyPreview, FontWeightScale, GradientPalette, MotionPreview, MotionSample, OpacityScale, ShadowPreview, ShadowSample, StrokeStylePreview, SwatchbookProvider, TOKENS_UPDATED_EVENT, ThemeContext, TokenDetail, TokenHeader, TokenNavigator, TokenTable, TokenUsageSnippet, TypographyScale, formatColor, onChannel, registerChannel, registerTokenSource, useActiveAxes, useActiveTheme, useChannelGlobals, useColorFormat, useOptionalSwatchbookData, useSwatchbookData, useTokenSnapshot };
5346
5368
 
5347
5369
  //# sourceMappingURL=index.mjs.map