@razorwind/storybook 0.0.58 → 0.0.60
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.cjs +53 -45
- package/dist/index.d.cts +4 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +49 -41
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/lib/fonts"),n=require("@razorwind/core/utils"),r=require("@stryke/path/join");function i(e,t={}){let r=t.cssVarPrefix??`rw
|
|
2
|
-
`,`\\n`).replaceAll(`\r`,`\\r`)}function
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/lib/fonts"),n=require("@razorwind/core/utils"),r=require("@stryke/path/join");function i(e){return e===!0||e===`true`||e===1}function a(e,t){return e?`${e}:${t}`:t}function o(e){let t=e.theme??e.$theme;return typeof t==`string`&&t.length>0?t:void 0}function s(e,t){return e===`palette`||e===`$palette`?typeof t==`boolean`||typeof t==`number`||typeof t==`string`:(e===`theme`||e===`$theme`)&&typeof t==`string`}function c(e){let t=new Map;function r(e,c,l,u,d){if(!(0,n.isObject)(e))return;let f=u||i(e.palette)||i(e.$palette),p=o(e)??d;if((0,n.isTokenLeaf)(e)){(f||p)&&t.set(a(l,c.join(`.`)),{...f&&{palette:!0},...p&&{childTheme:p}});return}for(let[t,n]of Object.entries(e))t.startsWith(`$`)&&t!==`$palette`&&t!==`$theme`||s(t,n)||r(n,[...c,t],l,f,p)}for(let t of(0,n.resolveTokenSets)(e)){let e=t.id==="default"?void 0:t.id;r(t.tokens,[],e,!1,void 0)}return t}function l(e,t={}){let r=t.cssVarPrefix??`rw`,i=c(e);return(0,n.flattenTokens)(e,{includeTypes:t.includeTypes,enrichToken:e=>{let t=i.get(a(e.theme,e.path));return{...e,cssVar:(0,n.toCssVar)(e.path,r),...e.type===`color`&&t}}})}function u(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
|
|
2
|
+
`,`\\n`).replaceAll(`\r`,`\\r`)}function d(e){return typeof e==`string`?`"${u(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function f(e){let t=e.titlePrefix??`Design Tokens`,n=e.themeFiles?.[0],r=e.themeNames??[],i=n?r.length>1?`
|
|
3
3
|
## Storybook UI theme
|
|
4
4
|
|
|
5
5
|
Generated theme module:
|
|
@@ -65,7 +65,21 @@ import { ColorPaletteBlock } from "./blocks";
|
|
|
65
65
|
## Regenerate
|
|
66
66
|
|
|
67
67
|
Re-run Razorwind generate when tokens change to refresh docs under \`${e.outputPath}/\`.
|
|
68
|
-
`}function
|
|
68
|
+
`}function p(e,t){let n=new Map;for(let r of e){let e=r.path.split(`.`).slice(0,Math.max(t,1)).join(`.`)||r.path,i=n.get(e)??[];i.push(r),n.set(e,i)}return n}function m(e,t){return e===t?e.split(`.`).at(-1)??e:e.startsWith(`${t}.`)?e.slice(t.length+1):e.split(`.`).at(-1)??e}function h(e,t={}){let n=e.filter(e=>e.type===`color`),r=t.colorGroupBy??2,i=(e,t=` `)=>[...p(e,r).entries()].toSorted(([e],[t])=>e.localeCompare(t)).map(([e,n])=>{let r=n.map(n=>`${t} ${d(m(n.path,e))}: ${d(n.cssValue)}`).join(`,
|
|
69
|
+
`),i=n.find(e=>e.description)?.description??`${n.length} token${n.length===1?``:`s`}`;return`${t}<ColorItem
|
|
70
|
+
title={${d(e)}}
|
|
71
|
+
subtitle={${d(i)}}
|
|
72
|
+
colors={{
|
|
73
|
+
${r}
|
|
74
|
+
}}
|
|
75
|
+
/>`}).join(`
|
|
76
|
+
`),a=n.filter(e=>e.palette),o=n.filter(e=>!e.palette&&e.childTheme),s=n.filter(e=>!e.palette&&!e.childTheme),c=a.length>0||o.length>0,l=i(n),u=[[`Color palettes`,a],[`Semantic colors`,o],[`Colors`,s]].filter(e=>!!e[1]&&e[1].length>0).map(([e,t])=>` <section>
|
|
77
|
+
<h2>${e}</h2>
|
|
78
|
+
<ColorPalette>
|
|
79
|
+
${i(t,` `)}
|
|
80
|
+
</ColorPalette>
|
|
81
|
+
</section>`).join(`
|
|
82
|
+
`);return`import { ColorPalette, ColorItem } from "@storybook/addon-docs/blocks";
|
|
69
83
|
|
|
70
84
|
/**
|
|
71
85
|
* Color tokens rendered with Storybook's ColorPalette doc block.
|
|
@@ -74,20 +88,14 @@ Re-run Razorwind generate when tokens change to refresh docs under \`${e.outputP
|
|
|
74
88
|
*/
|
|
75
89
|
export function ColorPaletteBlock() {
|
|
76
90
|
return (
|
|
77
|
-
|
|
78
|
-
${
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
colors={{
|
|
83
|
-
${n}
|
|
84
|
-
}}
|
|
85
|
-
/>`}).join(`
|
|
86
|
-
`)||` {/* No color tokens */}`}
|
|
87
|
-
</ColorPalette>
|
|
91
|
+
${c?` <>
|
|
92
|
+
${u}
|
|
93
|
+
</>`:` <ColorPalette>
|
|
94
|
+
${l||` {/* No color tokens */}`}
|
|
95
|
+
</ColorPalette>`}
|
|
88
96
|
);
|
|
89
97
|
}
|
|
90
|
-
`}function
|
|
98
|
+
`}function g(e,n={}){let r=n.sampleText??`The quick brown fox jumps over the lazy dog`,i=e.filter(e=>e.type===`dimension`&&/(?:font|type|text).*size|size.*(?:font|type|text)/i.test(e.path)).map(e=>{let t=/^(\d+(?:\.\d+)?)/.exec(e.cssValue);return t?Number(t[1]):e.cssValue}),a=[...new Set(i)],o=(0,t.pickFontByRole)(n.fonts,t.SANS_ROLES),s=(o?(0,t.cssFontFamily)(o):void 0)??e.find(e=>e.type===`fontFamily`)?.cssValue??`system-ui, sans-serif`,c=e.find(e=>e.type===`fontWeight`),l=c&&Number.parseFloat(c.cssValue)||400,u=a.length>0?`[${a.map(e=>d(e)).join(`, `)}]`:`[12, 14, 16, 20, 24, 32]`;return`import { Typeset } from "@storybook/addon-docs/blocks";
|
|
91
99
|
|
|
92
100
|
/**
|
|
93
101
|
* Typography tokens rendered with Storybook's Typeset doc block.
|
|
@@ -97,14 +105,14 @@ ${n}
|
|
|
97
105
|
export function TypesetBlock() {
|
|
98
106
|
return (
|
|
99
107
|
<Typeset
|
|
100
|
-
fontFamily={${
|
|
101
|
-
fontSizes={${
|
|
102
|
-
fontWeight={${
|
|
103
|
-
sampleText={${
|
|
108
|
+
fontFamily={${d(s)}}
|
|
109
|
+
fontSizes={${u}}
|
|
110
|
+
fontWeight={${d(l)}}
|
|
111
|
+
sampleText={${d(r)}}
|
|
104
112
|
/>
|
|
105
113
|
);
|
|
106
114
|
}
|
|
107
|
-
`}function
|
|
115
|
+
`}function _(e){return`import type { CSSProperties, ReactElement } from "react";
|
|
108
116
|
|
|
109
117
|
export interface TokenTableRow {
|
|
110
118
|
path: string;
|
|
@@ -116,12 +124,12 @@ export interface TokenTableRow {
|
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
const TOKENS: TokenTableRow[] = [
|
|
119
|
-
${e.map(e=>{let t=e.theme?
|
|
120
|
-
path: ${
|
|
121
|
-
type: ${e.type?
|
|
122
|
-
value: ${
|
|
123
|
-
cssVar: ${
|
|
124
|
-
description: ${e.description?
|
|
127
|
+
${e.map(e=>{let t=e.theme?d(e.theme):`undefined`;return` {
|
|
128
|
+
path: ${d(e.path)},
|
|
129
|
+
type: ${e.type?d(e.type):`undefined`},
|
|
130
|
+
value: ${d(e.cssValue)},
|
|
131
|
+
cssVar: ${d(e.cssVar)},
|
|
132
|
+
description: ${e.description?d(e.description):`undefined`},
|
|
125
133
|
theme: ${t}
|
|
126
134
|
}`}).join(`,
|
|
127
135
|
`)||``}
|
|
@@ -208,7 +216,7 @@ export function TokenTableBlock({
|
|
|
208
216
|
</table>
|
|
209
217
|
);
|
|
210
218
|
}
|
|
211
|
-
`}function
|
|
219
|
+
`}function v(e){let t=e.titlePrefix??`Design Tokens`,n=e.hasColors?`
|
|
212
220
|
## Colors
|
|
213
221
|
|
|
214
222
|
<ColorPaletteBlock />
|
|
@@ -221,7 +229,7 @@ import { ColorPaletteBlock } from "./blocks/ColorPalette";
|
|
|
221
229
|
import { TokenTableBlock } from "./blocks/TokenTable";
|
|
222
230
|
import { TypesetBlock } from "./blocks/Typeset";
|
|
223
231
|
|
|
224
|
-
<Meta title="${
|
|
232
|
+
<Meta title="${u(t)}/Overview" />
|
|
225
233
|
|
|
226
234
|
# ${t}
|
|
227
235
|
|
|
@@ -230,23 +238,23 @@ ${n}${r}
|
|
|
230
238
|
## All tokens
|
|
231
239
|
|
|
232
240
|
<TokenTableBlock />
|
|
233
|
-
`}function
|
|
241
|
+
`}function y(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
234
242
|
import { ColorPaletteBlock } from "./blocks/ColorPalette";
|
|
235
243
|
|
|
236
|
-
<Meta title="${
|
|
244
|
+
<Meta title="${u(e.titlePrefix??`Design Tokens`)}/Colors" />
|
|
237
245
|
|
|
238
246
|
# Colors
|
|
239
247
|
|
|
240
248
|
<ColorPaletteBlock />
|
|
241
|
-
`}function
|
|
249
|
+
`}function b(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
242
250
|
import { TypesetBlock } from "./blocks/Typeset";
|
|
243
251
|
|
|
244
|
-
<Meta title="${
|
|
252
|
+
<Meta title="${u(e.titlePrefix??`Design Tokens`)}/Typography" />
|
|
245
253
|
|
|
246
254
|
# Typography
|
|
247
255
|
|
|
248
256
|
<TypesetBlock />
|
|
249
|
-
`}function
|
|
257
|
+
`}function x(e,t){let n=e[t];return typeof n==`string`?n:void 0}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function C(e){return`import { IconGallery, IconItem } from "@storybook/addon-docs/blocks";
|
|
250
258
|
|
|
251
259
|
/**
|
|
252
260
|
* Icons rendered with Storybook's IconGallery doc block.
|
|
@@ -256,39 +264,39 @@ import { TypesetBlock } from "./blocks/Typeset";
|
|
|
256
264
|
export function IconGalleryBlock() {
|
|
257
265
|
return (
|
|
258
266
|
<IconGallery>
|
|
259
|
-
${(
|
|
267
|
+
${(S(e)?Object.values(e).filter(S).toSorted((e,t)=>(x(e,`name`)??``).localeCompare(x(t,`name`)??``)):[]).map(e=>{let t=x(e,`name`)??`unknown`,n=(Array.isArray(e.files)?e.files:[]).find(e=>S(e)&&x(e,`type`)===`svg`&&typeof e.content==`string`),r=S(n)&&typeof n.content==`string`?`<span
|
|
260
268
|
style={{ display: "inline-flex", width: 24, height: 24 }}
|
|
261
|
-
dangerouslySetInnerHTML={{ __html: ${
|
|
262
|
-
/>`:`<code>${
|
|
269
|
+
dangerouslySetInnerHTML={{ __html: ${d(n.content)} }}
|
|
270
|
+
/>`:`<code>${u(t)}</code>`;return` <IconItem name={${d(t)}}>
|
|
263
271
|
${r}
|
|
264
272
|
</IconItem>`}).join(`
|
|
265
273
|
`)||` {/* No icons */}`}
|
|
266
274
|
</IconGallery>
|
|
267
275
|
);
|
|
268
276
|
}
|
|
269
|
-
`}function
|
|
277
|
+
`}function w(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
270
278
|
import { IconGalleryBlock } from "./blocks/IconGallery";
|
|
271
279
|
|
|
272
|
-
<Meta title="${
|
|
280
|
+
<Meta title="${u(e.titlePrefix??`Design Tokens`)}/Icons" />
|
|
273
281
|
|
|
274
282
|
# Icons
|
|
275
283
|
|
|
276
284
|
<IconGalleryBlock />
|
|
277
|
-
`}function
|
|
285
|
+
`}function T(){return`export { ColorPaletteBlock } from "./ColorPalette";
|
|
278
286
|
export { IconGalleryBlock } from "./IconGallery";
|
|
279
287
|
export { TokenTableBlock } from "./TokenTable";
|
|
280
288
|
export type { TokenTableBlockProps, TokenTableRow } from "./TokenTable";
|
|
281
289
|
export { TypesetBlock } from "./Typeset";
|
|
282
|
-
`}const
|
|
283
|
-
`)}\n${t}})`}function
|
|
290
|
+
`}const E=new Set(`base.colorPrimary.colorSecondary.appBg.appContentBg.appHoverBg.appPreviewBg.appBorderColor.appBorderRadius.fontBase.fontCode.textColor.textInverseColor.textMutedColor.barTextColor.barHoverColor.barSelectedColor.barBg.buttonBg.buttonBorder.booleanBg.booleanSelectedBg.inputBg.inputBorder.inputTextColor.inputBorderRadius.brandTitle.brandUrl.brandImage.brandTarget.gridCellSize`.split(`.`));function D(e){return S(e)?e.base===`light`||e.base===`dark`:!1}function O(e){return S(e)?D(e)?!0:Object.keys(e).some(e=>E.has(e)):!1}function k(e){if(!S(e)||O(e))return!1;let t=Object.values(e);return t.length>0&&t.every(O)}function A(e,t,n){return t.base===`light`||t.base===`dark`?t.base:`${e} ${n??``}`.toLowerCase().includes(`light`)?`light`:`dark`}function j(e){return/^[a-z_$][\w$]*$/i.test(e)?e:d(e)}function M(e,t){let r=e.find(e=>e.id===n.SHARED_THEME_ID);return!r||(0,n.isSharedThemeId)(t.id)?t.tokens:(0,n.mergeTokenTrees)(t.tokens,r.tokens)}const N=/^\{([^{}]+)\}$/;function P(e){if(typeof e==`string`)return N.exec(e.trim())?.[1]?.trim()}function F(e){return S(e)&&`$value`in e&&!(`colorSpace`in e)&&!(`hex`in e)?e.$value:e}function I(e,t){let n=F(e),r=new Set;for(let e=0;e<8;e++){let e=P(n);if(!e||r.has(e))break;r.add(e);let i=t.get(e);if(!i)break;n=i.value}return n}function L(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:(0,n.formatTokenValue)(e)}function R(e,t){let r=(0,n.resolveTokenSets)(e),i=r.find(e=>e.id===t)??(r.length===1?r[0]:void 0),a=i?M(r,i):e,o=new Map;for(let e of l(a))(!o.get(e.path)||e.theme===t)&&o.set(e.path,e);return o}function z(e,t){let n={...e};for(let[r,i]of Object.entries(e))r!==`base`&&i!==void 0&&(n[r]=L(I(i,t)));return n}function B(e,t,n,r,i){let a=z(t,R(i.tokens,e));return V(A(e,a,i.theme),a,n,r)}function V(e,n,r,i){let a=(0,t.pickFontByRole)(i,t.SANS_ROLES),o=(0,t.pickFontByRole)(i,t.MONO_ROLES);return{brandTarget:`_blank`,base:e||`light`,...n,brandTitle:n.brandTitle??r.title,brandUrl:n.brandUrl??r.homepage,brandImage:n.brandImage??r.logo,fontBase:n.fontBase??(a?(0,t.cssFontFamily)(a):void 0),fontCode:n.fontCode??(o?(0,t.cssFontFamily)(o):void 0)}}function H(e,t=``){return`create({\n${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,n])=>`${t} ${e}: ${d(n)}`).join(`,
|
|
291
|
+
`)}\n${t}})`}function U(e){return`import { create } from "storybook/theming";
|
|
284
292
|
|
|
285
293
|
/**
|
|
286
294
|
* Storybook UI theme generated by \`@razorwind/storybook\`.
|
|
287
295
|
*
|
|
288
296
|
* @see https://storybook.js.org/docs/configure/user-interface/theming
|
|
289
297
|
*/
|
|
290
|
-
export default ${
|
|
291
|
-
`}function
|
|
298
|
+
export default ${H(e)};
|
|
299
|
+
`}function W(e){return`import { create } from "storybook/theming";
|
|
292
300
|
|
|
293
301
|
/**
|
|
294
302
|
* Storybook UI themes generated by \`@razorwind/storybook\`.
|
|
@@ -296,7 +304,7 @@ export default ${L(e)};
|
|
|
296
304
|
* @see https://storybook.js.org/docs/configure/user-interface/theming
|
|
297
305
|
*/
|
|
298
306
|
export default {
|
|
299
|
-
${Object.entries(e).map(([e,t])=>` ${
|
|
307
|
+
${Object.entries(e).map(([e,t])=>` ${j(e)}: ${H(t,` `)}`).join(`,
|
|
300
308
|
`)}
|
|
301
309
|
};
|
|
302
|
-
`}function
|
|
310
|
+
`}function G(e){if(D(e))return U(e);let t=Object.entries(e);if(t.length!==1)return W(e);let[,n]=t[0]??[];return n?U(n):W(e)}function K(e,t,r,i){let a=(e,n)=>B(e,n,r,t.fonts,t);if(k(e))return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,a(e,t)]));let o=(0,n.resolveTokenSets)(t.tokens),s=o.filter(e=>!(0,n.isSharedThemeId)(e.id));if(s.length>1){let e={};for(let t of s){let n=i(M(o,t));if(k(n)){let r=n[t.id];if(r){e[t.id]=a(t.id,r);continue}for(let[t,r]of Object.entries(n))e[t]=a(t,r);continue}O(n)&&(e[t.id]=a(t.id,n))}return e}if(O(e)){let n=s[0]&&s[0].id!=="default"?s[0].id:t.theme??`default`;return{[n]:a(n,e)}}return{}}const q=e=>(t,i,a)=>(0,n.createDocument)((0,r.joinPaths)(e,t),i,{name:`razorwind-storybook`},!1,a);function J(e,t={}){let i=t.outputPath??`storybook/tokens`,a=(0,n.resolveSchemaIdentity)(e),o=t.titlePrefix??a.title??`Design Tokens`,s={...t,titlePrefix:o},c=l(e.tokens,t),u=c.some(e=>e.type===`color`),d=e.fonts&&Object.keys(e.fonts).length>0||c.some(e=>e.type===`fontFamily`||e.type===`fontWeight`||e.type===`typography`||e.type===`dimension`&&/(?:font|type|text).*size|size.*(?:font|type|text)/i.test(e.path)),p=!t.skipIcons&&S(e.icons)&&Object.keys(e.icons).length>0,m=q(i),x={[(0,r.joinPaths)(i,`blocks/ColorPalette.tsx`)]:m(`blocks/ColorPalette.tsx`,h(c,s),`tsx`),[(0,r.joinPaths)(i,`blocks/Typeset.tsx`)]:m(`blocks/Typeset.tsx`,g(c,{...s,fonts:e.fonts}),`tsx`),[(0,r.joinPaths)(i,`blocks/TokenTable.tsx`)]:m(`blocks/TokenTable.tsx`,_(c),`tsx`),[(0,r.joinPaths)(i,`blocks/IconGallery.tsx`)]:m(`blocks/IconGallery.tsx`,C(t.skipIcons?{}:e.icons),`tsx`),[(0,r.joinPaths)(i,`blocks/index.ts`)]:m(`blocks/index.ts`,T(),`typescript`),[(0,r.joinPaths)(i,`Tokens.mdx`)]:m(`Tokens.mdx`,v({titlePrefix:o,hasColors:u,hasTypography:d}),`mdx`)};u&&(x[(0,r.joinPaths)(i,`Colors.mdx`)]=m(`Colors.mdx`,y(s),`mdx`)),d&&(x[(0,r.joinPaths)(i,`Typography.mdx`)]=m(`Typography.mdx`,b(s),`mdx`)),p&&(x[(0,r.joinPaths)(i,`Icons.mdx`)]=m(`Icons.mdx`,w(s),`mdx`)),x[(0,r.joinPaths)(i,`tokens.json`)]=m(`tokens.json`,`${JSON.stringify(c,null,2)}\n`,`json`);let E;if(t.mapTheme){let n=K(t.mapTheme(e.tokens),e,a,t.mapTheme);Object.keys(n).length>0&&(E=Object.keys(n),x[(0,r.joinPaths)(i,`theme.ts`)]=m(`theme.ts`,G(n),`typescript`))}let D=`INSTALL.md`;return x[(0,r.joinPaths)(i,D)]=m(D,t.installGuide??f({outputPath:i,titlePrefix:o,themeFiles:E?[`theme.ts`]:void 0,themeNames:E}),`markdown`),x}var Y=(0,e.definePlugin)(e=>({name:`storybook`,themeGeneration:`combined`,generate:async t=>J(t,e??{})}));exports.applyBrandDefaults=V,exports.default=Y,exports.flattenTokens=l,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return n.formatTokenValue}}),exports.generateTokenDocs=J,exports.normalizeThemes=K,exports.renderInstallMd=f,exports.renderThemeFile=G,exports.resolveTokenSets=n.resolveTokenSets,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return n.toCssVar}});
|
package/dist/index.d.cts
CHANGED
|
@@ -22,6 +22,10 @@ interface FlatToken {
|
|
|
22
22
|
description?: string;
|
|
23
23
|
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
24
24
|
theme?: string;
|
|
25
|
+
/** True when this color belongs to an ancestor group marked `palette: true`. */
|
|
26
|
+
palette?: boolean;
|
|
27
|
+
/** Semantic child-theme name from a token or ancestor `theme` property. */
|
|
28
|
+
childTheme?: string;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Storybook theme variables passed to `create()` from `storybook/theming`.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;UAwBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;;EAEf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU,wBAAwB,YAAY;KAEpC,uBACV,wBAAwB,eAAe;;;;;;KAO7B,0BACV,QAAQ,SAAS,eAAe,YAC7B;;;;UAKY;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;;;;;;;;;;EAeA,WAAW;;;;;;EAOX;;;;;EAMA;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;;UAwBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;;EAEf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU,wBAAwB,YAAY;KAEpC,uBACV,wBAAwB,eAAe;;;;;;KAO7B,0BACV,QAAQ,SAAS,eAAe,YAC7B;;;;UAKY;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;;;;;;;;;;EAeA,WAAW;;;;;;EAOX;;;;;EAMA;;;;;;;iBC3Dc,cACd,QAAQ,WAAS,eAAe,WAChC,UAAS,KAAK,2DACb;;;;;;;;iBC3Fa,gBAAgB;EAC9B;EACA;EACA;EACA;;;;;;;iBCstBc,mBACd,wBACA,OAAO,YAAY,yBACnB;EAAY;EAAgB;EAAmB;GAC/C,QAAQ,QACP;;;;;;;;;iBAkEa,gBACd,OAAO,iBAAiB,eAAe;;;;;;iBAwBzB,gBACd,iBACA,MAAM,KAAK,uCACX;EAAY;EAAgB;EAAmB;GAC/C,UAAU,YAAY,sCACrB,eAAe;;;;iBAwEF,kBACd,MAAM,QACN,UAAS,yBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -22,6 +22,10 @@ interface FlatToken {
|
|
|
22
22
|
description?: string;
|
|
23
23
|
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
24
24
|
theme?: string;
|
|
25
|
+
/** True when this color belongs to an ancestor group marked `palette: true`. */
|
|
26
|
+
palette?: boolean;
|
|
27
|
+
/** Semantic child-theme name from a token or ancestor `theme` property. */
|
|
28
|
+
childTheme?: string;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Storybook theme variables passed to `create()` from `storybook/theming`.
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{definePlugin as e}from"@razorwind/core/plugin";import{MONO_ROLES as t,SANS_ROLES as n,cssFontFamily as r,pickFontByRole as i}from"@razorwind/core/lib/fonts";import{SHARED_THEME_ID as a,createDocument as o,flattenTokens as s,formatTokenValue as c,
|
|
2
|
-
`,`\\n`).replaceAll(`\r`,`\\r`)}function
|
|
1
|
+
import{definePlugin as e}from"@razorwind/core/plugin";import{MONO_ROLES as t,SANS_ROLES as n,cssFontFamily as r,pickFontByRole as i}from"@razorwind/core/lib/fonts";import{SHARED_THEME_ID as a,createDocument as o,flattenTokens as s,formatTokenValue as c,isObject as l,isSharedThemeId as u,isTokenLeaf as d,mergeTokenTrees as f,resolveSchemaIdentity as ee,resolveTokenSets as p,toCssVar as m,toCssVar as h}from"@razorwind/core/utils";import{joinPaths as g}from"@stryke/path/join";function _(e){return e===!0||e===`true`||e===1}function v(e,t){return e?`${e}:${t}`:t}function y(e){let t=e.theme??e.$theme;return typeof t==`string`&&t.length>0?t:void 0}function te(e,t){return e===`palette`||e===`$palette`?typeof t==`boolean`||typeof t==`number`||typeof t==`string`:(e===`theme`||e===`$theme`)&&typeof t==`string`}function b(e){let t=new Map;function n(e,r,i,a,o){if(!l(e))return;let s=a||_(e.palette)||_(e.$palette),c=y(e)??o;if(d(e)){(s||c)&&t.set(v(i,r.join(`.`)),{...s&&{palette:!0},...c&&{childTheme:c}});return}for(let[t,a]of Object.entries(e))t.startsWith(`$`)&&t!==`$palette`&&t!==`$theme`||te(t,a)||n(a,[...r,t],i,s,c)}for(let t of p(e)){let e=t.id==="default"?void 0:t.id;n(t.tokens,[],e,!1,void 0)}return t}function x(e,t={}){let n=t.cssVarPrefix??`rw`,r=b(e);return s(e,{includeTypes:t.includeTypes,enrichToken:e=>{let t=r.get(v(e.theme,e.path));return{...e,cssVar:h(e.path,n),...e.type===`color`&&t}}})}function S(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
|
|
2
|
+
`,`\\n`).replaceAll(`\r`,`\\r`)}function C(e){return typeof e==`string`?`"${S(e)}"`:typeof e==`number`||typeof e==`boolean`?String(e):e==null?`undefined`:JSON.stringify(e)}function w(e){let t=e.titlePrefix??`Design Tokens`,n=e.themeFiles?.[0],r=e.themeNames??[],i=n?r.length>1?`
|
|
3
3
|
## Storybook UI theme
|
|
4
4
|
|
|
5
5
|
Generated theme module:
|
|
@@ -65,7 +65,21 @@ import { ColorPaletteBlock } from "./blocks";
|
|
|
65
65
|
## Regenerate
|
|
66
66
|
|
|
67
67
|
Re-run Razorwind generate when tokens change to refresh docs under \`${e.outputPath}/\`.
|
|
68
|
-
`}function
|
|
68
|
+
`}function T(e,t){let n=new Map;for(let r of e){let e=r.path.split(`.`).slice(0,Math.max(t,1)).join(`.`)||r.path,i=n.get(e)??[];i.push(r),n.set(e,i)}return n}function E(e,t){return e===t?e.split(`.`).at(-1)??e:e.startsWith(`${t}.`)?e.slice(t.length+1):e.split(`.`).at(-1)??e}function D(e,t={}){let n=e.filter(e=>e.type===`color`),r=t.colorGroupBy??2,i=(e,t=` `)=>[...T(e,r).entries()].toSorted(([e],[t])=>e.localeCompare(t)).map(([e,n])=>{let r=n.map(n=>`${t} ${C(E(n.path,e))}: ${C(n.cssValue)}`).join(`,
|
|
69
|
+
`),i=n.find(e=>e.description)?.description??`${n.length} token${n.length===1?``:`s`}`;return`${t}<ColorItem
|
|
70
|
+
title={${C(e)}}
|
|
71
|
+
subtitle={${C(i)}}
|
|
72
|
+
colors={{
|
|
73
|
+
${r}
|
|
74
|
+
}}
|
|
75
|
+
/>`}).join(`
|
|
76
|
+
`),a=n.filter(e=>e.palette),o=n.filter(e=>!e.palette&&e.childTheme),s=n.filter(e=>!e.palette&&!e.childTheme),c=a.length>0||o.length>0,l=i(n),u=[[`Color palettes`,a],[`Semantic colors`,o],[`Colors`,s]].filter(e=>!!e[1]&&e[1].length>0).map(([e,t])=>` <section>
|
|
77
|
+
<h2>${e}</h2>
|
|
78
|
+
<ColorPalette>
|
|
79
|
+
${i(t,` `)}
|
|
80
|
+
</ColorPalette>
|
|
81
|
+
</section>`).join(`
|
|
82
|
+
`);return`import { ColorPalette, ColorItem } from "@storybook/addon-docs/blocks";
|
|
69
83
|
|
|
70
84
|
/**
|
|
71
85
|
* Color tokens rendered with Storybook's ColorPalette doc block.
|
|
@@ -74,20 +88,14 @@ Re-run Razorwind generate when tokens change to refresh docs under \`${e.outputP
|
|
|
74
88
|
*/
|
|
75
89
|
export function ColorPaletteBlock() {
|
|
76
90
|
return (
|
|
77
|
-
|
|
78
|
-
${
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
colors={{
|
|
83
|
-
${n}
|
|
84
|
-
}}
|
|
85
|
-
/>`}).join(`
|
|
86
|
-
`)||` {/* No color tokens */}`}
|
|
87
|
-
</ColorPalette>
|
|
91
|
+
${c?` <>
|
|
92
|
+
${u}
|
|
93
|
+
</>`:` <ColorPalette>
|
|
94
|
+
${l||` {/* No color tokens */}`}
|
|
95
|
+
</ColorPalette>`}
|
|
88
96
|
);
|
|
89
97
|
}
|
|
90
|
-
`}function
|
|
98
|
+
`}function ne(e,t={}){let a=t.sampleText??`The quick brown fox jumps over the lazy dog`,o=e.filter(e=>e.type===`dimension`&&/(?:font|type|text).*size|size.*(?:font|type|text)/i.test(e.path)).map(e=>{let t=/^(\d+(?:\.\d+)?)/.exec(e.cssValue);return t?Number(t[1]):e.cssValue}),s=[...new Set(o)],c=i(t.fonts,n),l=(c?r(c):void 0)??e.find(e=>e.type===`fontFamily`)?.cssValue??`system-ui, sans-serif`,u=e.find(e=>e.type===`fontWeight`),d=u&&Number.parseFloat(u.cssValue)||400,f=s.length>0?`[${s.map(e=>C(e)).join(`, `)}]`:`[12, 14, 16, 20, 24, 32]`;return`import { Typeset } from "@storybook/addon-docs/blocks";
|
|
91
99
|
|
|
92
100
|
/**
|
|
93
101
|
* Typography tokens rendered with Storybook's Typeset doc block.
|
|
@@ -97,14 +105,14 @@ ${n}
|
|
|
97
105
|
export function TypesetBlock() {
|
|
98
106
|
return (
|
|
99
107
|
<Typeset
|
|
100
|
-
fontFamily={${
|
|
108
|
+
fontFamily={${C(l)}}
|
|
101
109
|
fontSizes={${f}}
|
|
102
|
-
fontWeight={${
|
|
103
|
-
sampleText={${
|
|
110
|
+
fontWeight={${C(d)}}
|
|
111
|
+
sampleText={${C(a)}}
|
|
104
112
|
/>
|
|
105
113
|
);
|
|
106
114
|
}
|
|
107
|
-
`}function
|
|
115
|
+
`}function re(e){return`import type { CSSProperties, ReactElement } from "react";
|
|
108
116
|
|
|
109
117
|
export interface TokenTableRow {
|
|
110
118
|
path: string;
|
|
@@ -116,12 +124,12 @@ export interface TokenTableRow {
|
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
const TOKENS: TokenTableRow[] = [
|
|
119
|
-
${e.map(e=>{let t=e.theme?
|
|
120
|
-
path: ${
|
|
121
|
-
type: ${e.type?
|
|
122
|
-
value: ${
|
|
123
|
-
cssVar: ${
|
|
124
|
-
description: ${e.description?
|
|
127
|
+
${e.map(e=>{let t=e.theme?C(e.theme):`undefined`;return` {
|
|
128
|
+
path: ${C(e.path)},
|
|
129
|
+
type: ${e.type?C(e.type):`undefined`},
|
|
130
|
+
value: ${C(e.cssValue)},
|
|
131
|
+
cssVar: ${C(e.cssVar)},
|
|
132
|
+
description: ${e.description?C(e.description):`undefined`},
|
|
125
133
|
theme: ${t}
|
|
126
134
|
}`}).join(`,
|
|
127
135
|
`)||``}
|
|
@@ -208,7 +216,7 @@ export function TokenTableBlock({
|
|
|
208
216
|
</table>
|
|
209
217
|
);
|
|
210
218
|
}
|
|
211
|
-
`}function
|
|
219
|
+
`}function ie(e){let t=e.titlePrefix??`Design Tokens`,n=e.hasColors?`
|
|
212
220
|
## Colors
|
|
213
221
|
|
|
214
222
|
<ColorPaletteBlock />
|
|
@@ -221,7 +229,7 @@ import { ColorPaletteBlock } from "./blocks/ColorPalette";
|
|
|
221
229
|
import { TokenTableBlock } from "./blocks/TokenTable";
|
|
222
230
|
import { TypesetBlock } from "./blocks/Typeset";
|
|
223
231
|
|
|
224
|
-
<Meta title="${
|
|
232
|
+
<Meta title="${S(t)}/Overview" />
|
|
225
233
|
|
|
226
234
|
# ${t}
|
|
227
235
|
|
|
@@ -230,23 +238,23 @@ ${n}${r}
|
|
|
230
238
|
## All tokens
|
|
231
239
|
|
|
232
240
|
<TokenTableBlock />
|
|
233
|
-
`}function
|
|
241
|
+
`}function ae(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
234
242
|
import { ColorPaletteBlock } from "./blocks/ColorPalette";
|
|
235
243
|
|
|
236
|
-
<Meta title="${
|
|
244
|
+
<Meta title="${S(e.titlePrefix??`Design Tokens`)}/Colors" />
|
|
237
245
|
|
|
238
246
|
# Colors
|
|
239
247
|
|
|
240
248
|
<ColorPaletteBlock />
|
|
241
|
-
`}function
|
|
249
|
+
`}function oe(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
242
250
|
import { TypesetBlock } from "./blocks/Typeset";
|
|
243
251
|
|
|
244
|
-
<Meta title="${
|
|
252
|
+
<Meta title="${S(e.titlePrefix??`Design Tokens`)}/Typography" />
|
|
245
253
|
|
|
246
254
|
# Typography
|
|
247
255
|
|
|
248
256
|
<TypesetBlock />
|
|
249
|
-
`}function
|
|
257
|
+
`}function O(e,t){let n=e[t];return typeof n==`string`?n:void 0}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return`import { IconGallery, IconItem } from "@storybook/addon-docs/blocks";
|
|
250
258
|
|
|
251
259
|
/**
|
|
252
260
|
* Icons rendered with Storybook's IconGallery doc block.
|
|
@@ -256,30 +264,30 @@ import { TypesetBlock } from "./blocks/Typeset";
|
|
|
256
264
|
export function IconGalleryBlock() {
|
|
257
265
|
return (
|
|
258
266
|
<IconGallery>
|
|
259
|
-
${(
|
|
267
|
+
${(k(e)?Object.values(e).filter(k).toSorted((e,t)=>(O(e,`name`)??``).localeCompare(O(t,`name`)??``)):[]).map(e=>{let t=O(e,`name`)??`unknown`,n=(Array.isArray(e.files)?e.files:[]).find(e=>k(e)&&O(e,`type`)===`svg`&&typeof e.content==`string`),r=k(n)&&typeof n.content==`string`?`<span
|
|
260
268
|
style={{ display: "inline-flex", width: 24, height: 24 }}
|
|
261
|
-
dangerouslySetInnerHTML={{ __html: ${
|
|
262
|
-
/>`:`<code>${
|
|
269
|
+
dangerouslySetInnerHTML={{ __html: ${C(n.content)} }}
|
|
270
|
+
/>`:`<code>${S(t)}</code>`;return` <IconItem name={${C(t)}}>
|
|
263
271
|
${r}
|
|
264
272
|
</IconItem>`}).join(`
|
|
265
273
|
`)||` {/* No icons */}`}
|
|
266
274
|
</IconGallery>
|
|
267
275
|
);
|
|
268
276
|
}
|
|
269
|
-
`}function
|
|
277
|
+
`}function j(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
270
278
|
import { IconGalleryBlock } from "./blocks/IconGallery";
|
|
271
279
|
|
|
272
|
-
<Meta title="${
|
|
280
|
+
<Meta title="${S(e.titlePrefix??`Design Tokens`)}/Icons" />
|
|
273
281
|
|
|
274
282
|
# Icons
|
|
275
283
|
|
|
276
284
|
<IconGalleryBlock />
|
|
277
|
-
`}function
|
|
285
|
+
`}function M(){return`export { ColorPaletteBlock } from "./ColorPalette";
|
|
278
286
|
export { IconGalleryBlock } from "./IconGallery";
|
|
279
287
|
export { TokenTableBlock } from "./TokenTable";
|
|
280
288
|
export type { TokenTableBlockProps, TokenTableRow } from "./TokenTable";
|
|
281
289
|
export { TypesetBlock } from "./Typeset";
|
|
282
|
-
`}const
|
|
290
|
+
`}const N=new Set(`base.colorPrimary.colorSecondary.appBg.appContentBg.appHoverBg.appPreviewBg.appBorderColor.appBorderRadius.fontBase.fontCode.textColor.textInverseColor.textMutedColor.barTextColor.barHoverColor.barSelectedColor.barBg.buttonBg.buttonBorder.booleanBg.booleanSelectedBg.inputBg.inputBorder.inputTextColor.inputBorderRadius.brandTitle.brandUrl.brandImage.brandTarget.gridCellSize`.split(`.`));function P(e){return k(e)?e.base===`light`||e.base===`dark`:!1}function F(e){return k(e)?P(e)?!0:Object.keys(e).some(e=>N.has(e)):!1}function I(e){if(!k(e)||F(e))return!1;let t=Object.values(e);return t.length>0&&t.every(F)}function L(e,t,n){return t.base===`light`||t.base===`dark`?t.base:`${e} ${n??``}`.toLowerCase().includes(`light`)?`light`:`dark`}function R(e){return/^[a-z_$][\w$]*$/i.test(e)?e:C(e)}function z(e,t){let n=e.find(e=>e.id===a);return!n||u(t.id)?t.tokens:f(t.tokens,n.tokens)}const B=/^\{([^{}]+)\}$/;function V(e){if(typeof e==`string`)return B.exec(e.trim())?.[1]?.trim()}function H(e){return k(e)&&`$value`in e&&!(`colorSpace`in e)&&!(`hex`in e)?e.$value:e}function U(e,t){let n=H(e),r=new Set;for(let e=0;e<8;e++){let e=V(n);if(!e||r.has(e))break;r.add(e);let i=t.get(e);if(!i)break;n=i.value}return n}function W(e){return e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:c(e)}function G(e,t){let n=p(e),r=n.find(e=>e.id===t)??(n.length===1?n[0]:void 0),i=r?z(n,r):e,a=new Map;for(let e of x(i))(!a.get(e.path)||e.theme===t)&&a.set(e.path,e);return a}function K(e,t){let n={...e};for(let[r,i]of Object.entries(e))r!==`base`&&i!==void 0&&(n[r]=W(U(i,t)));return n}function se(e,t,n,r,i){let a=K(t,G(i.tokens,e));return q(L(e,a,i.theme),a,n,r)}function q(e,a,o,s){let c=i(s,n),l=i(s,t);return{brandTarget:`_blank`,base:e||`light`,...a,brandTitle:a.brandTitle??o.title,brandUrl:a.brandUrl??o.homepage,brandImage:a.brandImage??o.logo,fontBase:a.fontBase??(c?r(c):void 0),fontCode:a.fontCode??(l?r(l):void 0)}}function J(e,t=``){return`create({\n${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,n])=>`${t} ${e}: ${C(n)}`).join(`,
|
|
283
291
|
`)}\n${t}})`}function Y(e){return`import { create } from "storybook/theming";
|
|
284
292
|
|
|
285
293
|
/**
|
|
@@ -296,8 +304,8 @@ export default ${J(e)};
|
|
|
296
304
|
* @see https://storybook.js.org/docs/configure/user-interface/theming
|
|
297
305
|
*/
|
|
298
306
|
export default {
|
|
299
|
-
${Object.entries(e).map(([e,t])=>` ${
|
|
307
|
+
${Object.entries(e).map(([e,t])=>` ${R(e)}: ${J(t,` `)}`).join(`,
|
|
300
308
|
`)}
|
|
301
309
|
};
|
|
302
|
-
`}function Z(e){if(
|
|
310
|
+
`}function Z(e){if(P(e))return Y(e);let t=Object.entries(e);if(t.length!==1)return X(e);let[,n]=t[0]??[];return n?Y(n):X(e)}function Q(e,t,n,r){let i=(e,r)=>se(e,r,n,t.fonts,t);if(I(e))return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,i(e,t)]));let a=p(t.tokens),o=a.filter(e=>!u(e.id));if(o.length>1){let e={};for(let t of o){let n=r(z(a,t));if(I(n)){let r=n[t.id];if(r){e[t.id]=i(t.id,r);continue}for(let[t,r]of Object.entries(n))e[t]=i(t,r);continue}F(n)&&(e[t.id]=i(t.id,n))}return e}if(F(e)){let n=o[0]&&o[0].id!=="default"?o[0].id:t.theme??`default`;return{[n]:i(n,e)}}return{}}const ce=e=>(t,n,r)=>o(g(e,t),n,{name:`razorwind-storybook`},!1,r);function $(e,t={}){let n=t.outputPath??`storybook/tokens`,r=ee(e),i=t.titlePrefix??r.title??`Design Tokens`,a={...t,titlePrefix:i},o=x(e.tokens,t),s=o.some(e=>e.type===`color`),c=e.fonts&&Object.keys(e.fonts).length>0||o.some(e=>e.type===`fontFamily`||e.type===`fontWeight`||e.type===`typography`||e.type===`dimension`&&/(?:font|type|text).*size|size.*(?:font|type|text)/i.test(e.path)),l=!t.skipIcons&&k(e.icons)&&Object.keys(e.icons).length>0,u=ce(n),d={[g(n,`blocks/ColorPalette.tsx`)]:u(`blocks/ColorPalette.tsx`,D(o,a),`tsx`),[g(n,`blocks/Typeset.tsx`)]:u(`blocks/Typeset.tsx`,ne(o,{...a,fonts:e.fonts}),`tsx`),[g(n,`blocks/TokenTable.tsx`)]:u(`blocks/TokenTable.tsx`,re(o),`tsx`),[g(n,`blocks/IconGallery.tsx`)]:u(`blocks/IconGallery.tsx`,A(t.skipIcons?{}:e.icons),`tsx`),[g(n,`blocks/index.ts`)]:u(`blocks/index.ts`,M(),`typescript`),[g(n,`Tokens.mdx`)]:u(`Tokens.mdx`,ie({titlePrefix:i,hasColors:s,hasTypography:c}),`mdx`)};s&&(d[g(n,`Colors.mdx`)]=u(`Colors.mdx`,ae(a),`mdx`)),c&&(d[g(n,`Typography.mdx`)]=u(`Typography.mdx`,oe(a),`mdx`)),l&&(d[g(n,`Icons.mdx`)]=u(`Icons.mdx`,j(a),`mdx`)),d[g(n,`tokens.json`)]=u(`tokens.json`,`${JSON.stringify(o,null,2)}\n`,`json`);let f;if(t.mapTheme){let i=Q(t.mapTheme(e.tokens),e,r,t.mapTheme);Object.keys(i).length>0&&(f=Object.keys(i),d[g(n,`theme.ts`)]=u(`theme.ts`,Z(i),`typescript`))}let p=`INSTALL.md`;return d[g(n,p)]=u(p,t.installGuide??w({outputPath:n,titlePrefix:i,themeFiles:f?[`theme.ts`]:void 0,themeNames:f}),`markdown`),d}var le=e(e=>({name:`storybook`,themeGeneration:`combined`,generate:async t=>$(t,e??{})}));export{q as applyBrandDefaults,le as default,x as flattenTokens,c as formatTokenValue,$ as generateTokenDocs,Q as normalizeThemes,w as renderInstallMd,Z as renderThemeFile,p as resolveTokenSets,m as toCssVar};
|
|
303
311
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/storybook",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that creates Storybook MDX token doc blocks from Razorwind design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"types": "./dist/index.d.cts",
|
|
84
84
|
"typings": "dist/index.d.mts",
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@power-plant/core": "^0.0.
|
|
86
|
+
"@power-plant/core": "^0.0.92",
|
|
87
87
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
88
|
-
"@razorwind/core": "^0.0.
|
|
89
|
-
"@stryke/path": "^0.29.
|
|
90
|
-
"@stryke/type-checks": "^0.6.
|
|
88
|
+
"@razorwind/core": "^0.0.63",
|
|
89
|
+
"@stryke/path": "^0.29.41",
|
|
90
|
+
"@stryke/type-checks": "^0.6.47"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@storybook/addon-docs": ">=8",
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
"storybook": { "optional": true }
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
104
|
-
"@stryke/types": "^0.12.
|
|
103
|
+
"@powerlines/plugin-tsdown": "^0.1.613",
|
|
104
|
+
"@stryke/types": "^0.12.42",
|
|
105
105
|
"@types/node": "^25.9.5",
|
|
106
106
|
"typescript": "^6.0.3"
|
|
107
107
|
},
|
|
108
108
|
"publishConfig": { "access": "public" },
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "574cc85598a992425f1b5fc361c5e48dc8aa4eb9"
|
|
110
110
|
}
|