@mildastudio/milda 0.1.0 → 0.2.0
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/README.md +51 -19
- package/dist/index.cjs +7849 -0
- package/dist/index.d.cts +1485 -0
- package/dist/index.d.mts +1259 -498
- package/dist/index.mjs +7732 -3007
- package/package.json +17 -10
- package/dist/index.d.ts +0 -724
- package/dist/index.js +0 -3094
package/dist/index.d.ts
DELETED
|
@@ -1,724 +0,0 @@
|
|
|
1
|
-
type Id = string;
|
|
2
|
-
interface TypeRef {
|
|
3
|
-
kind: 'ref';
|
|
4
|
-
ref: Id;
|
|
5
|
-
}
|
|
6
|
-
type TypeExpr = {
|
|
7
|
-
kind: 'string';
|
|
8
|
-
} | {
|
|
9
|
-
kind: 'number';
|
|
10
|
-
min?: number;
|
|
11
|
-
max?: number;
|
|
12
|
-
} | {
|
|
13
|
-
kind: 'boolean';
|
|
14
|
-
} | {
|
|
15
|
-
kind: 'enum';
|
|
16
|
-
values: string[];
|
|
17
|
-
} | {
|
|
18
|
-
kind: 'union';
|
|
19
|
-
members: TypeExpr[];
|
|
20
|
-
} | TypeRef | {
|
|
21
|
-
kind: 'array';
|
|
22
|
-
item: TypeExpr;
|
|
23
|
-
} | {
|
|
24
|
-
kind: 'object';
|
|
25
|
-
fields: ObjectField[];
|
|
26
|
-
} | {
|
|
27
|
-
kind: 'component';
|
|
28
|
-
componentIds?: Id[];
|
|
29
|
-
};
|
|
30
|
-
interface ObjectField {
|
|
31
|
-
id: Id;
|
|
32
|
-
name: string;
|
|
33
|
-
type: TypeExpr;
|
|
34
|
-
required: boolean;
|
|
35
|
-
description?: string;
|
|
36
|
-
}
|
|
37
|
-
type PropValue = string | number | boolean | PropValue[] | {
|
|
38
|
-
[key: string]: PropValue;
|
|
39
|
-
};
|
|
40
|
-
interface SharedType {
|
|
41
|
-
id: Id;
|
|
42
|
-
name: string;
|
|
43
|
-
description?: string;
|
|
44
|
-
definition: TypeExpr;
|
|
45
|
-
}
|
|
46
|
-
type ParamBinding = {
|
|
47
|
-
prop: Id;
|
|
48
|
-
} | {
|
|
49
|
-
static: PropValue;
|
|
50
|
-
};
|
|
51
|
-
interface DocumentMeta {
|
|
52
|
-
id: Id;
|
|
53
|
-
name: string;
|
|
54
|
-
version: string;
|
|
55
|
-
description?: string;
|
|
56
|
-
createdAt?: string;
|
|
57
|
-
updatedAt?: string;
|
|
58
|
-
}
|
|
59
|
-
type DocumentKind = 'prelude' | 'design-system';
|
|
60
|
-
interface MildaDocumentBase {
|
|
61
|
-
milda: string;
|
|
62
|
-
kind: DocumentKind;
|
|
63
|
-
prelude: string;
|
|
64
|
-
meta: DocumentMeta;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface TokenRef {
|
|
68
|
-
ref: Id;
|
|
69
|
-
}
|
|
70
|
-
type PrimitiveTokenType = 'color' | 'spacing' | 'radius' | 'size' | 'shadow' | 'typography' | 'fontFamily' | 'duration' | 'opacity' | 'blur' | 'tonal' | 'border';
|
|
71
|
-
type FacetTokenType = 'elevation' | 'ring' | 'backdrop' | 'none';
|
|
72
|
-
type TokenType$1 = PrimitiveTokenType | FacetTokenType;
|
|
73
|
-
type ColorSpace = 'srgb' | 'display-p3' | 'oklch' | 'hsl';
|
|
74
|
-
interface ColorValue {
|
|
75
|
-
space: ColorSpace;
|
|
76
|
-
channels: number[];
|
|
77
|
-
alpha?: number;
|
|
78
|
-
}
|
|
79
|
-
type DimensionUnit = 'scaled' | 'fixed' | 'percent' | 'em';
|
|
80
|
-
interface DimensionValue {
|
|
81
|
-
value: number;
|
|
82
|
-
unit: DimensionUnit;
|
|
83
|
-
}
|
|
84
|
-
type ColorOrRef = ColorValue | TokenRef;
|
|
85
|
-
type DimensionOrRef = DimensionValue | TokenRef;
|
|
86
|
-
interface ShadowLayer {
|
|
87
|
-
offsetX: DimensionValue;
|
|
88
|
-
offsetY: DimensionValue;
|
|
89
|
-
blur: DimensionValue;
|
|
90
|
-
spread: DimensionValue;
|
|
91
|
-
color: ColorOrRef;
|
|
92
|
-
inset: boolean;
|
|
93
|
-
}
|
|
94
|
-
interface ShadowValue {
|
|
95
|
-
layers: ShadowLayer[];
|
|
96
|
-
}
|
|
97
|
-
type FontCategory = 'sans' | 'serif' | 'mono' | 'display';
|
|
98
|
-
interface FontFamilyValue {
|
|
99
|
-
family: string;
|
|
100
|
-
fallback: string[];
|
|
101
|
-
category: FontCategory;
|
|
102
|
-
assetId?: Id | null;
|
|
103
|
-
}
|
|
104
|
-
interface TypographyValue {
|
|
105
|
-
family: TokenRef | FontFamilyValue;
|
|
106
|
-
size: DimensionValue;
|
|
107
|
-
weight: number;
|
|
108
|
-
lineHeight: DimensionValue | {
|
|
109
|
-
ratio: number;
|
|
110
|
-
};
|
|
111
|
-
letterSpacing: DimensionValue;
|
|
112
|
-
italic?: boolean;
|
|
113
|
-
uppercase?: boolean;
|
|
114
|
-
}
|
|
115
|
-
interface DurationValue {
|
|
116
|
-
ms: number;
|
|
117
|
-
}
|
|
118
|
-
interface OpacityValue {
|
|
119
|
-
value: number;
|
|
120
|
-
}
|
|
121
|
-
interface BlurValue {
|
|
122
|
-
radius: DimensionValue;
|
|
123
|
-
}
|
|
124
|
-
interface TonalValue {
|
|
125
|
-
level: number;
|
|
126
|
-
}
|
|
127
|
-
type BorderWidth = 'hairline' | 'thin' | 'thick' | DimensionValue;
|
|
128
|
-
type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'none';
|
|
129
|
-
interface BorderValue {
|
|
130
|
-
width: BorderWidth;
|
|
131
|
-
style: BorderStyle;
|
|
132
|
-
color: ColorOrRef;
|
|
133
|
-
}
|
|
134
|
-
interface NoneValue {
|
|
135
|
-
none: true;
|
|
136
|
-
}
|
|
137
|
-
interface TokenValueSchemaByType {
|
|
138
|
-
color: ColorValue;
|
|
139
|
-
spacing: DimensionValue;
|
|
140
|
-
radius: DimensionValue;
|
|
141
|
-
size: DimensionValue;
|
|
142
|
-
shadow: ShadowValue;
|
|
143
|
-
typography: TypographyValue;
|
|
144
|
-
fontFamily: FontFamilyValue;
|
|
145
|
-
duration: DurationValue;
|
|
146
|
-
opacity: OpacityValue;
|
|
147
|
-
blur: BlurValue;
|
|
148
|
-
tonal: TonalValue;
|
|
149
|
-
border: BorderValue;
|
|
150
|
-
elevation: NoneValue;
|
|
151
|
-
ring: NoneValue;
|
|
152
|
-
backdrop: NoneValue;
|
|
153
|
-
none: NoneValue;
|
|
154
|
-
}
|
|
155
|
-
type AnyTokenValue = TokenValueSchemaByType[TokenType$1];
|
|
156
|
-
interface RawTokenValue<T extends TokenType$1 = TokenType$1> {
|
|
157
|
-
kind: 'raw';
|
|
158
|
-
value: TokenValueSchemaByType[T];
|
|
159
|
-
}
|
|
160
|
-
interface AliasTokenValue {
|
|
161
|
-
kind: 'alias';
|
|
162
|
-
by: Id;
|
|
163
|
-
refs: Record<string, Id>;
|
|
164
|
-
}
|
|
165
|
-
interface EscapeTokenValue {
|
|
166
|
-
kind: 'escape';
|
|
167
|
-
raw: string;
|
|
168
|
-
note?: string;
|
|
169
|
-
}
|
|
170
|
-
type TokenValue<T extends TokenType$1 = TokenType$1> = RawTokenValue<T> | AliasTokenValue | EscapeTokenValue;
|
|
171
|
-
interface Token$1<T extends TokenType$1 = TokenType$1> {
|
|
172
|
-
id: Id;
|
|
173
|
-
name: string;
|
|
174
|
-
type: T;
|
|
175
|
-
value: TokenValue<T>;
|
|
176
|
-
description?: string;
|
|
177
|
-
}
|
|
178
|
-
interface Layer {
|
|
179
|
-
id: Id;
|
|
180
|
-
name: string;
|
|
181
|
-
order: number;
|
|
182
|
-
tokens: Token$1[];
|
|
183
|
-
}
|
|
184
|
-
interface Context {
|
|
185
|
-
id: Id;
|
|
186
|
-
name: string;
|
|
187
|
-
}
|
|
188
|
-
interface ContextGroup {
|
|
189
|
-
id: Id;
|
|
190
|
-
name: string;
|
|
191
|
-
contexts: Context[];
|
|
192
|
-
}
|
|
193
|
-
declare const TOKEN_VALUE_KIND: Record<TokenType$1, 'color' | 'dimension' | 'shadow' | 'typography' | 'fontFamily' | 'duration' | 'opacity' | 'blur' | 'tonal' | 'border' | 'facet'>;
|
|
194
|
-
|
|
195
|
-
type FacetName = 'fill' | 'ink' | 'border' | 'corner' | 'inset' | 'gap' | 'text' | 'textClamp' | 'textWrap' | 'elevation' | 'overlay' | 'opacity' | 'ring' | 'backdrop';
|
|
196
|
-
type InsetValue = {
|
|
197
|
-
block?: Id;
|
|
198
|
-
inline?: Id;
|
|
199
|
-
} | {
|
|
200
|
-
top?: Id;
|
|
201
|
-
right?: Id;
|
|
202
|
-
bottom?: Id;
|
|
203
|
-
left?: Id;
|
|
204
|
-
} | {
|
|
205
|
-
all: Id;
|
|
206
|
-
};
|
|
207
|
-
type FacetValue = {
|
|
208
|
-
token: Id;
|
|
209
|
-
} | {
|
|
210
|
-
literal: string | number | boolean;
|
|
211
|
-
} | {
|
|
212
|
-
inset: InsetValue;
|
|
213
|
-
} | {
|
|
214
|
-
raw: string;
|
|
215
|
-
};
|
|
216
|
-
type FacetMap = Partial<Record<FacetName, FacetValue>>;
|
|
217
|
-
type StackAxis = 'row' | 'column' | 'layers';
|
|
218
|
-
type AxisIntent = 'fit' | 'fill' | {
|
|
219
|
-
weight: number;
|
|
220
|
-
} | {
|
|
221
|
-
fixed: Id;
|
|
222
|
-
} | {
|
|
223
|
-
ratio: {
|
|
224
|
-
w: number;
|
|
225
|
-
h: number;
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
interface AxisSize {
|
|
229
|
-
intent: AxisIntent;
|
|
230
|
-
min?: Id;
|
|
231
|
-
max?: Id;
|
|
232
|
-
}
|
|
233
|
-
type AxisSizeValue = AxisIntent | AxisSize;
|
|
234
|
-
type Distribute = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
235
|
-
type Align = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
236
|
-
type Position = 'flow' | 'overlay' | {
|
|
237
|
-
pinned: 'top' | 'bottom' | 'left' | 'right' | 'all';
|
|
238
|
-
};
|
|
239
|
-
interface LayoutSpec {
|
|
240
|
-
stack?: StackAxis;
|
|
241
|
-
grid?: {
|
|
242
|
-
cols: number;
|
|
243
|
-
rows: number;
|
|
244
|
-
};
|
|
245
|
-
flow?: boolean;
|
|
246
|
-
gap?: Id;
|
|
247
|
-
inset?: InsetValue;
|
|
248
|
-
distribute?: Distribute;
|
|
249
|
-
align?: Align;
|
|
250
|
-
size?: {
|
|
251
|
-
width?: AxisSizeValue;
|
|
252
|
-
height?: AxisSizeValue;
|
|
253
|
-
};
|
|
254
|
-
position?: Position;
|
|
255
|
-
}
|
|
256
|
-
type StateName = 'pressed' | 'hovered' | 'focused' | 'active' | 'selected' | 'checked' | 'expanded' | 'open' | 'disabled' | 'readonly' | 'loading' | 'error' | 'success' | 'invalid' | 'valid' | 'indeterminate' | 'dragging' | 'empty' | 'complete' | 'first' | 'last' | 'odd' | 'even';
|
|
257
|
-
type Capability = 'input.keyboard' | 'input.pointer' | 'input.touch' | 'input.remote' | 'input.voice' | 'motion.haptic' | 'runtime.dynamic-color' | 'display.density' | 'a11y.screenreader' | 'platform.web' | 'platform.ios' | 'platform.android' | 'platform.tvos';
|
|
258
|
-
|
|
259
|
-
interface ProjectMetadataEntry {
|
|
260
|
-
id: Id;
|
|
261
|
-
key: string;
|
|
262
|
-
type: TypeExpr;
|
|
263
|
-
value?: PropValue;
|
|
264
|
-
}
|
|
265
|
-
interface Foundations {
|
|
266
|
-
contextGroups: ContextGroup[];
|
|
267
|
-
layers: Layer[];
|
|
268
|
-
sharedTypes: SharedType[];
|
|
269
|
-
metadata: ProjectMetadataEntry[];
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
interface AtomParam {
|
|
273
|
-
name: string;
|
|
274
|
-
bind?: boolean;
|
|
275
|
-
}
|
|
276
|
-
interface AtomContextVar {
|
|
277
|
-
name: string;
|
|
278
|
-
type?: string;
|
|
279
|
-
init?: string;
|
|
280
|
-
}
|
|
281
|
-
interface AtomStateNode {
|
|
282
|
-
id: string;
|
|
283
|
-
initial?: boolean;
|
|
284
|
-
}
|
|
285
|
-
interface AtomEvent {
|
|
286
|
-
name: string;
|
|
287
|
-
args?: string[];
|
|
288
|
-
}
|
|
289
|
-
interface Emit {
|
|
290
|
-
event: string;
|
|
291
|
-
arg?: string | boolean | number;
|
|
292
|
-
}
|
|
293
|
-
interface Assignment {
|
|
294
|
-
target: string;
|
|
295
|
-
expr: string;
|
|
296
|
-
}
|
|
297
|
-
type TransitionTarget = string | {
|
|
298
|
-
expr: string;
|
|
299
|
-
};
|
|
300
|
-
interface Transition {
|
|
301
|
-
from: string;
|
|
302
|
-
on?: string;
|
|
303
|
-
after?: string;
|
|
304
|
-
when?: string;
|
|
305
|
-
to?: TransitionTarget;
|
|
306
|
-
ctx?: Assignment[];
|
|
307
|
-
emit?: Emit;
|
|
308
|
-
do?: string;
|
|
309
|
-
note?: string;
|
|
310
|
-
}
|
|
311
|
-
interface Expose {
|
|
312
|
-
state: string;
|
|
313
|
-
when: string;
|
|
314
|
-
arg?: string;
|
|
315
|
-
}
|
|
316
|
-
interface RequiresClause {
|
|
317
|
-
anyOf: Capability[];
|
|
318
|
-
when?: string;
|
|
319
|
-
}
|
|
320
|
-
interface Atom {
|
|
321
|
-
kind: 'atom';
|
|
322
|
-
name: string;
|
|
323
|
-
doc?: string;
|
|
324
|
-
requires?: RequiresClause[];
|
|
325
|
-
params?: AtomParam[];
|
|
326
|
-
context?: AtomContextVar[];
|
|
327
|
-
states?: AtomStateNode[];
|
|
328
|
-
events?: AtomEvent[];
|
|
329
|
-
transitions: Transition[];
|
|
330
|
-
exposes?: Expose[];
|
|
331
|
-
emits?: {
|
|
332
|
-
name: string;
|
|
333
|
-
}[];
|
|
334
|
-
modes?: string[];
|
|
335
|
-
note?: string;
|
|
336
|
-
}
|
|
337
|
-
type CoordEntry = {
|
|
338
|
-
kind: 'wire';
|
|
339
|
-
from: string;
|
|
340
|
-
to: string;
|
|
341
|
-
arg?: string;
|
|
342
|
-
when?: string;
|
|
343
|
-
} | {
|
|
344
|
-
kind: 'gate';
|
|
345
|
-
machine: string;
|
|
346
|
-
activeWhen: string;
|
|
347
|
-
} | {
|
|
348
|
-
kind: 'broadcast';
|
|
349
|
-
set: string;
|
|
350
|
-
event: string;
|
|
351
|
-
} | {
|
|
352
|
-
kind: 'aggregate';
|
|
353
|
-
op: 'all' | 'any' | 'count' | 'first';
|
|
354
|
-
set: string;
|
|
355
|
-
pred: string;
|
|
356
|
-
as?: string;
|
|
357
|
-
then?: string;
|
|
358
|
-
} | {
|
|
359
|
-
kind: 'arena';
|
|
360
|
-
over: string[];
|
|
361
|
-
exclusive: boolean;
|
|
362
|
-
} | {
|
|
363
|
-
kind: 'requiresFail';
|
|
364
|
-
gesture: string;
|
|
365
|
-
failsAfter: string;
|
|
366
|
-
};
|
|
367
|
-
interface UsesClause {
|
|
368
|
-
atom: string;
|
|
369
|
-
as: string;
|
|
370
|
-
params?: Record<string, string>;
|
|
371
|
-
}
|
|
372
|
-
interface CompositeBehavior {
|
|
373
|
-
kind: 'composite';
|
|
374
|
-
name: string;
|
|
375
|
-
builtFrom: string[];
|
|
376
|
-
uses?: UsesClause[];
|
|
377
|
-
composition?: CoordEntry[];
|
|
378
|
-
note?: string;
|
|
379
|
-
}
|
|
380
|
-
type ArchetypeGroup = 'Actions' | 'Inputs' | 'Disclosure' | 'Navigation' | 'Collections' | 'Feedback' | 'Media';
|
|
381
|
-
interface ContentCategory {
|
|
382
|
-
level: 'phrase' | 'region';
|
|
383
|
-
interactive: boolean;
|
|
384
|
-
}
|
|
385
|
-
interface ArchetypeRealize {
|
|
386
|
-
target: string;
|
|
387
|
-
when?: string;
|
|
388
|
-
surface?: string;
|
|
389
|
-
browse?: string;
|
|
390
|
-
commit?: 'explicit' | 'continuous';
|
|
391
|
-
drop?: string[];
|
|
392
|
-
wire?: {
|
|
393
|
-
from: string;
|
|
394
|
-
to: string;
|
|
395
|
-
arg?: string;
|
|
396
|
-
}[];
|
|
397
|
-
note?: string;
|
|
398
|
-
}
|
|
399
|
-
type PartRole = 'container' | 'item' | 'text' | 'control' | 'input' | 'icon' | 'content';
|
|
400
|
-
interface AnatomyPart {
|
|
401
|
-
name: string;
|
|
402
|
-
role: PartRole;
|
|
403
|
-
optional?: boolean;
|
|
404
|
-
children?: AnatomyPart[];
|
|
405
|
-
}
|
|
406
|
-
interface ArchetypeDef {
|
|
407
|
-
kind: 'archetype';
|
|
408
|
-
name: string;
|
|
409
|
-
group: ArchetypeGroup;
|
|
410
|
-
contract: string;
|
|
411
|
-
produces: ContentCategory;
|
|
412
|
-
anatomy?: AnatomyPart[];
|
|
413
|
-
composes: string[];
|
|
414
|
-
uses?: UsesClause[];
|
|
415
|
-
composition?: CoordEntry[];
|
|
416
|
-
exposes?: Expose[];
|
|
417
|
-
emits?: {
|
|
418
|
-
name: string;
|
|
419
|
-
from?: string;
|
|
420
|
-
}[];
|
|
421
|
-
realize?: ArchetypeRealize[];
|
|
422
|
-
realizationNote?: string;
|
|
423
|
-
}
|
|
424
|
-
interface FacetDef {
|
|
425
|
-
name: FacetName;
|
|
426
|
-
covers: string;
|
|
427
|
-
divergence?: string;
|
|
428
|
-
}
|
|
429
|
-
interface StateDef {
|
|
430
|
-
name: StateName;
|
|
431
|
-
from: string;
|
|
432
|
-
}
|
|
433
|
-
interface CapabilityDef {
|
|
434
|
-
name: Capability;
|
|
435
|
-
note?: string;
|
|
436
|
-
status?: 'aspirational';
|
|
437
|
-
}
|
|
438
|
-
interface TaxonomyNote {
|
|
439
|
-
name: string;
|
|
440
|
-
note: string;
|
|
441
|
-
}
|
|
442
|
-
interface PreludeDocument extends MildaDocumentBase {
|
|
443
|
-
kind: 'prelude';
|
|
444
|
-
atoms: Atom[];
|
|
445
|
-
composites: CompositeBehavior[];
|
|
446
|
-
archetypes: ArchetypeDef[];
|
|
447
|
-
facets: FacetDef[];
|
|
448
|
-
states: StateDef[];
|
|
449
|
-
capabilities: CapabilityDef[];
|
|
450
|
-
decorations: TaxonomyNote[];
|
|
451
|
-
nonBehaviors: TaxonomyNote[];
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
interface PropDef {
|
|
455
|
-
id: Id;
|
|
456
|
-
name: string;
|
|
457
|
-
type: TypeExpr;
|
|
458
|
-
default?: PropValue;
|
|
459
|
-
required?: boolean;
|
|
460
|
-
description?: string;
|
|
461
|
-
binding?: string;
|
|
462
|
-
}
|
|
463
|
-
interface EventDef {
|
|
464
|
-
id?: Id;
|
|
465
|
-
name: string;
|
|
466
|
-
from?: string;
|
|
467
|
-
payload?: TypeExpr;
|
|
468
|
-
description?: string;
|
|
469
|
-
}
|
|
470
|
-
interface Contract {
|
|
471
|
-
params: Record<string, ParamBinding>;
|
|
472
|
-
props: PropDef[];
|
|
473
|
-
events: EventDef[];
|
|
474
|
-
}
|
|
475
|
-
interface PartState {
|
|
476
|
-
layout?: LayoutSpec;
|
|
477
|
-
facets?: FacetMap;
|
|
478
|
-
}
|
|
479
|
-
interface PartVariant {
|
|
480
|
-
when?: RealizeCond;
|
|
481
|
-
states?: StateName[];
|
|
482
|
-
facets?: FacetMap;
|
|
483
|
-
layout?: LayoutSpec;
|
|
484
|
-
}
|
|
485
|
-
interface Part {
|
|
486
|
-
layout?: LayoutSpec;
|
|
487
|
-
facets?: FacetMap;
|
|
488
|
-
states?: Partial<Record<StateName, PartState>>;
|
|
489
|
-
variants?: PartVariant[];
|
|
490
|
-
}
|
|
491
|
-
type Anatomy = Record<string, Part>;
|
|
492
|
-
interface RealizeCond {
|
|
493
|
-
prop: string;
|
|
494
|
-
eq: string | number | boolean;
|
|
495
|
-
}
|
|
496
|
-
interface Wire {
|
|
497
|
-
from: string;
|
|
498
|
-
to: string;
|
|
499
|
-
arg?: string;
|
|
500
|
-
when?: RealizeCond;
|
|
501
|
-
}
|
|
502
|
-
interface PresentationRealize {
|
|
503
|
-
surface?: string;
|
|
504
|
-
place?: string;
|
|
505
|
-
flip?: boolean;
|
|
506
|
-
matchWidth?: boolean;
|
|
507
|
-
}
|
|
508
|
-
interface BrowseRealize {
|
|
509
|
-
mode?: string;
|
|
510
|
-
orient?: 'horizontal' | 'vertical';
|
|
511
|
-
wrap?: boolean;
|
|
512
|
-
}
|
|
513
|
-
interface CommitRealize {
|
|
514
|
-
mode: 'explicit' | 'continuous';
|
|
515
|
-
on?: string[];
|
|
516
|
-
}
|
|
517
|
-
interface Realization {
|
|
518
|
-
target: string;
|
|
519
|
-
when: RealizeCond | null;
|
|
520
|
-
presentation?: PresentationRealize;
|
|
521
|
-
browse?: BrowseRealize;
|
|
522
|
-
commit?: CommitRealize;
|
|
523
|
-
surface?: string;
|
|
524
|
-
drop?: string[];
|
|
525
|
-
wire?: Wire[];
|
|
526
|
-
note?: string;
|
|
527
|
-
}
|
|
528
|
-
interface Composition {
|
|
529
|
-
uses: UsesClause[];
|
|
530
|
-
coordination: CoordEntry[];
|
|
531
|
-
}
|
|
532
|
-
interface Component {
|
|
533
|
-
id: Id;
|
|
534
|
-
name: string;
|
|
535
|
-
description?: string;
|
|
536
|
-
archetype: string;
|
|
537
|
-
contract: Contract;
|
|
538
|
-
anatomy: Anatomy;
|
|
539
|
-
realize: Realization[];
|
|
540
|
-
composition?: Composition;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
type AssetKind = 'font' | 'image' | 'svg' | 'video' | 'animation';
|
|
544
|
-
interface BaseAsset {
|
|
545
|
-
id: string;
|
|
546
|
-
name: string;
|
|
547
|
-
kind: AssetKind;
|
|
548
|
-
mimeType: string;
|
|
549
|
-
sizeBytes: number;
|
|
550
|
-
uploadedAt: string;
|
|
551
|
-
url: string;
|
|
552
|
-
tags: string[];
|
|
553
|
-
folderId: string | null;
|
|
554
|
-
}
|
|
555
|
-
interface FontAsset extends BaseAsset {
|
|
556
|
-
kind: 'font';
|
|
557
|
-
fontFamily: string;
|
|
558
|
-
fontStyle: 'normal' | 'italic';
|
|
559
|
-
fontWeight: number;
|
|
560
|
-
formats: Array<'woff2' | 'woff' | 'ttf' | 'otf'>;
|
|
561
|
-
}
|
|
562
|
-
interface ImageAsset extends BaseAsset {
|
|
563
|
-
kind: 'image';
|
|
564
|
-
width: number;
|
|
565
|
-
height: number;
|
|
566
|
-
alt: string;
|
|
567
|
-
}
|
|
568
|
-
interface SvgAsset extends BaseAsset {
|
|
569
|
-
kind: 'svg';
|
|
570
|
-
viewBox: string;
|
|
571
|
-
width: number;
|
|
572
|
-
height: number;
|
|
573
|
-
}
|
|
574
|
-
interface VideoAsset extends BaseAsset {
|
|
575
|
-
kind: 'video';
|
|
576
|
-
width: number;
|
|
577
|
-
height: number;
|
|
578
|
-
durationMs: number;
|
|
579
|
-
poster?: string;
|
|
580
|
-
}
|
|
581
|
-
type AnimationFormat = 'lottie' | 'rive' | 'css';
|
|
582
|
-
interface AnimationAsset extends BaseAsset {
|
|
583
|
-
kind: 'animation';
|
|
584
|
-
format: AnimationFormat;
|
|
585
|
-
durationMs: number;
|
|
586
|
-
loop: boolean;
|
|
587
|
-
}
|
|
588
|
-
type Asset = FontAsset | ImageAsset | SvgAsset | VideoAsset | AnimationAsset;
|
|
589
|
-
type AssetByKind = {
|
|
590
|
-
font: FontAsset;
|
|
591
|
-
image: ImageAsset;
|
|
592
|
-
svg: SvgAsset;
|
|
593
|
-
video: VideoAsset;
|
|
594
|
-
animation: AnimationAsset;
|
|
595
|
-
};
|
|
596
|
-
interface AssetFolder {
|
|
597
|
-
id: string;
|
|
598
|
-
name: string;
|
|
599
|
-
parentId: string | null;
|
|
600
|
-
createdAt: string;
|
|
601
|
-
}
|
|
602
|
-
interface AssetRegistry {
|
|
603
|
-
assets: Record<string, Asset>;
|
|
604
|
-
folders: Record<string, AssetFolder>;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
interface Project extends MildaDocumentBase {
|
|
608
|
-
kind: 'design-system';
|
|
609
|
-
foundations: Foundations;
|
|
610
|
-
assets: AssetRegistry;
|
|
611
|
-
components: Component[];
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
declare const preludeV0: PreludeDocument;
|
|
615
|
-
declare const atomsByName: Record<string, Atom>;
|
|
616
|
-
declare const archetypesByName: Record<string, ArchetypeDef>;
|
|
617
|
-
|
|
618
|
-
type ResolvedToken = {
|
|
619
|
-
kind: 'value';
|
|
620
|
-
type: TokenType$1;
|
|
621
|
-
value: AnyTokenValue;
|
|
622
|
-
} | {
|
|
623
|
-
kind: 'escape';
|
|
624
|
-
raw: string;
|
|
625
|
-
note?: string;
|
|
626
|
-
} | null;
|
|
627
|
-
declare function resolveToken(tokenId: string, contextIds: string | readonly string[], layers: Layer[], _depth?: number): ResolvedToken;
|
|
628
|
-
declare function findToken(tokenId: string, layers: Layer[]): {
|
|
629
|
-
token: Token$1;
|
|
630
|
-
layerId: string;
|
|
631
|
-
} | null;
|
|
632
|
-
declare function allTokensOfType(type: TokenType$1, layers: Layer[]): Array<{
|
|
633
|
-
token: Token$1;
|
|
634
|
-
layerId: string;
|
|
635
|
-
layerName: string;
|
|
636
|
-
}>;
|
|
637
|
-
|
|
638
|
-
interface ResolveFacetsInput {
|
|
639
|
-
part: Part;
|
|
640
|
-
activeStates: ReadonlySet<StateName>;
|
|
641
|
-
stateOrder?: StateName[];
|
|
642
|
-
}
|
|
643
|
-
declare function resolveFacets(input: ResolveFacetsInput): FacetMap;
|
|
644
|
-
declare function resolveLayout(input: ResolveFacetsInput): LayoutSpec | undefined;
|
|
645
|
-
declare function collectActiveStates(flags: Partial<Record<StateName, boolean>>): ReadonlySet<StateName>;
|
|
646
|
-
|
|
647
|
-
interface ValidationIssue {
|
|
648
|
-
severity: 'error' | 'warning';
|
|
649
|
-
code: string;
|
|
650
|
-
message: string;
|
|
651
|
-
where?: string;
|
|
652
|
-
}
|
|
653
|
-
declare function validate(doc: Project, prelude: PreludeDocument): ValidationIssue[];
|
|
654
|
-
|
|
655
|
-
interface Hole {
|
|
656
|
-
kind: 'facet' | 'layout' | 'behavior';
|
|
657
|
-
name: string;
|
|
658
|
-
where: string;
|
|
659
|
-
reason: string;
|
|
660
|
-
}
|
|
661
|
-
interface Substitution {
|
|
662
|
-
behavior: string;
|
|
663
|
-
via: string;
|
|
664
|
-
}
|
|
665
|
-
interface ConformanceReport {
|
|
666
|
-
target: string;
|
|
667
|
-
complete: boolean;
|
|
668
|
-
holes: Hole[];
|
|
669
|
-
substitutions: Substitution[];
|
|
670
|
-
}
|
|
671
|
-
interface ConformanceOptions {
|
|
672
|
-
target: string;
|
|
673
|
-
contextIds: string[];
|
|
674
|
-
layers: Layer[];
|
|
675
|
-
}
|
|
676
|
-
declare function conformance(comp: Component, opts: ConformanceOptions): ConformanceReport;
|
|
677
|
-
|
|
678
|
-
interface DesignSystemDocument {
|
|
679
|
-
milda: string;
|
|
680
|
-
kind: 'design-system';
|
|
681
|
-
prelude: string;
|
|
682
|
-
meta: {
|
|
683
|
-
id: string;
|
|
684
|
-
name: string;
|
|
685
|
-
version: string;
|
|
686
|
-
description?: string;
|
|
687
|
-
};
|
|
688
|
-
foundations: Foundations;
|
|
689
|
-
components: Component[];
|
|
690
|
-
}
|
|
691
|
-
interface ParseIssue {
|
|
692
|
-
severity: 'error' | 'warning';
|
|
693
|
-
code: string;
|
|
694
|
-
message: string;
|
|
695
|
-
line: number;
|
|
696
|
-
col: number;
|
|
697
|
-
}
|
|
698
|
-
interface ParseResult {
|
|
699
|
-
document: DesignSystemDocument;
|
|
700
|
-
issues: ParseIssue[];
|
|
701
|
-
}
|
|
702
|
-
interface ParseOptions {
|
|
703
|
-
name?: string;
|
|
704
|
-
milda?: string;
|
|
705
|
-
prelude?: string;
|
|
706
|
-
}
|
|
707
|
-
declare function parseMildaDocument(src: string, opts?: ParseOptions): ParseResult;
|
|
708
|
-
|
|
709
|
-
type TokenType = 'word' | 'string' | 'lbrace' | 'rbrace' | 'lparen' | 'rparen' | 'lt' | 'gt' | 'colon' | 'equals' | 'comma' | 'semi' | 'question' | 'arrow' | 'newline' | 'eof';
|
|
710
|
-
interface Token {
|
|
711
|
-
type: TokenType;
|
|
712
|
-
value: string;
|
|
713
|
-
pos: number;
|
|
714
|
-
line: number;
|
|
715
|
-
col: number;
|
|
716
|
-
}
|
|
717
|
-
declare class LexError extends Error {
|
|
718
|
-
line: number;
|
|
719
|
-
col: number;
|
|
720
|
-
constructor(message: string, line: number, col: number);
|
|
721
|
-
}
|
|
722
|
-
declare function lex(src: string): Token[];
|
|
723
|
-
|
|
724
|
-
export { type AliasTokenValue, type Align, type Anatomy, type AnatomyPart, type AnimationAsset, type AnimationFormat, type AnyTokenValue, type ArchetypeDef, type ArchetypeGroup, type ArchetypeRealize, type Asset, type AssetByKind, type AssetFolder, type AssetKind, type AssetRegistry, type Assignment, type Atom, type AtomContextVar, type AtomEvent, type AtomParam, type AtomStateNode, type AxisIntent, type AxisSize, type AxisSizeValue, type BlurValue, type BorderStyle, type BorderValue, type BorderWidth, type BrowseRealize, type Capability, type CapabilityDef, type ColorOrRef, type ColorSpace, type ColorValue, type CommitRealize, type Component, type CompositeBehavior, type Composition, type ConformanceOptions, type ConformanceReport, type ContentCategory, type Context, type ContextGroup, type Contract, type CoordEntry, type DesignSystemDocument, type DimensionOrRef, type DimensionUnit, type DimensionValue, type Distribute, type DocumentKind, type DocumentMeta, type Token as DslToken, type DurationValue, type Emit, type EscapeTokenValue, type EventDef, type Expose, type FacetDef, type FacetMap, type FacetName, type FacetTokenType, type FacetValue, type FontAsset, type FontCategory, type FontFamilyValue, type Foundations, type Hole, type Id, type ImageAsset, type InsetValue, type Layer, type LayoutSpec, LexError, type MildaDocumentBase, type NoneValue, type ObjectField, type OpacityValue, type ParamBinding, type ParseIssue, type ParseOptions, type ParseResult, type Part, type PartRole, type PartState, type PartVariant, type Position, type PreludeDocument, type PresentationRealize, type PrimitiveTokenType, type Project, type DocumentMeta as ProjectMeta, type ProjectMetadataEntry, type PropDef, type PropValue, type RawTokenValue, type Realization, type RealizeCond, type RequiresClause, type ResolveFacetsInput, type ResolvedToken, type ShadowLayer, type ShadowValue, type SharedType, type StackAxis, type StateDef, type StateName, type Substitution, type SvgAsset, TOKEN_VALUE_KIND, type TaxonomyNote, type Token$1 as Token, type TokenRef, type TokenType$1 as TokenType, type TokenValue, type TokenValueSchemaByType, type TonalValue, type Transition, type TransitionTarget, type TypeExpr, type TypeRef, type TypographyValue, type UsesClause, type ValidationIssue, type VideoAsset, type Wire, allTokensOfType, archetypesByName, atomsByName, collectActiveStates, conformance, findToken, lex, parseMildaDocument, preludeV0, resolveFacets, resolveLayout, resolveToken, validate };
|