@designid/tokens 1.2.11 → 1.2.12

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/bin/watch.js CHANGED
@@ -21,17 +21,17 @@ ${A}`;if(W.forEach((L)=>{if(VX(L,U,$))return;let H=TX(L,Z,Y);if(U.transformValue
21
21
  * This file is automatically generated.
22
22
  * DO NOT EDIT THIS FILE DIRECTLY.
23
23
  * Changes will be overwritten. Please update the source design tokens instead.
24
- */`,ZY=null,_Z=null,qY=null,$Y=null,UY=null,KY=null,WY=null,GY=null,zY=null;var BX=S(()=>{g()});function D(X){return X===OY}var OY="light";var wZ=S(()=>{BX()});async function JY(X){let Z=await gX();X=X.replace(/<\?xml[^>]*\?>\s*/,""),X=X.replace(/<!DOCTYPE [^>]*>\s*/,"");let Y=X.match(/<svg[^>]*>/),q=X.match(/viewBox="([\d\s.]+)"/),[$]=Y??[],U=$;if($&&U){let K=Z?.style?.fill||Z?.style?.stroke?.color,z=/id="[^"]*"/.test($);if(!U.includes("xmlns="))U=U.replace("<svg",'<svg xmlns="http://www.w3.org/2000/svg"');if(!z&&K)U=U.replace("<svg",`<svg id="${K}"`);else if(z&&K)U=U.replace(/id="[^"]*"/,`id="${K}"`)}if(q&&$&&U){let K=q[1].split(" ").map(Number),z=K[2],G=K[3],A=Z?.size??24,E=z/G*A;X=X.replace(/height="[\d.]+px?"/,`height="${A}px"`),X=X.replace(/width="[\d.]+px?"/,`width="${E}px"`);let L=/width="[\d.]+(px)?"/.test($),H=/height="[\d.]+(px)?"/.test($);if(!L)U=U.replace("<svg",`<svg width="${E}px"`);else U=U.replace(/width="[\d.]+(px)?"/,`width="${E}px"`);if(!H)U=U.replace("<svg",`<svg height="${A}px"`);else U=U.replace(/height="[\d.]+(px)?"/,`height="${A}px"`);X=X.replace($,U)}if(!X?.match(/data-style="([^"]*)"/)&&Z?.style?.type)X=X.replace("<svg ",`<svg data-style="${Z.style.type}" `);if(Z?.style?.type)X=f0(X,Z.style);return X}function f0(X,Z){switch(Z.type){case"mono":if(X=X.replace(/stroke="[^"]*"/g,""),X=X.replace(/stroke-width="[^"]*"/g,""),X=X.replace(/stroke-linecap="[^"]*"/g,""),X=X.replace(/stroke-linejoin="[^"]*"/g,""),X=X.replace(/fill="none"/g,'fill="currentColor"'),Z.fill&&!X.includes("fill="))X=X.replace("<svg",'<svg fill="currentColor"');else if(Z.fill)X=X.replace(/fill="(?!currentColor)[^"]*"/g,'fill="currentColor"');break;case"stroke":if(Z.stroke){let{color:q,width:$,linecap:U,linejoin:W}=Z.stroke;if(q){if(X=X.replace(/stroke="[^"]*"/g,'stroke="currentColor"'),!X.includes("stroke="))X=X.replace("<svg",'<svg stroke="currentColor"')}if($!==void 0){let K=typeof $==="number"?`${$}`:$;if(X=X.replace(/stroke-width="[^"]*"/g,`stroke-width="${K}"`),!X.includes("stroke-width="))X=X.replace("<svg",`<svg stroke-width="${K}"`)}if(U){if(X=X.replace(/stroke-linecap="[^"]*"/g,`stroke-linecap="${U}"`),!X.includes("stroke-linecap="))X=X.replace("<svg",`<svg stroke-linecap="${U}"`)}if(W){if(X=X.replace(/stroke-linejoin="[^"]*"/g,`stroke-linejoin="${W}"`),!X.includes("stroke-linejoin="))X=X.replace("<svg",`<svg stroke-linejoin="${W}"`)}if(!X.includes("fill="))X=X.replace("<svg",'<svg fill="none"')}break;case"fill":if(X=X.replace(/stroke="[^"]*"/g,""),X=X.replace(/stroke-width="[^"]*"/g,""),Z.fill){if(X=X.replace(/fill="[^"]*"/g,'fill="currentColor"'),!X.includes("fill="))X=X.replace("<svg",'<svg fill="currentColor"')}break;case"animated":case"custom":break;default:break}return X}var RZ=S(()=>{g()});var MZ=S(()=>{BX();g()});import{copyFileSync as m0,existsSync as p0,mkdirSync as NZ,statSync as d0}from"fs";import{writeFile as u0}from"fs/promises";import{join as y,relative as k0}from"path";async function BY(X,Z){try{let{assets:Y,workspaceRoot:q,distDir:$,__dirname:U}=await r(),W=Y?.fonts?.sourceDir?y(U,Y.fonts.sourceDir):null,K=y("assets","fonts"),z=y(q,$),G=Y?.fonts?.distDir?y(z,Y.fonts.distDir.replace(/^\.\//,"")):y(z,K);if(!X||!W)return;let A="",E=Z&&Y?.fonts?.distDir?y(Z,Y.fonts.distDir.replace(/^\.\//,"")):G;for(let Q of X){if(!Q)continue;if(A+=`/**** ${Q.family} ${Q.style} ****/
24
+ */`,ZY=null,_Z=null,qY=null,$Y=null,UY=null,KY=null,WY=null,GY=null,zY=null;var BX=S(()=>{g()});function D(X){return X===OY}var OY="light";var wZ=S(()=>{BX()});async function JY(X){let Z=await gX();X=X.replace(/<\?xml[^>]*\?>\s*/,""),X=X.replace(/<!DOCTYPE [^>]*>\s*/,"");let Y=X.match(/<svg[^>]*>/),q=X.match(/viewBox="([\d\s.]+)"/),[$]=Y??[],U=$;if($&&U){let K=Z?.style?.fill||Z?.style?.stroke?.color,z=/id="[^"]*"/.test($);if(!U.includes("xmlns="))U=U.replace("<svg",'<svg xmlns="http://www.w3.org/2000/svg"');if(!z&&K)U=U.replace("<svg",`<svg id="${K}"`);else if(z&&K)U=U.replace(/id="[^"]*"/,`id="${K}"`)}if(q&&$&&U){let K=q[1].split(" ").map(Number),z=K[2],G=K[3],A=Z?.size??24,E=z/G*A;X=X.replace(/height="[\d.]+px?"/,`height="${A}px"`),X=X.replace(/width="[\d.]+px?"/,`width="${E}px"`);let L=/width="[\d.]+(px)?"/.test($),H=/height="[\d.]+(px)?"/.test($);if(!L)U=U.replace("<svg",`<svg width="${E}px"`);else U=U.replace(/width="[\d.]+(px)?"/,`width="${E}px"`);if(!H)U=U.replace("<svg",`<svg height="${A}px"`);else U=U.replace(/height="[\d.]+(px)?"/,`height="${A}px"`);X=X.replace($,U)}if(!X?.match(/data-style="([^"]*)"/)&&Z?.style?.type)X=X.replace("<svg ",`<svg data-style="${Z.style.type}" `);if(Z?.style?.type)X=f0(X,Z.style);return X}function f0(X,Z){switch(Z.type){case"mono":if(X=X.replace(/stroke="[^"]*"/g,""),X=X.replace(/stroke-width="[^"]*"/g,""),X=X.replace(/stroke-linecap="[^"]*"/g,""),X=X.replace(/stroke-linejoin="[^"]*"/g,""),X=X.replace(/fill="none"/g,'fill="currentColor"'),Z.fill&&!X.includes("fill="))X=X.replace("<svg",'<svg fill="currentColor"');else if(Z.fill)X=X.replace(/fill="(?!currentColor)[^"]*"/g,'fill="currentColor"');break;case"stroke":if(Z.stroke){let{color:q,width:$,linecap:U,linejoin:W}=Z.stroke;if(q){if(X=X.replace(/stroke="[^"]*"/g,'stroke="currentColor"'),!X.includes("stroke="))X=X.replace("<svg",'<svg stroke="currentColor"')}if($!==void 0){let K=typeof $==="number"?`${$}`:$;if(X=X.replace(/stroke-width="[^"]*"/g,`stroke-width="${K}"`),!X.includes("stroke-width="))X=X.replace("<svg",`<svg stroke-width="${K}"`)}if(U){if(X=X.replace(/stroke-linecap="[^"]*"/g,`stroke-linecap="${U}"`),!X.includes("stroke-linecap="))X=X.replace("<svg",`<svg stroke-linecap="${U}"`)}if(W){if(X=X.replace(/stroke-linejoin="[^"]*"/g,`stroke-linejoin="${W}"`),!X.includes("stroke-linejoin="))X=X.replace("<svg",`<svg stroke-linejoin="${W}"`)}if(!X.includes("fill="))X=X.replace("<svg",'<svg fill="none"')}break;case"fill":if(X=X.replace(/stroke="[^"]*"/g,""),X=X.replace(/stroke-width="[^"]*"/g,""),Z.fill){if(X=X.replace(/fill="[^"]*"/g,'fill="currentColor"'),!X.includes("fill="))X=X.replace("<svg",'<svg fill="currentColor"')}break;case"animated":case"custom":break;default:break}return X}var RZ=S(()=>{g()});var MZ=S(()=>{BX();g()});import{copyFileSync as m0,existsSync as p0,mkdirSync as NZ,statSync as d0}from"fs";import{writeFile as k0}from"fs/promises";import{join as y,relative as u0}from"path";async function BY(X,Z){try{let{assets:Y,workspaceRoot:q,distDir:$,__dirname:U}=await r(),W=Y?.fonts?.sourceDir?y(U,Y.fonts.sourceDir):null,K=y("assets","fonts"),z=y(q,$),G=Y?.fonts?.distDir?y(z,Y.fonts.distDir.replace(/^\.\//,"")):y(z,K);if(!X||!W)return;let A="",E=Z&&Y?.fonts?.distDir?y(Z,Y.fonts.distDir.replace(/^\.\//,"")):G;for(let Q of X){if(!Q)continue;if(A+=`/**** ${Q.family} ${Q.style} ****/
25
25
  `,Q.linkHref){let O=await(await fetch(Q.linkHref)).text();A+=`${O.replace(/\s+/g," ").replace(/:\s+/g,":")}
26
- `}else if(Q?.src&&W){let J=Q.directory??Q.family.toLowerCase().replace(/\s+/g,"-"),O=y(W,J,Q.src);try{if(!p0(O)||!d0(O).isFile()){console.warn(`Font file not found: ${O}`);continue}}catch{console.warn(`Error accessing font file: ${O}`);continue}try{NZ(y(E,J),{recursive:!0}),m0(y(W,J,Q.src),y(E,J,Q.src))}catch(R){console.warn(`Error copying font file ${Q.src}:`,R instanceof Error?R.message:R);continue}let B;if(Y?.fonts?.cssImportPath)B=y(Y.fonts.cssImportPath,J,Q.src).replace(/\\/g,"/");else{let{distCSSPath:R}=await r(),I=Z?y(Z,"css"):R,w=k0(I,E);B=y(w,J,Q.src).replace(/\\/g,"/")}A+=`@font-face {
26
+ `}else if(Q?.src&&W){let J=Q.directory??Q.family.toLowerCase().replace(/\s+/g,"-"),O=y(W,J,Q.src);try{if(!p0(O)||!d0(O).isFile()){console.warn(`Font file not found: ${O}`);continue}}catch{console.warn(`Error accessing font file: ${O}`);continue}try{NZ(y(E,J),{recursive:!0}),m0(y(W,J,Q.src),y(E,J,Q.src))}catch(R){console.warn(`Error copying font file ${Q.src}:`,R instanceof Error?R.message:R);continue}let B;if(Y?.fonts?.cssImportPath)B=y(Y.fonts.cssImportPath,J,Q.src).replace(/\\/g,"/");else{let{distCSSPath:R}=await r(),I=Z?y(Z,"css"):R,w=u0(I,E);B=y(w,J,Q.src).replace(/\\/g,"/")}A+=`@font-face {
27
27
  font-family: "${Q.family}";
28
28
  font-style: ${Q.faceStyle};
29
29
  font-weight: ${Q.weight};
30
30
  src: url("${B}") format("${Q.format}");
31
31
  }
32
- `}}let{distCSSPath:L}=await r(),H=Z?y(Z,"css"):L,_=`${H}/fonts.css`;NZ(H,{recursive:!0}),await u0(_,A,{flag:"w",encoding:"utf-8"})}catch(Y){console.error("Error appending typography tokens:",Y)}}var IY=S(()=>{g()});function IX(X){if(typeof X!=="string"||!X.startsWith("{")||!X.endsWith("}"))return!1;let Z=X.slice(1,-1);return!Z.includes("{")&&!Z.includes("}")&&Z.trim()!==""}function wX(X){if(typeof X!=="string")return!1;let Z=/\{[^}]+\}/g,Y=X.match(Z);return!!(Y&&Y.length>0&&X.length>Y.join("").length)}function fX(X){let Z=[],Y=/\{[^}]+\}/g,q=0,$;while(($=Y.exec(X))!==null){if($.index>q){let W=X.slice(q,$.index);if(W)Z.push({type:"literal",value:W})}let U=$[0];if(U.startsWith("{#/"))Z.push({type:"reference",value:U,ref:{$ref:U.slice(2,-1)}});else Z.push({type:"reference",value:U,ref:U});q=$.index+$[0].length}if(q<X.length){let U=X.slice(q);if(U)Z.push({type:"literal",value:U})}return Z}function FZ(X){return!!X.$extensions?.$mode}function xZ(X){return!!(X.$extensions?.$generators&&Array.isArray(X.$extensions.$generators))}function jZ(X){return!!(X.$extensions?.$breakpoints&&typeof X.$extensions.$breakpoints==="object")}function bZ(X,Z){return`${X}${Z}`}function DZ(X){return typeof X==="object"&&X!==null&&"$value"in X}function SZ(X){return typeof X==="object"&&X!==null&&!("$value"in X)}var PZ=()=>{};function CZ(X){if(typeof X!=="string")return!1;let Z=X.trim();return Z.startsWith("<svg")&&Z.includes("</svg>")}function VZ(X){if(typeof X!=="string")return!1;return X.startsWith("data:image/png;base64,")||X.startsWith("iVBORw0KGgo")}function TZ(X){if(typeof X!=="string")return!1;return X.startsWith("data:image/jpeg;base64,")||X.startsWith("data:image/jpg;base64,")||X.startsWith("/9j/")}function l0(X){let Z=X.trim();return Z=Z.replace(/\s+/g," ").replace(/>\s+</g,"><").trim(),`data:image/svg+xml;base64,${Buffer.from(Z,"utf-8").toString("base64")}`}function r0(X){if(X.startsWith("data:image/png;base64,"))return X;return`data:image/png;base64,${X}`}function s0(X){if(X.startsWith("data:image/jpeg;base64,")||X.startsWith("data:image/jpg;base64,"))return X;return`data:image/jpeg;base64,${X}`}function RX(X){if(!X||typeof X!=="string")return X;if(X.startsWith("data:"))return X;if(CZ(X))return l0(X);else if(VZ(X))return r0(X);else if(TZ(X))return s0(X);return X}function i0(X){if(typeof X!=="string")return!1;return X.startsWith("data:image/svg+xml;")||X.startsWith("data:image/png;")||X.startsWith("data:image/jpeg;")||X.startsWith("data:image/jpg;")||X.startsWith("data:image/gif;")||X.startsWith("data:image/webp;")}function u(X){return CZ(X)||VZ(X)||TZ(X)||i0(X)}import{readFileSync as a0,readdirSync as n0,statSync as t0}from"fs";import{join as o0}from"path";import gZ from"colorjs.io";function RY(X){let Z={};function Y(q){let $=n0(q);for(let U of $){let W=o0(q,U);if(t0(W).isDirectory())Y(W);else if(U.endsWith(".tokens.json"))try{let z=a0(W,"utf-8");if(!z.trim())continue;let G=JSON.parse(z);fZ(Z,G)}catch(z){console.warn(`Failed to load token file: ${W}`,z)}}}return Y(X),Z}function fZ(X,Z){for(let Y in Z)if(Z[Y]&&typeof Z[Y]==="object"&&!Array.isArray(Z[Y])){if(!X[Y])X[Y]={};fZ(X[Y],Z[Y])}else X[Y]=Z[Y]}function MY(X,Z={}){let Y=[];function q($,U=[]){for(let[W,K]of Object.entries($)){if(W.startsWith("$"))continue;let z=[...U,W],G=z.join(".");if(DZ(K)){let A={path:z,name:G,type:K.$type,value:K.$value,description:K.$description,extensions:K.$extensions?{mode:FZ(K)?K.$extensions.$mode:K.$extensions.mode?K.$extensions.mode:void 0,generators:xZ(K)?K.$extensions.$generators:K.$extensions.generators?K.$extensions.generators:void 0,breakpoints:jZ(K)?K.$extensions.$breakpoints:K.$extensions.breakpoint?K.$extensions.breakpoint:void 0,...Object.fromEntries(Object.entries(K.$extensions).filter(([E])=>!["$mode","$generators","$breakpoints","mode","generators","breakpoint"].includes(E)))}:void 0,original:K};if(!Z.namespace||G.startsWith(Z.namespace))Y.push(A)}else if(SZ(K))q(K,z)}}return q(X),Y}function NY(X,Z={}){let Y=[...X],q=new Map(X.map((G)=>[G.name,G]));if(Z.generateModes||Z.generateDerivedTokens||Z.generateBreakpointTokens)for(let G of X){let A=yZ(G,Z,q);if(Y.push(...A),Z.generateModes){for(let E of A)if(E.extensions?.mode&&!E.name.includes("#")){let L=yZ(E,Z,q);Y.push(...L)}}}let $=Z.modes||[],U=$.length>0?$[0]:void 0,W={tokens:new Map(Y.map((G)=>[G.name,G])),mode:Z.generateModes?U:void 0,options:Z,brokenReferences:[]},K=[];for(let G of Y){let A=void 0;for(let H of $)if(G.name.endsWith(`#${H}`)){A=H;break}if(!A&&Z.generateModes)A=U;let E={...W,mode:A},L=e0(G,E);K.push(L)}if(Z.failOnBrokenReferences!==!1&&W.brokenReferences.length>0){let G=[...new Set(W.brokenReferences)],A=`Token reference${G.length>1?"s":""} not found:
32
+ `}}let{distCSSPath:L}=await r(),H=Z?y(Z,"css"):L,_=`${H}/fonts.css`;NZ(H,{recursive:!0}),await k0(_,A,{flag:"w",encoding:"utf-8"})}catch(Y){console.error("Error appending typography tokens:",Y)}}var IY=S(()=>{g()});function IX(X){if(typeof X!=="string"||!X.startsWith("{")||!X.endsWith("}"))return!1;let Z=X.slice(1,-1);return!Z.includes("{")&&!Z.includes("}")&&Z.trim()!==""}function wX(X){if(typeof X!=="string")return!1;let Z=/\{[^}]+\}/g,Y=X.match(Z);return!!(Y&&Y.length>0&&X.length>Y.join("").length)}function fX(X){let Z=[],Y=/\{[^}]+\}/g,q=0,$;while(($=Y.exec(X))!==null){if($.index>q){let W=X.slice(q,$.index);if(W)Z.push({type:"literal",value:W})}let U=$[0];if(U.startsWith("{#/"))Z.push({type:"reference",value:U,ref:{$ref:U.slice(2,-1)}});else Z.push({type:"reference",value:U,ref:U});q=$.index+$[0].length}if(q<X.length){let U=X.slice(q);if(U)Z.push({type:"literal",value:U})}return Z}function FZ(X){return!!X.$extensions?.$mode}function xZ(X){return!!(X.$extensions?.$generators&&Array.isArray(X.$extensions.$generators))}function jZ(X){return!!(X.$extensions?.$breakpoints&&typeof X.$extensions.$breakpoints==="object")}function bZ(X,Z){return`${X}${Z}`}function DZ(X){return typeof X==="object"&&X!==null&&"$value"in X}function SZ(X){return typeof X==="object"&&X!==null&&!("$value"in X)}var PZ=()=>{};function CZ(X){if(typeof X!=="string")return!1;let Z=X.trim();return Z.startsWith("<svg")&&Z.includes("</svg>")}function VZ(X){if(typeof X!=="string")return!1;return X.startsWith("data:image/png;base64,")||X.startsWith("iVBORw0KGgo")}function TZ(X){if(typeof X!=="string")return!1;return X.startsWith("data:image/jpeg;base64,")||X.startsWith("data:image/jpg;base64,")||X.startsWith("/9j/")}function l0(X){let Z=X.trim();return Z=Z.replace(/\s+/g," ").replace(/>\s+</g,"><").trim(),`data:image/svg+xml;base64,${Buffer.from(Z,"utf-8").toString("base64")}`}function r0(X){if(X.startsWith("data:image/png;base64,"))return X;return`data:image/png;base64,${X}`}function s0(X){if(X.startsWith("data:image/jpeg;base64,")||X.startsWith("data:image/jpg;base64,"))return X;return`data:image/jpeg;base64,${X}`}function RX(X){if(!X||typeof X!=="string")return X;if(X.startsWith("data:"))return X;if(CZ(X))return l0(X);else if(VZ(X))return r0(X);else if(TZ(X))return s0(X);return X}function i0(X){if(typeof X!=="string")return!1;return X.startsWith("data:image/svg+xml;")||X.startsWith("data:image/png;")||X.startsWith("data:image/jpeg;")||X.startsWith("data:image/jpg;")||X.startsWith("data:image/gif;")||X.startsWith("data:image/webp;")}function k(X){return CZ(X)||VZ(X)||TZ(X)||i0(X)}import{readFileSync as a0,readdirSync as n0,statSync as t0}from"fs";import{join as o0}from"path";import gZ from"colorjs.io";function RY(X){let Z={};function Y(q){let $=n0(q);for(let U of $){let W=o0(q,U);if(t0(W).isDirectory())Y(W);else if(U.endsWith(".tokens.json"))try{let z=a0(W,"utf-8");if(!z.trim())continue;let G=JSON.parse(z);fZ(Z,G)}catch(z){console.warn(`Failed to load token file: ${W}`,z)}}}return Y(X),Z}function fZ(X,Z){for(let Y in Z)if(Z[Y]&&typeof Z[Y]==="object"&&!Array.isArray(Z[Y])){if(!X[Y])X[Y]={};fZ(X[Y],Z[Y])}else X[Y]=Z[Y]}function MY(X,Z={}){let Y=[];function q($,U=[]){for(let[W,K]of Object.entries($)){if(W.startsWith("$"))continue;let z=[...U,W],G=z.join(".");if(DZ(K)){let A={path:z,name:G,type:K.$type,value:K.$value,description:K.$description,extensions:K.$extensions?{mode:FZ(K)?K.$extensions.$mode:K.$extensions.mode?K.$extensions.mode:void 0,generators:xZ(K)?K.$extensions.$generators:K.$extensions.generators?K.$extensions.generators:void 0,breakpoints:jZ(K)?K.$extensions.$breakpoints:K.$extensions.breakpoint?K.$extensions.breakpoint:void 0,...Object.fromEntries(Object.entries(K.$extensions).filter(([E])=>!["$mode","$generators","$breakpoints","mode","generators","breakpoint"].includes(E)))}:void 0,original:K};if(!Z.namespace||G.startsWith(Z.namespace))Y.push(A)}else if(SZ(K))q(K,z)}}return q(X),Y}function NY(X,Z={}){let Y=[...X],q=new Map(X.map((G)=>[G.name,G]));if(Z.generateModes||Z.generateDerivedTokens||Z.generateBreakpointTokens)for(let G of X){let A=yZ(G,Z,q);if(Y.push(...A),Z.generateModes){for(let E of A)if(E.extensions?.mode&&!E.name.includes("#")){let L=yZ(E,Z,q);Y.push(...L)}}}let $=Z.modes||[],U=$.length>0?$[0]:void 0,W={tokens:new Map(Y.map((G)=>[G.name,G])),mode:Z.generateModes?U:void 0,options:Z,brokenReferences:[]},K=[];for(let G of Y){let A=void 0;for(let H of $)if(G.name.endsWith(`#${H}`)){A=H;break}if(!A&&Z.generateModes)A=U;let E={...W,mode:A},L=e0(G,E);K.push(L)}if(Z.failOnBrokenReferences!==!1&&W.brokenReferences.length>0){let G=[...new Set(W.brokenReferences)],A=`Token reference${G.length>1?"s":""} not found:
33
33
  ${G.map((E)=>` - ${E}`).join(`
34
- `)}`;throw Error(A)}return K}function yZ(X,Z,Y){let q=[];if(Z.generateModes&&X.extensions?.mode){for(let[$,U]of Object.entries(X.extensions.mode))if(U!==void 0)q.push({...X,name:`${X.name}#${$}`,value:U,path:[...X.path,`#${$}`]})}if(Z.generateModes&&!X.extensions?.mode&&(Array.isArray(X.value)||typeof X.value==="object"&&X.value!==null)){let $=!1,U=!1,W=(K)=>{if(typeof K!=="object"||K===null)return!1;if(K.$extensions?.mode)return!0;return Object.values(K).some((z)=>{if(typeof z==="object"&&z!==null)return W(z);return!1})};if(Array.isArray(X.value))$=X.value.some((K)=>typeof K==="string"&&K.includes("{")||typeof K==="object"&&K!==null&&Object.values(K).some((z)=>typeof z==="string"&&z.includes("{"))),U=X.value.some((K)=>W(K));else $=Object.values(X.value).some((K)=>typeof K==="string"&&K.includes("{")),U=W(X.value);if($||U){if(["color","shadow","border","background","surface","composition"].includes(X.type)){let G;if(Array.isArray(X.value))G=X.value.map((A)=>{if(typeof A==="string"&&A.startsWith("{")&&A.endsWith("}")){let E=A.slice(1,-1);if(!E.includes("#dark")&&!E.includes("@dark"))return`{${E}#dark}`;return A}else if(typeof A==="object"&&A!==null){let E={};for(let[L,H]of Object.entries(A))if(typeof H==="string"&&H.startsWith("{")&&H.endsWith("}")){let _=H.slice(1,-1),Q=`${_}#dark`,J=Y?.get(_),O=Y?.has(Q)||J?.extensions?.mode?.dark!==void 0||J&&(Array.isArray(J.value)||typeof J.value==="object"&&J.value!==null);if(!_.includes("#dark")&&!_.includes("@dark")&&O)E[L]=`{${Q}}`;else E[L]=H}else E[L]=H;return E}return A});else if(typeof X.value==="object"&&X.value!==null){G={};let A=(E)=>{if(typeof E==="string"){if(E.startsWith("{")&&E.endsWith("}")){let L=E.slice(1,-1),H=`${L}#dark`,_=(J,O=new Set)=>{if(O.has(J))return!1;O.add(J);let B=Y?.get(J);if(!B){let R=J.match(/^(.+)@([^@]+)$/);if(R){let[,I,w]=R,M=Y?.get(I);if(M){if(M.extensions?.mode?.dark!==void 0)return!0;if(M.extensions?.generators)return!0;return _(I,O)}}return!1}if(B.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${J}#dark`))return!0;if(typeof B.value==="string"&&B.value.startsWith("{")&&B.value.endsWith("}")){let R=B.value.slice(1,-1);return _(R,O)}if(Array.isArray(B.value)||typeof B.value==="object"&&B.value!==null){let R=(I)=>{if(typeof I!=="object"||I===null)return!1;if(I.$extensions?.mode)return!0;return Object.values(I).some((w)=>{if(typeof w==="object"&&w!==null)return R(w);return!1})};if(Array.isArray(B.value))return B.value.some((I)=>typeof I==="string"&&I.includes("{")&&_(I.slice(1,-1),new Set(O))||typeof I==="object"&&I!==null&&(Object.values(I).some((w)=>typeof w==="string"&&w.includes("{")&&_(w.slice(1,-1),new Set(O)))||R(I)));else if(typeof B.value==="object")return Object.values(B.value).some((I)=>typeof I==="string"&&I.includes("{")&&_(I.slice(1,-1),new Set(O)))||R(B.value)}return!1},Q=_(L);if(!L.includes("#dark")&&!L.includes("@dark")&&Q)return`{${H}}`}return E}if(typeof E==="object"&&E!==null){if(E.$extensions?.mode?.dark)return E.$extensions.mode.dark;let L={};for(let[H,_]of Object.entries(E))L[H]=A(_);return L}return E};for(let[E,L]of Object.entries(X.value))G[E]=A(L)}q.push({...X,name:`${X.name}#dark`,value:G,path:[...X.path,"#dark"],extensions:{...X.extensions,autoGenerated:!0}})}}}if(Z.generateModes&&!X.extensions?.mode&&typeof X.value==="string"&&X.value.startsWith("{")&&X.value.endsWith("}")){let $=X.value.slice(1,-1),U=(A,E=new Set)=>{if(E.has(A))return!1;E.add(A);let L=Y?.get(A);if(!L){let H=A.match(/^(.+)@([^@]+)$/);if(H){let[,_,Q]=H,J=Y?.get(_);if(J){if(J.extensions?.mode?.dark!==void 0)return!0;if(J.extensions?.generators)return!0;return U(_,E)}}return!1}if(L.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${A}#dark`))return!0;if(typeof L.value==="string"&&L.value.startsWith("{")&&L.value.endsWith("}")){let H=L.value.slice(1,-1);return U(H,E)}if(Array.isArray(L.value)||typeof L.value==="object"&&L.value!==null){let H=(_)=>{if(typeof _!=="object"||_===null)return!1;if(_.$extensions?.mode)return!0;return Object.values(_).some((Q)=>{if(typeof Q==="object"&&Q!==null)return H(Q);return!1})};if(Array.isArray(L.value))return L.value.some((_)=>typeof _==="string"&&_.includes("{")&&U(_.slice(1,-1),new Set(E))||typeof _==="object"&&_!==null&&(Object.values(_).some((Q)=>typeof Q==="string"&&Q.includes("{")&&U(Q.slice(1,-1),new Set(E)))||H(_)));else if(typeof L.value==="object")return Object.values(L.value).some((_)=>typeof _==="string"&&_.includes("{")&&U(_.slice(1,-1),new Set(E)))||H(L.value)}return!1},W=U($);if(["color","shadow","border","background","surface","composition"].includes(X.type)&&W&&W&&!$.includes("#dark")&&!$.includes("@dark")){let A=`{${$}#dark}`;q.push({...X,name:`${X.name}#dark`,value:A,path:[...X.path,"#dark"],extensions:{...X.extensions,autoGenerated:!0}})}}if(Z.generateDerivedTokens&&X.extensions?.generators)for(let $ of X.extensions.generators)for(let[U,W]of Object.entries($.value)){let K=bZ(X.name,U),{generators:z,...G}=X.extensions;q.push({...X,name:K,value:X.value,path:[...X.path,U],extensions:{...G,generator:{type:$.type,value:W}}})}if(Z.generateBreakpointTokens&&X.extensions?.breakpoints)for(let[$,U]of Object.entries(X.extensions.breakpoints)){let W=`${X.name}@${$.replace(/[^a-zA-Z0-9]/g,"_")}`,K=U.$value||U.value;if(K&&typeof K==="object"&&"$value"in K)K=K.$value;else if(!K&&typeof U==="object"){let{...A}=U;if(Object.keys(A).length>0)K=A}let z=U.$extensions||U.$extensions,G=U.$type;if(!G&&U.value&&typeof U.value==="object")G=U.value.$type;q.push({...X,name:W,value:K,path:[...X.path,`@${$}`],type:G||X.type,extensions:{mediaQuery:$,...z?{mode:z.mode||z.$mode,generators:z.generators||z.$generators,...Object.fromEntries(Object.entries(z).filter(([A])=>!["mode","$mode","generators","$generators"].includes(A)))}:{}}})}return q}function e0(X,Z){let Y=e(X.value,Z),q=X.type;if(typeof X.value==="string"&&IX(X.value)){let U=X.value.slice(1,-1),W=Z.tokens.get(U);if(W){if(["border","shadow","typography","composition"].includes(W.type))q=W.type;else if(typeof W.value==="string"&&wX(W.value)){let K=fX(W.value),z=new Set;for(let G of K)if(G.type==="reference"&&G.ref&&typeof G.ref==="string"){let A=G.ref.slice(1,-1),E=Z.tokens.get(A);if(E&&["border","shadow","typography","composition"].includes(E.type))z.add(E.type)}if(z.size===1)q=Array.from(z)[0]}}}if(typeof X.value==="string"&&wX(X.value)){let U=fX(X.value),W=new Set;for(let K of U)if(K.type==="reference"&&K.ref&&typeof K.ref==="string"){let z=K.ref.slice(1,-1),G=Z.tokens.get(z);if(G&&["border","shadow","typography","composition"].includes(G.type))W.add(G.type)}if(W.size===1)q=Array.from(W)[0]}if(typeof Y==="object"&&Y!==null&&["border","shadow","typography","composition"].includes(q))Y=s(Y,Z);if(X.extensions?.generator&&typeof X.extensions.generator==="object"&&"type"in X.extensions.generator&&"value"in X.extensions.generator)Y=vX(X.value,X.extensions.generator.type,X.extensions.generator.value,Z);let $=X1(X.name,Z.options);if(q==="color"&&typeof Y==="string"&&p(Y))Y=b(Y,X);if(typeof Y==="string"&&u(Y))Y=RX(Y);return{...X,type:q,value:Y,cssVar:$}}function s(X,Z){if(typeof X==="string"){if(IX(X))return FY(X,Z);else if(wX(X))return hZ(X,Z)}if(Array.isArray(X))return X.map((Y)=>s(Y,Z));if(typeof X==="object"&&X!==null){if("$value"in X&&typeof X.$value==="string")return s(X.$value,Z);if("value"in X&&typeof X.value==="string"&&"$type"in X){if(Z.mode&&X.$extensions?.mode?.[Z.mode])return s(X.$extensions.mode[Z.mode],Z);return s(X.value,Z)}if("value"in X&&typeof X.value==="object"&&"$type"in X){let q=X.value,$=X.$extensions?.delimiter?.character||" ";if(X.$type==="composition"&&q&&typeof q==="object")return Object.values(q).map((W)=>s(W,Z)).join($);return s(X.value,Z)}let Y={};for(let[q,$]of Object.entries(X))Y[q]=s($,Z);return Y}return X}function e(X,Z){if(typeof X==="string"){if(wX(X))return hZ(X,Z);else if(IX(X))return FY(X,Z)}else if(typeof X==="object"&&X!==null&&"$ref"in X)return vZ(X,Z);return X}function FY(X,Z){let Y=X.slice(1,-1),q=Z.tokens.get(Y),$=Z.options.modes||[];if(!q){if($.length>0){for(let K of $)if(Y.endsWith(`@${K}`)){let z=Y.slice(0,-K.length-1)+`#${K}`;if(q=Z.tokens.get(z),q)return wY(q,Z);break}}let W=Y.match(/#([^#@]+)$/);if(W){let K=Y.substring(0,W.index),z=W[1];if(q=Z.tokens.get(K),q){if(q.extensions?.mode?.[z]){let G=q.extensions.mode[z],A=e(G,{...Z,mode:z});if(q.extensions?.generator&&typeof q.extensions.generator==="object"&&"type"in q.extensions.generator&&"value"in q.extensions.generator)A=vX(A,q.extensions.generator.type,q.extensions.generator.value,Z);if(q.type==="color"&&typeof A==="string"&&p(A))A=b(A,q);if(typeof A==="string"&&u(A))A=RX(A);return A}}}if($.length>0)for(let K of $){let z=new RegExp(`(@[^@]+)@${K}$`);if(z.test(Y)){let G=Y.replace(z,`$1#${K}`);if(q=Z.tokens.get(G),!q){let A=G.match(/#([^#@]+)$/);if(A){let E=G.substring(0,A.index),L=A[1];if(q=Z.tokens.get(E),q&&q.extensions?.mode?.[L]){let H=q.extensions.mode[L],_=e(H,{...Z,mode:L});if(q.extensions?.generator&&typeof q.extensions.generator==="object"&&"type"in q.extensions.generator&&"value"in q.extensions.generator)_=vX(_,q.extensions.generator.type,q.extensions.generator.value,Z);if(q.type==="color"&&typeof _==="string"&&p(_))_=b(_,q);if(typeof _==="string"&&u(_))_=RX(_);return _}}}else return wY(q,Z);break}}}if(!q)return console.warn(`Token reference not found: ${X}`),Z.brokenReferences.push(X),X;return wY(q,Z)}function wY(X,Z){let Y;if(X.extensions?.generator&&typeof X.extensions.generator==="object"&&"type"in X.extensions.generator&&"value"in X.extensions.generator)Y=vX(X.value,X.extensions.generator.type,X.extensions.generator.value,Z);else if(Z.mode&&X.extensions?.mode?.[Z.mode])Y=e(X.extensions.mode[Z.mode],Z);else Y=e(X.value,Z);if(X.type==="color"&&typeof Y==="string"&&p(Y))Y=b(Y,X);if(typeof Y==="string"&&u(Y))Y=RX(Y);return Y}function vZ(X,Z){let q=X.$ref.slice(2).replace(/\//g,"."),$=Z.tokens.get(q);if(!$)return console.warn(`JSON Pointer reference not found: ${X.$ref}`),Z.brokenReferences.push(X.$ref),X.$ref;return e($.value,Z)}function hZ(X,Z){let Y=fX(X),q=Y.some((W)=>W.value.includes(",")),$=!0,U=[];for(let W of Y){let K;if(W.type==="reference"&&W.ref){if(typeof W.ref==="string"&&IX(W.ref)){K=FY(W.ref,Z);let z=W.ref.slice(1,-1),G=Z.tokens.get(z);if(!G||!["border","shadow","typography","composition"].includes(G.type))$=!1}else if(typeof W.ref==="object"&&"$ref"in W.ref)K=vZ(W.ref,Z)}else if(K=W.value,W.value.trim()&&W.value.trim()!==",")$=!1;U.push(K)}if(q&&$)return U.filter((W)=>typeof W==="object"&&W!==null&&typeof W!=="string");return U.map((W)=>String(W)).join("")}function vX(X,Z,Y,q){let $=e(X,q);switch(Z){case"alpha":if(typeof $==="string")return Y1($,Number(Y)/100);break;case"scale":if(typeof $==="string"&&$.match(/[\d.]+/))return Z1($,Number(Y));break;case"hue":if(typeof $==="string")return q1($,Number(Y));break;default:return console.warn(`Unknown generator type: ${Z}`),$}return $}function X1(X,Z,Y){let q=X.replace(/\./g,"-");q=q.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),q=q.replace(/@[^@#]*(?:screen|width|height|min|max|orientation).*$/i,""),q=q.replace(/#[^#]*$/,""),q=q.replace(/-@/g,"-").replace(/@/g,"-");let $=q,U=!0,W=Z.prefix||"";if(Z.transformName){if($=Z.transformName(q),$=$.replace(/-+$/,""),$!==q)U=!1}let K=U&&W?`${W}-${$}`:$,z=Y?`-${Y}`:"";return`--${K}${z}`.replace(/[^a-zA-Z0-9-_]/g,"-")}function Y1(X,Z){try{if(!p(X))return X;let Y=new gZ(X);return Y.alpha=Z,b(Y)}catch(Y){return console.warn(`Failed to apply alpha to color "${X}": ${Y}`),X}}function Z1(X,Z){let Y=X.match(/([\d.]+)(\w+)/);if(Y){let[,q,$]=Y;return`${parseFloat(q)*Z}${$}`}return X}function q1(X,Z){try{if(!p(X))return X;let q=new gZ(X).to("oklch");return q.h=(q.h+Z)%360,b(q)}catch(Y){return console.warn(`Failed to shift hue for color "${X}": ${Y}`),X}}var xY=S(()=>{PZ();EX()});function jY(X){if(X.type==="typography"||X.type==="fontWeight"||X.type==="fontFamily")return!0;if(X.type==="dimension"&&X.name.includes("typography"))return!0;if(X.name.includes("typography")||X.name.includes("font"))return!0;return!1}function i(X,Z,Y){if(Y){if(X===Z)return":host";return`:host([data-theme="${X}"])`}if(X===Z)return":root";return`[data-theme="${X}"]`}function hX(X,Z={}){let{rootSelector:Y=":root",separateThemeFiles:q=!1,generateMediaQueries:$=!1,customHeader:U,modes:W=["light","dark"]}=Z;if(q)return U1(X,Z);let K=new Map,z=new Map;for(let B of W)K.set(B,[]);let G=W.join("|"),A=new RegExp(`#(${G})$`);for(let B of X){if(typeof B.value==="string"&&u(B.value))continue;if(jY(B))continue;let R=` ${B.cssVar}: ${m(B.value,B.type)};`;if($&&B.name.includes("@media")){let w=pX(B);if(w){if(!z.has(w))z.set(w,[]);z.get(w).push(R);continue}}let I=B.name.match(A);if(I){let w=I[1];if(!K.has(w))K.set(w,[]);K.get(w).push(R)}else{let w=W[0]||"light";K.get(w).push(R)}}let E="";if(U)E+=`${U}
34
+ `)}`;throw Error(A)}return K}function yZ(X,Z,Y){let q=[];if(Z.generateModes&&X.extensions?.mode){for(let[$,U]of Object.entries(X.extensions.mode))if(U!==void 0)q.push({...X,name:`${X.name}#${$}`,value:U,path:[...X.path,`#${$}`]})}if(Z.generateModes&&!X.extensions?.mode&&(Array.isArray(X.value)||typeof X.value==="object"&&X.value!==null)){let $=!1,U=!1,W=(K)=>{if(typeof K!=="object"||K===null)return!1;if(K.$extensions?.mode)return!0;return Object.values(K).some((z)=>{if(typeof z==="object"&&z!==null)return W(z);return!1})};if(Array.isArray(X.value))$=X.value.some((K)=>typeof K==="string"&&K.includes("{")||typeof K==="object"&&K!==null&&Object.values(K).some((z)=>typeof z==="string"&&z.includes("{"))),U=X.value.some((K)=>W(K));else $=Object.values(X.value).some((K)=>typeof K==="string"&&K.includes("{")),U=W(X.value);if($||U){if(["color","shadow","border","background","surface","composition"].includes(X.type)){let G;if(Array.isArray(X.value))G=X.value.map((A)=>{if(typeof A==="string"&&A.startsWith("{")&&A.endsWith("}")){let E=A.slice(1,-1);if(!E.includes("#dark")&&!E.includes("@dark"))return`{${E}#dark}`;return A}else if(typeof A==="object"&&A!==null){let E={};for(let[L,H]of Object.entries(A))if(typeof H==="string"&&H.startsWith("{")&&H.endsWith("}")){let _=H.slice(1,-1),Q=`${_}#dark`,J=Y?.get(_),O=Y?.has(Q)||J?.extensions?.mode?.dark!==void 0||J&&(Array.isArray(J.value)||typeof J.value==="object"&&J.value!==null);if(!_.includes("#dark")&&!_.includes("@dark")&&O)E[L]=`{${Q}}`;else E[L]=H}else E[L]=H;return E}return A});else if(typeof X.value==="object"&&X.value!==null){G={};let A=(E)=>{if(typeof E==="string"){if(E.startsWith("{")&&E.endsWith("}")){let L=E.slice(1,-1),H=`${L}#dark`,_=(J,O=new Set)=>{if(O.has(J))return!1;O.add(J);let B=Y?.get(J);if(!B){let R=J.match(/^(.+)@([^@]+)$/);if(R){let[,I,w]=R,M=Y?.get(I);if(M){if(M.extensions?.mode?.dark!==void 0)return!0;if(M.extensions?.generators)return!0;return _(I,O)}}return!1}if(B.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${J}#dark`))return!0;if(typeof B.value==="string"&&B.value.startsWith("{")&&B.value.endsWith("}")){let R=B.value.slice(1,-1);return _(R,O)}if(Array.isArray(B.value)||typeof B.value==="object"&&B.value!==null){let R=(I)=>{if(typeof I!=="object"||I===null)return!1;if(I.$extensions?.mode)return!0;return Object.values(I).some((w)=>{if(typeof w==="object"&&w!==null)return R(w);return!1})};if(Array.isArray(B.value))return B.value.some((I)=>typeof I==="string"&&I.includes("{")&&_(I.slice(1,-1),new Set(O))||typeof I==="object"&&I!==null&&(Object.values(I).some((w)=>typeof w==="string"&&w.includes("{")&&_(w.slice(1,-1),new Set(O)))||R(I)));else if(typeof B.value==="object")return Object.values(B.value).some((I)=>typeof I==="string"&&I.includes("{")&&_(I.slice(1,-1),new Set(O)))||R(B.value)}return!1},Q=_(L);if(!L.includes("#dark")&&!L.includes("@dark")&&Q)return`{${H}}`}return E}if(typeof E==="object"&&E!==null){if(E.$extensions?.mode?.dark)return E.$extensions.mode.dark;let L={};for(let[H,_]of Object.entries(E))L[H]=A(_);return L}return E};for(let[E,L]of Object.entries(X.value))G[E]=A(L)}q.push({...X,name:`${X.name}#dark`,value:G,path:[...X.path,"#dark"],extensions:{...X.extensions,autoGenerated:!0}})}}}if(Z.generateModes&&!X.extensions?.mode&&typeof X.value==="string"&&X.value.startsWith("{")&&X.value.endsWith("}")){let $=X.value.slice(1,-1),U=(A,E=new Set)=>{if(E.has(A))return!1;E.add(A);let L=Y?.get(A);if(!L){let H=A.match(/^(.+)@([^@]+)$/);if(H){let[,_,Q]=H,J=Y?.get(_);if(J){if(J.extensions?.mode?.dark!==void 0)return!0;if(J.extensions?.generators)return!0;return U(_,E)}}return!1}if(L.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${A}#dark`))return!0;if(typeof L.value==="string"&&L.value.startsWith("{")&&L.value.endsWith("}")){let H=L.value.slice(1,-1);return U(H,E)}if(Array.isArray(L.value)||typeof L.value==="object"&&L.value!==null){let H=(_)=>{if(typeof _!=="object"||_===null)return!1;if(_.$extensions?.mode)return!0;return Object.values(_).some((Q)=>{if(typeof Q==="object"&&Q!==null)return H(Q);return!1})};if(Array.isArray(L.value))return L.value.some((_)=>typeof _==="string"&&_.includes("{")&&U(_.slice(1,-1),new Set(E))||typeof _==="object"&&_!==null&&(Object.values(_).some((Q)=>typeof Q==="string"&&Q.includes("{")&&U(Q.slice(1,-1),new Set(E)))||H(_)));else if(typeof L.value==="object")return Object.values(L.value).some((_)=>typeof _==="string"&&_.includes("{")&&U(_.slice(1,-1),new Set(E)))||H(L.value)}return!1},W=U($);if(["color","shadow","border","background","surface","composition"].includes(X.type)&&W&&W&&!$.includes("#dark")&&!$.includes("@dark")){let A=`{${$}#dark}`;q.push({...X,name:`${X.name}#dark`,value:A,path:[...X.path,"#dark"],extensions:{...X.extensions,autoGenerated:!0}})}}if(Z.generateDerivedTokens&&X.extensions?.generators)for(let $ of X.extensions.generators)for(let[U,W]of Object.entries($.value)){let K=bZ(X.name,U),{generators:z,...G}=X.extensions;q.push({...X,name:K,value:X.value,path:[...X.path,U],extensions:{...G,generator:{type:$.type,value:W}}})}if(Z.generateBreakpointTokens&&X.extensions?.breakpoints)for(let[$,U]of Object.entries(X.extensions.breakpoints)){let W=`${X.name}@${$.replace(/[^a-zA-Z0-9]/g,"_")}`,K=U.$value||U.value;if(K&&typeof K==="object"&&"$value"in K)K=K.$value;else if(!K&&typeof U==="object"){let{...A}=U;if(Object.keys(A).length>0)K=A}let z=U.$extensions||U.$extensions,G=U.$type;if(!G&&U.value&&typeof U.value==="object")G=U.value.$type;q.push({...X,name:W,value:K,path:[...X.path,`@${$}`],type:G||X.type,extensions:{mediaQuery:$,...z?{mode:z.mode||z.$mode,generators:z.generators||z.$generators,...Object.fromEntries(Object.entries(z).filter(([A])=>!["mode","$mode","generators","$generators"].includes(A)))}:{}}})}return q}function e0(X,Z){let Y=e(X.value,Z),q=X.type;if(typeof X.value==="string"&&IX(X.value)){let U=X.value.slice(1,-1),W=Z.tokens.get(U);if(W){if(["border","shadow","typography","composition"].includes(W.type))q=W.type;else if(typeof W.value==="string"&&wX(W.value)){let K=fX(W.value),z=new Set;for(let G of K)if(G.type==="reference"&&G.ref&&typeof G.ref==="string"){let A=G.ref.slice(1,-1),E=Z.tokens.get(A);if(E&&["border","shadow","typography","composition"].includes(E.type))z.add(E.type)}if(z.size===1)q=Array.from(z)[0]}}}if(typeof X.value==="string"&&wX(X.value)){let U=fX(X.value),W=new Set;for(let K of U)if(K.type==="reference"&&K.ref&&typeof K.ref==="string"){let z=K.ref.slice(1,-1),G=Z.tokens.get(z);if(G&&["border","shadow","typography","composition"].includes(G.type))W.add(G.type)}if(W.size===1)q=Array.from(W)[0]}if(typeof Y==="object"&&Y!==null&&["border","shadow","typography","composition"].includes(q))Y=s(Y,Z);if(X.extensions?.generator&&typeof X.extensions.generator==="object"&&"type"in X.extensions.generator&&"value"in X.extensions.generator)Y=vX(X.value,X.extensions.generator.type,X.extensions.generator.value,Z);let $=X1(X.name,Z.options);if(q==="color"&&typeof Y==="string"&&p(Y))Y=b(Y,X);if(typeof Y==="string"&&k(Y))Y=RX(Y);return{...X,type:q,value:Y,cssVar:$}}function s(X,Z){if(typeof X==="string"){if(IX(X))return FY(X,Z);else if(wX(X))return hZ(X,Z)}if(Array.isArray(X))return X.map((Y)=>s(Y,Z));if(typeof X==="object"&&X!==null){if("$value"in X&&typeof X.$value==="string")return s(X.$value,Z);if("value"in X&&typeof X.value==="string"&&"$type"in X){if(Z.mode&&X.$extensions?.mode?.[Z.mode])return s(X.$extensions.mode[Z.mode],Z);return s(X.value,Z)}if("value"in X&&typeof X.value==="object"&&"$type"in X){let q=X.value,$=X.$extensions?.delimiter?.character||" ";if(X.$type==="composition"&&q&&typeof q==="object")return Object.values(q).map((W)=>s(W,Z)).join($);return s(X.value,Z)}let Y={};for(let[q,$]of Object.entries(X))Y[q]=s($,Z);return Y}return X}function e(X,Z){if(typeof X==="string"){if(wX(X))return hZ(X,Z);else if(IX(X))return FY(X,Z)}else if(typeof X==="object"&&X!==null&&"$ref"in X)return vZ(X,Z);return X}function FY(X,Z){let Y=X.slice(1,-1),q=Z.tokens.get(Y),$=Z.options.modes||[];if(!q){if($.length>0){for(let K of $)if(Y.endsWith(`@${K}`)){let z=Y.slice(0,-K.length-1)+`#${K}`;if(q=Z.tokens.get(z),q)return wY(q,Z);break}}let W=Y.match(/#([^#@]+)$/);if(W){let K=Y.substring(0,W.index),z=W[1];if(q=Z.tokens.get(K),q){if(q.extensions?.mode?.[z]){let G=q.extensions.mode[z],A=e(G,{...Z,mode:z});if(q.extensions?.generator&&typeof q.extensions.generator==="object"&&"type"in q.extensions.generator&&"value"in q.extensions.generator)A=vX(A,q.extensions.generator.type,q.extensions.generator.value,Z);if(q.type==="color"&&typeof A==="string"&&p(A))A=b(A,q);if(typeof A==="string"&&k(A))A=RX(A);return A}}}if($.length>0)for(let K of $){let z=new RegExp(`(@[^@]+)@${K}$`);if(z.test(Y)){let G=Y.replace(z,`$1#${K}`);if(q=Z.tokens.get(G),!q){let A=G.match(/#([^#@]+)$/);if(A){let E=G.substring(0,A.index),L=A[1];if(q=Z.tokens.get(E),q&&q.extensions?.mode?.[L]){let H=q.extensions.mode[L],_=e(H,{...Z,mode:L});if(q.extensions?.generator&&typeof q.extensions.generator==="object"&&"type"in q.extensions.generator&&"value"in q.extensions.generator)_=vX(_,q.extensions.generator.type,q.extensions.generator.value,Z);if(q.type==="color"&&typeof _==="string"&&p(_))_=b(_,q);if(typeof _==="string"&&k(_))_=RX(_);return _}}}else return wY(q,Z);break}}}if(!q)return console.warn(`Token reference not found: ${X}`),Z.brokenReferences.push(X),X;return wY(q,Z)}function wY(X,Z){let Y;if(X.extensions?.generator&&typeof X.extensions.generator==="object"&&"type"in X.extensions.generator&&"value"in X.extensions.generator)Y=vX(X.value,X.extensions.generator.type,X.extensions.generator.value,Z);else if(Z.mode&&X.extensions?.mode?.[Z.mode])Y=e(X.extensions.mode[Z.mode],Z);else Y=e(X.value,Z);if(X.type==="color"&&typeof Y==="string"&&p(Y))Y=b(Y,X);if(typeof Y==="string"&&k(Y))Y=RX(Y);return Y}function vZ(X,Z){let q=X.$ref.slice(2).replace(/\//g,"."),$=Z.tokens.get(q);if(!$)return console.warn(`JSON Pointer reference not found: ${X.$ref}`),Z.brokenReferences.push(X.$ref),X.$ref;return e($.value,Z)}function hZ(X,Z){let Y=fX(X),q=Y.some((W)=>W.value.includes(",")),$=!0,U=[];for(let W of Y){let K;if(W.type==="reference"&&W.ref){if(typeof W.ref==="string"&&IX(W.ref)){K=FY(W.ref,Z);let z=W.ref.slice(1,-1),G=Z.tokens.get(z);if(!G||!["border","shadow","typography","composition"].includes(G.type))$=!1}else if(typeof W.ref==="object"&&"$ref"in W.ref)K=vZ(W.ref,Z)}else if(K=W.value,W.value.trim()&&W.value.trim()!==",")$=!1;U.push(K)}if(q&&$)return U.filter((W)=>typeof W==="object"&&W!==null&&typeof W!=="string");return U.map((W)=>String(W)).join("")}function vX(X,Z,Y,q){let $=e(X,q);switch(Z){case"alpha":if(typeof $==="string")return Y1($,Number(Y)/100);break;case"scale":if(typeof $==="string"&&$.match(/[\d.]+/))return Z1($,Number(Y));break;case"hue":if(typeof $==="string")return q1($,Number(Y));break;default:return console.warn(`Unknown generator type: ${Z}`),$}return $}function X1(X,Z,Y){let q=X.replace(/\./g,"-");q=q.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),q=q.replace(/@[^@#]*(?:screen|width|height|min|max|orientation).*$/i,""),q=q.replace(/#[^#]*$/,""),q=q.replace(/-@/g,"-").replace(/@/g,"-");let $=q,U=!0,W=Z.prefix||"";if(Z.transformName){if($=Z.transformName(q),$=$.replace(/-+$/,""),$!==q)U=!1}let K=U&&W?`${W}-${$}`:$,z=Y?`-${Y}`:"";return`--${K}${z}`.replace(/[^a-zA-Z0-9-_]/g,"-")}function Y1(X,Z){try{if(!p(X))return X;let Y=new gZ(X);return Y.alpha=Z,b(Y)}catch(Y){return console.warn(`Failed to apply alpha to color "${X}": ${Y}`),X}}function Z1(X,Z){let Y=X.match(/([\d.]+)(\w+)/);if(Y){let[,q,$]=Y;return`${parseFloat(q)*Z}${$}`}return X}function q1(X,Z){try{if(!p(X))return X;let q=new gZ(X).to("oklch");return q.h=(q.h+Z)%360,b(q)}catch(Y){return console.warn(`Failed to shift hue for color "${X}": ${Y}`),X}}var xY=S(()=>{PZ();EX()});function jY(X){if(X.type==="typography"||X.type==="fontWeight"||X.type==="fontFamily")return!0;if(X.type==="dimension"&&X.name.includes("typography"))return!0;if(X.name.includes("typography")||X.name.includes("font"))return!0;return!1}function i(X,Z,Y){if(Y){if(X===Z)return":host";return`:host([data-theme="${X}"])`}if(X===Z)return":root";return`[data-theme="${X}"]`}function hX(X,Z={}){let{rootSelector:Y=":root",separateThemeFiles:q=!1,generateMediaQueries:$=!1,customHeader:U,modes:W=["light","dark"]}=Z;if(q)return U1(X,Z);let K=new Map,z=new Map;for(let B of W)K.set(B,[]);let G=W.join("|"),A=new RegExp(`#(${G})$`);for(let B of X){if(typeof B.value==="string"&&k(B.value))continue;if(jY(B))continue;let R=` ${B.cssVar}: ${m(B.value,B.type)};`;if($&&B.name.includes("@media")){let w=pX(B);if(w){if(!z.has(w))z.set(w,[]);z.get(w).push(R);continue}}let I=B.name.match(A);if(I){let w=I[1];if(!K.has(w))K.set(w,[]);K.get(w).push(R)}else{let w=W[0]||"light";K.get(w).push(R)}}let E="";if(U)E+=`${U}
35
35
 
36
36
  `;let L=Z.defaultMode||W[0]||"light",H=Z.isHost||!1,_=K.get(L)||[];if(_.length>0){_.sort();let B=i(L,L,H);E+=`${B} {
37
37
  ${_.join(`
@@ -56,7 +56,7 @@ ${I.map((w)=>` ${w}`).join(`
56
56
  }
57
57
  `}let Q=[{fileName:"tokens.css",content:E.endsWith(`
58
58
  `)?E:`${E}
59
- `}],J=kZ(X,Z);Q.push(...J);let O=cZ(X,Z);return Q.push(...O),Q}function $1(X,Z){let Y=[];for(let $ of X){let W=` ${$.cssVar||mX($,Z)}: ${m($.value,$.type)};`;Y.push(W)}let q="";if(Z.customHeader)q+=`${Z.customHeader}
59
+ `}],J=uZ(X,Z);Q.push(...J);let O=cZ(X,Z);return Q.push(...O),Q}function $1(X,Z){let Y=[];for(let $ of X){let W=` ${$.cssVar||mX($,Z)}: ${m($.value,$.type)};`;Y.push(W)}let q="";if(Z.customHeader)q+=`${Z.customHeader}
60
60
 
61
61
  `;if(Y.length>0)Y.sort(),q+=`${Z.rootSelector||":root"} {
62
62
  ${Y.join(`
@@ -64,7 +64,7 @@ ${Y.join(`
64
64
  }
65
65
  `;return{fileName:"theme.css",content:q.endsWith(`
66
66
  `)?q:`${q}
67
- `}}function U1(X,Z){let Y=[],q=new Map,$=[],U=Z.modes||["light","dark"],W=new Set(U),K=U.join("|"),z=new RegExp(`#(${K})$`);for(let _ of X){if(pX(_))continue;if(typeof _.value==="string"&&u(_.value))continue;if(jY(_))continue;let Q=_.name.match(z);if(Q){let J=Q[1];if(W.has(J)){if(!q.has(J))q.set(J,[]);q.get(J).push(_)}else $.push(_)}else $.push(_)}if($.length>0){let _=hX($,{...Z,separateThemeFiles:!1})[0];Y.push({..._,fileName:"tokens.css"})}let G=Z.defaultMode||(U.length>0?U[0]:"default"),A=Z.isHost||!1;for(let[_,Q]of q){let J=i(_,G,A),O=$1(Q,{...Z,separateThemeFiles:!1,rootSelector:J});Y.push({...O,fileName:`tokens.${_}.css`,theme:_})}let E=K1(X,Z);Y.push(...E);let L=kZ(X,Z);Y.push(...L);let H=cZ(X,Z);return Y.push(...H),Y}function K1(X,Z){let Y=new Map;for(let U of X){let W=pX(U);if(W){let K=U.name.match(/@(dark|light)$/),z=K?K[1]:"light";if(!Y.has(W))Y.set(W,new Map);let G=Y.get(W);if(!G.has(z))G.set(z,[]);G.get(z).push(U)}}if(Y.size===0)return[];let q=`/**
67
+ `}}function U1(X,Z){let Y=[],q=new Map,$=[],U=Z.modes||["light","dark"],W=new Set(U),K=U.join("|"),z=new RegExp(`#(${K})$`);for(let _ of X){if(pX(_))continue;if(typeof _.value==="string"&&k(_.value))continue;if(jY(_))continue;let Q=_.name.match(z);if(Q){let J=Q[1];if(W.has(J)){if(!q.has(J))q.set(J,[]);q.get(J).push(_)}else $.push(_)}else $.push(_)}if($.length>0){let _=hX($,{...Z,separateThemeFiles:!1})[0];Y.push({..._,fileName:"tokens.css"})}let G=Z.defaultMode||(U.length>0?U[0]:"default"),A=Z.isHost||!1;for(let[_,Q]of q){let J=i(_,G,A),O=$1(Q,{...Z,separateThemeFiles:!1,rootSelector:J});Y.push({...O,fileName:`tokens.${_}.css`,theme:_})}let E=K1(X,Z);Y.push(...E);let L=uZ(X,Z);Y.push(...L);let H=cZ(X,Z);return Y.push(...H),Y}function K1(X,Z){let Y=new Map;for(let U of X){let W=pX(U);if(W){let K=U.name.match(/@(dark|light)$/),z=K?K[1]:"light";if(!Y.has(W))Y.set(W,new Map);let G=Y.get(W);if(!G.has(z))G.set(z,[]);G.get(z).push(U)}}if(Y.size===0)return[];let q=`/**
68
68
  * Design System Tokens - Responsive Breakpoints
69
69
  * Generated: ${new Date().toISOString()}
70
70
  *
@@ -80,7 +80,7 @@ ${E.join(`
80
80
  }
81
81
 
82
82
  `}}}return[{fileName:"tokens.breakpoints.css",content:q.trim()+`
83
- `}]}function kZ(X,Z){let Y=new Map;for(let $ of X)if(typeof $.value==="string"&&u($.value)){let U=$.name.match(/@(dark|light)$/),W=U?U[1]:"light";if(!Y.has(W))Y.set(W,[]);Y.get(W).push($)}let q=[];if(Y.size===0)return[];if(Y.size===1){let[$,U]=Array.from(Y.entries())[0],W=mZ(U,$,Z);q.push({fileName:"tokens.icons.css",content:W.endsWith(`
83
+ `}]}function uZ(X,Z){let Y=new Map;for(let $ of X)if(typeof $.value==="string"&&k($.value)){let U=$.name.match(/@(dark|light)$/),W=U?U[1]:"light";if(!Y.has(W))Y.set(W,[]);Y.get(W).push($)}let q=[];if(Y.size===0)return[];if(Y.size===1){let[$,U]=Array.from(Y.entries())[0],W=mZ(U,$,Z);q.push({fileName:"tokens.icons.css",content:W.endsWith(`
84
84
  `)?W:`${W}
85
85
  `})}else for(let[$,U]of Y){let W=mZ(U,$,Z);q.push({fileName:`tokens.icons.${$}.css`,content:W.endsWith(`
86
86
  `)?W:`${W}
@@ -123,7 +123,7 @@ ${z.sort().map((H)=>` ${H}`).join(`
123
123
  `,$+=`}
124
124
 
125
125
  `}}}return $+`
126
- `}function m(X,Z){if(X===null||X===void 0)return"";if(typeof X==="object"&&X!==null&&!Array.isArray(X)){let q=X;if(q.$value!==void 0){if(typeof q.$value==="string")return q.$value;return m(q.$value,q.$type||Z)}}let Y=String(X);switch(Z){case"color":return W1(Y);case"dimension":return G1(Y);case"duration":return z1(Y);case"fontFamily":return A1(Y);case"fontWeight":return E1(Y);case"cubicBezier":return L1(X);case"shadow":return H1(X);case"border":return _1(X);case"typography":return Q1(X);case"composition":return DY(X);default:if(Y.startsWith("data:"))return`"${Y}"`;return Y}}function W1(X){if(X.startsWith("oklch(")||X.startsWith("rgb(")||X.startsWith("rgba(")||X.startsWith("hsl(")||X.startsWith("hsla(")||X.startsWith("#"))return X;return X}function G1(X){if(/^\d+(\.\d+)?(px|rem|em|%|vh|vw|vmin|vmax)$/.test(X))return X;if(/^\d+(\.\d+)?$/.test(X))return`${X}rem`;return X}function z1(X){if(/^\d+(\.\d+)?(s|ms)$/.test(X))return X;if(/^\d+(\.\d+)?$/.test(X))return`${X}ms`;return X}function A1(X){if((X.includes(",")||X.includes(" "))&&!X.startsWith('"')&&!X.startsWith("'"))return`"${X}"`;return X}function E1(X){return{thin:"100","extra-light":"200",light:"300",normal:"400",medium:"500","semi-bold":"600",bold:"700","extra-bold":"800",black:"900"}[X]||X}function L1(X){if(Array.isArray(X)&&X.length===4)return`cubic-bezier(${X.join(", ")})`;return String(X)}function H1(X){if(Array.isArray(X))return X.map((Z)=>dZ(Z)).join(", ");return dZ(X)}function dZ(X){if(typeof X==="object"&&X!==null){let Z=X,Y=Z.color||"transparent";if(typeof Y==="string"&&Y.includes("{")&&Y.includes("}")){console.warn(`Unresolved token reference in shadow color: ${Y}`);let $=Y.match(/\{([^}]+)\}/)?.[1];if($)Y=`var(${`--${MX}-${$.replace(/\./g,"-").replace(/@/g,"-")}`})`}let q=[Z.offsetX||"0",Z.offsetY||"0",Z.blur||"0",Z.spread||"0",Y];if(Z.inset)q.unshift("inset");return q.join(" ")}return String(X)}function _1(X){if(typeof X==="object"&&X!==null){let Z=X,Y=j(Z.width)||"1px",q=j(Z.style)||"solid",$=j(Z.color)||"transparent";return`${Y} ${q} ${$}`}return String(X)}function Q1(X){if(typeof X==="object"&&X!==null){let Z=X,Y=Z.fontWeight||"normal",q=Z.fontSize||"1rem",$=Z.lineHeight||"normal",U=Z.fontFamily||"sans-serif";if(U.includes(" ")&&!U.startsWith('"')&&!U.startsWith("'"))U=`'${U}'`;let W;if(q.includes("/"))W=q;else W=`${q}/${$}`;return`${Y} ${W} ${U}`}return String(X)}function DY(X){if(typeof X!=="object"||X===null)return String(X);if(Array.isArray(X))return X.map((Y)=>DY(Y)).join(", ");let Z=X;if(Z.offsetX!==void 0&&Z.offsetY!==void 0)return lZ(Z);if(Z.width!==void 0&&Z.style!==void 0&&Z.color!==void 0){let Y=String(Z.width||"1px"),q=String(Z.style||"solid"),$=String(Z.color||"transparent");return`${Y} ${q} ${$}`}if(Z.blur!==void 0||Z.saturate!==void 0||Z.brightness!==void 0)return O1(Z);if(Z.fontSize!==void 0||Z.fontFamily!==void 0)return J1(Z);return B1(Z)}function lZ(X){let Z=[j(X.offsetX)||"0",j(X.offsetY)||"0",j(X.blur)||"0",j(X.spread)||"0",j(X.color)||"transparent"];if(X.inset&&j(X.inset)==="true")Z.unshift("inset");return Z.join(" ")}function O1(X){let Z=[];if(X.blur)Z.push(j(X.blur)||"blur(0)");if(X.saturate)Z.push(j(X.saturate)||"saturate(100%)");if(X.brightness)Z.push(j(X.brightness)||"brightness(100%)");if(X.contrast)Z.push(j(X.contrast)||"contrast(100%)");if(X.hueRotate)Z.push(j(X.hueRotate)||"hue-rotate(0deg)");return Z.join(" ")||"none"}function J1(X){let Z=j(X.fontWeight)||"normal",Y=j(X.fontSize)||"1rem",q=j(X.lineHeight),$=j(X.fontFamily)||"sans-serif";if($.includes(" ")&&!$.startsWith('"')&&!$.startsWith("'"))$=`'${$}'`;if(Y.includes("/"))return`${Z} ${Y} ${$}`;else if(q)return`${Z} ${Y}/${q} ${$}`;return`${Z} ${Y} ${$}`}function uZ(X,Z,Y){let q=X.match(/^\{(.+)\}$/);if(!q)return X;let U=q[1].replace(/\./g,"-");if(Y)U=bY(U,{shortenName:Y.$metaData?.tokens?.css?.hooks?.shortenName});return`var(--${U})`}function j(X,Z,Y){if(X===null||X===void 0)return"";if(typeof X==="string"){if(X.match(/^\{.+\}$/))return uZ(X,Z||"ds",Y);return X}if(typeof X==="object"&&X.value!==void 0){let q=String(X.value);if(q.match(/^\{.+\}$/))return uZ(q,Z||"ds",Y);return q}return String(X)}function B1(X){let Z=[];for(let[,$]of Object.entries(X)){let U=$;if(typeof $==="object"&&$!==null&&U.$value&&typeof U.$value==="object"){let W=U.$value;if(W.offsetX!==void 0&&W.offsetY!==void 0){let K=lZ(W);if(K)Z.push(K)}else{let K=DY(W);if(K)Z.push(K)}}else{let W=j($);if(W)Z.push(W)}}let q=Z.some(($)=>/^\d/.test($)&&$.includes(" "))?", ":" ";return Z.join(q)||String(X)}function pX(X){if(X.extensions?.mediaQuery&&typeof X.extensions.mediaQuery==="string"){let Y=X.extensions.mediaQuery;if(Y=Y.replace(/\{universe\.foundation\.breakpoint\.screen\.width\.lg\}/g,"64rem"),!Y.startsWith("@media"))Y=`@media ${Y}`;return Y}let Z=X.name.match(/@(media[^@]+)/);if(Z)return`@${Z[1].replace(/_/g," ")}`;if(X.name.includes("@screen_and__min_width__300px_"))return"@media screen and (min-width: 300px)";if(X.name.includes("@screen_and__min_width__600px_"))return"@media screen and (min-width: 600px)";if(X.name.includes("@")&&X.name.includes("_"))return"@media (unknown-breakpoint)";return null}function dX(X){let Z=X?.$name||"Design System",Y=X?.$version||"1.0.0",q=new Date().toISOString();return`/**
126
+ `}function m(X,Z){if(X===null||X===void 0)return"";if(typeof X==="object"&&X!==null&&!Array.isArray(X)){let q=X;if(q.$value!==void 0){if(typeof q.$value==="string")return q.$value;return m(q.$value,q.$type||Z)}}let Y=String(X);switch(Z){case"color":return W1(Y);case"dimension":return G1(Y);case"duration":return z1(Y);case"fontFamily":return A1(Y);case"fontWeight":return E1(Y);case"cubicBezier":return L1(X);case"shadow":return H1(X);case"border":return _1(X);case"typography":return Q1(X);case"composition":return DY(X);default:if(Y.startsWith("data:"))return`"${Y}"`;return Y}}function W1(X){if(X.startsWith("oklch(")||X.startsWith("rgb(")||X.startsWith("rgba(")||X.startsWith("hsl(")||X.startsWith("hsla(")||X.startsWith("#"))return X;return X}function G1(X){if(/^\d+(\.\d+)?(px|rem|em|%|vh|vw|vmin|vmax)$/.test(X))return X;if(/^\d+(\.\d+)?$/.test(X))return`${X}rem`;return X}function z1(X){if(/^\d+(\.\d+)?(s|ms)$/.test(X))return X;if(/^\d+(\.\d+)?$/.test(X))return`${X}ms`;return X}function A1(X){if((X.includes(",")||X.includes(" "))&&!X.startsWith('"')&&!X.startsWith("'"))return`"${X}"`;return X}function E1(X){return{thin:"100","extra-light":"200",light:"300",normal:"400",medium:"500","semi-bold":"600",bold:"700","extra-bold":"800",black:"900"}[X]||X}function L1(X){if(Array.isArray(X)&&X.length===4)return`cubic-bezier(${X.join(", ")})`;return String(X)}function H1(X){if(Array.isArray(X))return X.map((Z)=>dZ(Z)).join(", ");return dZ(X)}function dZ(X){if(typeof X==="object"&&X!==null){let Z=X,Y=Z.color||"transparent";if(typeof Y==="string"&&Y.includes("{")&&Y.includes("}")){console.warn(`Unresolved token reference in shadow color: ${Y}`);let $=Y.match(/\{([^}]+)\}/)?.[1];if($)Y=`var(${`--${MX}-${$.replace(/\./g,"-").replace(/@/g,"-")}`})`}let q=[Z.offsetX||"0",Z.offsetY||"0",Z.blur||"0",Z.spread||"0",Y];if(Z.inset)q.unshift("inset");return q.join(" ")}return String(X)}function _1(X){if(typeof X==="object"&&X!==null){let Z=X,Y=j(Z.width)||"1px",q=j(Z.style)||"solid",$=j(Z.color)||"transparent";return`${Y} ${q} ${$}`}return String(X)}function Q1(X){if(typeof X==="object"&&X!==null){let Z=X,Y=Z.fontWeight||"normal",q=Z.fontSize||"1rem",$=Z.lineHeight||"normal",U=Z.fontFamily||"sans-serif";if(U.includes(" ")&&!U.startsWith('"')&&!U.startsWith("'"))U=`'${U}'`;let W;if(q.includes("/"))W=q;else W=`${q}/${$}`;return`${Y} ${W} ${U}`}return String(X)}function DY(X){if(typeof X!=="object"||X===null)return String(X);if(Array.isArray(X))return X.map((Y)=>DY(Y)).join(", ");let Z=X;if(Z.offsetX!==void 0&&Z.offsetY!==void 0)return lZ(Z);if(Z.width!==void 0&&Z.style!==void 0&&Z.color!==void 0){let Y=String(Z.width||"1px"),q=String(Z.style||"solid"),$=String(Z.color||"transparent");return`${Y} ${q} ${$}`}if(Z.blur!==void 0||Z.saturate!==void 0||Z.brightness!==void 0)return O1(Z);if(Z.fontSize!==void 0||Z.fontFamily!==void 0)return J1(Z);return B1(Z)}function lZ(X){let Z=[j(X.offsetX)||"0",j(X.offsetY)||"0",j(X.blur)||"0",j(X.spread)||"0",j(X.color)||"transparent"];if(X.inset&&j(X.inset)==="true")Z.unshift("inset");return Z.join(" ")}function O1(X){let Z=[];if(X.blur)Z.push(j(X.blur)||"blur(0)");if(X.saturate)Z.push(j(X.saturate)||"saturate(100%)");if(X.brightness)Z.push(j(X.brightness)||"brightness(100%)");if(X.contrast)Z.push(j(X.contrast)||"contrast(100%)");if(X.hueRotate)Z.push(j(X.hueRotate)||"hue-rotate(0deg)");return Z.join(" ")||"none"}function J1(X){let Z=j(X.fontWeight)||"normal",Y=j(X.fontSize)||"1rem",q=j(X.lineHeight),$=j(X.fontFamily)||"sans-serif";if($.includes(" ")&&!$.startsWith('"')&&!$.startsWith("'"))$=`'${$}'`;if(Y.includes("/"))return`${Z} ${Y} ${$}`;else if(q)return`${Z} ${Y}/${q} ${$}`;return`${Z} ${Y} ${$}`}function kZ(X,Z,Y){let q=X.match(/^\{(.+)\}$/);if(!q)return X;let U=q[1].replace(/\./g,"-");if(Y)U=bY(U,{shortenName:Y.$metaData?.tokens?.css?.hooks?.shortenName});return`var(--${U})`}function j(X,Z,Y){if(X===null||X===void 0)return"";if(typeof X==="string"){if(X.match(/^\{.+\}$/))return kZ(X,Z||"ds",Y);return X}if(typeof X==="object"&&X.value!==void 0){let q=String(X.value);if(q.match(/^\{.+\}$/))return kZ(q,Z||"ds",Y);return q}return String(X)}function B1(X){let Z=[];for(let[,$]of Object.entries(X)){let U=$;if(typeof $==="object"&&$!==null&&U.$value&&typeof U.$value==="object"){let W=U.$value;if(W.offsetX!==void 0&&W.offsetY!==void 0){let K=lZ(W);if(K)Z.push(K)}else{let K=DY(W);if(K)Z.push(K)}}else{let W=j($);if(W)Z.push(W)}}let q=Z.some(($)=>/^\d/.test($)&&$.includes(" "))?", ":" ";return Z.join(q)||String(X)}function pX(X){if(X.extensions?.mediaQuery&&typeof X.extensions.mediaQuery==="string"){let Y=X.extensions.mediaQuery;if(Y=Y.replace(/\{universe\.foundation\.breakpoint\.screen\.width\.lg\}/g,"64rem"),!Y.startsWith("@media"))Y=`@media ${Y}`;return Y}let Z=X.name.match(/@(media[^@]+)/);if(Z)return`@${Z[1].replace(/_/g," ")}`;if(X.name.includes("@screen_and__min_width__300px_"))return"@media screen and (min-width: 300px)";if(X.name.includes("@screen_and__min_width__600px_"))return"@media screen and (min-width: 600px)";if(X.name.includes("@")&&X.name.includes("_"))return"@media (unknown-breakpoint)";return null}function dX(X){let Z=X?.$name||"Design System",Y=X?.$version||"1.0.0",q=new Date().toISOString();return`/**
127
127
  * ${Z} - CSS Custom Properties
128
128
  * Version: ${Y}
129
129
  * Generated: ${q}
@@ -150,7 +150,7 @@ ${z.sort().map((H)=>` ${H}`).join(`
150
150
  `;let G=[...X].sort((A,E)=>A.name.localeCompare(E.name));for(let A of G){let E=A.name.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""),L=A.category?`${W}-${A.category}-${E}`:`${W}-${E}`;if(Z.hooks?.shortenName?.enabled)L=bY(L,Z.hooks);let H=I1(A.value);K+=` ${L}: url("${H}");
151
151
  `}return K+=`}
152
152
  `,{fileName:"tokens.icons.css",content:K.trim()+`
153
- `}}var uX=S(()=>{g()});import{readFileSync as w1,existsSync as R1}from"fs";import{join as rZ,relative as M1}from"path";async function PY(){try{let{assets:X}=await d(!0),{icons:Z}=await T(),Y=await o(),q=X?.icons?.distDir??"build",$=rZ(Y,q),U=rZ($,"tokens",await WX("json"));if(!R1(U)){let _=M1(process.cwd(),U);return console.log(`ℹ️ Icon data not found (skipping icon types): ${_}`),console.log(" Run icon build first if you need icon types generated."),[]}let W=JSON.parse(w1(U,"utf8")),K=Z?.objectPath??"universe.icons",z=K.split("."),G=W;for(let _ of z)if(G&&typeof G==="object"&&_ in G)G=G[_];else throw Error(`Icon path ${K} not found in icons file`);let A=[],E=Object.keys(G)[0],L=G[E];if(L&&typeof L==="object"&&"$value"in L){for(let[_,Q]of Object.entries(G))if(typeof Q==="object"&&Q!==null){let J=Q;if(_.startsWith("$"))continue;A.push({name:_,category:"",value:J.$value||"",description:J.$description||"",style:J.$style||"",dimensions:J.$extensions?.dimensions||J.$dimensions})}}else for(let[_,Q]of Object.entries(G))if(typeof Q==="object"&&Q!==null){for(let[J,O]of Object.entries(Q))if(typeof O==="object"&&O!==null){let B=O;if(J.startsWith("$"))continue;A.push({name:J,category:_,value:B.$value||"",description:B.$description||"",style:B.$style||"",dimensions:B.$extensions?.dimensions||B.$dimensions})}}return A}catch(X){if(X instanceof Error){if("code"in X&&X.code!=="ENOENT")console.warn(`⚠️ Could not load icon data: ${X.message}`)}return[]}}async function CY(X,Z={},Y){let{generateTypes:q=!0,generateConsts:$=!0}=Z,U=Z.icons;if(!U)U=await PY();let W={...Z,icons:U},K=[];if(q)K.push({fileName:"tokens.types.ts",content:N1(X,W),type:"types"});if($)K.push({fileName:"tokens.constants.ts",content:F1(X,W),type:"constants"});return K.push({fileName:"index.ts",content:x1(K,Y),type:"index"}),K}function N1(X,Z){let{tokenInterface:Y="DesignTokens",includeJSDoc:q=!0,icons:$=[]}=Z,U=VY("Type Definitions");if(U+=j1(X,q),U+=b1(X,q),$.length>0)U+=D1($,q);return U+=S1(X,Y,q),U+=C1(X,q),U+`
153
+ `}}var kX=S(()=>{g()});import{readFileSync as w1,existsSync as R1}from"fs";import{join as rZ,relative as M1}from"path";async function PY(){try{let{assets:X}=await d(!0),{icons:Z}=await T(),Y=await o(),q=X?.icons?.distDir??"build",$=rZ(Y,q),U=rZ($,"tokens",await WX("json"));if(!R1(U)){let _=M1(process.cwd(),U);return console.log(`ℹ️ Icon data not found (skipping icon types): ${_}`),console.log(" Run icon build first if you need icon types generated."),[]}let W=JSON.parse(w1(U,"utf8")),K=Z?.objectPath??"universe.icons",z=K.split("."),G=W;for(let _ of z)if(G&&typeof G==="object"&&_ in G)G=G[_];else throw Error(`Icon path ${K} not found in icons file`);let A=[],E=Object.keys(G)[0],L=G[E];if(L&&typeof L==="object"&&"$value"in L){for(let[_,Q]of Object.entries(G))if(typeof Q==="object"&&Q!==null){let J=Q;if(_.startsWith("$"))continue;A.push({name:_,category:"",value:J.$value||"",description:J.$description||"",style:J.$style||"",dimensions:J.$extensions?.dimensions||J.$dimensions})}}else for(let[_,Q]of Object.entries(G))if(typeof Q==="object"&&Q!==null){for(let[J,O]of Object.entries(Q))if(typeof O==="object"&&O!==null){let B=O;if(J.startsWith("$"))continue;A.push({name:J,category:_,value:B.$value||"",description:B.$description||"",style:B.$style||"",dimensions:B.$extensions?.dimensions||B.$dimensions})}}return A}catch(X){if(X instanceof Error){if("code"in X&&X.code!=="ENOENT")console.warn(`⚠️ Could not load icon data: ${X.message}`)}return[]}}async function CY(X,Z={},Y){let{generateTypes:q=!0,generateConsts:$=!0}=Z,U=Z.icons;if(!U)U=await PY();let W={...Z,icons:U},K=[];if(q)K.push({fileName:"tokens.types.ts",content:N1(X,W),type:"types"});if($)K.push({fileName:"tokens.constants.ts",content:F1(X,W),type:"constants"});return K.push({fileName:"index.ts",content:x1(K,Y),type:"index"}),K}function N1(X,Z){let{tokenInterface:Y="DesignTokens",includeJSDoc:q=!0,icons:$=[]}=Z,U=VY("Type Definitions");if(U+=j1(X,q),U+=b1(X,q),$.length>0)U+=D1($,q);return U+=S1(X,Y,q),U+=C1(X,q),U+`
154
154
  `}function F1(X,Z){let{includeJSDoc:Y=!0,icons:q=[]}=Z,$=VY("Token Constants"),U="TokenPaths, CSSVariableNames";if(q.length>0)U+=", IconNames, IconCategories, Icon";if($+=`import type { ${U} } from './tokens.types';
155
155
 
156
156
  `,$+=V1(X,Y),$+=y1(X,Y),q.length>0)$+=T1(q,Y);return $+=g1(X,Y),$+`
@@ -335,7 +335,7 @@ ${z.sort().map((H)=>` ${H}`).join(`
335
335
  * Do not edit this file directly - it will be overwritten.
336
336
  */
337
337
 
338
- `}var TY=S(()=>{g()});import{readFileSync as m1,mkdirSync as nZ}from"fs";import{writeFile as iZ,readdir as p1,mkdir as d1}from"fs/promises";import{resolve as u1,relative as aZ,join as kX,dirname as tZ}from"path";import k1 from"lodash";async function oZ(X){let Z=await p1(X,{withFileTypes:!0}),Y=await Promise.all(Z.map((q)=>{let $=u1(X,q.name);return q.isDirectory()?oZ($):$}));return Array.prototype.concat(...Y)}async function eZ(X,Z){if(!X)throw Error("outputDir is required for buildIcons");let{assets:Y,icons:q,tokenNamespace:$,__dirname:U,buildDir:W}=await r(),K=kX(U,Y?.icons?.sourceDir??"icons"),z="build",G=Y?.icons?.distDir??z,A=kX(U,G),E=kX(U,W,"icons");if(!Y?.icons?.sourceDir){console.warn("Skipping icon build: iconsDir is not defined in the project paths.");return}t(kX(U,W));let L=(await oZ(K)).filter((M)=>M.endsWith(".svg")),Q=(await Promise.all(L.map(async(M)=>{let N=m1(M,"utf8").replace(/(\s+(?=(?:[^"]*"[^"]*")*[^"]*$))/g," ").trim()??"";N=await JY(N);let YX=aZ(K,M).split("/").pop(),xX=(N.match(/name="(.*?)"/)??[])[1]??YX?.replace(".svg",""),lX=(N.match(/data-style="(.*?)"/)??[])[1],_0=(N.match(/description="(.*?)"/)??[])[1],[dY]=N.match(/<svg[^>]*>/)??[],[,Q0]=dY?.match(/width="([\d.]+)(px)?"/)??[],[,O0]=dY?.match(/height="([\d.]+)(px)?"/)??[];if(lX!=="animated"&&lX!=="custom")return{path:M,folder:aZ(K,M).split("/").slice(0,-1).concat(xX),file:YX,style:lX,content:N,name:xX,dimensions:{width:Number(Q0),height:Number(O0)},description:_0??""};return}))).filter((M)=>M!==void 0).reduce((M,N)=>{if(N?.style!=="animated"&&N?.style!=="custom"&&N)yY(M,N.folder.join("."),{$type:"icon",$name:N.name,$description:N.description,$style:N.style,$value:N.content,$extensions:{dimensions:N.dimensions},...c1(M,N.folder.join("."))});return M},{}),J=q?.objectPath??`${$}.icons`,B=Object.keys(Q).some((M)=>M.includes("."));Object.keys(Q).forEach(async(M)=>{let N,YX;if(B)N=`${E}/${M}`,YX=`${N}/svg.${M}.tokens.json`;else N=E,YX=`${E}/svg.${M}.tokens.json`;await d1(N,{recursive:!0});let xX=yY({},`${J}${J?".":""}${M}`,Q[M]);await iZ(YX,JSON.stringify(xX,null,2),{flag:"w",encoding:"utf-8"})});let R=`${A}/tokens/${await WX("json")}`,I=tZ(R);nZ(I,{recursive:!0});let w=yY({},J,Q);await iZ(R,JSON.stringify(w,null,2),{flag:"w",encoding:"utf-8"}),await l1(Q,X,Z)}async function l1(X,Z,Y){let{writeFileSync:q}=n("fs"),{join:$}=n("path");try{let U=Object.keys(X).sort(),W=`/**
338
+ `}var TY=S(()=>{g()});import{readFileSync as m1,mkdirSync as nZ}from"fs";import{writeFile as iZ,readdir as p1,mkdir as d1}from"fs/promises";import{resolve as k1,relative as aZ,join as uX,dirname as tZ}from"path";import u1 from"lodash";async function oZ(X){let Z=await p1(X,{withFileTypes:!0}),Y=await Promise.all(Z.map((q)=>{let $=k1(X,q.name);return q.isDirectory()?oZ($):$}));return Array.prototype.concat(...Y)}async function eZ(X,Z){if(!X)throw Error("outputDir is required for buildIcons");let{assets:Y,icons:q,tokenNamespace:$,__dirname:U,buildDir:W}=await r(),K=uX(U,Y?.icons?.sourceDir??"icons"),z="build",G=Y?.icons?.distDir??z,A=uX(U,G),E=uX(U,W,"icons");if(!Y?.icons?.sourceDir){console.warn("Skipping icon build: iconsDir is not defined in the project paths.");return}t(uX(U,W));let L=(await oZ(K)).filter((M)=>M.endsWith(".svg")),Q=(await Promise.all(L.map(async(M)=>{let N=m1(M,"utf8").replace(/(\s+(?=(?:[^"]*"[^"]*")*[^"]*$))/g," ").trim()??"";N=await JY(N);let YX=aZ(K,M).split("/").pop(),xX=(N.match(/name="(.*?)"/)??[])[1]??YX?.replace(".svg",""),lX=(N.match(/data-style="(.*?)"/)??[])[1],_0=(N.match(/description="(.*?)"/)??[])[1],[dY]=N.match(/<svg[^>]*>/)??[],[,Q0]=dY?.match(/width="([\d.]+)(px)?"/)??[],[,O0]=dY?.match(/height="([\d.]+)(px)?"/)??[];if(lX!=="animated"&&lX!=="custom")return{path:M,folder:aZ(K,M).split("/").slice(0,-1).concat(xX),file:YX,style:lX,content:N,name:xX,dimensions:{width:Number(Q0),height:Number(O0)},description:_0??""};return}))).filter((M)=>M!==void 0).reduce((M,N)=>{if(N?.style!=="animated"&&N?.style!=="custom"&&N)yY(M,N.folder.join("."),{$type:"icon",$name:N.name,$description:N.description,$style:N.style,$value:N.content,$extensions:{dimensions:N.dimensions},...c1(M,N.folder.join("."))});return M},{}),J=q?.objectPath??`${$}.icons`,B=Object.keys(Q).some((M)=>M.includes("."));Object.keys(Q).forEach(async(M)=>{let N,YX;if(B)N=`${E}/${M}`,YX=`${N}/svg.${M}.tokens.json`;else N=E,YX=`${E}/svg.${M}.tokens.json`;await d1(N,{recursive:!0});let xX=yY({},`${J}${J?".":""}${M}`,Q[M]);await iZ(YX,JSON.stringify(xX,null,2),{flag:"w",encoding:"utf-8"})});let R=`${A}/tokens/${await WX("json")}`,I=tZ(R);nZ(I,{recursive:!0});let w=yY({},J,Q);await iZ(R,JSON.stringify(w,null,2),{flag:"w",encoding:"utf-8"}),await l1(Q,X,Z)}async function l1(X,Z,Y){let{writeFileSync:q}=n("fs"),{join:$}=n("path");try{let U=Object.keys(X).sort(),W=`/**
339
339
  * Icon Names Type Definition
340
340
  * Generated: ${new Date().toISOString()}
341
341
  *
@@ -349,7 +349,7 @@ export const icons = [
349
349
  ] as const;
350
350
 
351
351
  export type IconName = typeof icons[number];
352
- `,K=$(Z,"typescript","tokens.icons.ts"),z=tZ(K);nZ(z,{recursive:!0}),q(K,W,"utf-8"),console.log(`✓ Generated ${U.length} icon names`)}catch(U){console.error("Failed to generate icon names:",U)}}var yY,c1;var X0=S(()=>{g();({set:yY,get:c1}=k1)});function q0(X,Z={}){let Y=[],q=Z.typescript?"ts":"js",$=Z.modes||[],U=X.filter((K)=>K.extensions?.mediaQuery||K.name.includes("@screen")||K.name.includes("@_")),W=X.filter((K)=>!K.extensions?.mediaQuery&&!K.name.includes("@screen")&&!K.name.includes("@_"));if(Z.separateThemeFiles&&$.length>0){let K=$.join("|"),z=new RegExp(`#(${K})$`),G=new Map;for(let A of $)G.set(A,[]);for(let A of W){let E=A.name.match(z);if(E){let L=E[1];G.get(L).push(A)}else{let L=$[0];G.get(L).push(A)}}for(let A of $){let E=G.get(A)||[];if(E.length>0){if(Z.typescript){let L=$0(E,A);Y.push({fileName:`${A}.d.ts`,content:t1(L,Z,A),theme:A})}Y.push({fileName:`${A}.${q}`,content:Z0(E,{...Z,theme:A}),theme:A})}}}else Y.push({fileName:`tokens.${q}`,content:Z0(W,Z)});if(U.length>0)Y.push({fileName:`breakpoints.${q}`,content:r1(U,X,Z)});if(Z.separateThemeFiles&&Y.length>1)Y.push({fileName:`index.${q}`,content:e1(Y,Z)});return Y}function r1(X,Z,Y={}){let{typescript:q,includeJSDoc:$,moduleType:U="es",customHeader:W,modes:K=[]}=Y,z=new Map(Z.map((L)=>[L.name,L])),G={};for(let L of X){let H=L.extensions?.mediaQuery||s1(L.name),_=K.length>0?K[0]:"default";for(let O of K)if(L.name.includes(`#${O}`)){_=O;break}if(typeof H==="string"&&H.includes("{")&&H.includes("}"))H=a1(H,z);if(!G[H])G[H]={};if(!G[H][_])G[H][_]={};let Q=i1(L.name),J=n1(Q,cX(L.value,z));G[H][_]={...G[H][_],...J}}let A=Object.keys(G).sort((L,H)=>{let _=Y0(L),Q=Y0(H);return _-Q}).reduce((L,H)=>{return L[H]=G[H],L},{}),E="";if(W)E+=`${W}
352
+ `,K=$(Z,"typescript","tokens.icons.ts"),z=tZ(K);nZ(z,{recursive:!0}),q(K,W,"utf-8"),console.log(`✓ Generated ${U.length} icon names`)}catch(U){console.error("Failed to generate icon names:",U)}}var yY,c1;var X0=S(()=>{g();({set:yY,get:c1}=u1)});function q0(X,Z={}){let Y=[],q=Z.typescript?"ts":"js",$=Z.modes||[],U=X.filter((K)=>K.extensions?.mediaQuery||K.name.includes("@screen")||K.name.includes("@_")),W=X.filter((K)=>!K.extensions?.mediaQuery&&!K.name.includes("@screen")&&!K.name.includes("@_"));if(Z.separateThemeFiles&&$.length>0){let K=$.join("|"),z=new RegExp(`#(${K})$`),G=new Map;for(let A of $)G.set(A,[]);for(let A of W){let E=A.name.match(z);if(E){let L=E[1];G.get(L).push(A)}else{let L=$[0];G.get(L).push(A)}}for(let A of $){let E=G.get(A)||[];if(E.length>0){if(Z.typescript){let L=$0(E,A);Y.push({fileName:`${A}.d.ts`,content:t1(L,Z,A),theme:A})}Y.push({fileName:`${A}.${q}`,content:Z0(E,{...Z,theme:A}),theme:A})}}}else Y.push({fileName:`tokens.${q}`,content:Z0(W,Z)});if(U.length>0)Y.push({fileName:`breakpoints.${q}`,content:r1(U,X,Z)});if(Z.separateThemeFiles&&Y.length>1)Y.push({fileName:`index.${q}`,content:e1(Y,Z)});return Y}function r1(X,Z,Y={}){let{typescript:q,includeJSDoc:$,moduleType:U="es",customHeader:W,modes:K=[]}=Y,z=new Map(Z.map((L)=>[L.name,L])),G={};for(let L of X){let H=L.extensions?.mediaQuery||s1(L.name),_=K.length>0?K[0]:"default";for(let O of K)if(L.name.includes(`#${O}`)){_=O;break}if(typeof H==="string"&&H.includes("{")&&H.includes("}"))H=a1(H,z);if(!G[H])G[H]={};if(!G[H][_])G[H][_]={};let Q=i1(L.name),J=n1(Q,cX(L.value,z));G[H][_]={...G[H][_],...J}}let A=Object.keys(G).sort((L,H)=>{let _=Y0(L),Q=Y0(H);return _-Q}).reduce((L,H)=>{return L[H]=G[H],L},{}),E="";if(W)E+=`${W}
353
353
 
354
354
  `;else E+=`/**
355
355
  `,E+=` * Design Tokens - Breakpoints
@@ -431,7 +431,7 @@ export type IconName = typeof icons[number];
431
431
  // Default export points to light theme
432
432
  `,W+=`module.exports = require('./light');
433
433
  `}return W+`
434
- `}var K0=S(()=>{uX()});var W0={};sX(W0,{validateCSSFiles:()=>X2,printValidationResults:()=>Y2});import{readFileSync as fY,existsSync as zX}from"fs";import{join as k}from"path";function X2(X,Z){let Y={isValid:!0,errors:[],warnings:[],checks:[]},q=k(X,"css"),$=k(q,"tokens.css"),U=zX($);if(Y.checks.push({name:"CSS file exists: tokens.css",passed:U,message:U?void 0:"Missing required CSS file: tokens.css"}),!U)Y.errors.push("Missing required CSS file: tokens.css"),Y.isValid=!1;if(Z.$metaData?.tokens?.css?.mediaQuery?.separateThemeFiles??!1){let E=k(q,"tokens.dark.css"),L=zX(E);if(Y.checks.push({name:"CSS file exists: tokens.dark.css",passed:L,message:L?void 0:"Missing required CSS file: tokens.dark.css (separateThemeFiles is enabled)"}),!L)Y.errors.push("Missing required CSS file: tokens.dark.css (separateThemeFiles is enabled)"),Y.isValid=!1}let K=k(q,"tokens.breakpoints.css");if(zX(K))Y.checks.push({name:"CSS file exists: tokens.breakpoints.css",passed:!0,message:void 0});let G=Z.$metaData?.tokens?.css?.hooks?.shortenName;if(G?.enabled&&zX(k(q,"tokens.css"))){let E=fY(k(q,"tokens.css"),"utf8");if(G.prefix)for(let{find:L,replace:H}of G.prefix){let _=`--${MX}-${L}`,Q=`--${H}`,J=E.includes(_),O=E.includes(Q);if(Y.checks.push({name:`Prefix hook applied: ${L} → ${H}`,passed:!J&&O,message:J?`Old prefix "${_}" still found in CSS, should be "${Q}"`:void 0}),J)Y.errors.push(`Prefix transformation failed: "${_}" should be replaced with "${Q}"`),Y.isValid=!1}if(G.suffix)for(let{find:L,replace:H}of G.suffix){let Q=new RegExp(`--[^:]+${L.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}:`,"g").test(E);if(Y.checks.push({name:`Suffix hook applied: ${L} → ${H}`,passed:!Q,message:Q?`Old suffix "${L}" still found in CSS variable names`:void 0}),Q)Y.errors.push(`Suffix transformation failed: "${L}" should be removed/replaced with "${H}"`),Y.isValid=!1}}if(zX(k(q,"tokens.css"))){let L=fY(k(q,"tokens.css"),"utf8").match(/:\s*{[^}]+}/g);if(Y.checks.push({name:"No unresolved token references",passed:!L,message:L?`Found unresolved references: ${L.join(", ")}`:void 0}),L)Y.errors.push(`Unresolved token references found: ${L.join(", ")}`),Y.isValid=!1}let A=["tokens.css","tokens.dark.css","tokens.breakpoints.css"];for(let E of A){let L=k(q,E);if(zX(L)){let H=fY(L,"utf8"),_=(H.match(/\{/g)||[]).length-(H.match(/\}/g)||[]).length;if(Y.checks.push({name:`CSS syntax valid: ${E}`,passed:_===0,message:_!==0?`Mismatched braces in ${E}`:void 0}),_!==0)Y.errors.push(`CSS syntax error in ${E}: mismatched braces`),Y.isValid=!1}}return Y}function Y2(X){console.log(`
434
+ `}var K0=S(()=>{kX()});var W0={};sX(W0,{validateCSSFiles:()=>X2,printValidationResults:()=>Y2});import{readFileSync as fY,existsSync as zX}from"fs";import{join as u}from"path";function X2(X,Z){let Y={isValid:!0,errors:[],warnings:[],checks:[]},q=u(X,"css"),$=u(q,"tokens.css"),U=zX($);if(Y.checks.push({name:"CSS file exists: tokens.css",passed:U,message:U?void 0:"Missing required CSS file: tokens.css"}),!U)Y.errors.push("Missing required CSS file: tokens.css"),Y.isValid=!1;if(Z.$metaData?.tokens?.css?.mediaQuery?.separateThemeFiles??!1){let E=u(q,"tokens.dark.css"),L=zX(E);if(Y.checks.push({name:"CSS file exists: tokens.dark.css",passed:L,message:L?void 0:"Missing required CSS file: tokens.dark.css (separateThemeFiles is enabled)"}),!L)Y.errors.push("Missing required CSS file: tokens.dark.css (separateThemeFiles is enabled)"),Y.isValid=!1}let K=u(q,"tokens.breakpoints.css");if(zX(K))Y.checks.push({name:"CSS file exists: tokens.breakpoints.css",passed:!0,message:void 0});let G=Z.$metaData?.tokens?.css?.hooks?.shortenName;if(G?.enabled&&zX(u(q,"tokens.css"))){let E=fY(u(q,"tokens.css"),"utf8");if(G.prefix)for(let{find:L,replace:H}of G.prefix){let _=`--${MX}-${L}`,Q=`--${H}`,J=E.includes(_),O=E.includes(Q);if(Y.checks.push({name:`Prefix hook applied: ${L} → ${H}`,passed:!J&&O,message:J?`Old prefix "${_}" still found in CSS, should be "${Q}"`:void 0}),J)Y.errors.push(`Prefix transformation failed: "${_}" should be replaced with "${Q}"`),Y.isValid=!1}if(G.suffix)for(let{find:L,replace:H}of G.suffix){let Q=new RegExp(`--[^:]+${L.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}:`,"g").test(E);if(Y.checks.push({name:`Suffix hook applied: ${L} → ${H}`,passed:!Q,message:Q?`Old suffix "${L}" still found in CSS variable names`:void 0}),Q)Y.errors.push(`Suffix transformation failed: "${L}" should be removed/replaced with "${H}"`),Y.isValid=!1}}if(zX(u(q,"tokens.css"))){let L=fY(u(q,"tokens.css"),"utf8").match(/:\s*{[^}]+}/g);if(Y.checks.push({name:"No unresolved token references",passed:!L,message:L?`Found unresolved references: ${L.join(", ")}`:void 0}),L)Y.errors.push(`Unresolved token references found: ${L.join(", ")}`),Y.isValid=!1}let A=["tokens.css","tokens.dark.css","tokens.breakpoints.css"];for(let E of A){let L=u(q,E);if(zX(L)){let H=fY(L,"utf8"),_=(H.match(/\{/g)||[]).length-(H.match(/\}/g)||[]).length;if(Y.checks.push({name:`CSS syntax valid: ${E}`,passed:_===0,message:_!==0?`Mismatched braces in ${E}`:void 0}),_!==0)Y.errors.push(`CSS syntax error in ${E}: mismatched braces`),Y.isValid=!1}}return Y}function Y2(X){console.log(`
435
435
 
436
436
  Build Validation Results:`),console.log("========================================================");for(let Z of X.checks){let Y=Z.passed?"✓":"✗";if(console.log(` ${Y} ${Z.name}`),Z.message)console.log(` ${Z.message}`)}if(X.warnings.length>0){console.log(`
437
437
  ⚠️ Warnings:`);for(let Z of X.warnings)console.log(` ${Z}`)}if(X.errors.length>0){console.log(`
@@ -439,7 +439,7 @@ Build Validation Results:`),console.log("=======================================
439
439
  Validation Summary:`),console.log(` - Checks: ${X.checks.filter((Z)=>Z.passed).length}/${X.checks.length} passed`),console.log(` - Errors: ${X.errors.length}`),console.log(` - Warnings: ${X.warnings.length}`),console.log(`
440
440
  ${X.isValid?"✅":"❌"} Build ${X.isValid?"passed":"failed"}`),console.log(`
441
441
  ========================================================
442
- `)}var G0=S(()=>{g()});import{writeFileSync as Z2,mkdirSync as q2,existsSync as hY,readFileSync as vY,readdirSync as $2,statSync as z0}from"fs";import{join as V,dirname as FX}from"path";function U2(X,Z,Y=!1,q=!1){let $=[],U=[],W=[];for(let z of X)if(z.fileName.includes("breakpoint"))U.push(`@import url("./css/${z.fileName}");`);else W.push(`@import url("./css/${z.fileName}");`);if($.push(...W),Y)$.push('@import url("./css/tokens.icons.css");');if(q)$.push('@import url("./css/fonts.css");');$.push(...U);let K=`/**
442
+ `)}var G0=S(()=>{g()});import{writeFileSync as Z2,mkdirSync as q2,existsSync as vY,readFileSync as hY,readdirSync as $2,statSync as U2}from"fs";import{join as V,dirname as FX}from"path";function K2(X,Z,Y=!1,q=!1){let $=[],U=[],W=[];for(let z of X)if(z.fileName.includes("breakpoint"))U.push(`@import url("./css/${z.fileName}");`);else W.push(`@import url("./css/${z.fileName}");`);if($.push(...W),Y)$.push('@import url("./css/tokens.icons.css");');if(q)$.push('@import url("./css/fonts.css");');$.push(...U);let K=`/**
443
443
  * ${Z} Design System - Main CSS Entry Point
444
444
  * Generated: ${new Date().toISOString()}
445
445
  *
@@ -452,7 +452,7 @@ ${X.isValid?"✅":"❌"} Build ${X.isValid?"passed":"failed"}`),console.log(`
452
452
  ${$.join(`
453
453
  `)}
454
454
  `;return{fileName:`${Z}.design-system.tokens.css`,content:K+`
455
- `,theme:void 0}}function K2(X,Z,Y=!1,q=!1,$,U){let{readFileSync:W}=n("fs"),{join:K}=n("path"),z=[],G=(H)=>{try{let _=K($,"css",H);return W(_,"utf-8")}catch(_){return console.warn(`Could not read ${H}:`,_),""}},A=[];for(let H of X){let _=G(H.fileName);if(!_)continue;if(H.fileName.includes("breakpoint"))A.push(_);else z.push(_)}let E=U?.$paths?.assets?.icons?.excludeFromRaw??!1;if(Y&&!E){let H=G("tokens.icons.css");if(H)z.push(H)}if(q){let H=G("fonts.css");if(H)z.push(H)}z.push(...A);let L=`/**
455
+ `,theme:void 0}}function W2(X,Z,Y=!1,q=!1,$,U){let{readFileSync:W}=n("fs"),{join:K}=n("path"),z=[],G=(H)=>{try{let _=K($,"css",H);return W(_,"utf-8")}catch(_){return console.warn(`Could not read ${H}:`,_),""}},A=[];for(let H of X){let _=G(H.fileName);if(!_)continue;if(H.fileName.includes("breakpoint"))A.push(_);else z.push(_)}let E=U?.$paths?.assets?.icons?.excludeFromRaw??!1;if(Y&&!E){let H=G("tokens.icons.css");if(H)z.push(H)}if(q){let H=G("fonts.css");if(H)z.push(H)}z.push(...A);let L=`/**
456
456
  * ${Z} Design System - Raw/Inline CSS
457
457
  * Generated: ${new Date().toISOString()}
458
458
  *
@@ -467,28 +467,28 @@ ${z.join(`
467
467
 
468
468
  `)}
469
469
  `;return{fileName:`${Z}.design-system.tokens.raw.css`,content:L+`
470
- `,theme:void 0}}function W2(X,Z){let Y=X.replace(/\\/g,"/");if(Z.replace(/\\/g,"/").startsWith(Y))return{valid:!1,error:`⚠️ Compositions directory cannot be inside tokens directory.
470
+ `,theme:void 0}}function G2(X,Z){let Y=X.replace(/\\/g,"/");if(Z.replace(/\\/g,"/").startsWith(Y))return{valid:!1,error:`⚠️ Compositions directory cannot be inside tokens directory.
471
471
  `+` Tokens dir: ${X}
472
472
  Compositions dir: ${Z}
473
- Please move compositions to a separate directory (e.g., './compositions')`};return{valid:!0}}function G2(X,Z){let Y=[];if(hY(X)){let q=z0(X);if(q.isDirectory())try{let $=$2(X);for(let U of $){if(!U.endsWith(".json"))continue;let W=V(X,U);if(z0(W).isFile())try{let z=vY(W,"utf-8"),G=JSON.parse(z);if(Array.isArray(G))Y.push(...G);else Y.push(G)}catch(z){console.warn(`⚠️ Failed to parse composition file ${U}:`,z)}}}catch($){console.warn("⚠️ Failed to read compositions directory:",$)}else if(q.isFile()&&X.endsWith(".json"))try{let $=vY(X,"utf-8"),U=JSON.parse($);if(Array.isArray(U))Y.push(...U);else Y.push(U)}catch($){console.warn("⚠️ Failed to parse compositions file:",$)}}if(Z&&Y.length===0){let q=V(Z,"compositions.json");if(hY(q))try{let $=vY(q,"utf-8"),U=JSON.parse($);if(Array.isArray(U))Y.push(...U)}catch($){console.warn("⚠️ Failed to parse compositions.json:",$)}}return Y}function A0(X,Z){let Y=Z.$metaData?.tokens?.css?.hooks?.shortenName;if(!Y?.enabled)return X;let q=X;if(Y.prefix&&Array.isArray(Y.prefix))for(let $ of Y.prefix)q=q.replace(new RegExp($.find,"g"),$.replace);if(Y.suffix&&Array.isArray(Y.suffix)){for(let $ of Y.suffix)if(q.endsWith($.find))q=q.substring(0,q.length-$.find.length)+$.replace}return q}function z2(X,Z){let Y=X.match(/^\{(.+)\}$/);if(Y){let $=Y[1].replace(/\./g,"-");return $=A0($,Z),`var(--${$})`}return X.replace(/\{([^}]+)\}/g,(q,$)=>{let U=$.replace(/\./g,"-");return U=A0(U,Z),`var(--${U})`})}function A2(X,Z,Y,q){let $=[],U=X.filter((z)=>z.platform==="css");if(U.length===0)return $;let W=new Map,K="compositions.css";for(let z of U){let G=z.fileName||"";if(G.endsWith(".css"))G=G.slice(0,-4);let A=G?`${G}.css`:K;if(!W.has(A))W.set(A,[]);W.get(A).push(z)}for(let[z,G]of W.entries()){let A=[];if(A.push("/**"),A.push(" * Design System Compositions - Generated Styles"),A.push(" * DO NOT EDIT THIS FILE DIRECTLY"),A.push(" * Generated from composition definitions"),A.push(` * Namespace: ${Z.$metaData?.dsNamespace||"ds"}.${Z.$metaData?.tokenNamespace||"tokens"}`),A.push(` * File: ${z}`),A.push(` */
474
- `),G.length===0)A.push("/* No compositions defined */");else for(let L of G){A.push(`/* ${L.name} */`);let H=L.groupProperties,_=H&&(H.mediaQuery||H.parentSelector||H.containerQuery||H.customAtRule),Q="",J=[];if(_){if(H.customAtRule){let O=c(H.customAtRule,Y);A.push(`${O} {`),J.push("}"),Q=" "}if(H.mediaQuery){let O=c(H.mediaQuery,Y);A.push(`${Q}${O} {`),J.push("}"),Q+=" "}if(H.containerQuery){let O=c(H.containerQuery,Y);A.push(`${Q}${O} {`),J.push("}"),Q+=" "}if(H.parentSelector){let O=c(H.parentSelector,Y);A.push(`${Q}${O} {`),J.push("}"),Q+=" "}}A.push(`${Q}${L.selector} {`);for(let O of L.properties){let B=z2(O.token,Z);A.push(`${Q} ${O.property}: ${B};`)}A.push(`${Q}}`);while(J.length>0)Q=Q.slice(2),A.push(`${Q}${J.pop()}`);A.push("")}let E=A.join(`
473
+ Please move compositions to a separate directory (e.g., './compositions')`};return{valid:!0}}function E0(X,Z){try{let Y=$2(X,{withFileTypes:!0});for(let q of Y){let $=V(X,q.name);if(q.isDirectory())E0($,Z);else if(q.isFile()&&q.name.endsWith(".json"))try{let U=hY($,"utf-8"),W=JSON.parse(U);if(Array.isArray(W))Z.push(...W);else Z.push(W)}catch(U){console.warn(`⚠️ Failed to parse composition file ${$}:`,U)}}}catch(Y){console.warn(`⚠️ Failed to read directory ${X}:`,Y)}}function z2(X,Z){let Y=[];if(vY(X)){let q=U2(X);if(q.isDirectory())E0(X,Y);else if(q.isFile()&&X.endsWith(".json"))try{let $=hY(X,"utf-8"),U=JSON.parse($);if(Array.isArray(U))Y.push(...U);else Y.push(U)}catch($){console.warn("⚠️ Failed to parse compositions file:",$)}}if(Z&&Y.length===0){let q=V(Z,"compositions.json");if(vY(q))try{let $=hY(q,"utf-8"),U=JSON.parse($);if(Array.isArray(U))Y.push(...U)}catch($){console.warn("⚠️ Failed to parse compositions.json:",$)}}return Y}function z0(X,Z){let Y=Z.$metaData?.tokens?.css?.hooks?.shortenName;if(!Y?.enabled)return X;let q=X;if(Y.prefix&&Array.isArray(Y.prefix))for(let $ of Y.prefix)q=q.replace(new RegExp($.find,"g"),$.replace);if(Y.suffix&&Array.isArray(Y.suffix)){for(let $ of Y.suffix)if(q.endsWith($.find))q=q.substring(0,q.length-$.find.length)+$.replace}return q}function A2(X,Z){let Y=X.match(/^\{(.+)\}$/);if(Y){let $=Y[1].replace(/\./g,"-");return $=z0($,Z),`var(--${$})`}return X.replace(/\{([^}]+)\}/g,(q,$)=>{let U=$.replace(/\./g,"-");return U=z0(U,Z),`var(--${U})`})}function E2(X,Z,Y,q){let $=[],U=X.filter((z)=>z.platform==="css");if(U.length===0)return $;let W=new Map,K="compositions.css";for(let z of U){let G=z.fileName||"";if(G.endsWith(".css"))G=G.slice(0,-4);let A=G?`${G}.css`:K;if(!W.has(A))W.set(A,[]);W.get(A).push(z)}for(let[z,G]of W.entries()){let A=[];if(A.push("/**"),A.push(" * Design System Compositions - Generated Styles"),A.push(" * DO NOT EDIT THIS FILE DIRECTLY"),A.push(" * Generated from composition definitions"),A.push(` * Namespace: ${Z.$metaData?.dsNamespace||"ds"}.${Z.$metaData?.tokenNamespace||"tokens"}`),A.push(` * File: ${z}`),A.push(` */
474
+ `),G.length===0)A.push("/* No compositions defined */");else for(let L of G){A.push(`/* ${L.name} */`);let H=L.groupProperties,_=H&&(H.mediaQuery||H.parentSelector||H.containerQuery||H.customAtRule),Q="",J=[];if(_){if(H.customAtRule){let O=c(H.customAtRule,Y);A.push(`${O} {`),J.push("}"),Q=" "}if(H.mediaQuery){let O=c(H.mediaQuery,Y);A.push(`${Q}${O} {`),J.push("}"),Q+=" "}if(H.containerQuery){let O=c(H.containerQuery,Y);A.push(`${Q}${O} {`),J.push("}"),Q+=" "}if(H.parentSelector){let O=c(H.parentSelector,Y);A.push(`${Q}${O} {`),J.push("}"),Q+=" "}}A.push(`${Q}${L.selector} {`);for(let O of L.properties){let B=A2(O.token,Z);A.push(`${Q} ${O.property}: ${B};`)}A.push(`${Q}}`);while(J.length>0)Q=Q.slice(2),A.push(`${Q}${J.pop()}`);A.push("")}let E=A.join(`
475
475
  `);$.push({fileName:z,content:E+`
476
476
  `,theme:void 0})}return $}async function L0(X){let Z=Date.now(),Y={tokenCount:0,cssFiles:[],typescriptFiles:[],javascriptFiles:[],jsonFiles:[],duration:0,warnings:[],errors:[]};try{F(`
477
- Starting token build process...`,X.verbose);let{initializeColorspace:q}=await Promise.resolve().then(() => (EX(),sY));await q(),F("Loading token files...",X.verbose);let $=RY(X.tokensDir);F("Parsing tokens...",X.verbose);let U=E2(X.config),W=MY($,U);if(F(`Found ${W.length} tokens`,X.verbose),Y.tokenCount=W.length,W.length===0&&U.namespace){let G=Object.keys($).filter((A)=>!A.startsWith("$"));if(G.length>0)Y.warnings.push(`⚠️ No tokens found matching tokenNamespace "${U.namespace}". Found root keys: ${G.join(", ")}. Please check if your $metaData.tokenNamespace in designid.config.ts matches.`)}let K=NY(W,U);if(F(`Resolved ${K.length} tokens`,X.verbose),X.generateCSS!==!1){F(`
478
- Generating CSS files...`,X.verbose);let G=E0(X.config,X.cssOptions),A=hX(K,G);for(let E of A){let L=V(X.outputDir,"css",E.fileName);a(L,E.content),F(` ✓ ${E.fileName}`,X.verbose)}Y.cssFiles=A}if(X.generateCSS!==!1)try{await eZ(X.outputDir,X.config),F(`
479
- Generated icon tokens`,X.verbose)}catch(G){if(X.verbose)console.warn("Could not build icon tokens:",G)}if(X.generateCSS!==!1)try{let G=await PY();if(G.length>0){let A=E0(X.config,X.cssOptions),E=X.config.$metaData?.modes?.isHost??!1,L=X.config.$modes?.default||"light",H=SY(G,{customHeader:dX(X.config),objectPath:X.config.$metaData?.icons?.objectPath||"universe.custom.path.icons",hooks:A.hooks,isHost:E,defaultMode:L}),_=V(X.outputDir,"css",H.fileName);if(a(_,H.content),F(` ✓ Generated ${H.fileName}`,X.verbose),Y.cssFiles)Y.cssFiles.push(H);else Y.cssFiles=[H]}}catch(G){if(X.verbose)console.warn("Could not generate icon CSS:",G)}let z=!1;if(X.generateCSS!==!1)try{let G=X.config.$fonts;if(G&&G.length>0){await BY(G,X.outputDir),F(" ✓ Generated fonts.css",X.verbose),z=!0;let A={fileName:"fonts.css",content:"Generated by appendTypographyTokens",theme:void 0};if(Y.cssFiles)Y.cssFiles.push(A);else Y.cssFiles=[A]}}catch(G){if(X.verbose)console.warn("Could not generate font CSS:",G)}if(X.generateCSS!==!1&&Y.cssFiles.length>0){let G=X.config.$metaData?.tokenNamespace||"tokens",A=Y.cssFiles.some((Q)=>Q.fileName==="tokens.icons.css"),E=X.config.$metaData?.modes?.isHost||!1,L=Y.cssFiles.filter((Q)=>{if(Q.fileName==="tokens.icons.css"||Q.fileName==="fonts.css")return!1;if(E&&Q.fileName.includes("composition"))return!1;return!0}),H=U2(L,G,A,z),_=V(X.outputDir,H.fileName);if(a(_,H.content),F(` ✓ Generated ${H.fileName}`,X.verbose),Y.cssFiles.push(H),E){let Q=K2(Y.cssFiles.filter((O)=>O.fileName!=="tokens.icons.css"&&O.fileName!=="fonts.css"&&!O.fileName.includes(".design-system.tokens.css")),G,A,z,X.outputDir,X.config),J=V(X.outputDir,Q.fileName);a(J,Q.content),F(` ✓ Generated ${Q.fileName} (raw/inline for web components)`,X.verbose),Y.cssFiles.push(Q)}}if(X.generateCSS!==!1&&X.config.$paths.compositionsDir)try{let G=X.config.$paths.baseDir,A=X.config.$paths.tokensDir,E=X.tokensDir,L=A.split("/").filter((O)=>O&&O!=="."&&O!=="..");for(let O=0;O<L.length;O++)E=FX(E);let H=G.split("/").filter((O)=>O&&O!=="."&&O!=="..");for(let O=0;O<H.length;O++)E=FX(E);let _=V(E,G,X.config.$paths.compositionsDir),Q=V(E,G);if(X.verbose)console.log(` Project root: ${E}`),console.log(` Base dir: ${Q}`),console.log(` Compositions dir: ${_}`);let J=W2(X.tokensDir,_);if(!J.valid)console.error(J.error),Y.errors.push(J.error);else{F(`
480
- Processing composition files...`,X.verbose);let O=G2(_,Q);if(O.length>0){F(` Found ${O.length} composition(s)`,X.verbose);let B=new Map;for(let I of K){let w=Array.isArray(I.path)?I.path.join("."):I.path;B.set(w,I)}let R=A2(O,X.config,B,X.outputDir);for(let I of R){let w=V(X.outputDir,"css",I.fileName);a(w,I.content),F(` ✓ Generated ${I.fileName}`,X.verbose),Y.cssFiles.push(I)}}else F(` No compositions found in ${_}`,X.verbose)}}catch(G){if(X.verbose)console.warn("Could not generate composition CSS:",G)}if(X.generateTypeScript!==!1){F(`
481
- Generating TypeScript files...`,X.verbose);let G=L2(X.config,X.typescriptOptions),A=await CY(K,G,X.outputDir);for(let E of A){let L=V(X.outputDir,"typescript",E.fileName);a(L,E.content),F(` ✓ Generated ${E.fileName}`,X.verbose)}Y.typescriptFiles=A}if(X.generateJavaScript!==!1){F(`
482
- Generating JavaScript files...`,X.verbose);let G=H2(X.config,X.javascriptOptions),A=q0(K,G);for(let E of A){let L=V(X.outputDir,"js",E.fileName);a(L,E.content),F(` ✓ Generated ${E.fileName}`,X.verbose)}Y.javascriptFiles=A}if(X.generateJSON!==!1){F(`
483
- Generating JSON files...`,X.verbose);let G=_2(K,W,X.config);for(let A of G){let E=V(X.outputDir,"json",A.fileName);a(E,A.content),F(` ✓ Generated ${A.fileName}`,X.verbose)}Y.jsonFiles=G}Y.duration=Date.now()-Z,F(`
477
+ Starting token build process...`,X.verbose);let{initializeColorspace:q}=await Promise.resolve().then(() => (EX(),sY));await q(),F("Loading token files...",X.verbose);let $=RY(X.tokensDir);F("Parsing tokens...",X.verbose);let U=L2(X.config),W=MY($,U);if(F(`Found ${W.length} tokens`,X.verbose),Y.tokenCount=W.length,W.length===0&&U.namespace){let G=Object.keys($).filter((A)=>!A.startsWith("$"));if(G.length>0)Y.warnings.push(`⚠️ No tokens found matching tokenNamespace "${U.namespace}". Found root keys: ${G.join(", ")}. Please check if your $metaData.tokenNamespace in designid.config.ts matches.`)}let K=NY(W,U);if(F(`Resolved ${K.length} tokens`,X.verbose),X.generateCSS!==!1){F(`
478
+ Generating CSS files...`,X.verbose);let G=A0(X.config,X.cssOptions),A=hX(K,G);for(let E of A){let L=V(X.outputDir,"css",E.fileName);a(L,E.content),F(` ✓ ${E.fileName}`,X.verbose)}Y.cssFiles=A}if(X.generateCSS!==!1)try{await eZ(X.outputDir,X.config),F(`
479
+ Generated icon tokens`,X.verbose)}catch(G){if(X.verbose)console.warn("Could not build icon tokens:",G)}if(X.generateCSS!==!1)try{let G=await PY();if(G.length>0){let A=A0(X.config,X.cssOptions),E=X.config.$metaData?.modes?.isHost??!1,L=X.config.$modes?.default||"light",H=SY(G,{customHeader:dX(X.config),objectPath:X.config.$metaData?.icons?.objectPath||"universe.custom.path.icons",hooks:A.hooks,isHost:E,defaultMode:L}),_=V(X.outputDir,"css",H.fileName);if(a(_,H.content),F(` ✓ Generated ${H.fileName}`,X.verbose),Y.cssFiles)Y.cssFiles.push(H);else Y.cssFiles=[H]}}catch(G){if(X.verbose)console.warn("Could not generate icon CSS:",G)}let z=!1;if(X.generateCSS!==!1)try{let G=X.config.$fonts;if(G&&G.length>0){await BY(G,X.outputDir),F(" ✓ Generated fonts.css",X.verbose),z=!0;let A={fileName:"fonts.css",content:"Generated by appendTypographyTokens",theme:void 0};if(Y.cssFiles)Y.cssFiles.push(A);else Y.cssFiles=[A]}}catch(G){if(X.verbose)console.warn("Could not generate font CSS:",G)}if(X.generateCSS!==!1&&Y.cssFiles.length>0){let G=X.config.$metaData?.tokenNamespace||"tokens",A=Y.cssFiles.some((Q)=>Q.fileName==="tokens.icons.css"),E=X.config.$metaData?.modes?.isHost||!1,L=Y.cssFiles.filter((Q)=>{if(Q.fileName==="tokens.icons.css"||Q.fileName==="fonts.css")return!1;if(E&&Q.fileName.includes("composition"))return!1;return!0}),H=K2(L,G,A,z),_=V(X.outputDir,H.fileName);if(a(_,H.content),F(` ✓ Generated ${H.fileName}`,X.verbose),Y.cssFiles.push(H),E){let Q=W2(Y.cssFiles.filter((O)=>O.fileName!=="tokens.icons.css"&&O.fileName!=="fonts.css"&&!O.fileName.includes(".design-system.tokens.css")),G,A,z,X.outputDir,X.config),J=V(X.outputDir,Q.fileName);a(J,Q.content),F(` ✓ Generated ${Q.fileName} (raw/inline for web components)`,X.verbose),Y.cssFiles.push(Q)}}if(X.generateCSS!==!1&&X.config.$paths.compositionsDir)try{let G=X.config.$paths.baseDir,A=X.config.$paths.tokensDir,E=X.tokensDir,L=A.split("/").filter((O)=>O&&O!=="."&&O!=="..");for(let O=0;O<L.length;O++)E=FX(E);let H=G.split("/").filter((O)=>O&&O!=="."&&O!=="..");for(let O=0;O<H.length;O++)E=FX(E);let _=V(E,G,X.config.$paths.compositionsDir),Q=V(E,G);if(X.verbose)console.log(` Project root: ${E}`),console.log(` Base dir: ${Q}`),console.log(` Compositions dir: ${_}`);let J=G2(X.tokensDir,_);if(!J.valid)console.error(J.error),Y.errors.push(J.error);else{F(`
480
+ Processing composition files...`,X.verbose);let O=z2(_,Q);if(O.length>0){F(` Found ${O.length} composition(s)`,X.verbose);let B=new Map;for(let I of K){let w=Array.isArray(I.path)?I.path.join("."):I.path;B.set(w,I)}let R=E2(O,X.config,B,X.outputDir);for(let I of R){let w=V(X.outputDir,"css",I.fileName);a(w,I.content),F(` ✓ Generated ${I.fileName}`,X.verbose),Y.cssFiles.push(I)}}else F(` No compositions found in ${_}`,X.verbose)}}catch(G){if(X.verbose)console.warn("Could not generate composition CSS:",G)}if(X.generateTypeScript!==!1){F(`
481
+ Generating TypeScript files...`,X.verbose);let G=H2(X.config,X.typescriptOptions),A=await CY(K,G,X.outputDir);for(let E of A){let L=V(X.outputDir,"typescript",E.fileName);a(L,E.content),F(` ✓ Generated ${E.fileName}`,X.verbose)}Y.typescriptFiles=A}if(X.generateJavaScript!==!1){F(`
482
+ Generating JavaScript files...`,X.verbose);let G=_2(X.config,X.javascriptOptions),A=q0(K,G);for(let E of A){let L=V(X.outputDir,"js",E.fileName);a(L,E.content),F(` ✓ Generated ${E.fileName}`,X.verbose)}Y.javascriptFiles=A}if(X.generateJSON!==!1){F(`
483
+ Generating JSON files...`,X.verbose);let G=Q2(K,W,X.config);for(let A of G){let E=V(X.outputDir,"json",A.fileName);a(E,A.content),F(` ✓ Generated ${A.fileName}`,X.verbose)}Y.jsonFiles=G}Y.duration=Date.now()-Z,F(`
484
484
  Build completed in ${Y.duration}ms`,X.verbose)}catch(q){let $=q instanceof Error?q.message:String(q);Y.errors.push($),F(`❌ Build failed: ${$}`,X.verbose)}if(X.validate!==!1){F(`
485
- Validating build output...`,X.verbose);let{validateCSSFiles:q,printValidationResults:$}=await Promise.resolve().then(() => (G0(),W0)),U=q(X.outputDir,X.config);if(X.verbose||!U.isValid)$(U);if(!U.isValid)Y.errors.push(...U.errors)}return Y}function E2(X){let Z=X.$metaData,Y=X.$modes?[...Object.values(X.$modes)]:[];return{prefix:Z.dsNamespace||Z.tokenNamespace,namespace:Z.tokenNamespace,generateModes:!0,modes:Y,generateDerivedTokens:!0,generateBreakpointTokens:!0,failOnBrokenReferences:!0,transformName:(q)=>{let $=Z.tokens?.css?.hooks?.shortenName;if($?.enabled){let U=q;if($.prefix)for(let{find:W,replace:K}of $.prefix){let z=W.replace(/\./g,"-").replace(/-$/,""),G=K.replace(/\./g,"-").replace(/-$/,"");U=U.replace(z,G)}if($.suffix){for(let{find:W,replace:K}of $.suffix)if(U.endsWith(W))U=U.substring(0,U.length-W.length)+K}return U}return q}}}function E0(X,Z){let Y=X.$metaData,q=Y.tokens?.css,$=X.$modes?[...Object.values(X.$modes)]:["light","dark"],U=$.length>0?$[0]:"light",W=Y.modes?.isHost??!1;return{...Z,separateThemeFiles:q?.mediaQuery?.separateThemeFiles??!1,rootSelector:":root",generateMediaQueries:!0,customHeader:dX(X),themeSelector:q?.mediaQuery?.match||"[data-theme]",modes:$,defaultMode:U,isHost:W,hooks:q?.hooks}}function L2(X,Z){let Y=X.$metaData;return{...Z,tokenInterface:"DesignTokens",exportNamespace:Y.dsNamespace||Y.tokenNamespace,generateTypes:!0,generateConsts:!0,generateCSSVarMappings:!0,includeJSDoc:!0}}function H2(X,Z){let Y=X.$modes?[...Object.values(X.$modes)]:["light","dark"];return{...Z,modes:Y,typescript:!0,separateThemeFiles:!0,includeJSDoc:!1,moduleType:"es",customHeader:`/**
485
+ Validating build output...`,X.verbose);let{validateCSSFiles:q,printValidationResults:$}=await Promise.resolve().then(() => (G0(),W0)),U=q(X.outputDir,X.config);if(X.verbose||!U.isValid)$(U);if(!U.isValid)Y.errors.push(...U.errors)}return Y}function L2(X){let Z=X.$metaData,Y=X.$modes?[...Object.values(X.$modes)]:[];return{prefix:Z.dsNamespace||Z.tokenNamespace,namespace:Z.tokenNamespace,generateModes:!0,modes:Y,generateDerivedTokens:!0,generateBreakpointTokens:!0,failOnBrokenReferences:!0,transformName:(q)=>{let $=Z.tokens?.css?.hooks?.shortenName;if($?.enabled){let U=q;if($.prefix)for(let{find:W,replace:K}of $.prefix){let z=W.replace(/\./g,"-").replace(/-$/,""),G=K.replace(/\./g,"-").replace(/-$/,"");U=U.replace(z,G)}if($.suffix){for(let{find:W,replace:K}of $.suffix)if(U.endsWith(W))U=U.substring(0,U.length-W.length)+K}return U}return q}}}function A0(X,Z){let Y=X.$metaData,q=Y.tokens?.css,$=X.$modes?[...Object.values(X.$modes)]:["light","dark"],U=$.length>0?$[0]:"light",W=Y.modes?.isHost??!1;return{...Z,separateThemeFiles:q?.mediaQuery?.separateThemeFiles??!1,rootSelector:":root",generateMediaQueries:!0,customHeader:dX(X),themeSelector:q?.mediaQuery?.match||"[data-theme]",modes:$,defaultMode:U,isHost:W,hooks:q?.hooks}}function H2(X,Z){let Y=X.$metaData;return{...Z,tokenInterface:"DesignTokens",exportNamespace:Y.dsNamespace||Y.tokenNamespace,generateTypes:!0,generateConsts:!0,generateCSSVarMappings:!0,includeJSDoc:!0}}function _2(X,Z){let Y=X.$modes?[...Object.values(X.$modes)]:["light","dark"];return{...Z,modes:Y,typescript:!0,separateThemeFiles:!0,includeJSDoc:!1,moduleType:"es",customHeader:`/**
486
486
  * ${X.$name}
487
487
  * Generated: ${new Date().toISOString()}
488
- */`}}function _2(X,Z,Y){let q=[],$=JSON.stringify({$schema:"https://schemas.designtokens.org/design-tokens.schema.json",$name:Y.$name,$version:Y.$version,tokens:Z.reduce((K,z)=>{return K[z.name]={$type:z.type,$value:z.value,$description:z.description,$extensions:z.extensions},K},{})},null,2);q.push({fileName:"tokens.raw.json",content:$+`
488
+ */`}}function Q2(X,Z,Y){let q=[],$=JSON.stringify({$schema:"https://schemas.designtokens.org/design-tokens.schema.json",$name:Y.$name,$version:Y.$version,tokens:Z.reduce((K,z)=>{return K[z.name]={$type:z.type,$value:z.value,$description:z.description,$extensions:z.extensions},K},{})},null,2);q.push({fileName:"tokens.raw.json",content:$+`
489
489
  `});let U=JSON.stringify({$name:Y.$name,$version:Y.$version,tokens:X.reduce((K,z)=>{return K[z.name]={$type:z.type,$value:z.value,$description:z.description,cssVar:z.cssVar},K},{})},null,2);q.push({fileName:"tokens.resolved.json",content:U+`
490
490
  `});let W=JSON.stringify({$name:`${Y.$name} - CSS Variables`,$version:Y.$version,variables:X.reduce((K,z)=>{return K[z.cssVar]=z.value,K},{})},null,2);return q.push({fileName:"css-variables.json",content:W+`
491
- `}),q}function a(X,Z){let Y=FX(X);if(!hY(Y))q2(Y,{recursive:!0});Z2(X,Z,"utf-8")}function F(X,Z){if(Z!==!1)console.log(X)}async function mY(X,Z){let Y=typeof globalThis.Bun<"u",q=X,$=null;if(X.endsWith(".ts")&&!Y){let{compileConfigFile:E,getDistConfigFile:L}=await Promise.resolve().then(() => (BX(),IZ)),H=FX(X);await E(H),q=L(H),$=q}let W=(await import(q)).default,K=FX(X),z=(E)=>{if(E.startsWith("../"))return V(K,E);return V(K,W.$paths.baseDir,E)},G=V(K,W.$paths.baseDir,W.$paths.tokensDir),A=Z||z(W.$paths.distDir);try{return await L0({config:W,tokensDir:G,outputDir:A,verbose:!0})}finally{if($){let{existsSync:E,unlinkSync:L}=await import("fs");if(E($))try{L($)}catch(H){}}}}var pY=S(()=>{X0();uX();K0();xY();TY();IY();SX()});function Q2(X,Z,Y){let q=C(X,{isIncludedOriginalValue:!0}),$=f(X,Y);if(!$||!l(X,"mode",{isIncludedOriginalValue:!1}))$=q;return PX(X,$,Z,Y)}function TX(X,Z,Y){let q=Q2(X,Z,Y),$=typeof q==="string"?$X(q):null;if($&&($?.length??0)>=1)return qX(q,$,Z,Y);else return O2(X,Z,Y)}function O2(X,Z,Y){return PX(X,nX(X,Z,Y),Z,Y)}function PX(X,Z,Y,q){if(!X)return null;if(X.$type==="color")Z=DX(Z,X,Y,q);else if(X.$type==="composition"||X.$type==="typography")Z=ZX(X,Y,q);return Z}var MX="did";var g=S(()=>{EX();SX();eX();EX();BX();wZ();RZ();MZ();SX();eX();IY();xY();uX();TY();pY()});import{existsSync as J2}from"fs";import{resolve as B2,join as H0}from"path";import I2 from"chokidar";import{execSync as N0}from"child_process";import{existsSync as jX,statSync as uY}from"fs";import{resolve as kY}from"path";async function cY(X,Z=!1){let Y=process.cwd(),q=X||kY(Y,"designid.config.ts"),$=kY(Y,"designid.config.mjs");if(!jX(q))return!1;if(!(!jX($)||jX(q)&&jX($)&&uY(q).mtimeMs>uY($).mtimeMs)){if(Z)console.log("✓ Config file is up to date");return!1}if(Z)console.log("\uD83D\uDD04 Compiling config file...");try{if(N0(`bun build ${q} --outfile ${$} --minify --target node --packages external --no-bundle`,{stdio:Z?"inherit":"pipe"}),Z)console.log(`✅ Config compiled successfully
491
+ `}),q}function a(X,Z){let Y=FX(X);if(!vY(Y))q2(Y,{recursive:!0});Z2(X,Z,"utf-8")}function F(X,Z){if(Z!==!1)console.log(X)}async function mY(X,Z){let Y=typeof globalThis.Bun<"u",q=X,$=null;if(X.endsWith(".ts")&&!Y){let{compileConfigFile:E,getDistConfigFile:L}=await Promise.resolve().then(() => (BX(),IZ)),H=FX(X);await E(H),q=L(H),$=q}let W=(await import(q)).default,K=FX(X),z=(E)=>{if(E.startsWith("../"))return V(K,E);return V(K,W.$paths.baseDir,E)},G=V(K,W.$paths.baseDir,W.$paths.tokensDir),A=Z||z(W.$paths.distDir);try{return await L0({config:W,tokensDir:G,outputDir:A,verbose:!0})}finally{if($){let{existsSync:E,unlinkSync:L}=await import("fs");if(E($))try{L($)}catch(H){}}}}var pY=S(()=>{X0();kX();K0();xY();TY();IY();SX()});function O2(X,Z,Y){let q=C(X,{isIncludedOriginalValue:!0}),$=f(X,Y);if(!$||!l(X,"mode",{isIncludedOriginalValue:!1}))$=q;return PX(X,$,Z,Y)}function TX(X,Z,Y){let q=O2(X,Z,Y),$=typeof q==="string"?$X(q):null;if($&&($?.length??0)>=1)return qX(q,$,Z,Y);else return J2(X,Z,Y)}function J2(X,Z,Y){return PX(X,nX(X,Z,Y),Z,Y)}function PX(X,Z,Y,q){if(!X)return null;if(X.$type==="color")Z=DX(Z,X,Y,q);else if(X.$type==="composition"||X.$type==="typography")Z=ZX(X,Y,q);return Z}var MX="did";var g=S(()=>{EX();SX();eX();EX();BX();wZ();RZ();MZ();SX();eX();IY();xY();kX();TY();pY()});import{existsSync as B2}from"fs";import{resolve as I2,join as H0}from"path";import w2 from"chokidar";import{execSync as N0}from"child_process";import{existsSync as jX,statSync as kY}from"fs";import{resolve as uY}from"path";async function cY(X,Z=!1){let Y=process.cwd(),q=X||uY(Y,"designid.config.ts"),$=uY(Y,"designid.config.mjs");if(!jX(q))return!1;if(!(!jX($)||jX(q)&&jX($)&&kY(q).mtimeMs>kY($).mtimeMs)){if(Z)console.log("✓ Config file is up to date");return!1}if(Z)console.log("\uD83D\uDD04 Compiling config file...");try{if(N0(`bun build ${q} --outfile ${$} --minify --target node --packages external --no-bundle`,{stdio:Z?"inherit":"pipe"}),Z)console.log(`✅ Config compiled successfully
492
492
  `);return!0}catch(W){if(console.error("❌ Failed to compile config file"),W instanceof Error)console.error(W.message);throw W}}g();pY();if(process.argv.includes("--help")||process.argv.includes("-h"))console.log(`
493
493
  Watch Tokens - File watcher for design token changes
494
494
 
@@ -504,7 +504,7 @@ Example:
504
504
  bun src/scripts/watch-tokens.ts
505
505
  bun src/scripts/watch-tokens.ts --config=./custom-config.ts
506
506
  bun src/scripts/watch-tokens.ts --dev
507
- `),process.exit(0);async function w2(){let X=await o(),{distDir:Z,buildDir:Y}=await d(),q=[/node_modules/,/dist/,/build/,H0(X,Z),H0(X,Y)],$=I2.watch(["**/*.tokens.json","designid.config.ts"],{ignored:q,persistent:!0}),U,W=300,K=!1;function z(E){let L=[E,"./designid.config.ts","./designid.config.mjs","./designid.config.js","./tokens.config.ts","./tokens.config.js"].filter(Boolean);for(let H of L){let _=B2(H);if(J2(_))return _}throw Error(`Config file not found. Tried: ${L.join(", ")}`)}let G=async()=>{if(K){console.log(`[${new Date().toLocaleTimeString()}] Build already in progress, skipping...`);return}clearTimeout(U),U=setTimeout(async()=>{K=!0,console.clear(),process.stdout.write("\x1Bc"),console.log(`[${new Date().toLocaleTimeString()}] Changes detected. Re-building tokens...
507
+ `),process.exit(0);async function R2(){let X=await o(),{distDir:Z,buildDir:Y}=await d(),q=[/node_modules/,/dist/,/build/,H0(X,Z),H0(X,Y)],$=w2.watch(["**/*.tokens.json","designid.config.ts"],{ignored:q,persistent:!0}),U,W=300,K=!1;function z(E){let L=[E,"./designid.config.ts","./designid.config.mjs","./designid.config.js","./tokens.config.ts","./tokens.config.js"].filter(Boolean);for(let H of L){let _=I2(H);if(B2(_))return _}throw Error(`Config file not found. Tried: ${L.join(", ")}`)}let G=async()=>{if(K){console.log(`[${new Date().toLocaleTimeString()}] Build already in progress, skipping...`);return}clearTimeout(U),U=setTimeout(async()=>{K=!0,console.clear(),process.stdout.write("\x1Bc"),console.log(`[${new Date().toLocaleTimeString()}] Changes detected. Re-building tokens...
508
508
  `);let E=(()=>{let L=process.argv.find((H)=>H.startsWith("--config="));return L?L.split("=")[1]:void 0})();try{await cY(E,!1);let L=z(E);console.log(`Using config: ${L}`);let H=await mY(L);if(H.errors.length>0){console.log(`
509
509
  ❌ Build failed with ${H.errors.length} error${H.errors.length>1?"s":""}:`),H.errors.forEach((_)=>console.log(` - ${_}`)),K=!1;return}if(console.log(`
510
510
  ✅ Build completed successfully!`),console.log(`Processed ${H.tokenCount} tokens in ${H.duration}ms`),H.cssFiles.length>0)console.log(`Generated ${H.cssFiles.length} CSS files`);if(H.typescriptFiles.length>0)console.log(`Generated ${H.typescriptFiles.length} TypeScript files`);if(H.warnings.length>0)console.log(`
@@ -512,4 +512,4 @@ Warnings:`),H.warnings.forEach((_)=>console.log(` - ${_}`));console.log(`
512
512
  Completed at ${new Date().toLocaleTimeString()}
513
513
  `)}catch(L){console.error(`
514
514
  ❌ Build failed:`,L)}finally{K=!1}},300)};$.on("ready",()=>{console.log("Watching for changes in .tokens.json files and designid.config.ts..."),console.log(`Working directory: ${process.cwd()}`),console.log(`Press Ctrl+C to stop watching
515
- `)}).on("change",(E)=>{console.log(`Changed: ${E}`),G().catch((L)=>{console.error("Error during token build:",L)})}).on("add",(E)=>{console.log(`Added: ${E}`),G().catch((L)=>{console.error("Error during token build:",L)})}).on("unlink",(E)=>{console.log(`Deleted: ${E}`),G().catch((L)=>{console.error("Error during token build:",L)})}).on("error",(E)=>{console.error(`Watcher error: ${E}`)});let A=()=>{clearTimeout(U),$.close().then(()=>{console.log("File watcher closed successfully"),process.exit(0)}).catch((E)=>{console.error("Error closing file watcher:",E),process.exit(1)})};process.on("SIGINT",A),process.on("SIGTERM",A),process.on("SIGHUP",A),process.on("uncaughtException",(E)=>{console.error("Uncaught Exception:",E),A()}),process.on("unhandledRejection",(E,L)=>{console.error("Unhandled Rejection at:",L,"reason:",E),A()})}var R2=process.argv[1]?.includes("tokens-watch")||process.argv[1]?.endsWith("watch.js")||import.meta.url===`file://${process.argv[1]}`;if(R2)w2().catch((X)=>{console.error("Error starting watch process:",X),process.exit(1)});export{w2 as runWatch};
515
+ `)}).on("change",(E)=>{console.log(`Changed: ${E}`),G().catch((L)=>{console.error("Error during token build:",L)})}).on("add",(E)=>{console.log(`Added: ${E}`),G().catch((L)=>{console.error("Error during token build:",L)})}).on("unlink",(E)=>{console.log(`Deleted: ${E}`),G().catch((L)=>{console.error("Error during token build:",L)})}).on("error",(E)=>{console.error(`Watcher error: ${E}`)});let A=()=>{clearTimeout(U),$.close().then(()=>{console.log("File watcher closed successfully"),process.exit(0)}).catch((E)=>{console.error("Error closing file watcher:",E),process.exit(1)})};process.on("SIGINT",A),process.on("SIGTERM",A),process.on("SIGHUP",A),process.on("uncaughtException",(E)=>{console.error("Uncaught Exception:",E),A()}),process.on("unhandledRejection",(E,L)=>{console.error("Unhandled Rejection at:",L,"reason:",E),A()})}var M2=process.argv[1]?.includes("tokens-watch")||process.argv[1]?.endsWith("watch.js")||import.meta.url===`file://${process.argv[1]}`;if(M2)R2().catch((X)=>{console.error("Error starting watch process:",X),process.exit(1)});export{R2 as runWatch};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designid/tokens",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "author": "Isa Ozler",
5
5
  "packageManager": "bun@1.2.16",
6
6
  "license": "Apache-2.0",