vsn 1.0.2 → 1.0.3
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/index.cjs +1827 -769
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +190 -52
- package/dist/index.d.ts +190 -52
- package/dist/index.js +1822 -767
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +8 -8
- package/dist/index.min.js.map +1 -1
- package/dist/plugins/microdata.d.ts +481 -0
- package/dist/plugins/microdata.js +178 -0
- package/dist/plugins/microdata.js.map +1 -0
- package/dist/plugins/microdata.min.js +2 -0
- package/dist/plugins/microdata.min.js.map +1 -0
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,9 @@ declare enum TokenType {
|
|
|
19
19
|
While = "While",
|
|
20
20
|
Try = "Try",
|
|
21
21
|
Catch = "Catch",
|
|
22
|
+
Assert = "Assert",
|
|
23
|
+
Break = "Break",
|
|
24
|
+
Continue = "Continue",
|
|
22
25
|
LBrace = "LBrace",
|
|
23
26
|
RBrace = "RBrace",
|
|
24
27
|
LParen = "LParen",
|
|
@@ -34,7 +37,9 @@ declare enum TokenType {
|
|
|
34
37
|
Greater = "Greater",
|
|
35
38
|
Less = "Less",
|
|
36
39
|
Plus = "Plus",
|
|
40
|
+
PlusPlus = "PlusPlus",
|
|
37
41
|
Minus = "Minus",
|
|
42
|
+
MinusMinus = "MinusMinus",
|
|
38
43
|
Tilde = "Tilde",
|
|
39
44
|
Star = "Star",
|
|
40
45
|
Slash = "Slash",
|
|
@@ -112,17 +117,19 @@ interface ExecutionContext {
|
|
|
112
117
|
element?: Element;
|
|
113
118
|
returnValue?: any;
|
|
114
119
|
returning?: boolean;
|
|
120
|
+
breaking?: boolean;
|
|
121
|
+
continuing?: boolean;
|
|
115
122
|
}
|
|
116
123
|
interface CFSNode {
|
|
117
124
|
type: string;
|
|
118
125
|
prepare(context: ExecutionContext): Promise<void>;
|
|
119
|
-
evaluate(context: ExecutionContext):
|
|
126
|
+
evaluate(context: ExecutionContext): any;
|
|
120
127
|
}
|
|
121
128
|
declare abstract class BaseNode implements CFSNode {
|
|
122
129
|
type: string;
|
|
123
130
|
constructor(type: string);
|
|
124
131
|
prepare(_context: ExecutionContext): Promise<void>;
|
|
125
|
-
evaluate(_context: ExecutionContext):
|
|
132
|
+
evaluate(_context: ExecutionContext): any;
|
|
126
133
|
}
|
|
127
134
|
declare class ProgramNode extends BaseNode {
|
|
128
135
|
behaviors: BehaviorNode[];
|
|
@@ -148,7 +155,7 @@ declare class UseNode extends BaseNode {
|
|
|
148
155
|
declare class BlockNode extends BaseNode {
|
|
149
156
|
statements: CFSNode[];
|
|
150
157
|
constructor(statements: CFSNode[]);
|
|
151
|
-
evaluate(context: ExecutionContext):
|
|
158
|
+
evaluate(context: ExecutionContext): any;
|
|
152
159
|
}
|
|
153
160
|
declare class SelectorNode extends BaseNode {
|
|
154
161
|
selectorText: string;
|
|
@@ -157,54 +164,75 @@ declare class SelectorNode extends BaseNode {
|
|
|
157
164
|
declare class BehaviorNode extends BaseNode {
|
|
158
165
|
selector: SelectorNode;
|
|
159
166
|
body: BlockNode;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
name: string;
|
|
164
|
-
value: ExpressionNode;
|
|
165
|
-
important: boolean;
|
|
166
|
-
constructor(name: string, value: ExpressionNode, important: boolean);
|
|
167
|
-
}
|
|
168
|
-
declare class StateBlockNode extends BaseNode {
|
|
169
|
-
entries: StateEntryNode[];
|
|
170
|
-
constructor(entries: StateEntryNode[]);
|
|
167
|
+
flags: BehaviorFlags;
|
|
168
|
+
flagArgs: BehaviorFlagArgs;
|
|
169
|
+
constructor(selector: SelectorNode, body: BlockNode, flags?: BehaviorFlags, flagArgs?: BehaviorFlagArgs);
|
|
171
170
|
}
|
|
172
171
|
declare class OnBlockNode extends BaseNode {
|
|
173
172
|
eventName: string;
|
|
174
173
|
args: string[];
|
|
175
174
|
body: BlockNode;
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
flags: DeclarationFlags;
|
|
176
|
+
flagArgs: DeclarationFlagArgs;
|
|
177
|
+
constructor(eventName: string, args: string[], body: BlockNode, flags?: DeclarationFlags, flagArgs?: DeclarationFlagArgs);
|
|
178
178
|
}
|
|
179
179
|
declare class AssignmentNode extends BaseNode {
|
|
180
180
|
target: AssignmentTarget;
|
|
181
181
|
value: ExpressionNode;
|
|
182
|
-
operator: "=" | "+=" | "-=" | "*=" | "/=";
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
operator: "=" | "+=" | "-=" | "*=" | "/=" | "++" | "--";
|
|
183
|
+
prefix: boolean;
|
|
184
|
+
constructor(target: AssignmentTarget, value: ExpressionNode, operator?: "=" | "+=" | "-=" | "*=" | "/=" | "++" | "--", prefix?: boolean);
|
|
185
|
+
evaluate(context: ExecutionContext): any;
|
|
185
186
|
private applyCompoundAssignment;
|
|
187
|
+
private applyIncrement;
|
|
186
188
|
private resolveAssignmentTarget;
|
|
187
189
|
private resolveIndexPath;
|
|
188
190
|
private resolveTargetPath;
|
|
189
191
|
private assignTarget;
|
|
192
|
+
private assignDirectiveTarget;
|
|
190
193
|
}
|
|
191
194
|
declare class ReturnNode extends BaseNode {
|
|
192
195
|
value?: ExpressionNode | undefined;
|
|
193
196
|
constructor(value?: ExpressionNode | undefined);
|
|
194
|
-
evaluate(context: ExecutionContext):
|
|
197
|
+
evaluate(context: ExecutionContext): any;
|
|
198
|
+
}
|
|
199
|
+
declare class BreakNode extends BaseNode {
|
|
200
|
+
constructor();
|
|
201
|
+
evaluate(context: ExecutionContext): any;
|
|
202
|
+
}
|
|
203
|
+
declare class ContinueNode extends BaseNode {
|
|
204
|
+
constructor();
|
|
205
|
+
evaluate(context: ExecutionContext): any;
|
|
206
|
+
}
|
|
207
|
+
declare class AssertError extends Error {
|
|
208
|
+
constructor(message?: string);
|
|
209
|
+
}
|
|
210
|
+
declare class AssertNode extends BaseNode {
|
|
211
|
+
test: ExpressionNode;
|
|
212
|
+
constructor(test: ExpressionNode);
|
|
213
|
+
evaluate(context: ExecutionContext): any;
|
|
195
214
|
}
|
|
196
215
|
declare class IfNode extends BaseNode {
|
|
197
216
|
test: ExpressionNode;
|
|
198
217
|
consequent: BlockNode;
|
|
199
218
|
alternate?: BlockNode | undefined;
|
|
200
219
|
constructor(test: ExpressionNode, consequent: BlockNode, alternate?: BlockNode | undefined);
|
|
201
|
-
evaluate(context: ExecutionContext):
|
|
220
|
+
evaluate(context: ExecutionContext): any;
|
|
202
221
|
}
|
|
203
222
|
declare class WhileNode extends BaseNode {
|
|
204
223
|
test: ExpressionNode;
|
|
205
224
|
body: BlockNode;
|
|
206
225
|
constructor(test: ExpressionNode, body: BlockNode);
|
|
207
|
-
evaluate(context: ExecutionContext):
|
|
226
|
+
evaluate(context: ExecutionContext): any;
|
|
227
|
+
}
|
|
228
|
+
declare class ForEachNode extends BaseNode {
|
|
229
|
+
target: IdentifierExpression;
|
|
230
|
+
iterable: ExpressionNode;
|
|
231
|
+
kind: "in" | "of";
|
|
232
|
+
body: BlockNode;
|
|
233
|
+
constructor(target: IdentifierExpression, iterable: ExpressionNode, kind: "in" | "of", body: BlockNode);
|
|
234
|
+
evaluate(context: ExecutionContext): any;
|
|
235
|
+
private getEntries;
|
|
208
236
|
}
|
|
209
237
|
declare class ForNode extends BaseNode {
|
|
210
238
|
init: CFSNode | undefined;
|
|
@@ -212,14 +240,14 @@ declare class ForNode extends BaseNode {
|
|
|
212
240
|
update: CFSNode | undefined;
|
|
213
241
|
body: BlockNode;
|
|
214
242
|
constructor(init: CFSNode | undefined, test: ExpressionNode | undefined, update: CFSNode | undefined, body: BlockNode);
|
|
215
|
-
evaluate(context: ExecutionContext):
|
|
243
|
+
evaluate(context: ExecutionContext): any;
|
|
216
244
|
}
|
|
217
245
|
declare class TryNode extends BaseNode {
|
|
218
246
|
body: BlockNode;
|
|
219
247
|
errorName: string;
|
|
220
248
|
handler: BlockNode;
|
|
221
249
|
constructor(body: BlockNode, errorName: string, handler: BlockNode);
|
|
222
|
-
evaluate(context: ExecutionContext):
|
|
250
|
+
evaluate(context: ExecutionContext): any;
|
|
223
251
|
}
|
|
224
252
|
declare class FunctionDeclarationNode extends BaseNode {
|
|
225
253
|
name: string;
|
|
@@ -233,7 +261,7 @@ declare class FunctionExpression extends BaseNode {
|
|
|
233
261
|
body: BlockNode;
|
|
234
262
|
isAsync: boolean;
|
|
235
263
|
constructor(params: FunctionParam[], body: BlockNode, isAsync?: boolean);
|
|
236
|
-
evaluate(context: ExecutionContext):
|
|
264
|
+
evaluate(context: ExecutionContext): any;
|
|
237
265
|
private applyParams;
|
|
238
266
|
private restoreParams;
|
|
239
267
|
}
|
|
@@ -247,6 +275,12 @@ interface DeclarationFlagArgs {
|
|
|
247
275
|
debounce?: number;
|
|
248
276
|
[key: string]: any;
|
|
249
277
|
}
|
|
278
|
+
interface BehaviorFlags {
|
|
279
|
+
[key: string]: boolean | undefined;
|
|
280
|
+
}
|
|
281
|
+
interface BehaviorFlagArgs {
|
|
282
|
+
[key: string]: any;
|
|
283
|
+
}
|
|
250
284
|
declare class DeclarationNode extends BaseNode {
|
|
251
285
|
target: DeclarationTarget;
|
|
252
286
|
operator: ":" | ":=" | ":<" | ":>";
|
|
@@ -255,7 +289,7 @@ declare class DeclarationNode extends BaseNode {
|
|
|
255
289
|
flagArgs: DeclarationFlagArgs;
|
|
256
290
|
constructor(target: DeclarationTarget, operator: ":" | ":=" | ":<" | ":>", value: ExpressionNode, flags: DeclarationFlags, flagArgs: DeclarationFlagArgs);
|
|
257
291
|
}
|
|
258
|
-
type ExpressionNode = IdentifierExpression | LiteralExpression | TemplateExpression | UnaryExpression | BinaryExpression | MemberExpression | CallExpression | ArrayExpression | ObjectExpression | IndexExpression | FunctionExpression | AwaitExpression | TernaryExpression | DirectiveExpression | QueryExpression;
|
|
292
|
+
type ExpressionNode = AssignmentNode | IdentifierExpression | LiteralExpression | TemplateExpression | UnaryExpression | BinaryExpression | MemberExpression | CallExpression | ArrayExpression | ObjectExpression | IndexExpression | FunctionExpression | AwaitExpression | TernaryExpression | DirectiveExpression | QueryExpression;
|
|
259
293
|
type DeclarationTarget = IdentifierExpression | DirectiveExpression;
|
|
260
294
|
type AssignmentTarget = IdentifierExpression | MemberExpression | IndexExpression | DirectiveExpression | ArrayPattern | ObjectPattern;
|
|
261
295
|
type FunctionParam = {
|
|
@@ -267,7 +301,7 @@ type PatternNode = IdentifierExpression | ArrayPattern | ObjectPattern;
|
|
|
267
301
|
declare class IdentifierExpression extends BaseNode {
|
|
268
302
|
name: string;
|
|
269
303
|
constructor(name: string);
|
|
270
|
-
evaluate(context: ExecutionContext):
|
|
304
|
+
evaluate(context: ExecutionContext): any;
|
|
271
305
|
}
|
|
272
306
|
declare class SpreadElement extends BaseNode {
|
|
273
307
|
value: ExpressionNode;
|
|
@@ -295,40 +329,44 @@ declare class ObjectPattern extends BaseNode {
|
|
|
295
329
|
declare class LiteralExpression extends BaseNode {
|
|
296
330
|
value: string | number | boolean | null;
|
|
297
331
|
constructor(value: string | number | boolean | null);
|
|
298
|
-
evaluate():
|
|
332
|
+
evaluate(): any;
|
|
299
333
|
}
|
|
300
334
|
declare class TemplateExpression extends BaseNode {
|
|
301
335
|
parts: ExpressionNode[];
|
|
302
336
|
constructor(parts: ExpressionNode[]);
|
|
303
|
-
evaluate(context: ExecutionContext):
|
|
337
|
+
evaluate(context: ExecutionContext): any;
|
|
304
338
|
}
|
|
305
339
|
declare class UnaryExpression extends BaseNode {
|
|
306
340
|
operator: string;
|
|
307
341
|
argument: ExpressionNode;
|
|
308
342
|
constructor(operator: string, argument: ExpressionNode);
|
|
309
|
-
evaluate(context: ExecutionContext):
|
|
343
|
+
evaluate(context: ExecutionContext): any;
|
|
310
344
|
}
|
|
311
345
|
declare class BinaryExpression extends BaseNode {
|
|
312
346
|
operator: string;
|
|
313
347
|
left: ExpressionNode;
|
|
314
348
|
right: ExpressionNode;
|
|
315
349
|
constructor(operator: string, left: ExpressionNode, right: ExpressionNode);
|
|
316
|
-
evaluate(context: ExecutionContext):
|
|
350
|
+
evaluate(context: ExecutionContext): any;
|
|
317
351
|
}
|
|
318
352
|
declare class TernaryExpression extends BaseNode {
|
|
319
353
|
test: ExpressionNode;
|
|
320
354
|
consequent: ExpressionNode;
|
|
321
355
|
alternate: ExpressionNode;
|
|
322
356
|
constructor(test: ExpressionNode, consequent: ExpressionNode, alternate: ExpressionNode);
|
|
323
|
-
evaluate(context: ExecutionContext):
|
|
357
|
+
evaluate(context: ExecutionContext): any;
|
|
324
358
|
}
|
|
325
359
|
declare class MemberExpression extends BaseNode {
|
|
326
360
|
target: ExpressionNode;
|
|
327
361
|
property: string;
|
|
328
362
|
optional: boolean;
|
|
329
363
|
constructor(target: ExpressionNode, property: string, optional?: boolean);
|
|
330
|
-
evaluate(context: ExecutionContext):
|
|
331
|
-
resolve(context: ExecutionContext):
|
|
364
|
+
evaluate(context: ExecutionContext): any;
|
|
365
|
+
resolve(context: ExecutionContext): {
|
|
366
|
+
value: any;
|
|
367
|
+
target?: any;
|
|
368
|
+
optional?: boolean;
|
|
369
|
+
} | undefined | Promise<{
|
|
332
370
|
value: any;
|
|
333
371
|
target?: any;
|
|
334
372
|
optional?: boolean;
|
|
@@ -346,14 +384,14 @@ declare class CallExpression extends BaseNode {
|
|
|
346
384
|
callee: ExpressionNode;
|
|
347
385
|
args: ExpressionNode[];
|
|
348
386
|
constructor(callee: ExpressionNode, args: ExpressionNode[]);
|
|
349
|
-
evaluate(context: ExecutionContext):
|
|
387
|
+
evaluate(context: ExecutionContext): any;
|
|
350
388
|
private resolveCallee;
|
|
351
389
|
}
|
|
352
390
|
type ArrayElement = ExpressionNode | SpreadElement;
|
|
353
391
|
declare class ArrayExpression extends BaseNode {
|
|
354
392
|
elements: ArrayElement[];
|
|
355
393
|
constructor(elements: ArrayElement[]);
|
|
356
|
-
evaluate(context: ExecutionContext):
|
|
394
|
+
evaluate(context: ExecutionContext): any;
|
|
357
395
|
}
|
|
358
396
|
type ObjectEntry = {
|
|
359
397
|
key: string;
|
|
@@ -369,46 +407,51 @@ type ObjectEntry = {
|
|
|
369
407
|
declare class ObjectExpression extends BaseNode {
|
|
370
408
|
entries: ObjectEntry[];
|
|
371
409
|
constructor(entries: ObjectEntry[]);
|
|
372
|
-
evaluate(context: ExecutionContext):
|
|
410
|
+
evaluate(context: ExecutionContext): any;
|
|
373
411
|
}
|
|
374
412
|
declare class IndexExpression extends BaseNode {
|
|
375
413
|
target: ExpressionNode;
|
|
376
414
|
index: ExpressionNode;
|
|
377
415
|
constructor(target: ExpressionNode, index: ExpressionNode);
|
|
378
|
-
evaluate(context: ExecutionContext):
|
|
416
|
+
evaluate(context: ExecutionContext): any;
|
|
417
|
+
private normalizeIndexKey;
|
|
379
418
|
}
|
|
380
419
|
declare class DirectiveExpression extends BaseNode {
|
|
381
420
|
kind: "attr" | "style";
|
|
382
421
|
name: string;
|
|
383
422
|
constructor(kind: "attr" | "style", name: string);
|
|
384
|
-
evaluate(context: ExecutionContext):
|
|
423
|
+
evaluate(context: ExecutionContext): any;
|
|
385
424
|
}
|
|
386
425
|
declare class AwaitExpression extends BaseNode {
|
|
387
426
|
argument: ExpressionNode;
|
|
388
427
|
constructor(argument: ExpressionNode);
|
|
389
|
-
evaluate(context: ExecutionContext):
|
|
428
|
+
evaluate(context: ExecutionContext): any;
|
|
390
429
|
}
|
|
391
430
|
declare class QueryExpression extends BaseNode {
|
|
392
431
|
direction: "self" | "descendant" | "ancestor";
|
|
393
432
|
selector: string;
|
|
394
433
|
constructor(direction: "self" | "descendant" | "ancestor", selector: string);
|
|
395
|
-
evaluate(context: ExecutionContext):
|
|
434
|
+
evaluate(context: ExecutionContext): any;
|
|
396
435
|
}
|
|
397
436
|
|
|
398
437
|
declare class Parser {
|
|
399
438
|
private stream;
|
|
400
439
|
private source;
|
|
401
440
|
private customFlags;
|
|
441
|
+
private behaviorFlags;
|
|
402
442
|
private allowImplicitSemicolon;
|
|
403
443
|
private awaitStack;
|
|
444
|
+
private functionDepth;
|
|
404
445
|
constructor(input: string, options?: {
|
|
405
446
|
customFlags?: Set<string>;
|
|
447
|
+
behaviorFlags?: Set<string>;
|
|
406
448
|
});
|
|
407
449
|
static parseInline(code: string): BlockNode;
|
|
408
450
|
parseProgram(): ProgramNode;
|
|
409
451
|
parseInlineBlock(): BlockNode;
|
|
410
452
|
private parseBehavior;
|
|
411
453
|
private parseSelector;
|
|
454
|
+
private parseBehaviorFlags;
|
|
412
455
|
private parseUseStatement;
|
|
413
456
|
private parseUseFlags;
|
|
414
457
|
private wrapErrors;
|
|
@@ -416,9 +459,7 @@ declare class Parser {
|
|
|
416
459
|
private getLineSnippet;
|
|
417
460
|
private parseBlock;
|
|
418
461
|
private parseStatement;
|
|
419
|
-
private parseStateBlock;
|
|
420
462
|
private parseOnBlock;
|
|
421
|
-
private parseOnModifiers;
|
|
422
463
|
private parseAssignment;
|
|
423
464
|
private parseExpression;
|
|
424
465
|
private parsePipeExpression;
|
|
@@ -432,6 +473,8 @@ declare class Parser {
|
|
|
432
473
|
private parseMultiplicativeExpression;
|
|
433
474
|
private parseAdditiveExpression;
|
|
434
475
|
private parseUnaryExpression;
|
|
476
|
+
private parsePostfixExpression;
|
|
477
|
+
private createIncrementNode;
|
|
435
478
|
private parseCallExpression;
|
|
436
479
|
private parsePrimaryExpression;
|
|
437
480
|
private parseArrayExpression;
|
|
@@ -450,10 +493,12 @@ declare class Parser {
|
|
|
450
493
|
private parseDeclarationOperator;
|
|
451
494
|
private parseFlags;
|
|
452
495
|
private parseCustomFlagArg;
|
|
496
|
+
private parseCustomFlagLiteral;
|
|
497
|
+
private parseCustomFlagArray;
|
|
498
|
+
private parseCustomFlagObject;
|
|
453
499
|
private isDeclarationStart;
|
|
454
500
|
private isAssignmentStart;
|
|
455
501
|
private isAssignmentOperatorStart;
|
|
456
|
-
private isCallStart;
|
|
457
502
|
private isExpressionStatementStart;
|
|
458
503
|
private isFunctionDeclarationStart;
|
|
459
504
|
private isArrowFunctionStart;
|
|
@@ -461,8 +506,11 @@ declare class Parser {
|
|
|
461
506
|
private isFunctionExpressionAssignmentStart;
|
|
462
507
|
private parseExpressionStatement;
|
|
463
508
|
private parseIfBlock;
|
|
509
|
+
private parseConditionalBody;
|
|
464
510
|
private parseWhileBlock;
|
|
465
511
|
private parseForBlock;
|
|
512
|
+
private detectForEachKind;
|
|
513
|
+
private parseForEachTarget;
|
|
466
514
|
private parseForClause;
|
|
467
515
|
private parseAssignmentExpression;
|
|
468
516
|
private parseAssignmentOperator;
|
|
@@ -471,8 +519,10 @@ declare class Parser {
|
|
|
471
519
|
private parseDestructBlock;
|
|
472
520
|
private parseQueryExpression;
|
|
473
521
|
private parseFunctionDeclaration;
|
|
474
|
-
private parseFunctionBlock;
|
|
475
522
|
private parseReturnStatement;
|
|
523
|
+
private parseAssertStatement;
|
|
524
|
+
private parseBreakStatement;
|
|
525
|
+
private parseContinueStatement;
|
|
476
526
|
private parseArrowFunctionExpression;
|
|
477
527
|
private parseFunctionParams;
|
|
478
528
|
private readSelectorUntil;
|
|
@@ -485,6 +535,7 @@ declare class Scope {
|
|
|
485
535
|
private root;
|
|
486
536
|
private listeners;
|
|
487
537
|
private anyListeners;
|
|
538
|
+
isEachItem: boolean;
|
|
488
539
|
constructor(parent?: Scope | undefined);
|
|
489
540
|
createChild(): Scope;
|
|
490
541
|
get(key: string): any;
|
|
@@ -502,6 +553,33 @@ declare class Scope {
|
|
|
502
553
|
private findNearestScopeWithKey;
|
|
503
554
|
}
|
|
504
555
|
|
|
556
|
+
interface RegisteredBehavior {
|
|
557
|
+
id: number;
|
|
558
|
+
hash: string;
|
|
559
|
+
selector: string;
|
|
560
|
+
rootSelector: string;
|
|
561
|
+
parentSelector?: string;
|
|
562
|
+
specificity: number;
|
|
563
|
+
order: number;
|
|
564
|
+
construct?: BlockNode;
|
|
565
|
+
destruct?: BlockNode;
|
|
566
|
+
onBlocks: {
|
|
567
|
+
event: string;
|
|
568
|
+
body: BlockNode;
|
|
569
|
+
flags: DeclarationFlags;
|
|
570
|
+
flagArgs: DeclarationFlagArgs;
|
|
571
|
+
args: string[];
|
|
572
|
+
}[];
|
|
573
|
+
declarations: DeclarationNode[];
|
|
574
|
+
functions: FunctionBinding[];
|
|
575
|
+
flags: BehaviorFlags;
|
|
576
|
+
flagArgs: BehaviorFlagArgs;
|
|
577
|
+
}
|
|
578
|
+
type FunctionBinding = {
|
|
579
|
+
name: string;
|
|
580
|
+
params: FunctionParam[];
|
|
581
|
+
body: BlockNode;
|
|
582
|
+
};
|
|
505
583
|
type AttributeHandler = {
|
|
506
584
|
id: string;
|
|
507
585
|
match: (name: string) => boolean;
|
|
@@ -516,6 +594,40 @@ type FlagApplyContext = {
|
|
|
516
594
|
};
|
|
517
595
|
type FlagHandler = {
|
|
518
596
|
onApply?: (context: FlagApplyContext) => void;
|
|
597
|
+
transformValue?: (context: FlagApplyContext, value: any) => any;
|
|
598
|
+
onEventBind?: (context: EventFlagContext) => EventBindPatch | void;
|
|
599
|
+
onEventBefore?: (context: EventFlagContext) => boolean | void;
|
|
600
|
+
onEventAfter?: (context: EventFlagContext) => void;
|
|
601
|
+
transformEventArgs?: (context: EventFlagContext, args: any[]) => any[];
|
|
602
|
+
};
|
|
603
|
+
type BehaviorModifierHandler = {
|
|
604
|
+
onBind?: (context: BehaviorModifierContext) => void | Promise<void>;
|
|
605
|
+
onConstruct?: (context: BehaviorModifierContext) => void | Promise<void>;
|
|
606
|
+
onDestruct?: (context: BehaviorModifierContext) => void | Promise<void>;
|
|
607
|
+
onUnbind?: (context: BehaviorModifierContext) => void | Promise<void>;
|
|
608
|
+
};
|
|
609
|
+
type BehaviorModifierContext = {
|
|
610
|
+
name: string;
|
|
611
|
+
args: any;
|
|
612
|
+
element: Element;
|
|
613
|
+
scope: Scope;
|
|
614
|
+
rootScope: Scope | undefined;
|
|
615
|
+
behavior: RegisteredBehavior;
|
|
616
|
+
engine: Engine;
|
|
617
|
+
};
|
|
618
|
+
type EventBindPatch = {
|
|
619
|
+
listenerTarget?: EventTarget;
|
|
620
|
+
options?: AddEventListenerOptions;
|
|
621
|
+
debounceMs?: number;
|
|
622
|
+
};
|
|
623
|
+
type EventFlagContext = {
|
|
624
|
+
name: string;
|
|
625
|
+
args: any;
|
|
626
|
+
element: Element;
|
|
627
|
+
scope: Scope;
|
|
628
|
+
rootScope: Scope | undefined;
|
|
629
|
+
event: Event | undefined;
|
|
630
|
+
engine: Engine;
|
|
519
631
|
};
|
|
520
632
|
type EngineOptions = {
|
|
521
633
|
diagnostics?: boolean;
|
|
@@ -532,18 +644,19 @@ declare class Engine {
|
|
|
532
644
|
private eachBindings;
|
|
533
645
|
private lifecycleBindings;
|
|
534
646
|
private behaviorRegistry;
|
|
647
|
+
private behaviorRegistryHashes;
|
|
535
648
|
private behaviorBindings;
|
|
536
649
|
private behaviorListeners;
|
|
537
650
|
private behaviorId;
|
|
538
651
|
private codeCache;
|
|
539
652
|
private behaviorCache;
|
|
540
653
|
private observer;
|
|
541
|
-
private observerRoot;
|
|
542
654
|
private attributeHandlers;
|
|
543
655
|
private globals;
|
|
544
656
|
private importantFlags;
|
|
545
657
|
private inlineDeclarations;
|
|
546
658
|
private flagHandlers;
|
|
659
|
+
private behaviorModifiers;
|
|
547
660
|
private pendingAdded;
|
|
548
661
|
private pendingRemoved;
|
|
549
662
|
private pendingUpdated;
|
|
@@ -552,13 +665,20 @@ declare class Engine {
|
|
|
552
665
|
private diagnostics;
|
|
553
666
|
private logger;
|
|
554
667
|
private pendingUses;
|
|
668
|
+
private pendingAutoBindToScope;
|
|
669
|
+
private scopeWatchers;
|
|
670
|
+
private executionStack;
|
|
671
|
+
private groupProxyCache;
|
|
555
672
|
constructor(options?: EngineOptions);
|
|
673
|
+
private getGroupTargetScope;
|
|
674
|
+
private getGroupProxy;
|
|
556
675
|
mount(root: HTMLElement): Promise<void>;
|
|
557
676
|
unmount(element: Element): void;
|
|
558
677
|
registerBehaviors(source: string): void;
|
|
559
678
|
registerGlobal(name: string, value: any): void;
|
|
560
679
|
registerGlobals(values: Record<string, any>): void;
|
|
561
680
|
registerFlag(name: string, handler?: FlagHandler): void;
|
|
681
|
+
registerBehaviorModifier(name: string, handler?: BehaviorModifierHandler): void;
|
|
562
682
|
getRegistryStats(): {
|
|
563
683
|
behaviorCount: number;
|
|
564
684
|
behaviorCacheSize: number;
|
|
@@ -588,6 +708,14 @@ declare class Engine {
|
|
|
588
708
|
private renderEach;
|
|
589
709
|
private attachBindInputHandler;
|
|
590
710
|
private parseBindDirection;
|
|
711
|
+
private resolveBindConfig;
|
|
712
|
+
private isFormControl;
|
|
713
|
+
private hasScopeValue;
|
|
714
|
+
private hasElementValue;
|
|
715
|
+
private coerceInt;
|
|
716
|
+
private coerceFloat;
|
|
717
|
+
private isInEachScope;
|
|
718
|
+
private flushAutoBindQueue;
|
|
591
719
|
private hasVsnAttributes;
|
|
592
720
|
private markInlineDeclaration;
|
|
593
721
|
private isInlineDeclaration;
|
|
@@ -595,10 +723,12 @@ declare class Engine {
|
|
|
595
723
|
private watch;
|
|
596
724
|
private watchWithDebounce;
|
|
597
725
|
private watchAllScopes;
|
|
726
|
+
private trackScopeWatcher;
|
|
727
|
+
private cleanupScopeWatchers;
|
|
728
|
+
private cleanupBehaviorListeners;
|
|
598
729
|
private parseOnAttribute;
|
|
599
|
-
private
|
|
600
|
-
private
|
|
601
|
-
private matchesTargetModifiers;
|
|
730
|
+
private parseInlineFlags;
|
|
731
|
+
private parseInlineFlagArg;
|
|
602
732
|
private describeElement;
|
|
603
733
|
private logDiagnostic;
|
|
604
734
|
private emitError;
|
|
@@ -606,8 +736,13 @@ declare class Engine {
|
|
|
606
736
|
private attachOnHandler;
|
|
607
737
|
private attachBehaviorOnHandler;
|
|
608
738
|
private attachGetHandler;
|
|
609
|
-
private
|
|
610
|
-
private
|
|
739
|
+
private getEventBindingConfig;
|
|
740
|
+
private applyEventFlagBefore;
|
|
741
|
+
private applyEventFlagAfter;
|
|
742
|
+
private applyEventFlagArgTransforms;
|
|
743
|
+
private matchesKeyFlag;
|
|
744
|
+
private withExecutionElement;
|
|
745
|
+
getCurrentElement(): Element | undefined;
|
|
611
746
|
private execute;
|
|
612
747
|
private executeBlock;
|
|
613
748
|
private safeExecute;
|
|
@@ -634,6 +769,9 @@ declare class Engine {
|
|
|
634
769
|
private applyBehaviorDeclarations;
|
|
635
770
|
private applyBehaviorDeclaration;
|
|
636
771
|
private applyCustomFlags;
|
|
772
|
+
private applyCustomFlagTransforms;
|
|
773
|
+
private applyBehaviorModifierHook;
|
|
774
|
+
private behaviorHasModifierHooks;
|
|
637
775
|
private applyDirectiveFromScope;
|
|
638
776
|
private applyDirectiveFromExpression;
|
|
639
777
|
private applyDirectiveToScope;
|
|
@@ -650,4 +788,4 @@ declare const VERSION = "0.1.0";
|
|
|
650
788
|
declare function parseCFS(source: string): ProgramNode;
|
|
651
789
|
declare function autoMount(root?: HTMLElement | Document): Engine | null;
|
|
652
790
|
|
|
653
|
-
export { type ArrayElement, ArrayExpression, ArrayPattern, type ArrayPatternElement, AssignmentNode, type AssignmentTarget, AwaitExpression, BaseNode, BehaviorNode, BinaryExpression, BlockNode, type CFSNode, CallExpression, type DeclarationFlagArgs, type DeclarationFlags, DeclarationNode, type DeclarationTarget, DirectiveExpression, Engine, type ExecutionContext, type ExpressionNode, ForNode, FunctionDeclarationNode, FunctionExpression, type FunctionParam, IdentifierExpression, IfNode, IndexExpression, Lexer, LiteralExpression, MemberExpression, type ObjectEntry, ObjectExpression, ObjectPattern, type ObjectPatternEntry, OnBlockNode, Parser, type PatternNode, ProgramNode, QueryExpression, RestElement, ReturnNode, SelectorNode, SpreadElement,
|
|
791
|
+
export { type ArrayElement, ArrayExpression, ArrayPattern, type ArrayPatternElement, AssertError, AssertNode, AssignmentNode, type AssignmentTarget, AwaitExpression, BaseNode, type BehaviorFlagArgs, type BehaviorFlags, BehaviorNode, BinaryExpression, BlockNode, BreakNode, type CFSNode, CallExpression, ContinueNode, type DeclarationFlagArgs, type DeclarationFlags, DeclarationNode, type DeclarationTarget, DirectiveExpression, Engine, type ExecutionContext, type ExpressionNode, ForEachNode, ForNode, FunctionDeclarationNode, FunctionExpression, type FunctionParam, IdentifierExpression, IfNode, IndexExpression, Lexer, LiteralExpression, MemberExpression, type ObjectEntry, ObjectExpression, ObjectPattern, type ObjectPatternEntry, OnBlockNode, Parser, type PatternNode, ProgramNode, QueryExpression, RestElement, ReturnNode, SelectorNode, SpreadElement, TemplateExpression, TernaryExpression, TokenType, TryNode, UnaryExpression, type UseFlagArgs, type UseFlags, UseNode, VERSION, WhileNode, autoMount, parseCFS };
|