@angular/core 17.1.0-next.4 → 17.1.0-rc.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/primitives/signals/index.mjs +2 -2
- package/esm2022/primitives/signals/src/signal.mjs +2 -10
- package/esm2022/src/application/application_ref.mjs +24 -12
- package/esm2022/src/application/create_application.mjs +2 -2
- package/esm2022/src/authoring/input.mjs +12 -5
- package/esm2022/src/authoring/input_signal.mjs +28 -1
- package/esm2022/src/authoring/input_signal_node.mjs +22 -0
- package/esm2022/src/authoring.mjs +1 -4
- package/esm2022/src/change_detection/flags.mjs +16 -0
- package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +164 -0
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +13 -0
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +56 -0
- package/esm2022/src/compiler/compiler_facade_interface.mjs +1 -1
- package/esm2022/src/core.mjs +3 -3
- package/esm2022/src/core_private_export.mjs +5 -2
- package/esm2022/src/core_render3_private_export.mjs +2 -2
- package/esm2022/src/defer/dom_triggers.mjs +1 -5
- package/esm2022/src/di/inject_switch.mjs +2 -3
- package/esm2022/src/di/r3_injector.mjs +8 -6
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/event_emitter.mjs +1 -2
- package/esm2022/src/hydration/utils.mjs +2 -2
- package/esm2022/src/hydration/views.mjs +2 -2
- package/esm2022/src/linker/view_container_ref.mjs +2 -2
- package/esm2022/src/metadata/directives.mjs +1 -1
- package/esm2022/src/pending_tasks.mjs +57 -0
- package/esm2022/src/platform/platform_ref.mjs +2 -2
- package/esm2022/src/render3/after_render_hooks.mjs +16 -34
- package/esm2022/src/render3/apply_value_input_field.mjs +16 -0
- package/esm2022/src/render3/collect_native_nodes.mjs +2 -3
- package/esm2022/src/render3/component_ref.mjs +24 -13
- package/esm2022/src/render3/debug/injector_profiler.mjs +1 -1
- package/esm2022/src/render3/definition.mjs +27 -68
- package/esm2022/src/render3/errors_di.mjs +4 -3
- package/esm2022/src/render3/features/host_directives_feature.mjs +2 -3
- package/esm2022/src/render3/features/inherit_definition_feature.mjs +31 -9
- package/esm2022/src/render3/features/input_transforms_feature.mjs +4 -5
- package/esm2022/src/render3/features/ng_onchanges_feature.mjs +4 -3
- package/esm2022/src/render3/instructions/advance.mjs +2 -2
- package/esm2022/src/render3/instructions/change_detection.mjs +1 -6
- package/esm2022/src/render3/instructions/control_flow.mjs +5 -3
- package/esm2022/src/render3/instructions/listener.mjs +1 -1
- package/esm2022/src/render3/instructions/mark_view_dirty.mjs +4 -3
- package/esm2022/src/render3/instructions/shared.mjs +63 -59
- package/esm2022/src/render3/instructions/write_to_directive_input.mjs +43 -0
- package/esm2022/src/render3/interfaces/container.mjs +1 -6
- package/esm2022/src/render3/interfaces/definition.mjs +8 -2
- package/esm2022/src/render3/interfaces/node.mjs +1 -1
- package/esm2022/src/render3/interfaces/view.mjs +1 -1
- package/esm2022/src/render3/jit/environment.mjs +3 -1
- package/esm2022/src/render3/node_manipulation.mjs +8 -8
- package/esm2022/src/render3/reactivity/effect.mjs +8 -6
- package/esm2022/src/render3/reactivity/signal.mjs +1 -1
- package/esm2022/src/render3/styling/style_binding_list.mjs +4 -4
- package/esm2022/src/render3/util/discovery_utils.mjs +37 -5
- package/esm2022/src/render3/util/global_utils.mjs +28 -28
- package/esm2022/src/render3/util/injector_discovery_utils.mjs +1 -1
- package/esm2022/src/render3/util/injector_utils.mjs +6 -5
- package/esm2022/src/render3/util/view_traversal_utils.mjs +3 -12
- package/esm2022/src/render3/util/view_utils.mjs +36 -19
- package/esm2022/src/render3/view_ref.mjs +2 -1
- package/esm2022/src/testability/testability.mjs +3 -15
- package/esm2022/src/util/empty.mjs +1 -1
- package/esm2022/src/version.mjs +6 -5
- package/esm2022/src/zone/ng_zone.mjs +1 -61
- package/esm2022/testing/src/component_fixture.mjs +62 -58
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +699 -542
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +2 -10
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +62 -58
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +677 -252
- package/package.json +1 -1
- package/primitives/signals/index.d.ts +3 -4
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/block-template-entities/bundle.js +497 -392
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +663 -459
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +816 -616
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +6 -2
- package/esm2022/src/change_detection/scheduling.mjs +0 -103
- package/esm2022/src/initial_render_pending_tasks.mjs +0 -49
|
@@ -526,6 +526,12 @@ var ChangeDetectionStrategy;
|
|
|
526
526
|
ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush";
|
|
527
527
|
ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default";
|
|
528
528
|
})(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
|
|
529
|
+
var InputFlags;
|
|
530
|
+
(function(InputFlags2) {
|
|
531
|
+
InputFlags2[InputFlags2["None"] = 0] = "None";
|
|
532
|
+
InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased";
|
|
533
|
+
InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform";
|
|
534
|
+
})(InputFlags || (InputFlags = {}));
|
|
529
535
|
var CUSTOM_ELEMENTS_SCHEMA = {
|
|
530
536
|
name: "custom-elements"
|
|
531
537
|
};
|
|
@@ -886,12 +892,13 @@ var BinaryOperator;
|
|
|
886
892
|
BinaryOperator2[BinaryOperator2["Modulo"] = 8] = "Modulo";
|
|
887
893
|
BinaryOperator2[BinaryOperator2["And"] = 9] = "And";
|
|
888
894
|
BinaryOperator2[BinaryOperator2["Or"] = 10] = "Or";
|
|
889
|
-
BinaryOperator2[BinaryOperator2["
|
|
890
|
-
BinaryOperator2[BinaryOperator2["
|
|
891
|
-
BinaryOperator2[BinaryOperator2["
|
|
892
|
-
BinaryOperator2[BinaryOperator2["
|
|
893
|
-
BinaryOperator2[BinaryOperator2["
|
|
894
|
-
BinaryOperator2[BinaryOperator2["
|
|
895
|
+
BinaryOperator2[BinaryOperator2["BitwiseOr"] = 11] = "BitwiseOr";
|
|
896
|
+
BinaryOperator2[BinaryOperator2["BitwiseAnd"] = 12] = "BitwiseAnd";
|
|
897
|
+
BinaryOperator2[BinaryOperator2["Lower"] = 13] = "Lower";
|
|
898
|
+
BinaryOperator2[BinaryOperator2["LowerEquals"] = 14] = "LowerEquals";
|
|
899
|
+
BinaryOperator2[BinaryOperator2["Bigger"] = 15] = "Bigger";
|
|
900
|
+
BinaryOperator2[BinaryOperator2["BiggerEquals"] = 16] = "BiggerEquals";
|
|
901
|
+
BinaryOperator2[BinaryOperator2["NullishCoalesce"] = 17] = "NullishCoalesce";
|
|
895
902
|
})(BinaryOperator || (BinaryOperator = {}));
|
|
896
903
|
function nullSafeIsEquivalent(base, other) {
|
|
897
904
|
if (base == null || other == null) {
|
|
@@ -964,6 +971,9 @@ var Expression = class {
|
|
|
964
971
|
and(rhs, sourceSpan) {
|
|
965
972
|
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
|
|
966
973
|
}
|
|
974
|
+
bitwiseOr(rhs, sourceSpan, parens = true) {
|
|
975
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan, parens);
|
|
976
|
+
}
|
|
967
977
|
bitwiseAnd(rhs, sourceSpan, parens = true) {
|
|
968
978
|
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens);
|
|
969
979
|
}
|
|
@@ -1874,7 +1884,7 @@ var ConstantPool = class {
|
|
|
1874
1884
|
}))));
|
|
1875
1885
|
}
|
|
1876
1886
|
}
|
|
1877
|
-
getSharedFunctionReference(fn2, prefix) {
|
|
1887
|
+
getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
|
|
1878
1888
|
var _a2;
|
|
1879
1889
|
const isArrow = fn2 instanceof ArrowFunctionExpr;
|
|
1880
1890
|
for (const current of this.statements) {
|
|
@@ -1885,7 +1895,7 @@ var ConstantPool = class {
|
|
|
1885
1895
|
return variable(current.name);
|
|
1886
1896
|
}
|
|
1887
1897
|
}
|
|
1888
|
-
const name = this.uniqueName(prefix);
|
|
1898
|
+
const name = useUniqueName ? this.uniqueName(prefix) : prefix;
|
|
1889
1899
|
this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
|
|
1890
1900
|
return variable(name);
|
|
1891
1901
|
}
|
|
@@ -2559,6 +2569,12 @@ var Identifiers = _Identifiers;
|
|
|
2559
2569
|
moduleName: CORE
|
|
2560
2570
|
};
|
|
2561
2571
|
})();
|
|
2572
|
+
(() => {
|
|
2573
|
+
_Identifiers.InputFlags = {
|
|
2574
|
+
name: "\u0275\u0275InputFlags",
|
|
2575
|
+
moduleName: CORE
|
|
2576
|
+
};
|
|
2577
|
+
})();
|
|
2562
2578
|
(() => {
|
|
2563
2579
|
_Identifiers.sanitizeHtml = { name: "\u0275\u0275sanitizeHtml", moduleName: CORE };
|
|
2564
2580
|
})();
|
|
@@ -3158,6 +3174,9 @@ var AbstractEmitterVisitor = class {
|
|
|
3158
3174
|
case BinaryOperator.And:
|
|
3159
3175
|
opStr = "&&";
|
|
3160
3176
|
break;
|
|
3177
|
+
case BinaryOperator.BitwiseOr:
|
|
3178
|
+
opStr = "|";
|
|
3179
|
+
break;
|
|
3161
3180
|
case BinaryOperator.BitwiseAnd:
|
|
3162
3181
|
opStr = "&";
|
|
3163
3182
|
break;
|
|
@@ -3512,13 +3531,17 @@ var TagContentType;
|
|
|
3512
3531
|
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
3513
3532
|
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
3514
3533
|
})(TagContentType || (TagContentType = {}));
|
|
3515
|
-
function splitNsName(elementName) {
|
|
3534
|
+
function splitNsName(elementName, fatal = true) {
|
|
3516
3535
|
if (elementName[0] != ":") {
|
|
3517
3536
|
return [null, elementName];
|
|
3518
3537
|
}
|
|
3519
3538
|
const colonIndex = elementName.indexOf(":", 1);
|
|
3520
3539
|
if (colonIndex === -1) {
|
|
3521
|
-
|
|
3540
|
+
if (fatal) {
|
|
3541
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
3542
|
+
} else {
|
|
3543
|
+
return [null, elementName];
|
|
3544
|
+
}
|
|
3522
3545
|
}
|
|
3523
3546
|
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
3524
3547
|
}
|
|
@@ -4025,28 +4048,6 @@ var BlockPlaceholder = class {
|
|
|
4025
4048
|
return visitor.visitBlockPlaceholder(this, context);
|
|
4026
4049
|
}
|
|
4027
4050
|
};
|
|
4028
|
-
var RecurseVisitor = class {
|
|
4029
|
-
visitText(text2, context) {
|
|
4030
|
-
}
|
|
4031
|
-
visitContainer(container, context) {
|
|
4032
|
-
container.children.forEach((child) => child.visit(this));
|
|
4033
|
-
}
|
|
4034
|
-
visitIcu(icu, context) {
|
|
4035
|
-
Object.keys(icu.cases).forEach((k) => {
|
|
4036
|
-
icu.cases[k].visit(this);
|
|
4037
|
-
});
|
|
4038
|
-
}
|
|
4039
|
-
visitTagPlaceholder(ph, context) {
|
|
4040
|
-
ph.children.forEach((child) => child.visit(this));
|
|
4041
|
-
}
|
|
4042
|
-
visitPlaceholder(ph, context) {
|
|
4043
|
-
}
|
|
4044
|
-
visitIcuPlaceholder(ph, context) {
|
|
4045
|
-
}
|
|
4046
|
-
visitBlockPlaceholder(ph, context) {
|
|
4047
|
-
ph.children.forEach((child) => child.visit(this));
|
|
4048
|
-
}
|
|
4049
|
-
};
|
|
4050
4051
|
function serializeMessage(messageNodes) {
|
|
4051
4052
|
const visitor = new LocalizeMessageStringVisitor();
|
|
4052
4053
|
const str = messageNodes.map((n) => n.visit(visitor)).join("");
|
|
@@ -4302,7 +4303,7 @@ function asLiteral(value) {
|
|
|
4302
4303
|
}
|
|
4303
4304
|
return literal(value, INFERRED_TYPE);
|
|
4304
4305
|
}
|
|
4305
|
-
function conditionallyCreateDirectiveBindingLiteral(map,
|
|
4306
|
+
function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
|
|
4306
4307
|
const keys = Object.getOwnPropertyNames(map);
|
|
4307
4308
|
if (keys.length === 0) {
|
|
4308
4309
|
return null;
|
|
@@ -4322,12 +4323,25 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
|
|
|
4322
4323
|
minifiedName = key;
|
|
4323
4324
|
declaredName = value.classPropertyName;
|
|
4324
4325
|
publicName = value.bindingPropertyName;
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4326
|
+
const differentDeclaringName = publicName !== declaredName;
|
|
4327
|
+
const hasDecoratorInputTransform = value.transformFunction !== null;
|
|
4328
|
+
let flags = null;
|
|
4329
|
+
if (value.isSignal) {
|
|
4330
|
+
flags = bitwiseOrInputFlagsExpr(InputFlags.SignalBased, flags);
|
|
4331
|
+
}
|
|
4332
|
+
if (hasDecoratorInputTransform) {
|
|
4333
|
+
flags = bitwiseOrInputFlagsExpr(InputFlags.HasDecoratorInputTransform, flags);
|
|
4334
|
+
}
|
|
4335
|
+
if (forInputs && (differentDeclaringName || hasDecoratorInputTransform || flags !== null)) {
|
|
4336
|
+
const flagsExpr = flags != null ? flags : importExpr(Identifiers.InputFlags).prop(InputFlags[InputFlags.None]);
|
|
4337
|
+
const result = [flagsExpr, asLiteral(publicName)];
|
|
4338
|
+
if (differentDeclaringName || hasDecoratorInputTransform) {
|
|
4339
|
+
result.push(asLiteral(declaredName));
|
|
4340
|
+
if (hasDecoratorInputTransform) {
|
|
4341
|
+
result.push(value.transformFunction);
|
|
4342
|
+
}
|
|
4329
4343
|
}
|
|
4330
|
-
expressionValue = literalArr(
|
|
4344
|
+
expressionValue = literalArr(result);
|
|
4331
4345
|
} else {
|
|
4332
4346
|
expressionValue = asLiteral(publicName);
|
|
4333
4347
|
}
|
|
@@ -4339,6 +4353,15 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
|
|
|
4339
4353
|
};
|
|
4340
4354
|
}));
|
|
4341
4355
|
}
|
|
4356
|
+
function getInputFlagExpr(flag) {
|
|
4357
|
+
return importExpr(Identifiers.InputFlags).prop(InputFlags[flag]);
|
|
4358
|
+
}
|
|
4359
|
+
function bitwiseOrInputFlagsExpr(flag, expr) {
|
|
4360
|
+
if (expr === null) {
|
|
4361
|
+
return getInputFlagExpr(flag);
|
|
4362
|
+
}
|
|
4363
|
+
return getInputFlagExpr(flag).bitwiseOr(expr);
|
|
4364
|
+
}
|
|
4342
4365
|
function trimTrailingNulls(parameters) {
|
|
4343
4366
|
while (isNull(parameters[parameters.length - 1])) {
|
|
4344
4367
|
parameters.pop();
|
|
@@ -7114,8 +7137,9 @@ var OpKind;
|
|
|
7114
7137
|
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
7115
7138
|
OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
|
|
7116
7139
|
OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
|
|
7117
|
-
OpKind2[OpKind2["
|
|
7118
|
-
OpKind2[OpKind2["
|
|
7140
|
+
OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
|
|
7141
|
+
OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
|
|
7142
|
+
OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
|
|
7119
7143
|
})(OpKind || (OpKind = {}));
|
|
7120
7144
|
var ExpressionKind;
|
|
7121
7145
|
(function(ExpressionKind2) {
|
|
@@ -7213,13 +7237,6 @@ var DeferTriggerKind;
|
|
|
7213
7237
|
DeferTriggerKind2[DeferTriggerKind2["Interaction"] = 4] = "Interaction";
|
|
7214
7238
|
DeferTriggerKind2[DeferTriggerKind2["Viewport"] = 5] = "Viewport";
|
|
7215
7239
|
})(DeferTriggerKind || (DeferTriggerKind = {}));
|
|
7216
|
-
var DerivedRepeaterVarIdentity;
|
|
7217
|
-
(function(DerivedRepeaterVarIdentity2) {
|
|
7218
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["First"] = 0] = "First";
|
|
7219
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Last"] = 1] = "Last";
|
|
7220
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Even"] = 2] = "Even";
|
|
7221
|
-
DerivedRepeaterVarIdentity2[DerivedRepeaterVarIdentity2["Odd"] = 3] = "Odd";
|
|
7222
|
-
})(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
|
|
7223
7240
|
var I18nContextKind;
|
|
7224
7241
|
(function(I18nContextKind2) {
|
|
7225
7242
|
I18nContextKind2[I18nContextKind2["RootI18n"] = 0] = "RootI18n";
|
|
@@ -7374,10 +7391,11 @@ function createClassMapOp(xref, expression, sourceSpan) {
|
|
|
7374
7391
|
sourceSpan
|
|
7375
7392
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
7376
7393
|
}
|
|
7377
|
-
function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
7394
|
+
function createAttributeOp(target, namespace, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
7378
7395
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
7379
7396
|
kind: OpKind.Attribute,
|
|
7380
7397
|
target,
|
|
7398
|
+
namespace,
|
|
7381
7399
|
name,
|
|
7382
7400
|
expression,
|
|
7383
7401
|
securityContext,
|
|
@@ -7419,15 +7437,15 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
|
7419
7437
|
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7420
7438
|
}
|
|
7421
7439
|
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
7422
|
-
return __spreadValues(__spreadValues({
|
|
7440
|
+
return __spreadValues(__spreadValues(__spreadValues({
|
|
7423
7441
|
kind: OpKind.DeferWhen,
|
|
7424
7442
|
target,
|
|
7425
7443
|
expr,
|
|
7426
7444
|
prefetch,
|
|
7427
7445
|
sourceSpan
|
|
7428
|
-
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7446
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
|
|
7429
7447
|
}
|
|
7430
|
-
function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
|
|
7448
|
+
function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
|
|
7431
7449
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
7432
7450
|
kind: OpKind.I18nExpression,
|
|
7433
7451
|
context,
|
|
@@ -7435,6 +7453,7 @@ function createI18nExpressionOp(context, target, i18nOwner, handle, expression,
|
|
|
7435
7453
|
i18nOwner,
|
|
7436
7454
|
handle,
|
|
7437
7455
|
expression,
|
|
7456
|
+
icuPlaceholder,
|
|
7438
7457
|
i18nPlaceholder,
|
|
7439
7458
|
resolutionTime,
|
|
7440
7459
|
usage,
|
|
@@ -8031,27 +8050,6 @@ var ConditionalCaseExpr = class extends ExpressionBase {
|
|
|
8031
8050
|
}
|
|
8032
8051
|
}
|
|
8033
8052
|
};
|
|
8034
|
-
var DerivedRepeaterVarExpr = class extends ExpressionBase {
|
|
8035
|
-
constructor(xref, identity) {
|
|
8036
|
-
super();
|
|
8037
|
-
this.xref = xref;
|
|
8038
|
-
this.identity = identity;
|
|
8039
|
-
this.kind = ExpressionKind.DerivedRepeaterVar;
|
|
8040
|
-
}
|
|
8041
|
-
transformInternalExpressions(transform2, flags) {
|
|
8042
|
-
}
|
|
8043
|
-
visitExpression(visitor, context) {
|
|
8044
|
-
}
|
|
8045
|
-
isEquivalent(e) {
|
|
8046
|
-
return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity && e.xref === this.xref;
|
|
8047
|
-
}
|
|
8048
|
-
isConstant() {
|
|
8049
|
-
return false;
|
|
8050
|
-
}
|
|
8051
|
-
clone() {
|
|
8052
|
-
return new DerivedRepeaterVarExpr(this.xref, this.identity);
|
|
8053
|
-
}
|
|
8054
|
-
};
|
|
8055
8053
|
var ConstCollectedExpr = class extends ExpressionBase {
|
|
8056
8054
|
constructor(expr) {
|
|
8057
8055
|
super();
|
|
@@ -8167,6 +8165,9 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8167
8165
|
if (op.placeholderConfig !== null) {
|
|
8168
8166
|
op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
|
|
8169
8167
|
}
|
|
8168
|
+
if (op.resolverFn !== null) {
|
|
8169
|
+
op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
|
|
8170
|
+
}
|
|
8170
8171
|
break;
|
|
8171
8172
|
case OpKind.I18nMessage:
|
|
8172
8173
|
for (const [placeholder, expr] of op.params) {
|
|
@@ -8203,6 +8204,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8203
8204
|
case OpKind.Template:
|
|
8204
8205
|
case OpKind.Text:
|
|
8205
8206
|
case OpKind.I18nAttributes:
|
|
8207
|
+
case OpKind.IcuPlaceholder:
|
|
8206
8208
|
break;
|
|
8207
8209
|
default:
|
|
8208
8210
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
@@ -8260,6 +8262,14 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
8260
8262
|
} else if (expr instanceof TaggedTemplateExpr) {
|
|
8261
8263
|
expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
|
|
8262
8264
|
expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
|
|
8265
|
+
} else if (expr instanceof ArrowFunctionExpr) {
|
|
8266
|
+
if (Array.isArray(expr.body)) {
|
|
8267
|
+
for (let i = 0; i < expr.body.length; i++) {
|
|
8268
|
+
transformExpressionsInStatement(expr.body[i], transform2, flags);
|
|
8269
|
+
}
|
|
8270
|
+
} else {
|
|
8271
|
+
expr.body = transformExpressionsInExpression(expr.body, transform2, flags);
|
|
8272
|
+
}
|
|
8263
8273
|
} else if (expr instanceof WrappedNodeExpr) {
|
|
8264
8274
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
8265
8275
|
} else {
|
|
@@ -8502,7 +8512,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
|
|
|
8502
8512
|
function isElementOrContainerOp(op) {
|
|
8503
8513
|
return elementContainerOpKinds.has(op.kind);
|
|
8504
8514
|
}
|
|
8505
|
-
function createElementStartOp(tag, xref, namespace, i18nPlaceholder,
|
|
8515
|
+
function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
8506
8516
|
return __spreadValues(__spreadValues({
|
|
8507
8517
|
kind: OpKind.ElementStart,
|
|
8508
8518
|
xref,
|
|
@@ -8513,10 +8523,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
|
|
|
8513
8523
|
nonBindable: false,
|
|
8514
8524
|
namespace,
|
|
8515
8525
|
i18nPlaceholder,
|
|
8516
|
-
|
|
8526
|
+
startSourceSpan,
|
|
8527
|
+
wholeSourceSpan
|
|
8517
8528
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
8518
8529
|
}
|
|
8519
|
-
function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder,
|
|
8530
|
+
function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
8520
8531
|
return __spreadValues(__spreadValues({
|
|
8521
8532
|
kind: OpKind.Template,
|
|
8522
8533
|
xref,
|
|
@@ -8531,11 +8542,12 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
|
|
|
8531
8542
|
nonBindable: false,
|
|
8532
8543
|
namespace,
|
|
8533
8544
|
i18nPlaceholder,
|
|
8534
|
-
|
|
8545
|
+
startSourceSpan,
|
|
8546
|
+
wholeSourceSpan
|
|
8535
8547
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
8536
8548
|
}
|
|
8537
|
-
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder,
|
|
8538
|
-
return __spreadProps(__spreadValues(__spreadValues({
|
|
8549
|
+
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
8550
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
8539
8551
|
kind: OpKind.RepeaterCreate,
|
|
8540
8552
|
attributes: null,
|
|
8541
8553
|
xref: primaryView,
|
|
@@ -8544,6 +8556,8 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i1
|
|
|
8544
8556
|
track,
|
|
8545
8557
|
trackByFn: null,
|
|
8546
8558
|
tag,
|
|
8559
|
+
emptyTag,
|
|
8560
|
+
emptyAttributes: null,
|
|
8547
8561
|
functionNameSuffix: "For",
|
|
8548
8562
|
namespace: Namespace.HTML,
|
|
8549
8563
|
nonBindable: false,
|
|
@@ -8554,8 +8568,9 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i1
|
|
|
8554
8568
|
usesComponentInstance: false,
|
|
8555
8569
|
i18nPlaceholder,
|
|
8556
8570
|
emptyI18nPlaceholder,
|
|
8557
|
-
|
|
8558
|
-
|
|
8571
|
+
startSourceSpan,
|
|
8572
|
+
wholeSourceSpan
|
|
8573
|
+
}, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
|
|
8559
8574
|
numSlotsUsed: emptyView === null ? 2 : 3
|
|
8560
8575
|
});
|
|
8561
8576
|
}
|
|
@@ -8578,12 +8593,13 @@ function createEnableBindingsOp(xref) {
|
|
|
8578
8593
|
xref
|
|
8579
8594
|
}, NEW_OP);
|
|
8580
8595
|
}
|
|
8581
|
-
function createTextOp(xref, initialValue, sourceSpan) {
|
|
8596
|
+
function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
|
|
8582
8597
|
return __spreadValues(__spreadValues({
|
|
8583
8598
|
kind: OpKind.Text,
|
|
8584
8599
|
xref,
|
|
8585
8600
|
handle: new SlotHandle(),
|
|
8586
8601
|
initialValue,
|
|
8602
|
+
icuPlaceholder,
|
|
8587
8603
|
sourceSpan
|
|
8588
8604
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
8589
8605
|
}
|
|
@@ -8626,7 +8642,7 @@ function createProjectionDefOp(def) {
|
|
|
8626
8642
|
def
|
|
8627
8643
|
}, NEW_OP);
|
|
8628
8644
|
}
|
|
8629
|
-
function createProjectionOp(xref, selector, i18nPlaceholder,
|
|
8645
|
+
function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
|
|
8630
8646
|
return __spreadValues(__spreadValues({
|
|
8631
8647
|
kind: OpKind.Projection,
|
|
8632
8648
|
xref,
|
|
@@ -8634,16 +8650,17 @@ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceS
|
|
|
8634
8650
|
selector,
|
|
8635
8651
|
i18nPlaceholder,
|
|
8636
8652
|
projectionSlotIndex: 0,
|
|
8637
|
-
attributes,
|
|
8653
|
+
attributes: null,
|
|
8638
8654
|
localRefs: [],
|
|
8639
8655
|
sourceSpan
|
|
8640
8656
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
8641
8657
|
}
|
|
8642
|
-
function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
8658
|
+
function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
8643
8659
|
return __spreadValues({
|
|
8644
8660
|
kind: OpKind.ExtractedAttribute,
|
|
8645
8661
|
target,
|
|
8646
8662
|
bindingKind,
|
|
8663
|
+
namespace,
|
|
8647
8664
|
name,
|
|
8648
8665
|
expression,
|
|
8649
8666
|
i18nContext,
|
|
@@ -8700,7 +8717,7 @@ function createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlace
|
|
|
8700
8717
|
subMessages: []
|
|
8701
8718
|
}, NEW_OP);
|
|
8702
8719
|
}
|
|
8703
|
-
function createI18nStartOp(xref, message, root) {
|
|
8720
|
+
function createI18nStartOp(xref, message, root, sourceSpan) {
|
|
8704
8721
|
return __spreadValues(__spreadValues({
|
|
8705
8722
|
kind: OpKind.I18nStart,
|
|
8706
8723
|
xref,
|
|
@@ -8709,13 +8726,15 @@ function createI18nStartOp(xref, message, root) {
|
|
|
8709
8726
|
message,
|
|
8710
8727
|
messageIndex: null,
|
|
8711
8728
|
subTemplateIndex: null,
|
|
8712
|
-
context: null
|
|
8729
|
+
context: null,
|
|
8730
|
+
sourceSpan
|
|
8713
8731
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
8714
8732
|
}
|
|
8715
|
-
function createI18nEndOp(xref) {
|
|
8733
|
+
function createI18nEndOp(xref, sourceSpan) {
|
|
8716
8734
|
return __spreadValues({
|
|
8717
8735
|
kind: OpKind.I18nEnd,
|
|
8718
|
-
xref
|
|
8736
|
+
xref,
|
|
8737
|
+
sourceSpan
|
|
8719
8738
|
}, NEW_OP);
|
|
8720
8739
|
}
|
|
8721
8740
|
function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
|
|
@@ -8734,6 +8753,15 @@ function createIcuEndOp(xref) {
|
|
|
8734
8753
|
xref
|
|
8735
8754
|
}, NEW_OP);
|
|
8736
8755
|
}
|
|
8756
|
+
function createIcuPlaceholderOp(xref, name, strings) {
|
|
8757
|
+
return __spreadValues({
|
|
8758
|
+
kind: OpKind.IcuPlaceholder,
|
|
8759
|
+
xref,
|
|
8760
|
+
name,
|
|
8761
|
+
strings,
|
|
8762
|
+
expressionPlaceholders: []
|
|
8763
|
+
}, NEW_OP);
|
|
8764
|
+
}
|
|
8737
8765
|
function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
|
|
8738
8766
|
if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
|
|
8739
8767
|
throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
|
|
@@ -8997,6 +9025,9 @@ function createOpXrefMap(unit) {
|
|
|
8997
9025
|
continue;
|
|
8998
9026
|
}
|
|
8999
9027
|
map.set(op.xref, op);
|
|
9028
|
+
if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
|
|
9029
|
+
map.set(op.emptyView, op);
|
|
9030
|
+
}
|
|
9000
9031
|
}
|
|
9001
9032
|
return map;
|
|
9002
9033
|
}
|
|
@@ -9024,6 +9055,7 @@ function extractAttributes(job) {
|
|
|
9024
9055
|
createExtractedAttributeOp(
|
|
9025
9056
|
op.target,
|
|
9026
9057
|
bindingKind,
|
|
9058
|
+
null,
|
|
9027
9059
|
op.name,
|
|
9028
9060
|
null,
|
|
9029
9061
|
null,
|
|
@@ -9040,6 +9072,7 @@ function extractAttributes(job) {
|
|
|
9040
9072
|
OpList.insertBefore(createExtractedAttributeOp(
|
|
9041
9073
|
op.target,
|
|
9042
9074
|
BindingKind.Property,
|
|
9075
|
+
null,
|
|
9043
9076
|
op.name,
|
|
9044
9077
|
null,
|
|
9045
9078
|
null,
|
|
@@ -9053,6 +9086,7 @@ function extractAttributes(job) {
|
|
|
9053
9086
|
const extractedAttributeOp = createExtractedAttributeOp(
|
|
9054
9087
|
op.target,
|
|
9055
9088
|
BindingKind.Property,
|
|
9089
|
+
null,
|
|
9056
9090
|
op.name,
|
|
9057
9091
|
null,
|
|
9058
9092
|
null,
|
|
@@ -9060,6 +9094,9 @@ function extractAttributes(job) {
|
|
|
9060
9094
|
SecurityContext.NONE
|
|
9061
9095
|
);
|
|
9062
9096
|
if (job.kind === CompilationJobKind.Host) {
|
|
9097
|
+
if (job.compatibility) {
|
|
9098
|
+
break;
|
|
9099
|
+
}
|
|
9063
9100
|
unit.create.push(extractedAttributeOp);
|
|
9064
9101
|
} else {
|
|
9065
9102
|
OpList.insertBefore(extractedAttributeOp, lookupElement(elements, op.target));
|
|
@@ -9081,18 +9118,12 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
9081
9118
|
if (op.expression instanceof Interpolation2) {
|
|
9082
9119
|
return;
|
|
9083
9120
|
}
|
|
9084
|
-
let extractable = op.expression.isConstant();
|
|
9121
|
+
let extractable = op.isTextAttribute || op.expression.isConstant();
|
|
9085
9122
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
9086
|
-
extractable =
|
|
9087
|
-
if (op.name === "style" || op.name === "class") {
|
|
9088
|
-
extractable && (extractable = op.isTextAttribute);
|
|
9089
|
-
}
|
|
9090
|
-
if (unit.job.kind === CompilationJobKind.Host) {
|
|
9091
|
-
extractable && (extractable = op.isTextAttribute);
|
|
9092
|
-
}
|
|
9123
|
+
extractable && (extractable = op.isTextAttribute);
|
|
9093
9124
|
}
|
|
9094
9125
|
if (extractable) {
|
|
9095
|
-
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
9126
|
+
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
9096
9127
|
if (unit.job.kind === CompilationJobKind.Host) {
|
|
9097
9128
|
unit.create.push(extractedAttributeOp);
|
|
9098
9129
|
} else {
|
|
@@ -9133,7 +9164,8 @@ function specializeBindings(job) {
|
|
|
9133
9164
|
const target = lookupElement2(elements, op.target);
|
|
9134
9165
|
target.nonBindable = true;
|
|
9135
9166
|
} else {
|
|
9136
|
-
|
|
9167
|
+
const [namespace, name] = splitNsName(op.name);
|
|
9168
|
+
OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
9137
9169
|
}
|
|
9138
9170
|
break;
|
|
9139
9171
|
case BindingKind.Property:
|
|
@@ -9273,6 +9305,7 @@ var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
|
9273
9305
|
["&&", BinaryOperator.And],
|
|
9274
9306
|
[">", BinaryOperator.Bigger],
|
|
9275
9307
|
[">=", BinaryOperator.BiggerEquals],
|
|
9308
|
+
["|", BinaryOperator.BitwiseOr],
|
|
9276
9309
|
["&", BinaryOperator.BitwiseAnd],
|
|
9277
9310
|
["/", BinaryOperator.Divide],
|
|
9278
9311
|
["==", BinaryOperator.Equals],
|
|
@@ -9324,9 +9357,9 @@ function collectElementConsts(job) {
|
|
|
9324
9357
|
for (const unit of job.units) {
|
|
9325
9358
|
for (const op of unit.create) {
|
|
9326
9359
|
if (op.kind === OpKind.ExtractedAttribute) {
|
|
9327
|
-
const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
|
|
9360
|
+
const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
|
|
9328
9361
|
allElementAttributes.set(op.target, attributes);
|
|
9329
|
-
attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
|
|
9362
|
+
attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);
|
|
9330
9363
|
OpList.remove(op);
|
|
9331
9364
|
}
|
|
9332
9365
|
}
|
|
@@ -9334,14 +9367,19 @@ function collectElementConsts(job) {
|
|
|
9334
9367
|
if (job instanceof ComponentCompilationJob) {
|
|
9335
9368
|
for (const unit of job.units) {
|
|
9336
9369
|
for (const op of unit.create) {
|
|
9337
|
-
if (
|
|
9370
|
+
if (op.kind == OpKind.Projection) {
|
|
9338
9371
|
const attributes = allElementAttributes.get(op.xref);
|
|
9339
9372
|
if (attributes !== void 0) {
|
|
9340
9373
|
const attrArray = serializeAttributes(attributes);
|
|
9341
9374
|
if (attrArray.entries.length > 0) {
|
|
9342
|
-
op.attributes =
|
|
9375
|
+
op.attributes = attrArray;
|
|
9343
9376
|
}
|
|
9344
9377
|
}
|
|
9378
|
+
} else if (isElementOrContainerOp(op)) {
|
|
9379
|
+
op.attributes = getConstIndex(job, allElementAttributes, op.xref);
|
|
9380
|
+
if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
|
|
9381
|
+
op.emptyAttributes = getConstIndex(job, allElementAttributes, op.emptyView);
|
|
9382
|
+
}
|
|
9345
9383
|
}
|
|
9346
9384
|
}
|
|
9347
9385
|
}
|
|
@@ -9357,13 +9395,18 @@ function collectElementConsts(job) {
|
|
|
9357
9395
|
}
|
|
9358
9396
|
}
|
|
9359
9397
|
}
|
|
9398
|
+
function getConstIndex(job, allElementAttributes, xref) {
|
|
9399
|
+
const attributes = allElementAttributes.get(xref);
|
|
9400
|
+
if (attributes !== void 0) {
|
|
9401
|
+
const attrArray = serializeAttributes(attributes);
|
|
9402
|
+
if (attrArray.entries.length > 0) {
|
|
9403
|
+
return job.addConst(attrArray);
|
|
9404
|
+
}
|
|
9405
|
+
}
|
|
9406
|
+
return null;
|
|
9407
|
+
}
|
|
9360
9408
|
var FLYWEIGHT_ARRAY = Object.freeze([]);
|
|
9361
9409
|
var ElementAttributes = class {
|
|
9362
|
-
constructor() {
|
|
9363
|
-
this.known = /* @__PURE__ */ new Set();
|
|
9364
|
-
this.byKind = /* @__PURE__ */ new Map();
|
|
9365
|
-
this.projectAs = null;
|
|
9366
|
-
}
|
|
9367
9410
|
get attributes() {
|
|
9368
9411
|
var _a2;
|
|
9369
9412
|
return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
@@ -9388,12 +9431,28 @@ var ElementAttributes = class {
|
|
|
9388
9431
|
var _a2;
|
|
9389
9432
|
return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
9390
9433
|
}
|
|
9391
|
-
|
|
9434
|
+
constructor(compatibility) {
|
|
9435
|
+
this.compatibility = compatibility;
|
|
9436
|
+
this.known = /* @__PURE__ */ new Map();
|
|
9437
|
+
this.byKind = /* @__PURE__ */ new Map();
|
|
9438
|
+
this.projectAs = null;
|
|
9439
|
+
}
|
|
9440
|
+
isKnown(kind, name, value) {
|
|
9392
9441
|
var _a2;
|
|
9393
|
-
|
|
9442
|
+
const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
|
|
9443
|
+
this.known.set(kind, nameToValue);
|
|
9444
|
+
if (nameToValue.has(name)) {
|
|
9445
|
+
return true;
|
|
9446
|
+
}
|
|
9447
|
+
nameToValue.add(name);
|
|
9448
|
+
return false;
|
|
9449
|
+
}
|
|
9450
|
+
add(kind, name, value, namespace, trustedValueFn) {
|
|
9451
|
+
var _a2;
|
|
9452
|
+
const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
|
|
9453
|
+
if (!allowDuplicates && this.isKnown(kind, name, value)) {
|
|
9394
9454
|
return;
|
|
9395
9455
|
}
|
|
9396
|
-
this.known.add(name);
|
|
9397
9456
|
if (name === "ngProjectAs") {
|
|
9398
9457
|
if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
|
|
9399
9458
|
throw Error("ngProjectAs must have a string literal value");
|
|
@@ -9401,7 +9460,7 @@ var ElementAttributes = class {
|
|
|
9401
9460
|
this.projectAs = value.value.toString();
|
|
9402
9461
|
}
|
|
9403
9462
|
const array = this.arrayFor(kind);
|
|
9404
|
-
array.push(...getAttributeNameLiterals(name));
|
|
9463
|
+
array.push(...getAttributeNameLiterals(namespace, name));
|
|
9405
9464
|
if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
|
|
9406
9465
|
if (value === null) {
|
|
9407
9466
|
throw Error("Attribute, i18n attribute, & style element attributes must have a value");
|
|
@@ -9423,15 +9482,10 @@ var ElementAttributes = class {
|
|
|
9423
9482
|
return this.byKind.get(kind);
|
|
9424
9483
|
}
|
|
9425
9484
|
};
|
|
9426
|
-
function getAttributeNameLiterals(name) {
|
|
9427
|
-
const
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
return [
|
|
9431
|
-
literal(0),
|
|
9432
|
-
literal(attributeNamespace),
|
|
9433
|
-
nameLiteral
|
|
9434
|
-
];
|
|
9485
|
+
function getAttributeNameLiterals(namespace, name) {
|
|
9486
|
+
const nameLiteral = literal(name);
|
|
9487
|
+
if (namespace) {
|
|
9488
|
+
return [literal(0), literal(namespace), nameLiteral];
|
|
9435
9489
|
}
|
|
9436
9490
|
return [nameLiteral];
|
|
9437
9491
|
}
|
|
@@ -9491,7 +9545,7 @@ function convertI18nBindings(job) {
|
|
|
9491
9545
|
if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
|
|
9492
9546
|
throw new Error(`AssertionError: An i18n attribute binding instruction requires the same number of expressions and placeholders, but found ${op.expression.i18nPlaceholders.length} placeholders and ${op.expression.expressions.length} expressions`);
|
|
9493
9547
|
}
|
|
9494
|
-
ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
|
|
9548
|
+
ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, null, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
|
|
9495
9549
|
}
|
|
9496
9550
|
OpList.replaceWithMany(op, ops);
|
|
9497
9551
|
break;
|
|
@@ -9522,7 +9576,11 @@ function createDeferDepsFns(job) {
|
|
|
9522
9576
|
if (op.handle.slot === null) {
|
|
9523
9577
|
throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
|
|
9524
9578
|
}
|
|
9525
|
-
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
9579
|
+
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
9580
|
+
depsFnExpr,
|
|
9581
|
+
`${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
|
|
9582
|
+
false
|
|
9583
|
+
);
|
|
9526
9584
|
}
|
|
9527
9585
|
}
|
|
9528
9586
|
}
|
|
@@ -9530,62 +9588,99 @@ function createDeferDepsFns(job) {
|
|
|
9530
9588
|
|
|
9531
9589
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
|
|
9532
9590
|
function createI18nContexts(job) {
|
|
9533
|
-
const
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9591
|
+
const attrContextByMessage = /* @__PURE__ */ new Map();
|
|
9592
|
+
for (const unit of job.units) {
|
|
9593
|
+
for (const op of unit.ops()) {
|
|
9594
|
+
switch (op.kind) {
|
|
9595
|
+
case OpKind.Binding:
|
|
9596
|
+
case OpKind.Property:
|
|
9597
|
+
case OpKind.Attribute:
|
|
9598
|
+
case OpKind.ExtractedAttribute:
|
|
9599
|
+
if (op.i18nMessage === null) {
|
|
9600
|
+
continue;
|
|
9601
|
+
}
|
|
9602
|
+
if (!attrContextByMessage.has(op.i18nMessage)) {
|
|
9603
|
+
const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
|
|
9604
|
+
unit.create.push(i18nContext);
|
|
9605
|
+
attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
|
|
9606
|
+
}
|
|
9607
|
+
op.i18nContext = attrContextByMessage.get(op.i18nMessage);
|
|
9608
|
+
break;
|
|
9609
|
+
}
|
|
9610
|
+
}
|
|
9611
|
+
}
|
|
9612
|
+
const blockContextByI18nBlock = /* @__PURE__ */ new Map();
|
|
9537
9613
|
for (const unit of job.units) {
|
|
9538
9614
|
for (const op of unit.create) {
|
|
9539
9615
|
switch (op.kind) {
|
|
9540
9616
|
case OpKind.I18nStart:
|
|
9541
|
-
currentI18nOp = op;
|
|
9542
9617
|
if (op.xref === op.root) {
|
|
9543
|
-
|
|
9544
|
-
unit.create.push(
|
|
9545
|
-
op.context = xref;
|
|
9546
|
-
|
|
9618
|
+
const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
|
|
9619
|
+
unit.create.push(contextOp);
|
|
9620
|
+
op.context = contextOp.xref;
|
|
9621
|
+
blockContextByI18nBlock.set(op.xref, contextOp);
|
|
9547
9622
|
}
|
|
9548
9623
|
break;
|
|
9624
|
+
}
|
|
9625
|
+
}
|
|
9626
|
+
}
|
|
9627
|
+
for (const unit of job.units) {
|
|
9628
|
+
for (const op of unit.create) {
|
|
9629
|
+
if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
|
|
9630
|
+
const rootContext = blockContextByI18nBlock.get(op.root);
|
|
9631
|
+
if (rootContext === void 0) {
|
|
9632
|
+
throw Error("AssertionError: Root i18n block i18n context should have been created.");
|
|
9633
|
+
}
|
|
9634
|
+
op.context = rootContext.xref;
|
|
9635
|
+
blockContextByI18nBlock.set(op.xref, rootContext);
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
}
|
|
9639
|
+
let currentI18nOp = null;
|
|
9640
|
+
for (const unit of job.units) {
|
|
9641
|
+
for (const op of unit.create) {
|
|
9642
|
+
switch (op.kind) {
|
|
9643
|
+
case OpKind.I18nStart:
|
|
9644
|
+
currentI18nOp = op;
|
|
9645
|
+
break;
|
|
9549
9646
|
case OpKind.I18nEnd:
|
|
9550
9647
|
currentI18nOp = null;
|
|
9551
9648
|
break;
|
|
9552
9649
|
case OpKind.IcuStart:
|
|
9553
9650
|
if (currentI18nOp === null) {
|
|
9554
|
-
throw Error("Unexpected ICU outside of an i18n block.");
|
|
9651
|
+
throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
|
|
9555
9652
|
}
|
|
9556
9653
|
if (op.message.id !== currentI18nOp.message.id) {
|
|
9557
|
-
|
|
9558
|
-
unit.create.push(
|
|
9559
|
-
op.context = xref;
|
|
9654
|
+
const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
|
|
9655
|
+
unit.create.push(contextOp);
|
|
9656
|
+
op.context = contextOp.xref;
|
|
9560
9657
|
} else {
|
|
9561
9658
|
op.context = currentI18nOp.context;
|
|
9659
|
+
blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
|
|
9562
9660
|
}
|
|
9563
9661
|
break;
|
|
9564
9662
|
}
|
|
9565
9663
|
}
|
|
9566
|
-
for (const op of unit.ops()) {
|
|
9567
|
-
switch (op.kind) {
|
|
9568
|
-
case OpKind.Binding:
|
|
9569
|
-
case OpKind.Property:
|
|
9570
|
-
case OpKind.Attribute:
|
|
9571
|
-
case OpKind.ExtractedAttribute:
|
|
9572
|
-
if (!op.i18nMessage) {
|
|
9573
|
-
continue;
|
|
9574
|
-
}
|
|
9575
|
-
if (!messageToContext.has(op.i18nMessage)) {
|
|
9576
|
-
const i18nContext = job.allocateXrefId();
|
|
9577
|
-
unit.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, op.i18nMessage, null));
|
|
9578
|
-
messageToContext.set(op.i18nMessage, i18nContext);
|
|
9579
|
-
}
|
|
9580
|
-
op.i18nContext = messageToContext.get(op.i18nMessage);
|
|
9581
|
-
break;
|
|
9582
|
-
}
|
|
9583
|
-
}
|
|
9584
9664
|
}
|
|
9665
|
+
}
|
|
9666
|
+
|
|
9667
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/deduplicate_text_bindings.mjs
|
|
9668
|
+
function deduplicateTextBindings(job) {
|
|
9669
|
+
const seen = /* @__PURE__ */ new Map();
|
|
9585
9670
|
for (const unit of job.units) {
|
|
9586
|
-
for (const op of unit.
|
|
9587
|
-
if (op.kind === OpKind.
|
|
9588
|
-
|
|
9671
|
+
for (const op of unit.update.reversed()) {
|
|
9672
|
+
if (op.kind === OpKind.Binding && op.isTextAttribute) {
|
|
9673
|
+
const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
|
|
9674
|
+
if (seenForElement.has(op.name)) {
|
|
9675
|
+
if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
9676
|
+
if (op.name === "style" || op.name === "class") {
|
|
9677
|
+
OpList.remove(op);
|
|
9678
|
+
}
|
|
9679
|
+
} else {
|
|
9680
|
+
}
|
|
9681
|
+
}
|
|
9682
|
+
seenForElement.add(op.name);
|
|
9683
|
+
seen.set(op.target, seenForElement);
|
|
9589
9684
|
}
|
|
9590
9685
|
}
|
|
9591
9686
|
}
|
|
@@ -9875,12 +9970,16 @@ var LIST_START_MARKER = "[";
|
|
|
9875
9970
|
var LIST_END_MARKER = "]";
|
|
9876
9971
|
var LIST_DELIMITER = "|";
|
|
9877
9972
|
function extractI18nMessages(job) {
|
|
9878
|
-
const
|
|
9973
|
+
const i18nMessagesByContext = /* @__PURE__ */ new Map();
|
|
9879
9974
|
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
9975
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9880
9976
|
for (const unit of job.units) {
|
|
9881
9977
|
for (const op of unit.create) {
|
|
9882
9978
|
switch (op.kind) {
|
|
9883
9979
|
case OpKind.I18nContext:
|
|
9980
|
+
const i18nMessageOp = createI18nMessage(job, op);
|
|
9981
|
+
unit.create.push(i18nMessageOp);
|
|
9982
|
+
i18nMessagesByContext.set(op.xref, i18nMessageOp);
|
|
9884
9983
|
i18nContexts.set(op.xref, op);
|
|
9885
9984
|
break;
|
|
9886
9985
|
case OpKind.I18nStart:
|
|
@@ -9889,49 +9988,40 @@ function extractI18nMessages(job) {
|
|
|
9889
9988
|
}
|
|
9890
9989
|
}
|
|
9891
9990
|
}
|
|
9892
|
-
|
|
9893
|
-
for (const op of unit.create) {
|
|
9894
|
-
if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
|
|
9895
|
-
continue;
|
|
9896
|
-
}
|
|
9897
|
-
const i18nMessageOp = createI18nMessage(job, op);
|
|
9898
|
-
unit.create.push(i18nMessageOp);
|
|
9899
|
-
}
|
|
9900
|
-
}
|
|
9901
|
-
const i18nBlockMessages = /* @__PURE__ */ new Map();
|
|
9902
|
-
for (const unit of job.units) {
|
|
9903
|
-
for (const op of unit.create) {
|
|
9904
|
-
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
9905
|
-
if (!op.context) {
|
|
9906
|
-
throw Error("I18n start op should have its context set.");
|
|
9907
|
-
}
|
|
9908
|
-
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
9909
|
-
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
9910
|
-
unit.create.push(i18nMessageOp);
|
|
9911
|
-
}
|
|
9912
|
-
}
|
|
9913
|
-
}
|
|
9991
|
+
let currentIcu = null;
|
|
9914
9992
|
for (const unit of job.units) {
|
|
9915
9993
|
for (const op of unit.create) {
|
|
9916
9994
|
switch (op.kind) {
|
|
9917
9995
|
case OpKind.IcuStart:
|
|
9918
|
-
|
|
9919
|
-
|
|
9996
|
+
currentIcu = op;
|
|
9997
|
+
OpList.remove(op);
|
|
9998
|
+
const icuContext = i18nContexts.get(op.context);
|
|
9999
|
+
if (icuContext.contextKind !== I18nContextKind.Icu) {
|
|
10000
|
+
continue;
|
|
9920
10001
|
}
|
|
9921
|
-
const
|
|
9922
|
-
if (
|
|
9923
|
-
|
|
9924
|
-
throw Error("ICU context should have its i18n block set.");
|
|
9925
|
-
}
|
|
9926
|
-
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
9927
|
-
unit.create.push(subMessage);
|
|
9928
|
-
const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
|
|
9929
|
-
const parentMessage = i18nBlockMessages.get(rootI18nId);
|
|
9930
|
-
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
10002
|
+
const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
|
|
10003
|
+
if (i18nBlock.context === icuContext.xref) {
|
|
10004
|
+
continue;
|
|
9931
10005
|
}
|
|
9932
|
-
|
|
10006
|
+
const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
|
|
10007
|
+
const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
|
|
10008
|
+
if (rootMessage === void 0) {
|
|
10009
|
+
throw Error("AssertionError: ICU sub-message should belong to a root message.");
|
|
10010
|
+
}
|
|
10011
|
+
const subMessage = i18nMessagesByContext.get(icuContext.xref);
|
|
10012
|
+
subMessage.messagePlaceholder = op.messagePlaceholder;
|
|
10013
|
+
rootMessage.subMessages.push(subMessage.xref);
|
|
9933
10014
|
break;
|
|
9934
10015
|
case OpKind.IcuEnd:
|
|
10016
|
+
currentIcu = null;
|
|
10017
|
+
OpList.remove(op);
|
|
10018
|
+
break;
|
|
10019
|
+
case OpKind.IcuPlaceholder:
|
|
10020
|
+
if (currentIcu === null || currentIcu.context == null) {
|
|
10021
|
+
throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
|
|
10022
|
+
}
|
|
10023
|
+
const msg = i18nMessagesByContext.get(currentIcu.context);
|
|
10024
|
+
msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
|
|
9935
10025
|
OpList.remove(op);
|
|
9936
10026
|
break;
|
|
9937
10027
|
}
|
|
@@ -9941,14 +10031,16 @@ function extractI18nMessages(job) {
|
|
|
9941
10031
|
function createI18nMessage(job, context, messagePlaceholder) {
|
|
9942
10032
|
let formattedParams = formatParams(context.params);
|
|
9943
10033
|
const formattedPostprocessingParams = formatParams(context.postprocessingParams);
|
|
9944
|
-
let needsPostprocessing =
|
|
9945
|
-
for (const values of context.params.values()) {
|
|
9946
|
-
if (values.length > 1) {
|
|
9947
|
-
needsPostprocessing = true;
|
|
9948
|
-
}
|
|
9949
|
-
}
|
|
10034
|
+
let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
|
|
9950
10035
|
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
9951
10036
|
}
|
|
10037
|
+
function formatIcuPlaceholder(op) {
|
|
10038
|
+
if (op.strings.length !== op.expressionPlaceholders.length + 1) {
|
|
10039
|
+
throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
|
|
10040
|
+
}
|
|
10041
|
+
const values = op.expressionPlaceholders.map(formatValue);
|
|
10042
|
+
return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
|
|
10043
|
+
}
|
|
9952
10044
|
function formatParams(params) {
|
|
9953
10045
|
const formattedParams = /* @__PURE__ */ new Map();
|
|
9954
10046
|
for (const [placeholder, placeholderValues] of params) {
|
|
@@ -10175,7 +10267,7 @@ var CLASS_BANG = "class!";
|
|
|
10175
10267
|
var BANG_IMPORTANT = "!important";
|
|
10176
10268
|
function parseHostStyleProperties(job) {
|
|
10177
10269
|
for (const op of job.root.update) {
|
|
10178
|
-
if (op.kind
|
|
10270
|
+
if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
|
|
10179
10271
|
continue;
|
|
10180
10272
|
}
|
|
10181
10273
|
if (op.name.endsWith(BANG_IMPORTANT)) {
|
|
@@ -10184,7 +10276,7 @@ function parseHostStyleProperties(job) {
|
|
|
10184
10276
|
if (op.name.startsWith(STYLE_DOT)) {
|
|
10185
10277
|
op.bindingKind = BindingKind.StyleProperty;
|
|
10186
10278
|
op.name = op.name.substring(STYLE_DOT.length);
|
|
10187
|
-
if (isCssCustomProperty(op.name)) {
|
|
10279
|
+
if (!isCssCustomProperty(op.name)) {
|
|
10188
10280
|
op.name = hyphenate(op.name);
|
|
10189
10281
|
}
|
|
10190
10282
|
const { property: property2, suffix } = parseProperty(op.name);
|
|
@@ -16317,7 +16409,7 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
|
16317
16409
|
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
16318
16410
|
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
16319
16411
|
let transformFn = void 0;
|
|
16320
|
-
if (messageOp.needsPostprocessing) {
|
|
16412
|
+
if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
|
|
16321
16413
|
const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
|
|
16322
16414
|
const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
|
|
16323
16415
|
const extraTransformFnParams = [];
|
|
@@ -16336,7 +16428,6 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
|
|
|
16336
16428
|
} else {
|
|
16337
16429
|
messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
|
|
16338
16430
|
messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
|
|
16339
|
-
messageOp.needsPostprocessing = true;
|
|
16340
16431
|
}
|
|
16341
16432
|
}
|
|
16342
16433
|
}
|
|
@@ -16370,12 +16461,13 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
16370
16461
|
|
|
16371
16462
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
|
|
16372
16463
|
function convertI18nText(job) {
|
|
16373
|
-
var _a2;
|
|
16464
|
+
var _a2, _b2, _c2;
|
|
16374
16465
|
for (const unit of job.units) {
|
|
16375
16466
|
let currentI18n = null;
|
|
16376
16467
|
let currentIcu = null;
|
|
16377
16468
|
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
16378
16469
|
const textNodeIcus = /* @__PURE__ */ new Map();
|
|
16470
|
+
const icuPlaceholderByText = /* @__PURE__ */ new Map();
|
|
16379
16471
|
for (const op of unit.create) {
|
|
16380
16472
|
switch (op.kind) {
|
|
16381
16473
|
case OpKind.I18nStart:
|
|
@@ -16400,7 +16492,13 @@ function convertI18nText(job) {
|
|
|
16400
16492
|
if (currentI18n !== null) {
|
|
16401
16493
|
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
16402
16494
|
textNodeIcus.set(op.xref, currentIcu);
|
|
16403
|
-
|
|
16495
|
+
if (op.icuPlaceholder !== null) {
|
|
16496
|
+
const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
|
|
16497
|
+
OpList.replace(op, icuPlaceholderOp);
|
|
16498
|
+
icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
|
|
16499
|
+
} else {
|
|
16500
|
+
OpList.remove(op);
|
|
16501
|
+
}
|
|
16404
16502
|
}
|
|
16405
16503
|
break;
|
|
16406
16504
|
}
|
|
@@ -16413,14 +16511,18 @@ function convertI18nText(job) {
|
|
|
16413
16511
|
}
|
|
16414
16512
|
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
16415
16513
|
const icuOp = textNodeIcus.get(op.target);
|
|
16514
|
+
const icuPlaceholder = icuPlaceholderByText.get(op.target);
|
|
16416
16515
|
const contextId = icuOp ? icuOp.context : i18nOp.context;
|
|
16417
16516
|
const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
|
|
16418
16517
|
const ops = [];
|
|
16419
16518
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
16420
16519
|
const expr = op.interpolation.expressions[i];
|
|
16421
|
-
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, op.interpolation.i18nPlaceholders[i], resolutionTime, I18nExpressionFor.I18nText, "", (
|
|
16520
|
+
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, (_a2 = icuPlaceholder == null ? void 0 : icuPlaceholder.xref) != null ? _a2 : null, (_b2 = op.interpolation.i18nPlaceholders[i]) != null ? _b2 : null, resolutionTime, I18nExpressionFor.I18nText, "", (_c2 = expr.sourceSpan) != null ? _c2 : op.sourceSpan));
|
|
16422
16521
|
}
|
|
16423
16522
|
OpList.replaceWithMany(op, ops);
|
|
16523
|
+
if (icuPlaceholder !== void 0) {
|
|
16524
|
+
icuPlaceholder.strings = op.interpolation.strings;
|
|
16525
|
+
}
|
|
16424
16526
|
break;
|
|
16425
16527
|
}
|
|
16426
16528
|
}
|
|
@@ -16571,7 +16673,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
16571
16673
|
op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
|
|
16572
16674
|
break;
|
|
16573
16675
|
case OpKind.Variable:
|
|
16574
|
-
varNames.set(op.xref, getVariableName(op.variable, state));
|
|
16676
|
+
varNames.set(op.xref, getVariableName(unit, op.variable, state));
|
|
16575
16677
|
break;
|
|
16576
16678
|
case OpKind.RepeaterCreate:
|
|
16577
16679
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
@@ -16622,14 +16724,19 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
16622
16724
|
});
|
|
16623
16725
|
}
|
|
16624
16726
|
}
|
|
16625
|
-
function getVariableName(variable2, state) {
|
|
16727
|
+
function getVariableName(unit, variable2, state) {
|
|
16626
16728
|
if (variable2.name === null) {
|
|
16627
16729
|
switch (variable2.kind) {
|
|
16628
16730
|
case SemanticVariableKind.Context:
|
|
16629
16731
|
variable2.name = `ctx_r${state.index++}`;
|
|
16630
16732
|
break;
|
|
16631
16733
|
case SemanticVariableKind.Identifier:
|
|
16632
|
-
|
|
16734
|
+
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
16735
|
+
const compatPrefix = variable2.identifier === "ctx" ? "i" : "";
|
|
16736
|
+
variable2.name = `${variable2.identifier}_${compatPrefix}r${++state.index}`;
|
|
16737
|
+
} else {
|
|
16738
|
+
variable2.name = `${variable2.identifier}_i${state.index++}`;
|
|
16739
|
+
}
|
|
16633
16740
|
break;
|
|
16634
16741
|
default:
|
|
16635
16742
|
variable2.name = `_r${++state.index}`;
|
|
@@ -16772,17 +16879,24 @@ var CREATE_ORDERING = [
|
|
|
16772
16879
|
{ test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
|
|
16773
16880
|
];
|
|
16774
16881
|
var UPDATE_ORDERING = [
|
|
16775
|
-
{ test: kindWithInterpolationTest(OpKind.HostProperty, true) },
|
|
16776
|
-
{ test: kindWithInterpolationTest(OpKind.HostProperty, false) },
|
|
16777
16882
|
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
16778
16883
|
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
16779
16884
|
{ test: kindTest(OpKind.StyleProp) },
|
|
16780
16885
|
{ test: kindTest(OpKind.ClassProp) },
|
|
16781
|
-
{ test: kindWithInterpolationTest(OpKind.Property, true) },
|
|
16782
16886
|
{ test: kindWithInterpolationTest(OpKind.Attribute, true) },
|
|
16887
|
+
{ test: kindWithInterpolationTest(OpKind.Property, true) },
|
|
16783
16888
|
{ test: kindWithInterpolationTest(OpKind.Property, false) },
|
|
16784
16889
|
{ test: kindWithInterpolationTest(OpKind.Attribute, false) }
|
|
16785
16890
|
];
|
|
16891
|
+
var UPDATE_HOST_ORDERING = [
|
|
16892
|
+
{ test: kindWithInterpolationTest(OpKind.HostProperty, true) },
|
|
16893
|
+
{ test: kindWithInterpolationTest(OpKind.HostProperty, false) },
|
|
16894
|
+
{ test: kindTest(OpKind.Attribute) },
|
|
16895
|
+
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
16896
|
+
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
16897
|
+
{ test: kindTest(OpKind.StyleProp) },
|
|
16898
|
+
{ test: kindTest(OpKind.ClassProp) }
|
|
16899
|
+
];
|
|
16786
16900
|
var handledOpKinds = /* @__PURE__ */ new Set([
|
|
16787
16901
|
OpKind.Listener,
|
|
16788
16902
|
OpKind.StyleMap,
|
|
@@ -16796,7 +16910,8 @@ var handledOpKinds = /* @__PURE__ */ new Set([
|
|
|
16796
16910
|
function orderOps(job) {
|
|
16797
16911
|
for (const unit of job.units) {
|
|
16798
16912
|
orderWithin(unit.create, CREATE_ORDERING);
|
|
16799
|
-
|
|
16913
|
+
const ordering = unit.job.kind === CompilationJobKind.Host ? UPDATE_HOST_ORDERING : UPDATE_ORDERING;
|
|
16914
|
+
orderWithin(unit.update, ordering);
|
|
16800
16915
|
}
|
|
16801
16916
|
}
|
|
16802
16917
|
function orderWithin(opList, ordering) {
|
|
@@ -16834,19 +16949,31 @@ function keepLast(ops) {
|
|
|
16834
16949
|
|
|
16835
16950
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/parse_extracted_styles.mjs
|
|
16836
16951
|
function parseExtractedStyles(job) {
|
|
16952
|
+
const elements = /* @__PURE__ */ new Map();
|
|
16953
|
+
for (const unit of job.units) {
|
|
16954
|
+
for (const op of unit.create) {
|
|
16955
|
+
if (isElementOrContainerOp(op)) {
|
|
16956
|
+
elements.set(op.xref, op);
|
|
16957
|
+
}
|
|
16958
|
+
}
|
|
16959
|
+
}
|
|
16837
16960
|
for (const unit of job.units) {
|
|
16838
16961
|
for (const op of unit.create) {
|
|
16839
16962
|
if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
|
|
16963
|
+
const target = elements.get(op.target);
|
|
16964
|
+
if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
|
|
16965
|
+
continue;
|
|
16966
|
+
}
|
|
16840
16967
|
if (op.name === "style") {
|
|
16841
16968
|
const parsedStyles = parse(op.expression.value);
|
|
16842
16969
|
for (let i = 0; i < parsedStyles.length - 1; i += 2) {
|
|
16843
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
16970
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
16844
16971
|
}
|
|
16845
16972
|
OpList.remove(op);
|
|
16846
16973
|
} else if (op.name === "class") {
|
|
16847
16974
|
const parsedClasses = op.expression.value.trim().split(/\s+/g);
|
|
16848
16975
|
for (const parsedClass of parsedClasses) {
|
|
16849
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
16976
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, null, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
16850
16977
|
}
|
|
16851
16978
|
OpList.remove(op);
|
|
16852
16979
|
}
|
|
@@ -16867,13 +16994,6 @@ function removeContentSelectors(job) {
|
|
|
16867
16994
|
OpList.remove(op);
|
|
16868
16995
|
}
|
|
16869
16996
|
break;
|
|
16870
|
-
case OpKind.Projection:
|
|
16871
|
-
for (let i = op.attributes.length - 2; i >= 0; i -= 2) {
|
|
16872
|
-
if (isSelectAttribute(op.attributes[i])) {
|
|
16873
|
-
op.attributes.splice(i, 2);
|
|
16874
|
-
}
|
|
16875
|
-
}
|
|
16876
|
-
break;
|
|
16877
16997
|
}
|
|
16878
16998
|
}
|
|
16879
16999
|
}
|
|
@@ -17000,8 +17120,11 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
17000
17120
|
var _a2;
|
|
17001
17121
|
if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
|
|
17002
17122
|
const id = unit.job.allocateXrefId();
|
|
17003
|
-
OpList.insertAfter(
|
|
17004
|
-
|
|
17123
|
+
OpList.insertAfter(
|
|
17124
|
+
createI18nStartOp(id, parentI18n.message, parentI18n.root, null),
|
|
17125
|
+
unit.create.head
|
|
17126
|
+
);
|
|
17127
|
+
OpList.insertBefore(createI18nEndOp(id, null), unit.create.tail);
|
|
17005
17128
|
}
|
|
17006
17129
|
}
|
|
17007
17130
|
|
|
@@ -17176,9 +17299,7 @@ function namespaceMath() {
|
|
|
17176
17299
|
return call(Identifiers.namespaceMathML, [], null);
|
|
17177
17300
|
}
|
|
17178
17301
|
function advance(delta, sourceSpan) {
|
|
17179
|
-
return call(Identifiers.advance, [
|
|
17180
|
-
literal(delta)
|
|
17181
|
-
], sourceSpan);
|
|
17302
|
+
return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
|
|
17182
17303
|
}
|
|
17183
17304
|
function reference(slot) {
|
|
17184
17305
|
return importExpr(Identifiers.reference).callFn([
|
|
@@ -17256,22 +17377,22 @@ function projectionDef(def) {
|
|
|
17256
17377
|
}
|
|
17257
17378
|
function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
|
|
17258
17379
|
const args = [literal(slot)];
|
|
17259
|
-
if (projectionSlotIndex !== 0 || attributes
|
|
17380
|
+
if (projectionSlotIndex !== 0 || attributes !== null) {
|
|
17260
17381
|
args.push(literal(projectionSlotIndex));
|
|
17261
|
-
if (attributes
|
|
17262
|
-
args.push(
|
|
17382
|
+
if (attributes !== null) {
|
|
17383
|
+
args.push(attributes);
|
|
17263
17384
|
}
|
|
17264
17385
|
}
|
|
17265
17386
|
return call(Identifiers.projection, args, sourceSpan);
|
|
17266
17387
|
}
|
|
17267
|
-
function i18nStart(slot, constIndex, subTemplateIndex) {
|
|
17388
|
+
function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
17268
17389
|
const args = [literal(slot), literal(constIndex)];
|
|
17269
17390
|
if (subTemplateIndex !== null) {
|
|
17270
17391
|
args.push(literal(subTemplateIndex));
|
|
17271
17392
|
}
|
|
17272
|
-
return call(Identifiers.i18nStart, args,
|
|
17393
|
+
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
17273
17394
|
}
|
|
17274
|
-
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, sourceSpan) {
|
|
17395
|
+
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
17275
17396
|
const args = [
|
|
17276
17397
|
literal(slot),
|
|
17277
17398
|
variable(viewFnName),
|
|
@@ -17285,6 +17406,12 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
17285
17406
|
args.push(literal(trackByUsesComponentInstance));
|
|
17286
17407
|
if (emptyViewFnName !== null) {
|
|
17287
17408
|
args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
|
|
17409
|
+
if (emptyTag !== null || emptyConstIndex !== null) {
|
|
17410
|
+
args.push(literal(emptyTag));
|
|
17411
|
+
}
|
|
17412
|
+
if (emptyConstIndex !== null) {
|
|
17413
|
+
args.push(literal(emptyConstIndex));
|
|
17414
|
+
}
|
|
17288
17415
|
}
|
|
17289
17416
|
}
|
|
17290
17417
|
return call(Identifiers.repeaterCreate, args, sourceSpan);
|
|
@@ -17295,15 +17422,15 @@ function repeater(collection, sourceSpan) {
|
|
|
17295
17422
|
function deferWhen(prefetch, expr, sourceSpan) {
|
|
17296
17423
|
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
17297
17424
|
}
|
|
17298
|
-
function i18n(slot, constIndex, subTemplateIndex) {
|
|
17425
|
+
function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
17299
17426
|
const args = [literal(slot), literal(constIndex)];
|
|
17300
17427
|
if (subTemplateIndex) {
|
|
17301
17428
|
args.push(literal(subTemplateIndex));
|
|
17302
17429
|
}
|
|
17303
|
-
return call(Identifiers.i18n, args,
|
|
17430
|
+
return call(Identifiers.i18n, args, sourceSpan);
|
|
17304
17431
|
}
|
|
17305
|
-
function i18nEnd() {
|
|
17306
|
-
return call(Identifiers.i18nEnd, [],
|
|
17432
|
+
function i18nEnd(endSourceSpan) {
|
|
17433
|
+
return call(Identifiers.i18nEnd, [], endSourceSpan);
|
|
17307
17434
|
}
|
|
17308
17435
|
function i18nAttributes(slot, i18nAttributesConfig) {
|
|
17309
17436
|
const args = [literal(slot), literal(i18nAttributesConfig)];
|
|
@@ -17316,10 +17443,13 @@ function property(name, expression, sanitizer, sourceSpan) {
|
|
|
17316
17443
|
}
|
|
17317
17444
|
return call(Identifiers.property, args, sourceSpan);
|
|
17318
17445
|
}
|
|
17319
|
-
function attribute(name, expression, sanitizer) {
|
|
17446
|
+
function attribute(name, expression, sanitizer, namespace) {
|
|
17320
17447
|
const args = [literal(name), expression];
|
|
17321
|
-
if (sanitizer !== null) {
|
|
17322
|
-
args.push(sanitizer);
|
|
17448
|
+
if (sanitizer !== null || namespace !== null) {
|
|
17449
|
+
args.push(sanitizer != null ? sanitizer : literal(null));
|
|
17450
|
+
}
|
|
17451
|
+
if (namespace !== null) {
|
|
17452
|
+
args.push(literal(namespace));
|
|
17323
17453
|
}
|
|
17324
17454
|
return call(Identifiers.attribute, args, null);
|
|
17325
17455
|
}
|
|
@@ -17630,31 +17760,31 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17630
17760
|
OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
|
|
17631
17761
|
break;
|
|
17632
17762
|
case OpKind.ElementStart:
|
|
17633
|
-
OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.
|
|
17763
|
+
OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
17634
17764
|
break;
|
|
17635
17765
|
case OpKind.Element:
|
|
17636
|
-
OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.
|
|
17766
|
+
OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
|
|
17637
17767
|
break;
|
|
17638
17768
|
case OpKind.ElementEnd:
|
|
17639
17769
|
OpList.replace(op, elementEnd(op.sourceSpan));
|
|
17640
17770
|
break;
|
|
17641
17771
|
case OpKind.ContainerStart:
|
|
17642
|
-
OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.
|
|
17772
|
+
OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
|
|
17643
17773
|
break;
|
|
17644
17774
|
case OpKind.Container:
|
|
17645
|
-
OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.
|
|
17775
|
+
OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
|
|
17646
17776
|
break;
|
|
17647
17777
|
case OpKind.ContainerEnd:
|
|
17648
17778
|
OpList.replace(op, elementContainerEnd());
|
|
17649
17779
|
break;
|
|
17650
17780
|
case OpKind.I18nStart:
|
|
17651
|
-
OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
17781
|
+
OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
|
|
17652
17782
|
break;
|
|
17653
17783
|
case OpKind.I18nEnd:
|
|
17654
|
-
OpList.replace(op, i18nEnd());
|
|
17784
|
+
OpList.replace(op, i18nEnd(op.sourceSpan));
|
|
17655
17785
|
break;
|
|
17656
17786
|
case OpKind.I18n:
|
|
17657
|
-
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
17787
|
+
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
|
|
17658
17788
|
break;
|
|
17659
17789
|
case OpKind.I18nAttributes:
|
|
17660
17790
|
if (op.i18nAttributesConfig === null) {
|
|
@@ -17670,7 +17800,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17670
17800
|
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
17671
17801
|
}
|
|
17672
17802
|
const childView = unit.job.views.get(op.xref);
|
|
17673
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.
|
|
17803
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
17674
17804
|
break;
|
|
17675
17805
|
case OpKind.DisableBindings:
|
|
17676
17806
|
OpList.replace(op, disableBindings2());
|
|
@@ -17685,7 +17815,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17685
17815
|
const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
17686
17816
|
const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
|
|
17687
17817
|
if (eventTargetResolver === void 0) {
|
|
17688
|
-
throw new Error(`
|
|
17818
|
+
throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
|
|
17689
17819
|
}
|
|
17690
17820
|
OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
|
|
17691
17821
|
break;
|
|
@@ -17772,7 +17902,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17772
17902
|
emptyDecls = emptyView.decls;
|
|
17773
17903
|
emptyVars = emptyView.vars;
|
|
17774
17904
|
}
|
|
17775
|
-
OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.
|
|
17905
|
+
OpList.replace(op, repeaterCreate(op.handle.slot, repeaterView.fnName, op.decls, op.vars, op.tag, op.attributes, op.trackByFn, op.usesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, op.emptyTag, op.emptyAttributes, op.wholeSourceSpan));
|
|
17776
17906
|
break;
|
|
17777
17907
|
case OpKind.Statement:
|
|
17778
17908
|
break;
|
|
@@ -17832,7 +17962,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17832
17962
|
if (op.expression instanceof Interpolation2) {
|
|
17833
17963
|
OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
|
|
17834
17964
|
} else {
|
|
17835
|
-
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer));
|
|
17965
|
+
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
|
|
17836
17966
|
}
|
|
17837
17967
|
break;
|
|
17838
17968
|
case OpKind.HostProperty:
|
|
@@ -18001,38 +18131,6 @@ function removeUnusedI18nAttributesOps(job) {
|
|
|
18001
18131
|
}
|
|
18002
18132
|
}
|
|
18003
18133
|
|
|
18004
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
|
|
18005
|
-
function generateRepeaterDerivedVars(job) {
|
|
18006
|
-
const repeaters = /* @__PURE__ */ new Map();
|
|
18007
|
-
for (const unit of job.units) {
|
|
18008
|
-
for (const op of unit.ops()) {
|
|
18009
|
-
if (op.kind === OpKind.RepeaterCreate) {
|
|
18010
|
-
repeaters.set(op.xref, op);
|
|
18011
|
-
}
|
|
18012
|
-
}
|
|
18013
|
-
}
|
|
18014
|
-
for (const unit of job.units) {
|
|
18015
|
-
for (const op of unit.ops()) {
|
|
18016
|
-
transformExpressionsInOp(op, (expr) => {
|
|
18017
|
-
if (!(expr instanceof DerivedRepeaterVarExpr)) {
|
|
18018
|
-
return expr;
|
|
18019
|
-
}
|
|
18020
|
-
const repeaterOp = repeaters.get(expr.xref);
|
|
18021
|
-
switch (expr.identity) {
|
|
18022
|
-
case DerivedRepeaterVarIdentity.First:
|
|
18023
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
|
|
18024
|
-
case DerivedRepeaterVarIdentity.Last:
|
|
18025
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
|
|
18026
|
-
case DerivedRepeaterVarIdentity.Even:
|
|
18027
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
|
|
18028
|
-
case DerivedRepeaterVarIdentity.Odd:
|
|
18029
|
-
return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
|
|
18030
|
-
}
|
|
18031
|
-
}, VisitorContextFlag.None);
|
|
18032
|
-
}
|
|
18033
|
-
}
|
|
18034
|
-
}
|
|
18035
|
-
|
|
18036
18134
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_contexts.mjs
|
|
18037
18135
|
function resolveContexts(job) {
|
|
18038
18136
|
for (const unit of job.units) {
|
|
@@ -18279,6 +18377,7 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
18279
18377
|
var _a2;
|
|
18280
18378
|
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
18281
18379
|
const i18nContexts = /* @__PURE__ */ new Map();
|
|
18380
|
+
const icuPlaceholders = /* @__PURE__ */ new Map();
|
|
18282
18381
|
for (const unit of job.units) {
|
|
18283
18382
|
for (const op of unit.create) {
|
|
18284
18383
|
switch (op.kind) {
|
|
@@ -18288,6 +18387,9 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
18288
18387
|
case OpKind.I18nContext:
|
|
18289
18388
|
i18nContexts.set(op.xref, op);
|
|
18290
18389
|
break;
|
|
18390
|
+
case OpKind.IcuPlaceholder:
|
|
18391
|
+
icuPlaceholders.set(op.xref, op);
|
|
18392
|
+
break;
|
|
18291
18393
|
}
|
|
18292
18394
|
}
|
|
18293
18395
|
}
|
|
@@ -18296,66 +18398,32 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
18296
18398
|
for (const unit of job.units) {
|
|
18297
18399
|
for (const op of unit.update) {
|
|
18298
18400
|
if (op.kind === OpKind.I18nExpression) {
|
|
18299
|
-
const i18nContext = i18nContexts.get(op.context);
|
|
18300
18401
|
const index = expressionIndices.get(referenceIndex(op)) || 0;
|
|
18301
18402
|
const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
|
|
18302
|
-
const
|
|
18303
|
-
const values = params.get(op.i18nPlaceholder) || [];
|
|
18304
|
-
values.push({
|
|
18403
|
+
const value = {
|
|
18305
18404
|
value: index,
|
|
18306
18405
|
subTemplateIndex,
|
|
18307
18406
|
flags: I18nParamValueFlags.ExpressionIndex
|
|
18308
|
-
}
|
|
18309
|
-
|
|
18407
|
+
};
|
|
18408
|
+
updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
|
|
18310
18409
|
expressionIndices.set(referenceIndex(op), index + 1);
|
|
18311
18410
|
}
|
|
18312
18411
|
}
|
|
18313
18412
|
}
|
|
18314
18413
|
}
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
|
|
18323
|
-
}
|
|
18324
|
-
}
|
|
18325
|
-
}
|
|
18326
|
-
}
|
|
18327
|
-
}
|
|
18328
|
-
var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
|
|
18329
|
-
constructor(params) {
|
|
18330
|
-
super();
|
|
18331
|
-
this.params = params;
|
|
18332
|
-
}
|
|
18333
|
-
visitContainerPlaceholder(placeholder) {
|
|
18334
|
-
var _a2, _b2;
|
|
18335
|
-
if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
|
|
18336
|
-
this.params.set(placeholder.startName, [{
|
|
18337
|
-
value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
|
|
18338
|
-
subTemplateIndex: null,
|
|
18339
|
-
flags: I18nParamValueFlags.None
|
|
18340
|
-
}]);
|
|
18341
|
-
}
|
|
18342
|
-
if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
|
|
18343
|
-
this.params.set(placeholder.closeName, [{
|
|
18344
|
-
value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
|
|
18345
|
-
subTemplateIndex: null,
|
|
18346
|
-
flags: I18nParamValueFlags.None
|
|
18347
|
-
}]);
|
|
18348
|
-
}
|
|
18349
|
-
}
|
|
18350
|
-
visitTagPlaceholder(placeholder) {
|
|
18351
|
-
super.visitTagPlaceholder(placeholder);
|
|
18352
|
-
this.visitContainerPlaceholder(placeholder);
|
|
18414
|
+
function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
|
|
18415
|
+
if (op.i18nPlaceholder !== null) {
|
|
18416
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
18417
|
+
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
18418
|
+
const values = params.get(op.i18nPlaceholder) || [];
|
|
18419
|
+
values.push(value);
|
|
18420
|
+
params.set(op.i18nPlaceholder, values);
|
|
18353
18421
|
}
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18422
|
+
if (op.icuPlaceholder !== null) {
|
|
18423
|
+
const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
|
|
18424
|
+
icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
|
|
18357
18425
|
}
|
|
18358
|
-
}
|
|
18426
|
+
}
|
|
18359
18427
|
|
|
18360
18428
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
|
|
18361
18429
|
function resolveNames(job) {
|
|
@@ -18661,6 +18729,9 @@ function generateTrackFns(job) {
|
|
|
18661
18729
|
}
|
|
18662
18730
|
let usesComponentContext = false;
|
|
18663
18731
|
op.track = transformExpressionsInExpression(op.track, (expr) => {
|
|
18732
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
18733
|
+
throw new Error(`Illegal State: Pipes are not allowed in this context`);
|
|
18734
|
+
}
|
|
18664
18735
|
if (expr instanceof TrackContextExpr) {
|
|
18665
18736
|
usesComponentContext = true;
|
|
18666
18737
|
return variable("this");
|
|
@@ -18825,7 +18896,10 @@ function varsUsedByOp(op) {
|
|
|
18825
18896
|
return op.interpolation.expressions.length;
|
|
18826
18897
|
case OpKind.I18nExpression:
|
|
18827
18898
|
case OpKind.Conditional:
|
|
18899
|
+
case OpKind.DeferWhen:
|
|
18828
18900
|
return 1;
|
|
18901
|
+
case OpKind.RepeaterCreate:
|
|
18902
|
+
return op.emptyView ? 1 : 0;
|
|
18829
18903
|
default:
|
|
18830
18904
|
throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
|
|
18831
18905
|
}
|
|
@@ -19118,12 +19192,12 @@ function wrapI18nIcus(job) {
|
|
|
19118
19192
|
case OpKind.IcuStart:
|
|
19119
19193
|
if (currentI18nOp === null) {
|
|
19120
19194
|
addedI18nId = job.allocateXrefId();
|
|
19121
|
-
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
|
|
19195
|
+
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message, void 0, null), op);
|
|
19122
19196
|
}
|
|
19123
19197
|
break;
|
|
19124
19198
|
case OpKind.IcuEnd:
|
|
19125
19199
|
if (addedI18nId !== null) {
|
|
19126
|
-
OpList.insertAfter(createI18nEndOp(addedI18nId), op);
|
|
19200
|
+
OpList.insertAfter(createI18nEndOp(addedI18nId, null), op);
|
|
19127
19201
|
addedI18nId = null;
|
|
19128
19202
|
}
|
|
19129
19203
|
break;
|
|
@@ -19139,6 +19213,7 @@ var phases = [
|
|
|
19139
19213
|
{ kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
|
|
19140
19214
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
19141
19215
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
19216
|
+
{ kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
|
|
19142
19217
|
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
19143
19218
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
19144
19219
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
@@ -19162,7 +19237,6 @@ var phases = [
|
|
|
19162
19237
|
{ kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
|
|
19163
19238
|
{ kind: CompilationJobKind.Both, fn: deleteAnyCasts },
|
|
19164
19239
|
{ kind: CompilationJobKind.Both, fn: resolveDollarEvent },
|
|
19165
|
-
{ kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
|
|
19166
19240
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
|
|
19167
19241
|
{ kind: CompilationJobKind.Both, fn: resolveNames },
|
|
19168
19242
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
@@ -19177,7 +19251,6 @@ var phases = [
|
|
|
19177
19251
|
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
19178
19252
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
19179
19253
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
19180
|
-
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
|
|
19181
19254
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
19182
19255
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
19183
19256
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
@@ -19320,7 +19393,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
19320
19393
|
bindingKind = BindingKind.Animation;
|
|
19321
19394
|
}
|
|
19322
19395
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
|
|
19323
|
-
ingestHostProperty(job, property2, bindingKind,
|
|
19396
|
+
ingestHostProperty(job, property2, bindingKind, securityContexts);
|
|
19324
19397
|
}
|
|
19325
19398
|
for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
|
|
19326
19399
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
|
|
@@ -19331,7 +19404,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
19331
19404
|
}
|
|
19332
19405
|
return job;
|
|
19333
19406
|
}
|
|
19334
|
-
function ingestHostProperty(job, property2, bindingKind,
|
|
19407
|
+
function ingestHostProperty(job, property2, bindingKind, securityContexts) {
|
|
19335
19408
|
let expression;
|
|
19336
19409
|
const ast = property2.expression.ast;
|
|
19337
19410
|
if (ast instanceof Interpolation) {
|
|
@@ -19339,7 +19412,7 @@ function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securi
|
|
|
19339
19412
|
} else {
|
|
19340
19413
|
expression = convertAst(ast, job, property2.sourceSpan);
|
|
19341
19414
|
}
|
|
19342
|
-
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts,
|
|
19415
|
+
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
|
|
19343
19416
|
}
|
|
19344
19417
|
function ingestHostAttribute(job, name, value, securityContexts) {
|
|
19345
19418
|
const attrBinding = createBindingOp(
|
|
@@ -19353,14 +19426,13 @@ function ingestHostAttribute(job, name, value, securityContexts) {
|
|
|
19353
19426
|
false,
|
|
19354
19427
|
null,
|
|
19355
19428
|
null,
|
|
19356
|
-
|
|
19429
|
+
value.sourceSpan
|
|
19357
19430
|
);
|
|
19358
19431
|
job.root.update.push(attrBinding);
|
|
19359
19432
|
}
|
|
19360
19433
|
function ingestHostEvent(job, event) {
|
|
19361
19434
|
const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
|
|
19362
|
-
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null,
|
|
19363
|
-
eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
|
|
19435
|
+
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
|
|
19364
19436
|
job.root.create.push(eventBinding);
|
|
19365
19437
|
}
|
|
19366
19438
|
function ingestNodes(unit, template2) {
|
|
@@ -19372,9 +19444,9 @@ function ingestNodes(unit, template2) {
|
|
|
19372
19444
|
} else if (node instanceof Content) {
|
|
19373
19445
|
ingestContent(unit, node);
|
|
19374
19446
|
} else if (node instanceof Text) {
|
|
19375
|
-
ingestText(unit, node);
|
|
19447
|
+
ingestText(unit, node, null);
|
|
19376
19448
|
} else if (node instanceof BoundText) {
|
|
19377
|
-
ingestBoundText(unit, node);
|
|
19449
|
+
ingestBoundText(unit, node, null);
|
|
19378
19450
|
} else if (node instanceof IfBlock) {
|
|
19379
19451
|
ingestIfBlock(unit, node);
|
|
19380
19452
|
} else if (node instanceof SwitchBlock) {
|
|
@@ -19391,29 +19463,30 @@ function ingestNodes(unit, template2) {
|
|
|
19391
19463
|
}
|
|
19392
19464
|
}
|
|
19393
19465
|
function ingestElement(unit, element2) {
|
|
19394
|
-
var _a2;
|
|
19466
|
+
var _a2, _b2;
|
|
19395
19467
|
if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
|
|
19396
19468
|
throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
|
|
19397
19469
|
}
|
|
19398
19470
|
const id = unit.job.allocateXrefId();
|
|
19399
19471
|
const [namespaceKey, elementName] = splitNsName(element2.name);
|
|
19400
|
-
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
|
|
19472
|
+
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
|
|
19401
19473
|
unit.create.push(startOp);
|
|
19402
19474
|
ingestElementBindings(unit, startOp, element2);
|
|
19403
19475
|
ingestReferences(startOp, element2);
|
|
19404
19476
|
let i18nBlockId = null;
|
|
19405
19477
|
if (element2.i18n instanceof Message) {
|
|
19406
19478
|
i18nBlockId = unit.job.allocateXrefId();
|
|
19407
|
-
unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n));
|
|
19479
|
+
unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n, void 0, element2.startSourceSpan));
|
|
19408
19480
|
}
|
|
19409
19481
|
ingestNodes(unit, element2.children);
|
|
19410
19482
|
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
19411
19483
|
unit.create.push(endOp);
|
|
19412
19484
|
if (i18nBlockId !== null) {
|
|
19413
|
-
OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
|
|
19485
|
+
OpList.insertBefore(createI18nEndOp(i18nBlockId, (_b2 = element2.endSourceSpan) != null ? _b2 : element2.startSourceSpan), endOp);
|
|
19414
19486
|
}
|
|
19415
19487
|
}
|
|
19416
19488
|
function ingestTemplate(unit, tmpl) {
|
|
19489
|
+
var _a2;
|
|
19417
19490
|
if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
|
|
19418
19491
|
throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
|
|
19419
19492
|
}
|
|
@@ -19427,7 +19500,7 @@ function ingestTemplate(unit, tmpl) {
|
|
|
19427
19500
|
const namespace = namespaceForKey(namespacePrefix);
|
|
19428
19501
|
const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
|
|
19429
19502
|
const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
|
|
19430
|
-
const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
|
|
19503
|
+
const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
|
|
19431
19504
|
unit.create.push(templateOp);
|
|
19432
19505
|
ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
|
|
19433
19506
|
ingestReferences(templateOp, tmpl);
|
|
@@ -19437,26 +19510,25 @@ function ingestTemplate(unit, tmpl) {
|
|
|
19437
19510
|
}
|
|
19438
19511
|
if (templateKind === TemplateKind.NgTemplate && tmpl.i18n instanceof Message) {
|
|
19439
19512
|
const id = unit.job.allocateXrefId();
|
|
19440
|
-
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
|
|
19441
|
-
OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
|
|
19513
|
+
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n, void 0, tmpl.startSourceSpan), childView.create.head);
|
|
19514
|
+
OpList.insertBefore(createI18nEndOp(id, (_a2 = tmpl.endSourceSpan) != null ? _a2 : tmpl.startSourceSpan), childView.create.tail);
|
|
19442
19515
|
}
|
|
19443
19516
|
}
|
|
19444
19517
|
function ingestContent(unit, content) {
|
|
19445
19518
|
if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
|
|
19446
19519
|
throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
|
|
19447
19520
|
}
|
|
19448
|
-
const
|
|
19449
|
-
const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, attrs, content.sourceSpan);
|
|
19521
|
+
const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
|
|
19450
19522
|
for (const attr of content.attributes) {
|
|
19451
19523
|
const securityContext = domSchema.securityContext(content.name, attr.name, true);
|
|
19452
19524
|
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
19453
19525
|
}
|
|
19454
19526
|
unit.create.push(op);
|
|
19455
19527
|
}
|
|
19456
|
-
function ingestText(unit, text2) {
|
|
19457
|
-
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
|
|
19528
|
+
function ingestText(unit, text2, icuPlaceholder) {
|
|
19529
|
+
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
|
|
19458
19530
|
}
|
|
19459
|
-
function ingestBoundText(unit, text2,
|
|
19531
|
+
function ingestBoundText(unit, text2, icuPlaceholder) {
|
|
19460
19532
|
var _a2;
|
|
19461
19533
|
let value = text2.value;
|
|
19462
19534
|
if (value instanceof ASTWithSource) {
|
|
@@ -19468,14 +19540,12 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
|
|
|
19468
19540
|
if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
|
|
19469
19541
|
throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
19470
19542
|
}
|
|
19471
|
-
|
|
19472
|
-
i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
19473
|
-
}
|
|
19543
|
+
const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
19474
19544
|
if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
|
|
19475
19545
|
throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
|
|
19476
19546
|
}
|
|
19477
19547
|
const textXref = unit.job.allocateXrefId();
|
|
19478
|
-
unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
|
|
19548
|
+
unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
|
|
19479
19549
|
const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
|
|
19480
19550
|
unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
|
|
19481
19551
|
}
|
|
@@ -19501,7 +19571,7 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
19501
19571
|
}
|
|
19502
19572
|
ifCaseI18nMeta = ifCase.i18n;
|
|
19503
19573
|
}
|
|
19504
|
-
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
|
|
19574
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
19505
19575
|
unit.create.push(templateOp);
|
|
19506
19576
|
if (firstXref === null) {
|
|
19507
19577
|
firstXref = cView.xref;
|
|
@@ -19517,6 +19587,9 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
19517
19587
|
}
|
|
19518
19588
|
function ingestSwitchBlock(unit, switchBlock) {
|
|
19519
19589
|
var _a2;
|
|
19590
|
+
if (switchBlock.cases.length === 0) {
|
|
19591
|
+
return;
|
|
19592
|
+
}
|
|
19520
19593
|
let firstXref = null;
|
|
19521
19594
|
let firstSlotHandle = null;
|
|
19522
19595
|
let conditions = [];
|
|
@@ -19529,7 +19602,7 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
19529
19602
|
}
|
|
19530
19603
|
switchCaseI18nMeta = switchCase.i18n;
|
|
19531
19604
|
}
|
|
19532
|
-
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
|
|
19605
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
19533
19606
|
unit.create.push(templateOp);
|
|
19534
19607
|
if (firstXref === null) {
|
|
19535
19608
|
firstXref = cView.xref;
|
|
@@ -19552,7 +19625,7 @@ function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
|
|
|
19552
19625
|
}
|
|
19553
19626
|
const secondaryView = unit.job.allocateView(unit.xref);
|
|
19554
19627
|
ingestNodes(secondaryView, children);
|
|
19555
|
-
const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan);
|
|
19628
|
+
const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
|
|
19556
19629
|
unit.create.push(templateOp);
|
|
19557
19630
|
return templateOp;
|
|
19558
19631
|
}
|
|
@@ -19626,6 +19699,9 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
19626
19699
|
deferOnOps.push(deferOnOp);
|
|
19627
19700
|
}
|
|
19628
19701
|
if (triggers.when !== void 0) {
|
|
19702
|
+
if (triggers.when.value instanceof Interpolation) {
|
|
19703
|
+
throw new Error(`Unexpected interpolation in defer block when trigger`);
|
|
19704
|
+
}
|
|
19629
19705
|
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
19630
19706
|
deferWhenOps.push(deferOnOp);
|
|
19631
19707
|
}
|
|
@@ -19645,9 +19721,9 @@ function ingestIcu(unit, icu) {
|
|
|
19645
19721
|
unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
|
|
19646
19722
|
for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
|
|
19647
19723
|
if (text2 instanceof BoundText) {
|
|
19648
|
-
ingestBoundText(unit, text2,
|
|
19724
|
+
ingestBoundText(unit, text2, placeholder);
|
|
19649
19725
|
} else {
|
|
19650
|
-
ingestText(unit, text2);
|
|
19726
|
+
ingestText(unit, text2, placeholder);
|
|
19651
19727
|
}
|
|
19652
19728
|
}
|
|
19653
19729
|
unit.create.push(createIcuEndOp(xref));
|
|
@@ -19658,28 +19734,46 @@ function ingestIcu(unit, icu) {
|
|
|
19658
19734
|
function ingestForBlock(unit, forBlock) {
|
|
19659
19735
|
var _a2, _b2, _c2;
|
|
19660
19736
|
const repeaterView = unit.job.allocateView(unit.xref);
|
|
19661
|
-
const createRepeaterAlias = (ident, repeaterVar) => {
|
|
19662
|
-
repeaterView.aliases.add({
|
|
19663
|
-
kind: SemanticVariableKind.Alias,
|
|
19664
|
-
name: null,
|
|
19665
|
-
identifier: ident,
|
|
19666
|
-
expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar)
|
|
19667
|
-
});
|
|
19668
|
-
};
|
|
19669
19737
|
repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
|
|
19670
19738
|
repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
|
|
19671
19739
|
repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19740
|
+
const indexName = `\u0275${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
|
|
19741
|
+
const countName = `\u0275${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
|
|
19742
|
+
repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
|
|
19743
|
+
repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
|
|
19744
|
+
repeaterView.aliases.add({
|
|
19745
|
+
kind: SemanticVariableKind.Alias,
|
|
19746
|
+
name: null,
|
|
19747
|
+
identifier: forBlock.contextVariables.$first.name,
|
|
19748
|
+
expression: new LexicalReadExpr(indexName).identical(literal(0))
|
|
19749
|
+
});
|
|
19750
|
+
repeaterView.aliases.add({
|
|
19751
|
+
kind: SemanticVariableKind.Alias,
|
|
19752
|
+
name: null,
|
|
19753
|
+
identifier: forBlock.contextVariables.$last.name,
|
|
19754
|
+
expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
|
|
19755
|
+
});
|
|
19756
|
+
repeaterView.aliases.add({
|
|
19757
|
+
kind: SemanticVariableKind.Alias,
|
|
19758
|
+
name: null,
|
|
19759
|
+
identifier: forBlock.contextVariables.$even.name,
|
|
19760
|
+
expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
|
|
19761
|
+
});
|
|
19762
|
+
repeaterView.aliases.add({
|
|
19763
|
+
kind: SemanticVariableKind.Alias,
|
|
19764
|
+
name: null,
|
|
19765
|
+
identifier: forBlock.contextVariables.$odd.name,
|
|
19766
|
+
expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
|
|
19767
|
+
});
|
|
19676
19768
|
const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
|
|
19677
19769
|
const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
|
|
19678
19770
|
ingestNodes(repeaterView, forBlock.children);
|
|
19679
19771
|
let emptyView = null;
|
|
19772
|
+
let emptyTagName = null;
|
|
19680
19773
|
if (forBlock.empty !== null) {
|
|
19681
19774
|
emptyView = unit.job.allocateView(unit.xref);
|
|
19682
19775
|
ingestNodes(emptyView, forBlock.empty.children);
|
|
19776
|
+
emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
|
|
19683
19777
|
}
|
|
19684
19778
|
const varNames = {
|
|
19685
19779
|
$index: forBlock.contextVariables.$index.name,
|
|
@@ -19699,7 +19793,7 @@ function ingestForBlock(unit, forBlock) {
|
|
|
19699
19793
|
const i18nPlaceholder = forBlock.i18n;
|
|
19700
19794
|
const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
|
|
19701
19795
|
const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
|
|
19702
|
-
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.sourceSpan);
|
|
19796
|
+
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, emptyTagName, i18nPlaceholder, emptyI18nPlaceholder, forBlock.startSourceSpan, forBlock.sourceSpan);
|
|
19703
19797
|
unit.create.push(repeaterCreate2);
|
|
19704
19798
|
const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
|
|
19705
19799
|
const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
|
|
@@ -19709,7 +19803,10 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
19709
19803
|
if (ast instanceof ASTWithSource) {
|
|
19710
19804
|
return convertAst(ast.ast, job, baseSourceSpan);
|
|
19711
19805
|
} else if (ast instanceof PropertyRead) {
|
|
19712
|
-
|
|
19806
|
+
const isThisReceiver = ast.receiver instanceof ThisReceiver;
|
|
19807
|
+
const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
|
|
19808
|
+
const isSpecialNode = ast.name === "$any" || ast.name === "$event";
|
|
19809
|
+
if (isImplicitReceiver || isThisReceiver && !isSpecialNode) {
|
|
19713
19810
|
return new LexicalReadExpr(ast.name);
|
|
19714
19811
|
} else {
|
|
19715
19812
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -19787,13 +19884,13 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
19787
19884
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
19788
19885
|
}
|
|
19789
19886
|
}
|
|
19790
|
-
function convertAstWithInterpolation(job, value, i18nMeta) {
|
|
19887
|
+
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
19791
19888
|
var _a2, _b2;
|
|
19792
19889
|
let expression;
|
|
19793
19890
|
if (value instanceof Interpolation) {
|
|
19794
|
-
expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
|
|
19891
|
+
expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, sourceSpan != null ? sourceSpan : null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
|
|
19795
19892
|
} else if (value instanceof AST) {
|
|
19796
|
-
expression = convertAst(value, job, null);
|
|
19893
|
+
expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
|
|
19797
19894
|
} else {
|
|
19798
19895
|
expression = literal(value);
|
|
19799
19896
|
}
|
|
@@ -19869,7 +19966,7 @@ function ingestTemplateBindings(unit, op, template2, templateKind) {
|
|
|
19869
19966
|
}
|
|
19870
19967
|
if (templateKind === TemplateKind.Structural && output.type !== 1) {
|
|
19871
19968
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
|
|
19872
|
-
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
|
|
19969
|
+
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
|
|
19873
19970
|
}
|
|
19874
19971
|
}
|
|
19875
19972
|
if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
|
|
@@ -19880,7 +19977,7 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
|
|
|
19880
19977
|
const isTextBinding = typeof value === "string";
|
|
19881
19978
|
if (templateKind === TemplateKind.Structural) {
|
|
19882
19979
|
if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
|
|
19883
|
-
return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
|
|
19980
|
+
return createExtractedAttributeOp(xref, BindingKind.Property, null, name, null, null, i18nMessage, securityContext);
|
|
19884
19981
|
}
|
|
19885
19982
|
if (!isTextBinding && (type === 1 || type === 4)) {
|
|
19886
19983
|
return null;
|
|
@@ -22739,6 +22836,9 @@ var TemplateDefinitionBuilder = class {
|
|
|
22739
22836
|
this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
|
|
22740
22837
|
}
|
|
22741
22838
|
visitSwitchBlock(block) {
|
|
22839
|
+
if (block.cases.length === 0) {
|
|
22840
|
+
return;
|
|
22841
|
+
}
|
|
22742
22842
|
const caseData = block.cases.map((currentCase) => {
|
|
22743
22843
|
const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
|
|
22744
22844
|
const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
|
|
@@ -22888,7 +22988,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
22888
22988
|
});
|
|
22889
22989
|
const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
|
|
22890
22990
|
let emptyData = null;
|
|
22991
|
+
let emptyTagName = null;
|
|
22992
|
+
let emptyAttrsExprs;
|
|
22891
22993
|
if (block.empty !== null) {
|
|
22994
|
+
const emptyInferred = this.inferProjectionDataFromInsertionPoint(block.empty);
|
|
22995
|
+
emptyTagName = emptyInferred.tagName;
|
|
22996
|
+
emptyAttrsExprs = emptyInferred.attrsExprs;
|
|
22892
22997
|
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
|
|
22893
22998
|
this.allocateBindingSlots(null);
|
|
22894
22999
|
}
|
|
@@ -22904,11 +23009,11 @@ var TemplateDefinitionBuilder = class {
|
|
|
22904
23009
|
trackByExpression
|
|
22905
23010
|
];
|
|
22906
23011
|
if (emptyData !== null) {
|
|
22907
|
-
params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()));
|
|
23012
|
+
params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()), literal(emptyTagName), this.addAttrsToConsts(emptyAttrsExprs || null));
|
|
22908
23013
|
} else if (trackByUsesComponentInstance) {
|
|
22909
23014
|
params.push(literal(trackByUsesComponentInstance));
|
|
22910
23015
|
}
|
|
22911
|
-
return params;
|
|
23016
|
+
return trimTrailingNulls(params);
|
|
22912
23017
|
});
|
|
22913
23018
|
const value = block.expression.visit(this._valueConverter);
|
|
22914
23019
|
this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
|
|
@@ -23061,7 +23166,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
23061
23166
|
if (delta < 1) {
|
|
23062
23167
|
throw new Error("advance instruction can only go forwards");
|
|
23063
23168
|
}
|
|
23064
|
-
this.instructionFn(this._updateCodeFns, span, Identifiers.advance, [literal(delta)]);
|
|
23169
|
+
this.instructionFn(this._updateCodeFns, span, Identifiers.advance, delta > 1 ? [literal(delta)] : []);
|
|
23065
23170
|
this._currentIndex = nodeIndex;
|
|
23066
23171
|
}
|
|
23067
23172
|
}
|
|
@@ -23471,12 +23576,15 @@ var BindingScope = class {
|
|
|
23471
23576
|
}
|
|
23472
23577
|
};
|
|
23473
23578
|
var TrackByBindingScope = class extends BindingScope {
|
|
23474
|
-
constructor(parentScope,
|
|
23579
|
+
constructor(parentScope, globalOverrides) {
|
|
23475
23580
|
super(parentScope.bindingLevel + 1, parentScope);
|
|
23476
|
-
this.
|
|
23581
|
+
this.globalOverrides = globalOverrides;
|
|
23477
23582
|
this.componentAccessCount = 0;
|
|
23478
23583
|
}
|
|
23479
23584
|
get(name) {
|
|
23585
|
+
if (this.globalOverrides.hasOwnProperty(name)) {
|
|
23586
|
+
return variable(this.globalOverrides[name]);
|
|
23587
|
+
}
|
|
23480
23588
|
let current = this.parent;
|
|
23481
23589
|
while (current) {
|
|
23482
23590
|
if (current.hasLocal(name)) {
|
|
@@ -23484,9 +23592,6 @@ var TrackByBindingScope = class extends BindingScope {
|
|
|
23484
23592
|
}
|
|
23485
23593
|
current = current.parent;
|
|
23486
23594
|
}
|
|
23487
|
-
if (this.globalAliases[name]) {
|
|
23488
|
-
return variable(this.globalAliases[name]);
|
|
23489
|
-
}
|
|
23490
23595
|
this.componentAccessCount++;
|
|
23491
23596
|
return variable("this").prop(name);
|
|
23492
23597
|
}
|
|
@@ -25151,7 +25256,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
25151
25256
|
bindingPropertyName: ann.alias || field,
|
|
25152
25257
|
classPropertyName: field,
|
|
25153
25258
|
required: ann.required || false,
|
|
25154
|
-
isSignal:
|
|
25259
|
+
isSignal: !!ann.isSignal,
|
|
25155
25260
|
transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null
|
|
25156
25261
|
};
|
|
25157
25262
|
} else if (isOutput(ann)) {
|
|
@@ -25505,7 +25610,7 @@ function publishFacade(global) {
|
|
|
25505
25610
|
}
|
|
25506
25611
|
|
|
25507
25612
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
25508
|
-
var VERSION2 = new Version("17.1.0-
|
|
25613
|
+
var VERSION2 = new Version("17.1.0-rc.0");
|
|
25509
25614
|
|
|
25510
25615
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
25511
25616
|
var _VisitorMode;
|