@razorwind/storybook 0.0.20 → 0.0.22

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 CHANGED
@@ -195,4 +195,4 @@ export default create({
195
195
  ${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}: ${i(t)}`).join(`,
196
196
  `)}
197
197
  });
198
- `}function C(e,n,r){return(0,t.createDocument)(e,n,{name:`razorwind-storybook`},r)}function w(e,t={}){let r=t.outputPath??`storybook/tokens`,i=f(e.tokens,t),a=i.some(e=>e.type===`color`),o=i.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)),s={[(0,n.join)(r,`blocks/ColorPalette.tsx`)]:C((0,n.join)(r,`blocks/ColorPalette.tsx`),h(i,t),`tsx`),[(0,n.join)(r,`blocks/Typeset.tsx`)]:C((0,n.join)(r,`blocks/Typeset.tsx`),g(i,t),`tsx`),[(0,n.join)(r,`blocks/TokenTable.tsx`)]:C((0,n.join)(r,`blocks/TokenTable.tsx`),_(i),`tsx`),[(0,n.join)(r,`blocks/index.ts`)]:C((0,n.join)(r,`blocks/index.ts`),x(),`typescript`),[(0,n.join)(r,`Tokens.mdx`)]:C((0,n.join)(r,`Tokens.mdx`),v({titlePrefix:t.titlePrefix,hasColors:a,hasTypography:o}),`mdx`)};if(a&&(s[(0,n.join)(r,`Colors.mdx`)]=C((0,n.join)(r,`Colors.mdx`),y(t),`mdx`)),o&&(s[(0,n.join)(r,`Typography.mdx`)]=C((0,n.join)(r,`Typography.mdx`),b(t),`mdx`)),s[(0,n.join)(r,`tokens.json`)]=C((0,n.join)(r,`tokens.json`),`${JSON.stringify(i,null,2)}\n`,`json`),t.generateTheme){let e=t.generateTheme(i);s[(0,n.join)(r,`theme.ts`)]=C((0,n.join)(r,`theme.ts`),S(e),`typescript`)}return s}var T=(0,e.definePlugin)(e=>({name:`storybook`,generate:async t=>w(t,e??{})}));exports.default=T,exports.flattenTokens=f,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTokenDocs=w,exports.renderThemeFile=S,exports.resolveTokenSets=d,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}});
198
+ `}function C(e,n,r){return(0,t.createDocument)(e,n,{name:`razorwind-storybook`},r)}function w(e,t={}){let r=t.outputPath??`storybook/tokens`,i=f(e.tokens,t),a=i.some(e=>e.type===`color`),o=i.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)),s={[(0,n.join)(r,`blocks/ColorPalette.tsx`)]:C((0,n.join)(r,`blocks/ColorPalette.tsx`),h(i,t),`tsx`),[(0,n.join)(r,`blocks/Typeset.tsx`)]:C((0,n.join)(r,`blocks/Typeset.tsx`),g(i,t),`tsx`),[(0,n.join)(r,`blocks/TokenTable.tsx`)]:C((0,n.join)(r,`blocks/TokenTable.tsx`),_(i),`tsx`),[(0,n.join)(r,`blocks/index.ts`)]:C((0,n.join)(r,`blocks/index.ts`),x(),`typescript`),[(0,n.join)(r,`Tokens.mdx`)]:C((0,n.join)(r,`Tokens.mdx`),v({titlePrefix:t.titlePrefix,hasColors:a,hasTypography:o}),`mdx`)};if(a&&(s[(0,n.join)(r,`Colors.mdx`)]=C((0,n.join)(r,`Colors.mdx`),y(t),`mdx`)),o&&(s[(0,n.join)(r,`Typography.mdx`)]=C((0,n.join)(r,`Typography.mdx`),b(t),`mdx`)),s[(0,n.join)(r,`tokens.json`)]=C((0,n.join)(r,`tokens.json`),`${JSON.stringify(i,null,2)}\n`,`json`),t.generateTheme){let i=t.generateTheme(e.tokens);if(typeof i==`object`&&i)for(let[e,t]of Object.entries(i))s[(0,n.join)(r,`theme-${e}.ts`)]=C((0,n.join)(r,`theme-${e}.ts`),S(t),`typescript`);else s[(0,n.join)(r,`theme.ts`)]=C((0,n.join)(r,`theme.ts`),S(i),`typescript`)}return s}var T=(0,e.definePlugin)(e=>({name:`storybook`,generate:async t=>w(t,e??{})}));exports.default=T,exports.flattenTokens=f,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateTokenDocs=w,exports.renderThemeFile=S,exports.resolveTokenSets=d,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { TokenType } from "@power-plant/dtcg-schema";
2
- import { Schema, Tokens } from "@razorwind/core/schema";
1
+ import { TokenType, Tokens } from "@power-plant/dtcg-schema";
2
+ import { Schema, Tokens as Tokens$1 } from "@razorwind/core/schema";
3
3
  import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
4
4
  import { GeneratorFunctionResult } from "@power-plant/core";
5
5
  //#region src/types.d.ts
@@ -61,12 +61,13 @@ interface StorybookTheme {
61
61
  brandTarget?: string;
62
62
  gridCellSize?: number;
63
63
  }
64
+ type StorybookThemeResult = StorybookTheme | Record<string, StorybookTheme>;
64
65
  /**
65
66
  * Map flattened design tokens to a Storybook theme object.
66
67
  *
67
68
  * @see https://storybook.js.org/docs/configure/user-interface/theming
68
69
  */
69
- type GenerateStorybookTheme = (tokens: FlatToken[]) => StorybookTheme;
70
+ type GenerateStorybookTheme = (tokens: Tokens | Record<string, Tokens>) => StorybookThemeResult;
70
71
  /**
71
72
  * Options for the Razorwind Storybook token docs generator.
72
73
  */
@@ -120,7 +121,7 @@ interface StorybookPluginOptions {
120
121
  //#region src/flatten.d.ts
121
122
  interface TokenSet {
122
123
  id: string;
123
- tokens: Tokens;
124
+ tokens: Tokens$1;
124
125
  }
125
126
  /**
126
127
  * Split `Schema.tokens` into one or more named token sets.
@@ -128,11 +129,11 @@ interface TokenSet {
128
129
  * A record whose keys all look like themes (`light`, `dark`, …) is treated as
129
130
  * multi-theme input; otherwise the whole document is a single set.
130
131
  */
131
- declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
132
+ declare function resolveTokenSets(tokens: Tokens$1 | Record<string, Tokens$1>): TokenSet[];
132
133
  /**
133
134
  * Flatten DTCG token trees into documentation rows.
134
135
  */
135
- declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<StorybookPluginOptions, "cssVarPrefix" | "includeTypes">): FlatToken[];
136
+ declare function flattenTokens(tokens: Tokens$1 | Record<string, Tokens$1>, options?: Pick<StorybookPluginOptions, "cssVarPrefix" | "includeTypes">): FlatToken[];
136
137
  //#endregion
137
138
  //#region src/generate.d.ts
138
139
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.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;;;;;;;KAQU,0BAA0B,QAAQ,gBAAgB;;;;UAK7C;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;;;;;EAUA,gBAAgB;;;;UChCD;EACf;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAuBa,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,2DACb;;;;;;;;iBCyOa,gBAAgB,OAAO;;;;iBAmCvB,kBACd,MAAM,QACN,UAAS,yBACR,wBAAwB,QAAQ"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.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,gBAAgB;;;;UCrCD;EACf;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,WAAS,eAAe,YAC/B;;;;iBAwBa,cACd,QAAQ,WAAS,eAAe,WAChC,UAAS,KAAK,2DACb;;;;;;;;iBCwOa,gBAAgB,OAAO;;;;iBAmCvB,kBACd,MAAM,QACN,UAAS,yBACR,wBAAwB,QAAQ"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
2
- import { TokenType } from "@power-plant/dtcg-schema";
3
- import { Schema, Tokens } from "@razorwind/core/schema";
2
+ import { TokenType, Tokens } from "@power-plant/dtcg-schema";
3
+ import { Schema, Tokens as Tokens$1 } from "@razorwind/core/schema";
4
4
  import { GeneratorFunctionResult } from "@power-plant/core";
5
5
  //#region src/types.d.ts
6
6
  /**
@@ -61,12 +61,13 @@ interface StorybookTheme {
61
61
  brandTarget?: string;
62
62
  gridCellSize?: number;
63
63
  }
64
+ type StorybookThemeResult = StorybookTheme | Record<string, StorybookTheme>;
64
65
  /**
65
66
  * Map flattened design tokens to a Storybook theme object.
66
67
  *
67
68
  * @see https://storybook.js.org/docs/configure/user-interface/theming
68
69
  */
69
- type GenerateStorybookTheme = (tokens: FlatToken[]) => StorybookTheme;
70
+ type GenerateStorybookTheme = (tokens: Tokens | Record<string, Tokens>) => StorybookThemeResult;
70
71
  /**
71
72
  * Options for the Razorwind Storybook token docs generator.
72
73
  */
@@ -120,7 +121,7 @@ interface StorybookPluginOptions {
120
121
  //#region src/flatten.d.ts
121
122
  interface TokenSet {
122
123
  id: string;
123
- tokens: Tokens;
124
+ tokens: Tokens$1;
124
125
  }
125
126
  /**
126
127
  * Split `Schema.tokens` into one or more named token sets.
@@ -128,11 +129,11 @@ interface TokenSet {
128
129
  * A record whose keys all look like themes (`light`, `dark`, …) is treated as
129
130
  * multi-theme input; otherwise the whole document is a single set.
130
131
  */
131
- declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
132
+ declare function resolveTokenSets(tokens: Tokens$1 | Record<string, Tokens$1>): TokenSet[];
132
133
  /**
133
134
  * Flatten DTCG token trees into documentation rows.
134
135
  */
135
- declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<StorybookPluginOptions, "cssVarPrefix" | "includeTypes">): FlatToken[];
136
+ declare function flattenTokens(tokens: Tokens$1 | Record<string, Tokens$1>, options?: Pick<StorybookPluginOptions, "cssVarPrefix" | "includeTypes">): FlatToken[];
136
137
  //#endregion
137
138
  //#region src/generate.d.ts
138
139
  /**
package/dist/index.mjs CHANGED
@@ -195,5 +195,5 @@ export default create({
195
195
  ${Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>` ${e}: ${s(t)}`).join(`,
