@ng-prism/core 22.6.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.
Files changed (377) hide show
  1. package/README.md +11 -9
  2. package/dist/app/canvas/canvas-bg.styles.d.ts +1 -1
  3. package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
  4. package/dist/app/canvas/canvas-bg.styles.js +1 -1
  5. package/dist/app/canvas/canvas-overlay-tokens.d.ts +12 -0
  6. package/dist/app/canvas/canvas-overlay-tokens.d.ts.map +1 -0
  7. package/dist/app/canvas/canvas-overlay-tokens.js +52 -0
  8. package/dist/app/canvas/prism-canvas-bg-pill.component.js +2 -2
  9. package/dist/app/canvas/prism-canvas-pin-row.component.js +2 -2
  10. package/dist/app/canvas/prism-canvas-rulers.component.d.ts +2 -0
  11. package/dist/app/canvas/prism-canvas-rulers.component.d.ts.map +1 -1
  12. package/dist/app/canvas/prism-canvas-rulers.component.js +17 -12
  13. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +3 -2
  14. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  15. package/dist/app/canvas/prism-canvas-toolbar.component.js +89 -97
  16. package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -1
  17. package/dist/app/canvas/prism-template-popover.component.js +16 -7
  18. package/dist/app/component-head/head-metrics.d.ts +35 -19
  19. package/dist/app/component-head/head-metrics.d.ts.map +1 -1
  20. package/dist/app/component-head/head-metrics.js +57 -27
  21. package/dist/app/component-head/pipe-facts.d.ts +9 -0
  22. package/dist/app/component-head/pipe-facts.d.ts.map +1 -0
  23. package/dist/app/component-head/pipe-facts.js +15 -0
  24. package/dist/app/component-head/prism-component-head.component.d.ts +19 -22
  25. package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
  26. package/dist/app/component-head/prism-component-head.component.js +80 -96
  27. package/dist/app/component-head/prism-head-gauge.component.d.ts +8 -12
  28. package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -1
  29. package/dist/app/component-head/prism-head-gauge.component.js +51 -67
  30. package/dist/app/component-head/prism-head-info.component.d.ts +13 -2
  31. package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
  32. package/dist/app/component-head/prism-head-info.component.js +57 -16
  33. package/dist/app/component-head/prism-stat.component.d.ts +4 -5
  34. package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
  35. package/dist/app/component-head/prism-stat.component.js +16 -12
  36. package/dist/app/component-head/service-facts.d.ts +8 -0
  37. package/dist/app/component-head/service-facts.d.ts.map +1 -0
  38. package/dist/app/component-head/service-facts.js +11 -0
  39. package/dist/app/controls/boolean-control.component.js +2 -2
  40. package/dist/app/controls/json-control.component.js +2 -2
  41. package/dist/app/controls/union-control.component.js +4 -3
  42. package/dist/app/header/header-brand.d.ts +25 -0
  43. package/dist/app/header/header-brand.d.ts.map +1 -0
  44. package/dist/app/header/header-brand.js +10 -0
  45. package/dist/app/header/prism-header.component.d.ts +2 -2
  46. package/dist/app/header/prism-header.component.d.ts.map +1 -1
  47. package/dist/app/header/prism-header.component.js +73 -57
  48. package/dist/app/icons/icon-registry.d.ts.map +1 -1
  49. package/dist/app/icons/icon-registry.js +4 -1
  50. package/dist/app/index.d.ts +12 -0
  51. package/dist/app/index.d.ts.map +1 -1
  52. package/dist/app/index.js +12 -1
  53. package/dist/app/layout-menu/prism-layout-menu.component.d.ts +3 -0
  54. package/dist/app/layout-menu/prism-layout-menu.component.d.ts.map +1 -1
  55. package/dist/app/layout-menu/prism-layout-menu.component.js +72 -58
  56. package/dist/app/overview/open-in-playground.d.ts +8 -0
  57. package/dist/app/overview/open-in-playground.d.ts.map +1 -1
  58. package/dist/app/overview/open-in-playground.js +13 -0
  59. package/dist/app/overview/overview-matrix.d.ts +10 -4
  60. package/dist/app/overview/overview-matrix.d.ts.map +1 -1
  61. package/dist/app/overview/overview-matrix.js +3 -3
  62. package/dist/app/overview/prism-overview-cell.component.d.ts +6 -2
  63. package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
  64. package/dist/app/overview/prism-overview-cell.component.js +35 -24
  65. package/dist/app/overview/prism-overview-matrix.component.js +46 -55
  66. package/dist/app/page-renderer/prism-page-renderer.component.js +2 -2
  67. package/dist/app/panels/a11y/a11y-header-badge.component.d.ts +1 -4
  68. package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
  69. package/dist/app/panels/a11y/a11y-header-badge.component.js +8 -19
  70. package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +2 -2
  71. package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts +1 -0
  72. package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts.map +1 -1
  73. package/dist/app/panels/a11y/a11y-overlay-host.component.js +4 -3
  74. package/dist/app/panels/a11y/a11y-panel.component.d.ts +4 -1
  75. package/dist/app/panels/a11y/a11y-panel.component.d.ts.map +1 -1
  76. package/dist/app/panels/a11y/a11y-panel.component.js +32 -54
  77. package/dist/app/panels/a11y/a11y-score.component.d.ts +8 -3
  78. package/dist/app/panels/a11y/a11y-score.component.d.ts.map +1 -1
  79. package/dist/app/panels/a11y/a11y-score.component.js +19 -35
  80. package/dist/app/panels/a11y/a11y-sr-overlay.component.js +2 -2
  81. package/dist/app/panels/a11y/a11y-sr.component.js +2 -2
  82. package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
  83. package/dist/app/panels/a11y/a11y-summary.js +8 -1
  84. package/dist/app/panels/a11y/a11y-tree.component.js +2 -2
  85. package/dist/app/panels/a11y/a11y-violations.component.d.ts +23 -2
  86. package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
  87. package/dist/app/panels/a11y/a11y-violations.component.js +104 -89
  88. package/dist/app/panels/a11y/severity.d.ts +9 -0
  89. package/dist/app/panels/a11y/severity.d.ts.map +1 -0
  90. package/dist/app/panels/a11y/severity.js +12 -0
  91. package/dist/app/panels/controls/non-editable-input-types.d.ts +9 -1
  92. package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -1
  93. package/dist/app/panels/controls/non-editable-input-types.js +18 -0
  94. package/dist/app/panels/controls/prism-controls-panel.component.d.ts +2 -1
  95. package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
  96. package/dist/app/panels/controls/prism-controls-panel.component.js +77 -59
  97. package/dist/app/panels/events/prism-events-panel.component.d.ts +2 -0
  98. package/dist/app/panels/events/prism-events-panel.component.d.ts.map +1 -1
  99. package/dist/app/panels/events/prism-events-panel.component.js +20 -7
  100. package/dist/app/panels/events/prism-json-node.utils.d.ts +6 -0
  101. package/dist/app/panels/events/prism-json-node.utils.d.ts.map +1 -1
  102. package/dist/app/panels/events/prism-json-node.utils.js +8 -0
  103. package/dist/app/panels/panel-host/addon-panels.d.ts +11 -0
  104. package/dist/app/panels/panel-host/addon-panels.d.ts.map +1 -0
  105. package/dist/app/panels/panel-host/addon-panels.js +12 -0
  106. package/dist/app/panels/panel-host/panel-badge.d.ts +22 -0
  107. package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
  108. package/dist/app/panels/panel-host/panel-badge.js +56 -11
  109. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +4 -1
  110. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
  111. package/dist/app/panels/panel-host/prism-panel-host.component.js +36 -70
  112. package/dist/app/renderer/composition.d.ts +20 -0
  113. package/dist/app/renderer/composition.d.ts.map +1 -0
  114. package/dist/app/renderer/composition.js +26 -0
  115. package/dist/app/renderer/input-bindings.d.ts +13 -1
  116. package/dist/app/renderer/input-bindings.d.ts.map +1 -1
  117. package/dist/app/renderer/input-bindings.js +22 -1
  118. package/dist/app/renderer/prism-renderer.component.d.ts +8 -1
  119. package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
  120. package/dist/app/renderer/prism-renderer.component.js +40 -28
  121. package/dist/app/renderer/snippet-generator.d.ts +14 -2
  122. package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
  123. package/dist/app/renderer/snippet-generator.js +137 -82
  124. package/dist/app/services/navigation-item.d.ts +10 -0
  125. package/dist/app/services/navigation-item.d.ts.map +1 -0
  126. package/dist/app/services/navigation-item.js +20 -0
  127. package/dist/app/services/navigation-item.types.d.ts +8 -0
  128. package/dist/app/services/navigation-item.types.d.ts.map +1 -1
  129. package/dist/app/services/prism-layout.service.d.ts +12 -0
  130. package/dist/app/services/prism-layout.service.d.ts.map +1 -1
  131. package/dist/app/services/prism-layout.service.js +17 -7
  132. package/dist/app/services/prism-manifest.service.d.ts +4 -0
  133. package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
  134. package/dist/app/services/prism-manifest.service.js +4 -0
  135. package/dist/app/services/prism-navigation.service.d.ts +12 -0
  136. package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
  137. package/dist/app/services/prism-navigation.service.js +85 -19
  138. package/dist/app/services/prism-panel.service.d.ts +7 -3
  139. package/dist/app/services/prism-panel.service.d.ts.map +1 -1
  140. package/dist/app/services/prism-panel.service.js +13 -4
  141. package/dist/app/services/prism-renderer.service.d.ts +6 -0
  142. package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
  143. package/dist/app/services/prism-renderer.service.js +40 -6
  144. package/dist/app/services/prism-search.service.d.ts +4 -0
  145. package/dist/app/services/prism-search.service.d.ts.map +1 -1
  146. package/dist/app/services/prism-search.service.js +29 -6
  147. package/dist/app/services/prism-theme.service.d.ts +11 -3
  148. package/dist/app/services/prism-theme.service.d.ts.map +1 -1
  149. package/dist/app/services/prism-theme.service.js +27 -19
  150. package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
  151. package/dist/app/services/prism-url-state.service.js +42 -4
  152. package/dist/app/shared/badge.types.d.ts +7 -0
  153. package/dist/app/shared/badge.types.d.ts.map +1 -0
  154. package/dist/app/shared/badge.types.js +9 -0
  155. package/dist/app/shared/brand-mark.d.ts +35 -0
  156. package/dist/app/shared/brand-mark.d.ts.map +1 -0
  157. package/dist/app/shared/brand-mark.js +52 -0
  158. package/dist/app/shared/metric-bar.d.ts +6 -0
  159. package/dist/app/shared/metric-bar.d.ts.map +1 -0
  160. package/dist/app/shared/metric-bar.js +7 -0
  161. package/dist/app/shared/prism-badge.component.d.ts +21 -0
  162. package/dist/app/shared/prism-badge.component.d.ts.map +1 -0
  163. package/dist/app/shared/prism-badge.component.js +68 -0
  164. package/dist/app/shared/prism-button.component.d.ts +12 -0
  165. package/dist/app/shared/prism-button.component.d.ts.map +1 -0
  166. package/dist/app/shared/prism-button.component.js +28 -0
  167. package/dist/app/shared/prism-icon-button.component.d.ts +17 -0
  168. package/dist/app/shared/prism-icon-button.component.d.ts.map +1 -0
  169. package/dist/app/shared/prism-icon-button.component.js +37 -0
  170. package/dist/app/shared/prism-list-row.component.d.ts +17 -0
  171. package/dist/app/shared/prism-list-row.component.d.ts.map +1 -0
  172. package/dist/app/shared/prism-list-row.component.js +57 -0
  173. package/dist/app/shared/prism-logo.component.d.ts +24 -0
  174. package/dist/app/shared/prism-logo.component.d.ts.map +1 -0
  175. package/dist/app/shared/prism-logo.component.js +77 -0
  176. package/dist/app/shared/prism-metric-badge.component.d.ts +9 -4
  177. package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
  178. package/dist/app/shared/prism-metric-badge.component.js +33 -12
  179. package/dist/app/shared/prism-metric-card.component.d.ts +30 -0
  180. package/dist/app/shared/prism-metric-card.component.d.ts.map +1 -0
  181. package/dist/app/shared/prism-metric-card.component.js +111 -0
  182. package/dist/app/shared/prism-panel-toolbar.component.d.ts +13 -0
  183. package/dist/app/shared/prism-panel-toolbar.component.d.ts.map +1 -0
  184. package/dist/app/shared/prism-panel-toolbar.component.js +28 -0
  185. package/dist/app/shared/prism-segmented.component.d.ts +25 -0
  186. package/dist/app/shared/prism-segmented.component.d.ts.map +1 -0
  187. package/dist/app/shared/prism-segmented.component.js +77 -0
  188. package/dist/app/shared/prism-tabs.component.d.ts +44 -0
  189. package/dist/app/shared/prism-tabs.component.d.ts.map +1 -0
  190. package/dist/app/shared/prism-tabs.component.js +134 -0
  191. package/dist/app/shared/roving-focus.d.ts +13 -0
  192. package/dist/app/shared/roving-focus.d.ts.map +1 -0
  193. package/dist/app/shared/roving-focus.js +34 -0
  194. package/dist/app/shell/prism-shell.component.d.ts +13 -0
  195. package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
  196. package/dist/app/shell/prism-shell.component.js +57 -28
  197. package/dist/app/shell/should-select-first.d.ts +17 -0
  198. package/dist/app/shell/should-select-first.d.ts.map +1 -0
  199. package/dist/app/shell/should-select-first.js +13 -0
  200. package/dist/app/sidebar/navigation-decorations.d.ts +23 -1
  201. package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
  202. package/dist/app/sidebar/navigation-decorations.js +33 -2
  203. package/dist/app/sidebar/prism-sidebar.component.d.ts +5 -15
  204. package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
  205. package/dist/app/sidebar/prism-sidebar.component.js +89 -77
  206. package/dist/app/theme/deprecated-tokens.d.ts +15 -0
  207. package/dist/app/theme/deprecated-tokens.d.ts.map +1 -0
  208. package/dist/app/theme/deprecated-tokens.js +22 -0
  209. package/dist/app/theme/favicon.d.ts +3 -0
  210. package/dist/app/theme/favicon.d.ts.map +1 -0
  211. package/dist/app/theme/favicon.js +3 -0
  212. package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
  213. package/dist/app/theme/prism-default-theme.js +116 -61
  214. package/dist/app/theme/resolve-theme-tokens.d.ts +29 -0
  215. package/dist/app/theme/resolve-theme-tokens.d.ts.map +1 -0
  216. package/dist/app/theme/resolve-theme-tokens.js +43 -0
  217. package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts +4 -7
  218. package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
  219. package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +31 -69
  220. package/dist/app/view-tab-bar/next-view-id.d.ts +7 -1
  221. package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -1
  222. package/dist/app/view-tab-bar/next-view-id.js +9 -1
  223. package/dist/app/view-tab-bar/panel-inputs.d.ts +28 -0
  224. package/dist/app/view-tab-bar/panel-inputs.d.ts.map +1 -0
  225. package/dist/app/view-tab-bar/panel-inputs.js +41 -0
  226. package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts +2 -3
  227. package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
  228. package/dist/app/view-tab-bar/prism-view-panel-host.component.js +9 -9
  229. package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts +6 -0
  230. package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
  231. package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +22 -29
  232. package/dist/builder/config-loader/deprecated-options.d.ts +4 -2
  233. package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -1
  234. package/dist/builder/config-loader/deprecated-options.js +13 -2
  235. package/dist/builder/manifest/composition-wrapper.generator.d.ts +14 -0
  236. package/dist/builder/manifest/composition-wrapper.generator.d.ts.map +1 -0
  237. package/dist/builder/manifest/composition-wrapper.generator.js +66 -0
  238. package/dist/builder/manifest/host-parser.d.ts +2 -0
  239. package/dist/builder/manifest/host-parser.d.ts.map +1 -1
  240. package/dist/builder/manifest/host-parser.js +9 -4
  241. package/dist/builder/manifest/manifest-imports.d.ts +34 -0
  242. package/dist/builder/manifest/manifest-imports.d.ts.map +1 -0
  243. package/dist/builder/manifest/manifest-imports.js +91 -0
  244. package/dist/builder/manifest/runtime-manifest.generator.d.ts +13 -0
  245. package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
  246. package/dist/builder/manifest/runtime-manifest.generator.js +135 -64
  247. package/dist/builder/manifest/selector-element.d.ts +16 -0
  248. package/dist/builder/manifest/selector-element.d.ts.map +1 -0
  249. package/dist/builder/manifest/selector-element.js +46 -0
  250. package/dist/builder/manifest/template-literal.d.ts +3 -0
  251. package/dist/builder/manifest/template-literal.d.ts.map +1 -0
  252. package/dist/builder/manifest/template-literal.js +4 -0
  253. package/dist/builder/plugin-runner/plugin-runner.d.ts.map +1 -1
  254. package/dist/builder/plugin-runner/plugin-runner.js +29 -26
  255. package/dist/builder/scanner/api/angular-decorators.d.ts +84 -0
  256. package/dist/builder/scanner/api/angular-decorators.d.ts.map +1 -0
  257. package/dist/builder/scanner/api/angular-decorators.js +157 -0
  258. package/dist/builder/scanner/api/component-api.extractor.d.ts +13 -0
  259. package/dist/builder/scanner/api/component-api.extractor.d.ts.map +1 -0
  260. package/dist/builder/scanner/api/component-api.extractor.js +104 -0
  261. package/dist/builder/scanner/api/doc-tags.d.ts +13 -0
  262. package/dist/builder/scanner/api/doc-tags.d.ts.map +1 -0
  263. package/dist/builder/scanner/api/doc-tags.js +101 -0
  264. package/dist/builder/scanner/api/export-index.d.ts +18 -0
  265. package/dist/builder/scanner/api/export-index.d.ts.map +1 -0
  266. package/dist/builder/scanner/api/export-index.js +22 -0
  267. package/dist/builder/scanner/api/member.extractor.d.ts +90 -0
  268. package/dist/builder/scanner/api/member.extractor.d.ts.map +1 -0
  269. package/dist/builder/scanner/api/member.extractor.js +270 -0
  270. package/dist/builder/scanner/api/pipe-api.extractor.d.ts +12 -0
  271. package/dist/builder/scanner/api/pipe-api.extractor.d.ts.map +1 -0
  272. package/dist/builder/scanner/api/pipe-api.extractor.js +52 -0
  273. package/dist/builder/scanner/api/service-api.extractor.d.ts +14 -0
  274. package/dist/builder/scanner/api/service-api.extractor.d.ts.map +1 -0
  275. package/dist/builder/scanner/api/service-api.extractor.js +119 -0
  276. package/dist/builder/scanner/api/setup.reader.d.ts +26 -0
  277. package/dist/builder/scanner/api/setup.reader.d.ts.map +1 -0
  278. package/dist/builder/scanner/api/setup.reader.js +89 -0
  279. package/dist/builder/scanner/api/type-collector.d.ts +24 -0
  280. package/dist/builder/scanner/api/type-collector.d.ts.map +1 -0
  281. package/dist/builder/scanner/api/type-collector.js +211 -0
  282. package/dist/builder/scanner/ast-utils.d.ts +8 -0
  283. package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
  284. package/dist/builder/scanner/ast-utils.js +37 -1
  285. package/dist/builder/scanner/class-hierarchy.d.ts +5 -3
  286. package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -1
  287. package/dist/builder/scanner/class-hierarchy.js +12 -6
  288. package/dist/builder/scanner/component.scanner.d.ts +60 -6
  289. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  290. package/dist/builder/scanner/component.scanner.js +209 -57
  291. package/dist/builder/scanner/composition/compose-template.d.ts +36 -0
  292. package/dist/builder/scanner/composition/compose-template.d.ts.map +1 -0
  293. package/dist/builder/scanner/composition/compose-template.js +187 -0
  294. package/dist/builder/scanner/composition/declarables.d.ts +54 -0
  295. package/dist/builder/scanner/composition/declarables.d.ts.map +1 -0
  296. package/dist/builder/scanner/composition/declarables.js +182 -0
  297. package/dist/builder/scanner/composition/match-declarables.d.ts +43 -0
  298. package/dist/builder/scanner/composition/match-declarables.d.ts.map +1 -0
  299. package/dist/builder/scanner/composition/match-declarables.js +131 -0
  300. package/dist/builder/scanner/composition/read-composition.d.ts +77 -0
  301. package/dist/builder/scanner/composition/read-composition.d.ts.map +1 -0
  302. package/dist/builder/scanner/composition/read-composition.js +302 -0
  303. package/dist/builder/scanner/composition/template-elements.d.ts +12 -0
  304. package/dist/builder/scanner/composition/template-elements.d.ts.map +1 -0
  305. package/dist/builder/scanner/composition/template-elements.js +41 -0
  306. package/dist/builder/scanner/index.d.ts +4 -0
  307. package/dist/builder/scanner/index.d.ts.map +1 -1
  308. package/dist/builder/scanner/index.js +2 -0
  309. package/dist/builder/scanner/input.extractor.d.ts +31 -2
  310. package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
  311. package/dist/builder/scanner/input.extractor.js +52 -15
  312. package/dist/builder/scanner/pipe.scanner.d.ts +29 -0
  313. package/dist/builder/scanner/pipe.scanner.d.ts.map +1 -0
  314. package/dist/builder/scanner/pipe.scanner.js +65 -0
  315. package/dist/builder/scanner/scanner.d.ts +25 -1
  316. package/dist/builder/scanner/scanner.d.ts.map +1 -1
  317. package/dist/builder/scanner/scanner.js +60 -26
  318. package/dist/builder/scanner/service/angular-decorators.d.ts +80 -0
  319. package/dist/builder/scanner/service/angular-decorators.d.ts.map +1 -0
  320. package/dist/builder/scanner/service/angular-decorators.js +154 -0
  321. package/dist/builder/scanner/service/doc-tags.d.ts +13 -0
  322. package/dist/builder/scanner/service/doc-tags.d.ts.map +1 -0
  323. package/dist/builder/scanner/service/doc-tags.js +97 -0
  324. package/dist/builder/scanner/service/export-index.d.ts +18 -0
  325. package/dist/builder/scanner/service/export-index.d.ts.map +1 -0
  326. package/dist/builder/scanner/service/export-index.js +22 -0
  327. package/dist/builder/scanner/service/member.extractor.d.ts +65 -0
  328. package/dist/builder/scanner/service/member.extractor.d.ts.map +1 -0
  329. package/dist/builder/scanner/service/member.extractor.js +216 -0
  330. package/dist/builder/scanner/service/pipe-api.extractor.d.ts +12 -0
  331. package/dist/builder/scanner/service/pipe-api.extractor.d.ts.map +1 -0
  332. package/dist/builder/scanner/service/pipe-api.extractor.js +72 -0
  333. package/dist/builder/scanner/service/service-api.extractor.d.ts +14 -0
  334. package/dist/builder/scanner/service/service-api.extractor.d.ts.map +1 -0
  335. package/dist/builder/scanner/service/service-api.extractor.js +119 -0
  336. package/dist/builder/scanner/service/setup.reader.d.ts +26 -0
  337. package/dist/builder/scanner/service/setup.reader.d.ts.map +1 -0
  338. package/dist/builder/scanner/service/setup.reader.js +89 -0
  339. package/dist/builder/scanner/service/type-collector.d.ts +23 -0
  340. package/dist/builder/scanner/service/type-collector.d.ts.map +1 -0
  341. package/dist/builder/scanner/service/type-collector.js +210 -0
  342. package/dist/builder/scanner/service.scanner.d.ts +26 -0
  343. package/dist/builder/scanner/service.scanner.d.ts.map +1 -0
  344. package/dist/builder/scanner/service.scanner.js +61 -0
  345. package/dist/builder/scanner/showcase-diagnostics.d.ts +60 -1
  346. package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -1
  347. package/dist/builder/scanner/showcase-diagnostics.js +114 -1
  348. package/dist/builder/shared/prism-pipeline.d.ts +6 -0
  349. package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
  350. package/dist/builder/shared/prism-pipeline.js +43 -5
  351. package/dist/decorator/index.d.ts +1 -1
  352. package/dist/decorator/index.d.ts.map +1 -1
  353. package/dist/decorator/showcase.types.d.ts +79 -9
  354. package/dist/decorator/showcase.types.d.ts.map +1 -1
  355. package/dist/plugin/index.d.ts +6 -1
  356. package/dist/plugin/index.d.ts.map +1 -1
  357. package/dist/plugin/index.js +4 -0
  358. package/dist/plugin/pipe.types.d.ts +36 -0
  359. package/dist/plugin/pipe.types.d.ts.map +1 -0
  360. package/dist/plugin/pipe.types.js +1 -0
  361. package/dist/plugin/plugin.types.d.ts +140 -3
  362. package/dist/plugin/plugin.types.d.ts.map +1 -1
  363. package/dist/plugin/service.types.d.ts +124 -0
  364. package/dist/plugin/service.types.d.ts.map +1 -0
  365. package/dist/plugin/service.types.js +1 -0
  366. package/dist/plugin/status.d.ts +27 -0
  367. package/dist/plugin/status.d.ts.map +1 -0
  368. package/dist/plugin/status.js +26 -0
  369. package/dist/shared/composition.d.ts +30 -0
  370. package/dist/shared/composition.d.ts.map +1 -0
  371. package/dist/shared/composition.js +29 -0
  372. package/dist/shared/pseudo-state.type.d.ts +2 -1
  373. package/dist/shared/pseudo-state.type.d.ts.map +1 -1
  374. package/dist/shared/void-elements.d.ts +3 -0
  375. package/dist/shared/void-elements.d.ts.map +1 -0
  376. package/dist/shared/void-elements.js +2 -0
  377. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ import { readPipeOptions } from './api/angular-decorators.js';
