xmlui 0.7.30 → 0.7.31
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/dist/{apiInterceptorWorker-DqMta6YM.mjs → apiInterceptorWorker-CaRsvFsP.mjs} +1 -1
- package/dist/{index-_MjjtXKH.mjs → index-C2wZyJh9.mjs} +16410 -22319
- package/dist/lint-Fx8P7hBr.mjs +5645 -0
- package/dist/scripts/bin/build-lib.js +8 -5
- package/dist/scripts/src/components/DatePicker/DatePicker.js +31 -2
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +2 -33
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +0 -1
- package/dist/scripts/src/components-core/descriptorHelper.js +16 -3
- package/dist/scripts/src/components-core/theming/layout-resolver.js +40 -9
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +15 -603
- package/dist/xmlui-metadata.mjs +2958 -2940
- package/dist/xmlui-metadata.umd.js +11 -11
- package/dist/xmlui-parser.d.ts +1488 -0
- package/dist/xmlui-parser.mjs +407 -0
- package/dist/xmlui-standalone.umd.js +139 -139
- package/dist/xmlui.mjs +1 -1
- package/package.json +12 -3
- package/dist/scripts/src/parsers/style-parser/style-compiler.js +0 -562
|
@@ -21,30 +21,6 @@ class StyleParser {
|
|
|
21
21
|
this._parseErrors = [];
|
|
22
22
|
this._lexer = new StyleLexer_1.StyleLexer(new StyleInputStream_1.StyleInputStream(source));
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* The errors raised during the parse phase
|
|
26
|
-
*/
|
|
27
|
-
get errors() {
|
|
28
|
-
return this._parseErrors;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Gets the current token
|
|
32
|
-
*/
|
|
33
|
-
get current() {
|
|
34
|
-
return this._lexer.peek();
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Checks if we're at the end of the expression
|
|
38
|
-
*/
|
|
39
|
-
get isEof() {
|
|
40
|
-
return this._lexer.peek().type === tokens_1.StyleTokenType.Eof;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Gets the characters remaining after parsing
|
|
44
|
-
*/
|
|
45
|
-
getTail() {
|
|
46
|
-
return this._lexer.getTail();
|
|
47
|
-
}
|
|
48
24
|
/**
|
|
49
25
|
* Tests if the parse is complete
|
|
50
26
|
*/
|
|
@@ -66,343 +42,6 @@ class StyleParser {
|
|
|
66
42
|
parseSize() {
|
|
67
43
|
return this.parseSizeLike("px");
|
|
68
44
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Parses a line height value
|
|
71
|
-
*/
|
|
72
|
-
parseLineHeight() {
|
|
73
|
-
return this.parseSizeLike("");
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Parses size and allows "fit-content"
|
|
77
|
-
*/
|
|
78
|
-
parseMargin() {
|
|
79
|
-
const startToken = this._lexer.peek();
|
|
80
|
-
if (startToken.type === tokens_1.StyleTokenType.Auto) {
|
|
81
|
-
this._lexer.get();
|
|
82
|
-
return this.createNode("Size", {
|
|
83
|
-
value: -1,
|
|
84
|
-
unit: "",
|
|
85
|
-
extSize: startToken.text,
|
|
86
|
-
}, startToken);
|
|
87
|
-
}
|
|
88
|
-
return this.parseSize();
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Parses an opacity value
|
|
92
|
-
*/
|
|
93
|
-
parseOpacity() {
|
|
94
|
-
const startToken = this._lexer.peek();
|
|
95
|
-
const themeIdNode = this.tryThemeId();
|
|
96
|
-
if (themeIdNode)
|
|
97
|
-
return themeIdNode;
|
|
98
|
-
const value = this.getNumber();
|
|
99
|
-
if (value === null)
|
|
100
|
-
return null;
|
|
101
|
-
// --- Get the unit
|
|
102
|
-
let unit = "";
|
|
103
|
-
const unitToken = this._lexer.peek(true);
|
|
104
|
-
if (unitToken.text === "%") {
|
|
105
|
-
unit = this._lexer.get(true).text;
|
|
106
|
-
}
|
|
107
|
-
else if (unitToken.type === tokens_1.StyleTokenType.Ws) {
|
|
108
|
-
this._lexer.get(true);
|
|
109
|
-
}
|
|
110
|
-
else if (unitToken.type !== tokens_1.StyleTokenType.Eof) {
|
|
111
|
-
this.reportError("S016", unitToken);
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
// --- Done.
|
|
115
|
-
return this.createNode("Size", {
|
|
116
|
-
value,
|
|
117
|
-
unit,
|
|
118
|
-
}, startToken);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Parses a Zoom value
|
|
122
|
-
*/
|
|
123
|
-
parseZoom() {
|
|
124
|
-
const startToken = this._lexer.peek();
|
|
125
|
-
const themeIdNode = this.tryThemeId();
|
|
126
|
-
if (themeIdNode)
|
|
127
|
-
return themeIdNode;
|
|
128
|
-
if (startToken.text === "reset" || startToken.text === "normal") {
|
|
129
|
-
this._lexer.get();
|
|
130
|
-
return this.createNode("Zoom", {
|
|
131
|
-
value: startToken.text,
|
|
132
|
-
}, startToken);
|
|
133
|
-
}
|
|
134
|
-
const value = this.getNumber();
|
|
135
|
-
if (value === null)
|
|
136
|
-
return null;
|
|
137
|
-
// --- Get the unit
|
|
138
|
-
let unit = "";
|
|
139
|
-
const unitToken = this._lexer.peek(true);
|
|
140
|
-
if (unitToken.text === "%") {
|
|
141
|
-
unit = this._lexer.get(true).text;
|
|
142
|
-
}
|
|
143
|
-
else if (unitToken.type === tokens_1.StyleTokenType.Ws) {
|
|
144
|
-
this._lexer.get(true);
|
|
145
|
-
}
|
|
146
|
-
else if (unitToken.type !== tokens_1.StyleTokenType.Eof) {
|
|
147
|
-
this.reportError("S016", unitToken);
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
// --- Done.
|
|
151
|
-
return this.createNode("Zoom", {
|
|
152
|
-
value,
|
|
153
|
-
unit,
|
|
154
|
-
}, startToken);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Parses a boolean value
|
|
158
|
-
*/
|
|
159
|
-
parseBoolean() {
|
|
160
|
-
const startToken = this._lexer.peek();
|
|
161
|
-
const themeIdNode = this.tryThemeId();
|
|
162
|
-
if (themeIdNode)
|
|
163
|
-
return themeIdNode;
|
|
164
|
-
if (startToken.type !== tokens_1.StyleTokenType.Boolean) {
|
|
165
|
-
this.reportError("S017", startToken);
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
// --- Done.
|
|
169
|
-
this._lexer.get();
|
|
170
|
-
return this.createNode("Boolean", {
|
|
171
|
-
value: startToken.text === "true" || startToken.text === "yes" || startToken.text === "on",
|
|
172
|
-
}, startToken);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Parses an alignment value
|
|
176
|
-
*/
|
|
177
|
-
parseAlignment() {
|
|
178
|
-
const startToken = this._lexer.peek();
|
|
179
|
-
if (startToken.type !== tokens_1.StyleTokenType.Alignment) {
|
|
180
|
-
this.reportError("S003", startToken);
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
// --- Done.
|
|
184
|
-
this._lexer.get();
|
|
185
|
-
return this.createNode("Alignment", {
|
|
186
|
-
value: startToken.text,
|
|
187
|
-
}, startToken);
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Parses a text alignment value
|
|
191
|
-
*/
|
|
192
|
-
parseTextAlign() {
|
|
193
|
-
const startToken = this._lexer.peek();
|
|
194
|
-
if (startToken.type !== tokens_1.StyleTokenType.Alignment && startToken.type !== tokens_1.StyleTokenType.TextAlignment) {
|
|
195
|
-
this.reportError("S003", startToken);
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
// --- Done.
|
|
199
|
-
this._lexer.get();
|
|
200
|
-
return this.createNode("TextAlign", {
|
|
201
|
-
value: startToken.text,
|
|
202
|
-
}, startToken);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Parses a user select value
|
|
206
|
-
*/
|
|
207
|
-
parseUserSelect() {
|
|
208
|
-
const startToken = this._lexer.peek();
|
|
209
|
-
if (startToken.type !== tokens_1.StyleTokenType.None &&
|
|
210
|
-
startToken.type !== tokens_1.StyleTokenType.Auto &&
|
|
211
|
-
startToken.type !== tokens_1.StyleTokenType.UserSelect) {
|
|
212
|
-
this.reportError("S020", startToken);
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
// --- Done.
|
|
216
|
-
this._lexer.get();
|
|
217
|
-
return this.createNode("UserSelect", {
|
|
218
|
-
value: startToken.text,
|
|
219
|
-
}, startToken);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Parses a text transform value
|
|
223
|
-
*/
|
|
224
|
-
parseTextTransform() {
|
|
225
|
-
const startToken = this._lexer.peek();
|
|
226
|
-
if (startToken.type !== tokens_1.StyleTokenType.None && startToken.type !== tokens_1.StyleTokenType.TextTransform) {
|
|
227
|
-
this.reportError("S021", startToken);
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
// --- Done.
|
|
231
|
-
this._lexer.get();
|
|
232
|
-
return this.createNode("TextTransform", {
|
|
233
|
-
value: startToken.text,
|
|
234
|
-
}, startToken);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Parses an orientation value
|
|
238
|
-
*/
|
|
239
|
-
parseOrientation() {
|
|
240
|
-
const startToken = this._lexer.peek();
|
|
241
|
-
if (startToken.type !== tokens_1.StyleTokenType.Orientation) {
|
|
242
|
-
this.reportError("S018", startToken);
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
// --- Done.
|
|
246
|
-
this._lexer.get();
|
|
247
|
-
return this.createNode("Orientation", {
|
|
248
|
-
value: startToken.text,
|
|
249
|
-
}, startToken);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Parses a cursor value
|
|
253
|
-
*/
|
|
254
|
-
parseCursor() {
|
|
255
|
-
const startToken = this._lexer.peek();
|
|
256
|
-
switch (startToken.type) {
|
|
257
|
-
case tokens_1.StyleTokenType.Auto:
|
|
258
|
-
case tokens_1.StyleTokenType.None:
|
|
259
|
-
case tokens_1.StyleTokenType.Default:
|
|
260
|
-
case tokens_1.StyleTokenType.Cursor:
|
|
261
|
-
this._lexer.get();
|
|
262
|
-
return this.createNode("Cursor", {
|
|
263
|
-
value: startToken.text,
|
|
264
|
-
}, startToken);
|
|
265
|
-
case tokens_1.StyleTokenType.UserSelect:
|
|
266
|
-
if (startToken.text === "text") {
|
|
267
|
-
this._lexer.get();
|
|
268
|
-
return this.createNode("Cursor", {
|
|
269
|
-
value: "text",
|
|
270
|
-
}, startToken);
|
|
271
|
-
}
|
|
272
|
-
this.reportError("S018", startToken);
|
|
273
|
-
return null;
|
|
274
|
-
default:
|
|
275
|
-
this.reportError("S018", startToken);
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Parses a direction value
|
|
281
|
-
*/
|
|
282
|
-
parseDirection() {
|
|
283
|
-
const startToken = this._lexer.peek();
|
|
284
|
-
const themeIdNode = this.tryThemeId();
|
|
285
|
-
if (themeIdNode)
|
|
286
|
-
return themeIdNode;
|
|
287
|
-
if (startToken.type !== tokens_1.StyleTokenType.Direction) {
|
|
288
|
-
this.reportError("S013", startToken);
|
|
289
|
-
return null;
|
|
290
|
-
}
|
|
291
|
-
// --- Done.
|
|
292
|
-
this._lexer.get();
|
|
293
|
-
return this.createNode("Direction", {
|
|
294
|
-
value: startToken.text,
|
|
295
|
-
}, startToken);
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Parses a fontFamily value
|
|
299
|
-
*/
|
|
300
|
-
parseFontFamily() {
|
|
301
|
-
const startToken = this._lexer.peek();
|
|
302
|
-
const themeIdNode = this.tryThemeId();
|
|
303
|
-
if (themeIdNode)
|
|
304
|
-
return themeIdNode;
|
|
305
|
-
let value = "";
|
|
306
|
-
let nextToken = startToken;
|
|
307
|
-
while (true) {
|
|
308
|
-
// --- Get font name token
|
|
309
|
-
if (nextToken.type === tokens_1.StyleTokenType.Eof)
|
|
310
|
-
break;
|
|
311
|
-
if (nextToken.type === tokens_1.StyleTokenType.FontFamily ||
|
|
312
|
-
nextToken.type === tokens_1.StyleTokenType.Identifier ||
|
|
313
|
-
nextToken.type === tokens_1.StyleTokenType.String) {
|
|
314
|
-
value += (value ? ", " : "") + nextToken.text;
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
this.reportError("S014", nextToken);
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
// --- Skip the parsed token
|
|
321
|
-
this._lexer.get();
|
|
322
|
-
// --- Check for separator comma
|
|
323
|
-
nextToken = this._lexer.peek();
|
|
324
|
-
if (nextToken.type === tokens_1.StyleTokenType.Comma) {
|
|
325
|
-
this._lexer.get();
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
nextToken = this._lexer.peek();
|
|
331
|
-
}
|
|
332
|
-
// --- Done.
|
|
333
|
-
return this.createNode("FontFamily", {
|
|
334
|
-
value,
|
|
335
|
-
}, startToken);
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Parses a weight value
|
|
339
|
-
*/
|
|
340
|
-
parseFontWeight() {
|
|
341
|
-
const startToken = this._lexer.peek();
|
|
342
|
-
const themeIdNode = this.tryThemeId();
|
|
343
|
-
if (themeIdNode)
|
|
344
|
-
return themeIdNode;
|
|
345
|
-
if (startToken.type !== tokens_1.StyleTokenType.FontWeight && startToken.type !== tokens_1.StyleTokenType.Number) {
|
|
346
|
-
this.reportError("S015", startToken);
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
// --- Done.
|
|
350
|
-
this._lexer.get();
|
|
351
|
-
return this.createNode("FontWeight", {
|
|
352
|
-
value: startToken.text,
|
|
353
|
-
}, startToken);
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Parses a zIndex value
|
|
357
|
-
*/
|
|
358
|
-
parseZIndex() {
|
|
359
|
-
const startToken = this._lexer.peek();
|
|
360
|
-
const themeIdNode = this.tryThemeId();
|
|
361
|
-
if (themeIdNode)
|
|
362
|
-
return themeIdNode;
|
|
363
|
-
if (startToken.type !== tokens_1.StyleTokenType.Number) {
|
|
364
|
-
this.reportError("S001", startToken);
|
|
365
|
-
return null;
|
|
366
|
-
}
|
|
367
|
-
// --- Done.
|
|
368
|
-
this._lexer.get();
|
|
369
|
-
return this.createNode("ZIndex", {
|
|
370
|
-
value: startToken.text,
|
|
371
|
-
}, startToken);
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Parses a scrolling value
|
|
375
|
-
*/
|
|
376
|
-
parseScrolling() {
|
|
377
|
-
const startToken = this._lexer.peek();
|
|
378
|
-
const themeIdNode = this.tryThemeId();
|
|
379
|
-
if (themeIdNode)
|
|
380
|
-
return themeIdNode;
|
|
381
|
-
if (startToken.type !== tokens_1.StyleTokenType.Scrolling) {
|
|
382
|
-
this.reportError("S012", startToken);
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
385
|
-
// --- Done.
|
|
386
|
-
this._lexer.get();
|
|
387
|
-
return this.createNode("Scrolling", {
|
|
388
|
-
value: startToken.text,
|
|
389
|
-
}, startToken);
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Parses a border style value with its unit
|
|
393
|
-
*/
|
|
394
|
-
parseBorderStyle() {
|
|
395
|
-
const startToken = this._lexer.peek();
|
|
396
|
-
if (startToken.type !== tokens_1.StyleTokenType.BorderStyle && startToken.type !== tokens_1.StyleTokenType.None) {
|
|
397
|
-
this.reportError("S004", startToken);
|
|
398
|
-
return null;
|
|
399
|
-
}
|
|
400
|
-
// --- Done.
|
|
401
|
-
this._lexer.get();
|
|
402
|
-
return this.createNode("BorderStyle", {
|
|
403
|
-
value: startToken.text,
|
|
404
|
-
}, startToken);
|
|
405
|
-
}
|
|
406
45
|
/**
|
|
407
46
|
* Parses a border (size, style, color in arbitrary order)
|
|
408
47
|
*/
|
|
@@ -483,6 +122,21 @@ class StyleParser {
|
|
|
483
122
|
styleValue: styleFound === null || styleFound === void 0 ? void 0 : styleFound.value,
|
|
484
123
|
}, startToken);
|
|
485
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Parses a border style value with its unit
|
|
127
|
+
*/
|
|
128
|
+
parseBorderStyle() {
|
|
129
|
+
const startToken = this._lexer.peek();
|
|
130
|
+
if (startToken.type !== tokens_1.StyleTokenType.BorderStyle && startToken.type !== tokens_1.StyleTokenType.None) {
|
|
131
|
+
this.reportError("S004", startToken);
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
// --- Done.
|
|
135
|
+
this._lexer.get();
|
|
136
|
+
return this.createNode("BorderStyle", {
|
|
137
|
+
value: startToken.text,
|
|
138
|
+
}, startToken);
|
|
139
|
+
}
|
|
486
140
|
/**
|
|
487
141
|
* Parses a color value
|
|
488
142
|
*/
|
|
@@ -626,248 +280,6 @@ class StyleParser {
|
|
|
626
280
|
return true;
|
|
627
281
|
}
|
|
628
282
|
}
|
|
629
|
-
/**
|
|
630
|
-
* Parses a text decoration value
|
|
631
|
-
*/
|
|
632
|
-
parseTextDecoration() {
|
|
633
|
-
const startToken = this._lexer.peek();
|
|
634
|
-
if (startToken.type === tokens_1.StyleTokenType.None) {
|
|
635
|
-
this._lexer.get();
|
|
636
|
-
return this.createNode("TextDecoration", {
|
|
637
|
-
none: true,
|
|
638
|
-
}, startToken);
|
|
639
|
-
}
|
|
640
|
-
const themeIdNode = this.tryThemeId();
|
|
641
|
-
let themeId1;
|
|
642
|
-
let maxStyleTokens = 3;
|
|
643
|
-
if (themeIdNode) {
|
|
644
|
-
if (this.testCompleted()) {
|
|
645
|
-
return themeIdNode;
|
|
646
|
-
}
|
|
647
|
-
maxStyleTokens = 2;
|
|
648
|
-
themeId1 = themeIdNode.themeId;
|
|
649
|
-
}
|
|
650
|
-
const acceptedStyles = ["solid", "double", "dotted", "dashed", "wavy"];
|
|
651
|
-
let lineFound;
|
|
652
|
-
let styleFound;
|
|
653
|
-
let colorFound = null;
|
|
654
|
-
let themeId2;
|
|
655
|
-
let themeId3;
|
|
656
|
-
for (let i = 0; i < maxStyleTokens; i++) {
|
|
657
|
-
const nextToken = this._lexer.peek();
|
|
658
|
-
if (isThemeId(nextToken)) {
|
|
659
|
-
if (!themeId2) {
|
|
660
|
-
themeId2 = this.parseThemeId();
|
|
661
|
-
}
|
|
662
|
-
else {
|
|
663
|
-
themeId3 = this.parseThemeId();
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
else {
|
|
667
|
-
if (acceptedStyles.indexOf(nextToken.text) >= 0) {
|
|
668
|
-
styleFound = nextToken.text;
|
|
669
|
-
this._lexer.get();
|
|
670
|
-
}
|
|
671
|
-
else {
|
|
672
|
-
switch (nextToken.type) {
|
|
673
|
-
case tokens_1.StyleTokenType.DecorationLine:
|
|
674
|
-
if (lineFound) {
|
|
675
|
-
this.reportError("S016", nextToken);
|
|
676
|
-
return null;
|
|
677
|
-
}
|
|
678
|
-
this._lexer.get();
|
|
679
|
-
lineFound = nextToken.text;
|
|
680
|
-
break;
|
|
681
|
-
case tokens_1.StyleTokenType.ColorName:
|
|
682
|
-
case tokens_1.StyleTokenType.ColorFunc:
|
|
683
|
-
case tokens_1.StyleTokenType.HexaColor:
|
|
684
|
-
if (colorFound) {
|
|
685
|
-
this.reportError("S016", nextToken);
|
|
686
|
-
return null;
|
|
687
|
-
}
|
|
688
|
-
colorFound = this.parseColor();
|
|
689
|
-
break;
|
|
690
|
-
default:
|
|
691
|
-
this.reportError("S016", nextToken);
|
|
692
|
-
return null;
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
const spToken = this._lexer.peek(true);
|
|
697
|
-
if (spToken.type === tokens_1.StyleTokenType.Eof)
|
|
698
|
-
break;
|
|
699
|
-
if (spToken.type === tokens_1.StyleTokenType.Ws) {
|
|
700
|
-
this._lexer.get(true);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return this.createNode("TextDecoration", {
|
|
704
|
-
themeId1,
|
|
705
|
-
themeId2,
|
|
706
|
-
themeId3,
|
|
707
|
-
color: colorFound === null || colorFound === void 0 ? void 0 : colorFound.value,
|
|
708
|
-
style: styleFound,
|
|
709
|
-
line: lineFound,
|
|
710
|
-
}, startToken);
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Parses a radius value
|
|
714
|
-
*/
|
|
715
|
-
parseRadius() {
|
|
716
|
-
var _a, _b, _c, _d;
|
|
717
|
-
const values = [];
|
|
718
|
-
const themeIds = [];
|
|
719
|
-
const startToken = this._lexer.peek();
|
|
720
|
-
let count = 0;
|
|
721
|
-
while (count < 2) {
|
|
722
|
-
// --- Resolve to theme id or size
|
|
723
|
-
const themeIdNode = this.tryThemeId();
|
|
724
|
-
if (themeIdNode) {
|
|
725
|
-
themeIds[count] = themeIdNode.themeId;
|
|
726
|
-
if (this._lexer.peek().type === tokens_1.StyleTokenType.Eof) {
|
|
727
|
-
// --- No more token
|
|
728
|
-
count = 5;
|
|
729
|
-
}
|
|
730
|
-
else {
|
|
731
|
-
// --- Skip trailing spaces
|
|
732
|
-
while (this._lexer.peek(true).type === tokens_1.StyleTokenType.Ws) {
|
|
733
|
-
this._lexer.get(true);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
else {
|
|
738
|
-
let size = this.parseSize();
|
|
739
|
-
if (!size) {
|
|
740
|
-
return null;
|
|
741
|
-
}
|
|
742
|
-
values[count] = size;
|
|
743
|
-
// --- Search for the end/whitespace
|
|
744
|
-
let wsCount = 0;
|
|
745
|
-
while (true) {
|
|
746
|
-
let nextToken = this._lexer.peek(true);
|
|
747
|
-
if (nextToken.type === tokens_1.StyleTokenType.Eof) {
|
|
748
|
-
// --- No more token
|
|
749
|
-
count = 5;
|
|
750
|
-
wsCount = 1;
|
|
751
|
-
break;
|
|
752
|
-
}
|
|
753
|
-
if (nextToken.type === tokens_1.StyleTokenType.Ws) {
|
|
754
|
-
// Skip the whitespace
|
|
755
|
-
this._lexer.get(true);
|
|
756
|
-
wsCount++;
|
|
757
|
-
}
|
|
758
|
-
else {
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
// --- We need a separator
|
|
763
|
-
if (!wsCount) {
|
|
764
|
-
this.reportError("S016");
|
|
765
|
-
return null;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
// --- Next item
|
|
769
|
-
count++;
|
|
770
|
-
}
|
|
771
|
-
return this.createNode("Radius", {
|
|
772
|
-
themeId1: themeIds[0],
|
|
773
|
-
themeId2: themeIds[1],
|
|
774
|
-
value1: (_a = values[0]) === null || _a === void 0 ? void 0 : _a.value,
|
|
775
|
-
unit1: (_b = values[0]) === null || _b === void 0 ? void 0 : _b.unit,
|
|
776
|
-
value2: (_c = values[1]) === null || _c === void 0 ? void 0 : _c.value,
|
|
777
|
-
unit2: (_d = values[1]) === null || _d === void 0 ? void 0 : _d.unit,
|
|
778
|
-
}, startToken);
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Parses a shadow value
|
|
782
|
-
*/
|
|
783
|
-
parseShadow() {
|
|
784
|
-
const startToken = this._lexer.peek();
|
|
785
|
-
const themeIdNode = this.tryThemeId();
|
|
786
|
-
if (themeIdNode)
|
|
787
|
-
return themeIdNode;
|
|
788
|
-
const segments = [];
|
|
789
|
-
let nextToken = null;
|
|
790
|
-
// --- Parse a single segment
|
|
791
|
-
while (true) {
|
|
792
|
-
let inset = null;
|
|
793
|
-
let sizeX = null;
|
|
794
|
-
let sizeY = null;
|
|
795
|
-
let blurRadius = null;
|
|
796
|
-
let spreadRadius = null;
|
|
797
|
-
let color = null;
|
|
798
|
-
nextToken = this._lexer.peek();
|
|
799
|
-
if (nextToken.text === "inset") {
|
|
800
|
-
inset = true;
|
|
801
|
-
this._lexer.get();
|
|
802
|
-
nextToken = this._lexer.peek();
|
|
803
|
-
}
|
|
804
|
-
// --- Offset values
|
|
805
|
-
sizeX = this.parseSize();
|
|
806
|
-
if (!sizeX) {
|
|
807
|
-
return null;
|
|
808
|
-
}
|
|
809
|
-
nextToken = this._lexer.peek(true);
|
|
810
|
-
if (nextToken.type !== tokens_1.StyleTokenType.Ws) {
|
|
811
|
-
this.reportError("S016", nextToken);
|
|
812
|
-
}
|
|
813
|
-
this._lexer.get();
|
|
814
|
-
sizeY = this.parseSize();
|
|
815
|
-
if (!sizeY) {
|
|
816
|
-
return null;
|
|
817
|
-
}
|
|
818
|
-
nextToken = this._lexer.peek(true);
|
|
819
|
-
if (nextToken.type === tokens_1.StyleTokenType.Ws) {
|
|
820
|
-
this._lexer.get();
|
|
821
|
-
nextToken = this._lexer.peek();
|
|
822
|
-
if (nextToken.type === tokens_1.StyleTokenType.Number) {
|
|
823
|
-
// --- Blur radius
|
|
824
|
-
blurRadius = this.parseSize();
|
|
825
|
-
nextToken = this._lexer.peek(true);
|
|
826
|
-
}
|
|
827
|
-
if (nextToken.type === tokens_1.StyleTokenType.Ws) {
|
|
828
|
-
this._lexer.get();
|
|
829
|
-
nextToken = this._lexer.peek();
|
|
830
|
-
if (nextToken.type === tokens_1.StyleTokenType.Number) {
|
|
831
|
-
// --- Spread radius
|
|
832
|
-
spreadRadius = this.parseSize();
|
|
833
|
-
nextToken = this._lexer.peek(true);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
// --- Check for color
|
|
838
|
-
if (nextToken.type === tokens_1.StyleTokenType.Ws) {
|
|
839
|
-
nextToken = this._lexer.get();
|
|
840
|
-
}
|
|
841
|
-
if (nextToken.type !== tokens_1.StyleTokenType.Eof && nextToken.type !== tokens_1.StyleTokenType.Comma) {
|
|
842
|
-
color = this.parseColor();
|
|
843
|
-
}
|
|
844
|
-
// --- Create segment
|
|
845
|
-
segments.push({
|
|
846
|
-
inset: inset !== null && inset !== void 0 ? inset : undefined,
|
|
847
|
-
offsetXValue: sizeX.value,
|
|
848
|
-
offsetXUnit: sizeX.unit,
|
|
849
|
-
offsetYValue: sizeY.value,
|
|
850
|
-
offsetYUnit: sizeY.unit,
|
|
851
|
-
blurRadiusValue: blurRadius === null || blurRadius === void 0 ? void 0 : blurRadius.value,
|
|
852
|
-
blurRadiusUnit: blurRadius === null || blurRadius === void 0 ? void 0 : blurRadius.unit,
|
|
853
|
-
spreadRadiusValue: spreadRadius === null || spreadRadius === void 0 ? void 0 : spreadRadius.value,
|
|
854
|
-
spreadRadiusUnit: spreadRadius === null || spreadRadius === void 0 ? void 0 : spreadRadius.unit,
|
|
855
|
-
color: color === null || color === void 0 ? void 0 : color.value,
|
|
856
|
-
});
|
|
857
|
-
// --- Check for next segment
|
|
858
|
-
const sp = this._lexer.peek(true);
|
|
859
|
-
if (sp.type === tokens_1.StyleTokenType.Comma) {
|
|
860
|
-
// --- There is a next shadow segment
|
|
861
|
-
this._lexer.get();
|
|
862
|
-
}
|
|
863
|
-
else {
|
|
864
|
-
break;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
return this.createNode("Shadow", {
|
|
868
|
-
segments,
|
|
869
|
-
}, startToken);
|
|
870
|
-
}
|
|
871
283
|
getNumber() {
|
|
872
284
|
const token = this._lexer.get();
|
|
873
285
|
if (token.type === tokens_1.StyleTokenType.Number) {
|