@ng-prism/core 22.5.0 → 22.7.0-beta.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/README.md +13 -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 +25 -3
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +154 -89
- 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/canvas/state-chips.d.ts +50 -0
- package/dist/app/canvas/state-chips.d.ts.map +1 -0
- package/dist/app/canvas/state-chips.js +40 -0
- 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 +20 -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 +85 -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 +14 -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 +84 -20
- 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/directives/resize-value.d.ts +1 -1
- package/dist/app/directives/resize-value.js +1 -1
- package/dist/app/discovery-manifest.d.ts +2 -2
- package/dist/app/discovery-manifest.d.ts.map +1 -1
- package/dist/app/discovery-manifest.js +15 -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 +19 -0
- package/dist/app/overview/open-in-playground.d.ts.map +1 -0
- package/dist/app/overview/open-in-playground.js +25 -0
- package/dist/app/overview/overview-matrix.d.ts +85 -0
- package/dist/app/overview/overview-matrix.d.ts.map +1 -0
- package/dist/app/overview/overview-matrix.js +98 -0
- package/dist/app/overview/overview-visibility.d.ts +10 -2
- package/dist/app/overview/overview-visibility.d.ts.map +1 -1
- package/dist/app/overview/overview-visibility.js +14 -3
- package/dist/app/overview/prism-overview-cell.component.d.ts +27 -2
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview-cell.component.js +145 -28
- package/dist/app/overview/prism-overview-matrix.component.d.ts +29 -0
- package/dist/app/overview/prism-overview-matrix.component.d.ts.map +1 -0
- package/dist/app/overview/prism-overview-matrix.component.js +155 -0
- package/dist/app/overview/prism-overview.component.d.ts +4 -0
- package/dist/app/overview/prism-overview.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview.component.js +37 -14
- package/dist/app/page-renderer/prism-page-renderer.component.js +2 -2
- package/dist/app/panels/a11y/a11y-core.plugin.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-core.plugin.js +0 -1
- 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/controls-plugin.d.ts.map +1 -1
- package/dist/app/panels/controls/controls-plugin.js +1 -2
- 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/events-plugin.d.ts.map +1 -1
- package/dist/app/panels/events/events-plugin.js +1 -2
- 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/pseudo/pseudo-state-marker.d.ts +32 -10
- package/dist/app/pseudo/pseudo-state-marker.d.ts.map +1 -1
- package/dist/app/pseudo/pseudo-state-marker.js +83 -67
- package/dist/app/pseudo/pseudo-targets.d.ts +11 -0
- package/dist/app/pseudo/pseudo-targets.d.ts.map +1 -0
- package/dist/app/pseudo/pseudo-targets.js +46 -0
- package/dist/app/pseudo/state-fit.d.ts +28 -0
- package/dist/app/pseudo/state-fit.d.ts.map +1 -0
- package/dist/app/pseudo/state-fit.js +97 -0
- 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 +28 -0
- package/dist/app/renderer/input-bindings.d.ts.map +1 -0
- package/dist/app/renderer/input-bindings.js +42 -0
- package/dist/app/renderer/known-inputs.d.ts +8 -1
- package/dist/app/renderer/known-inputs.d.ts.map +1 -1
- package/dist/app/renderer/known-inputs.js +13 -5
- package/dist/app/renderer/prism-renderer.component.d.ts +18 -4
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +78 -44
- package/dist/app/renderer/projectable-content.d.ts +8 -1
- package/dist/app/renderer/projectable-content.d.ts.map +1 -1
- package/dist/app/renderer/projectable-content.js +40 -29
- package/dist/app/renderer/rendered-key.d.ts +20 -6
- package/dist/app/renderer/rendered-key.d.ts.map +1 -1
- package/dist/app/renderer/rendered-key.js +25 -8
- 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 +138 -81
- 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-pseudo-state.service.d.ts +59 -14
- package/dist/app/services/prism-pseudo-state.service.d.ts.map +1 -1
- package/dist/app/services/prism-pseudo-state.service.js +86 -29
- package/dist/app/services/prism-renderer.service.d.ts +23 -0
- package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
- package/dist/app/services/prism-renderer.service.js +77 -8
- 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 +81 -12
- 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 +122 -66
- 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 +9 -0
- package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -0
- package/dist/builder/config-loader/deprecated-options.js +34 -0
- 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 +137 -65
- 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 +229 -58
- 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/entry-point-discovery.d.ts +5 -0
- package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
- package/dist/builder/scanner/entry-point-discovery.js +14 -0
- package/dist/builder/scanner/entry-point.scanner.d.ts +3 -1
- package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/entry-point.scanner.js +7 -6
- 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 +73 -17
- 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/pseudo-states.d.ts +1 -0
- package/dist/builder/scanner/pseudo-states.d.ts.map +1 -1
- package/dist/builder/scanner/pseudo-states.js +1 -1
- package/dist/builder/scanner/scanner.d.ts +27 -3
- package/dist/builder/scanner/scanner.d.ts.map +1 -1
- package/dist/builder/scanner/scanner.js +68 -24
- 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 +123 -10
- package/dist/builder/scanner/showcase-states.d.ts +17 -0
- package/dist/builder/scanner/showcase-states.d.ts.map +1 -0
- package/dist/builder/scanner/showcase-states.js +58 -0
- package/dist/builder/scanner/source-file-cache.d.ts +26 -0
- package/dist/builder/scanner/source-file-cache.d.ts.map +1 -0
- package/dist/builder/scanner/source-file-cache.js +60 -0
- 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 +71 -18
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.d.ts.map +1 -1
- package/dist/decorator/showcase.types.d.ts +102 -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 +184 -8
- 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
- package/src/builder/build/schema.json +6 -6
- package/src/builder/serve/schema.json +6 -6
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { VOID_ELEMENTS } from '../../shared/void-elements.js';
|
|
2
|
+
import { compositionClassName, generateCompositionClass } from './composition-wrapper.generator.js';
|
|
1
3
|
import { parseHostString } from './host-parser.js';
|
|
4
|
+
import { localName, ManifestImports } from './manifest-imports.js';
|
|
5
|
+
import { firstSelectorAttribute, selectorElement } from './selector-element.js';
|
|
6
|
+
import { escapeTemplateLiteral } from './template-literal.js';
|
|
2
7
|
function inputTypeAnnotation(input) {
|
|
3
8
|
if (input.type === 'union' && input.values) {
|
|
4
9
|
return input.values.map((v) => `'${v}'`).join(' | ');
|
|
@@ -28,49 +33,82 @@ function formatInputDeclaration(input) {
|
|
|
28
33
|
}
|
|
29
34
|
return `input(${def})`;
|
|
30
35
|
}
|
|
31
|
-
function directiveSelector(selector) {
|
|
32
|
-
const match = selector.match(/^\[([^\]]+)]$/);
|
|
33
|
-
return match ? match[1] : selector;
|
|
34
|
-
}
|
|
35
36
|
function isBindableInput(input) {
|
|
36
37
|
if (input.type === 'string' || input.type === 'number' || input.type === 'boolean' || input.type === 'union') {
|
|
37
38
|
return true;
|
|
38
39
|
}
|
|
39
40
|
return input.defaultValue !== undefined;
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
/** The class an object host renders, or `undefined` when it names none: a plain-JS config can leave `import` out, which the types would have caught. */
|
|
43
|
+
function objectHostImport(host) {
|
|
44
|
+
const { import: hostImport } = host;
|
|
45
|
+
return hostImport?.name && hostImport.from ? hostImport : undefined;
|
|
46
|
+
}
|
|
47
|
+
function hasContent(content) {
|
|
48
|
+
return typeof content === 'string' ? content !== '' : content !== undefined && Object.keys(content).length > 0;
|
|
49
|
+
}
|
|
50
|
+
/** Every variant renders in the composition wrapper: it is the component's `type`, and nothing renders through `__PrismHost`. */
|
|
51
|
+
function isFullyComposed(comp) {
|
|
52
|
+
const variantCases = comp.composition?.variantCases;
|
|
53
|
+
return variantCases !== undefined && variantCases.length > 0 && variantCases.every((index) => index >= 0);
|
|
54
|
+
}
|
|
55
|
+
/** The class an object host renders, `undefined` for a directive without one or one whose variants are all composed. */
|
|
56
|
+
function hostWrapperImport(comp) {
|
|
57
|
+
const host = comp.showcaseConfig.host;
|
|
58
|
+
return comp.componentMeta.isDirective && !isFullyComposed(comp) && host && typeof host === 'object' && !('template' in host) ? objectHostImport(host) : undefined;
|
|
59
|
+
}
|
|
60
|
+
function generateWrapperClass(comp, warn, localNames) {
|
|
42
61
|
const wrapperName = `${comp.className}__PrismHost`;
|
|
43
62
|
const host = comp.showcaseConfig.host;
|
|
44
|
-
const
|
|
63
|
+
const selector = comp.componentMeta.selector;
|
|
45
64
|
const bindableInputs = comp.inputs.filter(isBindableInput);
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
let
|
|
65
|
+
// `undefined` without a host: the element then comes from the directive's selector.
|
|
66
|
+
let hostTag;
|
|
67
|
+
let attrs = '';
|
|
68
|
+
let importsArray = `[${comp.className}]`;
|
|
49
69
|
let hostContentDefault = '';
|
|
50
70
|
if (typeof host === 'string') {
|
|
51
71
|
const parsed = parseHostString(host);
|
|
52
|
-
|
|
72
|
+
hostTag = parsed?.tag ?? 'div';
|
|
53
73
|
attrs = parsed?.attrs ? ` ${parsed.attrs}` : '';
|
|
54
74
|
hostContentDefault = parsed?.content ?? '';
|
|
55
|
-
importsArray = `[${comp.className}]`;
|
|
56
75
|
}
|
|
57
|
-
else if (host && typeof host === 'object') {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
else if (host && typeof host === 'object' && !('template' in host)) {
|
|
77
|
+
const hostImport = objectHostImport(host);
|
|
78
|
+
if (hostImport) {
|
|
79
|
+
hostTag = host.selector;
|
|
80
|
+
attrs = Object.entries(host.inputs ?? {})
|
|
81
|
+
.map(([k, v]) => ` ${k}="${String(v)}"`)
|
|
82
|
+
.join('');
|
|
83
|
+
importsArray = `[${comp.className}, ${localName(localNames, hostImport.from, hostImport.name)}]`;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
warn(`${comp.className}: the host names no class to import (host.import), so it renders as <div>.`);
|
|
87
|
+
hostTag = 'div';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const element = selectorElement(selector, hostTag);
|
|
91
|
+
const tag = element?.tag ?? hostTag ?? 'div';
|
|
92
|
+
if (!element) {
|
|
93
|
+
warn(`${comp.className}: no part of the selector "${selector}" fits the host <${tag}>, so only its first attribute is set.`);
|
|
94
|
+
}
|
|
95
|
+
const selectorAttributes = element ? element.attributes : firstSelectorAttribute(selector);
|
|
96
|
+
// The wrapper declares its inputs and outputs under the member names and binds the directive's public ones.
|
|
97
|
+
const inputBindings = bindableInputs.map((i) => ` [${i.alias ?? i.name}]="${i.name}()"`).join('');
|
|
98
|
+
const outputBindings = comp.outputs.map((o) => ` (${o.alias ?? o.name})="${o.name}.emit($event)"`).join('');
|
|
99
|
+
const opening = `<${tag}${attrs}${selectorAttributes ? ` ${selectorAttributes}` : ''}${inputBindings}${outputBindings}`;
|
|
100
|
+
let template;
|
|
101
|
+
if (VOID_ELEMENTS.has(tag.toLowerCase())) {
|
|
102
|
+
// A void element has no end tag and no content: Angular rejects `<input></input>` as well as `<input>{{ ... }}`.
|
|
103
|
+
template = `${opening} />`;
|
|
104
|
+
if (hasContent(hostContentDefault) || comp.showcaseConfig.variants?.some((v) => hasContent(v.content))) {
|
|
105
|
+
warn(`${comp.className}: <${tag}> is a void element and takes no content, so the content of the host and of the variants is not rendered.`);
|
|
106
|
+
}
|
|
65
107
|
}
|
|
66
108
|
else {
|
|
67
|
-
|
|
68
|
-
attrs = '';
|
|
69
|
-
importsArray = `[${comp.className}]`;
|
|
109
|
+
template = `${opening}>{{ __prismContent__() }}</${tag}>`;
|
|
70
110
|
}
|
|
71
|
-
|
|
72
|
-
const outputBindings = comp.outputs.map((o) => ` (${o.name})="${o.name}.emit($event)"`).join('');
|
|
73
|
-
const template = `<${tag}${attrs} ${directiveAttr}${inputBindings}${outputBindings}>{{ __prismContent__() }}</${tag}>`;
|
|
111
|
+
// The runtime sets `__prismContent__` on every directive, void host or not, so the wrapper declares it either way.
|
|
74
112
|
const members = [];
|
|
75
113
|
for (const i of bindableInputs) {
|
|
76
114
|
members.push(` ${i.name} = ${formatInputDeclaration(i)};`);
|
|
@@ -79,56 +117,62 @@ function generateWrapperClass(comp) {
|
|
|
79
117
|
members.push(` ${o.name} = output();`);
|
|
80
118
|
}
|
|
81
119
|
members.push(` __prismContent__ = input(${JSON.stringify(hostContentDefault)});`);
|
|
82
|
-
const lines = [
|
|
120
|
+
const lines = [
|
|
121
|
+
`@Component({`,
|
|
122
|
+
` standalone: true,`,
|
|
123
|
+
` imports: ${importsArray},`,
|
|
124
|
+
` template: \`${escapeTemplateLiteral(template)}\`,`,
|
|
125
|
+
`})`,
|
|
126
|
+
`class ${wrapperName} {`,
|
|
127
|
+
...members,
|
|
128
|
+
`}`
|
|
129
|
+
];
|
|
83
130
|
return lines.join('\n');
|
|
84
131
|
}
|
|
85
|
-
|
|
86
|
-
|
|
132
|
+
/**
|
|
133
|
+
* The classes the manifest imports. The showcased components come first, each by its own name, then the classes of
|
|
134
|
+
* the host wrappers and of the composition wrappers, which take an alias where another class has the name.
|
|
135
|
+
*/
|
|
136
|
+
function collectImports(components, libraryImportPath) {
|
|
137
|
+
// What the module declares or imports besides the classes: no class may take these identifiers.
|
|
138
|
+
const imports = new ManifestImports(['Component', 'computed', 'input', 'output', 'RuntimeManifest', 'PRISM_RUNTIME_MANIFEST']);
|
|
87
139
|
for (const comp of components) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
140
|
+
imports.keep(comp.importPath ?? libraryImportPath, comp.className);
|
|
141
|
+
}
|
|
142
|
+
for (const comp of components) {
|
|
143
|
+
const hostImport = hostWrapperImport(comp);
|
|
144
|
+
if (hostImport)
|
|
145
|
+
imports.local(hostImport.from, hostImport.name);
|
|
146
|
+
}
|
|
147
|
+
for (const comp of components) {
|
|
148
|
+
for (const { from, name } of comp.composition?.imports ?? []) {
|
|
149
|
+
imports.local(from, name);
|
|
95
150
|
}
|
|
96
151
|
}
|
|
97
|
-
return
|
|
152
|
+
return imports;
|
|
98
153
|
}
|
|
154
|
+
const defaultWarn = (message) => console.warn(`⚠ ng-prism: ${message}`);
|
|
99
155
|
export function generateRuntimeManifest(options) {
|
|
100
|
-
const { components, libraryImportPath, pages, meta } = options;
|
|
156
|
+
const { components, services, pipes, libraryImportPath, pages, meta, warn = defaultWarn } = options;
|
|
101
157
|
const directives = components.filter((c) => c.componentMeta.isDirective);
|
|
102
|
-
const
|
|
158
|
+
const hostWrapped = directives.filter((c) => !isFullyComposed(c));
|
|
159
|
+
const composed = components.filter((c) => c.composition);
|
|
160
|
+
const hasWrappers = directives.length > 0 || composed.length > 0;
|
|
103
161
|
const lines = ['// AUTO-GENERATED by ng-prism. Do not edit!', "import type { RuntimeManifest } from '@ng-prism/core/plugin';"];
|
|
104
|
-
if (
|
|
105
|
-
lines.push(
|
|
106
|
-
}
|
|
107
|
-
if (components.length > 0) {
|
|
108
|
-
const groups = groupComponentsByImportPath(components, libraryImportPath);
|
|
109
|
-
for (const comp of directives) {
|
|
110
|
-
const host = comp.showcaseConfig.host;
|
|
111
|
-
if (host && typeof host === 'object' && 'import' in host) {
|
|
112
|
-
const hostObj = host;
|
|
113
|
-
const existing = groups.get(hostObj.import.from);
|
|
114
|
-
if (existing) {
|
|
115
|
-
if (!existing.includes(hostObj.import.name)) {
|
|
116
|
-
existing.push(hostObj.import.name);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
groups.set(hostObj.import.from, [hostObj.import.name]);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
for (const [path, classNames] of groups) {
|
|
125
|
-
lines.push(`import { ${classNames.join(', ')} } from '${path}';`);
|
|
126
|
-
}
|
|
162
|
+
if (hasWrappers) {
|
|
163
|
+
lines.push(`import { ${['Component', ...(composed.length > 0 ? ['computed'] : []), 'input', 'output'].join(', ')} } from '@angular/core';`);
|
|
127
164
|
}
|
|
128
|
-
|
|
165
|
+
const imports = collectImports(components, libraryImportPath);
|
|
166
|
+
const localNames = imports.names();
|
|
167
|
+
lines.push(...imports.lines());
|
|
168
|
+
if (hasWrappers) {
|
|
129
169
|
lines.push('');
|
|
130
|
-
for (const comp of
|
|
131
|
-
lines.push(generateWrapperClass(comp));
|
|
170
|
+
for (const comp of hostWrapped) {
|
|
171
|
+
lines.push(generateWrapperClass(comp, warn, localNames));
|
|
172
|
+
lines.push('');
|
|
173
|
+
}
|
|
174
|
+
for (const comp of composed) {
|
|
175
|
+
lines.push(generateCompositionClass(comp, comp.composition, localNames));
|
|
132
176
|
lines.push('');
|
|
133
177
|
}
|
|
134
178
|
}
|
|
@@ -136,13 +180,18 @@ export function generateRuntimeManifest(options) {
|
|
|
136
180
|
lines.push('export const PRISM_RUNTIME_MANIFEST: RuntimeManifest = {');
|
|
137
181
|
lines.push(' components: [');
|
|
138
182
|
for (const comp of components) {
|
|
139
|
-
const
|
|
183
|
+
const wrapperName = comp.composition ? compositionClassName(comp.className) : undefined;
|
|
184
|
+
const typeName = isFullyComposed(comp) ? wrapperName : comp.componentMeta.isDirective ? `${comp.className}__PrismHost` : comp.className;
|
|
140
185
|
lines.push(' {');
|
|
141
186
|
lines.push(` type: ${typeName},`);
|
|
187
|
+
if (wrapperName)
|
|
188
|
+
lines.push(` composition: ${wrapperName},`);
|
|
142
189
|
lines.push(` meta: ${formatMeta(comp, 6)},`);
|
|
143
190
|
lines.push(' },');
|
|
144
191
|
}
|
|
145
192
|
lines.push(' ],');
|
|
193
|
+
pushDataEntries(lines, 'services', services);
|
|
194
|
+
pushDataEntries(lines, 'pipes', pipes);
|
|
146
195
|
if (pages && pages.length > 0) {
|
|
147
196
|
lines.push(` pages: ${JSON.stringify(pages, null, 2)
|
|
148
197
|
.split('\n')
|
|
@@ -160,6 +209,18 @@ export function generateRuntimeManifest(options) {
|
|
|
160
209
|
lines.push('');
|
|
161
210
|
return lines.join('\n');
|
|
162
211
|
}
|
|
212
|
+
/** A service or a pipe is `{ meta }` and nothing else: the styleguide never imports its class. Writes no line when there is none. */
|
|
213
|
+
function pushDataEntries(lines, key, items) {
|
|
214
|
+
if (!items || items.length === 0)
|
|
215
|
+
return;
|
|
216
|
+
lines.push(` ${key}: [`);
|
|
217
|
+
for (const item of items) {
|
|
218
|
+
lines.push(' {');
|
|
219
|
+
lines.push(` meta: ${formatObject(item, 6)},`);
|
|
220
|
+
lines.push(' },');
|
|
221
|
+
}
|
|
222
|
+
lines.push(' ],');
|
|
223
|
+
}
|
|
163
224
|
function json(value) {
|
|
164
225
|
return JSON.stringify(value);
|
|
165
226
|
}
|
|
@@ -175,11 +236,22 @@ function formatMeta(comp, baseIndent) {
|
|
|
175
236
|
const lines = [
|
|
176
237
|
`${indent(inner)}className: ${json(comp.className)},`,
|
|
177
238
|
`${indent(inner)}filePath: ${json(comp.filePath)},`,
|
|
239
|
+
// The entry point the class is imported from; a plugin's API page names it, e.g. in a usage snippet.
|
|
240
|
+
...(comp.importPath ? [`${indent(inner)}importPath: ${json(comp.importPath)},`] : []),
|
|
178
241
|
`${indent(inner)}showcaseConfig: ${formatObject(comp.showcaseConfig, inner)},`,
|
|
179
242
|
`${indent(inner)}inputs: ${formatArray(comp.inputs, inner)},`,
|
|
180
243
|
`${indent(inner)}outputs: ${formatArray(comp.outputs, inner)},`,
|
|
181
244
|
`${indent(inner)}componentMeta: ${formatObject(comp.componentMeta, inner)},`
|
|
182
245
|
];
|
|
246
|
+
if (comp.api) {
|
|
247
|
+
lines.push(`${indent(inner)}api: ${formatObject(comp.api, inner)},`);
|
|
248
|
+
}
|
|
249
|
+
if (comp.composition) {
|
|
250
|
+
// Without `origin`, which only the comments of the generated code use. `imports` stays: a plugin's usage example names them.
|
|
251
|
+
const { variantCases, cases, imports } = comp.composition;
|
|
252
|
+
const data = { variantCases, cases: cases.map(({ template, unbound }) => ({ template, unbound })), imports };
|
|
253
|
+
lines.push(`${indent(inner)}composition: ${formatObject(data, inner)},`);
|
|
254
|
+
}
|
|
183
255
|
if (comp.meta && Object.keys(comp.meta).length > 0) {
|
|
184
256
|
lines.push(`${indent(inner)}meta: ${formatObject(comp.meta, inner)},`);
|
|
185
257
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SelectorElement {
|
|
2
|
+
tag: string;
|
|
3
|
+
/** The attributes (`name` or `name="value"`) and the classes (`class="a b"`) of the selector part, separated by a space. */
|
|
4
|
+
attributes: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The element and the attributes a directive's selector asks for, to render the directive on a host element.
|
|
8
|
+
*
|
|
9
|
+
* Of a selector list it takes the first part whose element is `tag` or missing; without a `tag`, the first part
|
|
10
|
+
* and its element, or `div` when it names none. `:not()` is ignored. `null` when no part fits `tag`, or when the
|
|
11
|
+
* selector does not parse.
|
|
12
|
+
*/
|
|
13
|
+
export declare function selectorElement(selector: string, tag?: string): SelectorElement | null;
|
|
14
|
+
/** The first attribute of the first part of `selector`, as far as there is one: the least that makes a directive apply when its selector fits no host. */
|
|
15
|
+
export declare function firstSelectorAttribute(selector: string): string;
|
|
16
|
+
//# sourceMappingURL=selector-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector-element.d.ts","sourceRoot":"","sources":["../../../src/builder/manifest/selector-element.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,4HAA4H;IAC5H,UAAU,EAAE,MAAM,CAAC;CACtB;AAgCD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAMtF;AAED,0JAA0J;AAC1J,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI/D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CssSelector } from '@angular/compiler';
|
|
2
|
+
/** The parts of a selector list; a selector that Angular cannot parse has none. */
|
|
3
|
+
function selectorParts(selector) {
|
|
4
|
+
try {
|
|
5
|
+
return CssSelector.parse(selector);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** `*` and a missing element both fit any tag. */
|
|
12
|
+
function elementOf(part) {
|
|
13
|
+
return part.element && part.element !== '*' ? part.element : null;
|
|
14
|
+
}
|
|
15
|
+
/** The attributes of a part, then its classes as one `class` attribute. */
|
|
16
|
+
function attributeList(part) {
|
|
17
|
+
const attributes = [];
|
|
18
|
+
// `attrs` is a flat list of name and value pairs; an attribute without a value has ''.
|
|
19
|
+
for (let i = 0; i < part.attrs.length; i += 2) {
|
|
20
|
+
const [name, value] = [part.attrs[i], part.attrs[i + 1]];
|
|
21
|
+
attributes.push(value ? `${name}="${value.replace(/"/g, '"')}"` : name);
|
|
22
|
+
}
|
|
23
|
+
if (part.classNames.length > 0) {
|
|
24
|
+
attributes.push(`class="${part.classNames.join(' ')}"`);
|
|
25
|
+
}
|
|
26
|
+
return attributes;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The element and the attributes a directive's selector asks for, to render the directive on a host element.
|
|
30
|
+
*
|
|
31
|
+
* Of a selector list it takes the first part whose element is `tag` or missing; without a `tag`, the first part
|
|
32
|
+
* and its element, or `div` when it names none. `:not()` is ignored. `null` when no part fits `tag`, or when the
|
|
33
|
+
* selector does not parse.
|
|
34
|
+
*/
|
|
35
|
+
export function selectorElement(selector, tag) {
|
|
36
|
+
const parts = selectorParts(selector);
|
|
37
|
+
const part = tag === undefined ? parts[0] : parts.find((candidate) => (elementOf(candidate) ?? tag) === tag);
|
|
38
|
+
if (!part)
|
|
39
|
+
return null;
|
|
40
|
+
return { tag: tag ?? elementOf(part) ?? 'div', attributes: attributeList(part).join(' ') };
|
|
41
|
+
}
|
|
42
|
+
/** The first attribute of the first part of `selector`, as far as there is one: the least that makes a directive apply when its selector fits no host. */
|
|
43
|
+
export function firstSelectorAttribute(selector) {
|
|
44
|
+
const part = selectorParts(selector)[0];
|
|
45
|
+
return (part && attributeList(part)[0]) || '';
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-literal.d.ts","sourceRoot":"","sources":["../../../src/builder/manifest/template-literal.ts"],"names":[],"mappings":"AAAA,iJAAiJ;AACjJ,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Makes `text` safe inside a generated template literal: a backslash, a backtick or `${` in it would end the literal or start an expression. */
|
|
2
|
+
export function escapeTemplateLiteral(text) {
|
|
3
|
+
return text.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
|
|
4
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-runner.d.ts","sourceRoot":"","sources":["../../../src/builder/plugin-runner/plugin-runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-runner.d.ts","sourceRoot":"","sources":["../../../src/builder/plugin-runner/plugin-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AA0DjF,wBAAsB,cAAc,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAiC9G"}
|
|
@@ -9,44 +9,47 @@ function wrapPluginError(plugin, hook, target, err) {
|
|
|
9
9
|
}
|
|
10
10
|
return wrapped;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Runs a per-item hook over every item: each item goes through all plugins in
|
|
14
|
+
* turn, and a plugin that returns a value replaces the item for the next one.
|
|
15
|
+
*/
|
|
16
|
+
async function runItemHook(items, plugins, hook, label) {
|
|
17
|
+
const done = [];
|
|
18
|
+
for (const item of items) {
|
|
19
|
+
let current = item;
|
|
16
20
|
for (const plugin of plugins) {
|
|
17
|
-
|
|
21
|
+
const run = plugin[hook];
|
|
22
|
+
if (run) {
|
|
18
23
|
try {
|
|
19
|
-
const result = await
|
|
24
|
+
const result = await run.call(plugin, current);
|
|
20
25
|
if (result) {
|
|
21
26
|
current = result;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
29
|
catch (err) {
|
|
25
|
-
throw wrapPluginError(plugin,
|
|
30
|
+
throw wrapPluginError(plugin, hook, label(current), err);
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
done.push(current);
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
pages[i] = current;
|
|
36
|
+
return done;
|
|
37
|
+
}
|
|
38
|
+
export async function runPluginHooks(manifest, plugins) {
|
|
39
|
+
const components = await runItemHook(manifest.components, plugins, 'onComponentScanned', (component) => `component "${component.className}"`);
|
|
40
|
+
const services = await runItemHook(manifest.services ?? [], plugins, 'onServiceScanned', (service) => `service "${service.className}"`);
|
|
41
|
+
const pipes = await runItemHook(manifest.pipes ?? [], plugins, 'onPipeScanned', (pipe) => `pipe "${pipe.className}"`);
|
|
42
|
+
const pages = await runItemHook(manifest.pages ?? [], plugins, 'onPageScanned', (page) => `page "${page.title}"`);
|
|
43
|
+
let result = { components, pages };
|
|
44
|
+
if (manifest.services) {
|
|
45
|
+
result.services = services;
|
|
46
|
+
}
|
|
47
|
+
if (manifest.pipes) {
|
|
48
|
+
result.pipes = pipes;
|
|
49
|
+
}
|
|
50
|
+
if (manifest.meta) {
|
|
51
|
+
result.meta = manifest.meta;
|
|
48
52
|
}
|
|
49
|
-
let result = manifest.meta ? { components, pages, meta: manifest.meta } : { components, pages };
|
|
50
53
|
for (const plugin of plugins) {
|
|
51
54
|
if (plugin.onManifestReady) {
|
|
52
55
|
try {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ServiceProvision } from '../../../plugin/service.types.js';
|
|
3
|
+
export type ShowcaseClassKind = {
|
|
4
|
+
kind: 'component';
|
|
5
|
+
}
|
|
6
|
+
/** `decorator` is the `@Injectable` or `@Service` that makes it one. */
|
|
7
|
+
| {
|
|
8
|
+
kind: 'service';
|
|
9
|
+
decorator: ts.Decorator;
|
|
10
|
+
}
|
|
11
|
+
/** `decorator` is the `@Pipe` that makes it one; whether the pipe is shown is for the pipe scan to decide. */
|
|
12
|
+
| {
|
|
13
|
+
kind: 'pipe';
|
|
14
|
+
decorator: ts.Decorator;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An `@Injectable`, `@Service` or `@Pipe` that still declares component-only `fields`, so it stays a component for now.
|
|
18
|
+
* `source` says which decorator would make it a service or a pipe; `standalone: false` only for a pipe declared in an NgModule.
|
|
19
|
+
*/
|
|
20
|
+
| {
|
|
21
|
+
kind: 'legacy-component';
|
|
22
|
+
fields: string[];
|
|
23
|
+
source: 'injectable' | 'pipe';
|
|
24
|
+
standalone?: false;
|
|
25
|
+
};
|
|
26
|
+
/** What the `@Pipe` metadata says, as far as the source can be read. */
|
|
27
|
+
export interface PipeOptions {
|
|
28
|
+
/** Missing when the source does not give it as a string constant: the pipe cannot be shown without its name. */
|
|
29
|
+
name?: string;
|
|
30
|
+
/** `true` when the metadata does not say, missing when it says something the scan cannot read. */
|
|
31
|
+
pure?: boolean;
|
|
32
|
+
/** Only `false` when the metadata statically says `standalone: false`; Angular's default is `true`. */
|
|
33
|
+
standalone: boolean;
|
|
34
|
+
}
|
|
35
|
+
type AngularCoreDecoratorName = 'Injectable' | 'Service' | 'Component' | 'Directive' | 'Pipe';
|
|
36
|
+
/**
|
|
37
|
+
* {@link findDecorator} for an Angular decorator, found by the name it has in
|
|
38
|
+
* `@angular/core` rather than in the file: `import { Injectable as Service }`
|
|
39
|
+
* makes `@Service` Angular's `Injectable`, and `import * as ng` makes
|
|
40
|
+
* `@ng.Pipe` its `Pipe`. A `@Service` from a dependency-injection package of
|
|
41
|
+
* another name has nothing to do with Angular's.
|
|
42
|
+
*
|
|
43
|
+
* The scanner never imports `Service` itself, since Angular 20 has none: the
|
|
44
|
+
* decorator is recognised in the source alone.
|
|
45
|
+
*/
|
|
46
|
+
export declare function findAngularCoreDecorator(classDecl: ts.ClassDeclaration, name: AngularCoreDecoratorName, checker: ts.TypeChecker): ts.Decorator | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Tell a service or a pipe from a component. They all carry `@Showcase`, and
|
|
49
|
+
* the only thing that tells them apart is the Angular decorator beside it.
|
|
50
|
+
*
|
|
51
|
+
* A class with `@Component` or `@Directive` is a component, whatever else it
|
|
52
|
+
* carries. Otherwise `@Pipe` makes it a pipe, and `@Service` or `@Injectable`
|
|
53
|
+
* a service, so that a pipe that is also injectable stays a pipe. Either is
|
|
54
|
+
* overruled by the `@Showcase` argument declaring a component-only field: such
|
|
55
|
+
* a class has been shown as a component so far, so it stays one
|
|
56
|
+
* (`legacy-component`) until 23.0.0, and the scan says why. That check comes
|
|
57
|
+
* first, before anything is said about the pipe itself.
|
|
58
|
+
*
|
|
59
|
+
* `showcaseArg` is read from the literal and from the evaluated value, since a
|
|
60
|
+
* constant or a spread can bring the field in and a field the evaluator cannot
|
|
61
|
+
* read is still in the literal.
|
|
62
|
+
*/
|
|
63
|
+
export declare function classifyShowcaseClass(classDecl: ts.ClassDeclaration, showcaseArg: ts.Expression | undefined, checker: ts.TypeChecker): ShowcaseClassKind;
|
|
64
|
+
/**
|
|
65
|
+
* Whether Angular provides the service on its own (`auto`) or the user has to
|
|
66
|
+
* list it in a providers array (`manual`).
|
|
67
|
+
*
|
|
68
|
+
* `@Service()` is auto-provided unless it says `autoProvided: false`;
|
|
69
|
+
* `@Injectable` is when `providedIn` is `'root'`, `'platform'` or `'any'`.
|
|
70
|
+
* Anything else, such as no argument, no `providedIn`, a module class or a value
|
|
71
|
+
* the scan cannot read, is `manual`, without a warning: a service nobody
|
|
72
|
+
* provides is a normal thing to document.
|
|
73
|
+
*/
|
|
74
|
+
export declare function readProvision(decorator: ts.Decorator, checker: ts.TypeChecker): ServiceProvision;
|
|
75
|
+
/**
|
|
76
|
+
* Read `name`, `pure` and `standalone` from the `@Pipe` metadata.
|
|
77
|
+
*
|
|
78
|
+
* Nothing that cannot be read is guessed: a `name` or `pure` the source does not
|
|
79
|
+
* give as a constant is left out, so that the caller can say so, while
|
|
80
|
+
* `standalone` only counts as `false` when the source says exactly that.
|
|
81
|
+
*/
|
|
82
|
+
export declare function readPipeOptions(decorator: ts.Decorator, checker: ts.TypeChecker): PipeOptions;
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=angular-decorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-decorators.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/angular-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAezE,MAAM,MAAM,iBAAiB,GACvB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE;AACvB,wEAAwE;GACtE;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAA;CAAE;AAC9C,8GAA8G;GAC5G;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAA;CAAE;AAC3C;;;GAGG;GACD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAExG,wEAAwE;AACxE,MAAM,WAAW,WAAW;IACxB,gHAAgH;IAChH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uGAAuG;IACvG,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,KAAK,wBAAwB,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,MAAM,CAAC;AAE9F;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,SAAS,GAAG,SAAS,CAE1J;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,WAAW,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,iBAAiB,CAuBxJ;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,gBAAgB,CAsBhG;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,WAAW,CAqB7F"}
|