2
+ import { extractPipeApi } from './api/pipe-api.extractor.js';
3
+ import { readSetupRefs } from './api/setup.reader.js';
4
+ import { createReporters, extractShowcaseConfig } from './component.scanner.js';
5
+ import { pickServiceFields } from './service.scanner.js';
6
+ import { describePipeNameUnreadable, describePipeNotStandalone, describeUnreadableApi } from './showcase-diagnostics.js';
7
+ /**
8
+ * Read the pipes among the showcased classes of an entry point: classes with
9
+ * `@Pipe` from `@angular/core`, unless they declare fields only a component
10
+ * can use. Components are left to {@link scanComponents}, services to
11
+ * {@link scanServices}.
12
+ *
13
+ * A pipe the styleguide cannot call from a template is reported and dropped:
14
+ * one declared with `standalone: false`, and one whose `name` the source does
15
+ * not give as a constant. A `pure` that cannot be read is left out instead,
16
+ * since the pipe is still worth showing.
17
+ *
18
+ * Nothing is run and the class is never imported: the pipe is read from the
19
+ * source, its API from the declarations, its `setup` from the array literal
20
+ * the arrow function returns. A pipe whose API cannot be read is left out with
21
+ * a notice, so that it does not take the whole scan down.
22
+ */
23
+ export function scanPipes(showcased, checker, { exportIndex, diagnostics, notices }) {
24
+ const pipes = [];
25
+ const { report, notify } = createReporters(diagnostics, notices);
26
+ for (const { symbol, classDecl, decorator, argument, kind: classKind } of showcased) {
27
+ if (classKind.kind !== 'pipe')
28
+ continue;
29
+ const className = classDecl.name?.text ?? 'Anonymous';
30
+ const showcaseConfig = extractShowcaseConfig(decorator, className, report, checker);
31
+ if (!showcaseConfig || !argument)
32
+ continue;
33
+ const options = readPipeOptions(classKind.decorator, checker);
34
+ if (!options.standalone) {
35
+ report(describePipeNotStandalone(className, classKind.decorator));
36
+ continue;
37
+ }
38
+ if (options.name === undefined) {
39
+ report(describePipeNameUnreadable(className, classKind.decorator));
40
+ continue;
41
+ }
42
+ let api;
43
+ try {
44
+ api = extractPipeApi(classDecl, readSetupRefs(argument, className, checker, exportIndex, report), checker, exportIndex);
45
+ }
46
+ catch (error) {
47
+ notify(describeUnreadableApi(className, error, 'pipe'));
48
+ continue;
49
+ }
50
+ const pipe = {
51
+ className,
52
+ filePath: classDecl.getSourceFile().fileName,
53
+ showcaseConfig: pickServiceFields(showcaseConfig),
54
+ pipeName: options.name,
55
+ api
56
+ };
57
+ const importPath = exportIndex.get(symbol);
58
+ if (options.pure !== undefined)
59
+ pipe.pure = options.pure;
60
+ if (importPath !== undefined)
61
+ pipe.importPath = importPath;
62
+ pipes.push(pipe);
63
+ }
64
+ return pipes;
65
+ }
@@ -1,18 +1,42 @@
1
1
  import ts from 'typescript';
