@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,105 @@
|
|
|
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.getProjectTsConfigPaths = getProjectTsConfigPaths;
|
|
11
|
+
exports.getBuildableProjectNames = getBuildableProjectNames;
|
|
12
|
+
exports.resolveProjectNames = resolveProjectNames;
|
|
13
|
+
const core_1 = require("@angular-devkit/core");
|
|
14
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
15
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
16
|
+
function formatProjectOptions(projectNames) {
|
|
17
|
+
return projectNames.map((name) => ` --project=${name}`).join('\n');
|
|
18
|
+
}
|
|
19
|
+
function formatAvailableProjectMessage(projectNames) {
|
|
20
|
+
return `Run again with the project you want to migrate:\n\n${formatProjectOptions(projectNames)}\n\nOr run every buildable project with:\n\n --all`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets all tsconfig paths from a CLI project by reading the workspace configuration
|
|
24
|
+
* and looking for common tsconfig locations.
|
|
25
|
+
*/
|
|
26
|
+
async function getProjectTsConfigPaths(tree, projectName) {
|
|
27
|
+
// Start with some tsconfig paths that are generally used within CLI projects. Note
|
|
28
|
+
// that we are not interested in IDE-specific tsconfig files (e.g. /tsconfig.json)
|
|
29
|
+
const buildPaths = new Set();
|
|
30
|
+
const testPaths = new Set();
|
|
31
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
32
|
+
if (projectName && !workspace.projects.has(projectName)) {
|
|
33
|
+
throw new schematics_1.SchematicsException(`Project "${projectName}" does not exist.`);
|
|
34
|
+
}
|
|
35
|
+
for (const [nameProject, project] of workspace.projects) {
|
|
36
|
+
if (projectName && nameProject !== projectName) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
for (const [name, target] of project.targets) {
|
|
40
|
+
if (name !== 'build' && name !== 'test') {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
for (const [, options] of (0, workspace_1.allTargetOptions)(target)) {
|
|
44
|
+
const tsConfig = options['tsConfig'];
|
|
45
|
+
// Filter out tsconfig files that don't exist in the CLI project.
|
|
46
|
+
if (typeof tsConfig !== 'string' || !tree.exists(tsConfig)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (name === 'build') {
|
|
50
|
+
buildPaths.add((0, core_1.normalize)(tsConfig));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
testPaths.add((0, core_1.normalize)(tsConfig));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
buildPaths: [...buildPaths],
|
|
60
|
+
testPaths: [...testPaths]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async function getBuildableProjectNames(tree) {
|
|
64
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
65
|
+
const projectNames = [];
|
|
66
|
+
for (const [projectName, project] of workspace.projects) {
|
|
67
|
+
const buildTarget = project.targets.get('build');
|
|
68
|
+
if (!buildTarget) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
for (const [, options] of (0, workspace_1.allTargetOptions)(buildTarget)) {
|
|
72
|
+
const tsConfig = options['tsConfig'];
|
|
73
|
+
if (typeof tsConfig === 'string' && tree.exists(tsConfig)) {
|
|
74
|
+
projectNames.push(projectName);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return projectNames;
|
|
80
|
+
}
|
|
81
|
+
async function resolveProjectNames(tree, projectName, all) {
|
|
82
|
+
const projectNames = await getBuildableProjectNames(tree);
|
|
83
|
+
if (all) {
|
|
84
|
+
if (projectNames.length === 0) {
|
|
85
|
+
throw new schematics_1.SchematicsException('No projects with a build tsconfig were found.');
|
|
86
|
+
}
|
|
87
|
+
return projectNames;
|
|
88
|
+
}
|
|
89
|
+
if (projectName) {
|
|
90
|
+
if (!projectNames.includes(projectName)) {
|
|
91
|
+
const suffix = projectNames.length === 0
|
|
92
|
+
? 'No projects with a build tsconfig were found.'
|
|
93
|
+
: formatAvailableProjectMessage(projectNames);
|
|
94
|
+
throw new schematics_1.SchematicsException(`Project "${projectName}" does not exist or does not have a build tsconfig. ${suffix}`);
|
|
95
|
+
}
|
|
96
|
+
return [projectName];
|
|
97
|
+
}
|
|
98
|
+
if (projectNames.length === 1) {
|
|
99
|
+
return [projectNames[0]];
|
|
100
|
+
}
|
|
101
|
+
if (projectNames.length === 0) {
|
|
102
|
+
throw new schematics_1.SchematicsException('The "project" option is required. No projects with a build tsconfig were found.');
|
|
103
|
+
}
|
|
104
|
+
throw new schematics_1.SchematicsException(`The "project" option is required because this workspace has multiple buildable projects. ${formatAvailableProjectMessage(projectNames)}`);
|
|
105
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
import * as ts from 'typescript';
|
|
10
|
+
type FakeReadFileFn = (fileName: string) => string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a TypeScript program instance for a TypeScript project within
|
|
13
|
+
* the virtual file system tree.
|
|
14
|
+
* @param tree Virtual file system tree that contains the source files.
|
|
15
|
+
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
16
|
+
* @param basePath Base path for the virtual file system tree.
|
|
17
|
+
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
18
|
+
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
19
|
+
* @param additionalFiles Additional file paths that should be added to the program.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createMigrationProgram(tree: Tree, tsconfigPath: string, basePath: string, fakeFileRead?: FakeReadFileFn, additionalFiles?: string[]): ts.Program;
|
|
22
|
+
/**
|
|
23
|
+
* Creates the options necessary to instantiate a TypeScript program.
|
|
24
|
+
* @param tree Virtual file system tree that contains the source files.
|
|
25
|
+
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
26
|
+
* @param basePath Base path for the virtual file system tree.
|
|
27
|
+
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
28
|
+
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
29
|
+
* @param additionalFiles Additional file paths that should be added to the program.
|
|
30
|
+
* @param optionOverrides Overrides of the parsed compiler options.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createProgramOptions(tree: Tree, tsconfigPath: string, basePath: string, fakeFileRead?: FakeReadFileFn, additionalFiles?: string[], optionOverrides?: ts.CompilerOptions): {
|
|
33
|
+
rootNames: string[];
|
|
34
|
+
options: ts.CompilerOptions;
|
|
35
|
+
host: ts.CompilerHost;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether a file can be migrate by our automated migrations.
|
|
39
|
+
* @param basePath Absolute path to the project.
|
|
40
|
+
* @param sourceFile File being checked.
|
|
41
|
+
* @param program Program that includes the source file.
|
|
42
|
+
*/
|
|
43
|
+
export declare function canMigrateFile(basePath: string, sourceFile: ts.SourceFile, program: ts.Program): boolean;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMigrationProgram = createMigrationProgram;
|
|
4
|
+
exports.createProgramOptions = createProgramOptions;
|
|
5
|
+
exports.canMigrateFile = canMigrateFile;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
9
|
+
const parse_tsconfig_1 = require("./parse_tsconfig");
|
|
10
|
+
/**
|
|
11
|
+
* Creates a TypeScript program instance for a TypeScript project within
|
|
12
|
+
* the virtual file system tree.
|
|
13
|
+
* @param tree Virtual file system tree that contains the source files.
|
|
14
|
+
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
15
|
+
* @param basePath Base path for the virtual file system tree.
|
|
16
|
+
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
17
|
+
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
18
|
+
* @param additionalFiles Additional file paths that should be added to the program.
|
|
19
|
+
*/
|
|
20
|
+
function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
|
|
21
|
+
const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles);
|
|
22
|
+
return ts.createProgram(rootNames, options, host);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates the options necessary to instantiate a TypeScript program.
|
|
26
|
+
* @param tree Virtual file system tree that contains the source files.
|
|
27
|
+
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
28
|
+
* @param basePath Base path for the virtual file system tree.
|
|
29
|
+
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
30
|
+
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
31
|
+
* @param additionalFiles Additional file paths that should be added to the program.
|
|
32
|
+
* @param optionOverrides Overrides of the parsed compiler options.
|
|
33
|
+
*/
|
|
34
|
+
function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
|
|
35
|
+
// Resolve the tsconfig path to an absolute path. This is needed as TypeScript otherwise
|
|
36
|
+
// is not able to resolve root directories in the given tsconfig. More details can be found
|
|
37
|
+
// in the following issue: https://github.com/microsoft/TypeScript/issues/37731.
|
|
38
|
+
tsconfigPath = (0, path_1.resolve)(basePath, tsconfigPath);
|
|
39
|
+
const parsed = (0, parse_tsconfig_1.parseTsconfigFile)(tsconfigPath, (0, path_1.dirname)(tsconfigPath));
|
|
40
|
+
const options = optionOverrides ? { ...parsed.options, ...optionOverrides } : parsed.options;
|
|
41
|
+
const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
|
|
42
|
+
return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
|
|
43
|
+
}
|
|
44
|
+
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
45
|
+
const host = ts.createCompilerHost(options, true);
|
|
46
|
+
const defaultReadFile = host.readFile;
|
|
47
|
+
// We need to overwrite the host "readFile" method, as we want the TypeScript
|
|
48
|
+
// program to be based on the file contents in the virtual file tree. Otherwise
|
|
49
|
+
// if we run multiple migrations we might have intersecting changes and
|
|
50
|
+
// source files.
|
|
51
|
+
host.readFile = (fileName) => {
|
|
52
|
+
const treeRelativePath = (0, path_1.relative)(basePath, fileName);
|
|
53
|
+
let result = fakeRead?.(treeRelativePath);
|
|
54
|
+
if (typeof result !== 'string') {
|
|
55
|
+
// If the relative path resolved to somewhere outside of the tree, fall back to
|
|
56
|
+
// TypeScript's default file reading function since the `tree` will throw an error.
|
|
57
|
+
result = treeRelativePath.startsWith('..')
|
|
58
|
+
? defaultReadFile.call(host, fileName)
|
|
59
|
+
: tree.read(treeRelativePath)?.toString();
|
|
60
|
+
}
|
|
61
|
+
// Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,
|
|
62
|
+
// which breaks the CLI UpdateRecorder.
|
|
63
|
+
// See: https://github.com/angular/angular/pull/30719
|
|
64
|
+
return typeof result === 'string' ? result.replace(/^\uFEFF/, '') : undefined;
|
|
65
|
+
};
|
|
66
|
+
return host;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Checks whether a file can be migrate by our automated migrations.
|
|
70
|
+
* @param basePath Absolute path to the project.
|
|
71
|
+
* @param sourceFile File being checked.
|
|
72
|
+
* @param program Program that includes the source file.
|
|
73
|
+
*/
|
|
74
|
+
function canMigrateFile(basePath, sourceFile, program) {
|
|
75
|
+
// We shouldn't migrate .d.ts files, files from an external library or type checking files.
|
|
76
|
+
if (sourceFile.fileName.endsWith('.ngtypecheck.ts') ||
|
|
77
|
+
sourceFile.isDeclarationFile ||
|
|
78
|
+
program.isSourceFileFromExternalLibrary(sourceFile)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
// Our migrations are set up to create a `Program` from the project's tsconfig and to migrate all
|
|
82
|
+
// the files within the program. This can include files that are outside of the Angular CLI
|
|
83
|
+
// project. We can't migrate files outside of the project, because our file system interactions
|
|
84
|
+
// go through the CLI's `Tree` which assumes that all files are within the project. See:
|
|
85
|
+
// https://github.com/angular/angular-cli/blob/0b0961c9c233a825b6e4bb59ab7f0790f9b14676/packages/angular_devkit/schematics/src/tree/host-tree.ts#L131
|
|
86
|
+
return !(0, path_1.relative)(basePath, sourceFile.fileName).startsWith('..');
|
|
87
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { Import } from './imports';
|
|
10
|
+
export type CallExpressionDecorator = ts.Decorator & {
|
|
11
|
+
expression: ts.CallExpression;
|
|
12
|
+
};
|
|
13
|
+
export interface NgDecorator {
|
|
14
|
+
name: string;
|
|
15
|
+
node: CallExpressionDecorator;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Gets all decorators which are imported from an Angular package
|
|
19
|
+
* (e.g. "@angular/core") from a list of decorators.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAngularDecorators(typeChecker: ts.TypeChecker, decorators: readonly ts.Decorator[]): readonly NgDecorator[];
|
|
22
|
+
export declare function getCallDecoratorImport(typeChecker: ts.TypeChecker, decorator: ts.Decorator): Import | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
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.getAngularDecorators = getAngularDecorators;
|
|
11
|
+
exports.getCallDecoratorImport = getCallDecoratorImport;
|
|
12
|
+
const tslib_1 = require("tslib");
|
|
13
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
14
|
+
const imports_1 = require("./imports");
|
|
15
|
+
/**
|
|
16
|
+
* Gets all decorators which are imported from an Angular package
|
|
17
|
+
* (e.g. "@angular/core") from a list of decorators.
|
|
18
|
+
*/
|
|
19
|
+
function getAngularDecorators(typeChecker, decorators) {
|
|
20
|
+
return decorators
|
|
21
|
+
.map((node) => ({ node, importData: getCallDecoratorImport(typeChecker, node) }))
|
|
22
|
+
.filter(({ importData }) => importData && importData.moduleName.startsWith('@angular/'))
|
|
23
|
+
.map(({ node, importData }) => ({
|
|
24
|
+
node: node,
|
|
25
|
+
name: importData.symbolName
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function getCallDecoratorImport(typeChecker, decorator) {
|
|
29
|
+
if (!ts.isCallExpression(decorator.expression)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const valueExpr = decorator.expression.expression;
|
|
33
|
+
let identifier = null;
|
|
34
|
+
if (ts.isIdentifier(valueExpr)) {
|
|
35
|
+
identifier = valueExpr;
|
|
36
|
+
}
|
|
37
|
+
else if (ts.isPropertyAccessExpression(valueExpr) && ts.isIdentifier(valueExpr.name)) {
|
|
38
|
+
identifier = valueExpr.name;
|
|
39
|
+
}
|
|
40
|
+
return identifier ? (0, imports_1.getImportOfIdentifier)(identifier, typeChecker) : null;
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
11
|
+
* parentheses. e.g. "(((({exp}))))()". The function should return the TypeScript node
|
|
12
|
+
* referring to the inner expression. e.g "exp".
|
|
13
|
+
*/
|
|
14
|
+
export declare function unwrapExpression(node: ts.Expression | ts.ParenthesizedExpression): ts.Expression;
|
|
@@ -0,0 +1,20 @@
|
|
|
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.unwrapExpression = unwrapExpression;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
13
|
+
/**
|
|
14
|
+
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
15
|
+
* parentheses. e.g. "(((({exp}))))()". The function should return the TypeScript node
|
|
16
|
+
* referring to the inner expression. e.g "exp".
|
|
17
|
+
*/
|
|
18
|
+
function unwrapExpression(node) {
|
|
19
|
+
return ts.isParenthesizedExpression(node) ? unwrapExpression(node.expression) : node;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
/** Interface describing a resolved import. */
|
|
10
|
+
export interface Import {
|
|
11
|
+
/** Name of the imported symbol. */
|
|
12
|
+
symbolName: string;
|
|
13
|
+
/** Module name from which the symbol has been imported. */
|
|
14
|
+
moduleName: string;
|
|
15
|
+
}
|
|
16
|
+
/** Resolves the import of the specified identifier. */
|
|
17
|
+
export declare function getImportOfIdentifier(node: ts.Identifier, typeChecker: ts.TypeChecker): Import | null;
|
|
@@ -0,0 +1,110 @@
|
|
|
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.getImportOfIdentifier = getImportOfIdentifier;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
13
|
+
/** Resolves the import of the specified identifier. */
|
|
14
|
+
function getImportOfIdentifier(node, typeChecker) {
|
|
15
|
+
// Free standing identifiers which resolve to an import will be handled
|
|
16
|
+
// as direct imports. e.g. "@Component()" where "Component" is an identifier
|
|
17
|
+
// referring to an import specifier.
|
|
18
|
+
const directImport = getSpecificImportOfIdentifier(node, typeChecker);
|
|
19
|
+
if (directImport !== null) {
|
|
20
|
+
return directImport;
|
|
21
|
+
}
|
|
22
|
+
else if (ts.isQualifiedName(node.parent) && node.parent.right === node) {
|
|
23
|
+
// Determines the import of a qualified name. e.g. "let t: core.Component". In that
|
|
24
|
+
// case, the import of the most left identifier will be determined ("core").
|
|
25
|
+
const qualifierRoot = getQualifiedNameRoot(node.parent);
|
|
26
|
+
if (qualifierRoot) {
|
|
27
|
+
const moduleName = getImportOfNamespacedIdentifier(qualifierRoot, typeChecker);
|
|
28
|
+
if (moduleName) {
|
|
29
|
+
return { moduleName, symbolName: node.text };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
|
|
34
|
+
// Determines the import of a property expression. e.g. "@core.Component". In that
|
|
35
|
+
// case, the import of the most left identifier will be determined ("core").
|
|
36
|
+
const rootIdentifier = getPropertyAccessRoot(node.parent);
|
|
37
|
+
if (rootIdentifier) {
|
|
38
|
+
const moduleName = getImportOfNamespacedIdentifier(rootIdentifier, typeChecker);
|
|
39
|
+
if (moduleName) {
|
|
40
|
+
return { moduleName, symbolName: node.text };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolves the import of the specified identifier. Expects the identifier to resolve
|
|
48
|
+
* to a fine-grained import declaration with import specifiers.
|
|
49
|
+
*/
|
|
50
|
+
function getSpecificImportOfIdentifier(node, typeChecker) {
|
|
51
|
+
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
52
|
+
if (!symbol || !symbol.declarations || !symbol.declarations.length) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const declaration = symbol.declarations[0];
|
|
56
|
+
if (!ts.isImportSpecifier(declaration)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
// Since the declaration is an import specifier, we can walk up three times to get a reference
|
|
60
|
+
// to the import declaration node (NamedImports -> ImportClause -> ImportDeclaration).
|
|
61
|
+
const importDecl = declaration.parent.parent.parent;
|
|
62
|
+
if (!ts.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
moduleName: importDecl.moduleSpecifier.text,
|
|
67
|
+
symbolName: declaration.propertyName ? declaration.propertyName.text : declaration.name.text
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolves the import of the specified identifier. Expects the identifier to
|
|
72
|
+
* resolve to a namespaced import declaration. e.g. "import * as core from ...".
|
|
73
|
+
*/
|
|
74
|
+
function getImportOfNamespacedIdentifier(node, typeChecker) {
|
|
75
|
+
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
76
|
+
if (!symbol || !symbol.declarations || !symbol.declarations.length) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const declaration = symbol.declarations[0];
|
|
80
|
+
if (!ts.isNamespaceImport(declaration)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
// Since the declaration is a namespace import, we can walk up three times to get a reference
|
|
84
|
+
// to the import declaration node (NamespaceImport -> ImportClause -> ImportDeclaration).
|
|
85
|
+
const importDecl = declaration.parent.parent;
|
|
86
|
+
if (!ts.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return importDecl.moduleSpecifier.text;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets the root identifier of a qualified type chain. For example: "core.GestureConfig"
|
|
93
|
+
* will return the "core" identifier. Allowing us to find the import of "core".
|
|
94
|
+
*/
|
|
95
|
+
function getQualifiedNameRoot(name) {
|
|
96
|
+
while (ts.isQualifiedName(name.left)) {
|
|
97
|
+
name = name.left;
|
|
98
|
+
}
|
|
99
|
+
return ts.isIdentifier(name.left) ? name.left : null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets the root identifier of a property access chain. For example: "core.GestureConfig"
|
|
103
|
+
* will return the "core" identifier. Allowing us to find the import of "core".
|
|
104
|
+
*/
|
|
105
|
+
function getPropertyAccessRoot(node) {
|
|
106
|
+
while (ts.isPropertyAccessExpression(node.expression)) {
|
|
107
|
+
node = node.expression;
|
|
108
|
+
}
|
|
109
|
+
return ts.isIdentifier(node.expression) ? node.expression : null;
|
|
110
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export declare function parseTsconfigFile(tsconfigPath: string, basePath: string): ts.ParsedCommandLine;
|
|
@@ -0,0 +1,29 @@
|
|
|
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.parseTsconfigFile = parseTsconfigFile;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const path = tslib_1.__importStar(require("path"));
|
|
13
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
14
|
+
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
15
|
+
const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
16
|
+
const parseConfigHost = {
|
|
17
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
18
|
+
fileExists: ts.sys.fileExists,
|
|
19
|
+
readDirectory: ts.sys.readDirectory,
|
|
20
|
+
readFile: ts.sys.readFile
|
|
21
|
+
};
|
|
22
|
+
// Throw if incorrect arguments are passed to this function. Passing relative base paths
|
|
23
|
+
// results in root directories not being resolved and in later type checking runtime errors.
|
|
24
|
+
// More details can be found here: https://github.com/microsoft/TypeScript/issues/37731.
|
|
25
|
+
if (!path.isAbsolute(basePath)) {
|
|
26
|
+
throw Error('Unexpected relative base path has been specified.');
|
|
27
|
+
}
|
|
28
|
+
return ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Gets the text of the given property name. Returns null if the property
|
|
11
|
+
* name couldn't be determined statically.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPropertyNameText(node: ts.PropertyName): string | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
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.getPropertyNameText = getPropertyNameText;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
13
|
+
/**
|
|
14
|
+
* Gets the text of the given property name. Returns null if the property
|
|
15
|
+
* name couldn't be determined statically.
|
|
16
|
+
*/
|
|
17
|
+
function getPropertyNameText(node) {
|
|
18
|
+
if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {
|
|
19
|
+
return node.text;
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|