@design-factory/angular 21.1.0 → 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 +64 -62
- 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 +652 -401
- 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 +29 -19
- 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 +589 -589
- 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 +10 -16
- 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 +98 -14
- 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 +35 -47
- package/drawer/README.md +0 -54
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateAccordionTemplate = migrateAccordionTemplate;
|
|
4
|
+
exports.countLegacyAccordionUsages = countLegacyAccordionUsages;
|
|
5
|
+
const compiler_1 = require("@angular/compiler");
|
|
6
|
+
const template_edits_1 = require("../../shared/template-edits");
|
|
7
|
+
const template_result_1 = require("../../shared/template-result");
|
|
8
|
+
const todo_comments_1 = require("../../shared/todo-comments");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const title_content_1 = require("./title-content");
|
|
11
|
+
function hasAttributeOrInput(element, name) {
|
|
12
|
+
return !!(0, template_edits_1.findTextAttribute)(element, name) || !!(0, template_edits_1.findBoundAttribute)(element, name);
|
|
13
|
+
}
|
|
14
|
+
function isLegacyAccordionHost(element) {
|
|
15
|
+
return hasAttributeOrInput(element, 'ngbAccordion');
|
|
16
|
+
}
|
|
17
|
+
function isLegacyAccordionItem(element) {
|
|
18
|
+
return hasAttributeOrInput(element, 'ngbAccordionItem');
|
|
19
|
+
}
|
|
20
|
+
function getAccordionMatches(template) {
|
|
21
|
+
return (0, template_edits_1.findTemplateElementsWithAncestors)(template, (element) => isLegacyAccordionHost(element) || isLegacyAccordionItem(element));
|
|
22
|
+
}
|
|
23
|
+
function getNearestAccordionHost(match) {
|
|
24
|
+
return [...match.ancestors].reverse().find(isLegacyAccordionHost) ?? null;
|
|
25
|
+
}
|
|
26
|
+
function getSourceText(attribute) {
|
|
27
|
+
const content = attribute.sourceSpan.start.file.content;
|
|
28
|
+
return content.slice(attribute.sourceSpan.start.offset, attribute.sourceSpan.end.offset);
|
|
29
|
+
}
|
|
30
|
+
function getEventHandlerText(output) {
|
|
31
|
+
const content = output.sourceSpan.start.file.content;
|
|
32
|
+
return content.slice(output.handlerSpan.start.offset, output.handlerSpan.end.offset);
|
|
33
|
+
}
|
|
34
|
+
function renderEventSource(name, handler) {
|
|
35
|
+
return `(${name})="${handler}"`;
|
|
36
|
+
}
|
|
37
|
+
function combineEventHandlers(first, second) {
|
|
38
|
+
return [first, second]
|
|
39
|
+
.filter((output) => !!output)
|
|
40
|
+
.map(getEventHandlerText)
|
|
41
|
+
.join('; ');
|
|
42
|
+
}
|
|
43
|
+
function renameAttributeSource(source, oldName, newName) {
|
|
44
|
+
const index = source.indexOf(oldName);
|
|
45
|
+
return index === -1 ? source : `${source.slice(0, index)}${newName}${source.slice(index + oldName.length)}`;
|
|
46
|
+
}
|
|
47
|
+
function renderAttributes(attributes) {
|
|
48
|
+
return attributes
|
|
49
|
+
.sort((a, b) => a.start - b.start)
|
|
50
|
+
.map((attribute) => attribute.text)
|
|
51
|
+
.filter(Boolean)
|
|
52
|
+
.join(' ');
|
|
53
|
+
}
|
|
54
|
+
function getLineIndent(content, offset) {
|
|
55
|
+
const lineStart = content.lastIndexOf('\n', offset - 1) + 1;
|
|
56
|
+
const prefix = content.slice(lineStart, offset);
|
|
57
|
+
return /^\s*$/.test(prefix) ? prefix : '';
|
|
58
|
+
}
|
|
59
|
+
function editEndTagName(element, name) {
|
|
60
|
+
if (!element.endSourceSpan) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
start: element.endSourceSpan.start.offset + 2,
|
|
65
|
+
end: element.endSourceSpan.start.offset + 2 + element.name.length,
|
|
66
|
+
text: name
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function replaceStartTag(element, name, attributes) {
|
|
70
|
+
const renderedAttributes = renderAttributes(attributes);
|
|
71
|
+
return {
|
|
72
|
+
start: element.startSourceSpan.start.offset,
|
|
73
|
+
end: element.startSourceSpan.end.offset,
|
|
74
|
+
text: `<${name}${renderedAttributes ? ` ${renderedAttributes}` : ''}>`
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function getDirectChildElements(element) {
|
|
78
|
+
return element.children.filter((child) => child instanceof compiler_1.TmplAstElement);
|
|
79
|
+
}
|
|
80
|
+
function findDirectChildElement(element, predicate) {
|
|
81
|
+
return getDirectChildElements(element).find(predicate);
|
|
82
|
+
}
|
|
83
|
+
function hasOnlyAttributes(element, names) {
|
|
84
|
+
return (element.attributes.every((attribute) => names.has(attribute.name)) &&
|
|
85
|
+
element.inputs.length === 0 &&
|
|
86
|
+
element.outputs.length === 0 &&
|
|
87
|
+
element.references.length === 0);
|
|
88
|
+
}
|
|
89
|
+
function getHeaderLevel(header) {
|
|
90
|
+
const headingMatch = /^h([1-6])$/.exec(header.name);
|
|
91
|
+
if (headingMatch) {
|
|
92
|
+
return Number(headingMatch[1]);
|
|
93
|
+
}
|
|
94
|
+
const ariaLevel = (0, template_edits_1.findTextAttribute)(header, 'aria-level')?.value;
|
|
95
|
+
return ariaLevel && /^[1-6]$/.test(ariaLevel) ? Number(ariaLevel) : null;
|
|
96
|
+
}
|
|
97
|
+
function getItemParts(item) {
|
|
98
|
+
const header = findDirectChildElement(item, (child) => hasAttributeOrInput(child, 'ngbAccordionHeader'));
|
|
99
|
+
const titleButton = header
|
|
100
|
+
? findDirectChildElement(header, (child) => hasAttributeOrInput(child, 'ngbAccordionButton'))
|
|
101
|
+
: undefined;
|
|
102
|
+
const collapse = findDirectChildElement(item, (child) => hasAttributeOrInput(child, 'ngbAccordionCollapse'));
|
|
103
|
+
const body = (collapse && findDirectChildElement(collapse, (child) => hasAttributeOrInput(child, 'ngbAccordionBody'))) ??
|
|
104
|
+
findDirectChildElement(item, (child) => hasAttributeOrInput(child, 'ngbAccordionBody'));
|
|
105
|
+
return header && titleButton && body ? { header, titleButton, collapse, body } : null;
|
|
106
|
+
}
|
|
107
|
+
function hasNonI18nButtonAttributes(button) {
|
|
108
|
+
return (button.attributes.some((attribute) => attribute.name !== 'ngbAccordionButton' && !attribute.name.startsWith('i18n')) ||
|
|
109
|
+
button.inputs.length > 0 ||
|
|
110
|
+
button.outputs.length > 0 ||
|
|
111
|
+
button.references.length > 0);
|
|
112
|
+
}
|
|
113
|
+
function hasNonCanonicalStructure(parts) {
|
|
114
|
+
const allowedHeaderAttributes = new Set(['ngbAccordionHeader', 'aria-level']);
|
|
115
|
+
return (!hasOnlyAttributes(parts.header, allowedHeaderAttributes) ||
|
|
116
|
+
hasNonI18nButtonAttributes(parts.titleButton) ||
|
|
117
|
+
(!!parts.collapse && !hasOnlyAttributes(parts.collapse, new Set(['ngbAccordionCollapse']))) ||
|
|
118
|
+
!hasOnlyAttributes(parts.body, new Set(['ngbAccordionBody'])));
|
|
119
|
+
}
|
|
120
|
+
function hasOutput(element, name) {
|
|
121
|
+
return !!(0, template_edits_1.findBoundEvent)(element, name);
|
|
122
|
+
}
|
|
123
|
+
function hasPreEventConflict(element) {
|
|
124
|
+
return ((hasOutput(element, 'show') && hasOutput(element, 'shown')) ||
|
|
125
|
+
(hasOutput(element, 'hide') && hasOutput(element, 'hidden')));
|
|
126
|
+
}
|
|
127
|
+
function getLegacyReference(element, value) {
|
|
128
|
+
return element.references.find((reference) => reference.value === value);
|
|
129
|
+
}
|
|
130
|
+
function hasSelectablePattern(host) {
|
|
131
|
+
const classes = (0, template_edits_1.getStaticClassTokens)(host);
|
|
132
|
+
const hostSource = host.sourceSpan.start.file.content.slice(host.sourceSpan.start.offset, host.sourceSpan.end.offset);
|
|
133
|
+
return (classes.includes('df-accordion-radio') ||
|
|
134
|
+
(0, template_edits_1.findTextAttribute)(host, 'role')?.value === 'radiogroup' ||
|
|
135
|
+
/\btype\s*=\s*["']radio["']/.test(hostSource));
|
|
136
|
+
}
|
|
137
|
+
function hasCustomHostClass(host) {
|
|
138
|
+
return (0, template_edits_1.getStaticClassTokens)(host).some((className) => !constants_1.LEGACY_HOST_CLASSES.has(className));
|
|
139
|
+
}
|
|
140
|
+
function getHostTodos(host, itemParts) {
|
|
141
|
+
const todos = [
|
|
142
|
+
{
|
|
143
|
+
code: 'accordion.review',
|
|
144
|
+
message: 'This accordion was migrated automatically. Verify behavior and visual appearance.'
|
|
145
|
+
}
|
|
146
|
+
];
|
|
147
|
+
if ((0, template_edits_1.hasDynamicClassBinding)(host)) {
|
|
148
|
+
todos.push({
|
|
149
|
+
code: 'accordion.dynamic-class',
|
|
150
|
+
message: 'Dynamic accordion classes were preserved. Verify they do not depend on legacy accordion markup.'
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (hasCustomHostClass(host)) {
|
|
154
|
+
todos.push({
|
|
155
|
+
code: 'accordion.custom-classes',
|
|
156
|
+
message: 'Custom accordion classes were preserved. Verify that they still target the new DOM structure.'
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (getLegacyReference(host, 'ngbAccordion')) {
|
|
160
|
+
todos.push({
|
|
161
|
+
code: 'accordion.programmatic-api',
|
|
162
|
+
marker: 'human',
|
|
163
|
+
message: 'Template reference export was removed. Verify programmatic calls because the new API returns promises.'
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (hasOutput(host, 'show') || hasOutput(host, 'hide')) {
|
|
167
|
+
todos.push({
|
|
168
|
+
code: 'accordion.pre-event',
|
|
169
|
+
marker: 'human',
|
|
170
|
+
message: 'Legacy show/hide pre-events were mapped to post-change outputs. Verify timing-sensitive behavior.'
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (hasPreEventConflict(host)) {
|
|
174
|
+
todos.push({
|
|
175
|
+
code: 'accordion.event-conflict',
|
|
176
|
+
marker: 'human',
|
|
177
|
+
message: 'Pre-event and post-event handlers were combined on the same output. Verify timing-sensitive behavior.'
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (itemParts.some((parts) => !parts)) {
|
|
181
|
+
todos.push({
|
|
182
|
+
code: 'accordion.non-canonical-structure',
|
|
183
|
+
marker: 'human',
|
|
184
|
+
message: 'Some accordion items do not use the canonical ngbAccordion header/body structure and were not migrated.'
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return todos;
|
|
188
|
+
}
|
|
189
|
+
function getHardStopHostTodos(host, itemParts) {
|
|
190
|
+
const todos = [];
|
|
191
|
+
if (hasSelectablePattern(host)) {
|
|
192
|
+
todos.push({
|
|
193
|
+
code: 'accordion.selectable-pattern',
|
|
194
|
+
marker: 'human',
|
|
195
|
+
message: 'Selectable/radio accordion markup was not migrated. Convert it to df-accordion-selectable manually.'
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (itemParts.length === 0 || itemParts.some((parts) => !parts)) {
|
|
199
|
+
todos.push({
|
|
200
|
+
code: 'accordion.non-canonical-structure',
|
|
201
|
+
marker: 'human',
|
|
202
|
+
message: 'Accordion items do not use the canonical ngbAccordion header/body structure and were not migrated.'
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (itemParts.some((parts) => parts && hasNonCanonicalStructure(parts))) {
|
|
206
|
+
todos.push({
|
|
207
|
+
code: 'accordion.non-canonical-structure',
|
|
208
|
+
marker: 'human',
|
|
209
|
+
message: 'Accordion header/body attributes were not migrated. Convert this structure manually.'
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return todos;
|
|
213
|
+
}
|
|
214
|
+
function getHostHeadingLevel(itemParts, todos) {
|
|
215
|
+
const levels = itemParts
|
|
216
|
+
.map(({ header }) => getHeaderLevel(header))
|
|
217
|
+
.filter((level) => level !== null);
|
|
218
|
+
const uniqueLevels = new Set(levels);
|
|
219
|
+
if (uniqueLevels.size === 1 && levels.length === itemParts.length) {
|
|
220
|
+
return levels[0];
|
|
221
|
+
}
|
|
222
|
+
todos.push({
|
|
223
|
+
code: 'accordion.heading-level',
|
|
224
|
+
marker: 'human',
|
|
225
|
+
message: 'itemHeadingLevel was set to 2 because legacy header levels were missing or inconsistent.'
|
|
226
|
+
});
|
|
227
|
+
return 2;
|
|
228
|
+
}
|
|
229
|
+
function getStaticClassAttributeText(attribute) {
|
|
230
|
+
const tokens = attribute.value.split(/\s+/).filter(Boolean);
|
|
231
|
+
const remainingTokens = tokens.filter((className) => !constants_1.LEGACY_HOST_CLASSES.has(className));
|
|
232
|
+
return remainingTokens.length > 0 ? `class="${remainingTokens.join(' ')}"` : '';
|
|
233
|
+
}
|
|
234
|
+
function getHostAttributes(host, headingLevel, itemResults) {
|
|
235
|
+
const attributes = [];
|
|
236
|
+
const classes = (0, template_edits_1.getStaticClassTokens)(host);
|
|
237
|
+
const showOutput = (0, template_edits_1.findBoundEvent)(host, 'show');
|
|
238
|
+
const shownOutput = (0, template_edits_1.findBoundEvent)(host, 'shown');
|
|
239
|
+
const hideOutput = (0, template_edits_1.findBoundEvent)(host, 'hide');
|
|
240
|
+
const hiddenOutput = (0, template_edits_1.findBoundEvent)(host, 'hidden');
|
|
241
|
+
const subtitleTypes = itemResults
|
|
242
|
+
.map(({ subtitleType }) => subtitleType)
|
|
243
|
+
.filter((subtitleType) => subtitleType !== null);
|
|
244
|
+
for (const reference of host.references) {
|
|
245
|
+
attributes.push({
|
|
246
|
+
start: reference.sourceSpan.start.offset,
|
|
247
|
+
text: reference.value === 'ngbAccordion' ? `#${reference.name}` : getSourceText(reference)
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
for (const attribute of host.attributes) {
|
|
251
|
+
if (attribute.name === 'ngbAccordion') {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (attribute.name === 'class') {
|
|
255
|
+
attributes.push({
|
|
256
|
+
start: attribute.sourceSpan.start.offset,
|
|
257
|
+
text: getStaticClassAttributeText(attribute)
|
|
258
|
+
});
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
attributes.push({ start: attribute.sourceSpan.start.offset, text: getSourceText(attribute) });
|
|
262
|
+
}
|
|
263
|
+
for (const input of host.inputs) {
|
|
264
|
+
const source = getSourceText(input);
|
|
265
|
+
if (input.name === 'ngbAccordion') {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (input.name === 'destroyOnHide') {
|
|
269
|
+
attributes.push({
|
|
270
|
+
start: input.sourceSpan.start.offset,
|
|
271
|
+
text: renameAttributeSource(source, 'destroyOnHide', 'itemDestroyOnHide')
|
|
272
|
+
});
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (input.name === 'animation') {
|
|
276
|
+
attributes.push({
|
|
277
|
+
start: input.sourceSpan.start.offset,
|
|
278
|
+
text: renameAttributeSource(source, 'animation', 'animated')
|
|
279
|
+
});
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
attributes.push({ start: input.sourceSpan.start.offset, text: source });
|
|
283
|
+
}
|
|
284
|
+
for (const output of host.outputs) {
|
|
285
|
+
const source = getSourceText(output);
|
|
286
|
+
if (output.name === 'show') {
|
|
287
|
+
attributes.push({
|
|
288
|
+
start: output.sourceSpan.start.offset,
|
|
289
|
+
text: renderEventSource('itemShown', combineEventHandlers(output, shownOutput))
|
|
290
|
+
});
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (output.name === 'shown') {
|
|
294
|
+
if (showOutput) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
attributes.push({
|
|
298
|
+
start: output.sourceSpan.start.offset,
|
|
299
|
+
text: renameAttributeSource(source, 'shown', 'itemShown')
|
|
300
|
+
});
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (output.name === 'hide') {
|
|
304
|
+
attributes.push({
|
|
305
|
+
start: output.sourceSpan.start.offset,
|
|
306
|
+
text: renderEventSource('itemHidden', combineEventHandlers(output, hiddenOutput))
|
|
307
|
+
});
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (output.name === 'hidden') {
|
|
311
|
+
if (hideOutput) {
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
attributes.push({
|
|
315
|
+
start: output.sourceSpan.start.offset,
|
|
316
|
+
text: renameAttributeSource(source, 'hidden', 'itemHidden')
|
|
317
|
+
});
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
attributes.push({ start: output.sourceSpan.start.offset, text: source });
|
|
321
|
+
}
|
|
322
|
+
attributes.push({ start: host.startSourceSpan.end.offset, text: `itemHeadingLevel="${headingLevel}"` });
|
|
323
|
+
if (classes.includes('df-accordion-sm')) {
|
|
324
|
+
attributes.push({ start: host.startSourceSpan.end.offset, text: 'size="sm"' });
|
|
325
|
+
}
|
|
326
|
+
if (classes.includes('df-accordion-lg')) {
|
|
327
|
+
attributes.push({ start: host.startSourceSpan.end.offset, text: 'size="lg"' });
|
|
328
|
+
}
|
|
329
|
+
if (classes.includes('df-accordion-withsep')) {
|
|
330
|
+
attributes.push({ start: host.startSourceSpan.end.offset, text: 'separator' });
|
|
331
|
+
}
|
|
332
|
+
if (classes.includes('df-accordion-reverse')) {
|
|
333
|
+
attributes.push({ start: host.startSourceSpan.end.offset, text: 'arrowPosition="start"' });
|
|
334
|
+
}
|
|
335
|
+
if (itemResults.some(({ hasNumber }) => hasNumber)) {
|
|
336
|
+
attributes.push({ start: host.startSourceSpan.end.offset, text: 'addon="number"' });
|
|
337
|
+
}
|
|
338
|
+
if (subtitleTypes.length > 0) {
|
|
339
|
+
attributes.push({
|
|
340
|
+
start: host.startSourceSpan.end.offset,
|
|
341
|
+
text: `subtitleType="${subtitleTypes.includes('block') ? 'block' : 'inline'}"`
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
return attributes;
|
|
345
|
+
}
|
|
346
|
+
function getExpression(attribute) {
|
|
347
|
+
return attribute.valueSpan?.toString() ?? '';
|
|
348
|
+
}
|
|
349
|
+
function getVisibleAttribute(input, todos) {
|
|
350
|
+
const expression = getExpression(input).trim();
|
|
351
|
+
if (expression === 'false') {
|
|
352
|
+
return 'visible="true"';
|
|
353
|
+
}
|
|
354
|
+
if (expression === 'true') {
|
|
355
|
+
return 'visible="false"';
|
|
356
|
+
}
|
|
357
|
+
todos.push({
|
|
358
|
+
code: 'accordion.dynamic-collapsed',
|
|
359
|
+
message: 'Dynamic collapsed state was inverted to visible. Verify the expression still matches the intended state.'
|
|
360
|
+
});
|
|
361
|
+
return `[visible]="!(${expression})"`;
|
|
362
|
+
}
|
|
363
|
+
function getStaticVisibleAttribute(attribute, todos) {
|
|
364
|
+
if (attribute.value === 'false') {
|
|
365
|
+
return 'visible="true"';
|
|
366
|
+
}
|
|
367
|
+
if (attribute.value === 'true') {
|
|
368
|
+
return 'visible="false"';
|
|
369
|
+
}
|
|
370
|
+
todos.push({
|
|
371
|
+
code: 'accordion.dynamic-collapsed',
|
|
372
|
+
marker: 'human',
|
|
373
|
+
message: 'Static collapsed value was not a boolean literal. Verify the migrated visible input manually.'
|
|
374
|
+
});
|
|
375
|
+
return renameAttributeSource(getSourceText(attribute), 'collapsed', 'visible');
|
|
376
|
+
}
|
|
377
|
+
function getItemAttributes(item, todos) {
|
|
378
|
+
const attributes = [];
|
|
379
|
+
for (const reference of item.references) {
|
|
380
|
+
if (reference.value === 'ngbAccordionItem') {
|
|
381
|
+
todos.push({
|
|
382
|
+
code: 'accordion.programmatic-api',
|
|
383
|
+
marker: 'human',
|
|
384
|
+
message: 'Item template reference export was removed. Verify programmatic calls because the new API returns promises.'
|
|
385
|
+
});
|
|
386
|
+
attributes.push({ start: reference.sourceSpan.start.offset, text: `#${reference.name}` });
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
attributes.push({ start: reference.sourceSpan.start.offset, text: getSourceText(reference) });
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
for (const attribute of item.attributes) {
|
|
393
|
+
if (attribute.name === 'ngbAccordionItem') {
|
|
394
|
+
if (attribute.value) {
|
|
395
|
+
attributes.push({
|
|
396
|
+
start: attribute.sourceSpan.start.offset,
|
|
397
|
+
text: renameAttributeSource(getSourceText(attribute), 'ngbAccordionItem', 'id')
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
if (attribute.name === 'collapsed') {
|
|
403
|
+
attributes.push({ start: attribute.sourceSpan.start.offset, text: getStaticVisibleAttribute(attribute, todos) });
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
if (attribute.name === 'class') {
|
|
407
|
+
todos.push({
|
|
408
|
+
code: 'accordion.custom-classes',
|
|
409
|
+
message: 'Custom accordion item classes were preserved. Verify that they still target the new DOM structure.'
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
attributes.push({ start: attribute.sourceSpan.start.offset, text: getSourceText(attribute) });
|
|
413
|
+
}
|
|
414
|
+
for (const input of item.inputs) {
|
|
415
|
+
const source = getSourceText(input);
|
|
416
|
+
if (input.name === 'ngbAccordionItem') {
|
|
417
|
+
attributes.push({
|
|
418
|
+
start: input.sourceSpan.start.offset,
|
|
419
|
+
text: renameAttributeSource(source, 'ngbAccordionItem', 'id')
|
|
420
|
+
});
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (input.name === 'collapsed') {
|
|
424
|
+
attributes.push({ start: input.sourceSpan.start.offset, text: getVisibleAttribute(input, todos) });
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
attributes.push({ start: input.sourceSpan.start.offset, text: source });
|
|
428
|
+
}
|
|
429
|
+
for (const output of item.outputs) {
|
|
430
|
+
const source = getSourceText(output);
|
|
431
|
+
if (output.name === 'show') {
|
|
432
|
+
todos.push({
|
|
433
|
+
code: 'accordion.pre-event',
|
|
434
|
+
marker: 'human',
|
|
435
|
+
message: 'Legacy show pre-event was mapped to shown. Verify the behavior because the new output fires after expansion.'
|
|
436
|
+
});
|
|
437
|
+
attributes.push({ start: output.sourceSpan.start.offset, text: renameAttributeSource(source, 'show', 'shown') });
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
if (output.name === 'hide') {
|
|
441
|
+
todos.push({
|
|
442
|
+
code: 'accordion.pre-event',
|
|
443
|
+
marker: 'human',
|
|
444
|
+
message: 'Legacy hide pre-event was mapped to hidden. Verify the behavior because the new output fires after collapse.'
|
|
445
|
+
});
|
|
446
|
+
attributes.push({ start: output.sourceSpan.start.offset, text: renameAttributeSource(source, 'hide', 'hidden') });
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
attributes.push({ start: output.sourceSpan.start.offset, text: source });
|
|
450
|
+
}
|
|
451
|
+
return attributes;
|
|
452
|
+
}
|
|
453
|
+
function unwrapBodyTemplate(source) {
|
|
454
|
+
const trimmed = source.trim();
|
|
455
|
+
const match = /^<ng-template\s*>([\s\S]*)<\/ng-template>$/.exec(trimmed);
|
|
456
|
+
return match ? match[1] : source;
|
|
457
|
+
}
|
|
458
|
+
function indentContent(content, indentation) {
|
|
459
|
+
return content
|
|
460
|
+
.split(/\r?\n/)
|
|
461
|
+
.map((line) => (line.trim() ? `${indentation}${line.trimEnd()}` : line))
|
|
462
|
+
.join('\n');
|
|
463
|
+
}
|
|
464
|
+
function renderTemplateBlock(attribute, content, itemIndent, extraAttributes = '') {
|
|
465
|
+
const trimmed = content.trim();
|
|
466
|
+
const attributes = `${attribute}${extraAttributes ? ` ${extraAttributes}` : ''}`;
|
|
467
|
+
if (!trimmed.includes('\n')) {
|
|
468
|
+
return `${itemIndent} <ng-template ${attributes}>${trimmed}</ng-template>`;
|
|
469
|
+
}
|
|
470
|
+
return `${itemIndent} <ng-template ${attributes}>\n${indentContent(trimmed, `${itemIndent} `)}\n${itemIndent} </ng-template>`;
|
|
471
|
+
}
|
|
472
|
+
function getTitleTemplateAttributes(button) {
|
|
473
|
+
return button.attributes
|
|
474
|
+
.filter((attribute) => attribute.name.startsWith('i18n'))
|
|
475
|
+
.map(getSourceText)
|
|
476
|
+
.join(' ');
|
|
477
|
+
}
|
|
478
|
+
function escapeAttributeValue(value) {
|
|
479
|
+
return value.replace(/&/g, '&').replace(/"/g, '"');
|
|
480
|
+
}
|
|
481
|
+
function renderAccordionItem(item, parts) {
|
|
482
|
+
const todos = [];
|
|
483
|
+
const content = item.sourceSpan.start.file.content;
|
|
484
|
+
const itemIndent = getLineIndent(content, item.sourceSpan.start.offset);
|
|
485
|
+
const itemAttributes = getItemAttributes(item, todos);
|
|
486
|
+
const title = (0, template_edits_1.getElementInnerSource)(parts.titleButton);
|
|
487
|
+
const migratedTitle = (0, title_content_1.migrateTitleContent)(title, parts.titleButton);
|
|
488
|
+
const body = unwrapBodyTemplate((0, template_edits_1.getElementInnerSource)(parts.body));
|
|
489
|
+
if (!migratedTitle.subtitle && migratedTitle.hasRemainingLegacySubtitle) {
|
|
490
|
+
todos.push({
|
|
491
|
+
code: 'accordion.subtitle',
|
|
492
|
+
marker: 'human',
|
|
493
|
+
message: 'Legacy .df-subtitle markup was preserved because the subtitle content is complex. Convert it to the item subtitle input manually.'
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
if (migratedTitle.number) {
|
|
497
|
+
itemAttributes.push({
|
|
498
|
+
start: item.startSourceSpan.end.offset,
|
|
499
|
+
text: `number="${escapeAttributeValue(migratedTitle.number)}"`
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
if (migratedTitle.subtitle) {
|
|
503
|
+
itemAttributes.push({
|
|
504
|
+
start: item.startSourceSpan.end.offset,
|
|
505
|
+
text: `subtitle="${escapeAttributeValue(migratedTitle.subtitle)}"`
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
const titleTemplate = renderTemplateBlock('dfAccordionItemTitle', migratedTitle.title, itemIndent, getTitleTemplateAttributes(parts.titleButton));
|
|
509
|
+
const bodyTemplate = renderTemplateBlock('dfAccordionItemBody', body, itemIndent);
|
|
510
|
+
const renderedItemAttributes = renderAttributes(itemAttributes);
|
|
511
|
+
return {
|
|
512
|
+
text: `<df-accordion-item${renderedItemAttributes ? ` ${renderedItemAttributes}` : ''}>\n${titleTemplate}\n${bodyTemplate}\n${itemIndent}</df-accordion-item>`,
|
|
513
|
+
todos,
|
|
514
|
+
hasNumber: !!migratedTitle.number,
|
|
515
|
+
subtitleType: migratedTitle.subtitleType
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function migrateAccordionTemplate(template) {
|
|
519
|
+
const edits = [];
|
|
520
|
+
const standaloneImports = [];
|
|
521
|
+
const matches = getAccordionMatches(template);
|
|
522
|
+
const hostMatches = matches.filter(({ element }) => isLegacyAccordionHost(element));
|
|
523
|
+
const itemMatches = matches.filter(({ element }) => isLegacyAccordionItem(element));
|
|
524
|
+
for (const hostMatch of hostMatches) {
|
|
525
|
+
const hostItems = itemMatches.filter((itemMatch) => getNearestAccordionHost(itemMatch) === hostMatch.element);
|
|
526
|
+
const itemParts = hostItems.map(({ element }) => getItemParts(element));
|
|
527
|
+
const hardStopTodos = getHardStopHostTodos(hostMatch.element, itemParts);
|
|
528
|
+
if (hardStopTodos.length > 0) {
|
|
529
|
+
(0, todo_comments_1.editTemplateTodos)(hostMatch.element, hardStopTodos, edits);
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
const canonicalItemParts = itemParts;
|
|
533
|
+
const itemResults = hostItems.map(({ element }, index) => renderAccordionItem(element, canonicalItemParts[index]));
|
|
534
|
+
const hostTodos = getHostTodos(hostMatch.element, canonicalItemParts);
|
|
535
|
+
const headingLevel = getHostHeadingLevel(canonicalItemParts, hostTodos);
|
|
536
|
+
const hostAttributes = getHostAttributes(hostMatch.element, headingLevel, itemResults);
|
|
537
|
+
(0, todo_comments_1.editTemplateTodos)(hostMatch.element, hostTodos, edits);
|
|
538
|
+
edits.push(replaceStartTag(hostMatch.element, 'df-accordion', hostAttributes));
|
|
539
|
+
const endTagEdit = editEndTagName(hostMatch.element, 'df-accordion');
|
|
540
|
+
if (endTagEdit) {
|
|
541
|
+
edits.push(endTagEdit);
|
|
542
|
+
}
|
|
543
|
+
for (const [index, itemMatch] of hostItems.entries()) {
|
|
544
|
+
const result = itemResults[index];
|
|
545
|
+
(0, todo_comments_1.editTemplateTodos)(itemMatch.element, result.todos, edits);
|
|
546
|
+
edits.push((0, template_edits_1.replaceElement)(itemMatch.element, result.text));
|
|
547
|
+
}
|
|
548
|
+
standaloneImports.push(...constants_1.ACCORDION_IMPORTS);
|
|
549
|
+
}
|
|
550
|
+
return (0, template_result_1.createTemplateMigrationResult)(template, edits, standaloneImports);
|
|
551
|
+
}
|
|
552
|
+
function countLegacyAccordionUsages(template) {
|
|
553
|
+
return getAccordionMatches(template).filter(({ element }) => isLegacyAccordionHost(element)).length;
|
|
554
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TmplAstElement } from '@angular/compiler';
|
|
2
|
+
export interface MigratedTitleContent {
|
|
3
|
+
title: string;
|
|
4
|
+
number: string | null;
|
|
5
|
+
subtitle: string | null;
|
|
6
|
+
subtitleType: 'inline' | 'block' | null;
|
|
7
|
+
hasRemainingLegacySubtitle: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function migrateTitleContent(title: string, button: TmplAstElement): MigratedTitleContent;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateTitleContent = migrateTitleContent;
|
|
4
|
+
const compiler_1 = require("@angular/compiler");
|
|
5
|
+
const SIMPLE_LEGACY_TITLE_CLASSES = new Set(['flex-grow-1', 'd-flex', 'align-items-center', 'mb-2']);
|
|
6
|
+
function getDirectChildElements(element) {
|
|
7
|
+
return element.children.filter((child) => child instanceof compiler_1.TmplAstElement);
|
|
8
|
+
}
|
|
9
|
+
function hasStaticClass(element, className) {
|
|
10
|
+
return element.attributes.some((attribute) => attribute.name === 'class' && attribute.value.split(/\s+/).includes(className));
|
|
11
|
+
}
|
|
12
|
+
function hasDirectLegacySubtitle(button) {
|
|
13
|
+
return getDirectChildElements(button).some((element) => hasStaticClass(element, 'df-subtitle'));
|
|
14
|
+
}
|
|
15
|
+
function extractLegacyTitlePart(source, className) {
|
|
16
|
+
const pattern = new RegExp(`<(?<tag>[a-zA-Z][\\w:-]*)\\b(?<attributes>[^>]*)class=["'][^"']*\\b${className}\\b[^"']*["'][^>]*>(?<content>[\\s\\S]*?)<\\/\\k<tag>>`);
|
|
17
|
+
const match = pattern.exec(source);
|
|
18
|
+
const groups = match?.groups;
|
|
19
|
+
if (!match || !groups || /<[^>]+>/.test(groups['content'])) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
content: groups['content'].trim(),
|
|
24
|
+
source: source.slice(0, match.index) + source.slice(match.index + match[0].length)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function simplifyLegacyTitleMarkup(title) {
|
|
28
|
+
const trimmed = title.trim();
|
|
29
|
+
if (!trimmed.includes('<')) {
|
|
30
|
+
return trimmed;
|
|
31
|
+
}
|
|
32
|
+
for (const match of trimmed.matchAll(/<(?<closing>\/?)(?<tag>[a-zA-Z][\w:-]*)(?<attributes>[^>]*)>/g)) {
|
|
33
|
+
const groups = match.groups;
|
|
34
|
+
if (!groups || groups['closing']) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (groups['tag'] !== 'div' && groups['tag'] !== 'span') {
|
|
38
|
+
return title;
|
|
39
|
+
}
|
|
40
|
+
const attributes = groups['attributes'].trim();
|
|
41
|
+
const classMatch = /^class=["']([^"']*)["']$/.exec(attributes);
|
|
42
|
+
if (attributes && !classMatch) {
|
|
43
|
+
return title;
|
|
44
|
+
}
|
|
45
|
+
const classes = classMatch?.[1].split(/\s+/).filter(Boolean) ?? [];
|
|
46
|
+
if (classes.some((className) => !SIMPLE_LEGACY_TITLE_CLASSES.has(className))) {
|
|
47
|
+
return title;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const text = trimmed
|
|
51
|
+
.replace(/<[^>]+>/g, ' ')
|
|
52
|
+
.replace(/\s+/g, ' ')
|
|
53
|
+
.trim();
|
|
54
|
+
return text || title;
|
|
55
|
+
}
|
|
56
|
+
function migrateTitleContent(title, button) {
|
|
57
|
+
let migratedTitle = title;
|
|
58
|
+
const numberMatch = extractLegacyTitlePart(migratedTitle, 'df-accordion-number');
|
|
59
|
+
const number = numberMatch?.content.replace(/\.$/, '').trim() || null;
|
|
60
|
+
if (numberMatch) {
|
|
61
|
+
migratedTitle = numberMatch.source;
|
|
62
|
+
}
|
|
63
|
+
const subtitleMatch = extractLegacyTitlePart(migratedTitle, 'df-subtitle');
|
|
64
|
+
const subtitle = subtitleMatch?.content || null;
|
|
65
|
+
if (subtitleMatch) {
|
|
66
|
+
migratedTitle = subtitleMatch.source;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
title: number || subtitle ? simplifyLegacyTitleMarkup(migratedTitle) : migratedTitle,
|
|
70
|
+
number,
|
|
71
|
+
subtitle,
|
|
72
|
+
subtitleType: subtitle ? (hasDirectLegacySubtitle(button) ? 'inline' : 'block') : null,
|
|
73
|
+
hasRemainingLegacySubtitle: /\bclass\s*=\s*["'][^"']*\bdf-subtitle\b/.test(migratedTitle)
|
|
74
|
+
};
|
|
75
|
+
}
|