@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,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasTooltipI18nAttribute = hasTooltipI18nAttribute;
|
|
4
|
+
exports.editTooltipElement = editTooltipElement;
|
|
5
|
+
const compiler_1 = require("@angular/compiler");
|
|
6
|
+
const template_edits_1 = require("../../shared/template-edits");
|
|
7
|
+
const static_placement_1 = require("../../shared/static-placement");
|
|
8
|
+
const template_todos_1 = require("./template-todos");
|
|
9
|
+
function getAttributeKeySpan(attribute) {
|
|
10
|
+
return attribute.keySpan ?? attribute.sourceSpan;
|
|
11
|
+
}
|
|
12
|
+
function renameAttribute(attribute, name, edits) {
|
|
13
|
+
const keySpan = getAttributeKeySpan(attribute);
|
|
14
|
+
edits.push({
|
|
15
|
+
start: keySpan.start.offset,
|
|
16
|
+
end: keySpan.end.offset,
|
|
17
|
+
text: name
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function removeAttribute(attribute) {
|
|
21
|
+
const content = attribute.sourceSpan.start.file.content;
|
|
22
|
+
const start = attribute.sourceSpan.start.offset;
|
|
23
|
+
return {
|
|
24
|
+
start: /\s/.test(content[start - 1] ?? '') ? start - 1 : start,
|
|
25
|
+
end: attribute.sourceSpan.end.offset,
|
|
26
|
+
text: ''
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function setAttributeValue(attribute, value, edits) {
|
|
30
|
+
const valueSpan = attribute.valueSpan;
|
|
31
|
+
if (!valueSpan) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
edits.push({
|
|
35
|
+
start: valueSpan.start.offset,
|
|
36
|
+
end: valueSpan.end.offset,
|
|
37
|
+
text: value
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function getAttributeValue(attribute) {
|
|
41
|
+
if (!attribute) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return attribute.valueSpan?.toString().trim() ?? (typeof attribute.value === 'string' ? attribute.value.trim() : '');
|
|
45
|
+
}
|
|
46
|
+
function isBoundAttribute(attribute) {
|
|
47
|
+
return attribute instanceof compiler_1.TmplAstBoundAttribute;
|
|
48
|
+
}
|
|
49
|
+
function isTextAttribute(attribute) {
|
|
50
|
+
return attribute instanceof compiler_1.TmplAstTextAttribute;
|
|
51
|
+
}
|
|
52
|
+
function getTooltipContentAttribute(element) {
|
|
53
|
+
return (0, template_edits_1.findTextAttribute)(element, 'ngbTooltip') ?? (0, template_edits_1.findBoundAttribute)(element, 'ngbTooltip');
|
|
54
|
+
}
|
|
55
|
+
function escapeRegExp(value) {
|
|
56
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
57
|
+
}
|
|
58
|
+
function renameStartTagAttribute(element, name, newName, edits) {
|
|
59
|
+
const content = element.sourceSpan.start.file.content;
|
|
60
|
+
const start = element.sourceSpan.start.offset;
|
|
61
|
+
const end = element.startSourceSpan?.end.offset ?? content.indexOf('>', start) + 1;
|
|
62
|
+
const startTag = content.slice(start, end);
|
|
63
|
+
const match = new RegExp(`(^|[\\s<])(${escapeRegExp(name)})(?=\\s|=|>|/)`).exec(startTag);
|
|
64
|
+
if (!match) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const attributeStart = start + match.index + match[1].length;
|
|
68
|
+
edits.push({
|
|
69
|
+
start: attributeStart,
|
|
70
|
+
end: attributeStart + name.length,
|
|
71
|
+
text: newName
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function getStartTagAttributeSpan(element, name) {
|
|
75
|
+
const content = element.sourceSpan.start.file.content;
|
|
76
|
+
const start = element.sourceSpan.start.offset;
|
|
77
|
+
const end = element.startSourceSpan?.end.offset ?? content.indexOf('>', start) + 1;
|
|
78
|
+
const startTag = content.slice(start, end);
|
|
79
|
+
const match = new RegExp(`\\s+${escapeRegExp(name)}(?:\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]+))?`).exec(startTag);
|
|
80
|
+
if (!match) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
start: start + match.index,
|
|
85
|
+
end: start + match.index + match[0].length
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function hasStartTagAttribute(element, name) {
|
|
89
|
+
return !!getStartTagAttributeSpan(element, name);
|
|
90
|
+
}
|
|
91
|
+
function removeStartTagAttribute(element, name, edits) {
|
|
92
|
+
const span = getStartTagAttributeSpan(element, name);
|
|
93
|
+
if (span) {
|
|
94
|
+
edits.push({ ...span, text: '' });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function editTooltipI18nAttribute(element, edits) {
|
|
98
|
+
renameStartTagAttribute(element, 'i18n-ngbTooltip', 'i18n-dfTooltip', edits);
|
|
99
|
+
}
|
|
100
|
+
function hasTooltipI18nAttribute(element) {
|
|
101
|
+
return hasStartTagAttribute(element, 'i18n-ngbTooltip');
|
|
102
|
+
}
|
|
103
|
+
function isStringLiteralExpression(value) {
|
|
104
|
+
return /^(['"`])[\s\S]*\1$/.test(value);
|
|
105
|
+
}
|
|
106
|
+
function isTemplateReferenceContent(attribute, context) {
|
|
107
|
+
if (!isBoundAttribute(attribute)) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
const value = getAttributeValue(attribute);
|
|
111
|
+
return !!value && context.templateReferenceNames.has(value);
|
|
112
|
+
}
|
|
113
|
+
function getStaticTooltipClassSize(attribute) {
|
|
114
|
+
if (!attribute || !isTextAttribute(attribute)) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const classNames = attribute.value.split(/\s+/).filter(Boolean);
|
|
118
|
+
if (classNames.length !== 1) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
if (classNames[0] === 'tooltip-inner-sm') {
|
|
122
|
+
return 'sm';
|
|
123
|
+
}
|
|
124
|
+
if (classNames[0] === 'tooltip-inner-lg') {
|
|
125
|
+
return 'lg';
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
function hasUnsupportedBoundTooltipClass(attribute) {
|
|
130
|
+
return !!attribute && isBoundAttribute(attribute);
|
|
131
|
+
}
|
|
132
|
+
function hasUnsupportedStaticTooltipClass(attribute) {
|
|
133
|
+
return !!attribute && isTextAttribute(attribute) && !getStaticTooltipClassSize(attribute);
|
|
134
|
+
}
|
|
135
|
+
function getStaticTriggers(attribute) {
|
|
136
|
+
return attribute && isTextAttribute(attribute) ? attribute.value.trim() : null;
|
|
137
|
+
}
|
|
138
|
+
function isManualTrigger(attribute) {
|
|
139
|
+
if (!attribute) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
const triggers = getStaticTriggers(attribute);
|
|
143
|
+
return !!triggers && triggers.includes('manual');
|
|
144
|
+
}
|
|
145
|
+
function hasCustomTriggers(attribute) {
|
|
146
|
+
return !!attribute && getStaticTriggers(attribute) !== 'hover focus';
|
|
147
|
+
}
|
|
148
|
+
function editPlacement(element, edits, todos) {
|
|
149
|
+
const placement = (0, template_edits_1.findTextAttribute)(element, 'placement') ?? (0, template_edits_1.findBoundAttribute)(element, 'placement');
|
|
150
|
+
if (!placement) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (isTextAttribute(placement)) {
|
|
154
|
+
const mappedPlacement = (0, static_placement_1.mapStaticPlacement)(placement.value);
|
|
155
|
+
if (mappedPlacement) {
|
|
156
|
+
renameAttribute(placement, 'dfTooltipPlacement', edits);
|
|
157
|
+
setAttributeValue(placement, mappedPlacement, edits);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
edits.push(removeAttribute(placement));
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
renameAttribute(placement, 'dfTooltipPlacement', edits);
|
|
165
|
+
todos.dynamicPlacement = true;
|
|
166
|
+
}
|
|
167
|
+
function editDisableTooltip(element, edits) {
|
|
168
|
+
const disabled = (0, template_edits_1.findTextAttribute)(element, 'disableTooltip') ?? (0, template_edits_1.findBoundAttribute)(element, 'disableTooltip');
|
|
169
|
+
if (disabled) {
|
|
170
|
+
renameAttribute(disabled, 'dfTooltipDisabled', edits);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function editTooltipClass(element, edits, todos, contentMigrated) {
|
|
174
|
+
const tooltipClass = (0, template_todos_1.getTooltipClassAttribute)(element);
|
|
175
|
+
const size = getStaticTooltipClassSize(tooltipClass);
|
|
176
|
+
if (size && contentMigrated) {
|
|
177
|
+
edits.push(removeAttribute(tooltipClass));
|
|
178
|
+
edits.push({
|
|
179
|
+
start: (0, template_edits_1.getStartTagInsertOffset)(element),
|
|
180
|
+
end: (0, template_edits_1.getStartTagInsertOffset)(element),
|
|
181
|
+
text: ` dfTooltipSize="${size}"`
|
|
182
|
+
});
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (hasUnsupportedBoundTooltipClass(tooltipClass)) {
|
|
186
|
+
todos.customClass = true;
|
|
187
|
+
edits.push(removeAttribute(tooltipClass));
|
|
188
|
+
}
|
|
189
|
+
else if (hasUnsupportedStaticTooltipClass(tooltipClass)) {
|
|
190
|
+
todos.customClass = true;
|
|
191
|
+
edits.push(removeAttribute(tooltipClass));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function editTooltipTruncate(element, edits, todos) {
|
|
195
|
+
const truncate = (0, template_todos_1.getTooltipTruncateAttribute)(element);
|
|
196
|
+
if (!truncate) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
todos.truncate = true;
|
|
200
|
+
edits.push(removeAttribute(truncate));
|
|
201
|
+
}
|
|
202
|
+
function canMigrateTooltipContent(contentAttribute, element, context, todos) {
|
|
203
|
+
const tooltipReference = (0, template_todos_1.getTooltipReference)(element);
|
|
204
|
+
if (isTemplateReferenceContent(contentAttribute, context)) {
|
|
205
|
+
todos.templateContent = true;
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
if (tooltipReference) {
|
|
209
|
+
todos.templateReference = true;
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
function editTriggers(element, edits, todos, contentMigrated) {
|
|
215
|
+
const triggers = (0, template_todos_1.getTriggersAttribute)(element);
|
|
216
|
+
if (!triggers) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (isManualTrigger(triggers)) {
|
|
220
|
+
todos.manualTrigger = true;
|
|
221
|
+
}
|
|
222
|
+
else if (hasCustomTriggers(triggers)) {
|
|
223
|
+
todos.customTriggers = true;
|
|
224
|
+
}
|
|
225
|
+
if (contentMigrated) {
|
|
226
|
+
edits.push(removeAttribute(triggers));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function editAutoClose(element, edits, todos, contentMigrated) {
|
|
230
|
+
const autoClose = (0, template_todos_1.getAutoCloseAttribute)(element);
|
|
231
|
+
if (!autoClose) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
todos.autoClose = true;
|
|
235
|
+
if (contentMigrated) {
|
|
236
|
+
edits.push(removeAttribute(autoClose));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function editTooltipElement(element, context, edits) {
|
|
240
|
+
const todos = {};
|
|
241
|
+
const contentAttribute = getTooltipContentAttribute(element);
|
|
242
|
+
if (!contentAttribute) {
|
|
243
|
+
if (hasTooltipI18nAttribute(element)) {
|
|
244
|
+
removeStartTagAttribute(element, 'i18n-ngbTooltip', edits);
|
|
245
|
+
todos.orphanI18n = true;
|
|
246
|
+
}
|
|
247
|
+
return { migrated: false, todos };
|
|
248
|
+
}
|
|
249
|
+
const contentMigrated = canMigrateTooltipContent(contentAttribute, element, context, todos);
|
|
250
|
+
if (contentMigrated) {
|
|
251
|
+
renameAttribute(contentAttribute, 'dfTooltip', edits);
|
|
252
|
+
editTooltipI18nAttribute(element, edits);
|
|
253
|
+
if (isBoundAttribute(contentAttribute) && !(getAttributeValue(contentAttribute) ?? '').includes('{{')) {
|
|
254
|
+
todos.dynamicContent = !isStringLiteralExpression(getAttributeValue(contentAttribute) ?? '');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (contentMigrated) {
|
|
258
|
+
editPlacement(element, edits, todos);
|
|
259
|
+
editDisableTooltip(element, edits);
|
|
260
|
+
}
|
|
261
|
+
editTooltipClass(element, edits, todos, contentMigrated);
|
|
262
|
+
editTooltipTruncate(element, edits, todos);
|
|
263
|
+
editTriggers(element, edits, todos, contentMigrated);
|
|
264
|
+
editAutoClose(element, edits, todos, contentMigrated);
|
|
265
|
+
return { migrated: contentMigrated, todos };
|
|
266
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TmplAstBoundAttribute, TmplAstElement, TmplAstReference, TmplAstTextAttribute } from '@angular/compiler';
|
|
2
|
+
import { MigrationTodo } from '../../shared/todo-comments';
|
|
3
|
+
import { TemplateEdit } from '../../shared/template-edits';
|
|
4
|
+
export interface TooltipTemplateTodoContext {
|
|
5
|
+
migrated?: boolean;
|
|
6
|
+
dynamicContent?: boolean;
|
|
7
|
+
templateContent?: boolean;
|
|
8
|
+
customClass?: boolean;
|
|
9
|
+
customTriggers?: boolean;
|
|
10
|
+
manualTrigger?: boolean;
|
|
11
|
+
autoClose?: boolean;
|
|
12
|
+
truncate?: boolean;
|
|
13
|
+
templateReference?: boolean;
|
|
14
|
+
dynamicPlacement?: boolean;
|
|
15
|
+
orphanI18n?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type TooltipAttribute = TmplAstTextAttribute | TmplAstBoundAttribute;
|
|
18
|
+
export declare const TOOLTIP_REVIEW_TODO: MigrationTodo;
|
|
19
|
+
export declare function getTooltipReference(element: TmplAstElement): TmplAstReference | undefined;
|
|
20
|
+
export declare function getTooltipTruncateAttribute(element: TmplAstElement): TooltipAttribute | undefined;
|
|
21
|
+
export declare function getTooltipClassAttribute(element: TmplAstElement): TooltipAttribute | undefined;
|
|
22
|
+
export declare function getTriggersAttribute(element: TmplAstElement): TooltipAttribute | undefined;
|
|
23
|
+
export declare function getAutoCloseAttribute(element: TmplAstElement): TooltipAttribute | undefined;
|
|
24
|
+
export declare function editTooltipTemplateTodos(element: TmplAstElement, edits: TemplateEdit[], context: TooltipTemplateTodoContext): void;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOLTIP_REVIEW_TODO = void 0;
|
|
4
|
+
exports.getTooltipReference = getTooltipReference;
|
|
5
|
+
exports.getTooltipTruncateAttribute = getTooltipTruncateAttribute;
|
|
6
|
+
exports.getTooltipClassAttribute = getTooltipClassAttribute;
|
|
7
|
+
exports.getTriggersAttribute = getTriggersAttribute;
|
|
8
|
+
exports.getAutoCloseAttribute = getAutoCloseAttribute;
|
|
9
|
+
exports.editTooltipTemplateTodos = editTooltipTemplateTodos;
|
|
10
|
+
const todo_comments_1 = require("../../shared/todo-comments");
|
|
11
|
+
const template_edits_1 = require("../../shared/template-edits");
|
|
12
|
+
exports.TOOLTIP_REVIEW_TODO = {
|
|
13
|
+
code: 'tooltip.review',
|
|
14
|
+
message: 'This tooltip was migrated automatically. Verify behavior and visual appearance.'
|
|
15
|
+
};
|
|
16
|
+
const TOOLTIP_DYNAMIC_CONTENT_TODO = {
|
|
17
|
+
code: 'tooltip.dynamic-content',
|
|
18
|
+
message: 'Dynamic tooltip content was migrated without rewriting the expression. Verify it returns plain text.'
|
|
19
|
+
};
|
|
20
|
+
const TOOLTIP_TEMPLATE_CONTENT_TODO = {
|
|
21
|
+
code: 'tooltip.template-content',
|
|
22
|
+
marker: 'human',
|
|
23
|
+
message: 'Template-based tooltip content was not migrated. Convert it to plain tooltip text or a popover manually.'
|
|
24
|
+
};
|
|
25
|
+
const TOOLTIP_CUSTOM_CLASS_TODO = {
|
|
26
|
+
code: 'tooltip.custom-class',
|
|
27
|
+
marker: 'human',
|
|
28
|
+
message: 'The legacy tooltipClass attribute is not supported by the new tooltip API. Verify the visual intent manually.'
|
|
29
|
+
};
|
|
30
|
+
const TOOLTIP_CUSTOM_TRIGGERS_TODO = {
|
|
31
|
+
code: 'tooltip.custom-triggers',
|
|
32
|
+
marker: 'human',
|
|
33
|
+
message: 'Custom tooltip triggers are not supported by the new tooltip API. Verify the interaction manually.'
|
|
34
|
+
};
|
|
35
|
+
const TOOLTIP_MANUAL_TRIGGER_TODO = {
|
|
36
|
+
code: 'tooltip.manual-trigger',
|
|
37
|
+
marker: 'human',
|
|
38
|
+
message: 'Manual tooltip trigger control was not migrated. Replace the interaction manually if still needed.'
|
|
39
|
+
};
|
|
40
|
+
const TOOLTIP_AUTO_CLOSE_TODO = {
|
|
41
|
+
code: 'tooltip.auto-close',
|
|
42
|
+
marker: 'human',
|
|
43
|
+
message: 'Tooltip autoClose behavior was not migrated. Verify the old click behavior manually.'
|
|
44
|
+
};
|
|
45
|
+
const TOOLTIP_TRUNCATE_TODO = {
|
|
46
|
+
code: 'tooltip.truncate',
|
|
47
|
+
marker: 'human',
|
|
48
|
+
message: 'dfTooltipTruncate depends on the legacy tooltip and was not migrated automatically.'
|
|
49
|
+
};
|
|
50
|
+
const TOOLTIP_TEMPLATE_REFERENCE_TODO = {
|
|
51
|
+
code: 'tooltip.template-reference',
|
|
52
|
+
marker: 'human',
|
|
53
|
+
message: 'Template references to ngbTooltip were not migrated because the new tooltip has no equivalent export.'
|
|
54
|
+
};
|
|
55
|
+
const TOOLTIP_DYNAMIC_PLACEMENT_TODO = {
|
|
56
|
+
code: 'tooltip.dynamic-placement',
|
|
57
|
+
message: 'Dynamic tooltip placement was migrated. Verify it only returns supported dfTooltipPlacement values.'
|
|
58
|
+
};
|
|
59
|
+
const TOOLTIP_ORPHAN_I18N_TODO = {
|
|
60
|
+
code: 'tooltip.orphan-i18n',
|
|
61
|
+
marker: 'human',
|
|
62
|
+
message: 'Legacy tooltip i18n marker had no tooltip binding on this element. Verify whether a tooltip was intended.'
|
|
63
|
+
};
|
|
64
|
+
function getTooltipReference(element) {
|
|
65
|
+
return element.references.find((reference) => reference.value === 'ngbTooltip');
|
|
66
|
+
}
|
|
67
|
+
function getTooltipTruncateAttribute(element) {
|
|
68
|
+
return (0, template_edits_1.findTextAttribute)(element, 'dfTooltipTruncate') ?? (0, template_edits_1.findBoundAttribute)(element, 'dfTooltipTruncate');
|
|
69
|
+
}
|
|
70
|
+
function getTooltipClassAttribute(element) {
|
|
71
|
+
return (0, template_edits_1.findTextAttribute)(element, 'tooltipClass') ?? (0, template_edits_1.findBoundAttribute)(element, 'tooltipClass');
|
|
72
|
+
}
|
|
73
|
+
function getTriggersAttribute(element) {
|
|
74
|
+
return (0, template_edits_1.findTextAttribute)(element, 'triggers') ?? (0, template_edits_1.findBoundAttribute)(element, 'triggers');
|
|
75
|
+
}
|
|
76
|
+
function getAutoCloseAttribute(element) {
|
|
77
|
+
return (0, template_edits_1.findTextAttribute)(element, 'autoClose') ?? (0, template_edits_1.findBoundAttribute)(element, 'autoClose');
|
|
78
|
+
}
|
|
79
|
+
function editTooltipTemplateTodos(element, edits, context) {
|
|
80
|
+
const todos = [];
|
|
81
|
+
if (context.migrated && !context.dynamicContent) {
|
|
82
|
+
todos.push(exports.TOOLTIP_REVIEW_TODO);
|
|
83
|
+
}
|
|
84
|
+
if (context.dynamicContent) {
|
|
85
|
+
todos.push(TOOLTIP_DYNAMIC_CONTENT_TODO);
|
|
86
|
+
}
|
|
87
|
+
if (context.templateContent) {
|
|
88
|
+
todos.push(TOOLTIP_TEMPLATE_CONTENT_TODO);
|
|
89
|
+
}
|
|
90
|
+
if (context.customClass) {
|
|
91
|
+
todos.push(TOOLTIP_CUSTOM_CLASS_TODO);
|
|
92
|
+
}
|
|
93
|
+
if (context.customTriggers) {
|
|
94
|
+
todos.push(TOOLTIP_CUSTOM_TRIGGERS_TODO);
|
|
95
|
+
}
|
|
96
|
+
if (context.manualTrigger) {
|
|
97
|
+
todos.push(TOOLTIP_MANUAL_TRIGGER_TODO);
|
|
98
|
+
}
|
|
99
|
+
if (context.autoClose) {
|
|
100
|
+
todos.push(TOOLTIP_AUTO_CLOSE_TODO);
|
|
101
|
+
}
|
|
102
|
+
if (context.truncate) {
|
|
103
|
+
todos.push(TOOLTIP_TRUNCATE_TODO);
|
|
104
|
+
}
|
|
105
|
+
if (context.templateReference) {
|
|
106
|
+
todos.push(TOOLTIP_TEMPLATE_REFERENCE_TODO);
|
|
107
|
+
}
|
|
108
|
+
if (context.dynamicPlacement) {
|
|
109
|
+
todos.push(TOOLTIP_DYNAMIC_PLACEMENT_TODO);
|
|
110
|
+
}
|
|
111
|
+
if (context.orphanI18n) {
|
|
112
|
+
todos.push(TOOLTIP_ORPHAN_I18N_TODO);
|
|
113
|
+
}
|
|
114
|
+
(0, todo_comments_1.editTemplateTodos)(element, todos, edits);
|
|
115
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editTooltipImports = editTooltipImports;
|
|
4
|
+
const component_imports_1 = require("../../shared/component-imports");
|
|
5
|
+
const component_context_1 = require("../../shared/component-context");
|
|
6
|
+
const NEW_TOOLTIP_IMPORT = '@design-factory/angular/tooltip';
|
|
7
|
+
const DF_TOOLTIP = 'DfTooltip';
|
|
8
|
+
const LEGACY_NG_BOOTSTRAP_IMPORTS = new Set(['@ng-bootstrap/ng-bootstrap/tooltip', '@ng-bootstrap/ng-bootstrap']);
|
|
9
|
+
const LEGACY_DESIGN_FACTORY_IMPORTS = new Set([
|
|
10
|
+
'@design-factory/design-factory',
|
|
11
|
+
'@design-factory/design-factory/tooltip'
|
|
12
|
+
]);
|
|
13
|
+
const LEGACY_TOOLTIP_IMPORTS = new Set([...LEGACY_NG_BOOTSTRAP_IMPORTS, ...LEGACY_DESIGN_FACTORY_IMPORTS]);
|
|
14
|
+
const LEGACY_DIRECTIVE_SCOPE_SYMBOLS = new Set(['NgbTooltip']);
|
|
15
|
+
const LEGACY_MODULE_SCOPE_SYMBOLS = new Set(['NgbTooltipModule', 'DfTooltipModule']);
|
|
16
|
+
const LEGACY_SCOPE_SYMBOLS = new Set([...LEGACY_DIRECTIVE_SCOPE_SYMBOLS, ...LEGACY_MODULE_SCOPE_SYMBOLS]);
|
|
17
|
+
const LEGACY_TRUNCATE_SCOPE_SYMBOLS = new Set(['DfTooltipTruncateDirective']);
|
|
18
|
+
const LEGACY_IMPORT_SYMBOLS = new Set([...LEGACY_SCOPE_SYMBOLS, 'DfTooltipTruncateDirective', 'NgbTooltipConfig']);
|
|
19
|
+
function componentUsesDfTooltip(templates) {
|
|
20
|
+
return templates.some((template) => /(?:\[)?dfTooltip(?:\]|=|\s|>)/.test(template));
|
|
21
|
+
}
|
|
22
|
+
function componentUsesLegacyTooltip(templates) {
|
|
23
|
+
return templates.some((template) => /(^|[\s<])(?:\[)?ngbTooltip(?:\]|=|\s|>)/.test(template.replace(/<!--[\s\S]*?-->/g, '')));
|
|
24
|
+
}
|
|
25
|
+
function sourceFileNeedsDfTooltip(context) {
|
|
26
|
+
return (0, component_context_1.sourceFileNeedsComponentTemplate)(context, componentUsesDfTooltip);
|
|
27
|
+
}
|
|
28
|
+
function getLegacyTooltipImports(sourceFile) {
|
|
29
|
+
return (0, component_imports_1.getComponentNamedImports)(sourceFile, LEGACY_TOOLTIP_IMPORTS, LEGACY_IMPORT_SYMBOLS);
|
|
30
|
+
}
|
|
31
|
+
function editUnusedLegacyImportDeclarations(context, legacyImports) {
|
|
32
|
+
const sourceNeedsLegacyTooltip = (0, component_context_1.sourceFileNeedsComponentTemplate)(context, componentUsesLegacyTooltip);
|
|
33
|
+
return (0, component_imports_1.editRemovableLegacyImports)(context.sourceFile, LEGACY_TOOLTIP_IMPORTS, legacyImports, (legacyImport) => {
|
|
34
|
+
if (LEGACY_MODULE_SCOPE_SYMBOLS.has(legacyImport.importedName)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (sourceNeedsLegacyTooltip && LEGACY_DIRECTIVE_SCOPE_SYMBOLS.has(legacyImport.importedName)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function editRemainingLegacyImportTodos(context) {
|
|
44
|
+
const sourceNeedsLegacyTooltip = (0, component_context_1.sourceFileNeedsComponentTemplate)(context, componentUsesLegacyTooltip);
|
|
45
|
+
return (0, component_imports_1.editLegacyImportTodos)(context.sourceFile, LEGACY_TOOLTIP_IMPORTS, (legacyImport) => LEGACY_MODULE_SCOPE_SYMBOLS.has(legacyImport.importedName) ||
|
|
46
|
+
(sourceNeedsLegacyTooltip && LEGACY_DIRECTIVE_SCOPE_SYMBOLS.has(legacyImport.importedName)), {
|
|
47
|
+
code: 'tooltip.legacy-import',
|
|
48
|
+
message: 'Legacy tooltip import remains for second-pass verification. Remove it after confirming no legacy tooltip APIs need it.'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function hasLegacyTruncateImport(legacyImports) {
|
|
52
|
+
return legacyImports.some((legacyImport) => legacyImport.importedName === 'DfTooltipTruncateDirective');
|
|
53
|
+
}
|
|
54
|
+
function editTooltipImports(context) {
|
|
55
|
+
const edits = [];
|
|
56
|
+
const legacyImports = getLegacyTooltipImports(context.sourceFile);
|
|
57
|
+
if (sourceFileNeedsDfTooltip(context) || hasLegacyTruncateImport(legacyImports)) {
|
|
58
|
+
const scopeEdits = (0, component_imports_1.editComponentScopeImports)({
|
|
59
|
+
context,
|
|
60
|
+
newImport: { moduleName: NEW_TOOLTIP_IMPORT, symbolName: DF_TOOLTIP },
|
|
61
|
+
componentNeedsNewImport: componentUsesDfTooltip,
|
|
62
|
+
componentKeepsLegacyScope: componentUsesLegacyTooltip,
|
|
63
|
+
legacyImports,
|
|
64
|
+
legacyScopeImportedNames: LEGACY_DIRECTIVE_SCOPE_SYMBOLS,
|
|
65
|
+
cleanupScopeImportedNames: LEGACY_TRUNCATE_SCOPE_SYMBOLS,
|
|
66
|
+
indirectComponentImportsTodo: {
|
|
67
|
+
code: 'tooltip.indirect-component-imports',
|
|
68
|
+
message: 'Component imports use an indirect value. Add DfTooltip to that imports value after verifying its shape.'
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
edits.push(...scopeEdits.edits);
|
|
72
|
+
}
|
|
73
|
+
if (legacyImports.length === 0) {
|
|
74
|
+
return edits;
|
|
75
|
+
}
|
|
76
|
+
edits.push(...editUnusedLegacyImportDeclarations(context, legacyImports));
|
|
77
|
+
edits.push(...editRemainingLegacyImportTodos(context));
|
|
78
|
+
return edits;
|
|
79
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
10
|
+
export interface ResolvedResource {
|
|
11
|
+
/** Class declaration that contains this resource. */
|
|
12
|
+
container: ts.ClassDeclaration | null;
|
|
13
|
+
/** File content of the given template. */
|
|
14
|
+
content: string;
|
|
15
|
+
/** Start offset of the resource content (e.g. in the inline source file) */
|
|
16
|
+
start: number;
|
|
17
|
+
/** Whether the given resource is inline or not. */
|
|
18
|
+
inline: boolean;
|
|
19
|
+
/** Path to the file that contains this resource. */
|
|
20
|
+
filePath: string;
|
|
21
|
+
/** Absolute path to the file that contains this resource. */
|
|
22
|
+
absFilePath: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Collector that can be used to find Angular templates referenced within TypeScript source files.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ComponentResourceCollector {
|
|
28
|
+
typeChecker: ts.TypeChecker;
|
|
29
|
+
private tree;
|
|
30
|
+
resolvedTemplates: ResolvedResource[];
|
|
31
|
+
constructor(typeChecker: ts.TypeChecker, tree: Tree);
|
|
32
|
+
visitNode(node: ts.Node): void;
|
|
33
|
+
private _visitClassDeclaration;
|
|
34
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ComponentResourceCollector = void 0;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const core_1 = require("@angular-devkit/core");
|
|
14
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
15
|
+
const decorators_1 = require("./typescript/decorators");
|
|
16
|
+
const functions_1 = require("./typescript/functions");
|
|
17
|
+
const property_name_1 = require("./typescript/property-name");
|
|
18
|
+
/**
|
|
19
|
+
* Collector that can be used to find Angular templates referenced within TypeScript source files.
|
|
20
|
+
*/
|
|
21
|
+
class ComponentResourceCollector {
|
|
22
|
+
constructor(typeChecker, tree) {
|
|
23
|
+
this.typeChecker = typeChecker;
|
|
24
|
+
this.tree = tree;
|
|
25
|
+
this.resolvedTemplates = [];
|
|
26
|
+
}
|
|
27
|
+
visitNode(node) {
|
|
28
|
+
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
|
|
29
|
+
this._visitClassDeclaration(node);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
_visitClassDeclaration(node) {
|
|
33
|
+
const decorators = ts.getDecorators(node);
|
|
34
|
+
if (!decorators || !decorators.length) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const ngDecorators = (0, decorators_1.getAngularDecorators)(this.typeChecker, decorators);
|
|
38
|
+
const componentDecorator = ngDecorators.find((dec) => dec.name === 'Component');
|
|
39
|
+
// In case no "@Component" decorator could be found on the current class, skip.
|
|
40
|
+
if (!componentDecorator) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const decoratorCall = componentDecorator.node.expression;
|
|
44
|
+
// In case the component decorator call is not valid, skip this class declaration.
|
|
45
|
+
if (decoratorCall.arguments.length !== 1) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const componentMetadata = (0, functions_1.unwrapExpression)(decoratorCall.arguments[0]);
|
|
49
|
+
// Ensure that the component metadata is an object literal expression.
|
|
50
|
+
if (!ts.isObjectLiteralExpression(componentMetadata)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const sourceFile = node.getSourceFile();
|
|
54
|
+
const absFilePath = (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(sourceFile.fileName)));
|
|
55
|
+
const filePath = path_1.posix.relative((0, core_1.normalize)(process.cwd()), absFilePath);
|
|
56
|
+
const sourceFileDirPath = (0, path_1.dirname)(sourceFile.fileName);
|
|
57
|
+
// Walk through all component metadata properties and determine the referenced
|
|
58
|
+
// HTML templates (either external or inline)
|
|
59
|
+
componentMetadata.properties.forEach((property) => {
|
|
60
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const propertyName = (0, property_name_1.getPropertyNameText)(property.name);
|
|
64
|
+
// In case there is an inline template specified, ensure that the value is statically
|
|
65
|
+
// analyzable by checking if the initializer is a string literal-like node.
|
|
66
|
+
if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
|
|
67
|
+
// Need to add an offset of one to the start because the template quotes are
|
|
68
|
+
// not part of the template content.
|
|
69
|
+
const templateStartIdx = property.initializer.getStart() + 1;
|
|
70
|
+
this.resolvedTemplates.push({
|
|
71
|
+
filePath,
|
|
72
|
+
absFilePath,
|
|
73
|
+
container: node,
|
|
74
|
+
content: property.initializer.getText().slice(1, -1),
|
|
75
|
+
inline: true,
|
|
76
|
+
start: templateStartIdx
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
|
|
80
|
+
const templateUrl = property.initializer.text;
|
|
81
|
+
const absTemplatePath = (0, core_1.normalize)(path_1.posix.resolve('/', (0, core_1.normalize)(sourceFileDirPath), (0, core_1.normalize)(templateUrl)));
|
|
82
|
+
const templatePath = path_1.posix.relative((0, core_1.normalize)(process.cwd()), absTemplatePath);
|
|
83
|
+
// In case the template does not exist in the file system, skip this
|
|
84
|
+
// external template.
|
|
85
|
+
if (!this.tree.exists(templatePath)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const fileContent = stripBom(this.tree.readText(templatePath) || '');
|
|
89
|
+
if (fileContent) {
|
|
90
|
+
this.resolvedTemplates.push({
|
|
91
|
+
filePath: templatePath,
|
|
92
|
+
absFilePath: absTemplatePath,
|
|
93
|
+
container: node,
|
|
94
|
+
content: fileContent,
|
|
95
|
+
inline: false,
|
|
96
|
+
start: 0
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.ComponentResourceCollector = ComponentResourceCollector;
|
|
104
|
+
/** Strips the BOM from a string. */
|
|
105
|
+
function stripBom(content) {
|
|
106
|
+
return content.replace(/\uFEFF/g, '');
|
|
107
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
/**
|
|
10
|
+
* Gets all tsconfig paths from a CLI project by reading the workspace configuration
|
|
11
|
+
* and looking for common tsconfig locations.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getProjectTsConfigPaths(tree: Tree, projectName?: string): Promise<{
|
|
14
|
+
buildPaths: string[];
|
|
15
|
+
testPaths: string[];
|
|
16
|
+
}>;
|
|
17
|
+
export declare function getBuildableProjectNames(tree: Tree): Promise<string[]>;
|
|
18
|
+
export declare function resolveProjectNames(tree: Tree, projectName?: string, all?: boolean): Promise<string[]>;
|