@razorwind/tailwindcss 0.0.43 → 0.0.45

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/README.md CHANGED
@@ -94,7 +94,7 @@ export default defineConfig({
94
94
 
95
95
  | Option | Default | Description |
96
96
  | ------------- | --------------------------- | -------------------------------------------------------- |
97
- | `outFile` | `"DESIGN.md"` | Output file path (relative to the execution cwd) |
97
+ | `outputPath` | `"DESIGN.md"` | Output file path (relative to the execution cwd) |
98
98
  | `name` | `"Razorwind Design System"` | Design system name written to the YAML front matter |
99
99
  | `description` | — | Short description written to the YAML front matter |
100
100
  | `version` | `"alpha"` | DESIGN.md spec version written to the YAML front matter |
@@ -1,6 +1,7 @@
1
1
  import { i as __exportAll, r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-Bp1KBCUc.cjs";
2
2
  import { GeneratorFunctionResult } from "@power-plant/core";
3
3
  import { Fonts, Schema, Tokens } from "@razorwind/core/schema";
4
+ import { toThemeCssVar } from "@razorwind/core/utils";
4
5
  //#region src/install.d.ts
5
6
  /**
6
7
  * Build Tailwind INSTALL.md for generated CSS theme entry.
@@ -14,12 +15,6 @@ declare function renderInstallMd(options: {
14
15
  declare namespace generate_d_exports {
15
16
  export { FlatThemeToken, TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
16
17
  }
17
- /**
18
- * Convert a DTCG token path into a Tailwind `@theme` custom property.
19
- * Mirrors {@link nestFlatTokens}: `color.primary` → `--color-primary`,
20
- * and strips a trailing `DEFAULT` leaf (`radius.DEFAULT` → `--radius`).
21
- */
22
- declare function toThemeCssVar(path: string): string;
23
18
  interface TokenSet {
24
19
  id: string;
25
20
  tokens: Tokens;
@@ -61,4 +56,4 @@ declare function generateTailwindCss(spec: Schema, options?: TailwindGeneratePlu
61
56
  declare const _default: (options?: TailwindGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
62
57
  //#endregion
63
58
  export { renderTailwindCss as a, renderInstallMd as c, generate_d_exports as i, flattenThemeTokens as n, resolveTokenSets as o, generateTailwindCss as r, toThemeCssVar as s, _default as t };
64
- //# sourceMappingURL=generate-DpNg5Feb.d.cts.map
59
+ //# sourceMappingURL=generate-B8GEC1oY.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-B8GEC1oY.d.cts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":";;;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;;;;;UCyFQ;EACR;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAwBa,mBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBA+Fa,kBACd,QAAQ,kBACR,UAAS,KAAK;EACZ,QAAQ;;;;;iBAkDU,oBACpB,MAAM,QACN,UAAS,gCACR,QAAQ,wBAAwB,QAAQ"}
@@ -0,0 +1,36 @@
1
+ const e=require("./extract-DwBAAWH7.cjs");let t=require("@razorwind/core/lib/fonts"),n=require("@razorwind/core/plugin"),r=require("node:path"),i=require("@power-plant/core"),a=require("@razorwind/core/utils");function o(e){let t=e.includeImport?'The file includes `@import "tailwindcss"` and `@theme` token mappings.':'The file contains `@theme` token mappings (no `@import "tailwindcss"`).';return`# Installing Tailwind Theme CSS
2
+
3
+ Generated by \`@razorwind/tailwindcss\`.
4
+
5
+ ## Files
6
+
7
+ - \`${e.cssPath}\` — Tailwind v4 theme entry (${t})
8
+
9
+ ## Setup
10
+
11
+ 1. Import the generated CSS in your app entry (or merge into your existing Tailwind entry):
12
+
13
+ \`\`\`ts
14
+ import "./${e.cssPath}";
15
+ \`\`\`
16
+
17
+ 2. Ensure your build uses Tailwind v4 (Vite plugin, PostCSS, or CLI).
18
+
19
+ 3. Use generated theme tokens as utilities or arbitrary values, e.g. \`bg-primary\` when \`--color-primary\` is defined in \`@theme\`\.
20
+
21
+ ## Regenerate
22
+
23
+ Re-run Razorwind generate when design tokens change so \`${e.cssPath}\` stays in sync.
24
+ `}var s=e.u({default:()=>C,flattenThemeTokens:()=>h,generateTailwindCss:()=>S,renderInstallMd:()=>o,renderTailwindCss:()=>b,resolveTokenSets:()=>m,toThemeCssVar:()=>a.toThemeCssVar});const c=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,l=new Set([`default`,`base`,`light`,`theme`]);function u(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function d(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function f(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function p(e,t,n,r){if(!(0,a.isObject)(e))return;let i=d(e,n);if(u(e)){let n=f(e),o=t.join(`.`);r.push({path:o,type:i,value:n,cssValue:(0,a.formatTokenValue)(n,i),cssVar:(0,a.toThemeCssVar)(o)});return}for(let[n,a]of Object.entries(e))n.startsWith(`$`)||p(a,[...t,n],i,r)}function m(e){if(!(0,a.isObject)(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>c.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function h(e){let t=[];for(let n of m(e)){let e=[];p(n.tokens,[],void 0,e);for(let r of e)t.push({...r,theme:n.id==="default"?void 0:n.id})}return t}function g(e){return e.find(e=>l.has(e.id.toLowerCase()))??e[0]}function _(e){return e.length===0?`@theme {
25
+ }
26
+ `:`@theme {\n${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
27
+ `)}\n}\n`}function v(e){return e.length===0?``:`
28
+ @layer theme {
29
+ .dark {
30
+ ${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
31
+ `)}
32
+ }
33
+ }
34
+ `}function y(e,n){if(!n)return e;let r=new Set(e.filter(e=>!e.theme).map(e=>e.cssVar)),i=[];for(let e of Object.values(n)){if(!e.role)continue;let n=`--font-${e.role}`;if(r.has(n))continue;let a=(0,t.cssFontFamily)(e);i.push({path:`font.${e.role}`,type:`fontFamily`,value:a,cssValue:a,cssVar:n}),r.add(n)}return i.length>0?[...e,...i]:e}function b(e,n={}){let r=n.includeImport!==!1,i=n.fonts,a=y(e,i),o=a.filter(e=>!e.theme||l.has(e.theme.toLowerCase())),s=a.filter(e=>e.theme?.toLowerCase()===`dark`),c=[],u=i?(0,t.renderGoogleFontImports)(i):``;u&&c.push(`${u}\n`),r&&c.push(`@import "tailwindcss";
35
+ `);let d=i?(0,t.renderLocalFontFaces)(i):``;return d&&c.push(`${d}\n`),c.push(_(o)),s.length>0&&c.push(v(s)),`${c.join(`
36
+ `).trimEnd()}\n`}async function x(t){if(t.cssPath)return t.cssPath;let{cwd:n}=(0,i.useExecution)();return(await e.t(n)).cssFile??`src/app.css`}async function S(e,n={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let i=m(e.tokens);if(i.length===0||!g(i))return{};let s=h(e.tokens);if(s.length===0)return{};let c=await x(n),l=b(s,{...n,fonts:e.fonts}),u=n.includeImport!==!1;e.fonts&&await(0,t.copyFontFiles)(e.fonts,(0,r.join)((0,r.dirname)(c),`fonts`));let d=n.installGuide??o({cssPath:c,includeImport:u}),f=(0,r.join)((0,r.dirname)(c),`INSTALL.md`);return{[c]:(0,a.createDocument)(c,l,{name:`razorwind-tailwindcss`},`css`),[f]:(0,a.createDocument)(f,d,{name:`razorwind-tailwindcss`},`markdown`)}}var C=(0,n.definePlugin)(e=>({name:`tailwindcss:generate`,generate:async t=>S(t,e??{})}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
@@ -1,5 +1,6 @@
1
1
  import { r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-CGnL0PxK.mjs";
2
2
  import { GeneratorFunctionResult } from "@power-plant/core";
3
+ import { toThemeCssVar } from "@razorwind/core/utils";
3
4
  import { Fonts, Schema, Tokens } from "@razorwind/core/schema";
4
5
  //#region src/install.d.ts
5
6
  /**
@@ -14,12 +15,6 @@ declare function renderInstallMd(options: {
14
15
  declare namespace generate_d_exports {
15
16
  export { FlatThemeToken, TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
16
17
  }
17
- /**
18
- * Convert a DTCG token path into a Tailwind `@theme` custom property.
19
- * Mirrors {@link nestFlatTokens}: `color.primary` → `--color-primary`,
20
- * and strips a trailing `DEFAULT` leaf (`radius.DEFAULT` → `--radius`).
21
- */
22
- declare function toThemeCssVar(path: string): string;
23
18
  interface TokenSet {
24
19
  id: string;
25
20
  tokens: Tokens;
@@ -61,4 +56,4 @@ declare function generateTailwindCss(spec: Schema, options?: TailwindGeneratePlu
61
56
  declare const _default: (options?: TailwindGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
62
57
  //#endregion
63
58
  export { renderTailwindCss as a, renderInstallMd as c, generate_d_exports as i, flattenThemeTokens as n, resolveTokenSets as o, generateTailwindCss as r, toThemeCssVar as s, _default as t };
64
- //# sourceMappingURL=generate-CbmcAoDd.d.mts.map
59
+ //# sourceMappingURL=generate-DofsX4xq.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-DofsX4xq.d.mts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{t}from"./extract-D5hPV_r7.mjs";import{copyFontFiles as n,cssFontFamily as r,renderGoogleFontImports as i,renderLocalFontFaces as a}from"@razorwind/core/lib/fonts";import{definePlugin as o}from"@razorwind/core/plugin";import{dirname as s,join as c}from"node:path";import{useExecution as l}from"@power-plant/core";import{createDocument as u,formatTokenValue as d,isObject as f}from"@razorwind/core/utils";function p(e){let t=e.includeImport?'The file includes `@import "tailwindcss"` and `@theme` token mappings.':'The file contains `@theme` token mappings (no `@import "tailwindcss"`).';return`# Installing Tailwind Theme CSS
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{t}from"./extract-D5hPV_r7.mjs";import{copyFontFiles as n,cssFontFamily as r,renderGoogleFontImports as i,renderLocalFontFaces as a}from"@razorwind/core/lib/fonts";import{definePlugin as o}from"@razorwind/core/plugin";import{dirname as s,join as c}from"node:path";import{useExecution as l}from"@power-plant/core";import{createDocument as u,formatTokenValue as d,isObject as f,toThemeCssVar as p}from"@razorwind/core/utils";function m(e){let t=e.includeImport?'The file includes `@import "tailwindcss"` and `@theme` token mappings.':'The file contains `@theme` token mappings (no `@import "tailwindcss"`).';return`# Installing Tailwind Theme CSS
2
2
 
3
3
  Generated by \`@razorwind/tailwindcss\`.
4
4
 
@@ -21,7 +21,7 @@ import "./${e.cssPath}";
21
21
  ## Regenerate
22
22
 
23
23
  Re-run Razorwind generate when design tokens change so \`${e.cssPath}\` stays in sync.
24
- `}var m=e({default:()=>j,flattenThemeTokens:()=>C,generateTailwindCss:()=>A,renderInstallMd:()=>p,renderTailwindCss:()=>O,resolveTokenSets:()=>S,toThemeCssVar:()=>b});const h=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,g=new Set([`default`,`base`,`light`,`theme`]);function _(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function v(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function y(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function b(e){return`--${e.split(`.`).filter(Boolean).filter((e,t,n)=>e!==`DEFAULT`||t!==n.length-1).join(`-`)}`}function x(e,t,n,r){if(!f(e))return;let i=v(e,n);if(_(e)){let n=y(e),a=t.join(`.`);r.push({path:a,type:i,value:n,cssValue:d(n,i),cssVar:b(a)});return}for(let[n,a]of Object.entries(e))n.startsWith(`$`)||x(a,[...t,n],i,r)}function S(e){if(!f(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>h.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function C(e){let t=[];for(let n of S(e)){let e=[];x(n.tokens,[],void 0,e);for(let r of e)t.push({...r,theme:n.id==="default"?void 0:n.id})}return t}function w(e){return e.find(e=>g.has(e.id.toLowerCase()))??e[0]}function T(e){return e.length===0?`@theme {
24
+ `}var h=e({default:()=>j,flattenThemeTokens:()=>C,generateTailwindCss:()=>A,renderInstallMd:()=>m,renderTailwindCss:()=>O,resolveTokenSets:()=>S,toThemeCssVar:()=>p});const g=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,_=new Set([`default`,`base`,`light`,`theme`]);function v(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function y(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function b(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function x(e,t,n,r){if(!f(e))return;let i=y(e,n);if(v(e)){let n=b(e),a=t.join(`.`);r.push({path:a,type:i,value:n,cssValue:d(n,i),cssVar:p(a)});return}for(let[n,a]of Object.entries(e))n.startsWith(`$`)||x(a,[...t,n],i,r)}function S(e){if(!f(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>g.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function C(e){let t=[];for(let n of S(e)){let e=[];x(n.tokens,[],void 0,e);for(let r of e)t.push({...r,theme:n.id==="default"?void 0:n.id})}return t}function w(e){return e.find(e=>_.has(e.id.toLowerCase()))??e[0]}function T(e){return e.length===0?`@theme {
25
25
  }
26
26
  `:`@theme {\n${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
27
27
  `)}\n}\n`}function E(e){return e.length===0?``:`
@@ -31,7 +31,7 @@ ${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar
31
31
  `)}
32
32
  }
33
33
  }
34
- `}function D(e,t){if(!t)return e;let n=new Set(e.filter(e=>!e.theme).map(e=>e.cssVar)),i=[];for(let e of Object.values(t)){if(!e.role)continue;let t=`--font-${e.role}`;if(n.has(t))continue;let a=r(e);i.push({path:`font.${e.role}`,type:`fontFamily`,value:a,cssValue:a,cssVar:t}),n.add(t)}return i.length>0?[...e,...i]:e}function O(e,t={}){let n=t.includeImport!==!1,r=t.fonts,o=D(e,r),s=o.filter(e=>!e.theme||g.has(e.theme.toLowerCase())),c=o.filter(e=>e.theme?.toLowerCase()===`dark`),l=[],u=r?i(r):``;u&&l.push(`${u}\n`),n&&l.push(`@import "tailwindcss";
34
+ `}function D(e,t){if(!t)return e;let n=new Set(e.filter(e=>!e.theme).map(e=>e.cssVar)),i=[];for(let e of Object.values(t)){if(!e.role)continue;let t=`--font-${e.role}`;if(n.has(t))continue;let a=r(e);i.push({path:`font.${e.role}`,type:`fontFamily`,value:a,cssValue:a,cssVar:t}),n.add(t)}return i.length>0?[...e,...i]:e}function O(e,t={}){let n=t.includeImport!==!1,r=t.fonts,o=D(e,r),s=o.filter(e=>!e.theme||_.has(e.theme.toLowerCase())),c=o.filter(e=>e.theme?.toLowerCase()===`dark`),l=[],u=r?i(r):``;u&&l.push(`${u}\n`),n&&l.push(`@import "tailwindcss";
35
35
  `);let d=r?a(r):``;return d&&l.push(`${d}\n`),l.push(T(s)),c.length>0&&l.push(E(c)),`${l.join(`
36
- `).trimEnd()}\n`}async function k(e){if(e.cssPath)return e.cssPath;let{cwd:n}=l();return(await t(n)).cssFile??`src/app.css`}async function A(e,t={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let r=S(e.tokens);if(r.length===0||!w(r))return{};let i=C(e.tokens);if(i.length===0)return{};let a=await k(t),o=O(i,{...t,fonts:e.fonts}),l=t.includeImport!==!1;e.fonts&&await n(e.fonts,c(s(a),`fonts`));let d=t.installGuide??p({cssPath:a,includeImport:l}),f=c(s(a),`INSTALL.md`);return{[a]:u(a,o,{name:`razorwind-tailwindcss`},`css`),[f]:u(f,d,{name:`razorwind-tailwindcss`},`markdown`)}}var j=o(e=>({name:`tailwindcss:generate`,generate:async t=>A(t,e??{})}));export{O as a,p as c,m as i,A as n,S as o,j as r,b as s,C as t};
37
- //# sourceMappingURL=generate-ecQXGC5y.mjs.map
36
+ `).trimEnd()}\n`}async function k(e){if(e.cssPath)return e.cssPath;let{cwd:n}=l();return(await t(n)).cssFile??`src/app.css`}async function A(e,t={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let r=S(e.tokens);if(r.length===0||!w(r))return{};let i=C(e.tokens);if(i.length===0)return{};let a=await k(t),o=O(i,{...t,fonts:e.fonts}),l=t.includeImport!==!1;e.fonts&&await n(e.fonts,c(s(a),`fonts`));let d=t.installGuide??m({cssPath:a,includeImport:l}),f=c(s(a),`INSTALL.md`);return{[a]:u(a,o,{name:`razorwind-tailwindcss`},`css`),[f]:u(f,d,{name:`razorwind-tailwindcss`},`markdown`)}}var j=o(e=>({name:`tailwindcss:generate`,generate:async t=>A(t,e??{})}));export{O as a,m as c,h as i,A as n,S as o,j as r,p as s,C as t};
37
+ //# sourceMappingURL=generate-Dz0c_kcz.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-Dz0c_kcz.mjs","names":[],"sources":[],"mappings":""}
package/dist/generate.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-Bb0k5nol.cjs");exports.default=e.r,exports.flattenThemeTokens=e.t,exports.generateTailwindCss=e.n,exports.renderInstallMd=e.c,exports.renderTailwindCss=e.a,exports.resolveTokenSets=e.o,exports.toThemeCssVar=e.s;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-BIkxSR9n.cjs");let t=require("@razorwind/core/utils");exports.default=e.r,exports.flattenThemeTokens=e.t,exports.generateTailwindCss=e.n,exports.renderInstallMd=e.s,exports.renderTailwindCss=e.a,exports.resolveTokenSets=e.o,exports.toThemeCssVar=t.toThemeCssVar;
@@ -1,3 +1,3 @@
1
1
  import { r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-Bp1KBCUc.cjs";
2
- import { a as renderTailwindCss, c as renderInstallMd, n as flattenThemeTokens, o as resolveTokenSets, r as generateTailwindCss, s as toThemeCssVar, t as _default } from "./generate-DpNg5Feb.cjs";
2
+ import { a as renderTailwindCss, c as renderInstallMd, n as flattenThemeTokens, o as resolveTokenSets, r as generateTailwindCss, s as toThemeCssVar, t as _default } from "./generate-B8GEC1oY.cjs";
3
3
  export { type FlatThemeToken, type TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
@@ -1,3 +1,3 @@
1
1
  import { r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-CGnL0PxK.mjs";
2
- import { a as renderTailwindCss, c as renderInstallMd, n as flattenThemeTokens, o as resolveTokenSets, r as generateTailwindCss, s as toThemeCssVar, t as _default } from "./generate-CbmcAoDd.mjs";
2
+ import { a as renderTailwindCss, c as renderInstallMd, n as flattenThemeTokens, o as resolveTokenSets, r as generateTailwindCss, s as toThemeCssVar, t as _default } from "./generate-DofsX4xq.mjs";
3
3
  export { type FlatThemeToken, type TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
package/dist/generate.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,n,o as r,r as i,s as a,t as o}from"./generate-ecQXGC5y.mjs";export{i as default,o as flattenThemeTokens,n as generateTailwindCss,t as renderInstallMd,e as renderTailwindCss,r as resolveTokenSets,a as toThemeCssVar};
1
+ import{a as e,c as t,n,o as r,r as i,s as a,t as o}from"./generate-Dz0c_kcz.mjs";export{i as default,o as flattenThemeTokens,n as generateTailwindCss,t as renderInstallMd,e as renderTailwindCss,r as resolveTokenSets,a as toThemeCssVar};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract-DwBAAWH7.cjs"),t=require("./generate-Bb0k5nol.cjs");Object.defineProperty(exports,"extract",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(exports,"generate",{enumerable:!0,get:function(){return t.i}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract-DwBAAWH7.cjs"),t=require("./generate-BIkxSR9n.cjs");Object.defineProperty(exports,"extract",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(exports,"generate",{enumerable:!0,get:function(){return t.i}});
package/dist/index.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as extract_d_exports } from "./extract-DtoWdPiV.cjs";
2
- import { i as generate_d_exports } from "./generate-DpNg5Feb.cjs";
2
+ import { i as generate_d_exports } from "./generate-B8GEC1oY.cjs";
3
3
  export { extract_d_exports as extract, generate_d_exports as generate };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as extract_d_exports } from "./extract-yB1GBvRe.mjs";
2
- import { i as generate_d_exports } from "./generate-CbmcAoDd.mjs";
2
+ import { i as generate_d_exports } from "./generate-DofsX4xq.mjs";
3
3
  export { extract_d_exports as extract, generate_d_exports as generate };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e}from"./extract-D5hPV_r7.mjs";import{i as t}from"./generate-ecQXGC5y.mjs";export{e as extract,t as generate};
1
+ import{i as e}from"./extract-D5hPV_r7.mjs";import{i as t}from"./generate-Dz0c_kcz.mjs";export{e as extract,t as generate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/tailwindcss",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "type": "module",
5
5
  "description": "Razorwind Tailwind CSS plugin that can create Tailwind CSS files from design tokens or read a Tailwind CSS file and return the design tokens.",
6
6
  "repository": {
@@ -80,7 +80,7 @@
80
80
  "dependencies": {
81
81
  "@power-plant/core": "^0.0.90",
82
82
  "@power-plant/dtcg-schema": "^0.0.1",
83
- "@razorwind/core": "^0.0.47",
83
+ "@razorwind/core": "^0.0.49",
84
84
  "@stryke/fs": "^0.33.110",
85
85
  "@stryke/path": "^0.29.35",
86
86
  "@stryke/type-checks": "^0.6.41",
@@ -95,5 +95,5 @@
95
95
  "typescript": "^6.0.3"
96
96
  },
97
97
  "publishConfig": { "access": "public" },
98
- "gitHead": "ca5955e41399f13b752e589a14338d6821b78f6c"
98
+ "gitHead": "8dc94fb22937f30d41e97f3c6ecff7f45eb81202"
99
99
  }
@@ -1,36 +0,0 @@
1
- const e=require("./extract-DwBAAWH7.cjs");let t=require("@razorwind/core/lib/fonts"),n=require("@razorwind/core/plugin"),r=require("node:path"),i=require("@power-plant/core"),a=require("@razorwind/core/utils");function o(e){let t=e.includeImport?'The file includes `@import "tailwindcss"` and `@theme` token mappings.':'The file contains `@theme` token mappings (no `@import "tailwindcss"`).';return`# Installing Tailwind Theme CSS
2
-
3
- Generated by \`@razorwind/tailwindcss\`.
4
-
5
- ## Files
6
-
7
- - \`${e.cssPath}\` — Tailwind v4 theme entry (${t})
8
-
9
- ## Setup
10
-
11
- 1. Import the generated CSS in your app entry (or merge into your existing Tailwind entry):
12
-
13
- \`\`\`ts
14
- import "./${e.cssPath}";
15
- \`\`\`
16
-
17
- 2. Ensure your build uses Tailwind v4 (Vite plugin, PostCSS, or CLI).
18
-
19
- 3. Use generated theme tokens as utilities or arbitrary values, e.g. \`bg-primary\` when \`--color-primary\` is defined in \`@theme\`\.
20
-
21
- ## Regenerate
22
-
23
- Re-run Razorwind generate when design tokens change so \`${e.cssPath}\` stays in sync.
24
- `}var s=e.u({default:()=>w,flattenThemeTokens:()=>g,generateTailwindCss:()=>C,renderInstallMd:()=>o,renderTailwindCss:()=>x,resolveTokenSets:()=>h,toThemeCssVar:()=>p});const c=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,l=new Set([`default`,`base`,`light`,`theme`]);function u(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function d(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function f(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function p(e){return`--${e.split(`.`).filter(Boolean).filter((e,t,n)=>e!==`DEFAULT`||t!==n.length-1).join(`-`)}`}function m(e,t,n,r){if(!(0,a.isObject)(e))return;let i=d(e,n);if(u(e)){let n=f(e),o=t.join(`.`);r.push({path:o,type:i,value:n,cssValue:(0,a.formatTokenValue)(n,i),cssVar:p(o)});return}for(let[n,a]of Object.entries(e))n.startsWith(`$`)||m(a,[...t,n],i,r)}function h(e){if(!(0,a.isObject)(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>c.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function g(e){let t=[];for(let n of h(e)){let e=[];m(n.tokens,[],void 0,e);for(let r of e)t.push({...r,theme:n.id==="default"?void 0:n.id})}return t}function _(e){return e.find(e=>l.has(e.id.toLowerCase()))??e[0]}function v(e){return e.length===0?`@theme {
25
- }
26
- `:`@theme {\n${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
27
- `)}\n}\n`}function y(e){return e.length===0?``:`
28
- @layer theme {
29
- .dark {
30
- ${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
31
- `)}
32
- }
33
- }
34
- `}function b(e,n){if(!n)return e;let r=new Set(e.filter(e=>!e.theme).map(e=>e.cssVar)),i=[];for(let e of Object.values(n)){if(!e.role)continue;let n=`--font-${e.role}`;if(r.has(n))continue;let a=(0,t.cssFontFamily)(e);i.push({path:`font.${e.role}`,type:`fontFamily`,value:a,cssValue:a,cssVar:n}),r.add(n)}return i.length>0?[...e,...i]:e}function x(e,n={}){let r=n.includeImport!==!1,i=n.fonts,a=b(e,i),o=a.filter(e=>!e.theme||l.has(e.theme.toLowerCase())),s=a.filter(e=>e.theme?.toLowerCase()===`dark`),c=[],u=i?(0,t.renderGoogleFontImports)(i):``;u&&c.push(`${u}\n`),r&&c.push(`@import "tailwindcss";
35
- `);let d=i?(0,t.renderLocalFontFaces)(i):``;return d&&c.push(`${d}\n`),c.push(v(o)),s.length>0&&c.push(y(s)),`${c.join(`
36
- `).trimEnd()}\n`}async function S(t){if(t.cssPath)return t.cssPath;let{cwd:n}=(0,i.useExecution)();return(await e.t(n)).cssFile??`src/app.css`}async function C(e,n={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let i=h(e.tokens);if(i.length===0||!_(i))return{};let s=g(e.tokens);if(s.length===0)return{};let c=await S(n),l=x(s,{...n,fonts:e.fonts}),u=n.includeImport!==!1;e.fonts&&await(0,t.copyFontFiles)(e.fonts,(0,r.join)((0,r.dirname)(c),`fonts`));let d=n.installGuide??o({cssPath:c,includeImport:u}),f=(0,r.join)((0,r.dirname)(c),`INSTALL.md`);return{[c]:(0,a.createDocument)(c,l,{name:`razorwind-tailwindcss`},`css`),[f]:(0,a.createDocument)(f,d,{name:`razorwind-tailwindcss`},`markdown`)}}var w=(0,n.definePlugin)(e=>({name:`tailwindcss:generate`,generate:async t=>C(t,e??{})}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}});
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-CbmcAoDd.d.mts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-DpNg5Feb.d.cts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":";;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;;;;;;;;;;iBC2Dc,cAAc;UA6CpB;EACR;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAwBa,mBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBA+Fa,kBACd,QAAQ,kBACR,UAAS,KAAK;EACZ,QAAQ;;;;;iBAkDU,oBACpB,MAAM,QACN,UAAS,gCACR,QAAQ,wBAAwB,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-ecQXGC5y.mjs","names":[],"sources":[],"mappings":""}