@razorwind/tailwindcss 0.0.4 → 0.0.6

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.
@@ -0,0 +1,51 @@
1
+ import { i as __exportAll, n as TailwindExtractPluginOptions } from "./types-o6IU6Inw.cjs";
2
+ import { Tokens } from "@power-plant/dtcg-schema";
3
+ import { PackageJson } from "@stryke/types/package-json";
4
+ //#region src/workspace.d.ts
5
+ declare function getPackageInfo(cwd?: string): Promise<PackageJson | null>;
6
+ declare namespace extract_d_exports {
7
+ export { TailwindExtractPluginOptions, TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
8
+ }
9
+ interface TailwindWorkspaceInfo {
10
+ configured: boolean;
11
+ version: "v3" | "v4" | null;
12
+ cssFile: string | null;
13
+ configFile: string | null;
14
+ }
15
+ declare function getTailwindVersion(cwd: string): Promise<TailwindWorkspaceInfo["version"]>;
16
+ declare function getTailwindCssFile(cwd: string, configCssFile?: string): Promise<string | null>;
17
+ declare function getTailwindConfigFile(cwd: string): Promise<string | null>;
18
+ /**
19
+ * Detect whether the workspace has Tailwind CSS configured.
20
+ */
21
+ declare function detectTailwindWorkspace(cwd: string, cssPathHint?: string | null): Promise<TailwindWorkspaceInfo>;
22
+ /**
23
+ * Resolve the absolute CSS entry used for Tailwind theme extraction.
24
+ */
25
+ declare function resolveTailwindCssEntry(cwd: string, candidates: Array<string | null | undefined>): string | null;
26
+ /**
27
+ * Extract design tokens from a Tailwind v4 CSS entry via `@tailwindcss/node`.
28
+ *
29
+ * Uses `__unstable__loadDesignSystem` so `@import` graphs resolve and theme
30
+ * namespaces merge the same way the Tailwind engine does.
31
+ */
32
+ declare function extractTailwindTokens(options: TailwindExtractPluginOptions & {
33
+ cwd: string;
34
+ }): Promise<Tokens | undefined>;
35
+ /**
36
+ * Razorwind plugin: extract design tokens from Tailwind v4 `@theme` CSS.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { defineConfig } from "@razorwind/core";
41
+ * import tailwindcss from "@razorwind/tailwindcss/extract";
42
+ *
43
+ * export default defineConfig({
44
+ * plugins: [tailwindcss()]
45
+ * });
46
+ * ```
47
+ */
48
+ declare const _default: (options: any) => import("@razorwind/core/plugin").Plugin;
49
+ //#endregion
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-CAhgyV6a.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-CAhgyV6a.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"}
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("@power-plant/core"),u=require("@razorwind/core/plugin"),d=require("@razorwind/core/tokens"),f=require("@stryke/fs/exists"),p=require("@stryke/fs/read-file"),m=require("@stryke/path/append"),h=require("@stryke/type-checks/is-set-string"),g=require("fast-glob");g=c(g,1);let _=require("node:path");_=c(_,1);let v=require("@stryke/fs/json");async function y(e=``){return(0,v.readJsonFile)(_.default.join(e,`package.json`))}var b=o({default:()=>A,detectTailwindWorkspace:()=>D,extractTailwindTokens:()=>k,getPackageInfo:()=>y,getTailwindConfigFile:()=>E,getTailwindCssFile:()=>T,getTailwindVersion:()=>w,resolveTailwindCssEntry:()=>O});const x=[`**/node_modules/**`,`**/.git/**`,`**/dist/**`,`**/build/**`,`**/.next/**`,`**/.nuxt/**`,`**/.turbo/**`,`**/coverage/**`];async function S(){try{return await import(`@tailwindcss/node`)}catch(e){throw Error(`Cannot load '@tailwindcss/node'. Install tailwindcss v4 / @tailwindcss/node to extract workspace theme tokens.`,{cause:e})}}function C(e,t){return(0,_.isAbsolute)(t)?t:(0,_.resolve)(e,t)}async function w(e){let t=await y(e);return!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||``)?`v3`:`v4`}async function T(e,t){if(t&&(0,f.existsSync)((0,_.resolve)(e,t)))return t;let n=await g.default.glob([`**/*.css`,`**/*.scss`],{cwd:e,deep:5,ignore:x});if(!n.length)return null;for(let t of n){let n=await(0,p.readFile)((0,_.resolve)(e,t));if(n.includes(`@import "tailwindcss"`)||n.includes(`@import 'tailwindcss'`)||n.includes(`@tailwind base`))return t}return null}async function E(e){return(await g.default.glob(`tailwind.config.*`,{cwd:e,deep:3,ignore:x}))[0]??null}async function D(e,t){let[n,r,i]=await Promise.all([w(e),T(e,t??void 0),E(e)]);return{configured:!!(n&&r),version:n,cssFile:r,configFile:i}}function O(e,t){for(let n of t){if(!(0,h.isSetString)(n))continue;let t=C(e,n);if((0,f.existsSync)(t))return t}return null}async function k(e){let{cwd:t,cssPath:n,omitDefaults:r=!1}=e,i=await D(t,n);if(!i.configured||i.version!==`v4`)return;let a=O(t,[n,i.cssFile]);if(!a)return;let o=await(0,p.readFile)(a),s=await(await S()).__unstable__loadDesignSystem(o,{base:(0,_.dirname)(a)}),c={};for(let[e,t]of s.theme.entries())r&&(t.options&4)==4||!e.startsWith(`--`)||!t.value||(c[e]=t.value);if(Object.keys(c).length!==0)return(0,d.nestFlatTokens)(c)}var A=(0,u.definePlugin)((e={})=>({name:`tailwindcss:extract`,extract:async t=>{if(t.tokens&&Object.keys(t.tokens).length>0)return t;let{cwd:n}=(0,l.useExecution)(),r=await D(n,e.cssPath);if(!r.configured||r.version!==`v4`)return t;let i=await k({cwd:n,cssPath:e.cssPath?(0,m.appendPath)(e.cssPath,n):r.cssFile,omitDefaults:e.omitDefaults});return!i||Object.keys(i).length===0?t:{...t,tokens:i}}}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return o}});
@@ -0,0 +1,51 @@
1
+ import { n as TailwindExtractPluginOptions } from "./types-Cy7QTbNx.mjs";
2
+ import { Tokens } from "@power-plant/dtcg-schema";
3
+ import { PackageJson } from "@stryke/types/package-json";
4
+ //#region src/workspace.d.ts
5
+ declare function getPackageInfo(cwd?: string): Promise<PackageJson | null>;
6
+ declare namespace extract_d_exports {
7
+ export { TailwindExtractPluginOptions, TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
8
+ }
9
+ interface TailwindWorkspaceInfo {
10
+ configured: boolean;
11
+ version: "v3" | "v4" | null;
12
+ cssFile: string | null;
13
+ configFile: string | null;
14
+ }
15
+ declare function getTailwindVersion(cwd: string): Promise<TailwindWorkspaceInfo["version"]>;
16
+ declare function getTailwindCssFile(cwd: string, configCssFile?: string): Promise<string | null>;
17
+ declare function getTailwindConfigFile(cwd: string): Promise<string | null>;
18
+ /**
19
+ * Detect whether the workspace has Tailwind CSS configured.
20
+ */
21
+ declare function detectTailwindWorkspace(cwd: string, cssPathHint?: string | null): Promise<TailwindWorkspaceInfo>;
22
+ /**
23
+ * Resolve the absolute CSS entry used for Tailwind theme extraction.
24
+ */
25
+ declare function resolveTailwindCssEntry(cwd: string, candidates: Array<string | null | undefined>): string | null;
26
+ /**
27
+ * Extract design tokens from a Tailwind v4 CSS entry via `@tailwindcss/node`.
28
+ *
29
+ * Uses `__unstable__loadDesignSystem` so `@import` graphs resolve and theme
30
+ * namespaces merge the same way the Tailwind engine does.
31
+ */
32
+ declare function extractTailwindTokens(options: TailwindExtractPluginOptions & {
33
+ cwd: string;
34
+ }): Promise<Tokens | undefined>;
35
+ /**
36
+ * Razorwind plugin: extract design tokens from Tailwind v4 `@theme` CSS.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { defineConfig } from "@razorwind/core";
41
+ * import tailwindcss from "@razorwind/tailwindcss/extract";
42
+ *
43
+ * export default defineConfig({
44
+ * plugins: [tailwindcss()]
45
+ * });
46
+ * ```
47
+ */
48
+ declare const _default: (options: any) => import("@razorwind/core/plugin").Plugin;
49
+ //#endregion
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-CxYfJJnQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-CxYfJJnQ.d.mts","names":[],"sources":["../src/workspace.ts","../src/extract.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{useExecution as t}from"@power-plant/core";import{definePlugin as n}from"@razorwind/core/plugin";import{nestFlatTokens as r}from"@razorwind/core/tokens";import{existsSync as i}from"@stryke/fs/exists";import{readFile as a}from"@stryke/fs/read-file";import{appendPath as o}from"@stryke/path/append";import{isSetString as s}from"@stryke/type-checks/is-set-string";import c from"fast-glob";import l,{dirname as u,isAbsolute as d,resolve as f}from"node:path";import{readJsonFile as p}from"@stryke/fs/json";async function m(e=``){return p(l.join(e,`package.json`))}var h=e({default:()=>T,detectTailwindWorkspace:()=>S,extractTailwindTokens:()=>w,getPackageInfo:()=>m,getTailwindConfigFile:()=>x,getTailwindCssFile:()=>b,getTailwindVersion:()=>y,resolveTailwindCssEntry:()=>C});const g=[`**/node_modules/**`,`**/.git/**`,`**/dist/**`,`**/build/**`,`**/.next/**`,`**/.nuxt/**`,`**/.turbo/**`,`**/coverage/**`];async function _(){try{return await import(`@tailwindcss/node`)}catch(e){throw Error(`Cannot load '@tailwindcss/node'. Install tailwindcss v4 / @tailwindcss/node to extract workspace theme tokens.`,{cause:e})}}function v(e,t){return d(t)?t:f(e,t)}async function y(e){let t=await m(e);return!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||``)?`v3`:`v4`}async function b(e,t){if(t&&i(f(e,t)))return t;let n=await c.glob([`**/*.css`,`**/*.scss`],{cwd:e,deep:5,ignore:g});if(!n.length)return null;for(let t of n){let n=await a(f(e,t));if(n.includes(`@import "tailwindcss"`)||n.includes(`@import 'tailwindcss'`)||n.includes(`@tailwind base`))return t}return null}async function x(e){return(await c.glob(`tailwind.config.*`,{cwd:e,deep:3,ignore:g}))[0]??null}async function S(e,t){let[n,r,i]=await Promise.all([y(e),b(e,t??void 0),x(e)]);return{configured:!!(n&&r),version:n,cssFile:r,configFile:i}}function C(e,t){for(let n of t){if(!s(n))continue;let t=v(e,n);if(i(t))return t}return null}async function w(e){let{cwd:t,cssPath:n,omitDefaults:i=!1}=e,o=await S(t,n);if(!o.configured||o.version!==`v4`)return;let s=C(t,[n,o.cssFile]);if(!s)return;let c=await a(s),l=await(await _()).__unstable__loadDesignSystem(c,{base:u(s)}),d={};for(let[e,t]of l.theme.entries())i&&(t.options&4)==4||!e.startsWith(`--`)||!t.value||(d[e]=t.value);if(Object.keys(d).length!==0)return r(d)}var T=n((e={})=>({name:`tailwindcss:extract`,extract:async n=>{if(n.tokens&&Object.keys(n.tokens).length>0)return n;let{cwd:r}=t(),i=await S(r,e.cssPath);if(!i.configured||i.version!==`v4`)return n;let a=await w({cwd:r,cssPath:e.cssPath?o(e.cssPath,r):i.cssFile,omitDefaults:e.omitDefaults});return!a||Object.keys(a).length===0?n:{...n,tokens:a}}}));export{x as a,C as c,h as i,m as l,w as n,b as o,T as r,y as s,S as t};
2
+ //# sourceMappingURL=extract-DScDWodA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-DScDWodA.mjs","names":[],"sources":[],"mappings":""}
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./extract-CjHUvidG.cjs");exports.default=e.r,exports.detectTailwindWorkspace=e.t,exports.extractTailwindTokens=e.n,exports.getPackageInfo=e.l,exports.getTailwindConfigFile=e.a,exports.getTailwindCssFile=e.o,exports.getTailwindVersion=e.s,exports.resolveTailwindCssEntry=e.c;
@@ -0,0 +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-CAhgyV6a.cjs";
3
+ export { type TailwindExtractPluginOptions, TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
@@ -0,0 +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-CxYfJJnQ.mjs";
3
+ export { type TailwindExtractPluginOptions, TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
@@ -0,0 +1 @@
1
+ import{a as e,c as t,l as n,n as r,o as i,r as a,s as o,t as s}from"./extract-DScDWodA.mjs";export{a as default,s as detectTailwindWorkspace,r as extractTailwindTokens,n as getPackageInfo,e as getTailwindConfigFile,i as getTailwindCssFile,o as getTailwindVersion,t as resolveTailwindCssEntry};
@@ -0,0 +1,13 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./extract-CjHUvidG.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(`$`));return t.length>0&&t.every(e=>a.test(e))?t.map(t=>({id:t,tokens:e[t]})):[{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;
@@ -0,0 +1,52 @@
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: any) => 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
@@ -0,0 +1 @@
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;;;;iBAsBa,mBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBA0Da,kBACd,QAAQ,kBACR,UAAS,KAAK;;;;iBAqCM,oBACpB,MAAM,QACN,UAAS,gCACR,QAAQ,wBAAwB,QAAQ"}
@@ -0,0 +1,52 @@
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: any) => 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{t}from"./extract-DScDWodA.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(`$`));return t.length>0&&t.every(e=>c.test(e))?t.map(t=>({id:t,tokens:e[t]})):[{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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.mjs","names":[],"sources":[],"mappings":""}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("@power-plant/core"),l=require("@razorwind/core/plugin"),u=require("@stryke/path/append"),d=require("@stryke/type-checks/is-empty-object"),f=require("@razorwind/core/tokens"),p=require("@stryke/fs/exists"),m=require("@stryke/fs/read-file"),h=require("@stryke/type-checks/is-set-string"),g=require("fast-glob");g=s(g,1);let _=require("node:path");_=s(_,1);let v=require("@stryke/fs/json");async function y(e=``){return(0,v.readJsonFile)(_.default.join(e,`package.json`))}const b=[`**/node_modules/**`,`**/.git/**`,`**/dist/**`,`**/build/**`,`**/.next/**`,`**/.nuxt/**`,`**/.turbo/**`,`**/coverage/**`];async function x(){try{return await import(`@tailwindcss/node`)}catch(e){throw Error(`Cannot load '@tailwindcss/node'. Install tailwindcss v4 / @tailwindcss/node to extract workspace theme tokens.`,{cause:e})}}function S(e,t){return(0,_.isAbsolute)(t)?t:(0,_.resolve)(e,t)}async function C(e){let t=await y(e);return!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||``)?`v3`:`v4`}async function w(e,t){if(t&&(0,p.existsSync)((0,_.resolve)(e,t)))return t;let n=await g.default.glob([`**/*.css`,`**/*.scss`],{cwd:e,deep:5,ignore:b});if(!n.length)return null;for(let t of n){let n=await(0,m.readFile)((0,_.resolve)(e,t));if(n.includes(`@import "tailwindcss"`)||n.includes(`@import 'tailwindcss'`)||n.includes(`@tailwind base`))return t}return null}async function T(e){return(await g.default.glob(`tailwind.config.*`,{cwd:e,deep:3,ignore:b}))[0]??null}async function E(e,t){let[n,r,i]=await Promise.all([C(e),w(e,t??void 0),T(e)]);return{configured:!!(n&&r),version:n,cssFile:r,configFile:i}}function D(e,t){for(let n of t){if(!(0,h.isSetString)(n))continue;let t=S(e,n);if((0,p.existsSync)(t))return t}return null}async function O(e){let{cwd:t,cssPath:n,omitDefaults:r=!1}=e,i=await E(t,n);if(!i.configured||i.version!==`v4`)return;let a=D(t,[n,i.cssFile]);if(!a)return;let o=await(0,m.readFile)(a),s=await(await x()).__unstable__loadDesignSystem(o,{base:(0,_.dirname)(a)}),c={};for(let[e,t]of s.theme.entries())r&&(t.options&4)==4||!e.startsWith(`--`)||!t.value||(c[e]=t.value);if(Object.keys(c).length!==0)return(0,f.nestFlatTokens)(c)}var k=(0,l.definePlugin)((e={})=>({name:`razorwind-tailwindcss`,extract:async t=>{if(t.tokens&&!(0,d.isEmptyObject)(t.tokens))return t;let{cwd:n}=(0,c.useExecution)(),r=await E(n,e.cssPath);if(!r.configured||r.version!==`v4`)return t;let i=await O({cwd:n,cssPath:e.cssPath?(0,u.appendPath)(e.cssPath,n):r.cssFile,omitDefaults:e.omitDefaults});return!i||(0,d.isEmptyObject)(i)?t:{...t,tokens:i}}}));exports.default=k,exports.detectTailwindWorkspace=E,exports.extractTailwindTokens=O,exports.getPackageInfo=y,exports.getTailwindConfigFile=T,exports.getTailwindCssFile=w,exports.getTailwindVersion=C,exports.resolveTailwindCssEntry=D;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract-CjHUvidG.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}});
package/dist/index.d.cts CHANGED
@@ -1,65 +1,3 @@
1
- import { Tokens } from "@power-plant/dtcg-schema";
2
- import { PackageJson } from "@stryke/types/package-json";
3
- //#region src/types.d.ts
4
- interface TailwindPluginOptions {
5
- /**
6
- * Optional CSS entry override (registry `tailwind.css` / explicit path).
7
- */
8
- cssPath?: string | null;
9
- /**
10
- * When true, skip entries that carry only the DEFAULT theme option bit.
11
- *
12
- * @defaultValue false
13
- */
14
- omitDefaults?: boolean;
15
- }
16
- //#endregion
17
- //#region src/extract.d.ts
18
- interface TailwindWorkspaceInfo {
19
- configured: boolean;
20
- version: "v3" | "v4" | null;
21
- cssFile: string | null;
22
- configFile: string | null;
23
- }
24
- declare function getTailwindVersion(cwd: string): Promise<TailwindWorkspaceInfo["version"]>;
25
- declare function getTailwindCssFile(cwd: string, configCssFile?: string): Promise<string | null>;
26
- declare function getTailwindConfigFile(cwd: string): Promise<string | null>;
27
- /**
28
- * Detect whether the workspace has Tailwind CSS configured.
29
- */
30
- declare function detectTailwindWorkspace(cwd: string, cssPathHint?: string | null): Promise<TailwindWorkspaceInfo>;
31
- /**
32
- * Resolve the absolute CSS entry used for Tailwind theme extraction.
33
- */
34
- declare function resolveTailwindCssEntry(cwd: string, candidates: Array<string | null | undefined>): string | null;
35
- /**
36
- * Extract design tokens from a Tailwind v4 CSS entry via `@tailwindcss/node`.
37
- *
38
- * Uses `__unstable__loadDesignSystem` so `@import` graphs resolve and theme
39
- * namespaces merge the same way the Tailwind engine does.
40
- */
41
- declare function extractTailwindTokens(options: TailwindPluginOptions & {
42
- cwd: string;
43
- }): Promise<Tokens | undefined>;
44
- //#endregion
45
- //#region src/workspace.d.ts
46
- declare function getPackageInfo(cwd?: string): Promise<PackageJson | null>;
47
- //#endregion
48
- //#region src/index.d.ts
49
- /**
50
- * Razorwind plugin: extract design tokens from Tailwind v4 `@theme` CSS.
51
- *
52
- * @example
53
- * ```ts
54
- * import { defineConfig } from "@razorwind/core";
55
- * import tailwindcss from "@razorwind/tailwindcss";
56
- *
57
- * export default defineConfig({
58
- * plugins: [tailwindcss()]
59
- * });
60
- * ```
61
- */
62
- declare const _default: any;
63
- //#endregion
64
- export { type TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
65
- //# sourceMappingURL=index.d.cts.map
1
+ import { a as extract_d_exports } from "./extract-CAhgyV6a.cjs";
2
+ import { t as generate_d_exports } from "./generate.cjs";
3
+ export { extract_d_exports as extract, generate_d_exports as generate };
package/dist/index.d.mts CHANGED
@@ -1,65 +1,3 @@
1
- import { Tokens } from "@power-plant/dtcg-schema";
2
- import { PackageJson } from "@stryke/types/package-json";
3
- //#region src/types.d.ts
4
- interface TailwindPluginOptions {
5
- /**
6
- * Optional CSS entry override (registry `tailwind.css` / explicit path).
7
- */
8
- cssPath?: string | null;
9
- /**
10
- * When true, skip entries that carry only the DEFAULT theme option bit.
11
- *
12
- * @defaultValue false
13
- */
14
- omitDefaults?: boolean;
15
- }
16
- //#endregion
17
- //#region src/extract.d.ts
18
- interface TailwindWorkspaceInfo {
19
- configured: boolean;
20
- version: "v3" | "v4" | null;
21
- cssFile: string | null;
22
- configFile: string | null;
23
- }
24
- declare function getTailwindVersion(cwd: string): Promise<TailwindWorkspaceInfo["version"]>;
25
- declare function getTailwindCssFile(cwd: string, configCssFile?: string): Promise<string | null>;
26
- declare function getTailwindConfigFile(cwd: string): Promise<string | null>;
27
- /**
28
- * Detect whether the workspace has Tailwind CSS configured.
29
- */
30
- declare function detectTailwindWorkspace(cwd: string, cssPathHint?: string | null): Promise<TailwindWorkspaceInfo>;
31
- /**
32
- * Resolve the absolute CSS entry used for Tailwind theme extraction.
33
- */
34
- declare function resolveTailwindCssEntry(cwd: string, candidates: Array<string | null | undefined>): string | null;
35
- /**
36
- * Extract design tokens from a Tailwind v4 CSS entry via `@tailwindcss/node`.
37
- *
38
- * Uses `__unstable__loadDesignSystem` so `@import` graphs resolve and theme
39
- * namespaces merge the same way the Tailwind engine does.
40
- */
41
- declare function extractTailwindTokens(options: TailwindPluginOptions & {
42
- cwd: string;
43
- }): Promise<Tokens | undefined>;
44
- //#endregion
45
- //#region src/workspace.d.ts
46
- declare function getPackageInfo(cwd?: string): Promise<PackageJson | null>;
47
- //#endregion
48
- //#region src/index.d.ts
49
- /**
50
- * Razorwind plugin: extract design tokens from Tailwind v4 `@theme` CSS.
51
- *
52
- * @example
53
- * ```ts
54
- * import { defineConfig } from "@razorwind/core";
55
- * import tailwindcss from "@razorwind/tailwindcss";
56
- *
57
- * export default defineConfig({
58
- * plugins: [tailwindcss()]
59
- * });
60
- * ```
61
- */
62
- declare const _default: any;
63
- //#endregion
64
- export { type TailwindWorkspaceInfo, _default as default, detectTailwindWorkspace, extractTailwindTokens, getPackageInfo, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, resolveTailwindCssEntry };
65
- //# sourceMappingURL=index.d.mts.map
1
+ import { a as extract_d_exports } from "./extract-CxYfJJnQ.mjs";
2
+ import { t as generate_d_exports } from "./generate.mjs";
3
+ export { extract_d_exports as extract, generate_d_exports as generate };
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import{useExecution as e}from"@power-plant/core";import{definePlugin as t}from"@razorwind/core/plugin";import{appendPath as n}from"@stryke/path/append";import{isEmptyObject as r}from"@stryke/type-checks/is-empty-object";import{nestFlatTokens as i}from"@razorwind/core/tokens";import{existsSync as a}from"@stryke/fs/exists";import{readFile as o}from"@stryke/fs/read-file";import{isSetString as s}from"@stryke/type-checks/is-set-string";import c from"fast-glob";import l,{dirname as u,isAbsolute as d,resolve as f}from"node:path";import{readJsonFile as p}from"@stryke/fs/json";async function m(e=``){return p(l.join(e,`package.json`))}const h=[`**/node_modules/**`,`**/.git/**`,`**/dist/**`,`**/build/**`,`**/.next/**`,`**/.nuxt/**`,`**/.turbo/**`,`**/coverage/**`];async function g(){try{return await import(`@tailwindcss/node`)}catch(e){throw Error(`Cannot load '@tailwindcss/node'. Install tailwindcss v4 / @tailwindcss/node to extract workspace theme tokens.`,{cause:e})}}function _(e,t){return d(t)?t:f(e,t)}async function v(e){let t=await m(e);return!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||``)?`v3`:`v4`}async function y(e,t){if(t&&a(f(e,t)))return t;let n=await c.glob([`**/*.css`,`**/*.scss`],{cwd:e,deep:5,ignore:h});if(!n.length)return null;for(let t of n){let n=await o(f(e,t));if(n.includes(`@import "tailwindcss"`)||n.includes(`@import 'tailwindcss'`)||n.includes(`@tailwind base`))return t}return null}async function b(e){return(await c.glob(`tailwind.config.*`,{cwd:e,deep:3,ignore:h}))[0]??null}async function x(e,t){let[n,r,i]=await Promise.all([v(e),y(e,t??void 0),b(e)]);return{configured:!!(n&&r),version:n,cssFile:r,configFile:i}}function S(e,t){for(let n of t){if(!s(n))continue;let t=_(e,n);if(a(t))return t}return null}async function C(e){let{cwd:t,cssPath:n,omitDefaults:r=!1}=e,a=await x(t,n);if(!a.configured||a.version!==`v4`)return;let s=S(t,[n,a.cssFile]);if(!s)return;let c=await o(s),l=await(await g()).__unstable__loadDesignSystem(c,{base:u(s)}),d={};for(let[e,t]of l.theme.entries())r&&(t.options&4)==4||!e.startsWith(`--`)||!t.value||(d[e]=t.value);if(Object.keys(d).length!==0)return i(d)}var w=t((t={})=>({name:`razorwind-tailwindcss`,extract:async i=>{if(i.tokens&&!r(i.tokens))return i;let{cwd:a}=e(),o=await x(a,t.cssPath);if(!o.configured||o.version!==`v4`)return i;let s=await C({cwd:a,cssPath:t.cssPath?n(t.cssPath,a):o.cssFile,omitDefaults:t.omitDefaults});return!s||r(s)?i:{...i,tokens:s}}}));export{w as default,x as detectTailwindWorkspace,C as extractTailwindTokens,m as getPackageInfo,b as getTailwindConfigFile,y as getTailwindCssFile,v as getTailwindVersion,S as resolveTailwindCssEntry};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{i as e}from"./extract-DScDWodA.mjs";import{t}from"./generate.mjs";export{e as extract,t as generate};
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{t};
@@ -0,0 +1,55 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * Options for the Razorwind Tailwind CSS extract plugin.
4
+ */
5
+ interface TailwindExtractPluginOptions {
6
+ /**
7
+ * Optional CSS entry override used for extraction (registry `tailwind.css`
8
+ * / explicit path to read). When omitted, the detected workspace CSS entry
9
+ * is used.
10
+ */
11
+ cssPath?: string | null;
12
+ /**
13
+ * When true, skip entries that carry only the DEFAULT theme option bit
14
+ * during extraction.
15
+ *
16
+ * @defaultValue false
17
+ */
18
+ omitDefaults?: boolean;
19
+ }
20
+ /**
21
+ * Options for the Razorwind Tailwind CSS generate plugin.
22
+ */
23
+ interface TailwindGeneratePluginOptions {
24
+ /**
25
+ * Output path written relative to the execution cwd. When omitted, the
26
+ * detected workspace CSS entry is used (falling back to `src/app.css`).
27
+ */
28
+ cssPath?: string | null;
29
+ /**
30
+ * When generating CSS, include `@import "tailwindcss";` at the top of the file.
31
+ *
32
+ * @defaultValue true
33
+ */
34
+ includeImport?: boolean;
35
+ }
36
+ /**
37
+ * A flattened design token ready for Tailwind `@theme` emission.
38
+ */
39
+ interface FlatThemeToken {
40
+ /** Dot-separated token path (e.g. `color.primary`). */
41
+ path: string;
42
+ /** DTCG `$type`, when known. */
43
+ type?: string;
44
+ /** Raw `$value` from the token document. */
45
+ value: unknown;
46
+ /** CSS-friendly string form of {@link value}. */
47
+ cssValue: string;
48
+ /** Tailwind theme custom property (e.g. `--color-primary`). */
49
+ cssVar: string;
50
+ /** Optional theme id when tokens are multi-theme (`light` / `dark`). */
51
+ theme?: string;
52
+ }
53
+ //#endregion
54
+ export { TailwindExtractPluginOptions as n, TailwindGeneratePluginOptions as r, FlatThemeToken as t };
55
+ //# sourceMappingURL=types-Cy7QTbNx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Cy7QTbNx.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
@@ -0,0 +1,56 @@
1
+ //#endregion
2
+ //#region src/types.d.ts
3
+ /**
4
+ * Options for the Razorwind Tailwind CSS extract plugin.
5
+ */
6
+ interface TailwindExtractPluginOptions {
7
+ /**
8
+ * Optional CSS entry override used for extraction (registry `tailwind.css`
9
+ * / explicit path to read). When omitted, the detected workspace CSS entry
10
+ * is used.
11
+ */
12
+ cssPath?: string | null;
13
+ /**
14
+ * When true, skip entries that carry only the DEFAULT theme option bit
15
+ * during extraction.
16
+ *
17
+ * @defaultValue false
18
+ */
19
+ omitDefaults?: boolean;
20
+ }
21
+ /**
22
+ * Options for the Razorwind Tailwind CSS generate plugin.
23
+ */
24
+ interface TailwindGeneratePluginOptions {
25
+ /**
26
+ * Output path written relative to the execution cwd. When omitted, the
27
+ * detected workspace CSS entry is used (falling back to `src/app.css`).
28
+ */
29
+ cssPath?: string | null;
30
+ /**
31
+ * When generating CSS, include `@import "tailwindcss";` at the top of the file.
32
+ *
33
+ * @defaultValue true
34
+ */
35
+ includeImport?: boolean;
36
+ }
37
+ /**
38
+ * A flattened design token ready for Tailwind `@theme` emission.
39
+ */
40
+ interface FlatThemeToken {
41
+ /** Dot-separated token path (e.g. `color.primary`). */
42
+ path: string;
43
+ /** DTCG `$type`, when known. */
44
+ type?: string;
45
+ /** Raw `$value` from the token document. */
46
+ value: unknown;
47
+ /** CSS-friendly string form of {@link value}. */
48
+ cssValue: string;
49
+ /** Tailwind theme custom property (e.g. `--color-primary`). */
50
+ cssVar: string;
51
+ /** Optional theme id when tokens are multi-theme (`light` / `dark`). */
52
+ theme?: string;
53
+ }
54
+ //#endregion
55
+ export { __exportAll as i, TailwindExtractPluginOptions as n, TailwindGeneratePluginOptions as r, FlatThemeToken as t };
56
+ //# sourceMappingURL=types-o6IU6Inw.d.cts.map
@@ -0,0 +1 @@
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"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@razorwind/tailwindcss",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
- "description": "Razorwind Tailwind CSS package that can create Tailwind CSS files from design tokens or read a Tailwind CSS file and return the design tokens.",
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": {
7
7
  "type": "github",
