@ng-prism/core 22.6.0 → 22.7.0-beta.1
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/README.md +11 -9
- package/dist/app/canvas/canvas-bg.styles.d.ts +1 -1
- package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
- package/dist/app/canvas/canvas-bg.styles.js +1 -1
- package/dist/app/canvas/canvas-overlay-tokens.d.ts +12 -0
- package/dist/app/canvas/canvas-overlay-tokens.d.ts.map +1 -0
- package/dist/app/canvas/canvas-overlay-tokens.js +52 -0
- package/dist/app/canvas/prism-canvas-bg-pill.component.js +2 -2
- package/dist/app/canvas/prism-canvas-pin-row.component.js +2 -2
- package/dist/app/canvas/prism-canvas-rulers.component.d.ts +2 -0
- package/dist/app/canvas/prism-canvas-rulers.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-rulers.component.js +17 -12
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +3 -2
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +89 -97
- package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-template-popover.component.js +16 -7
- package/dist/app/component-head/head-metrics.d.ts +35 -19
- package/dist/app/component-head/head-metrics.d.ts.map +1 -1
- package/dist/app/component-head/head-metrics.js +57 -27
- package/dist/app/component-head/pipe-facts.d.ts +9 -0
- package/dist/app/component-head/pipe-facts.d.ts.map +1 -0
- package/dist/app/component-head/pipe-facts.js +15 -0
- package/dist/app/component-head/prism-component-head.component.d.ts +19 -22
- package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-component-head.component.js +80 -96
- package/dist/app/component-head/prism-head-gauge.component.d.ts +8 -12
- package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-head-gauge.component.js +51 -67
- package/dist/app/component-head/prism-head-info.component.d.ts +13 -2
- package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-head-info.component.js +57 -16
- package/dist/app/component-head/prism-stat.component.d.ts +4 -5
- package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-stat.component.js +16 -12
- package/dist/app/component-head/service-facts.d.ts +8 -0
- package/dist/app/component-head/service-facts.d.ts.map +1 -0
- package/dist/app/component-head/service-facts.js +11 -0
- package/dist/app/controls/boolean-control.component.js +2 -2
- package/dist/app/controls/json-control.component.js +2 -2
- package/dist/app/controls/union-control.component.js +4 -3
- package/dist/app/header/header-brand.d.ts +25 -0
- package/dist/app/header/header-brand.d.ts.map +1 -0
- package/dist/app/header/header-brand.js +10 -0
- package/dist/app/header/prism-header.component.d.ts +2 -2
- package/dist/app/header/prism-header.component.d.ts.map +1 -1
- package/dist/app/header/prism-header.component.js +73 -57
- package/dist/app/icons/icon-registry.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.js +4 -1
- package/dist/app/index.d.ts +12 -0
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +12 -1
- package/dist/app/layout-menu/prism-layout-menu.component.d.ts +3 -0
- package/dist/app/layout-menu/prism-layout-menu.component.d.ts.map +1 -1
- package/dist/app/layout-menu/prism-layout-menu.component.js +72 -58
- package/dist/app/overview/open-in-playground.d.ts +8 -0
- package/dist/app/overview/open-in-playground.d.ts.map +1 -1
- package/dist/app/overview/open-in-playground.js +13 -0
- package/dist/app/overview/overview-matrix.d.ts +10 -4
- package/dist/app/overview/overview-matrix.d.ts.map +1 -1
- package/dist/app/overview/overview-matrix.js +3 -3
- package/dist/app/overview/prism-overview-cell.component.d.ts +6 -2
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview-cell.component.js +35 -24
- package/dist/app/overview/prism-overview-matrix.component.js +46 -55
- package/dist/app/page-renderer/prism-page-renderer.component.js +2 -2
- package/dist/app/panels/a11y/a11y-header-badge.component.d.ts +1 -4
- package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-header-badge.component.js +8 -19
- package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +2 -2
- package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts +1 -0
- package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-overlay-host.component.js +4 -3
- package/dist/app/panels/a11y/a11y-panel.component.d.ts +4 -1
- package/dist/app/panels/a11y/a11y-panel.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-panel.component.js +32 -54
- package/dist/app/panels/a11y/a11y-score.component.d.ts +8 -3
- package/dist/app/panels/a11y/a11y-score.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-score.component.js +19 -35
- package/dist/app/panels/a11y/a11y-sr-overlay.component.js +2 -2
- package/dist/app/panels/a11y/a11y-sr.component.js +2 -2
- package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-summary.js +8 -1
- package/dist/app/panels/a11y/a11y-tree.component.js +2 -2
- package/dist/app/panels/a11y/a11y-violations.component.d.ts +23 -2
- package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-violations.component.js +104 -89
- package/dist/app/panels/a11y/severity.d.ts +9 -0
- package/dist/app/panels/a11y/severity.d.ts.map +1 -0
- package/dist/app/panels/a11y/severity.js +12 -0
- package/dist/app/panels/controls/non-editable-input-types.d.ts +9 -1
- package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -1
- package/dist/app/panels/controls/non-editable-input-types.js +18 -0
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts +2 -1
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
- package/dist/app/panels/controls/prism-controls-panel.component.js +77 -59
- package/dist/app/panels/events/prism-events-panel.component.d.ts +2 -0
- package/dist/app/panels/events/prism-events-panel.component.d.ts.map +1 -1
- package/dist/app/panels/events/prism-events-panel.component.js +20 -7
- package/dist/app/panels/events/prism-json-node.utils.d.ts +6 -0
- package/dist/app/panels/events/prism-json-node.utils.d.ts.map +1 -1
- package/dist/app/panels/events/prism-json-node.utils.js +8 -0
- package/dist/app/panels/panel-host/addon-panels.d.ts +11 -0
- package/dist/app/panels/panel-host/addon-panels.d.ts.map +1 -0
- package/dist/app/panels/panel-host/addon-panels.js +12 -0
- package/dist/app/panels/panel-host/panel-badge.d.ts +22 -0
- package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
- package/dist/app/panels/panel-host/panel-badge.js +56 -11
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +4 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.js +36 -70
- package/dist/app/renderer/composition.d.ts +20 -0
- package/dist/app/renderer/composition.d.ts.map +1 -0
- package/dist/app/renderer/composition.js +26 -0
- package/dist/app/renderer/input-bindings.d.ts +13 -1
- package/dist/app/renderer/input-bindings.d.ts.map +1 -1
- package/dist/app/renderer/input-bindings.js +22 -1
- package/dist/app/renderer/prism-renderer.component.d.ts +8 -1
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +40 -28
- package/dist/app/renderer/snippet-generator.d.ts +14 -2
- package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
- package/dist/app/renderer/snippet-generator.js +137 -82
- package/dist/app/services/navigation-item.d.ts +10 -0
- package/dist/app/services/navigation-item.d.ts.map +1 -0
- package/dist/app/services/navigation-item.js +20 -0
- package/dist/app/services/navigation-item.types.d.ts +8 -0
- package/dist/app/services/navigation-item.types.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.d.ts +12 -0
- package/dist/app/services/prism-layout.service.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.js +17 -7
- package/dist/app/services/prism-manifest.service.d.ts +4 -0
- package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
- package/dist/app/services/prism-manifest.service.js +4 -0
- package/dist/app/services/prism-navigation.service.d.ts +12 -0
- package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
- package/dist/app/services/prism-navigation.service.js +85 -19
- package/dist/app/services/prism-panel.service.d.ts +7 -3
- package/dist/app/services/prism-panel.service.d.ts.map +1 -1
- package/dist/app/services/prism-panel.service.js +13 -4
- package/dist/app/services/prism-renderer.service.d.ts +6 -0
- package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
- package/dist/app/services/prism-renderer.service.js +40 -6
- package/dist/app/services/prism-search.service.d.ts +4 -0
- package/dist/app/services/prism-search.service.d.ts.map +1 -1
- package/dist/app/services/prism-search.service.js +29 -6
- package/dist/app/services/prism-theme.service.d.ts +11 -3
- package/dist/app/services/prism-theme.service.d.ts.map +1 -1
- package/dist/app/services/prism-theme.service.js +27 -19
- package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
- package/dist/app/services/prism-url-state.service.js +42 -4
- package/dist/app/shared/badge.types.d.ts +7 -0
- package/dist/app/shared/badge.types.d.ts.map +1 -0
- package/dist/app/shared/badge.types.js +9 -0
- package/dist/app/shared/brand-mark.d.ts +35 -0
- package/dist/app/shared/brand-mark.d.ts.map +1 -0
- package/dist/app/shared/brand-mark.js +52 -0
- package/dist/app/shared/metric-bar.d.ts +6 -0
- package/dist/app/shared/metric-bar.d.ts.map +1 -0
- package/dist/app/shared/metric-bar.js +7 -0
- package/dist/app/shared/prism-badge.component.d.ts +21 -0
- package/dist/app/shared/prism-badge.component.d.ts.map +1 -0
- package/dist/app/shared/prism-badge.component.js +68 -0
- package/dist/app/shared/prism-button.component.d.ts +12 -0
- package/dist/app/shared/prism-button.component.d.ts.map +1 -0
- package/dist/app/shared/prism-button.component.js +28 -0
- package/dist/app/shared/prism-icon-button.component.d.ts +17 -0
- package/dist/app/shared/prism-icon-button.component.d.ts.map +1 -0
- package/dist/app/shared/prism-icon-button.component.js +37 -0
- package/dist/app/shared/prism-list-row.component.d.ts +17 -0
- package/dist/app/shared/prism-list-row.component.d.ts.map +1 -0
- package/dist/app/shared/prism-list-row.component.js +57 -0
- package/dist/app/shared/prism-logo.component.d.ts +24 -0
- package/dist/app/shared/prism-logo.component.d.ts.map +1 -0
- package/dist/app/shared/prism-logo.component.js +77 -0
- package/dist/app/shared/prism-metric-badge.component.d.ts +9 -4
- package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
- package/dist/app/shared/prism-metric-badge.component.js +33 -12
- package/dist/app/shared/prism-metric-card.component.d.ts +30 -0
- package/dist/app/shared/prism-metric-card.component.d.ts.map +1 -0
- package/dist/app/shared/prism-metric-card.component.js +111 -0
- package/dist/app/shared/prism-panel-toolbar.component.d.ts +13 -0
- package/dist/app/shared/prism-panel-toolbar.component.d.ts.map +1 -0
- package/dist/app/shared/prism-panel-toolbar.component.js +28 -0
- package/dist/app/shared/prism-segmented.component.d.ts +25 -0
- package/dist/app/shared/prism-segmented.component.d.ts.map +1 -0
- package/dist/app/shared/prism-segmented.component.js +77 -0
- package/dist/app/shared/prism-tabs.component.d.ts +44 -0
- package/dist/app/shared/prism-tabs.component.d.ts.map +1 -0
- package/dist/app/shared/prism-tabs.component.js +134 -0
- package/dist/app/shared/roving-focus.d.ts +13 -0
- package/dist/app/shared/roving-focus.d.ts.map +1 -0
- package/dist/app/shared/roving-focus.js +34 -0
- package/dist/app/shell/prism-shell.component.d.ts +13 -0
- package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
- package/dist/app/shell/prism-shell.component.js +57 -28
- package/dist/app/shell/should-select-first.d.ts +17 -0
- package/dist/app/shell/should-select-first.d.ts.map +1 -0
- package/dist/app/shell/should-select-first.js +13 -0
- package/dist/app/sidebar/navigation-decorations.d.ts +23 -1
- package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
- package/dist/app/sidebar/navigation-decorations.js +33 -2
- package/dist/app/sidebar/prism-sidebar.component.d.ts +5 -15
- package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
- package/dist/app/sidebar/prism-sidebar.component.js +89 -77
- package/dist/app/theme/deprecated-tokens.d.ts +15 -0
- package/dist/app/theme/deprecated-tokens.d.ts.map +1 -0
- package/dist/app/theme/deprecated-tokens.js +22 -0
- package/dist/app/theme/favicon.d.ts +3 -0
- package/dist/app/theme/favicon.d.ts.map +1 -0
- package/dist/app/theme/favicon.js +3 -0
- package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
- package/dist/app/theme/prism-default-theme.js +116 -61
- package/dist/app/theme/resolve-theme-tokens.d.ts +29 -0
- package/dist/app/theme/resolve-theme-tokens.d.ts.map +1 -0
- package/dist/app/theme/resolve-theme-tokens.js +43 -0
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts +4 -7
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +31 -69
- package/dist/app/view-tab-bar/next-view-id.d.ts +7 -1
- package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -1
- package/dist/app/view-tab-bar/next-view-id.js +9 -1
- package/dist/app/view-tab-bar/panel-inputs.d.ts +28 -0
- package/dist/app/view-tab-bar/panel-inputs.d.ts.map +1 -0
- package/dist/app/view-tab-bar/panel-inputs.js +41 -0
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts +2 -3
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-panel-host.component.js +9 -9
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts +6 -0
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +22 -29
- package/dist/builder/config-loader/deprecated-options.d.ts +4 -2
- package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -1
- package/dist/builder/config-loader/deprecated-options.js +13 -2
- package/dist/builder/manifest/composition-wrapper.generator.d.ts +14 -0
- package/dist/builder/manifest/composition-wrapper.generator.d.ts.map +1 -0
- package/dist/builder/manifest/composition-wrapper.generator.js +66 -0
- package/dist/builder/manifest/host-parser.d.ts +2 -0
- package/dist/builder/manifest/host-parser.d.ts.map +1 -1
- package/dist/builder/manifest/host-parser.js +9 -4
- package/dist/builder/manifest/manifest-imports.d.ts +34 -0
- package/dist/builder/manifest/manifest-imports.d.ts.map +1 -0
- package/dist/builder/manifest/manifest-imports.js +91 -0
- package/dist/builder/manifest/runtime-manifest.generator.d.ts +13 -0
- package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.js +135 -64
- package/dist/builder/manifest/selector-element.d.ts +16 -0
- package/dist/builder/manifest/selector-element.d.ts.map +1 -0
- package/dist/builder/manifest/selector-element.js +46 -0
- package/dist/builder/manifest/template-literal.d.ts +3 -0
- package/dist/builder/manifest/template-literal.d.ts.map +1 -0
- package/dist/builder/manifest/template-literal.js +4 -0
- package/dist/builder/plugin-runner/plugin-runner.d.ts.map +1 -1
- package/dist/builder/plugin-runner/plugin-runner.js +29 -26
- package/dist/builder/scanner/api/angular-decorators.d.ts +84 -0
- package/dist/builder/scanner/api/angular-decorators.d.ts.map +1 -0
- package/dist/builder/scanner/api/angular-decorators.js +157 -0
- package/dist/builder/scanner/api/component-api.extractor.d.ts +13 -0
- package/dist/builder/scanner/api/component-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/component-api.extractor.js +104 -0
- package/dist/builder/scanner/api/doc-tags.d.ts +13 -0
- package/dist/builder/scanner/api/doc-tags.d.ts.map +1 -0
- package/dist/builder/scanner/api/doc-tags.js +101 -0
- package/dist/builder/scanner/api/export-index.d.ts +18 -0
- package/dist/builder/scanner/api/export-index.d.ts.map +1 -0
- package/dist/builder/scanner/api/export-index.js +22 -0
- package/dist/builder/scanner/api/member.extractor.d.ts +90 -0
- package/dist/builder/scanner/api/member.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/member.extractor.js +270 -0
- package/dist/builder/scanner/api/pipe-api.extractor.d.ts +12 -0
- package/dist/builder/scanner/api/pipe-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/pipe-api.extractor.js +52 -0
- package/dist/builder/scanner/api/service-api.extractor.d.ts +14 -0
- package/dist/builder/scanner/api/service-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/api/service-api.extractor.js +119 -0
- package/dist/builder/scanner/api/setup.reader.d.ts +26 -0
- package/dist/builder/scanner/api/setup.reader.d.ts.map +1 -0
- package/dist/builder/scanner/api/setup.reader.js +89 -0
- package/dist/builder/scanner/api/type-collector.d.ts +24 -0
- package/dist/builder/scanner/api/type-collector.d.ts.map +1 -0
- package/dist/builder/scanner/api/type-collector.js +211 -0
- package/dist/builder/scanner/ast-utils.d.ts +8 -0
- package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
- package/dist/builder/scanner/ast-utils.js +37 -1
- package/dist/builder/scanner/class-hierarchy.d.ts +5 -3
- package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -1
- package/dist/builder/scanner/class-hierarchy.js +12 -6
- package/dist/builder/scanner/component.scanner.d.ts +60 -6
- package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/component.scanner.js +209 -57
- package/dist/builder/scanner/composition/compose-template.d.ts +36 -0
- package/dist/builder/scanner/composition/compose-template.d.ts.map +1 -0
- package/dist/builder/scanner/composition/compose-template.js +187 -0
- package/dist/builder/scanner/composition/declarables.d.ts +54 -0
- package/dist/builder/scanner/composition/declarables.d.ts.map +1 -0
- package/dist/builder/scanner/composition/declarables.js +182 -0
- package/dist/builder/scanner/composition/match-declarables.d.ts +43 -0
- package/dist/builder/scanner/composition/match-declarables.d.ts.map +1 -0
- package/dist/builder/scanner/composition/match-declarables.js +131 -0
- package/dist/builder/scanner/composition/read-composition.d.ts +77 -0
- package/dist/builder/scanner/composition/read-composition.d.ts.map +1 -0
- package/dist/builder/scanner/composition/read-composition.js +302 -0
- package/dist/builder/scanner/composition/template-elements.d.ts +12 -0
- package/dist/builder/scanner/composition/template-elements.d.ts.map +1 -0
- package/dist/builder/scanner/composition/template-elements.js +41 -0
- package/dist/builder/scanner/index.d.ts +4 -0
- package/dist/builder/scanner/index.d.ts.map +1 -1
- package/dist/builder/scanner/index.js +2 -0
- package/dist/builder/scanner/input.extractor.d.ts +31 -2
- package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.js +52 -15
- package/dist/builder/scanner/pipe.scanner.d.ts +29 -0
- package/dist/builder/scanner/pipe.scanner.d.ts.map +1 -0
- package/dist/builder/scanner/pipe.scanner.js +65 -0
- package/dist/builder/scanner/scanner.d.ts +25 -1
- package/dist/builder/scanner/scanner.d.ts.map +1 -1
- package/dist/builder/scanner/scanner.js +60 -26
- package/dist/builder/scanner/service/angular-decorators.d.ts +80 -0
- package/dist/builder/scanner/service/angular-decorators.d.ts.map +1 -0
- package/dist/builder/scanner/service/angular-decorators.js +154 -0
- package/dist/builder/scanner/service/doc-tags.d.ts +13 -0
- package/dist/builder/scanner/service/doc-tags.d.ts.map +1 -0
- package/dist/builder/scanner/service/doc-tags.js +97 -0
- package/dist/builder/scanner/service/export-index.d.ts +18 -0
- package/dist/builder/scanner/service/export-index.d.ts.map +1 -0
- package/dist/builder/scanner/service/export-index.js +22 -0
- package/dist/builder/scanner/service/member.extractor.d.ts +65 -0
- package/dist/builder/scanner/service/member.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/service/member.extractor.js +216 -0
- package/dist/builder/scanner/service/pipe-api.extractor.d.ts +12 -0
- package/dist/builder/scanner/service/pipe-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/service/pipe-api.extractor.js +72 -0
- package/dist/builder/scanner/service/service-api.extractor.d.ts +14 -0
- package/dist/builder/scanner/service/service-api.extractor.d.ts.map +1 -0
- package/dist/builder/scanner/service/service-api.extractor.js +119 -0
- package/dist/builder/scanner/service/setup.reader.d.ts +26 -0
- package/dist/builder/scanner/service/setup.reader.d.ts.map +1 -0
- package/dist/builder/scanner/service/setup.reader.js +89 -0
- package/dist/builder/scanner/service/type-collector.d.ts +23 -0
- package/dist/builder/scanner/service/type-collector.d.ts.map +1 -0
- package/dist/builder/scanner/service/type-collector.js +210 -0
- package/dist/builder/scanner/service.scanner.d.ts +26 -0
- package/dist/builder/scanner/service.scanner.d.ts.map +1 -0
- package/dist/builder/scanner/service.scanner.js +61 -0
- package/dist/builder/scanner/showcase-diagnostics.d.ts +60 -1
- package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -1
- package/dist/builder/scanner/showcase-diagnostics.js +114 -1
- package/dist/builder/shared/prism-pipeline.d.ts +6 -0
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +43 -5
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.d.ts.map +1 -1
- package/dist/decorator/showcase.types.d.ts +79 -9
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/dist/plugin/index.d.ts +6 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +4 -0
- package/dist/plugin/pipe.types.d.ts +36 -0
- package/dist/plugin/pipe.types.d.ts.map +1 -0
- package/dist/plugin/pipe.types.js +1 -0
- package/dist/plugin/plugin.types.d.ts +140 -3
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- package/dist/plugin/service.types.d.ts +124 -0
- package/dist/plugin/service.types.d.ts.map +1 -0
- package/dist/plugin/service.types.js +1 -0
- package/dist/plugin/status.d.ts +27 -0
- package/dist/plugin/status.d.ts.map +1 -0
- package/dist/plugin/status.js +26 -0
- package/dist/shared/composition.d.ts +30 -0
- package/dist/shared/composition.d.ts.map +1 -0
- package/dist/shared/composition.js +29 -0
- package/dist/shared/pseudo-state.type.d.ts +2 -1
- package/dist/shared/pseudo-state.type.d.ts.map +1 -1
- package/dist/shared/void-elements.d.ts +3 -0
- package/dist/shared/void-elements.d.ts.map +1 -0
- package/dist/shared/void-elements.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { CssSelector } from '@angular/compiler';
|
|
2
|
+
import { SUBJECT_MARKER_ATTR } from '../../../shared/composition.js';
|
|
3
|
+
import { VOID_ELEMENTS } from '../../../shared/void-elements.js';
|
|
4
|
+
import { matchHostString } from '../../manifest/host-parser.js';
|
|
5
|
+
import { describeShowcaseIssue, describeShowcaseOrigin } from '../showcase-diagnostics.js';
|
|
6
|
+
import { composeTemplate } from './compose-template.js';
|
|
7
|
+
import { resolveShowcaseImports } from './declarables.js';
|
|
8
|
+
import { matchDeclarables } from './match-declarables.js';
|
|
9
|
+
/** How a directive's text `content` goes into a template to render as written: no tag, no interpolation, no block. */
|
|
10
|
+
const TEXT_ENTITIES = { '&': '&', '<': '<', '{': '{', '}': '}', '@': '@' };
|
|
11
|
+
/** The one variant the styleguide renders a showcase without variants as. */
|
|
12
|
+
const IMPLICIT_VARIANT = { name: 'Default' };
|
|
13
|
+
/**
|
|
14
|
+
* The context of one scan: the library's declarables, and the lookup of a showcase's `imports` with the scan's
|
|
15
|
+
* compiler options.
|
|
16
|
+
*
|
|
17
|
+
* `readDeclarables` runs once, for the first showcase that composes, so that a library without compositions pays
|
|
18
|
+
* nothing for them on any scan. Its declarables come without those whose selector Angular cannot parse, each named
|
|
19
|
+
* once in a notice, so that one of them cannot fail every composition. When it throws, that is one diagnostic, and no
|
|
20
|
+
* showcase of the scan has a composition.
|
|
21
|
+
*/
|
|
22
|
+
export function createCompositionContext(readDeclarables, compilerOptions, reporters) {
|
|
23
|
+
let read;
|
|
24
|
+
return {
|
|
25
|
+
declarables: () => {
|
|
26
|
+
read ??= { declarables: indexDeclarables(readDeclarables, reporters) };
|
|
27
|
+
return read.declarables;
|
|
28
|
+
},
|
|
29
|
+
resolveImports: (imports, containingFile) => resolveShowcaseImports(imports, containingFile, compilerOptions)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function indexDeclarables(readDeclarables, { report, notify }) {
|
|
33
|
+
let declarables;
|
|
34
|
+
try {
|
|
35
|
+
declarables = readDeclarables();
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
39
|
+
report(`ng-prism could not read the library's components, directives and pipes (${reason}), so no variant renders a template or a host template.`);
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return declarables.filter((declarable) => {
|
|
43
|
+
const problem = selectorProblem(declarable);
|
|
44
|
+
if (problem) {
|
|
45
|
+
notify(`${declarable.name} from "${declarable.from}" has the selector "${declarable.selector}", which Angular cannot parse (${problem}); no composition imports it.`);
|
|
46
|
+
}
|
|
47
|
+
return !problem;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Read the compositions of a showcase. A variant is composed when it has a `template` or a host template, its own
|
|
52
|
+
* `host` or else the showcase's; a showcase without variants is one variant. A directive's `template` without a host
|
|
53
|
+
* template renders inside the element of its string or object host, if it has one. Each composed variant gets its
|
|
54
|
+
* template from {@link composeTemplate}, checked with Angular's parser against the library and the showcase's
|
|
55
|
+
* `imports`, and variants with the same template and the same unbound inputs share a case.
|
|
56
|
+
*
|
|
57
|
+
* Each problem is reported against the field it comes from, with the showcase's file, line and variant, and leaves
|
|
58
|
+
* that variant out: it renders as it would without `template` and `host`. Only what Angular may still accept is a
|
|
59
|
+
* notice: an import ng-prism cannot read, an element or a pipe nothing declares while there is one, a library class
|
|
60
|
+
* that matches only by standard attributes, and one that is not standalone, which only its NgModule can bring in. A
|
|
61
|
+
* subject that is not standalone has no composition at all.
|
|
62
|
+
*
|
|
63
|
+
* Mutates `config`: a composed variant loses the HTML `content` of a component inside a host template, and the
|
|
64
|
+
* inputs that the template sets on the subject, each with a diagnostic.
|
|
65
|
+
*
|
|
66
|
+
* `undefined` when no variant is composed. Also when `@angular/compiler` throws, which is one diagnostic for the
|
|
67
|
+
* showcase, so that the build goes on, and when the library's declarables could not be read.
|
|
68
|
+
*/
|
|
69
|
+
export function readComposition(subject, context, reporters) {
|
|
70
|
+
const { className, config, configNode } = subject;
|
|
71
|
+
const sharedHost = isHostTemplate(config.host) ? config.host : undefined;
|
|
72
|
+
const elementHost = subject.isDirective && !sharedHost ? readElementHost(config.host) : undefined;
|
|
73
|
+
const declared = config.variants ?? [];
|
|
74
|
+
const variants = declared.length > 0 ? declared : [IMPLICIT_VARIANT];
|
|
75
|
+
// Without a template, a variant keeps rendering in a string or object host as it did before.
|
|
76
|
+
const hosts = variants.map((variant) => variant.host ?? sharedHost ?? (variant.template !== undefined ? elementHost : undefined));
|
|
77
|
+
const firstComposed = variants.findIndex((variant, index) => variant.template !== undefined || hosts[index] !== undefined);
|
|
78
|
+
if (firstComposed < 0)
|
|
79
|
+
return undefined;
|
|
80
|
+
const at = (path, text) => describeShowcaseIssue(className, configNode, path, text);
|
|
81
|
+
// Where a variant's composition is written: the variant, its template and the host template it renders in.
|
|
82
|
+
const pathsOf = (variant, index) => {
|
|
83
|
+
const path = declared.length > 0 ? ['variants', subject.sources?.variants?.[index] ?? index] : ['host'];
|
|
84
|
+
const hostPath = variant.host ? [...path, 'host'] : ['host'];
|
|
85
|
+
return { path, hostPath, templatePath: [...path, 'template'] };
|
|
86
|
+
};
|
|
87
|
+
if (!subject.standalone) {
|
|
88
|
+
const { hostPath, templatePath } = pathsOf(variants[firstComposed], firstComposed);
|
|
89
|
+
reporters.report(at(variants[firstComposed].template !== undefined ? templatePath : hostPath, `${className} is not standalone, which the wrapper that renders a composition needs; no variant of this showcase renders a template or a host template`));
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const declarables = context.declarables();
|
|
93
|
+
if (!declarables)
|
|
94
|
+
return undefined;
|
|
95
|
+
// Messages and mutations wait for the end, so that a compiler failure leaves nothing behind but its own diagnostic.
|
|
96
|
+
const pending = [];
|
|
97
|
+
const report = (message) => pending.push(() => reporters.report(message));
|
|
98
|
+
const notify = (message) => pending.push(() => reporters.notify(message));
|
|
99
|
+
// Where the compiler is at, for the diagnostic when it throws.
|
|
100
|
+
let current = ['imports'];
|
|
101
|
+
try {
|
|
102
|
+
const hostImport = elementHost && 'import' in elementHost && hosts.includes(elementHost) ? elementHost.import : undefined;
|
|
103
|
+
const { resolved, unresolved } = readImports(subject, hostImport, declarables, context, (path, text) => notify(at(path, text)));
|
|
104
|
+
const inputNames = new Map(subject.inputs.map((input) => [input.alias ?? input.name, input.name]));
|
|
105
|
+
const cases = [];
|
|
106
|
+
const caseIndex = new Map();
|
|
107
|
+
const imports = new Map();
|
|
108
|
+
const skipped = new Set();
|
|
109
|
+
const notStandalone = new Set();
|
|
110
|
+
const variantCases = variants.map((variant, index) => {
|
|
111
|
+
const host = hosts[index];
|
|
112
|
+
if (variant.template === undefined && host === undefined)
|
|
113
|
+
return -1;
|
|
114
|
+
if (host && 'problem' in host) {
|
|
115
|
+
report(at(['host'], host.problem));
|
|
116
|
+
return -1;
|
|
117
|
+
}
|
|
118
|
+
const { path, hostPath, templatePath } = pathsOf(variant, index);
|
|
119
|
+
const { content, dropsContent } = subjectContent(variant, subject.isDirective);
|
|
120
|
+
current = variant.template !== undefined ? templatePath : hostPath;
|
|
121
|
+
const composed = composeTemplate({ selector: subject.selector, isDirective: subject.isDirective, inputNames, hostTemplate: host?.template, content });
|
|
122
|
+
if (!composed.ok) {
|
|
123
|
+
report(at(composed.at === 'host' ? hostPath : variant.template !== undefined ? templatePath : [...path, 'content'], composed.problem));
|
|
124
|
+
return -1;
|
|
125
|
+
}
|
|
126
|
+
const match = matchDeclarables(composed.nodes, declarables, resolved);
|
|
127
|
+
// Before the problems, which one of them may explain: the element it declares is unknown without its NgModule.
|
|
128
|
+
match.notStandalone.forEach((name) => notStandalone.add(name));
|
|
129
|
+
// A message names the field that writes what it is about: the template when it does, else the host template.
|
|
130
|
+
const fieldOf = (written) => variant.template !== undefined && (!host || written(variant.template)) ? templatePath : hostPath;
|
|
131
|
+
const undeclared = [
|
|
132
|
+
...match.unknownElements.map((element) => ({ where: fieldOf((t) => writesElement(t, element)), text: `<${element}> matches no imported component` })),
|
|
133
|
+
...match.unknownPipes.map((pipe) => ({ where: fieldOf((t) => writesPipe(t, pipe)), text: `pipe "${pipe}" matches no imported pipe` }))
|
|
134
|
+
];
|
|
135
|
+
const problems = match.ambiguous.map(({ element, classes }) => at(fieldOf((t) => writesElement(t, element)), `<${element}> matches ${andList(classes)}, and Angular allows one component per element (NG0300)`));
|
|
136
|
+
// An import ng-prism cannot read may declare what nothing else does, so Angular decides.
|
|
137
|
+
if (unresolved.length > 0) {
|
|
138
|
+
for (const { where, text } of undeclared)
|
|
139
|
+
notify(at(where, `${text}; an import ng-prism cannot read may declare it, so Angular checks it`));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
problems.unshift(...undeclared.map(({ where, text }) => at(where, text)));
|
|
143
|
+
}
|
|
144
|
+
problems.forEach(report);
|
|
145
|
+
if (problems.length > 0)
|
|
146
|
+
return -1;
|
|
147
|
+
// The wrapper imports the subject anyway, by the path of its entry point.
|
|
148
|
+
for (const { name, from, selector } of match.imports) {
|
|
149
|
+
if (name !== className || selector !== subject.selector)
|
|
150
|
+
imports.set(`${from} ${name}`, { name, from });
|
|
151
|
+
}
|
|
152
|
+
for (const { element, className: skippedClass } of match.skipped) {
|
|
153
|
+
if (skippedClass !== className)
|
|
154
|
+
skipped.add(`${skippedClass} on <${element}>`);
|
|
155
|
+
}
|
|
156
|
+
if (dropsContent) {
|
|
157
|
+
report(at([...path, 'content'], 'HTML content cannot be projected into a host template; use template'));
|
|
158
|
+
pending.push(() => delete variant.content);
|
|
159
|
+
}
|
|
160
|
+
const owned = new Set(composed.ownedInputs);
|
|
161
|
+
const unbound = subject.inputs.flatMap(({ name, defaultUnreadable }) => {
|
|
162
|
+
if (owned.has(name))
|
|
163
|
+
return [{ name, reason: 'template' }];
|
|
164
|
+
return defaultUnreadable && variant.inputs?.[name] === undefined ? [{ name, reason: 'default' }] : [];
|
|
165
|
+
});
|
|
166
|
+
for (const name of composed.ownedInputs) {
|
|
167
|
+
if (!variant.inputs || !(name in variant.inputs))
|
|
168
|
+
continue;
|
|
169
|
+
report(at([...path, 'inputs', name], 'set by the template on the subject; the variant value was dropped'));
|
|
170
|
+
pending.push(() => delete variant.inputs?.[name]);
|
|
171
|
+
}
|
|
172
|
+
// Variants that set an input with an unreadable default and variants that leave it to the subject need a case each.
|
|
173
|
+
const key = JSON.stringify([composed.template, unbound]);
|
|
174
|
+
let caseAt = caseIndex.get(key);
|
|
175
|
+
if (caseAt === undefined) {
|
|
176
|
+
caseAt = cases.push({ template: composed.template, unbound, paths: [] }) - 1;
|
|
177
|
+
caseIndex.set(key, caseAt);
|
|
178
|
+
}
|
|
179
|
+
cases[caseAt].paths.push(path);
|
|
180
|
+
return caseAt;
|
|
181
|
+
});
|
|
182
|
+
if (notStandalone.size > 0) {
|
|
183
|
+
const [verb, pronoun, modules] = notStandalone.size === 1 ? ['is', 'it', 'the NgModule that declares'] : ['are', 'them', 'the NgModules that declare'];
|
|
184
|
+
notify(at(['imports'], `${andList([...notStandalone])} ${verb} not standalone, so a composition cannot import ${pronoun}; add ${modules} ${pronoun} here`));
|
|
185
|
+
}
|
|
186
|
+
if (skipped.size > 0) {
|
|
187
|
+
const [verb, pronoun] = skipped.size === 1 ? ['matches', 'it'] : ['match', 'them'];
|
|
188
|
+
notify(at(['imports'], `${[...skipped].join(', ')} ${verb} only by standard attributes and ${skipped.size === 1 ? 'is' : 'are'} not imported; add ${pronoun} here to apply ${pronoun}`));
|
|
189
|
+
}
|
|
190
|
+
pending.forEach((flush) => flush());
|
|
191
|
+
if (cases.length === 0)
|
|
192
|
+
return undefined;
|
|
193
|
+
for (const entry of unresolved)
|
|
194
|
+
imports.set(`${entry.from} ${entry.name}`, entry);
|
|
195
|
+
return {
|
|
196
|
+
variantCases,
|
|
197
|
+
cases: cases.map(({ template, unbound, paths }) => ({ template, unbound, origin: describeShowcaseOrigin(configNode, paths) })),
|
|
198
|
+
imports: [...imports.values()]
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
203
|
+
reporters.report(at(current, `@angular/compiler failed on it (${reason}); no variant of this showcase renders a template or a host template`));
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The showcase's `imports`, and the class of an object host a variant template renders in, looked up: a class of the
|
|
209
|
+
* library as it is indexed, anything else through {@link CompositionContext.resolveImports}. What ng-prism can read is
|
|
210
|
+
* matched like a library class, the rest is imported as written, with a notice. That includes an import whose
|
|
211
|
+
* selector Angular cannot parse.
|
|
212
|
+
*/
|
|
213
|
+
function readImports({ config, filePath, sources }, hostImport, declarables, context, notice) {
|
|
214
|
+
const listed = (config.imports ?? []).map((entry, index) => ({
|
|
215
|
+
entry,
|
|
216
|
+
path: ['imports', sources?.imports?.[index] ?? index]
|
|
217
|
+
}));
|
|
218
|
+
if (hostImport)
|
|
219
|
+
listed.push({ entry: hostImport, path: ['host', 'import'] });
|
|
220
|
+
const isEntry = (entry) => (declarable) => declarable.name === entry.name && declarable.from === entry.from;
|
|
221
|
+
const fromLibrary = listed.flatMap(({ entry }) => declarables.filter(isEntry(entry)));
|
|
222
|
+
const elsewhere = listed.filter(({ entry }) => !fromLibrary.some(isEntry(entry))).map(({ entry }) => entry);
|
|
223
|
+
const looked = elsewhere.length > 0 ? context.resolveImports(elsewhere, filePath).resolved : [];
|
|
224
|
+
const resolved = [...fromLibrary, ...looked.filter((declarable) => !selectorProblem(declarable))];
|
|
225
|
+
const unresolved = listed.filter(({ entry }) => !resolved.some(isEntry(entry)));
|
|
226
|
+
for (const { entry, path } of unresolved) {
|
|
227
|
+
notice(path, `"${entry.name}" from "${entry.from}" is not a component, directive or pipe ng-prism can read; it is imported as written and Angular checks the template`);
|
|
228
|
+
}
|
|
229
|
+
return { resolved, unresolved: unresolved.map(({ entry }) => entry) };
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* A directive's string or object host as the host template of a variant template: the one element the host names,
|
|
233
|
+
* marked as the subject, with the static inputs of an object host as attributes and its class to import. The text a
|
|
234
|
+
* string host holds is left out, as the template replaces it. `undefined` for no host or an empty string.
|
|
235
|
+
*/
|
|
236
|
+
function readElementHost(host) {
|
|
237
|
+
const consequence = 'so the variants render without their template';
|
|
238
|
+
if (typeof host === 'string') {
|
|
239
|
+
if (host.trim() === '')
|
|
240
|
+
return undefined;
|
|
241
|
+
const parsed = matchHostString(host);
|
|
242
|
+
return parsed
|
|
243
|
+
? { template: markedElement(parsed.tag, parsed.attrs) }
|
|
244
|
+
: { problem: `${JSON.stringify(host)} is not one element ("<tag attrs>" or "<tag>text</tag>") for a variant template to render in, ${consequence}` };
|
|
245
|
+
}
|
|
246
|
+
if (typeof host !== 'object' || host === null)
|
|
247
|
+
return undefined;
|
|
248
|
+
const { selector, import: hostImport, inputs } = host;
|
|
249
|
+
if (typeof selector !== 'string' || selector === '' || !hostImport?.name || !hostImport.from) {
|
|
250
|
+
return { problem: `an object host needs a selector and an import { name, from } for a variant template to render in, ${consequence}` };
|
|
251
|
+
}
|
|
252
|
+
const attributes = Object.entries(inputs ?? {}).map(([name, value]) => `${name}="${String(value).replace(/&/g, '&').replace(/"/g, '"')}"`);
|
|
253
|
+
return { template: markedElement(selector, attributes.join(' ')), import: { name: hostImport.name, from: hostImport.from } };
|
|
254
|
+
}
|
|
255
|
+
function markedElement(tag, attributes) {
|
|
256
|
+
const opening = `<${tag}${attributes ? ` ${attributes}` : ''} ${SUBJECT_MARKER_ATTR}`;
|
|
257
|
+
return VOID_ELEMENTS.has(tag.toLowerCase()) ? `${opening} />` : `${opening}></${tag}>`;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* What a composed variant puts into its subject: its template, or the text `content` of a directive, escaped. A
|
|
261
|
+
* component's `content` is HTML, which cannot go into a host template, the only way such a variant is composed.
|
|
262
|
+
*/
|
|
263
|
+
function subjectContent(variant, isDirective) {
|
|
264
|
+
if (variant.template !== undefined)
|
|
265
|
+
return { content: variant.template, dropsContent: false };
|
|
266
|
+
if (variant.content === undefined)
|
|
267
|
+
return { dropsContent: false };
|
|
268
|
+
if (!isDirective)
|
|
269
|
+
return { dropsContent: true };
|
|
270
|
+
return { content: typeof variant.content === 'string' && variant.content !== '' ? escapeText(variant.content) : undefined, dropsContent: false };
|
|
271
|
+
}
|
|
272
|
+
function escapeText(text) {
|
|
273
|
+
return text.replace(/[&<{}@]/g, (char) => TEXT_ENTITIES[char]);
|
|
274
|
+
}
|
|
275
|
+
/** Why Angular cannot parse the selector of a declarable, `undefined` when it can or there is none. */
|
|
276
|
+
function selectorProblem({ selector }) {
|
|
277
|
+
if (selector === undefined)
|
|
278
|
+
return undefined;
|
|
279
|
+
try {
|
|
280
|
+
CssSelector.parse(selector);
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
return error instanceof Error ? error.message : String(error);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function isHostTemplate(host) {
|
|
288
|
+
return typeof host === 'object' && host !== null && typeof host.template === 'string';
|
|
289
|
+
}
|
|
290
|
+
function writesElement(template, element) {
|
|
291
|
+
return new RegExp(`<${escapeRegExp(element)}[\\s/>]`, 'i').test(template);
|
|
292
|
+
}
|
|
293
|
+
function writesPipe(template, pipe) {
|
|
294
|
+
return new RegExp(`\\|\\s*${escapeRegExp(pipe)}(?![\\w$])`).test(template);
|
|
295
|
+
}
|
|
296
|
+
function escapeRegExp(text) {
|
|
297
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
298
|
+
}
|
|
299
|
+
/** `A and B`, `A, B and C`. */
|
|
300
|
+
function andList(items) {
|
|
301
|
+
return items.length < 2 ? items.join('') : `${items.slice(0, -1).join(', ')} and ${items.at(-1)}`;
|
|
302
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BindingType, CssSelector, TmplAstElement, type TmplAstTemplate } from '@angular/compiler';
|
|
2
|
+
/**
|
|
3
|
+
* What a directive matcher sees of an element or an `<ng-template>`, built the way Angular builds it: tag, static
|
|
4
|
+
* attributes and classes, bound inputs and outputs. A template that a structural directive creates (`*libIf`) is an
|
|
5
|
+
* `ng-template` with the attributes of its microsyntax.
|
|
6
|
+
*/
|
|
7
|
+
export declare function elementSelector(node: TmplAstElement | TmplAstTemplate): CssSelector;
|
|
8
|
+
/** `[name]` and `[(name)]`; attribute, class, style and animation bindings set no input. */
|
|
9
|
+
export declare function isInputBinding(type: BindingType): boolean;
|
|
10
|
+
/** The parser names an element in a namespace `:svg:rect`; selectors match the local name. */
|
|
11
|
+
export declare function localName(name: string): string;
|
|
12
|
+
//# sourceMappingURL=template-elements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-elements.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/composition/template-elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,WAAW,CAyBnF;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAEzD;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BindingType, CssSelector, TmplAstElement } from '@angular/compiler';
|
|
2
|
+
/**
|
|
3
|
+
* What a directive matcher sees of an element or an `<ng-template>`, built the way Angular builds it: tag, static
|
|
4
|
+
* attributes and classes, bound inputs and outputs. A template that a structural directive creates (`*libIf`) is an
|
|
5
|
+
* `ng-template` with the attributes of its microsyntax.
|
|
6
|
+
*/
|
|
7
|
+
export function elementSelector(node) {
|
|
8
|
+
const selector = new CssSelector();
|
|
9
|
+
const isElement = node instanceof TmplAstElement;
|
|
10
|
+
selector.setElement(isElement ? localName(node.name) : 'ng-template');
|
|
11
|
+
if (!isElement && node.tagName !== 'ng-template') {
|
|
12
|
+
for (const attribute of node.templateAttrs)
|
|
13
|
+
selector.addAttribute(attribute.name, '');
|
|
14
|
+
return selector;
|
|
15
|
+
}
|
|
16
|
+
for (const attribute of node.attributes) {
|
|
17
|
+
selector.addAttribute(attribute.name, attribute.value);
|
|
18
|
+
if (attribute.name.toLowerCase() === 'class') {
|
|
19
|
+
for (const className of attribute.value.trim().split(/\s+/)) {
|
|
20
|
+
if (className)
|
|
21
|
+
selector.addClassName(className);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const bound of node.inputs) {
|
|
26
|
+
if (isInputBinding(bound.type))
|
|
27
|
+
selector.addAttribute(bound.name, '');
|
|
28
|
+
}
|
|
29
|
+
for (const output of node.outputs) {
|
|
30
|
+
selector.addAttribute(output.name, '');
|
|
31
|
+
}
|
|
32
|
+
return selector;
|
|
33
|
+
}
|
|
34
|
+
/** `[name]` and `[(name)]`; attribute, class, style and animation bindings set no input. */
|
|
35
|
+
export function isInputBinding(type) {
|
|
36
|
+
return type === BindingType.Property || type === BindingType.TwoWay;
|
|
37
|
+
}
|
|
38
|
+
/** The parser names an element in a namespace `:svg:rect`; selectors match the local name. */
|
|
39
|
+
export function localName(name) {
|
|
40
|
+
return name.replace(/^:[^:]+:/, '');
|
|
41
|
+
}
|
|
@@ -3,6 +3,10 @@ export type { CreateScannerOptions, Scanner, ScanResult } from './scanner.js';
|
|
|
3
3
|
export { resolveEntryPointExports } from './entry-point.scanner.js';
|
|
4
4
|
export type { EntryPointInput, MultiEntryResult, ResolvedEntryPoint } from './entry-point.scanner.js';
|
|
5
5
|
export { scanComponents } from './component.scanner.js';
|
|
6
|
+
export { scanServices } from './service.scanner.js';
|
|
7
|
+
export type { ScanServicesOptions } from './service.scanner.js';
|
|
8
|
+
export { scanPipes } from './pipe.scanner.js';
|
|
9
|
+
export type { ScanPipesOptions } from './pipe.scanner.js';
|
|
6
10
|
export { extractInputs, extractOutputs } from './input.extractor.js';
|
|
7
11
|
export { generateManifest } from './manifest.generator.js';
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
export { createScanner } from './scanner.js';
|
|
3
3
|
export { resolveEntryPointExports } from './entry-point.scanner.js';
|
|
4
4
|
export { scanComponents } from './component.scanner.js';
|
|
5
|
+
export { scanServices } from './service.scanner.js';
|
|
6
|
+
export { scanPipes } from './pipe.scanner.js';
|
|
5
7
|
export { extractInputs, extractOutputs } from './input.extractor.js';
|
|
6
8
|
export { generateManifest } from './manifest.generator.js';
|
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import type { InputMeta, OutputMeta } from '../../plugin/plugin.types.js';
|
|
3
|
+
import { type ClassHierarchy } from './class-hierarchy.js';
|
|
3
4
|
/**
|
|
4
5
|
* Extract all @Input(), input() and model() signal metadata from a class
|
|
5
6
|
* declaration and the base classes Angular inherits inputs from. An input the
|
|
6
7
|
* subclass redeclares wins over the one in its base class.
|
|
7
8
|
*/
|
|
8
|
-
export declare function extractInputs(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, hierarchy?:
|
|
9
|
+
export declare function extractInputs(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, hierarchy?: ClassHierarchy): InputMeta[];
|
|
10
|
+
/**
|
|
11
|
+
* The declaration Angular takes an input from: the member of that name in the
|
|
12
|
+
* nearest class that defines metadata and declares it an input, the one
|
|
13
|
+
* {@link extractInputs} reads.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findInputDeclaration(hierarchy: ClassHierarchy, name: string): {
|
|
16
|
+
member: ts.PropertyDeclaration;
|
|
17
|
+
owner: ts.ClassDeclaration;
|
|
18
|
+
} | undefined;
|
|
19
|
+
/** The declaration Angular takes an output from, as {@link findInputDeclaration} for an input. */
|
|
20
|
+
export declare function findOutputDeclaration(hierarchy: ClassHierarchy, name: string): {
|
|
21
|
+
member: ts.PropertyDeclaration;
|
|
22
|
+
owner: ts.ClassDeclaration;
|
|
23
|
+
} | undefined;
|
|
24
|
+
/** Whether an input is a `model()` or `model.required()`, for which Angular adds a change output. */
|
|
25
|
+
export declare function isModelInput(member: ts.PropertyDeclaration): boolean;
|
|
9
26
|
/**
|
|
10
27
|
* Extract all @Output() and output() signal metadata from a class declaration
|
|
11
28
|
* and the base classes Angular inherits outputs from.
|
|
12
29
|
*/
|
|
13
|
-
export declare function extractOutputs(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, hierarchy?:
|
|
30
|
+
export declare function extractOutputs(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, hierarchy?: ClassHierarchy): OutputMeta[];
|
|
31
|
+
/**
|
|
32
|
+
* Whether a declared type, or the expression a type is inferred from,
|
|
33
|
+
* mentions a type parameter of the class that declares it. Only then does the
|
|
34
|
+
* subclass change the type; otherwise the source text stays, alias names included.
|
|
35
|
+
*/
|
|
36
|
+
export declare function usesTypeParameters(node: ts.Node | undefined, owner: ts.ClassDeclaration, checker: ts.TypeChecker): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The type of a property declared in a generic base class, as the subclass
|
|
39
|
+
* sees it: `items = input.required<T[]>()` in `Field<T>` is an
|
|
40
|
+
* `InputSignal<Country[]>` on `Picker extends Field<Country>`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getInstantiatedType(name: string, subclass: ts.ClassDeclaration, checker: ts.TypeChecker): ts.Type | undefined;
|
|
14
43
|
//# sourceMappingURL=input.extractor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.extractor.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/input.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"input.extractor.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/input.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,sBAAsB,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,iBAAwC,GAAG,SAAS,EAAE,CAsCrJ;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC;IAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAA;CAAE,GAAG,SAAS,CAExJ;AAED,kGAAkG;AAClG,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC;IAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAA;CAAE,GAAG,SAAS,CAEzJ;AAED,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,GAAG,OAAO,CAKpE;AAoHD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,iBAAwC,GAAG,UAAU,EAAE,CA4BvJ;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAgB1H;AAuBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,IAAI,GAAG,SAAS,CAI7H"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { evaluateExpression, evaluateStatic, findDecorator, getDecoratorArgument, getJsDocComment } from './ast-utils.js';
|
|
2
|
+
import { evaluateExpression, evaluateStatic, findDecorator, getDecoratorArgument, getJsDocComment, UNEVALUABLE } from './ast-utils.js';
|
|
3
3
|
import { getClassHierarchy } from './class-hierarchy.js';
|
|
4
4
|
/**
|
|
5
5
|
* Extract all @Input(), input() and model() signal metadata from a class
|
|
@@ -28,11 +28,9 @@ export function extractInputs(classDecl, checker, hierarchy = getClassHierarchy(
|
|
|
28
28
|
}
|
|
29
29
|
const initializedBy = reinitialized.get(name);
|
|
30
30
|
if (initializedBy) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
else
|
|
35
|
-
input.defaultValue = defaultValue;
|
|
31
|
+
delete input.defaultValue;
|
|
32
|
+
delete input.defaultUnreadable;
|
|
33
|
+
Object.assign(input, defaultFields(readInitialValue(initializedBy, checker)));
|
|
36
34
|
}
|
|
37
35
|
seen.add(name);
|
|
38
36
|
inputs.push(input);
|
|
@@ -40,16 +38,53 @@ export function extractInputs(classDecl, checker, hierarchy = getClassHierarchy(
|
|
|
40
38
|
}
|
|
41
39
|
return inputs;
|
|
42
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* The declaration Angular takes an input from: the member of that name in the
|
|
43
|
+
* nearest class that defines metadata and declares it an input, the one
|
|
44
|
+
* {@link extractInputs} reads.
|
|
45
|
+
*/
|
|
46
|
+
export function findInputDeclaration(hierarchy, name) {
|
|
47
|
+
return findDeclaration(hierarchy, name, (member) => !isStatic(member) && (!!findDecorator(member, 'Input') || !!getInputSignalCall(member)));
|
|
48
|
+
}
|
|
49
|
+
/** The declaration Angular takes an output from, as {@link findInputDeclaration} for an input. */
|
|
50
|
+
export function findOutputDeclaration(hierarchy, name) {
|
|
51
|
+
return findDeclaration(hierarchy, name, (member) => !!findDecorator(member, 'Output') || isOutputSignal(member));
|
|
52
|
+
}
|
|
53
|
+
/** Whether an input is a `model()` or `model.required()`, for which Angular adds a change output. */
|
|
54
|
+
export function isModelInput(member) {
|
|
55
|
+
const call = getInputSignalCall(member);
|
|
56
|
+
const callee = call && (ts.isPropertyAccessExpression(call.expression) ? call.expression.expression : call.expression);
|
|
57
|
+
return !!callee && ts.isIdentifier(callee) && callee.text === 'model';
|
|
58
|
+
}
|
|
59
|
+
function findDeclaration(hierarchy, name, declares) {
|
|
60
|
+
for (const { classDecl: owner, definesMetadata } of hierarchy.classes) {
|
|
61
|
+
if (!definesMetadata)
|
|
62
|
+
continue;
|
|
63
|
+
const member = owner.members.find((m) => ts.isPropertyDeclaration(m) && ts.isIdentifier(m.name) && m.name.text === name && declares(m));
|
|
64
|
+
if (member)
|
|
65
|
+
return { member, owner };
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
43
69
|
function isStatic(member) {
|
|
44
70
|
return !!ts.getModifiers(member)?.some((m) => m.kind === ts.SyntaxKind.StaticKeyword);
|
|
45
71
|
}
|
|
46
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* What a field starts out with: its initializer, or for `input()` and `model()` the value passed to them. `undefined`
|
|
74
|
+
* when there is none, {@link UNEVALUABLE} when there is one the scan cannot read.
|
|
75
|
+
*/
|
|
47
76
|
function readInitialValue(member, checker) {
|
|
48
77
|
const signalCall = getInputSignalCall(member);
|
|
49
78
|
if (!signalCall)
|
|
50
79
|
return member.initializer ? evaluateDefault(member.initializer, checker) : undefined;
|
|
51
80
|
return !isSignalInputRequired(signalCall) && signalCall.arguments.length > 0 ? evaluateDefault(signalCall.arguments[0], checker) : undefined;
|
|
52
81
|
}
|
|
82
|
+
/** How {@link InputMeta} carries what {@link readInitialValue} found: a value, or that there is one that could not be read. */
|
|
83
|
+
function defaultFields(initial) {
|
|
84
|
+
if (initial === UNEVALUABLE)
|
|
85
|
+
return { defaultUnreadable: true };
|
|
86
|
+
return initial === undefined ? {} : { defaultValue: initial };
|
|
87
|
+
}
|
|
53
88
|
/**
|
|
54
89
|
* `owner` declares the member. `subclass` is the showcased class when that is
|
|
55
90
|
* a different one, which decides what the type parameters of `owner` stand for.
|
|
@@ -59,7 +94,7 @@ function readInput(member, name, checker, owner, subclass) {
|
|
|
59
94
|
if (inputDecorator) {
|
|
60
95
|
const required = isDecoratorInputRequired(inputDecorator);
|
|
61
96
|
const alias = readAlias(getDecoratorArgument(inputDecorator), name, checker);
|
|
62
|
-
const
|
|
97
|
+
const initial = readInitialValue(member, checker);
|
|
63
98
|
const doc = getJsDocComment(member, checker);
|
|
64
99
|
const instantiated = subclass && usesTypeParameters(member.type ?? member.initializer, owner, checker) ? getInstantiatedType(name, subclass, checker) : undefined;
|
|
65
100
|
const { type, values, rawType } = instantiated ? mapType(instantiated, checker) : resolveDecoratorInputType(member, checker);
|
|
@@ -70,7 +105,7 @@ function readInput(member, name, checker, owner, subclass) {
|
|
|
70
105
|
rawType,
|
|
71
106
|
required,
|
|
72
107
|
...(values && { values }),
|
|
73
|
-
...(
|
|
108
|
+
...defaultFields(initial),
|
|
74
109
|
...(doc && { doc })
|
|
75
110
|
};
|
|
76
111
|
}
|
|
@@ -80,7 +115,7 @@ function readInput(member, name, checker, owner, subclass) {
|
|
|
80
115
|
const required = isSignalInputRequired(signalCall);
|
|
81
116
|
// `input(initial, options)`, but `input.required(options)`.
|
|
82
117
|
const alias = readAlias(signalCall.arguments[required ? 0 : 1], name, checker);
|
|
83
|
-
const
|
|
118
|
+
const initial = readInitialValue(member, checker);
|
|
84
119
|
const doc = getJsDocComment(member, checker);
|
|
85
120
|
const declaredType = signalCall.typeArguments?.[0] ?? signalCall.arguments[0];
|
|
86
121
|
// A signal is a getter function, so its call signature returns the value type.
|
|
@@ -93,7 +128,7 @@ function readInput(member, name, checker, owner, subclass) {
|
|
|
93
128
|
rawType,
|
|
94
129
|
required,
|
|
95
130
|
...(values && { values }),
|
|
96
|
-
...(
|
|
131
|
+
...defaultFields(initial),
|
|
97
132
|
...(doc && { doc })
|
|
98
133
|
};
|
|
99
134
|
}
|
|
@@ -141,7 +176,7 @@ export function extractOutputs(classDecl, checker, hierarchy = getClassHierarchy
|
|
|
141
176
|
* mentions a type parameter of the class that declares it. Only then does the
|
|
142
177
|
* subclass change the type; otherwise the source text stays, alias names included.
|
|
143
178
|
*/
|
|
144
|
-
function usesTypeParameters(node, owner, checker) {
|
|
179
|
+
export function usesTypeParameters(node, owner, checker) {
|
|
145
180
|
const parameters = owner.typeParameters;
|
|
146
181
|
if (!node || !parameters?.length)
|
|
147
182
|
return false;
|
|
@@ -174,19 +209,21 @@ function typeMentions(type, isOwnParameter, checker, visited = new Set()) {
|
|
|
174
209
|
* sees it: `items = input.required<T[]>()` in `Field<T>` is an
|
|
175
210
|
* `InputSignal<Country[]>` on `Picker extends Field<Country>`.
|
|
176
211
|
*/
|
|
177
|
-
function getInstantiatedType(name, subclass, checker) {
|
|
212
|
+
export function getInstantiatedType(name, subclass, checker) {
|
|
178
213
|
const property = checker.getPropertyOfType(checker.getTypeAtLocation(subclass), name);
|
|
179
214
|
return property && checker.getTypeOfSymbolAtLocation(property, subclass);
|
|
180
215
|
}
|
|
181
216
|
/**
|
|
182
217
|
* A default is all or nothing. The renderer applies it to the component, so
|
|
183
218
|
* the part of `{ ...shared, size: 'm' }` that can be read would overwrite the
|
|
184
|
-
* whole default the component actually declares
|
|
219
|
+
* whole default the component actually declares: it is {@link UNEVALUABLE}
|
|
220
|
+
* instead, so that a default the scan could not read stays apart from one that
|
|
221
|
+
* is `undefined`.
|
|
185
222
|
*/
|
|
186
223
|
function evaluateDefault(node, checker) {
|
|
187
224
|
let complete = true;
|
|
188
225
|
const value = evaluateStatic(node, { checker, report: () => (complete = false) });
|
|
189
|
-
return complete ? value :
|
|
226
|
+
return complete ? value : UNEVALUABLE;
|
|
190
227
|
}
|
|
191
228
|
function getInputSignalCall(member) {
|
|
192
229
|
const init = member.initializer;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ScannedPipe } from '../../plugin/pipe.types.js';
|
|
3
|
+
import type { ExportIndex } from './api/export-index.js';
|
|
4
|
+
import { type ShowcasedClass } from './component.scanner.js';
|
|
5
|
+
export interface ScanPipesOptions {
|
|
6
|
+
/** Built from every entry point of the library, since a setup function or a type is often exported by another one than the pipe. */
|
|
7
|
+
exportIndex: ExportIndex;
|
|
8
|
+
/** Shared with {@link scanComponents} and {@link scanServices}, and across entry points, so that a pipe exported from several of them does not repeat its warnings. */
|
|
9
|
+
diagnostics: string[];
|
|
10
|
+
notices: Set<string>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read the pipes among the showcased classes of an entry point: classes with
|
|
14
|
+
* `@Pipe` from `@angular/core`, unless they declare fields only a component
|
|
15
|
+
* can use. Components are left to {@link scanComponents}, services to
|
|
16
|
+
* {@link scanServices}.
|
|
17
|
+
*
|
|
18
|
+
* A pipe the styleguide cannot call from a template is reported and dropped:
|
|
19
|
+
* one declared with `standalone: false`, and one whose `name` the source does
|
|
20
|
+
* not give as a constant. A `pure` that cannot be read is left out instead,
|
|
21
|
+
* since the pipe is still worth showing.
|
|
22
|
+
*
|
|
23
|
+
* Nothing is run and the class is never imported: the pipe is read from the
|
|
24
|
+
* source, its API from the declarations, its `setup` from the array literal
|
|
25
|
+
* the arrow function returns. A pipe whose API cannot be read is left out with
|
|
26
|
+
* a notice, so that it does not take the whole scan down.
|
|
27
|
+
*/
|
|
28
|
+
export declare function scanPipes(showcased: ShowcasedClass[], checker: ts.TypeChecker, { exportIndex, diagnostics, notices }: ScanPipesOptions): ScannedPipe[];
|
|
29
|
+
//# sourceMappingURL=pipe.scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe.scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/pipe.scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAIrG,MAAM,WAAW,gBAAgB;IAC7B,oIAAoI;IACpI,WAAW,EAAE,WAAW,CAAC;IACzB,uKAAuK;IACvK,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,gBAAgB,GAAG,WAAW,EAAE,CAiDtJ"}
|