@angular/material 16.0.0-rc.1 → 16.0.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/button/_button-base.scss +6 -0
- package/chips/_chips-theme.scss +1 -1
- package/core/tokens/m2/mdc/_linear-progress.scss +7 -2
- package/dialog/index.d.ts +2 -0
- package/esm2022/autocomplete/autocomplete-origin.mjs +7 -7
- package/esm2022/autocomplete/autocomplete-trigger.mjs +7 -7
- package/esm2022/autocomplete/autocomplete.mjs +8 -8
- package/esm2022/autocomplete/module.mjs +5 -5
- package/esm2022/badge/badge-module.mjs +5 -5
- package/esm2022/badge/badge.mjs +4 -4
- package/esm2022/bottom-sheet/bottom-sheet-container.mjs +4 -4
- package/esm2022/bottom-sheet/bottom-sheet-module.mjs +5 -5
- package/esm2022/bottom-sheet/bottom-sheet.mjs +4 -4
- package/esm2022/button/button-base.mjs +7 -7
- package/esm2022/button/button-lazy-loader.mjs +4 -4
- 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 +5 -5
- package/esm2022/button-toggle/button-toggle-module.mjs +5 -5
- package/esm2022/button-toggle/button-toggle.mjs +7 -7
- package/esm2022/card/card.mjs +43 -43
- package/esm2022/card/module.mjs +5 -5
- package/esm2022/checkbox/checkbox-required-validator.mjs +4 -4
- package/esm2022/checkbox/checkbox.mjs +7 -7
- package/esm2022/checkbox/module.mjs +9 -9
- package/esm2022/chips/chip-action.mjs +4 -4
- package/esm2022/chips/chip-edit-input.mjs +4 -4
- package/esm2022/chips/chip-grid.mjs +4 -4
- package/esm2022/chips/chip-icons.mjs +10 -10
- package/esm2022/chips/chip-input.mjs +4 -4
- package/esm2022/chips/chip-listbox.mjs +4 -5
- package/esm2022/chips/chip-option.mjs +4 -4
- package/esm2022/chips/chip-row.mjs +4 -4
- package/esm2022/chips/chip-set.mjs +4 -4
- package/esm2022/chips/chip.mjs +4 -4
- package/esm2022/chips/module.mjs +5 -5
- package/esm2022/core/common-behaviors/common-module.mjs +5 -5
- package/esm2022/core/datetime/index.mjs +9 -9
- package/esm2022/core/datetime/native-date-adapter.mjs +4 -4
- package/esm2022/core/error/error-options.mjs +7 -7
- package/esm2022/core/line/line.mjs +8 -8
- package/esm2022/core/option/index.mjs +5 -5
- package/esm2022/core/option/optgroup.mjs +7 -7
- package/esm2022/core/option/option.mjs +7 -7
- package/esm2022/core/ripple/index.mjs +5 -5
- package/esm2022/core/ripple/ripple.mjs +4 -4
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox-module.mjs +5 -5
- package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +4 -4
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/datepicker/calendar-body.mjs +4 -4
- package/esm2022/datepicker/calendar.mjs +7 -7
- package/esm2022/datepicker/date-range-input-parts.mjs +10 -10
- package/esm2022/datepicker/date-range-input.mjs +5 -7
- package/esm2022/datepicker/date-range-picker.mjs +4 -4
- package/esm2022/datepicker/date-range-selection-strategy.mjs +4 -4
- package/esm2022/datepicker/date-selection-model.mjs +10 -10
- package/esm2022/datepicker/datepicker-actions.mjs +10 -10
- package/esm2022/datepicker/datepicker-base.mjs +7 -7
- package/esm2022/datepicker/datepicker-input-base.mjs +4 -4
- package/esm2022/datepicker/datepicker-input.mjs +4 -4
- package/esm2022/datepicker/datepicker-intl.mjs +4 -4
- package/esm2022/datepicker/datepicker-module.mjs +5 -5
- package/esm2022/datepicker/datepicker-toggle.mjs +7 -7
- package/esm2022/datepicker/datepicker.mjs +4 -4
- package/esm2022/datepicker/month-view.mjs +4 -4
- package/esm2022/datepicker/multi-year-view.mjs +4 -4
- package/esm2022/datepicker/year-view.mjs +4 -4
- package/esm2022/dialog/dialog-container.mjs +25 -14
- package/esm2022/dialog/dialog-content-directives.mjs +13 -13
- package/esm2022/dialog/dialog.mjs +7 -7
- package/esm2022/dialog/module.mjs +5 -5
- package/esm2022/divider/divider-module.mjs +5 -5
- package/esm2022/divider/divider.mjs +4 -4
- package/esm2022/expansion/accordion.mjs +4 -4
- package/esm2022/expansion/expansion-module.mjs +5 -5
- package/esm2022/expansion/expansion-panel-content.mjs +4 -4
- package/esm2022/expansion/expansion-panel-header.mjs +10 -10
- package/esm2022/expansion/expansion-panel.mjs +7 -7
- package/esm2022/form-field/directives/error.mjs +4 -4
- package/esm2022/form-field/directives/floating-label.mjs +4 -4
- package/esm2022/form-field/directives/hint.mjs +4 -4
- package/esm2022/form-field/directives/label.mjs +4 -4
- package/esm2022/form-field/directives/line-ripple.mjs +4 -4
- package/esm2022/form-field/directives/notched-outline.mjs +4 -4
- package/esm2022/form-field/directives/prefix.mjs +4 -4
- package/esm2022/form-field/directives/suffix.mjs +4 -4
- package/esm2022/form-field/form-field-control.mjs +4 -4
- package/esm2022/form-field/form-field.mjs +5 -5
- package/esm2022/form-field/module.mjs +5 -5
- package/esm2022/grid-list/grid-list-module.mjs +5 -5
- package/esm2022/grid-list/grid-list.mjs +4 -4
- package/esm2022/grid-list/grid-tile.mjs +16 -16
- package/esm2022/icon/icon-module.mjs +5 -5
- package/esm2022/icon/icon-registry.mjs +4 -4
- package/esm2022/icon/icon.mjs +4 -4
- package/esm2022/icon/testing/fake-icon-registry.mjs +8 -8
- package/esm2022/input/input.mjs +4 -4
- package/esm2022/input/module.mjs +5 -5
- package/esm2022/legacy-autocomplete/autocomplete-module.mjs +5 -5
- package/esm2022/legacy-autocomplete/autocomplete-origin.mjs +4 -4
- package/esm2022/legacy-autocomplete/autocomplete-trigger.mjs +4 -4
- package/esm2022/legacy-autocomplete/autocomplete.mjs +4 -4
- package/esm2022/legacy-button/button-module.mjs +5 -5
- package/esm2022/legacy-button/button.mjs +7 -7
- package/esm2022/legacy-card/card-module.mjs +5 -5
- package/esm2022/legacy-card/card.mjs +43 -43
- package/esm2022/legacy-checkbox/checkbox-module.mjs +5 -5
- package/esm2022/legacy-checkbox/checkbox.mjs +4 -4
- package/esm2022/legacy-chips/chip-input.mjs +4 -4
- package/esm2022/legacy-chips/chip-list.mjs +4 -4
- package/esm2022/legacy-chips/chip.mjs +13 -13
- package/esm2022/legacy-chips/chips-module.mjs +5 -5
- package/esm2022/legacy-core/option/index.mjs +5 -5
- package/esm2022/legacy-core/option/optgroup.mjs +4 -4
- package/esm2022/legacy-core/option/option.mjs +4 -4
- package/esm2022/legacy-dialog/dialog-container.mjs +4 -4
- package/esm2022/legacy-dialog/dialog-content-directives.mjs +13 -13
- package/esm2022/legacy-dialog/dialog-module.mjs +5 -5
- package/esm2022/legacy-dialog/dialog.mjs +4 -4
- package/esm2022/legacy-form-field/error.mjs +4 -4
- package/esm2022/legacy-form-field/form-field-module.mjs +5 -5
- package/esm2022/legacy-form-field/form-field.mjs +4 -4
- package/esm2022/legacy-form-field/hint.mjs +4 -4
- package/esm2022/legacy-form-field/label.mjs +4 -4
- package/esm2022/legacy-form-field/placeholder.mjs +4 -4
- package/esm2022/legacy-form-field/prefix.mjs +4 -4
- package/esm2022/legacy-form-field/suffix.mjs +4 -4
- package/esm2022/legacy-input/input-module.mjs +5 -5
- package/esm2022/legacy-input/input.mjs +4 -4
- package/esm2022/legacy-list/list-module.mjs +5 -5
- package/esm2022/legacy-list/list.mjs +19 -19
- package/esm2022/legacy-list/selection-list.mjs +7 -7
- package/esm2022/legacy-menu/menu-content.mjs +4 -4
- package/esm2022/legacy-menu/menu-item.mjs +4 -4
- package/esm2022/legacy-menu/menu-module.mjs +5 -5
- package/esm2022/legacy-menu/menu-trigger.mjs +4 -4
- package/esm2022/legacy-menu/menu.mjs +4 -4
- package/esm2022/legacy-paginator/paginator-module.mjs +5 -5
- package/esm2022/legacy-paginator/paginator.mjs +4 -4
- package/esm2022/legacy-progress-bar/progress-bar-module.mjs +5 -5
- package/esm2022/legacy-progress-bar/progress-bar.mjs +4 -4
- package/esm2022/legacy-progress-spinner/progress-spinner-module.mjs +5 -5
- package/esm2022/legacy-progress-spinner/progress-spinner.mjs +4 -4
- package/esm2022/legacy-radio/radio-module.mjs +5 -5
- package/esm2022/legacy-radio/radio.mjs +7 -7
- package/esm2022/legacy-select/select-module.mjs +5 -5
- package/esm2022/legacy-select/select.mjs +7 -7
- package/esm2022/legacy-slide-toggle/slide-toggle-module.mjs +5 -5
- package/esm2022/legacy-slide-toggle/slide-toggle.mjs +4 -4
- package/esm2022/legacy-slider/slider-module.mjs +5 -5
- package/esm2022/legacy-slider/slider.mjs +4 -4
- package/esm2022/legacy-snack-bar/simple-snack-bar.mjs +4 -4
- package/esm2022/legacy-snack-bar/snack-bar-container.mjs +4 -4
- package/esm2022/legacy-snack-bar/snack-bar-module.mjs +5 -5
- package/esm2022/legacy-snack-bar/snack-bar.mjs +4 -4
- package/esm2022/legacy-table/cell.mjs +22 -22
- package/esm2022/legacy-table/row.mjs +22 -22
- package/esm2022/legacy-table/table-module.mjs +5 -5
- package/esm2022/legacy-table/table.mjs +7 -7
- package/esm2022/legacy-table/text-column.mjs +4 -4
- package/esm2022/legacy-tabs/ink-bar.mjs +4 -4
- package/esm2022/legacy-tabs/tab-body.mjs +7 -7
- package/esm2022/legacy-tabs/tab-content.mjs +4 -4
- package/esm2022/legacy-tabs/tab-group.mjs +4 -4
- package/esm2022/legacy-tabs/tab-header.mjs +4 -4
- package/esm2022/legacy-tabs/tab-label-wrapper.mjs +4 -4
- package/esm2022/legacy-tabs/tab-label.mjs +4 -4
- package/esm2022/legacy-tabs/tab-nav-bar/tab-nav-bar.mjs +10 -10
- package/esm2022/legacy-tabs/tab.mjs +4 -4
- package/esm2022/legacy-tabs/tabs-module.mjs +5 -5
- package/esm2022/legacy-tooltip/tooltip-module.mjs +5 -5
- package/esm2022/legacy-tooltip/tooltip.mjs +7 -7
- package/esm2022/list/action-list.mjs +5 -5
- package/esm2022/list/list-base.mjs +7 -7
- package/esm2022/list/list-item-sections.mjs +19 -19
- package/esm2022/list/list-module.mjs +5 -5
- package/esm2022/list/list-option.mjs +4 -4
- package/esm2022/list/list.mjs +8 -8
- package/esm2022/list/nav-list.mjs +5 -5
- package/esm2022/list/selection-list.mjs +6 -6
- package/esm2022/list/subheader.mjs +4 -4
- package/esm2022/menu/menu-content.mjs +7 -7
- package/esm2022/menu/menu-item.mjs +4 -4
- package/esm2022/menu/menu-trigger.mjs +7 -7
- package/esm2022/menu/menu.mjs +8 -8
- package/esm2022/menu/module.mjs +5 -5
- package/esm2022/paginator/module.mjs +5 -5
- package/esm2022/paginator/paginator-intl.mjs +4 -4
- package/esm2022/paginator/paginator.mjs +7 -7
- package/esm2022/progress-bar/module.mjs +5 -5
- package/esm2022/progress-bar/progress-bar.mjs +5 -5
- package/esm2022/progress-spinner/module.mjs +5 -5
- package/esm2022/progress-spinner/progress-spinner.mjs +4 -4
- package/esm2022/radio/module.mjs +5 -5
- package/esm2022/radio/radio.mjs +13 -13
- package/esm2022/select/module.mjs +5 -5
- package/esm2022/select/select.mjs +12 -12
- package/esm2022/sidenav/drawer.mjs +10 -10
- package/esm2022/sidenav/sidenav-module.mjs +5 -5
- package/esm2022/sidenav/sidenav.mjs +10 -10
- package/esm2022/slide-toggle/module.mjs +9 -9
- package/esm2022/slide-toggle/slide-toggle-required-validator.mjs +4 -4
- package/esm2022/slide-toggle/slide-toggle.mjs +7 -7
- package/esm2022/slider/module.mjs +5 -5
- package/esm2022/slider/slider-input.mjs +7 -7
- package/esm2022/slider/slider-thumb.mjs +4 -4
- package/esm2022/slider/slider.mjs +5 -5
- package/esm2022/snack-bar/module.mjs +5 -5
- package/esm2022/snack-bar/simple-snack-bar.mjs +4 -4
- package/esm2022/snack-bar/snack-bar-container.mjs +7 -7
- package/esm2022/snack-bar/snack-bar-content.mjs +10 -10
- package/esm2022/snack-bar/snack-bar.mjs +7 -7
- package/esm2022/sort/sort-header-intl.mjs +4 -4
- package/esm2022/sort/sort-header.mjs +4 -4
- package/esm2022/sort/sort-module.mjs +5 -5
- package/esm2022/sort/sort.mjs +4 -4
- package/esm2022/stepper/step-content.mjs +4 -4
- package/esm2022/stepper/step-header.mjs +4 -4
- package/esm2022/stepper/step-label.mjs +4 -4
- package/esm2022/stepper/stepper-button.mjs +7 -7
- package/esm2022/stepper/stepper-icon.mjs +4 -4
- package/esm2022/stepper/stepper-intl.mjs +4 -4
- package/esm2022/stepper/stepper-module.mjs +5 -5
- package/esm2022/stepper/stepper.mjs +7 -7
- package/esm2022/table/cell.mjs +22 -22
- package/esm2022/table/module.mjs +5 -5
- package/esm2022/table/row.mjs +22 -22
- package/esm2022/table/table.mjs +7 -7
- package/esm2022/table/text-column.mjs +4 -4
- package/esm2022/tabs/module.mjs +5 -5
- package/esm2022/tabs/paginated-tab-header.mjs +4 -4
- package/esm2022/tabs/tab-body.mjs +10 -10
- package/esm2022/tabs/tab-content.mjs +4 -4
- package/esm2022/tabs/tab-group.mjs +7 -7
- package/esm2022/tabs/tab-header.mjs +7 -7
- package/esm2022/tabs/tab-label-wrapper.mjs +7 -7
- package/esm2022/tabs/tab-label.mjs +4 -4
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +16 -16
- package/esm2022/tabs/tab.mjs +7 -7
- package/esm2022/toolbar/toolbar-module.mjs +5 -5
- package/esm2022/toolbar/toolbar.mjs +7 -7
- package/esm2022/tooltip/module.mjs +5 -5
- package/esm2022/tooltip/tooltip.mjs +13 -13
- package/esm2022/tree/node.mjs +10 -10
- package/esm2022/tree/outlet.mjs +4 -4
- package/esm2022/tree/padding.mjs +4 -4
- package/esm2022/tree/toggle.mjs +4 -4
- package/esm2022/tree/tree-module.mjs +5 -5
- package/esm2022/tree/tree.mjs +4 -4
- package/fesm2022/autocomplete.mjs +23 -23
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +7 -7
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +10 -10
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +10 -10
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +45 -45
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +17 -17
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips.mjs +40 -41
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +59 -59
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +83 -85
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +46 -35
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion.mjs +25 -25
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +35 -35
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/legacy-autocomplete.mjs +13 -13
- package/fesm2022/legacy-autocomplete.mjs.map +1 -1
- package/fesm2022/legacy-button.mjs +10 -10
- package/fesm2022/legacy-button.mjs.map +1 -1
- package/fesm2022/legacy-card.mjs +46 -46
- package/fesm2022/legacy-card.mjs.map +1 -1
- package/fesm2022/legacy-checkbox.mjs +7 -7
- package/fesm2022/legacy-checkbox.mjs.map +1 -1
- package/fesm2022/legacy-chips.mjs +22 -22
- package/fesm2022/legacy-chips.mjs.map +1 -1
- package/fesm2022/legacy-core.mjs +10 -10
- package/fesm2022/legacy-core.mjs.map +1 -1
- package/fesm2022/legacy-dialog.mjs +22 -22
- package/fesm2022/legacy-dialog.mjs.map +1 -1
- package/fesm2022/legacy-form-field.mjs +25 -25
- package/fesm2022/legacy-form-field.mjs.map +1 -1
- package/fesm2022/legacy-input.mjs +7 -7
- package/fesm2022/legacy-input.mjs.map +1 -1
- package/fesm2022/legacy-list.mjs +28 -28
- package/fesm2022/legacy-list.mjs.map +1 -1
- package/fesm2022/legacy-menu.mjs +16 -16
- package/fesm2022/legacy-menu.mjs.map +1 -1
- package/fesm2022/legacy-paginator.mjs +7 -7
- package/fesm2022/legacy-paginator.mjs.map +1 -1
- package/fesm2022/legacy-progress-bar.mjs +7 -7
- package/fesm2022/legacy-progress-bar.mjs.map +1 -1
- package/fesm2022/legacy-progress-spinner.mjs +7 -7
- package/fesm2022/legacy-progress-spinner.mjs.map +1 -1
- package/fesm2022/legacy-radio.mjs +10 -10
- package/fesm2022/legacy-radio.mjs.map +1 -1
- package/fesm2022/legacy-select.mjs +10 -10
- package/fesm2022/legacy-select.mjs.map +1 -1
- package/fesm2022/legacy-slide-toggle.mjs +7 -7
- package/fesm2022/legacy-slide-toggle.mjs.map +1 -1
- package/fesm2022/legacy-slider.mjs +7 -7
- package/fesm2022/legacy-slider.mjs.map +1 -1
- package/fesm2022/legacy-snack-bar.mjs +13 -13
- package/fesm2022/legacy-snack-bar.mjs.map +1 -1
- package/fesm2022/legacy-table.mjs +55 -55
- package/fesm2022/legacy-table.mjs.map +1 -1
- package/fesm2022/legacy-tabs.mjs +40 -40
- package/fesm2022/legacy-tabs.mjs.map +1 -1
- package/fesm2022/legacy-tooltip.mjs +10 -10
- package/fesm2022/legacy-tooltip.mjs.map +1 -1
- package/fesm2022/list.mjs +54 -54
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +26 -26
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +13 -13
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +8 -8
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio.mjs +16 -16
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +15 -15
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +22 -22
- 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 +17 -17
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +28 -28
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +61 -61
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +16 -16
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +54 -54
- 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 +2 -2
- package/schematics/ng-add/index.mjs +2 -2
- package/schematics/ng-add/setup-project.js +2 -4
- package/schematics/ng-add/setup-project.mjs +2 -4
- package/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +6 -5
- package/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +21 -4
- package/schematics/ng-generate/address-form/index.js +11 -8
- package/schematics/ng-generate/address-form/index.mjs +11 -8
- package/schematics/ng-generate/address-form/schema.json +4 -0
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +5 -6
- package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +18 -5
- package/schematics/ng-generate/dashboard/index.js +10 -8
- package/schematics/ng-generate/dashboard/index.mjs +10 -8
- package/schematics/ng-generate/dashboard/schema.json +4 -0
- package/schematics/ng-generate/mdc-migration/index_bundled.js +2592 -590
- package/schematics/ng-generate/mdc-migration/index_bundled.js.map +4 -4
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +5 -6
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +17 -6
- package/schematics/ng-generate/navigation/index.js +10 -8
- package/schematics/ng-generate/navigation/index.mjs +10 -8
- package/schematics/ng-generate/navigation/schema.json +4 -0
- package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +6 -5
- package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +6 -4
- package/schematics/ng-generate/table/index.js +8 -5
- package/schematics/ng-generate/table/index.mjs +8 -5
- package/schematics/ng-generate/table/schema.json +4 -0
- package/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.spec.ts.template +5 -5
- package/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +7 -3
- package/schematics/ng-generate/tree/index.js +8 -5
- package/schematics/ng-generate/tree/index.mjs +8 -5
- package/schematics/ng-generate/tree/schema.json +4 -0
|
@@ -464,8 +464,8 @@ var require_css_syntax_error = __commonJS({
|
|
|
464
464
|
let mark, aside;
|
|
465
465
|
if (color) {
|
|
466
466
|
let { bold, red, gray } = pico.createColors(true);
|
|
467
|
-
mark = (
|
|
468
|
-
aside = (
|
|
467
|
+
mark = (text2) => bold(red(text2));
|
|
468
|
+
aside = (text2) => gray(text2);
|
|
469
469
|
} else {
|
|
470
470
|
mark = aside = (str) => str;
|
|
471
471
|
}
|
|
@@ -902,11 +902,11 @@ var require_node = __commonJS({
|
|
|
902
902
|
}
|
|
903
903
|
return new CssSyntaxError2(message);
|
|
904
904
|
}
|
|
905
|
-
warn(result,
|
|
905
|
+
warn(result, text2, opts) {
|
|
906
906
|
let data = { node: this };
|
|
907
907
|
for (let i in opts)
|
|
908
908
|
data[i] = opts[i];
|
|
909
|
-
return result.warn(
|
|
909
|
+
return result.warn(text2, data);
|
|
910
910
|
}
|
|
911
911
|
remove() {
|
|
912
912
|
if (this.parent) {
|
|
@@ -2143,8 +2143,8 @@ var require_quick_sort = __commonJS({
|
|
|
2143
2143
|
return doQuickSort;
|
|
2144
2144
|
}
|
|
2145
2145
|
function cloneSort(comparator) {
|
|
2146
|
-
let
|
|
2147
|
-
let templateFn = new Function(`return ${
|
|
2146
|
+
let template2 = SortTemplate.toString();
|
|
2147
|
+
let templateFn = new Function(`return ${template2}`)();
|
|
2148
2148
|
return templateFn(comparator);
|
|
2149
2149
|
}
|
|
2150
2150
|
var sortCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3122,14 +3122,14 @@ var require_previous_map = __commonJS({
|
|
|
3122
3122
|
this.loadAnnotation(css);
|
|
3123
3123
|
this.inline = this.startWith(this.annotation, "data:");
|
|
3124
3124
|
let prev = opts.map ? opts.map.prev : void 0;
|
|
3125
|
-
let
|
|
3125
|
+
let text2 = this.loadMap(opts.from, prev);
|
|
3126
3126
|
if (!this.mapFile && opts.from) {
|
|
3127
3127
|
this.mapFile = opts.from;
|
|
3128
3128
|
}
|
|
3129
3129
|
if (this.mapFile)
|
|
3130
3130
|
this.root = dirname(this.mapFile);
|
|
3131
|
-
if (
|
|
3132
|
-
this.text =
|
|
3131
|
+
if (text2)
|
|
3132
|
+
this.text = text2;
|
|
3133
3133
|
}
|
|
3134
3134
|
consumer() {
|
|
3135
3135
|
if (!this.consumerCache) {
|
|
@@ -3158,18 +3158,18 @@ var require_previous_map = __commonJS({
|
|
|
3158
3158
|
this.annotation = this.getAnnotationURL(css.substring(start, end));
|
|
3159
3159
|
}
|
|
3160
3160
|
}
|
|
3161
|
-
decodeInline(
|
|
3161
|
+
decodeInline(text2) {
|
|
3162
3162
|
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
|
|
3163
3163
|
let baseUri = /^data:application\/json;base64,/;
|
|
3164
3164
|
let charsetUri = /^data:application\/json;charset=utf-?8,/;
|
|
3165
3165
|
let uri = /^data:application\/json,/;
|
|
3166
|
-
if (charsetUri.test(
|
|
3167
|
-
return decodeURIComponent(
|
|
3166
|
+
if (charsetUri.test(text2) || uri.test(text2)) {
|
|
3167
|
+
return decodeURIComponent(text2.substr(RegExp.lastMatch.length));
|
|
3168
3168
|
}
|
|
3169
|
-
if (baseCharsetUri.test(
|
|
3170
|
-
return fromBase64(
|
|
3169
|
+
if (baseCharsetUri.test(text2) || baseUri.test(text2)) {
|
|
3170
|
+
return fromBase64(text2.substr(RegExp.lastMatch.length));
|
|
3171
3171
|
}
|
|
3172
|
-
let encoding =
|
|
3172
|
+
let encoding = text2.match(/data:application\/json;([^,]+),/)[1];
|
|
3173
3173
|
throw new Error("Unsupported source map encoding " + encoding);
|
|
3174
3174
|
}
|
|
3175
3175
|
loadFile(path) {
|
|
@@ -4211,9 +4211,9 @@ var require_warning = __commonJS({
|
|
|
4211
4211
|
"node_modules/postcss/lib/warning.js"(exports, module2) {
|
|
4212
4212
|
"use strict";
|
|
4213
4213
|
var Warning2 = class {
|
|
4214
|
-
constructor(
|
|
4214
|
+
constructor(text2, opts = {}) {
|
|
4215
4215
|
this.type = "warning";
|
|
4216
|
-
this.text =
|
|
4216
|
+
this.text = text2;
|
|
4217
4217
|
if (opts.node && opts.node.source) {
|
|
4218
4218
|
let range = opts.node.rangeBy(opts);
|
|
4219
4219
|
this.line = range.start.line;
|
|
@@ -4260,13 +4260,13 @@ var require_result = __commonJS({
|
|
|
4260
4260
|
toString() {
|
|
4261
4261
|
return this.css;
|
|
4262
4262
|
}
|
|
4263
|
-
warn(
|
|
4263
|
+
warn(text2, opts = {}) {
|
|
4264
4264
|
if (!opts.plugin) {
|
|
4265
4265
|
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
4266
4266
|
opts.plugin = this.lastPlugin.postcssPlugin;
|
|
4267
4267
|
}
|
|
4268
4268
|
}
|
|
4269
|
-
let warning = new Warning2(
|
|
4269
|
+
let warning = new Warning2(text2, opts);
|
|
4270
4270
|
this.messages.push(warning);
|
|
4271
4271
|
return warning;
|
|
4272
4272
|
}
|
|
@@ -4522,13 +4522,13 @@ var require_parser = __commonJS({
|
|
|
4522
4522
|
let node = new Comment3();
|
|
4523
4523
|
this.init(node, token[2]);
|
|
4524
4524
|
node.source.end = this.getPosition(token[3] || token[2]);
|
|
4525
|
-
let
|
|
4526
|
-
if (/^\s*$/.test(
|
|
4525
|
+
let text2 = token[1].slice(2, -2);
|
|
4526
|
+
if (/^\s*$/.test(text2)) {
|
|
4527
4527
|
node.text = "";
|
|
4528
|
-
node.raws.left =
|
|
4528
|
+
node.raws.left = text2;
|
|
4529
4529
|
node.raws.right = "";
|
|
4530
4530
|
} else {
|
|
4531
|
-
let match =
|
|
4531
|
+
let match = text2.match(/^(\s*)([^]*\S)(\s*)$/);
|
|
4532
4532
|
node.text = match[2];
|
|
4533
4533
|
node.raws.left = match[1];
|
|
4534
4534
|
node.raws.right = match[3];
|
|
@@ -4906,8 +4906,8 @@ var require_parser = __commonJS({
|
|
|
4906
4906
|
colon(tokens) {
|
|
4907
4907
|
let brackets = 0;
|
|
4908
4908
|
let token, type, prev;
|
|
4909
|
-
for (let [i,
|
|
4910
|
-
token =
|
|
4909
|
+
for (let [i, element2] of tokens.entries()) {
|
|
4910
|
+
token = element2;
|
|
4911
4911
|
type = token[0];
|
|
4912
4912
|
if (type === "(") {
|
|
4913
4913
|
brackets += 1;
|
|
@@ -5710,7 +5710,7 @@ var require_fromJSON = __commonJS({
|
|
|
5710
5710
|
function fromJSON2(json, inputs) {
|
|
5711
5711
|
if (Array.isArray(json))
|
|
5712
5712
|
return json.map((n) => fromJSON2(n));
|
|
5713
|
-
let
|
|
5713
|
+
let _a2 = json, { inputs: ownInputs } = _a2, defaults = __objRest(_a2, ["inputs"]);
|
|
5714
5714
|
if (ownInputs) {
|
|
5715
5715
|
inputs = [];
|
|
5716
5716
|
for (let input of ownInputs) {
|
|
@@ -5850,8 +5850,8 @@ var require_scss_stringifier = __commonJS({
|
|
|
5850
5850
|
let left = this.raw(node, "left", "commentLeft");
|
|
5851
5851
|
let right = this.raw(node, "right", "commentRight");
|
|
5852
5852
|
if (node.raws.inline) {
|
|
5853
|
-
let
|
|
5854
|
-
this.builder("//" + left +
|
|
5853
|
+
let text2 = node.raws.text || node.text;
|
|
5854
|
+
this.builder("//" + left + text2 + right, node);
|
|
5855
5855
|
} else {
|
|
5856
5856
|
this.builder("/*" + left + node.text + right + "*/", node);
|
|
5857
5857
|
}
|
|
@@ -6319,13 +6319,13 @@ var require_scss_parser = __commonJS({
|
|
|
6319
6319
|
node.raws.inline = true;
|
|
6320
6320
|
let pos = this.input.fromOffset(token[3]);
|
|
6321
6321
|
node.source.end = { offset: token[3], line: pos.line, column: pos.col };
|
|
6322
|
-
let
|
|
6323
|
-
if (/^\s*$/.test(
|
|
6322
|
+
let text2 = token[1].slice(2);
|
|
6323
|
+
if (/^\s*$/.test(text2)) {
|
|
6324
6324
|
node.text = "";
|
|
6325
|
-
node.raws.left =
|
|
6325
|
+
node.raws.left = text2;
|
|
6326
6326
|
node.raws.right = "";
|
|
6327
6327
|
} else {
|
|
6328
|
-
let match =
|
|
6328
|
+
let match = text2.match(/^(\s*)([^]*\S)(\s*)$/);
|
|
6329
6329
|
let fixed = match[2].replace(/(\*\/|\/\*)/g, "*//*");
|
|
6330
6330
|
node.text = fixed;
|
|
6331
6331
|
node.raws.left = match[1];
|
|
@@ -6357,8 +6357,8 @@ var require_scss_parser = __commonJS({
|
|
|
6357
6357
|
let scss = node.raws[prop].raw;
|
|
6358
6358
|
node.raws[prop].raw = tokens.reduce((all, i) => {
|
|
6359
6359
|
if (i[0] === "comment" && i[4] === "inline") {
|
|
6360
|
-
let
|
|
6361
|
-
return all + "/*" +
|
|
6360
|
+
let text2 = i[1].slice(2).replace(/(\*\/|\/\*)/g, "*//*");
|
|
6361
|
+
return all + "/*" + text2 + "*/";
|
|
6362
6362
|
} else {
|
|
6363
6363
|
return all + i[1];
|
|
6364
6364
|
}
|
|
@@ -6421,7 +6421,7 @@ var StyleMigrator = class {
|
|
|
6421
6421
|
return this.mixinChanges.some((change) => atRule2.params.includes(`${namespace}.${change.old}`));
|
|
6422
6422
|
}
|
|
6423
6423
|
getMixinChange(namespace, atRule2) {
|
|
6424
|
-
var
|
|
6424
|
+
var _a2, _b;
|
|
6425
6425
|
const processedKey = `mixinChange-${namespace}`;
|
|
6426
6426
|
if (this._nodeIsProcessed(atRule2, processedKey)) {
|
|
6427
6427
|
return null;
|
|
@@ -6432,7 +6432,7 @@ var StyleMigrator = class {
|
|
|
6432
6432
|
if (!change) {
|
|
6433
6433
|
return null;
|
|
6434
6434
|
}
|
|
6435
|
-
const replacements = [...(
|
|
6435
|
+
const replacements = [...(_a2 = change.new) != null ? _a2 : []];
|
|
6436
6436
|
if (change.checkForDuplicates) {
|
|
6437
6437
|
const mixinArgumentMatches = (_b = atRule2.params) == null ? void 0 : _b.match(MIXIN_ARGUMENTS_REGEX);
|
|
6438
6438
|
atRule2.root().walkAtRules((rule2) => {
|
|
@@ -6449,16 +6449,16 @@ var StyleMigrator = class {
|
|
|
6449
6449
|
}
|
|
6450
6450
|
isLegacySelector(rule2) {
|
|
6451
6451
|
return this.classChanges.some((change) => {
|
|
6452
|
-
var
|
|
6453
|
-
return ((
|
|
6452
|
+
var _a2;
|
|
6453
|
+
return ((_a2 = rule2.selector) == null ? void 0 : _a2.match(change.old + END_OF_SELECTOR_REGEX)) !== null;
|
|
6454
6454
|
});
|
|
6455
6455
|
}
|
|
6456
6456
|
replaceLegacySelector(rule2) {
|
|
6457
|
-
var
|
|
6457
|
+
var _a2;
|
|
6458
6458
|
if (!this._nodeIsProcessed(rule2, "replaceLegacySelector")) {
|
|
6459
6459
|
for (let i = 0; i < this.classChanges.length; i++) {
|
|
6460
6460
|
const change = this.classChanges[i];
|
|
6461
|
-
if ((
|
|
6461
|
+
if ((_a2 = rule2.selector) == null ? void 0 : _a2.match(change.old + END_OF_SELECTOR_REGEX)) {
|
|
6462
6462
|
rule2.selector = rule2.selector.replace(change.old, change.new);
|
|
6463
6463
|
}
|
|
6464
6464
|
}
|
|
@@ -6474,8 +6474,8 @@ var StyleMigrator = class {
|
|
|
6474
6474
|
this._processedNodes.set(node, appliedActions);
|
|
6475
6475
|
}
|
|
6476
6476
|
_nodeIsProcessed(node, action) {
|
|
6477
|
-
var
|
|
6478
|
-
return !!((
|
|
6477
|
+
var _a2;
|
|
6478
|
+
return !!((_a2 = this._processedNodes.get(node)) == null ? void 0 : _a2.has(action));
|
|
6479
6479
|
}
|
|
6480
6480
|
};
|
|
6481
6481
|
|
|
@@ -6672,8 +6672,8 @@ var CssSelector = class {
|
|
|
6672
6672
|
hasElementSelector() {
|
|
6673
6673
|
return !!this.element;
|
|
6674
6674
|
}
|
|
6675
|
-
setElement(
|
|
6676
|
-
this.element =
|
|
6675
|
+
setElement(element2 = null) {
|
|
6676
|
+
this.element = element2;
|
|
6677
6677
|
}
|
|
6678
6678
|
getAttrs() {
|
|
6679
6679
|
const result = [];
|
|
@@ -6867,8 +6867,8 @@ function computeDecimalDigest(message) {
|
|
|
6867
6867
|
return computeMsgId(parts.join(""), message.meaning);
|
|
6868
6868
|
}
|
|
6869
6869
|
var _SerializerVisitor = class {
|
|
6870
|
-
visitText(
|
|
6871
|
-
return
|
|
6870
|
+
visitText(text2, context) {
|
|
6871
|
+
return text2.value;
|
|
6872
6872
|
}
|
|
6873
6873
|
visitContainer(container, context) {
|
|
6874
6874
|
return `[${container.children.map((child) => child.visit(this)).join(", ")}]`;
|
|
@@ -7409,10 +7409,10 @@ var InvokeFunctionExpr = class extends Expression {
|
|
|
7409
7409
|
}
|
|
7410
7410
|
};
|
|
7411
7411
|
var TaggedTemplateExpr = class extends Expression {
|
|
7412
|
-
constructor(tag,
|
|
7412
|
+
constructor(tag, template2, type, sourceSpan) {
|
|
7413
7413
|
super(type, sourceSpan);
|
|
7414
7414
|
this.tag = tag;
|
|
7415
|
-
this.template =
|
|
7415
|
+
this.template = template2;
|
|
7416
7416
|
}
|
|
7417
7417
|
isEquivalent(e) {
|
|
7418
7418
|
return e instanceof TaggedTemplateExpr && this.tag.isEquivalent(e.tag) && areAllEquivalentPredicate(this.template.elements, e.template.elements, (a, b) => a.text === b.text) && areAllEquivalent(this.template.expressions, e.template.expressions);
|
|
@@ -7462,22 +7462,22 @@ var TemplateLiteral = class {
|
|
|
7462
7462
|
}
|
|
7463
7463
|
};
|
|
7464
7464
|
var TemplateLiteralElement = class {
|
|
7465
|
-
constructor(
|
|
7466
|
-
var
|
|
7467
|
-
this.text =
|
|
7465
|
+
constructor(text2, sourceSpan, rawText) {
|
|
7466
|
+
var _a2;
|
|
7467
|
+
this.text = text2;
|
|
7468
7468
|
this.sourceSpan = sourceSpan;
|
|
7469
|
-
this.rawText = (
|
|
7469
|
+
this.rawText = (_a2 = rawText != null ? rawText : sourceSpan == null ? void 0 : sourceSpan.toString()) != null ? _a2 : escapeForTemplateLiteral(escapeSlashes(text2));
|
|
7470
7470
|
}
|
|
7471
7471
|
};
|
|
7472
7472
|
var LiteralPiece = class {
|
|
7473
|
-
constructor(
|
|
7474
|
-
this.text =
|
|
7473
|
+
constructor(text2, sourceSpan) {
|
|
7474
|
+
this.text = text2;
|
|
7475
7475
|
this.sourceSpan = sourceSpan;
|
|
7476
7476
|
}
|
|
7477
7477
|
};
|
|
7478
7478
|
var PlaceholderPiece = class {
|
|
7479
|
-
constructor(
|
|
7480
|
-
this.text =
|
|
7479
|
+
constructor(text2, sourceSpan, associatedMessage) {
|
|
7480
|
+
this.text = text2;
|
|
7481
7481
|
this.sourceSpan = sourceSpan;
|
|
7482
7482
|
this.associatedMessage = associatedMessage;
|
|
7483
7483
|
}
|
|
@@ -7518,19 +7518,19 @@ var LocalizedString = class extends Expression {
|
|
|
7518
7518
|
return createCookedRawString(metaBlock, this.messageParts[0].text, this.getMessagePartSourceSpan(0));
|
|
7519
7519
|
}
|
|
7520
7520
|
getMessagePartSourceSpan(i) {
|
|
7521
|
-
var
|
|
7522
|
-
return (_b = (
|
|
7521
|
+
var _a2, _b;
|
|
7522
|
+
return (_b = (_a2 = this.messageParts[i]) == null ? void 0 : _a2.sourceSpan) != null ? _b : this.sourceSpan;
|
|
7523
7523
|
}
|
|
7524
7524
|
getPlaceholderSourceSpan(i) {
|
|
7525
|
-
var
|
|
7526
|
-
return (_d = (_c = (
|
|
7525
|
+
var _a2, _b, _c, _d;
|
|
7526
|
+
return (_d = (_c = (_a2 = this.placeHolderNames[i]) == null ? void 0 : _a2.sourceSpan) != null ? _c : (_b = this.expressions[i]) == null ? void 0 : _b.sourceSpan) != null ? _d : this.sourceSpan;
|
|
7527
7527
|
}
|
|
7528
7528
|
serializeI18nTemplatePart(partIndex) {
|
|
7529
|
-
var
|
|
7529
|
+
var _a2;
|
|
7530
7530
|
const placeholder = this.placeHolderNames[partIndex - 1];
|
|
7531
7531
|
const messagePart = this.messageParts[partIndex];
|
|
7532
7532
|
let metaBlock = placeholder.text;
|
|
7533
|
-
if (((
|
|
7533
|
+
if (((_a2 = placeholder.associatedMessage) == null ? void 0 : _a2.legacyIds.length) === 0) {
|
|
7534
7534
|
metaBlock += `${ID_SEPARATOR$1}${computeMsgId(placeholder.associatedMessage.messageString, placeholder.associatedMessage.meaning)}`;
|
|
7535
7535
|
}
|
|
7536
7536
|
return createCookedRawString(metaBlock, messagePart.text, this.getMessagePartSourceSpan(partIndex));
|
|
@@ -7760,8 +7760,8 @@ var StmtModifier;
|
|
|
7760
7760
|
StmtModifier2[StmtModifier2["Static"] = 8] = "Static";
|
|
7761
7761
|
})(StmtModifier || (StmtModifier = {}));
|
|
7762
7762
|
var LeadingComment = class {
|
|
7763
|
-
constructor(
|
|
7764
|
-
this.text =
|
|
7763
|
+
constructor(text2, multiline, trailingNewline) {
|
|
7764
|
+
this.text = text2;
|
|
7765
7765
|
this.multiline = multiline;
|
|
7766
7766
|
this.trailingNewline = trailingNewline;
|
|
7767
7767
|
}
|
|
@@ -7788,8 +7788,8 @@ var Statement = class {
|
|
|
7788
7788
|
return (this.modifiers & modifier) !== 0;
|
|
7789
7789
|
}
|
|
7790
7790
|
addLeadingComment(leadingComment) {
|
|
7791
|
-
var
|
|
7792
|
-
this.leadingComments = (
|
|
7791
|
+
var _a2;
|
|
7792
|
+
this.leadingComments = (_a2 = this.leadingComments) != null ? _a2 : [];
|
|
7793
7793
|
this.leadingComments.push(leadingComment);
|
|
7794
7794
|
}
|
|
7795
7795
|
};
|
|
@@ -7860,6 +7860,164 @@ var IfStmt = class extends Statement {
|
|
|
7860
7860
|
return visitor.visitIfStmt(this, context);
|
|
7861
7861
|
}
|
|
7862
7862
|
};
|
|
7863
|
+
var RecursiveAstVisitor$1 = class {
|
|
7864
|
+
visitType(ast, context) {
|
|
7865
|
+
return ast;
|
|
7866
|
+
}
|
|
7867
|
+
visitExpression(ast, context) {
|
|
7868
|
+
if (ast.type) {
|
|
7869
|
+
ast.type.visitType(this, context);
|
|
7870
|
+
}
|
|
7871
|
+
return ast;
|
|
7872
|
+
}
|
|
7873
|
+
visitBuiltinType(type, context) {
|
|
7874
|
+
return this.visitType(type, context);
|
|
7875
|
+
}
|
|
7876
|
+
visitExpressionType(type, context) {
|
|
7877
|
+
type.value.visitExpression(this, context);
|
|
7878
|
+
if (type.typeParams !== null) {
|
|
7879
|
+
type.typeParams.forEach((param) => this.visitType(param, context));
|
|
7880
|
+
}
|
|
7881
|
+
return this.visitType(type, context);
|
|
7882
|
+
}
|
|
7883
|
+
visitArrayType(type, context) {
|
|
7884
|
+
return this.visitType(type, context);
|
|
7885
|
+
}
|
|
7886
|
+
visitMapType(type, context) {
|
|
7887
|
+
return this.visitType(type, context);
|
|
7888
|
+
}
|
|
7889
|
+
visitWrappedNodeExpr(ast, context) {
|
|
7890
|
+
return ast;
|
|
7891
|
+
}
|
|
7892
|
+
visitTypeofExpr(ast, context) {
|
|
7893
|
+
return this.visitExpression(ast, context);
|
|
7894
|
+
}
|
|
7895
|
+
visitReadVarExpr(ast, context) {
|
|
7896
|
+
return this.visitExpression(ast, context);
|
|
7897
|
+
}
|
|
7898
|
+
visitWriteVarExpr(ast, context) {
|
|
7899
|
+
ast.value.visitExpression(this, context);
|
|
7900
|
+
return this.visitExpression(ast, context);
|
|
7901
|
+
}
|
|
7902
|
+
visitWriteKeyExpr(ast, context) {
|
|
7903
|
+
ast.receiver.visitExpression(this, context);
|
|
7904
|
+
ast.index.visitExpression(this, context);
|
|
7905
|
+
ast.value.visitExpression(this, context);
|
|
7906
|
+
return this.visitExpression(ast, context);
|
|
7907
|
+
}
|
|
7908
|
+
visitWritePropExpr(ast, context) {
|
|
7909
|
+
ast.receiver.visitExpression(this, context);
|
|
7910
|
+
ast.value.visitExpression(this, context);
|
|
7911
|
+
return this.visitExpression(ast, context);
|
|
7912
|
+
}
|
|
7913
|
+
visitInvokeFunctionExpr(ast, context) {
|
|
7914
|
+
ast.fn.visitExpression(this, context);
|
|
7915
|
+
this.visitAllExpressions(ast.args, context);
|
|
7916
|
+
return this.visitExpression(ast, context);
|
|
7917
|
+
}
|
|
7918
|
+
visitTaggedTemplateExpr(ast, context) {
|
|
7919
|
+
ast.tag.visitExpression(this, context);
|
|
7920
|
+
this.visitAllExpressions(ast.template.expressions, context);
|
|
7921
|
+
return this.visitExpression(ast, context);
|
|
7922
|
+
}
|
|
7923
|
+
visitInstantiateExpr(ast, context) {
|
|
7924
|
+
ast.classExpr.visitExpression(this, context);
|
|
7925
|
+
this.visitAllExpressions(ast.args, context);
|
|
7926
|
+
return this.visitExpression(ast, context);
|
|
7927
|
+
}
|
|
7928
|
+
visitLiteralExpr(ast, context) {
|
|
7929
|
+
return this.visitExpression(ast, context);
|
|
7930
|
+
}
|
|
7931
|
+
visitLocalizedString(ast, context) {
|
|
7932
|
+
return this.visitExpression(ast, context);
|
|
7933
|
+
}
|
|
7934
|
+
visitExternalExpr(ast, context) {
|
|
7935
|
+
if (ast.typeParams) {
|
|
7936
|
+
ast.typeParams.forEach((type) => type.visitType(this, context));
|
|
7937
|
+
}
|
|
7938
|
+
return this.visitExpression(ast, context);
|
|
7939
|
+
}
|
|
7940
|
+
visitConditionalExpr(ast, context) {
|
|
7941
|
+
ast.condition.visitExpression(this, context);
|
|
7942
|
+
ast.trueCase.visitExpression(this, context);
|
|
7943
|
+
ast.falseCase.visitExpression(this, context);
|
|
7944
|
+
return this.visitExpression(ast, context);
|
|
7945
|
+
}
|
|
7946
|
+
visitNotExpr(ast, context) {
|
|
7947
|
+
ast.condition.visitExpression(this, context);
|
|
7948
|
+
return this.visitExpression(ast, context);
|
|
7949
|
+
}
|
|
7950
|
+
visitFunctionExpr(ast, context) {
|
|
7951
|
+
this.visitAllStatements(ast.statements, context);
|
|
7952
|
+
return this.visitExpression(ast, context);
|
|
7953
|
+
}
|
|
7954
|
+
visitUnaryOperatorExpr(ast, context) {
|
|
7955
|
+
ast.expr.visitExpression(this, context);
|
|
7956
|
+
return this.visitExpression(ast, context);
|
|
7957
|
+
}
|
|
7958
|
+
visitBinaryOperatorExpr(ast, context) {
|
|
7959
|
+
ast.lhs.visitExpression(this, context);
|
|
7960
|
+
ast.rhs.visitExpression(this, context);
|
|
7961
|
+
return this.visitExpression(ast, context);
|
|
7962
|
+
}
|
|
7963
|
+
visitReadPropExpr(ast, context) {
|
|
7964
|
+
ast.receiver.visitExpression(this, context);
|
|
7965
|
+
return this.visitExpression(ast, context);
|
|
7966
|
+
}
|
|
7967
|
+
visitReadKeyExpr(ast, context) {
|
|
7968
|
+
ast.receiver.visitExpression(this, context);
|
|
7969
|
+
ast.index.visitExpression(this, context);
|
|
7970
|
+
return this.visitExpression(ast, context);
|
|
7971
|
+
}
|
|
7972
|
+
visitLiteralArrayExpr(ast, context) {
|
|
7973
|
+
this.visitAllExpressions(ast.entries, context);
|
|
7974
|
+
return this.visitExpression(ast, context);
|
|
7975
|
+
}
|
|
7976
|
+
visitLiteralMapExpr(ast, context) {
|
|
7977
|
+
ast.entries.forEach((entry) => entry.value.visitExpression(this, context));
|
|
7978
|
+
return this.visitExpression(ast, context);
|
|
7979
|
+
}
|
|
7980
|
+
visitCommaExpr(ast, context) {
|
|
7981
|
+
this.visitAllExpressions(ast.parts, context);
|
|
7982
|
+
return this.visitExpression(ast, context);
|
|
7983
|
+
}
|
|
7984
|
+
visitAllExpressions(exprs, context) {
|
|
7985
|
+
exprs.forEach((expr) => expr.visitExpression(this, context));
|
|
7986
|
+
}
|
|
7987
|
+
visitDeclareVarStmt(stmt, context) {
|
|
7988
|
+
if (stmt.value) {
|
|
7989
|
+
stmt.value.visitExpression(this, context);
|
|
7990
|
+
}
|
|
7991
|
+
if (stmt.type) {
|
|
7992
|
+
stmt.type.visitType(this, context);
|
|
7993
|
+
}
|
|
7994
|
+
return stmt;
|
|
7995
|
+
}
|
|
7996
|
+
visitDeclareFunctionStmt(stmt, context) {
|
|
7997
|
+
this.visitAllStatements(stmt.statements, context);
|
|
7998
|
+
if (stmt.type) {
|
|
7999
|
+
stmt.type.visitType(this, context);
|
|
8000
|
+
}
|
|
8001
|
+
return stmt;
|
|
8002
|
+
}
|
|
8003
|
+
visitExpressionStmt(stmt, context) {
|
|
8004
|
+
stmt.expr.visitExpression(this, context);
|
|
8005
|
+
return stmt;
|
|
8006
|
+
}
|
|
8007
|
+
visitReturnStmt(stmt, context) {
|
|
8008
|
+
stmt.value.visitExpression(this, context);
|
|
8009
|
+
return stmt;
|
|
8010
|
+
}
|
|
8011
|
+
visitIfStmt(stmt, context) {
|
|
8012
|
+
stmt.condition.visitExpression(this, context);
|
|
8013
|
+
this.visitAllStatements(stmt.trueCase, context);
|
|
8014
|
+
this.visitAllStatements(stmt.falseCase, context);
|
|
8015
|
+
return stmt;
|
|
8016
|
+
}
|
|
8017
|
+
visitAllStatements(stmts, context) {
|
|
8018
|
+
stmts.forEach((stmt) => stmt.visitStatement(this, context));
|
|
8019
|
+
}
|
|
8020
|
+
};
|
|
7863
8021
|
function jsDocComment(tags = []) {
|
|
7864
8022
|
return new JSDocComment(tags);
|
|
7865
8023
|
}
|
|
@@ -7890,8 +8048,8 @@ function fn(params, body, type, sourceSpan, name) {
|
|
|
7890
8048
|
function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments) {
|
|
7891
8049
|
return new IfStmt(condition, thenClause, elseClause, sourceSpan, leadingComments);
|
|
7892
8050
|
}
|
|
7893
|
-
function taggedTemplate(tag,
|
|
7894
|
-
return new TaggedTemplateExpr(tag,
|
|
8051
|
+
function taggedTemplate(tag, template2, type, sourceSpan) {
|
|
8052
|
+
return new TaggedTemplateExpr(tag, template2, type, sourceSpan);
|
|
7895
8053
|
}
|
|
7896
8054
|
function literal(value, type, sourceSpan) {
|
|
7897
8055
|
return new LiteralExpr(value, type, sourceSpan);
|
|
@@ -7938,6 +8096,7 @@ var FixupExpression = class extends Expression {
|
|
|
7938
8096
|
constructor(resolved) {
|
|
7939
8097
|
super(resolved.type);
|
|
7940
8098
|
this.resolved = resolved;
|
|
8099
|
+
this.shared = false;
|
|
7941
8100
|
this.original = resolved;
|
|
7942
8101
|
}
|
|
7943
8102
|
visitExpression(visitor, context) {
|
|
@@ -9769,11 +9928,12 @@ var Container = class {
|
|
|
9769
9928
|
}
|
|
9770
9929
|
};
|
|
9771
9930
|
var Icu = class {
|
|
9772
|
-
constructor(expression, type, cases, sourceSpan) {
|
|
9931
|
+
constructor(expression, type, cases, sourceSpan, expressionPlaceholder) {
|
|
9773
9932
|
this.expression = expression;
|
|
9774
9933
|
this.type = type;
|
|
9775
9934
|
this.cases = cases;
|
|
9776
9935
|
this.sourceSpan = sourceSpan;
|
|
9936
|
+
this.expressionPlaceholder = expressionPlaceholder;
|
|
9777
9937
|
}
|
|
9778
9938
|
visit(visitor, context) {
|
|
9779
9939
|
return visitor.visitIcu(this, context);
|
|
@@ -9821,8 +9981,8 @@ function serializeMessage(messageNodes) {
|
|
|
9821
9981
|
return str;
|
|
9822
9982
|
}
|
|
9823
9983
|
var LocalizeMessageStringVisitor = class {
|
|
9824
|
-
visitText(
|
|
9825
|
-
return
|
|
9984
|
+
visitText(text2) {
|
|
9985
|
+
return text2.value;
|
|
9826
9986
|
}
|
|
9827
9987
|
visitContainer(container) {
|
|
9828
9988
|
return container.children.map((child) => child.visit(this)).join("");
|
|
@@ -9851,8 +10011,8 @@ var _Visitor$2 = class {
|
|
|
9851
10011
|
const strChildren = tag.children.map((node) => node.visit(this));
|
|
9852
10012
|
return `<${tag.name}${strAttrs}>${strChildren.join("")}</${tag.name}>`;
|
|
9853
10013
|
}
|
|
9854
|
-
visitText(
|
|
9855
|
-
return
|
|
10014
|
+
visitText(text2) {
|
|
10015
|
+
return text2.value;
|
|
9856
10016
|
}
|
|
9857
10017
|
visitDeclaration(decl2) {
|
|
9858
10018
|
return `<?xml${this._serializeAttributes(decl2.attrs)} ?>`;
|
|
@@ -9890,8 +10050,8 @@ function isSingleI18nIcu(meta) {
|
|
|
9890
10050
|
function hasI18nMeta(node) {
|
|
9891
10051
|
return !!node.i18n;
|
|
9892
10052
|
}
|
|
9893
|
-
function hasI18nAttrs(
|
|
9894
|
-
return
|
|
10053
|
+
function hasI18nAttrs(element2) {
|
|
10054
|
+
return element2.attrs.some((attr) => isI18nAttribute(attr.name));
|
|
9895
10055
|
}
|
|
9896
10056
|
function icuFromI18nMessage(message) {
|
|
9897
10057
|
return message.nodes[0];
|
|
@@ -10034,8 +10194,8 @@ var CHAINABLE_INSTRUCTIONS = /* @__PURE__ */ new Set([
|
|
|
10034
10194
|
Identifiers.textInterpolate8,
|
|
10035
10195
|
Identifiers.textInterpolateV
|
|
10036
10196
|
]);
|
|
10037
|
-
function invokeInstruction(span,
|
|
10038
|
-
return importExpr(
|
|
10197
|
+
function invokeInstruction(span, reference2, params) {
|
|
10198
|
+
return importExpr(reference2, null, span).callFn(params, span);
|
|
10039
10199
|
}
|
|
10040
10200
|
function temporaryAllocator(statements, name) {
|
|
10041
10201
|
let temp = null;
|
|
@@ -10131,13 +10291,13 @@ function getInterpolationArgsLength(interpolation) {
|
|
|
10131
10291
|
}
|
|
10132
10292
|
}
|
|
10133
10293
|
function getInstructionStatements(instructions) {
|
|
10134
|
-
var
|
|
10294
|
+
var _a2;
|
|
10135
10295
|
const statements = [];
|
|
10136
10296
|
let pendingExpression = null;
|
|
10137
10297
|
let pendingExpressionType = null;
|
|
10138
10298
|
let chainLength = 0;
|
|
10139
10299
|
for (const current of instructions) {
|
|
10140
|
-
const resolvedParams = (
|
|
10300
|
+
const resolvedParams = (_a2 = typeof current.paramsOrFn === "function" ? current.paramsOrFn() : current.paramsOrFn) != null ? _a2 : [];
|
|
10141
10301
|
const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
|
|
10142
10302
|
if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference && CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
|
|
10143
10303
|
pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
|
|
@@ -10585,8 +10745,8 @@ function getPolicy() {
|
|
|
10585
10745
|
return policy;
|
|
10586
10746
|
}
|
|
10587
10747
|
function trustedScriptFromString(script) {
|
|
10588
|
-
var
|
|
10589
|
-
return ((
|
|
10748
|
+
var _a2;
|
|
10749
|
+
return ((_a2 = getPolicy()) == null ? void 0 : _a2.createScript(script)) || script;
|
|
10590
10750
|
}
|
|
10591
10751
|
function newTrustedFunctionForJIT(...args) {
|
|
10592
10752
|
if (!_global.trustedTypes) {
|
|
@@ -10901,8 +11061,8 @@ var ImplicitReceiver = class extends AST {
|
|
|
10901
11061
|
};
|
|
10902
11062
|
var ThisReceiver = class extends ImplicitReceiver {
|
|
10903
11063
|
visit(visitor, context = null) {
|
|
10904
|
-
var
|
|
10905
|
-
return (
|
|
11064
|
+
var _a2;
|
|
11065
|
+
return (_a2 = visitor.visitThisReceiver) == null ? void 0 : _a2.call(visitor, this, context);
|
|
10906
11066
|
}
|
|
10907
11067
|
};
|
|
10908
11068
|
var Chain = class extends AST {
|
|
@@ -11808,8 +11968,8 @@ var _AstToIrVisitor = class {
|
|
|
11808
11968
|
return convertToStatementIfNeeded(mode, literal(ast.value, type, this.convertSourceSpan(ast.span)));
|
|
11809
11969
|
}
|
|
11810
11970
|
_getLocal(name, receiver) {
|
|
11811
|
-
var
|
|
11812
|
-
if (((
|
|
11971
|
+
var _a2;
|
|
11972
|
+
if (((_a2 = this._localResolver.globals) == null ? void 0 : _a2.has(name)) && receiver instanceof ThisReceiver) {
|
|
11813
11973
|
return null;
|
|
11814
11974
|
}
|
|
11815
11975
|
return this._localResolver.getLocal(name);
|
|
@@ -11889,8 +12049,8 @@ var _AstToIrVisitor = class {
|
|
|
11889
12049
|
}
|
|
11890
12050
|
return convertToStatementIfNeeded(mode, convertedArgs[0]);
|
|
11891
12051
|
}
|
|
11892
|
-
const
|
|
11893
|
-
return convertToStatementIfNeeded(mode,
|
|
12052
|
+
const call2 = this._visit(receiver, _Mode.Expression).callFn(convertedArgs, this.convertSourceSpan(ast.span));
|
|
12053
|
+
return convertToStatementIfNeeded(mode, call2);
|
|
11894
12054
|
}
|
|
11895
12055
|
visitSafeCall(ast, mode) {
|
|
11896
12056
|
return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
|
|
@@ -12324,11 +12484,11 @@ var ShadowCss = class {
|
|
|
12324
12484
|
}
|
|
12325
12485
|
_convertColonHostContext(cssText) {
|
|
12326
12486
|
return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
|
|
12327
|
-
var
|
|
12487
|
+
var _a2;
|
|
12328
12488
|
const contextSelectorGroups = [[]];
|
|
12329
12489
|
let match;
|
|
12330
12490
|
while (match = _cssColonHostContextRe.exec(selectorText)) {
|
|
12331
|
-
const newContextSelectors = ((
|
|
12491
|
+
const newContextSelectors = ((_a2 = match[1]) != null ? _a2 : "").trim().split(",").map((m) => m.trim()).filter((m) => m !== "");
|
|
12332
12492
|
const contextSelectorGroupsLength = contextSelectorGroups.length;
|
|
12333
12493
|
repeatGroups(contextSelectorGroups, newContextSelectors.length);
|
|
12334
12494
|
for (let i = 0; i < newContextSelectors.length; i++) {
|
|
@@ -12400,7 +12560,7 @@ var ShadowCss = class {
|
|
|
12400
12560
|
return scopeSelector + " " + selector;
|
|
12401
12561
|
}
|
|
12402
12562
|
_applySelectorScope(selector, scopeSelector, hostSelector) {
|
|
12403
|
-
var
|
|
12563
|
+
var _a2;
|
|
12404
12564
|
const isRe = /\[is=([^\]]*)\]/g;
|
|
12405
12565
|
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
12406
12566
|
const attrName = "[" + scopeSelector + "]";
|
|
@@ -12433,7 +12593,7 @@ var ShadowCss = class {
|
|
|
12433
12593
|
while ((res = sep.exec(selector)) !== null) {
|
|
12434
12594
|
const separator = res[1];
|
|
12435
12595
|
const part2 = selector.slice(startIndex, res.index).trim();
|
|
12436
|
-
if (part2.match(_placeholderRe) && ((
|
|
12596
|
+
if (part2.match(_placeholderRe) && ((_a2 = selector[res.index + 1]) == null ? void 0 : _a2.match(/[a-fA-F\d]/))) {
|
|
12437
12597
|
continue;
|
|
12438
12598
|
}
|
|
12439
12599
|
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
@@ -12463,198 +12623,2058 @@ var SafeSelector = class {
|
|
|
12463
12623
|
return pseudo + replaceBy;
|
|
12464
12624
|
});
|
|
12465
12625
|
}
|
|
12466
|
-
restore(content) {
|
|
12467
|
-
return content.replace(_placeholderRe, (_ph, index2) => this.placeholders[+index2]);
|
|
12626
|
+
restore(content) {
|
|
12627
|
+
return content.replace(_placeholderRe, (_ph, index2) => this.placeholders[+index2]);
|
|
12628
|
+
}
|
|
12629
|
+
content() {
|
|
12630
|
+
return this._content;
|
|
12631
|
+
}
|
|
12632
|
+
_escapeRegexMatches(content, pattern) {
|
|
12633
|
+
return content.replace(pattern, (_, keep) => {
|
|
12634
|
+
const replaceBy = `__ph-${this.index}__`;
|
|
12635
|
+
this.placeholders.push(keep);
|
|
12636
|
+
this.index++;
|
|
12637
|
+
return replaceBy;
|
|
12638
|
+
});
|
|
12639
|
+
}
|
|
12640
|
+
};
|
|
12641
|
+
var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
|
|
12642
|
+
var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
12643
|
+
var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
12644
|
+
var _polyfillHost = "-shadowcsshost";
|
|
12645
|
+
var _polyfillHostContext = "-shadowcsscontext";
|
|
12646
|
+
var _parenSuffix = "(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
12647
|
+
var _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, "gim");
|
|
12648
|
+
var _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, "gim");
|
|
12649
|
+
var _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, "im");
|
|
12650
|
+
var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
12651
|
+
var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
12652
|
+
var _shadowDOMSelectorsRe = [
|
|
12653
|
+
/::shadow/g,
|
|
12654
|
+
/::content/g,
|
|
12655
|
+
/\/shadow-deep\//g,
|
|
12656
|
+
/\/shadow\//g
|
|
12657
|
+
];
|
|
12658
|
+
var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g;
|
|
12659
|
+
var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
|
|
12660
|
+
var _polyfillHostRe = /-shadowcsshost/gim;
|
|
12661
|
+
var _colonHostRe = /:host/gim;
|
|
12662
|
+
var _colonHostContextRe = /:host-context/gim;
|
|
12663
|
+
var _commentRe = /\/\*[\s\S]*?\*\//g;
|
|
12664
|
+
var _placeholderRe = /__ph-(\d+)__/g;
|
|
12665
|
+
function stripComments(input) {
|
|
12666
|
+
return input.replace(_commentRe, "");
|
|
12667
|
+
}
|
|
12668
|
+
var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
12669
|
+
function extractCommentsWithHash(input) {
|
|
12670
|
+
return input.match(_commentWithHashRe) || [];
|
|
12671
|
+
}
|
|
12672
|
+
var BLOCK_PLACEHOLDER = "%BLOCK%";
|
|
12673
|
+
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
12674
|
+
var CONTENT_PAIRS = /* @__PURE__ */ new Map([["{", "}"]]);
|
|
12675
|
+
var COMMA_IN_PLACEHOLDER = "%COMMA_IN_PLACEHOLDER%";
|
|
12676
|
+
var SEMI_IN_PLACEHOLDER = "%SEMI_IN_PLACEHOLDER%";
|
|
12677
|
+
var COLON_IN_PLACEHOLDER = "%COLON_IN_PLACEHOLDER%";
|
|
12678
|
+
var _cssCommaInPlaceholderReGlobal = new RegExp(COMMA_IN_PLACEHOLDER, "g");
|
|
12679
|
+
var _cssSemiInPlaceholderReGlobal = new RegExp(SEMI_IN_PLACEHOLDER, "g");
|
|
12680
|
+
var _cssColonInPlaceholderReGlobal = new RegExp(COLON_IN_PLACEHOLDER, "g");
|
|
12681
|
+
var CssRule = class {
|
|
12682
|
+
constructor(selector, content) {
|
|
12683
|
+
this.selector = selector;
|
|
12684
|
+
this.content = content;
|
|
12685
|
+
}
|
|
12686
|
+
};
|
|
12687
|
+
function processRules(input, ruleCallback) {
|
|
12688
|
+
const escaped = escapeInStrings(input);
|
|
12689
|
+
const inputWithEscapedBlocks = escapeBlocks(escaped, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
|
|
12690
|
+
let nextBlockIndex = 0;
|
|
12691
|
+
const escapedResult = inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
12692
|
+
const selector = m[2];
|
|
12693
|
+
let content = "";
|
|
12694
|
+
let suffix = m[4];
|
|
12695
|
+
let contentPrefix = "";
|
|
12696
|
+
if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
|
|
12697
|
+
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
12698
|
+
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
12699
|
+
contentPrefix = "{";
|
|
12700
|
+
}
|
|
12701
|
+
const rule2 = ruleCallback(new CssRule(selector, content));
|
|
12702
|
+
return `${m[1]}${rule2.selector}${m[3]}${contentPrefix}${rule2.content}${suffix}`;
|
|
12703
|
+
});
|
|
12704
|
+
return unescapeInStrings(escapedResult);
|
|
12705
|
+
}
|
|
12706
|
+
var StringWithEscapedBlocks = class {
|
|
12707
|
+
constructor(escapedString, blocks) {
|
|
12708
|
+
this.escapedString = escapedString;
|
|
12709
|
+
this.blocks = blocks;
|
|
12710
|
+
}
|
|
12711
|
+
};
|
|
12712
|
+
function escapeBlocks(input, charPairs, placeholder) {
|
|
12713
|
+
const resultParts = [];
|
|
12714
|
+
const escapedBlocks = [];
|
|
12715
|
+
let openCharCount = 0;
|
|
12716
|
+
let nonBlockStartIndex = 0;
|
|
12717
|
+
let blockStartIndex = -1;
|
|
12718
|
+
let openChar;
|
|
12719
|
+
let closeChar;
|
|
12720
|
+
for (let i = 0; i < input.length; i++) {
|
|
12721
|
+
const char = input[i];
|
|
12722
|
+
if (char === "\\") {
|
|
12723
|
+
i++;
|
|
12724
|
+
} else if (char === closeChar) {
|
|
12725
|
+
openCharCount--;
|
|
12726
|
+
if (openCharCount === 0) {
|
|
12727
|
+
escapedBlocks.push(input.substring(blockStartIndex, i));
|
|
12728
|
+
resultParts.push(placeholder);
|
|
12729
|
+
nonBlockStartIndex = i;
|
|
12730
|
+
blockStartIndex = -1;
|
|
12731
|
+
openChar = closeChar = void 0;
|
|
12732
|
+
}
|
|
12733
|
+
} else if (char === openChar) {
|
|
12734
|
+
openCharCount++;
|
|
12735
|
+
} else if (openCharCount === 0 && charPairs.has(char)) {
|
|
12736
|
+
openChar = char;
|
|
12737
|
+
closeChar = charPairs.get(char);
|
|
12738
|
+
openCharCount = 1;
|
|
12739
|
+
blockStartIndex = i + 1;
|
|
12740
|
+
resultParts.push(input.substring(nonBlockStartIndex, blockStartIndex));
|
|
12741
|
+
}
|
|
12742
|
+
}
|
|
12743
|
+
if (blockStartIndex !== -1) {
|
|
12744
|
+
escapedBlocks.push(input.substring(blockStartIndex));
|
|
12745
|
+
resultParts.push(placeholder);
|
|
12746
|
+
} else {
|
|
12747
|
+
resultParts.push(input.substring(nonBlockStartIndex));
|
|
12748
|
+
}
|
|
12749
|
+
return new StringWithEscapedBlocks(resultParts.join(""), escapedBlocks);
|
|
12750
|
+
}
|
|
12751
|
+
var ESCAPE_IN_STRING_MAP = {
|
|
12752
|
+
";": SEMI_IN_PLACEHOLDER,
|
|
12753
|
+
",": COMMA_IN_PLACEHOLDER,
|
|
12754
|
+
":": COLON_IN_PLACEHOLDER
|
|
12755
|
+
};
|
|
12756
|
+
function escapeInStrings(input) {
|
|
12757
|
+
let result = input;
|
|
12758
|
+
let currentQuoteChar = null;
|
|
12759
|
+
for (let i = 0; i < result.length; i++) {
|
|
12760
|
+
const char = result[i];
|
|
12761
|
+
if (char === "\\") {
|
|
12762
|
+
i++;
|
|
12763
|
+
} else {
|
|
12764
|
+
if (currentQuoteChar !== null) {
|
|
12765
|
+
if (char === currentQuoteChar) {
|
|
12766
|
+
currentQuoteChar = null;
|
|
12767
|
+
} else {
|
|
12768
|
+
const placeholder = ESCAPE_IN_STRING_MAP[char];
|
|
12769
|
+
if (placeholder) {
|
|
12770
|
+
result = `${result.substr(0, i)}${placeholder}${result.substr(i + 1)}`;
|
|
12771
|
+
i += placeholder.length - 1;
|
|
12772
|
+
}
|
|
12773
|
+
}
|
|
12774
|
+
} else if (char === "'" || char === '"') {
|
|
12775
|
+
currentQuoteChar = char;
|
|
12776
|
+
}
|
|
12777
|
+
}
|
|
12778
|
+
}
|
|
12779
|
+
return result;
|
|
12780
|
+
}
|
|
12781
|
+
function unescapeInStrings(input) {
|
|
12782
|
+
let result = input.replace(_cssCommaInPlaceholderReGlobal, ",");
|
|
12783
|
+
result = result.replace(_cssSemiInPlaceholderReGlobal, ";");
|
|
12784
|
+
result = result.replace(_cssColonInPlaceholderReGlobal, ":");
|
|
12785
|
+
return result;
|
|
12786
|
+
}
|
|
12787
|
+
function unescapeQuotes(str, isQuoted) {
|
|
12788
|
+
return !isQuoted ? str : str.replace(/((?:^|[^\\])(?:\\\\)*)\\(?=['"])/g, "$1");
|
|
12789
|
+
}
|
|
12790
|
+
function combineHostContextSelectors(contextSelectors, otherSelectors) {
|
|
12791
|
+
const hostMarker = _polyfillHostNoCombinator;
|
|
12792
|
+
_polyfillHostRe.lastIndex = 0;
|
|
12793
|
+
const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);
|
|
12794
|
+
if (contextSelectors.length === 0) {
|
|
12795
|
+
return hostMarker + otherSelectors;
|
|
12796
|
+
}
|
|
12797
|
+
const combined = [contextSelectors.pop() || ""];
|
|
12798
|
+
while (contextSelectors.length > 0) {
|
|
12799
|
+
const length = combined.length;
|
|
12800
|
+
const contextSelector = contextSelectors.pop();
|
|
12801
|
+
for (let i = 0; i < length; i++) {
|
|
12802
|
+
const previousSelectors = combined[i];
|
|
12803
|
+
combined[length * 2 + i] = previousSelectors + " " + contextSelector;
|
|
12804
|
+
combined[length + i] = contextSelector + " " + previousSelectors;
|
|
12805
|
+
combined[i] = contextSelector + previousSelectors;
|
|
12806
|
+
}
|
|
12807
|
+
}
|
|
12808
|
+
return combined.map((s) => otherSelectorsHasHost ? `${s}${otherSelectors}` : `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`).join(",");
|
|
12809
|
+
}
|
|
12810
|
+
function repeatGroups(groups, multiples) {
|
|
12811
|
+
const length = groups.length;
|
|
12812
|
+
for (let i = 1; i < multiples; i++) {
|
|
12813
|
+
for (let j = 0; j < length; j++) {
|
|
12814
|
+
groups[j + i * length] = groups[j].slice(0);
|
|
12815
|
+
}
|
|
12816
|
+
}
|
|
12817
|
+
}
|
|
12818
|
+
var TagContentType;
|
|
12819
|
+
(function(TagContentType2) {
|
|
12820
|
+
TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
|
|
12821
|
+
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
12822
|
+
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
12823
|
+
})(TagContentType || (TagContentType = {}));
|
|
12824
|
+
function splitNsName(elementName) {
|
|
12825
|
+
if (elementName[0] != ":") {
|
|
12826
|
+
return [null, elementName];
|
|
12827
|
+
}
|
|
12828
|
+
const colonIndex = elementName.indexOf(":", 1);
|
|
12829
|
+
if (colonIndex === -1) {
|
|
12830
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
12831
|
+
}
|
|
12832
|
+
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
12833
|
+
}
|
|
12834
|
+
function isNgContainer(tagName) {
|
|
12835
|
+
return splitNsName(tagName)[1] === "ng-container";
|
|
12836
|
+
}
|
|
12837
|
+
function isNgContent(tagName) {
|
|
12838
|
+
return splitNsName(tagName)[1] === "ng-content";
|
|
12839
|
+
}
|
|
12840
|
+
function isNgTemplate(tagName) {
|
|
12841
|
+
return splitNsName(tagName)[1] === "ng-template";
|
|
12842
|
+
}
|
|
12843
|
+
function getNsPrefix(fullName) {
|
|
12844
|
+
return fullName === null ? null : splitNsName(fullName)[0];
|
|
12845
|
+
}
|
|
12846
|
+
function mergeNsAndName(prefix, localName) {
|
|
12847
|
+
return prefix ? `:${prefix}:${localName}` : localName;
|
|
12848
|
+
}
|
|
12849
|
+
var ElementAttributeKind;
|
|
12850
|
+
(function(ElementAttributeKind2) {
|
|
12851
|
+
ElementAttributeKind2[ElementAttributeKind2["Attribute"] = 0] = "Attribute";
|
|
12852
|
+
ElementAttributeKind2[ElementAttributeKind2["Class"] = 1] = "Class";
|
|
12853
|
+
ElementAttributeKind2[ElementAttributeKind2["Style"] = 2] = "Style";
|
|
12854
|
+
ElementAttributeKind2[ElementAttributeKind2["Binding"] = 3] = "Binding";
|
|
12855
|
+
ElementAttributeKind2[ElementAttributeKind2["Template"] = 4] = "Template";
|
|
12856
|
+
ElementAttributeKind2[ElementAttributeKind2["I18n"] = 5] = "I18n";
|
|
12857
|
+
})(ElementAttributeKind || (ElementAttributeKind = {}));
|
|
12858
|
+
var FLYWEIGHT_ARRAY = Object.freeze([]);
|
|
12859
|
+
var ElementAttributes = class {
|
|
12860
|
+
constructor() {
|
|
12861
|
+
this.known = /* @__PURE__ */ new Set();
|
|
12862
|
+
this.byKind = /* @__PURE__ */ new Map();
|
|
12863
|
+
this.projectAs = null;
|
|
12864
|
+
}
|
|
12865
|
+
get attributes() {
|
|
12866
|
+
var _a2;
|
|
12867
|
+
return (_a2 = this.byKind.get(ElementAttributeKind.Attribute)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
12868
|
+
}
|
|
12869
|
+
get classes() {
|
|
12870
|
+
var _a2;
|
|
12871
|
+
return (_a2 = this.byKind.get(ElementAttributeKind.Class)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
12872
|
+
}
|
|
12873
|
+
get styles() {
|
|
12874
|
+
var _a2;
|
|
12875
|
+
return (_a2 = this.byKind.get(ElementAttributeKind.Style)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
12876
|
+
}
|
|
12877
|
+
get bindings() {
|
|
12878
|
+
var _a2;
|
|
12879
|
+
return (_a2 = this.byKind.get(ElementAttributeKind.Binding)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
12880
|
+
}
|
|
12881
|
+
get template() {
|
|
12882
|
+
var _a2;
|
|
12883
|
+
return (_a2 = this.byKind.get(ElementAttributeKind.Template)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
12884
|
+
}
|
|
12885
|
+
get i18n() {
|
|
12886
|
+
var _a2;
|
|
12887
|
+
return (_a2 = this.byKind.get(ElementAttributeKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
12888
|
+
}
|
|
12889
|
+
add(kind, name, value) {
|
|
12890
|
+
if (this.known.has(name)) {
|
|
12891
|
+
return;
|
|
12892
|
+
}
|
|
12893
|
+
this.known.add(name);
|
|
12894
|
+
const array = this.arrayFor(kind);
|
|
12895
|
+
array.push(...getAttributeNameLiterals$1(name));
|
|
12896
|
+
if (value !== null) {
|
|
12897
|
+
array.push(value);
|
|
12898
|
+
}
|
|
12899
|
+
}
|
|
12900
|
+
arrayFor(kind) {
|
|
12901
|
+
if (!this.byKind.has(kind)) {
|
|
12902
|
+
this.byKind.set(kind, []);
|
|
12903
|
+
}
|
|
12904
|
+
return this.byKind.get(kind);
|
|
12905
|
+
}
|
|
12906
|
+
};
|
|
12907
|
+
function getAttributeNameLiterals$1(name) {
|
|
12908
|
+
const [attributeNamespace, attributeName] = splitNsName(name);
|
|
12909
|
+
const nameLiteral = literal(attributeName);
|
|
12910
|
+
if (attributeNamespace) {
|
|
12911
|
+
return [
|
|
12912
|
+
literal(0),
|
|
12913
|
+
literal(attributeNamespace),
|
|
12914
|
+
nameLiteral
|
|
12915
|
+
];
|
|
12916
|
+
}
|
|
12917
|
+
return [nameLiteral];
|
|
12918
|
+
}
|
|
12919
|
+
function assertIsElementAttributes(attrs) {
|
|
12920
|
+
if (!(attrs instanceof ElementAttributes)) {
|
|
12921
|
+
throw new Error(`AssertionError: ElementAttributes has already been coalesced into the view constants`);
|
|
12922
|
+
}
|
|
12923
|
+
}
|
|
12924
|
+
var OpKind;
|
|
12925
|
+
(function(OpKind2) {
|
|
12926
|
+
OpKind2[OpKind2["ListEnd"] = 0] = "ListEnd";
|
|
12927
|
+
OpKind2[OpKind2["Statement"] = 1] = "Statement";
|
|
12928
|
+
OpKind2[OpKind2["Variable"] = 2] = "Variable";
|
|
12929
|
+
OpKind2[OpKind2["ElementStart"] = 3] = "ElementStart";
|
|
12930
|
+
OpKind2[OpKind2["Element"] = 4] = "Element";
|
|
12931
|
+
OpKind2[OpKind2["Template"] = 5] = "Template";
|
|
12932
|
+
OpKind2[OpKind2["ElementEnd"] = 6] = "ElementEnd";
|
|
12933
|
+
OpKind2[OpKind2["Text"] = 7] = "Text";
|
|
12934
|
+
OpKind2[OpKind2["Listener"] = 8] = "Listener";
|
|
12935
|
+
OpKind2[OpKind2["InterpolateText"] = 9] = "InterpolateText";
|
|
12936
|
+
OpKind2[OpKind2["Property"] = 10] = "Property";
|
|
12937
|
+
OpKind2[OpKind2["Advance"] = 11] = "Advance";
|
|
12938
|
+
})(OpKind || (OpKind = {}));
|
|
12939
|
+
var ExpressionKind;
|
|
12940
|
+
(function(ExpressionKind2) {
|
|
12941
|
+
ExpressionKind2[ExpressionKind2["LexicalRead"] = 0] = "LexicalRead";
|
|
12942
|
+
ExpressionKind2[ExpressionKind2["Context"] = 1] = "Context";
|
|
12943
|
+
ExpressionKind2[ExpressionKind2["ReadVariable"] = 2] = "ReadVariable";
|
|
12944
|
+
ExpressionKind2[ExpressionKind2["NextContext"] = 3] = "NextContext";
|
|
12945
|
+
ExpressionKind2[ExpressionKind2["Reference"] = 4] = "Reference";
|
|
12946
|
+
ExpressionKind2[ExpressionKind2["GetCurrentView"] = 5] = "GetCurrentView";
|
|
12947
|
+
ExpressionKind2[ExpressionKind2["RestoreView"] = 6] = "RestoreView";
|
|
12948
|
+
ExpressionKind2[ExpressionKind2["ResetView"] = 7] = "ResetView";
|
|
12949
|
+
})(ExpressionKind || (ExpressionKind = {}));
|
|
12950
|
+
var SemanticVariableKind;
|
|
12951
|
+
(function(SemanticVariableKind2) {
|
|
12952
|
+
SemanticVariableKind2[SemanticVariableKind2["Context"] = 0] = "Context";
|
|
12953
|
+
SemanticVariableKind2[SemanticVariableKind2["Identifier"] = 1] = "Identifier";
|
|
12954
|
+
SemanticVariableKind2[SemanticVariableKind2["SavedView"] = 2] = "SavedView";
|
|
12955
|
+
})(SemanticVariableKind || (SemanticVariableKind = {}));
|
|
12956
|
+
var ConsumesSlot = Symbol("ConsumesSlot");
|
|
12957
|
+
var DependsOnSlotContext = Symbol("DependsOnSlotContext");
|
|
12958
|
+
var UsesSlotIndex = Symbol("UsesSlotIndex");
|
|
12959
|
+
var ConsumesVarsTrait = Symbol("UsesVars");
|
|
12960
|
+
var TRAIT_CONSUMES_SLOT = {
|
|
12961
|
+
[ConsumesSlot]: true,
|
|
12962
|
+
slot: null,
|
|
12963
|
+
numSlotsUsed: 1
|
|
12964
|
+
};
|
|
12965
|
+
var TRAIT_USES_SLOT_INDEX = {
|
|
12966
|
+
[UsesSlotIndex]: true,
|
|
12967
|
+
slot: null
|
|
12968
|
+
};
|
|
12969
|
+
var TRAIT_DEPENDS_ON_SLOT_CONTEXT = {
|
|
12970
|
+
[DependsOnSlotContext]: true
|
|
12971
|
+
};
|
|
12972
|
+
var TRAIT_CONSUMES_VARS = {
|
|
12973
|
+
[ConsumesVarsTrait]: true
|
|
12974
|
+
};
|
|
12975
|
+
function hasConsumesSlotTrait(op) {
|
|
12976
|
+
return op[ConsumesSlot] === true;
|
|
12977
|
+
}
|
|
12978
|
+
function hasDependsOnSlotContextTrait(op) {
|
|
12979
|
+
return op[DependsOnSlotContext] === true;
|
|
12980
|
+
}
|
|
12981
|
+
function hasConsumesVarsTrait(value) {
|
|
12982
|
+
return value[ConsumesVarsTrait] === true;
|
|
12983
|
+
}
|
|
12984
|
+
function hasUsesSlotIndexTrait(value) {
|
|
12985
|
+
return value[UsesSlotIndex] === true;
|
|
12986
|
+
}
|
|
12987
|
+
var _a;
|
|
12988
|
+
var ExpressionBase = class extends Expression {
|
|
12989
|
+
constructor(sourceSpan = null) {
|
|
12990
|
+
super(null, sourceSpan);
|
|
12991
|
+
}
|
|
12992
|
+
};
|
|
12993
|
+
var LexicalReadExpr = class extends ExpressionBase {
|
|
12994
|
+
constructor(name) {
|
|
12995
|
+
super();
|
|
12996
|
+
this.name = name;
|
|
12997
|
+
this.kind = ExpressionKind.LexicalRead;
|
|
12998
|
+
}
|
|
12999
|
+
visitExpression(visitor, context) {
|
|
13000
|
+
}
|
|
13001
|
+
isEquivalent() {
|
|
13002
|
+
return false;
|
|
13003
|
+
}
|
|
13004
|
+
isConstant() {
|
|
13005
|
+
return false;
|
|
13006
|
+
}
|
|
13007
|
+
transformInternalExpressions() {
|
|
13008
|
+
}
|
|
13009
|
+
};
|
|
13010
|
+
var _ReferenceExpr = class extends ExpressionBase {
|
|
13011
|
+
constructor(target, offset) {
|
|
13012
|
+
super();
|
|
13013
|
+
this.target = target;
|
|
13014
|
+
this.offset = offset;
|
|
13015
|
+
this.kind = ExpressionKind.Reference;
|
|
13016
|
+
this[_a] = true;
|
|
13017
|
+
this.slot = null;
|
|
13018
|
+
}
|
|
13019
|
+
visitExpression() {
|
|
13020
|
+
}
|
|
13021
|
+
isEquivalent(e) {
|
|
13022
|
+
return e instanceof _ReferenceExpr && e.target === this.target;
|
|
13023
|
+
}
|
|
13024
|
+
isConstant() {
|
|
13025
|
+
return false;
|
|
13026
|
+
}
|
|
13027
|
+
transformInternalExpressions() {
|
|
13028
|
+
}
|
|
13029
|
+
};
|
|
13030
|
+
var ReferenceExpr = _ReferenceExpr;
|
|
13031
|
+
(() => {
|
|
13032
|
+
_a = UsesSlotIndex;
|
|
13033
|
+
})();
|
|
13034
|
+
var ContextExpr = class extends ExpressionBase {
|
|
13035
|
+
constructor(view) {
|
|
13036
|
+
super();
|
|
13037
|
+
this.view = view;
|
|
13038
|
+
this.kind = ExpressionKind.Context;
|
|
13039
|
+
}
|
|
13040
|
+
visitExpression() {
|
|
13041
|
+
}
|
|
13042
|
+
isEquivalent(e) {
|
|
13043
|
+
return e instanceof ContextExpr && e.view === this.view;
|
|
13044
|
+
}
|
|
13045
|
+
isConstant() {
|
|
13046
|
+
return false;
|
|
13047
|
+
}
|
|
13048
|
+
transformInternalExpressions() {
|
|
13049
|
+
}
|
|
13050
|
+
};
|
|
13051
|
+
var NextContextExpr = class extends ExpressionBase {
|
|
13052
|
+
constructor() {
|
|
13053
|
+
super();
|
|
13054
|
+
this.kind = ExpressionKind.NextContext;
|
|
13055
|
+
this.steps = 1;
|
|
13056
|
+
}
|
|
13057
|
+
visitExpression() {
|
|
13058
|
+
}
|
|
13059
|
+
isEquivalent(e) {
|
|
13060
|
+
return e instanceof NextContextExpr && e.steps === this.steps;
|
|
13061
|
+
}
|
|
13062
|
+
isConstant() {
|
|
13063
|
+
return false;
|
|
13064
|
+
}
|
|
13065
|
+
transformInternalExpressions() {
|
|
13066
|
+
}
|
|
13067
|
+
};
|
|
13068
|
+
var GetCurrentViewExpr = class extends ExpressionBase {
|
|
13069
|
+
constructor() {
|
|
13070
|
+
super();
|
|
13071
|
+
this.kind = ExpressionKind.GetCurrentView;
|
|
13072
|
+
}
|
|
13073
|
+
visitExpression() {
|
|
13074
|
+
}
|
|
13075
|
+
isEquivalent(e) {
|
|
13076
|
+
return e instanceof GetCurrentViewExpr;
|
|
13077
|
+
}
|
|
13078
|
+
isConstant() {
|
|
13079
|
+
return false;
|
|
13080
|
+
}
|
|
13081
|
+
transformInternalExpressions() {
|
|
13082
|
+
}
|
|
13083
|
+
};
|
|
13084
|
+
var RestoreViewExpr = class extends ExpressionBase {
|
|
13085
|
+
constructor(view) {
|
|
13086
|
+
super();
|
|
13087
|
+
this.view = view;
|
|
13088
|
+
this.kind = ExpressionKind.RestoreView;
|
|
13089
|
+
}
|
|
13090
|
+
visitExpression(visitor, context) {
|
|
13091
|
+
if (typeof this.view !== "number") {
|
|
13092
|
+
this.view.visitExpression(visitor, context);
|
|
13093
|
+
}
|
|
13094
|
+
}
|
|
13095
|
+
isEquivalent(e) {
|
|
13096
|
+
if (!(e instanceof RestoreViewExpr) || typeof e.view !== typeof this.view) {
|
|
13097
|
+
return false;
|
|
13098
|
+
}
|
|
13099
|
+
if (typeof this.view === "number") {
|
|
13100
|
+
return this.view === e.view;
|
|
13101
|
+
} else {
|
|
13102
|
+
return this.view.isEquivalent(e.view);
|
|
13103
|
+
}
|
|
13104
|
+
}
|
|
13105
|
+
isConstant() {
|
|
13106
|
+
return false;
|
|
13107
|
+
}
|
|
13108
|
+
transformInternalExpressions(transform, flags) {
|
|
13109
|
+
if (typeof this.view !== "number") {
|
|
13110
|
+
this.view = transformExpressionsInExpression(this.view, transform, flags);
|
|
13111
|
+
}
|
|
13112
|
+
}
|
|
13113
|
+
};
|
|
13114
|
+
var ResetViewExpr = class extends ExpressionBase {
|
|
13115
|
+
constructor(expr) {
|
|
13116
|
+
super();
|
|
13117
|
+
this.expr = expr;
|
|
13118
|
+
this.kind = ExpressionKind.ResetView;
|
|
13119
|
+
}
|
|
13120
|
+
visitExpression(visitor, context) {
|
|
13121
|
+
this.expr.visitExpression(visitor, context);
|
|
13122
|
+
}
|
|
13123
|
+
isEquivalent(e) {
|
|
13124
|
+
return e instanceof ResetViewExpr && this.expr.isEquivalent(e.expr);
|
|
13125
|
+
}
|
|
13126
|
+
isConstant() {
|
|
13127
|
+
return false;
|
|
13128
|
+
}
|
|
13129
|
+
transformInternalExpressions(transform, flags) {
|
|
13130
|
+
this.expr = transformExpressionsInExpression(this.expr, transform, flags);
|
|
13131
|
+
}
|
|
13132
|
+
};
|
|
13133
|
+
var ReadVariableExpr = class extends ExpressionBase {
|
|
13134
|
+
constructor(xref) {
|
|
13135
|
+
super();
|
|
13136
|
+
this.xref = xref;
|
|
13137
|
+
this.kind = ExpressionKind.ReadVariable;
|
|
13138
|
+
this.name = null;
|
|
13139
|
+
}
|
|
13140
|
+
visitExpression() {
|
|
13141
|
+
}
|
|
13142
|
+
isEquivalent(other) {
|
|
13143
|
+
return other instanceof ReadVariableExpr && other.xref === this.xref;
|
|
13144
|
+
}
|
|
13145
|
+
isConstant() {
|
|
13146
|
+
return false;
|
|
13147
|
+
}
|
|
13148
|
+
transformInternalExpressions() {
|
|
13149
|
+
}
|
|
13150
|
+
};
|
|
13151
|
+
function visitExpressionsInOp(op, visitor) {
|
|
13152
|
+
transformExpressionsInOp(op, (expr, flags) => {
|
|
13153
|
+
visitor(expr, flags);
|
|
13154
|
+
return expr;
|
|
13155
|
+
}, VisitorContextFlag.None);
|
|
13156
|
+
}
|
|
13157
|
+
var VisitorContextFlag;
|
|
13158
|
+
(function(VisitorContextFlag2) {
|
|
13159
|
+
VisitorContextFlag2[VisitorContextFlag2["None"] = 0] = "None";
|
|
13160
|
+
VisitorContextFlag2[VisitorContextFlag2["InChildOperation"] = 1] = "InChildOperation";
|
|
13161
|
+
})(VisitorContextFlag || (VisitorContextFlag = {}));
|
|
13162
|
+
function transformExpressionsInOp(op, transform, flags) {
|
|
13163
|
+
switch (op.kind) {
|
|
13164
|
+
case OpKind.Property:
|
|
13165
|
+
op.expression = transformExpressionsInExpression(op.expression, transform, flags);
|
|
13166
|
+
break;
|
|
13167
|
+
case OpKind.Statement:
|
|
13168
|
+
transformExpressionsInStatement(op.statement, transform, flags);
|
|
13169
|
+
break;
|
|
13170
|
+
case OpKind.Variable:
|
|
13171
|
+
op.initializer = transformExpressionsInExpression(op.initializer, transform, flags);
|
|
13172
|
+
break;
|
|
13173
|
+
case OpKind.InterpolateText:
|
|
13174
|
+
for (let i = 0; i < op.expressions.length; i++) {
|
|
13175
|
+
op.expressions[i] = transformExpressionsInExpression(op.expressions[i], transform, flags);
|
|
13176
|
+
}
|
|
13177
|
+
break;
|
|
13178
|
+
case OpKind.Listener:
|
|
13179
|
+
for (const innerOp of op.handlerOps) {
|
|
13180
|
+
transformExpressionsInOp(innerOp, transform, flags | VisitorContextFlag.InChildOperation);
|
|
13181
|
+
}
|
|
13182
|
+
break;
|
|
13183
|
+
case OpKind.Element:
|
|
13184
|
+
case OpKind.ElementStart:
|
|
13185
|
+
case OpKind.ElementEnd:
|
|
13186
|
+
case OpKind.Template:
|
|
13187
|
+
case OpKind.Text:
|
|
13188
|
+
case OpKind.Advance:
|
|
13189
|
+
break;
|
|
13190
|
+
default:
|
|
13191
|
+
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
13192
|
+
}
|
|
13193
|
+
}
|
|
13194
|
+
function transformExpressionsInExpression(expr, transform, flags) {
|
|
13195
|
+
if (expr instanceof ExpressionBase) {
|
|
13196
|
+
expr.transformInternalExpressions(transform, flags);
|
|
13197
|
+
return transform(expr, flags);
|
|
13198
|
+
} else if (expr instanceof BinaryOperatorExpr) {
|
|
13199
|
+
expr.lhs = transformExpressionsInExpression(expr.lhs, transform, flags);
|
|
13200
|
+
expr.rhs = transformExpressionsInExpression(expr.rhs, transform, flags);
|
|
13201
|
+
} else if (expr instanceof ReadPropExpr) {
|
|
13202
|
+
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
|
13203
|
+
} else if (expr instanceof InvokeFunctionExpr) {
|
|
13204
|
+
expr.fn = transformExpressionsInExpression(expr.fn, transform, flags);
|
|
13205
|
+
for (let i = 0; i < expr.args.length; i++) {
|
|
13206
|
+
expr.args[i] = transformExpressionsInExpression(expr.args[i], transform, flags);
|
|
13207
|
+
}
|
|
13208
|
+
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
13209
|
+
} else {
|
|
13210
|
+
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
13211
|
+
}
|
|
13212
|
+
return expr;
|
|
13213
|
+
}
|
|
13214
|
+
function transformExpressionsInStatement(stmt, transform, flags) {
|
|
13215
|
+
if (stmt instanceof ExpressionStatement) {
|
|
13216
|
+
stmt.expr = transformExpressionsInExpression(stmt.expr, transform, flags);
|
|
13217
|
+
} else if (stmt instanceof ReturnStatement) {
|
|
13218
|
+
stmt.value = transformExpressionsInExpression(stmt.value, transform, flags);
|
|
13219
|
+
} else {
|
|
13220
|
+
throw new Error(`Unhandled statement kind: ${stmt.constructor.name}`);
|
|
13221
|
+
}
|
|
13222
|
+
}
|
|
13223
|
+
var _OpList = class {
|
|
13224
|
+
constructor() {
|
|
13225
|
+
this.debugListId = _OpList.nextListId++;
|
|
13226
|
+
this.head = {
|
|
13227
|
+
kind: OpKind.ListEnd,
|
|
13228
|
+
next: null,
|
|
13229
|
+
prev: null,
|
|
13230
|
+
debugListId: this.debugListId
|
|
13231
|
+
};
|
|
13232
|
+
this.tail = {
|
|
13233
|
+
kind: OpKind.ListEnd,
|
|
13234
|
+
next: null,
|
|
13235
|
+
prev: null,
|
|
13236
|
+
debugListId: this.debugListId
|
|
13237
|
+
};
|
|
13238
|
+
this.head.next = this.tail;
|
|
13239
|
+
this.tail.prev = this.head;
|
|
13240
|
+
}
|
|
13241
|
+
push(op) {
|
|
13242
|
+
_OpList.assertIsNotEnd(op);
|
|
13243
|
+
_OpList.assertIsUnowned(op);
|
|
13244
|
+
op.debugListId = this.debugListId;
|
|
13245
|
+
const oldLast = this.tail.prev;
|
|
13246
|
+
op.prev = oldLast;
|
|
13247
|
+
oldLast.next = op;
|
|
13248
|
+
op.next = this.tail;
|
|
13249
|
+
this.tail.prev = op;
|
|
13250
|
+
}
|
|
13251
|
+
prepend(ops) {
|
|
13252
|
+
if (ops.length === 0) {
|
|
13253
|
+
return;
|
|
13254
|
+
}
|
|
13255
|
+
for (const op of ops) {
|
|
13256
|
+
_OpList.assertIsNotEnd(op);
|
|
13257
|
+
_OpList.assertIsUnowned(op);
|
|
13258
|
+
op.debugListId = this.debugListId;
|
|
13259
|
+
}
|
|
13260
|
+
const first = this.head.next;
|
|
13261
|
+
let prev = this.head;
|
|
13262
|
+
for (const op of ops) {
|
|
13263
|
+
prev.next = op;
|
|
13264
|
+
op.prev = prev;
|
|
13265
|
+
prev = op;
|
|
13266
|
+
}
|
|
13267
|
+
prev.next = first;
|
|
13268
|
+
first.prev = prev;
|
|
13269
|
+
}
|
|
13270
|
+
*[Symbol.iterator]() {
|
|
13271
|
+
let current = this.head.next;
|
|
13272
|
+
while (current !== this.tail) {
|
|
13273
|
+
_OpList.assertIsOwned(current, this.debugListId);
|
|
13274
|
+
const next = current.next;
|
|
13275
|
+
yield current;
|
|
13276
|
+
current = next;
|
|
13277
|
+
}
|
|
13278
|
+
}
|
|
13279
|
+
*reversed() {
|
|
13280
|
+
let current = this.tail.prev;
|
|
13281
|
+
while (current !== this.head) {
|
|
13282
|
+
_OpList.assertIsOwned(current, this.debugListId);
|
|
13283
|
+
const prev = current.prev;
|
|
13284
|
+
yield current;
|
|
13285
|
+
current = prev;
|
|
13286
|
+
}
|
|
13287
|
+
}
|
|
13288
|
+
static replace(oldOp, newOp) {
|
|
13289
|
+
_OpList.assertIsNotEnd(oldOp);
|
|
13290
|
+
_OpList.assertIsNotEnd(newOp);
|
|
13291
|
+
_OpList.assertIsOwned(oldOp);
|
|
13292
|
+
_OpList.assertIsUnowned(newOp);
|
|
13293
|
+
newOp.debugListId = oldOp.debugListId;
|
|
13294
|
+
if (oldOp.prev !== null) {
|
|
13295
|
+
oldOp.prev.next = newOp;
|
|
13296
|
+
newOp.prev = oldOp.prev;
|
|
13297
|
+
}
|
|
13298
|
+
if (oldOp.next !== null) {
|
|
13299
|
+
oldOp.next.prev = newOp;
|
|
13300
|
+
newOp.next = oldOp.next;
|
|
13301
|
+
}
|
|
13302
|
+
oldOp.debugListId = null;
|
|
13303
|
+
oldOp.prev = null;
|
|
13304
|
+
oldOp.next = null;
|
|
13305
|
+
}
|
|
13306
|
+
static replaceWithMany(oldOp, newOps) {
|
|
13307
|
+
if (newOps.length === 0) {
|
|
13308
|
+
_OpList.remove(oldOp);
|
|
13309
|
+
return;
|
|
13310
|
+
}
|
|
13311
|
+
_OpList.assertIsNotEnd(oldOp);
|
|
13312
|
+
_OpList.assertIsOwned(oldOp);
|
|
13313
|
+
const listId = oldOp.debugListId;
|
|
13314
|
+
oldOp.debugListId = null;
|
|
13315
|
+
for (const newOp of newOps) {
|
|
13316
|
+
_OpList.assertIsNotEnd(newOp);
|
|
13317
|
+
_OpList.assertIsUnowned(newOp);
|
|
13318
|
+
}
|
|
13319
|
+
const { prev: oldPrev, next: oldNext } = oldOp;
|
|
13320
|
+
oldOp.prev = null;
|
|
13321
|
+
oldOp.next = null;
|
|
13322
|
+
let prev = oldPrev;
|
|
13323
|
+
for (const newOp of newOps) {
|
|
13324
|
+
this.assertIsUnowned(newOp);
|
|
13325
|
+
newOp.debugListId = listId;
|
|
13326
|
+
prev.next = newOp;
|
|
13327
|
+
newOp.prev = prev;
|
|
13328
|
+
newOp.next = null;
|
|
13329
|
+
prev = newOp;
|
|
13330
|
+
}
|
|
13331
|
+
const first = newOps[0];
|
|
13332
|
+
const last = prev;
|
|
13333
|
+
if (oldPrev !== null) {
|
|
13334
|
+
oldPrev.next = first;
|
|
13335
|
+
first.prev = oldOp.prev;
|
|
13336
|
+
}
|
|
13337
|
+
if (oldNext !== null) {
|
|
13338
|
+
oldNext.prev = last;
|
|
13339
|
+
last.next = oldNext;
|
|
13340
|
+
}
|
|
13341
|
+
}
|
|
13342
|
+
static remove(op) {
|
|
13343
|
+
_OpList.assertIsNotEnd(op);
|
|
13344
|
+
_OpList.assertIsOwned(op);
|
|
13345
|
+
op.prev.next = op.next;
|
|
13346
|
+
op.next.prev = op.prev;
|
|
13347
|
+
op.debugListId = null;
|
|
13348
|
+
op.prev = null;
|
|
13349
|
+
op.next = null;
|
|
13350
|
+
}
|
|
13351
|
+
static insertBefore(op, before) {
|
|
13352
|
+
_OpList.assertIsNotEnd(before);
|
|
13353
|
+
_OpList.assertIsNotEnd(op);
|
|
13354
|
+
_OpList.assertIsUnowned(op);
|
|
13355
|
+
_OpList.assertIsOwned(before);
|
|
13356
|
+
op.debugListId = before.debugListId;
|
|
13357
|
+
op.prev = null;
|
|
13358
|
+
before.prev.next = op;
|
|
13359
|
+
op.prev = before.prev;
|
|
13360
|
+
op.next = before;
|
|
13361
|
+
before.prev = op;
|
|
13362
|
+
}
|
|
13363
|
+
static assertIsUnowned(op) {
|
|
13364
|
+
if (op.debugListId !== null) {
|
|
13365
|
+
throw new Error(`AssertionError: illegal operation on owned node: ${OpKind[op.kind]}`);
|
|
13366
|
+
}
|
|
13367
|
+
}
|
|
13368
|
+
static assertIsOwned(op, byList) {
|
|
13369
|
+
if (op.debugListId === null) {
|
|
13370
|
+
throw new Error(`AssertionError: illegal operation on unowned node: ${OpKind[op.kind]}`);
|
|
13371
|
+
} else if (byList !== void 0 && op.debugListId !== byList) {
|
|
13372
|
+
throw new Error(`AssertionError: node belongs to the wrong list (expected ${byList}, actual ${op.debugListId})`);
|
|
13373
|
+
}
|
|
13374
|
+
}
|
|
13375
|
+
static assertIsNotEnd(op) {
|
|
13376
|
+
if (op.kind === OpKind.ListEnd) {
|
|
13377
|
+
throw new Error(`AssertionError: illegal operation on list head or tail`);
|
|
13378
|
+
}
|
|
13379
|
+
}
|
|
13380
|
+
};
|
|
13381
|
+
var OpList = _OpList;
|
|
13382
|
+
(() => {
|
|
13383
|
+
_OpList.nextListId = 0;
|
|
13384
|
+
})();
|
|
13385
|
+
function createStatementOp(statement) {
|
|
13386
|
+
return __spreadValues({
|
|
13387
|
+
kind: OpKind.Statement,
|
|
13388
|
+
statement
|
|
13389
|
+
}, NEW_OP);
|
|
13390
|
+
}
|
|
13391
|
+
function createVariableOp(xref, variable2, initializer) {
|
|
13392
|
+
return __spreadValues({
|
|
13393
|
+
kind: OpKind.Variable,
|
|
13394
|
+
xref,
|
|
13395
|
+
variable: variable2,
|
|
13396
|
+
initializer
|
|
13397
|
+
}, NEW_OP);
|
|
13398
|
+
}
|
|
13399
|
+
var NEW_OP = {
|
|
13400
|
+
debugListId: null,
|
|
13401
|
+
prev: null,
|
|
13402
|
+
next: null
|
|
13403
|
+
};
|
|
13404
|
+
function createElementStartOp(tag, xref) {
|
|
13405
|
+
return __spreadValues(__spreadValues({
|
|
13406
|
+
kind: OpKind.ElementStart,
|
|
13407
|
+
xref,
|
|
13408
|
+
tag,
|
|
13409
|
+
attributes: new ElementAttributes(),
|
|
13410
|
+
localRefs: []
|
|
13411
|
+
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
13412
|
+
}
|
|
13413
|
+
function createTemplateOp(xref, tag) {
|
|
13414
|
+
return __spreadValues(__spreadValues({
|
|
13415
|
+
kind: OpKind.Template,
|
|
13416
|
+
xref,
|
|
13417
|
+
attributes: new ElementAttributes(),
|
|
13418
|
+
tag,
|
|
13419
|
+
decls: null,
|
|
13420
|
+
vars: null,
|
|
13421
|
+
localRefs: []
|
|
13422
|
+
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
13423
|
+
}
|
|
13424
|
+
function createElementEndOp(xref) {
|
|
13425
|
+
return __spreadValues({
|
|
13426
|
+
kind: OpKind.ElementEnd,
|
|
13427
|
+
xref
|
|
13428
|
+
}, NEW_OP);
|
|
13429
|
+
}
|
|
13430
|
+
function createTextOp(xref, initialValue) {
|
|
13431
|
+
return __spreadValues(__spreadValues({
|
|
13432
|
+
kind: OpKind.Text,
|
|
13433
|
+
xref,
|
|
13434
|
+
initialValue
|
|
13435
|
+
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
13436
|
+
}
|
|
13437
|
+
function createListenerOp(target, name, tag) {
|
|
13438
|
+
return __spreadValues(__spreadValues({
|
|
13439
|
+
kind: OpKind.Listener,
|
|
13440
|
+
target,
|
|
13441
|
+
tag,
|
|
13442
|
+
name,
|
|
13443
|
+
handlerOps: new OpList(),
|
|
13444
|
+
handlerFnName: null
|
|
13445
|
+
}, NEW_OP), TRAIT_USES_SLOT_INDEX);
|
|
13446
|
+
}
|
|
13447
|
+
function createInterpolateTextOp(xref, strings, expressions) {
|
|
13448
|
+
return __spreadValues(__spreadValues(__spreadValues({
|
|
13449
|
+
kind: OpKind.InterpolateText,
|
|
13450
|
+
target: xref,
|
|
13451
|
+
strings,
|
|
13452
|
+
expressions
|
|
13453
|
+
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
13454
|
+
}
|
|
13455
|
+
function createPropertyOp(xref, name, expression) {
|
|
13456
|
+
return __spreadValues(__spreadValues(__spreadValues({
|
|
13457
|
+
kind: OpKind.Property,
|
|
13458
|
+
target: xref,
|
|
13459
|
+
name,
|
|
13460
|
+
expression
|
|
13461
|
+
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
13462
|
+
}
|
|
13463
|
+
function createAdvanceOp(delta) {
|
|
13464
|
+
return __spreadValues({
|
|
13465
|
+
kind: OpKind.Advance,
|
|
13466
|
+
delta
|
|
13467
|
+
}, NEW_OP);
|
|
13468
|
+
}
|
|
13469
|
+
function phaseConstCollection(cpl) {
|
|
13470
|
+
for (const [_, view] of cpl.views) {
|
|
13471
|
+
for (const op of view.create) {
|
|
13472
|
+
if (op.kind !== OpKind.ElementStart && op.kind !== OpKind.Element && op.kind !== OpKind.Template) {
|
|
13473
|
+
continue;
|
|
13474
|
+
} else if (!(op.attributes instanceof ElementAttributes)) {
|
|
13475
|
+
continue;
|
|
13476
|
+
}
|
|
13477
|
+
const attrArray = serializeAttributes(op.attributes);
|
|
13478
|
+
if (attrArray.entries.length > 0) {
|
|
13479
|
+
op.attributes = cpl.addConst(attrArray);
|
|
13480
|
+
} else {
|
|
13481
|
+
op.attributes = null;
|
|
13482
|
+
}
|
|
13483
|
+
}
|
|
13484
|
+
}
|
|
13485
|
+
}
|
|
13486
|
+
function serializeAttributes({ attributes, bindings, classes, i18n, projectAs, styles, template: template2 }) {
|
|
13487
|
+
const attrArray = [...attributes];
|
|
13488
|
+
if (projectAs !== null) {
|
|
13489
|
+
attrArray.push(literal(5), literal(projectAs));
|
|
13490
|
+
}
|
|
13491
|
+
if (classes.length > 0) {
|
|
13492
|
+
attrArray.push(literal(1), ...classes);
|
|
13493
|
+
}
|
|
13494
|
+
if (styles.length > 0) {
|
|
13495
|
+
attrArray.push(literal(2), ...styles);
|
|
13496
|
+
}
|
|
13497
|
+
if (bindings.length > 0) {
|
|
13498
|
+
attrArray.push(literal(3), ...bindings);
|
|
13499
|
+
}
|
|
13500
|
+
if (template2.length > 0) {
|
|
13501
|
+
attrArray.push(literal(4), ...template2);
|
|
13502
|
+
}
|
|
13503
|
+
if (i18n.length > 0) {
|
|
13504
|
+
attrArray.push(literal(6), ...i18n);
|
|
13505
|
+
}
|
|
13506
|
+
return literalArr(attrArray);
|
|
13507
|
+
}
|
|
13508
|
+
function phaseEmptyElements(cpl) {
|
|
13509
|
+
for (const [_, view] of cpl.views) {
|
|
13510
|
+
for (const op of view.create) {
|
|
13511
|
+
if (op.kind === OpKind.ElementEnd && op.prev !== null && op.prev.kind === OpKind.ElementStart) {
|
|
13512
|
+
op.prev.kind = OpKind.Element;
|
|
13513
|
+
OpList.remove(op);
|
|
13514
|
+
}
|
|
13515
|
+
}
|
|
13516
|
+
}
|
|
13517
|
+
}
|
|
13518
|
+
function phaseGenerateAdvance(cpl) {
|
|
13519
|
+
for (const [_, view] of cpl.views) {
|
|
13520
|
+
const slotMap = /* @__PURE__ */ new Map();
|
|
13521
|
+
for (const op of view.create) {
|
|
13522
|
+
if (!hasConsumesSlotTrait(op)) {
|
|
13523
|
+
continue;
|
|
13524
|
+
} else if (op.slot === null) {
|
|
13525
|
+
throw new Error(`AssertionError: expected slots to have been allocated before generating advance() calls`);
|
|
13526
|
+
}
|
|
13527
|
+
slotMap.set(op.xref, op.slot);
|
|
13528
|
+
}
|
|
13529
|
+
let slotContext = 0;
|
|
13530
|
+
for (const op of view.update) {
|
|
13531
|
+
if (!hasDependsOnSlotContextTrait(op)) {
|
|
13532
|
+
continue;
|
|
13533
|
+
} else if (!slotMap.has(op.target)) {
|
|
13534
|
+
throw new Error(`AssertionError: reference to unknown slot for var ${op.target}`);
|
|
13535
|
+
}
|
|
13536
|
+
const slot = slotMap.get(op.target);
|
|
13537
|
+
if (slotContext !== slot) {
|
|
13538
|
+
const delta = slot - slotContext;
|
|
13539
|
+
if (delta < 0) {
|
|
13540
|
+
throw new Error(`AssertionError: slot counter should never need to move backwards`);
|
|
13541
|
+
}
|
|
13542
|
+
OpList.insertBefore(createAdvanceOp(delta), op);
|
|
13543
|
+
slotContext = slot;
|
|
13544
|
+
}
|
|
13545
|
+
}
|
|
13546
|
+
}
|
|
13547
|
+
}
|
|
13548
|
+
function element(slot, tag, constIndex, localRefIndex) {
|
|
13549
|
+
return elementStartBase(Identifiers.element, slot, tag, constIndex, localRefIndex);
|
|
13550
|
+
}
|
|
13551
|
+
function elementStart(slot, tag, constIndex, localRefIndex) {
|
|
13552
|
+
return elementStartBase(Identifiers.elementStart, slot, tag, constIndex, localRefIndex);
|
|
13553
|
+
}
|
|
13554
|
+
function elementStartBase(instruction, slot, tag, constIndex, localRefIndex) {
|
|
13555
|
+
const args = [
|
|
13556
|
+
literal(slot),
|
|
13557
|
+
literal(tag)
|
|
13558
|
+
];
|
|
13559
|
+
if (localRefIndex !== null) {
|
|
13560
|
+
args.push(
|
|
13561
|
+
literal(constIndex),
|
|
13562
|
+
literal(localRefIndex)
|
|
13563
|
+
);
|
|
13564
|
+
} else if (constIndex !== null) {
|
|
13565
|
+
args.push(literal(constIndex));
|
|
13566
|
+
}
|
|
13567
|
+
return call(instruction, args);
|
|
13568
|
+
}
|
|
13569
|
+
function elementEnd() {
|
|
13570
|
+
return call(Identifiers.elementEnd, []);
|
|
13571
|
+
}
|
|
13572
|
+
function template(slot, templateFnRef, decls, vars, tag, constIndex) {
|
|
13573
|
+
return call(Identifiers.templateCreate, [
|
|
13574
|
+
literal(slot),
|
|
13575
|
+
templateFnRef,
|
|
13576
|
+
literal(decls),
|
|
13577
|
+
literal(vars),
|
|
13578
|
+
literal(tag),
|
|
13579
|
+
literal(constIndex)
|
|
13580
|
+
]);
|
|
13581
|
+
}
|
|
13582
|
+
function listener(name, handlerFn) {
|
|
13583
|
+
return call(Identifiers.listener, [
|
|
13584
|
+
literal(name),
|
|
13585
|
+
handlerFn
|
|
13586
|
+
]);
|
|
13587
|
+
}
|
|
13588
|
+
function advance(delta) {
|
|
13589
|
+
return call(Identifiers.advance, [
|
|
13590
|
+
literal(delta)
|
|
13591
|
+
]);
|
|
13592
|
+
}
|
|
13593
|
+
function reference(slot) {
|
|
13594
|
+
return importExpr(Identifiers.reference).callFn([
|
|
13595
|
+
literal(slot)
|
|
13596
|
+
]);
|
|
13597
|
+
}
|
|
13598
|
+
function nextContext(steps) {
|
|
13599
|
+
return importExpr(Identifiers.nextContext).callFn(steps === 1 ? [] : [literal(steps)]);
|
|
13600
|
+
}
|
|
13601
|
+
function getCurrentView() {
|
|
13602
|
+
return importExpr(Identifiers.getCurrentView).callFn([]);
|
|
13603
|
+
}
|
|
13604
|
+
function restoreView(savedView) {
|
|
13605
|
+
return importExpr(Identifiers.restoreView).callFn([
|
|
13606
|
+
savedView
|
|
13607
|
+
]);
|
|
13608
|
+
}
|
|
13609
|
+
function resetView(returnValue) {
|
|
13610
|
+
return importExpr(Identifiers.resetView).callFn([
|
|
13611
|
+
returnValue
|
|
13612
|
+
]);
|
|
13613
|
+
}
|
|
13614
|
+
function text(slot, initialValue) {
|
|
13615
|
+
const args = [literal(slot)];
|
|
13616
|
+
if (initialValue !== "") {
|
|
13617
|
+
args.push(literal(initialValue));
|
|
13618
|
+
}
|
|
13619
|
+
return call(Identifiers.text, args);
|
|
13620
|
+
}
|
|
13621
|
+
function property(name, expression) {
|
|
13622
|
+
return call(Identifiers.property, [
|
|
13623
|
+
literal(name),
|
|
13624
|
+
expression
|
|
13625
|
+
]);
|
|
13626
|
+
}
|
|
13627
|
+
function textInterpolate(strings, expressions) {
|
|
13628
|
+
if (strings.length < 1 || expressions.length !== strings.length - 1) {
|
|
13629
|
+
throw new Error(`AssertionError: expected specific shape of args for strings/expressions in interpolation`);
|
|
13630
|
+
}
|
|
13631
|
+
const interpolationArgs = [];
|
|
13632
|
+
if (expressions.length === 1 && strings[0] === "" && strings[1] === "") {
|
|
13633
|
+
interpolationArgs.push(expressions[0]);
|
|
13634
|
+
} else {
|
|
13635
|
+
let idx;
|
|
13636
|
+
for (idx = 0; idx < expressions.length; idx++) {
|
|
13637
|
+
interpolationArgs.push(literal(strings[idx]), expressions[idx]);
|
|
13638
|
+
}
|
|
13639
|
+
interpolationArgs.push(literal(strings[idx]));
|
|
13640
|
+
}
|
|
13641
|
+
return callInterpolation(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs);
|
|
13642
|
+
}
|
|
13643
|
+
function call(instruction, args) {
|
|
13644
|
+
return createStatementOp(importExpr(instruction).callFn(args).toStmt());
|
|
13645
|
+
}
|
|
13646
|
+
var TEXT_INTERPOLATE_CONFIG = {
|
|
13647
|
+
constant: [
|
|
13648
|
+
Identifiers.textInterpolate,
|
|
13649
|
+
Identifiers.textInterpolate1,
|
|
13650
|
+
Identifiers.textInterpolate2,
|
|
13651
|
+
Identifiers.textInterpolate3,
|
|
13652
|
+
Identifiers.textInterpolate4,
|
|
13653
|
+
Identifiers.textInterpolate5,
|
|
13654
|
+
Identifiers.textInterpolate6,
|
|
13655
|
+
Identifiers.textInterpolate7,
|
|
13656
|
+
Identifiers.textInterpolate8
|
|
13657
|
+
],
|
|
13658
|
+
variable: Identifiers.textInterpolateV
|
|
13659
|
+
};
|
|
13660
|
+
function callInterpolation(config, baseArgs, interpolationArgs) {
|
|
13661
|
+
if (interpolationArgs.length % 2 === 0) {
|
|
13662
|
+
throw new Error(`Expected odd number of interpolation arguments`);
|
|
13663
|
+
}
|
|
13664
|
+
const n = (interpolationArgs.length - 1) / 2;
|
|
13665
|
+
if (n < config.constant.length) {
|
|
13666
|
+
return call(config.constant[n], [...baseArgs, ...interpolationArgs]);
|
|
13667
|
+
} else {
|
|
13668
|
+
return call(config.variable, [...baseArgs, literalArr(interpolationArgs)]);
|
|
13669
|
+
}
|
|
13670
|
+
}
|
|
13671
|
+
function phaseReify(cpl) {
|
|
13672
|
+
for (const [_, view] of cpl.views) {
|
|
13673
|
+
reifyCreateOperations(view, view.create);
|
|
13674
|
+
reifyUpdateOperations(view, view.update);
|
|
13675
|
+
}
|
|
13676
|
+
}
|
|
13677
|
+
function reifyCreateOperations(view, ops) {
|
|
13678
|
+
for (const op of ops) {
|
|
13679
|
+
transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
|
|
13680
|
+
switch (op.kind) {
|
|
13681
|
+
case OpKind.Text:
|
|
13682
|
+
OpList.replace(op, text(op.slot, op.initialValue));
|
|
13683
|
+
break;
|
|
13684
|
+
case OpKind.ElementStart:
|
|
13685
|
+
OpList.replace(op, elementStart(op.slot, op.tag, op.attributes, op.localRefs));
|
|
13686
|
+
break;
|
|
13687
|
+
case OpKind.Element:
|
|
13688
|
+
OpList.replace(op, element(op.slot, op.tag, op.attributes, op.localRefs));
|
|
13689
|
+
break;
|
|
13690
|
+
case OpKind.ElementEnd:
|
|
13691
|
+
OpList.replace(op, elementEnd());
|
|
13692
|
+
break;
|
|
13693
|
+
case OpKind.Template:
|
|
13694
|
+
const childView = view.tpl.views.get(op.xref);
|
|
13695
|
+
OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes));
|
|
13696
|
+
break;
|
|
13697
|
+
case OpKind.Listener:
|
|
13698
|
+
const listenerFn = reifyListenerHandler(view, op.handlerFnName, op.handlerOps);
|
|
13699
|
+
OpList.replace(op, listener(op.name, listenerFn));
|
|
13700
|
+
break;
|
|
13701
|
+
case OpKind.Variable:
|
|
13702
|
+
if (op.variable.name === null) {
|
|
13703
|
+
throw new Error(`AssertionError: unnamed variable ${op.xref}`);
|
|
13704
|
+
}
|
|
13705
|
+
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer, void 0, StmtModifier.Final)));
|
|
13706
|
+
break;
|
|
13707
|
+
case OpKind.Statement:
|
|
13708
|
+
break;
|
|
13709
|
+
default:
|
|
13710
|
+
throw new Error(`AssertionError: Unsupported reification of create op ${OpKind[op.kind]}`);
|
|
13711
|
+
}
|
|
13712
|
+
}
|
|
13713
|
+
}
|
|
13714
|
+
function reifyUpdateOperations(_view, ops) {
|
|
13715
|
+
for (const op of ops) {
|
|
13716
|
+
transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
|
|
13717
|
+
switch (op.kind) {
|
|
13718
|
+
case OpKind.Advance:
|
|
13719
|
+
OpList.replace(op, advance(op.delta));
|
|
13720
|
+
break;
|
|
13721
|
+
case OpKind.Property:
|
|
13722
|
+
OpList.replace(op, property(op.name, op.expression));
|
|
13723
|
+
break;
|
|
13724
|
+
case OpKind.InterpolateText:
|
|
13725
|
+
OpList.replace(op, textInterpolate(op.strings, op.expressions));
|
|
13726
|
+
break;
|
|
13727
|
+
case OpKind.Variable:
|
|
13728
|
+
if (op.variable.name === null) {
|
|
13729
|
+
throw new Error(`AssertionError: unnamed variable ${op.xref}`);
|
|
13730
|
+
}
|
|
13731
|
+
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer, void 0, StmtModifier.Final)));
|
|
13732
|
+
break;
|
|
13733
|
+
case OpKind.Statement:
|
|
13734
|
+
break;
|
|
13735
|
+
default:
|
|
13736
|
+
throw new Error(`AssertionError: Unsupported reification of update op ${OpKind[op.kind]}`);
|
|
13737
|
+
}
|
|
13738
|
+
}
|
|
13739
|
+
}
|
|
13740
|
+
function reifyIrExpression(expr) {
|
|
13741
|
+
switch (expr.kind) {
|
|
13742
|
+
case ExpressionKind.NextContext:
|
|
13743
|
+
return nextContext(expr.steps);
|
|
13744
|
+
case ExpressionKind.Reference:
|
|
13745
|
+
return reference(expr.slot + 1 + expr.offset);
|
|
13746
|
+
case ExpressionKind.LexicalRead:
|
|
13747
|
+
throw new Error(`AssertionError: unresolved LexicalRead of ${expr.name}`);
|
|
13748
|
+
case ExpressionKind.RestoreView:
|
|
13749
|
+
if (typeof expr.view === "number") {
|
|
13750
|
+
throw new Error(`AssertionError: unresolved RestoreView`);
|
|
13751
|
+
}
|
|
13752
|
+
return restoreView(expr.view);
|
|
13753
|
+
case ExpressionKind.ResetView:
|
|
13754
|
+
return resetView(expr.expr);
|
|
13755
|
+
case ExpressionKind.GetCurrentView:
|
|
13756
|
+
return getCurrentView();
|
|
13757
|
+
case ExpressionKind.ReadVariable:
|
|
13758
|
+
if (expr.name === null) {
|
|
13759
|
+
throw new Error(`Read of unnamed variable ${expr.xref}`);
|
|
13760
|
+
}
|
|
13761
|
+
return variable(expr.name);
|
|
13762
|
+
default:
|
|
13763
|
+
throw new Error(`AssertionError: Unsupported reification of ir.Expression kind: ${ExpressionKind[expr.kind]}`);
|
|
13764
|
+
}
|
|
13765
|
+
}
|
|
13766
|
+
function reifyListenerHandler(view, name, handlerOps) {
|
|
13767
|
+
const lookForEvent = new LookForEventVisitor();
|
|
13768
|
+
reifyUpdateOperations(view, handlerOps);
|
|
13769
|
+
const handlerStmts = [];
|
|
13770
|
+
for (const op of handlerOps) {
|
|
13771
|
+
if (op.kind !== OpKind.Statement) {
|
|
13772
|
+
throw new Error(`AssertionError: expected reified statements, but found op ${OpKind[op.kind]}`);
|
|
13773
|
+
}
|
|
13774
|
+
handlerStmts.push(op.statement);
|
|
13775
|
+
}
|
|
13776
|
+
lookForEvent.visitAllStatements(handlerStmts, null);
|
|
13777
|
+
const params = [];
|
|
13778
|
+
if (lookForEvent.seenEventRead) {
|
|
13779
|
+
params.push(new FnParam("$event"));
|
|
13780
|
+
}
|
|
13781
|
+
return fn(params, handlerStmts, void 0, void 0, name);
|
|
13782
|
+
}
|
|
13783
|
+
var LookForEventVisitor = class extends RecursiveAstVisitor$1 {
|
|
13784
|
+
constructor() {
|
|
13785
|
+
super(...arguments);
|
|
13786
|
+
this.seenEventRead = false;
|
|
13787
|
+
}
|
|
13788
|
+
visitReadVarExpr(ast, context) {
|
|
13789
|
+
if (ast.name === "$event") {
|
|
13790
|
+
this.seenEventRead = true;
|
|
13791
|
+
}
|
|
13792
|
+
}
|
|
13793
|
+
};
|
|
13794
|
+
function phaseSlotAllocation(cpl) {
|
|
13795
|
+
const slotMap = /* @__PURE__ */ new Map();
|
|
13796
|
+
for (const [_, view] of cpl.views) {
|
|
13797
|
+
let slotCount = 0;
|
|
13798
|
+
for (const op of view.create) {
|
|
13799
|
+
if (!hasConsumesSlotTrait(op)) {
|
|
13800
|
+
continue;
|
|
13801
|
+
}
|
|
13802
|
+
op.slot = slotCount;
|
|
13803
|
+
slotMap.set(op.xref, op.slot);
|
|
13804
|
+
slotCount += op.numSlotsUsed;
|
|
13805
|
+
}
|
|
13806
|
+
view.decls = slotCount;
|
|
13807
|
+
}
|
|
13808
|
+
for (const [_, view] of cpl.views) {
|
|
13809
|
+
for (const op of view.ops()) {
|
|
13810
|
+
if (op.kind === OpKind.Template) {
|
|
13811
|
+
const childView = cpl.views.get(op.xref);
|
|
13812
|
+
op.decls = childView.decls;
|
|
13813
|
+
}
|
|
13814
|
+
if (hasUsesSlotIndexTrait(op) && op.slot === null) {
|
|
13815
|
+
if (!slotMap.has(op.target)) {
|
|
13816
|
+
throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
|
|
13817
|
+
}
|
|
13818
|
+
op.slot = slotMap.get(op.target);
|
|
13819
|
+
}
|
|
13820
|
+
visitExpressionsInOp(op, (expr) => {
|
|
13821
|
+
if (!hasUsesSlotIndexTrait(expr) || expr.slot !== null) {
|
|
13822
|
+
return;
|
|
13823
|
+
}
|
|
13824
|
+
if (!slotMap.has(expr.target)) {
|
|
13825
|
+
throw new Error(`AssertionError: no slot allocated for ${expr.constructor.name} target ${expr.target}`);
|
|
13826
|
+
}
|
|
13827
|
+
expr.slot = slotMap.get(expr.target);
|
|
13828
|
+
});
|
|
13829
|
+
}
|
|
13830
|
+
}
|
|
13831
|
+
}
|
|
13832
|
+
function phaseVarCounting(cpl) {
|
|
13833
|
+
for (const [_, view] of cpl.views) {
|
|
13834
|
+
let varCount = 0;
|
|
13835
|
+
for (const op of view.ops()) {
|
|
13836
|
+
if (hasConsumesVarsTrait(op)) {
|
|
13837
|
+
varCount += varsUsedByOp(op);
|
|
13838
|
+
}
|
|
13839
|
+
visitExpressionsInOp(op, (expr) => {
|
|
13840
|
+
if (hasConsumesVarsTrait(expr)) {
|
|
13841
|
+
varCount += varsUsedByIrExpression(expr);
|
|
13842
|
+
}
|
|
13843
|
+
});
|
|
13844
|
+
}
|
|
13845
|
+
view.vars = varCount;
|
|
13846
|
+
}
|
|
13847
|
+
for (const [_, view] of cpl.views) {
|
|
13848
|
+
for (const op of view.create) {
|
|
13849
|
+
if (op.kind !== OpKind.Template) {
|
|
13850
|
+
continue;
|
|
13851
|
+
}
|
|
13852
|
+
const childView = cpl.views.get(op.xref);
|
|
13853
|
+
op.vars = childView.vars;
|
|
13854
|
+
}
|
|
13855
|
+
}
|
|
13856
|
+
}
|
|
13857
|
+
function varsUsedByOp(op) {
|
|
13858
|
+
switch (op.kind) {
|
|
13859
|
+
case OpKind.Property:
|
|
13860
|
+
return 1;
|
|
13861
|
+
case OpKind.InterpolateText:
|
|
13862
|
+
return op.expressions.length;
|
|
13863
|
+
default:
|
|
13864
|
+
throw new Error(`Unhandled op: ${OpKind[op.kind]}`);
|
|
13865
|
+
}
|
|
13866
|
+
}
|
|
13867
|
+
function varsUsedByIrExpression(expr) {
|
|
13868
|
+
return 0;
|
|
13869
|
+
}
|
|
13870
|
+
function phaseNaming(cpl) {
|
|
13871
|
+
addNamesToView(cpl.root, cpl.componentName, { index: 0 });
|
|
13872
|
+
}
|
|
13873
|
+
function addNamesToView(view, baseName, state) {
|
|
13874
|
+
if (view.fnName === null) {
|
|
13875
|
+
view.fnName = `${baseName}_Template`;
|
|
13876
|
+
}
|
|
13877
|
+
const varNames = /* @__PURE__ */ new Map();
|
|
13878
|
+
for (const op of view.ops()) {
|
|
13879
|
+
switch (op.kind) {
|
|
13880
|
+
case OpKind.Listener:
|
|
13881
|
+
if (op.handlerFnName === null) {
|
|
13882
|
+
if (op.slot === null) {
|
|
13883
|
+
throw new Error(`Expected a slot to be assigned`);
|
|
13884
|
+
}
|
|
13885
|
+
op.handlerFnName = `${view.fnName}_${op.tag}_${op.name}_${op.slot}_listener`;
|
|
13886
|
+
}
|
|
13887
|
+
break;
|
|
13888
|
+
case OpKind.Variable:
|
|
13889
|
+
varNames.set(op.xref, getVariableName(op.variable, state));
|
|
13890
|
+
break;
|
|
13891
|
+
case OpKind.Template:
|
|
13892
|
+
const childView = view.tpl.views.get(op.xref);
|
|
13893
|
+
if (op.slot === null) {
|
|
13894
|
+
throw new Error(`Expected slot to be assigned`);
|
|
13895
|
+
}
|
|
13896
|
+
const safeTagName = op.tag.replace("-", "_");
|
|
13897
|
+
addNamesToView(childView, `${baseName}_${safeTagName}_${op.slot}`, state);
|
|
13898
|
+
break;
|
|
13899
|
+
}
|
|
13900
|
+
}
|
|
13901
|
+
for (const op of view.ops()) {
|
|
13902
|
+
visitExpressionsInOp(op, (expr) => {
|
|
13903
|
+
if (!(expr instanceof ReadVariableExpr) || expr.name !== null) {
|
|
13904
|
+
return;
|
|
13905
|
+
}
|
|
13906
|
+
if (!varNames.has(expr.xref)) {
|
|
13907
|
+
throw new Error(`Variable ${expr.xref} not yet named`);
|
|
13908
|
+
}
|
|
13909
|
+
expr.name = varNames.get(expr.xref);
|
|
13910
|
+
});
|
|
13911
|
+
}
|
|
13912
|
+
}
|
|
13913
|
+
function getVariableName(variable2, state) {
|
|
13914
|
+
if (variable2.name === null) {
|
|
13915
|
+
switch (variable2.kind) {
|
|
13916
|
+
case SemanticVariableKind.Identifier:
|
|
13917
|
+
variable2.name = `${variable2.identifier}_${state.index++}`;
|
|
13918
|
+
break;
|
|
13919
|
+
default:
|
|
13920
|
+
variable2.name = `_r${state.index++}`;
|
|
13921
|
+
break;
|
|
13922
|
+
}
|
|
13923
|
+
}
|
|
13924
|
+
return variable2.name;
|
|
13925
|
+
}
|
|
13926
|
+
function phaseLocalRefs(cpl) {
|
|
13927
|
+
for (const view of cpl.views.values()) {
|
|
13928
|
+
for (const op of view.create) {
|
|
13929
|
+
switch (op.kind) {
|
|
13930
|
+
case OpKind.ElementStart:
|
|
13931
|
+
case OpKind.Element:
|
|
13932
|
+
case OpKind.Template:
|
|
13933
|
+
if (!Array.isArray(op.localRefs)) {
|
|
13934
|
+
throw new Error(`AssertionError: expected localRefs to be an array still`);
|
|
13935
|
+
}
|
|
13936
|
+
op.numSlotsUsed += op.localRefs.length;
|
|
13937
|
+
if (op.localRefs.length > 0) {
|
|
13938
|
+
const localRefs = serializeLocalRefs(op.localRefs);
|
|
13939
|
+
op.localRefs = cpl.addConst(localRefs);
|
|
13940
|
+
} else {
|
|
13941
|
+
op.localRefs = null;
|
|
13942
|
+
}
|
|
13943
|
+
break;
|
|
13944
|
+
}
|
|
13945
|
+
}
|
|
13946
|
+
}
|
|
13947
|
+
}
|
|
13948
|
+
function serializeLocalRefs(refs) {
|
|
13949
|
+
const constRefs = [];
|
|
13950
|
+
for (const ref of refs) {
|
|
13951
|
+
constRefs.push(literal(ref.name), literal(ref.target));
|
|
13952
|
+
}
|
|
13953
|
+
return literalArr(constRefs);
|
|
13954
|
+
}
|
|
13955
|
+
function phaseGenerateVariables(cpl) {
|
|
13956
|
+
recursivelyProcessView(cpl.root, null);
|
|
13957
|
+
}
|
|
13958
|
+
function recursivelyProcessView(view, parentScope) {
|
|
13959
|
+
const scope = getScopeForView(view, parentScope);
|
|
13960
|
+
view.create.prepend([
|
|
13961
|
+
createVariableOp(view.tpl.allocateXrefId(), scope.savedViewVariable, new GetCurrentViewExpr())
|
|
13962
|
+
]);
|
|
13963
|
+
for (const op of view.create) {
|
|
13964
|
+
switch (op.kind) {
|
|
13965
|
+
case OpKind.Template:
|
|
13966
|
+
recursivelyProcessView(view.tpl.views.get(op.xref), scope);
|
|
13967
|
+
break;
|
|
13968
|
+
case OpKind.Listener:
|
|
13969
|
+
const preambleOps2 = [
|
|
13970
|
+
createVariableOp(view.tpl.allocateXrefId(), scope.viewContextVariable, new RestoreViewExpr(view.xref)),
|
|
13971
|
+
...generateVariablesInScopeForView(view, scope)
|
|
13972
|
+
];
|
|
13973
|
+
op.handlerOps.prepend(preambleOps2);
|
|
13974
|
+
for (const handlerOp of op.handlerOps) {
|
|
13975
|
+
if (handlerOp.kind === OpKind.Statement && handlerOp.statement instanceof ReturnStatement) {
|
|
13976
|
+
handlerOp.statement.value = new ResetViewExpr(handlerOp.statement.value);
|
|
13977
|
+
}
|
|
13978
|
+
}
|
|
13979
|
+
break;
|
|
13980
|
+
}
|
|
13981
|
+
}
|
|
13982
|
+
const preambleOps = generateVariablesInScopeForView(view, scope);
|
|
13983
|
+
view.update.prepend(preambleOps);
|
|
13984
|
+
}
|
|
13985
|
+
function getScopeForView(view, parent) {
|
|
13986
|
+
const scope = {
|
|
13987
|
+
view: view.xref,
|
|
13988
|
+
viewContextVariable: {
|
|
13989
|
+
kind: SemanticVariableKind.Context,
|
|
13990
|
+
name: null,
|
|
13991
|
+
view: view.xref
|
|
13992
|
+
},
|
|
13993
|
+
savedViewVariable: {
|
|
13994
|
+
kind: SemanticVariableKind.SavedView,
|
|
13995
|
+
name: null,
|
|
13996
|
+
view: view.xref
|
|
13997
|
+
},
|
|
13998
|
+
contextVariables: /* @__PURE__ */ new Map(),
|
|
13999
|
+
references: [],
|
|
14000
|
+
parent
|
|
14001
|
+
};
|
|
14002
|
+
for (const identifier of view.contextVariables.keys()) {
|
|
14003
|
+
scope.contextVariables.set(identifier, {
|
|
14004
|
+
kind: SemanticVariableKind.Identifier,
|
|
14005
|
+
name: null,
|
|
14006
|
+
identifier
|
|
14007
|
+
});
|
|
14008
|
+
}
|
|
14009
|
+
for (const op of view.create) {
|
|
14010
|
+
switch (op.kind) {
|
|
14011
|
+
case OpKind.Element:
|
|
14012
|
+
case OpKind.ElementStart:
|
|
14013
|
+
case OpKind.Template:
|
|
14014
|
+
if (!Array.isArray(op.localRefs)) {
|
|
14015
|
+
throw new Error(`AssertionError: expected localRefs to be an array`);
|
|
14016
|
+
}
|
|
14017
|
+
for (let offset = 0; offset < op.localRefs.length; offset++) {
|
|
14018
|
+
scope.references.push({
|
|
14019
|
+
name: op.localRefs[offset].name,
|
|
14020
|
+
targetId: op.xref,
|
|
14021
|
+
offset,
|
|
14022
|
+
variable: {
|
|
14023
|
+
kind: SemanticVariableKind.Identifier,
|
|
14024
|
+
name: null,
|
|
14025
|
+
identifier: op.localRefs[offset].name
|
|
14026
|
+
}
|
|
14027
|
+
});
|
|
14028
|
+
}
|
|
14029
|
+
break;
|
|
14030
|
+
}
|
|
14031
|
+
}
|
|
14032
|
+
return scope;
|
|
14033
|
+
}
|
|
14034
|
+
function generateVariablesInScopeForView(view, scope) {
|
|
14035
|
+
const newOps = [];
|
|
14036
|
+
if (scope.view !== view.xref) {
|
|
14037
|
+
newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
|
|
14038
|
+
}
|
|
14039
|
+
for (const [name, value] of view.tpl.views.get(scope.view).contextVariables) {
|
|
14040
|
+
newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.contextVariables.get(name), new ReadPropExpr(new ContextExpr(scope.view), value)));
|
|
14041
|
+
}
|
|
14042
|
+
for (const ref of scope.references) {
|
|
14043
|
+
newOps.push(createVariableOp(view.tpl.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
|
|
14044
|
+
}
|
|
14045
|
+
if (scope.parent !== null) {
|
|
14046
|
+
newOps.push(...generateVariablesInScopeForView(view, scope.parent));
|
|
14047
|
+
}
|
|
14048
|
+
return newOps;
|
|
14049
|
+
}
|
|
14050
|
+
function phaseResolveNames(cpl) {
|
|
14051
|
+
for (const [_, view] of cpl.views) {
|
|
14052
|
+
processLexicalScope$1(view, view.create, null);
|
|
14053
|
+
processLexicalScope$1(view, view.update, null);
|
|
14054
|
+
}
|
|
14055
|
+
}
|
|
14056
|
+
function processLexicalScope$1(view, ops, savedView) {
|
|
14057
|
+
const scope = /* @__PURE__ */ new Map();
|
|
14058
|
+
for (const op of ops) {
|
|
14059
|
+
switch (op.kind) {
|
|
14060
|
+
case OpKind.Variable:
|
|
14061
|
+
switch (op.variable.kind) {
|
|
14062
|
+
case SemanticVariableKind.Identifier:
|
|
14063
|
+
if (scope.has(op.variable.identifier)) {
|
|
14064
|
+
continue;
|
|
14065
|
+
}
|
|
14066
|
+
scope.set(op.variable.identifier, op.xref);
|
|
14067
|
+
break;
|
|
14068
|
+
case SemanticVariableKind.SavedView:
|
|
14069
|
+
savedView = {
|
|
14070
|
+
view: op.variable.view,
|
|
14071
|
+
variable: op.xref
|
|
14072
|
+
};
|
|
14073
|
+
break;
|
|
14074
|
+
}
|
|
14075
|
+
break;
|
|
14076
|
+
case OpKind.Listener:
|
|
14077
|
+
processLexicalScope$1(view, op.handlerOps, savedView);
|
|
14078
|
+
break;
|
|
14079
|
+
}
|
|
14080
|
+
}
|
|
14081
|
+
for (const op of ops) {
|
|
14082
|
+
transformExpressionsInOp(op, (expr) => {
|
|
14083
|
+
if (expr instanceof LexicalReadExpr) {
|
|
14084
|
+
if (scope.has(expr.name)) {
|
|
14085
|
+
return new ReadVariableExpr(scope.get(expr.name));
|
|
14086
|
+
} else {
|
|
14087
|
+
return new ReadPropExpr(new ContextExpr(view.tpl.root.xref), expr.name);
|
|
14088
|
+
}
|
|
14089
|
+
} else if (expr instanceof RestoreViewExpr && typeof expr.view === "number") {
|
|
14090
|
+
if (savedView === null || savedView.view !== expr.view) {
|
|
14091
|
+
throw new Error(`AssertionError: no saved view ${expr.view} from view ${view.xref}`);
|
|
14092
|
+
}
|
|
14093
|
+
expr.view = new ReadVariableExpr(savedView.variable);
|
|
14094
|
+
return expr;
|
|
14095
|
+
} else {
|
|
14096
|
+
return expr;
|
|
14097
|
+
}
|
|
14098
|
+
}, VisitorContextFlag.None);
|
|
14099
|
+
}
|
|
14100
|
+
}
|
|
14101
|
+
function phaseResolveContexts(cpl) {
|
|
14102
|
+
for (const view of cpl.views.values()) {
|
|
14103
|
+
processLexicalScope(view, view.create);
|
|
14104
|
+
processLexicalScope(view, view.update);
|
|
14105
|
+
}
|
|
14106
|
+
}
|
|
14107
|
+
function processLexicalScope(view, ops) {
|
|
14108
|
+
const scope = /* @__PURE__ */ new Map();
|
|
14109
|
+
scope.set(view.xref, variable("ctx"));
|
|
14110
|
+
for (const op of ops) {
|
|
14111
|
+
switch (op.kind) {
|
|
14112
|
+
case OpKind.Variable:
|
|
14113
|
+
switch (op.variable.kind) {
|
|
14114
|
+
case SemanticVariableKind.Context:
|
|
14115
|
+
scope.set(op.variable.view, new ReadVariableExpr(op.xref));
|
|
14116
|
+
break;
|
|
14117
|
+
}
|
|
14118
|
+
break;
|
|
14119
|
+
case OpKind.Listener:
|
|
14120
|
+
processLexicalScope(view, op.handlerOps);
|
|
14121
|
+
break;
|
|
14122
|
+
}
|
|
14123
|
+
}
|
|
14124
|
+
for (const op of ops) {
|
|
14125
|
+
transformExpressionsInOp(op, (expr) => {
|
|
14126
|
+
if (expr instanceof ContextExpr) {
|
|
14127
|
+
if (!scope.has(expr.view)) {
|
|
14128
|
+
throw new Error(`No context found for reference to view ${expr.view} from view ${view.xref}`);
|
|
14129
|
+
}
|
|
14130
|
+
return scope.get(expr.view);
|
|
14131
|
+
} else {
|
|
14132
|
+
return expr;
|
|
14133
|
+
}
|
|
14134
|
+
}, VisitorContextFlag.None);
|
|
14135
|
+
}
|
|
14136
|
+
}
|
|
14137
|
+
function phaseVariableOptimization(cpl, options) {
|
|
14138
|
+
for (const [_, view] of cpl.views) {
|
|
14139
|
+
optimizeVariablesInOpList(view.create, options);
|
|
14140
|
+
optimizeVariablesInOpList(view.update, options);
|
|
14141
|
+
for (const op of view.create) {
|
|
14142
|
+
if (op.kind === OpKind.Listener) {
|
|
14143
|
+
optimizeVariablesInOpList(op.handlerOps, options);
|
|
14144
|
+
}
|
|
14145
|
+
}
|
|
14146
|
+
}
|
|
14147
|
+
}
|
|
14148
|
+
var Fence;
|
|
14149
|
+
(function(Fence2) {
|
|
14150
|
+
Fence2[Fence2["None"] = 0] = "None";
|
|
14151
|
+
Fence2[Fence2["ViewContextRead"] = 1] = "ViewContextRead";
|
|
14152
|
+
Fence2[Fence2["ViewContextWrite"] = 3] = "ViewContextWrite";
|
|
14153
|
+
Fence2[Fence2["SideEffectful"] = 4] = "SideEffectful";
|
|
14154
|
+
})(Fence || (Fence = {}));
|
|
14155
|
+
function optimizeVariablesInOpList(ops, options) {
|
|
14156
|
+
const varDecls = /* @__PURE__ */ new Map();
|
|
14157
|
+
const varUsages = /* @__PURE__ */ new Map();
|
|
14158
|
+
const varRemoteUsages = /* @__PURE__ */ new Set();
|
|
14159
|
+
const opMap = /* @__PURE__ */ new Map();
|
|
14160
|
+
for (const op of ops) {
|
|
14161
|
+
if (op.kind === OpKind.Variable) {
|
|
14162
|
+
if (varDecls.has(op.xref) || varUsages.has(op.xref)) {
|
|
14163
|
+
throw new Error(`Should not see two declarations of the same variable: ${op.xref}`);
|
|
14164
|
+
}
|
|
14165
|
+
varDecls.set(op.xref, op);
|
|
14166
|
+
varUsages.set(op.xref, 0);
|
|
14167
|
+
}
|
|
14168
|
+
opMap.set(op, collectOpInfo(op));
|
|
14169
|
+
countVariableUsages(op, varUsages, varRemoteUsages);
|
|
14170
|
+
}
|
|
14171
|
+
let contextIsUsed = false;
|
|
14172
|
+
for (const op of ops.reversed()) {
|
|
14173
|
+
const opInfo = opMap.get(op);
|
|
14174
|
+
if (op.kind === OpKind.Variable && varUsages.get(op.xref) === 0) {
|
|
14175
|
+
if (contextIsUsed && opInfo.fences & Fence.ViewContextWrite || opInfo.fences & Fence.SideEffectful) {
|
|
14176
|
+
const stmtOp = createStatementOp(op.initializer.toStmt());
|
|
14177
|
+
opMap.set(stmtOp, opInfo);
|
|
14178
|
+
OpList.replace(op, stmtOp);
|
|
14179
|
+
} else {
|
|
14180
|
+
uncountVariableUsages(op, varUsages);
|
|
14181
|
+
OpList.remove(op);
|
|
14182
|
+
}
|
|
14183
|
+
opMap.delete(op);
|
|
14184
|
+
varDecls.delete(op.xref);
|
|
14185
|
+
varUsages.delete(op.xref);
|
|
14186
|
+
continue;
|
|
14187
|
+
}
|
|
14188
|
+
if (opInfo.fences & Fence.ViewContextRead) {
|
|
14189
|
+
contextIsUsed = true;
|
|
14190
|
+
}
|
|
14191
|
+
}
|
|
14192
|
+
const toInline = [];
|
|
14193
|
+
for (const [id, count] of varUsages) {
|
|
14194
|
+
if (count !== 1) {
|
|
14195
|
+
continue;
|
|
14196
|
+
}
|
|
14197
|
+
if (varRemoteUsages.has(id)) {
|
|
14198
|
+
continue;
|
|
14199
|
+
}
|
|
14200
|
+
toInline.push(id);
|
|
14201
|
+
}
|
|
14202
|
+
let candidate;
|
|
14203
|
+
while (candidate = toInline.pop()) {
|
|
14204
|
+
const decl2 = varDecls.get(candidate);
|
|
14205
|
+
const varInfo = opMap.get(decl2);
|
|
14206
|
+
for (let targetOp = decl2.next; targetOp.kind !== OpKind.ListEnd; targetOp = targetOp.next) {
|
|
14207
|
+
const opInfo = opMap.get(targetOp);
|
|
14208
|
+
if (opInfo.variablesUsed.has(candidate)) {
|
|
14209
|
+
if (options.conservative && !allowConservativeInlining(decl2, targetOp)) {
|
|
14210
|
+
break;
|
|
14211
|
+
}
|
|
14212
|
+
if (tryInlineVariableInitializer(candidate, decl2.initializer, targetOp, varInfo.fences)) {
|
|
14213
|
+
opInfo.variablesUsed.delete(candidate);
|
|
14214
|
+
for (const id of varInfo.variablesUsed) {
|
|
14215
|
+
opInfo.variablesUsed.add(id);
|
|
14216
|
+
}
|
|
14217
|
+
opInfo.fences |= varInfo.fences;
|
|
14218
|
+
varDecls.delete(candidate);
|
|
14219
|
+
varUsages.delete(candidate);
|
|
14220
|
+
opMap.delete(decl2);
|
|
14221
|
+
OpList.remove(decl2);
|
|
14222
|
+
}
|
|
14223
|
+
break;
|
|
14224
|
+
}
|
|
14225
|
+
if (!safeToInlinePastFences(opInfo.fences, varInfo.fences)) {
|
|
14226
|
+
break;
|
|
14227
|
+
}
|
|
14228
|
+
}
|
|
14229
|
+
}
|
|
14230
|
+
}
|
|
14231
|
+
function fencesForIrExpression(expr) {
|
|
14232
|
+
switch (expr.kind) {
|
|
14233
|
+
case ExpressionKind.NextContext:
|
|
14234
|
+
return Fence.ViewContextWrite;
|
|
14235
|
+
case ExpressionKind.RestoreView:
|
|
14236
|
+
return Fence.ViewContextWrite | Fence.SideEffectful;
|
|
14237
|
+
case ExpressionKind.Reference:
|
|
14238
|
+
return Fence.ViewContextRead;
|
|
14239
|
+
default:
|
|
14240
|
+
return Fence.None;
|
|
14241
|
+
}
|
|
14242
|
+
}
|
|
14243
|
+
function collectOpInfo(op) {
|
|
14244
|
+
let fences = Fence.None;
|
|
14245
|
+
const variablesUsed = /* @__PURE__ */ new Set();
|
|
14246
|
+
visitExpressionsInOp(op, (expr) => {
|
|
14247
|
+
switch (expr.kind) {
|
|
14248
|
+
case ExpressionKind.ReadVariable:
|
|
14249
|
+
variablesUsed.add(expr.xref);
|
|
14250
|
+
break;
|
|
14251
|
+
default:
|
|
14252
|
+
fences |= fencesForIrExpression(expr);
|
|
14253
|
+
}
|
|
14254
|
+
});
|
|
14255
|
+
return { fences, variablesUsed };
|
|
14256
|
+
}
|
|
14257
|
+
function countVariableUsages(op, varUsages, varRemoteUsage) {
|
|
14258
|
+
visitExpressionsInOp(op, (expr, flags) => {
|
|
14259
|
+
if (expr.kind !== ExpressionKind.ReadVariable) {
|
|
14260
|
+
return;
|
|
14261
|
+
}
|
|
14262
|
+
const count = varUsages.get(expr.xref);
|
|
14263
|
+
if (count === void 0) {
|
|
14264
|
+
return;
|
|
14265
|
+
}
|
|
14266
|
+
varUsages.set(expr.xref, count + 1);
|
|
14267
|
+
if (flags & VisitorContextFlag.InChildOperation) {
|
|
14268
|
+
varRemoteUsage.add(expr.xref);
|
|
14269
|
+
}
|
|
14270
|
+
});
|
|
14271
|
+
}
|
|
14272
|
+
function uncountVariableUsages(op, varUsages) {
|
|
14273
|
+
visitExpressionsInOp(op, (expr) => {
|
|
14274
|
+
if (expr.kind !== ExpressionKind.ReadVariable) {
|
|
14275
|
+
return;
|
|
14276
|
+
}
|
|
14277
|
+
const count = varUsages.get(expr.xref);
|
|
14278
|
+
if (count === void 0) {
|
|
14279
|
+
return;
|
|
14280
|
+
} else if (count === 0) {
|
|
14281
|
+
throw new Error(`Inaccurate variable count: ${expr.xref} - found another read but count is already 0`);
|
|
14282
|
+
}
|
|
14283
|
+
varUsages.set(expr.xref, count - 1);
|
|
14284
|
+
});
|
|
14285
|
+
}
|
|
14286
|
+
function safeToInlinePastFences(fences, declFences) {
|
|
14287
|
+
if (fences & Fence.ViewContextWrite) {
|
|
14288
|
+
if (declFences & Fence.ViewContextRead) {
|
|
14289
|
+
return false;
|
|
14290
|
+
}
|
|
14291
|
+
} else if (fences & Fence.ViewContextRead) {
|
|
14292
|
+
if (declFences & Fence.ViewContextWrite) {
|
|
14293
|
+
return false;
|
|
14294
|
+
}
|
|
14295
|
+
}
|
|
14296
|
+
return true;
|
|
14297
|
+
}
|
|
14298
|
+
function tryInlineVariableInitializer(id, initializer, target, declFences) {
|
|
14299
|
+
let inlined = false;
|
|
14300
|
+
let inliningAllowed = true;
|
|
14301
|
+
transformExpressionsInOp(target, (expr, flags) => {
|
|
14302
|
+
if (inlined || !inliningAllowed) {
|
|
14303
|
+
return expr;
|
|
14304
|
+
} else if (flags & VisitorContextFlag.InChildOperation && declFences & Fence.ViewContextRead) {
|
|
14305
|
+
return expr;
|
|
14306
|
+
}
|
|
14307
|
+
switch (expr.kind) {
|
|
14308
|
+
case ExpressionKind.ReadVariable:
|
|
14309
|
+
if (expr.xref === id) {
|
|
14310
|
+
inlined = true;
|
|
14311
|
+
return initializer;
|
|
14312
|
+
}
|
|
14313
|
+
break;
|
|
14314
|
+
default:
|
|
14315
|
+
const exprFences = fencesForIrExpression(expr);
|
|
14316
|
+
inliningAllowed = inliningAllowed && safeToInlinePastFences(exprFences, declFences);
|
|
14317
|
+
break;
|
|
14318
|
+
}
|
|
14319
|
+
return expr;
|
|
14320
|
+
}, VisitorContextFlag.None);
|
|
14321
|
+
return inlined;
|
|
14322
|
+
}
|
|
14323
|
+
function allowConservativeInlining(decl2, target) {
|
|
14324
|
+
switch (decl2.variable.kind) {
|
|
14325
|
+
case SemanticVariableKind.Identifier:
|
|
14326
|
+
return false;
|
|
14327
|
+
case SemanticVariableKind.Context:
|
|
14328
|
+
return target.kind === OpKind.Variable;
|
|
14329
|
+
default:
|
|
14330
|
+
return true;
|
|
14331
|
+
}
|
|
14332
|
+
}
|
|
14333
|
+
var CHAINABLE = /* @__PURE__ */ new Set([
|
|
14334
|
+
Identifiers.elementStart,
|
|
14335
|
+
Identifiers.elementEnd,
|
|
14336
|
+
Identifiers.property
|
|
14337
|
+
]);
|
|
14338
|
+
function phaseChaining(cpl) {
|
|
14339
|
+
for (const [_, view] of cpl.views) {
|
|
14340
|
+
chainOperationsInList(view.create);
|
|
14341
|
+
chainOperationsInList(view.update);
|
|
14342
|
+
}
|
|
14343
|
+
}
|
|
14344
|
+
function chainOperationsInList(opList) {
|
|
14345
|
+
let chain = null;
|
|
14346
|
+
for (const op of opList) {
|
|
14347
|
+
if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {
|
|
14348
|
+
chain = null;
|
|
14349
|
+
continue;
|
|
14350
|
+
}
|
|
14351
|
+
if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {
|
|
14352
|
+
chain = null;
|
|
14353
|
+
continue;
|
|
14354
|
+
}
|
|
14355
|
+
const instruction = op.statement.expr.fn.value;
|
|
14356
|
+
if (!CHAINABLE.has(instruction)) {
|
|
14357
|
+
chain = null;
|
|
14358
|
+
continue;
|
|
14359
|
+
}
|
|
14360
|
+
if (chain !== null && chain.instruction === instruction) {
|
|
14361
|
+
const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
|
|
14362
|
+
chain.expression = expression;
|
|
14363
|
+
chain.op.statement = expression.toStmt();
|
|
14364
|
+
OpList.remove(op);
|
|
14365
|
+
} else {
|
|
14366
|
+
chain = {
|
|
14367
|
+
op,
|
|
14368
|
+
instruction,
|
|
14369
|
+
expression: op.statement.expr
|
|
14370
|
+
};
|
|
14371
|
+
}
|
|
14372
|
+
}
|
|
14373
|
+
}
|
|
14374
|
+
function phaseMergeNextContext(cpl) {
|
|
14375
|
+
for (const view of cpl.views.values()) {
|
|
14376
|
+
for (const op of view.create) {
|
|
14377
|
+
if (op.kind === OpKind.Listener) {
|
|
14378
|
+
mergeNextContextsInOps(op.handlerOps);
|
|
14379
|
+
}
|
|
14380
|
+
}
|
|
14381
|
+
mergeNextContextsInOps(view.update);
|
|
14382
|
+
}
|
|
14383
|
+
}
|
|
14384
|
+
function mergeNextContextsInOps(ops) {
|
|
14385
|
+
for (const op of ops) {
|
|
14386
|
+
if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement) || !(op.statement.expr instanceof NextContextExpr)) {
|
|
14387
|
+
continue;
|
|
14388
|
+
}
|
|
14389
|
+
const mergeSteps = op.statement.expr.steps;
|
|
14390
|
+
let tryToMerge = true;
|
|
14391
|
+
for (let candidate = op.next; candidate.kind !== OpKind.ListEnd && tryToMerge; candidate = candidate.next) {
|
|
14392
|
+
visitExpressionsInOp(candidate, (expr, flags) => {
|
|
14393
|
+
if (!tryToMerge) {
|
|
14394
|
+
return;
|
|
14395
|
+
}
|
|
14396
|
+
if (flags & VisitorContextFlag.InChildOperation) {
|
|
14397
|
+
return;
|
|
14398
|
+
}
|
|
14399
|
+
switch (expr.kind) {
|
|
14400
|
+
case ExpressionKind.NextContext:
|
|
14401
|
+
expr.steps += mergeSteps;
|
|
14402
|
+
OpList.remove(op);
|
|
14403
|
+
tryToMerge = false;
|
|
14404
|
+
break;
|
|
14405
|
+
case ExpressionKind.GetCurrentView:
|
|
14406
|
+
case ExpressionKind.Reference:
|
|
14407
|
+
tryToMerge = false;
|
|
14408
|
+
break;
|
|
14409
|
+
}
|
|
14410
|
+
});
|
|
14411
|
+
}
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
function transformTemplate(cpl) {
|
|
14415
|
+
phaseGenerateVariables(cpl);
|
|
14416
|
+
phaseResolveNames(cpl);
|
|
14417
|
+
phaseResolveContexts(cpl);
|
|
14418
|
+
phaseLocalRefs(cpl);
|
|
14419
|
+
phaseEmptyElements(cpl);
|
|
14420
|
+
phaseConstCollection(cpl);
|
|
14421
|
+
phaseSlotAllocation(cpl);
|
|
14422
|
+
phaseVarCounting(cpl);
|
|
14423
|
+
phaseGenerateAdvance(cpl);
|
|
14424
|
+
phaseNaming(cpl);
|
|
14425
|
+
phaseVariableOptimization(cpl, { conservative: true });
|
|
14426
|
+
phaseMergeNextContext(cpl);
|
|
14427
|
+
phaseReify(cpl);
|
|
14428
|
+
phaseChaining(cpl);
|
|
14429
|
+
}
|
|
14430
|
+
function emitTemplateFn(tpl, pool) {
|
|
14431
|
+
const rootFn = emitView(tpl.root);
|
|
14432
|
+
emitChildViews(tpl.root, pool);
|
|
14433
|
+
return rootFn;
|
|
14434
|
+
}
|
|
14435
|
+
function emitChildViews(parent, pool) {
|
|
14436
|
+
for (const view of parent.tpl.views.values()) {
|
|
14437
|
+
if (view.parent !== parent.xref) {
|
|
14438
|
+
continue;
|
|
14439
|
+
}
|
|
14440
|
+
emitChildViews(view, pool);
|
|
14441
|
+
const viewFn = emitView(view);
|
|
14442
|
+
pool.statements.push(viewFn.toDeclStmt(viewFn.name));
|
|
12468
14443
|
}
|
|
12469
|
-
|
|
12470
|
-
|
|
14444
|
+
}
|
|
14445
|
+
function emitView(view) {
|
|
14446
|
+
if (view.fnName === null) {
|
|
14447
|
+
throw new Error(`AssertionError: view ${view.xref} is unnamed`);
|
|
12471
14448
|
}
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
});
|
|
14449
|
+
const createStatements = [];
|
|
14450
|
+
for (const op of view.create) {
|
|
14451
|
+
if (op.kind !== OpKind.Statement) {
|
|
14452
|
+
throw new Error(`AssertionError: expected all create ops to have been compiled, but got ${OpKind[op.kind]}`);
|
|
14453
|
+
}
|
|
14454
|
+
createStatements.push(op.statement);
|
|
12479
14455
|
}
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
]
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
var _colonHostContextRe = /:host-context/gim;
|
|
12503
|
-
var _commentRe = /\/\*[\s\S]*?\*\//g;
|
|
12504
|
-
var _placeholderRe = /__ph-(\d+)__/g;
|
|
12505
|
-
function stripComments(input) {
|
|
12506
|
-
return input.replace(_commentRe, "");
|
|
14456
|
+
const updateStatements = [];
|
|
14457
|
+
for (const op of view.update) {
|
|
14458
|
+
if (op.kind !== OpKind.Statement) {
|
|
14459
|
+
throw new Error(`AssertionError: expected all update ops to have been compiled, but got ${OpKind[op.kind]}`);
|
|
14460
|
+
}
|
|
14461
|
+
updateStatements.push(op.statement);
|
|
14462
|
+
}
|
|
14463
|
+
const createCond = maybeGenerateRfBlock(1, createStatements);
|
|
14464
|
+
const updateCond = maybeGenerateRfBlock(2, updateStatements);
|
|
14465
|
+
return fn(
|
|
14466
|
+
[
|
|
14467
|
+
new FnParam("rf"),
|
|
14468
|
+
new FnParam("ctx")
|
|
14469
|
+
],
|
|
14470
|
+
[
|
|
14471
|
+
...createCond,
|
|
14472
|
+
...updateCond
|
|
14473
|
+
],
|
|
14474
|
+
void 0,
|
|
14475
|
+
void 0,
|
|
14476
|
+
view.fnName
|
|
14477
|
+
);
|
|
12507
14478
|
}
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
14479
|
+
function maybeGenerateRfBlock(flag, statements) {
|
|
14480
|
+
if (statements.length === 0) {
|
|
14481
|
+
return [];
|
|
14482
|
+
}
|
|
14483
|
+
return [
|
|
14484
|
+
ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable("rf"), literal(flag)), statements)
|
|
14485
|
+
];
|
|
12511
14486
|
}
|
|
12512
|
-
var
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
var CssRule = class {
|
|
12522
|
-
constructor(selector, content) {
|
|
12523
|
-
this.selector = selector;
|
|
12524
|
-
this.content = content;
|
|
14487
|
+
var ComponentCompilation = class {
|
|
14488
|
+
constructor(componentName) {
|
|
14489
|
+
this.componentName = componentName;
|
|
14490
|
+
this.nextXrefId = 0;
|
|
14491
|
+
this.views = /* @__PURE__ */ new Map();
|
|
14492
|
+
this.consts = [];
|
|
14493
|
+
const root2 = new ViewCompilation(this, this.allocateXrefId(), null);
|
|
14494
|
+
this.views.set(root2.xref, root2);
|
|
14495
|
+
this.root = root2;
|
|
12525
14496
|
}
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
let
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
contentPrefix = "{";
|
|
14497
|
+
allocateView(parent) {
|
|
14498
|
+
const view = new ViewCompilation(this, this.allocateXrefId(), parent);
|
|
14499
|
+
this.views.set(view.xref, view);
|
|
14500
|
+
return view;
|
|
14501
|
+
}
|
|
14502
|
+
allocateXrefId() {
|
|
14503
|
+
return this.nextXrefId++;
|
|
14504
|
+
}
|
|
14505
|
+
addConst(newConst) {
|
|
14506
|
+
for (let idx2 = 0; idx2 < this.consts.length; idx2++) {
|
|
14507
|
+
if (this.consts[idx2].isEquivalent(newConst)) {
|
|
14508
|
+
return idx2;
|
|
14509
|
+
}
|
|
12540
14510
|
}
|
|
12541
|
-
const
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
return unescapeInStrings(escapedResult);
|
|
12545
|
-
}
|
|
12546
|
-
var StringWithEscapedBlocks = class {
|
|
12547
|
-
constructor(escapedString, blocks) {
|
|
12548
|
-
this.escapedString = escapedString;
|
|
12549
|
-
this.blocks = blocks;
|
|
14511
|
+
const idx = this.consts.length;
|
|
14512
|
+
this.consts.push(newConst);
|
|
14513
|
+
return idx;
|
|
12550
14514
|
}
|
|
12551
14515
|
};
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
openChar = closeChar = void 0;
|
|
14516
|
+
var ViewCompilation = class {
|
|
14517
|
+
constructor(tpl, xref, parent) {
|
|
14518
|
+
this.tpl = tpl;
|
|
14519
|
+
this.xref = xref;
|
|
14520
|
+
this.parent = parent;
|
|
14521
|
+
this.fnName = null;
|
|
14522
|
+
this.create = new OpList();
|
|
14523
|
+
this.update = new OpList();
|
|
14524
|
+
this.contextVariables = /* @__PURE__ */ new Map();
|
|
14525
|
+
this.decls = null;
|
|
14526
|
+
this.vars = null;
|
|
14527
|
+
}
|
|
14528
|
+
*ops() {
|
|
14529
|
+
for (const op of this.create) {
|
|
14530
|
+
yield op;
|
|
14531
|
+
if (op.kind === OpKind.Listener) {
|
|
14532
|
+
for (const listenerOp of op.handlerOps) {
|
|
14533
|
+
yield listenerOp;
|
|
14534
|
+
}
|
|
12572
14535
|
}
|
|
12573
|
-
}
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
openChar = char;
|
|
12577
|
-
closeChar = charPairs.get(char);
|
|
12578
|
-
openCharCount = 1;
|
|
12579
|
-
blockStartIndex = i + 1;
|
|
12580
|
-
resultParts.push(input.substring(nonBlockStartIndex, blockStartIndex));
|
|
14536
|
+
}
|
|
14537
|
+
for (const op of this.update) {
|
|
14538
|
+
yield op;
|
|
12581
14539
|
}
|
|
12582
14540
|
}
|
|
12583
|
-
if (blockStartIndex !== -1) {
|
|
12584
|
-
escapedBlocks.push(input.substring(blockStartIndex));
|
|
12585
|
-
resultParts.push(placeholder);
|
|
12586
|
-
} else {
|
|
12587
|
-
resultParts.push(input.substring(nonBlockStartIndex));
|
|
12588
|
-
}
|
|
12589
|
-
return new StringWithEscapedBlocks(resultParts.join(""), escapedBlocks);
|
|
12590
|
-
}
|
|
12591
|
-
var ESCAPE_IN_STRING_MAP = {
|
|
12592
|
-
";": SEMI_IN_PLACEHOLDER,
|
|
12593
|
-
",": COMMA_IN_PLACEHOLDER,
|
|
12594
|
-
":": COLON_IN_PLACEHOLDER
|
|
12595
14541
|
};
|
|
12596
|
-
function
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
14542
|
+
function ingest(componentName, template2) {
|
|
14543
|
+
const cpl = new ComponentCompilation(componentName);
|
|
14544
|
+
ingestNodes(cpl.root, template2);
|
|
14545
|
+
return cpl;
|
|
14546
|
+
}
|
|
14547
|
+
function ingestNodes(view, template2) {
|
|
14548
|
+
for (const node of template2) {
|
|
14549
|
+
if (node instanceof Element$1) {
|
|
14550
|
+
ingestElement(view, node);
|
|
14551
|
+
} else if (node instanceof Template) {
|
|
14552
|
+
ingestTemplate(view, node);
|
|
14553
|
+
} else if (node instanceof Text$3) {
|
|
14554
|
+
ingestText(view, node);
|
|
14555
|
+
} else if (node instanceof BoundText) {
|
|
14556
|
+
ingestBoundText(view, node);
|
|
12603
14557
|
} else {
|
|
12604
|
-
|
|
12605
|
-
if (char === currentQuoteChar) {
|
|
12606
|
-
currentQuoteChar = null;
|
|
12607
|
-
} else {
|
|
12608
|
-
const placeholder = ESCAPE_IN_STRING_MAP[char];
|
|
12609
|
-
if (placeholder) {
|
|
12610
|
-
result = `${result.substr(0, i)}${placeholder}${result.substr(i + 1)}`;
|
|
12611
|
-
i += placeholder.length - 1;
|
|
12612
|
-
}
|
|
12613
|
-
}
|
|
12614
|
-
} else if (char === "'" || char === '"') {
|
|
12615
|
-
currentQuoteChar = char;
|
|
12616
|
-
}
|
|
14558
|
+
throw new Error(`Unsupported template node: ${node.constructor.name}`);
|
|
12617
14559
|
}
|
|
12618
14560
|
}
|
|
12619
|
-
return result;
|
|
12620
14561
|
}
|
|
12621
|
-
function
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
14562
|
+
function ingestElement(view, element2) {
|
|
14563
|
+
const staticAttributes = {};
|
|
14564
|
+
for (const attr of element2.attributes) {
|
|
14565
|
+
staticAttributes[attr.name] = attr.value;
|
|
14566
|
+
}
|
|
14567
|
+
const id = view.tpl.allocateXrefId();
|
|
14568
|
+
const startOp = createElementStartOp(element2.name, id);
|
|
14569
|
+
view.create.push(startOp);
|
|
14570
|
+
ingestAttributes(startOp, element2);
|
|
14571
|
+
ingestBindings(view, startOp, element2);
|
|
14572
|
+
ingestReferences(startOp, element2);
|
|
14573
|
+
ingestNodes(view, element2.children);
|
|
14574
|
+
view.create.push(createElementEndOp(id));
|
|
12626
14575
|
}
|
|
12627
|
-
function
|
|
12628
|
-
|
|
14576
|
+
function ingestTemplate(view, tmpl) {
|
|
14577
|
+
var _a2;
|
|
14578
|
+
const childView = view.tpl.allocateView(view.xref);
|
|
14579
|
+
const tplOp = createTemplateOp(childView.xref, (_a2 = tmpl.tagName) != null ? _a2 : "ng-template");
|
|
14580
|
+
view.create.push(tplOp);
|
|
14581
|
+
ingestAttributes(tplOp, tmpl);
|
|
14582
|
+
ingestBindings(view, tplOp, tmpl);
|
|
14583
|
+
ingestReferences(tplOp, tmpl);
|
|
14584
|
+
ingestNodes(childView, tmpl.children);
|
|
14585
|
+
for (const { name, value } of tmpl.variables) {
|
|
14586
|
+
childView.contextVariables.set(name, value);
|
|
14587
|
+
}
|
|
12629
14588
|
}
|
|
12630
|
-
function
|
|
12631
|
-
|
|
12632
|
-
|
|
12633
|
-
|
|
12634
|
-
|
|
12635
|
-
|
|
14589
|
+
function ingestText(view, text2) {
|
|
14590
|
+
view.create.push(createTextOp(view.tpl.allocateXrefId(), text2.value));
|
|
14591
|
+
}
|
|
14592
|
+
function ingestBoundText(view, text2) {
|
|
14593
|
+
let value = text2.value;
|
|
14594
|
+
if (value instanceof ASTWithSource) {
|
|
14595
|
+
value = value.ast;
|
|
12636
14596
|
}
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12641
|
-
|
|
12642
|
-
|
|
12643
|
-
|
|
12644
|
-
|
|
12645
|
-
|
|
14597
|
+
if (!(value instanceof Interpolation)) {
|
|
14598
|
+
throw new Error(`AssertionError: expected Interpolation for BoundText node, got ${value.constructor.name}`);
|
|
14599
|
+
}
|
|
14600
|
+
const textXref = view.tpl.allocateXrefId();
|
|
14601
|
+
view.create.push(createTextOp(textXref, ""));
|
|
14602
|
+
view.update.push(createInterpolateTextOp(textXref, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
|
|
14603
|
+
}
|
|
14604
|
+
function convertAst(ast, cpl) {
|
|
14605
|
+
if (ast instanceof ASTWithSource) {
|
|
14606
|
+
return convertAst(ast.ast, cpl);
|
|
14607
|
+
} else if (ast instanceof PropertyRead) {
|
|
14608
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
14609
|
+
return new LexicalReadExpr(ast.name);
|
|
14610
|
+
} else {
|
|
14611
|
+
return new ReadPropExpr(convertAst(ast.receiver, cpl), ast.name);
|
|
12646
14612
|
}
|
|
14613
|
+
} else if (ast instanceof Call) {
|
|
14614
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
14615
|
+
throw new Error(`Unexpected ImplicitReceiver`);
|
|
14616
|
+
} else {
|
|
14617
|
+
return new InvokeFunctionExpr(convertAst(ast.receiver, cpl), ast.args.map((arg) => convertAst(arg, cpl)));
|
|
14618
|
+
}
|
|
14619
|
+
} else if (ast instanceof LiteralPrimitive) {
|
|
14620
|
+
return literal(ast.value);
|
|
14621
|
+
} else if (ast instanceof ThisReceiver) {
|
|
14622
|
+
return new ContextExpr(cpl.root.xref);
|
|
14623
|
+
} else {
|
|
14624
|
+
throw new Error(`Unhandled expression type: ${ast.constructor.name}`);
|
|
12647
14625
|
}
|
|
12648
|
-
return combined.map((s) => otherSelectorsHasHost ? `${s}${otherSelectors}` : `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`).join(",");
|
|
12649
14626
|
}
|
|
12650
|
-
function
|
|
12651
|
-
|
|
12652
|
-
for (
|
|
12653
|
-
|
|
12654
|
-
|
|
14627
|
+
function ingestAttributes(op, element2) {
|
|
14628
|
+
assertIsElementAttributes(op.attributes);
|
|
14629
|
+
for (const attr of element2.attributes) {
|
|
14630
|
+
op.attributes.add(ElementAttributeKind.Attribute, attr.name, literal(attr.value));
|
|
14631
|
+
}
|
|
14632
|
+
for (const input of element2.inputs) {
|
|
14633
|
+
op.attributes.add(ElementAttributeKind.Binding, input.name, null);
|
|
14634
|
+
}
|
|
14635
|
+
for (const output of element2.outputs) {
|
|
14636
|
+
op.attributes.add(ElementAttributeKind.Binding, output.name, null);
|
|
14637
|
+
}
|
|
14638
|
+
if (element2 instanceof Template) {
|
|
14639
|
+
for (const attr of element2.templateAttrs) {
|
|
14640
|
+
op.attributes.add(ElementAttributeKind.Template, attr.name, null);
|
|
12655
14641
|
}
|
|
12656
14642
|
}
|
|
12657
14643
|
}
|
|
14644
|
+
function ingestBindings(view, op, element2) {
|
|
14645
|
+
if (element2 instanceof Template) {
|
|
14646
|
+
for (const attr of element2.templateAttrs) {
|
|
14647
|
+
if (typeof attr.value === "string") {
|
|
14648
|
+
} else {
|
|
14649
|
+
view.update.push(createPropertyOp(op.xref, attr.name, convertAst(attr.value, view.tpl)));
|
|
14650
|
+
}
|
|
14651
|
+
}
|
|
14652
|
+
} else {
|
|
14653
|
+
for (const input of element2.inputs) {
|
|
14654
|
+
view.update.push(createPropertyOp(op.xref, input.name, convertAst(input.value, view.tpl)));
|
|
14655
|
+
}
|
|
14656
|
+
for (const output of element2.outputs) {
|
|
14657
|
+
const listenerOp = createListenerOp(op.xref, output.name, op.tag);
|
|
14658
|
+
listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(output.handler, view.tpl))));
|
|
14659
|
+
view.create.push(listenerOp);
|
|
14660
|
+
}
|
|
14661
|
+
}
|
|
14662
|
+
}
|
|
14663
|
+
function ingestReferences(op, element2) {
|
|
14664
|
+
assertIsArray(op.localRefs);
|
|
14665
|
+
for (const { name, value } of element2.references) {
|
|
14666
|
+
op.localRefs.push({
|
|
14667
|
+
name,
|
|
14668
|
+
target: value
|
|
14669
|
+
});
|
|
14670
|
+
}
|
|
14671
|
+
}
|
|
14672
|
+
function assertIsArray(value) {
|
|
14673
|
+
if (!Array.isArray(value)) {
|
|
14674
|
+
throw new Error(`AssertionError: expected an array`);
|
|
14675
|
+
}
|
|
14676
|
+
}
|
|
14677
|
+
var USE_TEMPLATE_PIPELINE = false;
|
|
12658
14678
|
function parse(value) {
|
|
12659
14679
|
const styles = [];
|
|
12660
14680
|
let i = 0;
|
|
@@ -12756,11 +14776,11 @@ var StylingBuilder = class {
|
|
|
12756
14776
|
const isClass = !isStyle && (name === "class" || prefix === "class." || prefix === "class!");
|
|
12757
14777
|
if (isStyle || isClass) {
|
|
12758
14778
|
const isMapBased = name.charAt(5) !== ".";
|
|
12759
|
-
const
|
|
14779
|
+
const property2 = name.slice(isMapBased ? 5 : 6);
|
|
12760
14780
|
if (isStyle) {
|
|
12761
|
-
binding = this.registerStyleInput(
|
|
14781
|
+
binding = this.registerStyleInput(property2, isMapBased, expression, sourceSpan);
|
|
12762
14782
|
} else {
|
|
12763
|
-
binding = this.registerClassInput(
|
|
14783
|
+
binding = this.registerClassInput(property2, isMapBased, expression, sourceSpan);
|
|
12764
14784
|
}
|
|
12765
14785
|
}
|
|
12766
14786
|
return binding;
|
|
@@ -12772,14 +14792,14 @@ var StylingBuilder = class {
|
|
|
12772
14792
|
if (!isCssCustomProperty(name)) {
|
|
12773
14793
|
name = hyphenate(name);
|
|
12774
14794
|
}
|
|
12775
|
-
const { property, hasOverrideFlag, suffix: bindingSuffix } = parseProperty(name);
|
|
14795
|
+
const { property: property2, hasOverrideFlag, suffix: bindingSuffix } = parseProperty(name);
|
|
12776
14796
|
suffix = typeof suffix === "string" && suffix.length !== 0 ? suffix : bindingSuffix;
|
|
12777
|
-
const entry = { name:
|
|
14797
|
+
const entry = { name: property2, suffix, value, sourceSpan, hasOverrideFlag };
|
|
12778
14798
|
if (isMapBased) {
|
|
12779
14799
|
this._styleMapInput = entry;
|
|
12780
14800
|
} else {
|
|
12781
14801
|
(this._singleStyleInputs = this._singleStyleInputs || []).push(entry);
|
|
12782
|
-
registerIntoMap(this._stylesIndex,
|
|
14802
|
+
registerIntoMap(this._stylesIndex, property2);
|
|
12783
14803
|
}
|
|
12784
14804
|
this._lastStylingInput = entry;
|
|
12785
14805
|
this._firstStylingInput = this._firstStylingInput || entry;
|
|
@@ -12791,13 +14811,13 @@ var StylingBuilder = class {
|
|
|
12791
14811
|
if (isEmptyExpression(value)) {
|
|
12792
14812
|
return null;
|
|
12793
14813
|
}
|
|
12794
|
-
const { property, hasOverrideFlag } = parseProperty(name);
|
|
12795
|
-
const entry = { name:
|
|
14814
|
+
const { property: property2, hasOverrideFlag } = parseProperty(name);
|
|
14815
|
+
const entry = { name: property2, value, sourceSpan, hasOverrideFlag, suffix: null };
|
|
12796
14816
|
if (isMapBased) {
|
|
12797
14817
|
this._classMapInput = entry;
|
|
12798
14818
|
} else {
|
|
12799
14819
|
(this._singleClassInputs = this._singleClassInputs || []).push(entry);
|
|
12800
|
-
registerIntoMap(this._classesIndex,
|
|
14820
|
+
registerIntoMap(this._classesIndex, property2);
|
|
12801
14821
|
}
|
|
12802
14822
|
this._lastStylingInput = entry;
|
|
12803
14823
|
this._firstStylingInput = this._firstStylingInput || entry;
|
|
@@ -12853,15 +14873,15 @@ var StylingBuilder = class {
|
|
|
12853
14873
|
_buildMapBasedInstruction(valueConverter, isClassBased, stylingInput) {
|
|
12854
14874
|
let totalBindingSlotsRequired = MIN_STYLING_BINDING_SLOTS_REQUIRED;
|
|
12855
14875
|
const mapValue = stylingInput.value.visit(valueConverter);
|
|
12856
|
-
let
|
|
14876
|
+
let reference2;
|
|
12857
14877
|
if (mapValue instanceof Interpolation) {
|
|
12858
14878
|
totalBindingSlotsRequired += mapValue.expressions.length;
|
|
12859
|
-
|
|
14879
|
+
reference2 = isClassBased ? getClassMapInterpolationExpression(mapValue) : getStyleMapInterpolationExpression(mapValue);
|
|
12860
14880
|
} else {
|
|
12861
|
-
|
|
14881
|
+
reference2 = isClassBased ? Identifiers.classMap : Identifiers.styleMap;
|
|
12862
14882
|
}
|
|
12863
14883
|
return {
|
|
12864
|
-
reference,
|
|
14884
|
+
reference: reference2,
|
|
12865
14885
|
calls: [{
|
|
12866
14886
|
supportsInterpolation: true,
|
|
12867
14887
|
sourceSpan: stylingInput.sourceSpan,
|
|
@@ -12874,12 +14894,12 @@ var StylingBuilder = class {
|
|
|
12874
14894
|
}]
|
|
12875
14895
|
};
|
|
12876
14896
|
}
|
|
12877
|
-
_buildSingleInputs(
|
|
14897
|
+
_buildSingleInputs(reference2, inputs, valueConverter, getInterpolationExpressionFn, isClassBased) {
|
|
12878
14898
|
const instructions = [];
|
|
12879
14899
|
inputs.forEach((input) => {
|
|
12880
14900
|
const previousInstruction = instructions[instructions.length - 1];
|
|
12881
14901
|
const value = input.value.visit(valueConverter);
|
|
12882
|
-
let referenceForCall =
|
|
14902
|
+
let referenceForCall = reference2;
|
|
12883
14903
|
let totalBindingSlotsRequired = MIN_STYLING_BINDING_SLOTS_REQUIRED;
|
|
12884
14904
|
if (value instanceof Interpolation) {
|
|
12885
14905
|
totalBindingSlotsRequired += value.expressions.length;
|
|
@@ -12887,7 +14907,7 @@ var StylingBuilder = class {
|
|
|
12887
14907
|
referenceForCall = getInterpolationExpressionFn(value);
|
|
12888
14908
|
}
|
|
12889
14909
|
}
|
|
12890
|
-
const
|
|
14910
|
+
const call2 = {
|
|
12891
14911
|
sourceSpan: input.sourceSpan,
|
|
12892
14912
|
allocateBindingSlots: totalBindingSlotsRequired,
|
|
12893
14913
|
supportsInterpolation: !!getInterpolationExpressionFn,
|
|
@@ -12907,9 +14927,9 @@ var StylingBuilder = class {
|
|
|
12907
14927
|
}
|
|
12908
14928
|
};
|
|
12909
14929
|
if (previousInstruction && previousInstruction.reference === referenceForCall) {
|
|
12910
|
-
previousInstruction.calls.push(
|
|
14930
|
+
previousInstruction.calls.push(call2);
|
|
12911
14931
|
} else {
|
|
12912
|
-
instructions.push({ reference: referenceForCall, calls: [
|
|
14932
|
+
instructions.push({ reference: referenceForCall, calls: [call2] });
|
|
12913
14933
|
}
|
|
12914
14934
|
});
|
|
12915
14935
|
return instructions;
|
|
@@ -12956,13 +14976,13 @@ function parseProperty(name) {
|
|
|
12956
14976
|
hasOverrideFlag = true;
|
|
12957
14977
|
}
|
|
12958
14978
|
let suffix = null;
|
|
12959
|
-
let
|
|
14979
|
+
let property2 = name;
|
|
12960
14980
|
const unitIndex = name.lastIndexOf(".");
|
|
12961
14981
|
if (unitIndex > 0) {
|
|
12962
14982
|
suffix = name.slice(unitIndex + 1);
|
|
12963
|
-
|
|
14983
|
+
property2 = name.substring(0, unitIndex);
|
|
12964
14984
|
}
|
|
12965
|
-
return { property, suffix, hasOverrideFlag };
|
|
14985
|
+
return { property: property2, suffix, hasOverrideFlag };
|
|
12966
14986
|
}
|
|
12967
14987
|
function getClassMapInterpolationExpression(interpolation) {
|
|
12968
14988
|
switch (getInterpolationArgsLength(interpolation)) {
|
|
@@ -13058,8 +15078,8 @@ var TokenType;
|
|
|
13058
15078
|
})(TokenType || (TokenType = {}));
|
|
13059
15079
|
var KEYWORDS = ["var", "let", "as", "null", "undefined", "true", "false", "if", "else", "this"];
|
|
13060
15080
|
var Lexer = class {
|
|
13061
|
-
tokenize(
|
|
13062
|
-
const scanner = new _Scanner(
|
|
15081
|
+
tokenize(text2) {
|
|
15082
|
+
const scanner = new _Scanner(text2);
|
|
13063
15083
|
const tokens = [];
|
|
13064
15084
|
let token = scanner.scanToken();
|
|
13065
15085
|
while (token != null) {
|
|
@@ -13145,20 +15165,20 @@ var Token = class {
|
|
|
13145
15165
|
function newCharacterToken(index2, end, code) {
|
|
13146
15166
|
return new Token(index2, end, TokenType.Character, code, String.fromCharCode(code));
|
|
13147
15167
|
}
|
|
13148
|
-
function newIdentifierToken(index2, end,
|
|
13149
|
-
return new Token(index2, end, TokenType.Identifier, 0,
|
|
15168
|
+
function newIdentifierToken(index2, end, text2) {
|
|
15169
|
+
return new Token(index2, end, TokenType.Identifier, 0, text2);
|
|
13150
15170
|
}
|
|
13151
|
-
function newPrivateIdentifierToken(index2, end,
|
|
13152
|
-
return new Token(index2, end, TokenType.PrivateIdentifier, 0,
|
|
15171
|
+
function newPrivateIdentifierToken(index2, end, text2) {
|
|
15172
|
+
return new Token(index2, end, TokenType.PrivateIdentifier, 0, text2);
|
|
13153
15173
|
}
|
|
13154
|
-
function newKeywordToken(index2, end,
|
|
13155
|
-
return new Token(index2, end, TokenType.Keyword, 0,
|
|
15174
|
+
function newKeywordToken(index2, end, text2) {
|
|
15175
|
+
return new Token(index2, end, TokenType.Keyword, 0, text2);
|
|
13156
15176
|
}
|
|
13157
|
-
function newOperatorToken(index2, end,
|
|
13158
|
-
return new Token(index2, end, TokenType.Operator, 0,
|
|
15177
|
+
function newOperatorToken(index2, end, text2) {
|
|
15178
|
+
return new Token(index2, end, TokenType.Operator, 0, text2);
|
|
13159
15179
|
}
|
|
13160
|
-
function newStringToken(index2, end,
|
|
13161
|
-
return new Token(index2, end, TokenType.String, 0,
|
|
15180
|
+
function newStringToken(index2, end, text2) {
|
|
15181
|
+
return new Token(index2, end, TokenType.String, 0, text2);
|
|
13162
15182
|
}
|
|
13163
15183
|
function newNumberToken(index2, end, n) {
|
|
13164
15184
|
return new Token(index2, end, TokenType.Number, n, "");
|
|
@@ -13397,10 +15417,10 @@ function unescape2(code) {
|
|
|
13397
15417
|
return code;
|
|
13398
15418
|
}
|
|
13399
15419
|
}
|
|
13400
|
-
function parseIntAutoRadix(
|
|
13401
|
-
const result = parseInt(
|
|
15420
|
+
function parseIntAutoRadix(text2) {
|
|
15421
|
+
const result = parseInt(text2);
|
|
13402
15422
|
if (isNaN(result)) {
|
|
13403
|
-
throw new Error("Invalid integer literal when parsing " +
|
|
15423
|
+
throw new Error("Invalid integer literal when parsing " + text2);
|
|
13404
15424
|
}
|
|
13405
15425
|
return result;
|
|
13406
15426
|
}
|
|
@@ -13495,7 +15515,7 @@ var Parser$1 = class {
|
|
|
13495
15515
|
return new ASTWithSource(interpolation, input, location, absoluteOffset, this.errors);
|
|
13496
15516
|
}
|
|
13497
15517
|
splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
13498
|
-
var
|
|
15518
|
+
var _a2;
|
|
13499
15519
|
const strings = [];
|
|
13500
15520
|
const expressions = [];
|
|
13501
15521
|
const offsets = [];
|
|
@@ -13511,8 +15531,8 @@ var Parser$1 = class {
|
|
|
13511
15531
|
if (i === -1) {
|
|
13512
15532
|
i = input.length;
|
|
13513
15533
|
}
|
|
13514
|
-
const
|
|
13515
|
-
strings.push({ text, start, end: i });
|
|
15534
|
+
const text2 = input.substring(start, i);
|
|
15535
|
+
strings.push({ text: text2, start, end: i });
|
|
13516
15536
|
atInterpolation = true;
|
|
13517
15537
|
} else {
|
|
13518
15538
|
const fullStart = i;
|
|
@@ -13524,12 +15544,12 @@ var Parser$1 = class {
|
|
|
13524
15544
|
break;
|
|
13525
15545
|
}
|
|
13526
15546
|
const fullEnd = exprEnd + interpEnd.length;
|
|
13527
|
-
const
|
|
13528
|
-
if (
|
|
15547
|
+
const text2 = input.substring(exprStart, exprEnd);
|
|
15548
|
+
if (text2.trim().length === 0) {
|
|
13529
15549
|
this._reportError("Blank expressions are not allowed in interpolated strings", input, `at column ${i} in`, location);
|
|
13530
15550
|
}
|
|
13531
|
-
expressions.push({ text, start: fullStart, end: fullEnd });
|
|
13532
|
-
const startInOriginalTemplate = (
|
|
15551
|
+
expressions.push({ text: text2, start: fullStart, end: fullEnd });
|
|
15552
|
+
const startInOriginalTemplate = (_a2 = inputToTemplateIndexMap == null ? void 0 : inputToTemplateIndexMap.get(fullStart)) != null ? _a2 : fullStart;
|
|
13533
15553
|
const offset = startInOriginalTemplate + interpStart.length;
|
|
13534
15554
|
offsets.push(offset);
|
|
13535
15555
|
i = fullEnd;
|
|
@@ -14068,8 +16088,8 @@ var _ParseAST = class {
|
|
|
14068
16088
|
parseAccessMember(readReceiver, start, isSafe) {
|
|
14069
16089
|
const nameStart = this.inputIndex;
|
|
14070
16090
|
const id = this.withContext(ParseContextFlags.Writable, () => {
|
|
14071
|
-
var
|
|
14072
|
-
const id2 = (
|
|
16091
|
+
var _a2;
|
|
16092
|
+
const id2 = (_a2 = this.expectIdentifierOrKeyword()) != null ? _a2 : "";
|
|
14073
16093
|
if (id2.length === 0) {
|
|
14074
16094
|
this.error(`Expected identifier for property access`, readReceiver.span.end);
|
|
14075
16095
|
}
|
|
@@ -14382,37 +16402,6 @@ function visitAll(visitor, nodes, context = null) {
|
|
|
14382
16402
|
});
|
|
14383
16403
|
return result;
|
|
14384
16404
|
}
|
|
14385
|
-
var TagContentType;
|
|
14386
|
-
(function(TagContentType2) {
|
|
14387
|
-
TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
|
|
14388
|
-
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
14389
|
-
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
14390
|
-
})(TagContentType || (TagContentType = {}));
|
|
14391
|
-
function splitNsName(elementName) {
|
|
14392
|
-
if (elementName[0] != ":") {
|
|
14393
|
-
return [null, elementName];
|
|
14394
|
-
}
|
|
14395
|
-
const colonIndex = elementName.indexOf(":", 1);
|
|
14396
|
-
if (colonIndex === -1) {
|
|
14397
|
-
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
14398
|
-
}
|
|
14399
|
-
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
14400
|
-
}
|
|
14401
|
-
function isNgContainer(tagName) {
|
|
14402
|
-
return splitNsName(tagName)[1] === "ng-container";
|
|
14403
|
-
}
|
|
14404
|
-
function isNgContent(tagName) {
|
|
14405
|
-
return splitNsName(tagName)[1] === "ng-content";
|
|
14406
|
-
}
|
|
14407
|
-
function isNgTemplate(tagName) {
|
|
14408
|
-
return splitNsName(tagName)[1] === "ng-template";
|
|
14409
|
-
}
|
|
14410
|
-
function getNsPrefix(fullName) {
|
|
14411
|
-
return fullName === null ? null : splitNsName(fullName)[0];
|
|
14412
|
-
}
|
|
14413
|
-
function mergeNsAndName(prefix, localName) {
|
|
14414
|
-
return prefix ? `:${prefix}:${localName}` : localName;
|
|
14415
|
-
}
|
|
14416
16405
|
var ElementSchemaRegistry = class {
|
|
14417
16406
|
};
|
|
14418
16407
|
var BOOLEAN = "boolean";
|
|
@@ -14609,23 +16598,23 @@ var DomElementSchemaRegistry = class extends ElementSchemaRegistry {
|
|
|
14609
16598
|
events.add(superEvent);
|
|
14610
16599
|
}
|
|
14611
16600
|
}
|
|
14612
|
-
properties.forEach((
|
|
14613
|
-
if (
|
|
14614
|
-
switch (
|
|
16601
|
+
properties.forEach((property2) => {
|
|
16602
|
+
if (property2.length > 0) {
|
|
16603
|
+
switch (property2[0]) {
|
|
14615
16604
|
case "*":
|
|
14616
|
-
events.add(
|
|
16605
|
+
events.add(property2.substring(1));
|
|
14617
16606
|
break;
|
|
14618
16607
|
case "!":
|
|
14619
|
-
type.set(
|
|
16608
|
+
type.set(property2.substring(1), BOOLEAN);
|
|
14620
16609
|
break;
|
|
14621
16610
|
case "#":
|
|
14622
|
-
type.set(
|
|
16611
|
+
type.set(property2.substring(1), NUMBER);
|
|
14623
16612
|
break;
|
|
14624
16613
|
case "%":
|
|
14625
|
-
type.set(
|
|
16614
|
+
type.set(property2.substring(1), OBJECT);
|
|
14626
16615
|
break;
|
|
14627
16616
|
default:
|
|
14628
|
-
type.set(
|
|
16617
|
+
type.set(property2, STRING);
|
|
14629
16618
|
}
|
|
14630
16619
|
}
|
|
14631
16620
|
});
|
|
@@ -14674,8 +16663,8 @@ var DomElementSchemaRegistry = class extends ElementSchemaRegistry {
|
|
|
14674
16663
|
return ctx ? ctx : SecurityContext.NONE;
|
|
14675
16664
|
}
|
|
14676
16665
|
getMappedPropName(propName) {
|
|
14677
|
-
var
|
|
14678
|
-
return (
|
|
16666
|
+
var _a2;
|
|
16667
|
+
return (_a2 = _ATTR_TO_PROP.get(propName)) != null ? _a2 : propName;
|
|
14679
16668
|
}
|
|
14680
16669
|
getDefaultComponentElementName() {
|
|
14681
16670
|
return "ng-component";
|
|
@@ -14703,13 +16692,13 @@ If '${name}' is a directive input, make sure the directive is imported by the cu
|
|
|
14703
16692
|
allKnownAttributesOfElement(tagName) {
|
|
14704
16693
|
const elementProperties = this._schema.get(tagName.toLowerCase()) || this._schema.get("unknown");
|
|
14705
16694
|
return Array.from(elementProperties.keys()).map((prop) => {
|
|
14706
|
-
var
|
|
14707
|
-
return (
|
|
16695
|
+
var _a2;
|
|
16696
|
+
return (_a2 = _PROP_TO_ATTR.get(prop)) != null ? _a2 : prop;
|
|
14708
16697
|
});
|
|
14709
16698
|
}
|
|
14710
16699
|
allKnownEventsOfElement(tagName) {
|
|
14711
|
-
var
|
|
14712
|
-
return Array.from((
|
|
16700
|
+
var _a2;
|
|
16701
|
+
return Array.from((_a2 = this._eventSchema.get(tagName.toLowerCase())) != null ? _a2 : []);
|
|
14713
16702
|
}
|
|
14714
16703
|
normalizeAnimationStyleProperty(propName) {
|
|
14715
16704
|
return dashCaseToCamelCase(propName);
|
|
@@ -14795,7 +16784,7 @@ var HtmlTagDefinition = class {
|
|
|
14795
16784
|
var DEFAULT_TAG_DEFINITION;
|
|
14796
16785
|
var TAG_DEFINITIONS;
|
|
14797
16786
|
function getHtmlTagDefinition(tagName) {
|
|
14798
|
-
var
|
|
16787
|
+
var _a2, _b;
|
|
14799
16788
|
if (!TAG_DEFINITIONS) {
|
|
14800
16789
|
DEFAULT_TAG_DEFINITION = new HtmlTagDefinition({ canSelfClose: true });
|
|
14801
16790
|
TAG_DEFINITIONS = {
|
|
@@ -14880,7 +16869,7 @@ function getHtmlTagDefinition(tagName) {
|
|
|
14880
16869
|
}
|
|
14881
16870
|
});
|
|
14882
16871
|
}
|
|
14883
|
-
return (_b = (
|
|
16872
|
+
return (_b = (_a2 = TAG_DEFINITIONS[tagName]) != null ? _a2 : TAG_DEFINITIONS[tagName.toLowerCase()]) != null ? _b : DEFAULT_TAG_DEFINITION;
|
|
14884
16873
|
}
|
|
14885
16874
|
var NAMED_ENTITIES = {
|
|
14886
16875
|
"AElig": "\xC6",
|
|
@@ -17921,9 +19910,9 @@ var _TreeBuilder = class {
|
|
|
17921
19910
|
this._advanceIf(13);
|
|
17922
19911
|
}
|
|
17923
19912
|
_consumeComment(token) {
|
|
17924
|
-
const
|
|
19913
|
+
const text2 = this._advanceIf(7);
|
|
17925
19914
|
this._advanceIf(11);
|
|
17926
|
-
const value =
|
|
19915
|
+
const value = text2 != null ? text2.parts[0].trim() : null;
|
|
17927
19916
|
this._addToParent(new Comment(value, token.sourceSpan));
|
|
17928
19917
|
}
|
|
17929
19918
|
_consumeExpansion(token) {
|
|
@@ -18001,28 +19990,28 @@ var _TreeBuilder = class {
|
|
|
18001
19990
|
_consumeText(token) {
|
|
18002
19991
|
const tokens = [token];
|
|
18003
19992
|
const startSpan = token.sourceSpan;
|
|
18004
|
-
let
|
|
18005
|
-
if (
|
|
19993
|
+
let text2 = token.parts[0];
|
|
19994
|
+
if (text2.length > 0 && text2[0] === "\n") {
|
|
18006
19995
|
const parent = this._getParentElement();
|
|
18007
19996
|
if (parent != null && parent.children.length === 0 && this.getTagDefinition(parent.name).ignoreFirstLf) {
|
|
18008
|
-
|
|
18009
|
-
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [
|
|
19997
|
+
text2 = text2.substring(1);
|
|
19998
|
+
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text2] };
|
|
18010
19999
|
}
|
|
18011
20000
|
}
|
|
18012
20001
|
while (this._peek.type === 8 || this._peek.type === 5 || this._peek.type === 9) {
|
|
18013
20002
|
token = this._advance();
|
|
18014
20003
|
tokens.push(token);
|
|
18015
20004
|
if (token.type === 8) {
|
|
18016
|
-
|
|
20005
|
+
text2 += token.parts.join("").replace(/&([^;]+);/g, decodeEntity);
|
|
18017
20006
|
} else if (token.type === 9) {
|
|
18018
|
-
|
|
20007
|
+
text2 += token.parts[0];
|
|
18019
20008
|
} else {
|
|
18020
|
-
|
|
20009
|
+
text2 += token.parts.join("");
|
|
18021
20010
|
}
|
|
18022
20011
|
}
|
|
18023
|
-
if (
|
|
20012
|
+
if (text2.length > 0) {
|
|
18024
20013
|
const endSpan = token.sourceSpan;
|
|
18025
|
-
this._addToParent(new Text(
|
|
20014
|
+
this._addToParent(new Text(text2, new ParseSourceSpan(startSpan.start, endSpan.end, startSpan.fullStart, startSpan.details), tokens));
|
|
18026
20015
|
}
|
|
18027
20016
|
}
|
|
18028
20017
|
_closeVoidElement() {
|
|
@@ -18154,8 +20143,8 @@ var _TreeBuilder = class {
|
|
|
18154
20143
|
return mergeNsAndName(prefix, localName);
|
|
18155
20144
|
}
|
|
18156
20145
|
};
|
|
18157
|
-
function lastOnStack(stack,
|
|
18158
|
-
return stack.length > 0 && stack[stack.length - 1] ===
|
|
20146
|
+
function lastOnStack(stack, element2) {
|
|
20147
|
+
return stack.length > 0 && stack[stack.length - 1] === element2;
|
|
18159
20148
|
}
|
|
18160
20149
|
function decodeEntity(match, entity) {
|
|
18161
20150
|
if (NAMED_ENTITIES[entity] !== void 0) {
|
|
@@ -18189,22 +20178,22 @@ function replaceNgsp(value) {
|
|
|
18189
20178
|
return value.replace(new RegExp(NGSP_UNICODE, "g"), " ");
|
|
18190
20179
|
}
|
|
18191
20180
|
var WhitespaceVisitor = class {
|
|
18192
|
-
visitElement(
|
|
18193
|
-
if (SKIP_WS_TRIM_TAGS.has(
|
|
18194
|
-
return new Element(
|
|
20181
|
+
visitElement(element2, context) {
|
|
20182
|
+
if (SKIP_WS_TRIM_TAGS.has(element2.name) || hasPreserveWhitespacesAttr(element2.attrs)) {
|
|
20183
|
+
return new Element(element2.name, visitAll(this, element2.attrs), element2.children, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
18195
20184
|
}
|
|
18196
|
-
return new Element(
|
|
20185
|
+
return new Element(element2.name, element2.attrs, visitAllWithSiblings(this, element2.children), element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
18197
20186
|
}
|
|
18198
20187
|
visitAttribute(attribute, context) {
|
|
18199
20188
|
return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;
|
|
18200
20189
|
}
|
|
18201
|
-
visitText(
|
|
18202
|
-
const isNotBlank =
|
|
20190
|
+
visitText(text2, context) {
|
|
20191
|
+
const isNotBlank = text2.value.match(NO_WS_REGEXP);
|
|
18203
20192
|
const hasExpansionSibling = context && (context.prev instanceof Expansion || context.next instanceof Expansion);
|
|
18204
20193
|
if (isNotBlank || hasExpansionSibling) {
|
|
18205
|
-
const tokens =
|
|
18206
|
-
const value = processWhitespace(
|
|
18207
|
-
return new Text(value,
|
|
20194
|
+
const tokens = text2.tokens.map((token) => token.type === 5 ? createWhitespaceProcessedTextToken(token) : token);
|
|
20195
|
+
const value = processWhitespace(text2.value);
|
|
20196
|
+
return new Text(value, text2.sourceSpan, tokens, text2.i18n);
|
|
18208
20197
|
}
|
|
18209
20198
|
return null;
|
|
18210
20199
|
}
|
|
@@ -18221,8 +20210,8 @@ var WhitespaceVisitor = class {
|
|
|
18221
20210
|
function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
|
|
18222
20211
|
return { type, parts: [processWhitespace(parts[0])], sourceSpan };
|
|
18223
20212
|
}
|
|
18224
|
-
function processWhitespace(
|
|
18225
|
-
return replaceNgsp(
|
|
20213
|
+
function processWhitespace(text2) {
|
|
20214
|
+
return replaceNgsp(text2).replace(WS_REPLACE_REGEXP, " ");
|
|
18226
20215
|
}
|
|
18227
20216
|
function visitAllWithSiblings(visitor, nodes) {
|
|
18228
20217
|
const result = [];
|
|
@@ -18689,19 +20678,19 @@ var HtmlAstToIvyAst = class {
|
|
|
18689
20678
|
this.commentNodes = [];
|
|
18690
20679
|
this.inI18nBlock = false;
|
|
18691
20680
|
}
|
|
18692
|
-
visitElement(
|
|
18693
|
-
const isI18nRootElement = isI18nRootNode(
|
|
20681
|
+
visitElement(element2) {
|
|
20682
|
+
const isI18nRootElement = isI18nRootNode(element2.i18n);
|
|
18694
20683
|
if (isI18nRootElement) {
|
|
18695
20684
|
if (this.inI18nBlock) {
|
|
18696
|
-
this.reportError("Cannot mark an element as translatable inside of a translatable section. Please remove the nested i18n marker.",
|
|
20685
|
+
this.reportError("Cannot mark an element as translatable inside of a translatable section. Please remove the nested i18n marker.", element2.sourceSpan);
|
|
18697
20686
|
}
|
|
18698
20687
|
this.inI18nBlock = true;
|
|
18699
20688
|
}
|
|
18700
|
-
const preparsedElement = preparseElement(
|
|
20689
|
+
const preparsedElement = preparseElement(element2);
|
|
18701
20690
|
if (preparsedElement.type === PreparsedElementType.SCRIPT) {
|
|
18702
20691
|
return null;
|
|
18703
20692
|
} else if (preparsedElement.type === PreparsedElementType.STYLE) {
|
|
18704
|
-
const contents = textContents(
|
|
20693
|
+
const contents = textContents(element2);
|
|
18705
20694
|
if (contents !== null) {
|
|
18706
20695
|
this.styles.push(contents);
|
|
18707
20696
|
}
|
|
@@ -18710,7 +20699,7 @@ var HtmlAstToIvyAst = class {
|
|
|
18710
20699
|
this.styleUrls.push(preparsedElement.hrefAttr);
|
|
18711
20700
|
return null;
|
|
18712
20701
|
}
|
|
18713
|
-
const isTemplateElement = isNgTemplate(
|
|
20702
|
+
const isTemplateElement = isNgTemplate(element2.name);
|
|
18714
20703
|
const parsedProperties = [];
|
|
18715
20704
|
const boundEvents = [];
|
|
18716
20705
|
const variables = [];
|
|
@@ -18720,7 +20709,7 @@ var HtmlAstToIvyAst = class {
|
|
|
18720
20709
|
const templateParsedProperties = [];
|
|
18721
20710
|
const templateVariables = [];
|
|
18722
20711
|
let elementHasInlineTemplate = false;
|
|
18723
|
-
for (const attribute of
|
|
20712
|
+
for (const attribute of element2.attrs) {
|
|
18724
20713
|
let hasBinding = false;
|
|
18725
20714
|
const normalizedName = normalizeAttributeName(attribute.name);
|
|
18726
20715
|
let isTemplateBinding = false;
|
|
@@ -18746,22 +20735,22 @@ var HtmlAstToIvyAst = class {
|
|
|
18746
20735
|
attributes.push(this.visitAttribute(attribute));
|
|
18747
20736
|
}
|
|
18748
20737
|
}
|
|
18749
|
-
const children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this,
|
|
20738
|
+
const children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element2.children);
|
|
18750
20739
|
let parsedElement;
|
|
18751
20740
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
|
18752
|
-
if (
|
|
18753
|
-
this.reportError(`<ng-content> element cannot have content.`,
|
|
20741
|
+
if (element2.children && !element2.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
|
|
20742
|
+
this.reportError(`<ng-content> element cannot have content.`, element2.sourceSpan);
|
|
18754
20743
|
}
|
|
18755
20744
|
const selector = preparsedElement.selectAttr;
|
|
18756
|
-
const attrs =
|
|
18757
|
-
parsedElement = new Content(selector, attrs,
|
|
20745
|
+
const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
|
|
20746
|
+
parsedElement = new Content(selector, attrs, element2.sourceSpan, element2.i18n);
|
|
18758
20747
|
this.ngContentSelectors.push(selector);
|
|
18759
20748
|
} else if (isTemplateElement) {
|
|
18760
|
-
const attrs = this.extractAttributes(
|
|
18761
|
-
parsedElement = new Template(
|
|
20749
|
+
const attrs = this.extractAttributes(element2.name, parsedProperties, i18nAttrsMeta);
|
|
20750
|
+
parsedElement = new Template(element2.name, attributes, attrs.bound, boundEvents, [], children, references, variables, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
18762
20751
|
} else {
|
|
18763
|
-
const attrs = this.extractAttributes(
|
|
18764
|
-
parsedElement = new Element$1(
|
|
20752
|
+
const attrs = this.extractAttributes(element2.name, parsedProperties, i18nAttrsMeta);
|
|
20753
|
+
parsedElement = new Element$1(element2.name, attributes, attrs.bound, boundEvents, children, references, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
18765
20754
|
}
|
|
18766
20755
|
if (elementHasInlineTemplate) {
|
|
18767
20756
|
const attrs = this.extractAttributes("ng-template", templateParsedProperties, i18nAttrsMeta);
|
|
@@ -18773,9 +20762,9 @@ var HtmlAstToIvyAst = class {
|
|
|
18773
20762
|
inputs: parsedElement.inputs,
|
|
18774
20763
|
outputs: parsedElement.outputs
|
|
18775
20764
|
} : { attributes: [], inputs: [], outputs: [] };
|
|
18776
|
-
const i18n = isTemplateElement && isI18nRootElement ? void 0 :
|
|
20765
|
+
const i18n = isTemplateElement && isI18nRootElement ? void 0 : element2.i18n;
|
|
18777
20766
|
const name = parsedElement instanceof Template ? null : parsedElement.name;
|
|
18778
|
-
parsedElement = new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [], templateVariables,
|
|
20767
|
+
parsedElement = new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [], templateVariables, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, i18n);
|
|
18779
20768
|
}
|
|
18780
20769
|
if (isI18nRootElement) {
|
|
18781
20770
|
this.inI18nBlock = false;
|
|
@@ -18785,8 +20774,8 @@ var HtmlAstToIvyAst = class {
|
|
|
18785
20774
|
visitAttribute(attribute) {
|
|
18786
20775
|
return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
|
|
18787
20776
|
}
|
|
18788
|
-
visitText(
|
|
18789
|
-
return this._visitTextWithInterpolation(
|
|
20777
|
+
visitText(text2) {
|
|
20778
|
+
return this._visitTextWithInterpolation(text2.value, text2.sourceSpan, text2.tokens, text2.i18n);
|
|
18790
20779
|
}
|
|
18791
20780
|
visitExpansion(expansion) {
|
|
18792
20781
|
if (!expansion.i18n) {
|
|
@@ -18834,7 +20823,7 @@ var HtmlAstToIvyAst = class {
|
|
|
18834
20823
|
return { bound, literal: literal2 };
|
|
18835
20824
|
}
|
|
18836
20825
|
parseAttribute(isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references) {
|
|
18837
|
-
var
|
|
20826
|
+
var _a2;
|
|
18838
20827
|
const name = normalizeAttributeName(attribute.name);
|
|
18839
20828
|
const value = attribute.value;
|
|
18840
20829
|
const srcSpan = attribute.sourceSpan;
|
|
@@ -18904,7 +20893,7 @@ var HtmlAstToIvyAst = class {
|
|
|
18904
20893
|
return true;
|
|
18905
20894
|
}
|
|
18906
20895
|
const keySpan = createKeySpan(srcSpan, "", name);
|
|
18907
|
-
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, (
|
|
20896
|
+
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, (_a2 = attribute.valueTokens) != null ? _a2 : null);
|
|
18908
20897
|
return hasBinding;
|
|
18909
20898
|
}
|
|
18910
20899
|
_visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
|
|
@@ -18925,7 +20914,7 @@ var HtmlAstToIvyAst = class {
|
|
|
18925
20914
|
this.reportError(`"-" is not allowed in reference names`, sourceSpan);
|
|
18926
20915
|
} else if (identifier.length === 0) {
|
|
18927
20916
|
this.reportError(`Reference does not have a name`, sourceSpan);
|
|
18928
|
-
} else if (references.some((
|
|
20917
|
+
} else if (references.some((reference2) => reference2.name === identifier)) {
|
|
18929
20918
|
this.reportError(`Reference "#${identifier}" is defined more than once`, sourceSpan);
|
|
18930
20919
|
}
|
|
18931
20920
|
references.push(new Reference(identifier, value, sourceSpan, keySpan, valueSpan));
|
|
@@ -18964,8 +20953,8 @@ var NonBindableVisitor = class {
|
|
|
18964
20953
|
visitAttribute(attribute) {
|
|
18965
20954
|
return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
|
|
18966
20955
|
}
|
|
18967
|
-
visitText(
|
|
18968
|
-
return new Text$3(
|
|
20956
|
+
visitText(text2) {
|
|
20957
|
+
return new Text$3(text2.value, text2.sourceSpan);
|
|
18969
20958
|
}
|
|
18970
20959
|
visitExpansion(expansion) {
|
|
18971
20960
|
return null;
|
|
@@ -19110,26 +21099,26 @@ function findTemplateFn(ctx, templateIndex) {
|
|
|
19110
21099
|
return (token) => typeof token === "object" && token.type === TagType.TEMPLATE && token.index === templateIndex && token.ctx === ctx;
|
|
19111
21100
|
}
|
|
19112
21101
|
function serializePlaceholderValue(value) {
|
|
19113
|
-
const
|
|
19114
|
-
const
|
|
21102
|
+
const element2 = (data, closed) => wrapTag("#", data, closed);
|
|
21103
|
+
const template2 = (data, closed) => wrapTag("*", data, closed);
|
|
19115
21104
|
switch (value.type) {
|
|
19116
21105
|
case TagType.ELEMENT:
|
|
19117
21106
|
if (value.closed) {
|
|
19118
|
-
return
|
|
21107
|
+
return element2(value, true) + (value.tmpl ? template2(value.tmpl, true) : "");
|
|
19119
21108
|
}
|
|
19120
21109
|
if (value.tmpl) {
|
|
19121
|
-
return
|
|
21110
|
+
return template2(value.tmpl) + element2(value) + (value.isVoid ? template2(value.tmpl, true) : "");
|
|
19122
21111
|
}
|
|
19123
|
-
return
|
|
21112
|
+
return element2(value);
|
|
19124
21113
|
case TagType.TEMPLATE:
|
|
19125
|
-
return
|
|
21114
|
+
return template2(value, value.closed);
|
|
19126
21115
|
default:
|
|
19127
21116
|
return value;
|
|
19128
21117
|
}
|
|
19129
21118
|
}
|
|
19130
21119
|
var IcuSerializerVisitor = class {
|
|
19131
|
-
visitText(
|
|
19132
|
-
return
|
|
21120
|
+
visitText(text2) {
|
|
21121
|
+
return text2.value;
|
|
19133
21122
|
}
|
|
19134
21123
|
visitContainer(container) {
|
|
19135
21124
|
return container.children.map((child) => child.visit(this)).join("");
|
|
@@ -19274,7 +21263,7 @@ var _I18nVisitor = class {
|
|
|
19274
21263
|
return new Message(i18nodes, context.placeholderToContent, context.placeholderToMessage, meaning, description, customId);
|
|
19275
21264
|
}
|
|
19276
21265
|
visitElement(el, context) {
|
|
19277
|
-
var
|
|
21266
|
+
var _a2;
|
|
19278
21267
|
const children = visitAll(this, el.children, context);
|
|
19279
21268
|
const attrs = {};
|
|
19280
21269
|
el.attrs.forEach((attr) => {
|
|
@@ -19291,7 +21280,7 @@ var _I18nVisitor = class {
|
|
|
19291
21280
|
closePhName = context.placeholderRegistry.getCloseTagPlaceholderName(el.name);
|
|
19292
21281
|
context.placeholderToContent[closePhName] = {
|
|
19293
21282
|
text: `</${el.name}>`,
|
|
19294
|
-
sourceSpan: (
|
|
21283
|
+
sourceSpan: (_a2 = el.endSourceSpan) != null ? _a2 : el.sourceSpan
|
|
19295
21284
|
};
|
|
19296
21285
|
}
|
|
19297
21286
|
const node = new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
|
|
@@ -19301,9 +21290,9 @@ var _I18nVisitor = class {
|
|
|
19301
21290
|
const node = attribute.valueTokens === void 0 || attribute.valueTokens.length === 1 ? new Text$2(attribute.value, attribute.valueSpan || attribute.sourceSpan) : this._visitTextWithInterpolation(attribute.valueTokens, attribute.valueSpan || attribute.sourceSpan, context, attribute.i18n);
|
|
19302
21291
|
return context.visitNodeFn(attribute, node);
|
|
19303
21292
|
}
|
|
19304
|
-
visitText(
|
|
19305
|
-
const node =
|
|
19306
|
-
return context.visitNodeFn(
|
|
21293
|
+
visitText(text2, context) {
|
|
21294
|
+
const node = text2.tokens.length === 1 ? new Text$2(text2.value, text2.sourceSpan) : this._visitTextWithInterpolation(text2.tokens, text2.sourceSpan, context, text2.i18n);
|
|
21295
|
+
return context.visitNodeFn(text2, node);
|
|
19307
21296
|
}
|
|
19308
21297
|
visitComment(comment2, context) {
|
|
19309
21298
|
return null;
|
|
@@ -19435,23 +21424,23 @@ var I18nMetaVisitor = class {
|
|
|
19435
21424
|
const result = nodes.map((node) => node.visit(this, null));
|
|
19436
21425
|
return new ParseTreeResult(result, this._errors);
|
|
19437
21426
|
}
|
|
19438
|
-
visitElement(
|
|
21427
|
+
visitElement(element2) {
|
|
19439
21428
|
let message = void 0;
|
|
19440
|
-
if (hasI18nAttrs(
|
|
21429
|
+
if (hasI18nAttrs(element2)) {
|
|
19441
21430
|
this.hasI18nMeta = true;
|
|
19442
21431
|
const attrs = [];
|
|
19443
21432
|
const attrsMeta = {};
|
|
19444
|
-
for (const attr of
|
|
21433
|
+
for (const attr of element2.attrs) {
|
|
19445
21434
|
if (attr.name === I18N_ATTR) {
|
|
19446
|
-
const i18n =
|
|
19447
|
-
message = this._generateI18nMessage(
|
|
21435
|
+
const i18n = element2.i18n || attr.value;
|
|
21436
|
+
message = this._generateI18nMessage(element2.children, i18n, setI18nRefs);
|
|
19448
21437
|
if (message.nodes.length === 0) {
|
|
19449
21438
|
message = void 0;
|
|
19450
21439
|
}
|
|
19451
|
-
|
|
21440
|
+
element2.i18n = message;
|
|
19452
21441
|
} else if (attr.name.startsWith(I18N_ATTR_PREFIX)) {
|
|
19453
21442
|
const name = attr.name.slice(I18N_ATTR_PREFIX.length);
|
|
19454
|
-
if (isTrustedTypesSink(
|
|
21443
|
+
if (isTrustedTypesSink(element2.name, name)) {
|
|
19455
21444
|
this._reportError(attr, `Translating attribute '${name}' is disallowed for security reasons.`);
|
|
19456
21445
|
} else {
|
|
19457
21446
|
attrsMeta[name] = attr.value;
|
|
@@ -19469,11 +21458,11 @@ var I18nMetaVisitor = class {
|
|
|
19469
21458
|
}
|
|
19470
21459
|
}
|
|
19471
21460
|
if (!this.keepI18nAttrs) {
|
|
19472
|
-
|
|
21461
|
+
element2.attrs = attrs;
|
|
19473
21462
|
}
|
|
19474
21463
|
}
|
|
19475
|
-
visitAll(this,
|
|
19476
|
-
return
|
|
21464
|
+
visitAll(this, element2.children, message);
|
|
21465
|
+
return element2;
|
|
19477
21466
|
}
|
|
19478
21467
|
visitExpansion(expansion, currentMessage) {
|
|
19479
21468
|
let message;
|
|
@@ -19493,8 +21482,8 @@ var I18nMetaVisitor = class {
|
|
|
19493
21482
|
expansion.i18n = message;
|
|
19494
21483
|
return expansion;
|
|
19495
21484
|
}
|
|
19496
|
-
visitText(
|
|
19497
|
-
return
|
|
21485
|
+
visitText(text2) {
|
|
21486
|
+
return text2;
|
|
19498
21487
|
}
|
|
19499
21488
|
visitAttribute(attribute) {
|
|
19500
21489
|
return attribute;
|
|
@@ -19576,8 +21565,8 @@ var GetMsgSerializerVisitor = class {
|
|
|
19576
21565
|
formatPh(value) {
|
|
19577
21566
|
return `{$${formatI18nPlaceholderName(value)}}`;
|
|
19578
21567
|
}
|
|
19579
|
-
visitText(
|
|
19580
|
-
return
|
|
21568
|
+
visitText(text2) {
|
|
21569
|
+
return text2.value;
|
|
19581
21570
|
}
|
|
19582
21571
|
visitContainer(container) {
|
|
19583
21572
|
return container.children.map((child) => child.visit(this)).join("");
|
|
@@ -19612,12 +21601,12 @@ var LocalizeSerializerVisitor = class {
|
|
|
19612
21601
|
this.placeholderToMessage = placeholderToMessage;
|
|
19613
21602
|
this.pieces = pieces;
|
|
19614
21603
|
}
|
|
19615
|
-
visitText(
|
|
21604
|
+
visitText(text2) {
|
|
19616
21605
|
if (this.pieces[this.pieces.length - 1] instanceof LiteralPiece) {
|
|
19617
|
-
this.pieces[this.pieces.length - 1].text +=
|
|
21606
|
+
this.pieces[this.pieces.length - 1].text += text2.value;
|
|
19618
21607
|
} else {
|
|
19619
|
-
const sourceSpan = new ParseSourceSpan(
|
|
19620
|
-
this.pieces.push(new LiteralPiece(
|
|
21608
|
+
const sourceSpan = new ParseSourceSpan(text2.sourceSpan.fullStart, text2.sourceSpan.end, text2.sourceSpan.fullStart, text2.sourceSpan.details);
|
|
21609
|
+
this.pieces.push(new LiteralPiece(text2.value, sourceSpan));
|
|
19621
21610
|
}
|
|
19622
21611
|
}
|
|
19623
21612
|
visitContainer(container) {
|
|
@@ -19627,8 +21616,8 @@ var LocalizeSerializerVisitor = class {
|
|
|
19627
21616
|
this.pieces.push(new LiteralPiece(serializeIcuNode(icu), icu.sourceSpan));
|
|
19628
21617
|
}
|
|
19629
21618
|
visitTagPlaceholder(ph) {
|
|
19630
|
-
var
|
|
19631
|
-
this.pieces.push(this.createPlaceholderPiece(ph.startName, (
|
|
21619
|
+
var _a2, _b;
|
|
21620
|
+
this.pieces.push(this.createPlaceholderPiece(ph.startName, (_a2 = ph.startSourceSpan) != null ? _a2 : ph.sourceSpan));
|
|
19632
21621
|
if (!ph.isVoid) {
|
|
19633
21622
|
ph.children.forEach((child) => child.visit(this));
|
|
19634
21623
|
this.pieces.push(this.createPlaceholderPiece(ph.closeName, (_b = ph.endSourceSpan) != null ? _b : ph.sourceSpan));
|
|
@@ -19995,9 +21984,9 @@ var TemplateDefinitionBuilder = class {
|
|
|
19995
21984
|
return Identifiers.namespaceHTML;
|
|
19996
21985
|
}
|
|
19997
21986
|
}
|
|
19998
|
-
addNamespaceInstruction(nsInstruction,
|
|
21987
|
+
addNamespaceInstruction(nsInstruction, element2) {
|
|
19999
21988
|
this._namespace = nsInstruction;
|
|
20000
|
-
this.creationInstruction(
|
|
21989
|
+
this.creationInstruction(element2.startSourceSpan, nsInstruction);
|
|
20001
21990
|
}
|
|
20002
21991
|
interpolatedUpdateInstruction(instruction, elementIndex, attrName, input, value, params) {
|
|
20003
21992
|
this.updateInstructionWithAdvance(elementIndex, input.sourceSpan, instruction, () => [literal(attrName), ...this.getUpdateInstructionArguments(value), ...params]);
|
|
@@ -20019,16 +22008,16 @@ var TemplateDefinitionBuilder = class {
|
|
|
20019
22008
|
this.i18n.appendProjection(ngContent.i18n, slot);
|
|
20020
22009
|
}
|
|
20021
22010
|
}
|
|
20022
|
-
visitElement(
|
|
20023
|
-
var
|
|
22011
|
+
visitElement(element2) {
|
|
22012
|
+
var _a2, _b;
|
|
20024
22013
|
const elementIndex = this.allocateDataSlot();
|
|
20025
22014
|
const stylingBuilder = new StylingBuilder(null);
|
|
20026
22015
|
let isNonBindableMode = false;
|
|
20027
|
-
const isI18nRootElement = isI18nRootNode(
|
|
22016
|
+
const isI18nRootElement = isI18nRootNode(element2.i18n) && !isSingleI18nIcu(element2.i18n);
|
|
20028
22017
|
const outputAttrs = [];
|
|
20029
|
-
const [namespaceKey, elementName] = splitNsName(
|
|
20030
|
-
const isNgContainer$1 = isNgContainer(
|
|
20031
|
-
for (const attr of
|
|
22018
|
+
const [namespaceKey, elementName] = splitNsName(element2.name);
|
|
22019
|
+
const isNgContainer$1 = isNgContainer(element2.name);
|
|
22020
|
+
for (const attr of element2.attributes) {
|
|
20032
22021
|
const { name, value } = attr;
|
|
20033
22022
|
if (name === NON_BINDABLE_ATTR) {
|
|
20034
22023
|
isNonBindableMode = true;
|
|
@@ -20046,7 +22035,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
20046
22035
|
}
|
|
20047
22036
|
const allOtherInputs = [];
|
|
20048
22037
|
const boundI18nAttrs = [];
|
|
20049
|
-
|
|
22038
|
+
element2.inputs.forEach((input) => {
|
|
20050
22039
|
const stylingInputWasSet = stylingBuilder.registerBoundInput(input);
|
|
20051
22040
|
if (!stylingInputWasSet) {
|
|
20052
22041
|
if (input.type === 0 && input.i18n) {
|
|
@@ -20056,38 +22045,38 @@ var TemplateDefinitionBuilder = class {
|
|
|
20056
22045
|
}
|
|
20057
22046
|
}
|
|
20058
22047
|
});
|
|
20059
|
-
const attributes = this.getAttributeExpressions(
|
|
22048
|
+
const attributes = this.getAttributeExpressions(element2.name, outputAttrs, allOtherInputs, element2.outputs, stylingBuilder, [], boundI18nAttrs);
|
|
20060
22049
|
parameters.push(this.addAttrsToConsts(attributes));
|
|
20061
|
-
const refs = this.prepareRefsArray(
|
|
22050
|
+
const refs = this.prepareRefsArray(element2.references);
|
|
20062
22051
|
parameters.push(this.addToConsts(refs));
|
|
20063
22052
|
const wasInNamespace = this._namespace;
|
|
20064
22053
|
const currentNamespace = this.getNamespaceInstruction(namespaceKey);
|
|
20065
22054
|
if (currentNamespace !== wasInNamespace) {
|
|
20066
|
-
this.addNamespaceInstruction(currentNamespace,
|
|
22055
|
+
this.addNamespaceInstruction(currentNamespace, element2);
|
|
20067
22056
|
}
|
|
20068
22057
|
if (this.i18n) {
|
|
20069
|
-
this.i18n.appendElement(
|
|
22058
|
+
this.i18n.appendElement(element2.i18n, elementIndex);
|
|
20070
22059
|
}
|
|
20071
|
-
const hasChildren = !isI18nRootElement && this.i18n ? !hasTextChildrenOnly(
|
|
20072
|
-
const createSelfClosingInstruction = !stylingBuilder.hasBindingsWithPipes &&
|
|
20073
|
-
const createSelfClosingI18nInstruction = !createSelfClosingInstruction && hasTextChildrenOnly(
|
|
22060
|
+
const hasChildren = !isI18nRootElement && this.i18n ? !hasTextChildrenOnly(element2.children) : element2.children.length > 0;
|
|
22061
|
+
const createSelfClosingInstruction = !stylingBuilder.hasBindingsWithPipes && element2.outputs.length === 0 && boundI18nAttrs.length === 0 && !hasChildren;
|
|
22062
|
+
const createSelfClosingI18nInstruction = !createSelfClosingInstruction && hasTextChildrenOnly(element2.children);
|
|
20074
22063
|
if (createSelfClosingInstruction) {
|
|
20075
|
-
this.creationInstruction(
|
|
22064
|
+
this.creationInstruction(element2.sourceSpan, isNgContainer$1 ? Identifiers.elementContainer : Identifiers.element, trimTrailingNulls(parameters));
|
|
20076
22065
|
} else {
|
|
20077
|
-
this.creationInstruction(
|
|
22066
|
+
this.creationInstruction(element2.startSourceSpan, isNgContainer$1 ? Identifiers.elementContainerStart : Identifiers.elementStart, trimTrailingNulls(parameters));
|
|
20078
22067
|
if (isNonBindableMode) {
|
|
20079
|
-
this.creationInstruction(
|
|
22068
|
+
this.creationInstruction(element2.startSourceSpan, Identifiers.disableBindings);
|
|
20080
22069
|
}
|
|
20081
22070
|
if (boundI18nAttrs.length > 0) {
|
|
20082
|
-
this.i18nAttributesInstruction(elementIndex, boundI18nAttrs, (
|
|
22071
|
+
this.i18nAttributesInstruction(elementIndex, boundI18nAttrs, (_a2 = element2.startSourceSpan) != null ? _a2 : element2.sourceSpan);
|
|
20083
22072
|
}
|
|
20084
|
-
if (
|
|
20085
|
-
for (const outputAst of
|
|
20086
|
-
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter(
|
|
22073
|
+
if (element2.outputs.length > 0) {
|
|
22074
|
+
for (const outputAst of element2.outputs) {
|
|
22075
|
+
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter(element2.name, outputAst, elementIndex));
|
|
20087
22076
|
}
|
|
20088
22077
|
}
|
|
20089
22078
|
if (isI18nRootElement) {
|
|
20090
|
-
this.i18nStart(
|
|
22079
|
+
this.i18nStart(element2.startSourceSpan, element2.i18n, createSelfClosingI18nInstruction);
|
|
20091
22080
|
}
|
|
20092
22081
|
}
|
|
20093
22082
|
const stylingInstructions = stylingBuilder.buildUpdateLevelInstructions(this._valueConverter);
|
|
@@ -20119,7 +22108,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
20119
22108
|
const isAttributeBinding = inputType === 1;
|
|
20120
22109
|
let sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
|
|
20121
22110
|
if (!sanitizationRef) {
|
|
20122
|
-
if (isIframeElement(
|
|
22111
|
+
if (isIframeElement(element2.name) && isIframeSecuritySensitiveAttr(input.name)) {
|
|
20123
22112
|
sanitizationRef = importExpr(Identifiers.validateIframeAttribute);
|
|
20124
22113
|
}
|
|
20125
22114
|
}
|
|
@@ -20173,12 +22162,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
20173
22162
|
for (const attributeBinding of attributeBindings) {
|
|
20174
22163
|
this.updateInstructionWithAdvance(elementIndex, attributeBinding.span, Identifiers.attribute, attributeBinding.paramsOrFn);
|
|
20175
22164
|
}
|
|
20176
|
-
visitAll$1(this,
|
|
22165
|
+
visitAll$1(this, element2.children);
|
|
20177
22166
|
if (!isI18nRootElement && this.i18n) {
|
|
20178
|
-
this.i18n.appendElement(
|
|
22167
|
+
this.i18n.appendElement(element2.i18n, elementIndex, true);
|
|
20179
22168
|
}
|
|
20180
22169
|
if (!createSelfClosingInstruction) {
|
|
20181
|
-
const span = (_b =
|
|
22170
|
+
const span = (_b = element2.endSourceSpan) != null ? _b : element2.sourceSpan;
|
|
20182
22171
|
if (isI18nRootElement) {
|
|
20183
22172
|
this.i18nEnd(span, createSelfClosingI18nInstruction);
|
|
20184
22173
|
}
|
|
@@ -20188,77 +22177,77 @@ var TemplateDefinitionBuilder = class {
|
|
|
20188
22177
|
this.creationInstruction(span, isNgContainer$1 ? Identifiers.elementContainerEnd : Identifiers.elementEnd);
|
|
20189
22178
|
}
|
|
20190
22179
|
}
|
|
20191
|
-
visitTemplate(
|
|
20192
|
-
var
|
|
22180
|
+
visitTemplate(template2) {
|
|
22181
|
+
var _a2;
|
|
20193
22182
|
const NG_TEMPLATE_TAG_NAME = "ng-template";
|
|
20194
22183
|
const templateIndex = this.allocateDataSlot();
|
|
20195
22184
|
if (this.i18n) {
|
|
20196
|
-
this.i18n.appendTemplate(
|
|
22185
|
+
this.i18n.appendTemplate(template2.i18n, templateIndex);
|
|
20197
22186
|
}
|
|
20198
|
-
const tagNameWithoutNamespace =
|
|
20199
|
-
const contextName = `${this.contextName}${
|
|
22187
|
+
const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
|
|
22188
|
+
const contextName = `${this.contextName}${template2.tagName ? "_" + sanitizeIdentifier(template2.tagName) : ""}_${templateIndex}`;
|
|
20200
22189
|
const templateName = `${contextName}_Template`;
|
|
20201
22190
|
const parameters = [
|
|
20202
22191
|
literal(templateIndex),
|
|
20203
22192
|
variable(templateName),
|
|
20204
22193
|
literal(tagNameWithoutNamespace)
|
|
20205
22194
|
];
|
|
20206
|
-
const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME,
|
|
22195
|
+
const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
|
|
20207
22196
|
parameters.push(this.addAttrsToConsts(attrsExprs));
|
|
20208
|
-
if (
|
|
20209
|
-
const refs = this.prepareRefsArray(
|
|
22197
|
+
if (template2.references && template2.references.length) {
|
|
22198
|
+
const refs = this.prepareRefsArray(template2.references);
|
|
20210
22199
|
parameters.push(this.addToConsts(refs));
|
|
20211
22200
|
parameters.push(importExpr(Identifiers.templateRefExtractor));
|
|
20212
22201
|
}
|
|
20213
22202
|
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this._constants);
|
|
20214
22203
|
this._nestedTemplateFns.push(() => {
|
|
20215
|
-
const templateFunctionExpr = templateVisitor.buildTemplateFunction(
|
|
22204
|
+
const templateFunctionExpr = templateVisitor.buildTemplateFunction(template2.children, template2.variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, template2.i18n);
|
|
20216
22205
|
this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(templateName));
|
|
20217
22206
|
if (templateVisitor._ngContentReservedSlots.length) {
|
|
20218
22207
|
this._ngContentReservedSlots.push(...templateVisitor._ngContentReservedSlots);
|
|
20219
22208
|
}
|
|
20220
22209
|
});
|
|
20221
|
-
this.creationInstruction(
|
|
22210
|
+
this.creationInstruction(template2.sourceSpan, Identifiers.templateCreate, () => {
|
|
20222
22211
|
parameters.splice(2, 0, literal(templateVisitor.getConstCount()), literal(templateVisitor.getVarCount()));
|
|
20223
22212
|
return trimTrailingNulls(parameters);
|
|
20224
22213
|
});
|
|
20225
|
-
this.templatePropertyBindings(templateIndex,
|
|
22214
|
+
this.templatePropertyBindings(templateIndex, template2.templateAttrs);
|
|
20226
22215
|
if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME) {
|
|
20227
|
-
const [i18nInputs, inputs] = partitionArray(
|
|
22216
|
+
const [i18nInputs, inputs] = partitionArray(template2.inputs, hasI18nMeta);
|
|
20228
22217
|
if (i18nInputs.length > 0) {
|
|
20229
|
-
this.i18nAttributesInstruction(templateIndex, i18nInputs, (
|
|
22218
|
+
this.i18nAttributesInstruction(templateIndex, i18nInputs, (_a2 = template2.startSourceSpan) != null ? _a2 : template2.sourceSpan);
|
|
20230
22219
|
}
|
|
20231
22220
|
if (inputs.length > 0) {
|
|
20232
22221
|
this.templatePropertyBindings(templateIndex, inputs);
|
|
20233
22222
|
}
|
|
20234
|
-
for (const outputAst of
|
|
22223
|
+
for (const outputAst of template2.outputs) {
|
|
20235
22224
|
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter("ng_template", outputAst, templateIndex));
|
|
20236
22225
|
}
|
|
20237
22226
|
}
|
|
20238
22227
|
}
|
|
20239
|
-
visitBoundText(
|
|
22228
|
+
visitBoundText(text2) {
|
|
20240
22229
|
if (this.i18n) {
|
|
20241
|
-
const value2 =
|
|
22230
|
+
const value2 = text2.value.visit(this._valueConverter);
|
|
20242
22231
|
this.allocateBindingSlots(value2);
|
|
20243
22232
|
if (value2 instanceof Interpolation) {
|
|
20244
|
-
this.i18n.appendBoundText(
|
|
22233
|
+
this.i18n.appendBoundText(text2.i18n);
|
|
20245
22234
|
this.i18nAppendBindings(value2.expressions);
|
|
20246
22235
|
}
|
|
20247
22236
|
return;
|
|
20248
22237
|
}
|
|
20249
22238
|
const nodeIndex = this.allocateDataSlot();
|
|
20250
|
-
this.creationInstruction(
|
|
20251
|
-
const value =
|
|
22239
|
+
this.creationInstruction(text2.sourceSpan, Identifiers.text, [literal(nodeIndex)]);
|
|
22240
|
+
const value = text2.value.visit(this._valueConverter);
|
|
20252
22241
|
this.allocateBindingSlots(value);
|
|
20253
22242
|
if (value instanceof Interpolation) {
|
|
20254
|
-
this.updateInstructionWithAdvance(nodeIndex,
|
|
22243
|
+
this.updateInstructionWithAdvance(nodeIndex, text2.sourceSpan, getTextInterpolationExpression(value), () => this.getUpdateInstructionArguments(value));
|
|
20255
22244
|
} else {
|
|
20256
22245
|
error("Text nodes should be interpolated and never bound directly.");
|
|
20257
22246
|
}
|
|
20258
22247
|
}
|
|
20259
|
-
visitText(
|
|
22248
|
+
visitText(text2) {
|
|
20260
22249
|
if (!this.i18n) {
|
|
20261
|
-
this.creationInstruction(
|
|
22250
|
+
this.creationInstruction(text2.sourceSpan, Identifiers.text, [literal(this.allocateDataSlot()), literal(text2.value)]);
|
|
20262
22251
|
}
|
|
20263
22252
|
}
|
|
20264
22253
|
visitIcu(icu) {
|
|
@@ -20330,28 +22319,28 @@ var TemplateDefinitionBuilder = class {
|
|
|
20330
22319
|
this.updateInstructionWithAdvance(templateIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
|
|
20331
22320
|
}
|
|
20332
22321
|
}
|
|
20333
|
-
instructionFn(fns, span,
|
|
20334
|
-
fns[prepend ? "unshift" : "push"]({ span, reference, paramsOrFn });
|
|
22322
|
+
instructionFn(fns, span, reference2, paramsOrFn, prepend = false) {
|
|
22323
|
+
fns[prepend ? "unshift" : "push"]({ span, reference: reference2, paramsOrFn });
|
|
20335
22324
|
}
|
|
20336
22325
|
processStylingUpdateInstruction(elementIndex, instruction) {
|
|
20337
22326
|
let allocateBindingSlots = 0;
|
|
20338
22327
|
if (instruction) {
|
|
20339
|
-
for (const
|
|
20340
|
-
allocateBindingSlots +=
|
|
20341
|
-
this.updateInstructionWithAdvance(elementIndex,
|
|
22328
|
+
for (const call2 of instruction.calls) {
|
|
22329
|
+
allocateBindingSlots += call2.allocateBindingSlots;
|
|
22330
|
+
this.updateInstructionWithAdvance(elementIndex, call2.sourceSpan, instruction.reference, () => call2.params((value) => call2.supportsInterpolation && value instanceof Interpolation ? this.getUpdateInstructionArguments(value) : this.convertPropertyBinding(value)));
|
|
20342
22331
|
}
|
|
20343
22332
|
}
|
|
20344
22333
|
return allocateBindingSlots;
|
|
20345
22334
|
}
|
|
20346
|
-
creationInstruction(span,
|
|
20347
|
-
this.instructionFn(this._creationCodeFns, span,
|
|
22335
|
+
creationInstruction(span, reference2, paramsOrFn, prepend) {
|
|
22336
|
+
this.instructionFn(this._creationCodeFns, span, reference2, paramsOrFn || [], prepend);
|
|
20348
22337
|
}
|
|
20349
|
-
updateInstructionWithAdvance(nodeIndex, span,
|
|
22338
|
+
updateInstructionWithAdvance(nodeIndex, span, reference2, paramsOrFn) {
|
|
20350
22339
|
this.addAdvanceInstructionIfNecessary(nodeIndex, span);
|
|
20351
|
-
this.updateInstruction(span,
|
|
22340
|
+
this.updateInstruction(span, reference2, paramsOrFn);
|
|
20352
22341
|
}
|
|
20353
|
-
updateInstruction(span,
|
|
20354
|
-
this.instructionFn(this._updateCodeFns, span,
|
|
22342
|
+
updateInstruction(span, reference2, paramsOrFn) {
|
|
22343
|
+
this.instructionFn(this._updateCodeFns, span, reference2, paramsOrFn || []);
|
|
20355
22344
|
}
|
|
20356
22345
|
addAdvanceInstructionIfNecessary(nodeIndex, span) {
|
|
20357
22346
|
if (nodeIndex !== this._currentIndex) {
|
|
@@ -20474,17 +22463,17 @@ var TemplateDefinitionBuilder = class {
|
|
|
20474
22463
|
if (!references || references.length === 0) {
|
|
20475
22464
|
return TYPED_NULL_EXPR;
|
|
20476
22465
|
}
|
|
20477
|
-
const refsParam = references.flatMap((
|
|
22466
|
+
const refsParam = references.flatMap((reference2) => {
|
|
20478
22467
|
const slot = this.allocateDataSlot();
|
|
20479
22468
|
const variableName = this._bindingScope.freshReferenceName();
|
|
20480
22469
|
const retrievalLevel = this.level;
|
|
20481
22470
|
const lhs = variable(variableName);
|
|
20482
|
-
this._bindingScope.set(retrievalLevel,
|
|
22471
|
+
this._bindingScope.set(retrievalLevel, reference2.name, lhs, 0, (scope, relativeLevel) => {
|
|
20483
22472
|
const nextContextStmt = relativeLevel > 0 ? [generateNextContextExpr(relativeLevel).toStmt()] : [];
|
|
20484
22473
|
const refExpr = lhs.set(importExpr(Identifiers.reference).callFn([literal(slot)]));
|
|
20485
22474
|
return nextContextStmt.concat(refExpr.toConstDecl());
|
|
20486
22475
|
}, true);
|
|
20487
|
-
return [
|
|
22476
|
+
return [reference2.name, reference2.value];
|
|
20488
22477
|
});
|
|
20489
22478
|
return asLiteral(refsParam);
|
|
20490
22479
|
}
|
|
@@ -20830,11 +22819,11 @@ function getTextInterpolationExpression(interpolation) {
|
|
|
20830
22819
|
return Identifiers.textInterpolateV;
|
|
20831
22820
|
}
|
|
20832
22821
|
}
|
|
20833
|
-
function parseTemplate(
|
|
22822
|
+
function parseTemplate(template2, templateUrl, options = {}) {
|
|
20834
22823
|
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
20835
22824
|
const bindingParser = makeBindingParser(interpolationConfig);
|
|
20836
22825
|
const htmlParser = new HtmlParser();
|
|
20837
|
-
const parseResult = htmlParser.parse(
|
|
22826
|
+
const parseResult = htmlParser.parse(template2, templateUrl, __spreadProps(__spreadValues({ leadingTriviaChars: LEADING_TRIVIA_CHARS }, options), { tokenizeExpansionForms: true }));
|
|
20838
22827
|
if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
|
|
20839
22828
|
const parsedTemplate2 = {
|
|
20840
22829
|
interpolationConfig,
|
|
@@ -20994,7 +22983,7 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
20994
22983
|
return definitionMap;
|
|
20995
22984
|
}
|
|
20996
22985
|
function addFeatures(definitionMap, meta) {
|
|
20997
|
-
var
|
|
22986
|
+
var _a2;
|
|
20998
22987
|
const features = [];
|
|
20999
22988
|
const providers = meta.providers;
|
|
21000
22989
|
const viewProviders = meta.viewProviders;
|
|
@@ -21017,7 +23006,7 @@ function addFeatures(definitionMap, meta) {
|
|
|
21017
23006
|
if (meta.hasOwnProperty("template") && meta.isStandalone) {
|
|
21018
23007
|
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
21019
23008
|
}
|
|
21020
|
-
if ((
|
|
23009
|
+
if ((_a2 = meta.hostDirectives) == null ? void 0 : _a2.length) {
|
|
21021
23010
|
features.push(importExpr(Identifiers.HostDirectivesFeature).callFn([createHostDirectivesFeatureArg(meta.hostDirectives)]));
|
|
21022
23011
|
}
|
|
21023
23012
|
if (features.length) {
|
|
@@ -21048,24 +23037,36 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
21048
23037
|
const templateTypeName = meta.name;
|
|
21049
23038
|
const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
|
|
21050
23039
|
const changeDetection = meta.changeDetection;
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
23040
|
+
if (!USE_TEMPLATE_PIPELINE) {
|
|
23041
|
+
const template2 = meta.template;
|
|
23042
|
+
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
23043
|
+
const templateFunctionExpression = templateBuilder.buildTemplateFunction(template2.nodes, []);
|
|
23044
|
+
const ngContentSelectors = templateBuilder.getNgContentSelectors();
|
|
23045
|
+
if (ngContentSelectors) {
|
|
23046
|
+
definitionMap.set("ngContentSelectors", ngContentSelectors);
|
|
23047
|
+
}
|
|
23048
|
+
definitionMap.set("decls", literal(templateBuilder.getConstCount()));
|
|
23049
|
+
definitionMap.set("vars", literal(templateBuilder.getVarCount()));
|
|
23050
|
+
const { constExpressions, prepareStatements } = templateBuilder.getConsts();
|
|
23051
|
+
if (constExpressions.length > 0) {
|
|
23052
|
+
let constsExpr = literalArr(constExpressions);
|
|
23053
|
+
if (prepareStatements.length > 0) {
|
|
23054
|
+
constsExpr = fn([], [...prepareStatements, new ReturnStatement(constsExpr)]);
|
|
23055
|
+
}
|
|
23056
|
+
definitionMap.set("consts", constsExpr);
|
|
23057
|
+
}
|
|
23058
|
+
definitionMap.set("template", templateFunctionExpression);
|
|
23059
|
+
} else {
|
|
23060
|
+
const tpl = ingest(meta.name, meta.template.nodes);
|
|
23061
|
+
transformTemplate(tpl);
|
|
23062
|
+
const templateFn = emitTemplateFn(tpl, constantPool);
|
|
23063
|
+
definitionMap.set("decls", literal(tpl.root.decls));
|
|
23064
|
+
definitionMap.set("vars", literal(tpl.root.vars));
|
|
23065
|
+
if (tpl.consts.length > 0) {
|
|
23066
|
+
definitionMap.set("consts", literalArr(tpl.consts));
|
|
23067
|
+
}
|
|
23068
|
+
definitionMap.set("template", templateFn);
|
|
23069
|
+
}
|
|
21069
23070
|
if (meta.declarations.length > 0) {
|
|
21070
23071
|
definitionMap.set("dependencies", compileDeclarationList(literalArr(meta.declarations.map((decl2) => decl2.type)), meta.declarationListEmitMode));
|
|
21071
23072
|
}
|
|
@@ -21319,11 +23320,11 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
21319
23320
|
styleBuilder.assignHostAttrs(hostAttrs, definitionMap);
|
|
21320
23321
|
if (styleBuilder.hasBindings) {
|
|
21321
23322
|
styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach((instruction) => {
|
|
21322
|
-
for (const
|
|
21323
|
-
totalHostVarsCount += Math.max(
|
|
23323
|
+
for (const call2 of instruction.calls) {
|
|
23324
|
+
totalHostVarsCount += Math.max(call2.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
|
|
21324
23325
|
updateInstructions.push({
|
|
21325
23326
|
reference: instruction.reference,
|
|
21326
|
-
paramsOrFn: convertStylingCall(
|
|
23327
|
+
paramsOrFn: convertStylingCall(call2, bindingContext, bindingFn),
|
|
21327
23328
|
span: null
|
|
21328
23329
|
});
|
|
21329
23330
|
}
|
|
@@ -21348,8 +23349,8 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
21348
23349
|
function bindingFn(implicit, value) {
|
|
21349
23350
|
return convertPropertyBinding(null, implicit, value, "b");
|
|
21350
23351
|
}
|
|
21351
|
-
function convertStylingCall(
|
|
21352
|
-
return
|
|
23352
|
+
function convertStylingCall(call2, bindingContext, bindingFn2) {
|
|
23353
|
+
return call2.params((value) => bindingFn2(bindingContext, value).currValExpr);
|
|
21353
23354
|
}
|
|
21354
23355
|
function getBindingNameAndInstruction(binding) {
|
|
21355
23356
|
let bindingName = binding.name;
|
|
@@ -21448,8 +23449,8 @@ function compileStyles(styles, selector, hostSelector) {
|
|
|
21448
23449
|
});
|
|
21449
23450
|
}
|
|
21450
23451
|
function createHostDirectivesType(meta) {
|
|
21451
|
-
var
|
|
21452
|
-
if (!((
|
|
23452
|
+
var _a2;
|
|
23453
|
+
if (!((_a2 = meta.hostDirectives) == null ? void 0 : _a2.length)) {
|
|
21453
23454
|
return NONE_TYPE;
|
|
21454
23455
|
}
|
|
21455
23456
|
return expressionType(literalArr(meta.hostDirectives.map((hostMeta) => literalMap([
|
|
@@ -21523,7 +23524,7 @@ var CompilerFacadeImpl = class {
|
|
|
21523
23524
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
|
|
21524
23525
|
}
|
|
21525
23526
|
compileInjectable(angularCoreEnv, sourceMapUrl, facade) {
|
|
21526
|
-
var
|
|
23527
|
+
var _a2;
|
|
21527
23528
|
const { expression, statements } = compileInjectable(
|
|
21528
23529
|
{
|
|
21529
23530
|
name: facade.name,
|
|
@@ -21534,14 +23535,14 @@ var CompilerFacadeImpl = class {
|
|
|
21534
23535
|
useFactory: wrapExpression(facade, "useFactory"),
|
|
21535
23536
|
useValue: convertToProviderExpression(facade, "useValue"),
|
|
21536
23537
|
useExisting: convertToProviderExpression(facade, "useExisting"),
|
|
21537
|
-
deps: (
|
|
23538
|
+
deps: (_a2 = facade.deps) == null ? void 0 : _a2.map(convertR3DependencyMetadata)
|
|
21538
23539
|
},
|
|
21539
23540
|
true
|
|
21540
23541
|
);
|
|
21541
23542
|
return this.jitExpression(expression, angularCoreEnv, sourceMapUrl, statements);
|
|
21542
23543
|
}
|
|
21543
23544
|
compileInjectableDeclaration(angularCoreEnv, sourceMapUrl, facade) {
|
|
21544
|
-
var
|
|
23545
|
+
var _a2;
|
|
21545
23546
|
const { expression, statements } = compileInjectable(
|
|
21546
23547
|
{
|
|
21547
23548
|
name: facade.type.name,
|
|
@@ -21552,7 +23553,7 @@ var CompilerFacadeImpl = class {
|
|
|
21552
23553
|
useFactory: wrapExpression(facade, "useFactory"),
|
|
21553
23554
|
useValue: convertToProviderExpression(facade, "useValue"),
|
|
21554
23555
|
useExisting: convertToProviderExpression(facade, "useExisting"),
|
|
21555
|
-
deps: (
|
|
23556
|
+
deps: (_a2 = facade.deps) == null ? void 0 : _a2.map(convertR3DeclareDependencyMetadata)
|
|
21556
23557
|
},
|
|
21557
23558
|
true
|
|
21558
23559
|
);
|
|
@@ -21610,13 +23611,13 @@ var CompilerFacadeImpl = class {
|
|
|
21610
23611
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, constantPool.statements);
|
|
21611
23612
|
}
|
|
21612
23613
|
compileComponent(angularCoreEnv, sourceMapUrl, facade) {
|
|
21613
|
-
const { template, interpolation } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
|
|
23614
|
+
const { template: template2, interpolation } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
|
|
21614
23615
|
const meta = __spreadProps(__spreadValues(__spreadValues({}, facade), convertDirectiveFacadeToMetadata(facade)), {
|
|
21615
23616
|
selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
|
|
21616
|
-
template,
|
|
23617
|
+
template: template2,
|
|
21617
23618
|
declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
|
|
21618
23619
|
declarationListEmitMode: 0,
|
|
21619
|
-
styles: [...facade.styles, ...
|
|
23620
|
+
styles: [...facade.styles, ...template2.styles],
|
|
21620
23621
|
encapsulation: facade.encapsulation,
|
|
21621
23622
|
interpolation,
|
|
21622
23623
|
changeDetection: facade.changeDetection,
|
|
@@ -21680,10 +23681,10 @@ function convertToR3QueryMetadata(facade) {
|
|
|
21680
23681
|
});
|
|
21681
23682
|
}
|
|
21682
23683
|
function convertQueryDeclarationToMetadata(declaration) {
|
|
21683
|
-
var
|
|
23684
|
+
var _a2, _b, _c, _d;
|
|
21684
23685
|
return {
|
|
21685
23686
|
propertyName: declaration.propertyName,
|
|
21686
|
-
first: (
|
|
23687
|
+
first: (_a2 = declaration.first) != null ? _a2 : false,
|
|
21687
23688
|
predicate: convertQueryPredicate(declaration.predicate),
|
|
21688
23689
|
descendants: (_b = declaration.descendants) != null ? _b : false,
|
|
21689
23690
|
read: declaration.read ? new WrappedNodeExpr(declaration.read) : null,
|
|
@@ -21731,12 +23732,12 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
21731
23732
|
});
|
|
21732
23733
|
}
|
|
21733
23734
|
function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
21734
|
-
var
|
|
23735
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
21735
23736
|
return {
|
|
21736
23737
|
name: declaration.type.name,
|
|
21737
23738
|
type: wrapReference(declaration.type),
|
|
21738
23739
|
typeSourceSpan,
|
|
21739
|
-
selector: (
|
|
23740
|
+
selector: (_a2 = declaration.selector) != null ? _a2 : null,
|
|
21740
23741
|
inputs: declaration.inputs ? inputsMappingToInputMetadata(declaration.inputs) : {},
|
|
21741
23742
|
outputs: (_b = declaration.outputs) != null ? _b : {},
|
|
21742
23743
|
host: convertHostDeclarationToMetadata(declaration.host),
|
|
@@ -21754,9 +23755,9 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
21754
23755
|
};
|
|
21755
23756
|
}
|
|
21756
23757
|
function convertHostDeclarationToMetadata(host = {}) {
|
|
21757
|
-
var
|
|
23758
|
+
var _a2, _b, _c;
|
|
21758
23759
|
return {
|
|
21759
|
-
attributes: convertOpaqueValuesToExpressions((
|
|
23760
|
+
attributes: convertOpaqueValuesToExpressions((_a2 = host.attributes) != null ? _a2 : {}),
|
|
21760
23761
|
listeners: (_b = host.listeners) != null ? _b : {},
|
|
21761
23762
|
properties: (_c = host.properties) != null ? _c : {},
|
|
21762
23763
|
specialAttributes: {
|
|
@@ -21766,8 +23767,8 @@ function convertHostDeclarationToMetadata(host = {}) {
|
|
|
21766
23767
|
};
|
|
21767
23768
|
}
|
|
21768
23769
|
function convertHostDirectivesToMetadata(metadata) {
|
|
21769
|
-
var
|
|
21770
|
-
if ((
|
|
23770
|
+
var _a2;
|
|
23771
|
+
if ((_a2 = metadata.hostDirectives) == null ? void 0 : _a2.length) {
|
|
21771
23772
|
return metadata.hostDirectives.map((hostDirective) => {
|
|
21772
23773
|
return typeof hostDirective === "function" ? {
|
|
21773
23774
|
directive: wrapReference(hostDirective),
|
|
@@ -21792,8 +23793,8 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
21792
23793
|
return result;
|
|
21793
23794
|
}
|
|
21794
23795
|
function convertDeclareComponentFacadeToMetadata(decl2, typeSourceSpan, sourceMapUrl) {
|
|
21795
|
-
var
|
|
21796
|
-
const { template, interpolation } = parseJitTemplate(decl2.template, decl2.type.name, sourceMapUrl, (
|
|
23796
|
+
var _a2, _b, _c, _d;
|
|
23797
|
+
const { template: template2, interpolation } = parseJitTemplate(decl2.template, decl2.type.name, sourceMapUrl, (_a2 = decl2.preserveWhitespaces) != null ? _a2 : false, decl2.interpolation);
|
|
21797
23798
|
const declarations = [];
|
|
21798
23799
|
if (decl2.dependencies) {
|
|
21799
23800
|
for (const innerDep of decl2.dependencies) {
|
|
@@ -21813,7 +23814,7 @@ function convertDeclareComponentFacadeToMetadata(decl2, typeSourceSpan, sourceMa
|
|
|
21813
23814
|
decl2.pipes && declarations.push(...convertPipeMapToMetadata(decl2.pipes));
|
|
21814
23815
|
}
|
|
21815
23816
|
return __spreadProps(__spreadValues({}, convertDeclareDirectiveFacadeToMetadata(decl2, typeSourceSpan)), {
|
|
21816
|
-
template,
|
|
23817
|
+
template: template2,
|
|
21817
23818
|
styles: (_b = decl2.styles) != null ? _b : [],
|
|
21818
23819
|
declarations,
|
|
21819
23820
|
viewProviders: decl2.viewProviders !== void 0 ? new WrappedNodeExpr(decl2.viewProviders) : null,
|
|
@@ -21832,13 +23833,13 @@ function convertDeclarationFacadeToMetadata(declaration) {
|
|
|
21832
23833
|
});
|
|
21833
23834
|
}
|
|
21834
23835
|
function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
|
|
21835
|
-
var
|
|
23836
|
+
var _a2, _b, _c;
|
|
21836
23837
|
return {
|
|
21837
23838
|
kind: R3TemplateDependencyKind.Directive,
|
|
21838
23839
|
isComponent: isComponent || declaration.kind === "component",
|
|
21839
23840
|
selector: declaration.selector,
|
|
21840
23841
|
type: new WrappedNodeExpr(declaration.type),
|
|
21841
|
-
inputs: (
|
|
23842
|
+
inputs: (_a2 = declaration.inputs) != null ? _a2 : [],
|
|
21842
23843
|
outputs: (_b = declaration.outputs) != null ? _b : [],
|
|
21843
23844
|
exportAs: (_c = declaration.exportAs) != null ? _c : null
|
|
21844
23845
|
};
|
|
@@ -21862,25 +23863,25 @@ function convertPipeDeclarationToMetadata(pipe) {
|
|
|
21862
23863
|
type: new WrappedNodeExpr(pipe.type)
|
|
21863
23864
|
};
|
|
21864
23865
|
}
|
|
21865
|
-
function parseJitTemplate(
|
|
23866
|
+
function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
21866
23867
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
21867
|
-
const parsed = parseTemplate(
|
|
23868
|
+
const parsed = parseTemplate(template2, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
|
|
21868
23869
|
if (parsed.errors !== null) {
|
|
21869
23870
|
const errors = parsed.errors.map((err) => err.toString()).join(", ");
|
|
21870
23871
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
21871
23872
|
}
|
|
21872
23873
|
return { template: parsed, interpolation: interpolationConfig };
|
|
21873
23874
|
}
|
|
21874
|
-
function convertToProviderExpression(obj,
|
|
21875
|
-
if (obj.hasOwnProperty(
|
|
21876
|
-
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[
|
|
23875
|
+
function convertToProviderExpression(obj, property2) {
|
|
23876
|
+
if (obj.hasOwnProperty(property2)) {
|
|
23877
|
+
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property2]), 0);
|
|
21877
23878
|
} else {
|
|
21878
23879
|
return void 0;
|
|
21879
23880
|
}
|
|
21880
23881
|
}
|
|
21881
|
-
function wrapExpression(obj,
|
|
21882
|
-
if (obj.hasOwnProperty(
|
|
21883
|
-
return new WrappedNodeExpr(obj[
|
|
23882
|
+
function wrapExpression(obj, property2) {
|
|
23883
|
+
if (obj.hasOwnProperty(property2)) {
|
|
23884
|
+
return new WrappedNodeExpr(obj[property2]);
|
|
21884
23885
|
} else {
|
|
21885
23886
|
return void 0;
|
|
21886
23887
|
}
|
|
@@ -21899,8 +23900,8 @@ function convertR3DependencyMetadata(facade) {
|
|
|
21899
23900
|
return createR3DependencyMetadata(token, isAttributeDep, facade.host, facade.optional, facade.self, facade.skipSelf);
|
|
21900
23901
|
}
|
|
21901
23902
|
function convertR3DeclareDependencyMetadata(facade) {
|
|
21902
|
-
var
|
|
21903
|
-
const isAttributeDep = (
|
|
23903
|
+
var _a2, _b, _c, _d, _e;
|
|
23904
|
+
const isAttributeDep = (_a2 = facade.attribute) != null ? _a2 : false;
|
|
21904
23905
|
const token = facade.token === null ? null : new WrappedNodeExpr(facade.token);
|
|
21905
23906
|
return createR3DependencyMetadata(token, isAttributeDep, (_b = facade.host) != null ? _b : false, (_c = facade.optional) != null ? _c : false, (_d = facade.self) != null ? _d : false, (_e = facade.skipSelf) != null ? _e : false);
|
|
21906
23907
|
}
|
|
@@ -21973,14 +23974,14 @@ function parseMappingString(value) {
|
|
|
21973
23974
|
return [bindingPropertyName != null ? bindingPropertyName : fieldName, fieldName];
|
|
21974
23975
|
}
|
|
21975
23976
|
function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
21976
|
-
var
|
|
23977
|
+
var _a2, _b;
|
|
21977
23978
|
return {
|
|
21978
23979
|
name: declaration.type.name,
|
|
21979
23980
|
type: wrapReference(declaration.type),
|
|
21980
23981
|
typeArgumentCount: 0,
|
|
21981
23982
|
pipeName: declaration.name,
|
|
21982
23983
|
deps: null,
|
|
21983
|
-
pure: (
|
|
23984
|
+
pure: (_a2 = declaration.pure) != null ? _a2 : true,
|
|
21984
23985
|
isStandalone: (_b = declaration.isStandalone) != null ? _b : false
|
|
21985
23986
|
};
|
|
21986
23987
|
}
|
|
@@ -21996,7 +23997,7 @@ function publishFacade(global2) {
|
|
|
21996
23997
|
const ng = global2.ng || (global2.ng = {});
|
|
21997
23998
|
ng.\u0275compilerFacade = new CompilerFacadeImpl();
|
|
21998
23999
|
}
|
|
21999
|
-
var VERSION = new Version("16.0.0-
|
|
24000
|
+
var VERSION = new Version("16.0.0-rc.2");
|
|
22000
24001
|
var _VisitorMode;
|
|
22001
24002
|
(function(_VisitorMode2) {
|
|
22002
24003
|
_VisitorMode2[_VisitorMode2["Extract"] = 0] = "Extract";
|
|
@@ -22005,6 +24006,7 @@ var _VisitorMode;
|
|
|
22005
24006
|
var XmlTagDefinition = class {
|
|
22006
24007
|
constructor() {
|
|
22007
24008
|
this.closedByParent = false;
|
|
24009
|
+
this.implicitNamespacePrefix = null;
|
|
22008
24010
|
this.isVoid = false;
|
|
22009
24011
|
this.ignoreFirstLf = false;
|
|
22010
24012
|
this.canSelfClose = true;
|
|
@@ -22049,8 +24051,8 @@ function visitElements(nodes, preorderCallback = () => {
|
|
|
22049
24051
|
}
|
|
22050
24052
|
}
|
|
22051
24053
|
}
|
|
22052
|
-
function parseTemplate2(
|
|
22053
|
-
return parseTemplate(
|
|
24054
|
+
function parseTemplate2(template2, templateUrl = "") {
|
|
24055
|
+
return parseTemplate(template2, templateUrl, {
|
|
22054
24056
|
preserveWhitespaces: true,
|
|
22055
24057
|
preserveLineEndings: true,
|
|
22056
24058
|
leadingTriviaChars: []
|
|
@@ -22066,10 +24068,10 @@ function replaceEndTag(html, node, tag) {
|
|
|
22066
24068
|
return replaceAt(html, node.endSourceSpan.start.offset + 2, node.name, tag);
|
|
22067
24069
|
}
|
|
22068
24070
|
function updateAttribute(html, node, name, update) {
|
|
22069
|
-
var
|
|
24071
|
+
var _a2;
|
|
22070
24072
|
const existingAttr = node.attributes.find((currentAttr) => currentAttr.name === name);
|
|
22071
24073
|
if (existingAttr && existingAttr.keySpan) {
|
|
22072
|
-
const updatedValue = update(((
|
|
24074
|
+
const updatedValue = update(((_a2 = existingAttr.valueSpan) == null ? void 0 : _a2.toString()) || "");
|
|
22073
24075
|
if (updatedValue == null) {
|
|
22074
24076
|
return html.slice(0, existingAttr.sourceSpan.start.offset).trimEnd() + html.slice(existingAttr.sourceSpan.end.offset);
|
|
22075
24077
|
} else if (updatedValue == "") {
|
|
@@ -23392,9 +25394,9 @@ function parseNamespace(atRule2) {
|
|
|
23392
25394
|
return params[params.length - 1];
|
|
23393
25395
|
}
|
|
23394
25396
|
function addLegacyCommentForPartialMigrations(atRule2, legacyComment) {
|
|
23395
|
-
var
|
|
25397
|
+
var _a2;
|
|
23396
25398
|
let hasAddedComment = false;
|
|
23397
|
-
(
|
|
25399
|
+
(_a2 = atRule2.parent) == null ? void 0 : _a2.walkComments((comment2) => {
|
|
23398
25400
|
if (comment2.text.includes(legacyComment)) {
|
|
23399
25401
|
hasAddedComment = true;
|
|
23400
25402
|
}
|
|
@@ -23406,11 +25408,11 @@ function addLegacyCommentForPartialMigrations(atRule2, legacyComment) {
|
|
|
23406
25408
|
return true;
|
|
23407
25409
|
}
|
|
23408
25410
|
function addCommentBeforeNode(node, comment2) {
|
|
23409
|
-
var
|
|
25411
|
+
var _a2;
|
|
23410
25412
|
let commentNode = comment({
|
|
23411
25413
|
text: comment2
|
|
23412
25414
|
});
|
|
23413
|
-
const indentation = (
|
|
25415
|
+
const indentation = (_a2 = node.raws.before) == null ? void 0 : _a2.split("\n").pop();
|
|
23414
25416
|
commentNode.raws.before = "\n" + indentation;
|
|
23415
25417
|
node.parent.insertBefore(node, commentNode);
|
|
23416
25418
|
node.raws.before = "\n" + indentation;
|
|
@@ -23422,11 +25424,11 @@ function replaceCrossCuttingMixin(atRule2, namespace) {
|
|
|
23422
25424
|
atRule2.remove();
|
|
23423
25425
|
}
|
|
23424
25426
|
function replaceAtRuleWithMultiple(atRule2, textToReplace, replacements) {
|
|
23425
|
-
var
|
|
25427
|
+
var _a2;
|
|
23426
25428
|
atRule2.cloneBefore({
|
|
23427
25429
|
params: atRule2.params.replace(textToReplace, replacements[0])
|
|
23428
25430
|
});
|
|
23429
|
-
const indentation = (
|
|
25431
|
+
const indentation = (_a2 = atRule2.raws.before) == null ? void 0 : _a2.split("\n").pop();
|
|
23430
25432
|
atRule2.raws.before = "\n" + indentation;
|
|
23431
25433
|
for (let i = 1; i < replacements.length; i++) {
|
|
23432
25434
|
atRule2.cloneBefore({
|
|
@@ -23475,7 +25477,7 @@ function migrateTypographyConfigs(content, namespace) {
|
|
|
23475
25477
|
});
|
|
23476
25478
|
replacements.push({ start: name.start, end: name.end, text: newFunctionName });
|
|
23477
25479
|
});
|
|
23478
|
-
replacements.sort((a, b) => b.start - a.start).forEach(({ start, end, text }) => content = content.slice(0, start) +
|
|
25480
|
+
replacements.sort((a, b) => b.start - a.start).forEach(({ start, end, text: text2 }) => content = content.slice(0, start) + text2 + content.slice(end));
|
|
23479
25481
|
return content;
|
|
23480
25482
|
}
|
|
23481
25483
|
function extractFunctionCalls(name, content) {
|
|
@@ -23587,11 +25589,11 @@ var TemplateMigration = class extends import_schematics2.Migration {
|
|
|
23587
25589
|
super(...arguments);
|
|
23588
25590
|
this.enabled = true;
|
|
23589
25591
|
}
|
|
23590
|
-
visitTemplate(
|
|
23591
|
-
this.fileSystem.edit(
|
|
25592
|
+
visitTemplate(template2) {
|
|
25593
|
+
this.fileSystem.edit(template2.filePath).remove(template2.start, template2.content.length).insertRight(template2.start, this.migrate(template2.content, template2.filePath));
|
|
23592
25594
|
}
|
|
23593
|
-
migrate(
|
|
23594
|
-
const ast = parseTemplate2(
|
|
25595
|
+
migrate(template2, templateUrl) {
|
|
25596
|
+
const ast = parseTemplate2(template2, templateUrl);
|
|
23595
25597
|
const migrators = this.upgradeData.filter((m) => m.template).map((m) => m.template);
|
|
23596
25598
|
const updates = [];
|
|
23597
25599
|
migrators.forEach((m) => {
|
|
@@ -23605,7 +25607,7 @@ var TemplateMigration = class extends import_schematics2.Migration {
|
|
|
23605
25607
|
this.logger.warn(`Failed to process template: ${templateUrl} (see error above).`);
|
|
23606
25608
|
}
|
|
23607
25609
|
});
|
|
23608
|
-
return writeUpdates(
|
|
25610
|
+
return writeUpdates(template2, updates);
|
|
23609
25611
|
}
|
|
23610
25612
|
};
|
|
23611
25613
|
|
|
@@ -23652,19 +25654,19 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
|
|
|
23652
25654
|
});
|
|
23653
25655
|
}
|
|
23654
25656
|
_findImportsToMigrate(sourceFile) {
|
|
23655
|
-
var
|
|
25657
|
+
var _a2;
|
|
23656
25658
|
const importSpecifiersToNewNames = /* @__PURE__ */ new Map();
|
|
23657
25659
|
const moduleSpecifiers = /* @__PURE__ */ new Map();
|
|
23658
25660
|
const identifiersToImportSpecifiers = /* @__PURE__ */ new Map();
|
|
23659
25661
|
for (const statement of sourceFile.statements) {
|
|
23660
|
-
if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && ((
|
|
23661
|
-
statement.importClause.namedBindings.elements.forEach((
|
|
23662
|
-
const oldName = (
|
|
25662
|
+
if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && ((_a2 = statement.importClause) == null ? void 0 : _a2.namedBindings) && ts.isNamedImports(statement.importClause.namedBindings) && LEGACY_MODULES.has(statement.moduleSpecifier.text) && this._importPathHasComponentToMigrate(statement.moduleSpecifier.text)) {
|
|
25663
|
+
statement.importClause.namedBindings.elements.forEach((element2) => {
|
|
25664
|
+
const oldName = (element2.propertyName || element2.name).text;
|
|
23663
25665
|
const newName = this._removeLegacy(oldName);
|
|
23664
25666
|
if (newName) {
|
|
23665
|
-
importSpecifiersToNewNames.set(
|
|
23666
|
-
if (!
|
|
23667
|
-
identifiersToImportSpecifiers.set(oldName,
|
|
25667
|
+
importSpecifiersToNewNames.set(element2, newName);
|
|
25668
|
+
if (!element2.propertyName) {
|
|
25669
|
+
identifiersToImportSpecifiers.set(oldName, element2);
|
|
23668
25670
|
}
|
|
23669
25671
|
}
|
|
23670
25672
|
});
|
|
@@ -23792,11 +25794,11 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
|
|
|
23792
25794
|
if (!ts.isDecorator(node)) {
|
|
23793
25795
|
return false;
|
|
23794
25796
|
}
|
|
23795
|
-
const
|
|
23796
|
-
if (!ts.isCallExpression(
|
|
25797
|
+
const call2 = node.expression;
|
|
25798
|
+
if (!ts.isCallExpression(call2) || !ts.isIdentifier(call2.expression)) {
|
|
23797
25799
|
return false;
|
|
23798
25800
|
}
|
|
23799
|
-
return
|
|
25801
|
+
return call2.expression.text === "Component";
|
|
23800
25802
|
}
|
|
23801
25803
|
_isImportExpression(node) {
|
|
23802
25804
|
return ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments.length === 1 && ts.isStringLiteralLike(node.arguments[0]);
|
|
@@ -23805,30 +25807,30 @@ var RuntimeCodeMigration = class extends import_schematics3.Migration {
|
|
|
23805
25807
|
return ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteralLike(node.argument.literal);
|
|
23806
25808
|
}
|
|
23807
25809
|
_printAndUpdateNode(sourceFile, oldNode, newNode) {
|
|
23808
|
-
var
|
|
25810
|
+
var _a2;
|
|
23809
25811
|
const filePath = this.fileSystem.resolve(sourceFile.fileName);
|
|
23810
25812
|
const newNodeText = typeof newNode === "string" ? newNode : this._printer.printNode(ts.EmitHint.Unspecified, newNode, sourceFile);
|
|
23811
25813
|
const start = oldNode.getStart();
|
|
23812
25814
|
const width = oldNode.getWidth();
|
|
23813
|
-
(
|
|
25815
|
+
(_a2 = this._updates) != null ? _a2 : this._updates = [];
|
|
23814
25816
|
this._updates.push({
|
|
23815
25817
|
offset: start,
|
|
23816
25818
|
update: () => this.fileSystem.edit(filePath).remove(start, width).insertRight(start, newNodeText)
|
|
23817
25819
|
});
|
|
23818
25820
|
}
|
|
23819
25821
|
postAnalysis() {
|
|
23820
|
-
var
|
|
23821
|
-
(
|
|
25822
|
+
var _a2;
|
|
25823
|
+
(_a2 = this._updates) == null ? void 0 : _a2.sort((a, b) => b.offset - a.offset).forEach(({ update }) => update());
|
|
23822
25824
|
}
|
|
23823
25825
|
_isReferenceToImport(node, importSpecifier) {
|
|
23824
|
-
var
|
|
25826
|
+
var _a2, _b, _c, _d;
|
|
23825
25827
|
if ((importSpecifier.propertyName || importSpecifier.name).text !== node.text) {
|
|
23826
25828
|
return false;
|
|
23827
25829
|
}
|
|
23828
25830
|
const nodeSymbol = this.typeChecker.getTypeAtLocation(node).getSymbol();
|
|
23829
25831
|
const importSymbol = this.typeChecker.getTypeAtLocation(importSpecifier).getSymbol();
|
|
23830
25832
|
if (!nodeSymbol && !importSymbol) {
|
|
23831
|
-
return ((_b = (
|
|
25833
|
+
return ((_b = (_a2 = this.typeChecker.getSymbolAtLocation(node)) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) === importSpecifier;
|
|
23832
25834
|
}
|
|
23833
25835
|
return !!(((_c = nodeSymbol == null ? void 0 : nodeSymbol.declarations) == null ? void 0 : _c[0]) && ((_d = importSymbol == null ? void 0 : importSymbol.declarations) == null ? void 0 : _d[0])) && nodeSymbol.declarations[0] === importSymbol.declarations[0];
|
|
23834
25836
|
}
|
|
@@ -23934,7 +25936,7 @@ ${[...componentsToMigrate].join("\n")}`);
|
|
|
23934
25936
|
* found in the LICENSE file at https://angular.io/license
|
|
23935
25937
|
*/
|
|
23936
25938
|
/**
|
|
23937
|
-
* @license Angular v16.0.0-
|
|
25939
|
+
* @license Angular v16.0.0-rc.2
|
|
23938
25940
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
23939
25941
|
* License: MIT
|
|
23940
25942
|
*/
|