2
+ import type { ScannedPipe } from '../../plugin/pipe.types.js';
2
3
  import type { ScannedComponent } from '../../plugin/plugin.types.js';
4
+ import type { ScannedService } from '../../plugin/service.types.js';
3
5
  import { type EntryPointInput } from './entry-point.scanner.js';
4
6
  export interface CreateScannerOptions {
5
7
  entryPoints: ReadonlyArray<EntryPointInput>;
6
8
  compilerOptions?: ts.CompilerOptions;
7
9
  }
10
+ /**
11
+ * What the scan reads beyond the components, each `true` when not given. The
12
+ * build reads only what a plugin in the config uses: services and pipes are
13
+ * then only counted, and components come without `api`.
14
+ */
15
+ export interface ScanOptions {
16
+ /** {@link ScannedComponent.api}, read for a plugin with `componentApi`. */
17
+ componentApi?: boolean;
18
+ /** Services, read for a plugin with a view panel that applies to them. */
19
+ services?: boolean;
20
+ /** Pipes, read for a plugin with a view panel that applies to them. */
21
+ pipes?: boolean;
22
+ }
8
23
  export interface ScanResult {
9
24
  components: ScannedComponent[];
25
+ /** Empty when {@link ScanOptions.services} is `false`. */
26
+ services: ScannedService[];
27
+ /** Empty when {@link ScanOptions.pipes} is `false`. */
28
+ pipes: ScannedPipe[];
29
+ /** The showcased services and pipes the options left unread, counted once each however many entry points export them. */
30
+ unread: {
31
+ services: number;
32
+ pipes: number;
33
+ };
10
34
  /** One message per @Showcase value the scan had to drop, already printed as a warning. */
11
35
  diagnostics: string[];
12
36
  }
