@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,157 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { evaluateExpression, evaluateStatic, findDecorator, getDecoratorArgument, UNEVALUABLE } from '../ast-utils.js';
|
|
3
|
+
const ANGULAR_CORE = '@angular/core';
|
|
4
|
+
/**
|
|
5
|
+
* `@Showcase` fields that only a component can use. A class that carries
|
|
6
|
+
* one of them next to `@Injectable` or `@Pipe` is a component with that
|
|
7
|
+
* decorator, not a service or a pipe: showing it as one would drop the field.
|
|
8
|
+
*/
|
|
9
|
+
const COMPONENT_ONLY_FIELDS = ['variants', 'states', 'providers', 'bg', 'canvasLayout', 'host', 'renderPage', 'imports'];
|
|
10
|
+
/** The values of `providedIn` that make Angular provide a service without anyone listing it. */
|
|
11
|
+
const AUTO_PROVIDED_IN = ['root', 'platform', 'any'];
|
|
12
|
+
/**
|
|
13
|
+
* {@link findDecorator} for an Angular decorator, found by the name it has in
|
|
14
|
+
* `@angular/core` rather than in the file: `import { Injectable as Service }`
|
|
15
|
+
* makes `@Service` Angular's `Injectable`, and `import * as ng` makes
|
|
16
|
+
* `@ng.Pipe` its `Pipe`. A `@Service` from a dependency-injection package of
|
|
17
|
+
* another name has nothing to do with Angular's.
|
|
18
|
+
*
|
|
19
|
+
* The scanner never imports `Service` itself, since Angular 20 has none: the
|
|
20
|
+
* decorator is recognised in the source alone.
|
|
21
|
+
*/
|
|
22
|
+
export function findAngularCoreDecorator(classDecl, name, checker) {
|
|
23
|
+
return ts.getDecorators(classDecl)?.find((decorator) => angularCoreName(decorator, checker) === name);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Tell a service or a pipe from a component. They all carry `@Showcase`, and
|
|
27
|
+
* the only thing that tells them apart is the Angular decorator beside it.
|
|
28
|
+
*
|
|
29
|
+
* A class with `@Component` or `@Directive` is a component, whatever else it
|
|
30
|
+
* carries. Otherwise `@Pipe` makes it a pipe, and `@Service` or `@Injectable`
|
|
31
|
+
* a service, so that a pipe that is also injectable stays a pipe. Either is
|
|
32
|
+
* overruled by the `@Showcase` argument declaring a component-only field: such
|
|
33
|
+
* a class has been shown as a component so far, so it stays one
|
|
34
|
+
* (`legacy-component`) until 23.0.0, and the scan says why. That check comes
|
|
35
|
+
* first, before anything is said about the pipe itself.
|
|
36
|
+
*
|
|
37
|
+
* `showcaseArg` is read from the literal and from the evaluated value, since a
|
|
38
|
+
* constant or a spread can bring the field in and a field the evaluator cannot
|
|
39
|
+
* read is still in the literal.
|
|
40
|
+
*/
|
|
41
|
+
export function classifyShowcaseClass(classDecl, showcaseArg, checker) {
|
|
42
|
+
// Compared by name, as everywhere else in the scanner.
|
|
43
|
+
if (findDecorator(classDecl, 'Component') || findDecorator(classDecl, 'Directive'))
|
|
44
|
+
return { kind: 'component' };
|
|
45
|
+
const pipe = findAngularCoreDecorator(classDecl, 'Pipe', checker);
|
|
46
|
+
if (pipe) {
|
|
47
|
+
const fields = readComponentOnlyFields(showcaseArg, checker);
|
|
48
|
+
if (fields.length === 0)
|
|
49
|
+
return { kind: 'pipe', decorator: pipe };
|
|
50
|
+
return readPipeOptions(pipe, checker).standalone
|
|
51
|
+
? { kind: 'legacy-component', fields, source: 'pipe' }
|
|
52
|
+
: { kind: 'legacy-component', fields, source: 'pipe', standalone: false };
|
|
53
|
+
}
|
|
54
|
+
const decorator = findAngularCoreDecorator(classDecl, 'Service', checker) ?? findAngularCoreDecorator(classDecl, 'Injectable', checker);
|
|
55
|
+
if (!decorator)
|
|
56
|
+
return { kind: 'component' };
|
|
57
|
+
const fields = readComponentOnlyFields(showcaseArg, checker);
|
|
58
|
+
return fields.length > 0 ? { kind: 'legacy-component', fields, source: 'injectable' } : { kind: 'service', decorator };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Whether Angular provides the service on its own (`auto`) or the user has to
|
|
62
|
+
* list it in a providers array (`manual`).
|
|
63
|
+
*
|
|
64
|
+
* `@Service()` is auto-provided unless it says `autoProvided: false`;
|
|
65
|
+
* `@Injectable` is when `providedIn` is `'root'`, `'platform'` or `'any'`.
|
|
66
|
+
* Anything else, such as no argument, no `providedIn`, a module class or a value
|
|
67
|
+
* the scan cannot read, is `manual`, without a warning: a service nobody
|
|
68
|
+
* provides is a normal thing to document.
|
|
69
|
+
*/
|
|
70
|
+
export function readProvision(decorator, checker) {
|
|
71
|
+
const isService = angularCoreName(decorator, checker) === 'Service';
|
|
72
|
+
const arg = getDecoratorArgument(decorator);
|
|
73
|
+
if (!arg)
|
|
74
|
+
return isService ? 'auto' : 'manual';
|
|
75
|
+
let unreadable = false;
|
|
76
|
+
const raw = evaluateStatic(arg, {
|
|
77
|
+
checker,
|
|
78
|
+
report: (issue) => {
|
|
79
|
+
// A `factory` is a runtime value and always dropped, which leaves the provision alone.
|
|
80
|
+
if (isService && issue.path[0] === 'autoProvided')
|
|
81
|
+
unreadable = true;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
if (raw === UNEVALUABLE || typeof raw !== 'object' || raw === null)
|
|
85
|
+
return 'manual';
|
|
86
|
+
const options = raw;
|
|
87
|
+
if (isService)
|
|
88
|
+
return unreadable || options['autoProvided'] === false ? 'manual' : 'auto';
|
|
89
|
+
return AUTO_PROVIDED_IN.includes(options['providedIn']) ? 'auto' : 'manual';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Read `name`, `pure` and `standalone` from the `@Pipe` metadata.
|
|
93
|
+
*
|
|
94
|
+
* Nothing that cannot be read is guessed: a `name` or `pure` the source does not
|
|
95
|
+
* give as a constant is left out, so that the caller can say so, while
|
|
96
|
+
* `standalone` only counts as `false` when the source says exactly that.
|
|
97
|
+
*/
|
|
98
|
+
export function readPipeOptions(decorator, checker) {
|
|
99
|
+
const arg = getDecoratorArgument(decorator);
|
|
100
|
+
let unreadable = false;
|
|
101
|
+
const raw = arg
|
|
102
|
+
? evaluateStatic(arg, {
|
|
103
|
+
checker,
|
|
104
|
+
report: (issue) => {
|
|
105
|
+
// The whole argument or a spread that fails could have carried `pure` along, so it counts for it too.
|
|
106
|
+
if (issue.path.length === 0 || issue.path[0] === 'pure')
|
|
107
|
+
unreadable = true;
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
: {};
|
|
111
|
+
const options = typeof raw === 'object' && raw !== null ? raw : {};
|
|
112
|
+
const result = { standalone: options['standalone'] !== false };
|
|
113
|
+
if (typeof options['name'] === 'string')
|
|
114
|
+
result.name = options['name'];
|
|
115
|
+
if (typeof options['pure'] === 'boolean')
|
|
116
|
+
result.pure = options['pure'];
|
|
117
|
+
else if (!unreadable && options['pure'] === undefined)
|
|
118
|
+
result.pure = true;
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The name a decorator has in `@angular/core`, or `undefined` when it does not
|
|
123
|
+
* come from there: the imported name of an identifier, whatever it is called
|
|
124
|
+
* in the file, or the member of a namespace import.
|
|
125
|
+
*/
|
|
126
|
+
function angularCoreName(decorator, checker) {
|
|
127
|
+
const expr = ts.isCallExpression(decorator.expression) ? decorator.expression.expression : decorator.expression;
|
|
128
|
+
if (ts.isIdentifier(expr)) {
|
|
129
|
+
const specifier = checker.getSymbolAtLocation(expr)?.declarations?.find(ts.isImportSpecifier);
|
|
130
|
+
return specifier && importsAngularCore(specifier.parent.parent.parent) ? (specifier.propertyName ?? specifier.name).text : undefined;
|
|
131
|
+
}
|
|
132
|
+
if (ts.isPropertyAccessExpression(expr) && ts.isIdentifier(expr.expression)) {
|
|
133
|
+
const namespace = checker.getSymbolAtLocation(expr.expression)?.declarations?.find(ts.isNamespaceImport);
|
|
134
|
+
return namespace && importsAngularCore(namespace.parent.parent) ? expr.name.text : undefined;
|
|
135
|
+
}
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
function importsAngularCore(importDeclaration) {
|
|
139
|
+
return ts.isStringLiteral(importDeclaration.moduleSpecifier) && importDeclaration.moduleSpecifier.text === ANGULAR_CORE;
|
|
140
|
+
}
|
|
141
|
+
function readComponentOnlyFields(showcaseArg, checker) {
|
|
142
|
+
if (!showcaseArg)
|
|
143
|
+
return [];
|
|
144
|
+
const declared = new Set();
|
|
145
|
+
if (ts.isObjectLiteralExpression(showcaseArg)) {
|
|
146
|
+
for (const prop of showcaseArg.properties) {
|
|
147
|
+
if (prop.name && (ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)))
|
|
148
|
+
declared.add(prop.name.text);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const evaluated = evaluateExpression(showcaseArg, checker);
|
|
152
|
+
if (typeof evaluated === 'object' && evaluated !== null) {
|
|
153
|
+
for (const key of Object.keys(evaluated))
|
|
154
|
+
declared.add(key);
|
|
155
|
+
}
|
|
156
|
+
return COMPONENT_ONLY_FIELDS.filter((field) => declared.has(field));
|
|
157
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ComponentApi, InputMeta, OutputMeta } from '../../../plugin/plugin.types.js';
|
|
3
|
+
import type { ClassHierarchy } from '../class-hierarchy.js';
|
|
4
|
+
import type { ExportIndex } from './export-index.js';
|
|
5
|
+
/**
|
|
6
|
+
* What the API page of a component or directive shows beyond `inputs` and
|
|
7
|
+
* `outputs`: the type of each input and the payload of each output, the
|
|
8
|
+
* change output of each `model()`, the documented methods, the description
|
|
9
|
+
* and tags of the class, and every documented type all of them reach, the
|
|
10
|
+
* inputs first, then the outputs, then the methods.
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractComponentApi(classDecl: ts.ClassDeclaration, inputs: InputMeta[], outputs: OutputMeta[], hierarchy: ClassHierarchy, checker: ts.TypeChecker, exportIndex: ExportIndex): ComponentApi;
|
|
13
|
+
//# sourceMappingURL=component-api.extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-api.extractor.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/component-api.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAG3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgBrD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAC9B,MAAM,EAAE,SAAS,EAAE,EACnB,OAAO,EAAE,UAAU,EAAE,EACrB,SAAS,EAAE,cAAc,EACzB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,WAAW,EAAE,WAAW,GACzB,YAAY,CAuCd"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { findDecorator } from '../ast-utils.js';
|
|
3
|
+
import { findInputDeclaration, findOutputDeclaration, getInstantiatedType, isModelInput, usesTypeParameters } from '../input.extractor.js';
|
|
4
|
+
import { readDescription, readDocTags } from './doc-tags.js';
|
|
5
|
+
import { extractDocumentedMethods } from './member.extractor.js';
|
|
6
|
+
import { createTypeCollector } from './type-collector.js';
|
|
7
|
+
/**
|
|
8
|
+
* What the API page of a component or directive shows beyond `inputs` and
|
|
9
|
+
* `outputs`: the type of each input and the payload of each output, the
|
|
10
|
+
* change output of each `model()`, the documented methods, the description
|
|
11
|
+
* and tags of the class, and every documented type all of them reach, the
|
|
12
|
+
* inputs first, then the outputs, then the methods.
|
|
13
|
+
*/
|
|
14
|
+
export function extractComponentApi(classDecl, inputs, outputs, hierarchy, checker, exportIndex) {
|
|
15
|
+
const collector = createTypeCollector(checker, exportIndex);
|
|
16
|
+
const inputTypes = {};
|
|
17
|
+
const outputTypes = {};
|
|
18
|
+
const modelChanges = [];
|
|
19
|
+
for (const { name, alias } of inputs) {
|
|
20
|
+
const declaration = findInputDeclaration(hierarchy, name);
|
|
21
|
+
if (!declaration)
|
|
22
|
+
continue;
|
|
23
|
+
// A type is reached by the name a template binds.
|
|
24
|
+
const pub = alias ?? name;
|
|
25
|
+
const { node, type } = readInputType(declaration, name, classDecl, checker);
|
|
26
|
+
const ref = collector.ref(node, type, `type of ${pub}`, { kind: 'property', name: pub });
|
|
27
|
+
inputTypes[name] = ref;
|
|
28
|
+
if (isModelInput(declaration.member))
|
|
29
|
+
modelChanges.push({ input: name, event: `${pub}Change`, type: ref });
|
|
30
|
+
}
|
|
31
|
+
for (const { name, alias } of outputs) {
|
|
32
|
+
const declaration = findOutputDeclaration(hierarchy, name);
|
|
33
|
+
if (!declaration)
|
|
34
|
+
continue;
|
|
35
|
+
const pub = alias ?? name;
|
|
36
|
+
const { node, type } = readOutputPayload(declaration, name, classDecl, checker);
|
|
37
|
+
outputTypes[name] = collector.ref(node, type, `payload of ${pub}`, { kind: 'property', name: pub });
|
|
38
|
+
}
|
|
39
|
+
const methods = extractDocumentedMethods(classDecl, checker, collector);
|
|
40
|
+
const api = { tags: readDocTags(classDecl), inputTypes, outputTypes, modelChanges, methods, types: collector.drain() };
|
|
41
|
+
const description = readDescription(classDecl);
|
|
42
|
+
if (description)
|
|
43
|
+
api.description = description;
|
|
44
|
+
return api;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The value an input takes, shown as written where it is written: the type
|
|
48
|
+
* argument of `input()` or `model()`, or the annotation of an `@Input()`.
|
|
49
|
+
* The type itself comes from the checker, so an input without either has one too.
|
|
50
|
+
*/
|
|
51
|
+
function readInputType(declaration, name, classDecl, checker) {
|
|
52
|
+
const { member } = declaration;
|
|
53
|
+
if (findDecorator(member, 'Input')) {
|
|
54
|
+
const instantiated = readInstantiatedType(declaration, member.type ?? member.initializer, name, classDecl, checker);
|
|
55
|
+
return instantiated ? { node: undefined, type: instantiated } : { node: member.type, type: checker.getTypeAtLocation(member) };
|
|
56
|
+
}
|
|
57
|
+
// Without the decorator, an input is a member initialized by a call to `input()` or `model()`.
|
|
58
|
+
const call = member.initializer;
|
|
59
|
+
const node = call.typeArguments?.[0];
|
|
60
|
+
const instantiated = readInstantiatedType(declaration, node ?? call.arguments[0], name, classDecl, checker);
|
|
61
|
+
const signal = instantiated ?? checker.getTypeAtLocation(member);
|
|
62
|
+
// A signal is a getter function, so its call signature returns the value type.
|
|
63
|
+
return { node: instantiated ? undefined : node, type: signal.getCallSignatures()[0]?.getReturnType() ?? signal };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What an output emits: the type argument of its type, `OutputEmitterRef<T>`
|
|
67
|
+
* or `EventEmitter<T>`, which is `void` for an `output()` without one. It is
|
|
68
|
+
* shown as written in `output<T>()`, `new EventEmitter<T>()` or the annotation.
|
|
69
|
+
*/
|
|
70
|
+
function readOutputPayload(declaration, name, classDecl, checker) {
|
|
71
|
+
const { member } = declaration;
|
|
72
|
+
const node = readCreatedPayload(member.initializer) ?? readAnnotatedPayload(member.type);
|
|
73
|
+
const instantiated = readInstantiatedType(declaration, node, name, classDecl, checker);
|
|
74
|
+
const emitter = instantiated ?? checker.getTypeAtLocation(member);
|
|
75
|
+
const isReference = emitter.flags & ts.TypeFlags.Object && emitter.objectFlags & ts.ObjectFlags.Reference;
|
|
76
|
+
// A type without type arguments says nothing about what it emits.
|
|
77
|
+
const type = (isReference ? checker.getTypeArguments(emitter)[0] : undefined) ?? checker.getUnknownType();
|
|
78
|
+
return { node: instantiated ? undefined : node, type };
|
|
79
|
+
}
|
|
80
|
+
/** `output<T>()` and `new EventEmitter<T>()`. */
|
|
81
|
+
function readCreatedPayload(initializer) {
|
|
82
|
+
if (initializer && ts.isCallExpression(initializer) && ts.isIdentifier(initializer.expression) && initializer.expression.text === 'output') {
|
|
83
|
+
return initializer.typeArguments?.[0];
|
|
84
|
+
}
|
|
85
|
+
if (initializer && ts.isNewExpression(initializer) && ts.isIdentifier(initializer.expression) && initializer.expression.text === 'EventEmitter') {
|
|
86
|
+
return initializer.typeArguments?.[0];
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
/** `EventEmitter<T>`, `OutputEmitterRef<T>` or `Observable<T>` as annotated. */
|
|
91
|
+
function readAnnotatedPayload(typeNode) {
|
|
92
|
+
return typeNode && ts.isTypeReferenceNode(typeNode) ? typeNode.typeArguments?.[0] : undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The type of a member of a generic base class as the showcased class
|
|
96
|
+
* instantiates it, when what the member is declared with names the base's
|
|
97
|
+
* type parameters: `model<T>()` in `Field<T>` is a `number` on a class that
|
|
98
|
+
* extends `Field<number>`, and its annotation, which says `T`, is not shown.
|
|
99
|
+
* `undefined` for a member that does not use them, as `extractInputs`
|
|
100
|
+
* decides it: that one keeps its annotation, with the links in it.
|
|
101
|
+
*/
|
|
102
|
+
function readInstantiatedType({ owner }, declared, name, classDecl, checker) {
|
|
103
|
+
return owner !== classDecl && usesTypeParameters(declared, owner, checker) ? getInstantiatedType(name, classDecl, checker) : undefined;
|
|
104
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ApiDocTags } from '../../../plugin/service.types.js';
|
|
3
|
+
/** The comment text of a node without its tags, as written: line breaks and markdown stay. */
|
|
4
|
+
export declare function readDescription(node: ts.Node): string | undefined;
|
|
5
|
+
/** The tags of a node. Tags without a place in {@link ApiDocTags} are not read. */
|
|
6
|
+
export declare function readDocTags(node: ts.Node): ApiDocTags;
|
|
7
|
+
/** Whether a node has a doc block of its own, tags only or not. */
|
|
8
|
+
export declare function isDocumented(node: ts.Node): boolean;
|
|
9
|
+
/** Whether a node carries an `@internal` tag. */
|
|
10
|
+
export declare function isInternal(node: ts.Node): boolean;
|
|
11
|
+
/** The `@param` descriptions of a function-like node, by parameter name. */
|
|
12
|
+
export declare function readParamDescriptions(node: ts.Node): Map<string, string>;
|
|
13
|
+
//# sourceMappingURL=doc-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-tags.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/doc-tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAgCnE,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,UAAU,CAgCrD;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAEnD;AAED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAEjD;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxE"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* The block that documents a node: the last `/** *\/` above it, as long as it
|
|
4
|
+
* sits right on top of the node and says something. Line comments in between,
|
|
5
|
+
* such as `// eslint-disable-next-line`, keep it attached. TypeScript also
|
|
6
|
+
* attaches a block that floats a few lines above, such as a section banner,
|
|
7
|
+
* and one that is only a ruler (`/** ===== *\/`); neither describes the node.
|
|
8
|
+
*/
|
|
9
|
+
function readDocBlock(node) {
|
|
10
|
+
const blocks = node.jsDoc;
|
|
11
|
+
const block = blocks?.[blocks.length - 1];
|
|
12
|
+
if (!block)
|
|
13
|
+
return undefined;
|
|
14
|
+
const sourceFile = node.getSourceFile();
|
|
15
|
+
// The first line is the rest of the block's last line, the last one the indentation of the node.
|
|
16
|
+
const linesBetween = sourceFile.text.slice(block.end, node.getStart(sourceFile)).split('\n').slice(1, -1);
|
|
17
|
+
if (linesBetween.some((line) => !/^\s*\/\//.test(line)))
|
|
18
|
+
return undefined;
|
|
19
|
+
const stripped = block.getText(sourceFile).replace(/[/*\s]/g, '');
|
|
20
|
+
if (stripped.length === 0 || /^[*=\-_#~]+$/.test(stripped))
|
|
21
|
+
return undefined;
|
|
22
|
+
return block;
|
|
23
|
+
}
|
|
24
|
+
function commentText(comment) {
|
|
25
|
+
return ts.getTextOfJSDocComment(comment)?.trim() || undefined;
|
|
26
|
+
}
|
|
27
|
+
/** The comment text of a node without its tags, as written: line breaks and markdown stay. */
|
|
28
|
+
export function readDescription(node) {
|
|
29
|
+
return commentText(readDocBlock(node)?.comment);
|
|
30
|
+
}
|
|
31
|
+
/** The tags of a node. Tags without a place in {@link ApiDocTags} are not read. */
|
|
32
|
+
export function readDocTags(node) {
|
|
33
|
+
const result = {};
|
|
34
|
+
for (const tag of readDocBlock(node)?.tags ?? []) {
|
|
35
|
+
const comment = commentText(tag.comment);
|
|
36
|
+
switch (tag.tagName.text) {
|
|
37
|
+
case 'deprecated':
|
|
38
|
+
result.deprecated = comment ?? true;
|
|
39
|
+
break;
|
|
40
|
+
case 'since':
|
|
41
|
+
if (comment)
|
|
42
|
+
result.since = comment;
|
|
43
|
+
break;
|
|
44
|
+
case 'version':
|
|
45
|
+
if (comment)
|
|
46
|
+
result.version = comment;
|
|
47
|
+
break;
|
|
48
|
+
case 'default':
|
|
49
|
+
if (comment)
|
|
50
|
+
result.default = comment;
|
|
51
|
+
break;
|
|
52
|
+
case 'see': {
|
|
53
|
+
const reference = readSeeReference(tag);
|
|
54
|
+
if (reference)
|
|
55
|
+
result.see = [...(result.see ?? []), reference];
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case 'example':
|
|
59
|
+
if (comment)
|
|
60
|
+
result.example = [...(result.example ?? []), comment];
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/** Whether a node has a doc block of its own, tags only or not. */
|
|
67
|
+
export function isDocumented(node) {
|
|
68
|
+
return readDocBlock(node) !== undefined;
|
|
69
|
+
}
|
|
70
|
+
/** Whether a node carries an `@internal` tag. */
|
|
71
|
+
export function isInternal(node) {
|
|
72
|
+
return readDocBlock(node)?.tags?.some((tag) => tag.tagName.text === 'internal') ?? false;
|
|
73
|
+
}
|
|
74
|
+
/** The `@param` descriptions of a function-like node, by parameter name. */
|
|
75
|
+
export function readParamDescriptions(node) {
|
|
76
|
+
const result = new Map();
|
|
77
|
+
for (const tag of readDocBlock(node)?.tags ?? []) {
|
|
78
|
+
if (!ts.isJSDocParameterTag(tag) || !ts.isIdentifier(tag.name))
|
|
79
|
+
continue;
|
|
80
|
+
// `@param name - text` is the TSDoc spelling; the dash is not part of the text.
|
|
81
|
+
const description = commentText(tag.comment)?.replace(/^-\s+/, '');
|
|
82
|
+
if (description)
|
|
83
|
+
result.set(tag.name.text, description);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* What a `@see` points at: the target of a `{@link}`, a name, or a URL. The
|
|
89
|
+
* parser reads a URL as a name followed by `://…` and leaves a stray `*` of the
|
|
90
|
+
* next line behind, so the tag is read from the source instead of from its parts.
|
|
91
|
+
*/
|
|
92
|
+
function readSeeReference(tag) {
|
|
93
|
+
const body = tag
|
|
94
|
+
.getSourceFile()
|
|
95
|
+
.text.slice(tag.tagName.end, tag.end)
|
|
96
|
+
.split('\n')
|
|
97
|
+
.map((line) => line.replace(/^\s*\*?\s*/, ''))
|
|
98
|
+
.join(' ')
|
|
99
|
+
.trim();
|
|
100
|
+
return /^\{@link(?:code|plain)?\s+([^\s}|]+)/.exec(body)?.[1] ?? (body.split(/\s+/)[0] || undefined);
|
|
101
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/** Where a symbol can be imported from: the resolved symbol of an export, and the `importPath` of the entry point that exports it. */
|
|
3
|
+
export type ExportIndex = ReadonlyMap<ts.Symbol, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Index everything the library's entry points export by its resolved symbol,
|
|
6
|
+
* so that a reference found anywhere in the source can be traced to the entry
|
|
7
|
+
* point a consumer imports it from. A re-export (`export { x } from`) is an
|
|
8
|
+
* alias and is followed to the declaration, which is what a reference resolves
|
|
9
|
+
* to as well.
|
|
10
|
+
*
|
|
11
|
+
* A symbol exported more than once keeps the first entry: callers put the
|
|
12
|
+
* secondary entry points before the primary one, as the component dedupe does.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildExportIndex(entries: ReadonlyArray<{
|
|
15
|
+
exports: ts.Symbol[];
|
|
16
|
+
importPath: string;
|
|
17
|
+
}>, checker: ts.TypeChecker): ExportIndex;
|
|
18
|
+
//# sourceMappingURL=export-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-index.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/export-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,sIAAsI;AACtI,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC;IAAE,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,WAAW,CAY3I"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Index everything the library's entry points export by its resolved symbol,
|
|
4
|
+
* so that a reference found anywhere in the source can be traced to the entry
|
|
5
|
+
* point a consumer imports it from. A re-export (`export { x } from`) is an
|
|
6
|
+
* alias and is followed to the declaration, which is what a reference resolves
|
|
7
|
+
* to as well.
|
|
8
|
+
*
|
|
9
|
+
* A symbol exported more than once keeps the first entry: callers put the
|
|
10
|
+
* secondary entry points before the primary one, as the component dedupe does.
|
|
11
|
+
*/
|
|
12
|
+
export function buildExportIndex(entries, checker) {
|
|
13
|
+
const index = new Map();
|
|
14
|
+
for (const { exports, importPath } of entries) {
|
|
15
|
+
for (const sym of exports) {
|
|
16
|
+
const resolved = sym.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(sym) : sym;
|
|
17
|
+
if (!index.has(resolved))
|
|
18
|
+
index.set(resolved, importPath);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return index;
|
|
22
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { ApiMethod, ApiProperty, ApiTypeRef } from '../../../plugin/service.types.js';
|
|
3
|
+
/** What a type is the type of: a property, a parameter of a method, or what a method returns. */
|
|
4
|
+
export type TypeSite = {
|
|
5
|
+
kind: 'property';
|
|
6
|
+
name: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'parameter';
|
|
9
|
+
name: string;
|
|
10
|
+
method: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'return';
|
|
13
|
+
method: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Turns the type of a member, parameter or return value into an {@link ApiTypeRef}.
|
|
17
|
+
* `reachedFrom` says where it was met, e.g. `parameter of show()`, and `site`
|
|
18
|
+
* the same in parts, for a resolver that documents the types it finds on the
|
|
19
|
+
* way and follows their members.
|
|
20
|
+
*/
|
|
21
|
+
export interface TypeRefResolver {
|
|
22
|
+
ref(typeNode: ts.TypeNode | undefined, type: ts.Type, reachedFrom: string, site?: TypeSite): ApiTypeRef;
|
|
23
|
+
}
|
|
24
|
+
type MethodLike = ts.MethodDeclaration | ts.MethodSignature;
|
|
25
|
+
/** A type as written, or as the checker prints it when there is nothing written. Whitespace is collapsed, so a multi-line literal type stays on one line. */
|
|
26
|
+
export declare function readTypeText(checker: ts.TypeChecker, typeNode: ts.TypeNode | undefined, type: ts.Type): string;
|
|
27
|
+
/** Gives the text of a type and nothing else: no links, no documented types. */
|
|
28
|
+
export declare function textOnlyResolver(checker: ts.TypeChecker): TypeRefResolver;
|
|
29
|
+
/**
|
|
30
|
+
* The public instance members of a class and of its base classes, nearest
|
|
31
|
+
* class first and in source order. A class that declares a name hides it in
|
|
32
|
+
* the classes above, whatever it declares: an `@internal` override removes
|
|
33
|
+
* the member, a redeclaration replaces the inherited one. A static member
|
|
34
|
+
* hides nothing, as it is not an instance member.
|
|
35
|
+
*
|
|
36
|
+
* Left out: `private`, `protected` and `#` members, names with a `_` prefix,
|
|
37
|
+
* lifecycle hooks, the constructor, statics and what is tagged `@internal`.
|
|
38
|
+
* The constructor's parameter properties (`constructor(readonly id: string)`)
|
|
39
|
+
* are properties, in the constructor's place, described by its `@param`.
|
|
40
|
+
* Methods are listed with or without JSDoc. A redeclaration without JSDoc of
|
|
41
|
+
* its own keeps its signature, but takes description, tags and `@param` texts
|
|
42
|
+
* from the nearest base class member of that name that has them.
|
|
43
|
+
*/
|
|
44
|
+
export declare function extractMembers(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, types: TypeRefResolver): {
|
|
45
|
+
properties: ApiProperty[];
|
|
46
|
+
methods: ApiMethod[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The methods {@link extractMembers} lists, but only those with docs of their
|
|
50
|
+
* own or taken from a base class member of that name. A component's public
|
|
51
|
+
* methods are often only there for its own template; the documented ones are
|
|
52
|
+
* those meant to be called from outside.
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractDocumentedMethods(classDecl: ts.ClassDeclaration, checker: ts.TypeChecker, types: TypeRefResolver): ApiMethod[];
|
|
55
|
+
/**
|
|
56
|
+
* The members of an interface or an object literal type, the inherited ones
|
|
57
|
+
* included, own members first. What is tagged `@internal` is left out; there
|
|
58
|
+
* is nothing private to leave out.
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractObjectTypeMembers(type: ts.Type, checker: ts.TypeChecker, types: TypeRefResolver): {
|
|
61
|
+
properties: ApiProperty[];
|
|
62
|
+
methods: ApiMethod[];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The signatures a caller can use of a method that `declarations` declare in
|
|
66
|
+
* one class, in source order: its overload signatures, or the one declaration
|
|
67
|
+
* when there are none. The implementation of overloads is not one a caller
|
|
68
|
+
* can use. In a .d.ts every declaration is a signature.
|
|
69
|
+
*
|
|
70
|
+
* A signature without a doc block of its own takes the one of the
|
|
71
|
+
* implementation, then of the first documented signature, then `inherited`,
|
|
72
|
+
* the documented declaration of the method in the nearest base class that has
|
|
73
|
+
* one. The implementation and a base class document the method as a whole, so
|
|
74
|
+
* all of their block is taken. Another signature's block is about that
|
|
75
|
+
* signature: its description and `@param` texts are taken, its tags are not,
|
|
76
|
+
* since an overload marked `@deprecated` does not deprecate the one that
|
|
77
|
+
* replaces it.
|
|
78
|
+
*/
|
|
79
|
+
export declare function extractOverloads(name: string, declarations: MethodLike[], inherited: ts.Node | undefined, checker: ts.TypeChecker, types: TypeRefResolver): ApiMethod[];
|
|
80
|
+
/**
|
|
81
|
+
* The signature of a method, or of a function such as a setup function, with
|
|
82
|
+
* the doc block read from `docs`: the declaration itself, the statement of a
|
|
83
|
+
* `const` arrow function, or a declaration it inherits the docs of.
|
|
84
|
+
*/
|
|
85
|
+
export declare function extractMethod(name: string, declaration: ts.SignatureDeclaration, docs: ts.Node, checker: ts.TypeChecker, types: TypeRefResolver): ApiMethod;
|
|
86
|
+
/** The first parameter that is not `this`. */
|
|
87
|
+
export declare function firstParameter(declaration: ts.SignatureDeclaration): ts.ParameterDeclaration | undefined;
|
|
88
|
+
export declare function collapseWhitespace(text: string): string;
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=member.extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.extractor.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/api/member.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAY,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAIrG,iGAAiG;AACjG,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErJ;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC3G;AAiBD,KAAK,UAAU,GAAG,EAAE,CAAC,iBAAiB,GAAG,EAAE,CAAC,eAAe,CAAC;AAE5D,6JAA6J;AAC7J,wBAAgB,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAE9G;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,eAAe,CAIzE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG;IAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,EAAE,CAAA;CAAE,CAUnK;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,SAAS,EAAE,CAIrI;AAyCD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG;IAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,EAAE,CAAA;CAAE,CA0B5J;AAiFD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,SAAS,EAAE,CAcvK;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,oBAAoB,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,GAAG,SAAS,CAe3J;AAoBD,8CAA8C;AAC9C,wBAAgB,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC,oBAAoB,GAAG,EAAE,CAAC,oBAAoB,GAAG,SAAS,CAExG;AA2BD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|