8
8
  "url": "https://github.com/storm-software/razorwind.git",
@@ -43,6 +43,34 @@
43
43
  "default": "./dist/index.mjs"
44
44
  }
45
45
  },
46
+ "./extract": {
47
+ "require": {
48
+ "types": "./dist/extract.d.cts",
49
+ "default": "./dist/extract.cjs"
50
+ },
51
+ "import": {
52
+ "types": "./dist/extract.d.mts",
53
+ "default": "./dist/extract.mjs"
54
+ },
55
+ "default": {
56
+ "types": "./dist/extract.d.mts",
57
+ "default": "./dist/extract.mjs"
58
+ }
59
+ },
60
+ "./generate": {
61
+ "require": {
62
+ "types": "./dist/generate.d.cts",
63
+ "default": "./dist/generate.cjs"
64
+ },
65
+ "import": {
66
+ "types": "./dist/generate.d.mts",
67
+ "default": "./dist/generate.mjs"
68
+ },
69
+ "default": {
70
+ "types": "./dist/generate.d.mts",
71
+ "default": "./dist/generate.mjs"
72
+ }
73
+ },
46
74
  "./package.json": "./package.json"
47
75
  },
48
76
  "main": "./dist/index.cjs",
@@ -50,10 +78,11 @@
50
78
  "types": "./dist/index.d.cts",