13
37
  export interface Scanner {
14
38
  /** Scan all entry points. Reuses TypeScript program state from previous scans. */
15
- scan(): ScanResult;
39
+ scan(options?: ScanOptions): ScanResult;
16
40
  }
17
41
  /**
18
42
  * Create a stateful multi-entry scanner that retains the previous ts.Program between scans.
@@ -1 +1 @@
1
- {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,KAAK,eAAe,EAA4B,MAAM,0BAA0B,CAAC;AAG1F,MAAM,WAAW,oBAAoB;IACjC,WAAW,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC5C,eAAe,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,0FAA0F;IAC1F,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACpB,kFAAkF;IAClF,IAAI,IAAI,UAAU,CAAC;CACtB;AAkBD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CA0DpE"}
1
+ {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAKpE,OAAO,EAAE,KAAK,eAAe,EAA4B,MAAM,0BAA0B,CAAC;AAK1F,MAAM,WAAW,oBAAoB;IACjC,WAAW,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC5C,eAAe,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IACxB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,uDAAuD;IACvD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,yHAAyH;IACzH,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,0FAA0F;IAC1F,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACpB,kFAAkF;IAClF,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;CAC3C;AAkBD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CA4DpE"}
@@ -1,6 +1,11 @@
1
1
  import ts from 'typescript';
2
- import { scanComponents } from './component.scanner.js';
2
+ import { buildExportIndex } from './api/export-index.js';
3
+ import { createReporters, findShowcasedClasses, scanComponents } from './component.scanner.js';
4
+ import { buildDeclarableIndex } from './composition/declarables.js';
5
+ import { createCompositionContext } from './composition/read-composition.js';
3
6
  import { resolveEntryPointExports } from './entry-point.scanner.js';
7
+ import { scanPipes } from './pipe.scanner.js';
8
+ import { scanServices } from './service.scanner.js';
4
9
  import { createSourceFileCache } from './source-file-cache.js';
5
10
  const DEFAULT_COMPILER_OPTIONS = {
6
11
  target: ts.ScriptTarget.ES2022,
@@ -34,44 +39,73 @@ export function createScanner(options) {
34
39
  const sourceFiles = createSourceFileCache(compilerOptions);
35
40
  let previousProgram;
36
41
  return {
37
- scan() {
42
+ scan({ componentApi = true, services: readServices = true, pipes: readPipes = true } = {}) {
38
43
  const { program, entries } = resolveEntryPointExports(options.entryPoints, compilerOptions, previousProgram, sourceFiles.host);
39
44
  previousProgram = program;
40
45
  sourceFiles.prune(program);
41
46
  const checker = program.getTypeChecker();
42
47
  const allComponents = [];
48
+ const allServices = [];
49
+ const allPipes = [];
50
+ const unreadServices = new Set();
51
+ const unreadPipes = new Set();
43
52
  const diagnostics = [];
44
53
  const notices = new Set();
54
+ // A setup function or a type is often exported by another entry point than the component, service or pipe that names it.
55
+ const exportIndex = buildExportIndex(entries, checker);
56
+ const context = { exportIndex, diagnostics, notices };
57
+ // A showcase's templates use what any entry point exports, not only its own. Read for the first one that composes.
58
+ const composition = createCompositionContext(() => buildDeclarableIndex(entries, checker), compilerOptions, createReporters(diagnostics, notices));
45
59
  const fromPrimary = new Set();
46
60
  for (const { exports, importPath, primary } of entries) {
47
- const components = scanComponents(exports, checker, diagnostics, notices);
48
- for (const c of components) {
61
+ const showcased = findShowcasedClasses(exports, checker);
62
+ const components = scanComponents(showcased, checker, { ...context, api: componentApi, composition });
63
+ const services = readServices ? scanServices(showcased, checker, context) : [];
64
+ const pipes = readPipes ? scanPipes(showcased, checker, context) : [];
65
+ for (const { classDecl, kind } of showcased) {
66
+ if (!readServices && kind.kind === 'service')
67
+ unreadServices.add(classDecl);
68
+ if (!readPipes && kind.kind === 'pipe')
69
+ unreadPipes.add(classDecl);
70
+ }
71
+ for (const c of components)
49
72
  c.importPath = importPath;
50
- if (primary)
51
- fromPrimary.add(c);
73
+ if (primary) {
74
+ for (const item of [...components, ...services, ...pipes])
75
+ fromPrimary.add(item);
52
76
  }
53
77
  allComponents.push(...components);
78
+ allServices.push(...services);
79
+ allPipes.push(...pipes);
54
80
  }
55
- // Dedupe by (filePath, className): if a component class is re-exported from
56
- // multiple entry points (e.g. atoms/button + barrel index.ts), we keep the first
57
- // occurrence. The duplicate would otherwise produce duplicate imports in the
58
- // generated manifest and a runtime collision in the Prism shell. The primary
59
- // entry point comes last and re-exporting its secondaries is normal there.
60
- const seen = new Set();
61
- const unique = [];
62
- for (const c of allComponents) {
63
- const key = `${c.filePath}::${c.className}`;
64
- if (seen.has(key)) {
65
- if (fromPrimary.has(c))
66
- continue;
67
- console.warn(`⚠ ng-prism: ${c.className} is exported by multiple entry points; ` +
68
- `keeping the first occurrence (importPath: ${unique.find((u) => u.className === c.className && u.filePath === c.filePath)?.importPath}).`);
69
- continue;
70
- }
71
- seen.add(key);
72
- unique.push(c);
73
- }
74
- return { components: unique, diagnostics };
81
+ return {
82
+ components: dedupe(allComponents, fromPrimary),
83
+ services: dedupe(allServices, fromPrimary),
84
+ pipes: dedupe(allPipes, fromPrimary),
85
+ unread: { services: unreadServices.size, pipes: unreadPipes.size },
86
+ diagnostics
87
+ };
75
88
  }
76
89
  };
77
90
  }
91
+ /**
92
+ * Dedupe by (filePath, className): if a class is re-exported from multiple
93
+ * entry points (e.g. atoms/button + barrel index.ts), we keep the first
94
+ * occurrence. The duplicate would otherwise produce duplicate imports in the
95
+ * generated manifest and a runtime collision in the Prism shell. The primary
96
+ * entry point comes last and re-exporting its secondaries is normal there.
97
+ */
98
+ function dedupe(items, fromPrimary) {
99
+ const first = new Map();
100
+ for (const item of items) {
101
+ const key = `${item.filePath}::${item.className}`;
102
+ const kept = first.get(key);
103
+ if (!kept) {
104
+ first.set(key, item);
105
+ }
106
+ else if (!fromPrimary.has(item)) {
107
+ console.warn(`⚠ ng-prism: ${item.className} is exported by multiple entry points; ` + `keeping the first occurrence (importPath: ${kept.importPath}).`);
108
+ }
109
+ }
110
+ return [...first.values()];
111
+ }
@@ -0,0 +1,80 @@
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
+ /**
36
+ * {@link findDecorator} for an Angular decorator: it only counts if the
37
+ * identifier is imported from `@angular/core`. A `@Service` from a
38
+ * dependency-injection package of another name has nothing to do with Angular's.
39
+ *
40
+ * The scanner never imports `Service` itself, since Angular 20 has none: the
41
+ * decorator is recognised in the source alone.
42
+ */
43
+ export declare function findAngularCoreDecorator(classDecl: ts.ClassDeclaration, name: 'Injectable' | 'Service' | 'Component' | 'Directive' | 'Pipe', checker: ts.TypeChecker): ts.Decorator | undefined;
44
+ /**
45
+ * Tell a service or a pipe from a component. They all carry `@Showcase`, and
46
+ * the only thing that tells them apart is the Angular decorator beside it.
47
+ *
48
+ * A class with `@Component` or `@Directive` is a component, whatever else it
49
+ * carries. Otherwise `@Pipe` makes it a pipe, and `@Service` or `@Injectable`
50
+ * a service, so that a pipe that is also injectable stays a pipe. Either is
51
+ * overruled by the `@Showcase` argument declaring a component-only field: such
52
+ * a class has been shown as a component so far, so it stays one
53
+ * (`legacy-component`) until 23.0.0, and the scan says why. That check comes
54
+ * first, before anything is said about the pipe itself.
55
+ *
56
+ * `showcaseArg` is read from the literal and from the evaluated value, since a
57
+ * constant or a spread can bring the field in and a field the evaluator cannot
58
+ * read is still in the literal.
59
+ */
60
+ export declare function classifyShowcaseClass(classDecl: ts.ClassDeclaration, showcaseArg: ts.Expression | undefined, checker: ts.TypeChecker): ShowcaseClassKind;
61
+ /**
62
+ * Whether Angular provides the service on its own (`auto`) or the user has to
63
+ * list it in a providers array (`manual`).
64
+ *
65
+ * `@Service()` is auto-provided unless it says `autoProvided: false`;
66
+ * `@Injectable` is when `providedIn` is `'root'`, `'platform'` or `'any'`.
67
+ * Anything else, such as no argument, no `providedIn`, a module class or a value
68
+ * the scan cannot read, is `manual`, without a warning: a service nobody
69
+ * provides is a normal thing to document.
70
+ */
71
+ export declare function readProvision(decorator: ts.Decorator, checker: ts.TypeChecker): ServiceProvision;
72
+ /**
73
+ * Read `name`, `pure` and `standalone` from the `@Pipe` metadata.
74
+ *
75
+ * Nothing that cannot be read is guessed: a `name` or `pure` the source does not
76
+ * give as a constant is left out, so that the caller can say so, while
77
+ * `standalone` only counts as `false` when the source says exactly that.
78
+ */
79
+ export declare function readPipeOptions(decorator: ts.Decorator, checker: ts.TypeChecker): PipeOptions;
80
+ //# sourceMappingURL=angular-decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-decorators.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/service/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;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACpC,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAC9B,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,MAAM,EACnE,OAAO,EAAE,EAAE,CAAC,WAAW,GACxB,EAAE,CAAC,SAAS,GAAG,SAAS,CAI1B;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"}
@@ -0,0 +1,154 @@
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'];
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: it only counts if the
14
+ * identifier is imported from `@angular/core`. A `@Service` from a
15
+ * dependency-injection package of another name has nothing to do with Angular's.
16
+ *
17
+ * The scanner never imports `Service` itself, since Angular 20 has none: the
18
+ * decorator is recognised in the source alone.
19
+ */
20
+ export function findAngularCoreDecorator(classDecl, name, checker) {
21
+ const decorator = findDecorator(classDecl, name);
22
+ return decorator && isImportedFromAngularCore(decorator, name, checker) ? decorator : undefined;
23
+ }
24
+ /**
25
+ * Tell a service or a pipe from a component. They all carry `@Showcase`, and
26
+ * the only thing that tells them apart is the Angular decorator beside it.
27
+ *
28
+ * A class with `@Component` or `@Directive` is a component, whatever else it
29
+ * carries. Otherwise `@Pipe` makes it a pipe, and `@Service` or `@Injectable`
30
+ * a service, so that a pipe that is also injectable stays a pipe. Either is
31
+ * overruled by the `@Showcase` argument declaring a component-only field: such
32
+ * a class has been shown as a component so far, so it stays one
33
+ * (`legacy-component`) until 23.0.0, and the scan says why. That check comes
34
+ * first, before anything is said about the pipe itself.
35
+ *
36
+ * `showcaseArg` is read from the literal and from the evaluated value, since a
37
+ * constant or a spread can bring the field in and a field the evaluator cannot
38
+ * read is still in the literal.
39
+ */
40
+ export function classifyShowcaseClass(classDecl, showcaseArg, checker) {
41
+ // Compared by name, as everywhere else in the scanner.
42
+ if (findDecorator(classDecl, 'Component') || findDecorator(classDecl, 'Directive'))
43
+ return { kind: 'component' };
44
+ const pipe = findAngularCoreDecorator(classDecl, 'Pipe', checker);
45
+ if (pipe) {
46
+ const fields = readComponentOnlyFields(showcaseArg, checker);
47
+ if (fields.length === 0)
48
+ return { kind: 'pipe', decorator: pipe };
49
+ return readPipeOptions(pipe, checker).standalone
50
+ ? { kind: 'legacy-component', fields, source: 'pipe' }
51
+ : { kind: 'legacy-component', fields, source: 'pipe', standalone: false };
52
+ }
53
+ const decorator = findAngularCoreDecorator(classDecl, 'Service', checker) ?? findAngularCoreDecorator(classDecl, 'Injectable', checker);
54
+ if (!decorator)
55
+ return { kind: 'component' };
56
+ const fields = readComponentOnlyFields(showcaseArg, checker);
57
+ return fields.length > 0 ? { kind: 'legacy-component', fields, source: 'injectable' } : { kind: 'service', decorator };
58
+ }
59
+ /**
60
+ * Whether Angular provides the service on its own (`auto`) or the user has to
61
+ * list it in a providers array (`manual`).
62
+ *
63
+ * `@Service()` is auto-provided unless it says `autoProvided: false`;
64
+ * `@Injectable` is when `providedIn` is `'root'`, `'platform'` or `'any'`.
65
+ * Anything else, such as no argument, no `providedIn`, a module class or a value
66
+ * the scan cannot read, is `manual`, without a warning: a service nobody
67
+ * provides is a normal thing to document.
68
+ */
69
+ export function readProvision(decorator, checker) {
70
+ const isService = decoratorName(decorator) === 'Service';
71
+ const arg = getDecoratorArgument(decorator);
72
+ if (!arg)
73
+ return isService ? 'auto' : 'manual';
74
+ let unreadable = false;
75
+ const raw = evaluateStatic(arg, {
76
+ checker,
77
+ report: (issue) => {
78
+ // A `factory` is a runtime value and always dropped, which leaves the provision alone.
79
+ if (isService && issue.path[0] === 'autoProvided')
80
+ unreadable = true;
81
+ }
82
+ });
83
+ if (raw === UNEVALUABLE || typeof raw !== 'object' || raw === null)
84
+ return 'manual';
85
+ const options = raw;
86
+ if (isService)
87
+ return unreadable || options['autoProvided'] === false ? 'manual' : 'auto';
88
+ return AUTO_PROVIDED_IN.includes(options['providedIn']) ? 'auto' : 'manual';
89
+ }
90
+ /**
91
+ * Read `name`, `pure` and `standalone` from the `@Pipe` metadata.
92
+ *
93
+ * Nothing that cannot be read is guessed: a `name` or `pure` the source does not
94
+ * give as a constant is left out, so that the caller can say so, while
95
+ * `standalone` only counts as `false` when the source says exactly that.
96
+ */
97
+ export function readPipeOptions(decorator, checker) {
98
+ const arg = getDecoratorArgument(decorator);
99
+ let unreadable = false;
100
+ const raw = arg
101
+ ? evaluateStatic(arg, {
102
+ checker,
103
+ report: (issue) => {
104
+ // The whole argument or a spread that fails could have carried `pure` along, so it counts for it too.
105
+ if (issue.path.length === 0 || issue.path[0] === 'pure')
106
+ unreadable = true;
107
+ }
108
+ })
109
+ : {};
110
+ const options = typeof raw === 'object' && raw !== null ? raw : {};
111
+ const result = { standalone: options['standalone'] !== false };
112
+ if (typeof options['name'] === 'string')
113
+ result.name = options['name'];
114
+ if (typeof options['pure'] === 'boolean')
115
+ result.pure = options['pure'];
116
+ else if (!unreadable && options['pure'] === undefined)
117
+ result.pure = true;
118
+ return result;
119
+ }
120
+ function isImportedFromAngularCore(decorator, name, checker) {
121
+ const expr = ts.isCallExpression(decorator.expression) ? decorator.expression.expression : decorator.expression;
122
+ if (!ts.isIdentifier(expr))
123
+ return false;
124
+ return (checker.getSymbolAtLocation(expr)?.declarations?.some((decl) => {
125
+ if (!ts.isImportSpecifier(decl))
126
+ return false;
127
+ const importDeclaration = decl.parent.parent.parent;
128
+ // `import { Injectable as Service }` is Angular's Injectable, not its Service.
129
+ return (ts.isStringLiteral(importDeclaration.moduleSpecifier) &&
130
+ importDeclaration.moduleSpecifier.text === ANGULAR_CORE &&
131
+ (decl.propertyName ?? decl.name).text === name);
132
+ }) ?? false);
133
+ }
134
+ function decoratorName(decorator) {
135
+ const expr = ts.isCallExpression(decorator.expression) ? decorator.expression.expression : decorator.expression;
136
+ return ts.isIdentifier(expr) ? expr.text : undefined;
137
+ }
138
+ function readComponentOnlyFields(showcaseArg, checker) {
139
+ if (!showcaseArg)
140
+ return [];
141
+ const declared = new Set();
142
+ if (ts.isObjectLiteralExpression(showcaseArg)) {
143
+ for (const prop of showcaseArg.properties) {
144
+ if (prop.name && (ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)))
145
+ declared.add(prop.name.text);
146
+ }
147
+ }
148
+ const evaluated = evaluateExpression(showcaseArg, checker);
149
+ if (typeof evaluated === 'object' && evaluated !== null) {
150
+ for (const key of Object.keys(evaluated))
151
+ declared.add(key);
152
+ }
153
+ return COMPONENT_ONLY_FIELDS.filter((field) => declared.has(field));
154
+ }
@@ -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. `@version` and 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/service/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,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,UAAU,CA6BrD;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,97 @@
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. `@version` and 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 'default':
45
+ if (comment)
46
+ result.default = comment;
47
+ break;
48
+ case 'see': {
49
+ const reference = readSeeReference(tag);
50
+ if (reference)
51
+ result.see = [...(result.see ?? []), reference];
52
+ break;
53
+ }
54
+ case 'example':
55
+ if (comment)
56
+ result.example = [...(result.example ?? []), comment];
57
+ break;
58
+ }
59
+ }
60
+ return result;
61
+ }
62
+ /** Whether a node has a doc block of its own, tags only or not. */
63
+ export function isDocumented(node) {
64
+ return readDocBlock(node) !== undefined;
65
+ }
66
+ /** Whether a node carries an `@internal` tag. */
67
+ export function isInternal(node) {
68
+ return readDocBlock(node)?.tags?.some((tag) => tag.tagName.text === 'internal') ?? false;
69
+ }
70
+ /** The `@param` descriptions of a function-like node, by parameter name. */
71
+ export function readParamDescriptions(node) {
72
+ const result = new Map();
73
+ for (const tag of readDocBlock(node)?.tags ?? []) {
74
+ if (!ts.isJSDocParameterTag(tag) || !ts.isIdentifier(tag.name))
75
+ continue;
76
+ // `@param name - text` is the TSDoc spelling; the dash is not part of the text.
77
+ const description = commentText(tag.comment)?.replace(/^-\s+/, '');
78
+ if (description)
79
+ result.set(tag.name.text, description);
80
+ }
81
+ return result;
82
+ }
83
+ /**
84
+ * What a `@see` points at: the target of a `{@link}`, a name, or a URL. The
85
+ * parser reads a URL as a name followed by `://…` and leaves a stray `*` of the
86
+ * next line behind, so the tag is read from the source instead of from its parts.
87
+ */
88
+ function readSeeReference(tag) {
89
+ const body = tag
90
+ .getSourceFile()
91
+ .text.slice(tag.tagName.end, tag.end)
92
+ .split('\n')
93
+ .map((line) => line.replace(/^\s*\*?\s*/, ''))
94
+ .join(' ')
95
+ .trim();
96
+ return /^\{@link(?:code|plain)?\s+([^\s}|]+)/.exec(body)?.[1] ?? (body.split(/\s+/)[0] || undefined);
97
+ }
@@ -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/service/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
+ }