@razorwind/tailwindcss 0.0.25 → 0.0.26

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.
@@ -1,4 +1,4 @@
1
- import { i as __exportAll, n as TailwindExtractPluginOptions } from "./types-o6IU6Inw.cjs";
1
+ import { i as __exportAll, n as TailwindExtractPluginOptions } from "./types-Bp1KBCUc.cjs";
2
2
  import { Tokens } from "@power-plant/dtcg-schema";
3
3
  import { PackageJson } from "@stryke/types/package-json";
4
4
  //#region src/workspace.d.ts
@@ -48,4 +48,4 @@ declare function extractTailwindTokens(options: TailwindExtractPluginOptions & {
48
48
  declare const _default: (options?: TailwindExtractPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
49
49
  //#endregion
50
50
  export { extract_d_exports as a, getTailwindVersion as c, extractTailwindTokens as i, resolveTailwindCssEntry as l, _default as n, getTailwindConfigFile as o, detectTailwindWorkspace as r, getTailwindCssFile as s, TailwindWorkspaceInfo as t, getPackageInfo as u };
51
- //# sourceMappingURL=extract-QsaKglv1.d.cts.map
51
+ //# sourceMappingURL=extract-DtoWdPiV.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extract-QsaKglv1.d.cts","names":[],"sources":["../src/workspace.ts","../src/extract.ts"],"mappings":";;;;iBAsBsB,eACpB,eACC,QAAQ;;;;UCwBM;EACf;EACA;EACA;EACA;;iBAgCoB,mBACpB,cACC,QAAQ;iBAuBW,mBACpB,aACA,yBACC;iBAgCmB,sBACpB,cACC;;;;iBAamB,wBACpB,aACA,8BACC,QAAQ;;;;iBAkBK,wBACd,aACA,YAAY;;;;;;;iBAoBQ,sBACpB,SAAS;EAAiC;IACzC,QAAQ"}
1
+ {"version":3,"file":"extract-DtoWdPiV.d.cts","names":[],"sources":["../src/workspace.ts","../src/extract.ts"],"mappings":";;;;iBAsBsB,eACpB,eACC,QAAQ;;;;UCwBM;EACf;EACA;EACA;EACA;;iBAgCoB,mBACpB,cACC,QAAQ;iBAuBW,mBACpB,aACA,yBACC;iBAgCmB,sBACpB,cACC;;;;iBAamB,wBACpB,aACA,8BACC,QAAQ;;;;iBAkBK,wBACd,aACA,YAAY;;;;;;;iBAoBQ,sBACpB,SAAS;EAAiC;IACzC,QAAQ"}
@@ -1,4 +1,4 @@
1
- import { n as TailwindExtractPluginOptions } from "./types-Cy7QTbNx.mjs";
1
+ import { n as TailwindExtractPluginOptions } from "./types-CGnL0PxK.mjs";
2
2
  import { Tokens } from "@power-plant/dtcg-schema";
3
3
  import { PackageJson } from "@stryke/types/package-json";
4
4
  //#region src/workspace.d.ts
@@ -48,4 +48,4 @@ declare function extractTailwindTokens(options: TailwindExtractPluginOptions & {
48
48
  declare const _default: (options?: TailwindExtractPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
49
49
  //#endregion
50
50
  export { extract_d_exports as a, getTailwindVersion as c, extractTailwindTokens as i, resolveTailwindCssEntry as l, _default as n, getTailwindConfigFile as o, detectTailwindWorkspace as r, getTailwindCssFile as s, TailwindWorkspaceInfo as t, getPackageInfo as u };
51
- //# sourceMappingURL=extract-Dc7HWHSe.d.mts.map
51
+ //# sourceMappingURL=extract-yB1GBvRe.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-yB1GBvRe.d.mts","names":[],"sources":["../src/workspace.ts","../src/extract.ts"],"mappings":""}
@@ -1,3 +1,3 @@
1
- import { n as TailwindExtractPluginOptions } from "./types-o6IU6Inw.cjs";
2
- import { c as getTailwindVersion, i as extractTailwindTokens, l as resolveTailwindCssEntry, n as _default, o as getTailwindConfigFile, r as detectTailwindWorkspace, s as getTailwindCssFile, t as TailwindWorkspaceInfo, u as getPackageInfo } from "./extract-QsaKglv1.cjs";
1
+ import { n as TailwindExtractPluginOptions } from "./types-Bp1KBCUc.cjs";
2
+ import { c as getTailwindVersion, i as extractTailwindTokens, l as resolveTailwindCssEntry, n as _default, o as getTailwindConfigFile, r as detectTailwindWorkspace, s as getTailwindCssFile, t as TailwindWorkspaceInfo, u as getPackageInfo } from "./extract-DtoWdPiV.cjs";
3
3
  export { type TailwindExtractPluginOptions, TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
@@ -1,3 +1,3 @@
1
- import { n as TailwindExtractPluginOptions } from "./types-Cy7QTbNx.mjs";
2
- import { c as getTailwindVersion, i as extractTailwindTokens, l as resolveTailwindCssEntry, n as _default, o as getTailwindConfigFile, r as detectTailwindWorkspace, s as getTailwindCssFile, t as TailwindWorkspaceInfo, u as getPackageInfo } from "./extract-Dc7HWHSe.mjs";
1
+ import { n as TailwindExtractPluginOptions } from "./types-CGnL0PxK.mjs";
2
+ import { c as getTailwindVersion, i as extractTailwindTokens, l as resolveTailwindCssEntry, n as _default, o as getTailwindConfigFile, r as detectTailwindWorkspace, s as getTailwindCssFile, t as TailwindWorkspaceInfo, u as getPackageInfo } from "./extract-yB1GBvRe.mjs";
3
3
  export { type TailwindExtractPluginOptions, TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
@@ -0,0 +1,36 @@
1
+ const e=require("./extract-DebhqpQQ.cjs");let t=require("@power-plant/core"),n=require("@razorwind/core/plugin"),r=require("node:path"),i=require("@razorwind/core/utils");function a(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 o=e.u({default:()=>S,flattenThemeTokens:()=>h,generateTailwindCss:()=>x,renderInstallMd:()=>a,renderTailwindCss:()=>y,resolveTokenSets:()=>m,toThemeCssVar:()=>f});const s=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,c=new Set([`default`,`base`,`light`,`theme`]);function l(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function u(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function d(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 f(e){return`--${e.split(`.`).filter(Boolean).filter((e,t,n)=>e!==`DEFAULT`||t!==n.length-1).join(`-`)}`}function p(e,t,n,r){if(!(0,i.isObject)(e))return;let a=u(e,n);if(l(e)){let n=d(e),o=t.join(`.`);r.push({path:o,type:a,value:n,cssValue:(0,i.formatTokenValue)(n,a),cssVar:f(o)});return}for(let[n,i]of Object.entries(e))n.startsWith(`$`)||p(i,[...t,n],a,r)}function m(e){if(!(0,i.isObject)(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>s.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=>c.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,t={}){let n=t.includeImport!==!1,r=e.filter(e=>!e.theme||c.has(e.theme.toLowerCase())),i=e.filter(e=>e.theme?.toLowerCase()===`dark`),a=[];return n&&a.push(`@import "tailwindcss";
35
+ `),a.push(_(r)),i.length>0&&a.push(v(i)),`${a.join(`
36
+ `).trimEnd()}\n`}async function b(n){if(n.cssPath)return n.cssPath;let{cwd:r}=(0,t.useExecution)();return(await e.t(r)).cssFile??`src/app.css`}async function x(e,t={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let n=m(e.tokens);if(n.length===0||!g(n))return{};let o=h(e.tokens);if(o.length===0)return{};let s=await b(t),c=y(o,t),l=t.includeImport!==!1,u=t.installGuide??a({cssPath:s,includeImport:l}),d=(0,r.join)((0,r.dirname)(s),`INSTALL.md`);return{[s]:(0,i.createDocument)(s,c,{name:`razorwind-tailwindcss`},`css`),[d]:(0,i.createDocument)(d,u,{name:`razorwind-tailwindcss`},`markdown`)}}var S=(0,n.definePlugin)(e=>({name:`tailwindcss:generate`,generate:async t=>x(t,e??{})}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
@@ -0,0 +1,62 @@
1
+ import { i as __exportAll, r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-Bp1KBCUc.cjs";
2
+ import { GeneratorFunctionResult } from "@power-plant/core";
3
+ import { Schema, Tokens } from "@razorwind/core/schema";
4
+ //#region src/install.d.ts
5
+ /**
6
+ * Build Tailwind INSTALL.md for generated CSS theme entry.
7
+ *
8
+ * @see https://tailwindcss.com/docs/theme
9
+ */
10
+ declare function renderInstallMd(options: {
11
+ cssPath: string;
12
+ includeImport: boolean;
13
+ }): string;
14
+ declare namespace generate_d_exports {
15
+ export { FlatThemeToken, TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
16
+ }
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
+ interface TokenSet {
24
+ id: string;
25
+ tokens: Tokens;
26
+ }
27
+ /**
28
+ * Split `Schema.tokens` into one or more named token sets.
29
+ *
30
+ * A record whose keys all look like themes (`light`, `dark`, …) is treated as
31
+ * multi-theme input; otherwise the whole document is a single set.
32
+ */
33
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
34
+ /**
35
+ * Flatten DTCG tokens into Tailwind `@theme` custom-property rows.
36
+ */
37
+ declare function flattenThemeTokens(tokens: Tokens | Record<string, Tokens>): FlatThemeToken[];
38
+ /**
39
+ * Render a Tailwind v4 CSS entry from flattened theme tokens.
40
+ */
41
+ declare function renderTailwindCss(tokens: FlatThemeToken[], options?: Pick<TailwindGeneratePluginOptions, "includeImport">): string;
42
+ /**
43
+ * Generate a Tailwind v4 CSS entry (`@import` + `@theme`) from a Razorwind schema.
44
+ */
45
+ declare function generateTailwindCss(spec: Schema, options?: TailwindGeneratePluginOptions): Promise<GeneratorFunctionResult<Schema, TailwindGeneratePluginOptions>>;
46
+ /**
47
+ * Razorwind plugin: generate a Tailwind v4 CSS entry from schema tokens.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { defineConfig } from "@razorwind/core";
52
+ * import tailwindcss from "@razorwind/tailwindcss/generate";
53
+ *
54
+ * export default defineConfig({
55
+ * plugins: [tailwindcss()]
56
+ * });
57
+ * ```
58
+ */
59
+ declare const _default: (options?: TailwindGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
60
+ //#endregion
61
+ 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 };
62
+ //# sourceMappingURL=generate-CtFpoykM.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-CtFpoykM.d.cts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":";;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;;;;;;;;;;iBCqDc,cAAc;UA6CpB;EACR;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAwBa,mBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBA0Da,kBACd,QAAQ,kBACR,UAAS,KAAK;;;;iBAuCM,oBACpB,MAAM,QACN,UAAS,gCACR,QAAQ,wBAAwB,QAAQ"}
@@ -0,0 +1,37 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{t}from"./extract-DQ9VSzv_.mjs";import{useExecution as n}from"@power-plant/core";import{definePlugin as r}from"@razorwind/core/plugin";import{dirname as i,join as a}from"node:path";import{createDocument as o,formatTokenValue as s,isObject as c}from"@razorwind/core/utils";function l(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 u=e({default:()=>E,flattenThemeTokens:()=>y,generateTailwindCss:()=>T,renderInstallMd:()=>l,renderTailwindCss:()=>C,resolveTokenSets:()=>v,toThemeCssVar:()=>g});const d=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,f=new Set([`default`,`base`,`light`,`theme`]);function p(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function m(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function h(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 g(e){return`--${e.split(`.`).filter(Boolean).filter((e,t,n)=>e!==`DEFAULT`||t!==n.length-1).join(`-`)}`}function _(e,t,n,r){if(!c(e))return;let i=m(e,n);if(p(e)){let n=h(e),a=t.join(`.`);r.push({path:a,type:i,value:n,cssValue:s(n,i),cssVar:g(a)});return}for(let[n,a]of Object.entries(e))n.startsWith(`$`)||_(a,[...t,n],i,r)}function v(e){if(!c(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>d.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function y(e){let t=[];for(let n of v(e)){let e=[];_(n.tokens,[],void 0,e);for(let r of e)t.push({...r,theme:n.id==="default"?void 0:n.id})}return t}function b(e){return e.find(e=>f.has(e.id.toLowerCase()))??e[0]}function x(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 S(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 C(e,t={}){let n=t.includeImport!==!1,r=e.filter(e=>!e.theme||f.has(e.theme.toLowerCase())),i=e.filter(e=>e.theme?.toLowerCase()===`dark`),a=[];return n&&a.push(`@import "tailwindcss";
35
+ `),a.push(x(r)),i.length>0&&a.push(S(i)),`${a.join(`
36
+ `).trimEnd()}\n`}async function w(e){if(e.cssPath)return e.cssPath;let{cwd:r}=n();return(await t(r)).cssFile??`src/app.css`}async function T(e,t={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let n=v(e.tokens);if(n.length===0||!b(n))return{};let r=y(e.tokens);if(r.length===0)return{};let s=await w(t),c=C(r,t),u=t.includeImport!==!1,d=t.installGuide??l({cssPath:s,includeImport:u}),f=a(i(s),`INSTALL.md`);return{[s]:o(s,c,{name:`razorwind-tailwindcss`},`css`),[f]:o(f,d,{name:`razorwind-tailwindcss`},`markdown`)}}var E=r(e=>({name:`tailwindcss:generate`,generate:async t=>T(t,e??{})}));export{C as a,l as c,u as i,T as n,v as o,E as r,g as s,y as t};
37
+ //# sourceMappingURL=generate-DljVzG07.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-DljVzG07.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ import { r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-CGnL0PxK.mjs";
2
+ import { GeneratorFunctionResult } from "@power-plant/core";
3
+ import { Schema, Tokens } from "@razorwind/core/schema";
4
+ //#region src/install.d.ts
5
+ /**
6
+ * Build Tailwind INSTALL.md for generated CSS theme entry.
7
+ *
8
+ * @see https://tailwindcss.com/docs/theme
9
+ */
10
+ declare function renderInstallMd(options: {
11
+ cssPath: string;
12
+ includeImport: boolean;
13
+ }): string;
14
+ declare namespace generate_d_exports {
15
+ export { FlatThemeToken, TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
16
+ }
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
+ interface TokenSet {
24
+ id: string;
25
+ tokens: Tokens;
26
+ }
27
+ /**
28
+ * Split `Schema.tokens` into one or more named token sets.
29
+ *
30
+ * A record whose keys all look like themes (`light`, `dark`, …) is treated as
31
+ * multi-theme input; otherwise the whole document is a single set.
32
+ */
33
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
34
+ /**
35
+ * Flatten DTCG tokens into Tailwind `@theme` custom-property rows.
36
+ */
37
+ declare function flattenThemeTokens(tokens: Tokens | Record<string, Tokens>): FlatThemeToken[];
38
+ /**
39
+ * Render a Tailwind v4 CSS entry from flattened theme tokens.
40
+ */
41
+ declare function renderTailwindCss(tokens: FlatThemeToken[], options?: Pick<TailwindGeneratePluginOptions, "includeImport">): string;
42
+ /**
43
+ * Generate a Tailwind v4 CSS entry (`@import` + `@theme`) from a Razorwind schema.
44
+ */
45
+ declare function generateTailwindCss(spec: Schema, options?: TailwindGeneratePluginOptions): Promise<GeneratorFunctionResult<Schema, TailwindGeneratePluginOptions>>;
46
+ /**
47
+ * Razorwind plugin: generate a Tailwind v4 CSS entry from schema tokens.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { defineConfig } from "@razorwind/core";
52
+ * import tailwindcss from "@razorwind/tailwindcss/generate";
53
+ *
54
+ * export default defineConfig({
55
+ * plugins: [tailwindcss()]
56
+ * });
57
+ * ```
58
+ */
59
+ declare const _default: (options?: TailwindGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
60
+ //#endregion
61
+ 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 };
62
+ //# sourceMappingURL=generate-OJ9Icif0.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-OJ9Icif0.d.mts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":""}
package/dist/generate.cjs CHANGED
@@ -1,13 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./extract-DebhqpQQ.cjs");let t=require("@power-plant/core"),n=require("@razorwind/core/plugin"),r=require("@razorwind/core/utils");var i=e.u({default:()=>b,flattenThemeTokens:()=>p,generateTailwindCss:()=>y,renderTailwindCss:()=>_,resolveTokenSets:()=>f,toThemeCssVar:()=>u});const a=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i,o=new Set([`default`,`base`,`light`,`theme`]);function s(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function c(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function l(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 u(e){return`--${e.split(`.`).filter(Boolean).filter((e,t,n)=>e!==`DEFAULT`||t!==n.length-1).join(`-`)}`}function d(e,t,n,i){if(!(0,r.isObject)(e))return;let a=c(e,n);if(s(e)){let n=l(e),o=t.join(`.`);i.push({path:o,type:a,value:n,cssValue:(0,r.formatTokenValue)(n,a),cssVar:u(o)});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)||d(r,[...t,n],a,i)}function f(e){if(!(0,r.isObject)(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>a.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function p(e){let t=[];for(let n of f(e)){let e=[];d(n.tokens,[],void 0,e);for(let r of e)t.push({...r,theme:n.id==="default"?void 0:n.id})}return t}function m(e){return e.find(e=>o.has(e.id.toLowerCase()))??e[0]}function h(e){return e.length===0?`@theme {
2
- }
3
- `:`@theme {\n${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
4
- `)}\n}\n`}function g(e){return e.length===0?``:`
5
- @layer theme {
6
- .dark {
7
- ${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
8
- `)}
9
- }
10
- }
11
- `}function _(e,t={}){let n=t.includeImport!==!1,r=e.filter(e=>!e.theme||o.has(e.theme.toLowerCase())),i=e.filter(e=>e.theme?.toLowerCase()===`dark`),a=[];return n&&a.push(`@import "tailwindcss";
12
- `),a.push(h(r)),i.length>0&&a.push(g(i)),`${a.join(`
13
- `).trimEnd()}\n`}async function v(n){if(n.cssPath)return n.cssPath;let{cwd:r}=(0,t.useExecution)();return(await e.t(r)).cssFile??`src/app.css`}async function y(e,t={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let n=f(e.tokens);if(n.length===0||!m(n))return{};let i=p(e.tokens);if(i.length===0)return{};let a=await v(t),o=_(i,t);return{[a]:(0,r.createDocument)(a,o,{name:`razorwind-tailwindcss`},`css`)}}var b=(0,n.definePlugin)(e=>({name:`tailwindcss:generate`,generate:async t=>y(t,e??{})}));exports.default=b,exports.flattenThemeTokens=p,exports.generateTailwindCss=y,exports.renderTailwindCss=_,exports.resolveTokenSets=f,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}}),exports.toThemeCssVar=u;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-CN3e2HJN.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,52 +1,3 @@
1
- import { i as __exportAll, r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-o6IU6Inw.cjs";
2
- import { GeneratorFunctionResult } from "@power-plant/core";
3
- import { Schema, Tokens } from "@razorwind/core/schema";
4
- declare namespace generate_d_exports {
5
- export { FlatThemeToken, TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderTailwindCss, resolveTokenSets, toThemeCssVar };
6
- }
7
- /**
8
- * Convert a DTCG token path into a Tailwind `@theme` custom property.
9
- * Mirrors {@link nestFlatTokens}: `color.primary` → `--color-primary`,
10
- * and strips a trailing `DEFAULT` leaf (`radius.DEFAULT` → `--radius`).
11
- */
12
- declare function toThemeCssVar(path: string): string;
13
- interface TokenSet {
14
- id: string;
15
- tokens: Tokens;
16
- }
17
- /**
18
- * Split `Schema.tokens` into one or more named token sets.
19
- *
20
- * A record whose keys all look like themes (`light`, `dark`, …) is treated as
21
- * multi-theme input; otherwise the whole document is a single set.
22
- */
23
- declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
24
- /**
25
- * Flatten DTCG tokens into Tailwind `@theme` custom-property rows.
26
- */
27
- declare function flattenThemeTokens(tokens: Tokens | Record<string, Tokens>): FlatThemeToken[];
28
- /**
29
- * Render a Tailwind v4 CSS entry from flattened theme tokens.
30
- */
31
- declare function renderTailwindCss(tokens: FlatThemeToken[], options?: Pick<TailwindGeneratePluginOptions, "includeImport">): string;
32
- /**
33
- * Generate a Tailwind v4 CSS entry (`@import` + `@theme`) from a Razorwind schema.
34
- */
35
- declare function generateTailwindCss(spec: Schema, options?: TailwindGeneratePluginOptions): Promise<GeneratorFunctionResult<Schema, TailwindGeneratePluginOptions>>;
36
- /**
37
- * Razorwind plugin: generate a Tailwind v4 CSS entry from schema tokens.
38
- *
39
- * @example
40
- * ```ts
41
- * import { defineConfig } from "@razorwind/core";
42
- * import tailwindcss from "@razorwind/tailwindcss/generate";
43
- *
44
- * export default defineConfig({
45
- * plugins: [tailwindcss()]
46
- * });
47
- * ```
48
- */
49
- declare const _default: (options?: TailwindGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
50
- //#endregion
51
- export { type FlatThemeToken, type TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderTailwindCss, resolveTokenSets, generate_d_exports as t, toThemeCssVar };
52
- //# sourceMappingURL=generate.d.cts.map
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-CtFpoykM.cjs";
3
+ export { type FlatThemeToken, type TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
@@ -1,52 +1,3 @@
1
- import { r as TailwindGeneratePluginOptions, t as FlatThemeToken } from "./types-Cy7QTbNx.mjs";
2
- import { GeneratorFunctionResult } from "@power-plant/core";
3
- import { Schema, Tokens } from "@razorwind/core/schema";
4
- declare namespace generate_d_exports {
5
- export { FlatThemeToken, TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderTailwindCss, resolveTokenSets, toThemeCssVar };
6
- }
7
- /**
8
- * Convert a DTCG token path into a Tailwind `@theme` custom property.
9
- * Mirrors {@link nestFlatTokens}: `color.primary` → `--color-primary`,
10
- * and strips a trailing `DEFAULT` leaf (`radius.DEFAULT` → `--radius`).
11
- */
12
- declare function toThemeCssVar(path: string): string;
13
- interface TokenSet {
14
- id: string;
15
- tokens: Tokens;
16
- }
17
- /**
18
- * Split `Schema.tokens` into one or more named token sets.
19
- *
20
- * A record whose keys all look like themes (`light`, `dark`, …) is treated as
21
- * multi-theme input; otherwise the whole document is a single set.
22
- */
23
- declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
24
- /**
25
- * Flatten DTCG tokens into Tailwind `@theme` custom-property rows.
26
- */
27
- declare function flattenThemeTokens(tokens: Tokens | Record<string, Tokens>): FlatThemeToken[];
28
- /**
29
- * Render a Tailwind v4 CSS entry from flattened theme tokens.
30
- */
31
- declare function renderTailwindCss(tokens: FlatThemeToken[], options?: Pick<TailwindGeneratePluginOptions, "includeImport">): string;
32
- /**
33
- * Generate a Tailwind v4 CSS entry (`@import` + `@theme`) from a Razorwind schema.
34
- */
35
- declare function generateTailwindCss(spec: Schema, options?: TailwindGeneratePluginOptions): Promise<GeneratorFunctionResult<Schema, TailwindGeneratePluginOptions>>;
36
- /**
37
- * Razorwind plugin: generate a Tailwind v4 CSS entry from schema tokens.
38
- *
39
- * @example
40
- * ```ts
41
- * import { defineConfig } from "@razorwind/core";
42
- * import tailwindcss from "@razorwind/tailwindcss/generate";
43
- *
44
- * export default defineConfig({
45
- * plugins: [tailwindcss()]
46
- * });
47
- * ```
48
- */
49
- declare const _default: (options?: TailwindGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
50
- //#endregion
51
- export { type FlatThemeToken, type TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderTailwindCss, resolveTokenSets, generate_d_exports as t, toThemeCssVar };
52
- //# sourceMappingURL=generate.d.mts.map
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-OJ9Icif0.mjs";
3
+ export { type FlatThemeToken, type TailwindGeneratePluginOptions, _default as default, flattenThemeTokens, generateTailwindCss, renderInstallMd, renderTailwindCss, resolveTokenSets, toThemeCssVar };
package/dist/generate.mjs CHANGED
@@ -1,14 +1 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{t}from"./extract-DQ9VSzv_.mjs";import{useExecution as n}from"@power-plant/core";import{definePlugin as r}from"@razorwind/core/plugin";import{createDocument as i,formatTokenValue as a,isObject as o}from"@razorwind/core/utils";var s=e({default:()=>C,flattenThemeTokens:()=>g,generateTailwindCss:()=>S,renderTailwindCss:()=>b,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(!o(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:a(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(!o(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 {
2
- }
3
- `:`@theme {\n${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
4
- `)}\n}\n`}function y(e){return e.length===0?``:`
5
- @layer theme {
6
- .dark {
7
- ${e.slice().sort((e,t)=>e.cssVar.localeCompare(t.cssVar)).map(e=>` ${e.cssVar}: ${e.cssValue};`).join(`
8
- `)}
9
- }
10
- }
11
- `}function b(e,t={}){let n=t.includeImport!==!1,r=e.filter(e=>!e.theme||l.has(e.theme.toLowerCase())),i=e.filter(e=>e.theme?.toLowerCase()===`dark`),a=[];return n&&a.push(`@import "tailwindcss";
12
- `),a.push(v(r)),i.length>0&&a.push(y(i)),`${a.join(`
13
- `).trimEnd()}\n`}async function x(e){if(e.cssPath)return e.cssPath;let{cwd:r}=n();return(await t(r)).cssFile??`src/app.css`}async function S(e,t={}){if(!e.tokens||Object.keys(e.tokens).length===0)return{};let n=h(e.tokens);if(n.length===0||!_(n))return{};let r=g(e.tokens);if(r.length===0)return{};let a=await x(t),o=b(r,t);return{[a]:i(a,o,{name:`razorwind-tailwindcss`},`css`)}}var C=r(e=>({name:`tailwindcss:generate`,generate:async t=>S(t,e??{})}));export{C as default,g as flattenThemeTokens,S as generateTailwindCss,b as renderTailwindCss,h as resolveTokenSets,s as t,p as toThemeCssVar};
14
- //# sourceMappingURL=generate.mjs.map
1
+ import{a as e,c as t,n,o as r,r as i,s as a,t as o}from"./generate-DljVzG07.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-DebhqpQQ.cjs"),t=require("./generate.cjs");Object.defineProperty(exports,"extract",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(exports,"generate",{enumerable:!0,get:function(){return t.t}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract-DebhqpQQ.cjs"),t=require("./generate-CN3e2HJN.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
- import { a as extract_d_exports } from "./extract-QsaKglv1.cjs";
2
- import { t as generate_d_exports } from "./generate.cjs";
1
+ import { a as extract_d_exports } from "./extract-DtoWdPiV.cjs";
2
+ import { i as generate_d_exports } from "./generate-CtFpoykM.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
- import { a as extract_d_exports } from "./extract-Dc7HWHSe.mjs";
2
- import { t as generate_d_exports } from "./generate.mjs";
1
+ import { a as extract_d_exports } from "./extract-yB1GBvRe.mjs";
2
+ import { i as generate_d_exports } from "./generate-OJ9Icif0.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-DQ9VSzv_.mjs";import{t}from"./generate.mjs";export{e as extract,t as generate};
1
+ import{i as e}from"./extract-DQ9VSzv_.mjs";import{i as t}from"./generate-DljVzG07.mjs";export{e as extract,t as generate};
@@ -33,6 +33,11 @@ interface TailwindGeneratePluginOptions {
33
33
  * @defaultValue true
34
34
  */
35
35
  includeImport?: boolean;
36
+ /**
37
+ * Override body for generated `INSTALL.md`. When omitted, Tailwind CSS
38
+ * wiring steps are generated for the output file.
39
+ */
40
+ installGuide?: string;
36
41
  }
37
42
  /**
38
43
  * A flattened design token ready for Tailwind `@theme` emission.
@@ -53,4 +58,4 @@ interface FlatThemeToken {
53
58
  }
54
59
  //#endregion
55
60
  export { __exportAll as i, TailwindExtractPluginOptions as n, TailwindGeneratePluginOptions as r, FlatThemeToken as t };
56
- //# sourceMappingURL=types-o6IU6Inw.d.cts.map
61
+ //# sourceMappingURL=types-Bp1KBCUc.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Bp1KBCUc.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;UAqBiB;;;;;;EAMf;;;;;;;EAQA;;;;;UAMe;;;;;EAKf;;;;;;EAOA;;;;;EAMA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA"}
@@ -32,6 +32,11 @@ interface TailwindGeneratePluginOptions {
32
32
  * @defaultValue true
33
33
  */
34
34
  includeImport?: boolean;
35
+ /**
36
+ * Override body for generated `INSTALL.md`. When omitted, Tailwind CSS
37
+ * wiring steps are generated for the output file.
38
+ */
39
+ installGuide?: string;
35
40
  }
36
41
  /**
37
42
  * A flattened design token ready for Tailwind `@theme` emission.
@@ -52,4 +57,4 @@ interface FlatThemeToken {
52
57
  }
53
58
  //#endregion
54
59
  export { TailwindExtractPluginOptions as n, TailwindGeneratePluginOptions as r, FlatThemeToken as t };
55
- //# sourceMappingURL=types-Cy7QTbNx.d.mts.map
60
+ //# sourceMappingURL=types-CGnL0PxK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CGnL0PxK.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/tailwindcss",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
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": {
@@ -78,9 +78,9 @@
78
78
  "types": "./dist/index.d.cts",
79
79
  "typings": "dist/index.d.mts",
80
80
  "dependencies": {
81
- "@power-plant/core": "^0.0.75",
81
+ "@power-plant/core": "^0.0.81",
82
82
  "@power-plant/dtcg-schema": "^0.0.1",
83
- "@razorwind/core": "0.0.29",
83
+ "@razorwind/core": "^0.0.30",
84
84
  "@stryke/fs": "^0.33.103",
85
85
  "@stryke/path": "^0.29.29",
86
86
  "@stryke/type-checks": "^0.6.35",
@@ -90,10 +90,10 @@
90
90
  "tailwindcss": "^4.3.3"
91
91
  },
92
92
  "devDependencies": {
93
- "@powerlines/plugin-tsdown": "^0.1.589",
93
+ "@powerlines/plugin-tsdown": "^0.1.590",
94
94
  "@types/node": "^25.9.5",
95
95
  "typescript": "^6.0.3"
96
96
  },
97
97
  "publishConfig": { "access": "public" },
98
- "gitHead": "a861c6938501ed645ccdcd3970fc1164d110b4ed"
98
+ "gitHead": "11a6e827627acf51ef0044e366fd9493f2173ec2"
99
99
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"extract-Dc7HWHSe.d.mts","names":[],"sources":["../src/workspace.ts","../src/extract.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.cts","names":[],"sources":["../src/generate.ts"],"mappings":";;;;;;;;;;;iBA4EgB,cAAc;UA6CpB;EACR;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAwBa,mBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBA0Da,kBACd,QAAQ,kBACR,UAAS,KAAK;;;;iBAqCM,oBACpB,MAAM,QACN,UAAS,gCACR,QAAQ,wBAAwB,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-Cy7QTbNx.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-o6IU6Inw.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;UAqBiB;;;;;;EAMf;;;;;;;EAQA;;;;;UAMe;;;;;EAKf;;;;;;EAOA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA"}