51
79
  "typings": "dist/index.d.mts",
52
80
  "dependencies": {
53
- "@power-plant/core": "^0.0.37",
81
+ "@power-plant/core": "^0.0.40",
54
82
  "@power-plant/dtcg-schema": "^0.0.1",
55
- "@razorwind/core": "^0.0.8",
83
+ "@razorwind/core": "^0.0.10",
56
84
  "@stryke/fs": "^0.33.99",
85
+ "@stryke/path": "^0.29.25",
57
86
  "@stryke/type-checks": "^0.6.31",
58
87
  "@stryke/types": "^0.12.26",
59
88
  "@tailwindcss/node": "^4.3.3",
@@ -61,10 +90,10 @@
61
90
  "tailwindcss": "^4.3.3"
62
91
  },
63
92
  "devDependencies": {
64
- "@powerlines/plugin-tsdown": "^0.1.560",
93
+ "@powerlines/plugin-tsdown": "^0.1.561",
65
94
  "@types/node": "^25.9.5",
66
95
  "typescript": "^6.0.3"
67
96
  },
68
97
  "publishConfig": { "access": "public" },
69
- "gitHead": "1d74276595c13888022fafaa5f501092dc8e03a0"
98
+ "gitHead": "35f5d31c337fdedeb003c0d9eca72949d4305437"
70
99
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/extract.ts","../src/workspace.ts","../src/index.ts"],"mappings":";;;UAAiB;;;;EAIf;;;;;;EAOA;;;;UC+Be;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;EAA0B;IAClC,QAAQ;;;iBChLW,eACpB,eACC,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/extract.ts","../src/workspace.ts","../src/index.ts"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}