@unpunnyfuns/swatchbook-blocks 0.10.0 → 0.11.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/dist/index.mjs +10 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -433,13 +433,13 @@ function snapshotToData(snapshot) {
|
|
|
433
433
|
/**
|
|
434
434
|
* Reads project data either from a mounted {@link SwatchbookProvider}
|
|
435
435
|
* (preferred — the addon's preview decorator installs one around every
|
|
436
|
-
* story) or
|
|
437
|
-
*
|
|
436
|
+
* story) or, when no provider is present, from the virtual module plus
|
|
437
|
+
* Storybook globals directly.
|
|
438
438
|
*
|
|
439
|
-
* The
|
|
440
|
-
* blocks and autodocs renders where no story is active. It
|
|
441
|
-
* the virtual module's per-theme CSS and tracks the active
|
|
442
|
-
* `globalsUpdated` channel event; {@link useGlobals} from
|
|
439
|
+
* The provider-less path is what makes the hook safe to call from MDX
|
|
440
|
+
* doc blocks and autodocs renders where no story is active. It
|
|
441
|
+
* self-mounts the virtual module's per-theme CSS and tracks the active
|
|
442
|
+
* tuple via the `globalsUpdated` channel event; {@link useGlobals} from
|
|
443
443
|
* `storybook/preview-api` would throw outside a story render.
|
|
444
444
|
*/
|
|
445
445
|
function useProject() {
|
|
@@ -1020,9 +1020,6 @@ function DimensionBar({ path, kind = "length" }) {
|
|
|
1020
1020
|
* respecting the active color format for color-typed tokens and the
|
|
1021
1021
|
* color sub-values of composite types (border, shadow, gradient).
|
|
1022
1022
|
*
|
|
1023
|
-
* Replaces the old `formatValue` one-shot that hex-short-circuited
|
|
1024
|
-
* colors and fell through to raw JSON for known composites.
|
|
1025
|
-
*
|
|
1026
1023
|
* Shape by type:
|
|
1027
1024
|
* - `color` → `formatColor(value, colorFormat)` — e.g. `#3b82f6`, `oklch(...)`, `raw` JSON.
|
|
1028
1025
|
* - `dimension|duration` → `value + unit` — e.g. `16px`, `200ms`.
|
|
@@ -3132,10 +3129,6 @@ function TokenNavigator({ root, type, initiallyExpanded = 1, searchable = true,
|
|
|
3132
3129
|
else setSelectedPath(path);
|
|
3133
3130
|
}, [onSelect]);
|
|
3134
3131
|
const typeLabel = typeFilter ? ` · ${[...typeFilter].map((t) => `$type=${t}`).join(", ")}` : "";
|
|
3135
|
-
if (tree.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
3136
|
-
...themeAttrs(cssVarPrefix, activeTheme),
|
|
3137
|
-
children: /* @__PURE__ */ jsx(EmptyState, { children: root ? `No tokens under "${root}"${typeFilter ? ` matching ${typeLabel.slice(3)}` : ""}.` : typeFilter ? `No tokens matching ${typeLabel.slice(3)} in the active theme.` : "No tokens in the active theme." })
|
|
3138
|
-
});
|
|
3139
3132
|
const trimmedQuery = query.trim();
|
|
3140
3133
|
const matchCount = useMemo(() => {
|
|
3141
3134
|
if (!searchExpanded) return 0;
|
|
@@ -3143,6 +3136,10 @@ function TokenNavigator({ root, type, initiallyExpanded = 1, searchable = true,
|
|
|
3143
3136
|
for (const node of visibleTree) n += countLeaves(node);
|
|
3144
3137
|
return n;
|
|
3145
3138
|
}, [visibleTree, searchExpanded]);
|
|
3139
|
+
if (tree.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
3140
|
+
...themeAttrs(cssVarPrefix, activeTheme),
|
|
3141
|
+
children: /* @__PURE__ */ jsx(EmptyState, { children: root ? `No tokens under "${root}"${typeFilter ? ` matching ${typeLabel.slice(3)}` : ""}.` : typeFilter ? `No tokens matching ${typeLabel.slice(3)} in the active theme.` : "No tokens in the active theme." })
|
|
3142
|
+
});
|
|
3146
3143
|
return /* @__PURE__ */ jsxs("div", {
|
|
3147
3144
|
...themeAttrs(cssVarPrefix, activeTheme),
|
|
3148
3145
|
children: [
|