@mildastudio/milda 0.1.1 → 0.3.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 +16 -9
- package/dist/index.cjs +7985 -0
- package/dist/index.d.cts +1501 -0
- package/dist/index.d.mts +1245 -557
- package/dist/index.mjs +7859 -3568
- package/package.json +14 -9
- package/dist/index.d.ts +0 -813
- package/dist/index.js +0 -3660
package/dist/index.d.mts
CHANGED
|
@@ -1,813 +1,1501 @@
|
|
|
1
1
|
type Id = string;
|
|
2
2
|
interface TypeRef {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
kind: 'ref';
|
|
4
|
+
ref: Id;
|
|
5
5
|
}
|
|
6
6
|
type TypeExpr = {
|
|
7
|
-
|
|
7
|
+
kind: 'string';
|
|
8
8
|
} | {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
kind: 'number';
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
12
|
} | {
|
|
13
|
-
|
|
13
|
+
kind: 'boolean';
|
|
14
14
|
} | {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
kind: 'enum';
|
|
16
|
+
values: string[];
|
|
17
17
|
} | {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
kind: 'context';
|
|
19
|
+
group: Id;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'union';
|
|
22
|
+
members: TypeExpr[];
|
|
20
23
|
} | TypeRef | {
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
kind: 'array';
|
|
25
|
+
item: TypeExpr;
|
|
23
26
|
} | {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
kind: 'object';
|
|
28
|
+
fields: ObjectField[];
|
|
26
29
|
} | {
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
kind: 'component';
|
|
31
|
+
componentIds?: Id[];
|
|
29
32
|
};
|
|
30
33
|
interface ObjectField {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
id: Id;
|
|
35
|
+
name: string;
|
|
36
|
+
type: TypeExpr;
|
|
37
|
+
required: boolean;
|
|
38
|
+
description?: string;
|
|
36
39
|
}
|
|
37
40
|
type PropValue = string | number | boolean | PropValue[] | {
|
|
38
|
-
|
|
41
|
+
[key: string]: PropValue;
|
|
39
42
|
};
|
|
40
43
|
type Metadata = Record<string, PropValue>;
|
|
41
44
|
interface SharedType {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
id: Id;
|
|
46
|
+
name: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
definition: TypeExpr;
|
|
46
49
|
}
|
|
47
50
|
type ParamBinding = {
|
|
48
|
-
|
|
51
|
+
prop: Id;
|
|
49
52
|
} | {
|
|
50
|
-
|
|
53
|
+
static: PropValue;
|
|
51
54
|
};
|
|
52
55
|
interface DocumentMeta {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
id: Id;
|
|
57
|
+
name: string;
|
|
58
|
+
version: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
createdAt?: string;
|
|
61
|
+
updatedAt?: string;
|
|
59
62
|
}
|
|
60
63
|
type DocumentKind = 'prelude' | 'design-system';
|
|
61
64
|
interface MildaDocumentBase {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
milda: string;
|
|
66
|
+
kind: DocumentKind;
|
|
67
|
+
prelude: string;
|
|
68
|
+
meta: DocumentMeta;
|
|
66
69
|
}
|
|
67
|
-
|
|
68
70
|
interface TokenRef {
|
|
69
|
-
|
|
71
|
+
ref: Id;
|
|
70
72
|
}
|
|
71
|
-
type PrimitiveTokenType = 'color' | 'spacing' | 'radius' | 'size' | 'shadow' | 'typography' | 'fontFamily' | 'fontWeight' | 'duration' | 'opacity' | 'blur' | 'tonal' | 'border';
|
|
73
|
+
type PrimitiveTokenType = 'color' | 'spacing' | 'radius' | 'size' | 'shadow' | 'typography' | 'fontFamily' | 'fontWeight' | 'duration' | 'opacity' | 'blur' | 'tonal' | 'border' | 'lineHeight' | 'easing' | 'gradient' | 'fontSize' | 'letterSpacing';
|
|
72
74
|
type FacetTokenType = 'elevation' | 'ring' | 'backdrop' | 'none';
|
|
73
|
-
type TokenType
|
|
75
|
+
type TokenType = PrimitiveTokenType | FacetTokenType;
|
|
74
76
|
type ColorSpace = 'srgb' | 'display-p3' | 'oklch' | 'hsl';
|
|
75
77
|
interface ColorValue {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
78
|
+
space: ColorSpace;
|
|
79
|
+
channels: number[];
|
|
80
|
+
alpha?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The neutral length units (0038). `fixed` is a density-independent length (CSS px,
|
|
84
|
+
* Android dp, iOS pt, Figma px); `scaled` is a multiple of the user's text size (CSS
|
|
85
|
+
* rem, Android sp, iOS Dynamic Type). The surface spells them `12px` and `scaled(12)`;
|
|
86
|
+
* `dp`/`sp`/`rem` are read as synonyms but never emitted.
|
|
87
|
+
*/
|
|
80
88
|
type DimensionUnit = 'scaled' | 'fixed' | 'percent' | 'em';
|
|
81
89
|
interface DimensionValue {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
90
|
+
value: number;
|
|
91
|
+
unit: DimensionUnit;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A length that is an INTENT rather than a measurement (0038). `pill` is "fully
|
|
95
|
+
* rounded": on the web it lowers to a large px radius, on iOS to a capsule, on Android
|
|
96
|
+
* to a circle shape, in Figma to a clamped corner radius. Spelling it as a keyword is
|
|
97
|
+
* what lets each target lower it correctly instead of pattern-matching `9999px`.
|
|
98
|
+
*/
|
|
99
|
+
type LengthKeyword = 'pill';
|
|
100
|
+
interface LengthKeywordValue {
|
|
101
|
+
keyword: LengthKeyword;
|
|
102
|
+
}
|
|
103
|
+
type LengthValue = DimensionValue | LengthKeywordValue;
|
|
85
104
|
type ColorOrRef = ColorValue | TokenRef;
|
|
86
105
|
type DimensionOrRef = DimensionValue | TokenRef;
|
|
87
106
|
interface ShadowLayer {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
offsetX: DimensionValue;
|
|
108
|
+
offsetY: DimensionValue;
|
|
109
|
+
blur: DimensionValue;
|
|
110
|
+
spread: DimensionValue;
|
|
111
|
+
color: ColorOrRef;
|
|
112
|
+
inset: boolean;
|
|
94
113
|
}
|
|
95
114
|
interface ShadowValue {
|
|
96
|
-
|
|
115
|
+
layers: ShadowLayer[];
|
|
97
116
|
}
|
|
98
117
|
type FontCategory = 'sans' | 'serif' | 'mono' | 'display';
|
|
118
|
+
/**
|
|
119
|
+
* Where the face comes from (added 2026-08-06 with the fontFamily token surface).
|
|
120
|
+
*
|
|
121
|
+
* Without it a family read back from a file could only ever be "some family called Inter":
|
|
122
|
+
* whether it is a platform stack, a bundled Google Font (and under which licence), or a file
|
|
123
|
+
* the project uploaded is exactly what a generator has to know to EMIT it - a @font-face, a
|
|
124
|
+
* stylesheet link, or nothing at all. Optional, so every existing document stays valid and is
|
|
125
|
+
* read as a plain named family.
|
|
126
|
+
*/
|
|
127
|
+
type FontProvenance = {
|
|
128
|
+
kind: 'system';
|
|
129
|
+
} | {
|
|
130
|
+
kind: 'google';
|
|
131
|
+
license?: string;
|
|
132
|
+
} | {
|
|
133
|
+
kind: 'custom';
|
|
134
|
+
};
|
|
99
135
|
interface FontFamilyValue {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
136
|
+
/** The family name, or - for a system face - the platform stack itself. */
|
|
137
|
+
family: string;
|
|
138
|
+
fallback: string[];
|
|
139
|
+
category: FontCategory;
|
|
140
|
+
assetId?: Id | null;
|
|
141
|
+
source?: FontProvenance;
|
|
104
142
|
}
|
|
105
143
|
interface FontWeightValue {
|
|
106
|
-
|
|
144
|
+
weight: number;
|
|
107
145
|
}
|
|
108
146
|
interface TypographyValue {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
147
|
+
family: TokenRef | FontFamilyValue;
|
|
148
|
+
size: DimensionValue;
|
|
149
|
+
weight: number;
|
|
150
|
+
lineHeight: DimensionValue | {
|
|
151
|
+
ratio: number;
|
|
152
|
+
};
|
|
153
|
+
letterSpacing: DimensionValue;
|
|
154
|
+
italic?: boolean;
|
|
155
|
+
uppercase?: boolean;
|
|
118
156
|
}
|
|
119
157
|
interface DurationValue {
|
|
120
|
-
|
|
158
|
+
ms: number;
|
|
121
159
|
}
|
|
122
160
|
interface OpacityValue {
|
|
123
|
-
|
|
161
|
+
value: number;
|
|
124
162
|
}
|
|
125
163
|
interface BlurValue {
|
|
126
|
-
|
|
164
|
+
radius: DimensionValue;
|
|
127
165
|
}
|
|
128
166
|
interface TonalValue {
|
|
129
|
-
|
|
167
|
+
level: number;
|
|
130
168
|
}
|
|
131
169
|
type BorderWidth = 'hairline' | 'thin' | 'thick' | DimensionValue;
|
|
132
170
|
type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'none';
|
|
133
171
|
interface BorderValue {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
172
|
+
width: BorderWidth;
|
|
173
|
+
style: BorderStyle;
|
|
174
|
+
color: ColorOrRef;
|
|
137
175
|
}
|
|
138
176
|
interface NoneValue {
|
|
139
|
-
|
|
177
|
+
none: true;
|
|
178
|
+
}
|
|
179
|
+
interface RatioValue {
|
|
180
|
+
value: number;
|
|
181
|
+
}
|
|
182
|
+
interface EasingValue {
|
|
183
|
+
keyword?: string;
|
|
184
|
+
cubicBezier?: [number, number, number, number];
|
|
185
|
+
css?: string;
|
|
186
|
+
}
|
|
187
|
+
interface GradientValue {
|
|
188
|
+
css: string;
|
|
140
189
|
}
|
|
141
190
|
interface TokenValueSchemaByType {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
191
|
+
color: ColorValue;
|
|
192
|
+
spacing: DimensionValue;
|
|
193
|
+
radius: LengthValue;
|
|
194
|
+
size: DimensionValue;
|
|
195
|
+
shadow: ShadowValue;
|
|
196
|
+
typography: TypographyValue;
|
|
197
|
+
fontFamily: FontFamilyValue;
|
|
198
|
+
fontWeight: FontWeightValue;
|
|
199
|
+
duration: DurationValue;
|
|
200
|
+
opacity: OpacityValue;
|
|
201
|
+
blur: BlurValue;
|
|
202
|
+
tonal: TonalValue;
|
|
203
|
+
border: BorderValue;
|
|
204
|
+
fontSize: DimensionValue;
|
|
205
|
+
letterSpacing: DimensionValue;
|
|
206
|
+
lineHeight: RatioValue;
|
|
207
|
+
easing: EasingValue;
|
|
208
|
+
gradient: GradientValue;
|
|
209
|
+
elevation: NoneValue;
|
|
210
|
+
ring: NoneValue;
|
|
211
|
+
backdrop: NoneValue;
|
|
212
|
+
none: NoneValue;
|
|
213
|
+
}
|
|
214
|
+
type AnyTokenValue = TokenValueSchemaByType[TokenType];
|
|
215
|
+
interface RawTokenValue<T extends TokenType = TokenType> {
|
|
216
|
+
kind: 'raw';
|
|
217
|
+
value: TokenValueSchemaByType[T];
|
|
164
218
|
}
|
|
165
219
|
interface AliasTokenValue {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
220
|
+
kind: 'alias';
|
|
221
|
+
by: Id;
|
|
222
|
+
refs: Record<string, Id>;
|
|
169
223
|
}
|
|
170
224
|
interface EscapeTokenValue {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
225
|
+
kind: 'escape';
|
|
226
|
+
raw: string;
|
|
227
|
+
note?: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Which space a computed COLOUR does its maths in.
|
|
231
|
+
*
|
|
232
|
+
* Wider than `ColorSpace` on purpose: that type is about how a colour LITERAL is spelled, and
|
|
233
|
+
* the surface can only spell four. A perceptual space like Oklab is a legitimate place to do
|
|
234
|
+
* the arithmetic even though no literal is written in it, so narrowing this to ColorSpace
|
|
235
|
+
* would silently move a token's maths to a different space on the way through the file.
|
|
236
|
+
*/
|
|
237
|
+
type ComputeSpace = 'srgb' | 'display-p3' | 'oklch' | 'hsl' | 'oklab' | 'lab' | 'lch';
|
|
238
|
+
/**
|
|
239
|
+
* One step of a computed value. Two vocabularies in one union, exactly as the IR has them:
|
|
240
|
+
* a colour is lightened and mixed, a measurement is scaled and rounded. Which one applies
|
|
241
|
+
* follows the TOKEN'S TYPE, not a discriminant here.
|
|
242
|
+
*
|
|
243
|
+
* Amounts are 0..1 fractions (the surface writes them as percentages), `degrees` is a hue
|
|
244
|
+
* rotation, and `delta` / `to` are density-independent pixels - the neutral unit, so a step
|
|
245
|
+
* means the same thing on every platform.
|
|
246
|
+
*/
|
|
247
|
+
type ComputeOp = {
|
|
248
|
+
op: 'lighten' | 'darken' | 'saturate' | 'desaturate' | 'alpha';
|
|
249
|
+
amount: number;
|
|
250
|
+
} | {
|
|
251
|
+
op: 'rotate';
|
|
252
|
+
degrees: number;
|
|
253
|
+
} | {
|
|
254
|
+
op: 'mix';
|
|
255
|
+
with: Id;
|
|
256
|
+
amount: number;
|
|
257
|
+
} | {
|
|
258
|
+
op: 'scale';
|
|
259
|
+
factor: number;
|
|
260
|
+
} | {
|
|
261
|
+
op: 'offset';
|
|
262
|
+
delta: number;
|
|
263
|
+
} | {
|
|
264
|
+
op: 'round';
|
|
265
|
+
to: number;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* A value DERIVED from another token: "the accent, 20% lighter", "the body size × 1.25".
|
|
269
|
+
*
|
|
270
|
+
* `base` and a `mix` operand are token IDS, like an alias's `refs` - and for the same reason:
|
|
271
|
+
* the canonical AST names tokens, it does not embed anonymous values. An inline literal
|
|
272
|
+
* written in either position is hoisted to a synthesized token by the parser (and printed
|
|
273
|
+
* back as the literal by the emitter), which is the mechanism alias slots already use.
|
|
274
|
+
*/
|
|
275
|
+
interface ComputeTokenValue {
|
|
276
|
+
kind: 'compute';
|
|
277
|
+
base: Id;
|
|
278
|
+
ops: ComputeOp[];
|
|
279
|
+
/** Colour only; absent means the IR's own default (OKLCH). */
|
|
280
|
+
space?: ComputeSpace;
|
|
281
|
+
}
|
|
282
|
+
type TokenValue<T extends TokenType = TokenType> = RawTokenValue<T> | AliasTokenValue | EscapeTokenValue | ComputeTokenValue;
|
|
283
|
+
interface Token$1<T extends TokenType = TokenType> {
|
|
284
|
+
id: Id;
|
|
285
|
+
name: string;
|
|
286
|
+
type: T;
|
|
287
|
+
value: TokenValue<T>;
|
|
288
|
+
description?: string;
|
|
182
289
|
}
|
|
183
290
|
interface Layer {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
291
|
+
id: Id;
|
|
292
|
+
name: string;
|
|
293
|
+
order: number;
|
|
294
|
+
tokens: Token$1[];
|
|
188
295
|
}
|
|
189
296
|
interface Context {
|
|
190
|
-
|
|
191
|
-
|
|
297
|
+
id: Id;
|
|
298
|
+
name: string;
|
|
192
299
|
}
|
|
193
300
|
interface ContextGroup {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
declare const TOKEN_VALUE_KIND: Record<TokenType
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
301
|
+
id: Id;
|
|
302
|
+
name: string;
|
|
303
|
+
contexts: Context[];
|
|
304
|
+
}
|
|
305
|
+
declare const TOKEN_VALUE_KIND: Record<TokenType, 'color' | 'dimension' | 'shadow' | 'typography' | 'fontFamily' | 'fontWeight' | 'duration' | 'opacity' | 'blur' | 'tonal' | 'border' | 'ratio' | 'easing' | 'gradient' | 'facet'>;
|
|
306
|
+
/** What a part IS. Neutral by design - the platform element is a target decision. */
|
|
307
|
+
declare const NODE_KINDS: readonly string[];
|
|
308
|
+
/** Where a part came from: the archetype, or the author. */
|
|
309
|
+
declare const NODE_ORIGINS: readonly string[];
|
|
310
|
+
/** The interactions an emission (or a demo action) can fire on. */
|
|
311
|
+
declare const INTERACTION_KINDS: readonly string[];
|
|
312
|
+
/** Control realization (0016) and group realization (0022). */
|
|
313
|
+
declare const CONTROL_REALIZATIONS: readonly string[];
|
|
314
|
+
declare const GROUP_REALIZATIONS: readonly string[];
|
|
315
|
+
/** Presentation intent (0022 §8), surface-spelled. */
|
|
316
|
+
declare const PRESENTATION_KINDS: readonly string[];
|
|
317
|
+
/** A media part's type (0028). */
|
|
318
|
+
declare const MEDIA_TYPES: readonly string[];
|
|
319
|
+
/** A table cell's role. */
|
|
320
|
+
declare const CELL_MODIFIERS: readonly string[];
|
|
321
|
+
/** The modifiers a `slot` statement accepts after its arity and content spec. */
|
|
322
|
+
declare const SLOT_MODIFIERS: readonly string[];
|
|
323
|
+
/** The structural roles a slot can play in a disclosure. */
|
|
324
|
+
declare const SLOT_ROLES: readonly string[];
|
|
325
|
+
/** How a behaviour/config field's value is read. `node`/`nodes` name a part BY PATH. */
|
|
326
|
+
type FieldType = 'string' | 'number' | 'boolean' | 'node' | 'nodes';
|
|
327
|
+
declare const BEHAVIOR_FIELDS: Readonly<Record<string, Readonly<Record<string, FieldType>>>>;
|
|
328
|
+
/** The behaviour kinds, in the surface's kebab spelling (`focus-trap`). */
|
|
329
|
+
declare const BEHAVIOR_KINDS: readonly string[];
|
|
330
|
+
type ConfigFieldSpec = {
|
|
331
|
+
kind: 'boolean';
|
|
332
|
+
} | {
|
|
333
|
+
kind: 'number';
|
|
204
334
|
} | {
|
|
205
|
-
|
|
206
|
-
right?: Id;
|
|
207
|
-
bottom?: Id;
|
|
208
|
-
left?: Id;
|
|
335
|
+
kind: 'numbers';
|
|
209
336
|
} | {
|
|
210
|
-
|
|
337
|
+
kind: 'enum';
|
|
338
|
+
values: readonly string[];
|
|
339
|
+
} | {
|
|
340
|
+
kind: 'enums';
|
|
341
|
+
values: readonly string[];
|
|
342
|
+
};
|
|
343
|
+
interface ConfigSurface {
|
|
344
|
+
/** The node field this block configures. */
|
|
345
|
+
field: string;
|
|
346
|
+
fields: Readonly<Record<string, ConfigFieldSpec>>;
|
|
347
|
+
/** True for a single-valued surface written `severity danger` rather than as a block. */
|
|
348
|
+
single?: boolean;
|
|
349
|
+
}
|
|
350
|
+
declare const PART_CONFIGS: Readonly<Record<string, ConfigSurface>>;
|
|
351
|
+
/** The block-shaped config surfaces - read as a config only when a `{` follows the word,
|
|
352
|
+
* which is what keeps `overlay { … }` apart from the `overlay` paint facet. */
|
|
353
|
+
declare const PART_CONFIG_NAMES: ReadonlySet<string>;
|
|
354
|
+
/** The single-valued config surfaces (`severity danger`). */
|
|
355
|
+
declare const PART_CONFIG_WORDS: readonly string[];
|
|
356
|
+
/** The prose blocks, whose keyword IS their kind. */
|
|
357
|
+
declare const DOC_PROSE_KINDS: readonly string[];
|
|
358
|
+
/** The transclusion blocks - each names what it shows, by name. */
|
|
359
|
+
declare const DOC_TRANSCLUSIONS: readonly string[];
|
|
360
|
+
declare const DOC_BLOCK_KEYWORDS: readonly string[];
|
|
361
|
+
/** Statement keywords inside `docs { … }` and inside a `page { … }`'s header. */
|
|
362
|
+
declare const DOCS_KEYWORDS: readonly string[];
|
|
363
|
+
declare const DOCS_SITE_KEYS: readonly string[];
|
|
364
|
+
declare const DOCS_FOOTER_KEYWORDS: readonly string[];
|
|
365
|
+
declare const ASSET_KINDS: readonly string[];
|
|
366
|
+
/** The fields every asset carries, whatever its kind. `url`/`data` are the two shapes the
|
|
367
|
+
* bytes can take: beside the file, or in it. */
|
|
368
|
+
declare const ASSET_BASE_KEYS: readonly string[];
|
|
369
|
+
/** Per-kind metadata, validated on lowering. */
|
|
370
|
+
declare const ASSET_FIELDS: Readonly<Record<string, Readonly<Record<string, FieldType | 'strings'>>>>;
|
|
371
|
+
/** The value each asset kind's fields take, in the surface's kebab spelling. */
|
|
372
|
+
declare const ASSET_FIELD_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
373
|
+
interface LiteralChannel {
|
|
374
|
+
/** The channel's name, as the docs and the argument hint call it. */
|
|
375
|
+
name: string;
|
|
376
|
+
/** What it accepts, in one phrase. */
|
|
377
|
+
hint: string;
|
|
378
|
+
/** An in-range value, for a pre-filled call. */
|
|
379
|
+
sample: string;
|
|
380
|
+
}
|
|
381
|
+
interface LiteralFnSpec {
|
|
382
|
+
channels: readonly LiteralChannel[];
|
|
383
|
+
/** Whether a trailing alpha is accepted (`… / 50%`, or a bare fourth channel). */
|
|
384
|
+
alpha: boolean;
|
|
385
|
+
/** One line on what the function is. */
|
|
386
|
+
doc: string;
|
|
387
|
+
}
|
|
388
|
+
declare const VALUE_LITERAL_FNS: Readonly<Record<string, LiteralFnSpec>>;
|
|
389
|
+
/** The colour-space literals, in the order a picker should offer them. */
|
|
390
|
+
declare const COLOR_LITERAL_FNS: readonly string[];
|
|
391
|
+
/**
|
|
392
|
+
* Spellings a reader accepts for a function it already has. In CSS Color 4 `rgba`/`hsla` ARE
|
|
393
|
+
* `rgb`/`hsl` - the alpha is a fourth channel either way - and someone coming from CSS writes
|
|
394
|
+
* the four-letter name without thinking about it. Read, never offered, never written: the
|
|
395
|
+
* canonical name is the target. (The same treatment `rem`/`dp`/`sp` get on the length side.)
|
|
396
|
+
*/
|
|
397
|
+
declare const COLOR_LITERAL_ALIASES: Readonly<Record<string, string>>;
|
|
398
|
+
/** Every spelling of a colour function the reader accepts - the canonical ones and the aliases.
|
|
399
|
+
* What a highlighter needs: `rgba(1 0 0 / 0.5)` is a colour literal, so its payload is a value
|
|
400
|
+
* and not four identifiers. */
|
|
401
|
+
declare const COLOR_LITERAL_SPELLINGS: readonly string[];
|
|
402
|
+
/** Colour words that name a value rather than a token. `transparent` is the absence of a colour,
|
|
403
|
+
* which every platform has a spelling for; the Studio seeds one (a tab's resting border). */
|
|
404
|
+
declare const COLOR_KEYWORDS: readonly string[];
|
|
405
|
+
/** The length-valued literals (0038). */
|
|
406
|
+
declare const LENGTH_LITERAL_FNS: readonly string[];
|
|
407
|
+
/** What a stack's children flow along. `layers` draws them on top of each other. */
|
|
408
|
+
declare const LAYOUT_DIRECTIONS: readonly ['row', 'column', 'layers'];
|
|
409
|
+
type LayoutDirection = (typeof LAYOUT_DIRECTIONS)[number];
|
|
410
|
+
/** Cross-axis placement (vertical in a `layers` stack). */
|
|
411
|
+
declare const LAYOUT_ALIGNS: readonly ['start', 'center', 'end', 'stretch', 'baseline'];
|
|
412
|
+
type LayoutAlign = (typeof LAYOUT_ALIGNS)[number];
|
|
413
|
+
/** Main-axis placement (horizontal in a `layers` stack). */
|
|
414
|
+
declare const LAYOUT_DISTRIBUTES: readonly ['start', 'center', 'end', 'between', 'around', 'evenly'];
|
|
415
|
+
type LayoutDistribute = (typeof LAYOUT_DISTRIBUTES)[number];
|
|
416
|
+
declare const LAYOUT_WRAPS: readonly ['nowrap', 'wrap', 'wrap-reverse'];
|
|
417
|
+
type LayoutWrap = (typeof LAYOUT_WRAPS)[number];
|
|
418
|
+
/** How one axis of a part is sized (PRELUDE §4 "child sizing"). `weight`, `fixed` and `ratio`
|
|
419
|
+
* take an argument: `weight(2)`, `fixed(size.md)`, `ratio(16:9)`. */
|
|
420
|
+
declare const AXIS_INTENTS: readonly ['fit', 'fill', 'weight', 'fixed', 'ratio'];
|
|
421
|
+
type AxisIntentKind = (typeof AXIS_INTENTS)[number];
|
|
422
|
+
/** The clamps an axis intent may be followed by: `min(size.sm)`, `max(size.lg)`. */
|
|
423
|
+
declare const AXIS_CLAMPS: readonly ['min', 'max'];
|
|
424
|
+
/** Where a part sits relative to the flow. `pinned` and `bleed` take logical edges. */
|
|
425
|
+
declare const POSITION_KINDS: readonly ['flow', 'overlay', 'pinned', 'bleed'];
|
|
426
|
+
type PositionKind = (typeof POSITION_KINDS)[number];
|
|
427
|
+
/** Logical edges, so a design system reads the same in a right-to-left locale. */
|
|
428
|
+
declare const LOGICAL_EDGES: readonly ['block-start', 'block-end', 'inline-start', 'inline-end', 'block', 'inline', 'all'];
|
|
429
|
+
type LogicalEdge = (typeof LOGICAL_EDGES)[number];
|
|
430
|
+
/** The edges an inset can be stated on, besides all four at once (proposal 0057). A dotted facet
|
|
431
|
+
* name each - `inset.inline`, `inset.block-start` - the way `border` takes `.<edge>`. The bare
|
|
432
|
+
* `inset` already means all four, so `all` is not one of them. */
|
|
433
|
+
declare const INSET_EDGES: readonly ["block", "inline", "block-start", "block-end", "inline-start", "inline-end"];
|
|
434
|
+
type InsetEdge = (typeof INSET_EDGES)[number];
|
|
435
|
+
/** The physical edge words the parser used to take, read as the logical edge each names in a
|
|
436
|
+
* horizontal left-to-right system. Read, never offered, never written - the `rgba` treatment. */
|
|
437
|
+
declare const PHYSICAL_EDGE_ALIASES: Readonly<Record<string, LogicalEdge>>;
|
|
438
|
+
/** The keys of the editor's layout record (`node.layout`), whose values are the words above:
|
|
439
|
+
* a direction, an alignment, a distribution, a wrap, an axis intent spelled as the surface
|
|
440
|
+
* spells it (`fill`, `weight(2)`, `ratio(16:9)`, a size token or a length), a clamp as a size
|
|
441
|
+
* token or a length, and a position as its surface words (`overlay`, `pinned block-start`). */
|
|
442
|
+
declare const LAYOUT_RECORD_KEYS: readonly ['direction', 'align', 'distribute', 'wrap', 'width', 'height', 'widthMin', 'widthMax', 'heightMin', 'heightMax', 'position'];
|
|
443
|
+
type LayoutRecordKey = (typeof LAYOUT_RECORD_KEYS)[number];
|
|
444
|
+
declare const EXAMPLE_KEYWORDS: readonly string[];
|
|
445
|
+
declare const DEMO_ACTION_OPS: readonly string[];
|
|
446
|
+
declare function kebab(s: string): string;
|
|
447
|
+
/** A surface kebab key → the IR's camelCase field (`week-starts-on` → `weekStartsOn`). */
|
|
448
|
+
declare function camelField(s: string): string;
|
|
449
|
+
declare const MILDA_SURFACE_VERSION = "0.10";
|
|
450
|
+
declare const PRELUDE_VERSION = "0.0.2";
|
|
451
|
+
type FacetName = 'fill' | 'ink' | 'border' | 'border.top' | 'border.right' | 'border.bottom' | 'border.left' | 'border.inline-start' | 'border.inline-end' | 'border.block-start' | 'border.block-end' | 'corner' | 'inset' | `inset.${InsetEdge}` | 'gap' | 'text' | 'textClamp' | 'textWrap' | 'weight' | 'font' | 'slant' | 'elevation' | 'overlay' | 'opacity' | 'ring' | 'backdrop';
|
|
452
|
+
type InsetValue = {
|
|
453
|
+
block?: Id;
|
|
454
|
+
inline?: Id;
|
|
455
|
+
} | {
|
|
456
|
+
all: Id;
|
|
211
457
|
};
|
|
212
458
|
type BorderFacetStyle = 'solid' | 'dashed' | 'dotted';
|
|
213
459
|
interface BorderFacetValue {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
460
|
+
width?: Id;
|
|
461
|
+
color?: Id;
|
|
462
|
+
style?: BorderFacetStyle;
|
|
217
463
|
}
|
|
218
464
|
type FacetValue = {
|
|
219
|
-
|
|
465
|
+
token: Id;
|
|
220
466
|
} | {
|
|
221
|
-
|
|
467
|
+
literal: string | number | boolean;
|
|
222
468
|
} | {
|
|
223
|
-
|
|
469
|
+
inset: InsetValue;
|
|
224
470
|
} | {
|
|
225
|
-
|
|
471
|
+
border: BorderFacetValue;
|
|
226
472
|
} | {
|
|
227
|
-
|
|
473
|
+
raw: string;
|
|
228
474
|
};
|
|
229
475
|
type FacetMap = Partial<Record<FacetName, FacetValue>>;
|
|
230
|
-
type StackAxis =
|
|
476
|
+
type StackAxis = LayoutDirection;
|
|
231
477
|
type AxisIntent = 'fit' | 'fill' | {
|
|
232
|
-
|
|
478
|
+
weight: number;
|
|
233
479
|
} | {
|
|
234
|
-
|
|
480
|
+
fixed: Id;
|
|
235
481
|
} | {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
482
|
+
ratio: {
|
|
483
|
+
w: number;
|
|
484
|
+
h: number;
|
|
485
|
+
};
|
|
240
486
|
};
|
|
241
487
|
interface AxisSize {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
488
|
+
intent: AxisIntent;
|
|
489
|
+
min?: Id;
|
|
490
|
+
max?: Id;
|
|
245
491
|
}
|
|
246
492
|
type AxisSizeValue = AxisIntent | AxisSize;
|
|
247
|
-
type Distribute =
|
|
248
|
-
type Align =
|
|
493
|
+
type Distribute = LayoutDistribute;
|
|
494
|
+
type Align = LayoutAlign;
|
|
495
|
+
/** `pinned` and `bleed` name LOGICAL edges (PRELUDE §4, proposal 0003 §2a). */
|
|
249
496
|
type Position = 'flow' | 'overlay' | {
|
|
250
|
-
|
|
497
|
+
pinned: LogicalEdge[];
|
|
498
|
+
} | {
|
|
499
|
+
bleed: LogicalEdge[];
|
|
251
500
|
};
|
|
252
501
|
interface LayoutSpec {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
502
|
+
stack?: StackAxis;
|
|
503
|
+
/** Reserved: read and reported, with no target yet (0056 §3.3). */
|
|
504
|
+
grid?: {
|
|
505
|
+
cols: number;
|
|
506
|
+
rows?: number;
|
|
507
|
+
};
|
|
508
|
+
/** The `flow` key, an alias of `wrap wrap` (0003 §2b). Read, never written. */
|
|
509
|
+
flow?: boolean;
|
|
510
|
+
wrap?: LayoutWrap;
|
|
511
|
+
gap?: Id;
|
|
512
|
+
inset?: InsetValue;
|
|
513
|
+
distribute?: Distribute;
|
|
514
|
+
align?: Align;
|
|
515
|
+
size?: {
|
|
516
|
+
width?: AxisSizeValue;
|
|
517
|
+
height?: AxisSizeValue;
|
|
518
|
+
};
|
|
519
|
+
position?: Position;
|
|
268
520
|
}
|
|
269
521
|
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';
|
|
270
522
|
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';
|
|
271
|
-
|
|
272
|
-
interface ProjectMetadataEntry {
|
|
273
|
-
id: Id;
|
|
274
|
-
key: string;
|
|
275
|
-
type: TypeExpr;
|
|
276
|
-
value?: PropValue;
|
|
277
|
-
}
|
|
278
|
-
interface Foundations {
|
|
279
|
-
contextGroups: ContextGroup[];
|
|
280
|
-
layers: Layer[];
|
|
281
|
-
sharedTypes: SharedType[];
|
|
282
|
-
metadata: ProjectMetadataEntry[];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
523
|
interface AtomParam {
|
|
286
|
-
|
|
287
|
-
|
|
524
|
+
name: string;
|
|
525
|
+
bind?: boolean;
|
|
288
526
|
}
|
|
289
527
|
interface AtomContextVar {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
528
|
+
name: string;
|
|
529
|
+
type?: string;
|
|
530
|
+
init?: string;
|
|
293
531
|
}
|
|
294
532
|
interface AtomStateNode {
|
|
295
|
-
|
|
296
|
-
|
|
533
|
+
id: string;
|
|
534
|
+
initial?: boolean;
|
|
297
535
|
}
|
|
298
536
|
interface AtomEvent {
|
|
299
|
-
|
|
300
|
-
|
|
537
|
+
name: string;
|
|
538
|
+
args?: string[];
|
|
301
539
|
}
|
|
302
540
|
interface Emit {
|
|
303
|
-
|
|
304
|
-
|
|
541
|
+
event: string;
|
|
542
|
+
arg?: string | boolean | number;
|
|
305
543
|
}
|
|
306
544
|
interface Assignment {
|
|
307
|
-
|
|
308
|
-
|
|
545
|
+
target: string;
|
|
546
|
+
expr: string;
|
|
309
547
|
}
|
|
310
548
|
type TransitionTarget = string | {
|
|
311
|
-
|
|
549
|
+
expr: string;
|
|
312
550
|
};
|
|
313
551
|
interface Transition {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
552
|
+
from: string;
|
|
553
|
+
on?: string;
|
|
554
|
+
after?: string;
|
|
555
|
+
when?: string;
|
|
556
|
+
to?: TransitionTarget;
|
|
557
|
+
ctx?: Assignment[];
|
|
558
|
+
emit?: Emit;
|
|
559
|
+
do?: string;
|
|
560
|
+
note?: string;
|
|
323
561
|
}
|
|
324
562
|
interface Expose {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
563
|
+
state: string;
|
|
564
|
+
when: string;
|
|
565
|
+
arg?: string;
|
|
328
566
|
}
|
|
329
567
|
interface RequiresClause {
|
|
330
|
-
|
|
331
|
-
|
|
568
|
+
anyOf: Capability[];
|
|
569
|
+
when?: string;
|
|
332
570
|
}
|
|
333
571
|
interface Atom {
|
|
334
|
-
|
|
572
|
+
kind: 'atom';
|
|
573
|
+
name: string;
|
|
574
|
+
doc?: string;
|
|
575
|
+
requires?: RequiresClause[];
|
|
576
|
+
params?: AtomParam[];
|
|
577
|
+
context?: AtomContextVar[];
|
|
578
|
+
states?: AtomStateNode[];
|
|
579
|
+
events?: AtomEvent[];
|
|
580
|
+
transitions: Transition[];
|
|
581
|
+
exposes?: Expose[];
|
|
582
|
+
emits?: {
|
|
335
583
|
name: string;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
context?: AtomContextVar[];
|
|
340
|
-
states?: AtomStateNode[];
|
|
341
|
-
events?: AtomEvent[];
|
|
342
|
-
transitions: Transition[];
|
|
343
|
-
exposes?: Expose[];
|
|
344
|
-
emits?: {
|
|
345
|
-
name: string;
|
|
346
|
-
}[];
|
|
347
|
-
modes?: string[];
|
|
348
|
-
note?: string;
|
|
584
|
+
}[];
|
|
585
|
+
modes?: string[];
|
|
586
|
+
note?: string;
|
|
349
587
|
}
|
|
350
588
|
type CoordEntry = {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
} | {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
} | {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
} | {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
} | {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
} | {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
589
|
+
kind: 'wire';
|
|
590
|
+
from: string;
|
|
591
|
+
to: string;
|
|
592
|
+
arg?: string;
|
|
593
|
+
when?: string;
|
|
594
|
+
} | {
|
|
595
|
+
kind: 'gate';
|
|
596
|
+
machine: string;
|
|
597
|
+
activeWhen: string;
|
|
598
|
+
} | {
|
|
599
|
+
kind: 'broadcast';
|
|
600
|
+
set: string;
|
|
601
|
+
event: string;
|
|
602
|
+
} | {
|
|
603
|
+
kind: 'aggregate';
|
|
604
|
+
op: 'all' | 'any' | 'count' | 'first';
|
|
605
|
+
set: string;
|
|
606
|
+
pred: string;
|
|
607
|
+
as?: string;
|
|
608
|
+
then?: string;
|
|
609
|
+
} | {
|
|
610
|
+
kind: 'arena';
|
|
611
|
+
over: string[];
|
|
612
|
+
exclusive: boolean;
|
|
613
|
+
} | {
|
|
614
|
+
kind: 'requiresFail';
|
|
615
|
+
gesture: string;
|
|
616
|
+
failsAfter: string;
|
|
379
617
|
};
|
|
380
618
|
interface UsesClause {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
619
|
+
atom: string;
|
|
620
|
+
as: string;
|
|
621
|
+
params?: Record<string, string>;
|
|
384
622
|
}
|
|
385
623
|
interface CompositeBehavior {
|
|
386
|
-
|
|
624
|
+
kind: 'composite';
|
|
625
|
+
name: string;
|
|
626
|
+
builtFrom: string[];
|
|
627
|
+
uses?: UsesClause[];
|
|
628
|
+
composition?: CoordEntry[];
|
|
629
|
+
emits?: {
|
|
387
630
|
name: string;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
composition?: CoordEntry[];
|
|
391
|
-
emits?: {
|
|
392
|
-
name: string;
|
|
393
|
-
}[];
|
|
394
|
-
note?: string;
|
|
631
|
+
}[];
|
|
632
|
+
note?: string;
|
|
395
633
|
}
|
|
396
634
|
type ArchetypeGroup = 'Actions' | 'Inputs' | 'Disclosure' | 'Navigation' | 'Collections' | 'Feedback' | 'Media';
|
|
397
635
|
interface ContentCategory {
|
|
398
|
-
|
|
399
|
-
|
|
636
|
+
level: 'phrase' | 'region';
|
|
637
|
+
interactive: boolean;
|
|
400
638
|
}
|
|
401
639
|
interface ArchetypeRealize {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
640
|
+
target: string;
|
|
641
|
+
when?: string;
|
|
642
|
+
surface?: string;
|
|
643
|
+
browse?: string;
|
|
644
|
+
commit?: 'explicit' | 'continuous';
|
|
645
|
+
drop?: string[];
|
|
646
|
+
wire?: {
|
|
647
|
+
from: string;
|
|
648
|
+
to: string;
|
|
649
|
+
arg?: string;
|
|
650
|
+
}[];
|
|
651
|
+
note?: string;
|
|
414
652
|
}
|
|
415
653
|
type PartRole = 'container' | 'item' | 'text' | 'control' | 'input' | 'icon' | 'content';
|
|
416
654
|
interface AnatomyPart {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
655
|
+
name: string;
|
|
656
|
+
role: PartRole;
|
|
657
|
+
optional?: boolean;
|
|
658
|
+
children?: AnatomyPart[];
|
|
421
659
|
}
|
|
422
660
|
interface ArchetypeDef {
|
|
423
|
-
|
|
661
|
+
kind: 'archetype';
|
|
662
|
+
name: string;
|
|
663
|
+
group: ArchetypeGroup;
|
|
664
|
+
contract: string;
|
|
665
|
+
produces: ContentCategory;
|
|
666
|
+
anatomy?: AnatomyPart[];
|
|
667
|
+
composes: string[];
|
|
668
|
+
uses?: UsesClause[];
|
|
669
|
+
composition?: CoordEntry[];
|
|
670
|
+
exposes?: Expose[];
|
|
671
|
+
emits?: {
|
|
424
672
|
name: string;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
composes: string[];
|
|
430
|
-
uses?: UsesClause[];
|
|
431
|
-
composition?: CoordEntry[];
|
|
432
|
-
exposes?: Expose[];
|
|
433
|
-
emits?: {
|
|
434
|
-
name: string;
|
|
435
|
-
from?: string;
|
|
436
|
-
}[];
|
|
437
|
-
realize?: ArchetypeRealize[];
|
|
438
|
-
realizationNote?: string;
|
|
673
|
+
from?: string;
|
|
674
|
+
}[];
|
|
675
|
+
realize?: ArchetypeRealize[];
|
|
676
|
+
realizationNote?: string;
|
|
439
677
|
}
|
|
440
678
|
interface FacetDef {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
679
|
+
name: FacetName;
|
|
680
|
+
covers: string;
|
|
681
|
+
divergence?: string;
|
|
444
682
|
}
|
|
445
683
|
interface StateDef {
|
|
446
|
-
|
|
447
|
-
|
|
684
|
+
name: StateName;
|
|
685
|
+
from: string;
|
|
448
686
|
}
|
|
449
687
|
interface CapabilityDef {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
688
|
+
name: Capability;
|
|
689
|
+
note?: string;
|
|
690
|
+
status?: 'aspirational';
|
|
453
691
|
}
|
|
454
692
|
interface TaxonomyNote {
|
|
455
|
-
|
|
456
|
-
|
|
693
|
+
name: string;
|
|
694
|
+
note: string;
|
|
457
695
|
}
|
|
458
696
|
interface PreludeDocument extends MildaDocumentBase {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
|
|
697
|
+
kind: 'prelude';
|
|
698
|
+
atoms: Atom[];
|
|
699
|
+
composites: CompositeBehavior[];
|
|
700
|
+
archetypes: ArchetypeDef[];
|
|
701
|
+
facets: FacetDef[];
|
|
702
|
+
states: StateDef[];
|
|
703
|
+
capabilities: CapabilityDef[];
|
|
704
|
+
decorations: TaxonomyNote[];
|
|
705
|
+
nonBehaviors: TaxonomyNote[];
|
|
706
|
+
}
|
|
470
707
|
interface PropDef {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
708
|
+
id: Id;
|
|
709
|
+
name: string;
|
|
710
|
+
type: TypeExpr;
|
|
711
|
+
default?: PropValue;
|
|
712
|
+
required?: boolean;
|
|
713
|
+
requiredWhen?: Predicate;
|
|
714
|
+
description?: string;
|
|
715
|
+
global?: true;
|
|
716
|
+
binding?: string;
|
|
717
|
+
meta?: Metadata;
|
|
479
718
|
}
|
|
480
719
|
interface EventDef {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
720
|
+
id?: Id;
|
|
721
|
+
name: string;
|
|
722
|
+
from?: string;
|
|
723
|
+
payload?: TypeExpr;
|
|
724
|
+
description?: string;
|
|
725
|
+
}
|
|
726
|
+
interface PropConstraint {
|
|
727
|
+
kind: 'one-of' | 'any-of' | 'exclusive';
|
|
728
|
+
props: string[];
|
|
486
729
|
}
|
|
487
730
|
interface Contract {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
731
|
+
params: Record<string, ParamBinding>;
|
|
732
|
+
props: PropDef[];
|
|
733
|
+
events: EventDef[];
|
|
734
|
+
/** Absent when the props block states none. */
|
|
735
|
+
constraints?: PropConstraint[];
|
|
491
736
|
}
|
|
492
737
|
interface PartState {
|
|
493
|
-
|
|
494
|
-
|
|
738
|
+
layout?: LayoutSpec;
|
|
739
|
+
facets?: FacetMap;
|
|
495
740
|
}
|
|
496
741
|
type PredicateRef = {
|
|
497
|
-
|
|
498
|
-
|
|
742
|
+
kind: 'prop';
|
|
743
|
+
path: string;
|
|
499
744
|
} | {
|
|
500
|
-
|
|
501
|
-
|
|
745
|
+
kind: 'state';
|
|
746
|
+
state: string;
|
|
502
747
|
} | {
|
|
503
|
-
|
|
504
|
-
|
|
748
|
+
kind: 'context';
|
|
749
|
+
group: string;
|
|
505
750
|
} | {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
751
|
+
kind: 'ancestor';
|
|
752
|
+
nodeId: string;
|
|
753
|
+
state: string;
|
|
509
754
|
};
|
|
510
755
|
type CompareOp = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'set' | 'unset';
|
|
511
756
|
type Predicate = {
|
|
512
|
-
|
|
513
|
-
|
|
757
|
+
kind: 'all';
|
|
758
|
+
items: Predicate[];
|
|
514
759
|
} | {
|
|
515
|
-
|
|
516
|
-
|
|
760
|
+
kind: 'any';
|
|
761
|
+
items: Predicate[];
|
|
517
762
|
} | {
|
|
518
|
-
|
|
519
|
-
|
|
763
|
+
kind: 'not';
|
|
764
|
+
item: Predicate;
|
|
520
765
|
} | {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
766
|
+
kind: 'cmp';
|
|
767
|
+
ref: PredicateRef;
|
|
768
|
+
op: CompareOp;
|
|
769
|
+
value?: PropValue;
|
|
525
770
|
};
|
|
526
771
|
interface PartVariant {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
772
|
+
when?: RealizeCond;
|
|
773
|
+
whenPredicate?: Predicate;
|
|
774
|
+
states?: StateName[];
|
|
775
|
+
facets?: FacetMap;
|
|
776
|
+
layout?: LayoutSpec;
|
|
532
777
|
}
|
|
533
778
|
type PartSlotArity = 'single' | 'optional' | 'many';
|
|
534
779
|
type PartSlotAccepts = {
|
|
535
|
-
|
|
780
|
+
kind: 'content';
|
|
781
|
+
} | {
|
|
782
|
+
kind: 'type';
|
|
783
|
+
ref: string;
|
|
784
|
+
} | {
|
|
785
|
+
kind: 'component';
|
|
786
|
+
ref: string;
|
|
787
|
+
};
|
|
788
|
+
/** A design-time-only fill for a slot (never generated): a literal string, a named
|
|
789
|
+
* example, or a list of either (the multi-item preview of a `many` slot). */
|
|
790
|
+
type PartSlotSample = {
|
|
791
|
+
kind: 'text';
|
|
792
|
+
text: string;
|
|
536
793
|
} | {
|
|
537
|
-
|
|
538
|
-
|
|
794
|
+
kind: 'example';
|
|
795
|
+
example: string;
|
|
539
796
|
} | {
|
|
540
|
-
|
|
541
|
-
|
|
797
|
+
kind: 'list';
|
|
798
|
+
items: PartSlotSample[];
|
|
542
799
|
};
|
|
543
800
|
interface PartSlot {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
801
|
+
arity: PartSlotArity;
|
|
802
|
+
accepts: PartSlotAccepts;
|
|
803
|
+
/** The slot a consumer fills when they pass children positionally. */
|
|
804
|
+
default?: boolean;
|
|
805
|
+
/** The item field that keys a `many` slot's entries. */
|
|
806
|
+
keyedBy?: string;
|
|
807
|
+
/** The public name this slot is exposed under, when it differs from the part name. */
|
|
808
|
+
exposeAs?: string;
|
|
809
|
+
/** `trigger` / `panel` - the structural role a disclosure's slot plays. */
|
|
810
|
+
role?: string;
|
|
811
|
+
/** Authored doc prose for the slot (proposal 0018), transcluded by the docs page. */
|
|
812
|
+
description?: string;
|
|
813
|
+
sample?: PartSlotSample;
|
|
814
|
+
}
|
|
815
|
+
/** A value that is either a literal or BOUND to a prop. Mirrors core's `ContentValue`. */
|
|
816
|
+
type PartValue = {
|
|
817
|
+
kind: 'value';
|
|
818
|
+
value: PropValue;
|
|
819
|
+
} | {
|
|
820
|
+
kind: 'bind';
|
|
821
|
+
prop: string;
|
|
822
|
+
};
|
|
823
|
+
/** One conditional leg of a part's text (`when <predicate> -> <value>`). */
|
|
824
|
+
interface PartContentRule {
|
|
825
|
+
when?: Predicate;
|
|
826
|
+
value: PartValue;
|
|
827
|
+
}
|
|
828
|
+
/** A part's text content: a fixed string, or a default plus predicate-gated legs. */
|
|
829
|
+
type PartContent = {
|
|
830
|
+
kind: 'static';
|
|
831
|
+
text: string;
|
|
832
|
+
} | {
|
|
833
|
+
kind: 'dynamic';
|
|
834
|
+
default: PartValue;
|
|
835
|
+
rules: PartContentRule[];
|
|
836
|
+
};
|
|
837
|
+
/** Accessible naming (proposal 0013). `labelledBy`/`describedBy` name a part by PATH. */
|
|
838
|
+
interface PartA11y {
|
|
839
|
+
name?: PartValue;
|
|
840
|
+
labelledBy?: string;
|
|
841
|
+
describedBy?: string;
|
|
842
|
+
}
|
|
843
|
+
/** An event the part raises: `<event> on <interaction> [payload …]`. `event` is a
|
|
844
|
+
* declared event NAME (the surface never prints an internal event id). */
|
|
845
|
+
interface PartEmit {
|
|
846
|
+
event: string;
|
|
847
|
+
on: string;
|
|
848
|
+
payload?: PartValue;
|
|
849
|
+
signal?: string;
|
|
850
|
+
locked?: boolean;
|
|
851
|
+
}
|
|
852
|
+
/** A UI state driven by a prop (`bind state disabled disabled`). */
|
|
853
|
+
interface PartStateBinding {
|
|
854
|
+
state: string;
|
|
855
|
+
prop: string;
|
|
856
|
+
}
|
|
857
|
+
type PartRepeatSource = {
|
|
858
|
+
kind: 'prop';
|
|
859
|
+
prop: string;
|
|
860
|
+
} | {
|
|
861
|
+
kind: 'static';
|
|
862
|
+
items: PropValue[];
|
|
863
|
+
};
|
|
864
|
+
/** Repetition over a collection (`repeat items as item`). */
|
|
865
|
+
interface PartRepeat {
|
|
866
|
+
source: PartRepeatSource;
|
|
867
|
+
itemAlias: string;
|
|
868
|
+
}
|
|
869
|
+
/** One transition (proposal 0017). `duration`/`easing`/`delay` name TOKENS. */
|
|
870
|
+
interface PartMotionTransition {
|
|
871
|
+
facets?: string[];
|
|
872
|
+
duration: string;
|
|
873
|
+
easing?: string;
|
|
874
|
+
delay?: string;
|
|
875
|
+
}
|
|
876
|
+
/** A nested component (proposal 0012). `component` is the component NAME. */
|
|
877
|
+
interface PartInstance {
|
|
878
|
+
component: string;
|
|
879
|
+
props: Array<{
|
|
880
|
+
name: string;
|
|
881
|
+
value: PartValue;
|
|
882
|
+
}>;
|
|
883
|
+
}
|
|
884
|
+
/** Non-portable, target-specific content (proposal 0041 §4). Quarantined by design: a
|
|
885
|
+
* reader that does not know `target` must skip it rather than try to interpret it. */
|
|
886
|
+
interface PartForeign {
|
|
887
|
+
code: string;
|
|
888
|
+
label?: string;
|
|
889
|
+
target?: string;
|
|
890
|
+
}
|
|
891
|
+
interface PartCell {
|
|
892
|
+
header?: boolean;
|
|
893
|
+
scope?: 'col' | 'row';
|
|
894
|
+
}
|
|
895
|
+
type PartMediaSample = {
|
|
896
|
+
kind: 'asset';
|
|
897
|
+
asset: string;
|
|
898
|
+
} | {
|
|
899
|
+
kind: 'url';
|
|
900
|
+
url: string;
|
|
901
|
+
};
|
|
902
|
+
type PartMediaSource = {
|
|
903
|
+
kind: 'bind';
|
|
904
|
+
prop: string;
|
|
905
|
+
sample?: PartMediaSample;
|
|
906
|
+
} | {
|
|
907
|
+
kind: 'static';
|
|
908
|
+
asset: string;
|
|
909
|
+
};
|
|
910
|
+
/** A free behaviour (proposal 0041 §4): a closed vocabulary of interaction behaviours
|
|
911
|
+
* (`focus-trap`, `typeahead`, …), each a flat record of scalars and part paths. */
|
|
912
|
+
interface PartBehavior {
|
|
913
|
+
kind: string;
|
|
914
|
+
config: Metadata;
|
|
915
|
+
}
|
|
916
|
+
/** The per-archetype configuration surfaces (proposal 0034/0029/0035): `calendar { … }`,
|
|
917
|
+
* `tabs { … }`, `slider { … }`, … Each block is a flat record of scalars, keyed by the
|
|
918
|
+
* surface block name; the AST→IR adapter VALIDATES each into its typed shape rather
|
|
919
|
+
* than casting, because a `.milda` is untrusted input. */
|
|
920
|
+
type PartConfigs = Record<string, Metadata>;
|
|
547
921
|
interface Part {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
922
|
+
layout?: LayoutSpec;
|
|
923
|
+
facets?: FacetMap;
|
|
924
|
+
kind?: string;
|
|
925
|
+
origin?: 'root' | 'archetype' | 'author';
|
|
926
|
+
content?: PartContent;
|
|
927
|
+
a11y?: PartA11y;
|
|
928
|
+
emits?: PartEmit[];
|
|
929
|
+
stateBindings?: PartStateBinding[];
|
|
930
|
+
/** The prop this part's value is bound to (an input's `value`). */
|
|
931
|
+
valueBinding?: string;
|
|
932
|
+
/** The declared type of the value this part holds. */
|
|
933
|
+
value?: TypeExpr;
|
|
934
|
+
repeat?: PartRepeat;
|
|
935
|
+
cell?: PartCell;
|
|
936
|
+
/** Control realization (proposal 0016): `checkbox` | `switch`. */
|
|
937
|
+
control?: string;
|
|
938
|
+
/** Group realization (0022): `radio` | `segmented`. */
|
|
939
|
+
group?: string;
|
|
940
|
+
/** Presentation intent (0022 §8): `accessibleName` for an icon-only control. */
|
|
941
|
+
presentation?: string;
|
|
942
|
+
/** Media type of a content part: `img` | `video` | `audio` | `embed`. */
|
|
943
|
+
media?: string;
|
|
944
|
+
mediaSource?: PartMediaSource;
|
|
945
|
+
mediaAlt?: PartValue;
|
|
946
|
+
/** Navigation target of a link part - static or prop-bound. */
|
|
947
|
+
destination?: PartValue;
|
|
948
|
+
motion?: PartMotionTransition[];
|
|
949
|
+
instance?: PartInstance;
|
|
950
|
+
behaviors?: PartBehavior[];
|
|
951
|
+
foreign?: PartForeign;
|
|
952
|
+
configs?: PartConfigs;
|
|
953
|
+
/** Demo interactions (proposal 0021) - only meaningful inside an `example`. */
|
|
954
|
+
actions?: PartAction[];
|
|
955
|
+
slot?: PartSlot;
|
|
956
|
+
presence?: Predicate;
|
|
957
|
+
states?: Partial<Record<StateName, PartState>>;
|
|
958
|
+
variants?: PartVariant[];
|
|
554
959
|
}
|
|
555
960
|
type Anatomy = Record<string, Part>;
|
|
556
961
|
interface RealizeCond {
|
|
557
|
-
|
|
558
|
-
|
|
962
|
+
prop: string;
|
|
963
|
+
eq: string | number | boolean;
|
|
559
964
|
}
|
|
560
965
|
interface Wire {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
966
|
+
from: string;
|
|
967
|
+
to: string;
|
|
968
|
+
arg?: string;
|
|
969
|
+
when?: RealizeCond;
|
|
565
970
|
}
|
|
566
971
|
interface PresentationRealize {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
972
|
+
surface?: string;
|
|
973
|
+
place?: string;
|
|
974
|
+
flip?: boolean;
|
|
975
|
+
matchWidth?: boolean;
|
|
571
976
|
}
|
|
572
977
|
interface BrowseRealize {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
978
|
+
mode?: string;
|
|
979
|
+
orient?: 'horizontal' | 'vertical';
|
|
980
|
+
wrap?: boolean;
|
|
576
981
|
}
|
|
577
982
|
interface CommitRealize {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
983
|
+
mode: 'explicit' | 'continuous';
|
|
984
|
+
on?: string[];
|
|
985
|
+
live?: string;
|
|
986
|
+
settled?: string;
|
|
582
987
|
}
|
|
583
988
|
interface Realization {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
989
|
+
target: string;
|
|
990
|
+
when: RealizeCond | null;
|
|
991
|
+
presentation?: PresentationRealize;
|
|
992
|
+
browse?: BrowseRealize;
|
|
993
|
+
commit?: CommitRealize;
|
|
994
|
+
surface?: string;
|
|
995
|
+
drop?: string[];
|
|
996
|
+
wire?: Wire[];
|
|
997
|
+
note?: string;
|
|
998
|
+
dismiss?: string[];
|
|
999
|
+
backdrop?: string;
|
|
595
1000
|
}
|
|
596
1001
|
interface Composition {
|
|
597
|
-
|
|
598
|
-
|
|
1002
|
+
uses: UsesClause[];
|
|
1003
|
+
coordination: CoordEntry[];
|
|
599
1004
|
}
|
|
600
1005
|
interface Component {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
1006
|
+
id: Id;
|
|
1007
|
+
name: string;
|
|
1008
|
+
description?: string;
|
|
1009
|
+
archetype: string;
|
|
1010
|
+
contract: Contract;
|
|
1011
|
+
anatomy: Anatomy;
|
|
1012
|
+
realize: Realization[];
|
|
1013
|
+
composition?: Composition;
|
|
1014
|
+
meta?: Metadata;
|
|
1015
|
+
group?: string;
|
|
1016
|
+
}
|
|
1017
|
+
interface ComponentGroupDecl {
|
|
1018
|
+
path: string;
|
|
1019
|
+
description?: string;
|
|
1020
|
+
}
|
|
1021
|
+
interface DemoVariable {
|
|
1022
|
+
type: TypeExpr;
|
|
1023
|
+
initial: PropValue;
|
|
1024
|
+
}
|
|
1025
|
+
interface Example {
|
|
1026
|
+
name: string;
|
|
1027
|
+
/** The component NAME this scene demonstrates; absent = a freestanding fixture. */
|
|
1028
|
+
for?: string;
|
|
1029
|
+
description?: string;
|
|
1030
|
+
demo?: Record<string, DemoVariable>;
|
|
1031
|
+
anatomy: Anatomy;
|
|
1032
|
+
}
|
|
1033
|
+
interface PartAction {
|
|
1034
|
+
on: string;
|
|
1035
|
+
op: 'set' | 'toggle';
|
|
1036
|
+
variable: string;
|
|
1037
|
+
value?: PropValue;
|
|
1038
|
+
}
|
|
1039
|
+
interface ProjectMetadataEntry {
|
|
1040
|
+
id: Id;
|
|
1041
|
+
key: string;
|
|
1042
|
+
type: TypeExpr;
|
|
1043
|
+
value?: PropValue;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* A prop declared ONCE for the whole system, which any component may take by reference
|
|
1047
|
+
* (proposal 0051 §5). Its default is the system-wide value; an instance overrides it by passing
|
|
1048
|
+
* the prop, exactly as it would a local one.
|
|
1049
|
+
*
|
|
1050
|
+
* It lives in the foundations rather than on a component because that is what it IS: a
|
|
1051
|
+
* system-wide decision, next to the context groups it usually names. A design system with a
|
|
1052
|
+
* `variant` dimension says so once - the Radix mapping restated the same five props on 49
|
|
1053
|
+
* components, and the restatement carried no information.
|
|
1054
|
+
*/
|
|
1055
|
+
interface GlobalProp {
|
|
1056
|
+
id: Id;
|
|
1057
|
+
name: string;
|
|
1058
|
+
type: TypeExpr;
|
|
1059
|
+
/** The system-wide value. Absent means "no default" - for a context type, inherit the theme. */
|
|
1060
|
+
default?: PropValue;
|
|
1061
|
+
description?: string;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* How the system is meant to be put together (proposal 0052 §5): a top-level `rule`. Mirrors the
|
|
1065
|
+
* editor IR's `UsageRule` (@mildastudio/core) for the reason `Predicate` does - this package is
|
|
1066
|
+
* standalone - and is lowered to it by the AST adapter in `@mildastudio/generate`.
|
|
1067
|
+
*
|
|
1068
|
+
* Every reference is by NAME, so a rule naming a component another file declares survives a
|
|
1069
|
+
* per-file round trip; a reference nothing resolves is a warning, never a drop.
|
|
1070
|
+
*/
|
|
1071
|
+
interface RuleSubject {
|
|
1072
|
+
kind: 'component' | 'archetype';
|
|
1073
|
+
name: string;
|
|
1074
|
+
where?: Predicate;
|
|
1075
|
+
}
|
|
1076
|
+
type UsageRule = {
|
|
1077
|
+
id: string;
|
|
1078
|
+
severity: 'error' | 'warning';
|
|
1079
|
+
rationale: string;
|
|
1080
|
+
} & ({
|
|
1081
|
+
kind: 'count';
|
|
1082
|
+
subject: RuleSubject;
|
|
1083
|
+
within: RuleSubject;
|
|
1084
|
+
min?: number;
|
|
1085
|
+
max?: number;
|
|
1086
|
+
} | {
|
|
1087
|
+
kind: 'never';
|
|
1088
|
+
subject: RuleSubject;
|
|
1089
|
+
within: RuleSubject;
|
|
1090
|
+
} | {
|
|
1091
|
+
kind: 'only-within';
|
|
1092
|
+
subject: RuleSubject;
|
|
1093
|
+
within: RuleSubject[];
|
|
1094
|
+
} | {
|
|
1095
|
+
kind: 'tokens-only';
|
|
1096
|
+
types: TokenType[];
|
|
1097
|
+
} | {
|
|
1098
|
+
kind: 'prefer';
|
|
1099
|
+
component: string;
|
|
1100
|
+
archetypes: string[];
|
|
1101
|
+
});
|
|
1102
|
+
interface Foundations {
|
|
1103
|
+
contextGroups: ContextGroup[];
|
|
1104
|
+
layers: Layer[];
|
|
1105
|
+
sharedTypes: SharedType[];
|
|
1106
|
+
metadata: ProjectMetadataEntry[];
|
|
1107
|
+
/** Absent when the system declares none, so a file that has never used one is unchanged. */
|
|
1108
|
+
globalProps?: GlobalProp[];
|
|
1109
|
+
/** Usage rules (0052 §5). Absent when the file declares none. */
|
|
1110
|
+
rules?: UsageRule[];
|
|
1111
|
+
}
|
|
1112
|
+
type DocBlockDecl = {
|
|
1113
|
+
kind: 'prose';
|
|
1114
|
+
prose: string;
|
|
1115
|
+
text: string;
|
|
1116
|
+
anchor?: string;
|
|
1117
|
+
} | {
|
|
1118
|
+
kind: 'divider';
|
|
1119
|
+
} | {
|
|
1120
|
+
kind: 'image';
|
|
1121
|
+
asset?: string;
|
|
1122
|
+
} | {
|
|
1123
|
+
kind: 'component';
|
|
1124
|
+
component?: string;
|
|
1125
|
+
} | {
|
|
1126
|
+
kind: 'componentProps';
|
|
1127
|
+
component?: string;
|
|
1128
|
+
} | {
|
|
1129
|
+
kind: 'componentEvents';
|
|
1130
|
+
component?: string;
|
|
1131
|
+
} | {
|
|
1132
|
+
kind: 'componentComposition';
|
|
1133
|
+
component?: string;
|
|
1134
|
+
} | {
|
|
1135
|
+
kind: 'componentProp';
|
|
1136
|
+
component?: string;
|
|
1137
|
+
prop?: string;
|
|
1138
|
+
} | {
|
|
1139
|
+
kind: 'componentEvent';
|
|
1140
|
+
component?: string;
|
|
1141
|
+
event?: string;
|
|
1142
|
+
} | {
|
|
1143
|
+
kind: 'example';
|
|
1144
|
+
example?: string;
|
|
1145
|
+
} | {
|
|
1146
|
+
kind: 'componentGroup';
|
|
1147
|
+
group?: string;
|
|
1148
|
+
} | {
|
|
1149
|
+
kind: 'tokens';
|
|
1150
|
+
tokenType?: string;
|
|
1151
|
+
} | {
|
|
1152
|
+
kind: 'swatch';
|
|
1153
|
+
tokenType?: string;
|
|
1154
|
+
};
|
|
1155
|
+
interface DocPageDecl {
|
|
1156
|
+
title: string;
|
|
1157
|
+
/** The sidebar section this page sits in. */
|
|
1158
|
+
group?: string;
|
|
1159
|
+
/** The parent page's TITLE, for a nested page. */
|
|
1160
|
+
parent?: string;
|
|
1161
|
+
blocks: DocBlockDecl[];
|
|
1162
|
+
}
|
|
1163
|
+
interface DocsSiteDecl {
|
|
1164
|
+
name?: string;
|
|
1165
|
+
tagline?: string;
|
|
1166
|
+
version?: string;
|
|
1167
|
+
searchPlaceholder?: string;
|
|
1168
|
+
}
|
|
1169
|
+
interface DocsFooterLinkDecl {
|
|
1170
|
+
label: string;
|
|
1171
|
+
href: string;
|
|
1172
|
+
}
|
|
1173
|
+
interface DocsFooterDecl {
|
|
1174
|
+
links: DocsFooterLinkDecl[];
|
|
1175
|
+
copyright?: string;
|
|
1176
|
+
}
|
|
1177
|
+
interface DocsDecl {
|
|
1178
|
+
pages: DocPageDecl[];
|
|
1179
|
+
site?: DocsSiteDecl;
|
|
1180
|
+
footer?: DocsFooterDecl;
|
|
1181
|
+
}
|
|
1182
|
+
interface AssetFolderDecl {
|
|
1183
|
+
/** The folder's PATH (`Brand/Icons`), which is its nesting written down. */
|
|
1184
|
+
path: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface AssetDecl {
|
|
1187
|
+
kind: string;
|
|
1188
|
+
name: string;
|
|
1189
|
+
/** The containing folder's path; absent = the library root. */
|
|
1190
|
+
folder?: string;
|
|
1191
|
+
mimeType?: string;
|
|
1192
|
+
sizeBytes?: number;
|
|
1193
|
+
uploadedAt?: string;
|
|
1194
|
+
/** Where the bytes live. A `data:` URI here makes the file self-contained. */
|
|
1195
|
+
url?: string;
|
|
1196
|
+
tags?: string[];
|
|
1197
|
+
/** Per-kind metadata (`width`, `viewBox`, `fontWeight`, …), validated on lowering. */
|
|
1198
|
+
props: Record<string, PropValue>;
|
|
1199
|
+
}
|
|
1200
|
+
interface AssetsDecl {
|
|
1201
|
+
folders: AssetFolderDecl[];
|
|
1202
|
+
assets: AssetDecl[];
|
|
1203
|
+
}
|
|
1204
|
+
interface IconSetDecl {
|
|
1205
|
+
/** The set's prefix in its provider's namespace (`lucide`, `ph`), which is what resolves. */
|
|
1206
|
+
prefix: string;
|
|
1207
|
+
name: string;
|
|
1208
|
+
provider?: string;
|
|
1209
|
+
license?: string;
|
|
1210
|
+
/** Four representative glyph names a preview shows for the set. */
|
|
1211
|
+
samples?: string[];
|
|
1212
|
+
}
|
|
1213
|
+
type IconDecl = {
|
|
1214
|
+
kind: 'set';
|
|
1215
|
+
prefix: string;
|
|
1216
|
+
name: string;
|
|
1217
|
+
label?: string;
|
|
1218
|
+
/** The glyph's vendored SVG body, so a generated package needs no CDN (proposal 0019). */
|
|
1219
|
+
svg?: string;
|
|
1220
|
+
} | {
|
|
1221
|
+
kind: 'custom';
|
|
1222
|
+
name: string;
|
|
1223
|
+
/** The NAME of the asset in the file's `assets` block whose bytes draw this glyph. */
|
|
1224
|
+
asset?: string;
|
|
1225
|
+
label?: string;
|
|
1226
|
+
};
|
|
1227
|
+
interface IconsDecl {
|
|
1228
|
+
sets: IconSetDecl[];
|
|
1229
|
+
icons: IconDecl[];
|
|
1230
|
+
}
|
|
612
1231
|
type AssetKind = 'font' | 'image' | 'svg' | 'video' | 'animation';
|
|
613
1232
|
interface BaseAsset {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
1233
|
+
id: string;
|
|
1234
|
+
name: string;
|
|
1235
|
+
kind: AssetKind;
|
|
1236
|
+
mimeType: string;
|
|
1237
|
+
sizeBytes: number;
|
|
1238
|
+
uploadedAt: string;
|
|
1239
|
+
url: string;
|
|
1240
|
+
tags: string[];
|
|
1241
|
+
folderId: string | null;
|
|
623
1242
|
}
|
|
624
1243
|
interface FontAsset extends BaseAsset {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
1244
|
+
kind: 'font';
|
|
1245
|
+
fontFamily: string;
|
|
1246
|
+
fontStyle: 'normal' | 'italic';
|
|
1247
|
+
fontWeight: number;
|
|
1248
|
+
formats: Array<'woff2' | 'woff' | 'ttf' | 'otf'>;
|
|
630
1249
|
}
|
|
631
1250
|
interface ImageAsset extends BaseAsset {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
1251
|
+
kind: 'image';
|
|
1252
|
+
width: number;
|
|
1253
|
+
height: number;
|
|
1254
|
+
alt: string;
|
|
636
1255
|
}
|
|
637
1256
|
interface SvgAsset extends BaseAsset {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
1257
|
+
kind: 'svg';
|
|
1258
|
+
viewBox: string;
|
|
1259
|
+
width: number;
|
|
1260
|
+
height: number;
|
|
642
1261
|
}
|
|
643
1262
|
interface VideoAsset extends BaseAsset {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
1263
|
+
kind: 'video';
|
|
1264
|
+
width: number;
|
|
1265
|
+
height: number;
|
|
1266
|
+
durationMs: number;
|
|
1267
|
+
poster?: string;
|
|
649
1268
|
}
|
|
650
1269
|
type AnimationFormat = 'lottie' | 'rive' | 'css';
|
|
651
1270
|
interface AnimationAsset extends BaseAsset {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
1271
|
+
kind: 'animation';
|
|
1272
|
+
format: AnimationFormat;
|
|
1273
|
+
durationMs: number;
|
|
1274
|
+
loop: boolean;
|
|
656
1275
|
}
|
|
657
1276
|
type Asset = FontAsset | ImageAsset | SvgAsset | VideoAsset | AnimationAsset;
|
|
658
1277
|
type AssetByKind = {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1278
|
+
font: FontAsset;
|
|
1279
|
+
image: ImageAsset;
|
|
1280
|
+
svg: SvgAsset;
|
|
1281
|
+
video: VideoAsset;
|
|
1282
|
+
animation: AnimationAsset;
|
|
664
1283
|
};
|
|
665
1284
|
interface AssetFolder {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
1285
|
+
id: string;
|
|
1286
|
+
name: string;
|
|
1287
|
+
parentId: string | null;
|
|
1288
|
+
createdAt: string;
|
|
670
1289
|
}
|
|
671
1290
|
interface AssetRegistry {
|
|
672
|
-
|
|
673
|
-
|
|
1291
|
+
assets: Record<string, Asset>;
|
|
1292
|
+
folders: Record<string, AssetFolder>;
|
|
674
1293
|
}
|
|
675
|
-
|
|
676
1294
|
interface Project extends MildaDocumentBase {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
1295
|
+
kind: 'design-system';
|
|
1296
|
+
foundations: Foundations;
|
|
1297
|
+
assets: AssetRegistry;
|
|
1298
|
+
components: Component[];
|
|
681
1299
|
}
|
|
682
|
-
|
|
683
1300
|
declare const preludeV0: PreludeDocument;
|
|
684
1301
|
declare const atomsByName: Record<string, Atom>;
|
|
685
1302
|
declare const compositesByName: Record<string, CompositeBehavior>;
|
|
686
1303
|
declare const archetypesByName: Record<string, ArchetypeDef>;
|
|
687
|
-
|
|
1304
|
+
type ArchetypeRef = ArchetypeDef | string | null | undefined;
|
|
1305
|
+
interface AnatomyEntry {
|
|
1306
|
+
name: string;
|
|
1307
|
+
parentName: string | null;
|
|
1308
|
+
role: PartRole;
|
|
1309
|
+
optional: boolean;
|
|
1310
|
+
repeated: boolean;
|
|
1311
|
+
}
|
|
1312
|
+
declare function anatomyIndex(archetype: ArchetypeRef): Map<string, AnatomyEntry>;
|
|
1313
|
+
declare function loweredAnatomy(archetype: ArchetypeRef): readonly string[];
|
|
1314
|
+
declare function findDeclaredPart(name: string, parentPath: string, rootPath: string, paths: Iterable<string>, repeated: boolean): string | undefined;
|
|
1315
|
+
interface MissingPart {
|
|
1316
|
+
path: string;
|
|
1317
|
+
kind: PartRole;
|
|
1318
|
+
implied: boolean;
|
|
1319
|
+
}
|
|
1320
|
+
declare function missingRequiredParts(archetype: ArchetypeRef, anatomy: Anatomy): MissingPart[];
|
|
688
1321
|
type ResolvedToken = {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
1322
|
+
kind: 'value';
|
|
1323
|
+
type: TokenType;
|
|
1324
|
+
value: AnyTokenValue;
|
|
692
1325
|
} | {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
1326
|
+
kind: 'escape';
|
|
1327
|
+
raw: string;
|
|
1328
|
+
note?: string;
|
|
1329
|
+
} |
|
|
1330
|
+
/**
|
|
1331
|
+
* A computed value (proposal 0044), reported rather than evaluated: the maths - colour
|
|
1332
|
+
* spaces, dp lowering - lives in the editor IR's resolver, not in this lightweight AST
|
|
1333
|
+
* walk. It is its own answer because neither alternative is true: `null` would say the
|
|
1334
|
+
* token does not resolve (it does, and a conformance check would report a hole that is not
|
|
1335
|
+
* there), and returning the base's value would say the token IS its base, unmodified.
|
|
1336
|
+
*/
|
|
1337
|
+
{
|
|
1338
|
+
kind: 'computed';
|
|
1339
|
+
type: TokenType;
|
|
1340
|
+
from: string;
|
|
696
1341
|
} | null;
|
|
697
1342
|
declare function resolveToken(tokenId: string, contextIds: string | readonly string[], layers: Layer[], _depth?: number): ResolvedToken;
|
|
698
1343
|
declare function findToken(tokenId: string, layers: Layer[]): {
|
|
699
|
-
|
|
700
|
-
|
|
1344
|
+
token: Token$1;
|
|
1345
|
+
layerId: string;
|
|
701
1346
|
} | null;
|
|
702
|
-
declare function allTokensOfType(type: TokenType
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
1347
|
+
declare function allTokensOfType(type: TokenType, layers: Layer[]): Array<{
|
|
1348
|
+
token: Token$1;
|
|
1349
|
+
layerId: string;
|
|
1350
|
+
layerName: string;
|
|
706
1351
|
}>;
|
|
707
|
-
|
|
708
|
-
interface ResolveFacetsInput {
|
|
709
|
-
part: Part;
|
|
710
|
-
activeStates: ReadonlySet<StateName>;
|
|
711
|
-
stateOrder?: StateName[];
|
|
712
|
-
}
|
|
713
|
-
declare function resolveFacets(input: ResolveFacetsInput): FacetMap;
|
|
714
|
-
declare function resolveLayout(input: ResolveFacetsInput): LayoutSpec | undefined;
|
|
715
|
-
declare function collectActiveStates(flags: Partial<Record<StateName, boolean>>): ReadonlySet<StateName>;
|
|
716
|
-
|
|
717
1352
|
interface ValidationIssue {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
1353
|
+
severity: 'error' | 'warning';
|
|
1354
|
+
code: string;
|
|
1355
|
+
message: string;
|
|
1356
|
+
where?: string;
|
|
1357
|
+
id?: string;
|
|
723
1358
|
}
|
|
724
1359
|
declare function validate(doc: Project, prelude: PreludeDocument): ValidationIssue[];
|
|
725
|
-
|
|
726
1360
|
interface Hole {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
1361
|
+
kind: 'facet' | 'layout' | 'behavior';
|
|
1362
|
+
name: string;
|
|
1363
|
+
where: string;
|
|
1364
|
+
reason: string;
|
|
731
1365
|
}
|
|
732
1366
|
interface Substitution {
|
|
733
|
-
|
|
734
|
-
|
|
1367
|
+
behavior: string;
|
|
1368
|
+
via: string;
|
|
735
1369
|
}
|
|
736
1370
|
interface ConformanceReport {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
1371
|
+
target: string;
|
|
1372
|
+
complete: boolean;
|
|
1373
|
+
holes: Hole[];
|
|
1374
|
+
substitutions: Substitution[];
|
|
741
1375
|
}
|
|
742
1376
|
interface ConformanceOptions {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
1377
|
+
target: string;
|
|
1378
|
+
contextIds: string[];
|
|
1379
|
+
layers: Layer[];
|
|
746
1380
|
}
|
|
747
1381
|
declare function conformance(comp: Component, opts: ConformanceOptions): ConformanceReport;
|
|
748
|
-
|
|
749
1382
|
interface DesignSystemDocument {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1383
|
+
milda: string;
|
|
1384
|
+
kind: 'design-system';
|
|
1385
|
+
prelude: string;
|
|
1386
|
+
meta: {
|
|
1387
|
+
id: string;
|
|
1388
|
+
name: string;
|
|
1389
|
+
version: string;
|
|
1390
|
+
description?: string;
|
|
1391
|
+
};
|
|
1392
|
+
foundations: Foundations;
|
|
1393
|
+
components: Component[];
|
|
1394
|
+
componentGroups?: ComponentGroupDecl[];
|
|
1395
|
+
examples?: Example[];
|
|
1396
|
+
docs?: DocsDecl;
|
|
1397
|
+
assets?: AssetsDecl;
|
|
1398
|
+
icons?: IconsDecl;
|
|
761
1399
|
}
|
|
762
1400
|
interface ParseIssue {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
1401
|
+
severity: 'error' | 'warning';
|
|
1402
|
+
code: string;
|
|
1403
|
+
message: string;
|
|
1404
|
+
line: number;
|
|
1405
|
+
col: number;
|
|
768
1406
|
}
|
|
769
1407
|
interface SourcePosition {
|
|
770
|
-
|
|
771
|
-
|
|
1408
|
+
line: number;
|
|
1409
|
+
col: number;
|
|
772
1410
|
}
|
|
773
1411
|
interface SourceRange {
|
|
774
|
-
|
|
775
|
-
|
|
1412
|
+
start: SourcePosition;
|
|
1413
|
+
end: SourcePosition;
|
|
776
1414
|
}
|
|
777
|
-
type SpanKind = 'component' | 'token' | 'contextGroup' | 'context' | 'sharedType' | 'part' | 'prop' | 'event';
|
|
1415
|
+
type SpanKind = 'component' | 'token' | 'contextGroup' | 'context' | 'sharedType' | 'globalProp' | 'rule' | 'part' | 'prop' | 'event';
|
|
778
1416
|
interface NodeSpan {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1417
|
+
id: string;
|
|
1418
|
+
kind: SpanKind;
|
|
1419
|
+
name: string;
|
|
1420
|
+
nameRange: SourceRange;
|
|
1421
|
+
fullRange: SourceRange;
|
|
1422
|
+
parentId?: string;
|
|
785
1423
|
}
|
|
786
1424
|
interface ParseResult {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
1425
|
+
document: DesignSystemDocument;
|
|
1426
|
+
issues: ParseIssue[];
|
|
1427
|
+
spans: NodeSpan[];
|
|
790
1428
|
}
|
|
791
1429
|
interface ParseOptions {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
1430
|
+
name?: string;
|
|
1431
|
+
milda?: string;
|
|
1432
|
+
prelude?: string;
|
|
1433
|
+
}
|
|
1434
|
+
/** Facet names accepted by `parseFacetStmt` (those with an AST home). */
|
|
1435
|
+
declare const FACET_NAMES: readonly string[];
|
|
1436
|
+
/** Token-type names accepted by `parseTokenDecl` - kebab spelling only (the camelCase
|
|
1437
|
+
* aliases in TYPE_MAP stay accepted, they're just not advertised, and neither are the
|
|
1438
|
+
* legacy spellings above). */
|
|
1439
|
+
declare const TOKEN_TYPE_NAMES: readonly string[];
|
|
1440
|
+
/** The `token … = ‹kind›` value kinds. */
|
|
1441
|
+
declare const TOKEN_VALUE_KINDS: readonly string[];
|
|
1442
|
+
/** Keys accepted inside a `layout { … }` block - keep in step with `parseLayoutBody`. `flow` and
|
|
1443
|
+
* `ratio` are reading aliases (0056 §3.2); `grid` is reserved (0056 §3.3). */
|
|
1444
|
+
declare const LAYOUT_KEYS: readonly string[];
|
|
1445
|
+
/** What may follow each word inside a `layout { … }` block, keyed on the word BEFORE the
|
|
1446
|
+
* cursor so completion can read it directly: a key's values, the edges after `pinned` /
|
|
1447
|
+
* `bleed`, the intents after `size` / `width` / `height`. All from the vocabulary (0056 §3.1),
|
|
1448
|
+
* so the parser, the printer and the LSP cannot disagree about a word. */
|
|
1449
|
+
declare const LAYOUT_VALUES: Readonly<Record<string, readonly string[]>>;
|
|
1450
|
+
/** Slot arities accepted by `slot ‹arity›` (grammar `arity`). */
|
|
1451
|
+
declare const SLOT_ARITIES: readonly string[];
|
|
1452
|
+
/** Statement keywords accepted inside a `part { … }` block, for editor completion. */
|
|
1453
|
+
declare const PART_KEYWORDS: readonly string[];
|
|
1454
|
+
/** The surface token-type names whose value MUST carry a unit (a bare number is rejected
|
|
1455
|
+
* with `length-unit-required`). Exported so the printer's own "emit a canonical length
|
|
1456
|
+
* here" set can be asserted against this one: giving `border`/`font-size`/`letter-spacing`
|
|
1457
|
+
* their own words widened the reader's set and left the writer's behind, so the printer
|
|
1458
|
+
* emitted bare numbers its own reader then refused (0041 §1.1d). */
|
|
1459
|
+
declare const LENGTH_TOKEN_TYPE_NAMES: readonly string[];
|
|
1460
|
+
/**
|
|
1461
|
+
* The KIND of value a token type carries. Types are grouped into families rather than compared
|
|
1462
|
+
* exactly, because several of them share a value shape on purpose: a `ring` or a `backdrop` IS a
|
|
1463
|
+
* colour, and every length type fills a length slot. Used by the alias cross-type check (below)
|
|
1464
|
+
* and by editor tooling, which offers the tokens that would fit a slot - one answer to "can this
|
|
1465
|
+
* value go there", not two that can disagree.
|
|
1466
|
+
*/
|
|
1467
|
+
declare function tokenTypeFamily(type: TokenType | string): string;
|
|
1468
|
+
/** Every accepted spelling of a token type → the AST type it means (`dimension` → `size`,
|
|
1469
|
+
* `font-family` → `fontFamily`). Exported so tooling can read a DECLARED type off the source
|
|
1470
|
+
* and compare it with the tokens it already parsed. */
|
|
1471
|
+
declare const TOKEN_TYPES_BY_NAME: Readonly<Record<string, TokenType>>;
|
|
1472
|
+
/** The surface token-type names whose value is a COLOUR - so an editor knows that this is
|
|
1473
|
+
* where `hex(…)` and `oklch(…)` belong, without a second list of type names to keep in
|
|
1474
|
+
* step with this file's (a `ring` and a `backdrop` are colours too, and both were missed
|
|
1475
|
+
* by every hand-written copy of "the colour types"). */
|
|
1476
|
+
declare const COLOR_TOKEN_TYPE_NAMES: readonly string[];
|
|
796
1477
|
declare function parseMildaDocument(src: string, opts?: ParseOptions): ParseResult;
|
|
797
|
-
|
|
798
|
-
type TokenType = 'word' | 'string' | 'lbrace' | 'rbrace' | 'lparen' | 'rparen' | 'lbracket' | 'rbracket' | 'lt' | 'gt' | 'lte' | 'gte' | 'ne' | 'colon' | 'equals' | 'comma' | 'semi' | 'question' | 'arrow' | 'at' | 'newline' | 'eof';
|
|
1478
|
+
type TokenType$1 = 'word' | 'string' | 'lbrace' | 'rbrace' | 'lparen' | 'rparen' | 'lbracket' | 'rbracket' | 'lt' | 'gt' | 'lte' | 'gte' | 'ne' | 'colon' | 'equals' | 'comma' | 'semi' | 'question' | 'arrow' | 'at' | 'newline' | 'eof';
|
|
799
1479
|
interface Token {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
1480
|
+
type: TokenType$1;
|
|
1481
|
+
value: string;
|
|
1482
|
+
pos: number;
|
|
1483
|
+
line: number;
|
|
1484
|
+
col: number;
|
|
805
1485
|
}
|
|
806
1486
|
declare class LexError extends Error {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1487
|
+
line: number;
|
|
1488
|
+
col: number;
|
|
1489
|
+
constructor(message: string, line: number, col: number);
|
|
1490
|
+
}
|
|
1491
|
+
/** A character the lexer had to skip: not a token, not whitespace, not a comment. Collected
|
|
1492
|
+
* rather than thrown, so a half-typed document still lexes - but REPORTED, because silently
|
|
1493
|
+
* dropping a character means a typo changes the value and the author never learns. `hex(őfff)`
|
|
1494
|
+
* used to lex as `hex(fff)`: white, no issue, no clue (proposal 0041). */
|
|
1495
|
+
interface SkippedChar {
|
|
1496
|
+
char: string;
|
|
1497
|
+
line: number;
|
|
1498
|
+
col: number;
|
|
1499
|
+
}
|
|
1500
|
+
declare function lex(src: string, skipped?: SkippedChar[]): Token[];
|
|
1501
|
+
export { ASSET_BASE_KEYS, ASSET_FIELDS, ASSET_FIELD_KEYS, ASSET_KINDS, AXIS_CLAMPS, AXIS_INTENTS, type AliasTokenValue, type Align, type Anatomy, type AnatomyEntry, type AnatomyPart, type AnimationAsset, type AnimationFormat, type AnyTokenValue, type ArchetypeDef, type ArchetypeGroup, type ArchetypeRealize, type ArchetypeRef, type Asset, type AssetByKind, type AssetDecl, type AssetFolder, type AssetFolderDecl, type AssetKind, type AssetRegistry, type AssetsDecl, type Assignment, type Atom, type AtomContextVar, type AtomEvent, type AtomParam, type AtomStateNode, type AxisIntent, type AxisIntentKind, type AxisSize, type AxisSizeValue, BEHAVIOR_FIELDS, BEHAVIOR_KINDS, type BlurValue, type BorderFacetStyle, type BorderFacetValue, type BorderStyle, type BorderValue, type BorderWidth, type BrowseRealize, CELL_MODIFIERS, COLOR_KEYWORDS, COLOR_LITERAL_ALIASES, COLOR_LITERAL_FNS, COLOR_LITERAL_SPELLINGS, COLOR_TOKEN_TYPE_NAMES, CONTROL_REALIZATIONS, type Capability, type CapabilityDef, type ColorOrRef, type ColorSpace, type ColorValue, type CommitRealize, type CompareOp, type Component, type ComponentGroupDecl, type CompositeBehavior, type Composition, type ComputeOp, type ComputeSpace, type ComputeTokenValue, type ConfigFieldSpec, type ConfigSurface, type ConformanceOptions, type ConformanceReport, type ContentCategory, type Context, type ContextGroup, type Contract, type CoordEntry, DEMO_ACTION_OPS, DOCS_FOOTER_KEYWORDS, DOCS_KEYWORDS, DOCS_SITE_KEYS, DOC_BLOCK_KEYWORDS, DOC_PROSE_KINDS, DOC_TRANSCLUSIONS, type DemoVariable, type DesignSystemDocument, type DimensionOrRef, type DimensionUnit, type DimensionValue, type Distribute, type DocBlockDecl, type DocPageDecl, type DocsDecl, type DocsFooterDecl, type DocsFooterLinkDecl, type DocsSiteDecl, type DocumentKind, type DocumentMeta, type DocumentMeta as ProjectMeta, type Token as DslToken, type DurationValue, EXAMPLE_KEYWORDS, type Emit, type EscapeTokenValue, type EventDef, type Example, type Expose, FACET_NAMES, type FacetDef, type FacetMap, type FacetName, type FacetTokenType, type FacetValue, type FieldType, type FontAsset, type FontCategory, type FontFamilyValue, type FontProvenance, type FontWeightValue, type Foundations, GROUP_REALIZATIONS, type GlobalProp, type Hole, INSET_EDGES, INTERACTION_KINDS, type IconDecl, type IconSetDecl, type IconsDecl, type Id, type ImageAsset, type InsetEdge, type InsetValue, LAYOUT_ALIGNS, LAYOUT_DIRECTIONS, LAYOUT_DISTRIBUTES, LAYOUT_KEYS, LAYOUT_RECORD_KEYS, LAYOUT_VALUES, LAYOUT_WRAPS, LENGTH_LITERAL_FNS, LENGTH_TOKEN_TYPE_NAMES, LOGICAL_EDGES, type Layer, type LayoutAlign, type LayoutDirection, type LayoutDistribute, type LayoutRecordKey, type LayoutSpec, type LayoutWrap, type LengthKeyword, type LengthKeywordValue, type LengthValue, LexError, type LiteralChannel, type LiteralFnSpec, type LogicalEdge, MEDIA_TYPES, MILDA_SURFACE_VERSION, type Metadata, type MildaDocumentBase, type MissingPart, NODE_KINDS, NODE_ORIGINS, type NodeSpan, type NoneValue, type ObjectField, type OpacityValue, PART_CONFIGS, PART_CONFIG_NAMES, PART_CONFIG_WORDS, PART_KEYWORDS, PHYSICAL_EDGE_ALIASES, POSITION_KINDS, PRELUDE_VERSION, PRESENTATION_KINDS, type ParamBinding, type ParseIssue, type ParseOptions, type ParseResult, type Part, type PartA11y, type PartAction, type PartBehavior, type PartCell, type PartConfigs, type PartContent, type PartContentRule, type PartEmit, type PartForeign, type PartInstance, type PartMediaSample, type PartMediaSource, type PartMotionTransition, type PartRepeat, type PartRepeatSource, type PartRole, type PartSlot, type PartSlotAccepts, type PartSlotArity, type PartSlotSample, type PartState, type PartStateBinding, type PartValue, type PartVariant, type Position, type PositionKind, type Predicate, type PredicateRef, type PreludeDocument, type PresentationRealize, type PrimitiveTokenType, type Project, type ProjectMetadataEntry, type PropConstraint, type PropDef, type PropValue, type RawTokenValue, type Realization, type RealizeCond, type RequiresClause, type ResolvedToken, type RuleSubject, SLOT_ARITIES, SLOT_MODIFIERS, SLOT_ROLES, type ShadowLayer, type ShadowValue, type SharedType, type SkippedChar, type SourcePosition, type SourceRange, type SpanKind, type StackAxis, type StateDef, type StateName, type Substitution, type SvgAsset, TOKEN_TYPES_BY_NAME, TOKEN_TYPE_NAMES, TOKEN_VALUE_KIND, TOKEN_VALUE_KINDS, type TaxonomyNote, type Token$1 as Token, type TokenRef, type TokenType, type TokenValue, type TokenValueSchemaByType, type TonalValue, type Transition, type TransitionTarget, type TypeExpr, type TypeRef, type TypographyValue, type UsageRule, type UsesClause, VALUE_LITERAL_FNS, type ValidationIssue, type VideoAsset, type Wire, allTokensOfType, anatomyIndex, archetypesByName, atomsByName, camelField, compositesByName, conformance, findDeclaredPart, findToken, kebab as kebabField, lex, loweredAnatomy, missingRequiredParts, parseMildaDocument, preludeV0, resolveToken, tokenTypeFamily, validate };
|