@sugarcube-org/core 0.0.1-alpha.1 → 0.0.1-alpha.2

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +220 -113
  2. package/dist/index.js +12 -6
  3. package/package.json +10 -2
package/dist/index.d.ts CHANGED
@@ -1,3 +1,52 @@
1
+ type Files = Record<string, string>;
2
+ type CollectionMode = {
3
+ name: string;
4
+ files: string[];
5
+ };
6
+ type Collection = {
7
+ name: string;
8
+ modes?: CollectionMode[];
9
+ files?: string[];
10
+ };
11
+ type ColorFormat = StandardColorFormat | FeatureDependentColorFormat;
12
+ type StandardColorFormat = {
13
+ name: "hex" | "rgb" | "hsl";
14
+ };
15
+ type FeatureDependentColorFormat = {
16
+ name: "p3";
17
+ featureQuery: string;
18
+ };
19
+ type ColorFormatConverter = {
20
+ type: "standard" | "conditional";
21
+ convert: (r: number, g: number, b: number, a: number) => string;
22
+ featureQuery?: string;
23
+ };
24
+ type ColorConfig = {
25
+ format: ColorFormat;
26
+ converter?: ColorFormatConverter;
27
+ };
28
+ type ViewportDimension = {
29
+ value: number;
30
+ unit: "px" | "rem";
31
+ };
32
+ type FluidConfig = {
33
+ viewports: {
34
+ min: ViewportDimension;
35
+ max: ViewportDimension;
36
+ };
37
+ };
38
+ type OutputConfig = {
39
+ directory?: string;
40
+ separate?: boolean;
41
+ };
42
+ type SugarcubeConfig = {
43
+ files: Files;
44
+ collections?: Collection[];
45
+ fluid?: FluidConfig;
46
+ color?: ColorConfig;
47
+ output?: OutputConfig;
48
+ };
49
+
1
50
  type Color = string;
