@angular/material 17.1.0-next.2 → 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/LICENSE +1 -1
- package/_index.scss +6 -6
- package/bottom-sheet/index.d.ts +2 -4
- package/button/_button-base.scss +20 -2
- package/button/_button-theme.scss +131 -97
- package/button/_fab-theme.scss +2 -8
- package/button/_icon-button-theme.scss +11 -9
- package/button/index.d.ts +31 -2
- package/core/_core-theme.scss +6 -7
- package/core/_core.scss +17 -2
- package/core/index.d.ts +10 -3
- package/core/mdc-helpers/_mdc-helpers.scss +0 -184
- package/core/style/_sass-utils.scss +19 -0
- package/core/tokens/_token-utils.scss +56 -0
- package/core/tokens/m2/_index.scss +19 -5
- package/core/tokens/m2/mat/{_slide-toggle.scss → _app.scss} +12 -15
- package/core/tokens/m2/mat/_fab.scss +3 -0
- package/core/tokens/m2/mat/_filled-button.scss +3 -0
- package/core/tokens/m2/mat/_form-field.scss +50 -1
- package/core/tokens/m2/mat/_icon-button.scss +3 -0
- package/core/tokens/m2/mat/_outlined-button.scss +3 -0
- package/core/tokens/m2/mat/_protected-button.scss +3 -0
- package/core/tokens/m2/mat/_slider.scss +34 -8
- package/core/tokens/m2/mat/_tab-header.scss +6 -1
- package/core/tokens/m2/mat/_text-button.scss +3 -0
- package/core/tokens/m2/mdc/_extended-fab.scss +7 -6
- package/core/tokens/m2/mdc/_fab.scss +5 -5
- package/core/tokens/m2/mdc/_filled-button.scss +13 -12
- package/core/tokens/m2/mdc/_outlined-button.scss +7 -7
- package/core/tokens/m2/mdc/_protected-button.scss +14 -13
- package/core/tokens/m2/mdc/_text-button.scss +7 -12
- package/esm2022/autocomplete/autocomplete-origin.mjs +3 -3
- package/esm2022/autocomplete/autocomplete-trigger.mjs +7 -5
- package/esm2022/autocomplete/autocomplete.mjs +4 -5
- package/esm2022/autocomplete/module.mjs +4 -4
- package/esm2022/badge/badge-module.mjs +4 -4
- package/esm2022/badge/badge.mjs +3 -3
- package/esm2022/bottom-sheet/bottom-sheet-container.mjs +7 -8
- package/esm2022/bottom-sheet/bottom-sheet-module.mjs +4 -4
- package/esm2022/bottom-sheet/bottom-sheet.mjs +3 -3
- package/esm2022/button/button-base.mjs +46 -19
- package/esm2022/button/button.mjs +9 -9
- package/esm2022/button/fab.mjs +17 -17
- package/esm2022/button/icon-button.mjs +9 -9
- package/esm2022/button/module.mjs +4 -4
- package/esm2022/button/public-api.mjs +2 -1
- package/esm2022/button/testing/button-harness.mjs +4 -3
- package/esm2022/button-toggle/button-toggle-module.mjs +4 -4
- package/esm2022/button-toggle/button-toggle.mjs +6 -6
- package/esm2022/card/card.mjs +42 -42
- package/esm2022/card/module.mjs +4 -4
- package/esm2022/checkbox/checkbox-required-validator.mjs +3 -3
- package/esm2022/checkbox/checkbox.mjs +3 -3
- package/esm2022/checkbox/module.mjs +8 -8
- package/esm2022/chips/chip-action.mjs +3 -3
- package/esm2022/chips/chip-edit-input.mjs +3 -3
- package/esm2022/chips/chip-grid.mjs +3 -3
- package/esm2022/chips/chip-icons.mjs +9 -9
- package/esm2022/chips/chip-input.mjs +3 -3
- package/esm2022/chips/chip-listbox.mjs +4 -5
- package/esm2022/chips/chip-option.mjs +3 -3
- package/esm2022/chips/chip-row.mjs +3 -3
- package/esm2022/chips/chip-set.mjs +3 -3
- package/esm2022/chips/chip.mjs +5 -4
- package/esm2022/chips/module.mjs +4 -4
- package/esm2022/core/common-behaviors/common-module.mjs +4 -4
- package/esm2022/core/datetime/index.mjs +16 -11
- package/esm2022/core/datetime/native-date-adapter.mjs +3 -3
- package/esm2022/core/error/error-options.mjs +6 -6
- package/esm2022/core/internal-form-field/internal-form-field.mjs +3 -3
- package/esm2022/core/line/line.mjs +7 -7
- package/esm2022/core/option/index.mjs +4 -4
- package/esm2022/core/option/optgroup.mjs +3 -3
- package/esm2022/core/option/option.mjs +3 -3
- package/esm2022/core/private/ripple-loader.mjs +30 -12
- package/esm2022/core/ripple/index.mjs +4 -4
- package/esm2022/core/ripple/ripple-renderer.mjs +1 -1
- package/esm2022/core/ripple/ripple.mjs +3 -3
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox-module.mjs +4 -4
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +3 -3
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/datepicker/calendar-body.mjs +3 -3
- package/esm2022/datepicker/calendar.mjs +8 -8
- package/esm2022/datepicker/date-range-input-parts.mjs +9 -9
- package/esm2022/datepicker/date-range-input.mjs +3 -3
- package/esm2022/datepicker/date-range-picker.mjs +3 -3
- package/esm2022/datepicker/date-range-selection-strategy.mjs +3 -3
- package/esm2022/datepicker/date-selection-model.mjs +9 -9
- package/esm2022/datepicker/datepicker-actions.mjs +9 -9
- package/esm2022/datepicker/datepicker-base.mjs +6 -6
- package/esm2022/datepicker/datepicker-errors.mjs +4 -4
- package/esm2022/datepicker/datepicker-input-base.mjs +3 -3
- package/esm2022/datepicker/datepicker-input.mjs +3 -3
- package/esm2022/datepicker/datepicker-intl.mjs +3 -3
- package/esm2022/datepicker/datepicker-module.mjs +4 -4
- package/esm2022/datepicker/datepicker-toggle.mjs +6 -6
- package/esm2022/datepicker/datepicker.mjs +3 -3
- package/esm2022/datepicker/month-view.mjs +3 -3
- package/esm2022/datepicker/multi-year-view.mjs +3 -3
- package/esm2022/datepicker/year-view.mjs +3 -3
- package/esm2022/dialog/dialog-container.mjs +5 -5
- package/esm2022/dialog/dialog-content-directives.mjs +18 -21
- package/esm2022/dialog/dialog.mjs +3 -3
- package/esm2022/dialog/module.mjs +4 -4
- package/esm2022/divider/divider-module.mjs +4 -4
- package/esm2022/divider/divider.mjs +3 -3
- package/esm2022/expansion/accordion.mjs +4 -5
- package/esm2022/expansion/expansion-module.mjs +4 -4
- package/esm2022/expansion/expansion-panel-content.mjs +3 -3
- package/esm2022/expansion/expansion-panel-header.mjs +9 -9
- package/esm2022/expansion/expansion-panel.mjs +8 -8
- package/esm2022/form-field/directives/error.mjs +3 -3
- package/esm2022/form-field/directives/floating-label.mjs +3 -3
- package/esm2022/form-field/directives/hint.mjs +3 -3
- package/esm2022/form-field/directives/label.mjs +3 -3
- package/esm2022/form-field/directives/line-ripple.mjs +3 -3
- package/esm2022/form-field/directives/notched-outline.mjs +3 -3
- package/esm2022/form-field/directives/prefix.mjs +3 -3
- package/esm2022/form-field/directives/suffix.mjs +3 -3
- package/esm2022/form-field/form-field-control.mjs +3 -3
- package/esm2022/form-field/form-field.mjs +6 -6
- package/esm2022/form-field/module.mjs +4 -4
- package/esm2022/grid-list/grid-list-module.mjs +4 -4
- package/esm2022/grid-list/grid-list.mjs +3 -3
- package/esm2022/grid-list/grid-tile.mjs +15 -15
- package/esm2022/icon/icon-module.mjs +4 -4
- package/esm2022/icon/icon-registry.mjs +3 -3
- package/esm2022/icon/icon.mjs +3 -3
- package/esm2022/icon/testing/fake-icon-registry.mjs +7 -7
- package/esm2022/input/input.mjs +3 -3
- package/esm2022/input/module.mjs +4 -4
- package/esm2022/list/action-list.mjs +3 -3
- package/esm2022/list/list-base.mjs +6 -6
- package/esm2022/list/list-item-sections.mjs +18 -18
- package/esm2022/list/list-module.mjs +4 -4
- package/esm2022/list/list-option.mjs +6 -6
- package/esm2022/list/list.mjs +6 -6
- package/esm2022/list/nav-list.mjs +3 -3
- package/esm2022/list/selection-list.mjs +3 -3
- package/esm2022/list/subheader.mjs +3 -3
- package/esm2022/list/tokens.mjs +2 -2
- package/esm2022/menu/menu-content.mjs +3 -3
- package/esm2022/menu/menu-item.mjs +3 -3
- package/esm2022/menu/menu-trigger.mjs +3 -3
- package/esm2022/menu/menu.mjs +4 -5
- package/esm2022/menu/module.mjs +4 -4
- package/esm2022/paginator/module.mjs +4 -4
- package/esm2022/paginator/paginator-intl.mjs +3 -3
- package/esm2022/paginator/paginator.mjs +5 -5
- package/esm2022/progress-bar/module.mjs +4 -4
- package/esm2022/progress-bar/progress-bar.mjs +3 -3
- package/esm2022/progress-spinner/module.mjs +4 -4
- package/esm2022/progress-spinner/progress-spinner.mjs +3 -3
- package/esm2022/radio/module.mjs +4 -4
- package/esm2022/radio/radio.mjs +6 -6
- package/esm2022/select/module.mjs +4 -4
- package/esm2022/select/select.mjs +19 -19
- package/esm2022/sidenav/drawer.mjs +22 -18
- package/esm2022/sidenav/sidenav-module.mjs +4 -4
- package/esm2022/sidenav/sidenav.mjs +10 -13
- package/esm2022/slide-toggle/module.mjs +8 -8
- package/esm2022/slide-toggle/slide-toggle-required-validator.mjs +3 -3
- package/esm2022/slide-toggle/slide-toggle.mjs +7 -7
- package/esm2022/slider/module.mjs +4 -4
- package/esm2022/slider/slider-input.mjs +43 -26
- package/esm2022/slider/slider-interface.mjs +1 -1
- package/esm2022/slider/slider-thumb.mjs +12 -5
- package/esm2022/slider/slider.mjs +5 -6
- package/esm2022/snack-bar/module.mjs +4 -4
- package/esm2022/snack-bar/simple-snack-bar.mjs +3 -3
- package/esm2022/snack-bar/snack-bar-container.mjs +13 -12
- package/esm2022/snack-bar/snack-bar-content.mjs +9 -9
- package/esm2022/snack-bar/snack-bar.mjs +3 -3
- package/esm2022/sort/sort-header-intl.mjs +3 -3
- package/esm2022/sort/sort-header.mjs +3 -3
- package/esm2022/sort/sort-module.mjs +4 -4
- package/esm2022/sort/sort.mjs +3 -3
- package/esm2022/stepper/step-content.mjs +3 -3
- package/esm2022/stepper/step-header.mjs +3 -3
- package/esm2022/stepper/step-label.mjs +3 -3
- package/esm2022/stepper/stepper-button.mjs +7 -9
- package/esm2022/stepper/stepper-icon.mjs +3 -3
- package/esm2022/stepper/stepper-intl.mjs +3 -3
- package/esm2022/stepper/stepper-module.mjs +4 -4
- package/esm2022/stepper/stepper.mjs +16 -12
- package/esm2022/table/cell.mjs +21 -21
- package/esm2022/table/module.mjs +4 -4
- package/esm2022/table/row.mjs +21 -21
- package/esm2022/table/table.mjs +64 -31
- package/esm2022/table/text-column.mjs +3 -3
- package/esm2022/tabs/ink-bar.mjs +4 -4
- package/esm2022/tabs/module.mjs +4 -4
- package/esm2022/tabs/paginated-tab-header.mjs +13 -6
- package/esm2022/tabs/tab-body.mjs +6 -6
- package/esm2022/tabs/tab-content.mjs +3 -3
- package/esm2022/tabs/tab-group.mjs +20 -9
- package/esm2022/tabs/tab-header.mjs +6 -6
- package/esm2022/tabs/tab-label-wrapper.mjs +3 -3
- package/esm2022/tabs/tab-label.mjs +3 -3
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +12 -12
- package/esm2022/tabs/tab.mjs +9 -5
- package/esm2022/toolbar/toolbar-module.mjs +4 -4
- package/esm2022/toolbar/toolbar.mjs +7 -7
- package/esm2022/tooltip/module.mjs +4 -4
- package/esm2022/tooltip/tooltip.mjs +6 -6
- package/esm2022/tree/node.mjs +9 -9
- package/esm2022/tree/outlet.mjs +3 -3
- package/esm2022/tree/padding.mjs +3 -3
- package/esm2022/tree/toggle.mjs +3 -3
- package/esm2022/tree/tree-module.mjs +4 -4
- package/esm2022/tree/tree.mjs +3 -3
- package/expansion/index.d.ts +2 -2
- package/fesm2022/autocomplete.mjs +16 -15
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +7 -7
- package/fesm2022/bottom-sheet.mjs +12 -13
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button/testing.mjs +3 -2
- package/fesm2022/button/testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +10 -10
- package/fesm2022/button.mjs +82 -55
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/checkbox.mjs +14 -14
- package/fesm2022/chips.mjs +41 -41
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +93 -70
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +86 -86
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +28 -31
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/expansion.mjs +26 -27
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -36
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/list.mjs +52 -52
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +16 -17
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +11 -11
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +7 -7
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/radio.mjs +10 -10
- package/fesm2022/select.mjs +22 -22
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +34 -33
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +17 -17
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +60 -38
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +32 -30
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/stepper.mjs +40 -38
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +111 -78
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +76 -55
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +11 -11
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tree.mjs +25 -25
- package/form-field/_form-field-subscript.scss +1 -2
- package/form-field/_form-field-theme.scss +4 -2
- package/form-field/_mdc-text-field-density-overrides.scss +60 -0
- package/icon/_icon-theme.scss +24 -10
- package/list/index.d.ts +1 -1
- package/package.json +49 -49
- package/paginator/_paginator-theme.scss +5 -4
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +1 -1
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +5 -3
- package/schematics/ng-generate/mdc-migration/index_bundled.js +1251 -633
- package/schematics/ng-generate/mdc-migration/index_bundled.js.map +4 -4
- package/schematics/ng-generate/mdc-migration/schema.json +0 -1
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
- package/slide-toggle/_slide-toggle-theme.scss +16 -28
- package/slide-toggle/index.d.ts +2 -2
- package/slider/_slider-theme.scss +10 -12
- package/slider/index.d.ts +9 -12
- package/snack-bar/index.d.ts +2 -2
- package/stepper/index.d.ts +5 -3
- package/table/index.d.ts +2 -4
- package/tabs/_tabs-common.scss +20 -1
- package/tabs/index.d.ts +14 -7
- package/form-field/_form-field-density.scss +0 -118
- package/form-field/_form-field-sizing.scss +0 -40
|
@@ -8242,7 +8242,7 @@ var ConstantPool = class {
|
|
|
8242
8242
|
}))));
|
|
8243
8243
|
}
|
|
8244
8244
|
}
|
|
8245
|
-
getSharedFunctionReference(fn2, prefix) {
|
|
8245
|
+
getSharedFunctionReference(fn2, prefix, useUniqueName = true) {
|
|
8246
8246
|
var _a2;
|
|
8247
8247
|
const isArrow = fn2 instanceof ArrowFunctionExpr;
|
|
8248
8248
|
for (const current of this.statements) {
|
|
@@ -8253,7 +8253,7 @@ var ConstantPool = class {
|
|
|
8253
8253
|
return variable(current.name);
|
|
8254
8254
|
}
|
|
8255
8255
|
}
|
|
8256
|
-
const name = this.uniqueName(prefix);
|
|
8256
|
+
const name = useUniqueName ? this.uniqueName(prefix) : prefix;
|
|
8257
8257
|
this.statements.push(fn2.toDeclStmt(name, StmtModifier.Final));
|
|
8258
8258
|
return variable(name);
|
|
8259
8259
|
}
|
|
@@ -8952,6 +8952,12 @@ var Identifiers = _Identifiers;
|
|
|
8952
8952
|
(() => {
|
|
8953
8953
|
_Identifiers.validateIframeAttribute = { name: "\u0275\u0275validateIframeAttribute", moduleName: CORE };
|
|
8954
8954
|
})();
|
|
8955
|
+
(() => {
|
|
8956
|
+
_Identifiers.InputSignalBrandWriteType = { name: "\u0275INPUT_SIGNAL_BRAND_WRITE_TYPE", moduleName: CORE };
|
|
8957
|
+
})();
|
|
8958
|
+
(() => {
|
|
8959
|
+
_Identifiers.UnwrapDirectiveSignalInputs = { name: "\u0275UnwrapDirectiveSignalInputs", moduleName: CORE };
|
|
8960
|
+
})();
|
|
8955
8961
|
var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
8956
8962
|
function dashCaseToCamelCase(input) {
|
|
8957
8963
|
return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
|
@@ -9860,13 +9866,17 @@ var TagContentType;
|
|
|
9860
9866
|
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
9861
9867
|
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
9862
9868
|
})(TagContentType || (TagContentType = {}));
|
|
9863
|
-
function splitNsName(elementName) {
|
|
9869
|
+
function splitNsName(elementName, fatal = true) {
|
|
9864
9870
|
if (elementName[0] != ":") {
|
|
9865
9871
|
return [null, elementName];
|
|
9866
9872
|
}
|
|
9867
9873
|
const colonIndex = elementName.indexOf(":", 1);
|
|
9868
9874
|
if (colonIndex === -1) {
|
|
9869
|
-
|
|
9875
|
+
if (fatal) {
|
|
9876
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
9877
|
+
} else {
|
|
9878
|
+
return [null, elementName];
|
|
9879
|
+
}
|
|
9870
9880
|
}
|
|
9871
9881
|
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
9872
9882
|
}
|
|
@@ -10369,28 +10379,6 @@ var BlockPlaceholder = class {
|
|
|
10369
10379
|
return visitor.visitBlockPlaceholder(this, context);
|
|
10370
10380
|
}
|
|
10371
10381
|
};
|
|
10372
|
-
var RecurseVisitor = class {
|
|
10373
|
-
visitText(text2, context) {
|
|
10374
|
-
}
|
|
10375
|
-
visitContainer(container, context) {
|
|
10376
|
-
container.children.forEach((child) => child.visit(this));
|
|
10377
|
-
}
|
|
10378
|
-
visitIcu(icu, context) {
|
|
10379
|
-
Object.keys(icu.cases).forEach((k) => {
|
|
10380
|
-
icu.cases[k].visit(this);
|
|
10381
|
-
});
|
|
10382
|
-
}
|
|
10383
|
-
visitTagPlaceholder(ph, context) {
|
|
10384
|
-
ph.children.forEach((child) => child.visit(this));
|
|
10385
|
-
}
|
|
10386
|
-
visitPlaceholder(ph, context) {
|
|
10387
|
-
}
|
|
10388
|
-
visitIcuPlaceholder(ph, context) {
|
|
10389
|
-
}
|
|
10390
|
-
visitBlockPlaceholder(ph, context) {
|
|
10391
|
-
ph.children.forEach((child) => child.visit(this));
|
|
10392
|
-
}
|
|
10393
|
-
};
|
|
10394
10382
|
function serializeMessage(messageNodes) {
|
|
10395
10383
|
const visitor = new LocalizeMessageStringVisitor();
|
|
10396
10384
|
const str = messageNodes.map((n) => n.visit(visitor)).join("");
|
|
@@ -10456,7 +10444,7 @@ var TRANSLATION_VAR_PREFIX$1 = "i18n_";
|
|
|
10456
10444
|
var I18N_ATTR = "i18n";
|
|
10457
10445
|
var I18N_ATTR_PREFIX = "i18n-";
|
|
10458
10446
|
var I18N_ICU_VAR_PREFIX = "VAR_";
|
|
10459
|
-
var I18N_ICU_MAPPING_PREFIX = "I18N_EXP_";
|
|
10447
|
+
var I18N_ICU_MAPPING_PREFIX$1 = "I18N_EXP_";
|
|
10460
10448
|
var I18N_PLACEHOLDER_SYMBOL = "\uFFFD";
|
|
10461
10449
|
function isI18nAttribute(name) {
|
|
10462
10450
|
return name === I18N_ATTR || name.startsWith(I18N_ATTR_PREFIX);
|
|
@@ -13414,7 +13402,9 @@ var OpKind;
|
|
|
13414
13402
|
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
13415
13403
|
OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
|
|
13416
13404
|
OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
|
|
13417
|
-
OpKind2[OpKind2["
|
|
13405
|
+
OpKind2[OpKind2["IcuPlaceholder"] = 43] = "IcuPlaceholder";
|
|
13406
|
+
OpKind2[OpKind2["I18nContext"] = 44] = "I18nContext";
|
|
13407
|
+
OpKind2[OpKind2["I18nAttributes"] = 45] = "I18nAttributes";
|
|
13418
13408
|
})(OpKind || (OpKind = {}));
|
|
13419
13409
|
var ExpressionKind;
|
|
13420
13410
|
(function(ExpressionKind2) {
|
|
@@ -13439,10 +13429,11 @@ var ExpressionKind;
|
|
|
13439
13429
|
ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
|
|
13440
13430
|
ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
|
|
13441
13431
|
ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
|
|
13442
|
-
ExpressionKind2[ExpressionKind2["
|
|
13443
|
-
ExpressionKind2[ExpressionKind2["
|
|
13444
|
-
ExpressionKind2[ExpressionKind2["
|
|
13445
|
-
ExpressionKind2[ExpressionKind2["
|
|
13432
|
+
ExpressionKind2[ExpressionKind2["TrustedValueFnExpr"] = 21] = "TrustedValueFnExpr";
|
|
13433
|
+
ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
|
|
13434
|
+
ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
|
|
13435
|
+
ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 24] = "DerivedRepeaterVar";
|
|
13436
|
+
ExpressionKind2[ExpressionKind2["ConstCollected"] = 25] = "ConstCollected";
|
|
13446
13437
|
})(ExpressionKind || (ExpressionKind = {}));
|
|
13447
13438
|
var VariableFlags;
|
|
13448
13439
|
(function(VariableFlags2) {
|
|
@@ -13461,15 +13452,6 @@ var CompatibilityMode;
|
|
|
13461
13452
|
CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
|
|
13462
13453
|
CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
|
|
13463
13454
|
})(CompatibilityMode || (CompatibilityMode = {}));
|
|
13464
|
-
var SanitizerFn;
|
|
13465
|
-
(function(SanitizerFn2) {
|
|
13466
|
-
SanitizerFn2[SanitizerFn2["Html"] = 0] = "Html";
|
|
13467
|
-
SanitizerFn2[SanitizerFn2["Script"] = 1] = "Script";
|
|
13468
|
-
SanitizerFn2[SanitizerFn2["Style"] = 2] = "Style";
|
|
13469
|
-
SanitizerFn2[SanitizerFn2["Url"] = 3] = "Url";
|
|
13470
|
-
SanitizerFn2[SanitizerFn2["ResourceUrl"] = 4] = "ResourceUrl";
|
|
13471
|
-
SanitizerFn2[SanitizerFn2["IframeAttribute"] = 5] = "IframeAttribute";
|
|
13472
|
-
})(SanitizerFn || (SanitizerFn = {}));
|
|
13473
13455
|
var DeferSecondaryKind;
|
|
13474
13456
|
(function(DeferSecondaryKind2) {
|
|
13475
13457
|
DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
|
|
@@ -13491,6 +13473,11 @@ var I18nParamResolutionTime;
|
|
|
13491
13473
|
I18nParamResolutionTime2[I18nParamResolutionTime2["Creation"] = 0] = "Creation";
|
|
13492
13474
|
I18nParamResolutionTime2[I18nParamResolutionTime2["Postproccessing"] = 1] = "Postproccessing";
|
|
13493
13475
|
})(I18nParamResolutionTime || (I18nParamResolutionTime = {}));
|
|
13476
|
+
var I18nExpressionFor;
|
|
13477
|
+
(function(I18nExpressionFor2) {
|
|
13478
|
+
I18nExpressionFor2[I18nExpressionFor2["I18nText"] = 0] = "I18nText";
|
|
13479
|
+
I18nExpressionFor2[I18nExpressionFor2["I18nAttribute"] = 1] = "I18nAttribute";
|
|
13480
|
+
})(I18nExpressionFor || (I18nExpressionFor = {}));
|
|
13494
13481
|
var I18nParamValueFlags;
|
|
13495
13482
|
(function(I18nParamValueFlags2) {
|
|
13496
13483
|
I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
|
|
@@ -13526,7 +13513,14 @@ var I18nContextKind;
|
|
|
13526
13513
|
(function(I18nContextKind2) {
|
|
13527
13514
|
I18nContextKind2[I18nContextKind2["RootI18n"] = 0] = "RootI18n";
|
|
13528
13515
|
I18nContextKind2[I18nContextKind2["Icu"] = 1] = "Icu";
|
|
13516
|
+
I18nContextKind2[I18nContextKind2["Attr"] = 2] = "Attr";
|
|
13529
13517
|
})(I18nContextKind || (I18nContextKind = {}));
|
|
13518
|
+
var TemplateKind;
|
|
13519
|
+
(function(TemplateKind2) {
|
|
13520
|
+
TemplateKind2[TemplateKind2["NgTemplate"] = 0] = "NgTemplate";
|
|
13521
|
+
TemplateKind2[TemplateKind2["Structural"] = 1] = "Structural";
|
|
13522
|
+
TemplateKind2[TemplateKind2["Block"] = 2] = "Block";
|
|
13523
|
+
})(TemplateKind || (TemplateKind = {}));
|
|
13530
13524
|
var ConsumesSlot = Symbol("ConsumesSlot");
|
|
13531
13525
|
var DependsOnSlotContext = Symbol("DependsOnSlotContext");
|
|
13532
13526
|
var ConsumesVarsTrait = Symbol("ConsumesVars");
|
|
@@ -13577,22 +13571,25 @@ var NEW_OP = {
|
|
|
13577
13571
|
prev: null,
|
|
13578
13572
|
next: null
|
|
13579
13573
|
};
|
|
13580
|
-
function createInterpolateTextOp(xref, interpolation,
|
|
13574
|
+
function createInterpolateTextOp(xref, interpolation, sourceSpan) {
|
|
13581
13575
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
13582
13576
|
kind: OpKind.InterpolateText,
|
|
13583
13577
|
target: xref,
|
|
13584
13578
|
interpolation,
|
|
13585
|
-
i18nPlaceholders,
|
|
13586
13579
|
sourceSpan
|
|
13587
13580
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
13588
13581
|
}
|
|
13589
13582
|
var Interpolation = class {
|
|
13590
|
-
constructor(strings, expressions) {
|
|
13583
|
+
constructor(strings, expressions, i18nPlaceholders) {
|
|
13591
13584
|
this.strings = strings;
|
|
13592
13585
|
this.expressions = expressions;
|
|
13586
|
+
this.i18nPlaceholders = i18nPlaceholders;
|
|
13587
|
+
if (i18nPlaceholders.length !== 0 && i18nPlaceholders.length !== expressions.length) {
|
|
13588
|
+
throw new Error(`Expected ${expressions.length} placeholders to match interpolation expression count, but got ${i18nPlaceholders.length}`);
|
|
13589
|
+
}
|
|
13593
13590
|
}
|
|
13594
13591
|
};
|
|
13595
|
-
function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute,
|
|
13592
|
+
function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
13596
13593
|
return __spreadValues({
|
|
13597
13594
|
kind: OpKind.Binding,
|
|
13598
13595
|
bindingKind: kind,
|
|
@@ -13602,11 +13599,14 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
|
|
|
13602
13599
|
unit,
|
|
13603
13600
|
securityContext,
|
|
13604
13601
|
isTextAttribute,
|
|
13605
|
-
|
|
13602
|
+
isStructuralTemplateAttribute,
|
|
13603
|
+
templateKind,
|
|
13604
|
+
i18nContext: null,
|
|
13605
|
+
i18nMessage,
|
|
13606
13606
|
sourceSpan
|
|
13607
13607
|
}, NEW_OP);
|
|
13608
13608
|
}
|
|
13609
|
-
function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext,
|
|
13609
|
+
function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
|
|
13610
13610
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
13611
13611
|
kind: OpKind.Property,
|
|
13612
13612
|
target,
|
|
@@ -13615,7 +13615,10 @@ function createPropertyOp(target, name, expression, isAnimationTrigger, security
|
|
|
13615
13615
|
isAnimationTrigger,
|
|
13616
13616
|
securityContext,
|
|
13617
13617
|
sanitizer: null,
|
|
13618
|
-
|
|
13618
|
+
isStructuralTemplateAttribute,
|
|
13619
|
+
templateKind,
|
|
13620
|
+
i18nContext,
|
|
13621
|
+
i18nMessage,
|
|
13619
13622
|
sourceSpan
|
|
13620
13623
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
13621
13624
|
}
|
|
@@ -13654,7 +13657,7 @@ function createClassMapOp(xref, expression, sourceSpan) {
|
|
|
13654
13657
|
sourceSpan
|
|
13655
13658
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
13656
13659
|
}
|
|
13657
|
-
function createAttributeOp(target, name, expression, securityContext, isTextAttribute,
|
|
13660
|
+
function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
13658
13661
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
13659
13662
|
kind: OpKind.Attribute,
|
|
13660
13663
|
target,
|
|
@@ -13663,7 +13666,10 @@ function createAttributeOp(target, name, expression, securityContext, isTextAttr
|
|
|
13663
13666
|
securityContext,
|
|
13664
13667
|
sanitizer: null,
|
|
13665
13668
|
isTextAttribute,
|
|
13666
|
-
|
|
13669
|
+
isStructuralTemplateAttribute,
|
|
13670
|
+
templateKind,
|
|
13671
|
+
i18nContext: null,
|
|
13672
|
+
i18nMessage,
|
|
13667
13673
|
sourceSpan
|
|
13668
13674
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
13669
13675
|
}
|
|
@@ -13696,30 +13702,34 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
|
13696
13702
|
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
13697
13703
|
}
|
|
13698
13704
|
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
13699
|
-
return __spreadValues(__spreadValues({
|
|
13705
|
+
return __spreadValues(__spreadValues(__spreadValues({
|
|
13700
13706
|
kind: OpKind.DeferWhen,
|
|
13701
13707
|
target,
|
|
13702
13708
|
expr,
|
|
13703
13709
|
prefetch,
|
|
13704
13710
|
sourceSpan
|
|
13705
|
-
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
13711
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
|
|
13706
13712
|
}
|
|
13707
|
-
function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
|
|
13713
|
+
function createI18nExpressionOp(context, target, i18nOwner, handle, expression, icuPlaceholder, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
|
|
13708
13714
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
13709
13715
|
kind: OpKind.I18nExpression,
|
|
13710
13716
|
context,
|
|
13711
13717
|
target,
|
|
13718
|
+
i18nOwner,
|
|
13712
13719
|
handle,
|
|
13713
13720
|
expression,
|
|
13721
|
+
icuPlaceholder,
|
|
13714
13722
|
i18nPlaceholder,
|
|
13715
13723
|
resolutionTime,
|
|
13724
|
+
usage,
|
|
13725
|
+
name,
|
|
13716
13726
|
sourceSpan
|
|
13717
13727
|
}, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
13718
13728
|
}
|
|
13719
|
-
function createI18nApplyOp(
|
|
13729
|
+
function createI18nApplyOp(owner, handle, sourceSpan) {
|
|
13720
13730
|
return __spreadValues({
|
|
13721
13731
|
kind: OpKind.I18nApply,
|
|
13722
|
-
|
|
13732
|
+
owner,
|
|
13723
13733
|
handle,
|
|
13724
13734
|
sourceSpan
|
|
13725
13735
|
}, NEW_OP);
|
|
@@ -14254,26 +14264,6 @@ var ReadTemporaryExpr = class extends ExpressionBase {
|
|
|
14254
14264
|
return r;
|
|
14255
14265
|
}
|
|
14256
14266
|
};
|
|
14257
|
-
var SanitizerExpr = class extends ExpressionBase {
|
|
14258
|
-
constructor(fn2) {
|
|
14259
|
-
super();
|
|
14260
|
-
this.fn = fn2;
|
|
14261
|
-
this.kind = ExpressionKind.SanitizerExpr;
|
|
14262
|
-
}
|
|
14263
|
-
visitExpression(visitor, context) {
|
|
14264
|
-
}
|
|
14265
|
-
isEquivalent(e) {
|
|
14266
|
-
return e instanceof SanitizerExpr && e.fn === this.fn;
|
|
14267
|
-
}
|
|
14268
|
-
isConstant() {
|
|
14269
|
-
return true;
|
|
14270
|
-
}
|
|
14271
|
-
clone() {
|
|
14272
|
-
return new SanitizerExpr(this.fn);
|
|
14273
|
-
}
|
|
14274
|
-
transformInternalExpressions() {
|
|
14275
|
-
}
|
|
14276
|
-
};
|
|
14277
14267
|
var SlotLiteralExpr = class extends ExpressionBase {
|
|
14278
14268
|
constructor(slot) {
|
|
14279
14269
|
super();
|
|
@@ -14392,7 +14382,6 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
14392
14382
|
case OpKind.ClassProp:
|
|
14393
14383
|
case OpKind.ClassMap:
|
|
14394
14384
|
case OpKind.Binding:
|
|
14395
|
-
case OpKind.HostProperty:
|
|
14396
14385
|
if (op.expression instanceof Interpolation) {
|
|
14397
14386
|
transformExpressionsInInterpolation(op.expression, transform2, flags);
|
|
14398
14387
|
} else {
|
|
@@ -14400,6 +14389,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
14400
14389
|
}
|
|
14401
14390
|
break;
|
|
14402
14391
|
case OpKind.Property:
|
|
14392
|
+
case OpKind.HostProperty:
|
|
14403
14393
|
case OpKind.Attribute:
|
|
14404
14394
|
if (op.expression instanceof Interpolation) {
|
|
14405
14395
|
transformExpressionsInInterpolation(op.expression, transform2, flags);
|
|
@@ -14441,6 +14431,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
14441
14431
|
break;
|
|
14442
14432
|
case OpKind.ExtractedAttribute:
|
|
14443
14433
|
op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
|
|
14434
|
+
op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform2, flags);
|
|
14444
14435
|
break;
|
|
14445
14436
|
case OpKind.RepeaterCreate:
|
|
14446
14437
|
op.track = transformExpressionsInExpression(op.track, transform2, flags);
|
|
@@ -14458,6 +14449,9 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
14458
14449
|
if (op.placeholderConfig !== null) {
|
|
14459
14450
|
op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
|
|
14460
14451
|
}
|
|
14452
|
+
if (op.resolverFn !== null) {
|
|
14453
|
+
op.resolverFn = transformExpressionsInExpression(op.resolverFn, transform2, flags);
|
|
14454
|
+
}
|
|
14461
14455
|
break;
|
|
14462
14456
|
case OpKind.I18nMessage:
|
|
14463
14457
|
for (const [placeholder, expr] of op.params) {
|
|
@@ -14493,6 +14487,8 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
14493
14487
|
case OpKind.ProjectionDef:
|
|
14494
14488
|
case OpKind.Template:
|
|
14495
14489
|
case OpKind.Text:
|
|
14490
|
+
case OpKind.I18nAttributes:
|
|
14491
|
+
case OpKind.IcuPlaceholder:
|
|
14496
14492
|
break;
|
|
14497
14493
|
default:
|
|
14498
14494
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
@@ -14504,6 +14500,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
14504
14500
|
} else if (expr instanceof BinaryOperatorExpr) {
|
|
14505
14501
|
expr.lhs = transformExpressionsInExpression(expr.lhs, transform2, flags);
|
|
14506
14502
|
expr.rhs = transformExpressionsInExpression(expr.rhs, transform2, flags);
|
|
14503
|
+
} else if (expr instanceof UnaryOperatorExpr) {
|
|
14504
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
14507
14505
|
} else if (expr instanceof ReadPropExpr) {
|
|
14508
14506
|
expr.receiver = transformExpressionsInExpression(expr.receiver, transform2, flags);
|
|
14509
14507
|
} else if (expr instanceof ReadKeyExpr) {
|
|
@@ -14543,6 +14541,20 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
14543
14541
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
14544
14542
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
|
|
14545
14543
|
}
|
|
14544
|
+
} else if (expr instanceof NotExpr) {
|
|
14545
|
+
expr.condition = transformExpressionsInExpression(expr.condition, transform2, flags);
|
|
14546
|
+
} else if (expr instanceof TaggedTemplateExpr) {
|
|
14547
|
+
expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
|
|
14548
|
+
expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
|
|
14549
|
+
} else if (expr instanceof ArrowFunctionExpr) {
|
|
14550
|
+
if (Array.isArray(expr.body)) {
|
|
14551
|
+
for (let i = 0; i < expr.body.length; i++) {
|
|
14552
|
+
transformExpressionsInStatement(expr.body[i], transform2, flags);
|
|
14553
|
+
}
|
|
14554
|
+
} else {
|
|
14555
|
+
expr.body = transformExpressionsInExpression(expr.body, transform2, flags);
|
|
14556
|
+
}
|
|
14557
|
+
} else if (expr instanceof WrappedNodeExpr) {
|
|
14546
14558
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
14547
14559
|
} else {
|
|
14548
14560
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
@@ -14778,7 +14790,7 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
|
|
|
14778
14790
|
function isElementOrContainerOp(op) {
|
|
14779
14791
|
return elementContainerOpKinds.has(op.kind);
|
|
14780
14792
|
}
|
|
14781
|
-
function createElementStartOp(tag, xref, namespace, i18nPlaceholder,
|
|
14793
|
+
function createElementStartOp(tag, xref, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
14782
14794
|
return __spreadValues(__spreadValues({
|
|
14783
14795
|
kind: OpKind.ElementStart,
|
|
14784
14796
|
xref,
|
|
@@ -14789,13 +14801,15 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
|
|
|
14789
14801
|
nonBindable: false,
|
|
14790
14802
|
namespace,
|
|
14791
14803
|
i18nPlaceholder,
|
|
14792
|
-
|
|
14804
|
+
startSourceSpan,
|
|
14805
|
+
wholeSourceSpan
|
|
14793
14806
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
14794
14807
|
}
|
|
14795
|
-
function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlaceholder,
|
|
14808
|
+
function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
14796
14809
|
return __spreadValues(__spreadValues({
|
|
14797
14810
|
kind: OpKind.Template,
|
|
14798
14811
|
xref,
|
|
14812
|
+
templateKind,
|
|
14799
14813
|
attributes: null,
|
|
14800
14814
|
tag,
|
|
14801
14815
|
handle: new SlotHandle(),
|
|
@@ -14806,11 +14820,12 @@ function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlacehol
|
|
|
14806
14820
|
nonBindable: false,
|
|
14807
14821
|
namespace,
|
|
14808
14822
|
i18nPlaceholder,
|
|
14809
|
-
|
|
14823
|
+
startSourceSpan,
|
|
14824
|
+
wholeSourceSpan
|
|
14810
14825
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
14811
14826
|
}
|
|
14812
|
-
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames,
|
|
14813
|
-
return __spreadProps(__spreadValues(__spreadValues({
|
|
14827
|
+
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
14828
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
14814
14829
|
kind: OpKind.RepeaterCreate,
|
|
14815
14830
|
attributes: null,
|
|
14816
14831
|
xref: primaryView,
|
|
@@ -14819,6 +14834,8 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
|
|
|
14819
14834
|
track,
|
|
14820
14835
|
trackByFn: null,
|
|
14821
14836
|
tag,
|
|
14837
|
+
emptyTag,
|
|
14838
|
+
emptyAttributes: null,
|
|
14822
14839
|
functionNameSuffix: "For",
|
|
14823
14840
|
namespace: Namespace.HTML,
|
|
14824
14841
|
nonBindable: false,
|
|
@@ -14827,8 +14844,11 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
|
|
|
14827
14844
|
vars: null,
|
|
14828
14845
|
varNames,
|
|
14829
14846
|
usesComponentInstance: false,
|
|
14830
|
-
|
|
14831
|
-
|
|
14847
|
+
i18nPlaceholder,
|
|
14848
|
+
emptyI18nPlaceholder,
|
|
14849
|
+
startSourceSpan,
|
|
14850
|
+
wholeSourceSpan
|
|
14851
|
+
}, TRAIT_CONSUMES_SLOT), NEW_OP), TRAIT_CONSUMES_VARS), {
|
|
14832
14852
|
numSlotsUsed: emptyView === null ? 2 : 3
|
|
14833
14853
|
});
|
|
14834
14854
|
}
|
|
@@ -14851,16 +14871,19 @@ function createEnableBindingsOp(xref) {
|
|
|
14851
14871
|
xref
|
|
14852
14872
|
}, NEW_OP);
|
|
14853
14873
|
}
|
|
14854
|
-
function createTextOp(xref, initialValue, sourceSpan) {
|
|
14874
|
+
function createTextOp(xref, initialValue, icuPlaceholder, sourceSpan) {
|
|
14855
14875
|
return __spreadValues(__spreadValues({
|
|
14856
14876
|
kind: OpKind.Text,
|
|
14857
14877
|
xref,
|
|
14858
14878
|
handle: new SlotHandle(),
|
|
14859
14879
|
initialValue,
|
|
14880
|
+
icuPlaceholder,
|
|
14860
14881
|
sourceSpan
|
|
14861
14882
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
14862
14883
|
}
|
|
14863
|
-
function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
|
|
14884
|
+
function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {
|
|
14885
|
+
const handlerList = new OpList();
|
|
14886
|
+
handlerList.push(handlerOps);
|
|
14864
14887
|
return __spreadValues({
|
|
14865
14888
|
kind: OpKind.Listener,
|
|
14866
14889
|
target,
|
|
@@ -14868,11 +14891,12 @@ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostLis
|
|
|
14868
14891
|
tag,
|
|
14869
14892
|
hostListener,
|
|
14870
14893
|
name,
|
|
14871
|
-
handlerOps:
|
|
14894
|
+
handlerOps: handlerList,
|
|
14872
14895
|
handlerFnName: null,
|
|
14873
14896
|
consumesDollarEvent: false,
|
|
14874
14897
|
isAnimationListener: animationPhase !== null,
|
|
14875
14898
|
animationPhase,
|
|
14899
|
+
eventTarget,
|
|
14876
14900
|
sourceSpan
|
|
14877
14901
|
}, NEW_OP);
|
|
14878
14902
|
}
|
|
@@ -14896,25 +14920,30 @@ function createProjectionDefOp(def) {
|
|
|
14896
14920
|
def
|
|
14897
14921
|
}, NEW_OP);
|
|
14898
14922
|
}
|
|
14899
|
-
function createProjectionOp(xref, selector, sourceSpan) {
|
|
14923
|
+
function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
|
|
14900
14924
|
return __spreadValues(__spreadValues({
|
|
14901
14925
|
kind: OpKind.Projection,
|
|
14902
14926
|
xref,
|
|
14903
14927
|
handle: new SlotHandle(),
|
|
14904
14928
|
selector,
|
|
14929
|
+
i18nPlaceholder,
|
|
14905
14930
|
projectionSlotIndex: 0,
|
|
14906
|
-
attributes:
|
|
14931
|
+
attributes: null,
|
|
14907
14932
|
localRefs: [],
|
|
14908
14933
|
sourceSpan
|
|
14909
14934
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
14910
14935
|
}
|
|
14911
|
-
function createExtractedAttributeOp(target, bindingKind, name, expression) {
|
|
14936
|
+
function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
14912
14937
|
return __spreadValues({
|
|
14913
14938
|
kind: OpKind.ExtractedAttribute,
|
|
14914
14939
|
target,
|
|
14915
14940
|
bindingKind,
|
|
14916
14941
|
name,
|
|
14917
|
-
expression
|
|
14942
|
+
expression,
|
|
14943
|
+
i18nContext,
|
|
14944
|
+
i18nMessage,
|
|
14945
|
+
securityContext,
|
|
14946
|
+
trustedValueFn: null
|
|
14918
14947
|
}, NEW_OP);
|
|
14919
14948
|
}
|
|
14920
14949
|
function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
|
|
@@ -14951,10 +14980,11 @@ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
|
|
|
14951
14980
|
sourceSpan
|
|
14952
14981
|
}, NEW_OP);
|
|
14953
14982
|
}
|
|
14954
|
-
function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
14983
|
+
function createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
14955
14984
|
return __spreadValues({
|
|
14956
14985
|
kind: OpKind.I18nMessage,
|
|
14957
14986
|
xref,
|
|
14987
|
+
i18nContext,
|
|
14958
14988
|
i18nBlock,
|
|
14959
14989
|
message,
|
|
14960
14990
|
messagePlaceholder,
|
|
@@ -14964,7 +14994,7 @@ function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, param
|
|
|
14964
14994
|
subMessages: []
|
|
14965
14995
|
}, NEW_OP);
|
|
14966
14996
|
}
|
|
14967
|
-
function createI18nStartOp(xref, message, root2) {
|
|
14997
|
+
function createI18nStartOp(xref, message, root2, sourceSpan) {
|
|
14968
14998
|
return __spreadValues(__spreadValues({
|
|
14969
14999
|
kind: OpKind.I18nStart,
|
|
14970
15000
|
xref,
|
|
@@ -14973,13 +15003,15 @@ function createI18nStartOp(xref, message, root2) {
|
|
|
14973
15003
|
message,
|
|
14974
15004
|
messageIndex: null,
|
|
14975
15005
|
subTemplateIndex: null,
|
|
14976
|
-
context: null
|
|
15006
|
+
context: null,
|
|
15007
|
+
sourceSpan
|
|
14977
15008
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
14978
15009
|
}
|
|
14979
|
-
function createI18nEndOp(xref) {
|
|
15010
|
+
function createI18nEndOp(xref, sourceSpan) {
|
|
14980
15011
|
return __spreadValues({
|
|
14981
15012
|
kind: OpKind.I18nEnd,
|
|
14982
|
-
xref
|
|
15013
|
+
xref,
|
|
15014
|
+
sourceSpan
|
|
14983
15015
|
}, NEW_OP);
|
|
14984
15016
|
}
|
|
14985
15017
|
function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
|
|
@@ -14998,7 +15030,19 @@ function createIcuEndOp(xref) {
|
|
|
14998
15030
|
xref
|
|
14999
15031
|
}, NEW_OP);
|
|
15000
15032
|
}
|
|
15033
|
+
function createIcuPlaceholderOp(xref, name, strings) {
|
|
15034
|
+
return __spreadValues({
|
|
15035
|
+
kind: OpKind.IcuPlaceholder,
|
|
15036
|
+
xref,
|
|
15037
|
+
name,
|
|
15038
|
+
strings,
|
|
15039
|
+
expressionPlaceholders: []
|
|
15040
|
+
}, NEW_OP);
|
|
15041
|
+
}
|
|
15001
15042
|
function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
|
|
15043
|
+
if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
|
|
15044
|
+
throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
|
|
15045
|
+
}
|
|
15002
15046
|
return __spreadValues({
|
|
15003
15047
|
kind: OpKind.I18nContext,
|
|
15004
15048
|
contextKind,
|
|
@@ -15010,12 +15054,24 @@ function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan)
|
|
|
15010
15054
|
postprocessingParams: /* @__PURE__ */ new Map()
|
|
15011
15055
|
}, NEW_OP);
|
|
15012
15056
|
}
|
|
15013
|
-
function
|
|
15057
|
+
function createI18nAttributesOp(xref, handle, target) {
|
|
15058
|
+
return __spreadValues(__spreadValues({
|
|
15059
|
+
kind: OpKind.I18nAttributes,
|
|
15060
|
+
xref,
|
|
15061
|
+
handle,
|
|
15062
|
+
target,
|
|
15063
|
+
i18nAttributesConfig: null
|
|
15064
|
+
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
15065
|
+
}
|
|
15066
|
+
function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
15014
15067
|
return __spreadValues(__spreadValues({
|
|
15015
15068
|
kind: OpKind.HostProperty,
|
|
15016
15069
|
name,
|
|
15017
15070
|
expression,
|
|
15018
15071
|
isAnimationTrigger,
|
|
15072
|
+
i18nContext,
|
|
15073
|
+
securityContext,
|
|
15074
|
+
sanitizer: null,
|
|
15019
15075
|
sourceSpan
|
|
15020
15076
|
}, TRAIT_CONSUMES_VARS), NEW_OP);
|
|
15021
15077
|
}
|
|
@@ -15153,7 +15209,7 @@ function applyI18nExpressions(job) {
|
|
|
15153
15209
|
for (const unit of job.units) {
|
|
15154
15210
|
for (const op of unit.update) {
|
|
15155
15211
|
if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
|
|
15156
|
-
OpList.insertAfter(createI18nApplyOp(op.
|
|
15212
|
+
OpList.insertAfter(createI18nApplyOp(op.i18nOwner, op.handle, null), op);
|
|
15157
15213
|
}
|
|
15158
15214
|
}
|
|
15159
15215
|
}
|
|
@@ -15165,33 +15221,62 @@ function needsApplication(i18nContexts, op) {
|
|
|
15165
15221
|
}
|
|
15166
15222
|
const context = i18nContexts.get(op.context);
|
|
15167
15223
|
const nextContext2 = i18nContexts.get(op.next.context);
|
|
15168
|
-
if (context
|
|
15224
|
+
if (context === void 0) {
|
|
15225
|
+
throw new Error("AssertionError: expected an I18nContextOp to exist for the I18nExpressionOp's context");
|
|
15226
|
+
}
|
|
15227
|
+
if (nextContext2 === void 0) {
|
|
15228
|
+
throw new Error("AssertionError: expected an I18nContextOp to exist for the next I18nExpressionOp's context");
|
|
15229
|
+
}
|
|
15230
|
+
if (context.i18nBlock !== null) {
|
|
15231
|
+
if (context.i18nBlock !== nextContext2.i18nBlock) {
|
|
15232
|
+
return true;
|
|
15233
|
+
}
|
|
15234
|
+
return false;
|
|
15235
|
+
}
|
|
15236
|
+
if (op.i18nOwner !== op.next.i18nOwner) {
|
|
15169
15237
|
return true;
|
|
15170
15238
|
}
|
|
15171
15239
|
return false;
|
|
15172
15240
|
}
|
|
15173
15241
|
function assignI18nSlotDependencies(job) {
|
|
15174
|
-
const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
|
|
15175
|
-
let lastSlotConsumer = null;
|
|
15176
|
-
let currentI18nOp = null;
|
|
15177
15242
|
for (const unit of job.units) {
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15243
|
+
let updateOp = unit.update.head;
|
|
15244
|
+
let i18nExpressionsInProgress = [];
|
|
15245
|
+
let state = null;
|
|
15246
|
+
for (const createOp of unit.create) {
|
|
15247
|
+
if (createOp.kind === OpKind.I18nStart) {
|
|
15248
|
+
state = {
|
|
15249
|
+
blockXref: createOp.xref,
|
|
15250
|
+
lastSlotConsumer: createOp.xref
|
|
15251
|
+
};
|
|
15252
|
+
} else if (createOp.kind === OpKind.I18nEnd) {
|
|
15253
|
+
for (const op of i18nExpressionsInProgress) {
|
|
15254
|
+
op.target = state.lastSlotConsumer;
|
|
15255
|
+
OpList.insertBefore(op, updateOp);
|
|
15256
|
+
}
|
|
15257
|
+
i18nExpressionsInProgress.length = 0;
|
|
15258
|
+
state = null;
|
|
15190
15259
|
}
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15260
|
+
if (hasConsumesSlotTrait(createOp)) {
|
|
15261
|
+
if (state !== null) {
|
|
15262
|
+
state.lastSlotConsumer = createOp.xref;
|
|
15263
|
+
}
|
|
15264
|
+
while (true) {
|
|
15265
|
+
if (updateOp.next === null) {
|
|
15266
|
+
break;
|
|
15267
|
+
}
|
|
15268
|
+
if (state !== null && updateOp.kind === OpKind.I18nExpression && updateOp.usage === I18nExpressionFor.I18nText && updateOp.i18nOwner === state.blockXref) {
|
|
15269
|
+
const opToRemove = updateOp;
|
|
15270
|
+
updateOp = updateOp.next;
|
|
15271
|
+
OpList.remove(opToRemove);
|
|
15272
|
+
i18nExpressionsInProgress.push(opToRemove);
|
|
15273
|
+
continue;
|
|
15274
|
+
}
|
|
15275
|
+
if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
|
|
15276
|
+
break;
|
|
15277
|
+
}
|
|
15278
|
+
updateOp = updateOp.next;
|
|
15279
|
+
}
|
|
15195
15280
|
}
|
|
15196
15281
|
}
|
|
15197
15282
|
}
|
|
@@ -15203,6 +15288,9 @@ function createOpXrefMap(unit) {
|
|
|
15203
15288
|
continue;
|
|
15204
15289
|
}
|
|
15205
15290
|
map.set(op.xref, op);
|
|
15291
|
+
if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
|
|
15292
|
+
map.set(op.emptyView, op);
|
|
15293
|
+
}
|
|
15206
15294
|
}
|
|
15207
15295
|
return map;
|
|
15208
15296
|
}
|
|
@@ -15216,19 +15304,57 @@ function extractAttributes(job) {
|
|
|
15216
15304
|
break;
|
|
15217
15305
|
case OpKind.Property:
|
|
15218
15306
|
if (!op.isAnimationTrigger) {
|
|
15219
|
-
|
|
15307
|
+
let bindingKind;
|
|
15308
|
+
if (op.i18nMessage !== null && op.templateKind === null) {
|
|
15309
|
+
bindingKind = BindingKind.I18n;
|
|
15310
|
+
} else if (op.isStructuralTemplateAttribute) {
|
|
15311
|
+
bindingKind = BindingKind.Template;
|
|
15312
|
+
} else {
|
|
15313
|
+
bindingKind = BindingKind.Property;
|
|
15314
|
+
}
|
|
15315
|
+
OpList.insertBefore(
|
|
15316
|
+
createExtractedAttributeOp(
|
|
15317
|
+
op.target,
|
|
15318
|
+
bindingKind,
|
|
15319
|
+
op.name,
|
|
15320
|
+
null,
|
|
15321
|
+
null,
|
|
15322
|
+
null,
|
|
15323
|
+
op.securityContext
|
|
15324
|
+
),
|
|
15325
|
+
lookupElement$2(elements, op.target)
|
|
15326
|
+
);
|
|
15220
15327
|
}
|
|
15221
15328
|
break;
|
|
15222
15329
|
case OpKind.StyleProp:
|
|
15223
15330
|
case OpKind.ClassProp:
|
|
15224
15331
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr) {
|
|
15225
|
-
OpList.insertBefore(createExtractedAttributeOp(
|
|
15332
|
+
OpList.insertBefore(createExtractedAttributeOp(
|
|
15333
|
+
op.target,
|
|
15334
|
+
BindingKind.Property,
|
|
15335
|
+
op.name,
|
|
15336
|
+
null,
|
|
15337
|
+
null,
|
|
15338
|
+
null,
|
|
15339
|
+
SecurityContext.STYLE
|
|
15340
|
+
), lookupElement$2(elements, op.target));
|
|
15226
15341
|
}
|
|
15227
15342
|
break;
|
|
15228
15343
|
case OpKind.Listener:
|
|
15229
15344
|
if (!op.isAnimationListener) {
|
|
15230
|
-
const extractedAttributeOp = createExtractedAttributeOp(
|
|
15345
|
+
const extractedAttributeOp = createExtractedAttributeOp(
|
|
15346
|
+
op.target,
|
|
15347
|
+
BindingKind.Property,
|
|
15348
|
+
op.name,
|
|
15349
|
+
null,
|
|
15350
|
+
null,
|
|
15351
|
+
null,
|
|
15352
|
+
SecurityContext.NONE
|
|
15353
|
+
);
|
|
15231
15354
|
if (job.kind === CompilationJobKind.Host) {
|
|
15355
|
+
if (job.compatibility) {
|
|
15356
|
+
break;
|
|
15357
|
+
}
|
|
15232
15358
|
unit.create.push(extractedAttributeOp);
|
|
15233
15359
|
} else {
|
|
15234
15360
|
OpList.insertBefore(extractedAttributeOp, lookupElement$2(elements, op.target));
|
|
@@ -15250,18 +15376,12 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
15250
15376
|
if (op.expression instanceof Interpolation) {
|
|
15251
15377
|
return;
|
|
15252
15378
|
}
|
|
15253
|
-
let extractable = op.expression.isConstant();
|
|
15379
|
+
let extractable = op.isTextAttribute || op.expression.isConstant();
|
|
15254
15380
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
15255
|
-
extractable =
|
|
15256
|
-
if (op.name === "style" || op.name === "class") {
|
|
15257
|
-
extractable && (extractable = op.isTextAttribute);
|
|
15258
|
-
}
|
|
15259
|
-
if (unit.job.kind === CompilationJobKind.Host) {
|
|
15260
|
-
extractable && (extractable = op.isTextAttribute);
|
|
15261
|
-
}
|
|
15381
|
+
extractable && (extractable = op.isTextAttribute);
|
|
15262
15382
|
}
|
|
15263
15383
|
if (extractable) {
|
|
15264
|
-
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.
|
|
15384
|
+
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
15265
15385
|
if (unit.job.kind === CompilationJobKind.Host) {
|
|
15266
15386
|
unit.create.push(extractedAttributeOp);
|
|
15267
15387
|
} else {
|
|
@@ -15300,15 +15420,15 @@ function specializeBindings(job) {
|
|
|
15300
15420
|
const target = lookupElement$1(elements, op.target);
|
|
15301
15421
|
target.nonBindable = true;
|
|
15302
15422
|
} else {
|
|
15303
|
-
OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.
|
|
15423
|
+
OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
15304
15424
|
}
|
|
15305
15425
|
break;
|
|
15306
15426
|
case BindingKind.Property:
|
|
15307
15427
|
case BindingKind.Animation:
|
|
15308
15428
|
if (job.kind === CompilationJobKind.Host) {
|
|
15309
|
-
OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.sourceSpan));
|
|
15429
|
+
OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
15310
15430
|
} else {
|
|
15311
|
-
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.
|
|
15431
|
+
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
15312
15432
|
}
|
|
15313
15433
|
break;
|
|
15314
15434
|
case BindingKind.I18n:
|
|
@@ -15481,9 +15601,9 @@ function collectElementConsts(job) {
|
|
|
15481
15601
|
for (const unit of job.units) {
|
|
15482
15602
|
for (const op of unit.create) {
|
|
15483
15603
|
if (op.kind === OpKind.ExtractedAttribute) {
|
|
15484
|
-
const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
|
|
15604
|
+
const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
|
|
15485
15605
|
allElementAttributes.set(op.target, attributes);
|
|
15486
|
-
attributes.add(op.bindingKind, op.name, op.expression);
|
|
15606
|
+
attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
|
|
15487
15607
|
OpList.remove(op);
|
|
15488
15608
|
}
|
|
15489
15609
|
}
|
|
@@ -15491,14 +15611,19 @@ function collectElementConsts(job) {
|
|
|
15491
15611
|
if (job instanceof ComponentCompilationJob) {
|
|
15492
15612
|
for (const unit of job.units) {
|
|
15493
15613
|
for (const op of unit.create) {
|
|
15494
|
-
if (
|
|
15614
|
+
if (op.kind == OpKind.Projection) {
|
|
15495
15615
|
const attributes = allElementAttributes.get(op.xref);
|
|
15496
15616
|
if (attributes !== void 0) {
|
|
15497
15617
|
const attrArray = serializeAttributes(attributes);
|
|
15498
15618
|
if (attrArray.entries.length > 0) {
|
|
15499
|
-
op.attributes =
|
|
15619
|
+
op.attributes = attrArray;
|
|
15500
15620
|
}
|
|
15501
15621
|
}
|
|
15622
|
+
} else if (isElementOrContainerOp(op)) {
|
|
15623
|
+
op.attributes = getConstIndex(job, allElementAttributes, op.xref);
|
|
15624
|
+
if (op.kind === OpKind.RepeaterCreate && op.emptyView !== null) {
|
|
15625
|
+
op.emptyAttributes = getConstIndex(job, allElementAttributes, op.emptyView);
|
|
15626
|
+
}
|
|
15502
15627
|
}
|
|
15503
15628
|
}
|
|
15504
15629
|
}
|
|
@@ -15514,13 +15639,18 @@ function collectElementConsts(job) {
|
|
|
15514
15639
|
}
|
|
15515
15640
|
}
|
|
15516
15641
|
}
|
|
15642
|
+
function getConstIndex(job, allElementAttributes, xref) {
|
|
15643
|
+
const attributes = allElementAttributes.get(xref);
|
|
15644
|
+
if (attributes !== void 0) {
|
|
15645
|
+
const attrArray = serializeAttributes(attributes);
|
|
15646
|
+
if (attrArray.entries.length > 0) {
|
|
15647
|
+
return job.addConst(attrArray);
|
|
15648
|
+
}
|
|
15649
|
+
}
|
|
15650
|
+
return null;
|
|
15651
|
+
}
|
|
15517
15652
|
var FLYWEIGHT_ARRAY = Object.freeze([]);
|
|
15518
15653
|
var ElementAttributes = class {
|
|
15519
|
-
constructor() {
|
|
15520
|
-
this.known = /* @__PURE__ */ new Set();
|
|
15521
|
-
this.byKind = /* @__PURE__ */ new Map();
|
|
15522
|
-
this.projectAs = null;
|
|
15523
|
-
}
|
|
15524
15654
|
get attributes() {
|
|
15525
15655
|
var _a2;
|
|
15526
15656
|
return (_a2 = this.byKind.get(BindingKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
@@ -15545,12 +15675,28 @@ var ElementAttributes = class {
|
|
|
15545
15675
|
var _a2;
|
|
15546
15676
|
return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
15547
15677
|
}
|
|
15548
|
-
|
|
15678
|
+
constructor(compatibility) {
|
|
15679
|
+
this.compatibility = compatibility;
|
|
15680
|
+
this.known = /* @__PURE__ */ new Map();
|
|
15681
|
+
this.byKind = /* @__PURE__ */ new Map();
|
|
15682
|
+
this.projectAs = null;
|
|
15683
|
+
}
|
|
15684
|
+
isKnown(kind, name, value) {
|
|
15549
15685
|
var _a2;
|
|
15550
|
-
|
|
15686
|
+
const nameToValue = (_a2 = this.known.get(kind)) != null ? _a2 : /* @__PURE__ */ new Set();
|
|
15687
|
+
this.known.set(kind, nameToValue);
|
|
15688
|
+
if (nameToValue.has(name)) {
|
|
15689
|
+
return true;
|
|
15690
|
+
}
|
|
15691
|
+
nameToValue.add(name);
|
|
15692
|
+
return false;
|
|
15693
|
+
}
|
|
15694
|
+
add(kind, name, value, trustedValueFn) {
|
|
15695
|
+
var _a2;
|
|
15696
|
+
const allowDuplicates = this.compatibility === CompatibilityMode.TemplateDefinitionBuilder && (kind === BindingKind.Attribute || kind === BindingKind.ClassName || kind === BindingKind.StyleProperty);
|
|
15697
|
+
if (!allowDuplicates && this.isKnown(kind, name, value)) {
|
|
15551
15698
|
return;
|
|
15552
15699
|
}
|
|
15553
|
-
this.known.add(name);
|
|
15554
15700
|
if (name === "ngProjectAs") {
|
|
15555
15701
|
if (value === null || !(value instanceof LiteralExpr) || value.value == null || typeof ((_a2 = value.value) == null ? void 0 : _a2.toString()) !== "string") {
|
|
15556
15702
|
throw Error("ngProjectAs must have a string literal value");
|
|
@@ -15561,9 +15707,16 @@ var ElementAttributes = class {
|
|
|
15561
15707
|
array.push(...getAttributeNameLiterals$1(name));
|
|
15562
15708
|
if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
|
|
15563
15709
|
if (value === null) {
|
|
15564
|
-
throw Error("Attribute & style element attributes must have a value");
|
|
15710
|
+
throw Error("Attribute, i18n attribute, & style element attributes must have a value");
|
|
15711
|
+
}
|
|
15712
|
+
if (trustedValueFn !== null) {
|
|
15713
|
+
if (!isStringLiteral(value)) {
|
|
15714
|
+
throw Error("AssertionError: extracted attribute value should be string literal");
|
|
15715
|
+
}
|
|
15716
|
+
array.push(taggedTemplate(trustedValueFn, new TemplateLiteral([new TemplateLiteralElement(value.value)], []), void 0, value.sourceSpan));
|
|
15717
|
+
} else {
|
|
15718
|
+
array.push(value);
|
|
15565
15719
|
}
|
|
15566
|
-
array.push(value);
|
|
15567
15720
|
}
|
|
15568
15721
|
}
|
|
15569
15722
|
arrayFor(kind) {
|
|
@@ -15574,7 +15727,7 @@ var ElementAttributes = class {
|
|
|
15574
15727
|
}
|
|
15575
15728
|
};
|
|
15576
15729
|
function getAttributeNameLiterals$1(name) {
|
|
15577
|
-
const [attributeNamespace, attributeName] = splitNsName(name);
|
|
15730
|
+
const [attributeNamespace, attributeName] = splitNsName(name, false);
|
|
15578
15731
|
const nameLiteral = literal(attributeName);
|
|
15579
15732
|
if (attributeNamespace) {
|
|
15580
15733
|
return [
|
|
@@ -15608,6 +15761,45 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
|
|
|
15608
15761
|
}
|
|
15609
15762
|
return literalArr(attrArray);
|
|
15610
15763
|
}
|
|
15764
|
+
function convertI18nBindings(job) {
|
|
15765
|
+
const i18nAttributesByElem = /* @__PURE__ */ new Map();
|
|
15766
|
+
for (const unit of job.units) {
|
|
15767
|
+
for (const op of unit.create) {
|
|
15768
|
+
if (op.kind === OpKind.I18nAttributes) {
|
|
15769
|
+
i18nAttributesByElem.set(op.target, op);
|
|
15770
|
+
}
|
|
15771
|
+
}
|
|
15772
|
+
for (const op of unit.update) {
|
|
15773
|
+
switch (op.kind) {
|
|
15774
|
+
case OpKind.Property:
|
|
15775
|
+
case OpKind.Attribute:
|
|
15776
|
+
if (op.i18nContext === null) {
|
|
15777
|
+
continue;
|
|
15778
|
+
}
|
|
15779
|
+
if (!(op.expression instanceof Interpolation)) {
|
|
15780
|
+
continue;
|
|
15781
|
+
}
|
|
15782
|
+
const i18nAttributesForElem = i18nAttributesByElem.get(op.target);
|
|
15783
|
+
if (i18nAttributesForElem === void 0) {
|
|
15784
|
+
throw new Error("AssertionError: An i18n attribute binding instruction requires the owning element to have an I18nAttributes create instruction");
|
|
15785
|
+
}
|
|
15786
|
+
if (i18nAttributesForElem.target !== op.target) {
|
|
15787
|
+
throw new Error("AssertionError: Expected i18nAttributes target element to match binding target element");
|
|
15788
|
+
}
|
|
15789
|
+
const ops = [];
|
|
15790
|
+
for (let i = 0; i < op.expression.expressions.length; i++) {
|
|
15791
|
+
const expr = op.expression.expressions[i];
|
|
15792
|
+
if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
|
|
15793
|
+
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`);
|
|
15794
|
+
}
|
|
15795
|
+
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));
|
|
15796
|
+
}
|
|
15797
|
+
OpList.replaceWithMany(op, ops);
|
|
15798
|
+
break;
|
|
15799
|
+
}
|
|
15800
|
+
}
|
|
15801
|
+
}
|
|
15802
|
+
}
|
|
15611
15803
|
function createDeferDepsFns(job) {
|
|
15612
15804
|
for (const unit of job.units) {
|
|
15613
15805
|
for (const op of unit.create) {
|
|
@@ -15629,49 +15821,107 @@ function createDeferDepsFns(job) {
|
|
|
15629
15821
|
if (op.handle.slot === null) {
|
|
15630
15822
|
throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
|
|
15631
15823
|
}
|
|
15632
|
-
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
15824
|
+
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
15825
|
+
depsFnExpr,
|
|
15826
|
+
`${job.componentName}_Defer_${op.handle.slot}_DepsFn`,
|
|
15827
|
+
false
|
|
15828
|
+
);
|
|
15633
15829
|
}
|
|
15634
15830
|
}
|
|
15635
15831
|
}
|
|
15636
15832
|
}
|
|
15637
15833
|
function createI18nContexts(job) {
|
|
15638
|
-
const
|
|
15639
|
-
|
|
15640
|
-
|
|
15834
|
+
const attrContextByMessage = /* @__PURE__ */ new Map();
|
|
15835
|
+
for (const unit of job.units) {
|
|
15836
|
+
for (const op of unit.ops()) {
|
|
15837
|
+
switch (op.kind) {
|
|
15838
|
+
case OpKind.Binding:
|
|
15839
|
+
case OpKind.Property:
|
|
15840
|
+
case OpKind.Attribute:
|
|
15841
|
+
case OpKind.ExtractedAttribute:
|
|
15842
|
+
if (op.i18nMessage === null) {
|
|
15843
|
+
continue;
|
|
15844
|
+
}
|
|
15845
|
+
if (!attrContextByMessage.has(op.i18nMessage)) {
|
|
15846
|
+
const i18nContext = createI18nContextOp(I18nContextKind.Attr, job.allocateXrefId(), null, op.i18nMessage, null);
|
|
15847
|
+
unit.create.push(i18nContext);
|
|
15848
|
+
attrContextByMessage.set(op.i18nMessage, i18nContext.xref);
|
|
15849
|
+
}
|
|
15850
|
+
op.i18nContext = attrContextByMessage.get(op.i18nMessage);
|
|
15851
|
+
break;
|
|
15852
|
+
}
|
|
15853
|
+
}
|
|
15854
|
+
}
|
|
15855
|
+
const blockContextByI18nBlock = /* @__PURE__ */ new Map();
|
|
15641
15856
|
for (const unit of job.units) {
|
|
15642
15857
|
for (const op of unit.create) {
|
|
15643
15858
|
switch (op.kind) {
|
|
15644
15859
|
case OpKind.I18nStart:
|
|
15645
|
-
currentI18nOp = op;
|
|
15646
15860
|
if (op.xref === op.root) {
|
|
15647
|
-
|
|
15648
|
-
unit.create.push(
|
|
15649
|
-
op.context = xref;
|
|
15650
|
-
|
|
15861
|
+
const contextOp = createI18nContextOp(I18nContextKind.RootI18n, job.allocateXrefId(), op.xref, op.message, null);
|
|
15862
|
+
unit.create.push(contextOp);
|
|
15863
|
+
op.context = contextOp.xref;
|
|
15864
|
+
blockContextByI18nBlock.set(op.xref, contextOp);
|
|
15651
15865
|
}
|
|
15652
15866
|
break;
|
|
15867
|
+
}
|
|
15868
|
+
}
|
|
15869
|
+
}
|
|
15870
|
+
for (const unit of job.units) {
|
|
15871
|
+
for (const op of unit.create) {
|
|
15872
|
+
if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
|
|
15873
|
+
const rootContext = blockContextByI18nBlock.get(op.root);
|
|
15874
|
+
if (rootContext === void 0) {
|
|
15875
|
+
throw Error("AssertionError: Root i18n block i18n context should have been created.");
|
|
15876
|
+
}
|
|
15877
|
+
op.context = rootContext.xref;
|
|
15878
|
+
blockContextByI18nBlock.set(op.xref, rootContext);
|
|
15879
|
+
}
|
|
15880
|
+
}
|
|
15881
|
+
}
|
|
15882
|
+
let currentI18nOp = null;
|
|
15883
|
+
for (const unit of job.units) {
|
|
15884
|
+
for (const op of unit.create) {
|
|
15885
|
+
switch (op.kind) {
|
|
15886
|
+
case OpKind.I18nStart:
|
|
15887
|
+
currentI18nOp = op;
|
|
15888
|
+
break;
|
|
15653
15889
|
case OpKind.I18nEnd:
|
|
15654
15890
|
currentI18nOp = null;
|
|
15655
15891
|
break;
|
|
15656
15892
|
case OpKind.IcuStart:
|
|
15657
15893
|
if (currentI18nOp === null) {
|
|
15658
|
-
throw Error("Unexpected ICU outside of an i18n block.");
|
|
15894
|
+
throw Error("AssertionError: Unexpected ICU outside of an i18n block.");
|
|
15659
15895
|
}
|
|
15660
15896
|
if (op.message.id !== currentI18nOp.message.id) {
|
|
15661
|
-
|
|
15662
|
-
unit.create.push(
|
|
15663
|
-
op.context = xref;
|
|
15897
|
+
const contextOp = createI18nContextOp(I18nContextKind.Icu, job.allocateXrefId(), currentI18nOp.xref, op.message, null);
|
|
15898
|
+
unit.create.push(contextOp);
|
|
15899
|
+
op.context = contextOp.xref;
|
|
15664
15900
|
} else {
|
|
15665
15901
|
op.context = currentI18nOp.context;
|
|
15902
|
+
blockContextByI18nBlock.get(currentI18nOp.xref).contextKind = I18nContextKind.Icu;
|
|
15666
15903
|
}
|
|
15667
15904
|
break;
|
|
15668
15905
|
}
|
|
15669
15906
|
}
|
|
15670
15907
|
}
|
|
15908
|
+
}
|
|
15909
|
+
function deduplicateTextBindings(job) {
|
|
15910
|
+
const seen = /* @__PURE__ */ new Map();
|
|
15671
15911
|
for (const unit of job.units) {
|
|
15672
|
-
for (const op of unit.
|
|
15673
|
-
if (op.kind === OpKind.
|
|
15674
|
-
|
|
15912
|
+
for (const op of unit.update.reversed()) {
|
|
15913
|
+
if (op.kind === OpKind.Binding && op.isTextAttribute) {
|
|
15914
|
+
const seenForElement = seen.get(op.target) || /* @__PURE__ */ new Set();
|
|
15915
|
+
if (seenForElement.has(op.name)) {
|
|
15916
|
+
if (job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
15917
|
+
if (op.name === "style" || op.name === "class") {
|
|
15918
|
+
OpList.remove(op);
|
|
15919
|
+
}
|
|
15920
|
+
} else {
|
|
15921
|
+
}
|
|
15922
|
+
}
|
|
15923
|
+
seenForElement.add(op.name);
|
|
15924
|
+
seen.set(op.target, seenForElement);
|
|
15675
15925
|
}
|
|
15676
15926
|
}
|
|
15677
15927
|
}
|
|
@@ -15942,7 +16192,7 @@ function ternaryTransform(e) {
|
|
|
15942
16192
|
}
|
|
15943
16193
|
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
15944
16194
|
}
|
|
15945
|
-
var ESCAPE = "\uFFFD";
|
|
16195
|
+
var ESCAPE$1 = "\uFFFD";
|
|
15946
16196
|
var ELEMENT_MARKER = "#";
|
|
15947
16197
|
var TEMPLATE_MARKER = "*";
|
|
15948
16198
|
var TAG_CLOSE_MARKER = "/";
|
|
@@ -15951,12 +16201,16 @@ var LIST_START_MARKER = "[";
|
|
|
15951
16201
|
var LIST_END_MARKER = "]";
|
|
15952
16202
|
var LIST_DELIMITER = "|";
|
|
15953
16203
|
function extractI18nMessages(job) {
|
|
15954
|
-
const
|
|
16204
|
+
const i18nMessagesByContext = /* @__PURE__ */ new Map();
|
|
15955
16205
|
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
16206
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
15956
16207
|
for (const unit of job.units) {
|
|
15957
16208
|
for (const op of unit.create) {
|
|
15958
16209
|
switch (op.kind) {
|
|
15959
16210
|
case OpKind.I18nContext:
|
|
16211
|
+
const i18nMessageOp = createI18nMessage(job, op);
|
|
16212
|
+
unit.create.push(i18nMessageOp);
|
|
16213
|
+
i18nMessagesByContext.set(op.xref, i18nMessageOp);
|
|
15960
16214
|
i18nContexts.set(op.xref, op);
|
|
15961
16215
|
break;
|
|
15962
16216
|
case OpKind.I18nStart:
|
|
@@ -15965,37 +16219,40 @@ function extractI18nMessages(job) {
|
|
|
15965
16219
|
}
|
|
15966
16220
|
}
|
|
15967
16221
|
}
|
|
15968
|
-
|
|
15969
|
-
for (const unit of job.units) {
|
|
15970
|
-
for (const op of unit.create) {
|
|
15971
|
-
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
15972
|
-
if (!op.context) {
|
|
15973
|
-
throw Error("I18n start op should have its context set.");
|
|
15974
|
-
}
|
|
15975
|
-
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
15976
|
-
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
15977
|
-
unit.create.push(i18nMessageOp);
|
|
15978
|
-
}
|
|
15979
|
-
}
|
|
15980
|
-
}
|
|
16222
|
+
let currentIcu = null;
|
|
15981
16223
|
for (const unit of job.units) {
|
|
15982
16224
|
for (const op of unit.create) {
|
|
15983
16225
|
switch (op.kind) {
|
|
15984
16226
|
case OpKind.IcuStart:
|
|
15985
|
-
|
|
15986
|
-
|
|
16227
|
+
currentIcu = op;
|
|
16228
|
+
OpList.remove(op);
|
|
16229
|
+
const icuContext = i18nContexts.get(op.context);
|
|
16230
|
+
if (icuContext.contextKind !== I18nContextKind.Icu) {
|
|
16231
|
+
continue;
|
|
16232
|
+
}
|
|
16233
|
+
const i18nBlock = i18nBlocks.get(icuContext.i18nBlock);
|
|
16234
|
+
if (i18nBlock.context === icuContext.xref) {
|
|
16235
|
+
continue;
|
|
15987
16236
|
}
|
|
15988
|
-
const
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
|
|
15993
|
-
const parentMessage = i18nBlockMessages.get(rootI18nId);
|
|
15994
|
-
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
16237
|
+
const rootI18nBlock = i18nBlocks.get(i18nBlock.root);
|
|
16238
|
+
const rootMessage = i18nMessagesByContext.get(rootI18nBlock.context);
|
|
16239
|
+
if (rootMessage === void 0) {
|
|
16240
|
+
throw Error("AssertionError: ICU sub-message should belong to a root message.");
|
|
15995
16241
|
}
|
|
15996
|
-
|
|
16242
|
+
const subMessage = i18nMessagesByContext.get(icuContext.xref);
|
|
16243
|
+
subMessage.messagePlaceholder = op.messagePlaceholder;
|
|
16244
|
+
rootMessage.subMessages.push(subMessage.xref);
|
|
15997
16245
|
break;
|
|
15998
16246
|
case OpKind.IcuEnd:
|
|
16247
|
+
currentIcu = null;
|
|
16248
|
+
OpList.remove(op);
|
|
16249
|
+
break;
|
|
16250
|
+
case OpKind.IcuPlaceholder:
|
|
16251
|
+
if (currentIcu === null || currentIcu.context == null) {
|
|
16252
|
+
throw Error("AssertionError: Unexpected ICU placeholder outside of i18n context");
|
|
16253
|
+
}
|
|
16254
|
+
const msg = i18nMessagesByContext.get(currentIcu.context);
|
|
16255
|
+
msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
|
|
15999
16256
|
OpList.remove(op);
|
|
16000
16257
|
break;
|
|
16001
16258
|
}
|
|
@@ -16003,69 +16260,56 @@ function extractI18nMessages(job) {
|
|
|
16003
16260
|
}
|
|
16004
16261
|
}
|
|
16005
16262
|
function createI18nMessage(job, context, messagePlaceholder) {
|
|
16006
|
-
let
|
|
16007
|
-
const
|
|
16008
|
-
needsPostprocessing
|
|
16009
|
-
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
16263
|
+
let formattedParams = formatParams(context.params);
|
|
16264
|
+
const formattedPostprocessingParams = formatParams(context.postprocessingParams);
|
|
16265
|
+
let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
|
|
16266
|
+
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
16267
|
+
}
|
|
16268
|
+
function formatIcuPlaceholder(op) {
|
|
16269
|
+
if (op.strings.length !== op.expressionPlaceholders.length + 1) {
|
|
16270
|
+
throw Error(`AsserionError: Invalid ICU placeholder with ${op.strings.length} strings and ${op.expressionPlaceholders.length} expressions`);
|
|
16271
|
+
}
|
|
16272
|
+
const values = op.expressionPlaceholders.map(formatValue);
|
|
16273
|
+
return op.strings.flatMap((str, i) => [str, values[i] || ""]).join("");
|
|
16010
16274
|
}
|
|
16011
16275
|
function formatParams(params) {
|
|
16012
16276
|
const formattedParams = /* @__PURE__ */ new Map();
|
|
16013
|
-
let needsPostprocessing = false;
|
|
16014
16277
|
for (const [placeholder, placeholderValues] of params) {
|
|
16015
|
-
const
|
|
16016
|
-
needsPostprocessing || (needsPostprocessing = paramNeedsPostprocessing);
|
|
16278
|
+
const serializedValues = formatParamValues(placeholderValues);
|
|
16017
16279
|
if (serializedValues !== null) {
|
|
16018
16280
|
formattedParams.set(placeholder, literal(serializedValues));
|
|
16019
16281
|
}
|
|
16020
16282
|
}
|
|
16021
|
-
return
|
|
16283
|
+
return formattedParams;
|
|
16022
16284
|
}
|
|
16023
16285
|
function formatParamValues(values) {
|
|
16024
16286
|
if (values.length === 0) {
|
|
16025
|
-
return
|
|
16287
|
+
return null;
|
|
16026
16288
|
}
|
|
16027
|
-
collapseElementTemplatePairs(values);
|
|
16028
16289
|
const serializedValues = values.map((value) => formatValue(value));
|
|
16029
|
-
return serializedValues.length === 1 ?
|
|
16290
|
+
return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
|
|
16030
16291
|
}
|
|
16031
|
-
function
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
const value = values[i];
|
|
16036
|
-
if (value.subTemplateIndex !== null && value.flags & (I18nParamValueFlags.ElementTag | I18nParamValueFlags.TemplateTag)) {
|
|
16037
|
-
const valueIndicies = (_a2 = valueIndiciesBySubTemplateIndex.get(value.subTemplateIndex)) != null ? _a2 : [];
|
|
16038
|
-
valueIndicies.push(i);
|
|
16039
|
-
valueIndiciesBySubTemplateIndex.set(value.subTemplateIndex, valueIndicies);
|
|
16040
|
-
}
|
|
16041
|
-
}
|
|
16042
|
-
for (const [subTemplateIndex, valueIndicies] of valueIndiciesBySubTemplateIndex) {
|
|
16043
|
-
if (valueIndicies.length > 1) {
|
|
16044
|
-
const elementIndex = valueIndicies.find((index2) => values[index2].flags & I18nParamValueFlags.ElementTag);
|
|
16045
|
-
const templateIndex = valueIndicies.find((index2) => values[index2].flags & I18nParamValueFlags.TemplateTag);
|
|
16046
|
-
if (elementIndex !== void 0 && templateIndex !== void 0) {
|
|
16047
|
-
const elementValue = values[elementIndex];
|
|
16048
|
-
const templateValue = values[templateIndex];
|
|
16049
|
-
let compundValue;
|
|
16050
|
-
if (elementValue.flags & I18nParamValueFlags.OpenTag && elementValue.flags & I18nParamValueFlags.CloseTag) {
|
|
16051
|
-
compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}${formatValue(templateValue)}`;
|
|
16052
|
-
} else if (elementValue.flags & I18nParamValueFlags.OpenTag) {
|
|
16053
|
-
compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}`;
|
|
16054
|
-
} else {
|
|
16055
|
-
compundValue = `${formatValue(elementValue)}${formatValue(templateValue)}`;
|
|
16056
|
-
}
|
|
16057
|
-
values.splice(elementIndex, 1, { value: compundValue, subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
16058
|
-
values.splice(templateIndex, 1, null);
|
|
16059
|
-
}
|
|
16292
|
+
function formatValue(value) {
|
|
16293
|
+
if (value.flags & I18nParamValueFlags.ElementTag && value.flags & I18nParamValueFlags.TemplateTag) {
|
|
16294
|
+
if (typeof value.value !== "object") {
|
|
16295
|
+
throw Error("AssertionError: Expected i18n param value to have an element and template slot");
|
|
16060
16296
|
}
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16297
|
+
const elementValue = formatValue(__spreadProps(__spreadValues({}, value), {
|
|
16298
|
+
value: value.value.element,
|
|
16299
|
+
flags: value.flags & ~I18nParamValueFlags.TemplateTag
|
|
16300
|
+
}));
|
|
16301
|
+
const templateValue = formatValue(__spreadProps(__spreadValues({}, value), {
|
|
16302
|
+
value: value.value.template,
|
|
16303
|
+
flags: value.flags & ~I18nParamValueFlags.ElementTag
|
|
16304
|
+
}));
|
|
16305
|
+
if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
|
|
16306
|
+
return `${templateValue}${elementValue}${templateValue}`;
|
|
16065
16307
|
}
|
|
16308
|
+
return value.flags & I18nParamValueFlags.CloseTag ? `${elementValue}${templateValue}` : `${templateValue}${elementValue}`;
|
|
16309
|
+
}
|
|
16310
|
+
if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
|
|
16311
|
+
return `${formatValue(__spreadProps(__spreadValues({}, value), { flags: value.flags & ~I18nParamValueFlags.CloseTag }))}${formatValue(__spreadProps(__spreadValues({}, value), { flags: value.flags & ~I18nParamValueFlags.OpenTag }))}`;
|
|
16066
16312
|
}
|
|
16067
|
-
}
|
|
16068
|
-
function formatValue(value) {
|
|
16069
16313
|
if (value.flags === I18nParamValueFlags.None) {
|
|
16070
16314
|
return `${value.value}`;
|
|
16071
16315
|
}
|
|
@@ -16080,10 +16324,7 @@ function formatValue(value) {
|
|
|
16080
16324
|
closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
|
|
16081
16325
|
}
|
|
16082
16326
|
const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
|
|
16083
|
-
|
|
16084
|
-
return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
|
|
16085
|
-
}
|
|
16086
|
-
return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
|
|
16327
|
+
return `${ESCAPE$1}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE$1}`;
|
|
16087
16328
|
}
|
|
16088
16329
|
function generateAdvance(job) {
|
|
16089
16330
|
for (const unit of job.units) {
|
|
@@ -16101,7 +16342,7 @@ function generateAdvance(job) {
|
|
|
16101
16342
|
if (!hasDependsOnSlotContextTrait(op)) {
|
|
16102
16343
|
continue;
|
|
16103
16344
|
} else if (!slotMap.has(op.target)) {
|
|
16104
|
-
throw new Error(`AssertionError: reference to unknown slot for
|
|
16345
|
+
throw new Error(`AssertionError: reference to unknown slot for target ${op.target}`);
|
|
16105
16346
|
}
|
|
16106
16347
|
const slot = slotMap.get(op.target);
|
|
16107
16348
|
if (slotContext !== slot) {
|
|
@@ -16145,8 +16386,13 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
16145
16386
|
for (const op of view.create) {
|
|
16146
16387
|
switch (op.kind) {
|
|
16147
16388
|
case OpKind.Template:
|
|
16389
|
+
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
16390
|
+
break;
|
|
16148
16391
|
case OpKind.RepeaterCreate:
|
|
16149
16392
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
16393
|
+
if (op.emptyView) {
|
|
16394
|
+
recursivelyProcessView(view.job.views.get(op.emptyView), scope);
|
|
16395
|
+
}
|
|
16150
16396
|
break;
|
|
16151
16397
|
case OpKind.Listener:
|
|
16152
16398
|
op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
|
|
@@ -16242,7 +16488,7 @@ var CLASS_BANG = "class!";
|
|
|
16242
16488
|
var BANG_IMPORTANT = "!important";
|
|
16243
16489
|
function parseHostStyleProperties(job) {
|
|
16244
16490
|
for (const op of job.root.update) {
|
|
16245
|
-
if (op.kind
|
|
16491
|
+
if (!(op.kind === OpKind.Binding && op.bindingKind === BindingKind.Property)) {
|
|
16246
16492
|
continue;
|
|
16247
16493
|
}
|
|
16248
16494
|
if (op.name.endsWith(BANG_IMPORTANT)) {
|
|
@@ -22197,56 +22443,136 @@ function createEmptyMessagePart(location) {
|
|
|
22197
22443
|
}
|
|
22198
22444
|
var NG_I18N_CLOSURE_MODE$1 = "ngI18nClosureMode";
|
|
22199
22445
|
var TRANSLATION_VAR_PREFIX = "i18n_";
|
|
22446
|
+
var I18N_ICU_MAPPING_PREFIX = "I18N_EXP_";
|
|
22447
|
+
var ESCAPE = "\uFFFD";
|
|
22200
22448
|
function collectI18nConsts(job) {
|
|
22449
|
+
var _a2, _b2;
|
|
22201
22450
|
const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
|
|
22202
|
-
const
|
|
22451
|
+
const extractedAttributesByI18nContext = /* @__PURE__ */ new Map();
|
|
22452
|
+
const i18nAttributesByElement = /* @__PURE__ */ new Map();
|
|
22453
|
+
const i18nExpressionsByElement = /* @__PURE__ */ new Map();
|
|
22203
22454
|
const messages = /* @__PURE__ */ new Map();
|
|
22204
22455
|
for (const unit of job.units) {
|
|
22205
|
-
for (const op of unit.
|
|
22206
|
-
if (op.kind === OpKind.
|
|
22456
|
+
for (const op of unit.ops()) {
|
|
22457
|
+
if (op.kind === OpKind.ExtractedAttribute && op.i18nContext !== null) {
|
|
22458
|
+
const attributes = (_a2 = extractedAttributesByI18nContext.get(op.i18nContext)) != null ? _a2 : [];
|
|
22459
|
+
attributes.push(op);
|
|
22460
|
+
extractedAttributesByI18nContext.set(op.i18nContext, attributes);
|
|
22461
|
+
} else if (op.kind === OpKind.I18nAttributes) {
|
|
22462
|
+
i18nAttributesByElement.set(op.target, op);
|
|
22463
|
+
} else if (op.kind === OpKind.I18nExpression && op.usage === I18nExpressionFor.I18nAttribute) {
|
|
22464
|
+
const expressions = (_b2 = i18nExpressionsByElement.get(op.target)) != null ? _b2 : [];
|
|
22465
|
+
expressions.push(op);
|
|
22466
|
+
i18nExpressionsByElement.set(op.target, expressions);
|
|
22467
|
+
} else if (op.kind === OpKind.I18nMessage) {
|
|
22207
22468
|
messages.set(op.xref, op);
|
|
22208
|
-
OpList.remove(op);
|
|
22209
22469
|
}
|
|
22210
22470
|
}
|
|
22211
22471
|
}
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22472
|
+
const i18nValuesByContext = /* @__PURE__ */ new Map();
|
|
22473
|
+
const messageConstIndices = /* @__PURE__ */ new Map();
|
|
22474
|
+
for (const unit of job.units) {
|
|
22475
|
+
for (const op of unit.create) {
|
|
22476
|
+
if (op.kind === OpKind.I18nMessage) {
|
|
22477
|
+
if (op.messagePlaceholder === null) {
|
|
22478
|
+
const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
|
|
22479
|
+
if (op.i18nBlock !== null) {
|
|
22480
|
+
const i18nConst = job.addConst(mainVar, statements);
|
|
22481
|
+
messageConstIndices.set(op.i18nBlock, i18nConst);
|
|
22482
|
+
} else {
|
|
22483
|
+
job.constsInitializers.push(...statements);
|
|
22484
|
+
i18nValuesByContext.set(op.i18nContext, mainVar);
|
|
22485
|
+
const attributesForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
|
|
22486
|
+
if (attributesForMessage !== void 0) {
|
|
22487
|
+
for (const attr of attributesForMessage) {
|
|
22488
|
+
attr.expression = mainVar.clone();
|
|
22489
|
+
}
|
|
22490
|
+
}
|
|
22491
|
+
}
|
|
22492
|
+
}
|
|
22493
|
+
OpList.remove(op);
|
|
22494
|
+
}
|
|
22495
|
+
}
|
|
22496
|
+
}
|
|
22497
|
+
for (const unit of job.units) {
|
|
22498
|
+
for (const elem of unit.create) {
|
|
22499
|
+
if (isElementOrContainerOp(elem)) {
|
|
22500
|
+
const i18nAttributes2 = i18nAttributesByElement.get(elem.xref);
|
|
22501
|
+
if (i18nAttributes2 === void 0) {
|
|
22502
|
+
continue;
|
|
22503
|
+
}
|
|
22504
|
+
let i18nExpressions = i18nExpressionsByElement.get(elem.xref);
|
|
22505
|
+
if (i18nExpressions === void 0) {
|
|
22506
|
+
throw new Error("AssertionError: Could not find any i18n expressions associated with an I18nAttributes instruction");
|
|
22507
|
+
}
|
|
22508
|
+
const seenPropertyNames = /* @__PURE__ */ new Set();
|
|
22509
|
+
i18nExpressions = i18nExpressions.filter((i18nExpr) => {
|
|
22510
|
+
const seen = seenPropertyNames.has(i18nExpr.name);
|
|
22511
|
+
seenPropertyNames.add(i18nExpr.name);
|
|
22512
|
+
return !seen;
|
|
22513
|
+
});
|
|
22514
|
+
const i18nAttributeConfig = i18nExpressions.flatMap((i18nExpr) => {
|
|
22515
|
+
const i18nExprValue = i18nValuesByContext.get(i18nExpr.context);
|
|
22516
|
+
if (i18nExprValue === void 0) {
|
|
22517
|
+
throw new Error("AssertionError: Could not find i18n expression's value");
|
|
22518
|
+
}
|
|
22519
|
+
return [literal(i18nExpr.name), i18nExprValue];
|
|
22520
|
+
});
|
|
22521
|
+
i18nAttributes2.i18nAttributesConfig = job.addConst(new LiteralArrayExpr(i18nAttributeConfig));
|
|
22522
|
+
}
|
|
22216
22523
|
}
|
|
22217
22524
|
}
|
|
22218
22525
|
for (const unit of job.units) {
|
|
22219
22526
|
for (const op of unit.create) {
|
|
22220
22527
|
if (op.kind === OpKind.I18nStart) {
|
|
22221
|
-
|
|
22528
|
+
const msgIndex = messageConstIndices.get(op.root);
|
|
22529
|
+
if (msgIndex === void 0) {
|
|
22530
|
+
throw new Error("AssertionError: Could not find corresponding i18n block index for an i18n message op; was an i18n message incorrectly assumed to correspond to an attribute?");
|
|
22531
|
+
}
|
|
22532
|
+
op.messageIndex = msgIndex;
|
|
22222
22533
|
}
|
|
22223
22534
|
}
|
|
22224
22535
|
}
|
|
22225
22536
|
}
|
|
22226
22537
|
function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
22538
|
+
var _a2;
|
|
22227
22539
|
const statements = [];
|
|
22540
|
+
const subMessagePlaceholders = /* @__PURE__ */ new Map();
|
|
22228
22541
|
for (const subMessageId of messageOp.subMessages) {
|
|
22229
22542
|
const subMessage = messages.get(subMessageId);
|
|
22230
22543
|
const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
|
|
22231
22544
|
statements.push(...subMessageStatements);
|
|
22232
|
-
|
|
22545
|
+
const subMessages = (_a2 = subMessagePlaceholders.get(subMessage.messagePlaceholder)) != null ? _a2 : [];
|
|
22546
|
+
subMessages.push(subMessageVar);
|
|
22547
|
+
subMessagePlaceholders.set(subMessage.messagePlaceholder, subMessages);
|
|
22233
22548
|
}
|
|
22549
|
+
addSubMessageParams(messageOp, subMessagePlaceholders);
|
|
22234
22550
|
messageOp.params = new Map([...messageOp.params.entries()].sort());
|
|
22235
|
-
assertAllParamsResolved(messageOp);
|
|
22236
22551
|
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX));
|
|
22237
22552
|
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
22238
22553
|
let transformFn = void 0;
|
|
22239
|
-
if (messageOp.needsPostprocessing) {
|
|
22240
|
-
|
|
22554
|
+
if (messageOp.needsPostprocessing || messageOp.postprocessingParams.size > 0) {
|
|
22555
|
+
const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
|
|
22556
|
+
const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
|
|
22241
22557
|
const extraTransformFnParams = [];
|
|
22242
22558
|
if (messageOp.postprocessingParams.size > 0) {
|
|
22243
|
-
extraTransformFnParams.push(
|
|
22559
|
+
extraTransformFnParams.push(mapLiteral(formattedPostprocessingParams, true));
|
|
22244
22560
|
}
|
|
22245
22561
|
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
22246
22562
|
}
|
|
22247
22563
|
statements.push(...getTranslationDeclStmts$1(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
|
|
22248
22564
|
return { mainVar, statements };
|
|
22249
22565
|
}
|
|
22566
|
+
function addSubMessageParams(messageOp, subMessagePlaceholders) {
|
|
22567
|
+
for (const [placeholder, subMessages] of subMessagePlaceholders) {
|
|
22568
|
+
if (subMessages.length === 1) {
|
|
22569
|
+
messageOp.params.set(placeholder, subMessages[0]);
|
|
22570
|
+
} else {
|
|
22571
|
+
messageOp.params.set(placeholder, literal(`${ESCAPE}${I18N_ICU_MAPPING_PREFIX}${placeholder}${ESCAPE}`));
|
|
22572
|
+
messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
|
|
22573
|
+
}
|
|
22574
|
+
}
|
|
22575
|
+
}
|
|
22250
22576
|
function getTranslationDeclStmts$1(message, variable2, closureVar, params, transformFn) {
|
|
22251
22577
|
const paramsObject = Object.fromEntries(params);
|
|
22252
22578
|
const statements = [
|
|
@@ -22274,27 +22600,14 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
22274
22600
|
}
|
|
22275
22601
|
return variable(name);
|
|
22276
22602
|
}
|
|
22277
|
-
function
|
|
22278
|
-
|
|
22279
|
-
placeholder = placeholder.trimEnd();
|
|
22280
|
-
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
22281
|
-
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
22282
|
-
}
|
|
22283
|
-
}
|
|
22284
|
-
for (let placeholder in op.message.placeholderToMessage) {
|
|
22285
|
-
placeholder = placeholder.trimEnd();
|
|
22286
|
-
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
22287
|
-
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
22288
|
-
}
|
|
22289
|
-
}
|
|
22290
|
-
}
|
|
22291
|
-
function extractI18nText(job) {
|
|
22292
|
-
var _a2;
|
|
22603
|
+
function convertI18nText(job) {
|
|
22604
|
+
var _a2, _b2, _c2;
|
|
22293
22605
|
for (const unit of job.units) {
|
|
22294
22606
|
let currentI18n = null;
|
|
22295
22607
|
let currentIcu = null;
|
|
22296
22608
|
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
22297
22609
|
const textNodeIcus = /* @__PURE__ */ new Map();
|
|
22610
|
+
const icuPlaceholderByText = /* @__PURE__ */ new Map();
|
|
22298
22611
|
for (const op of unit.create) {
|
|
22299
22612
|
switch (op.kind) {
|
|
22300
22613
|
case OpKind.I18nStart:
|
|
@@ -22319,7 +22632,13 @@ function extractI18nText(job) {
|
|
|
22319
22632
|
if (currentI18n !== null) {
|
|
22320
22633
|
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
22321
22634
|
textNodeIcus.set(op.xref, currentIcu);
|
|
22322
|
-
|
|
22635
|
+
if (op.icuPlaceholder !== null) {
|
|
22636
|
+
const icuPlaceholderOp = createIcuPlaceholderOp(job.allocateXrefId(), op.icuPlaceholder, [op.initialValue]);
|
|
22637
|
+
OpList.replace(op, icuPlaceholderOp);
|
|
22638
|
+
icuPlaceholderByText.set(op.xref, icuPlaceholderOp);
|
|
22639
|
+
} else {
|
|
22640
|
+
OpList.remove(op);
|
|
22641
|
+
}
|
|
22323
22642
|
}
|
|
22324
22643
|
break;
|
|
22325
22644
|
}
|
|
@@ -22332,14 +22651,18 @@ function extractI18nText(job) {
|
|
|
22332
22651
|
}
|
|
22333
22652
|
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
22334
22653
|
const icuOp = textNodeIcus.get(op.target);
|
|
22654
|
+
const icuPlaceholder = icuPlaceholderByText.get(op.target);
|
|
22335
22655
|
const contextId = icuOp ? icuOp.context : i18nOp.context;
|
|
22336
22656
|
const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
|
|
22337
22657
|
const ops = [];
|
|
22338
22658
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
22339
22659
|
const expr = op.interpolation.expressions[i];
|
|
22340
|
-
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, (
|
|
22660
|
+
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));
|
|
22341
22661
|
}
|
|
22342
22662
|
OpList.replaceWithMany(op, ops);
|
|
22663
|
+
if (icuPlaceholder !== void 0) {
|
|
22664
|
+
icuPlaceholder.strings = op.interpolation.strings;
|
|
22665
|
+
}
|
|
22343
22666
|
break;
|
|
22344
22667
|
}
|
|
22345
22668
|
}
|
|
@@ -22482,7 +22805,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22482
22805
|
op.handlerFnName = sanitizeIdentifier(op.handlerFnName);
|
|
22483
22806
|
break;
|
|
22484
22807
|
case OpKind.Variable:
|
|
22485
|
-
varNames.set(op.xref, getVariableName(op.variable, state));
|
|
22808
|
+
varNames.set(op.xref, getVariableName(unit, op.variable, state));
|
|
22486
22809
|
break;
|
|
22487
22810
|
case OpKind.RepeaterCreate:
|
|
22488
22811
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
@@ -22533,14 +22856,19 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
22533
22856
|
});
|
|
22534
22857
|
}
|
|
22535
22858
|
}
|
|
22536
|
-
function getVariableName(variable2, state) {
|
|
22859
|
+
function getVariableName(unit, variable2, state) {
|
|
22537
22860
|
if (variable2.name === null) {
|
|
22538
22861
|
switch (variable2.kind) {
|
|
22539
22862
|
case SemanticVariableKind.Context:
|
|
22540
22863
|
variable2.name = `ctx_r${state.index++}`;
|
|
22541
22864
|
break;
|
|
22542
22865
|
case SemanticVariableKind.Identifier:
|
|
22543
|
-
|
|
22866
|
+
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
22867
|
+
const compatPrefix = variable2.identifier === "ctx" ? "i" : "";
|
|
22868
|
+
variable2.name = `${variable2.identifier}_${compatPrefix}r${++state.index}`;
|
|
22869
|
+
} else {
|
|
22870
|
+
variable2.name = `${variable2.identifier}_i${state.index++}`;
|
|
22871
|
+
}
|
|
22544
22872
|
break;
|
|
22545
22873
|
default:
|
|
22546
22874
|
variable2.name = `_r${++state.index}`;
|
|
@@ -22673,17 +23001,24 @@ var CREATE_ORDERING = [
|
|
|
22673
23001
|
{ test: (op) => op.kind === OpKind.Listener && !(op.hostListener && op.isAnimationListener) }
|
|
22674
23002
|
];
|
|
22675
23003
|
var UPDATE_ORDERING = [
|
|
22676
|
-
{ test: kindWithInterpolationTest(OpKind.HostProperty, true) },
|
|
22677
|
-
{ test: kindWithInterpolationTest(OpKind.HostProperty, false) },
|
|
22678
23004
|
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
22679
23005
|
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
22680
23006
|
{ test: kindTest(OpKind.StyleProp) },
|
|
22681
23007
|
{ test: kindTest(OpKind.ClassProp) },
|
|
22682
|
-
{ test: kindWithInterpolationTest(OpKind.Property, true) },
|
|
22683
23008
|
{ test: kindWithInterpolationTest(OpKind.Attribute, true) },
|
|
23009
|
+
{ test: kindWithInterpolationTest(OpKind.Property, true) },
|
|
22684
23010
|
{ test: kindWithInterpolationTest(OpKind.Property, false) },
|
|
22685
23011
|
{ test: kindWithInterpolationTest(OpKind.Attribute, false) }
|
|
22686
23012
|
];
|
|
23013
|
+
var UPDATE_HOST_ORDERING = [
|
|
23014
|
+
{ test: kindWithInterpolationTest(OpKind.HostProperty, true) },
|
|
23015
|
+
{ test: kindWithInterpolationTest(OpKind.HostProperty, false) },
|
|
23016
|
+
{ test: kindTest(OpKind.Attribute) },
|
|
23017
|
+
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
23018
|
+
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
23019
|
+
{ test: kindTest(OpKind.StyleProp) },
|
|
23020
|
+
{ test: kindTest(OpKind.ClassProp) }
|
|
23021
|
+
];
|
|
22687
23022
|
var handledOpKinds = /* @__PURE__ */ new Set([
|
|
22688
23023
|
OpKind.Listener,
|
|
22689
23024
|
OpKind.StyleMap,
|
|
@@ -22697,7 +23032,8 @@ var handledOpKinds = /* @__PURE__ */ new Set([
|
|
|
22697
23032
|
function orderOps(job) {
|
|
22698
23033
|
for (const unit of job.units) {
|
|
22699
23034
|
orderWithin(unit.create, CREATE_ORDERING);
|
|
22700
|
-
|
|
23035
|
+
const ordering = unit.job.kind === CompilationJobKind.Host ? UPDATE_HOST_ORDERING : UPDATE_ORDERING;
|
|
23036
|
+
orderWithin(unit.update, ordering);
|
|
22701
23037
|
}
|
|
22702
23038
|
}
|
|
22703
23039
|
function orderWithin(opList, ordering) {
|
|
@@ -22733,19 +23069,31 @@ function keepLast(ops) {
|
|
|
22733
23069
|
return ops.slice(ops.length - 1);
|
|
22734
23070
|
}
|
|
22735
23071
|
function parseExtractedStyles(job) {
|
|
23072
|
+
const elements = /* @__PURE__ */ new Map();
|
|
23073
|
+
for (const unit of job.units) {
|
|
23074
|
+
for (const op of unit.create) {
|
|
23075
|
+
if (isElementOrContainerOp(op)) {
|
|
23076
|
+
elements.set(op.xref, op);
|
|
23077
|
+
}
|
|
23078
|
+
}
|
|
23079
|
+
}
|
|
22736
23080
|
for (const unit of job.units) {
|
|
22737
23081
|
for (const op of unit.create) {
|
|
22738
23082
|
if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
|
|
23083
|
+
const target = elements.get(op.target);
|
|
23084
|
+
if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
|
|
23085
|
+
continue;
|
|
23086
|
+
}
|
|
22739
23087
|
if (op.name === "style") {
|
|
22740
23088
|
const parsedStyles = parse(op.expression.value);
|
|
22741
23089
|
for (let i = 0; i < parsedStyles.length - 1; i += 2) {
|
|
22742
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1])), op);
|
|
23090
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
22743
23091
|
}
|
|
22744
23092
|
OpList.remove(op);
|
|
22745
23093
|
} else if (op.name === "class") {
|
|
22746
23094
|
const parsedClasses = op.expression.value.trim().split(/\s+/g);
|
|
22747
23095
|
for (const parsedClass of parsedClasses) {
|
|
22748
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null), op);
|
|
23096
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
22749
23097
|
}
|
|
22750
23098
|
OpList.remove(op);
|
|
22751
23099
|
}
|
|
@@ -22756,11 +23104,11 @@ function parseExtractedStyles(job) {
|
|
|
22756
23104
|
function removeContentSelectors(job) {
|
|
22757
23105
|
for (const unit of job.units) {
|
|
22758
23106
|
const elements = createOpXrefMap(unit);
|
|
22759
|
-
for (const op of unit.
|
|
23107
|
+
for (const op of unit.ops()) {
|
|
22760
23108
|
switch (op.kind) {
|
|
22761
23109
|
case OpKind.Binding:
|
|
22762
23110
|
const target = lookupInXrefMap(elements, op.target);
|
|
22763
|
-
if (op.name
|
|
23111
|
+
if (isSelectAttribute(op.name) && target.kind === OpKind.Projection) {
|
|
22764
23112
|
OpList.remove(op);
|
|
22765
23113
|
}
|
|
22766
23114
|
break;
|
|
@@ -22768,6 +23116,9 @@ function removeContentSelectors(job) {
|
|
|
22768
23116
|
}
|
|
22769
23117
|
}
|
|
22770
23118
|
}
|
|
23119
|
+
function isSelectAttribute(name) {
|
|
23120
|
+
return name.toLowerCase() === "select";
|
|
23121
|
+
}
|
|
22771
23122
|
function lookupInXrefMap(map, xref) {
|
|
22772
23123
|
const el = map.get(xref);
|
|
22773
23124
|
if (el === void 0) {
|
|
@@ -22848,28 +23199,44 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
22848
23199
|
i18nBlock = op;
|
|
22849
23200
|
break;
|
|
22850
23201
|
case OpKind.I18nEnd:
|
|
23202
|
+
if (i18nBlock.subTemplateIndex === null) {
|
|
23203
|
+
subTemplateIndex = 0;
|
|
23204
|
+
}
|
|
22851
23205
|
i18nBlock = null;
|
|
22852
23206
|
break;
|
|
22853
23207
|
case OpKind.Template:
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
23208
|
+
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
23209
|
+
break;
|
|
23210
|
+
case OpKind.RepeaterCreate:
|
|
23211
|
+
const forView = unit.job.views.get(op.xref);
|
|
23212
|
+
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
23213
|
+
if (op.emptyView !== null) {
|
|
23214
|
+
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
|
|
22861
23215
|
}
|
|
22862
|
-
|
|
23216
|
+
break;
|
|
22863
23217
|
}
|
|
22864
23218
|
}
|
|
22865
23219
|
return subTemplateIndex;
|
|
22866
23220
|
}
|
|
23221
|
+
function propagateI18nBlocksForView(view, i18nBlock, i18nPlaceholder, subTemplateIndex) {
|
|
23222
|
+
if (i18nPlaceholder !== void 0) {
|
|
23223
|
+
if (i18nBlock === null) {
|
|
23224
|
+
throw Error("Expected template with i18n placeholder to be in an i18n block.");
|
|
23225
|
+
}
|
|
23226
|
+
subTemplateIndex++;
|
|
23227
|
+
wrapTemplateWithI18n(view, i18nBlock);
|
|
23228
|
+
}
|
|
23229
|
+
return propagateI18nBlocksToTemplates(view, subTemplateIndex);
|
|
23230
|
+
}
|
|
22867
23231
|
function wrapTemplateWithI18n(unit, parentI18n) {
|
|
22868
23232
|
var _a2;
|
|
22869
23233
|
if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
|
|
22870
23234
|
const id = unit.job.allocateXrefId();
|
|
22871
|
-
OpList.insertAfter(
|
|
22872
|
-
|
|
23235
|
+
OpList.insertAfter(
|
|
23236
|
+
createI18nStartOp(id, parentI18n.message, parentI18n.root, null),
|
|
23237
|
+
unit.create.head
|
|
23238
|
+
);
|
|
23239
|
+
OpList.insertBefore(createI18nEndOp(id, null), unit.create.tail);
|
|
22873
23240
|
}
|
|
22874
23241
|
}
|
|
22875
23242
|
function extractPureFunctions(job) {
|
|
@@ -23014,17 +23381,13 @@ function disableBindings() {
|
|
|
23014
23381
|
function enableBindings() {
|
|
23015
23382
|
return call(Identifiers.enableBindings, [], null);
|
|
23016
23383
|
}
|
|
23017
|
-
function listener(name, handlerFn, sourceSpan) {
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
}
|
|
23023
|
-
|
|
23024
|
-
return call(Identifiers.syntheticHostListener, [
|
|
23025
|
-
literal(name),
|
|
23026
|
-
handlerFn
|
|
23027
|
-
], sourceSpan);
|
|
23384
|
+
function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
|
|
23385
|
+
const args = [literal(name), handlerFn];
|
|
23386
|
+
if (eventTargetResolver !== null) {
|
|
23387
|
+
args.push(literal(false));
|
|
23388
|
+
args.push(importExpr(eventTargetResolver));
|
|
23389
|
+
}
|
|
23390
|
+
return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
|
|
23028
23391
|
}
|
|
23029
23392
|
function pipe(slot, name) {
|
|
23030
23393
|
return call(Identifiers.pipe, [
|
|
@@ -23122,22 +23485,22 @@ function projectionDef(def) {
|
|
|
23122
23485
|
}
|
|
23123
23486
|
function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
|
|
23124
23487
|
const args = [literal(slot)];
|
|
23125
|
-
if (projectionSlotIndex !== 0 || attributes
|
|
23488
|
+
if (projectionSlotIndex !== 0 || attributes !== null) {
|
|
23126
23489
|
args.push(literal(projectionSlotIndex));
|
|
23127
|
-
if (attributes
|
|
23128
|
-
args.push(
|
|
23490
|
+
if (attributes !== null) {
|
|
23491
|
+
args.push(attributes);
|
|
23129
23492
|
}
|
|
23130
23493
|
}
|
|
23131
23494
|
return call(Identifiers.projection, args, sourceSpan);
|
|
23132
23495
|
}
|
|
23133
|
-
function i18nStart(slot, constIndex, subTemplateIndex) {
|
|
23496
|
+
function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
23134
23497
|
const args = [literal(slot), literal(constIndex)];
|
|
23135
23498
|
if (subTemplateIndex !== null) {
|
|
23136
23499
|
args.push(literal(subTemplateIndex));
|
|
23137
23500
|
}
|
|
23138
|
-
return call(Identifiers.i18nStart, args,
|
|
23501
|
+
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
23139
23502
|
}
|
|
23140
|
-
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, sourceSpan) {
|
|
23503
|
+
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
23141
23504
|
const args = [
|
|
23142
23505
|
literal(slot),
|
|
23143
23506
|
variable(viewFnName),
|
|
@@ -23151,6 +23514,12 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
23151
23514
|
args.push(literal(trackByUsesComponentInstance));
|
|
23152
23515
|
if (emptyViewFnName !== null) {
|
|
23153
23516
|
args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
|
|
23517
|
+
if (emptyTag !== null || emptyConstIndex !== null) {
|
|
23518
|
+
args.push(literal(emptyTag));
|
|
23519
|
+
}
|
|
23520
|
+
if (emptyConstIndex !== null) {
|
|
23521
|
+
args.push(literal(emptyConstIndex));
|
|
23522
|
+
}
|
|
23154
23523
|
}
|
|
23155
23524
|
}
|
|
23156
23525
|
return call(Identifiers.repeaterCreate, args, sourceSpan);
|
|
@@ -23161,15 +23530,19 @@ function repeater(collection, sourceSpan) {
|
|
|
23161
23530
|
function deferWhen(prefetch, expr, sourceSpan) {
|
|
23162
23531
|
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
23163
23532
|
}
|
|
23164
|
-
function i18n(slot, constIndex, subTemplateIndex) {
|
|
23533
|
+
function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
23165
23534
|
const args = [literal(slot), literal(constIndex)];
|
|
23166
23535
|
if (subTemplateIndex) {
|
|
23167
23536
|
args.push(literal(subTemplateIndex));
|
|
23168
23537
|
}
|
|
23169
|
-
return call(Identifiers.i18n, args,
|
|
23538
|
+
return call(Identifiers.i18n, args, sourceSpan);
|
|
23539
|
+
}
|
|
23540
|
+
function i18nEnd(endSourceSpan) {
|
|
23541
|
+
return call(Identifiers.i18nEnd, [], endSourceSpan);
|
|
23170
23542
|
}
|
|
23171
|
-
function
|
|
23172
|
-
|
|
23543
|
+
function i18nAttributes(slot, i18nAttributesConfig) {
|
|
23544
|
+
const args = [literal(slot), literal(i18nAttributesConfig)];
|
|
23545
|
+
return call(Identifiers.i18nAttributes, args, null);
|
|
23173
23546
|
}
|
|
23174
23547
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
23175
23548
|
const args = [literal(name), expression];
|
|
@@ -23279,8 +23652,12 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
|
|
|
23279
23652
|
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
23280
23653
|
return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
23281
23654
|
}
|
|
23282
|
-
function hostProperty(name, expression, sourceSpan) {
|
|
23283
|
-
|
|
23655
|
+
function hostProperty(name, expression, sanitizer, sourceSpan) {
|
|
23656
|
+
const args = [literal(name), expression];
|
|
23657
|
+
if (sanitizer !== null) {
|
|
23658
|
+
args.push(sanitizer);
|
|
23659
|
+
}
|
|
23660
|
+
return call(Identifiers.hostProperty, args, sourceSpan);
|
|
23284
23661
|
}
|
|
23285
23662
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
23286
23663
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
@@ -23466,13 +23843,10 @@ function callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraA
|
|
|
23466
23843
|
function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs, sourceSpan) {
|
|
23467
23844
|
return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan).toStmt());
|
|
23468
23845
|
}
|
|
23469
|
-
var
|
|
23470
|
-
[
|
|
23471
|
-
[
|
|
23472
|
-
[
|
|
23473
|
-
[SanitizerFn.Script, Identifiers.sanitizeScript],
|
|
23474
|
-
[SanitizerFn.Style, Identifiers.sanitizeStyle],
|
|
23475
|
-
[SanitizerFn.Url, Identifiers.sanitizeUrl]
|
|
23846
|
+
var GLOBAL_TARGET_RESOLVERS$1 = /* @__PURE__ */ new Map([
|
|
23847
|
+
["window", Identifiers.resolveWindow],
|
|
23848
|
+
["document", Identifiers.resolveDocument],
|
|
23849
|
+
["body", Identifiers.resolveBody]
|
|
23476
23850
|
]);
|
|
23477
23851
|
function reify(job) {
|
|
23478
23852
|
for (const unit of job.units) {
|
|
@@ -23489,31 +23863,37 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23489
23863
|
OpList.replace(op, text(op.handle.slot, op.initialValue, op.sourceSpan));
|
|
23490
23864
|
break;
|
|
23491
23865
|
case OpKind.ElementStart:
|
|
23492
|
-
OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.
|
|
23866
|
+
OpList.replace(op, elementStart(op.handle.slot, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23493
23867
|
break;
|
|
23494
23868
|
case OpKind.Element:
|
|
23495
|
-
OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.
|
|
23869
|
+
OpList.replace(op, element(op.handle.slot, op.tag, op.attributes, op.localRefs, op.wholeSourceSpan));
|
|
23496
23870
|
break;
|
|
23497
23871
|
case OpKind.ElementEnd:
|
|
23498
23872
|
OpList.replace(op, elementEnd(op.sourceSpan));
|
|
23499
23873
|
break;
|
|
23500
23874
|
case OpKind.ContainerStart:
|
|
23501
|
-
OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.
|
|
23875
|
+
OpList.replace(op, elementContainerStart(op.handle.slot, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23502
23876
|
break;
|
|
23503
23877
|
case OpKind.Container:
|
|
23504
|
-
OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.
|
|
23878
|
+
OpList.replace(op, elementContainer(op.handle.slot, op.attributes, op.localRefs, op.wholeSourceSpan));
|
|
23505
23879
|
break;
|
|
23506
23880
|
case OpKind.ContainerEnd:
|
|
23507
23881
|
OpList.replace(op, elementContainerEnd());
|
|
23508
23882
|
break;
|
|
23509
23883
|
case OpKind.I18nStart:
|
|
23510
|
-
OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
23884
|
+
OpList.replace(op, i18nStart(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
|
|
23511
23885
|
break;
|
|
23512
23886
|
case OpKind.I18nEnd:
|
|
23513
|
-
OpList.replace(op, i18nEnd());
|
|
23887
|
+
OpList.replace(op, i18nEnd(op.sourceSpan));
|
|
23514
23888
|
break;
|
|
23515
23889
|
case OpKind.I18n:
|
|
23516
|
-
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
23890
|
+
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex, op.sourceSpan));
|
|
23891
|
+
break;
|
|
23892
|
+
case OpKind.I18nAttributes:
|
|
23893
|
+
if (op.i18nAttributesConfig === null) {
|
|
23894
|
+
throw new Error(`AssertionError: i18nAttributesConfig was not set`);
|
|
23895
|
+
}
|
|
23896
|
+
OpList.replace(op, i18nAttributes(op.handle.slot, op.i18nAttributesConfig));
|
|
23517
23897
|
break;
|
|
23518
23898
|
case OpKind.Template:
|
|
23519
23899
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
@@ -23523,7 +23903,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23523
23903
|
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
23524
23904
|
}
|
|
23525
23905
|
const childView = unit.job.views.get(op.xref);
|
|
23526
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.
|
|
23906
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23527
23907
|
break;
|
|
23528
23908
|
case OpKind.DisableBindings:
|
|
23529
23909
|
OpList.replace(op, disableBindings());
|
|
@@ -23536,8 +23916,11 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23536
23916
|
break;
|
|
23537
23917
|
case OpKind.Listener:
|
|
23538
23918
|
const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
23539
|
-
const
|
|
23540
|
-
|
|
23919
|
+
const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS$1.get(op.eventTarget) : null;
|
|
23920
|
+
if (eventTargetResolver === void 0) {
|
|
23921
|
+
throw new Error(`Unexpected global target '${op.eventTarget}' defined for '${op.name}' event. Supported list of global targets: window,document,body.`);
|
|
23922
|
+
}
|
|
23923
|
+
OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
|
|
23541
23924
|
break;
|
|
23542
23925
|
case OpKind.Variable:
|
|
23543
23926
|
if (op.variable.name === null) {
|
|
@@ -23622,7 +24005,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23622
24005
|
emptyDecls = emptyView.decls;
|
|
23623
24006
|
emptyVars = emptyView.vars;
|
|
23624
24007
|
}
|
|
23625
|
-
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.
|
|
24008
|
+
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));
|
|
23626
24009
|
break;
|
|
23627
24010
|
case OpKind.Statement:
|
|
23628
24011
|
break;
|
|
@@ -23692,7 +24075,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
23692
24075
|
if (op.isAnimationTrigger) {
|
|
23693
24076
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23694
24077
|
} else {
|
|
23695
|
-
OpList.replace(op, hostProperty(op.name, op.expression, op.sourceSpan));
|
|
24078
|
+
OpList.replace(op, hostProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23696
24079
|
}
|
|
23697
24080
|
}
|
|
23698
24081
|
break;
|
|
@@ -23770,8 +24153,6 @@ function reifyIrExpression(expr) {
|
|
|
23770
24153
|
return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
|
|
23771
24154
|
case ExpressionKind.PipeBindingVariadic:
|
|
23772
24155
|
return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
|
|
23773
|
-
case ExpressionKind.SanitizerExpr:
|
|
23774
|
-
return importExpr(sanitizerIdentifierMap.get(expr.fn));
|
|
23775
24156
|
case ExpressionKind.SlotLiteralExpr:
|
|
23776
24157
|
return literal(expr.slot.slot);
|
|
23777
24158
|
default:
|
|
@@ -23826,6 +24207,26 @@ function removeI18nContexts(job) {
|
|
|
23826
24207
|
}
|
|
23827
24208
|
}
|
|
23828
24209
|
}
|
|
24210
|
+
function removeUnusedI18nAttributesOps(job) {
|
|
24211
|
+
for (const unit of job.units) {
|
|
24212
|
+
const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
|
|
24213
|
+
for (const op of unit.update) {
|
|
24214
|
+
switch (op.kind) {
|
|
24215
|
+
case OpKind.I18nExpression:
|
|
24216
|
+
ownersWithI18nExpressions.add(op.i18nOwner);
|
|
24217
|
+
}
|
|
24218
|
+
}
|
|
24219
|
+
for (const op of unit.create) {
|
|
24220
|
+
switch (op.kind) {
|
|
24221
|
+
case OpKind.I18nAttributes:
|
|
24222
|
+
if (ownersWithI18nExpressions.has(op.xref)) {
|
|
24223
|
+
continue;
|
|
24224
|
+
}
|
|
24225
|
+
OpList.remove(op);
|
|
24226
|
+
}
|
|
24227
|
+
}
|
|
24228
|
+
}
|
|
24229
|
+
}
|
|
23829
24230
|
function generateRepeaterDerivedVars(job) {
|
|
23830
24231
|
const repeaters = /* @__PURE__ */ new Map();
|
|
23831
24232
|
for (const unit of job.units) {
|
|
@@ -23931,8 +24332,9 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
23931
24332
|
}
|
|
23932
24333
|
resolvePlaceholdersForView(job, job.root, i18nContexts, elements);
|
|
23933
24334
|
}
|
|
23934
|
-
function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
|
|
24335
|
+
function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingStructuralDirective) {
|
|
23935
24336
|
let currentOps = null;
|
|
24337
|
+
let pendingStructuralDirectiveCloses = /* @__PURE__ */ new Map();
|
|
23936
24338
|
for (const op of unit.create) {
|
|
23937
24339
|
switch (op.kind) {
|
|
23938
24340
|
case OpKind.I18nStart:
|
|
@@ -23949,52 +24351,135 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
|
|
|
23949
24351
|
if (currentOps === null) {
|
|
23950
24352
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
23951
24353
|
}
|
|
23952
|
-
|
|
23953
|
-
|
|
23954
|
-
|
|
23955
|
-
flags |= I18nParamValueFlags.CloseTag;
|
|
24354
|
+
recordElementStart(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24355
|
+
if (pendingStructuralDirective && op.i18nPlaceholder.closeName) {
|
|
24356
|
+
pendingStructuralDirectiveCloses.set(op.xref, pendingStructuralDirective);
|
|
23956
24357
|
}
|
|
23957
|
-
|
|
24358
|
+
pendingStructuralDirective = void 0;
|
|
23958
24359
|
}
|
|
23959
24360
|
break;
|
|
23960
24361
|
case OpKind.ElementEnd:
|
|
23961
24362
|
const startOp = elements.get(op.xref);
|
|
23962
24363
|
if (startOp && startOp.i18nPlaceholder !== void 0) {
|
|
23963
24364
|
if (currentOps === null) {
|
|
23964
|
-
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
23965
|
-
}
|
|
23966
|
-
const { closeName } = startOp.i18nPlaceholder;
|
|
23967
|
-
if (closeName !== "") {
|
|
23968
|
-
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
24365
|
+
throw Error("AssertionError: i18n tag placeholder should only occur inside an i18n block");
|
|
23969
24366
|
}
|
|
24367
|
+
recordElementClose(startOp, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirectiveCloses.get(op.xref));
|
|
24368
|
+
pendingStructuralDirectiveCloses.delete(op.xref);
|
|
23970
24369
|
}
|
|
23971
24370
|
break;
|
|
23972
|
-
case OpKind.
|
|
24371
|
+
case OpKind.Projection:
|
|
23973
24372
|
if (op.i18nPlaceholder !== void 0) {
|
|
23974
24373
|
if (currentOps === null) {
|
|
23975
24374
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
23976
24375
|
}
|
|
23977
|
-
|
|
23978
|
-
|
|
23979
|
-
|
|
23980
|
-
|
|
23981
|
-
|
|
23982
|
-
|
|
24376
|
+
recordElementStart(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24377
|
+
recordElementClose(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24378
|
+
pendingStructuralDirective = void 0;
|
|
24379
|
+
}
|
|
24380
|
+
break;
|
|
24381
|
+
case OpKind.Template:
|
|
24382
|
+
const view = job.views.get(op.xref);
|
|
24383
|
+
if (op.i18nPlaceholder === void 0) {
|
|
24384
|
+
resolvePlaceholdersForView(job, view, i18nContexts, elements);
|
|
24385
|
+
} else {
|
|
24386
|
+
if (currentOps === null) {
|
|
24387
|
+
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
23983
24388
|
}
|
|
23984
|
-
|
|
23985
|
-
|
|
23986
|
-
|
|
23987
|
-
|
|
24389
|
+
if (op.templateKind === TemplateKind.Structural) {
|
|
24390
|
+
resolvePlaceholdersForView(job, view, i18nContexts, elements, op);
|
|
24391
|
+
} else {
|
|
24392
|
+
recordTemplateStart(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24393
|
+
resolvePlaceholdersForView(job, view, i18nContexts, elements);
|
|
24394
|
+
recordTemplateClose(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24395
|
+
pendingStructuralDirective = void 0;
|
|
23988
24396
|
}
|
|
24397
|
+
}
|
|
24398
|
+
break;
|
|
24399
|
+
case OpKind.RepeaterCreate:
|
|
24400
|
+
if (pendingStructuralDirective !== void 0) {
|
|
24401
|
+
throw Error("AssertionError: Unexpected structural directive associated with @for block");
|
|
24402
|
+
}
|
|
24403
|
+
const forSlot = op.handle.slot + 1;
|
|
24404
|
+
const forView = job.views.get(op.xref);
|
|
24405
|
+
if (op.i18nPlaceholder === void 0) {
|
|
24406
|
+
resolvePlaceholdersForView(job, forView, i18nContexts, elements);
|
|
23989
24407
|
} else {
|
|
23990
|
-
|
|
24408
|
+
if (currentOps === null) {
|
|
24409
|
+
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
24410
|
+
}
|
|
24411
|
+
recordTemplateStart(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24412
|
+
resolvePlaceholdersForView(job, forView, i18nContexts, elements);
|
|
24413
|
+
recordTemplateClose(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24414
|
+
pendingStructuralDirective = void 0;
|
|
24415
|
+
}
|
|
24416
|
+
if (op.emptyView !== null) {
|
|
24417
|
+
const emptySlot = op.handle.slot + 2;
|
|
24418
|
+
const emptyView = job.views.get(op.emptyView);
|
|
24419
|
+
if (op.emptyI18nPlaceholder === void 0) {
|
|
24420
|
+
resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
|
|
24421
|
+
} else {
|
|
24422
|
+
if (currentOps === null) {
|
|
24423
|
+
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
24424
|
+
}
|
|
24425
|
+
recordTemplateStart(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24426
|
+
resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
|
|
24427
|
+
recordTemplateClose(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
24428
|
+
pendingStructuralDirective = void 0;
|
|
24429
|
+
}
|
|
23991
24430
|
}
|
|
23992
24431
|
break;
|
|
23993
24432
|
}
|
|
23994
24433
|
}
|
|
23995
24434
|
}
|
|
23996
|
-
function
|
|
23997
|
-
|
|
24435
|
+
function recordElementStart(op, i18nContext, i18nBlock, structuralDirective) {
|
|
24436
|
+
const { startName, closeName } = op.i18nPlaceholder;
|
|
24437
|
+
let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
|
|
24438
|
+
let value = op.handle.slot;
|
|
24439
|
+
if (structuralDirective !== void 0) {
|
|
24440
|
+
flags |= I18nParamValueFlags.TemplateTag;
|
|
24441
|
+
value = { element: value, template: structuralDirective.handle.slot };
|
|
24442
|
+
}
|
|
24443
|
+
if (!closeName) {
|
|
24444
|
+
flags |= I18nParamValueFlags.CloseTag;
|
|
24445
|
+
}
|
|
24446
|
+
addParam(i18nContext.params, startName, value, i18nBlock.subTemplateIndex, flags);
|
|
24447
|
+
}
|
|
24448
|
+
function recordElementClose(op, i18nContext, i18nBlock, structuralDirective) {
|
|
24449
|
+
const { closeName } = op.i18nPlaceholder;
|
|
24450
|
+
if (closeName) {
|
|
24451
|
+
let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag;
|
|
24452
|
+
let value = op.handle.slot;
|
|
24453
|
+
if (structuralDirective !== void 0) {
|
|
24454
|
+
flags |= I18nParamValueFlags.TemplateTag;
|
|
24455
|
+
value = { element: value, template: structuralDirective.handle.slot };
|
|
24456
|
+
}
|
|
24457
|
+
addParam(i18nContext.params, closeName, value, i18nBlock.subTemplateIndex, flags);
|
|
24458
|
+
}
|
|
24459
|
+
}
|
|
24460
|
+
function recordTemplateStart(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
|
|
24461
|
+
let { startName, closeName } = i18nPlaceholder;
|
|
24462
|
+
let flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
|
|
24463
|
+
if (!closeName) {
|
|
24464
|
+
flags |= I18nParamValueFlags.CloseTag;
|
|
24465
|
+
}
|
|
24466
|
+
if (structuralDirective !== void 0) {
|
|
24467
|
+
addParam(i18nContext.params, startName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
|
|
24468
|
+
}
|
|
24469
|
+
addParam(i18nContext.params, startName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
|
|
24470
|
+
}
|
|
24471
|
+
function recordTemplateClose(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
|
|
24472
|
+
const { startName, closeName } = i18nPlaceholder;
|
|
24473
|
+
const flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag;
|
|
24474
|
+
if (closeName) {
|
|
24475
|
+
addParam(i18nContext.params, closeName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
|
|
24476
|
+
if (structuralDirective !== void 0) {
|
|
24477
|
+
addParam(i18nContext.params, closeName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
|
|
24478
|
+
}
|
|
24479
|
+
}
|
|
24480
|
+
}
|
|
24481
|
+
function getSubTemplateIndexForTemplateTag(job, i18nOp, view) {
|
|
24482
|
+
for (const childOp of view.create) {
|
|
23998
24483
|
if (childOp.kind === OpKind.I18nStart) {
|
|
23999
24484
|
return childOp.subTemplateIndex;
|
|
24000
24485
|
}
|
|
@@ -24008,8 +24493,10 @@ function addParam(params, placeholder, value, subTemplateIndex, flags) {
|
|
|
24008
24493
|
params.set(placeholder, values);
|
|
24009
24494
|
}
|
|
24010
24495
|
function resolveI18nExpressionPlaceholders(job) {
|
|
24496
|
+
var _a2;
|
|
24011
24497
|
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
24012
24498
|
const i18nContexts = /* @__PURE__ */ new Map();
|
|
24499
|
+
const icuPlaceholders = /* @__PURE__ */ new Map();
|
|
24013
24500
|
for (const unit of job.units) {
|
|
24014
24501
|
for (const op of unit.create) {
|
|
24015
24502
|
switch (op.kind) {
|
|
@@ -24019,71 +24506,43 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
24019
24506
|
case OpKind.I18nContext:
|
|
24020
24507
|
i18nContexts.set(op.xref, op);
|
|
24021
24508
|
break;
|
|
24509
|
+
case OpKind.IcuPlaceholder:
|
|
24510
|
+
icuPlaceholders.set(op.xref, op);
|
|
24511
|
+
break;
|
|
24022
24512
|
}
|
|
24023
24513
|
}
|
|
24024
24514
|
}
|
|
24025
24515
|
const expressionIndices = /* @__PURE__ */ new Map();
|
|
24516
|
+
const referenceIndex = (op) => op.usage === I18nExpressionFor.I18nText ? op.i18nOwner : op.context;
|
|
24026
24517
|
for (const unit of job.units) {
|
|
24027
24518
|
for (const op of unit.update) {
|
|
24028
24519
|
if (op.kind === OpKind.I18nExpression) {
|
|
24029
|
-
const
|
|
24030
|
-
const
|
|
24031
|
-
const
|
|
24032
|
-
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
24033
|
-
const values = params.get(op.i18nPlaceholder) || [];
|
|
24034
|
-
values.push({
|
|
24520
|
+
const index2 = expressionIndices.get(referenceIndex(op)) || 0;
|
|
24521
|
+
const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
|
|
24522
|
+
const value = {
|
|
24035
24523
|
value: index2,
|
|
24036
24524
|
subTemplateIndex,
|
|
24037
24525
|
flags: I18nParamValueFlags.ExpressionIndex
|
|
24038
|
-
}
|
|
24039
|
-
|
|
24040
|
-
expressionIndices.set(op
|
|
24041
|
-
}
|
|
24042
|
-
}
|
|
24043
|
-
}
|
|
24044
|
-
}
|
|
24045
|
-
function resolveI18nIcuPlaceholders(job) {
|
|
24046
|
-
for (const unit of job.units) {
|
|
24047
|
-
for (const op of unit.create) {
|
|
24048
|
-
if (op.kind === OpKind.I18nContext && op.contextKind === I18nContextKind.Icu) {
|
|
24049
|
-
for (const node of op.message.nodes) {
|
|
24050
|
-
node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
|
|
24051
|
-
}
|
|
24526
|
+
};
|
|
24527
|
+
updatePlaceholder(op, value, i18nContexts, icuPlaceholders);
|
|
24528
|
+
expressionIndices.set(referenceIndex(op), index2 + 1);
|
|
24052
24529
|
}
|
|
24053
24530
|
}
|
|
24054
24531
|
}
|
|
24055
24532
|
}
|
|
24056
|
-
|
|
24057
|
-
|
|
24058
|
-
|
|
24059
|
-
|
|
24060
|
-
|
|
24061
|
-
|
|
24062
|
-
|
|
24063
|
-
if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
|
|
24064
|
-
this.params.set(placeholder.startName, [{
|
|
24065
|
-
value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
|
|
24066
|
-
subTemplateIndex: null,
|
|
24067
|
-
flags: I18nParamValueFlags.None
|
|
24068
|
-
}]);
|
|
24069
|
-
}
|
|
24070
|
-
if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
|
|
24071
|
-
this.params.set(placeholder.closeName, [{
|
|
24072
|
-
value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
|
|
24073
|
-
subTemplateIndex: null,
|
|
24074
|
-
flags: I18nParamValueFlags.None
|
|
24075
|
-
}]);
|
|
24076
|
-
}
|
|
24077
|
-
}
|
|
24078
|
-
visitTagPlaceholder(placeholder) {
|
|
24079
|
-
super.visitTagPlaceholder(placeholder);
|
|
24080
|
-
this.visitContainerPlaceholder(placeholder);
|
|
24533
|
+
function updatePlaceholder(op, value, i18nContexts, icuPlaceholders) {
|
|
24534
|
+
if (op.i18nPlaceholder !== null) {
|
|
24535
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
24536
|
+
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
24537
|
+
const values = params.get(op.i18nPlaceholder) || [];
|
|
24538
|
+
values.push(value);
|
|
24539
|
+
params.set(op.i18nPlaceholder, values);
|
|
24081
24540
|
}
|
|
24082
|
-
|
|
24083
|
-
|
|
24084
|
-
|
|
24541
|
+
if (op.icuPlaceholder !== null) {
|
|
24542
|
+
const icuPlaceholderOp = icuPlaceholders.get(op.icuPlaceholder);
|
|
24543
|
+
icuPlaceholderOp == null ? void 0 : icuPlaceholderOp.expressionPlaceholders.push(value);
|
|
24085
24544
|
}
|
|
24086
|
-
}
|
|
24545
|
+
}
|
|
24087
24546
|
function resolveNames(job) {
|
|
24088
24547
|
for (const unit of job.units) {
|
|
24089
24548
|
processLexicalScope(unit, unit.create, null);
|
|
@@ -24146,30 +24605,54 @@ function processLexicalScope(unit, ops, savedView) {
|
|
|
24146
24605
|
});
|
|
24147
24606
|
}
|
|
24148
24607
|
}
|
|
24149
|
-
var
|
|
24150
|
-
[SecurityContext.HTML,
|
|
24151
|
-
[SecurityContext.
|
|
24152
|
-
[SecurityContext.
|
|
24153
|
-
[SecurityContext.
|
|
24154
|
-
[SecurityContext.
|
|
24608
|
+
var sanitizerFns = /* @__PURE__ */ new Map([
|
|
24609
|
+
[SecurityContext.HTML, Identifiers.sanitizeHtml],
|
|
24610
|
+
[SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl],
|
|
24611
|
+
[SecurityContext.SCRIPT, Identifiers.sanitizeScript],
|
|
24612
|
+
[SecurityContext.STYLE, Identifiers.sanitizeStyle],
|
|
24613
|
+
[SecurityContext.URL, Identifiers.sanitizeUrl]
|
|
24614
|
+
]);
|
|
24615
|
+
var trustedValueFns = /* @__PURE__ */ new Map([
|
|
24616
|
+
[SecurityContext.HTML, Identifiers.trustConstantHtml],
|
|
24617
|
+
[SecurityContext.RESOURCE_URL, Identifiers.trustConstantResourceUrl]
|
|
24155
24618
|
]);
|
|
24156
24619
|
function resolveSanitizers(job) {
|
|
24620
|
+
var _a2, _b2;
|
|
24157
24621
|
for (const unit of job.units) {
|
|
24158
24622
|
const elements = createOpXrefMap(unit);
|
|
24159
|
-
|
|
24623
|
+
if (job.kind !== CompilationJobKind.Host) {
|
|
24624
|
+
for (const op of unit.create) {
|
|
24625
|
+
if (op.kind === OpKind.ExtractedAttribute) {
|
|
24626
|
+
const trustedValueFn = (_a2 = trustedValueFns.get(getOnlySecurityContext(op.securityContext))) != null ? _a2 : null;
|
|
24627
|
+
op.trustedValueFn = trustedValueFn !== null ? importExpr(trustedValueFn) : null;
|
|
24628
|
+
}
|
|
24629
|
+
}
|
|
24630
|
+
}
|
|
24160
24631
|
for (const op of unit.update) {
|
|
24161
24632
|
switch (op.kind) {
|
|
24162
24633
|
case OpKind.Property:
|
|
24163
24634
|
case OpKind.Attribute:
|
|
24164
|
-
|
|
24165
|
-
|
|
24635
|
+
case OpKind.HostProperty:
|
|
24636
|
+
let sanitizerFn = null;
|
|
24637
|
+
if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
|
|
24638
|
+
sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
|
|
24639
|
+
} else {
|
|
24640
|
+
sanitizerFn = (_b2 = sanitizerFns.get(getOnlySecurityContext(op.securityContext))) != null ? _b2 : null;
|
|
24641
|
+
}
|
|
24642
|
+
op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
|
|
24166
24643
|
if (op.sanitizer === null) {
|
|
24167
|
-
|
|
24168
|
-
if (
|
|
24169
|
-
|
|
24644
|
+
let isIframe = false;
|
|
24645
|
+
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.HostProperty) {
|
|
24646
|
+
isIframe = true;
|
|
24647
|
+
} else {
|
|
24648
|
+
const ownerOp = elements.get(op.target);
|
|
24649
|
+
if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
|
|
24650
|
+
throw Error("Property should have an element-like owner");
|
|
24651
|
+
}
|
|
24652
|
+
isIframe = isIframeElement$1(ownerOp);
|
|
24170
24653
|
}
|
|
24171
|
-
if (
|
|
24172
|
-
op.sanitizer =
|
|
24654
|
+
if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
|
|
24655
|
+
op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
|
|
24173
24656
|
}
|
|
24174
24657
|
}
|
|
24175
24658
|
break;
|
|
@@ -24181,6 +24664,15 @@ function isIframeElement$1(op) {
|
|
|
24181
24664
|
var _a2;
|
|
24182
24665
|
return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
|
|
24183
24666
|
}
|
|
24667
|
+
function getOnlySecurityContext(securityContext) {
|
|
24668
|
+
if (Array.isArray(securityContext)) {
|
|
24669
|
+
if (securityContext.length > 1) {
|
|
24670
|
+
throw Error(`AssertionError: Ambiguous security context`);
|
|
24671
|
+
}
|
|
24672
|
+
return securityContext[0] || SecurityContext.NONE;
|
|
24673
|
+
}
|
|
24674
|
+
return securityContext;
|
|
24675
|
+
}
|
|
24184
24676
|
function saveAndRestoreView(job) {
|
|
24185
24677
|
for (const unit of job.units) {
|
|
24186
24678
|
unit.create.prepend([
|
|
@@ -24342,6 +24834,9 @@ function generateTrackFns(job) {
|
|
|
24342
24834
|
}
|
|
24343
24835
|
let usesComponentContext = false;
|
|
24344
24836
|
op.track = transformExpressionsInExpression(op.track, (expr) => {
|
|
24837
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
24838
|
+
throw new Error(`Illegal State: Pipes are not allowed in this context`);
|
|
24839
|
+
}
|
|
24345
24840
|
if (expr instanceof TrackContextExpr) {
|
|
24346
24841
|
usesComponentContext = true;
|
|
24347
24842
|
return variable("this");
|
|
@@ -24500,7 +24995,10 @@ function varsUsedByOp(op) {
|
|
|
24500
24995
|
return op.interpolation.expressions.length;
|
|
24501
24996
|
case OpKind.I18nExpression:
|
|
24502
24997
|
case OpKind.Conditional:
|
|
24998
|
+
case OpKind.DeferWhen:
|
|
24503
24999
|
return 1;
|
|
25000
|
+
case OpKind.RepeaterCreate:
|
|
25001
|
+
return op.emptyView ? 1 : 0;
|
|
24504
25002
|
default:
|
|
24505
25003
|
throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
|
|
24506
25004
|
}
|
|
@@ -24789,12 +25287,12 @@ function wrapI18nIcus(job) {
|
|
|
24789
25287
|
case OpKind.IcuStart:
|
|
24790
25288
|
if (currentI18nOp === null) {
|
|
24791
25289
|
addedI18nId = job.allocateXrefId();
|
|
24792
|
-
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
|
|
25290
|
+
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message, void 0, null), op);
|
|
24793
25291
|
}
|
|
24794
25292
|
break;
|
|
24795
25293
|
case OpKind.IcuEnd:
|
|
24796
25294
|
if (addedI18nId !== null) {
|
|
24797
|
-
OpList.insertAfter(createI18nEndOp(addedI18nId), op);
|
|
25295
|
+
OpList.insertAfter(createI18nEndOp(addedI18nId, null), op);
|
|
24798
25296
|
addedI18nId = null;
|
|
24799
25297
|
}
|
|
24800
25298
|
break;
|
|
@@ -24806,12 +25304,13 @@ var phases = [
|
|
|
24806
25304
|
{ kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
|
|
24807
25305
|
{ kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
|
|
24808
25306
|
{ kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
|
|
24809
|
-
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
24810
|
-
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
24811
25307
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
24812
25308
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
24813
|
-
{ kind: CompilationJobKind.
|
|
25309
|
+
{ kind: CompilationJobKind.Both, fn: deduplicateTextBindings },
|
|
25310
|
+
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
25311
|
+
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
24814
25312
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
25313
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
24815
25314
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
24816
25315
|
{ kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
|
|
24817
25316
|
{ kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
|
|
@@ -24819,14 +25318,17 @@ var phases = [
|
|
|
24819
25318
|
{ kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
|
|
24820
25319
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
24821
25320
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
24822
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
25321
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
25322
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
25323
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
25324
|
+
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
24823
25325
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
24824
25326
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
24825
25327
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
24826
25328
|
{ kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
|
|
24827
25329
|
{ kind: CompilationJobKind.Tmpl, fn: generateVariables },
|
|
24828
25330
|
{ kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
|
|
24829
|
-
{ kind: CompilationJobKind.
|
|
25331
|
+
{ kind: CompilationJobKind.Both, fn: deleteAnyCasts },
|
|
24830
25332
|
{ kind: CompilationJobKind.Both, fn: resolveDollarEvent },
|
|
24831
25333
|
{ kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
|
|
24832
25334
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
|
|
@@ -24834,7 +25336,7 @@ var phases = [
|
|
|
24834
25336
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
24835
25337
|
{ kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
|
|
24836
25338
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
24837
|
-
{ kind: CompilationJobKind.
|
|
25339
|
+
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
24838
25340
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
24839
25341
|
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
24840
25342
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
@@ -24843,13 +25345,11 @@ var phases = [
|
|
|
24843
25345
|
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
24844
25346
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
24845
25347
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
24846
|
-
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
|
|
24847
25348
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
24848
25349
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
24849
25350
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
24850
25351
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
24851
25352
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
24852
|
-
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
24853
25353
|
{ kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
|
|
24854
25354
|
{ kind: CompilationJobKind.Both, fn: countVariables },
|
|
24855
25355
|
{ kind: CompilationJobKind.Tmpl, fn: generateAdvance },
|
|
@@ -24965,6 +25465,8 @@ function emitHostBindingFunction(job) {
|
|
|
24965
25465
|
);
|
|
24966
25466
|
}
|
|
24967
25467
|
var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
25468
|
+
var domSchema = new DomElementSchemaRegistry();
|
|
25469
|
+
var NG_TEMPLATE_TAG_NAME$1 = "ng-template";
|
|
24968
25470
|
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
24969
25471
|
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
|
|
24970
25472
|
ingestNodes(job.root, template2);
|
|
@@ -24974,51 +25476,55 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
24974
25476
|
var _a2, _b2, _c2;
|
|
24975
25477
|
const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode);
|
|
24976
25478
|
for (const property2 of (_a2 = input.properties) != null ? _a2 : []) {
|
|
24977
|
-
|
|
25479
|
+
let bindingKind = BindingKind.Property;
|
|
25480
|
+
if (property2.name.startsWith("attr.")) {
|
|
25481
|
+
property2.name = property2.name.substring("attr.".length);
|
|
25482
|
+
bindingKind = BindingKind.Attribute;
|
|
25483
|
+
}
|
|
25484
|
+
if (property2.isAnimation) {
|
|
25485
|
+
bindingKind = BindingKind.Animation;
|
|
25486
|
+
}
|
|
25487
|
+
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
|
|
25488
|
+
ingestHostProperty(job, property2, bindingKind, securityContexts);
|
|
24978
25489
|
}
|
|
24979
25490
|
for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
|
|
24980
|
-
|
|
25491
|
+
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
|
|
25492
|
+
ingestHostAttribute(job, name, expr, securityContexts);
|
|
24981
25493
|
}
|
|
24982
25494
|
for (const event of (_c2 = input.events) != null ? _c2 : []) {
|
|
24983
25495
|
ingestHostEvent(job, event);
|
|
24984
25496
|
}
|
|
24985
25497
|
return job;
|
|
24986
25498
|
}
|
|
24987
|
-
function ingestHostProperty(job, property2,
|
|
25499
|
+
function ingestHostProperty(job, property2, bindingKind, securityContexts) {
|
|
24988
25500
|
let expression;
|
|
24989
25501
|
const ast = property2.expression.ast;
|
|
24990
25502
|
if (ast instanceof Interpolation$1) {
|
|
24991
|
-
expression = new Interpolation(ast.strings, ast.expressions.map((expr) => convertAst(expr, job, property2.sourceSpan)));
|
|
25503
|
+
expression = new Interpolation(ast.strings, ast.expressions.map((expr) => convertAst(expr, job, property2.sourceSpan)), []);
|
|
24992
25504
|
} else {
|
|
24993
25505
|
expression = convertAst(ast, job, property2.sourceSpan);
|
|
24994
25506
|
}
|
|
24995
|
-
|
|
24996
|
-
if (property2.name.startsWith("attr.")) {
|
|
24997
|
-
property2.name = property2.name.substring("attr.".length);
|
|
24998
|
-
bindingKind = BindingKind.Attribute;
|
|
24999
|
-
}
|
|
25000
|
-
if (property2.isAnimation) {
|
|
25001
|
-
bindingKind = BindingKind.Animation;
|
|
25002
|
-
}
|
|
25003
|
-
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, SecurityContext.NONE, isTextAttribute, false, property2.sourceSpan));
|
|
25507
|
+
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, false, false, null, null, property2.sourceSpan));
|
|
25004
25508
|
}
|
|
25005
|
-
function ingestHostAttribute(job, name, value) {
|
|
25509
|
+
function ingestHostAttribute(job, name, value, securityContexts) {
|
|
25006
25510
|
const attrBinding = createBindingOp(
|
|
25007
25511
|
job.root.xref,
|
|
25008
25512
|
BindingKind.Attribute,
|
|
25009
25513
|
name,
|
|
25010
25514
|
value,
|
|
25011
25515
|
null,
|
|
25012
|
-
|
|
25516
|
+
securityContexts,
|
|
25013
25517
|
true,
|
|
25014
25518
|
false,
|
|
25015
|
-
null
|
|
25519
|
+
null,
|
|
25520
|
+
null,
|
|
25521
|
+
value.sourceSpan
|
|
25016
25522
|
);
|
|
25017
25523
|
job.root.update.push(attrBinding);
|
|
25018
25524
|
}
|
|
25019
25525
|
function ingestHostEvent(job, event) {
|
|
25020
|
-
const
|
|
25021
|
-
eventBinding.
|
|
25526
|
+
const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
|
|
25527
|
+
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, makeListenerHandlerOps(job.root, event.handler, event.handlerSpan), phase, target, true, event.sourceSpan);
|
|
25022
25528
|
job.root.create.push(eventBinding);
|
|
25023
25529
|
}
|
|
25024
25530
|
function ingestNodes(unit, template2) {
|
|
@@ -25030,9 +25536,9 @@ function ingestNodes(unit, template2) {
|
|
|
25030
25536
|
} else if (node instanceof Content) {
|
|
25031
25537
|
ingestContent(unit, node);
|
|
25032
25538
|
} else if (node instanceof Text$3) {
|
|
25033
|
-
ingestText(unit, node);
|
|
25539
|
+
ingestText(unit, node, null);
|
|
25034
25540
|
} else if (node instanceof BoundText) {
|
|
25035
|
-
ingestBoundText(unit, node);
|
|
25541
|
+
ingestBoundText(unit, node, null);
|
|
25036
25542
|
} else if (node instanceof IfBlock) {
|
|
25037
25543
|
ingestIfBlock(unit, node);
|
|
25038
25544
|
} else if (node instanceof SwitchBlock) {
|
|
@@ -25049,26 +25555,30 @@ function ingestNodes(unit, template2) {
|
|
|
25049
25555
|
}
|
|
25050
25556
|
}
|
|
25051
25557
|
function ingestElement(unit, element2) {
|
|
25052
|
-
var _a2;
|
|
25558
|
+
var _a2, _b2;
|
|
25053
25559
|
if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
|
|
25054
25560
|
throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
|
|
25055
25561
|
}
|
|
25056
25562
|
const id = unit.job.allocateXrefId();
|
|
25057
25563
|
const [namespaceKey, elementName] = splitNsName(element2.name);
|
|
25058
|
-
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
|
|
25564
|
+
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan, element2.sourceSpan);
|
|
25059
25565
|
unit.create.push(startOp);
|
|
25060
|
-
|
|
25566
|
+
ingestElementBindings(unit, startOp, element2);
|
|
25061
25567
|
ingestReferences(startOp, element2);
|
|
25568
|
+
let i18nBlockId = null;
|
|
25569
|
+
if (element2.i18n instanceof Message) {
|
|
25570
|
+
i18nBlockId = unit.job.allocateXrefId();
|
|
25571
|
+
unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n, void 0, element2.startSourceSpan));
|
|
25572
|
+
}
|
|
25062
25573
|
ingestNodes(unit, element2.children);
|
|
25063
25574
|
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
25064
25575
|
unit.create.push(endOp);
|
|
25065
|
-
if (
|
|
25066
|
-
|
|
25067
|
-
OpList.insertAfter(createI18nStartOp(i18nBlockId, element2.i18n), startOp);
|
|
25068
|
-
OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
|
|
25576
|
+
if (i18nBlockId !== null) {
|
|
25577
|
+
OpList.insertBefore(createI18nEndOp(i18nBlockId, (_b2 = element2.endSourceSpan) != null ? _b2 : element2.startSourceSpan), endOp);
|
|
25069
25578
|
}
|
|
25070
25579
|
}
|
|
25071
25580
|
function ingestTemplate(unit, tmpl) {
|
|
25581
|
+
var _a2;
|
|
25072
25582
|
if (tmpl.i18n !== void 0 && !(tmpl.i18n instanceof Message || tmpl.i18n instanceof TagPlaceholder)) {
|
|
25073
25583
|
throw Error(`Unhandled i18n metadata type for template: ${tmpl.i18n.constructor.name}`);
|
|
25074
25584
|
}
|
|
@@ -25081,31 +25591,36 @@ function ingestTemplate(unit, tmpl) {
|
|
|
25081
25591
|
const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
|
|
25082
25592
|
const namespace = namespaceForKey(namespacePrefix);
|
|
25083
25593
|
const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
|
|
25084
|
-
const
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
|
|
25594
|
+
const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
|
|
25595
|
+
const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan, tmpl.sourceSpan);
|
|
25596
|
+
unit.create.push(templateOp);
|
|
25597
|
+
ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
|
|
25598
|
+
ingestReferences(templateOp, tmpl);
|
|
25088
25599
|
ingestNodes(childView, tmpl.children);
|
|
25089
25600
|
for (const { name, value } of tmpl.variables) {
|
|
25090
25601
|
childView.contextVariables.set(name, value !== "" ? value : "$implicit");
|
|
25091
25602
|
}
|
|
25092
|
-
if (
|
|
25603
|
+
if (templateKind === TemplateKind.NgTemplate && tmpl.i18n instanceof Message) {
|
|
25093
25604
|
const id = unit.job.allocateXrefId();
|
|
25094
|
-
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
|
|
25095
|
-
OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
|
|
25605
|
+
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n, void 0, tmpl.startSourceSpan), childView.create.head);
|
|
25606
|
+
OpList.insertBefore(createI18nEndOp(id, (_a2 = tmpl.endSourceSpan) != null ? _a2 : tmpl.startSourceSpan), childView.create.tail);
|
|
25096
25607
|
}
|
|
25097
25608
|
}
|
|
25098
25609
|
function ingestContent(unit, content) {
|
|
25099
|
-
|
|
25610
|
+
if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
|
|
25611
|
+
throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
|
|
25612
|
+
}
|
|
25613
|
+
const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, content.sourceSpan);
|
|
25100
25614
|
for (const attr of content.attributes) {
|
|
25101
|
-
|
|
25615
|
+
const securityContext = domSchema.securityContext(content.name, attr.name, true);
|
|
25616
|
+
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
25102
25617
|
}
|
|
25103
25618
|
unit.create.push(op);
|
|
25104
25619
|
}
|
|
25105
|
-
function ingestText(unit, text2) {
|
|
25106
|
-
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
|
|
25620
|
+
function ingestText(unit, text2, icuPlaceholder) {
|
|
25621
|
+
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, icuPlaceholder, text2.sourceSpan));
|
|
25107
25622
|
}
|
|
25108
|
-
function ingestBoundText(unit, text2,
|
|
25623
|
+
function ingestBoundText(unit, text2, icuPlaceholder) {
|
|
25109
25624
|
var _a2;
|
|
25110
25625
|
let value = text2.value;
|
|
25111
25626
|
if (value instanceof ASTWithSource) {
|
|
@@ -25117,18 +25632,17 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
|
|
|
25117
25632
|
if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
|
|
25118
25633
|
throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
25119
25634
|
}
|
|
25120
|
-
|
|
25121
|
-
i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
25122
|
-
}
|
|
25635
|
+
const i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
25123
25636
|
if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
|
|
25124
25637
|
throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
|
|
25125
25638
|
}
|
|
25126
25639
|
const textXref = unit.job.allocateXrefId();
|
|
25127
|
-
unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
|
|
25640
|
+
unit.create.push(createTextOp(textXref, "", icuPlaceholder, text2.sourceSpan));
|
|
25128
25641
|
const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
|
|
25129
|
-
unit.update.push(createInterpolateTextOp(textXref, new Interpolation(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan))
|
|
25642
|
+
unit.update.push(createInterpolateTextOp(textXref, new Interpolation(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
|
|
25130
25643
|
}
|
|
25131
25644
|
function ingestIfBlock(unit, ifBlock) {
|
|
25645
|
+
var _a2;
|
|
25132
25646
|
let firstXref = null;
|
|
25133
25647
|
let firstSlotHandle = null;
|
|
25134
25648
|
let conditions = [];
|
|
@@ -25142,14 +25656,21 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
25142
25656
|
if (ifCase.expressionAlias !== null) {
|
|
25143
25657
|
cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
|
|
25144
25658
|
}
|
|
25145
|
-
|
|
25146
|
-
|
|
25659
|
+
let ifCaseI18nMeta = void 0;
|
|
25660
|
+
if (ifCase.i18n !== void 0) {
|
|
25661
|
+
if (!(ifCase.i18n instanceof BlockPlaceholder)) {
|
|
25662
|
+
throw Error(`Unhandled i18n metadata type for if block: ${(_a2 = ifCase.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
25663
|
+
}
|
|
25664
|
+
ifCaseI18nMeta = ifCase.i18n;
|
|
25665
|
+
}
|
|
25666
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
25667
|
+
unit.create.push(templateOp);
|
|
25147
25668
|
if (firstXref === null) {
|
|
25148
25669
|
firstXref = cView.xref;
|
|
25149
|
-
firstSlotHandle =
|
|
25670
|
+
firstSlotHandle = templateOp.handle;
|
|
25150
25671
|
}
|
|
25151
25672
|
const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
|
|
25152
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
25673
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle, ifCase.expressionAlias);
|
|
25153
25674
|
conditions.push(conditionalCaseExpr);
|
|
25154
25675
|
ingestNodes(cView, ifCase.children);
|
|
25155
25676
|
}
|
|
@@ -25157,54 +25678,65 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
25157
25678
|
unit.update.push(conditional2);
|
|
25158
25679
|
}
|
|
25159
25680
|
function ingestSwitchBlock(unit, switchBlock) {
|
|
25681
|
+
var _a2;
|
|
25160
25682
|
let firstXref = null;
|
|
25161
25683
|
let firstSlotHandle = null;
|
|
25162
25684
|
let conditions = [];
|
|
25163
25685
|
for (const switchCase of switchBlock.cases) {
|
|
25164
25686
|
const cView = unit.job.allocateView(unit.xref);
|
|
25165
|
-
|
|
25166
|
-
|
|
25687
|
+
let switchCaseI18nMeta = void 0;
|
|
25688
|
+
if (switchCase.i18n !== void 0) {
|
|
25689
|
+
if (!(switchCase.i18n instanceof BlockPlaceholder)) {
|
|
25690
|
+
throw Error(`Unhandled i18n metadata type for switch block: ${(_a2 = switchCase.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
25691
|
+
}
|
|
25692
|
+
switchCaseI18nMeta = switchCase.i18n;
|
|
25693
|
+
}
|
|
25694
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
25695
|
+
unit.create.push(templateOp);
|
|
25167
25696
|
if (firstXref === null) {
|
|
25168
25697
|
firstXref = cView.xref;
|
|
25169
|
-
firstSlotHandle =
|
|
25698
|
+
firstSlotHandle = templateOp.handle;
|
|
25170
25699
|
}
|
|
25171
25700
|
const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
|
|
25172
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
25701
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle);
|
|
25173
25702
|
conditions.push(conditionalCaseExpr);
|
|
25174
25703
|
ingestNodes(cView, switchCase.children);
|
|
25175
25704
|
}
|
|
25176
25705
|
const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
|
|
25177
25706
|
unit.update.push(conditional2);
|
|
25178
25707
|
}
|
|
25179
|
-
function ingestDeferView(unit, suffix, children, sourceSpan) {
|
|
25708
|
+
function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
|
|
25709
|
+
if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
|
|
25710
|
+
throw Error("Unhandled i18n metadata type for defer block");
|
|
25711
|
+
}
|
|
25180
25712
|
if (children === void 0) {
|
|
25181
25713
|
return null;
|
|
25182
25714
|
}
|
|
25183
25715
|
const secondaryView = unit.job.allocateView(unit.xref);
|
|
25184
25716
|
ingestNodes(secondaryView, children);
|
|
25185
|
-
const templateOp = createTemplateOp(secondaryView.xref, null, `Defer${suffix}`, Namespace.HTML,
|
|
25717
|
+
const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan, sourceSpan);
|
|
25186
25718
|
unit.create.push(templateOp);
|
|
25187
25719
|
return templateOp;
|
|
25188
25720
|
}
|
|
25189
25721
|
function ingestDeferBlock(unit, deferBlock) {
|
|
25190
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
25722
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
25191
25723
|
const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
|
|
25192
25724
|
if (blockMeta === void 0) {
|
|
25193
25725
|
throw new Error(`AssertionError: unable to find metadata for deferred block`);
|
|
25194
25726
|
}
|
|
25195
|
-
const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
|
|
25196
|
-
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.
|
|
25197
|
-
const placeholder = ingestDeferView(unit, "Placeholder", (
|
|
25198
|
-
const error2 = ingestDeferView(unit, "Error", (
|
|
25727
|
+
const main = ingestDeferView(unit, "", deferBlock.i18n, deferBlock.children, deferBlock.sourceSpan);
|
|
25728
|
+
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.i18n, (_b2 = deferBlock.loading) == null ? void 0 : _b2.children, (_c2 = deferBlock.loading) == null ? void 0 : _c2.sourceSpan);
|
|
25729
|
+
const placeholder = ingestDeferView(unit, "Placeholder", (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.i18n, (_e2 = deferBlock.placeholder) == null ? void 0 : _e2.children, (_f2 = deferBlock.placeholder) == null ? void 0 : _f2.sourceSpan);
|
|
25730
|
+
const error2 = ingestDeferView(unit, "Error", (_g = deferBlock.error) == null ? void 0 : _g.i18n, (_h = deferBlock.error) == null ? void 0 : _h.children, (_i = deferBlock.error) == null ? void 0 : _i.sourceSpan);
|
|
25199
25731
|
const deferXref = unit.job.allocateXrefId();
|
|
25200
25732
|
const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
|
|
25201
|
-
deferOp.placeholderView = (
|
|
25202
|
-
deferOp.placeholderSlot = (
|
|
25203
|
-
deferOp.loadingSlot = (
|
|
25204
|
-
deferOp.errorSlot = (
|
|
25205
|
-
deferOp.placeholderMinimumTime = (
|
|
25206
|
-
deferOp.loadingMinimumTime = (
|
|
25207
|
-
deferOp.loadingAfterTime = (
|
|
25733
|
+
deferOp.placeholderView = (_j = placeholder == null ? void 0 : placeholder.xref) != null ? _j : null;
|
|
25734
|
+
deferOp.placeholderSlot = (_k = placeholder == null ? void 0 : placeholder.handle) != null ? _k : null;
|
|
25735
|
+
deferOp.loadingSlot = (_l = loading == null ? void 0 : loading.handle) != null ? _l : null;
|
|
25736
|
+
deferOp.errorSlot = (_m = error2 == null ? void 0 : error2.handle) != null ? _m : null;
|
|
25737
|
+
deferOp.placeholderMinimumTime = (_o = (_n = deferBlock.placeholder) == null ? void 0 : _n.minimumTime) != null ? _o : null;
|
|
25738
|
+
deferOp.loadingMinimumTime = (_q = (_p = deferBlock.loading) == null ? void 0 : _p.minimumTime) != null ? _q : null;
|
|
25739
|
+
deferOp.loadingAfterTime = (_s = (_r = deferBlock.loading) == null ? void 0 : _r.afterTime) != null ? _s : null;
|
|
25208
25740
|
unit.create.push(deferOp);
|
|
25209
25741
|
let prefetch = false;
|
|
25210
25742
|
let deferOnOps = [];
|
|
@@ -25256,6 +25788,9 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
25256
25788
|
deferOnOps.push(deferOnOp);
|
|
25257
25789
|
}
|
|
25258
25790
|
if (triggers.when !== void 0) {
|
|
25791
|
+
if (triggers.when.value instanceof Interpolation$1) {
|
|
25792
|
+
throw new Error(`Unexpected interpolation in defer block when trigger`);
|
|
25793
|
+
}
|
|
25259
25794
|
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
25260
25795
|
deferWhenOps.push(deferOnOp);
|
|
25261
25796
|
}
|
|
@@ -25268,30 +25803,25 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
25268
25803
|
unit.update.push(deferWhenOps);
|
|
25269
25804
|
}
|
|
25270
25805
|
function ingestIcu(unit, icu) {
|
|
25271
|
-
var _a2
|
|
25806
|
+
var _a2;
|
|
25272
25807
|
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
25273
25808
|
const xref = unit.job.allocateXrefId();
|
|
25274
25809
|
const icuNode = icu.i18n.nodes[0];
|
|
25275
25810
|
unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
|
|
25276
|
-
const
|
|
25277
|
-
if (expressionPlaceholder === void 0 || icu.vars[expressionPlaceholder] === void 0) {
|
|
25278
|
-
throw Error("ICU should have a text binding");
|
|
25279
|
-
}
|
|
25280
|
-
ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
|
|
25281
|
-
for (const [placeholder, text2] of Object.entries(icu.placeholders)) {
|
|
25811
|
+
for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
|
|
25282
25812
|
if (text2 instanceof BoundText) {
|
|
25283
|
-
ingestBoundText(unit, text2,
|
|
25813
|
+
ingestBoundText(unit, text2, placeholder);
|
|
25284
25814
|
} else {
|
|
25285
|
-
ingestText(unit, text2);
|
|
25815
|
+
ingestText(unit, text2, placeholder);
|
|
25286
25816
|
}
|
|
25287
25817
|
}
|
|
25288
25818
|
unit.create.push(createIcuEndOp(xref));
|
|
25289
25819
|
} else {
|
|
25290
|
-
throw Error(`Unhandled i18n metadata type for ICU: ${(
|
|
25820
|
+
throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
25291
25821
|
}
|
|
25292
25822
|
}
|
|
25293
25823
|
function ingestForBlock(unit, forBlock) {
|
|
25294
|
-
var _a2;
|
|
25824
|
+
var _a2, _b2, _c2;
|
|
25295
25825
|
const repeaterView = unit.job.allocateView(unit.xref);
|
|
25296
25826
|
const createRepeaterAlias = (ident, repeaterVar) => {
|
|
25297
25827
|
repeaterView.aliases.add({
|
|
@@ -25312,9 +25842,11 @@ function ingestForBlock(unit, forBlock) {
|
|
|
25312
25842
|
const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
|
|
25313
25843
|
ingestNodes(repeaterView, forBlock.children);
|
|
25314
25844
|
let emptyView = null;
|
|
25845
|
+
let emptyTagName = null;
|
|
25315
25846
|
if (forBlock.empty !== null) {
|
|
25316
25847
|
emptyView = unit.job.allocateView(unit.xref);
|
|
25317
25848
|
ingestNodes(emptyView, forBlock.empty.children);
|
|
25849
|
+
emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
|
|
25318
25850
|
}
|
|
25319
25851
|
const varNames = {
|
|
25320
25852
|
$index: forBlock.contextVariables.$index.name,
|
|
@@ -25325,8 +25857,16 @@ function ingestForBlock(unit, forBlock) {
|
|
|
25325
25857
|
$odd: forBlock.contextVariables.$odd.name,
|
|
25326
25858
|
$implicit: forBlock.item.name
|
|
25327
25859
|
};
|
|
25860
|
+
if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
|
|
25861
|
+
throw Error("AssertionError: Unhandled i18n metadata type or @for");
|
|
25862
|
+
}
|
|
25863
|
+
if (((_a2 = forBlock.empty) == null ? void 0 : _a2.i18n) !== void 0 && !(forBlock.empty.i18n instanceof BlockPlaceholder)) {
|
|
25864
|
+
throw Error("AssertionError: Unhandled i18n metadata type or @empty");
|
|
25865
|
+
}
|
|
25866
|
+
const i18nPlaceholder = forBlock.i18n;
|
|
25867
|
+
const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
|
|
25328
25868
|
const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
|
|
25329
|
-
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (
|
|
25869
|
+
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);
|
|
25330
25870
|
unit.create.push(repeaterCreate2);
|
|
25331
25871
|
const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
|
|
25332
25872
|
const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
|
|
@@ -25336,7 +25876,10 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
25336
25876
|
if (ast instanceof ASTWithSource) {
|
|
25337
25877
|
return convertAst(ast.ast, job, baseSourceSpan);
|
|
25338
25878
|
} else if (ast instanceof PropertyRead) {
|
|
25339
|
-
|
|
25879
|
+
const isThisReceiver = ast.receiver instanceof ThisReceiver;
|
|
25880
|
+
const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
|
|
25881
|
+
const isSpecialNode = ast.name === "$any" || ast.name === "$event";
|
|
25882
|
+
if (isImplicitReceiver || isThisReceiver && !isSpecialNode) {
|
|
25340
25883
|
return new LexicalReadExpr(ast.name);
|
|
25341
25884
|
} else {
|
|
25342
25885
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -25362,6 +25905,15 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
25362
25905
|
}
|
|
25363
25906
|
} else if (ast instanceof LiteralPrimitive) {
|
|
25364
25907
|
return literal(ast.value, void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
25908
|
+
} else if (ast instanceof Unary) {
|
|
25909
|
+
switch (ast.operator) {
|
|
25910
|
+
case "+":
|
|
25911
|
+
return new UnaryOperatorExpr(UnaryOperator.Plus, convertAst(ast.expr, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
25912
|
+
case "-":
|
|
25913
|
+
return new UnaryOperatorExpr(UnaryOperator.Minus, convertAst(ast.expr, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
25914
|
+
default:
|
|
25915
|
+
throw new Error(`AssertionError: unknown unary operator ${ast.operator}`);
|
|
25916
|
+
}
|
|
25365
25917
|
} else if (ast instanceof Binary) {
|
|
25366
25918
|
const operator = BINARY_OPERATORS.get(ast.operation);
|
|
25367
25919
|
if (operator === void 0) {
|
|
@@ -25399,104 +25951,134 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
25399
25951
|
return new SafeInvokeFunctionExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.args.map((a) => convertAst(a, job, baseSourceSpan)));
|
|
25400
25952
|
} else if (ast instanceof EmptyExpr$1) {
|
|
25401
25953
|
return new EmptyExpr(convertSourceSpan(ast.span, baseSourceSpan));
|
|
25954
|
+
} else if (ast instanceof PrefixNot) {
|
|
25955
|
+
return not(convertAst(ast.expression, job, baseSourceSpan), convertSourceSpan(ast.span, baseSourceSpan));
|
|
25402
25956
|
} else {
|
|
25403
25957
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
25404
25958
|
}
|
|
25405
25959
|
}
|
|
25960
|
+
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
25961
|
+
var _a2, _b2;
|
|
25962
|
+
let expression;
|
|
25963
|
+
if (value instanceof Interpolation$1) {
|
|
25964
|
+
expression = new Interpolation(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 : {}));
|
|
25965
|
+
} else if (value instanceof AST) {
|
|
25966
|
+
expression = convertAst(value, job, sourceSpan != null ? sourceSpan : null);
|
|
25967
|
+
} else {
|
|
25968
|
+
expression = literal(value);
|
|
25969
|
+
}
|
|
25970
|
+
return expression;
|
|
25971
|
+
}
|
|
25972
|
+
var BINDING_KINDS = /* @__PURE__ */ new Map([
|
|
25973
|
+
[0, BindingKind.Property],
|
|
25974
|
+
[1, BindingKind.Attribute],
|
|
25975
|
+
[2, BindingKind.ClassName],
|
|
25976
|
+
[3, BindingKind.StyleProperty],
|
|
25977
|
+
[4, BindingKind.Animation]
|
|
25978
|
+
]);
|
|
25406
25979
|
function isPlainTemplate(tmpl) {
|
|
25407
25980
|
var _a2;
|
|
25408
|
-
return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] ===
|
|
25409
|
-
}
|
|
25410
|
-
function
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
}
|
|
25417
|
-
const templateAttrFlags = flags | BindingFlags.BindingTargetsTemplate | BindingFlags.IsStructuralTemplateAttribute;
|
|
25418
|
-
for (const attr of element2.templateAttrs) {
|
|
25419
|
-
if (attr instanceof TextAttribute) {
|
|
25420
|
-
ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, templateAttrFlags | BindingFlags.TextValue);
|
|
25421
|
-
} else {
|
|
25422
|
-
ingestBinding(unit, op.xref, attr.name, attr.value, attr.type, attr.unit, attr.securityContext, attr.sourceSpan, templateAttrFlags);
|
|
25423
|
-
}
|
|
25424
|
-
}
|
|
25981
|
+
return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === NG_TEMPLATE_TAG_NAME$1;
|
|
25982
|
+
}
|
|
25983
|
+
function asMessage(i18nMeta) {
|
|
25984
|
+
if (i18nMeta == null) {
|
|
25985
|
+
return null;
|
|
25986
|
+
}
|
|
25987
|
+
if (!(i18nMeta instanceof Message)) {
|
|
25988
|
+
throw Error(`Expected i18n meta to be a Message, but got: ${i18nMeta.constructor.name}`);
|
|
25425
25989
|
}
|
|
25990
|
+
return i18nMeta;
|
|
25991
|
+
}
|
|
25992
|
+
function ingestElementBindings(unit, op, element2) {
|
|
25993
|
+
var _a2;
|
|
25994
|
+
let bindings = new Array();
|
|
25426
25995
|
for (const attr of element2.attributes) {
|
|
25427
|
-
|
|
25996
|
+
const securityContext = domSchema.securityContext(element2.name, attr.name, true);
|
|
25997
|
+
bindings.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, convertAstWithInterpolation(unit.job, attr.value, attr.i18n), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
25428
25998
|
}
|
|
25429
25999
|
for (const input of element2.inputs) {
|
|
25430
|
-
|
|
26000
|
+
bindings.push(createBindingOp(op.xref, BINDING_KINDS.get(input.type), input.name, convertAstWithInterpolation(unit.job, astOf(input.value), input.i18n), input.unit, input.securityContext, false, false, null, (_a2 = asMessage(input.i18n)) != null ? _a2 : null, input.sourceSpan));
|
|
25431
26001
|
}
|
|
26002
|
+
unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
|
|
26003
|
+
unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
|
|
25432
26004
|
for (const output of element2.outputs) {
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
if (output.phase === null) {
|
|
25436
|
-
throw Error("Animation listener should have a phase");
|
|
25437
|
-
}
|
|
25438
|
-
}
|
|
25439
|
-
if (element2 instanceof Template && !isPlainTemplate(element2)) {
|
|
25440
|
-
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null));
|
|
25441
|
-
continue;
|
|
26005
|
+
if (output.type === 1 && output.phase === null) {
|
|
26006
|
+
throw Error("Animation listener should have a phase");
|
|
25442
26007
|
}
|
|
25443
|
-
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
26008
|
+
unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
|
|
26009
|
+
}
|
|
26010
|
+
if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
|
|
26011
|
+
unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
|
|
26012
|
+
}
|
|
26013
|
+
}
|
|
26014
|
+
function ingestTemplateBindings(unit, op, template2, templateKind) {
|
|
26015
|
+
let bindings = new Array();
|
|
26016
|
+
for (const attr of template2.templateAttrs) {
|
|
26017
|
+
if (attr instanceof TextAttribute) {
|
|
26018
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME$1, attr.name, true);
|
|
26019
|
+
bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
|
|
25451
26020
|
} else {
|
|
25452
|
-
|
|
26021
|
+
bindings.push(createTemplateBinding(unit, op.xref, attr.type, attr.name, astOf(attr.value), attr.unit, attr.securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
|
|
25453
26022
|
}
|
|
25454
|
-
|
|
25455
|
-
|
|
26023
|
+
}
|
|
26024
|
+
for (const attr of template2.attributes) {
|
|
26025
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME$1, attr.name, true);
|
|
26026
|
+
bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, false, templateKind, asMessage(attr.i18n), attr.sourceSpan));
|
|
26027
|
+
}
|
|
26028
|
+
for (const input of template2.inputs) {
|
|
26029
|
+
bindings.push(createTemplateBinding(unit, op.xref, input.type, input.name, astOf(input.value), input.unit, input.securityContext, false, templateKind, asMessage(input.i18n), input.sourceSpan));
|
|
26030
|
+
}
|
|
26031
|
+
unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
|
|
26032
|
+
unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
|
|
26033
|
+
for (const output of template2.outputs) {
|
|
26034
|
+
if (output.type === 1 && output.phase === null) {
|
|
26035
|
+
throw Error("Animation listener should have a phase");
|
|
25456
26036
|
}
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
for (const expr of expressions) {
|
|
25460
|
-
const stmtOp = createStatementOp(new ExpressionStatement(expr, expr.sourceSpan));
|
|
25461
|
-
listenerOp.handlerOps.push(stmtOp);
|
|
26037
|
+
if (templateKind === TemplateKind.NgTemplate) {
|
|
26038
|
+
unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
|
|
25462
26039
|
}
|
|
25463
|
-
|
|
25464
|
-
|
|
26040
|
+
if (templateKind === TemplateKind.Structural && output.type !== 1) {
|
|
26041
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME$1, output.name, false);
|
|
26042
|
+
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
|
|
26043
|
+
}
|
|
26044
|
+
}
|
|
26045
|
+
if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
|
|
26046
|
+
unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
|
|
25465
26047
|
}
|
|
25466
26048
|
}
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
BindingFlags2[BindingFlags2["None"] = 0] = "None";
|
|
25477
|
-
BindingFlags2[BindingFlags2["TextValue"] = 1] = "TextValue";
|
|
25478
|
-
BindingFlags2[BindingFlags2["BindingTargetsTemplate"] = 2] = "BindingTargetsTemplate";
|
|
25479
|
-
BindingFlags2[BindingFlags2["IsStructuralTemplateAttribute"] = 4] = "IsStructuralTemplateAttribute";
|
|
25480
|
-
BindingFlags2[BindingFlags2["OnNgTemplateElement"] = 8] = "OnNgTemplateElement";
|
|
25481
|
-
})(BindingFlags || (BindingFlags = {}));
|
|
25482
|
-
function ingestBinding(view, xref, name, value, type, unit, securityContext, sourceSpan, flags) {
|
|
25483
|
-
if (value instanceof ASTWithSource) {
|
|
25484
|
-
value = value.ast;
|
|
26049
|
+
function createTemplateBinding(view, xref, type, name, value, unit, securityContext, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
26050
|
+
const isTextBinding = typeof value === "string";
|
|
26051
|
+
if (templateKind === TemplateKind.Structural) {
|
|
26052
|
+
if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
|
|
26053
|
+
return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
|
|
26054
|
+
}
|
|
26055
|
+
if (!isTextBinding && (type === 1 || type === 4)) {
|
|
26056
|
+
return null;
|
|
26057
|
+
}
|
|
25485
26058
|
}
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
26059
|
+
let bindingType = BINDING_KINDS.get(type);
|
|
26060
|
+
if (templateKind === TemplateKind.NgTemplate) {
|
|
26061
|
+
if (type === 2 || type === 3 || type === 1 && !isTextBinding) {
|
|
26062
|
+
bindingType = BindingKind.Property;
|
|
26063
|
+
}
|
|
25489
26064
|
}
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
26065
|
+
return createBindingOp(xref, bindingType, name, convertAstWithInterpolation(view.job, value, i18nMessage), unit, securityContext, isTextBinding, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan);
|
|
26066
|
+
}
|
|
26067
|
+
function makeListenerHandlerOps(unit, handler, handlerSpan) {
|
|
26068
|
+
handler = astOf(handler);
|
|
26069
|
+
const handlerOps = new Array();
|
|
26070
|
+
let handlerExprs = handler instanceof Chain ? handler.expressions : [handler];
|
|
26071
|
+
if (handlerExprs.length === 0) {
|
|
26072
|
+
throw new Error("Expected listener to have non-empty expression list.");
|
|
25497
26073
|
}
|
|
25498
|
-
const
|
|
25499
|
-
|
|
26074
|
+
const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, handlerSpan));
|
|
26075
|
+
const returnExpr = expressions.pop();
|
|
26076
|
+
handlerOps.push(...expressions.map((e) => createStatementOp(new ExpressionStatement(e, e.sourceSpan))));
|
|
26077
|
+
handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
|
|
26078
|
+
return handlerOps;
|
|
26079
|
+
}
|
|
26080
|
+
function astOf(ast) {
|
|
26081
|
+
return ast instanceof ASTWithSource ? ast.ast : ast;
|
|
25500
26082
|
}
|
|
25501
26083
|
function ingestReferences(op, element2) {
|
|
25502
26084
|
assertIsArray(op.localRefs);
|
|
@@ -25536,10 +26118,11 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
25536
26118
|
}
|
|
25537
26119
|
if (root2 !== null) {
|
|
25538
26120
|
for (const attr of root2.attributes) {
|
|
25539
|
-
|
|
26121
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME$1, attr.name, true);
|
|
26122
|
+
unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
25540
26123
|
}
|
|
25541
26124
|
const tagName = root2 instanceof Element$1 ? root2.name : root2.tagName;
|
|
25542
|
-
return tagName ===
|
|
26125
|
+
return tagName === NG_TEMPLATE_TAG_NAME$1 ? null : tagName;
|
|
25543
26126
|
}
|
|
25544
26127
|
return null;
|
|
25545
26128
|
}
|
|
@@ -27862,7 +28445,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
27862
28445
|
if (refs.length === 1) {
|
|
27863
28446
|
params[key] = refs[0];
|
|
27864
28447
|
} else {
|
|
27865
|
-
const placeholder = wrapI18nPlaceholder(`${I18N_ICU_MAPPING_PREFIX}${key}`);
|
|
28448
|
+
const placeholder = wrapI18nPlaceholder(`${I18N_ICU_MAPPING_PREFIX$1}${key}`);
|
|
27866
28449
|
params[key] = literal(placeholder);
|
|
27867
28450
|
icuMapping[key] = literalArr(refs);
|
|
27868
28451
|
}
|
|
@@ -28449,7 +29032,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
28449
29032
|
});
|
|
28450
29033
|
const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
|
|
28451
29034
|
let emptyData = null;
|
|
29035
|
+
let emptyTagName = null;
|
|
29036
|
+
let emptyAttrsExprs;
|
|
28452
29037
|
if (block.empty !== null) {
|
|
29038
|
+
const emptyInferred = this.inferProjectionDataFromInsertionPoint(block.empty);
|
|
29039
|
+
emptyTagName = emptyInferred.tagName;
|
|
29040
|
+
emptyAttrsExprs = emptyInferred.attrsExprs;
|
|
28453
29041
|
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
|
|
28454
29042
|
this.allocateBindingSlots(null);
|
|
28455
29043
|
}
|
|
@@ -28465,11 +29053,11 @@ var TemplateDefinitionBuilder = class {
|
|
|
28465
29053
|
trackByExpression
|
|
28466
29054
|
];
|
|
28467
29055
|
if (emptyData !== null) {
|
|
28468
|
-
params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()));
|
|
29056
|
+
params.push(literal(trackByUsesComponentInstance), variable(emptyData.name), literal(emptyData.getConstCount()), literal(emptyData.getVarCount()), literal(emptyTagName), this.addAttrsToConsts(emptyAttrsExprs || null));
|
|
28469
29057
|
} else if (trackByUsesComponentInstance) {
|
|
28470
29058
|
params.push(literal(trackByUsesComponentInstance));
|
|
28471
29059
|
}
|
|
28472
|
-
return params;
|
|
29060
|
+
return trimTrailingNulls(params);
|
|
28473
29061
|
});
|
|
28474
29062
|
const value = block.expression.visit(this._valueConverter);
|
|
28475
29063
|
this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
|
|
@@ -29032,12 +29620,15 @@ var BindingScope = class {
|
|
|
29032
29620
|
}
|
|
29033
29621
|
};
|
|
29034
29622
|
var TrackByBindingScope = class extends BindingScope {
|
|
29035
|
-
constructor(parentScope,
|
|
29623
|
+
constructor(parentScope, globalOverrides) {
|
|
29036
29624
|
super(parentScope.bindingLevel + 1, parentScope);
|
|
29037
|
-
this.
|
|
29625
|
+
this.globalOverrides = globalOverrides;
|
|
29038
29626
|
this.componentAccessCount = 0;
|
|
29039
29627
|
}
|
|
29040
29628
|
get(name) {
|
|
29629
|
+
if (this.globalOverrides.hasOwnProperty(name)) {
|
|
29630
|
+
return variable(this.globalOverrides[name]);
|
|
29631
|
+
}
|
|
29041
29632
|
let current = this.parent;
|
|
29042
29633
|
while (current) {
|
|
29043
29634
|
if (current.hasLocal(name)) {
|
|
@@ -29045,9 +29636,6 @@ var TrackByBindingScope = class extends BindingScope {
|
|
|
29045
29636
|
}
|
|
29046
29637
|
current = current.parent;
|
|
29047
29638
|
}
|
|
29048
|
-
if (this.globalAliases[name]) {
|
|
29049
|
-
return variable(this.globalAliases[name]);
|
|
29050
|
-
}
|
|
29051
29639
|
this.componentAccessCount++;
|
|
29052
29640
|
return variable("this").prop(name);
|
|
29053
29641
|
}
|
|
@@ -29540,14 +30128,14 @@ function createBaseDirectiveTypeParams(meta) {
|
|
|
29540
30128
|
function getInputsTypeExpression(meta) {
|
|
29541
30129
|
return literalMap(Object.keys(meta.inputs).map((key) => {
|
|
29542
30130
|
const value = meta.inputs[key];
|
|
29543
|
-
|
|
29544
|
-
key,
|
|
29545
|
-
value:
|
|
29546
|
-
|
|
29547
|
-
|
|
29548
|
-
|
|
29549
|
-
|
|
29550
|
-
};
|
|
30131
|
+
const values = [
|
|
30132
|
+
{ key: "alias", value: literal(value.bindingPropertyName), quoted: true },
|
|
30133
|
+
{ key: "required", value: literal(value.required), quoted: true }
|
|
30134
|
+
];
|
|
30135
|
+
if (value.isSignal) {
|
|
30136
|
+
values.push({ key: "isSignal", value: literal(value.isSignal), quoted: true });
|
|
30137
|
+
}
|
|
30138
|
+
return { key, value: literalMap(values), quoted: true };
|
|
29551
30139
|
}));
|
|
29552
30140
|
}
|
|
29553
30141
|
function createDirectiveType(meta) {
|
|
@@ -29591,6 +30179,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29591
30179
|
}
|
|
29592
30180
|
const hostJob = ingestHostBinding({
|
|
29593
30181
|
componentName: name,
|
|
30182
|
+
componentSelector: selector,
|
|
29594
30183
|
properties: bindings,
|
|
29595
30184
|
events: eventBindings,
|
|
29596
30185
|
attributes: hostBindingsMetadata.attributes
|
|
@@ -29603,6 +30192,8 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29603
30192
|
}
|
|
29604
30193
|
return emitHostBindingFunction(hostJob);
|
|
29605
30194
|
}
|
|
30195
|
+
let bindingId = 0;
|
|
30196
|
+
const getNextBindingId = () => `${bindingId++}`;
|
|
29606
30197
|
const bindingContext = variable(CONTEXT_NAME);
|
|
29607
30198
|
const styleBuilder = new StylingBuilder(bindingContext);
|
|
29608
30199
|
const { styleAttr, classAttr } = hostBindingsMetadata.specialAttributes;
|
|
@@ -29652,7 +30243,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29652
30243
|
const syntheticHostBindings = [];
|
|
29653
30244
|
for (const binding of allOtherBindings) {
|
|
29654
30245
|
const value = binding.expression.visit(getValueConverter());
|
|
29655
|
-
const bindingExpr = bindingFn(bindingContext, value);
|
|
30246
|
+
const bindingExpr = bindingFn(bindingContext, value, getNextBindingId);
|
|
29656
30247
|
const { bindingName, instruction, isAttribute } = getBindingNameAndInstruction(binding);
|
|
29657
30248
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(selector, bindingName, isAttribute).filter((context) => context !== SecurityContext.NONE);
|
|
29658
30249
|
let sanitizerFn = null;
|
|
@@ -29697,9 +30288,11 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29697
30288
|
styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach((instruction) => {
|
|
29698
30289
|
for (const call2 of instruction.calls) {
|
|
29699
30290
|
totalHostVarsCount += Math.max(call2.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
|
|
30291
|
+
const { params, stmts } = convertStylingCall(call2, bindingContext, bindingFn, getNextBindingId);
|
|
30292
|
+
updateVariables.push(...stmts);
|
|
29700
30293
|
updateInstructions.push({
|
|
29701
30294
|
reference: instruction.reference,
|
|
29702
|
-
paramsOrFn:
|
|
30295
|
+
paramsOrFn: params,
|
|
29703
30296
|
span: null
|
|
29704
30297
|
});
|
|
29705
30298
|
}
|
|
@@ -29721,11 +30314,19 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29721
30314
|
}
|
|
29722
30315
|
return null;
|
|
29723
30316
|
}
|
|
29724
|
-
function bindingFn(implicit, value) {
|
|
29725
|
-
return convertPropertyBinding(null, implicit, value,
|
|
30317
|
+
function bindingFn(implicit, value, getNextBindingIdFn) {
|
|
30318
|
+
return convertPropertyBinding(null, implicit, value, getNextBindingIdFn());
|
|
29726
30319
|
}
|
|
29727
|
-
function convertStylingCall(call2, bindingContext, bindingFn2) {
|
|
29728
|
-
|
|
30320
|
+
function convertStylingCall(call2, bindingContext, bindingFn2, getNextBindingIdFn) {
|
|
30321
|
+
const stmts = [];
|
|
30322
|
+
const params = call2.params((value) => {
|
|
30323
|
+
const result = bindingFn2(bindingContext, value, getNextBindingIdFn);
|
|
30324
|
+
if (Array.isArray(result.stmts) && result.stmts.length > 0) {
|
|
30325
|
+
stmts.push(...result.stmts);
|
|
30326
|
+
}
|
|
30327
|
+
return result.currValExpr;
|
|
30328
|
+
});
|
|
30329
|
+
return { params, stmts };
|
|
29729
30330
|
}
|
|
29730
30331
|
function getBindingNameAndInstruction(binding) {
|
|
29731
30332
|
let bindingName = binding.name;
|
|
@@ -30691,6 +31292,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
30691
31292
|
bindingPropertyName: ann.alias || field,
|
|
30692
31293
|
classPropertyName: field,
|
|
30693
31294
|
required: ann.required || false,
|
|
31295
|
+
isSignal: false,
|
|
30694
31296
|
transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null
|
|
30695
31297
|
};
|
|
30696
31298
|
} else if (isOutput(ann)) {
|
|
@@ -30721,7 +31323,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
30721
31323
|
type: wrapReference(declaration.type),
|
|
30722
31324
|
typeSourceSpan,
|
|
30723
31325
|
selector: (_a2 = declaration.selector) != null ? _a2 : null,
|
|
30724
|
-
inputs: declaration.inputs ?
|
|
31326
|
+
inputs: declaration.inputs ? inputsPartialMetadataToInputMetadata(declaration.inputs) : {},
|
|
30725
31327
|
outputs: (_b2 = declaration.outputs) != null ? _b2 : {},
|
|
30726
31328
|
host: convertHostDeclarationToMetadata(declaration.host),
|
|
30727
31329
|
queries: ((_c2 = declaration.queries) != null ? _c2 : []).map(convertQueryDeclarationToMetadata),
|
|
@@ -30949,27 +31551,41 @@ function isInput(value) {
|
|
|
30949
31551
|
function isOutput(value) {
|
|
30950
31552
|
return value.ngMetadataName === "Output";
|
|
30951
31553
|
}
|
|
30952
|
-
function
|
|
30953
|
-
return Object.keys(inputs).reduce((result,
|
|
30954
|
-
const value = inputs[
|
|
30955
|
-
if (typeof value === "string") {
|
|
30956
|
-
result[
|
|
30957
|
-
bindingPropertyName: value,
|
|
30958
|
-
classPropertyName: value,
|
|
30959
|
-
transformFunction: null,
|
|
30960
|
-
required: false
|
|
30961
|
-
};
|
|
31554
|
+
function inputsPartialMetadataToInputMetadata(inputs) {
|
|
31555
|
+
return Object.keys(inputs).reduce((result, minifiedClassName) => {
|
|
31556
|
+
const value = inputs[minifiedClassName];
|
|
31557
|
+
if (typeof value === "string" || Array.isArray(value)) {
|
|
31558
|
+
result[minifiedClassName] = parseLegacyInputPartialOutput(value);
|
|
30962
31559
|
} else {
|
|
30963
|
-
result[
|
|
30964
|
-
bindingPropertyName: value
|
|
30965
|
-
classPropertyName:
|
|
30966
|
-
transformFunction: value
|
|
30967
|
-
required:
|
|
31560
|
+
result[minifiedClassName] = {
|
|
31561
|
+
bindingPropertyName: value.publicName,
|
|
31562
|
+
classPropertyName: minifiedClassName,
|
|
31563
|
+
transformFunction: value.transformFunction !== null ? new WrappedNodeExpr(value.transformFunction) : null,
|
|
31564
|
+
required: value.isRequired,
|
|
31565
|
+
isSignal: value.isSignal
|
|
30968
31566
|
};
|
|
30969
31567
|
}
|
|
30970
31568
|
return result;
|
|
30971
31569
|
}, {});
|
|
30972
31570
|
}
|
|
31571
|
+
function parseLegacyInputPartialOutput(value) {
|
|
31572
|
+
if (typeof value === "string") {
|
|
31573
|
+
return {
|
|
31574
|
+
bindingPropertyName: value,
|
|
31575
|
+
classPropertyName: value,
|
|
31576
|
+
transformFunction: null,
|
|
31577
|
+
required: false,
|
|
31578
|
+
isSignal: false
|
|
31579
|
+
};
|
|
31580
|
+
}
|
|
31581
|
+
return {
|
|
31582
|
+
bindingPropertyName: value[0],
|
|
31583
|
+
classPropertyName: value[1],
|
|
31584
|
+
transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
|
|
31585
|
+
required: false,
|
|
31586
|
+
isSignal: false
|
|
31587
|
+
};
|
|
31588
|
+
}
|
|
30973
31589
|
function parseInputsArray(values) {
|
|
30974
31590
|
return values.reduce((results, value) => {
|
|
30975
31591
|
if (typeof value === "string") {
|
|
@@ -30978,6 +31594,7 @@ function parseInputsArray(values) {
|
|
|
30978
31594
|
bindingPropertyName,
|
|
30979
31595
|
classPropertyName,
|
|
30980
31596
|
required: false,
|
|
31597
|
+
isSignal: false,
|
|
30981
31598
|
transformFunction: null
|
|
30982
31599
|
};
|
|
30983
31600
|
} else {
|
|
@@ -30985,6 +31602,7 @@ function parseInputsArray(values) {
|
|
|
30985
31602
|
bindingPropertyName: value.alias || value.name,
|
|
30986
31603
|
classPropertyName: value.name,
|
|
30987
31604
|
required: value.required || false,
|
|
31605
|
+
isSignal: false,
|
|
30988
31606
|
transformFunction: value.transform != null ? new WrappedNodeExpr(value.transform) : null
|
|
30989
31607
|
};
|
|
30990
31608
|
}
|
|
@@ -31026,7 +31644,7 @@ function publishFacade(global) {
|
|
|
31026
31644
|
const ng = global.ng || (global.ng = {});
|
|
31027
31645
|
ng.\u0275compilerFacade = new CompilerFacadeImpl();
|
|
31028
31646
|
}
|
|
31029
|
-
var VERSION = new Version("17.1.0-next.
|
|
31647
|
+
var VERSION = new Version("17.1.0-next.5");
|
|
31030
31648
|
var _VisitorMode;
|
|
31031
31649
|
(function(_VisitorMode2) {
|
|
31032
31650
|
_VisitorMode2[_VisitorMode2["Extract"] = 0] = "Extract";
|
|
@@ -32980,7 +33598,7 @@ ${[...componentsToMigrate].join("\n")}`);
|
|
|
32980
33598
|
* found in the LICENSE file at https://angular.io/license
|
|
32981
33599
|
*/
|
|
32982
33600
|
/**
|
|
32983
|
-
* @license Angular v17.1.0-next.
|
|
33601
|
+
* @license Angular v17.1.0-next.5
|
|
32984
33602
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
32985
33603
|
* License: MIT
|
|
32986
33604
|
*/
|