@greensight/gts 1.0.0-beta.7 → 1.0.0-beta.9
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/index.cjs +12 -12
- package/index.mjs +139 -131
- package/modules/utilities/types.d.ts +5 -0
- package/modules/utilities/types.d.ts.map +1 -1
- package/modules/utilities/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Te=Object.defineProperty;var ve=(r,e,o)=>e in r?Te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var w=(r,e,o)=>ve(r,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("path"),je=require("ts-import"),F=require("node:fs"),k=require("node:fs/promises"),C=require("node:path"),p=class p{static resolveReadPath(e){if(!e||!e.trim())throw new Error("File path must be a non-empty string");return C.resolve(p.baseDir,e)}static resolveWritePath(e,o){const t=C.resolve(p.baseDir,o??"");return{targetDir:t,targetPath:C.resolve(t,e)}}static handleReadError(e,o){throw e.code==="ENOENT"?new Error(`File not found: ${o}`):new Error(`Failed to read file "${o}": ${e.message??String(e)}`)}static async read(e,o="utf8"){const t=p.resolveReadPath(e);try{return await k.readFile(t,{encoding:o})}catch(s){p.handleReadError(s,t)}}static async readBuffer(e){const o=p.resolveReadPath(e);try{return await k.readFile(o)}catch(t){p.handleReadError(t,o)}}static async readJson(e){const o=p.resolveReadPath(e);try{const t=await k.readFile(o,{encoding:"utf8"});try{return JSON.parse(t)}catch(s){throw new Error(`Failed to parse JSON from "${o}": ${s.message}`)}}catch(t){p.handleReadError(t,o)}}static async write(e,o="",t={}){const{directory:s,overwrite:n=!0}=t,{targetDir:a,targetPath:i}=p.resolveWritePath(e,s);if(!n&&F.existsSync(i))throw new Error(`File ${i} already exists`);return await k.mkdir(a,{recursive:!0}),await k.writeFile(i,o,{encoding:"utf8"}),i}static async writeWithExtension(e,o,t="",s){const n=o.startsWith(".")?o:`.${o}`,a=`${e}${n}`;return p.write(a,t,s)}static exists(e){const o=p.resolveReadPath(e);return F.existsSync(o)}static async delete(e,o){const{targetPath:t}=p.resolveWritePath(e,o);F.existsSync(t)&&await k.rm(t,{recursive:!0,force:!0})}};w(p,"baseDir",process.cwd());let
|
|
1
|
+
"use strict";var Te=Object.defineProperty;var ve=(r,e,o)=>e in r?Te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var w=(r,e,o)=>ve(r,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("path"),je=require("ts-import"),F=require("node:fs"),k=require("node:fs/promises"),C=require("node:path"),p=class p{static resolveReadPath(e){if(!e||!e.trim())throw new Error("File path must be a non-empty string");return C.resolve(p.baseDir,e)}static resolveWritePath(e,o){const t=C.resolve(p.baseDir,o??"");return{targetDir:t,targetPath:C.resolve(t,e)}}static handleReadError(e,o){throw e.code==="ENOENT"?new Error(`File not found: ${o}`):new Error(`Failed to read file "${o}": ${e.message??String(e)}`)}static async read(e,o="utf8"){const t=p.resolveReadPath(e);try{return await k.readFile(t,{encoding:o})}catch(s){p.handleReadError(s,t)}}static async readBuffer(e){const o=p.resolveReadPath(e);try{return await k.readFile(o)}catch(t){p.handleReadError(t,o)}}static async readJson(e){const o=p.resolveReadPath(e);try{const t=await k.readFile(o,{encoding:"utf8"});try{return JSON.parse(t)}catch(s){throw new Error(`Failed to parse JSON from "${o}": ${s.message}`)}}catch(t){p.handleReadError(t,o)}}static async write(e,o="",t={}){const{directory:s,overwrite:n=!0}=t,{targetDir:a,targetPath:i}=p.resolveWritePath(e,s);if(!n&&F.existsSync(i))throw new Error(`File ${i} already exists`);return await k.mkdir(a,{recursive:!0}),await k.writeFile(i,o,{encoding:"utf8"}),i}static async writeWithExtension(e,o,t="",s){const n=o.startsWith(".")?o:`.${o}`,a=`${e}${n}`;return p.write(a,t,s)}static exists(e){const o=p.resolveReadPath(e);return F.existsSync(o)}static async delete(e,o){const{targetPath:t}=p.resolveWritePath(e,o);F.existsSync(t)&&await k.rm(t,{recursive:!0,force:!0})}};w(p,"baseDir",process.cwd());let y=p;const S=class S{static async create(){if(y.exists(S.configFileName))throw new Error("The file already exists");await y.write(S.configFileName,"",{overwrite:!1})}async load(){try{const e=await je.tsImport.compile(`${$.resolve(process.cwd(),S.configFileName)}`);if(!e)throw new Error("gts.config.ts must default-export a configuration object");return e.default}catch(e){console.error("Cannot find module gts.config.ts",e)}}};w(S,"configFileName","gts.config.ts");let N=S;const Ne=r=>{const e=new URLSearchParams;return Object.keys(r).forEach(o=>{Array.isArray(r[o])?r[o].forEach(t=>e.append(`${o}[]`,t)):e.append(o,r[o])}),e},Me=(r,e=50)=>{const o=[];for(let t=0;t<r.length;t+=e)o.push(r.slice(t,t+e));return o};class O{constructor(e,o){w(this,"figmaToken");w(this,"fileId");w(this,"onTimeMeasureHandler");this.figmaToken=e,this.fileId=o}setOnTimeMeasureHandler(e){this.onTimeMeasureHandler=e}static async returnJSON(e){const o=await e.json();if(!e.ok){let t="Request failed";throw new Error(t)}return o}async performControlledRequest(e,{params:o={},timeout:t=3e4,abortController:s=new AbortController}={}){var m;if(!this.figmaToken||!this.fileId)throw new Error("figmaToken and fileId are required in gts.config.ts");const n=Object.entries(o).reduce((f,[h,b])=>typeof b<"u"?{...f,[h]:b}:f,{}),a=`https://api.figma.com/v1${e}${n&&Object.keys(n).length?`?${Ne(n)}`:""}`;console.log("endpoinWithParams=",a);const i=setTimeout(()=>s.abort(),t),l={"Content-Type":"application/json",...this.figmaToken&&{"X-Figma-Token":this.figmaToken}},c={method:"GET",headers:l,signal:s.signal},u=performance.now(),d=await fetch(`${a}`,c);clearTimeout(i);const g=performance.now()-u;return(m=this.onTimeMeasureHandler)==null||m.call(this,a,l,g),d}async request(e,o){var s;const t=await this.performControlledRequest(e,{...o});return(s=t.headers.get("content-type"))!=null&&s.includes("application/json")?O.returnJSON(t):t}async getComponents(){return this.request(`/files/${this.fileId}/components`)}async getStyles(){return this.request(`/files/${this.fileId}/styles`)}async getNodes(e){const o=Me(e).map(n=>this.request(`/files/${this.fileId}/nodes`,{params:{ids:n.join(",")}})),t=await Promise.all(o);return{...t[0],nodes:t.reduce((n,a)=>({...n,...a.nodes}),{})}}}const Q=(r,e)=>{const o=Array.isArray(e)?e:e.split(".");let t=r;for(const s of o){if(t==null||typeof t!="object")return;t=t[s]}return t},X=(r,e)=>{if(!e||typeof e!="object")return r;if(!r||typeof r!="object")return e;const o={...r};for(const t in e)e.hasOwnProperty(t)&&(typeof e[t]=="object"&&e[t]!==null&&typeof o[t]=="object"&&o[t]!==null?o[t]=X(o[t],e[t]):o[t]=e[t]);return o};function x(r,e){if(r===e)return!0;if(r==null||e==null)return r===e;if(typeof r!=typeof e)return!1;if(r instanceof Date&&e instanceof Date)return r.getTime()===e.getTime();if(r instanceof RegExp&&e instanceof RegExp)return r.toString()===e.toString();if(Array.isArray(r)&&Array.isArray(e)){if(r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!x(r[o],e[o]))return!1;return!0}if(typeof r=="object"&&typeof e=="object"){const o=Object.keys(r),t=Object.keys(e);if(o.length!==t.length)return!1;for(const s of o)if(!t.includes(s)||!x(r[s],e[s]))return!1;return!0}return!1}const R={color:{},effect:{},text:{},grid:{}};class Y{constructor(e){w(this,"tokensDir");w(this,"manifestPath");w(this,"variables");w(this,"styles");w(this,"loaded",!1);this.tokensDir=e||"",this.manifestPath=$.join(this.tokensDir,"manifest.json")}isLoaded(){return this.loaded&&!!this.variables&&!!this.styles}normalizeKey(e){const o=e.trim();return o&&o.replace(/[-_\s]+/g," ").split(" ").filter(t=>t.length).map((t,s)=>{const n=t.charAt(0),a=t.slice(1);return s===0?t.toLowerCase():n.toUpperCase()+a}).join("")}parseVariableString(e){if(typeof e!="string")return e;const o=/^\{(.+)\}$/,t=e.match(o);if(t){const s=t[1].trim();return`{${this.normalizeKey(s)}}`}return e}createVariableFileList(e){return Object.entries(e).flatMap(([o,t])=>Object.entries(t.modes).flatMap(([s,n])=>n.map(a=>({fileName:a,modeName:this.normalizeKey(s.trim()),collectionName:o}))))}parseValue(e){return e&&(typeof e=="string"?this.parseVariableString(e):typeof e!="object"?e:Array.isArray(e)?e.map(o=>this.parseValue(o)):Object.entries(e).reduce((o,[t,s])=>({...o,[t]:this.parseValue(s)}),{}))}getTokensFromFile(e,o){return Object.entries(e).reduce((t,[s,n])=>"$type"in n&&"$value"in n?{...t,[this.normalizeKey(s)]:{type:n.$type,description:n.$description,value:o?{[this.normalizeKey(o)]:this.parseValue(n.$value)}:this.parseValue(n.$value)}}:{...t,[this.normalizeKey(s)]:this.getTokensFromFile(n,o)},{})}processTokensFile(e,o,t){const s=this.normalizeKey(t),n=this.getTokensFromFile(e,o);return{[s]:n}}async loadVariableFiles(e){return Promise.all(e.map(async({fileName:o,modeName:t,collectionName:s})=>{try{const n=$.join(this.tokensDir,o),a=await y.readJson(n);return this.processTokensFile(a,t,s)}catch(n){return console.warn(`Failed to load variable file: ${$.join(this.tokensDir,o)}`,n),{}}}))}mergeVariables(e){return e.reduce((o,t)=>X(o,t),{})}async loadTokenVariables(e){try{const o=this.createVariableFileList(e),t=await this.loadVariableFiles(o);return this.mergeVariables(t)}catch(o){throw new Error(`Failed to load token variables from ${this.tokensDir}: ${o}`)}}createStyleFileList(e){return Object.entries(e).flatMap(([o,t])=>(t==null?void 0:t.map(s=>({styleType:o,fileName:s})))||[])}async loadStyleFiles(e){return(await Promise.all(e.map(async({styleType:t,fileName:s})=>{try{const n=$.join(this.tokensDir,s),a=await y.readJson(n);return{styleType:t,styleTokens:a}}catch(n){return console.warn(`Failed to load style file: ${$.join(this.tokensDir,s)}`,n),{styleType:t,styleTokens:{}}}}))).reduce((t,s)=>({...t,[s.styleType]:this.getTokensFromFile(s.styleTokens,"")}),{...R})}async loadStyles(e){if(!e)return{...R};const o=this.createStyleFileList(e);return await this.loadStyleFiles(o)}async load(){if(this.loaded)return;const e=await y.readJson(this.manifestPath);if(!e)throw new Error(`Failed to load manifest file from: ${this.manifestPath}`);this.variables=await this.loadTokenVariables(e.collections),this.styles=await this.loadStyles(e.styles),this.loaded=!0}getVariables(){if(!this.loaded||!this.variables)throw new Error("Tokens not loaded. Call load() first.");return this.variables}getStyles(){if(!this.loaded||!this.styles)throw new Error("Tokens not loaded. Call load() first.");return this.styles}isVariableReference(e){return typeof e!="string"?!1:/^\{.+\}$/.test(e)}getVariablePath(e){return e.slice(1,-1)}resolveVariableValue(e){if(typeof e=="object")return Object.keys(e).reduce((o,t)=>{const s=e[t],n=this.resolveVariableValueString(s,t);return n&&(o[t]=n),o},{})}resolveVariableValueString(e,o){if(!this.isVariableReference(e))return e;const t=this.getVariablePath(e),s=this.getToken(t,o);if(s)return this.resolveVariableValueString(s,o)}getToken(e,o){if(!this.loaded||!this.variables)throw new Error("Tokens not loaded. Call load() first.");for(const t of Object.values(this.variables)){const s=Q(t,e);if(s!=null&&s.value&&typeof s.value=="object"){if(o)return s.value[o];{const n=Object.keys(s.value)[0];return s.value[n]}}}}}const Fe=async()=>{const e=await new N().load();if(!e)throw new Error('Failed to load gts.config.ts. Run "npx gts-init" to create it, or ensure the file exists and default-exports a valid configuration.');const{figmaToken:o,fileId:t,modules:s,manifest:n}=e,a=new O(o,t),i=new Y(n);n&&y.exists(n)&&await i.load(),await Promise.all(s.map(l=>l.executor({figmaApiClient:a,tokenManagerClient:i})))},Ce=async()=>{await N.create(),console.log("\x1B[32m%s\x1B[0m","✔️ Configuration file created gts.config.ts")},_=["xxxl","xxl","xl","lg","md","sm","xs","xxs","xxxs"],Ve=r=>parseInt(r.value,10),xe=r=>r.reduce((e,o)=>({...e,[o.name]:Ve(o)}),{}),Pe=async(r,e)=>{await y.delete(r,e)},Oe=async(r,e,o)=>{await y.write(r,e,{directory:o})},V=async(r,e,o)=>{await Pe(r,o),await Oe(r,e,o)},Ee=r=>{const e=r.map(({name:o,value:t})=>` --${o}: ${t};`);return e.length?`.breakpoint-variables {
|
|
2
2
|
${e.join(`
|
|
3
3
|
`)}
|
|
4
4
|
}
|
|
@@ -8,11 +8,11 @@ ${e.join(`,
|
|
|
8
8
|
);
|
|
9
9
|
|
|
10
10
|
$defaultBreakpoint: '${o}';
|
|
11
|
-
`},
|
|
12
|
-
`),
|
|
11
|
+
`},Ke=r=>[`const breakpoints = ${JSON.stringify(r,null,4)} as const;`,"","const BREAKPOINTS_NAMES = Object.keys(breakpoints);","","type BreakpointsKeysType = keyof typeof breakpoints;","type AllowMedia = 'all' | BreakpointsKeysType;","","export { breakpoints, BREAKPOINTS_NAMES };","export type { BreakpointsKeysType, AllowMedia };",""].join(`
|
|
12
|
+
`),Ue=async({breakpointTokens:r,dir:e})=>{const o=xe(r),t=Ee(r),s=Be(r),n=Ke(o);await Promise.all([V("styles.css",t,e),V("styles.scss",s,e),V("index.ts",n,e)])},Ae=(r,e)=>{const o=Object.keys(r).filter(n=>!isNaN(Number(n))).sort((n,a)=>Number(n)-Number(a));if(o.length>e.length)throw new Error(`Not enough breakpoint names provided. Found ${o.length} breakpoints in data, but only ${e.length} names specified: ${e.join(", ")}`);const s=Object.keys(r).filter(n=>isNaN(Number(n)));if(s.length>0)throw new Error(`Found non-numeric breakpoint keys in grid data: ${s.join(", ")}. All breakpoint keys must be numeric values.`);return o.map((n,a)=>({name:e[e.length-1-a]||`bp-${n}`,value:n}))},Re=({input:r={},output:{dir:e}})=>({name:"breakpoints/tokenManager",executor:async({tokenManagerClient:o})=>{try{console.log("[breakpoints/tokenManager] Generating breakpoints from TokenManager...");const{names:t=_}=r;if(!o.isLoaded())throw new Error("TokenManager is not loaded. Tokens must be loaded before using this module.");const s=o.getStyles();if(!s.grid)throw new Error("No grid styles found in TokenManager. Grid tokens must be loaded.");console.log("[breakpoints/tokenManager] Extracting breakpoints from grid styles...");const n=Ae(s.grid,t);if(!n.length){console.warn("[breakpoints/tokenManager] No breakpoints found in grid styles.");return}console.log(`[breakpoints/tokenManager] Found ${n.length} breakpoints: ${n.map(a=>a.name).join(", ")}`),console.log(`[breakpoints/tokenManager] Writing files to ${e}...`),await Ue({breakpointTokens:n,dir:e}),console.log("[breakpoints/tokenManager] ✅ Successfully generated breakpoint files")}catch(t){const s=t instanceof Error?t.message:String(t);throw console.error("[breakpoints/tokenManager] ❌ Failed to generate breakpoints:",s),t instanceof Error&&t.stack&&console.error("[breakpoints/tokenManager] Stack trace:",t.stack),t}}}),De="styles.css",Ie="index.ts",D=(r,e)=>{if(!e.length)return"";const o=e.map(t=>` ${t}`).join(`
|
|
13
13
|
`);return`${r} {
|
|
14
14
|
${o}
|
|
15
|
-
}`},
|
|
15
|
+
}`},Le=r=>`.${r.replace(/\s+/g,"-").toLowerCase()}`,ee=r=>`--cl-${r}`,We=r=>r.reduce((e,o)=>{const t=ee(o.name);return typeof o.value=="object"?Object.entries(o.value).forEach(([s,n])=>{e[s]||(e[s]=[]),e[s].push(`${t}: ${n};`)}):e.root.push(`${t}: ${o.value};`),e},{root:[]}),ze=r=>{const e=D(".color-variables",r.root),o=Object.entries(r).reduce((t,[s,n])=>{if(s==="root"||!n.length)return t;const a=D(Le(`${s}-color-variables`),n);return a&&t.push(a),t},[]).join(`
|
|
16
16
|
|
|
17
17
|
`);return[e,o].filter(Boolean).join(`
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ ${r.map(t=>` '${t.name}': 'var(${ee(t.name)})'`).join(`,
|
|
|
24
24
|
type ColorsKeysType = keyof typeof colors;
|
|
25
25
|
|
|
26
26
|
export { colors, type ColorsKeysType };
|
|
27
|
-
`,qe=async({tsContent:r,cssContent:e,dir:o})=>{await
|
|
27
|
+
`,qe=async({tsContent:r,cssContent:e,dir:o})=>{await y.delete(o);const t=y.write(Ie,r,{directory:o}),s=y.write(De,e,{directory:o});await Promise.all([t,s])},Je=async({colorTokens:r,dir:e})=>{const o=We(r),t=ze(o),s=Ge(r);await qe({tsContent:s,cssContent:t,dir:e})},M=r=>r.reduce((e,o)=>{const t=Number((o.position*100).toFixed(1));return[...e,`${o.color}${t>0&&t<100?` ${t}%`:""}`]},[]).join(", "),He=r=>{const e=M(r.stops);return`linear-gradient(${r.angle}deg, ${e})`},Ze=r=>`radial-gradient(circle, ${M(r.stops)})`,Qe=r=>{const e=M(r.stops);return`conic-gradient(from ${r.angle}deg, ${e})`},Xe=r=>{const e=M(r.stops);return`linear-gradient(${r.angle}deg, ${e})`},I=r=>typeof r=="string"?r:r.type==="linear"?He(r):r.type==="radial"?Ze(r):r.type==="conic"?Qe(r):r.type==="diamond"?Xe(r):"",te=(r,e)=>Object.keys(r).reduce((o,t)=>{const s=r[t],n=e?`${e}-${t}`:t;if(s&&typeof s=="object"&&"type"in s&&"value"in s){const i=Object.keys(s.value),l=i.length>1?s.value:s.value[i[0]],c=typeof l=="object"?Object.keys(l).reduce((d,g)=>({...d,[g]:I(l[g])}),{}):I(l),u={[n]:c};return{...o,...u}}const a=te(s,n);return{...o,...a}},{}),re=(r,e)=>Object.keys(r).reduce((o,t)=>{const s=r[t];if(s.type&&s.type!=="color")return o;if(s.type&&s.value){const a=typeof s.value=="string"?e.resolveVariableValueString(s.value,t):e.resolveVariableValue(s.value);return a?{...o,[t]:{...s,value:a}}:o}const n=re(s,e);return n?{...o,[t]:n}:o},{}),Ye=({input:r={},output:{dir:e}})=>({name:"colors/tokenManager",executor:async({tokenManagerClient:o})=>{try{console.log("[colors/tokenManager] Generating colors from TokenManager...");const{includeVariables:t,includeStyles:s=!0}=r;if(!(t!=null&&t.length)&&!s)throw new Error("Either includeVariables or includeStyles must be enabled");if(!o.isLoaded())throw new Error("TokenManager is not loaded. Tokens must be loaded before using this module.");const n=[],a=o.getVariables();if(s){const l=o.getStyles();console.log("[colors/tokenManager] Processing styles for colors..."),l.color&&n.push(l.color)}if(t!=null&&t.length){console.log(`[colors/tokenManager] Processing ${t.length} variable groups...`);const l=t.map(c=>a[c]).filter(Boolean);n.push(...l)}const i=n.map(l=>re(l,o)).flatMap(l=>Object.entries(te(l,"")).reduce((c,[u,d])=>[...c,{name:u,value:d}],[]));if(i.length===0){console.warn("[colors/tokenManager] No color tokens generated");return}console.log(`[colors/tokenManager] Generated ${i.length} color tokens`),console.log(`[colors/tokenManager] Writing files to ${e}...`),await Je({colorTokens:i,dir:e}),console.log("[colors/tokenManager] ✅ Successfully generated color files")}catch(t){const s=t instanceof Error?t.message:String(t);throw console.error("[colors/tokenManager] ❌ Failed to generate colors:",s),t instanceof Error&&t.stack&&console.error("[colors/tokenManager] Stack trace:",t.stack),t}}}),_e=r=>` @media (width <= ${r.breakpoint}px) {
|
|
28
28
|
.container {
|
|
29
29
|
padding-left: ${r.offset};
|
|
30
30
|
padding-right: ${r.offset};
|
|
@@ -42,7 +42,7 @@ ${t}
|
|
|
42
42
|
|
|
43
43
|
export const conatinerClassName = styles.container;
|
|
44
44
|
export const conatinerTabletClassName = styles.containerTablet;
|
|
45
|
-
`,
|
|
45
|
+
`,L=async(r,e,o)=>{await y.delete(r,o),await y.write(r,e,{directory:o})},rt=async({containerTokens:r,dir:e,layer:o})=>{const t=et(r,o),s=tt();await L("styles.module.css",t,e),await L("index.ts",s,e)},ot=r=>{const e=r.trim().toLowerCase();return e==="0"||e==="0px"},st=(r,e)=>Object.keys(r).filter(n=>!isNaN(Number(n))).sort((n,a)=>Number(a)-Number(n)).reduce((n,a)=>{const i=r[a];if(!i||!("value"in i)||!Array.isArray(i.value))return n;const l=i.value.find(u=>u.pattern==="columns");if(!(l!=null&&l.offset))return n;const c=e.resolveVariableValueString(l.offset);return!c||typeof c!="string"||ot(c)?n:[...n,{breakpoint:Number(a),offset:c}]},[]).reduce((n,a)=>{const i=n[n.length-1];return i&&x(i.offset,a.offset)||n.push(a),n},[]),nt=({input:r={},output:{dir:e}})=>({name:"container/tokenManager",executor:async({tokenManagerClient:o})=>{try{console.log("[container/tokenManager] Generating container styles...");const{layer:t}=r;if(!o.isLoaded())throw new Error("TokenManager is not loaded. Tokens must be loaded before using this module.");console.log("[container/tokenManager] Extracting container tokens...");const s=o.getStyles();if(!s.grid)throw new Error("No grid styles found in TokenManager. Grid tokens must be loaded.");const n=st(s.grid,o);if(!n.length){console.warn("[container/tokenManager] No container tokens found.");return}console.log(`[container/tokenManager] Found ${n.length} container tokens: ${n.map(a=>a.breakpoint).join(", ")}`),console.log(`[container/tokenManager] Writing files to ${e}...`),await rt({containerTokens:n,dir:e,layer:t}),console.log("[container/tokenManager] ✅ Successfully generated container files")}catch(t){const s=t instanceof Error?t.message:String(t);throw console.error("[container/tokenManager] ❌ Failed to generate container:",s),t instanceof Error&&t.stack&&console.error("[container/tokenManager] Stack trace:",t.stack),t}}}),at="styles.css",it="index.ts",W=(r,e)=>{if(!e.length)return"";const o=e.map(t=>` ${t}`).join(`
|
|
46
46
|
`);return`${r} {
|
|
47
47
|
${o}
|
|
48
48
|
}`},lt=r=>`.${r.replace(/\s+/g,"-").toLowerCase()}`,oe=r=>`--${r}`,ct=({offsetX:r,offsetY:e,blur:o,spread:t,color:s})=>`${r} ${e} ${o} ${t} ${s}`,ut=r=>r.reduce((e,o)=>{const t=oe(o.name);return typeof o.value!="object"?(e.root.push(`${t}: ${o.value};`),e):Object.entries(o.value).reduce((s,[n,a])=>{const i=s[n]??[];return{...s,[n]:[...i,`${t}: ${a};`]}},e)},{root:[]}),dt=r=>{const e=W(".shadow-variables",r.root),o=Object.entries(r).reduce((t,[s,n])=>{if(s==="root"||!n.length)return t;const a=W(lt(`${s}-shadow-variables`),n);return a&&t.push(a),t},[]).join(`
|
|
@@ -57,10 +57,10 @@ ${r.map(t=>` '${t.name}': 'var(${oe(t.name)})'`).join(`,
|
|
|
57
57
|
type ShadowsKeysType = keyof typeof shadows;
|
|
58
58
|
|
|
59
59
|
export { shadows, type ShadowsKeysType };
|
|
60
|
-
`,gt=async({tsContent:r,cssContent:e,dir:o})=>{await
|
|
60
|
+
`,gt=async({tsContent:r,cssContent:e,dir:o})=>{await y.delete(o);const t=y.write(it,r,{directory:o}),s=y.write(at,e,{directory:o});await Promise.all([t,s])},ft=async({shadowTokens:r,dir:e})=>{const o=ut(r),t=dt(o),s=yt(r);await gt({tsContent:s,cssContent:t,dir:e})},se=(r,e)=>Object.keys(r).reduce((o,t)=>{const s=r[t],n=e?`${e}-${t}`:t;if(s&&typeof s=="object"&&"type"in s&&"value"in s){const i={[n]:s.value.map(ct).join(", ")};return{...o,...i}}const a=se(s,n);return{...o,...a}},{}),pt=({input:r={},output:{dir:e}})=>({name:"shadows/tokenManager",executor:async({tokenManagerClient:o})=>{try{console.log("[shadows/tokenManager] Generating shadows from TokenManager...");const{includeStyles:t=!0}=r;if(!t)throw new Error("includeStyles must be enabled for shadows generation");if(!o.isLoaded())throw new Error("TokenManager is not loaded. Tokens must be loaded before using this module.");const s=[];if(t){const a=o.getStyles();console.log("[shadows/tokenManager] Processing styles for shadows..."),a.effect&&s.push(a.effect)}const n=s.flatMap(a=>Object.entries(se(a,"")).reduce((i,[l,c])=>[...i,{name:l,value:c}],[]));if(n.length===0){console.warn("[shadows/tokenManager] No shadow tokens generated");return}console.log(`[shadows/tokenManager] Generated ${n.length} shadow tokens`),console.log(`[shadows/tokenManager] Writing files to ${e}...`),await ft({shadowTokens:n,dir:e}),console.log("[shadows/tokenManager] ✅ Successfully generated shadow files")}catch(t){const s=t instanceof Error?t.message:String(t);throw console.error("[shadows/tokenManager] ❌ Failed to generate shadows:",s),t instanceof Error&&t.stack&&console.error("[shadows/tokenManager] Stack trace:",t.stack),t}}}),ht="styles.module.css",mt="index.ts",bt="typography.ts",z="sans-serif",G=(r,e)=>{if(!e.length)return"";const o=e.map(t=>` ${t}`).join(`
|
|
61
61
|
`);return`${r} {
|
|
62
62
|
${o}
|
|
63
|
-
}`},ne=(r,e)=>{if(typeof r!="string")return r;const o=e[r]??r;return o.trim().toLowerCase().endsWith(z)?o:`${o}, ${z}`},q=(r,e)=>typeof r.fontFamily!="string"?r:{...r,fontFamily:ne(r.fontFamily,e)},v=(r,e)=>{const o={};return Object.entries(r).forEach(([t,s])=>{const n=t==="fontFamily"?ne(s,e):s,a=t.replace(/([A-Z])/g,"-$1")
|
|
63
|
+
}`},ne=(r,e)=>{if(typeof r!="string")return r;const o=e[r]??r;return o.trim().toLowerCase().endsWith(z)?o:`${o}, ${z}`},q=(r,e)=>typeof r.fontFamily!="string"?r:{...r,fontFamily:ne(r.fontFamily,e)},v=(r,e)=>{const o={};return Object.entries(r).forEach(([t,s])=>{const n=t==="fontFamily"?ne(s,e):s,a=t.replace(/([A-Z])/g,"-$1");o[a]=n}),o},wt=(r,e,o)=>{const t=Object.keys(r.breakpoints),s=v(r.base,o);return t.reduce((n,a,i)=>{const l=v(r.breakpoints[a],o);return i?[...n,{breakpoint:Number(e[a]),css:l}]:[{breakpoint:null,css:{...s,...l}}]},[{breakpoint:null,css:s}])},ae=()=>({base:{},breakpoints:{}}),P=(r,e,o,t)=>{Object.keys(t).length&&(r.breakpoints[e]||(r.breakpoints[e]={}),r.breakpoints[e][o]={...r.breakpoints[e][o],...t})},j=(r,e,o,t)=>{wt(e.value,o,t).forEach(({breakpoint:n,css:a})=>{if(n===null){r.base[e.name]=a;return}P(r,n,e.name,a)})},ie=r=>{const e=J(r.base),o=Object.keys(r.breakpoints).map(Number).sort((t,s)=>s-t).reduce((t,s)=>{const n=r.breakpoints[s];return t+`@media (max-width: ${s}px) { ${J(n)} }`},"");return e+o},kt=(r,e,o)=>{const t=r.reduce((s,n)=>(j(s,n,e,o),s),ae());return ie(t)},J=r=>Object.keys(r).reduce((e,o)=>{const t=r[o],s=Object.keys(t).map(n=>`${n}: ${t[n]}`).join(";");return e+`.typo-${o} { ${s} }`},""),H=r=>{if(typeof r=="number")return Number.isFinite(r)?r:null;const e=Number.parseFloat(r);return Number.isFinite(e)?e:null},Z=r=>{if(typeof r=="number")return r/16;const e=r.trim().toLowerCase();if(e.endsWith("rem"))return H(e);if(e.endsWith("px")){const o=H(e);return o===null?null:o/16}return null},$t=r=>{const{minValueRem:e,maxValueRem:o,minVwRem:t,maxVwRem:s}=r,n=o-e;return`calc(${e}rem + ((100vw - ${t}rem) / (${s}rem - ${t}rem)) * ${n}rem)`},St=(r,e,o,t)=>{const s=["font-size","line-height"],n=Object.entries(e.value.breakpoints).map(([f,h])=>{const b=Number.parseInt(o[f],10);return{breakpointName:f,width:b,typography:h}}).filter(f=>Number.isFinite(f.width)).sort((f,h)=>h.width-f.width);if(n.length<2){j(r,e,o,t);return}const a=n[0],i=n[n.length-1];if(a.width<=i.width){j(r,e,o,t);return}const l=v(e.value.base,t),c=v(a.typography,t),u=v(i.typography,t),d=a.width/16,g=i.width/16;if(d===g){j(r,e,o,t);return}r.base[e.name]={...l,...c};const m=s.reduce((f,h)=>{const b=c[h],T=u[h];if(b===void 0||T===void 0||b===T)return f;const U=Z(b),A=Z(T);return U===null||A===null?f:{...f,[h]:$t({minValueRem:A,maxValueRem:U,minVwRem:g,maxVwRem:d})}},{});P(r,a.width,e.name,m),P(r,i.width,e.name,u)},Tt=(r,e,o,t)=>{if(!t)return kt(r,e,o);const s=r.reduce((n,a)=>(St(n,a,e,o),n),ae());return ie(s)},vt=r=>r.length?`import styles from './styles.module.css';
|
|
64
64
|
import { typography } from './typography';
|
|
65
65
|
|
|
66
66
|
type TypographyKeysType = keyof typeof typography;
|
|
@@ -79,11 +79,11 @@ ${r.map(t=>{const s=q(t.value.base,e),n=Object.entries(t.value.breakpoints).redu
|
|
|
79
79
|
} as const;
|
|
80
80
|
|
|
81
81
|
export { typography };
|
|
82
|
-
`:"",
|
|
83
|
-
${
|
|
82
|
+
`:"",Nt=async({indexTSContent:r,typographyTSContent:e,cssContent:o,dir:t})=>{await y.delete(t);const s=y.write(mt,r,{directory:t}),n=y.write(bt,e,{directory:t}),a=y.write(ht,o,{directory:t});await Promise.all([s,n,a])},Mt=async({typographyTokens:r,dir:e,breakpoints:o,fontFamily:t,fluid:s})=>{const n=Tt(r,o,t,s),a=jt(r,t),i=vt(r);await Nt({indexTSContent:i,typographyTSContent:a,cssContent:n,dir:e})},le=(r,e,o)=>Object.keys(r).reduce((t,s)=>{const n=r[s];if(typeof n!="object"||Array.isArray(n))return t;if(!("type"in n)||!("value"in n))return{...t,[s]:le(n,e,o)};if(n.type!=="typography")return t;const a=n.value,i=Object.entries(a).reduce((l,[c,u])=>{const d=Object.keys(o.breakpoints);if(d.length)d.forEach(g=>{const m=e.resolveVariableValueString(u,g);m&&(m===u?l.base={...l.base,[c]:m}:l.breakpoints[g]={...l.breakpoints[g],[c]:m})});else{const g=e.resolveVariableValueString(u);g&&(l.base={...l.base,[c]:g})}return l},{base:{},breakpoints:{}});return{...t,[s]:{type:"typography",value:i}}},{}),ce=(r,e)=>Object.keys(r).reduce((o,t)=>{const s=e?`${e}-${t}`:t,n=r[t];if(!("type"in n)||!("value"in n))return{...o,...ce(n,s)};const a=n.value;return{...o,[s]:a}},{}),Ft=({input:r,output:{dir:e}})=>({name:"typography/tokenManager",executor:async({tokenManagerClient:o})=>{try{console.log("[typography/tokenManager] Generating typography from TokenManager...");const{breakpoints:t,fontFamily:s}=r,n=r.fluid??!0;if(!o.isLoaded())throw new Error("TokenManager is not loaded. Tokens must be loaded before using this module.");const a=[],i=o.getStyles();console.log("[typography/tokenManager] Processing styles for typography..."),i.text&&a.push(i.text);const l=a.reduce((u,d)=>({...u,...le(d,o,{breakpoints:r.breakpoints})}),{}),c=Object.entries(ce(l)).map(([u,d])=>({name:u,value:d}));if(c.length===0){console.warn("[typography/tokenManager] No typography tokens generated");return}console.log(`[typography/tokenManager] Generated ${c.length} typography tokens`),console.log(`[typography/tokenManager] Writing files to ${e}...`),await Mt({typographyTokens:c,dir:e,breakpoints:t,fontFamily:s||{},fluid:n}),console.log("[typography/tokenManager] ✅ Successfully generated typography files")}catch(t){const s=t instanceof Error?t.message:String(t);throw console.error("[typography/tokenManager] ❌ Failed to generate typography:",s),t instanceof Error&&t.stack&&console.error("[typography/tokenManager] Stack trace:",t.stack),t}}}),Ct=r=>typeof r=="object"&&r!==null&&"type"in r&&"value"in r,Vt=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),ue=r=>r.trim().split(".").map(e=>e.trim()).filter(Boolean),de=(r,e)=>{const o=ue(e);if(!o.length)throw new Error("variablePath must contain at least one segment");const t=Q(r,o);if(t===void 0)throw new Error(`Variables subtree not found at path: ${o.join(".")}`);return t},ye=(r,e,o)=>{if(!r)return[];if(Ct(r)){if(r.type!=="dimension")return[];const t=r.value,s=Object.keys(t).reduce((n,a)=>{const i=t[a],l=o.resolveVariableValueString(i,a);return{...n,[a]:l??i}},{});return[{flatName:e,resolvedByMode:s}]}return Vt(r)?Object.keys(r).flatMap(t=>{const s=r[t],n=e?`${e}-${t}`:t;return ye(s,n,o)}):[]},ge=(r,e)=>ye(r,"",e),fe=(r,e)=>typeof e=="string"?r===e:e.test(r),pe=(r,e)=>e!=null&&e.length?r.filter(o=>e.some(t=>fe(o.flatName,t))):r,he=r=>Object.keys(r).map(e=>({mode:e,widthPx:Number.parseInt(r[e],10)})).filter(e=>Number.isFinite(e.widthPx)).sort((e,o)=>o.widthPx-e.widthPx),E=r=>{const e=ue(r);if(!e.length)throw new Error("variablePath must contain at least one segment");const o=e[e.length-1];return{variablesClassName:`${o}-variables`,variableNamePrefix:o}},me=(r,e)=>{const t=E(r.variablePath).variableNamePrefix,s=e.variablesClassName??`${t}-variables`;return{variableNamePrefix:t,variablesClassName:s}},B=(r,e)=>`${E(r).variableNamePrefix}-${e}`,xt=(r,e)=>`--${B(r,e)}`,Pt=r=>`--${r}`,K=(r,e,o)=>{const t=B(r.variablePath,o);if(!e.parseCssVariableName)return t;const s=e.parseCssVariableName({variablePath:r.variablePath,flatName:o,defaultName:t});return s.trim()?s:t},Ot=(r,e)=>Object.keys(e).reduce((o,t)=>{const s=Number(t);return{...o,[s]:{...o[s],...e[s]}}},{...r}),be=(r,e,o)=>{const{breakpoints:t}=e,s=K(e,o,r.flatName),n=Pt(s),a=he(t);if(Object.keys(t).length===0||a.length===0){const u=Object.values(r.resolvedByMode)[0]??"";return{base:{[n]:u},byBreakpoint:{}}}const i=a.filter(u=>u.mode in r.resolvedByMode);if(i.length===0){const u=Object.values(r.resolvedByMode)[0]??"";return{base:{[n]:u},byBreakpoint:{}}}if(i.length===1){const u=i[0],d=r.resolvedByMode[u.mode]??"";return{base:{[n]:d},byBreakpoint:{}}}const l=r.resolvedByMode[i[0].mode]??"",c=i.slice(1).reduce((u,d,g)=>{const m=i[g].mode,f=r.resolvedByMode[m],h=r.resolvedByMode[d.mode];if(h===void 0||h===f)return u;const b=d.widthPx,T=u[b]??{};return{...u,[b]:{...T,[n]:h}}},{});return{base:{[n]:l},byBreakpoint:c}},Et=(r,e,o)=>r.reduce((t,s)=>{const{base:n,byBreakpoint:a}=be(s,e,o);return{base:{...t.base,...n},breakpoints:Ot(t.breakpoints,a)}},{base:{},breakpoints:{}}),we=(r,e,o)=>{if(!r.length)return"";const{variablesClassName:t}=me(e,o),s=Et(r,e,o),n=Object.keys(s.base).map(l=>` ${l}: ${s.base[l]};`),a=G(`.${t}`,n),i=Object.keys(s.breakpoints).map(Number).sort((l,c)=>c-l).map(l=>{const c=s.breakpoints[l],u=Object.keys(c).map(g=>` ${g}: ${c[g]};`),d=G(`.${t}`,u);return`@media (max-width: ${l}px) {
|
|
83
|
+
${d}
|
|
84
84
|
}`}).filter(Boolean).join(`
|
|
85
85
|
|
|
86
86
|
`);return i?`${a}
|
|
87
87
|
|
|
88
|
-
${i}`:a},Bt=r=>{const e=r.split("-").map(o=>o.trim()).filter(Boolean);return e[e.length-1]??r},
|
|
89
|
-
`)},
|
|
88
|
+
${i}`:a},Bt=r=>{const e=r.split("-").map(o=>o.trim()).filter(Boolean);return e[e.length-1]??r},Kt=(r,e,o)=>{const t=Bt(o);if(!e.parseUtilityKey)return t;const s=e.parseUtilityKey({variablePath:r.variablePath,flatName:o,defaultKey:t});return s.trim()?s:t},Ut=/^[A-Za-z_$][A-Za-z0-9_$]*$/,At=r=>{var t;const o=((t=r.utilityKeysTypeName)==null?void 0:t.trim())||"UtilitiesKeysType";if(!Ut.test(o))throw new Error(`Invalid utilityKeysTypeName: "${o}". Expected a valid TypeScript identifier.`);return o},Rt=(r,e,o)=>r.reduce((t,s)=>{const n=Kt(e,o,s.flatName),a=t[n];if(a&&a!==s.flatName)throw new Error(`Utility key collision: "${n}" is generated for both "${a}" and "${s.flatName}"`);return{...t,[n]:s.flatName}},{}),ke=(r,e,o)=>{var c;const t=Rt(r,e,o),s=Object.keys(t).reduce((u,d)=>{const g=t[d];return{...u,[d]:K(e,o,g)}},{}),n=JSON.stringify(s,null,4),i=((c=o.getUtilityCssVarFunctionName)==null?void 0:c.trim())||"getUtilityCssVar",l=At(o);return[`const utilityVariableNameByKey = ${n} as const;`,"",`type ${l} = keyof typeof utilityVariableNameByKey;`,"",`const getUtilityCssVariableName = (key: ${l}): string =>`," `--${utilityVariableNameByKey[key]}`;","",`const ${i} = (key: ${l}): string =>`," `var(${getUtilityCssVariableName(key)})`;","","export {"," getUtilityCssVariableName,",` ${i},`,` type ${l},`,"};",""].join(`
|
|
89
|
+
`)},Dt="styles.css",It="index.ts",$e=async({dir:r,globalCss:e,indexTs:o})=>{await y.delete(r),await Promise.all([y.write(Dt,e,{directory:r}),y.write(It,o,{directory:r})])},Se=async({tokens:r,input:e,output:o})=>{const{dir:t}=o,s=we(r,e,o),n=ke(r,e,o);await $e({dir:t,globalCss:s,indexTs:n})},Lt=({input:r,output:e})=>({name:"utilities/tokenManager",executor:async({tokenManagerClient:o})=>{var t;try{if(console.log("[utilities/tokenManager] Generating utility classes from TokenManager..."),!o.isLoaded())throw new Error("TokenManager is not loaded. Tokens must be loaded before using this module.");const s=o.getVariables(),n=de(s,r.variablePath),a=ge(n,o),i=pe(a,r.include);if(!i.length){a.length&&((t=r.include)!=null&&t.length)?console.warn(`[utilities/tokenManager] No tokens left after include filter (${a.length} at path "${r.variablePath}")`):console.warn(`[utilities/tokenManager] No dimension tokens found at path "${r.variablePath}"`);return}console.log(`[utilities/tokenManager] Resolved ${i.length} utility token(s)`),console.log(`[utilities/tokenManager] Writing files to ${e.dir}...`),await Se({tokens:i,input:r,output:e}),console.log("[utilities/tokenManager] ✅ Successfully generated utility files")}catch(s){const n=s instanceof Error?s.message:String(s);throw console.error("[utilities/tokenManager] ❌ Failed to generate utilities:",n),s instanceof Error&&s.stack&&console.error("[utilities/tokenManager] Stack trace:",s.stack),s}}});exports.BREAKPOINTS_NAMES=_;exports.TokenManager=Y;exports.breakpointsFromTokenManager=Re;exports.buildUtilitiesGlobalStylesCSS=we;exports.buildUtilitiesIndexTSContent=ke;exports.colorsFromTokenManager=Ye;exports.containerFromTokenManager=nt;exports.deriveUtilityNamingFromVariablePath=E;exports.filterResolvedUtilitiesByInclude=pe;exports.generate=Fe;exports.generateUtilitiesFiles=Se;exports.getSortedBreakpointModes=he;exports.getUtilityCssVariableName=xt;exports.getUtilityCssVariableNameWithoutDashes=B;exports.getVariablesSubtree=de;exports.init=Ce;exports.resolveUtilitiesSubtree=ge;exports.resolveUtilityCssVariableNameWithoutDashes=K;exports.resolveUtilityNaming=me;exports.shadowsFromTokenManager=pt;exports.splitUtilityTokenForMedia=be;exports.typographyFromTokenManager=Ft;exports.utilitiesFromTokenManager=Lt;exports.utilityFlatNameMatchesIncludePattern=fe;exports.writeUtilitiesFiles=$e;
|
package/index.mjs
CHANGED
|
@@ -73,12 +73,12 @@ const p = class p {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
w(p, "baseDir", process.cwd());
|
|
76
|
-
let
|
|
76
|
+
let y = p;
|
|
77
77
|
const $ = class $ {
|
|
78
78
|
static async create() {
|
|
79
|
-
if (
|
|
79
|
+
if (y.exists($.configFileName))
|
|
80
80
|
throw new Error("The file already exists");
|
|
81
|
-
await
|
|
81
|
+
await y.write($.configFileName, "", { overwrite: !1 });
|
|
82
82
|
}
|
|
83
83
|
async load() {
|
|
84
84
|
try {
|
|
@@ -133,14 +133,14 @@ class O {
|
|
|
133
133
|
const i = setTimeout(() => s.abort(), t), l = {
|
|
134
134
|
"Content-Type": "application/json",
|
|
135
135
|
...this.figmaToken && { "X-Figma-Token": this.figmaToken }
|
|
136
|
-
},
|
|
136
|
+
}, c = {
|
|
137
137
|
method: "GET",
|
|
138
138
|
headers: l,
|
|
139
139
|
signal: s.signal
|
|
140
|
-
},
|
|
140
|
+
}, u = performance.now(), d = await fetch(`${a}`, c);
|
|
141
141
|
clearTimeout(i);
|
|
142
|
-
const f = performance.now() -
|
|
143
|
-
return (m = this.onTimeMeasureHandler) == null || m.call(this, a, l, f),
|
|
142
|
+
const f = performance.now() - u;
|
|
143
|
+
return (m = this.onTimeMeasureHandler) == null || m.call(this, a, l, f), d;
|
|
144
144
|
}
|
|
145
145
|
async request(e, o) {
|
|
146
146
|
var s;
|
|
@@ -290,7 +290,7 @@ class be {
|
|
|
290
290
|
return Promise.all(
|
|
291
291
|
e.map(async ({ fileName: o, modeName: t, collectionName: s }) => {
|
|
292
292
|
try {
|
|
293
|
-
const n = k.join(this.tokensDir, o), a = await
|
|
293
|
+
const n = k.join(this.tokensDir, o), a = await y.readJson(n);
|
|
294
294
|
return this.processTokensFile(a, t, s);
|
|
295
295
|
} catch (n) {
|
|
296
296
|
return console.warn(`Failed to load variable file: ${k.join(this.tokensDir, o)}`, n), {};
|
|
@@ -330,7 +330,7 @@ class be {
|
|
|
330
330
|
return (await Promise.all(
|
|
331
331
|
e.map(async ({ styleType: t, fileName: s }) => {
|
|
332
332
|
try {
|
|
333
|
-
const n = k.join(this.tokensDir, s), a = await
|
|
333
|
+
const n = k.join(this.tokensDir, s), a = await y.readJson(n);
|
|
334
334
|
return { styleType: t, styleTokens: a };
|
|
335
335
|
} catch (n) {
|
|
336
336
|
return console.warn(`Failed to load style file: ${k.join(this.tokensDir, s)}`, n), { styleType: t, styleTokens: {} };
|
|
@@ -353,7 +353,7 @@ class be {
|
|
|
353
353
|
}
|
|
354
354
|
async load() {
|
|
355
355
|
if (this.loaded) return;
|
|
356
|
-
const e = await
|
|
356
|
+
const e = await y.readJson(this.manifestPath);
|
|
357
357
|
if (!e)
|
|
358
358
|
throw new Error(`Failed to load manifest file from: ${this.manifestPath}`);
|
|
359
359
|
this.variables = await this.loadTokenVariables(e.collections), this.styles = await this.loadStyles(e.styles), this.loaded = !0;
|
|
@@ -435,15 +435,15 @@ class be {
|
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
const
|
|
438
|
+
const It = async () => {
|
|
439
439
|
const e = await new v().load();
|
|
440
440
|
if (!e)
|
|
441
441
|
throw new Error(
|
|
442
442
|
'Failed to load gts.config.ts. Run "npx gts-init" to create it, or ensure the file exists and default-exports a valid configuration.'
|
|
443
443
|
);
|
|
444
444
|
const { figmaToken: o, fileId: t, modules: s, manifest: n } = e, a = new O(o, t), i = new be(n);
|
|
445
|
-
n &&
|
|
446
|
-
},
|
|
445
|
+
n && y.exists(n) && await i.load(), await Promise.all(s.map((l) => l.executor({ figmaApiClient: a, tokenManagerClient: i })));
|
|
446
|
+
}, zt = async () => {
|
|
447
447
|
await v.create(), console.log("\x1B[32m%s\x1B[0m", "✔️ Configuration file created gts.config.ts");
|
|
448
448
|
}, we = ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs", "xxs", "xxxs"], ke = (r) => parseInt(r.value, 10), $e = (r) => r.reduce(
|
|
449
449
|
(e, o) => ({
|
|
@@ -452,9 +452,9 @@ const Lt = async () => {
|
|
|
452
452
|
}),
|
|
453
453
|
{}
|
|
454
454
|
), Se = async (r, e) => {
|
|
455
|
-
await
|
|
455
|
+
await y.delete(r, e);
|
|
456
456
|
}, Te = async (r, e, o) => {
|
|
457
|
-
await
|
|
457
|
+
await y.write(r, e, { directory: o });
|
|
458
458
|
}, F = async (r, e, o) => {
|
|
459
459
|
await Se(r, o), await Te(r, e, o);
|
|
460
460
|
}, je = (r) => {
|
|
@@ -508,7 +508,7 @@ $defaultBreakpoint: '${o}';
|
|
|
508
508
|
name: e[e.length - 1 - a] || `bp-${n}`,
|
|
509
509
|
value: n
|
|
510
510
|
}));
|
|
511
|
-
},
|
|
511
|
+
}, Gt = ({
|
|
512
512
|
input: r = {},
|
|
513
513
|
output: { dir: e }
|
|
514
514
|
}) => ({
|
|
@@ -539,25 +539,25 @@ $defaultBreakpoint: '${o}';
|
|
|
539
539
|
throw console.error("[breakpoints/tokenManager] ❌ Failed to generate breakpoints:", s), t instanceof Error && t.stack && console.error("[breakpoints/tokenManager] Stack trace:", t.stack), t;
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
}), Ve = "styles.css", Fe = "index.ts",
|
|
542
|
+
}), Ve = "styles.css", Fe = "index.ts", A = (r, e) => {
|
|
543
543
|
if (!e.length) return "";
|
|
544
544
|
const o = e.map((t) => ` ${t}`).join(`
|
|
545
545
|
`);
|
|
546
546
|
return `${r} {
|
|
547
547
|
${o}
|
|
548
548
|
}`;
|
|
549
|
-
}, xe = (r) => `.${r.replace(/\s+/g, "-").toLowerCase()}`,
|
|
549
|
+
}, xe = (r) => `.${r.replace(/\s+/g, "-").toLowerCase()}`, Z = (r) => `--cl-${r}`, Pe = (r) => r.reduce(
|
|
550
550
|
(e, o) => {
|
|
551
|
-
const t =
|
|
551
|
+
const t = Z(o.name);
|
|
552
552
|
return typeof o.value == "object" ? Object.entries(o.value).forEach(([s, n]) => {
|
|
553
553
|
e[s] || (e[s] = []), e[s].push(`${t}: ${n};`);
|
|
554
554
|
}) : e.root.push(`${t}: ${o.value};`), e;
|
|
555
555
|
},
|
|
556
556
|
{ root: [] }
|
|
557
557
|
), Oe = (r) => {
|
|
558
|
-
const e =
|
|
558
|
+
const e = A(".color-variables", r.root), o = Object.entries(r).reduce((t, [s, n]) => {
|
|
559
559
|
if (s === "root" || !n.length) return t;
|
|
560
|
-
const a =
|
|
560
|
+
const a = A(xe(`${s}-color-variables`), n);
|
|
561
561
|
return a && t.push(a), t;
|
|
562
562
|
}, []).join(`
|
|
563
563
|
|
|
@@ -566,7 +566,7 @@ ${o}
|
|
|
566
566
|
|
|
567
567
|
`);
|
|
568
568
|
}, Ee = (r) => `${`const colors = {
|
|
569
|
-
${r.map((t) => ` '${t.name}': 'var(${
|
|
569
|
+
${r.map((t) => ` '${t.name}': 'var(${Z(t.name)})'`).join(`,
|
|
570
570
|
`)}
|
|
571
571
|
} as const;`}
|
|
572
572
|
|
|
@@ -578,8 +578,8 @@ export { colors, type ColorsKeysType };
|
|
|
578
578
|
cssContent: e,
|
|
579
579
|
dir: o
|
|
580
580
|
}) => {
|
|
581
|
-
await
|
|
582
|
-
const t =
|
|
581
|
+
await y.delete(o);
|
|
582
|
+
const t = y.write(Fe, r, { directory: o }), s = y.write(Ve, e, { directory: o });
|
|
583
583
|
await Promise.all([t, s]);
|
|
584
584
|
}, Ke = async ({ colorTokens: r, dir: e }) => {
|
|
585
585
|
const o = Pe(r), t = Oe(o), s = Ee(r);
|
|
@@ -587,29 +587,29 @@ export { colors, type ColorsKeysType };
|
|
|
587
587
|
}, N = (r) => r.reduce((e, o) => {
|
|
588
588
|
const t = Number((o.position * 100).toFixed(1));
|
|
589
589
|
return [...e, `${o.color}${t > 0 && t < 100 ? ` ${t}%` : ""}`];
|
|
590
|
-
}, []).join(", "),
|
|
590
|
+
}, []).join(", "), Ae = (r) => {
|
|
591
591
|
const e = N(r.stops);
|
|
592
592
|
return `linear-gradient(${r.angle}deg, ${e})`;
|
|
593
|
-
},
|
|
593
|
+
}, Re = (r) => `radial-gradient(circle, ${N(r.stops)})`, De = (r) => {
|
|
594
594
|
const e = N(r.stops);
|
|
595
595
|
return `conic-gradient(from ${r.angle}deg, ${e})`;
|
|
596
|
-
},
|
|
596
|
+
}, Ue = (r) => {
|
|
597
597
|
const e = N(r.stops);
|
|
598
598
|
return `linear-gradient(${r.angle}deg, ${e})`;
|
|
599
|
-
},
|
|
599
|
+
}, R = (r) => typeof r == "string" ? r : r.type === "linear" ? Ae(r) : r.type === "radial" ? Re(r) : r.type === "conic" ? De(r) : r.type === "diamond" ? Ue(r) : "", Q = (r, e) => Object.keys(r).reduce(
|
|
600
600
|
(o, t) => {
|
|
601
601
|
const s = r[t], n = e ? `${e}-${t}` : t;
|
|
602
602
|
if (s && typeof s == "object" && "type" in s && "value" in s) {
|
|
603
|
-
const i = Object.keys(s.value), l = i.length > 1 ? s.value : s.value[i[0]],
|
|
604
|
-
(
|
|
605
|
-
...
|
|
606
|
-
[f]:
|
|
603
|
+
const i = Object.keys(s.value), l = i.length > 1 ? s.value : s.value[i[0]], c = typeof l == "object" ? Object.keys(l).reduce(
|
|
604
|
+
(d, f) => ({
|
|
605
|
+
...d,
|
|
606
|
+
[f]: R(l[f])
|
|
607
607
|
}),
|
|
608
608
|
{}
|
|
609
|
-
) :
|
|
610
|
-
return { ...o, ...
|
|
609
|
+
) : R(l), u = { [n]: c };
|
|
610
|
+
return { ...o, ...u };
|
|
611
611
|
}
|
|
612
|
-
const a =
|
|
612
|
+
const a = Q(s, n);
|
|
613
613
|
return { ...o, ...a };
|
|
614
614
|
},
|
|
615
615
|
{}
|
|
@@ -622,7 +622,7 @@ export { colors, type ColorsKeysType };
|
|
|
622
622
|
}
|
|
623
623
|
const n = X(s, e);
|
|
624
624
|
return n ? { ...o, [t]: n } : o;
|
|
625
|
-
}, {}),
|
|
625
|
+
}, {}), Jt = ({ input: r = {}, output: { dir: e } }) => ({
|
|
626
626
|
name: "colors/tokenManager",
|
|
627
627
|
executor: async ({ tokenManagerClient: o }) => {
|
|
628
628
|
try {
|
|
@@ -639,12 +639,12 @@ export { colors, type ColorsKeysType };
|
|
|
639
639
|
}
|
|
640
640
|
if (t != null && t.length) {
|
|
641
641
|
console.log(`[colors/tokenManager] Processing ${t.length} variable groups...`);
|
|
642
|
-
const l = t.map((
|
|
642
|
+
const l = t.map((c) => a[c]).filter(Boolean);
|
|
643
643
|
n.push(...l);
|
|
644
644
|
}
|
|
645
645
|
const i = n.map((l) => X(l, o)).flatMap(
|
|
646
|
-
(l) => Object.entries(
|
|
647
|
-
(
|
|
646
|
+
(l) => Object.entries(Q(l, "")).reduce(
|
|
647
|
+
(c, [u, d]) => [...c, { name: u, value: d }],
|
|
648
648
|
[]
|
|
649
649
|
)
|
|
650
650
|
);
|
|
@@ -682,11 +682,11 @@ ${t}
|
|
|
682
682
|
|
|
683
683
|
export const conatinerClassName = styles.container;
|
|
684
684
|
export const conatinerTabletClassName = styles.containerTablet;
|
|
685
|
-
`,
|
|
686
|
-
await
|
|
685
|
+
`, D = async (r, e, o) => {
|
|
686
|
+
await y.delete(r, o), await y.write(r, e, { directory: o });
|
|
687
687
|
}, ze = async ({ containerTokens: r, dir: e, layer: o }) => {
|
|
688
688
|
const t = We(r, o), s = Ie();
|
|
689
|
-
await
|
|
689
|
+
await D("styles.module.css", t, e), await D("index.ts", s, e);
|
|
690
690
|
}, Ge = (r) => {
|
|
691
691
|
const e = r.trim().toLowerCase();
|
|
692
692
|
return e === "0" || e === "0px";
|
|
@@ -694,21 +694,21 @@ export const conatinerTabletClassName = styles.containerTablet;
|
|
|
694
694
|
const i = r[a];
|
|
695
695
|
if (!i || !("value" in i) || !Array.isArray(i.value))
|
|
696
696
|
return n;
|
|
697
|
-
const l = i.value.find((
|
|
697
|
+
const l = i.value.find((u) => u.pattern === "columns");
|
|
698
698
|
if (!(l != null && l.offset))
|
|
699
699
|
return n;
|
|
700
|
-
const
|
|
701
|
-
return !
|
|
700
|
+
const c = e.resolveVariableValueString(l.offset);
|
|
701
|
+
return !c || typeof c != "string" || Ge(c) ? n : [
|
|
702
702
|
...n,
|
|
703
703
|
{
|
|
704
704
|
breakpoint: Number(a),
|
|
705
|
-
offset:
|
|
705
|
+
offset: c
|
|
706
706
|
}
|
|
707
707
|
];
|
|
708
708
|
}, []).reduce((n, a) => {
|
|
709
709
|
const i = n[n.length - 1];
|
|
710
710
|
return i && x(i.offset, a.offset) || n.push(a), n;
|
|
711
|
-
}, []),
|
|
711
|
+
}, []), qt = ({
|
|
712
712
|
input: r = {},
|
|
713
713
|
output: { dir: e }
|
|
714
714
|
}) => ({
|
|
@@ -740,14 +740,14 @@ export const conatinerTabletClassName = styles.containerTablet;
|
|
|
740
740
|
throw console.error("[container/tokenManager] ❌ Failed to generate container:", s), t instanceof Error && t.stack && console.error("[container/tokenManager] Stack trace:", t.stack), t;
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
|
-
}), qe = "styles.css", He = "index.ts",
|
|
743
|
+
}), qe = "styles.css", He = "index.ts", U = (r, e) => {
|
|
744
744
|
if (!e.length) return "";
|
|
745
745
|
const o = e.map((t) => ` ${t}`).join(`
|
|
746
746
|
`);
|
|
747
747
|
return `${r} {
|
|
748
748
|
${o}
|
|
749
749
|
}`;
|
|
750
|
-
},
|
|
750
|
+
}, Ze = (r) => `.${r.replace(/\s+/g, "-").toLowerCase()}`, Y = (r) => `--${r}`, Qe = ({ offsetX: r, offsetY: e, blur: o, spread: t, color: s }) => `${r} ${e} ${o} ${t} ${s}`, Xe = (r) => r.reduce(
|
|
751
751
|
(e, o) => {
|
|
752
752
|
const t = Y(o.name);
|
|
753
753
|
return typeof o.value != "object" ? (e.root.push(`${t}: ${o.value};`), e) : Object.entries(o.value).reduce((s, [n, a]) => {
|
|
@@ -757,9 +757,9 @@ ${o}
|
|
|
757
757
|
},
|
|
758
758
|
{ root: [] }
|
|
759
759
|
), Ye = (r) => {
|
|
760
|
-
const e =
|
|
760
|
+
const e = U(".shadow-variables", r.root), o = Object.entries(r).reduce((t, [s, n]) => {
|
|
761
761
|
if (s === "root" || !n.length) return t;
|
|
762
|
-
const a =
|
|
762
|
+
const a = U(Ze(`${s}-shadow-variables`), n);
|
|
763
763
|
return a && t.push(a), t;
|
|
764
764
|
}, []).join(`
|
|
765
765
|
|
|
@@ -780,8 +780,8 @@ export { shadows, type ShadowsKeysType };
|
|
|
780
780
|
cssContent: e,
|
|
781
781
|
dir: o
|
|
782
782
|
}) => {
|
|
783
|
-
await
|
|
784
|
-
const t =
|
|
783
|
+
await y.delete(o);
|
|
784
|
+
const t = y.write(He, r, { directory: o }), s = y.write(qe, e, { directory: o });
|
|
785
785
|
await Promise.all([t, s]);
|
|
786
786
|
}, tt = async ({ shadowTokens: r, dir: e }) => {
|
|
787
787
|
const o = Xe(r), t = Ye(o), s = _e(r);
|
|
@@ -791,7 +791,7 @@ export { shadows, type ShadowsKeysType };
|
|
|
791
791
|
const s = r[t], n = e ? `${e}-${t}` : t;
|
|
792
792
|
if (s && typeof s == "object" && "type" in s && "value" in s) {
|
|
793
793
|
const i = {
|
|
794
|
-
[n]: s.value.map(
|
|
794
|
+
[n]: s.value.map(Qe).join(", ")
|
|
795
795
|
};
|
|
796
796
|
return { ...o, ...i };
|
|
797
797
|
}
|
|
@@ -799,7 +799,7 @@ export { shadows, type ShadowsKeysType };
|
|
|
799
799
|
return { ...o, ...a };
|
|
800
800
|
},
|
|
801
801
|
{}
|
|
802
|
-
),
|
|
802
|
+
), Ht = ({ input: r = {}, output: { dir: e } }) => ({
|
|
803
803
|
name: "shadows/tokenManager",
|
|
804
804
|
executor: async ({ tokenManagerClient: o }) => {
|
|
805
805
|
try {
|
|
@@ -816,7 +816,7 @@ export { shadows, type ShadowsKeysType };
|
|
|
816
816
|
}
|
|
817
817
|
const n = s.flatMap(
|
|
818
818
|
(a) => Object.entries(_(a, "")).reduce(
|
|
819
|
-
(i, [l,
|
|
819
|
+
(i, [l, c]) => [...i, { name: l, value: c }],
|
|
820
820
|
[]
|
|
821
821
|
)
|
|
822
822
|
);
|
|
@@ -850,7 +850,7 @@ ${o}
|
|
|
850
850
|
}, T = (r, e) => {
|
|
851
851
|
const o = {};
|
|
852
852
|
return Object.entries(r).forEach(([t, s]) => {
|
|
853
|
-
const n = t === "fontFamily" ? ee(s, e) : s, a = t.replace(/([A-Z])/g, "-$1")
|
|
853
|
+
const n = t === "fontFamily" ? ee(s, e) : s, a = t.replace(/([A-Z])/g, "-$1");
|
|
854
854
|
o[a] = n;
|
|
855
855
|
}), o;
|
|
856
856
|
}, nt = (r, e, o) => {
|
|
@@ -933,26 +933,26 @@ ${o}
|
|
|
933
933
|
j(r, e, o, t);
|
|
934
934
|
return;
|
|
935
935
|
}
|
|
936
|
-
const l = T(e.value.base, t),
|
|
937
|
-
if (
|
|
936
|
+
const l = T(e.value.base, t), c = T(a.typography, t), u = T(i.typography, t), d = a.width / 16, f = i.width / 16;
|
|
937
|
+
if (d === f) {
|
|
938
938
|
j(r, e, o, t);
|
|
939
939
|
return;
|
|
940
940
|
}
|
|
941
941
|
r.base[e.name] = {
|
|
942
942
|
...l,
|
|
943
|
-
...
|
|
943
|
+
...c
|
|
944
944
|
};
|
|
945
945
|
const m = s.reduce((g, h) => {
|
|
946
|
-
const b =
|
|
946
|
+
const b = c[h], S = u[h];
|
|
947
947
|
if (b === void 0 || S === void 0 || b === S)
|
|
948
948
|
return g;
|
|
949
949
|
const E = J(b), B = J(S);
|
|
950
950
|
return E === null || B === null ? g : {
|
|
951
951
|
...g,
|
|
952
|
-
[h]: it({ minValueRem: B, maxValueRem: E, minVwRem: f, maxVwRem:
|
|
952
|
+
[h]: it({ minValueRem: B, maxValueRem: E, minVwRem: f, maxVwRem: d })
|
|
953
953
|
};
|
|
954
954
|
}, {});
|
|
955
|
-
P(r, a.width, e.name, m), P(r, i.width, e.name,
|
|
955
|
+
P(r, a.width, e.name, m), P(r, i.width, e.name, u);
|
|
956
956
|
}, ct = (r, e, o, t) => {
|
|
957
957
|
if (!t) return at(r, e, o);
|
|
958
958
|
const s = r.reduce((n, a) => (lt(n, a, e, o), n), te());
|
|
@@ -991,8 +991,8 @@ export { typography };
|
|
|
991
991
|
cssContent: o,
|
|
992
992
|
dir: t
|
|
993
993
|
}) => {
|
|
994
|
-
await
|
|
995
|
-
const s =
|
|
994
|
+
await y.delete(t);
|
|
995
|
+
const s = y.write(ot, r, { directory: t }), n = y.write(st, e, { directory: t }), a = y.write(rt, o, { directory: t });
|
|
996
996
|
await Promise.all([s, n, a]);
|
|
997
997
|
}, ft = async ({
|
|
998
998
|
typographyTokens: r,
|
|
@@ -1010,16 +1010,16 @@ export { typography };
|
|
|
1010
1010
|
return { ...t, [s]: oe(n, e, o) };
|
|
1011
1011
|
if (n.type !== "typography") return t;
|
|
1012
1012
|
const a = n.value, i = Object.entries(a).reduce(
|
|
1013
|
-
(l, [
|
|
1014
|
-
const
|
|
1015
|
-
if (
|
|
1016
|
-
|
|
1017
|
-
const m = e.resolveVariableValueString(
|
|
1018
|
-
m && (m ===
|
|
1013
|
+
(l, [c, u]) => {
|
|
1014
|
+
const d = Object.keys(o.breakpoints);
|
|
1015
|
+
if (d.length)
|
|
1016
|
+
d.forEach((f) => {
|
|
1017
|
+
const m = e.resolveVariableValueString(u, f);
|
|
1018
|
+
m && (m === u ? l.base = { ...l.base, [c]: m } : l.breakpoints[f] = { ...l.breakpoints[f], [c]: m });
|
|
1019
1019
|
});
|
|
1020
1020
|
else {
|
|
1021
|
-
const f = e.resolveVariableValueString(
|
|
1022
|
-
f && (l.base = { ...l.base, [
|
|
1021
|
+
const f = e.resolveVariableValueString(u);
|
|
1022
|
+
f && (l.base = { ...l.base, [c]: f });
|
|
1023
1023
|
}
|
|
1024
1024
|
return l;
|
|
1025
1025
|
},
|
|
@@ -1032,7 +1032,7 @@ export { typography };
|
|
|
1032
1032
|
return { ...o, ...se(n, s) };
|
|
1033
1033
|
const a = n.value;
|
|
1034
1034
|
return { ...o, [s]: a };
|
|
1035
|
-
}, {}),
|
|
1035
|
+
}, {}), Zt = ({ input: r, output: { dir: e } }) => ({
|
|
1036
1036
|
name: "typography/tokenManager",
|
|
1037
1037
|
executor: async ({ tokenManagerClient: o }) => {
|
|
1038
1038
|
try {
|
|
@@ -1043,20 +1043,20 @@ export { typography };
|
|
|
1043
1043
|
const a = [], i = o.getStyles();
|
|
1044
1044
|
console.log("[typography/tokenManager] Processing styles for typography..."), i.text && a.push(i.text);
|
|
1045
1045
|
const l = a.reduce(
|
|
1046
|
-
(
|
|
1047
|
-
...
|
|
1048
|
-
...oe(
|
|
1046
|
+
(u, d) => ({
|
|
1047
|
+
...u,
|
|
1048
|
+
...oe(d, o, { breakpoints: r.breakpoints })
|
|
1049
1049
|
}),
|
|
1050
1050
|
{}
|
|
1051
|
-
),
|
|
1052
|
-
([
|
|
1051
|
+
), c = Object.entries(se(l)).map(
|
|
1052
|
+
([u, d]) => ({ name: u, value: d })
|
|
1053
1053
|
);
|
|
1054
|
-
if (
|
|
1054
|
+
if (c.length === 0) {
|
|
1055
1055
|
console.warn("[typography/tokenManager] No typography tokens generated");
|
|
1056
1056
|
return;
|
|
1057
1057
|
}
|
|
1058
|
-
console.log(`[typography/tokenManager] Generated ${
|
|
1059
|
-
typographyTokens:
|
|
1058
|
+
console.log(`[typography/tokenManager] Generated ${c.length} typography tokens`), console.log(`[typography/tokenManager] Writing files to ${e}...`), await ft({
|
|
1059
|
+
typographyTokens: c,
|
|
1060
1060
|
dir: e,
|
|
1061
1061
|
breakpoints: t,
|
|
1062
1062
|
fontFamily: s || {},
|
|
@@ -1106,7 +1106,7 @@ export { typography };
|
|
|
1106
1106
|
variableNamePrefix: t,
|
|
1107
1107
|
variablesClassName: s
|
|
1108
1108
|
};
|
|
1109
|
-
}, le = (r, e) => `${ie(r).variableNamePrefix}-${e}`,
|
|
1109
|
+
}, le = (r, e) => `${ie(r).variableNamePrefix}-${e}`, Qt = (r, e) => `--${le(r, e)}`, St = (r) => `--${r}`, ce = (r, e, o) => {
|
|
1110
1110
|
const t = le(r.variablePath, o);
|
|
1111
1111
|
if (!e.parseCssVariableName)
|
|
1112
1112
|
return t;
|
|
@@ -1125,25 +1125,25 @@ export { typography };
|
|
|
1125
1125
|
), jt = (r, e, o) => {
|
|
1126
1126
|
const { breakpoints: t } = e, s = ce(e, o, r.flatName), n = St(s), a = kt(t);
|
|
1127
1127
|
if (Object.keys(t).length === 0 || a.length === 0) {
|
|
1128
|
-
const
|
|
1129
|
-
return { base: { [n]:
|
|
1128
|
+
const u = Object.values(r.resolvedByMode)[0] ?? "";
|
|
1129
|
+
return { base: { [n]: u }, byBreakpoint: {} };
|
|
1130
1130
|
}
|
|
1131
|
-
const i = a.filter((
|
|
1131
|
+
const i = a.filter((u) => u.mode in r.resolvedByMode);
|
|
1132
1132
|
if (i.length === 0) {
|
|
1133
|
-
const
|
|
1134
|
-
return { base: { [n]:
|
|
1133
|
+
const u = Object.values(r.resolvedByMode)[0] ?? "";
|
|
1134
|
+
return { base: { [n]: u }, byBreakpoint: {} };
|
|
1135
1135
|
}
|
|
1136
1136
|
if (i.length === 1) {
|
|
1137
|
-
const
|
|
1138
|
-
return { base: { [n]:
|
|
1137
|
+
const u = i[0], d = r.resolvedByMode[u.mode] ?? "";
|
|
1138
|
+
return { base: { [n]: d }, byBreakpoint: {} };
|
|
1139
1139
|
}
|
|
1140
|
-
const l = r.resolvedByMode[i[0].mode] ?? "",
|
|
1141
|
-
const m = i[f].mode, g = r.resolvedByMode[m], h = r.resolvedByMode[
|
|
1142
|
-
if (h === void 0 || h === g) return
|
|
1143
|
-
const b =
|
|
1144
|
-
return { ...
|
|
1140
|
+
const l = r.resolvedByMode[i[0].mode] ?? "", c = i.slice(1).reduce((u, d, f) => {
|
|
1141
|
+
const m = i[f].mode, g = r.resolvedByMode[m], h = r.resolvedByMode[d.mode];
|
|
1142
|
+
if (h === void 0 || h === g) return u;
|
|
1143
|
+
const b = d.widthPx, S = u[b] ?? {};
|
|
1144
|
+
return { ...u, [b]: { ...S, [n]: h } };
|
|
1145
1145
|
}, {});
|
|
1146
|
-
return { base: { [n]: l }, byBreakpoint:
|
|
1146
|
+
return { base: { [n]: l }, byBreakpoint: c };
|
|
1147
1147
|
}, vt = (r, e, o) => r.reduce(
|
|
1148
1148
|
(t, s) => {
|
|
1149
1149
|
const { base: n, byBreakpoint: a } = jt(s, e, o);
|
|
@@ -1155,10 +1155,10 @@ export { typography };
|
|
|
1155
1155
|
{ base: {}, breakpoints: {} }
|
|
1156
1156
|
), Nt = (r, e, o) => {
|
|
1157
1157
|
if (!r.length) return "";
|
|
1158
|
-
const { variablesClassName: t } = $t(e, o), s = vt(r, e, o), n = Object.keys(s.base).map((l) => ` ${l}: ${s.base[l]};`), a = W(`.${t}`, n), i = Object.keys(s.breakpoints).map(Number).sort((l,
|
|
1159
|
-
const
|
|
1158
|
+
const { variablesClassName: t } = $t(e, o), s = vt(r, e, o), n = Object.keys(s.base).map((l) => ` ${l}: ${s.base[l]};`), a = W(`.${t}`, n), i = Object.keys(s.breakpoints).map(Number).sort((l, c) => c - l).map((l) => {
|
|
1159
|
+
const c = s.breakpoints[l], u = Object.keys(c).map((f) => ` ${f}: ${c[f]};`), d = W(`.${t}`, u);
|
|
1160
1160
|
return `@media (max-width: ${l}px) {
|
|
1161
|
-
${
|
|
1161
|
+
${d}
|
|
1162
1162
|
}`;
|
|
1163
1163
|
}).filter(Boolean).join(`
|
|
1164
1164
|
|
|
@@ -1179,7 +1179,15 @@ ${i}` : a;
|
|
|
1179
1179
|
defaultKey: t
|
|
1180
1180
|
});
|
|
1181
1181
|
return s.trim() ? s : t;
|
|
1182
|
-
}, Vt =
|
|
1182
|
+
}, Vt = /^[A-Za-z_$][A-Za-z0-9_$]*$/, Ft = (r) => {
|
|
1183
|
+
var t;
|
|
1184
|
+
const o = ((t = r.utilityKeysTypeName) == null ? void 0 : t.trim()) || "UtilitiesKeysType";
|
|
1185
|
+
if (!Vt.test(o))
|
|
1186
|
+
throw new Error(
|
|
1187
|
+
`Invalid utilityKeysTypeName: "${o}". Expected a valid TypeScript identifier.`
|
|
1188
|
+
);
|
|
1189
|
+
return o;
|
|
1190
|
+
}, xt = (r, e, o) => r.reduce((t, s) => {
|
|
1183
1191
|
const n = Ct(e, o, s.flatName), a = t[n];
|
|
1184
1192
|
if (a && a !== s.flatName)
|
|
1185
1193
|
throw new Error(
|
|
@@ -1189,51 +1197,51 @@ ${i}` : a;
|
|
|
1189
1197
|
...t,
|
|
1190
1198
|
[n]: s.flatName
|
|
1191
1199
|
};
|
|
1192
|
-
}, {}),
|
|
1193
|
-
var
|
|
1194
|
-
const t =
|
|
1195
|
-
const
|
|
1200
|
+
}, {}), Pt = (r, e, o) => {
|
|
1201
|
+
var c;
|
|
1202
|
+
const t = xt(r, e, o), s = Object.keys(t).reduce((u, d) => {
|
|
1203
|
+
const f = t[d];
|
|
1196
1204
|
return {
|
|
1197
1205
|
...u,
|
|
1198
|
-
[
|
|
1206
|
+
[d]: ce(e, o, f)
|
|
1199
1207
|
};
|
|
1200
|
-
}, {}), n = JSON.stringify(s, null, 4), i = ((
|
|
1208
|
+
}, {}), n = JSON.stringify(s, null, 4), i = ((c = o.getUtilityCssVarFunctionName) == null ? void 0 : c.trim()) || "getUtilityCssVar", l = Ft(o);
|
|
1201
1209
|
return [
|
|
1202
1210
|
`const utilityVariableNameByKey = ${n} as const;`,
|
|
1203
1211
|
"",
|
|
1204
|
-
|
|
1212
|
+
`type ${l} = keyof typeof utilityVariableNameByKey;`,
|
|
1205
1213
|
"",
|
|
1206
|
-
|
|
1214
|
+
`const getUtilityCssVariableName = (key: ${l}): string =>`,
|
|
1207
1215
|
" `--${utilityVariableNameByKey[key]}`;",
|
|
1208
1216
|
"",
|
|
1209
|
-
`const ${i} = (key:
|
|
1217
|
+
`const ${i} = (key: ${l}): string =>`,
|
|
1210
1218
|
" `var(${getUtilityCssVariableName(key)})`;",
|
|
1211
1219
|
"",
|
|
1212
1220
|
"export {",
|
|
1213
1221
|
" getUtilityCssVariableName,",
|
|
1214
1222
|
` ${i},`,
|
|
1215
|
-
|
|
1223
|
+
` type ${l},`,
|
|
1216
1224
|
"};",
|
|
1217
1225
|
""
|
|
1218
1226
|
].join(`
|
|
1219
1227
|
`);
|
|
1220
|
-
},
|
|
1228
|
+
}, Ot = "styles.css", Et = "index.ts", Bt = async ({
|
|
1221
1229
|
dir: r,
|
|
1222
1230
|
globalCss: e,
|
|
1223
1231
|
indexTs: o
|
|
1224
1232
|
}) => {
|
|
1225
|
-
await
|
|
1226
|
-
|
|
1227
|
-
|
|
1233
|
+
await y.delete(r), await Promise.all([
|
|
1234
|
+
y.write(Ot, e, { directory: r }),
|
|
1235
|
+
y.write(Et, o, { directory: r })
|
|
1228
1236
|
]);
|
|
1229
|
-
},
|
|
1237
|
+
}, Kt = async ({
|
|
1230
1238
|
tokens: r,
|
|
1231
1239
|
input: e,
|
|
1232
1240
|
output: o
|
|
1233
1241
|
}) => {
|
|
1234
|
-
const { dir: t } = o, s = Nt(r, e, o), n =
|
|
1235
|
-
await
|
|
1236
|
-
},
|
|
1242
|
+
const { dir: t } = o, s = Nt(r, e, o), n = Pt(r, e, o);
|
|
1243
|
+
await Bt({ dir: t, globalCss: s, indexTs: n });
|
|
1244
|
+
}, Xt = ({ input: r, output: e }) => ({
|
|
1237
1245
|
name: "utilities/tokenManager",
|
|
1238
1246
|
executor: async ({ tokenManagerClient: o }) => {
|
|
1239
1247
|
var t;
|
|
@@ -1247,7 +1255,7 @@ ${i}` : a;
|
|
|
1247
1255
|
) : console.warn(`[utilities/tokenManager] No dimension tokens found at path "${r.variablePath}"`);
|
|
1248
1256
|
return;
|
|
1249
1257
|
}
|
|
1250
|
-
console.log(`[utilities/tokenManager] Resolved ${i.length} utility token(s)`), console.log(`[utilities/tokenManager] Writing files to ${e.dir}...`), await
|
|
1258
|
+
console.log(`[utilities/tokenManager] Resolved ${i.length} utility token(s)`), console.log(`[utilities/tokenManager] Writing files to ${e.dir}...`), await Kt({ tokens: i, input: r, output: e }), console.log("[utilities/tokenManager] ✅ Successfully generated utility files");
|
|
1251
1259
|
} catch (s) {
|
|
1252
1260
|
const n = s instanceof Error ? s.message : String(s);
|
|
1253
1261
|
throw console.error("[utilities/tokenManager] ❌ Failed to generate utilities:", n), s instanceof Error && s.stack && console.error("[utilities/tokenManager] Stack trace:", s.stack), s;
|
|
@@ -1257,27 +1265,27 @@ ${i}` : a;
|
|
|
1257
1265
|
export {
|
|
1258
1266
|
we as BREAKPOINTS_NAMES,
|
|
1259
1267
|
be as TokenManager,
|
|
1260
|
-
|
|
1268
|
+
Gt as breakpointsFromTokenManager,
|
|
1261
1269
|
Nt as buildUtilitiesGlobalStylesCSS,
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1270
|
+
Pt as buildUtilitiesIndexTSContent,
|
|
1271
|
+
Jt as colorsFromTokenManager,
|
|
1272
|
+
qt as containerFromTokenManager,
|
|
1265
1273
|
ie as deriveUtilityNamingFromVariablePath,
|
|
1266
1274
|
wt as filterResolvedUtilitiesByInclude,
|
|
1267
|
-
|
|
1268
|
-
|
|
1275
|
+
It as generate,
|
|
1276
|
+
Kt as generateUtilitiesFiles,
|
|
1269
1277
|
kt as getSortedBreakpointModes,
|
|
1270
|
-
|
|
1278
|
+
Qt as getUtilityCssVariableName,
|
|
1271
1279
|
le as getUtilityCssVariableNameWithoutDashes,
|
|
1272
1280
|
ht as getVariablesSubtree,
|
|
1273
|
-
|
|
1281
|
+
zt as init,
|
|
1274
1282
|
mt as resolveUtilitiesSubtree,
|
|
1275
1283
|
ce as resolveUtilityCssVariableNameWithoutDashes,
|
|
1276
1284
|
$t as resolveUtilityNaming,
|
|
1277
|
-
|
|
1285
|
+
Ht as shadowsFromTokenManager,
|
|
1278
1286
|
jt as splitUtilityTokenForMedia,
|
|
1279
|
-
|
|
1280
|
-
|
|
1287
|
+
Zt as typographyFromTokenManager,
|
|
1288
|
+
Xt as utilitiesFromTokenManager,
|
|
1281
1289
|
bt as utilityFlatNameMatchesIncludePattern,
|
|
1282
|
-
|
|
1290
|
+
Bt as writeUtilitiesFiles
|
|
1283
1291
|
};
|
|
@@ -59,6 +59,11 @@ export interface IUtilitiesOutput {
|
|
|
59
59
|
* Если не задано — `getUtilityCssVar`.
|
|
60
60
|
*/
|
|
61
61
|
getUtilityCssVarFunctionName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Имя экспортируемого типа ключей utilities в сгенерированном `index.ts`.
|
|
64
|
+
* Если не задано — `UtilitiesKeysType`.
|
|
65
|
+
*/
|
|
66
|
+
utilityKeysTypeName?: string;
|
|
62
67
|
}
|
|
63
68
|
/**
|
|
64
69
|
* `input` — данные токенов и семантика CSS; `output` — каталог вывода.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/utilities/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAEpF,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,YAAY,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,yGAAyG;IACzG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACvB,KAAK,MAAM,CAAC;IACb;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACtB,KAAK,MAAM,CAAC;IACb;;;OAGG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../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