@razorwind/storybook 0.0.30 → 0.0.31
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 +2 -2
- package/dist/index.d.cts +9 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.mjs +33 -33
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -264,7 +264,7 @@ export { IconGalleryBlock } from "./IconGallery";
|
|
|
264
264
|
export { TokenTableBlock } from "./TokenTable";
|
|
265
265
|
export type { TokenTableBlockProps, TokenTableRow } from "./TokenTable";
|
|
266
266
|
export { TypesetBlock } from "./Typeset";
|
|
267
|
-
`}function b(e){return`import { create } from "storybook/theming";
|
|
267
|
+
`}function b(e){return g(e)?e.base===`light`||e.base===`dark`:!1}function x(e,t){return{...e,brandTitle:e.brandTitle??t.title,brandUrl:e.brandUrl??t.homepage,brandImage:e.brandImage??t.logo}}function S(e){return`import { create } from "storybook/theming";
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
270
|
* Storybook UI theme generated by \`@razorwind/storybook\`.
|
|
@@ -275,4 +275,4 @@ export default create({
|
|
|
275
275
|
${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}: ${a(t)}`).join(`,
|
|
276
276
|
`)}
|
|
277
277
|
});
|
|
278
|
-
`}function
|
|
278
|
+
`}function C(e,n,r){return(0,t.createDocument)(e,n,{name:`razorwind-storybook`},r)}function w(e,i={}){let a=i.outputPath??`storybook/tokens`,s=(0,t.resolveSchemaIdentity)(e),c=i.titlePrefix??s.title??`Design Tokens`,h={...i,titlePrefix:c},w=r(e.tokens,i),T=w.some(e=>e.type===`color`),E=w.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)),D=!i.skipIcons&&g(e.icons)&&Object.keys(e.icons).length>0,O={[(0,n.join)(a,`blocks/ColorPalette.tsx`)]:C((0,n.join)(a,`blocks/ColorPalette.tsx`),l(w,h),`tsx`),[(0,n.join)(a,`blocks/Typeset.tsx`)]:C((0,n.join)(a,`blocks/Typeset.tsx`),u(w,h),`tsx`),[(0,n.join)(a,`blocks/TokenTable.tsx`)]:C((0,n.join)(a,`blocks/TokenTable.tsx`),d(w),`tsx`),[(0,n.join)(a,`blocks/IconGallery.tsx`)]:C((0,n.join)(a,`blocks/IconGallery.tsx`),_(i.skipIcons?{}:e.icons),`tsx`),[(0,n.join)(a,`blocks/index.ts`)]:C((0,n.join)(a,`blocks/index.ts`),y(),`typescript`),[(0,n.join)(a,`Tokens.mdx`)]:C((0,n.join)(a,`Tokens.mdx`),f({titlePrefix:c,hasColors:T,hasTypography:E}),`mdx`)};if(T&&(O[(0,n.join)(a,`Colors.mdx`)]=C((0,n.join)(a,`Colors.mdx`),p(h),`mdx`)),E&&(O[(0,n.join)(a,`Typography.mdx`)]=C((0,n.join)(a,`Typography.mdx`),m(h),`mdx`)),D&&(O[(0,n.join)(a,`Icons.mdx`)]=C((0,n.join)(a,`Icons.mdx`),v(h),`mdx`)),O[(0,n.join)(a,`tokens.json`)]=C((0,n.join)(a,`tokens.json`),`${JSON.stringify(w,null,2)}\n`,`json`),i.mapTheme){let t=i.mapTheme(e.tokens);if(b(t))O[(0,n.join)(a,`theme.ts`)]=C((0,n.join)(a,`theme.ts`),S(x(t,s)),`typescript`);else if(g(t))for(let[e,r]of Object.entries(t))b(r)&&(O[(0,n.join)(a,`theme-${e}.ts`)]=C((0,n.join)(a,`theme-${e}.ts`),S(x(r,s)),`typescript`))}let k=Object.keys(O).filter(e=>e.startsWith((0,n.join)(a,`theme`))).map(e=>e.slice(a.length+1)),A=i.installGuide??o({outputPath:a,titlePrefix:c,themeFiles:k.length>0?k:void 0}),j=(0,n.join)(a,`INSTALL.md`);return O[j]=C(j,A,`markdown`),O}var T=(0,e.definePlugin)(e=>({name:`storybook`,generate:async t=>w(t,e??{})}));exports.applyBrandDefaults=x,exports.default=T,exports.flattenTokens=r,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTokenDocs=w,exports.renderInstallMd=o,exports.renderThemeFile=S,exports.resolveTokenSets=t.resolveTokenSets,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}});
|
package/dist/index.d.cts
CHANGED
|
@@ -148,6 +148,14 @@ declare function renderInstallMd(options: {
|
|
|
148
148
|
}): string;
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/generate.d.ts
|
|
151
|
+
/**
|
|
152
|
+
* Fill Storybook brand fields from Schema identity when the mapped theme omits them.
|
|
153
|
+
*/
|
|
154
|
+
declare function applyBrandDefaults(theme: StorybookTheme, identity: {
|
|
155
|
+
title?: string;
|
|
156
|
+
homepage?: string;
|
|
157
|
+
logo?: string;
|
|
158
|
+
}): StorybookTheme;
|
|
151
159
|
/**
|
|
152
160
|
* Serialize a Storybook theme object as a `storybook/theming` `create()` module.
|
|
153
161
|
*
|
|
@@ -188,5 +196,5 @@ declare function generateTokenDocs(spec: Schema, options?: StorybookPluginOption
|
|
|
188
196
|
*/
|
|
189
197
|
declare const _default: (options?: StorybookPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
190
198
|
//#endregion
|
|
191
|
-
export { type FlatToken, type GenerateStorybookTheme, type StorybookPluginOptions, type StorybookTheme, _default as default, flattenTokens, formatTokenValue, generateTokenDocs, renderInstallMd, renderThemeFile, resolveTokenSets, toCssVar };
|
|
199
|
+
export { type FlatToken, type GenerateStorybookTheme, type StorybookPluginOptions, type StorybookTheme, applyBrandDefaults, _default as default, flattenTokens, formatTokenValue, generateTokenDocs, renderInstallMd, renderThemeFile, resolveTokenSets, toCssVar };
|
|
192
200
|
//# sourceMappingURL=index.d.cts.map
|
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":";;;;;;;;UAuBiB;;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,uBACV,iBAAiB,eAAe;;;;;;KAOtB,0BACV,QAAQ,SAAS,eAAe,YAC7B;;;;UAKY;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;;;;;EAUA,WAAW;;;;;;EAOX;;;;;EAMA;;;;;;;iBC7Hc,cACd,QAAQ,WAAS,eAAe,WAChC,UAAS,KAAK,2DACb;;;;;;;;iBCba,gBAAgB;EAC9B;EACA;EACA
|
|
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":";;;;;;;;UAuBiB;;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,uBACV,iBAAiB,eAAe;;;;;;KAOtB,0BACV,QAAQ,SAAS,eAAe,YAC7B;;;;UAKY;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;;;;;EAUA,WAAW;;;;;;EAOX;;;;;EAMA;;;;;;;iBC7Hc,cACd,QAAQ,WAAS,eAAe,WAChC,UAAS,KAAK,2DACb;;;;;;;;iBCba,gBAAgB;EAC9B;EACA;EACA;;;;;;;iBC+bc,mBACd,OAAO,gBACP;EAAY;EAAgB;EAAmB;IAC9C;;;;;;iBAca,gBAAgB,OAAO;;;;iBAqCvB,kBACd,MAAM,QACN,UAAS,yBACR,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
CHANGED
|
@@ -148,6 +148,14 @@ declare function renderInstallMd(options: {
|
|
|
148
148
|
}): string;
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/generate.d.ts
|
|
151
|
+
/**
|
|
152
|
+
* Fill Storybook brand fields from Schema identity when the mapped theme omits them.
|
|
153
|
+
*/
|
|
154
|
+
declare function applyBrandDefaults(theme: StorybookTheme, identity: {
|
|
155
|
+
title?: string;
|
|
156
|
+
homepage?: string;
|
|
157
|
+
logo?: string;
|
|
158
|
+
}): StorybookTheme;
|
|
151
159
|
/**
|
|
152
160
|
* Serialize a Storybook theme object as a `storybook/theming` `create()` module.
|
|
153
161
|
*
|
|
@@ -188,5 +196,5 @@ declare function generateTokenDocs(spec: Schema, options?: StorybookPluginOption
|
|
|
188
196
|
*/
|
|
189
197
|
declare const _default: (options?: StorybookPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
190
198
|
//#endregion
|
|
191
|
-
export { type FlatToken, type GenerateStorybookTheme, type StorybookPluginOptions, type StorybookTheme, _default as default, flattenTokens, formatTokenValue, generateTokenDocs, renderInstallMd, renderThemeFile, resolveTokenSets, toCssVar };
|
|
199
|
+
export { type FlatToken, type GenerateStorybookTheme, type StorybookPluginOptions, type StorybookTheme, applyBrandDefaults, _default as default, flattenTokens, formatTokenValue, generateTokenDocs, renderInstallMd, renderThemeFile, resolveTokenSets, toCssVar };
|
|
192
200
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,
|
|
2
|
-
`,`\\n`).replaceAll(`\r`,`\\r`)}function
|
|
1
|
+
import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,resolveSchemaIdentity as i,resolveTokenSets as a,toCssVar as o,toCssVar as s}from"@razorwind/core/utils";import{join as c}from"node:path";function l(e,t={}){let r=t.cssVarPrefix??`rw`;return n(e,{includeTypes:t.includeTypes,enrichToken:e=>({...e,cssVar:s(e.path,r)})})}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&&e.themeFiles.length>0?`
|
|
3
3
|
## Storybook UI theme
|
|
4
4
|
|
|
5
5
|
Generated theme module(s):
|
|
@@ -50,7 +50,7 @@ import { ColorPaletteBlock } from "./blocks";
|
|
|
50
50
|
## Regenerate
|
|
51
51
|
|
|
52
52
|
Re-run Razorwind generate when tokens change to refresh docs under \`${e.outputPath}/\`.
|
|
53
|
-
`}function
|
|
53
|
+
`}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={}){return`import { ColorPalette, ColorItem } from "@storybook/addon-docs/blocks";
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Color tokens rendered with Storybook's ColorPalette doc block.
|
|
@@ -60,10 +60,10 @@ Re-run Razorwind generate when tokens change to refresh docs under \`${e.outputP
|
|
|
60
60
|
export function ColorPaletteBlock() {
|
|
61
61
|
return (
|
|
62
62
|
<ColorPalette>
|
|
63
|
-
${[...
|
|
63
|
+
${[...p(e.filter(e=>e.type===`color`),t.colorGroupBy??2).entries()].toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>{let n=t.map(t=>` ${d(m(t.path,e))}: ${d(t.cssValue)}`).join(`,
|
|
64
64
|
`),r=t.find(e=>e.description)?.description??`${t.length} token${t.length===1?``:`s`}`;return` <ColorItem
|
|
65
|
-
title={${
|
|
66
|
-
subtitle={${
|
|
65
|
+
title={${d(e)}}
|
|
66
|
+
subtitle={${d(r)}}
|
|
67
67
|
colors={{
|
|
68
68
|
${n}
|
|
69
69
|
}}
|
|
@@ -72,7 +72,7 @@ ${n}
|
|
|
72
72
|
</ColorPalette>
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
|
-
`}function
|
|
75
|
+
`}function g(e,t={}){let n=t.sampleText??`The quick brown fox jumps over the lazy dog`,r=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}),i=[...new Set(r)],a=e.find(e=>e.type===`fontFamily`)?.cssValue??`system-ui, sans-serif`,o=e.find(e=>e.type===`fontWeight`),s=o&&Number.parseFloat(o.cssValue)||400,c=i.length>0?`[${i.map(e=>d(e)).join(`, `)}]`:`[12, 14, 16, 20, 24, 32]`;return`import { Typeset } from "@storybook/addon-docs/blocks";
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Typography tokens rendered with Storybook's Typeset doc block.
|
|
@@ -82,14 +82,14 @@ ${n}
|
|
|
82
82
|
export function TypesetBlock() {
|
|
83
83
|
return (
|
|
84
84
|
<Typeset
|
|
85
|
-
fontFamily={${
|
|
85
|
+
fontFamily={${d(a)}}
|
|
86
86
|
fontSizes={${c}}
|
|
87
|
-
fontWeight={${
|
|
88
|
-
sampleText={${
|
|
87
|
+
fontWeight={${d(s)}}
|
|
88
|
+
sampleText={${d(n)}}
|
|
89
89
|
/>
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
|
-
`}function
|
|
92
|
+
`}function _(e){return`import type { CSSProperties, ReactElement } from "react";
|
|
93
93
|
|
|
94
94
|
export interface TokenTableRow {
|
|
95
95
|
path: string;
|
|
@@ -101,12 +101,12 @@ export interface TokenTableRow {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const TOKENS: TokenTableRow[] = [
|
|
104
|
-
${e.map(e=>{let t=e.theme?
|
|
105
|
-
path: ${
|
|
106
|
-
type: ${e.type?
|
|
107
|
-
value: ${
|
|
108
|
-
cssVar: ${
|
|
109
|
-
description: ${e.description?
|
|
104
|
+
${e.map(e=>{let t=e.theme?d(e.theme):`undefined`;return` {
|
|
105
|
+
path: ${d(e.path)},
|
|
106
|
+
type: ${e.type?d(e.type):`undefined`},
|
|
107
|
+
value: ${d(e.cssValue)},
|
|
108
|
+
cssVar: ${d(e.cssVar)},
|
|
109
|
+
description: ${e.description?d(e.description):`undefined`},
|
|
110
110
|
theme: ${t}
|
|
111
111
|
}`}).join(`,
|
|
112
112
|
`)||``}
|
|
@@ -193,7 +193,7 @@ export function TokenTableBlock({
|
|
|
193
193
|
</table>
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
|
-
`}function
|
|
196
|
+
`}function v(e){let t=e.titlePrefix??`Design Tokens`,n=e.hasColors?`
|
|
197
197
|
## Colors
|
|
198
198
|
|
|
199
199
|
<ColorPaletteBlock />
|
|
@@ -206,7 +206,7 @@ import { ColorPaletteBlock } from "./blocks/ColorPalette";
|
|
|
206
206
|
import { TokenTableBlock } from "./blocks/TokenTable";
|
|
207
207
|
import { TypesetBlock } from "./blocks/Typeset";
|
|
208
208
|
|
|
209
|
-
<Meta title="${
|
|
209
|
+
<Meta title="${u(t)}/Overview" />
|
|
210
210
|
|
|
211
211
|
# ${t}
|
|
212
212
|
|
|
@@ -215,23 +215,23 @@ ${n}${r}
|
|
|
215
215
|
## All tokens
|
|
216
216
|
|
|
217
217
|
<TokenTableBlock />
|
|
218
|
-
`}function
|
|
218
|
+
`}function y(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
219
219
|
import { ColorPaletteBlock } from "./blocks/ColorPalette";
|
|
220
220
|
|
|
221
|
-
<Meta title="${
|
|
221
|
+
<Meta title="${u(e.titlePrefix??`Design Tokens`)}/Colors" />
|
|
222
222
|
|
|
223
223
|
# Colors
|
|
224
224
|
|
|
225
225
|
<ColorPaletteBlock />
|
|
226
|
-
`}function
|
|
226
|
+
`}function b(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
227
227
|
import { TypesetBlock } from "./blocks/Typeset";
|
|
228
228
|
|
|
229
|
-
<Meta title="${
|
|
229
|
+
<Meta title="${u(e.titlePrefix??`Design Tokens`)}/Typography" />
|
|
230
230
|
|
|
231
231
|
# Typography
|
|
232
232
|
|
|
233
233
|
<TypesetBlock />
|
|
234
|
-
`}function
|
|
234
|
+
`}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";
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
237
|
* Icons rendered with Storybook's IconGallery doc block.
|
|
@@ -241,30 +241,30 @@ import { TypesetBlock } from "./blocks/Typeset";
|
|
|
241
241
|
export function IconGalleryBlock() {
|
|
242
242
|
return (
|
|
243
243
|
<IconGallery>
|
|
244
|
-
${(
|
|
244
|
+
${(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
|
|
245
245
|
style={{ display: "inline-flex", width: 24, height: 24 }}
|
|
246
|
-
dangerouslySetInnerHTML={{ __html: ${
|
|
247
|
-
/>`:`<code>${
|
|
246
|
+
dangerouslySetInnerHTML={{ __html: ${d(n.content)} }}
|
|
247
|
+
/>`:`<code>${u(t)}</code>`;return` <IconItem name={${d(t)}}>
|
|
248
248
|
${r}
|
|
249
249
|
</IconItem>`}).join(`
|
|
250
250
|
`)||` {/* No icons */}`}
|
|
251
251
|
</IconGallery>
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
|
-
`}function
|
|
254
|
+
`}function w(e={}){return`import { Meta } from "@storybook/addon-docs/blocks";
|
|
255
255
|
import { IconGalleryBlock } from "./blocks/IconGallery";
|
|
256
256
|
|
|
257
|
-
<Meta title="${
|
|
257
|
+
<Meta title="${u(e.titlePrefix??`Design Tokens`)}/Icons" />
|
|
258
258
|
|
|
259
259
|
# Icons
|
|
260
260
|
|
|
261
261
|
<IconGalleryBlock />
|
|
262
|
-
`}function
|
|
262
|
+
`}function T(){return`export { ColorPaletteBlock } from "./ColorPalette";
|
|
263
263
|
export { IconGalleryBlock } from "./IconGallery";
|
|
264
264
|
export { TokenTableBlock } from "./TokenTable";
|
|
265
265
|
export type { TokenTableBlockProps, TokenTableRow } from "./TokenTable";
|
|
266
266
|
export { TypesetBlock } from "./Typeset";
|
|
267
|
-
`}function
|
|
267
|
+
`}function E(e){return S(e)?e.base===`light`||e.base===`dark`:!1}function D(e,t){return{...e,brandTitle:e.brandTitle??t.title,brandUrl:e.brandUrl??t.homepage,brandImage:e.brandImage??t.logo}}function O(e){return`import { create } from "storybook/theming";
|
|
268
268
|
|
|
269
269
|
/**
|
|
270
270
|
* Storybook UI theme generated by \`@razorwind/storybook\`.
|
|
@@ -272,8 +272,8 @@ export { TypesetBlock } from "./Typeset";
|
|
|
272
272
|
* @see https://storybook.js.org/docs/configure/user-interface/theming
|
|
273
273
|
*/
|
|
274
274
|
export default create({
|
|
275
|
-
${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}: ${
|
|
275
|
+
${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}: ${d(t)}`).join(`,
|
|
276
276
|
`)}
|
|
277
277
|
});
|
|
278
|
-
`}function
|
|
278
|
+
`}function k(e,n,r){return t(e,n,{name:`razorwind-storybook`},r)}function A(e,t={}){let n=t.outputPath??`storybook/tokens`,r=i(e),a=t.titlePrefix??r.title??`Design Tokens`,o={...t,titlePrefix:a},s=l(e.tokens,t),u=s.some(e=>e.type===`color`),d=s.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={[c(n,`blocks/ColorPalette.tsx`)]:k(c(n,`blocks/ColorPalette.tsx`),h(s,o),`tsx`),[c(n,`blocks/Typeset.tsx`)]:k(c(n,`blocks/Typeset.tsx`),g(s,o),`tsx`),[c(n,`blocks/TokenTable.tsx`)]:k(c(n,`blocks/TokenTable.tsx`),_(s),`tsx`),[c(n,`blocks/IconGallery.tsx`)]:k(c(n,`blocks/IconGallery.tsx`),C(t.skipIcons?{}:e.icons),`tsx`),[c(n,`blocks/index.ts`)]:k(c(n,`blocks/index.ts`),T(),`typescript`),[c(n,`Tokens.mdx`)]:k(c(n,`Tokens.mdx`),v({titlePrefix:a,hasColors:u,hasTypography:d}),`mdx`)};if(u&&(m[c(n,`Colors.mdx`)]=k(c(n,`Colors.mdx`),y(o),`mdx`)),d&&(m[c(n,`Typography.mdx`)]=k(c(n,`Typography.mdx`),b(o),`mdx`)),p&&(m[c(n,`Icons.mdx`)]=k(c(n,`Icons.mdx`),w(o),`mdx`)),m[c(n,`tokens.json`)]=k(c(n,`tokens.json`),`${JSON.stringify(s,null,2)}\n`,`json`),t.mapTheme){let i=t.mapTheme(e.tokens);if(E(i))m[c(n,`theme.ts`)]=k(c(n,`theme.ts`),O(D(i,r)),`typescript`);else if(S(i))for(let[e,t]of Object.entries(i))E(t)&&(m[c(n,`theme-${e}.ts`)]=k(c(n,`theme-${e}.ts`),O(D(t,r)),`typescript`))}let x=Object.keys(m).filter(e=>e.startsWith(c(n,`theme`))).map(e=>e.slice(n.length+1)),A=t.installGuide??f({outputPath:n,titlePrefix:a,themeFiles:x.length>0?x:void 0}),j=c(n,`INSTALL.md`);return m[j]=k(j,A,`markdown`),m}var j=e(e=>({name:`storybook`,generate:async t=>A(t,e??{})}));export{D as applyBrandDefaults,j as default,l as flattenTokens,r as formatTokenValue,A as generateTokenDocs,f as renderInstallMd,O as renderThemeFile,a as resolveTokenSets,o as toCssVar};
|
|
279
279
|
//# 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.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that creates Storybook MDX token doc blocks from Razorwind design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"@power-plant/core": "^0.0.81",
|
|
87
87
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
88
|
-
"@razorwind/core": "0.0.
|
|
88
|
+
"@razorwind/core": "0.0.34",
|
|
89
89
|
"@stryke/type-checks": "^0.6.35"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"typescript": "^6.0.3"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": { "access": "public" },
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "2e9d53ceff13e46fdd225eff5f9ac32bc661814a"
|
|
108
108
|
}
|