2
51
  type Dimension = {
3
52
  value: number;
@@ -15,9 +64,8 @@ type FontWeightString = "thin" | "hairline" | "extra-light" | "ultra-light" | "l
15
64
  type LineCap = "round" | "butt" | "square";
16
65
  type TokenType = SimpleTokenType | CompositeTokenType;
17
66
  type SimpleTokenType = "color" | "dimension" | "fluidDimension" | "duration" | "cubicBezier" | "fontFamily" | "fontWeight" | "number";
18
- type CompositeTokenType = AlwaysDecomposedType | OptionallyDecomposedType | StructuralCompositeType;
67
+ type CompositeTokenType = AlwaysDecomposedType | "border" | "shadow" | "gradient" | "transition" | StructuralCompositeType;
19
68
  type AlwaysDecomposedType = "typography";
20
- type OptionallyDecomposedType = "border" | "shadow" | "gradient" | "transition";
21
69
  type StructuralCompositeType = "strokeStyle";
22
70
  type Reference<T extends TokenType = TokenType> = string & {
23
71
  __tokenType?: T;
@@ -47,7 +95,7 @@ type StrokeStyle = StrokeStyleKeyword | StrokeStyleCustom;
47
95
  type Border = {
48
96
  color: TokenValue<"color">;
49
97
  width: TokenValue<"dimension">;
50
- style: StrokeStyle;
98
+ style: StrokeStyle | Reference<"strokeStyle">;
51
99
  };
52
100
  type ShadowObject = {
53
101
  color: TokenValue<"color">;
@@ -63,34 +111,9 @@ type GradientStop = {
63
111
  position: number;
64
112
  };
65
113
  type Gradient = GradientStop[];
66
- type TokenMetadata = {
67
- $description?: string;
68
- $extensions?: SugarcubeExtensions;
69
- };
70
- type SugarcubeExtensions = {
71
- "com.sugarcube": {
72
- color?: ColorMetadata;
73
- fluid?: FluidMetadata;
74
- };
75
- };
76
- type ColorMetadata = {
77
- format: ColorFormatName;
78
- };
79
- type FluidMetadata = {
80
- viewports: {
81
- min: Dimension;
82
- max: Dimension;
83
- };
84
- };
85
- type ColorFormatName = "hex" | "rgb" | "hsl" | "p3";
86
- type MetadataMap = {
87
- root: TokenMetadata;
88
- groups: Record<string, TokenMetadata>;
89
- tokens: Record<string, TokenMetadata>;
90
- };
91
- type CSSProperties<T extends TokenType> = T extends SimpleTokenType ? SimpleCSSProperties : T extends AlwaysDecomposedType ? AlwaysDecomposedProperties : T extends OptionallyDecomposedType ? OptionallyDecomposedProperties<T> : T extends StructuralCompositeType ? SimpleCSSProperties : never;
114
+ type CSSProperties<T extends TokenType> = T extends SimpleTokenType ? SimpleCSSProperties : T extends AlwaysDecomposedType ? AlwaysDecomposedProperties : T extends StructuralCompositeType ? SimpleCSSProperties : never;
92
115
  type SimpleCSSProperties = {
93
- value: string | number;
116
+ value: string;
94
117
  featureValues?: Array<{
95
118
  query: string;
96
119
  value: string;
@@ -104,90 +127,89 @@ type CSSTypographyProperties = {
104
127
  "letter-spacing"?: string;
105
128
  "line-height"?: number | string;
106
129
  };
107
- type OptionallyDecomposedProperties<T extends OptionallyDecomposedType> = T extends "border" ? CSSBorderProperties : T extends "shadow" ? CSSShadowProperties : T extends "gradient" ? CSSGradientProperties : T extends "transition" ? CSSTransitionProperties : never;
108
- type CSSBorderProperties = {
109
- value: string;
110
- split?: {
111
- width: string;
112
- style: string;
113
- color: string;
114
- };
115
- };
116
- type CSSShadowProperties = {
117
- value: string;
118
- split?: CSSShadowSplitProperties | CSSShadowSplitProperties[];
119
- };
120
- type CSSShadowSplitProperties = {
121
- "offset-x": string;
122
- "offset-y": string;
123
- "blur": string;
124
- "spread": string;
125
- "color": string;
126
- "inset"?: "inset";
127
- };
128
- type CSSGradientProperties = {
129
- value: string;
130
- split?: {
131
- stops: Array<{
132
- color: string;
133
- position: string;
134
- }>;
135
- };
136
- };
137
- type CSSTransitionProperties = {
138
- value: string;
139
- split?: {
140
- "duration": string;
141
- "timing-function": string;
142
- "delay"?: string;
130
+ type NodeMetadata = {
131
+ $description?: string;
132
+ $extensions?: {
133
+ [key: string]: unknown;
143
134
  };
144
135
  };
145
- type BaseToken = TokenMetadata & {
136
+ type Token = NodeMetadata & {
146
137
  $value: TokenValue<TokenType>;
138
+ $type?: TokenType;
147
139
  };
148
- type SelfTypedToken<T extends TokenType = TokenType> = BaseToken & {
149
- $type: T;
140
+ type TokenGroup = {
141
+ [key: string]: Token | TokenGroup;
142
+ } & NodeMetadata & {
143
+ $type?: TokenType;
150
144
  };
151
- type InheritedTypeToken = BaseToken;
152
- type Token<T extends TokenType = TokenType> = SelfTypedToken<T> | InheritedTypeToken;
153
- type UnresolvedToken<T extends TokenType = TokenType> = (SelfTypedToken<T> & {
154
- $path: string;
155
- }) | (InheritedTypeToken & {
145
+ type FlattenedToken<T extends TokenType = TokenType> = NodeMetadata & {
146
+ $type: T;
147
+ $value: TokenValue<T>;
156
148
  $path: string;
157
- });
158
- type ResolvedToken<T extends TokenType = TokenType> = UnresolvedToken<T> & {
149
+ $source: TokenSource;
150
+ $originalPath: string;
151
+ };
152
+ type FlattenedTokens = {
153
+ [lookupKey: TokenLookupKey]: FlattenedToken | NodeMetadata;
154
+ };
155
+ type ValidatedToken<T extends TokenType = TokenType> = FlattenedToken<T>;
156
+ type ResolvedToken<T extends TokenType = TokenType> = ValidatedToken<T> & {
159
157
  $resolvedValue: RawTokenValue<T>;
160
158
  };
159
+ type ResolvedTokens = {
160
+ [lookupKey: TokenLookupKey]: ResolvedToken | NodeMetadata;
161
+ };
161
162
  type ConvertedToken<T extends TokenType = TokenType> = ResolvedToken<T> & {
162
- $type: T;
163
- cssProperties: CSSProperties<T>;
163
+ $cssProperties: CSSProperties<T>;
164
+ };
165
+ type ConvertedTokens = {
166
+ [lookupKey: TokenLookupKey]: ConvertedToken | NodeMetadata;
167
+ };
168
+ type TokenSource = {
169
+ file: string;
164
170
  };
165
171
  type DesignTokens = TokenGroup;
166
- type TokenGroup = {
167
- [key: string]: Token | TokenGroup | string | undefined;
168
- } & TokenMetadata;
169
- type FlattenedTokens = {
170
- [path: string]: UnresolvedToken;
172
+ type TokenTree = {
173
+ name: string;
174
+ tokens: TokenGroup;
171
175
  };
172
- type ResolvedTokens = {
173
- [path: string]: ResolvedToken;
176
+ type BaseError = {
177
+ message: string;
174
178
  };
175
- type ConvertedTokens = {
176
- [path: string]: ConvertedToken;
179
+ type LoadError = BaseError & {
180
+ file: string;
177
181
  };
178
- type ValidationError = {
182
+ type FlattenError = BaseError & {
179
183
  path: string;
180
- message: string;
184
+ source: TokenSource;
185
+ };
186
+ type ValidationError = BaseError & {
187
+ path: string;
188
+ source: TokenSource;
181
189
  };
182
- type ResolutionError = {
190
+ type ResolutionError = BaseError & {
183
191
  type: "circular" | "missing" | "type-mismatch";
184
192
  path: string;
185
- message: string;
193
+ source: TokenSource;
194
+ };
195
+ type NormalizedConvertedTokens = {
196
+ [collection: string]: {
197
+ [mode: string]: ConvertedTokens;
198
+ };
199
+ };
200
+
201
+ type LoadResult = {
202
+ trees: TokenTree[];
203
+ errors: LoadError[];
186
204
  };
205
+ declare function loadTreesFromConfig(files: SugarcubeConfig["files"]): Promise<LoadResult>;
187
206
 
188
- declare function flatten(tree: DesignTokens): {
207
+ declare function flatten(trees: Array<{
208
+ name: string;
209
+ tokens: TokenGroup;
210
+ }>): {
189
211
  tokens: FlattenedTokens;
190
- errors: ValidationError[];
212
+ errors: FlattenError[];
191
213
  };
192
214
 
193
215
  declare function resolve(tokens: FlattenedTokens): {
@@ -195,24 +217,11 @@ declare function resolve(tokens: FlattenedTokens): {
195
217
  errors: ResolutionError[];
196
218
  };
197
219
 
198
- /**
199
- * Converts a set of resolved tokens to CSS-ready converted tokens
200
- * @param tokens - The resolved tokens to convert
201
- * @param metadataMap - Metadata for the token conversion process
202
- * @returns A record of converted tokens with kebab-case keys
203
- * @throws If any token has an unsupported type or is missing required properties
204
- */
205
- declare function convert(tokens: ResolvedTokens, metadataMap: MetadataMap): ConvertedTokens;
206
-
207
- declare function generateCSS(tokens: ConvertedTokens, options?: {
208
- splitTypes?: OptionallyDecomposedType[];
209
- }): Promise<string>;
210
-
211
- type MetadataResult = {
212
- metadata: MetadataMap;
213
- errors: ValidationError[];
214
- };
215
- declare function collectMetadata(tree: DesignTokens): MetadataResult;
220
+ declare function convert(tokens: {
221
+ [collection: string]: {
222
+ [mode: string]: ResolvedTokens;
223
+ };
224
+ }, config: SugarcubeConfig): NormalizedConvertedTokens;
216
225
 
217
226
  /**
218
227
  * This function takes a JSON string representation of a token tree and converts it
@@ -225,6 +234,104 @@ declare function collectMetadata(tree: DesignTokens): MetadataResult;
225
234
  */
226
235
  declare function parseJson(json: string): DesignTokens;
227
236
 
228
- declare function validate(tokens: FlattenedTokens, metadata: MetadataMap): ValidationError[];
237
+ declare function validate(tokens: FlattenedTokens, config: SugarcubeConfig): ValidationError[];
238
+
239
+ type ProcessedTree = {
240
+ name: string;
241
+ tokens: ResolvedTokens;
242
+ };
243
+ declare function processTrees(trees: Pick<TokenTree, "name">[], resolved: ResolvedTokens): ProcessedTree[];
244
+
245
+ type CollectionModes = {
246
+ [mode: string]: ResolvedTokens;
247
+ };
248
+ type NormalizedTokens = {
249
+ default: CollectionModes;
250
+ [collection: string]: CollectionModes;
251
+ };
252
+ type NormalizationError = ValidationError & {
253
+ collection: string;
254
+ mode: string;
255
+ };
256
+ type NormalizationWarning = {
257
+ type: "warning";
258
+ message: string;
259
+ file: string;
260
+ collection: string;
261
+ mode?: string;
262
+ };
263
+ type NormalizeResult = {
264
+ tokens: NormalizedTokens;
265
+ errors: NormalizationError[];
266
+ warnings: NormalizationWarning[];
267
+ };
268
+ declare function normalizeTokens(trees: ProcessedTree[], collections?: SugarcubeConfig["collections"]): NormalizeResult;
269
+
270
+ type GenerationError = {
271
+ path: string;
272
+ message: string;
273
+ };
274
+ type GeneratedOutput = Array<{
275
+ name: string;
276
+ content: string;
277
+ }>;
278
+ type GenerationResult = {
279
+ output: GeneratedOutput;
280
+ errors: GenerationError[];
281
+ };
282
+ declare function generate(tokens: NormalizedConvertedTokens, config?: OutputConfig): Promise<GenerationResult>;
283
+
284
+ type TokensToCSSPipelineResult = {
285
+ output: GeneratedOutput;
286
+ trees: TokenTree[];
287
+ errors: {
288
+ load: LoadError[];
289
+ flatten: FlattenError[];
290
+ validation: ValidationError[];
291
+ resolution: ResolutionError[];
292
+ generation: GenerationError[];
293
+ };
294
+ warnings: {
295
+ normalization: Array<{
296
+ type: "warning";
297
+ message: string;
298
+ file: string;
299
+ collection: string;
300
+ mode?: string;
301
+ }>;
302
+ };
303
+ };
304
+ declare function tokensToCSSPipeline(config: SugarcubeConfig): Promise<TokensToCSSPipelineResult>;
305
+
306
+ type ValidationPipelineErrors = {
307
+ load: LoadError[];
308
+ flatten: FlattenError[];
309
+ validation: ValidationError[];
310
+ resolution: ResolutionError[];
311
+ };
312
+ type ValidationPipelineResult = {
313
+ trees: TokenTree[];
314
+ flattenedTokens: FlattenedTokens;
315
+ resolved: ResolvedTokens;
316
+ errors: ValidationPipelineErrors;
317
+ };
318
+ declare function validationPipeline(config: SugarcubeConfig): Promise<ValidationPipelineResult>;
319
+
320
+ type GenerationPipelineResult = {
321
+ output: GeneratedOutput;
322
+ errors: {
323
+ generation: GenerationError[];
324
+ };
325
+ warnings: {
326
+ normalization: Array<{
327
+ type: "warning";
328
+ message: string;
329
+ file: string;
330
+ collection: string;
331
+ mode?: string;
332
+ }>;
333
+ };
334
+ };
335
+ declare function generationPipeline(trees: TokenTree[], resolved: ResolvedTokens, configState: any): Promise<GenerationPipelineResult>;
229
336
 
230
- export { type MetadataMap, type OptionallyDecomposedType, type ResolutionError, type ResolvedTokens, type ValidationError, collectMetadata, convert, flatten, generateCSS, parseJson, resolve, validate };
337
+ export { type GeneratedOutput, type GenerationResult, type ResolutionError, type ResolvedTokens, type TokenTree, type ValidationError, convert, flatten, generate, generationPipeline, loadTreesFromConfig, normalizeTokens, parseJson, processTrees, resolve, tokensToCSSPipeline, validate, validationPipeline };
package/dist/index.js CHANGED
@@ -1,7 +1,13 @@
1
- var K=Object.defineProperty;var n=(e,t)=>K(e,"name",{value:t,configurable:!0});const c={PARSE:{INVALID_INPUT_TYPE:n(e=>`Invalid input: expected string, got ${e}`,"INVALID_INPUT_TYPE"),JSON_PARSE_ERROR:n(e=>`JSON parsing error: ${e}`,"JSON_PARSE_ERROR")},FLATTEN:{INVALID_TOKEN_NAME:n(e=>`Invalid token name '${e}': cannot contain '.', '{', or '}'`,"INVALID_TOKEN_NAME"),INVALID_NODE_STRUCTURE:n(e=>`Invalid node structure at '${e}': expected object`,"INVALID_NODE_STRUCTURE"),MISSING_INHERITED_TYPE:n(e=>`Token at '${e}' has no type (neither explicit nor inherited)`,"MISSING_INHERITED_TYPE"),UNEXPECTED_ERROR:n(e=>`Unexpected error during flattening: ${e}`,"UNEXPECTED_ERROR")},METADATA:{COLLECTION_ERROR:n(e=>`Error collecting metadata: ${e}`,"COLLECTION_ERROR"),INVALID_EXTENSIONS:n(e=>`Invalid extensions at '${e}': expected object, got ${typeof e}`,"INVALID_EXTENSIONS"),INVALID_DESCRIPTION:n(e=>`Invalid description at '${e}': expected string, got ${typeof e}`,"INVALID_DESCRIPTION")},VALIDATE:{INVALID_TOKEN_STRUCTURE:n(e=>`Invalid token at '${e}'. Each token should have "$type" and "$value" properties`,"INVALID_TOKEN_STRUCTURE"),MISSING_TYPE:n(e=>`Token at '${e}' is missing the "$type" property`,"MISSING_TYPE"),MISSING_VALUE:n(e=>`Token at '${e}' is missing the "$value" property`,"MISSING_VALUE"),UNKNOWN_TOKEN_TYPE:n((e,t)=>`Unknown token type '${e}' at '${t}'. Valid types are: color, dimension, fontFamily, fontWeight, duration, cubicBezier, strokeStyle, border, transition, shadow, gradient, typography`,"UNKNOWN_TOKEN_TYPE"),INVALID_COLOR:n((e,t)=>`Invalid color at '${t}': '${e}'. Color should be a valid hex value`,"INVALID_COLOR"),INVALID_DIMENSION:n((e,t)=>`Invalid dimension at '${t}': ${e}. Dimensions should have a numeric value and unit, like { "value": 16, "unit": "px" }`,"INVALID_DIMENSION"),INVALID_DIMENSION_UNIT:n((e,t)=>`Invalid unit at '${t}': ${e}. Unit must be either "px" or "rem"`,"INVALID_DIMENSION_UNIT"),INVALID_FONT_FAMILY:n((e,t)=>`Invalid font family at '${t}': ${e}. Should be a string or array of strings, like "Arial" or ["Arial", "sans-serif"]`,"INVALID_FONT_FAMILY"),INVALID_FONT_WEIGHT:n((e,t)=>`Invalid font weight at '${t}': ${e}. Should be a number between 1-1000 or a keyword like "thin", "light", "normal", "bold"`,"INVALID_FONT_WEIGHT"),INVALID_DURATION:n((e,t)=>`Invalid duration at '${t}': ${e}. Should be like { "value": 300, "unit": "ms" }`,"INVALID_DURATION"),INVALID_DURATION_UNIT:n((e,t)=>`Invalid unit at '${t}': ${e}. Unit must be "ms" or "s"`,"INVALID_DURATION_UNIT"),INVALID_CUBIC_BEZIER:n((e,t)=>`Invalid cubic bezier at '${t}': ${e}. Should be an array of 4 numbers between 0 and 1`,"INVALID_CUBIC_BEZIER"),INVALID_CUBIC_BEZIER_RANGE:n((e,t)=>`Invalid cubic bezier control points at '${t}': ${e}. X values must be between 0 and 1`,"INVALID_CUBIC_BEZIER_RANGE"),INVALID_STROKE_STYLE:n((e,t)=>`Invalid stroke style at '${t}': ${e}. Should be "solid", "dashed", "dotted", etc.`,"INVALID_STROKE_STYLE"),INVALID_STROKE_LINE_CAP:n((e,t)=>`Invalid line cap at '${t}': ${e}. Should be one of: round, butt, square`,"INVALID_STROKE_LINE_CAP"),INVALID_BORDER:n((e,t)=>`Invalid border at '${t}': ${e}. Should have color, width, and style properties`,"INVALID_BORDER"),INVALID_SHADOW:n((e,t)=>`Invalid shadow at '${t}': ${e}. Should have color, offsetX, offsetY properties (blur and spread are optional)`,"INVALID_SHADOW"),INVALID_SHADOW_INSET:n((e,t)=>`Invalid inset value at '${t}': ${e}. Should be true or false`,"INVALID_SHADOW_INSET"),INVALID_TRANSITION:n((e,t)=>`Invalid transition at '${t}': ${e}. Should have duration, delay, and timingFunction properties`,"INVALID_TRANSITION"),INVALID_GRADIENT:n((e,t)=>`Invalid gradient at '${t}': ${e}. Should be an array of color stops with position values between 0 and 1`,"INVALID_GRADIENT"),INVALID_GRADIENT_STOP_POSITION:n((e,t)=>`Invalid gradient stop position at '${t}': ${e}. Position must be between 0 and 1`,"INVALID_GRADIENT_STOP_POSITION"),INVALID_TYPOGRAPHY:n((e,t)=>`Invalid typography at '${t}': ${e}. Should have fontFamily and fontSize (fontWeight, letterSpacing, and lineHeight are optional)`,"INVALID_TYPOGRAPHY"),MISSING_REQUIRED_PROPERTY:n((e,t)=>`Missing required property '${e}' at '${t}'`,"MISSING_REQUIRED_PROPERTY"),INVALID_NUMBER:n((e,t)=>`Invalid number at '${t}': ${e}. Expected a number value`,"INVALID_NUMBER"),INVALID_ARRAY:n((e,t)=>`Invalid array at '${t}': ${e}. Expected an array value`,"INVALID_ARRAY"),MISSING_FLUID_CONFIG:n(e=>`Missing fluid configuration at root level. Token at '${e}' requires fluid viewport settings`,"MISSING_FLUID_CONFIG"),INVALID_FLUID_DIMENSION:n((e,t)=>`Invalid fluid dimension at '${t}': ${e}. Fluid dimensions should have min and max values, like { "min": { "value": 16, "unit": "px" }, "max": { "value": 24, "unit": "px" } }`,"INVALID_FLUID_DIMENSION"),INVALID_VIEWPORT_CONFIG:n((e,t)=>`Invalid viewport configuration at '${t}': ${e}. Viewport config should have min and max dimension values`,"INVALID_VIEWPORT_CONFIG"),MISMATCHED_UNITS:n((e,t,r)=>`Mismatched units at '${r}': min uses '${e}', max uses '${t}'. Both values must use the same unit`,"MISMATCHED_UNITS"),INVALID_FLUID_VALUE_RANGE:n(e=>`Invalid fluid value range at '${e}': min value must be less than max value`,"INVALID_FLUID_VALUE_RANGE"),INVALID_TOKEN_TYPE:n((e,t,r)=>`Invalid token type at '${r}': expected ${e}, got ${t}`,"INVALID_TOKEN_TYPE"),INVALID_TYPE:n((e,t,r)=>`Expected ${e}, received ${typeof t} at '${r}'`,"INVALID_TYPE"),INVALID_ENUM_VALUE:n((e,t,r)=>`Expected value to be one of [${e.join(", ")}], but got ${String(t)} at ${r}`,"INVALID_ENUM_VALUE")},CONVERT:{UNSUPPORTED_TOKEN_TYPE:n(e=>`Unsupported token type: ${e}. Valid types are: color, dimension, fontFamily, fontWeight, duration, cubicBezier, strokeStyle, border, transition, shadow, gradient, typography`,"UNSUPPORTED_TOKEN_TYPE"),MISSING_FLUID_CONFIG:n(e=>`Missing fluid configuration for token at path: ${e}`,"MISSING_FLUID_CONFIG")},RESOLVE:{CIRCULAR_REFERENCE:n((e,t)=>`Circular reference detected: ${e} -> ${t}`,"CIRCULAR_REFERENCE"),REFERENCE_NOT_FOUND:n((e,t)=>`Reference not found: ${t} in ${e}`,"REFERENCE_NOT_FOUND"),TYPE_MISMATCH:n(e=>`Type mismatch in reference resolution at ${e}`,"TYPE_MISMATCH")},GENERATE:{INVALID_CSS_VALUE:n((e,t)=>`Invalid CSS value for property '${e}': ${t}`,"INVALID_CSS_VALUE")}};function X(e){return O(e)}n(X,"flatten");function O(e,t="",r){const o={},i=[];for(const[s,a]of Object.entries(e)){if(s.startsWith("$"))continue;const u=t?`${t}.${s}`:s;if(s.includes(".")||s.includes("{")||s.includes("}")){i.push({path:s,message:c.FLATTEN.INVALID_TOKEN_NAME(s)});continue}if(typeof a!="object"||a===null){i.push({path:u,message:c.FLATTEN.INVALID_NODE_STRUCTURE(u)});continue}const f="$type"in a?a.$type:r;if("$value"in a){if(!f){i.push({path:u,message:c.FLATTEN.MISSING_INHERITED_TYPE(u)});continue}o[u]={$type:f,$value:a.$value,$path:u}}else{const I=O(a,u,f);Object.assign(o,I.tokens),i.push(...I.errors)}}return{tokens:o,errors:i}}n(O,"processTokens");function l(e){return typeof e=="string"&&e.startsWith("{")&&e.endsWith("}")}n(l,"isReference");function m(e,t,r,o){return typeof t=="string"&&l(t)?Q(e,t,r,o):Array.isArray(t)?t.map(i=>m(e,i,r,o)):typeof t=="object"&&t!==null?Object.entries(t).reduce((s,[a,u])=>({...s,[a]:m(`${e}.${a}`,u,r,o)}),{}):t}n(m,"resolveValue");function Z(e){const t={},r=new Set,o=[];for(const[i,s]of Object.entries(e))try{if(!s.$path)continue;t[s.$path]={...s,$resolvedValue:m(s.$path,s.$value,e,r)}}catch(a){const u=a instanceof Error?a.message:String(a);let f,I;u.includes("Circular reference detected")?(f="circular",I=u):u.includes("Reference not found")?(f="missing",I=u):(f="type-mismatch",I=c.RESOLVE.TYPE_MISMATCH(s.$path)),o.push({type:f,path:s.$path,message:I})}return{resolved:t,errors:o}}n(Z,"resolve");function Q(e,t,r,o){const i=t.slice(1,-1);if(o.has(i))throw new Error(`Circular reference detected: ${e} -> ${i}`);const s=r[i];if(!s)throw new Error(`Reference not found: ${i} in ${e}`);o.add(i);const a=m(i,s.$value,r,o);return o.delete(i),a}n(Q,"resolveReferenceChain");function y(e){return["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"].includes(e.toLowerCase())?e:/[\s'"!@#$%^&*()=+[\]{};:|\\/,.<>?~]/.test(e)?`"${e}"`:e}n(y,"quoteFont");const J={thin:100,hairline:100,"extra-light":200,"ultra-light":200,light:300,normal:400,regular:400,book:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,black:900,heavy:900,"extra-black":950,"ultra-black":950};function v(e){return l(e)?{value:e}:typeof e=="number"?{value:e}:{value:J[e.toLowerCase()]??e}}n(v,"convertFontWeightToken");function ee(e){if(l(e))return{"font-family":e,"font-size":e};const t={"font-family":l(e.fontFamily)?e.fontFamily:Array.isArray(e.fontFamily)?e.fontFamily.map(r=>y(r)).join(", "):y(e.fontFamily),"font-size":l(e.fontSize)?e.fontSize:`${e.fontSize.value}${e.fontSize.unit}`};return e.fontWeight&&(t["font-weight"]=l(e.fontWeight)?e.fontWeight:v(e.fontWeight).value),e.letterSpacing&&(t["letter-spacing"]=l(e.letterSpacing)?e.letterSpacing:`${e.letterSpacing.value}${e.letterSpacing.unit}`),e.lineHeight&&(t["line-height"]=(l(e.lineHeight),e.lineHeight)),t}n(ee,"convertTypographyToken");function te(e){if(l(e))return{value:e};const t=(l(e.duration),e.duration),r=l(e.timingFunction)?e.timingFunction:`cubic-bezier(${e.timingFunction.join(", ")})`,o=e.delay&&(l(e.delay),e.delay),i={duration:t,"timing-function":r,...o&&{delay:o}};return{value:[t,r,o].filter(Boolean).join(" "),split:i}}n(te,"convertTransitionToken");function re(e){return l(e)?{value:e}:{value:`cubic-bezier(${e.join(", ")})`}}n(re,"convertCubicBezierToken");function ne(e){return l(e)?{value:e}:{value:e}}n(ne,"convertNumberToken");function oe(e){return l(e)?{value:e}:{value:e.toString()}}n(oe,"convertDurationToken");function R(e){return l(e)?{value:e}:typeof e=="string"?{value:e}:{value:`${e.dashArray.map(r=>l(r)?r:`${r.value}${r.unit}`).join(" ")} ${e.lineCap}`}}n(R,"convertStrokeStyleToken");function ie(e){if(l(e))return{value:e};const t=l(e.width)?e.width:`${e.width.value}${e.width.unit}`,r=(l(e.color),e.color);let o;return typeof e.style=="string"?o=e.style:o=R(e.style).value,{value:`${t} ${o} ${r}`,split:{width:t,style:o,color:r}}}n(ie,"convertBorderToken");function C(e){const t=l(e.offsetX)?e.offsetX:`${e.offsetX.value}${e.offsetX.unit}`,r=l(e.offsetY)?e.offsetY:`${e.offsetY.value}${e.offsetY.unit}`,o=l(e.blur)?e.blur:`${e.blur.value}${e.blur.unit}`,i=l(e.spread)?e.spread:`${e.spread.value}${e.spread.unit}`,s=(l(e.color),e.color),a={color:s,"offset-x":t,"offset-y":r,blur:o,spread:i,...e.inset&&{inset:"inset"}};return{value:`${e.inset?"inset ":""}${t} ${r} ${o} ${i} ${s}`,split:a}}n(C,"convertSingleShadow");function se(e){if(l(e))return{value:e};if(!Array.isArray(e)){const r=C(e);return{value:r.value,split:[r.split]}}const t=e.map(C);return{value:t.map(r=>r.value).join(", "),split:t.map(r=>r.split)}}n(se,"convertShadowToken");function ae(e){if(l(e))return{value:e};const t=e.map(r=>({color:(l(r.color),r.color),position:`${r.position}%`}));return{value:`linear-gradient(${t.map(r=>`${r.color} ${r.position}`).join(", ")})`,split:{stops:t}}}n(ae,"convertGradientToken");function ce(e){return l(e)?{value:e}:{value:Array.isArray(e)?e.map(r=>y(r)).join(", "):y(e)}}n(ce,"convertFontFamilyToken");function ue(e){return l(e)?{value:e}:{value:`${e.value}${e.unit}`}}n(ue,"convertDimensionToken");function le(e,t,r){if(e in r.tokens&&r.tokens[e]?.[t]!==void 0)return r.tokens[e][t];const o=e.split(".");for(;o.length>0;){const i=o.join(".");if(i in r.groups&&r.groups[i]&&t in r.groups[i])return r.groups[i][t];o.pop()}return r.root[t]}n(le,"getMetadataValue");function F(e,t){return le(e,"$extensions",t)?.["com.sugarcube"]}n(F,"getExtensions");function M(e,t){return F(e,t)?.fluid}n(M,"getFluidConfig");function fe(e,t){return F(e,t)?.color?.format}n(fe,"getColorFormat");function A(e,t=16){switch(e.unit){case"px":return e.value;case"rem":return e.value*t;default:throw new Error(`Unsupported unit: ${e.unit}. Fluid dimensions must use 'px' or 'rem'`)}}n(A,"normalizeToPixels");function de(e,t){if(!t?.viewports)throw new Error("Fluid metadata is required for fluid dimensions");const{min:r,max:o}=e,{viewports:i}=t,s=16,a=A(r,s),u=A(o,s),f=A(i.min,s),I=A(i.max,s);if(a===u)return{value:`${a/s}rem`};const S=a/s,V=u/s,b=f/s,q=I/s,L=(V-S)/(q-b),H=-1*b*L+S;return{value:`clamp(${S}rem, ${H.toFixed(2)}rem + ${(L*100).toFixed(2)}vw, ${V}rem)`}}n(de,"convertFluidDimension");function Ie(e,t){if(l(e))return{value:e};const r=M(t.path,t.metadataMap);if(!r)throw new Error(c.CONVERT.MISSING_FLUID_CONFIG(t.path));return de(e,r)}n(Ie,"convertFluidDimensionToken");function pe(e,t,r){const o=Math.max(e,t,r),i=Math.min(e,t,r);let s=0,a=0;const u=(o+i)/2;if(o!==i){const f=o-i;switch(a=u>.5?f/(2-o-i):f/(o+i),o){case e:s=(t-r)/f+(t<r?6:0);break;case t:s=(r-e)/f+2;break;case r:s=(e-t)/f+4;break}s*=60}return[Math.round(s),Math.round(a*100),Math.round(u*100)]}n(pe,"rgbToHsl");const g=n(e=>Number.isInteger(e)?e.toString():Number(e.toFixed(3)).toString(),"formatNumber"),$e={hex:{type:"standard",convert:n((e,t,r,o)=>{const i=n(s=>Math.round(s*255).toString(16).padStart(2,"0"),"toHex");return`#${i(e)}${i(t)}${i(r)}${o<1?i(o):""}`},"convert")},rgb:{type:"standard",convert:n((e,t,r,o)=>{const i=[e,t,r].map(s=>Math.round(s*255));return o===1?`rgb(${i.join(", ")})`:`rgba(${i.join(", ")}, ${g(o)})`},"convert")},hsl:{type:"standard",convert:n((e,t,r,o)=>{const[i,s,a]=pe(e,t,r);return o===1?`hsl(${i}, ${s}%, ${a}%)`:`hsla(${i}, ${s}%, ${a}%, ${g(o)})`},"convert")},p3:{type:"conditional",featureQuery:"@supports (color: color(display-p3 1 1 1))",convert:n((e,t,r,o)=>{const i=[e,t,r].map(g).join(" ");return o===1?`color(display-p3 ${i})`:`color(display-p3 ${i} / ${g(o)})`},"convert")}};function me(e,t){if(l(e))return{value:e};const r=fe(t.path,t.metadataMap)||"hex";if(r==="hex")return{value:e};const o=$e[r];if(!o)return{value:e};const i=e.substring(1),s=parseInt(i.substring(0,2),16)/255,a=parseInt(i.substring(2,4),16)/255,u=parseInt(i.substring(4,6),16)/255,f=i.length===8?parseInt(i.substring(6,8),16)/255:1;return o.type==="conditional"?{value:e,featureValues:[{query:o.featureQuery,value:o.convert(s,a,u,f)}]}:{value:o.convert(s,a,u,f)}}n(me,"convertColorToken");const ye={duration:oe,number:ne,cubicBezier:re,color:me,dimension:ue,fluidDimension:Ie,typography:ee,border:ie,shadow:se,gradient:ae,transition:te,strokeStyle:R,fontFamily:ce,fontWeight:v},Ae=new Set(["$description","$extensions"]),k=new Map;function x(e){const t=k.get(e);if(t)return t;const r=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z])(?=[a-z])/g,"$1-$2").toLowerCase();return k.set(e,r),r}n(x,"toKebabCase");function ge(e,t){const r=ye[e.$type];if(!r)throw new Error(c.CONVERT.UNSUPPORTED_TOKEN_TYPE(e.$type));return{$type:e.$type,$value:e.$value,$path:e.$path,$resolvedValue:e.$resolvedValue,cssProperties:r(e.$value,t)}}n(ge,"convertSingleToken");function Te(e,t){const r={};for(const[o,i]of Object.entries(e)){if(Ae.has(o)||i===void 0)continue;const s={metadataMap:t,path:o};if(!("$type"in i))throw new Error(`Token at path ${o} is missing $type property`);if(i.$type==="fluidDimension"&&!t)throw new Error(c.CONVERT.MISSING_FLUID_CONFIG(o));const a=o.split(".").map(x).join("-");r[a]=ge(i,s)}return r}n(Te,"convert");function Ee(e){return typeof e=="object"&&e!==null&&typeof e.query=="string"&&typeof e.value=="string"}n(Ee,"isFeatureValue");function Se(e){return typeof e!="object"||e===null||!("value"in e)||typeof e.value!="string"&&typeof e.value!="number"?!1:"featureValues"in e?Array.isArray(e.featureValues)?e.featureValues.every(Ee):!1:!0}n(Se,"isSimpleCSSProperties");function Ne(e){return!!(typeof e=="string"||typeof e=="number"||Se(e))}n(Ne,"isValidCSSValue");const N="(color: color(display-p3 1 1 1))",he=[{query:N,test:n(e=>e.$type!=="color"?!1:e.cssProperties.featureValues?.some(r=>r.query===N)??!1,"test"),convertToCSSVars:n((e,t)=>{const o=t.cssProperties.featureValues?.find(i=>i.query===N);return o?[{name:`--${De(e)}`,value:o.value}]:[]},"convertToCSSVars")}];function De(e){return e.split(".").join("-")}n(De,"formatCSSVarPath");function j(e){return typeof e=="number"?e.toString():e.replace(/\{([^}]+)\}/g,(t,r)=>`var(--${r.split(".").map(x).join("-")})`)}n(j,"convertReferenceToCSSVar");function $(e,t){if(!Ne(t))throw new Error(c.GENERATE.INVALID_CSS_VALUE(e,String(t)));const r=typeof t=="object"&&"value"in t?j(t.value):j(t);return{name:`--${e}`,value:r}}n($,"createSingleCSSVar");function _e(e,t){if(!("split"in t)||!t.split)return{base:"value"in t?[$(e,t.value)]:Object.entries(t).map(([r,o])=>$(`${e}-${r}`,o))};if(Array.isArray(t.split)){const r=t.split.length>1;return{base:t.split.flatMap((o,i)=>Object.entries(o).map(([s,a])=>{const u=r?`-${i+1}-${s}`:`-${s}`;return $(`${e}${u}`,a)}))}}return{base:Object.entries(t.split).map(([r,o])=>$(`${e}-${r}`,o))}}n(_e,"convertSplitTokenToCSSVars");function Ve(e){return{name:`--${e}`,value:[`var(--${e}-width)`,`var(--${e}-style)`,`var(--${e}-color)`].join(" ")}}n(Ve,"createBorderCSSVar");function U(e,t,r){return[`var(--${e}${t?`-${r+1}`:""}-offset-x)`,`var(--${e}${t?`-${r+1}`:""}-offset-y)`,`var(--${e}${t?`-${r+1}`:""}-blur)`,`var(--${e}${t?`-${r+1}`:""}-spread)`,`var(--${e}${t?`-${r+1}`:""}-color)`].join(" ")}n(U,"createShadowCSSVar");function be(e,t,r){if("split"in r){if(e!=="shadow")return e==="border"?Ve(t):void 0;if(Array.isArray(r.split)){const o=r.split.length>1,i=r.split.map((s,a)=>U(t,o,a)).join(", ");return{name:`--${t}`,value:i}}return{name:`--${t}`,value:U(t,!1,0)}}}n(be,"createCombinedCSSVar");function Le(e,t,r){if(!(t.$type==="typography"||r.includes(t.$type)))return[$(e,t.cssProperties)];const{base:i}=_e(e,t.cssProperties),s=be(t.$type,e,t.cssProperties);return s?[...i,s]:i}n(Le,"convertTokenToCSSVarSet");function Oe(e){const t=`${e.root.selector}{${e.root.vars.map(o=>`${o.name}:${o.value}`).join(";")}}`,r=e.features.map(o=>`@supports ${o.query}{${e.root.selector}{${o.vars.map(i=>`${i.name}:${i.value}`).join(";")}}}`).join("");return t+r}n(Oe,"convertCSSVarsToString");async function ve(e,t={}){const r=Object.entries(e).filter(([s])=>s!=="$extensions").flatMap(([s,a])=>Le(s,a,t.splitTypes||[])),o=he.map(s=>{const u=Object.entries(e).filter(([f,I])=>s.test(I)).flatMap(([f,I])=>s.convertToCSSVars(f,I));return u.length>0?{query:s.query,vars:u}:null}).filter(s=>s!==null),i=Oe({root:{selector:":root",vars:r},features:o});return Re(i)}n(ve,"generateCSS");function Re(e){return e=e.replace(/{/g,`{
2
- `),e=e.replace(/([^{]);/g,`$1;
3
- `),e=e.replace(/}(?!$)/g,`
4
- }
1
+ var Q=Object.defineProperty;var n=(e,t)=>Q(e,"name",{value:t,configurable:!0});import{readFile as ee}from"fs/promises";import te from"fast-glob";import re from"node:path";const u={LOAD:{FILE_NOT_FOUND:n(e=>`File not found: ${e}`,"FILE_NOT_FOUND"),INVALID_JSON:n((e,t)=>`Invalid JSON in file ${e}: ${t}`,"INVALID_JSON"),READ_ERROR:n((e,t)=>`Error reading file ${e}: ${t}`,"READ_ERROR"),INVALID_SOURCE:n(e=>`Invalid source: expected string or array of file descriptors, got ${typeof e}`,"INVALID_SOURCE"),NO_FILES_FOUND:n(e=>`No files found matching pattern: ${e}.`,"NO_FILES_FOUND"),GLOB_ERROR:n((e,t)=>`Error resolving glob pattern ${e}: ${t}`,"GLOB_ERROR"),EMPTY_CONFIG:n(()=>"No token files specified in sugarcube.config.json","EMPTY_CONFIG")},PARSE:{INVALID_INPUT_TYPE:n(e=>`Invalid input: expected string, got ${e}`,"INVALID_INPUT_TYPE"),JSON_PARSE_ERROR:n(e=>`JSON parsing error: ${e}`,"JSON_PARSE_ERROR"),UNEXPECTED_ERROR:n(e=>`Unexpected error during parsing: ${e}`,"UNEXPECTED_ERROR")},FLATTEN:{INVALID_TOKEN_NAME:n(e=>`Invalid token name '${e}': cannot contain '.', '{', or '}'`,"INVALID_TOKEN_NAME"),INVALID_NODE_STRUCTURE:n(e=>`Invalid node structure at '${e}': expected object`,"INVALID_NODE_STRUCTURE"),MISSING_INHERITED_TYPE:n(e=>`Token at '${e}' has no type (neither explicit nor inherited)`,"MISSING_INHERITED_TYPE")},METADATA:{COLLECTION_ERROR:n(e=>`Error collecting metadata: ${e}`,"COLLECTION_ERROR"),INVALID_EXTENSIONS:n(e=>`Invalid extensions at '${e}': expected object, got ${typeof e}`,"INVALID_EXTENSIONS"),INVALID_DESCRIPTION:n(e=>`Invalid description at '${e}': expected string, got ${typeof e}`,"INVALID_DESCRIPTION")},VALIDATE:{MISSING_TYPE:n(e=>`Token at '${e}' is missing the "$type" property`,"MISSING_TYPE"),MISSING_VALUE:n(e=>`Token at '${e}' is missing the "$value" property`,"MISSING_VALUE"),UNKNOWN_TOKEN_TYPE:n((e,t)=>`Unknown token type '${e}' at '${t}'. Valid types are: color, dimension, fontFamily, fontWeight, duration, cubicBezier, strokeStyle, border, transition, shadow, gradient, typography`,"UNKNOWN_TOKEN_TYPE"),INVALID_COLOR:n((e,t)=>`Invalid color at '${t}': '${e}'. Color should be a valid hex value`,"INVALID_COLOR"),INVALID_DIMENSION:n((e,t)=>`Invalid dimension at '${t}': ${e}. Dimensions should have a numeric value and unit, like { "value": 16, "unit": "px" }`,"INVALID_DIMENSION"),INVALID_DIMENSION_UNIT:n((e,t)=>`Invalid unit at '${t}': ${e}. Unit must be either "px" or "rem"`,"INVALID_DIMENSION_UNIT"),INVALID_FONT_FAMILY:n((e,t)=>`Invalid font family at '${t}': ${e}. Should be a string or array of strings, like "Arial" or ["Arial", "sans-serif"]`,"INVALID_FONT_FAMILY"),INVALID_FONT_WEIGHT:n((e,t)=>`Invalid font weight at '${t}': ${e}. Should be a number between 1-1000 or a keyword like "thin", "light", "normal", "bold"`,"INVALID_FONT_WEIGHT"),INVALID_DURATION:n((e,t)=>`Invalid duration at '${t}': ${e}. Should be like { "value": 300, "unit": "ms" }`,"INVALID_DURATION"),INVALID_DURATION_UNIT:n((e,t)=>`Invalid unit at '${t}': ${e}. Unit must be "ms" or "s"`,"INVALID_DURATION_UNIT"),INVALID_CUBIC_BEZIER:n((e,t)=>`Invalid cubic bezier at '${t}': ${e}. Should be an array of 4 numbers between 0 and 1`,"INVALID_CUBIC_BEZIER"),INVALID_CUBIC_BEZIER_RANGE:n((e,t)=>`Invalid cubic bezier control points at '${t}': ${e}. X values must be between 0 and 1`,"INVALID_CUBIC_BEZIER_RANGE"),INVALID_STROKE_STYLE:n((e,t)=>`Invalid stroke style at '${t}': ${e}. Should be "solid", "dashed", "dotted", etc.`,"INVALID_STROKE_STYLE"),INVALID_STROKE_LINE_CAP:n((e,t)=>`Invalid line cap at '${t}': ${e}. Should be one of: round, butt, square`,"INVALID_STROKE_LINE_CAP"),INVALID_BORDER:n((e,t)=>`Invalid border at '${t}': ${e}. Should have color, width, and style properties`,"INVALID_BORDER"),INVALID_SHADOW:n((e,t)=>`Invalid shadow at '${t}': ${e}. Should have color, offsetX, offsetY properties (blur and spread are optional)`,"INVALID_SHADOW"),INVALID_SHADOW_INSET:n((e,t)=>`Invalid inset value at '${t}': ${e}. Should be true or false`,"INVALID_SHADOW_INSET"),INVALID_TRANSITION:n((e,t)=>`Invalid transition at '${t}': ${e}. Should have duration, delay, and timingFunction properties`,"INVALID_TRANSITION"),INVALID_GRADIENT:n((e,t)=>`Invalid gradient at '${t}': ${e}. Should be an array of color stops with position values between 0 and 1`,"INVALID_GRADIENT"),INVALID_GRADIENT_STOP_POSITION:n((e,t)=>`Invalid gradient stop position at '${t}': ${e}. Position must be between 0 and 1`,"INVALID_GRADIENT_STOP_POSITION"),INVALID_TYPOGRAPHY:n((e,t)=>`Invalid typography at '${t}': ${e}. Should have fontFamily and fontSize (fontWeight, letterSpacing, and lineHeight are optional)`,"INVALID_TYPOGRAPHY"),MISSING_REQUIRED_PROPERTY:n((e,t)=>`Missing required property '${e}' at '${t}'`,"MISSING_REQUIRED_PROPERTY"),INVALID_NUMBER:n((e,t)=>`Invalid number at '${t}': ${e}. Expected a number value`,"INVALID_NUMBER"),INVALID_ARRAY:n((e,t)=>`Invalid array at '${t}': ${e}. Expected an array value`,"INVALID_ARRAY"),MISSING_FLUID_CONFIG:n(e=>`Missing fluid configuration at root level. Token at '${e}' requires fluid viewport settings`,"MISSING_FLUID_CONFIG"),INVALID_FLUID_DIMENSION:n((e,t)=>`Invalid fluid dimension at '${t}': ${e}. Fluid dimensions should have min and max values, like { "min": { "value": 16, "unit": "px" }, "max": { "value": 24, "unit": "px" } }`,"INVALID_FLUID_DIMENSION"),INVALID_VIEWPORT_CONFIG:n((e,t)=>`Invalid viewport configuration at '${t}': ${e}. Viewport config should have min and max dimension values`,"INVALID_VIEWPORT_CONFIG"),MISMATCHED_UNITS:n((e,t,r)=>`Mismatched units at '${r}': min uses '${e}', max uses '${t}'. Both values must use the same unit`,"MISMATCHED_UNITS"),INVALID_FLUID_VALUE_RANGE:n(e=>`Invalid fluid value range at '${e}': min value must be less than max value`,"INVALID_FLUID_VALUE_RANGE"),INVALID_TOKEN_TYPE:n((e,t,r)=>`Invalid token type at '${r}': expected ${e}, got ${t}`,"INVALID_TOKEN_TYPE"),INVALID_TYPE:n((e,t,r)=>`Expected ${e}, received ${typeof t} at '${r}'`,"INVALID_TYPE"),INVALID_ENUM_VALUE:n((e,t,r)=>`Expected value to be one of [${e.join(", ")}], but got ${String(t)} at ${r}`,"INVALID_ENUM_VALUE")},RESOLVE:{CIRCULAR_REFERENCE:n((e,t)=>`Circular reference detected: ${e} -> ${t}`,"CIRCULAR_REFERENCE"),REFERENCE_NOT_FOUND:n((e,t)=>`Reference not found: ${t} in ${e}`,"REFERENCE_NOT_FOUND"),TYPE_MISMATCH:n(e=>`Type mismatch in reference resolution at ${e}`,"TYPE_MISMATCH")},NORMALIZE:{DUPLICATE_FILE_WARNING:n((e,t)=>`Warning: File '${e}' is assigned to multiple collections without modes (in '${t}'). This will create duplicate CSS variables in :root since collections without modes default to root scope.`,"DUPLICATE_FILE_WARNING"),DUPLICATE_MODE_WARNING:n((e,t,r)=>`Warning: File '${e}' is assigned to multiple modes in collection '${t}' (in '${r}'). This means the same token values will be duplicated across different theme selectors.`,"DUPLICATE_MODE_WARNING")},GENERATE:{INVALID_CSS_VALUE:n((e,t)=>`Invalid CSS value for property '${e}': ${t}`,"INVALID_CSS_VALUE"),INVALID_VARIABLE_NAME:n((e,t)=>`Invalid CSS variable name at '${e}': ${t}`,"INVALID_VARIABLE_NAME")}};async function ne(e){const t={files:{},errors:[]};for(const[r,i]of Object.entries(e))try{const o=!i.includes("*")&&!i.endsWith(".json")?re.join(i,"**/*.json"):i,s=await te(o,{absolute:!0,onlyFiles:!0});if(s.length===0){t.errors.push({pattern:i,error:u.LOAD.NO_FILES_FOUND(i)});continue}t.files[r]=s}catch(o){t.errors.push({pattern:i,error:u.LOAD.GLOB_ERROR(i,o instanceof Error?o.message:"Unknown error")})}return t}n(ne,"resolveFiles");async function oe(e){try{const t=await ee(e,"utf-8");return JSON.parse(t)}catch(t){throw t instanceof Error?t instanceof SyntaxError?new Error(u.LOAD.INVALID_JSON(e,t.message)):"code"in t&&t.code==="ENOENT"?new Error(u.LOAD.FILE_NOT_FOUND(e)):new Error(u.LOAD.READ_ERROR(e,t.message)):new Error(u.LOAD.READ_ERROR(e,"Unknown error"))}}n(oe,"loadTree");async function L(e){const t=[],r=[];if(Object.keys(e).length===0)return{trees:[],errors:[{file:"",message:u.LOAD.EMPTY_CONFIG()}]};const{files:i,errors:o}=await ne(e);t.push(...o.map(s=>({file:s.pattern,message:s.error})));for(const[s,a]of Object.entries(i))for(const c of a)try{const f=await oe(c);r.push({name:s,tokens:f})}catch(f){t.push({file:c,message:f instanceof Error?f.message:"Unknown error"})}return{trees:r,errors:t}}n(L,"loadTreesFromConfig");function ie(e,t){const r={},i=[];(e.$description||e.$extensions)&&(r[t.file]={$description:e.$description,$extensions:e.$extensions});function o(s,a=[],c){if(a.length>0&&(s.$description||s.$extensions)&&(r[`${t.file}.${a.join(".")}`]={$description:s.$description,$extensions:s.$extensions}),"$value"in s)return;const f=s.$type||c,d=Object.keys(s).filter(l=>!l.startsWith("$"));for(const l of d){const I=s[l];if(l.includes(".")||l.includes("{")||l.includes("}")){i.push({path:[...a,l].join("."),source:t,message:u.FLATTEN.INVALID_TOKEN_NAME(l)});continue}const m=[...a,l];if("$value"in I){if(!f&&!I.$type){i.push({path:m.join("."),source:t,message:u.FLATTEN.MISSING_INHERITED_TYPE(m.join("."))});continue}r[`${t.file}.${m.join(".")}`]={...I,$type:I.$type||f,$path:m.join("."),$source:t,$originalPath:m.join(".")}}else o(I,m,f)}}return n(o,"processNode"),o(e),{tokens:r,errors:i}}n(ie,"flattenTree");function b(e){return e.reduce((t,{name:r,tokens:i})=>{const{tokens:o,errors:s}=ie(i,{file:r});return{tokens:{...t.tokens,...o},errors:[...t.errors,...s]}},{tokens:{},errors:[]})}n(b,"flatten");function p(e){return typeof e=="string"&&e.startsWith("{")&&e.endsWith("}")}n(p,"isReference");function g(e,t,r,i){return typeof t=="string"&&p(t)?se(e,t,r,i):Array.isArray(t)?t.map(o=>g(e,o,r,i)):typeof t=="object"&&t!==null?Object.entries(t).reduce((s,[a,c])=>({...s,[a]:g(`${e}.${a}`,c,r,i)}),{}):t}n(g,"resolveValue");function V(e){const t={},r=new Set,i=[];for(const[o,s]of Object.entries(e))try{if(!("$value"in s)){t[o]=s;continue}const a=s;t[o]={...a,$resolvedValue:g(a.$path,a.$value,e,r)}}catch(a){const c=a instanceof Error?a.message:String(a),f=s,d=f.$path,l=f.$source;let I,m;c.includes("Circular reference detected")?(I="circular",m=c):c.includes("Reference not found")?(I="missing",m=c):(I="type-mismatch",m=u.RESOLVE.TYPE_MISMATCH(d)),i.push({type:I,path:d,source:l,message:m})}return{resolved:t,errors:i}}n(V,"resolve");function se(e,t,r,i){const o=t.slice(1,-1),s=Object.keys(r).find(f=>{const d=r[f];return d?"$originalPath"in d&&d.$originalPath===o:!1});if(!s)throw new Error(`Reference not found: ${o} in ${e}`);if(i.has(s))throw new Error(`Circular reference detected: ${e} -> ${s}`);const a=r[s];if(!a||!("$value"in a))throw new Error(`Reference not found: ${o} in ${e}`);i.add(s);const c=g(s,a.$value,r,i);return i.delete(s),c}n(se,"resolveReferenceChain");function E(e){return["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"].includes(e.toLowerCase())?e:/[\s'"!@#$%^&*()=+[\]{};:|\\/,.<>?~]/.test(e)?`"${e}"`:e}n(E,"quoteFont");const ae={thin:100,hairline:100,"extra-light":200,"ultra-light":200,light:300,normal:400,regular:400,book:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,black:900,heavy:900,"extra-black":950,"ultra-black":950};function x(e){return p(e)?{value:e}:typeof e=="number"?{value:e}:{value:ae[e.toLowerCase()]??e}}n(x,"convertFontWeightToken");function ce(e){if(p(e))return{"font-family":e,"font-size":e};const t={"font-family":p(e.fontFamily)?e.fontFamily:Array.isArray(e.fontFamily)?e.fontFamily.map(r=>E(r)).join(", "):E(e.fontFamily),"font-size":p(e.fontSize)?e.fontSize:`${e.fontSize.value}${e.fontSize.unit}`};return e.fontWeight&&(t["font-weight"]=p(e.fontWeight)?e.fontWeight:x(e.fontWeight).value),e.letterSpacing&&(t["letter-spacing"]=p(e.letterSpacing)?e.letterSpacing:`${e.letterSpacing.value}${e.letterSpacing.unit}`),e.lineHeight&&(t["line-height"]=(p(e.lineHeight),e.lineHeight)),t}n(ce,"convertTypographyToken");function ue(e){if(p(e))return{value:e};const t=(p(e.duration),e.duration),r=p(e.timingFunction)?e.timingFunction:`cubic-bezier(${e.timingFunction.join(", ")})`,i=e.delay&&(p(e.delay),e.delay);return{value:[t,r,i].filter(Boolean).join(" ")}}n(ue,"convertTransitionToken");function fe(e){return p(e)?{value:e}:{value:`cubic-bezier(${e.join(", ")})`}}n(fe,"convertCubicBezierToken");function le(e){return p(e)?{value:e}:{value:e}}n(le,"convertNumberToken");function de(e){return p(e)?{value:e}:{value:e.toString()}}n(de,"convertDurationToken");function P(e){return p(e)?{value:e}:typeof e=="string"?{value:e}:{value:`${e.dashArray.map(r=>p(r)?r:`${r.value}${r.unit}`).join(" ")} ${e.lineCap}`}}n(P,"convertStrokeStyleToken");function pe(e){if(p(e))return{value:e};const t=p(e.width)?e.width:`${e.width.value}${e.width.unit}`,r=(p(e.color),e.color),i=typeof e.style=="string"?e.style:P(e.style).value;return{value:`${t} ${i} ${r}`}}n(pe,"convertBorderToken");function U(e){const t=p(e.offsetX)?e.offsetX:`${e.offsetX.value}${e.offsetX.unit}`,r=p(e.offsetY)?e.offsetY:`${e.offsetY.value}${e.offsetY.unit}`,i=p(e.blur)?e.blur:`${e.blur.value}${e.blur.unit}`,o=p(e.spread)?e.spread:`${e.spread.value}${e.spread.unit}`,s=(p(e.color),e.color);return`${e.inset?"inset ":""}${t} ${r} ${i} ${o} ${s}`}n(U,"convertSingleShadow");function Ie(e){return p(e)?{value:e}:Array.isArray(e)?{value:e.map(U).join(", ")}:{value:U(e)}}n(Ie,"convertShadowToken");function me(e){return p(e)?{value:e}:{value:`linear-gradient(${e.map(r=>`${p(r.color),r.color} ${r.position}%`).join(", ")})`}}n(me,"convertGradientToken");function $e(e){return p(e)?{value:e}:{value:Array.isArray(e)?e.map(r=>E(r)).join(", "):E(e)}}n($e,"convertFontFamilyToken");function he(e){return p(e)?{value:e}:{value:`${e.value}${e.unit}`}}n(he,"convertDimensionToken");function T(e,t=16){return e.unit==="px"?e.value:e.value*t}n(T,"normalizeToPixels");function Ae(e,t){const{min:r,max:i}=e,{viewports:o}=t.fluidConfig,s=16,a=T(r,s),c=T(i,s),f=T(o.min,s),d=T(o.max,s);if(a===c)return{value:`${a/s}rem`};const l=a/s,I=c/s,m=f/s,A=d/s,y=(I-l)/(A-m),_=-1*m*y+l;return{value:`clamp(${l}rem, ${_.toFixed(2)}rem + ${(y*100).toFixed(2)}vw, ${I}rem)`}}n(Ae,"convertFluidDimension");function ye(e,t){return p(e)?{value:e}:Ae(e,t)}n(ye,"convertFluidDimensionToken");function ge(e,t,r){const i=Math.max(e,t,r),o=Math.min(e,t,r);let s=0,a=0;const c=(i+o)/2;if(i!==o){const f=i-o;switch(a=c>.5?f/(2-i-o):f/(i+o),i){case e:s=(t-r)/f+(t<r?6:0);break;case t:s=(r-e)/f+2;break;case r:s=(e-t)/f+4;break}s*=60}return[Math.round(s),Math.round(a*100),Math.round(c*100)]}n(ge,"rgbToHsl");const N=n(e=>Number.isInteger(e)?e.toString():Number(e.toFixed(3)).toString(),"formatNumber"),Ee={hex:{type:"standard",convert:n((e,t,r,i)=>{const o=n(s=>Math.round(s*255).toString(16).padStart(2,"0"),"toHex");return`#${o(e)}${o(t)}${o(r)}${i<1?o(i):""}`},"convert")},rgb:{type:"standard",convert:n((e,t,r,i)=>{const o=[e,t,r].map(s=>Math.round(s*255));return i===1?`rgb(${o.join(", ")})`:`rgba(${o.join(", ")}, ${N(i)})`},"convert")},hsl:{type:"standard",convert:n((e,t,r,i)=>{const[o,s,a]=ge(e,t,r);return i===1?`hsl(${o}, ${s}%, ${a}%)`:`hsla(${o}, ${s}%, ${a}%, ${N(i)})`},"convert")},p3:{type:"conditional",featureQuery:"@supports (color: color(display-p3 1 1 1))",convert:n((e,t,r,i)=>{const o=[e,t,r].map(N).join(" ");return i===1?`color(display-p3 ${o})`:`color(display-p3 ${o} / ${N(i)})`},"convert")}};function Te(e,t){if(p(e))return{value:e};const r=t.colorFormat||"hex";if(r==="hex")return{value:e};const i=Ee[r.name];if(!i)return{value:e};const o=e.substring(1),s=parseInt(o.substring(0,2),16)/255,a=parseInt(o.substring(2,4),16)/255,c=parseInt(o.substring(4,6),16)/255,f=o.length===8?parseInt(o.substring(6,8),16)/255:1;return i.type==="conditional"?{value:e,featureValues:[{query:i.featureQuery,value:i.convert(s,a,c,f)}]}:{value:i.convert(s,a,c,f)}}n(Te,"convertColorToken");const G={duration:de,number:le,cubicBezier:fe,color:Te,dimension:he,fluidDimension:ye,typography:ce,border:pe,shadow:Ie,gradient:me,transition:ue,strokeStyle:P,fontFamily:$e,fontWeight:x};function Ne(e,t){const r=G[e.$type];return{...e.$description?{$description:e.$description}:{},...e.$extensions?{$extensions:e.$extensions}:{},$type:e.$type,$value:e.$value,$path:e.$path,$source:e.$source,$originalPath:e.$originalPath,$resolvedValue:e.$resolvedValue,$cssProperties:r(e.$value,t)}}n(Ne,"convertSingleToken");function Se(e,t){const r={};for(const[i,o]of Object.entries(e)){if(!o||typeof o!="object")continue;if(!("$type"in o)){r[i]={...o.$description?{$description:o.$description}:{},...o.$extensions?{$extensions:o.$extensions}:{}};continue}if(!G[o.$type])continue;const s={fluidConfig:t.fluid,colorFormat:t.color?.format,path:o.$path};r[i]=Ne(o,s)}return r}n(Se,"convertTokens");function O(e,t){const r={};for(const[i,o]of Object.entries(e)){r[i]={};for(const[s,a]of Object.entries(o))r[i][s]=Se(a,t)}return r}n(O,"convert");function De(e){return JSON.parse(e)}n(De,"parseJson");const _e={isObject:n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObject")};function $(e,t,r,i){if(p(t))return[];switch(e.type){case"object":return be(e,t,r,i);case"union":return Ve(e,t,r,i);case"array":return Oe(e,t,r,i);default:return Le(e,t,r,i)}}n($,"validateSchema");function Le(e,t,r,i){return typeof t!==e.type?[{path:r,message:e.errorMessage?.(t,r)||u.VALIDATE.INVALID_TYPE(e.type,t,r),source:i}]:e.validate?.(t,r,i)??[]}n(Le,"validateSimpleValue");function be(e,t,r,i){if(!_e.isObject(t))return[{path:r,message:e.errorMessage?.(t,r)||u.VALIDATE.INVALID_TYPE("object",t,r),source:i}];const o=[],s=t;if(e.required)for(const a of e.required)a in s||o.push({path:`${r}.${a}`,message:u.VALIDATE.MISSING_REQUIRED_PROPERTY(a,r),source:i});for(const[a,c]of Object.entries(e.properties))a in s&&o.push(...$(c,s[a],`${r}.${a}`,i));return o}n(be,"validateObject");function Ve(e,t,r,i){let o=[],s=1/0;for(const a of e.oneOf){if(a.type==="string"&&typeof t!="string"||a.type==="object"&&typeof t!="object")continue;const c=$(a,t,r,i);if(c.length===0)return e.validate?.(t,r,i)??[];c.length<s&&(o=c,s=c.length)}return s===1/0?[{path:r,message:u.VALIDATE.INVALID_TYPE(e.oneOf.map(a=>a.type).join(" or "),t,r),source:i}]:o}n(Ve,"validateUnion");function Oe(e,t,r,i){return Array.isArray(t)?e.validate?.(t,r,i)??[]:[{path:r,message:e.errorMessage?.(t,r)||u.VALIDATE.INVALID_TYPE("array",t,r),source:i}]}n(Oe,"validateArray");const S={tokenType:"color",schema:{type:"string",errorMessage:n((e,t)=>u.VALIDATE.INVALID_COLOR(e,t),"errorMessage"),validate:n((e,t,r)=>/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)?[]:[{path:t,message:u.VALIDATE.INVALID_COLOR(e,t),source:r}],"validate")}};function Re(e,t,r){return $(S.schema,e,t,r)}n(Re,"validateColor");const D={tokenType:"number",schema:{type:"number",errorMessage:n((e,t)=>u.VALIDATE.INVALID_NUMBER(e,t),"errorMessage"),validate:n((e,t,r)=>typeof e!="number"||isNaN(e)?[{path:t,message:u.VALIDATE.INVALID_NUMBER(e,t),source:r}]:[],"validate")}};function ve(e,t,r){return $(D.schema,e,t,r)}n(ve,"validateNumber");const h={tokenType:"dimension",schema:{type:"object",errorMessage:n((e,t)=>u.VALIDATE.INVALID_DIMENSION(e,t),"errorMessage"),properties:{value:D.schema,unit:{type:"string",validate:n((e,t,r)=>typeof e!="string"||!["px","rem"].includes(e)?[{path:t,message:u.VALIDATE.INVALID_DIMENSION_UNIT(e,t),source:r}]:[],"validate")}},required:["value","unit"]}};function Fe(e,t,r){return $(h.schema,e,t,r)}n(Fe,"validateDimension");const W={tokenType:"fontFamily",schema:{type:"union",oneOf:[{type:"string",errorMessage:n((e,t)=>u.VALIDATE.INVALID_FONT_FAMILY(e,t),"errorMessage")},{type:"array",errorMessage:n((e,t)=>u.VALIDATE.INVALID_FONT_FAMILY(e,t),"errorMessage"),validate:n((e,t,r)=>e.every(o=>typeof o=="string")?[]:[{path:t,message:u.VALIDATE.INVALID_FONT_FAMILY(e,t),source:r}],"validate")}],errorMessage:n((e,t)=>u.VALIDATE.INVALID_FONT_FAMILY(e,t),"errorMessage")}};function ke(e,t,r){return $(W.schema,e,t,r)}n(ke,"validateFontFamily");const Me=["thin","hairline","extra-light","ultra-light","light","normal","regular","book","medium","semi-bold","demi-bold","bold","extra-bold","ultra-bold","black","heavy","extra-black","ultra-black"],Y={tokenType:"fontWeight",schema:{type:"union",errorMessage:n((e,t)=>u.VALIDATE.INVALID_FONT_WEIGHT(e,t),"errorMessage"),oneOf:[{type:"number",errorMessage:n((e,t)=>u.VALIDATE.INVALID_FONT_WEIGHT(e,t),"errorMessage"),validate:n((e,t,r)=>e<1||e>1e3?[{path:t,message:u.VALIDATE.INVALID_FONT_WEIGHT(e,t),source:r}]:[],"validate")},{type:"string",errorMessage:n((e,t)=>u.VALIDATE.INVALID_FONT_WEIGHT(e,t),"errorMessage"),validate:n((e,t,r)=>Me.includes(e.toLowerCase())?[]:[{path:t,message:u.VALIDATE.INVALID_FONT_WEIGHT(e,t),source:r}],"validate")}]}};function Ce(e,t,r){return $(Y.schema,e,t,r)}n(Ce,"validateFontWeight");const je=["ms","s"],R={tokenType:"duration",schema:{type:"object",errorMessage:n((e,t)=>u.VALIDATE.INVALID_DURATION(e,t),"errorMessage"),properties:{value:D.schema,unit:{type:"string",validate:n((e,t,r)=>je.includes(e)?[]:[{path:t,message:u.VALIDATE.INVALID_DURATION_UNIT(e,t),source:r}],"validate")}},required:["value","unit"]}};function we(e,t,r){return $(R.schema,e,t,r)}n(we,"validateDuration");const z={tokenType:"cubicBezier",schema:{type:"array",errorMessage:n((e,t)=>u.VALIDATE.INVALID_CUBIC_BEZIER(e,t),"errorMessage"),validate:n((e,t,r)=>{const i=e;if(i.length!==4||!i.every(a=>typeof a=="number"))return[{path:t,message:u.VALIDATE.INVALID_CUBIC_BEZIER(e,t),source:r}];const[o,,s]=i;return o<0||o>1||s<0||s>1?[{path:t,message:u.VALIDATE.INVALID_CUBIC_BEZIER_RANGE(e,t),source:r}]:[]},"validate")}};function xe(e,t,r){return $(z.schema,e,t,r)}n(xe,"validateCubicBezier");const Pe={tokenType:"typography",schema:{type:"object",properties:{fontFamily:W.schema,fontSize:h.schema,letterSpacing:h.schema,lineHeight:D.schema,fontWeight:Y.schema},required:["fontFamily","fontSize"],errorMessage:n((e,t)=>u.VALIDATE.INVALID_TYPOGRAPHY(e,t),"errorMessage")}};function Ue(e,t,r){return $(Pe.schema,e,t,r)}n(Ue,"validateTypography");const Ge=["solid","dashed","dotted","double","groove","ridge","outset","inset"],We=["round","butt","square"],Ye={type:"object",errorMessage:n((e,t)=>u.VALIDATE.INVALID_STROKE_STYLE(e,t),"errorMessage"),properties:{dashArray:{type:"array",validate:n((e,t,r)=>{const i=e,o=[];return i.forEach((s,a)=>{typeof s!="string"&&o.push(...$(h.schema,s,`${t}.${a}`,r))}),o},"validate")},lineCap:{type:"string",validate:n((e,t,r)=>We.includes(e)?[]:[{path:t,message:u.VALIDATE.INVALID_STROKE_LINE_CAP(e,t),source:r}],"validate")}},required:["dashArray","lineCap"]},B={tokenType:"strokeStyle",schema:{type:"union",oneOf:[{type:"string",validate:n((e,t,r)=>!Ge.includes(e)&&typeof e=="string"?[{path:t,message:u.VALIDATE.INVALID_STROKE_STYLE(e,t),source:r}]:[],"validate")},Ye]}};function ze(e,t,r){return $(B.schema,e,t,r)}n(ze,"validateStrokeStyle");const Be={tokenType:"border",schema:{type:"object",properties:{color:S.schema,width:h.schema,style:B.schema},required:["color","width","style"],errorMessage:n((e,t)=>u.VALIDATE.INVALID_BORDER(e,t),"errorMessage")}};function He(e,t,r){return $(Be.schema,e,t,r)}n(He,"validateBorder");const qe={tokenType:"transition",schema:{type:"object",properties:{duration:R.schema,delay:R.schema,timingFunction:z.schema},required:["duration","delay","timingFunction"],errorMessage:n((e,t)=>u.VALIDATE.INVALID_TRANSITION(e,t),"errorMessage")}};function Ke(e,t,r){return $(qe.schema,e,t,r)}n(Ke,"validateTransition");const H={tokenType:"shadow",schema:{type:"object",properties:{color:S.schema,offsetX:h.schema,offsetY:h.schema,blur:h.schema,spread:h.schema,inset:{type:"boolean",errorMessage:n((e,t)=>u.VALIDATE.INVALID_SHADOW_INSET(e,t),"errorMessage")}},required:["color","offsetX","offsetY","blur","spread"],errorMessage:n((e,t)=>u.VALIDATE.INVALID_SHADOW(e,t),"errorMessage")}};function Ze(e,t,r){const i=[];return Array.isArray(e)?(e.forEach((o,s)=>{i.push(...$(H.schema,o,`${t}[${s}]`,r))}),i):$(H.schema,e,t,r)}n(Ze,"validateShadow");const Xe={type:"object",errorMessage:n((e,t)=>u.VALIDATE.INVALID_GRADIENT(e,t),"errorMessage"),properties:{color:{type:"string",validate:S.schema.validate},position:{type:"number",validate:n((e,t,r)=>e<0||e>1?[{path:t,message:u.VALIDATE.INVALID_GRADIENT_STOP_POSITION(e,t),source:r}]:[],"validate")}},required:["color","position"]},Je={tokenType:"gradient",schema:{type:"array",errorMessage:n((e,t)=>u.VALIDATE.INVALID_ARRAY(e,t),"errorMessage"),validate:n((e,t,r)=>{const i=e,o=[];return i.forEach((s,a)=>{o.push(...$(Xe,s,`${t}[${a}]`,r))}),o},"validate")}};function Qe(e,t,r){return $(Je.schema,e,t,r)}n(Qe,"validateGradient");const et={tokenType:"fluidDimension",schema:{type:"object",errorMessage:n((e,t)=>u.VALIDATE.INVALID_FLUID_DIMENSION(e,t),"errorMessage"),properties:{min:h.schema,max:h.schema},required:["min","max"]}};function tt(e,t,r,i){const o=[];return i?.fluid?.viewports||o.push({path:t,message:u.VALIDATE.MISSING_FLUID_CONFIG(t),source:r}),o.push(...$(et.schema,e,t,r)),o}n(tt,"validateFluidDimension");const rt={color:Re,dimension:Fe,fluidDimension:tt,duration:we,cubicBezier:xe,fontFamily:ke,fontWeight:Ce,number:ve,strokeStyle:ze,typography:Ue,border:He,shadow:Ze,gradient:Qe,transition:Ke};function v(e,t){const r=[];for(const[i,o]of Object.entries(e)){if(typeof o!="object"||o===null||!("$type"in o)||!("$path"in o)||o.$path.startsWith("$"))continue;const s=rt[o.$type];if(!s){r.push({path:o.$path,message:u.VALIDATE.UNKNOWN_TOKEN_TYPE(o.$type,o.$path),source:o.$source});continue}r.push(...s(o.$value,o.$path,o.$source,t))}return r}n(v,"validate");function F(e,t){return e.map(r=>({name:r.name,tokens:Object.entries(t).reduce((i,[o,s])=>("$source"in s&&s.$source.file!==r.name||("$type"in s?s.$source.file===r.name&&(i[o]=s):i[o]=s),i),{})}))}n(F,"processTrees");function k(e,t){const r=[],i=[],o=new Map;return t?.length?{...e.reduce((a,{name:c,tokens:f})=>{let d=!1;return t.forEach(l=>{l.modes?.length&&l.modes.forEach(I=>{if(!I.files.includes(c))return;const m=o.get(c);m&&m.collection===l.name&&r.push({type:"warning",message:u.NORMALIZE.DUPLICATE_MODE_WARNING(c,l.name,I.name),file:c,collection:l.name,mode:I.name}),o.set(c,{collection:l.name,mode:I.name}),d=!0;const A=a.tokens[l.name]||{},y=A[I.name]||{};a.tokens[l.name]={...A,[I.name]:{...y,...f}}})}),d||t.forEach(l=>{if(!l.modes&&l.files?.includes(c)){const I=o.get(c);I&&!t.find(m=>m.name===I.collection)?.modes?.length&&r.push({type:"warning",message:u.NORMALIZE.DUPLICATE_FILE_WARNING(c,l.name),file:c,collection:l.name}),o.set(c,{collection:l.name}),d=!0,a.tokens[l.name]={default:{...a.tokens[l.name]?.default,...f}}}}),d||(a.tokens.default={default:{...a.tokens.default?.default,...f}}),a},{tokens:{default:{default:{}}},errors:[],warnings:[],processedFiles:new Map}),errors:i,warnings:r}:{tokens:{default:{default:e.reduce((c,{tokens:f})=>({...c,...f}),{})}},errors:[],warnings:[]}}n(k,"normalizeTokens");const q=new Map;function nt(e){const t=q.get(e);if(t)return t;const r=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z])(?=[a-z])/g,"$1-$2").toLowerCase();return q.set(e,r),r}n(nt,"toKebabCase");function ot(e){return typeof e=="object"&&e!==null&&typeof e.query=="string"&&typeof e.value=="string"}n(ot,"isFeatureValue");function it(e){return typeof e!="object"||e===null||!("value"in e)||typeof e.value!="string"&&typeof e.value!="number"?!1:"featureValues"in e?Array.isArray(e.featureValues)?e.featureValues.every(ot):!1:!0}n(it,"isSimpleCSSProperties");function M(e){return!!(typeof e=="string"||typeof e=="number"||it(e))}n(M,"isValidCSSValue");function st(e){return/^--[a-zA-Z][a-zA-Z0-9-]*$/.test(e)}n(st,"isValidCSSVariableName");const K="@supports (color: color(display-p3 1 1 1))";function at(e){return e.$type==="typography"}n(at,"isTypographyToken");function C(e){return e.split(".").join("-")}n(C,"formatCSSVarPath");function Z(e){return typeof e=="number"?e:typeof e!="string"?(console.warn("Unexpected value type in convertReferenceToCSSVar, got:",e),String(e)):e.replace(/\{([^}]+)\}/g,(t,r)=>`var(--${r.split(".").map(nt).join("-")})`)}n(Z,"convertReferenceToCSSVar");function ct(e,t){const r=`--${C(e.$path)}`,i=e.$cssProperties;if(!("value"in i))return;const o=i.value;if(!M(o)){t.push({path:e.$path,message:u.GENERATE.INVALID_CSS_VALUE(e.$path,String(o))});return}if(!st(r)){t.push({path:e.$path,message:u.GENERATE.INVALID_VARIABLE_NAME(e.$path,r)});return}return{name:r,value:Z(o)}}n(ct,"generateSingleVariable");function ut(e,t){const r=[];return Object.entries(e.$cssProperties).forEach(([i,o])=>{if(o!==void 0){if(!M(o)){t.push({path:`${e.$path}-${i}`,message:u.GENERATE.INVALID_CSS_VALUE(e.$path,String(o))});return}r.push({name:`--${C(e.$path)}-${i}`,value:Z(o)})}}),r}n(ut,"generateTypographyVariables");function X(e,t){if(e.$type!=="color")return[];const r=e.$cssProperties;if(!("featureValues"in r))return[];const i=[];return r.featureValues?.forEach(o=>{if(o.query===K){if(!M(o.value)){t.push({path:e.$path,message:u.GENERATE.INVALID_CSS_VALUE(e.$path,String(o.value))});return}i.push({name:`--${C(e.$path)}`,value:o.value})}}),i}n(X,"generateFeatureVariables");function J(e){const t=[`${e.selector} {`];if(e.comment&&t.push(` /* ${e.comment} */`),e.vars.length>0){const r=e.vars.map(i=>` ${i.name}: ${i.value};`).join(`
2
+ `);t.push(r)}return t.push("}"),t.join(`
3
+ `)}n(J,"generateCSSBlock");function ft(e){const t=[];return e.root.vars.length>0&&t.push(J({selector:e.root.selector,vars:e.root.vars})),e.features.forEach(r=>{const o=J({selector:e.root.selector,vars:r.vars}).split(`
4
+ `).map(s=>` ${s}`).join(`
5
+ `);t.push(`${r.query} {
6
+ ${o}
7
+ }`)}),t.filter(Boolean).join(`
5
8
 
6
- `),e=e.replace(/}$/,`
7
- }`),e}n(Re,"formatCSSVars");function Ce(e){const t={root:{},groups:{},tokens:{}},r=[];if(D(e)){const{value:o,errors:i}=h(e,"");t.root=o,r.push(...i)}return P(e,"",t,r),{metadata:t,errors:r}}n(Ce,"collectMetadata");function P(e,t,r,o){for(const[i,s]of Object.entries(e)){if(i.startsWith("$"))continue;const a=t?`${t}.${i}`:i;if(!(typeof s!="object"||s===null)){if(!("$value"in s)&&D(s)){const{value:u,errors:f}=h(s,a);f.length>0&&o.push(...f),r.groups[a]=u}else if("$value"in s&&D(s)){const{value:u,errors:f}=h(s,a);f.length>0&&o.push(...f),r.tokens[a]=u}"$value"in s||P(s,a,r,o)}}}n(P,"collectNodeMetadata");function h(e,t){const r={},o=[];return w(e)?("$extensions"in e&&(typeof e.$extensions!="object"||e.$extensions===null?o.push({path:t,message:c.METADATA.INVALID_EXTENSIONS(t)}):r.$extensions=e.$extensions),"$description"in e&&(typeof e.$description!="string"?o.push({path:t,message:c.METADATA.INVALID_DESCRIPTION(t)}):r.$description=e.$description),{value:r,errors:o}):{value:r,errors:o}}n(h,"extractMetadata");function D(e){return w(e)&&("$extensions"in e||"$description"in e)}n(D,"hasMetadata");function w(e){return typeof e=="object"&&e!==null}n(w,"isValidNode");function Fe(e){return JSON.parse(e)}n(Fe,"parseJson");const Me={isObject:n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObject")};function d(e,t,r){if(l(t))return[];switch(e.type){case"object":return xe(e,t,r);case"union":return je(e,t,r);case"array":return Ue(e,t,r);default:return ke(e,t,r)}}n(d,"validateSchema");function ke(e,t,r){return typeof t!==e.type?[{path:r,message:e.errorMessage?.(t,r)||c.VALIDATE.INVALID_TYPE(e.type,t,r)}]:e.validate?.(t,r)??[]}n(ke,"validateSimpleValue");function xe(e,t,r){if(!Me.isObject(t))return[{path:r,message:e.errorMessage?.(t,r)||c.VALIDATE.INVALID_TYPE("object",t,r)}];const o=[],i=t;if(e.required)for(const s of e.required)s in i||o.push({path:`${r}.${s}`,message:c.VALIDATE.MISSING_REQUIRED_PROPERTY(s,r)});for(const[s,a]of Object.entries(e.properties))s in i&&o.push(...d(a,i[s],`${r}.${s}`));return o}n(xe,"validateObject");function je(e,t,r){let o=[];for(const s of e.oneOf){const a=d(s,t,r);if(a.length===0)return e.validate?.(t,r)??[];o=o.concat(a)}return[o.reduce((s,a)=>a.path.length>s.path.length?a:s)]}n(je,"validateUnion");function Ue(e,t,r){return Array.isArray(t)?e.validate?.(t,r)??[]:[{path:r,message:e.errorMessage?.(t,r)||c.VALIDATE.INVALID_TYPE("array",t,r)}]}n(Ue,"validateArray");const T={tokenType:"color",schema:{type:"string",errorMessage:n((e,t)=>c.VALIDATE.INVALID_COLOR(e,t),"errorMessage"),validate:n((e,t)=>/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)?[]:[{path:t,message:c.VALIDATE.INVALID_COLOR(e,t)}],"validate")}};function Pe(e,t){return d(T.schema,e,t)}n(Pe,"validateColor");const E={tokenType:"number",schema:{type:"number",errorMessage:n((e,t)=>c.VALIDATE.INVALID_NUMBER(e,t),"errorMessage"),validate:n((e,t)=>typeof e!="number"||isNaN(e)?[{path:t,message:c.VALIDATE.INVALID_NUMBER(e,t)}]:[],"validate")}};function we(e,t){return d(E.schema,e,t)}n(we,"validateNumber");const p={tokenType:"dimension",schema:{type:"object",errorMessage:n((e,t)=>c.VALIDATE.INVALID_DIMENSION(e,t),"errorMessage"),properties:{value:E.schema,unit:{type:"string",validate:n((e,t)=>typeof e!="string"||!["px","rem"].includes(e)?[{path:t,message:c.VALIDATE.INVALID_DIMENSION_UNIT(e,t)}]:[],"validate")}},required:["value","unit"]}};function Ye(e,t){return d(p.schema,e,t)}n(Ye,"validateDimension");const Y={tokenType:"fontFamily",schema:{type:"union",errorMessage:n((e,t)=>c.VALIDATE.INVALID_FONT_FAMILY(e,t),"errorMessage"),oneOf:[{type:"string",errorMessage:n((e,t)=>c.VALIDATE.INVALID_FONT_FAMILY(e,t),"errorMessage")},{type:"array",validate:n((e,t)=>e.every(o=>typeof o=="string")?[]:[{path:t,message:c.VALIDATE.INVALID_FONT_FAMILY(e,t)}],"validate")}]}};function Ge(e,t){return d(Y.schema,e,t)}n(Ge,"validateFontFamily");const We=["thin","hairline","extra-light","ultra-light","light","normal","regular","book","medium","semi-bold","demi-bold","bold","extra-bold","ultra-bold","black","heavy","extra-black","ultra-black"],G={tokenType:"fontWeight",schema:{type:"union",errorMessage:n((e,t)=>c.VALIDATE.INVALID_FONT_WEIGHT(e,t),"errorMessage"),oneOf:[{type:"number",errorMessage:n((e,t)=>c.VALIDATE.INVALID_FONT_WEIGHT(e,t),"errorMessage"),validate:n((e,t)=>e<1||e>1e3?[{path:t,message:c.VALIDATE.INVALID_FONT_WEIGHT(e,t)}]:[],"validate")},{type:"string",errorMessage:n((e,t)=>c.VALIDATE.INVALID_FONT_WEIGHT(e,t),"errorMessage"),validate:n((e,t)=>We.includes(e.toLowerCase())?[]:[{path:t,message:c.VALIDATE.INVALID_FONT_WEIGHT(e,t)}],"validate")}]}};function Be(e,t){return d(G.schema,e,t)}n(Be,"validateFontWeight");const ze=["ms","s"],_={tokenType:"duration",schema:{type:"object",errorMessage:n((e,t)=>c.VALIDATE.INVALID_DURATION(e,t),"errorMessage"),properties:{value:E.schema,unit:{type:"string",validate:n((e,t)=>(console.log("value",e),ze.includes(e)?[]:[{path:t,message:c.VALIDATE.INVALID_DURATION_UNIT(e,t)}]),"validate")}},required:["value","unit"]}};function qe(e,t){return d(_.schema,e,t)}n(qe,"validateDuration");const W={tokenType:"cubicBezier",schema:{type:"array",errorMessage:n((e,t)=>c.VALIDATE.INVALID_CUBIC_BEZIER(e,t),"errorMessage"),validate:n((e,t)=>{const r=e;if(r.length!==4||!r.every(s=>typeof s=="number"))return[{path:t,message:c.VALIDATE.INVALID_CUBIC_BEZIER(e,t)}];const[o,,i]=r;return o<0||o>1||i<0||i>1?[{path:t,message:c.VALIDATE.INVALID_CUBIC_BEZIER_RANGE(e,t)}]:[]},"validate")}};function He(e,t){return d(W.schema,e,t)}n(He,"validateCubicBezier");const Ke={tokenType:"typography",schema:{type:"object",properties:{fontFamily:Y.schema,fontSize:p.schema,letterSpacing:p.schema,lineHeight:E.schema,fontWeight:G.schema},required:["fontFamily","fontSize"],errorMessage:n((e,t)=>c.VALIDATE.INVALID_TYPOGRAPHY(e,t),"errorMessage")}};function Xe(e,t){return d(Ke.schema,e,t)}n(Xe,"validateTypography");const Ze=["solid","dashed","dotted","double","groove","ridge","outset","inset"],Qe=["round","butt","square"],Je={type:"object",errorMessage:n((e,t)=>c.VALIDATE.INVALID_STROKE_STYLE(e,t),"errorMessage"),properties:{dashArray:{type:"array",validate:n((e,t)=>{const r=e,o=[];return r.forEach((i,s)=>{typeof i!="string"&&o.push(...d(p.schema,i,`${t}[${s}]`))}),o},"validate")},lineCap:{type:"string",validate:n((e,t)=>Qe.includes(e)?[]:[{path:t,message:c.VALIDATE.INVALID_STROKE_LINE_CAP(e,t)}],"validate")}},required:["dashArray","lineCap"]},B={tokenType:"strokeStyle",schema:{type:"union",oneOf:[{type:"string",errorMessage:n((e,t)=>c.VALIDATE.INVALID_STROKE_STYLE(e,t),"errorMessage"),validate:n((e,t)=>Ze.includes(e)?[]:[{path:t,message:c.VALIDATE.INVALID_STROKE_STYLE(e,t)}],"validate")},Je]}};function et(e,t){return d(B.schema,e,t)}n(et,"validateStrokeStyle");const tt={tokenType:"border",schema:{type:"object",properties:{color:T.schema,width:p.schema,style:B.schema},required:["color","width","style"],errorMessage:n((e,t)=>c.VALIDATE.INVALID_BORDER(e,t),"errorMessage")}};function rt(e,t){return d(tt.schema,e,t)}n(rt,"validateBorder");const nt={tokenType:"transition",schema:{type:"object",properties:{duration:_.schema,delay:_.schema,timingFunction:W.schema},required:["duration","delay","timingFunction"],errorMessage:n((e,t)=>c.VALIDATE.INVALID_TRANSITION(e,t),"errorMessage")}};function ot(e,t){return d(nt.schema,e,t)}n(ot,"validateTransition");const z={tokenType:"shadow",schema:{type:"object",properties:{color:T.schema,offsetX:p.schema,offsetY:p.schema,blur:p.schema,spread:p.schema,inset:{type:"boolean",errorMessage:n((e,t)=>c.VALIDATE.INVALID_SHADOW_INSET(e,t),"errorMessage")}},required:["color","offsetX","offsetY","blur","spread"],errorMessage:n((e,t)=>c.VALIDATE.INVALID_SHADOW(e,t),"errorMessage")}};function it(e,t){const r=[];return Array.isArray(e)?(e.forEach((o,i)=>{r.push(...d(z.schema,o,`${t}[${i}]`))}),r):d(z.schema,e,t)}n(it,"validateShadow");const st={type:"object",errorMessage:n((e,t)=>c.VALIDATE.INVALID_GRADIENT(e,t),"errorMessage"),properties:{color:{type:"string",validate:T.schema.validate},position:{type:"number",validate:n((e,t)=>e<0||e>1?[{path:t,message:c.VALIDATE.INVALID_GRADIENT_STOP_POSITION(e,t)}]:[],"validate")}},required:["color","position"]},at={tokenType:"gradient",schema:{type:"array",errorMessage:n((e,t)=>c.VALIDATE.INVALID_ARRAY(e,t),"errorMessage"),validate:n((e,t)=>{const r=e,o=[];return r.forEach((i,s)=>{o.push(...d(st,i,`${t}[${s}]`))}),o},"validate")}};function ct(e,t){return d(at.schema,e,t)}n(ct,"validateGradient");const ut={tokenType:"fluidDimension",schema:{type:"object",errorMessage:n((e,t)=>c.VALIDATE.INVALID_FLUID_DIMENSION(e,t),"errorMessage"),properties:{min:p.schema,max:p.schema},required:["min","max"]}};function lt(e,t){return d(ut.schema,e,t)}n(lt,"validateFluidDimension");const ft={color:n((e,t)=>Pe(e,t),"color"),dimension:n((e,t)=>Ye(e,t),"dimension"),fluidDimension:n((e,t)=>lt(e,t),"fluidDimension"),duration:n((e,t)=>qe(e,t),"duration"),cubicBezier:n((e,t)=>He(e,t),"cubicBezier"),fontFamily:n((e,t)=>Ge(e,t),"fontFamily"),fontWeight:n((e,t)=>Be(e,t),"fontWeight"),number:n((e,t)=>we(e,t),"number"),strokeStyle:n((e,t)=>et(e,t),"strokeStyle"),typography:n((e,t)=>Xe(e,t),"typography"),border:n((e,t)=>rt(e,t),"border"),shadow:n((e,t)=>it(e,t),"shadow"),gradient:n((e,t)=>ct(e,t),"gradient"),transition:n((e,t)=>ot(e,t),"transition")};function dt(e,t,r){const o=[];if(!("$type"in e))return[{path:t,message:c.VALIDATE.MISSING_TYPE(t)}];if(!("$value"in e))return[{path:t,message:c.VALIDATE.MISSING_VALUE(t)}];const i=ft[e.$type];return i?(e.$type==="fluidDimension"&&(M(t,r)?.viewports||o.push({path:t,message:c.VALIDATE.MISSING_FLUID_CONFIG(t)})),[...o,...i(e.$value,t)]):[{path:t,message:c.VALIDATE.UNKNOWN_TOKEN_TYPE(e.$type,t)}]}n(dt,"validateTokenNode");function It(e,t){const r=[];for(const[o,i]of Object.entries(e))if(!(typeof i!="object"||i===null)&&!(!i.$path||i.$path.startsWith("$"))){if(typeof i!="object"||i===null){r.push({path:o,message:c.VALIDATE.INVALID_TOKEN_STRUCTURE(o)});continue}r.push(...dt(i,i.$path,t))}return r}n(It,"validate");export{Ce as collectMetadata,Te as convert,X as flatten,ve as generateCSS,Fe as parseJson,Z as resolve,It as validate};
9
+ `)}n(ft,"convertCSSVarsToString");function lt(e,t){if(at(e))return{vars:ut(e,t),features:X(e,t)};const r=ct(e,t);return{vars:r?[r]:[],features:X(e,t)}}n(lt,"generateVariablesForToken");async function j(e,t={}){const r=[],i=Object.entries(e).filter(([f,d])=>f!=="$extensions"&&"$type"in d).map(([f,d])=>lt(d,r));let o=":root";t.collection&&t.mode&&t.mode!=="default"&&(o+=`[data-theme="${t.mode}"]`);const s=i.flatMap(f=>f.vars),a=i.flatMap(f=>f.features||[]),c=ft({root:{selector:o,vars:s},features:a.length?[{query:K,vars:a}]:[]});return{output:[{name:"variables.css",content:dt(c)}],errors:r}}n(j,"generateCSS");function dt(e){return e.endsWith(`
10
+ `)?e:e+`
11
+ `}n(dt,"formatCSSVars");async function w(e,t){const r=[];return{output:t?.separate?await It(e,r,t):await pt(e,r,t),errors:r}}n(w,"generate");async function pt(e,t,r){const i=[];for(const[o,s]of Object.entries(e))for(const[a,c]of Object.entries(s)){const f=await j(c,{mode:a!=="default"?a:void 0,collection:o!=="default"?o:void 0});t.push(...f.errors.map(d=>({...d,path:`${o}.${a}.${d.path}`}))),f.output[0]?.content&&i.push(f.output[0].content)}return[{name:r?.directory?`${r.directory}/variables.css`:"variables.css",content:i.filter(Boolean).join(`
12
+ `).trim()+`
13
+ `}]}n(pt,"generateSingleFile");async function It(e,t,r){const i=r?.directory||"",o=[],s=e.default?.default;if(s&&Object.keys(e).length===1){const a=new Map;for(const[c,f]of Object.entries(s)){const d=c.split(".")[0]||"default";a.has(d)||a.set(d,{});const l=a.get(d);l[c]=f}for(const[c,f]of a){const d=await j(f,{});d.output[0]?.content&&o.push({name:`${i}/${c}.css`,content:d.output[0].content}),t.push(...d.errors.map(l=>({...l,path:`${c}.${l.path}`})))}return o}for(const[a,c]of Object.entries(e))if(Object.keys(c).length!==0)for(const[f,d]of Object.entries(c)){if(Object.keys(d).length===0)continue;const l=await j(d,{mode:f!=="default"?f:void 0,collection:a!=="default"?a:void 0});if(t.push(...l.errors.map(I=>({...I,path:`${a}.${f}.${I.path}`}))),l.output[0]?.content){const I=a==="default"?Object.keys(d)[0].split(".")[0]:a;o.push({name:`${i}/${I}.css`,content:l.output[0].content})}}return o}n(It,"generateSeparateFiles");async function mt(e){const t={load:[],flatten:[],validation:[],resolution:[],generation:[]},r={normalization:[]},{trees:i,errors:o}=await L(e.files);t.load.push(...o);const{tokens:s,errors:a}=b(i);t.flatten.push(...a);const c=v(s,e);if(t.validation.push(...c),c.length>0)return{output:[],trees:i,errors:t,warnings:r};const{resolved:f,errors:d}=V(s);t.resolution.push(...d);const l=F(i,f),{tokens:I,warnings:m}=k(l,e.collections);r.normalization.push(...m);const A=O(I,e),{output:y,errors:_}=await w(A,e.output);return t.generation.push(..._),{output:y,trees:i,errors:t,warnings:r}}n(mt,"tokensToCSSPipeline");async function $t(e){const{trees:t,errors:r}=await L(e.files),{tokens:i,errors:o}=b(t),s=v(i,e),{resolved:a,errors:c}=V(i);return{trees:t,flattenedTokens:i,resolved:a,errors:{load:r,flatten:o,validation:s,resolution:c}}}n($t,"validationPipeline");async function ht(e,t,r){const i={generation:[]},o={normalization:[]},s=F(e,t),{tokens:a,warnings:c}=k(s,r.collections);o.normalization.push(...c);const f=O(a,r),{output:d,errors:l}=await w(f,r.output);return i.generation.push(...l),{output:d,errors:i,warnings:o}}n(ht,"generationPipeline");export{O as convert,b as flatten,w as generate,ht as generationPipeline,L as loadTreesFromConfig,k as normalizeTokens,De as parseJson,F as processTrees,V as resolve,mt as tokensToCSSPipeline,v as validate,$t as validationPipeline};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarcube-org/core",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.2",
4
4
  "publishConfig": {
5
5
  "access": "restricted"
6
6
  },
@@ -12,7 +12,15 @@
12
12
  "README.md"
13
13
  ],
14
14
  "devDependencies": {
15
- "pkgroll": "^2.5.1"
15
+ "@types/picomatch": "^3.0.1",
16
+ "pkgroll": "^2.5.1",
17
+ "tsx": "^4.19.2"
18
+ },
19
+ "dependencies": {
20
+ "fast-glob": "^3.3.2",
21
+ "globby": "^14.0.2",
22
+ "picomatch": "^4.0.2",
23
+ "zod": "^3.21.4"
16
24
  },
17
25
  "scripts": {
18
26
  "build": "pkgroll --minify",