@angular/compiler 16.2.0 → 17.0.0-next.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/esm2022/src/compiler.mjs +3 -3
- package/esm2022/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2022/src/render3/partial/component.mjs +4 -1
- package/esm2022/src/render3/partial/directive.mjs +1 -1
- package/esm2022/src/render3/partial/factory.mjs +1 -1
- package/esm2022/src/render3/partial/injectable.mjs +1 -1
- package/esm2022/src/render3/partial/injector.mjs +1 -1
- package/esm2022/src/render3/partial/ng_module.mjs +1 -1
- package/esm2022/src/render3/partial/pipe.mjs +1 -1
- package/esm2022/src/render3/r3_ast.mjs +113 -9
- package/esm2022/src/render3/r3_class_metadata_compiler.mjs +55 -1
- package/esm2022/src/render3/r3_control_flow.mjs +289 -0
- package/esm2022/src/render3/r3_deferred_blocks.mjs +16 -9
- package/esm2022/src/render3/r3_deferred_triggers.mjs +33 -19
- package/esm2022/src/render3/r3_identifiers.mjs +17 -1
- package/esm2022/src/render3/r3_template_transform.mjs +28 -7
- package/esm2022/src/render3/view/api.mjs +1 -1
- package/esm2022/src/render3/view/compiler.mjs +12 -2
- package/esm2022/src/render3/view/t2_binder.mjs +66 -5
- package/esm2022/src/render3/view/template.mjs +130 -54
- package/esm2022/src/template/pipeline/ir/index.mjs +2 -3
- package/esm2022/src/template/pipeline/ir/src/enums.mjs +41 -3
- package/esm2022/src/template/pipeline/ir/src/expression.mjs +11 -1
- package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +16 -4
- package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +5 -3
- package/esm2022/src/template/pipeline/src/emit.mjs +3 -1
- package/esm2022/src/template/pipeline/src/ingest.mjs +10 -10
- package/esm2022/src/template/pipeline/src/phases/attribute_extraction.mjs +43 -75
- package/esm2022/src/template/pipeline/src/phases/binding_specialization.mjs +2 -2
- package/esm2022/src/template/pipeline/src/phases/const_collection.mjs +90 -13
- package/esm2022/src/template/pipeline/src/phases/parse_extracted_styles.mjs +38 -0
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +1110 -425
- package/fesm2022/compiler.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/index.d.ts +141 -5
- package/package.json +2 -2
- package/testing/index.d.ts +1 -1
- package/esm2022/src/template/pipeline/ir/src/element.mjs +0 -108
package/fesm2022/testing.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v17.0.0-next.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -635,6 +635,27 @@ export declare function compileClassMetadata(metadata: R3ClassMetadata): outputA
|
|
|
635
635
|
|
|
636
636
|
export declare type CompileClassMetadataFn = (metadata: R3ClassMetadata) => outputAst.Expression;
|
|
637
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Wraps the `setClassMetadata` function with extra logic that dynamically
|
|
640
|
+
* loads dependencies from `{#defer}` blocks.
|
|
641
|
+
*
|
|
642
|
+
* Generates a call like this:
|
|
643
|
+
* ```
|
|
644
|
+
* setClassMetadataAsync(type, () => {
|
|
645
|
+
* return [
|
|
646
|
+
* import('./cmp-a').then(m => m.CmpA);
|
|
647
|
+
* import('./cmp-b').then(m => m.CmpB);
|
|
648
|
+
* ];
|
|
649
|
+
* }, (CmpA, CmpB) => {
|
|
650
|
+
* setClassMetadata(type, decorators, ctorParameters, propParameters);
|
|
651
|
+
* });
|
|
652
|
+
* ```
|
|
653
|
+
*
|
|
654
|
+
* Similar to the `setClassMetadata` call, it's wrapped into the `ngDevMode`
|
|
655
|
+
* check to tree-shake away this code in production mode.
|
|
656
|
+
*/
|
|
657
|
+
export declare function compileComponentClassMetadata(metadata: R3ClassMetadata, deferrableTypes: Map<string, string>): outputAst.Expression;
|
|
658
|
+
|
|
638
659
|
/**
|
|
639
660
|
* Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
|
|
640
661
|
*/
|
|
@@ -907,7 +928,8 @@ export declare const enum DeclarationListEmitMode {
|
|
|
907
928
|
* directives: function () { return [dirA, dirB].map(ng.resolveForwardRef); },
|
|
908
929
|
* ```
|
|
909
930
|
*/
|
|
910
|
-
ClosureResolved = 2
|
|
931
|
+
ClosureResolved = 2,
|
|
932
|
+
RuntimeResolved = 3
|
|
911
933
|
}
|
|
912
934
|
|
|
913
935
|
export declare interface DeclareComponentTemplateInfo {
|
|
@@ -979,6 +1001,16 @@ export declare interface DeferBlockTemplateDependency {
|
|
|
979
1001
|
importPath: string | null;
|
|
980
1002
|
}
|
|
981
1003
|
|
|
1004
|
+
declare interface DeferredBlockTriggers {
|
|
1005
|
+
when?: TmplAstBoundDeferredTrigger;
|
|
1006
|
+
idle?: TmplAstIdleDeferredTrigger;
|
|
1007
|
+
immediate?: TmplAstImmediateDeferredTrigger;
|
|
1008
|
+
hover?: TmplAstHoverDeferredTrigger;
|
|
1009
|
+
timer?: TmplAstTimerDeferredTrigger;
|
|
1010
|
+
interaction?: TmplAstInteractionDeferredTrigger;
|
|
1011
|
+
viewport?: TmplAstViewportDeferredTrigger;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
982
1014
|
export declare function devOnlyGuardedExpression(expr: outputAst.Expression): outputAst.Expression;
|
|
983
1015
|
|
|
984
1016
|
/**
|
|
@@ -2889,6 +2921,12 @@ export declare interface R3ComponentMetadata<DeclarationT extends R3TemplateDepe
|
|
|
2889
2921
|
* Strategy used for detecting changes in the component.
|
|
2890
2922
|
*/
|
|
2891
2923
|
changeDetection?: ChangeDetectionStrategy;
|
|
2924
|
+
/**
|
|
2925
|
+
* The imports expression as appears on the component decorate for standalone component. This
|
|
2926
|
+
* field is currently needed only for local compilation, and so in other compilation modes it may
|
|
2927
|
+
* not be set. If component has empty array imports then this field is not set.
|
|
2928
|
+
*/
|
|
2929
|
+
rawImports?: outputAst.Expression;
|
|
2892
2930
|
}
|
|
2893
2931
|
|
|
2894
2932
|
/**
|
|
@@ -3667,6 +3705,20 @@ export declare class R3Identifiers {
|
|
|
3667
3705
|
static resetView: outputAst.ExternalReference;
|
|
3668
3706
|
static templateCreate: outputAst.ExternalReference;
|
|
3669
3707
|
static defer: outputAst.ExternalReference;
|
|
3708
|
+
static deferWhen: outputAst.ExternalReference;
|
|
3709
|
+
static deferOnIdle: outputAst.ExternalReference;
|
|
3710
|
+
static deferOnImmediate: outputAst.ExternalReference;
|
|
3711
|
+
static deferOnTimer: outputAst.ExternalReference;
|
|
3712
|
+
static deferOnHover: outputAst.ExternalReference;
|
|
3713
|
+
static deferOnInteraction: outputAst.ExternalReference;
|
|
3714
|
+
static deferOnViewport: outputAst.ExternalReference;
|
|
3715
|
+
static deferPrefetchWhen: outputAst.ExternalReference;
|
|
3716
|
+
static deferPrefetchOnIdle: outputAst.ExternalReference;
|
|
3717
|
+
static deferPrefetchOnImmediate: outputAst.ExternalReference;
|
|
3718
|
+
static deferPrefetchOnTimer: outputAst.ExternalReference;
|
|
3719
|
+
static deferPrefetchOnHover: outputAst.ExternalReference;
|
|
3720
|
+
static deferPrefetchOnInteraction: outputAst.ExternalReference;
|
|
3721
|
+
static deferPrefetchOnViewport: outputAst.ExternalReference;
|
|
3670
3722
|
static text: outputAst.ExternalReference;
|
|
3671
3723
|
static enableBindings: outputAst.ExternalReference;
|
|
3672
3724
|
static disableBindings: outputAst.ExternalReference;
|
|
@@ -3734,6 +3786,7 @@ export declare class R3Identifiers {
|
|
|
3734
3786
|
static resolveWindow: outputAst.ExternalReference;
|
|
3735
3787
|
static resolveDocument: outputAst.ExternalReference;
|
|
3736
3788
|
static resolveBody: outputAst.ExternalReference;
|
|
3789
|
+
static getComponentDepsFactory: outputAst.ExternalReference;
|
|
3737
3790
|
static defineComponent: outputAst.ExternalReference;
|
|
3738
3791
|
static declareComponent: outputAst.ExternalReference;
|
|
3739
3792
|
static setComponentScope: outputAst.ExternalReference;
|
|
@@ -3761,6 +3814,7 @@ export declare class R3Identifiers {
|
|
|
3761
3814
|
static declarePipe: outputAst.ExternalReference;
|
|
3762
3815
|
static declareClassMetadata: outputAst.ExternalReference;
|
|
3763
3816
|
static setClassMetadata: outputAst.ExternalReference;
|
|
3817
|
+
static setClassMetadataAsync: outputAst.ExternalReference;
|
|
3764
3818
|
static queryRefresh: outputAst.ExternalReference;
|
|
3765
3819
|
static viewQuery: outputAst.ExternalReference;
|
|
3766
3820
|
static loadQuery: outputAst.ExternalReference;
|
|
@@ -4460,7 +4514,14 @@ declare namespace t {
|
|
|
4460
4514
|
TmplAstDeferredBlockPlaceholder as DeferredBlockPlaceholder,
|
|
4461
4515
|
TmplAstDeferredBlockLoading as DeferredBlockLoading,
|
|
4462
4516
|
TmplAstDeferredBlockError as DeferredBlockError,
|
|
4517
|
+
DeferredBlockTriggers,
|
|
4463
4518
|
TmplAstDeferredBlock as DeferredBlock,
|
|
4519
|
+
TmplAstSwitchBlock as SwitchBlock,
|
|
4520
|
+
TmplAstSwitchBlockCase as SwitchBlockCase,
|
|
4521
|
+
TmplAstForLoopBlock as ForLoopBlock,
|
|
4522
|
+
TmplAstForLoopBlockEmpty as ForLoopBlockEmpty,
|
|
4523
|
+
TmplAstIfBlock as IfBlock,
|
|
4524
|
+
TmplAstIfBlockBranch as IfBlockBranch,
|
|
4464
4525
|
TmplAstTemplate as Template,
|
|
4465
4526
|
TmplAstContent as Content,
|
|
4466
4527
|
TmplAstVariable as Variable,
|
|
@@ -4670,16 +4731,20 @@ export declare class TmplAstContent implements TmplAstNode {
|
|
|
4670
4731
|
|
|
4671
4732
|
export declare class TmplAstDeferredBlock implements TmplAstNode {
|
|
4672
4733
|
children: TmplAstNode[];
|
|
4673
|
-
triggers: TmplAstDeferredTrigger[];
|
|
4674
|
-
prefetchTriggers: TmplAstDeferredTrigger[];
|
|
4675
4734
|
placeholder: TmplAstDeferredBlockPlaceholder | null;
|
|
4676
4735
|
loading: TmplAstDeferredBlockLoading | null;
|
|
4677
4736
|
error: TmplAstDeferredBlockError | null;
|
|
4678
4737
|
sourceSpan: ParseSourceSpan;
|
|
4679
4738
|
startSourceSpan: ParseSourceSpan;
|
|
4680
4739
|
endSourceSpan: ParseSourceSpan | null;
|
|
4681
|
-
|
|
4740
|
+
readonly triggers: Readonly<DeferredBlockTriggers>;
|
|
4741
|
+
readonly prefetchTriggers: Readonly<DeferredBlockTriggers>;
|
|
4742
|
+
private readonly definedTriggers;
|
|
4743
|
+
private readonly definedPrefetchTriggers;
|
|
4744
|
+
constructor(children: TmplAstNode[], triggers: DeferredBlockTriggers, prefetchTriggers: DeferredBlockTriggers, placeholder: TmplAstDeferredBlockPlaceholder | null, loading: TmplAstDeferredBlockLoading | null, error: TmplAstDeferredBlockError | null, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null);
|
|
4682
4745
|
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4746
|
+
visitAll(visitor: Visitor_3<unknown>): void;
|
|
4747
|
+
private visitTriggers;
|
|
4683
4748
|
}
|
|
4684
4749
|
|
|
4685
4750
|
export declare class TmplAstDeferredBlockError implements TmplAstNode {
|
|
@@ -4733,6 +4798,27 @@ export declare class TmplAstElement implements TmplAstNode {
|
|
|
4733
4798
|
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4734
4799
|
}
|
|
4735
4800
|
|
|
4801
|
+
export declare class TmplAstForLoopBlock implements TmplAstNode {
|
|
4802
|
+
itemName: string;
|
|
4803
|
+
expression: AST;
|
|
4804
|
+
trackBy: string;
|
|
4805
|
+
children: TmplAstNode[];
|
|
4806
|
+
empty: TmplAstForLoopBlockEmpty | null;
|
|
4807
|
+
sourceSpan: ParseSourceSpan;
|
|
4808
|
+
startSourceSpan: ParseSourceSpan;
|
|
4809
|
+
endSourceSpan: ParseSourceSpan | null;
|
|
4810
|
+
constructor(itemName: string, expression: AST, trackBy: string, children: TmplAstNode[], empty: TmplAstForLoopBlockEmpty | null, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null);
|
|
4811
|
+
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
export declare class TmplAstForLoopBlockEmpty implements TmplAstNode {
|
|
4815
|
+
children: TmplAstNode[];
|
|
4816
|
+
sourceSpan: ParseSourceSpan;
|
|
4817
|
+
startSourceSpan: ParseSourceSpan;
|
|
4818
|
+
constructor(children: TmplAstNode[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan);
|
|
4819
|
+
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4820
|
+
}
|
|
4821
|
+
|
|
4736
4822
|
export declare class TmplAstHoverDeferredTrigger extends TmplAstDeferredTrigger {
|
|
4737
4823
|
}
|
|
4738
4824
|
|
|
@@ -4756,6 +4842,25 @@ export declare class TmplAstIcu implements TmplAstNode {
|
|
|
4756
4842
|
export declare class TmplAstIdleDeferredTrigger extends TmplAstDeferredTrigger {
|
|
4757
4843
|
}
|
|
4758
4844
|
|
|
4845
|
+
export declare class TmplAstIfBlock implements TmplAstNode {
|
|
4846
|
+
branches: TmplAstIfBlockBranch[];
|
|
4847
|
+
sourceSpan: ParseSourceSpan;
|
|
4848
|
+
startSourceSpan: ParseSourceSpan;
|
|
4849
|
+
endSourceSpan: ParseSourceSpan | null;
|
|
4850
|
+
constructor(branches: TmplAstIfBlockBranch[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null);
|
|
4851
|
+
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
export declare class TmplAstIfBlockBranch implements TmplAstNode {
|
|
4855
|
+
expression: AST | null;
|
|
4856
|
+
children: TmplAstNode[];
|
|
4857
|
+
expressionAlias: string | null;
|
|
4858
|
+
sourceSpan: ParseSourceSpan;
|
|
4859
|
+
startSourceSpan: ParseSourceSpan;
|
|
4860
|
+
constructor(expression: AST | null, children: TmplAstNode[], expressionAlias: string | null, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan);
|
|
4861
|
+
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4862
|
+
}
|
|
4863
|
+
|
|
4759
4864
|
export declare class TmplAstImmediateDeferredTrigger extends TmplAstDeferredTrigger {
|
|
4760
4865
|
}
|
|
4761
4866
|
|
|
@@ -4776,6 +4881,12 @@ export declare class TmplAstRecursiveVisitor implements Visitor_3<void> {
|
|
|
4776
4881
|
visitDeferredBlockPlaceholder(block: TmplAstDeferredBlockPlaceholder): void;
|
|
4777
4882
|
visitDeferredBlockError(block: TmplAstDeferredBlockError): void;
|
|
4778
4883
|
visitDeferredBlockLoading(block: TmplAstDeferredBlockLoading): void;
|
|
4884
|
+
visitSwitchBlock(block: TmplAstSwitchBlock): void;
|
|
4885
|
+
visitSwitchBlockCase(block: TmplAstSwitchBlockCase): void;
|
|
4886
|
+
visitForLoopBlock(block: TmplAstForLoopBlock): void;
|
|
4887
|
+
visitForLoopBlockEmpty(block: TmplAstForLoopBlockEmpty): void;
|
|
4888
|
+
visitIfBlock(block: TmplAstIfBlock): void;
|
|
4889
|
+
visitIfBlockBranch(block: TmplAstIfBlockBranch): void;
|
|
4779
4890
|
visitContent(content: TmplAstContent): void;
|
|
4780
4891
|
visitVariable(variable: TmplAstVariable): void;
|
|
4781
4892
|
visitReference(reference: TmplAstReference): void;
|
|
@@ -4798,6 +4909,25 @@ export declare class TmplAstReference implements TmplAstNode {
|
|
|
4798
4909
|
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4799
4910
|
}
|
|
4800
4911
|
|
|
4912
|
+
export declare class TmplAstSwitchBlock implements TmplAstNode {
|
|
4913
|
+
expression: AST;
|
|
4914
|
+
cases: TmplAstSwitchBlockCase[];
|
|
4915
|
+
sourceSpan: ParseSourceSpan;
|
|
4916
|
+
startSourceSpan: ParseSourceSpan;
|
|
4917
|
+
endSourceSpan: ParseSourceSpan | null;
|
|
4918
|
+
constructor(expression: AST, cases: TmplAstSwitchBlockCase[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null);
|
|
4919
|
+
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
export declare class TmplAstSwitchBlockCase implements TmplAstNode {
|
|
4923
|
+
expression: AST | null;
|
|
4924
|
+
children: TmplAstNode[];
|
|
4925
|
+
sourceSpan: ParseSourceSpan;
|
|
4926
|
+
startSourceSpan: ParseSourceSpan;
|
|
4927
|
+
constructor(expression: AST | null, children: TmplAstNode[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan);
|
|
4928
|
+
visit<Result>(visitor: Visitor_3<Result>): Result;
|
|
4929
|
+
}
|
|
4930
|
+
|
|
4801
4931
|
export declare class TmplAstTemplate implements TmplAstNode {
|
|
4802
4932
|
tagName: string | null;
|
|
4803
4933
|
attributes: TmplAstTextAttribute[];
|
|
@@ -5181,6 +5311,12 @@ declare interface Visitor_3<Result = any> {
|
|
|
5181
5311
|
visitDeferredBlockError(block: TmplAstDeferredBlockError): Result;
|
|
5182
5312
|
visitDeferredBlockLoading(block: TmplAstDeferredBlockLoading): Result;
|
|
5183
5313
|
visitDeferredTrigger(trigger: TmplAstDeferredTrigger): Result;
|
|
5314
|
+
visitSwitchBlock(block: TmplAstSwitchBlock): Result;
|
|
5315
|
+
visitSwitchBlockCase(block: TmplAstSwitchBlockCase): Result;
|
|
5316
|
+
visitForLoopBlock(block: TmplAstForLoopBlock): Result;
|
|
5317
|
+
visitForLoopBlockEmpty(block: TmplAstForLoopBlockEmpty): Result;
|
|
5318
|
+
visitIfBlock(block: TmplAstIfBlock): Result;
|
|
5319
|
+
visitIfBlockBranch(block: TmplAstIfBlockBranch): Result;
|
|
5184
5320
|
}
|
|
5185
5321
|
|
|
5186
5322
|
export declare class WrappedNodeExpr<T> extends Expression {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-next.0",
|
|
4
4
|
"description": "Angular - the compiler library",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"tslib": "^2.3.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@angular/core": "
|
|
14
|
+
"@angular/core": "17.0.0-next.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependenciesMeta": {
|
|
17
17
|
"@angular/core": {
|
package/testing/index.d.ts
CHANGED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { splitNsName } from '../../../../ml_parser/tags';
|
|
9
|
-
import * as o from '../../../../output/output_ast';
|
|
10
|
-
/**
|
|
11
|
-
* Enumeration of the types of attributes which can be applied to an element.
|
|
12
|
-
*/
|
|
13
|
-
export var BindingKind;
|
|
14
|
-
(function (BindingKind) {
|
|
15
|
-
/**
|
|
16
|
-
* Static attributes.
|
|
17
|
-
*/
|
|
18
|
-
BindingKind[BindingKind["Attribute"] = 0] = "Attribute";
|
|
19
|
-
/**
|
|
20
|
-
* Class bindings.
|
|
21
|
-
*/
|
|
22
|
-
BindingKind[BindingKind["ClassName"] = 1] = "ClassName";
|
|
23
|
-
/**
|
|
24
|
-
* Style bindings.
|
|
25
|
-
*/
|
|
26
|
-
BindingKind[BindingKind["StyleProperty"] = 2] = "StyleProperty";
|
|
27
|
-
/**
|
|
28
|
-
* Dynamic property bindings.
|
|
29
|
-
*/
|
|
30
|
-
BindingKind[BindingKind["Property"] = 3] = "Property";
|
|
31
|
-
/**
|
|
32
|
-
* Property or attribute bindings on a template.
|
|
33
|
-
*/
|
|
34
|
-
BindingKind[BindingKind["Template"] = 4] = "Template";
|
|
35
|
-
/**
|
|
36
|
-
* Internationalized attributes.
|
|
37
|
-
*/
|
|
38
|
-
BindingKind[BindingKind["I18n"] = 5] = "I18n";
|
|
39
|
-
/**
|
|
40
|
-
* TODO: Consider how Animations are handled, and if they should be a distinct BindingKind.
|
|
41
|
-
*/
|
|
42
|
-
BindingKind[BindingKind["Animation"] = 6] = "Animation";
|
|
43
|
-
})(BindingKind || (BindingKind = {}));
|
|
44
|
-
const FLYWEIGHT_ARRAY = Object.freeze([]);
|
|
45
|
-
/**
|
|
46
|
-
* Container for all of the various kinds of attributes which are applied on an element.
|
|
47
|
-
*/
|
|
48
|
-
export class ElementAttributes {
|
|
49
|
-
constructor() {
|
|
50
|
-
this.known = new Set();
|
|
51
|
-
this.byKind = new Map;
|
|
52
|
-
this.projectAs = null;
|
|
53
|
-
}
|
|
54
|
-
get attributes() {
|
|
55
|
-
return this.byKind.get(BindingKind.Attribute) ?? FLYWEIGHT_ARRAY;
|
|
56
|
-
}
|
|
57
|
-
get classes() {
|
|
58
|
-
return this.byKind.get(BindingKind.ClassName) ?? FLYWEIGHT_ARRAY;
|
|
59
|
-
}
|
|
60
|
-
get styles() {
|
|
61
|
-
return this.byKind.get(BindingKind.StyleProperty) ?? FLYWEIGHT_ARRAY;
|
|
62
|
-
}
|
|
63
|
-
get bindings() {
|
|
64
|
-
return this.byKind.get(BindingKind.Property) ?? FLYWEIGHT_ARRAY;
|
|
65
|
-
}
|
|
66
|
-
get template() {
|
|
67
|
-
return this.byKind.get(BindingKind.Template) ?? FLYWEIGHT_ARRAY;
|
|
68
|
-
}
|
|
69
|
-
get i18n() {
|
|
70
|
-
return this.byKind.get(BindingKind.I18n) ?? FLYWEIGHT_ARRAY;
|
|
71
|
-
}
|
|
72
|
-
add(kind, name, value) {
|
|
73
|
-
if (this.known.has(name)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
this.known.add(name);
|
|
77
|
-
const array = this.arrayFor(kind);
|
|
78
|
-
array.push(...getAttributeNameLiterals(name));
|
|
79
|
-
if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
|
|
80
|
-
if (value === null) {
|
|
81
|
-
throw Error('Attribute & style element attributes must have a value');
|
|
82
|
-
}
|
|
83
|
-
array.push(value);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
arrayFor(kind) {
|
|
87
|
-
if (!this.byKind.has(kind)) {
|
|
88
|
-
this.byKind.set(kind, []);
|
|
89
|
-
}
|
|
90
|
-
return this.byKind.get(kind);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function getAttributeNameLiterals(name) {
|
|
94
|
-
const [attributeNamespace, attributeName] = splitNsName(name);
|
|
95
|
-
const nameLiteral = o.literal(attributeName);
|
|
96
|
-
if (attributeNamespace) {
|
|
97
|
-
return [
|
|
98
|
-
o.literal(0 /* core.AttributeMarker.NamespaceURI */), o.literal(attributeNamespace), nameLiteral
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
return [nameLiteral];
|
|
102
|
-
}
|
|
103
|
-
export function assertIsElementAttributes(attrs) {
|
|
104
|
-
if (!(attrs instanceof ElementAttributes)) {
|
|
105
|
-
throw new Error(`AssertionError: ElementAttributes has already been coalesced into the view constants`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWxlbWVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy90ZW1wbGF0ZS9waXBlbGluZS9pci9zcmMvZWxlbWVudC50cyJdLCJuYW1lcyI6W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