196
196
  `)}
197
197
  });
198
- `}function E(e,n,r){return t(e,n,{name:`razorwind-storybook`},r)}function D(e,t={}){let n=t.outputPath??`storybook/tokens`,r=h(e.tokens,t),i=r.some(e=>e.type===`color`),o=r.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)),s={[a(n,`blocks/ColorPalette.tsx`)]:E(a(n,`blocks/ColorPalette.tsx`),v(r,t),`tsx`),[a(n,`blocks/Typeset.tsx`)]:E(a(n,`blocks/Typeset.tsx`),y(r,t),`tsx`),[a(n,`blocks/TokenTable.tsx`)]:E(a(n,`blocks/TokenTable.tsx`),b(r),`tsx`),[a(n,`blocks/index.ts`)]:E(a(n,`blocks/index.ts`),w(),`typescript`),[a(n,`Tokens.mdx`)]:E(a(n,`Tokens.mdx`),x({titlePrefix:t.titlePrefix,hasColors:i,hasTypography:o}),`mdx`)};if(i&&(s[a(n,`Colors.mdx`)]=E(a(n,`Colors.mdx`),S(t),`mdx`)),o&&(s[a(n,`Typography.mdx`)]=E(a(n,`Typography.mdx`),C(t),`mdx`)),s[a(n,`tokens.json`)]=E(a(n,`tokens.json`),`${JSON.stringify(r,null,2)}\n`,`json`),t.generateTheme){let e=t.generateTheme(r);s[a(n,`theme.ts`)]=E(a(n,`theme.ts`),T(e),`typescript`)}return s}var O=e(e=>({name:`storybook`,generate:async t=>D(t,e??{})}));export{O as default,h as flattenTokens,n as formatTokenValue,D as generateTokenDocs,T as renderThemeFile,m as resolveTokenSets,i as toCssVar};
198
+ `}function E(e,n,r){return t(e,n,{name:`razorwind-storybook`},r)}function D(e,t={}){let n=t.outputPath??`storybook/tokens`,r=h(e.tokens,t),i=r.some(e=>e.type===`color`),o=r.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)),s={[a(n,`blocks/ColorPalette.tsx`)]:E(a(n,`blocks/ColorPalette.tsx`),v(r,t),`tsx`),[a(n,`blocks/Typeset.tsx`)]:E(a(n,`blocks/Typeset.tsx`),y(r,t),`tsx`),[a(n,`blocks/TokenTable.tsx`)]:E(a(n,`blocks/TokenTable.tsx`),b(r),`tsx`),[a(n,`blocks/index.ts`)]:E(a(n,`blocks/index.ts`),w(),`typescript`),[a(n,`Tokens.mdx`)]:E(a(n,`Tokens.mdx`),x({titlePrefix:t.titlePrefix,hasColors:i,hasTypography:o}),`mdx`)};if(i&&(s[a(n,`Colors.mdx`)]=E(a(n,`Colors.mdx`),S(t),`mdx`)),o&&(s[a(n,`Typography.mdx`)]=E(a(n,`Typography.mdx`),C(t),`mdx`)),s[a(n,`tokens.json`)]=E(a(n,`tokens.json`),`${JSON.stringify(r,null,2)}\n`,`json`),t.generateTheme){let r=t.generateTheme(e.tokens);if(typeof r==`object`&&r)for(let[e,t]of Object.entries(r))s[a(n,`theme-${e}.ts`)]=E(a(n,`theme-${e}.ts`),T(t),`typescript`);else s[a(n,`theme.ts`)]=E(a(n,`theme.ts`),T(r),`typescript`)}return s}var O=e(e=>({name:`storybook`,generate:async t=>D(t,e??{})}));export{O as default,h as flattenTokens,n as formatTokenValue,D as generateTokenDocs,T as renderThemeFile,m as resolveTokenSets,i as toCssVar};
199
199
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/storybook",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "description": "Razorwind plugin that creates Storybook MDX token doc blocks from Razorwind design tokens.",
6
6
  "repository": {
@@ -85,8 +85,8 @@
85
85
  "dependencies": {
86
86
  "@power-plant/core": "^0.0.67",
87
87
  "@power-plant/dtcg-schema": "^0.0.1",
88
- "@razorwind/core": "^0.0.23",
89
- "@stryke/type-checks": "^0.6.32"
88
+ "@razorwind/core": "^0.0.25",
89
+ "@stryke/type-checks": "^0.6.34"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@storybook/addon-docs": ">=8",
@@ -104,5 +104,5 @@
104
104
  "typescript": "^6.0.3"
105
105
  },
106
106
  "publishConfig": { "access": "public" },
107
- "gitHead": "2aef3bbc4f3c7dd3bd522fde80c9bb0da40ddc84"
107
+ "gitHead": "4cac94d47388e7e4d0739cde32600845340eaba2"
108
108
  }