@design-factory/angular 21.1.0-next.1 → 22.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai/docs/components/accordion/accessibility.md +45 -0
- package/.ai/docs/components/accordion/api.md +279 -0
- package/.ai/docs/components/accordion/developer.md +43 -0
- package/.ai/docs/components/accordion/guidelines.md +99 -0
- package/.ai/docs/components/accordion/overview.md +17 -0
- package/.ai/docs/components/alert/accessibility.md +24 -0
- package/.ai/docs/components/alert/api.md +65 -0
- package/.ai/docs/components/alert/developer.md +63 -0
- package/.ai/docs/components/alert/guidelines.md +62 -0
- package/.ai/docs/components/alert/overview.md +12 -0
- package/.ai/docs/components/button/accessibility.md +25 -0
- package/.ai/docs/components/button/api.md +71 -0
- package/.ai/docs/components/button/developer.md +52 -0
- package/.ai/docs/components/button/guidelines.md +75 -0
- package/.ai/docs/components/button/overview.md +15 -0
- package/.ai/docs/components/buttongroup/api.md +16 -0
- package/.ai/docs/components/buttongroup/developer.md +32 -0
- package/.ai/docs/components/drawer/accessibility.md +15 -0
- package/.ai/docs/components/drawer/api.md +56 -0
- package/.ai/docs/components/drawer/developer.md +36 -0
- package/.ai/docs/components/drawer/examples.md +9 -0
- package/.ai/docs/components/drawer/guidelines.md +58 -0
- package/.ai/docs/components/drawer/overview.md +19 -0
- package/.ai/docs/components/dropdown/accessibility.md +27 -0
- package/.ai/docs/components/dropdown/api.md +85 -0
- package/.ai/docs/components/dropdown/developer.md +59 -0
- package/.ai/docs/components/dropdown/guidelines.md +80 -0
- package/.ai/docs/components/dropdown/overview.md +16 -0
- package/.ai/docs/components/sidenav/accessibility.md +48 -0
- package/.ai/docs/components/sidenav/api.md +110 -0
- package/.ai/docs/components/sidenav/developer.md +14 -0
- package/.ai/docs/components/sidenav/guidelines.md +83 -0
- package/.ai/docs/components/sidenav/overview.md +16 -0
- package/.ai/docs/components/tooltip/accessibility.md +11 -0
- package/.ai/docs/components/tooltip/api.md +39 -0
- package/.ai/docs/components/tooltip/developer.md +16 -0
- package/.ai/docs/components/tooltip/guidelines.md +84 -0
- package/.ai/docs/components/tooltip/overview.md +23 -0
- package/.ai/docs/components/topnav/accessibility.md +51 -0
- package/.ai/docs/components/topnav/api.md +190 -0
- package/.ai/docs/components/topnav/developer.md +43 -0
- package/.ai/docs/components/topnav/guidelines.md +121 -0
- package/.ai/docs/components/topnav/overview.md +17 -0
- package/.ai/docs/demos/accordion/addons-subtitle/accordion-addons-subtitle.html +75 -0
- package/.ai/docs/demos/accordion/addons-subtitle/accordion-addons-subtitle.ts +27 -0
- package/.ai/docs/demos/accordion/basic/accordion-basic.html +16 -0
- package/.ai/docs/demos/accordion/basic/accordion-basic.ts +14 -0
- package/.ai/docs/demos/accordion/close-others/accordion-close-others.html +16 -0
- package/.ai/docs/demos/accordion/close-others/accordion-close-others.ts +14 -0
- package/.ai/docs/demos/accordion/interactive/accordion-interactive.html +84 -0
- package/.ai/docs/demos/accordion/interactive/accordion-interactive.ts +30 -0
- package/.ai/docs/demos/accordion/interactive-addons-subtitle/accordion-interactive-addons-subtitle.html +126 -0
- package/.ai/docs/demos/accordion/interactive-addons-subtitle/accordion-interactive-addons-subtitle.ts +33 -0
- package/.ai/docs/demos/accordion/programmatic-control/accordion-programmatic-control.html +36 -0
- package/.ai/docs/demos/accordion/programmatic-control/accordion-programmatic-control.ts +15 -0
- package/.ai/docs/demos/accordion/selectable/accordion-selectable.html +16 -0
- package/.ai/docs/demos/accordion/selectable/accordion-selectable.ts +14 -0
- package/.ai/docs/demos/accordion/selectable-extended/accordion-selectable-extended.html +28 -0
- package/.ai/docs/demos/accordion/selectable-extended/accordion-selectable-extended.ts +80 -0
- package/.ai/docs/demos/accordion/separator/accordion-separator.html +16 -0
- package/.ai/docs/demos/accordion/separator/accordion-separator.ts +14 -0
- package/.ai/docs/demos/alert/banner/alert-banner.html +15 -0
- package/.ai/docs/demos/alert/banner/alert-banner.ts +16 -0
- package/.ai/docs/demos/alert/basic/alert-basic.html +6 -0
- package/.ai/docs/demos/alert/basic/alert-basic.ts +9 -0
- package/.ai/docs/demos/alert/card/alert-card.html +15 -0
- package/.ai/docs/demos/alert/card/alert-card.ts +9 -0
- package/.ai/docs/demos/alert/dismissal/alert-dismissal.html +5 -0
- package/.ai/docs/demos/alert/dismissal/alert-dismissal.ts +27 -0
- package/.ai/docs/demos/alert/expandable/alert-expandable.html +9 -0
- package/.ai/docs/demos/alert/expandable/alert-expandable.ts +11 -0
- package/.ai/docs/demos/button/basic/button-basic.html +4 -0
- package/.ai/docs/demos/button/basic/button-basic.ts +9 -0
- package/.ai/docs/demos/button/disabled/button-disabled.html +18 -0
- package/.ai/docs/demos/button/disabled/button-disabled.ts +12 -0
- package/.ai/docs/demos/button/icons/button-icons.html +17 -0
- package/.ai/docs/demos/button/icons/button-icons.ts +10 -0
- package/.ai/docs/demos/button/surfaces/button-surfaces.html +13 -0
- package/.ai/docs/demos/button/surfaces/button-surfaces.ts +9 -0
- package/.ai/docs/demos/button/variants/button-variants.html +49 -0
- package/.ai/docs/demos/button/variants/button-variants.ts +9 -0
- package/.ai/docs/demos/buttongroup/basic/buttongroup-basic.html +6 -0
- package/.ai/docs/demos/buttongroup/basic/buttongroup-basic.ts +10 -0
- package/.ai/docs/demos/buttongroup/disabled/buttongroup-disabled.html +6 -0
- package/.ai/docs/demos/buttongroup/disabled/buttongroup-disabled.ts +10 -0
- package/.ai/docs/demos/buttongroup/mirror/buttongroup-mirror.html +8 -0
- package/.ai/docs/demos/buttongroup/mirror/buttongroup-mirror.ts +10 -0
- package/.ai/docs/demos/buttongroup/orientation/buttongroup-orientation.html +19 -0
- package/.ai/docs/demos/buttongroup/orientation/buttongroup-orientation.ts +10 -0
- package/.ai/docs/demos/buttongroup/sizing/buttongroup-sizing.html +19 -0
- package/.ai/docs/demos/buttongroup/sizing/buttongroup-sizing.ts +10 -0
- package/.ai/docs/demos/drawer/inline/drawer-inline-basic.html +46 -0
- package/.ai/docs/demos/drawer/inline/drawer-inline-basic.ts +33 -0
- package/.ai/docs/demos/drawer/overlay/drawer-overlay-basic.html +30 -0
- package/.ai/docs/demos/drawer/overlay/drawer-overlay-basic.ts +25 -0
- package/.ai/docs/demos/dropdown/basic/dropdown-basic.html +8 -0
- package/.ai/docs/demos/dropdown/basic/dropdown-basic.ts +15 -0
- package/.ai/docs/demos/dropdown/sizes/dropdown-sizes.html +9 -0
- package/.ai/docs/demos/dropdown/sizes/dropdown-sizes.ts +21 -0
- package/.ai/docs/demos/dropdown/split/dropdown-split.html +9 -0
- package/.ai/docs/demos/dropdown/split/dropdown-split.ts +11 -0
- package/.ai/docs/demos/dropdown/toggle/dropdown-toggle.html +22 -0
- package/.ai/docs/demos/dropdown/toggle/dropdown-toggle.ts +10 -0
- package/.ai/docs/demos/sidenav/sidenav-basic-no-icon/routes.ts +95 -0
- package/.ai/docs/demos/sidenav/sidenav-basic-no-icon/sidenav-basic-no-icon.html +42 -0
- package/.ai/docs/demos/sidenav/sidenav-basic-no-icon/sidenav-basic-no-icon.ts +12 -0
- package/.ai/docs/demos/sidenav/sidenav-basic-with-icon/routes.ts +41 -0
- package/.ai/docs/demos/sidenav/sidenav-basic-with-icon/sidenav-basic-with-icon.html +34 -0
- package/.ai/docs/demos/sidenav/sidenav-basic-with-icon/sidenav-basic-with-icon.ts +12 -0
- package/.ai/docs/demos/tooltip/basic/tooltip-basic.html +1 -0
- package/.ai/docs/demos/tooltip/basic/tooltip-basic.ts +10 -0
- package/.ai/docs/demos/tooltip/placements/tooltip-placements.html +35 -0
- package/.ai/docs/demos/tooltip/placements/tooltip-placements.ts +12 -0
- package/.ai/docs/demos/tooltip/sizes/tooltip-sizes.html +5 -0
- package/.ai/docs/demos/tooltip/sizes/tooltip-sizes.ts +10 -0
- package/.ai/docs/demos/topnav/brand/topnav-brand.ts +64 -0
- package/.ai/docs/demos/topnav/environment-banner/topnav-environment-banner.ts +20 -0
- package/.ai/docs/demos/topnav/navigation/routes.ts +35 -0
- package/.ai/docs/demos/topnav/navigation/topnav-navigation-flat.ts +67 -0
- package/.ai/docs/demos/topnav/navigation/topnav-navigation-tree.ts +82 -0
- package/.ai/docs/demos/topnav/quick-actions/notifications.ts +75 -0
- package/.ai/docs/demos/topnav/quick-actions/topnav-quick-actions.ts +108 -0
- package/.ai/docs/demos/topnav/quick-actions/user-account.ts +23 -0
- package/.ai/index.md +26 -0
- package/fesm2022/design-factory-angular-accordion.mjs +1153 -0
- package/fesm2022/design-factory-angular-accordion.mjs.map +1 -0
- package/fesm2022/design-factory-angular-alert.mjs +312 -0
- package/fesm2022/design-factory-angular-alert.mjs.map +1 -0
- package/fesm2022/design-factory-angular-breakpoints.mjs +53 -0
- package/fesm2022/design-factory-angular-breakpoints.mjs.map +1 -0
- package/fesm2022/design-factory-angular-button.mjs +240 -0
- package/fesm2022/design-factory-angular-button.mjs.map +1 -0
- package/fesm2022/design-factory-angular-buttongroup.mjs +75 -0
- package/fesm2022/design-factory-angular-buttongroup.mjs.map +1 -0
- package/fesm2022/design-factory-angular-drawer.mjs +76 -81
- package/fesm2022/design-factory-angular-drawer.mjs.map +1 -1
- package/fesm2022/design-factory-angular-dropdown.mjs +323 -0
- package/fesm2022/design-factory-angular-dropdown.mjs.map +1 -0
- package/fesm2022/design-factory-angular-form-field.mjs +287 -0
- package/fesm2022/design-factory-angular-form-field.mjs.map +1 -0
- package/fesm2022/design-factory-angular-icon.mjs +24 -0
- package/fesm2022/design-factory-angular-icon.mjs.map +1 -0
- package/fesm2022/design-factory-angular-input.mjs +34 -0
- package/fesm2022/design-factory-angular-input.mjs.map +1 -0
- package/fesm2022/design-factory-angular-internals.mjs +119 -39
- package/fesm2022/design-factory-angular-internals.mjs.map +1 -1
- package/fesm2022/design-factory-angular-separator.mjs +43 -0
- package/fesm2022/design-factory-angular-separator.mjs.map +1 -0
- package/fesm2022/design-factory-angular-sidenav.mjs +766 -438
- package/fesm2022/design-factory-angular-sidenav.mjs.map +1 -1
- package/fesm2022/design-factory-angular-slider.mjs +451 -0
- package/fesm2022/design-factory-angular-slider.mjs.map +1 -0
- package/fesm2022/design-factory-angular-theme.mjs +30 -20
- package/fesm2022/design-factory-angular-theme.mjs.map +1 -1
- package/fesm2022/design-factory-angular-toggle.mjs +172 -0
- package/fesm2022/design-factory-angular-toggle.mjs.map +1 -0
- package/fesm2022/design-factory-angular-tooltip.mjs +138 -0
- package/fesm2022/design-factory-angular-tooltip.mjs.map +1 -0
- package/fesm2022/design-factory-angular-topnav.mjs +635 -558
- package/fesm2022/design-factory-angular-topnav.mjs.map +1 -1
- package/package.json +61 -8
- package/schematics/collection.json +35 -0
- package/schematics/component-migration/accordion/constants.d.ts +10 -0
- package/schematics/component-migration/accordion/constants.js +46 -0
- package/schematics/component-migration/accordion/guide.md +257 -0
- package/schematics/component-migration/accordion/index.d.ts +2 -0
- package/schematics/component-migration/accordion/index.js +5 -0
- package/schematics/component-migration/accordion/migration.d.ts +2 -0
- package/schematics/component-migration/accordion/migration.js +13 -0
- package/schematics/component-migration/accordion/schema.json +25 -0
- package/schematics/component-migration/accordion/steps/accordion-imports.d.ts +3 -0
- package/schematics/component-migration/accordion/steps/accordion-imports.js +41 -0
- package/schematics/component-migration/accordion/steps/template-migration.d.ts +3 -0
- package/schematics/component-migration/accordion/steps/template-migration.js +554 -0
- package/schematics/component-migration/accordion/steps/title-content.d.ts +9 -0
- package/schematics/component-migration/accordion/steps/title-content.js +75 -0
- package/schematics/component-migration/ai/prompt.md +83 -0
- package/schematics/component-migration/alert/guide.md +246 -0
- package/schematics/component-migration/alert/index.d.ts +2 -0
- package/schematics/component-migration/alert/index.js +5 -0
- package/schematics/component-migration/alert/migration.d.ts +2 -0
- package/schematics/component-migration/alert/migration.js +50 -0
- package/schematics/component-migration/alert/schema.json +25 -0
- package/schematics/component-migration/alert/steps/alert-imports.d.ts +4 -0
- package/schematics/component-migration/alert/steps/alert-imports.js +97 -0
- package/schematics/component-migration/alert/steps/animation-input.d.ts +3 -0
- package/schematics/component-migration/alert/steps/animation-input.js +17 -0
- package/schematics/component-migration/alert/steps/close-output.d.ts +3 -0
- package/schematics/component-migration/alert/steps/close-output.js +17 -0
- package/schematics/component-migration/alert/steps/icon-directive-imports.d.ts +3 -0
- package/schematics/component-migration/alert/steps/icon-directive-imports.js +84 -0
- package/schematics/component-migration/alert/steps/icon-directive.d.ts +3 -0
- package/schematics/component-migration/alert/steps/icon-directive.js +10 -0
- package/schematics/component-migration/alert/steps/legacy-module-imports.d.ts +3 -0
- package/schematics/component-migration/alert/steps/legacy-module-imports.js +57 -0
- package/schematics/component-migration/alert/steps/programmatic-close.d.ts +3 -0
- package/schematics/component-migration/alert/steps/programmatic-close.js +44 -0
- package/schematics/component-migration/alert/steps/selector.d.ts +3 -0
- package/schematics/component-migration/alert/steps/selector.js +18 -0
- package/schematics/component-migration/alert/steps/static-classes.d.ts +3 -0
- package/schematics/component-migration/alert/steps/static-classes.js +97 -0
- package/schematics/component-migration/alert/steps/static-type.d.ts +3 -0
- package/schematics/component-migration/alert/steps/static-type.js +28 -0
- package/schematics/component-migration/alert/steps/template-reference.d.ts +3 -0
- package/schematics/component-migration/alert/steps/template-reference.js +15 -0
- package/schematics/component-migration/alert/steps/template-todos.d.ts +3 -0
- package/schematics/component-migration/alert/steps/template-todos.js +78 -0
- package/schematics/component-migration/button/guide.md +278 -0
- package/schematics/component-migration/button/index.d.ts +2 -0
- package/schematics/component-migration/button/index.js +5 -0
- package/schematics/component-migration/button/migration.d.ts +2 -0
- package/schematics/component-migration/button/migration.js +180 -0
- package/schematics/component-migration/button/schema.json +25 -0
- package/schematics/component-migration/button/steps/static-classes.d.ts +10 -0
- package/schematics/component-migration/button/steps/static-classes.js +128 -0
- package/schematics/component-migration/button/steps/template-todos.d.ts +19 -0
- package/schematics/component-migration/button/steps/template-todos.js +120 -0
- package/schematics/component-migration/button/types.d.ts +7 -0
- package/schematics/component-migration/button/types.js +2 -0
- package/schematics/component-migration/dropdown/guide.md +252 -0
- package/schematics/component-migration/dropdown/index.d.ts +2 -0
- package/schematics/component-migration/dropdown/index.js +5 -0
- package/schematics/component-migration/dropdown/migration.d.ts +2 -0
- package/schematics/component-migration/dropdown/migration.js +41 -0
- package/schematics/component-migration/dropdown/schema.json +25 -0
- package/schematics/component-migration/dropdown/steps/dropdown-imports.d.ts +3 -0
- package/schematics/component-migration/dropdown/steps/dropdown-imports.js +308 -0
- package/schematics/component-migration/dropdown/steps/template-attributes.d.ts +10 -0
- package/schematics/component-migration/dropdown/steps/template-attributes.js +57 -0
- package/schematics/component-migration/dropdown/steps/template-helpers.d.ts +20 -0
- package/schematics/component-migration/dropdown/steps/template-helpers.js +125 -0
- package/schematics/component-migration/dropdown/steps/template-imports.d.ts +22 -0
- package/schematics/component-migration/dropdown/steps/template-imports.js +12 -0
- package/schematics/component-migration/dropdown/steps/template-items.d.ts +7 -0
- package/schematics/component-migration/dropdown/steps/template-items.js +58 -0
- package/schematics/component-migration/dropdown/steps/template-menu.d.ts +14 -0
- package/schematics/component-migration/dropdown/steps/template-menu.js +107 -0
- package/schematics/component-migration/dropdown/steps/template-todos.d.ts +19 -0
- package/schematics/component-migration/dropdown/steps/template-todos.js +118 -0
- package/schematics/component-migration/dropdown/steps/template-toggle.d.ts +9 -0
- package/schematics/component-migration/dropdown/steps/template-toggle.js +70 -0
- package/schematics/component-migration/dropdown/steps/template-wrapper.d.ts +12 -0
- package/schematics/component-migration/dropdown/steps/template-wrapper.js +105 -0
- package/schematics/component-migration/index.d.ts +3 -0
- package/schematics/component-migration/index.js +26 -0
- package/schematics/component-migration/next-steps/index.d.ts +13 -0
- package/schematics/component-migration/next-steps/index.js +34 -0
- package/schematics/component-migration/registry.d.ts +1 -0
- package/schematics/component-migration/registry.js +15 -0
- package/schematics/component-migration/schema.json +20 -0
- package/schematics/component-migration/shared/ai-handoff.d.ts +2 -0
- package/schematics/component-migration/shared/ai-handoff.js +28 -0
- package/schematics/component-migration/shared/angular-component.d.ts +10 -0
- package/schematics/component-migration/shared/angular-component.js +125 -0
- package/schematics/component-migration/shared/button-visual-classes.d.ts +24 -0
- package/schematics/component-migration/shared/button-visual-classes.js +111 -0
- package/schematics/component-migration/shared/component-context.d.ts +7 -0
- package/schematics/component-migration/shared/component-context.js +24 -0
- package/schematics/component-migration/shared/component-imports.d.ts +45 -0
- package/schematics/component-migration/shared/component-imports.js +380 -0
- package/schematics/component-migration/shared/create-component-schematic.d.ts +3 -0
- package/schematics/component-migration/shared/create-component-schematic.js +55 -0
- package/schematics/component-migration/shared/import-edits.d.ts +11 -0
- package/schematics/component-migration/shared/import-edits.js +157 -0
- package/schematics/component-migration/shared/legacy-config-todos.d.ts +3 -0
- package/schematics/component-migration/shared/legacy-config-todos.js +90 -0
- package/schematics/component-migration/shared/migrate-project.d.ts +12 -0
- package/schematics/component-migration/shared/migrate-project.js +151 -0
- package/schematics/component-migration/shared/project-templates.d.ts +15 -0
- package/schematics/component-migration/shared/project-templates.js +43 -0
- package/schematics/component-migration/shared/scan-project.d.ts +3 -0
- package/schematics/component-migration/shared/scan-project.js +24 -0
- package/schematics/component-migration/shared/static-placement.d.ts +1 -0
- package/schematics/component-migration/shared/static-placement.js +45 -0
- package/schematics/component-migration/shared/template-edits.d.ts +28 -0
- package/schematics/component-migration/shared/template-edits.js +153 -0
- package/schematics/component-migration/shared/template-result.d.ts +3 -0
- package/schematics/component-migration/shared/template-result.js +11 -0
- package/schematics/component-migration/shared/testing.d.ts +13 -0
- package/schematics/component-migration/shared/testing.js +59 -0
- package/schematics/component-migration/shared/todo-comments.d.ts +10 -0
- package/schematics/component-migration/shared/todo-comments.js +81 -0
- package/schematics/component-migration/shared/types.d.ts +41 -0
- package/schematics/component-migration/shared/types.js +2 -0
- package/schematics/component-migration/tooltip/guide.md +196 -0
- package/schematics/component-migration/tooltip/index.d.ts +2 -0
- package/schematics/component-migration/tooltip/index.js +5 -0
- package/schematics/component-migration/tooltip/migration.d.ts +2 -0
- package/schematics/component-migration/tooltip/migration.js +50 -0
- package/schematics/component-migration/tooltip/schema.json +25 -0
- package/schematics/component-migration/tooltip/steps/template-attributes.d.ts +13 -0
- package/schematics/component-migration/tooltip/steps/template-attributes.js +266 -0
- package/schematics/component-migration/tooltip/steps/template-todos.d.ts +24 -0
- package/schematics/component-migration/tooltip/steps/template-todos.js +115 -0
- package/schematics/component-migration/tooltip/steps/tooltip-imports.d.ts +3 -0
- package/schematics/component-migration/tooltip/steps/tooltip-imports.js +79 -0
- package/schematics/component-migration/utils/component-resource-collector.d.ts +34 -0
- package/schematics/component-migration/utils/component-resource-collector.js +107 -0
- package/schematics/component-migration/utils/project_tsconfig_paths.d.ts +18 -0
- package/schematics/component-migration/utils/project_tsconfig_paths.js +105 -0
- package/schematics/component-migration/utils/typescript/compiler_host.d.ts +44 -0
- package/schematics/component-migration/utils/typescript/compiler_host.js +87 -0
- package/schematics/component-migration/utils/typescript/decorators.d.ts +22 -0
- package/schematics/component-migration/utils/typescript/decorators.js +41 -0
- package/schematics/component-migration/utils/typescript/functions.d.ts +14 -0
- package/schematics/component-migration/utils/typescript/functions.js +20 -0
- package/schematics/component-migration/utils/typescript/imports.d.ts +17 -0
- package/schematics/component-migration/utils/typescript/imports.js +110 -0
- package/schematics/component-migration/utils/typescript/parse_tsconfig.d.ts +9 -0
- package/schematics/component-migration/utils/typescript/parse_tsconfig.js +29 -0
- package/schematics/component-migration/utils/typescript/property-name.d.ts +13 -0
- package/schematics/component-migration/utils/typescript/property-name.js +22 -0
- package/schematics/package.json +3 -0
- package/types/design-factory-angular-accordion.d.ts +553 -0
- package/types/design-factory-angular-alert.d.ts +166 -0
- package/types/design-factory-angular-breakpoints.d.ts +13 -0
- package/types/design-factory-angular-button.d.ts +166 -0
- package/types/design-factory-angular-buttongroup.d.ts +45 -0
- package/types/design-factory-angular-drawer.d.ts +19 -26
- package/types/design-factory-angular-dropdown.d.ts +148 -0
- package/types/design-factory-angular-form-field.d.ts +122 -0
- package/types/design-factory-angular-icon.d.ts +11 -0
- package/types/design-factory-angular-input.d.ts +16 -0
- package/types/design-factory-angular-internals.d.ts +78 -19
- package/types/design-factory-angular-separator.d.ts +29 -0
- package/types/design-factory-angular-sidenav.d.ts +114 -17
- package/types/design-factory-angular-slider.d.ts +239 -0
- package/types/design-factory-angular-toggle.d.ts +93 -0
- package/types/design-factory-angular-tooltip.d.ts +113 -0
- package/types/design-factory-angular-topnav.d.ts +47 -52
- package/drawer/README.md +0 -54
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editLegacyConfigTodos = editLegacyConfigTodos;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
|
+
const imports_1 = require("../utils/typescript/imports");
|
|
7
|
+
const todo_comments_1 = require("./todo-comments");
|
|
8
|
+
const LEGACY_CONFIG_IMPORTS = new Set([
|
|
9
|
+
'@ng-bootstrap/ng-bootstrap',
|
|
10
|
+
'@ng-bootstrap/ng-bootstrap/accordion',
|
|
11
|
+
'@ng-bootstrap/ng-bootstrap/alert',
|
|
12
|
+
'@ng-bootstrap/ng-bootstrap/dropdown',
|
|
13
|
+
'@ng-bootstrap/ng-bootstrap/tooltip'
|
|
14
|
+
]);
|
|
15
|
+
const LEGACY_CONFIG_TODOS = {
|
|
16
|
+
NgbAccordionConfig: {
|
|
17
|
+
code: 'accordion.config',
|
|
18
|
+
marker: 'human',
|
|
19
|
+
message: 'Legacy NgbAccordionConfig is not supported anymore. Review this configuration and migrate supported defaults to provideDfAccordionConfig().'
|
|
20
|
+
},
|
|
21
|
+
NgbAlertConfig: {
|
|
22
|
+
code: 'alert.config',
|
|
23
|
+
marker: 'human',
|
|
24
|
+
message: 'Legacy NgbAlertConfig is not supported anymore. Review this configuration and migrate supported defaults to provideDfAlertConfig().'
|
|
25
|
+
},
|
|
26
|
+
NgbDropdownConfig: {
|
|
27
|
+
code: 'dropdown.config',
|
|
28
|
+
marker: 'human',
|
|
29
|
+
message: 'Legacy NgbDropdownConfig is not supported anymore. DfDropdown has no provideDfDropdownConfig() equivalent yet; review this configuration manually.'
|
|
30
|
+
},
|
|
31
|
+
NgbTooltipConfig: {
|
|
32
|
+
code: 'tooltip.config',
|
|
33
|
+
marker: 'human',
|
|
34
|
+
message: 'Legacy NgbTooltipConfig is not supported anymore. Review this configuration and migrate supported defaults to provideDfTooltipConfig().'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function getImportedConfigNames(statement) {
|
|
38
|
+
if (!ts.isStringLiteral(statement.moduleSpecifier) || !LEGACY_CONFIG_IMPORTS.has(statement.moduleSpecifier.text)) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const namedBindings = statement.importClause?.namedBindings;
|
|
42
|
+
if (!namedBindings || !ts.isNamedImports(namedBindings)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
return namedBindings.elements
|
|
46
|
+
.map((element) => element.propertyName?.text ?? element.name.text)
|
|
47
|
+
.filter((symbolName) => LEGACY_CONFIG_TODOS[symbolName]);
|
|
48
|
+
}
|
|
49
|
+
function isLegacyConfigIdentifier(node, context) {
|
|
50
|
+
const importData = (0, imports_1.getImportOfIdentifier)(node, context.typeChecker);
|
|
51
|
+
if (!importData || !LEGACY_CONFIG_IMPORTS.has(importData.moduleName) || !LEGACY_CONFIG_TODOS[importData.symbolName]) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return importData.symbolName;
|
|
55
|
+
}
|
|
56
|
+
function editLegacyConfigTodos(context, configNames) {
|
|
57
|
+
const edits = [];
|
|
58
|
+
const requestedConfigNames = new Set(configNames);
|
|
59
|
+
const reportedConfigNames = new Set();
|
|
60
|
+
function addTodo(configName, node) {
|
|
61
|
+
if (!requestedConfigNames.has(configName) || reportedConfigNames.has(configName)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const edit = (0, todo_comments_1.editSourceTodo)(context.sourceFile, node, LEGACY_CONFIG_TODOS[configName]);
|
|
65
|
+
if (edit) {
|
|
66
|
+
edits.push(edit);
|
|
67
|
+
}
|
|
68
|
+
reportedConfigNames.add(configName);
|
|
69
|
+
}
|
|
70
|
+
for (const statement of context.sourceFile.statements) {
|
|
71
|
+
if (ts.isImportDeclaration(statement)) {
|
|
72
|
+
for (const configName of getImportedConfigNames(statement)) {
|
|
73
|
+
addTodo(configName, statement);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function visit(node) {
|
|
78
|
+
if (ts.isIdentifier(node)) {
|
|
79
|
+
const configName = isLegacyConfigIdentifier(node, context);
|
|
80
|
+
if (configName) {
|
|
81
|
+
addTodo(configName, node);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (reportedConfigNames.size < requestedConfigNames.size) {
|
|
85
|
+
ts.forEachChild(node, visit);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
visit(context.sourceFile);
|
|
89
|
+
return edits;
|
|
90
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { ComponentMigrationDefinition, ComponentMigrationRunContext } from './types';
|
|
3
|
+
export interface ComponentMigrationResult {
|
|
4
|
+
analyzedSourceFiles: number;
|
|
5
|
+
analyzedComponents: number;
|
|
6
|
+
analyzedTemplates: number;
|
|
7
|
+
changedTemplates: number;
|
|
8
|
+
changes: number;
|
|
9
|
+
changedFiles: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function createComponentMigrationRunContext(): ComponentMigrationRunContext;
|
|
12
|
+
export declare function migrateProjectComponentTemplates(tree: Tree, projectName: string, migration: ComponentMigrationDefinition, runContext?: ComponentMigrationRunContext): Promise<ComponentMigrationResult>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createComponentMigrationRunContext = createComponentMigrationRunContext;
|
|
4
|
+
exports.migrateProjectComponentTemplates = migrateProjectComponentTemplates;
|
|
5
|
+
const compiler_host_1 = require("../utils/typescript/compiler_host");
|
|
6
|
+
const project_templates_1 = require("./project-templates");
|
|
7
|
+
function addFileEdit(fileEdits, filePath, edit) {
|
|
8
|
+
const edits = fileEdits.get(filePath) ?? [];
|
|
9
|
+
edits.push(edit);
|
|
10
|
+
fileEdits.set(filePath, edits);
|
|
11
|
+
}
|
|
12
|
+
function addStandaloneImportRequirements(standaloneImportsByComponent, component, requirements) {
|
|
13
|
+
const componentRequirements = standaloneImportsByComponent.get(component) ?? [];
|
|
14
|
+
for (const requirement of requirements) {
|
|
15
|
+
if (!componentRequirements.some((existing) => existing.moduleName === requirement.moduleName && existing.symbolName === requirement.symbolName)) {
|
|
16
|
+
componentRequirements.push(requirement);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
standaloneImportsByComponent.set(component, componentRequirements);
|
|
20
|
+
}
|
|
21
|
+
function applyFileEdits(tree, fileEdits) {
|
|
22
|
+
for (const [filePath, edits] of fileEdits) {
|
|
23
|
+
const recorder = tree.beginUpdate(filePath);
|
|
24
|
+
for (const edit of edits.sort((a, b) => b.start - a.start || b.end - a.end)) {
|
|
25
|
+
recorder.remove(edit.start, edit.end - edit.start);
|
|
26
|
+
recorder.insertRight(edit.start, edit.text);
|
|
27
|
+
}
|
|
28
|
+
tree.commitUpdate(recorder);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function createComponentMigrationRunContext() {
|
|
32
|
+
return {
|
|
33
|
+
processedSourceFiles: new Set(),
|
|
34
|
+
processedTemplateFiles: new Set(),
|
|
35
|
+
migratedExternalTemplates: new Map(),
|
|
36
|
+
changedFiles: new Set()
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function migrateProjectComponentTemplates(tree, projectName, migration, runContext = createComponentMigrationRunContext()) {
|
|
40
|
+
const { basePath, program, typeChecker, sourceTemplates } = await (0, project_templates_1.collectProjectTemplates)(tree, projectName);
|
|
41
|
+
const templatesBySourceFile = new Map();
|
|
42
|
+
const standaloneImportsBySourceFile = new Map();
|
|
43
|
+
const projectTemplatesByComponent = new Map();
|
|
44
|
+
const projectStandaloneImportsByComponent = new Map();
|
|
45
|
+
const fileEdits = new Map();
|
|
46
|
+
const editableSourceFilePaths = new Set();
|
|
47
|
+
const analyzedComponents = new Set();
|
|
48
|
+
const analyzedTemplates = new Set();
|
|
49
|
+
let analyzedSourceFiles = 0;
|
|
50
|
+
let changedTemplates = 0;
|
|
51
|
+
let changes = 0;
|
|
52
|
+
for (const { sourceFile, templates: collectedTemplates } of sourceTemplates) {
|
|
53
|
+
const sourceFilePath = (0, project_templates_1.getWorkspaceRelativePath)(sourceFile.fileName);
|
|
54
|
+
const sourceFileWasProcessed = runContext.processedSourceFiles.has(sourceFilePath);
|
|
55
|
+
if (!sourceFileWasProcessed) {
|
|
56
|
+
runContext.processedSourceFiles.add(sourceFilePath);
|
|
57
|
+
editableSourceFilePaths.add(sourceFilePath);
|
|
58
|
+
analyzedSourceFiles++;
|
|
59
|
+
}
|
|
60
|
+
const templatesByComponent = new Map();
|
|
61
|
+
const standaloneImportsByComponent = new Map();
|
|
62
|
+
templatesBySourceFile.set(sourceFile, templatesByComponent);
|
|
63
|
+
standaloneImportsBySourceFile.set(sourceFile, standaloneImportsByComponent);
|
|
64
|
+
for (const template of collectedTemplates) {
|
|
65
|
+
if (!sourceFileWasProcessed) {
|
|
66
|
+
analyzedTemplates.add(template.inline ? `${sourceFile.fileName}:${template.start}` : template.absFilePath);
|
|
67
|
+
}
|
|
68
|
+
if (!sourceFileWasProcessed && template.container) {
|
|
69
|
+
analyzedComponents.add(template.container);
|
|
70
|
+
}
|
|
71
|
+
const templateKey = template.inline ? `${sourceFilePath}:${template.start}` : template.filePath;
|
|
72
|
+
const templateWasProcessed = runContext.processedTemplateFiles.has(templateKey);
|
|
73
|
+
let migrationResult = template.inline ? undefined : runContext.migratedExternalTemplates.get(template.filePath);
|
|
74
|
+
if (!migrationResult) {
|
|
75
|
+
migrationResult = migration.migrateTemplate?.(template.content) ?? { content: template.content, changes: 0 };
|
|
76
|
+
if (!template.inline) {
|
|
77
|
+
runContext.migratedExternalTemplates.set(template.filePath, migrationResult);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!templateWasProcessed) {
|
|
81
|
+
runContext.processedTemplateFiles.add(templateKey);
|
|
82
|
+
}
|
|
83
|
+
if (!templateWasProcessed && migrationResult.content !== template.content) {
|
|
84
|
+
addFileEdit(fileEdits, template.filePath, {
|
|
85
|
+
start: template.start,
|
|
86
|
+
end: template.start + template.content.length,
|
|
87
|
+
text: migrationResult.content
|
|
88
|
+
});
|
|
89
|
+
changedTemplates++;
|
|
90
|
+
changes += migrationResult.changes;
|
|
91
|
+
}
|
|
92
|
+
if (template.container) {
|
|
93
|
+
const templates = templatesByComponent.get(template.container) ?? [];
|
|
94
|
+
templates.push(migrationResult.content);
|
|
95
|
+
templatesByComponent.set(template.container, templates);
|
|
96
|
+
projectTemplatesByComponent.set(template.container, templates);
|
|
97
|
+
addStandaloneImportRequirements(standaloneImportsByComponent, template.container, migrationResult.standaloneImports ?? []);
|
|
98
|
+
addStandaloneImportRequirements(projectStandaloneImportsByComponent, template.container, migrationResult.standaloneImports ?? []);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const sourceFile of program.getSourceFiles()) {
|
|
103
|
+
if (!(0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const sourceFilePath = (0, project_templates_1.getWorkspaceRelativePath)(sourceFile.fileName);
|
|
107
|
+
if (!runContext.processedSourceFiles.has(sourceFilePath)) {
|
|
108
|
+
runContext.processedSourceFiles.add(sourceFilePath);
|
|
109
|
+
analyzedSourceFiles++;
|
|
110
|
+
}
|
|
111
|
+
const projectSourceEdits = migration.migrateProjectSourceFile?.({
|
|
112
|
+
sourceFile,
|
|
113
|
+
typeChecker,
|
|
114
|
+
templatesByComponent: templatesBySourceFile.get(sourceFile) ?? new Map(),
|
|
115
|
+
projectTemplatesByComponent,
|
|
116
|
+
standaloneImportsByComponent: standaloneImportsBySourceFile.get(sourceFile) ?? new Map(),
|
|
117
|
+
projectStandaloneImportsByComponent
|
|
118
|
+
}) ?? [];
|
|
119
|
+
for (const edit of projectSourceEdits) {
|
|
120
|
+
addFileEdit(fileEdits, sourceFilePath, edit);
|
|
121
|
+
}
|
|
122
|
+
changes += projectSourceEdits.length;
|
|
123
|
+
if (!editableSourceFilePaths.has(sourceFilePath)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const sourceEdits = migration.migrateSourceFile?.({
|
|
127
|
+
sourceFile,
|
|
128
|
+
typeChecker,
|
|
129
|
+
templatesByComponent: templatesBySourceFile.get(sourceFile) ?? new Map(),
|
|
130
|
+
projectTemplatesByComponent,
|
|
131
|
+
standaloneImportsByComponent: standaloneImportsBySourceFile.get(sourceFile) ?? new Map(),
|
|
132
|
+
projectStandaloneImportsByComponent
|
|
133
|
+
}) ?? [];
|
|
134
|
+
for (const edit of sourceEdits) {
|
|
135
|
+
addFileEdit(fileEdits, sourceFilePath, edit);
|
|
136
|
+
}
|
|
137
|
+
changes += sourceEdits.length;
|
|
138
|
+
}
|
|
139
|
+
for (const filePath of fileEdits.keys()) {
|
|
140
|
+
runContext.changedFiles.add(filePath);
|
|
141
|
+
}
|
|
142
|
+
applyFileEdits(tree, fileEdits);
|
|
143
|
+
return {
|
|
144
|
+
analyzedSourceFiles,
|
|
145
|
+
analyzedComponents: analyzedComponents.size,
|
|
146
|
+
analyzedTemplates: analyzedTemplates.size,
|
|
147
|
+
changedTemplates,
|
|
148
|
+
changes,
|
|
149
|
+
changedFiles: [...fileEdits.keys()]
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
import { ResolvedResource } from '../utils/component-resource-collector';
|
|
4
|
+
export interface ProjectSourceTemplates {
|
|
5
|
+
sourceFile: ts.SourceFile;
|
|
6
|
+
templates: ResolvedResource[];
|
|
7
|
+
}
|
|
8
|
+
export interface ProjectTemplateCollection {
|
|
9
|
+
basePath: string;
|
|
10
|
+
program: ts.Program;
|
|
11
|
+
typeChecker: ts.TypeChecker;
|
|
12
|
+
sourceTemplates: ProjectSourceTemplates[];
|
|
13
|
+
}
|
|
14
|
+
export declare function getWorkspaceRelativePath(fileName: string): string;
|
|
15
|
+
export declare function collectProjectTemplates(tree: Tree, projectName: string): Promise<ProjectTemplateCollection>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkspaceRelativePath = getWorkspaceRelativePath;
|
|
4
|
+
exports.collectProjectTemplates = collectProjectTemplates;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
+
const core_1 = require("@angular-devkit/core");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
10
|
+
const component_resource_collector_1 = require("../utils/component-resource-collector");
|
|
11
|
+
const project_tsconfig_paths_1 = require("../utils/project_tsconfig_paths");
|
|
12
|
+
const compiler_host_1 = require("../utils/typescript/compiler_host");
|
|
13
|
+
function getWorkspaceRelativePath(fileName) {
|
|
14
|
+
const absFilePath = (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(fileName)));
|
|
15
|
+
return path_1.posix.relative((0, core_1.normalize)(process.cwd()), absFilePath);
|
|
16
|
+
}
|
|
17
|
+
function collectTemplates(tree, sourceFile, typeChecker) {
|
|
18
|
+
const resourceCollector = new component_resource_collector_1.ComponentResourceCollector(typeChecker, tree);
|
|
19
|
+
const visitNode = (node) => {
|
|
20
|
+
ts.forEachChild(node, visitNode);
|
|
21
|
+
resourceCollector.visitNode(node);
|
|
22
|
+
};
|
|
23
|
+
visitNode(sourceFile);
|
|
24
|
+
return resourceCollector.resolvedTemplates;
|
|
25
|
+
}
|
|
26
|
+
async function collectProjectTemplates(tree, projectName) {
|
|
27
|
+
const { buildPaths } = await (0, project_tsconfig_paths_1.getProjectTsConfigPaths)(tree, projectName);
|
|
28
|
+
const tsconfigPath = buildPaths[0];
|
|
29
|
+
if (!tsconfigPath) {
|
|
30
|
+
throw new schematics_1.SchematicsException(`Could not find a build tsconfig for project "${projectName}".`);
|
|
31
|
+
}
|
|
32
|
+
const basePath = process.cwd();
|
|
33
|
+
const program = (0, compiler_host_1.createMigrationProgram)(tree, tsconfigPath, basePath);
|
|
34
|
+
const typeChecker = program.getTypeChecker();
|
|
35
|
+
const sourceTemplates = program
|
|
36
|
+
.getSourceFiles()
|
|
37
|
+
.filter((sourceFile) => (0, compiler_host_1.canMigrateFile)(basePath, sourceFile, program))
|
|
38
|
+
.map((sourceFile) => ({
|
|
39
|
+
sourceFile,
|
|
40
|
+
templates: collectTemplates(tree, sourceFile, typeChecker)
|
|
41
|
+
}));
|
|
42
|
+
return { basePath, program, typeChecker, sourceTemplates };
|
|
43
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { ComponentMigrationDefinition, ComponentMigrationRunContext, ComponentMigrationScanResult } from './types';
|
|
3
|
+
export declare function scanProjectForComponentMigrations(tree: Tree, projectName: string, migrations: ComponentMigrationDefinition[], runContext?: Pick<ComponentMigrationRunContext, 'processedSourceFiles'>): Promise<ComponentMigrationScanResult[]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanProjectForComponentMigrations = scanProjectForComponentMigrations;
|
|
4
|
+
const project_templates_1 = require("./project-templates");
|
|
5
|
+
async function scanProjectForComponentMigrations(tree, projectName, migrations, runContext) {
|
|
6
|
+
const { sourceTemplates } = await (0, project_templates_1.collectProjectTemplates)(tree, projectName);
|
|
7
|
+
const usageCounts = new Map(migrations.map((migration) => [migration.id, 0]));
|
|
8
|
+
for (const { sourceFile, templates } of sourceTemplates) {
|
|
9
|
+
const sourceFilePath = (0, project_templates_1.getWorkspaceRelativePath)(sourceFile.fileName);
|
|
10
|
+
if (runContext?.processedSourceFiles.has(sourceFilePath)) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
runContext?.processedSourceFiles.add(sourceFilePath);
|
|
14
|
+
for (const template of templates) {
|
|
15
|
+
for (const migration of migrations) {
|
|
16
|
+
usageCounts.set(migration.id, (usageCounts.get(migration.id) ?? 0) + migration.countLegacyTemplateUsages(template.content));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return migrations.map((migration) => ({
|
|
21
|
+
migration,
|
|
22
|
+
legacyUsages: usageCounts.get(migration.id) ?? 0
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapStaticPlacement(value: string): string | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapStaticPlacement = mapStaticPlacement;
|
|
4
|
+
const STATIC_PLACEMENT_MAP = new Map([
|
|
5
|
+
['top', 'top'],
|
|
6
|
+
['bottom', 'bottom'],
|
|
7
|
+
['left', 'start'],
|
|
8
|
+
['right', 'end'],
|
|
9
|
+
['start', 'start'],
|
|
10
|
+
['end', 'end'],
|
|
11
|
+
['auto', 'auto'],
|
|
12
|
+
['vertical', 'vertical'],
|
|
13
|
+
['horizontal', 'horizontal'],
|
|
14
|
+
['top-start', 'top-start'],
|
|
15
|
+
['top-left', 'top-start'],
|
|
16
|
+
['top-end', 'top-end'],
|
|
17
|
+
['top-right', 'top-end'],
|
|
18
|
+
['bottom-start', 'bottom-start'],
|
|
19
|
+
['bottom-left', 'bottom-start'],
|
|
20
|
+
['bottom-end', 'bottom-end'],
|
|
21
|
+
['bottom-right', 'bottom-end'],
|
|
22
|
+
['left-start', 'start-start'],
|
|
23
|
+
['left-top', 'start-start'],
|
|
24
|
+
['start-start', 'start-start'],
|
|
25
|
+
['start-top', 'start-start'],
|
|
26
|
+
['left-end', 'start-end'],
|
|
27
|
+
['left-bottom', 'start-end'],
|
|
28
|
+
['start-end', 'start-end'],
|
|
29
|
+
['start-bottom', 'start-end'],
|
|
30
|
+
['right-start', 'end-start'],
|
|
31
|
+
['right-top', 'end-start'],
|
|
32
|
+
['end-start', 'end-start'],
|
|
33
|
+
['end-top', 'end-start'],
|
|
34
|
+
['right-end', 'end-end'],
|
|
35
|
+
['right-bottom', 'end-end'],
|
|
36
|
+
['end-end', 'end-end'],
|
|
37
|
+
['end-bottom', 'end-end']
|
|
38
|
+
]);
|
|
39
|
+
function mapStaticPlacement(value) {
|
|
40
|
+
const placements = value
|
|
41
|
+
.split(/\s+/)
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.map((placement) => STATIC_PLACEMENT_MAP.get(placement) ?? placement);
|
|
44
|
+
return placements.length > 0 ? placements.join(' ') : null;
|
|
45
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstNode, TmplAstTextAttribute } from '@angular/compiler';
|
|
2
|
+
export interface TemplateEdit {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TemplateElementMatch {
|
|
8
|
+
element: TmplAstElement;
|
|
9
|
+
ancestors: TmplAstElement[];
|
|
10
|
+
}
|
|
11
|
+
export type ClassAttribute = TmplAstTextAttribute | TmplAstBoundAttribute;
|
|
12
|
+
export declare function applyTemplateEdits(template: string, edits: TemplateEdit[]): string;
|
|
13
|
+
export declare function replaceElement(element: TmplAstElement, text: string): TemplateEdit;
|
|
14
|
+
export declare function getElementInnerSource(element: TmplAstElement): string;
|
|
15
|
+
export declare function visitTemplateNodes(nodes: TmplAstNode[], visitor: (node: TmplAstNode, ancestors: TmplAstElement[]) => void, ancestors?: TmplAstElement[]): void;
|
|
16
|
+
export declare function findTemplateElements(template: string, predicate: (element: TmplAstElement) => boolean): TmplAstElement[];
|
|
17
|
+
export declare function findTemplateElementsWithAncestors(template: string, predicate: (element: TmplAstElement) => boolean): TemplateElementMatch[];
|
|
18
|
+
export declare function findTextAttribute(element: TmplAstElement, name: string): TmplAstTextAttribute | undefined;
|
|
19
|
+
export declare function findBoundAttribute(element: TmplAstElement, name: string): TmplAstBoundAttribute | undefined;
|
|
20
|
+
export declare function isInterpolatedClassAttribute(attribute: TmplAstBoundAttribute): boolean;
|
|
21
|
+
export declare function findStaticOrInterpolatedClassAttribute(element: TmplAstElement): ClassAttribute | undefined;
|
|
22
|
+
export declare function findBoundEvent(element: TmplAstElement, name: string): TmplAstBoundEvent | undefined;
|
|
23
|
+
export declare function getStartTagInsertOffset(element: TmplAstElement): number;
|
|
24
|
+
export declare function getStartTagAttributesOffset(element: TmplAstElement): number;
|
|
25
|
+
export declare function removeTextAttribute(attribute: ClassAttribute): TemplateEdit;
|
|
26
|
+
export declare function getStaticClassTokens(element: TmplAstElement): string[];
|
|
27
|
+
export declare function getStaticOrInterpolatedClassTokens(element: TmplAstElement): string[];
|
|
28
|
+
export declare function hasDynamicClassBinding(element: TmplAstElement): boolean;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyTemplateEdits = applyTemplateEdits;
|
|
4
|
+
exports.replaceElement = replaceElement;
|
|
5
|
+
exports.getElementInnerSource = getElementInnerSource;
|
|
6
|
+
exports.visitTemplateNodes = visitTemplateNodes;
|
|
7
|
+
exports.findTemplateElements = findTemplateElements;
|
|
8
|
+
exports.findTemplateElementsWithAncestors = findTemplateElementsWithAncestors;
|
|
9
|
+
exports.findTextAttribute = findTextAttribute;
|
|
10
|
+
exports.findBoundAttribute = findBoundAttribute;
|
|
11
|
+
exports.isInterpolatedClassAttribute = isInterpolatedClassAttribute;
|
|
12
|
+
exports.findStaticOrInterpolatedClassAttribute = findStaticOrInterpolatedClassAttribute;
|
|
13
|
+
exports.findBoundEvent = findBoundEvent;
|
|
14
|
+
exports.getStartTagInsertOffset = getStartTagInsertOffset;
|
|
15
|
+
exports.getStartTagAttributesOffset = getStartTagAttributesOffset;
|
|
16
|
+
exports.removeTextAttribute = removeTextAttribute;
|
|
17
|
+
exports.getStaticClassTokens = getStaticClassTokens;
|
|
18
|
+
exports.getStaticOrInterpolatedClassTokens = getStaticOrInterpolatedClassTokens;
|
|
19
|
+
exports.hasDynamicClassBinding = hasDynamicClassBinding;
|
|
20
|
+
const compiler_1 = require("@angular/compiler");
|
|
21
|
+
function applyTemplateEdits(template, edits) {
|
|
22
|
+
if (edits.length === 0) {
|
|
23
|
+
return template;
|
|
24
|
+
}
|
|
25
|
+
const content = edits
|
|
26
|
+
.sort((a, b) => b.start - a.start || b.end - a.end)
|
|
27
|
+
.reduce((content, edit) => content.slice(0, edit.start) + edit.text + content.slice(edit.end), template);
|
|
28
|
+
return removeWhitespaceOnlyLines(content);
|
|
29
|
+
}
|
|
30
|
+
function replaceElement(element, text) {
|
|
31
|
+
return {
|
|
32
|
+
start: element.sourceSpan.start.offset,
|
|
33
|
+
end: element.sourceSpan.end.offset,
|
|
34
|
+
text
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getElementInnerSource(element) {
|
|
38
|
+
const content = element.sourceSpan.start.file.content;
|
|
39
|
+
const start = element.startSourceSpan.end.offset;
|
|
40
|
+
const end = element.endSourceSpan?.start.offset ?? element.sourceSpan.end.offset;
|
|
41
|
+
return content.slice(start, end);
|
|
42
|
+
}
|
|
43
|
+
function removeWhitespaceOnlyLines(content) {
|
|
44
|
+
return content.replace(/^[ \t]+(?:\r?\n)/gm, '');
|
|
45
|
+
}
|
|
46
|
+
function visitTemplateNodes(nodes, visitor, ancestors = []) {
|
|
47
|
+
for (const node of nodes) {
|
|
48
|
+
visitor(node, ancestors);
|
|
49
|
+
const childAncestors = node instanceof compiler_1.TmplAstElement ? [...ancestors, node] : ancestors;
|
|
50
|
+
const nodeWithChildren = node;
|
|
51
|
+
if (nodeWithChildren.children) {
|
|
52
|
+
visitTemplateNodes(nodeWithChildren.children, visitor, childAncestors);
|
|
53
|
+
}
|
|
54
|
+
const nodeWithBranches = node;
|
|
55
|
+
for (const branch of nodeWithBranches.branches ?? []) {
|
|
56
|
+
visitTemplateNodes(branch.children, visitor, childAncestors);
|
|
57
|
+
}
|
|
58
|
+
const nodeWithCases = node;
|
|
59
|
+
for (const switchCase of nodeWithCases.cases ?? []) {
|
|
60
|
+
visitTemplateNodes(switchCase.children, visitor, childAncestors);
|
|
61
|
+
}
|
|
62
|
+
const nodeWithGroups = node;
|
|
63
|
+
for (const group of nodeWithGroups.groups ?? []) {
|
|
64
|
+
visitTemplateNodes(group.children, visitor, childAncestors);
|
|
65
|
+
}
|
|
66
|
+
const nodeWithEmpty = node;
|
|
67
|
+
if (nodeWithEmpty.empty) {
|
|
68
|
+
visitTemplateNodes(nodeWithEmpty.empty.children, visitor, childAncestors);
|
|
69
|
+
}
|
|
70
|
+
const nodeWithDeferredBlocks = node;
|
|
71
|
+
for (const deferredBlock of [
|
|
72
|
+
nodeWithDeferredBlocks.placeholder,
|
|
73
|
+
nodeWithDeferredBlocks.loading,
|
|
74
|
+
nodeWithDeferredBlocks.error
|
|
75
|
+
]) {
|
|
76
|
+
if (deferredBlock) {
|
|
77
|
+
visitTemplateNodes(deferredBlock.children, visitor, childAncestors);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function findTemplateElements(template, predicate) {
|
|
83
|
+
const parsedTemplate = (0, compiler_1.parseTemplate)(template, 'component-template.html', {
|
|
84
|
+
preserveWhitespaces: true,
|
|
85
|
+
preserveLineEndings: true
|
|
86
|
+
});
|
|
87
|
+
const elements = [];
|
|
88
|
+
visitTemplateNodes(parsedTemplate.nodes, (node) => {
|
|
89
|
+
if (node instanceof compiler_1.TmplAstElement && predicate(node)) {
|
|
90
|
+
elements.push(node);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return elements;
|
|
94
|
+
}
|
|
95
|
+
function findTemplateElementsWithAncestors(template, predicate) {
|
|
96
|
+
const parsedTemplate = (0, compiler_1.parseTemplate)(template, 'component-template.html', {
|
|
97
|
+
preserveWhitespaces: true,
|
|
98
|
+
preserveLineEndings: true
|
|
99
|
+
});
|
|
100
|
+
const elements = [];
|
|
101
|
+
visitTemplateNodes(parsedTemplate.nodes, (node, ancestors) => {
|
|
102
|
+
if (node instanceof compiler_1.TmplAstElement && predicate(node)) {
|
|
103
|
+
elements.push({ element: node, ancestors });
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return elements;
|
|
107
|
+
}
|
|
108
|
+
function findTextAttribute(element, name) {
|
|
109
|
+
return element.attributes.find((attribute) => attribute.name === name);
|
|
110
|
+
}
|
|
111
|
+
function findBoundAttribute(element, name) {
|
|
112
|
+
return element.inputs.find((attribute) => attribute.name === name);
|
|
113
|
+
}
|
|
114
|
+
function isInterpolatedClassAttribute(attribute) {
|
|
115
|
+
const value = attribute.value;
|
|
116
|
+
return attribute.name === 'class' && value.ast instanceof compiler_1.Interpolation;
|
|
117
|
+
}
|
|
118
|
+
function findStaticOrInterpolatedClassAttribute(element) {
|
|
119
|
+
return findTextAttribute(element, 'class') ?? element.inputs.find(isInterpolatedClassAttribute);
|
|
120
|
+
}
|
|
121
|
+
function findBoundEvent(element, name) {
|
|
122
|
+
return element.outputs.find((output) => output.name === name);
|
|
123
|
+
}
|
|
124
|
+
function getStartTagInsertOffset(element) {
|
|
125
|
+
const content = element.startSourceSpan.start.file.content;
|
|
126
|
+
const tagEndOffset = element.startSourceSpan.end.offset;
|
|
127
|
+
return content[tagEndOffset - 2] === '/' ? tagEndOffset - 2 : tagEndOffset - 1;
|
|
128
|
+
}
|
|
129
|
+
function getStartTagAttributesOffset(element) {
|
|
130
|
+
return element.startSourceSpan.start.offset + element.name.length + 1;
|
|
131
|
+
}
|
|
132
|
+
function removeTextAttribute(attribute) {
|
|
133
|
+
const content = attribute.sourceSpan.start.file.content;
|
|
134
|
+
const start = attribute.sourceSpan.start.offset;
|
|
135
|
+
return {
|
|
136
|
+
start: /\s/.test(content[start - 1] ?? '') ? start - 1 : start,
|
|
137
|
+
end: attribute.sourceSpan.end.offset,
|
|
138
|
+
text: ''
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function getStaticClassTokens(element) {
|
|
142
|
+
return findTextAttribute(element, 'class')?.value.split(/\s+/).filter(Boolean) ?? [];
|
|
143
|
+
}
|
|
144
|
+
function getStaticOrInterpolatedClassTokens(element) {
|
|
145
|
+
const classAttribute = findStaticOrInterpolatedClassAttribute(element);
|
|
146
|
+
const fallbackValue = typeof classAttribute?.value === 'string' ? classAttribute.value : '';
|
|
147
|
+
const value = classAttribute?.valueSpan?.toString() ?? fallbackValue;
|
|
148
|
+
return value.split(/\s+/).filter(Boolean);
|
|
149
|
+
}
|
|
150
|
+
function hasDynamicClassBinding(element) {
|
|
151
|
+
return (!!findTextAttribute(element, 'ngClass') ||
|
|
152
|
+
element.inputs.some((input) => input.name === 'class' || input.name === 'ngClass' || input.type === compiler_1.BindingType.Class));
|
|
153
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ComponentMigrationTemplateResult, StandaloneImportRequirement } from './types';
|
|
2
|
+
import { TemplateEdit } from './template-edits';
|
|
3
|
+
export declare function createTemplateMigrationResult(template: string, edits: TemplateEdit[], standaloneImports?: StandaloneImportRequirement[]): ComponentMigrationTemplateResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTemplateMigrationResult = createTemplateMigrationResult;
|
|
4
|
+
const template_edits_1 = require("./template-edits");
|
|
5
|
+
function createTemplateMigrationResult(template, edits, standaloneImports) {
|
|
6
|
+
return {
|
|
7
|
+
content: (0, template_edits_1.applyTemplateEdits)(template, edits),
|
|
8
|
+
changes: edits.length,
|
|
9
|
+
standaloneImports
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TempScopedNodeJsSyncHost } from '@angular-devkit/core/node/testing';
|
|
2
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
3
|
+
export interface ComponentMigrationTestContext {
|
|
4
|
+
host: TempScopedNodeJsSyncHost;
|
|
5
|
+
tree: UnitTestTree;
|
|
6
|
+
tmpDirPath: string;
|
|
7
|
+
previousWorkingDir: string;
|
|
8
|
+
logs: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function setupComponentMigrationTest(runner: SchematicTestRunner, testCaseRoot: string): ComponentMigrationTestContext;
|
|
11
|
+
export declare function cleanupComponentMigrationTest(context: ComponentMigrationTestContext): void;
|
|
12
|
+
export declare function expectTestCaseOutputFile(tree: UnitTestTree, testCaseRoot: string, filePath: string): void;
|
|
13
|
+
export declare function expectSchematicIdempotent(runner: SchematicTestRunner, schematicName: string, context: ComponentMigrationTestContext): Promise<void>;
|