@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.
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,23 @@
1
+ import ts from 'typescript';
2
+ import type { ApiTypeDoc } from '../../../plugin/service.types.js';
3
+ import type { ExportIndex } from './export-index.js';
4
+ import { type TypeRefResolver } from './member.extractor.js';
5
+ /** A {@link TypeRefResolver} that links the documented types it meets and collects them for `ServiceApi.types`. */
6
+ export interface TypeCollector extends TypeRefResolver {
7
+ /** A resolver for the members of the value at `path`, e.g. the options of a setup function's `config`. */
8
+ within(path: string): TypeRefResolver;
9
+ /** Documents what was reached so far, and what their members reach in turn, in the order of first reach. */
10
+ drain(): ApiTypeDoc[];
11
+ }
12
+ /**
13
+ * Collects the types a service's API reaches. A type is documented when it is
14
+ * an interface, class, type alias or enum, a scanned entry point exports it,
15
+ * and it is not tagged `@internal`. Anything else, `Signal` or `Provider` or a
16
+ * type the library keeps to itself, stays text without a link.
17
+ *
18
+ * Each type is documented once, under the id it got when it was first
19
+ * reached: its name, or `${name}@${importPath}` when a type of that name was
20
+ * reached before. That also ends a type that refers to itself.
21
+ */
22
+ export declare function createTypeCollector(checker: ts.TypeChecker, exportIndex: ExportIndex): TypeCollector;
23
+ //# sourceMappingURL=type-collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-collector.d.ts","sourceRoot":"","sources":["../../../../src/builder/scanner/service/type-collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAA0B,UAAU,EAAc,MAAM,kCAAkC,CAAC;AAEvG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAA8E,KAAK,eAAe,EAAiB,MAAM,uBAAuB,CAAC;AAexJ,mHAAmH;AACnH,MAAM,WAAW,aAAc,SAAQ,eAAe;IAClD,0GAA0G;IAC1G,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IACtC,4GAA4G;IAC5G,KAAK,IAAI,UAAU,EAAE,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,GAAG,aAAa,CAqGpG"}
@@ -0,0 +1,210 @@
1
+ import ts from 'typescript';
2
+ import { isInternal, readDescription, readDocTags } from './doc-tags.js';
3
+ import { collapseWhitespace, extractMembers, extractObjectTypeMembers, readTypeText } from './member.extractor.js';
4
+ /**
5
+ * Collects the types a service's API reaches. A type is documented when it is
6
+ * an interface, class, type alias or enum, a scanned entry point exports it,
7
+ * and it is not tagged `@internal`. Anything else, `Signal` or `Provider` or a
8
+ * type the library keeps to itself, stays text without a link.
9
+ *
10
+ * Each type is documented once, under the id it got when it was first
11
+ * reached: its name, or `${name}@${importPath}` when a type of that name was
12
+ * reached before. That also ends a type that refers to itself.
13
+ */
14
+ export function createTypeCollector(checker, exportIndex) {
15
+ /** Every symbol met so far: what it was reached as, or `null` when it is not documented. */
16
+ const reached = new Map();
17
+ const ids = new Set();
18
+ const queue = [];
19
+ const docs = [];
20
+ function collect(typeNode, type, reachedFrom, path) {
21
+ const links = [];
22
+ const visit = (symbol) => {
23
+ const target = reach(symbol, reachedFrom, path);
24
+ if (target && !links.includes(target.id))
25
+ links.push(target.id);
26
+ };
27
+ if (typeNode)
28
+ forEachReferenceInNode(typeNode, checker, visit);
29
+ else
30
+ forEachReferenceInType(type, checker, visit, new Set());
31
+ const text = readTypeText(checker, typeNode, type);
32
+ return links.length > 0 ? { text, links } : { text };
33
+ }
34
+ function reach(symbol, reachedFrom, path) {
35
+ const target = resolveSymbol(symbol, checker);
36
+ const known = reached.get(target);
37
+ if (known !== undefined)
38
+ return known ?? undefined;
39
+ const declaration = target.declarations?.find(isDocumentedKind);
40
+ const importPath = exportIndex.get(target);
41
+ if (!declaration || importPath === undefined || isInternal(declaration)) {
42
+ reached.set(target, null);
43
+ return undefined;
44
+ }
45
+ const id = ids.has(target.name) ? `${target.name}@${importPath}` : target.name;
46
+ const entry = { id, symbol: target, declaration, importPath, reachedFrom, path: path ?? target.name };
47
+ ids.add(id);
48
+ reached.set(target, entry);
49
+ queue.push(entry);
50
+ return entry;
51
+ }
52
+ function within(owner) {
53
+ return {
54
+ ref(typeNode, type, reachedFrom, site) {
55
+ switch (site?.kind) {
56
+ case 'property':
57
+ return collect(typeNode, type, `via ${owner}.${site.name}`, `${owner}.${site.name}`);
58
+ case 'parameter':
59
+ return collect(typeNode, type, `parameter of ${owner}.${site.method}()`, site.name);
60
+ case 'return':
61
+ return collect(typeNode, type, `returned by ${owner}.${site.method}()`, `${owner}.${site.method}()`);
62
+ default:
63
+ return collect(typeNode, type, `via ${owner}`, owner);
64
+ }
65
+ }
66
+ };
67
+ }
68
+ function describe({ id, symbol, declaration, importPath, reachedFrom, path }) {
69
+ const doc = { id, name: symbol.name, kind: kindOf(declaration), importPath, tags: readDocTags(declaration) };
70
+ const description = readDescription(declaration);
71
+ const members = within(path);
72
+ if (description)
73
+ doc.description = description;
74
+ if (ts.isClassDeclaration(declaration)) {
75
+ assignMembers(doc, extractMembers(declaration, checker, members));
76
+ }
77
+ else if (ts.isInterfaceDeclaration(declaration)) {
78
+ assignMembers(doc, extractObjectTypeMembers(checker.getDeclaredTypeOfSymbol(symbol), checker, members));
79
+ }
80
+ else if (ts.isEnumDeclaration(declaration)) {
81
+ doc.members = declaration.members.filter((member) => !isInternal(member)).map((member) => describeEnumMember(member, checker));
82
+ }
83
+ else if (isLiteralUnion(declaration.type)) {
84
+ doc.union = declaration.type.types.map((member) => member.getText());
85
+ }
86
+ else if (ts.isTypeLiteralNode(declaration.type)) {
87
+ assignMembers(doc, extractObjectTypeMembers(checker.getDeclaredTypeOfSymbol(symbol), checker, members));
88
+ }
89
+ else {
90
+ // The text has no links of its own, but the types it names are reached all the same.
91
+ doc.text = collect(declaration.type, checker.getDeclaredTypeOfSymbol(symbol), `via ${path}`, path).text;
92
+ }
93
+ doc.reachedFrom = reachedFrom;
94
+ return doc;
95
+ }
96
+ return {
97
+ ref: (typeNode, type, reachedFrom, site) => collect(typeNode, type, reachedFrom, site && pathOf(site)),
98
+ within,
99
+ drain() {
100
+ // Describing a type reaches the types of its members, which join the queue behind it.
101
+ while (docs.length < queue.length)
102
+ docs.push(describe(queue[docs.length]));
103
+ return [...docs];
104
+ }
105
+ };
106
+ }
107
+ /** The value a type at the top level is the type of: a property, a parameter by its name, or `show()` for a return value. */
108
+ function pathOf(site) {
109
+ return site.kind === 'return' ? `${site.method}()` : site.name;
110
+ }
111
+ /**
112
+ * The declaration a reference ends at: an import followed to its source, the
113
+ * export symbol of a declaration exported from its own file, an enum for one
114
+ * of its members. That is the symbol the export index holds.
115
+ */
116
+ function resolveSymbol(symbol, checker) {
117
+ let target = symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
118
+ if (target.flags & ts.SymbolFlags.EnumMember && target.valueDeclaration && ts.isEnumDeclaration(target.valueDeclaration.parent)) {
119
+ target = checker.getSymbolAtLocation(target.valueDeclaration.parent.name) ?? target;
120
+ }
121
+ return checker.getExportSymbolOfSymbol(target);
122
+ }
123
+ function isDocumentedKind(declaration) {
124
+ return ts.isInterfaceDeclaration(declaration) || ts.isClassDeclaration(declaration) || ts.isTypeAliasDeclaration(declaration) || ts.isEnumDeclaration(declaration);
125
+ }
126
+ function kindOf(declaration) {
127
+ if (ts.isInterfaceDeclaration(declaration))
128
+ return 'interface';
129
+ if (ts.isClassDeclaration(declaration))
130
+ return 'class';
131
+ if (ts.isEnumDeclaration(declaration))
132
+ return 'enum';
133
+ return 'type';
134
+ }
135
+ /** `'top-left' | 'top-right'`, `1 | 2` or `true | null`: a union of literals only. */
136
+ function isLiteralUnion(node) {
137
+ return ts.isUnionTypeNode(node) && node.types.every(ts.isLiteralTypeNode);
138
+ }
139
+ function assignMembers(doc, { properties, methods }) {
140
+ if (properties.length > 0)
141
+ doc.properties = properties;
142
+ if (methods.length > 0)
143
+ doc.methods = methods;
144
+ }
145
+ /** The initializer as written, or the value TypeScript counts up to without one. */
146
+ function describeEnumMember(member, checker) {
147
+ const result = {
148
+ name: ts.isIdentifier(member.name) || ts.isStringLiteral(member.name) ? member.name.text : member.name.getText()
149
+ };
150
+ const value = member.initializer ? collapseWhitespace(member.initializer.getText()) : checker.getConstantValue(member)?.toString();
151
+ const description = readDescription(member);
152
+ if (value !== undefined)
153
+ result.value = value;
154
+ if (description)
155
+ result.description = description;
156
+ return result;
157
+ }
158
+ /** Every type reference in an annotation: in type arguments, arrays, unions and object literal types too. */
159
+ function forEachReferenceInNode(node, checker, visit) {
160
+ if (ts.isTypeReferenceNode(node)) {
161
+ const symbol = checker.getSymbolAtLocation(ts.isQualifiedName(node.typeName) ? node.typeName.right : node.typeName);
162
+ if (symbol)
163
+ visit(symbol);
164
+ }
165
+ ts.forEachChild(node, (child) => forEachReferenceInNode(child, checker, visit));
166
+ }
167
+ /**
168
+ * Every named type in a type without annotation, as `typeToString` prints it:
169
+ * an alias or a class or interface with their type arguments, the parts of a
170
+ * union or intersection, and the members of an object literal or function type.
171
+ */
172
+ function forEachReferenceInType(type, checker, visit, seen) {
173
+ if (seen.has(type))
174
+ return;
175
+ seen.add(type);
176
+ const walk = (inner) => forEachReferenceInType(inner, checker, visit, seen);
177
+ if (type.aliasSymbol) {
178
+ visit(type.aliasSymbol);
179
+ type.aliasTypeArguments?.forEach(walk);
180
+ return;
181
+ }
182
+ // An enum, or one of its members.
183
+ if (type.flags & ts.TypeFlags.EnumLiteral && type.symbol) {
184
+ visit(type.symbol);
185
+ return;
186
+ }
187
+ if (type.isUnionOrIntersection()) {
188
+ type.types.forEach(walk);
189
+ return;
190
+ }
191
+ if (!(type.flags & ts.TypeFlags.Object))
192
+ return;
193
+ const { objectFlags } = type;
194
+ if (objectFlags & (ts.ObjectFlags.Class | ts.ObjectFlags.Interface | ts.ObjectFlags.Reference)) {
195
+ if (type.symbol)
196
+ visit(type.symbol);
197
+ if (objectFlags & ts.ObjectFlags.Reference)
198
+ checker.getTypeArguments(type).forEach(walk);
199
+ return;
200
+ }
201
+ if (objectFlags & ts.ObjectFlags.Anonymous) {
202
+ for (const property of type.getProperties())
203
+ walk(checker.getTypeOfSymbol(property));
204
+ for (const signature of type.getCallSignatures()) {
205
+ for (const parameter of signature.getParameters())
206
+ walk(checker.getTypeOfSymbol(parameter));
207
+ walk(signature.getReturnType());
208
+ }
209
+ }
210
+ }
@@ -0,0 +1,26 @@
1
+ import ts from 'typescript';
2
+ import type { ShowcaseConfig } from '../../decorator/showcase.types.js';
3
+ import type { ScannedService } from '../../plugin/service.types.js';
4
+ import type { ExportIndex } from './api/export-index.js';
5
+ import { type ShowcasedClass } from './component.scanner.js';
6
+ export interface ScanServicesOptions {
7
+ /** Built from every entry point of the library, since a setup function or a type is often exported by another one than the service. */
8
+ exportIndex: ExportIndex;
9
+ /** Shared with {@link scanComponents}, and across entry points, so that a service exported from several of them does not repeat its warnings. */
10
+ diagnostics: string[];
11
+ notices: Set<string>;
12
+ }
13
+ /**
14
+ * Read the services among the showcased classes of an entry point: classes
15
+ * with `@Injectable` or `@Service`, unless they declare fields only a component
16
+ * can use. Components are left to {@link scanComponents}.
17
+ *
18
+ * Nothing is run and the class is never imported: the service is read from the
19
+ * source, its API from the declarations, its `setup` from the array literal
20
+ * the arrow function returns. A service whose API cannot be read is left out
21
+ * with a notice, so that it does not take the whole scan down.
22
+ */
23
+ export declare function scanServices(showcased: ShowcasedClass[], checker: ts.TypeChecker, { exportIndex, diagnostics, notices }: ScanServicesOptions): ScannedService[];
24
+ /** `title` and whichever of the service fields the config sets: a component's `variants`, `bg` and the like mean nothing here. */
25
+ export declare function pickServiceFields(config: ShowcaseConfig): ShowcaseConfig;
26
+ //# sourceMappingURL=service.scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/service.scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AASrG,MAAM,WAAW,mBAAmB;IAChC,uIAAuI;IACvI,WAAW,EAAE,WAAW,CAAC;IACzB,iJAAiJ;IACjJ,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,cAAc,EAAE,CAoC/J;AAED,kIAAkI;AAClI,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAQxE"}
@@ -0,0 +1,61 @@
1
+ import { readProvision } from './api/angular-decorators.js';
2
+ import { extractServiceApi } from './api/service-api.extractor.js';
3
+ import { readSetupRefs } from './api/setup.reader.js';
4
+ import { createReporters, extractShowcaseConfig } from './component.scanner.js';
5
+ import { describeUnreadableApi } from './showcase-diagnostics.js';
6
+ /**
7
+ * The `@Showcase` fields that mean something for a service, and for a pipe, which the sidebar and the plugins treat the same way:
8
+ * what places it in the sidebar, and what a plugin may read.
9
+ */
10
+ const SERVICE_CONFIG_FIELDS = ['description', 'category', 'categoryOrder', 'componentOrder', 'section', 'sectionOrder', 'tags', 'meta', 'status'];
11
+ /**
12
+ * Read the services among the showcased classes of an entry point: classes
13
+ * with `@Injectable` or `@Service`, unless they declare fields only a component
14
+ * can use. Components are left to {@link scanComponents}.
15
+ *
16
+ * Nothing is run and the class is never imported: the service is read from the
17
+ * source, its API from the declarations, its `setup` from the array literal
18
+ * the arrow function returns. A service whose API cannot be read is left out
19
+ * with a notice, so that it does not take the whole scan down.
20
+ */
21
+ export function scanServices(showcased, checker, { exportIndex, diagnostics, notices }) {
22
+ const services = [];
23
+ const { report, notify } = createReporters(diagnostics, notices);
24
+ for (const { symbol, classDecl, decorator, argument, kind: classKind } of showcased) {
25
+ if (classKind.kind !== 'service')
26
+ continue;
27
+ const className = classDecl.name?.text ?? 'Anonymous';
28
+ const showcaseConfig = extractShowcaseConfig(decorator, className, report, checker);
29
+ if (!showcaseConfig || !argument)
30
+ continue;
31
+ let api;
32
+ try {
33
+ api = extractServiceApi(classDecl, readSetupRefs(argument, className, checker, exportIndex, report), checker, exportIndex);
34
+ }
35
+ catch (error) {
36
+ notify(describeUnreadableApi(className, error, 'service'));
37
+ continue;
38
+ }
39
+ const service = {
40
+ className,
41
+ filePath: classDecl.getSourceFile().fileName,
42
+ showcaseConfig: pickServiceFields(showcaseConfig),
43
+ provision: readProvision(classKind.decorator, checker),
44
+ api
45
+ };
46
+ const importPath = exportIndex.get(symbol);
47
+ if (importPath !== undefined)
48
+ service.importPath = importPath;
49
+ services.push(service);
50
+ }
51
+ return services;
52
+ }
53
+ /** `title` and whichever of the service fields the config sets: a component's `variants`, `bg` and the like mean nothing here. */
54
+ export function pickServiceFields(config) {
55
+ const picked = { title: config.title };
56
+ for (const field of SERVICE_CONFIG_FIELDS) {
57
+ if (config[field] !== undefined)
58
+ Object.assign(picked, { [field]: config[field] });
59
+ }
60
+ return picked;
61
+ }
@@ -1,5 +1,5 @@
1
1
  import ts from 'typescript';
2
- import { type UnevaluableIssue } from './ast-utils.js';
2
+ import { type EvaluationPath, type UnevaluableIssue } from './ast-utils.js';
3
3
  import type { UnreadableBase } from './class-hierarchy.js';
4
4
  /**
5
5
  * Describe one value the scanner had to drop from a `@Showcase` config:
@@ -8,6 +8,21 @@ import type { UnreadableBase } from './class-hierarchy.js';
8
8
  * `SguiFileInputComponent › variants[3] "Auto hint" › inputs.maxFileSize — "megabytes(5)" (src/file-input.component.ts:27:22) cannot be evaluated statically and was dropped.`
9
9
  */
10
10
  export declare function describeUnevaluable(className: string, config: ts.Expression, issue: UnevaluableIssue): string;
11
+ /**
12
+ * Describe a value of a `@Showcase` config that is valid to the evaluator but not to the scan: which component, where
13
+ * in the config, what is wrong and where. `path` is read as in {@link describeUnevaluable}, with array indices as
14
+ * written in the source. The location is the node at `path` when the literal has one, else the whole config.
15
+ *
16
+ * `FormFieldComponent › variants[2] "Both" › content — set together with template; template wins and content was dropped (src/form-field.component.ts:31:9)`
17
+ */
18
+ export declare function describeShowcaseIssue(className: string, config: ts.Expression, path: EvaluationPath, text: string): string;
19
+ /**
20
+ * Name the places of a `@Showcase` config that something comes from, and where the first of them is written, read as
21
+ * in {@link describeShowcaseIssue}.
22
+ *
23
+ * `variants[0] "Default", variants[3] "Again" (src/form-field.component.ts:20:9)`
24
+ */
25
+ export declare function describeShowcaseOrigin(config: ts.Expression, paths: readonly EvaluationPath[]): string;
11
26
  /**
12
27
  * `providers` never reached the manifest: classes, factories and instances
13
28
  * cannot be written into static data. One message for the field, not one per
@@ -22,4 +37,48 @@ export declare function describeDeprecatedProviders(className: string, config: t
22
37
  * knows which variant values will not reach the component.
23
38
  */
24
39
  export declare function describeUnreadableBase(className: string, base: UnreadableBase): string;
40
+ /**
41
+ * A class with `@Injectable` or `@Service` that still declares fields only a
42
+ * component can use. Shown as a component for now, so nothing is lost, but
43
+ * the service page will not have these fields, which is why it is said early.
44
+ */
45
+ export declare function describeLegacyServiceComponent(className: string, fields: string[]): string;
46
+ /**
47
+ * A class with `@Pipe` that still declares fields only a component can use:
48
+ * the pipe counterpart of {@link describeLegacyServiceComponent}. A pipe declared
49
+ * in an NgModule (`standalone: false`) has more to lose, since ng-prism will not
50
+ * show it at all.
51
+ */
52
+ export declare function describeLegacyPipeComponent(className: string, fields: string[], standalone: boolean): string;
53
+ /** A pipe declared in an NgModule cannot be called from a template the styleguide builds, so it is not shown. */
54
+ export declare function describePipeNotStandalone(className: string, node: ts.Node): string;
55
+ /**
56
+ * The name is what a template calls the pipe by; without it the pipe has no
57
+ * usage to show. It points at the `name` property of the `@Pipe({ … })`
58
+ * literal if there is one, else at the decorator.
59
+ */
60
+ export declare function describePipeNameUnreadable(className: string, decorator: ts.Decorator): string;
61
+ /** `setup` lists what configures a service or a pipe; a component has no use for it, and says so instead of silently ignoring it. */
62
+ export declare function describeSetupOnComponent(className: string, node: ts.Node): string;
63
+ /**
64
+ * {@link describeSetupOnComponent} for a service or pipe that its component-only `fields` still keep a component:
65
+ * the class has the decorator the generic message names, so it says why that is not enough.
66
+ */
67
+ export declare function describeSetupOnLegacyComponent(className: string, node: ts.Node, fields: string[]): string;
68
+ /**
69
+ * The notice for an API the extractor could not read. A notice, not a diagnostic: no `@Showcase` value was dropped,
70
+ * so strictShowcase does not fail over it. A component keeps its page, which falls back to its inputs and outputs;
71
+ * a service or a pipe has nothing else to show and is left out.
72
+ */
73
+ export declare function describeUnreadableApi(className: string, error: unknown, kind: 'component' | 'service' | 'pipe'): string;
74
+ /**
75
+ * `setup` has to be readable without running anything: an arrow function whose
76
+ * body is an array literal. Anything else drops the whole field, since there is
77
+ * no telling which entries it would have listed.
78
+ */
79
+ export declare function describeInvalidSetup(className: string, node: ts.Node): string;
80
+ /** The styleguide shows where to import a `setup` entry from, which it only knows for what a library entry point exports. */
81
+ export declare function describeSetupEntryNotExported(className: string, index: number, node: ts.Node): string;
82
+ /** A `setup` entry stands for a provider function or an InjectionToken; a class, a plain value or a call is neither. */
83
+ export declare function describeSetupEntryNotSupported(className: string, index: number, node: ts.Node): string;
25
84
  //# sourceMappingURL=showcase-diagnostics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"showcase-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/showcase-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAA2C,KAAK,gBAAgB,EAA4B,MAAM,gBAAgB,CAAC;AAC1H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAa3D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAY7G;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAO7G;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAOtF"}
1
+ {"version":3,"file":"showcase-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/showcase-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAsB,KAAK,cAAc,EAAwB,KAAK,gBAAgB,EAA4B,MAAM,gBAAgB,CAAC;AAChJ,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAa3D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAY7G;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1H;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAEtG;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAO7G;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAOtF;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAK1F;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,CAM5G;AAED,iHAAiH;AACjH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,GAAG,MAAM,CAK7F;AAED,qIAAqI;AACrI,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAEjF;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAEzG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAMvH;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAK7E;AAED,6HAA6H;AAC7H,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAKrG;AAED,wHAAwH;AACxH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAEtG"}
@@ -1,6 +1,6 @@
1
1
  import { relative } from 'node:path';
2
2
  import ts from 'typescript';
3
- import { evaluateExpression } from './ast-utils.js';
3
+ import { evaluateExpression, getDecoratorArgument } from './ast-utils.js';
4
4
  const MAX_EXCERPT_LENGTH = 60;
5
5
  const CAUSES = {
6
6
  let: 'is declared with let; only const declarations can be read',
@@ -27,6 +27,25 @@ export function describeUnevaluable(className, config, issue) {
27
27
  const cause = issue.cause ? `: ${excerpt(issue.cause.node)} ${CAUSES[issue.cause.kind]}` : '';
28
28
  return `${className} › ${where} — "${excerpt(issue.node)}" (${location(issue.node)}) ${consequence}${cause}.`;
29
29
  }
30
+ /**
31
+ * Describe a value of a `@Showcase` config that is valid to the evaluator but not to the scan: which component, where
32
+ * in the config, what is wrong and where. `path` is read as in {@link describeUnevaluable}, with array indices as
33
+ * written in the source. The location is the node at `path` when the literal has one, else the whole config.
34
+ *
35
+ * `FormFieldComponent › variants[2] "Both" › content — set together with template; template wins and content was dropped (src/form-field.component.ts:31:9)`
36
+ */
37
+ export function describeShowcaseIssue(className, config, path, text) {
38
+ return `${className} › ${formatShowcasePath(path, config)} — ${text} (${location(nodeAtPath(config, path) ?? config)})`;
39
+ }
40
+ /**
41
+ * Name the places of a `@Showcase` config that something comes from, and where the first of them is written, read as
42
+ * in {@link describeShowcaseIssue}.
43
+ *
44
+ * `variants[0] "Default", variants[3] "Again" (src/form-field.component.ts:20:9)`
45
+ */
46
+ export function describeShowcaseOrigin(config, paths) {
47
+ return `${paths.map((path) => formatShowcasePath(path, config)).join(', ')} (${location((paths[0] && nodeAtPath(config, paths[0])) ?? config)})`;
48
+ }
30
49
  /**
31
50
  * `providers` never reached the manifest: classes, factories and instances
32
51
  * cannot be written into static data. One message for the field, not one per
@@ -49,6 +68,81 @@ export function describeUnreadableBase(className, base) {
49
68
  return (`${className} inherits ${base.inputs.join(', ')} from ${baseName}, which only exists as a declaration (${location(base.classDecl)}); ` +
50
69
  `without its source these inputs cannot be read, so they are missing from the manifest and variants cannot set them.`);
51
70
  }
71
+ /**
72
+ * A class with `@Injectable` or `@Service` that still declares fields only a
73
+ * component can use. Shown as a component for now, so nothing is lost, but
74
+ * the service page will not have these fields, which is why it is said early.
75
+ */
76
+ export function describeLegacyServiceComponent(className, fields) {
77
+ return (`${className} is an @Injectable/@Service with @Showcase and declares ${fields.join(', ')}, so it is still treated as a component. ` +
78
+ `From 23.0.0 it will be shown as a service and these fields will be dropped; remove them, or move the page to a componentPage.`);
79
+ }
80
+ /**
81
+ * A class with `@Pipe` that still declares fields only a component can use:
82
+ * the pipe counterpart of {@link describeLegacyServiceComponent}. A pipe declared
83
+ * in an NgModule (`standalone: false`) has more to lose, since ng-prism will not
84
+ * show it at all.
85
+ */
86
+ export function describeLegacyPipeComponent(className, fields, standalone) {
87
+ const lead = `${className} is a @Pipe with @Showcase and declares ${fields.join(', ')}, so it is still treated as a component. `;
88
+ return standalone
89
+ ? `${lead}From 23.0.0 it will be shown as a pipe and these fields will be dropped; remove them, or move the page to a componentPage.`
90
+ : `${lead}From 23.0.0 it will be dropped, because ng-prism shows standalone pipes only; make the pipe standalone and remove the fields, or move the page to a componentPage.`;
91
+ }
92
+ /** A pipe declared in an NgModule cannot be called from a template the styleguide builds, so it is not shown. */
93
+ export function describePipeNotStandalone(className, node) {
94
+ return `${className} › @Pipe (${location(node)}) is declared with standalone: false; ng-prism shows standalone pipes only, so it was dropped.`;
95
+ }
96
+ /**
97
+ * The name is what a template calls the pipe by; without it the pipe has no
98
+ * usage to show. It points at the `name` property of the `@Pipe({ … })`
99
+ * literal if there is one, else at the decorator.
100
+ */
101
+ export function describePipeNameUnreadable(className, decorator) {
102
+ const arg = getDecoratorArgument(decorator);
103
+ const name = arg && ts.isObjectLiteralExpression(arg) ? findProperty(arg, 'name') : undefined;
104
+ return `${className} › @Pipe name (${location(name ?? decorator)}) cannot be evaluated statically, so the pipe was dropped.`;
105
+ }
106
+ /** `setup` lists what configures a service or a pipe; a component has no use for it, and says so instead of silently ignoring it. */
107
+ export function describeSetupOnComponent(className, node) {
108
+ return `${className} › setup (${location(node)}) only applies to services and pipes (@Injectable, @Service or @Pipe); it was dropped.`;
109
+ }
110
+ /**
111
+ * {@link describeSetupOnComponent} for a service or pipe that its component-only `fields` still keep a component:
112
+ * the class has the decorator the generic message names, so it says why that is not enough.
113
+ */
114
+ export function describeSetupOnLegacyComponent(className, node, fields) {
115
+ return `${className} › setup (${location(node)}) was dropped: setup only applies to services and pipes, and the class is still a component because it declares ${fields.join(', ')}.`;
116
+ }
117
+ /**
118
+ * The notice for an API the extractor could not read. A notice, not a diagnostic: no `@Showcase` value was dropped,
119
+ * so strictShowcase does not fail over it. A component keeps its page, which falls back to its inputs and outputs;
120
+ * a service or a pipe has nothing else to show and is left out.
121
+ */
122
+ export function describeUnreadableApi(className, error, kind) {
123
+ const reason = error instanceof Error ? error.message : String(error);
124
+ return kind === 'component'
125
+ ? `${className}: could not read its API for the API page (${reason}); the page falls back to its inputs and outputs.`
126
+ : `${className}: could not read its API (${reason}); the ${kind} is left out of the styleguide.`;
127
+ }
128
+ /**
129
+ * `setup` has to be readable without running anything: an arrow function whose
130
+ * body is an array literal. Anything else drops the whole field, since there is
131
+ * no telling which entries it would have listed.
132
+ */
133
+ export function describeInvalidSetup(className, node) {
134
+ return (`${className} › setup — "${excerpt(node)}" (${location(node)}) must be an arrow function returning an array literal, ` +
135
+ `e.g. setup: () => [provideX]; setup was dropped.`);
136
+ }
137
+ /** The styleguide shows where to import a `setup` entry from, which it only knows for what a library entry point exports. */
138
+ export function describeSetupEntryNotExported(className, index, node) {
139
+ return (`${className} › setup[${index}] — "${excerpt(node)}" (${location(node)}) is not exported from any library entry point, ` +
140
+ `so the styleguide cannot show where to import it from; it was dropped.`);
141
+ }
142
+ /** A `setup` entry stands for a provider function or an InjectionToken; a class, a plain value or a call is neither. */
143
+ export function describeSetupEntryNotSupported(className, index, node) {
144
+ return `${className} › setup[${index}] — "${excerpt(node)}" (${location(node)}) is neither a function nor an InjectionToken; it was dropped.`;
145
+ }
52
146
  /** A variant or a state is named by its `name` as well as its index, since that is what the styleguide shows. */
53
147
  function formatShowcasePath(path, config) {
54
148
  const [head, index, ...rest] = path;
@@ -77,6 +171,25 @@ function elementName(config, key, index) {
77
171
  const value = name && evaluateExpression(name);
78
172
  return typeof value === 'string' ? value : undefined;
79
173
  }
174
+ /** The property or element the literal has at `path`, or `undefined` as soon as the literal stops spelling the path out, as with a spread or a constant. */
175
+ function nodeAtPath(config, path) {
176
+ let container = config;
177
+ let found;
178
+ for (const segment of path) {
179
+ const member = typeof segment === 'number'
180
+ ? ts.isArrayLiteralExpression(container)
181
+ ? container.elements[segment]
182
+ : undefined
183
+ : ts.isObjectLiteralExpression(container)
184
+ ? findProperty(container, segment)
185
+ : undefined;
186
+ if (!member)
187
+ return undefined;
188
+ found = member;
189
+ container = ts.isPropertyAssignment(member) ? member.initializer : member;
190
+ }
191
+ return found;
192
+ }
80
193
  function findProperty(object, key) {
81
194
  return object.properties.find((prop) => prop.name !== undefined && (ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)) && prop.name.text === key);
82
195
  }
@@ -11,6 +11,10 @@ export interface PrismPipelineOptions {
11
11
  export interface PrismPipelineResult {
12
12
  manifestPath: string;
13
13
  componentCount: number;
14
+ /** Services in the manifest: 0 when no plugin shows services, however many the scan found. */
15
+ serviceCount: number;
16
+ /** Pipes in the manifest: 0 when no plugin shows pipes, however many the scan found. */
17
+ pipeCount: number;
14
18
  pageCount: number;
15
19
  /** True if the manifest file was actually written; false if the existing content was identical. */
16
20
  written: boolean;
@@ -19,6 +23,8 @@ export interface PrismPipelineState {
19
23
  scanner: Scanner | undefined;
20
24
  /** Sorted, joined entry-file paths. Used to detect when the entry set changed between rebuilds. */
21
25
  lastEntrySetKey: string | undefined;
26
+ /** Hints already logged in this builder run, so that `serve` does not repeat them on every rebuild. */
27
+ hints: Set<string>;
22
28
  }
23
29
  export declare function createPipelineState(): PrismPipelineState;
24
30
  export declare function runPrismPipeline(options: PrismPipelineOptions, context: BuilderContext, state: PrismPipelineState): Promise<PrismPipelineResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"prism-pipeline.d.ts","sourceRoot":"","sources":["../../../src/builder/shared/prism-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAUhE,OAAO,EAAiB,KAAK,OAAO,EAAmB,MAAM,uBAAuB,CAAC;AAErF,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,mGAAmG;IACnG,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,wBAAgB,mBAAmB,IAAI,kBAAkB,CAExD;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA2FtJ"}
1
+ {"version":3,"file":"prism-pipeline.d.ts","sourceRoot":"","sources":["../../../src/builder/shared/prism-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAYhE,OAAO,EAAiB,KAAK,OAAO,EAAqC,MAAM,uBAAuB,CAAC;AAEvG,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,8FAA8F;IAC9F,YAAY,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,mGAAmG;IACnG,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,uGAAuG;IACvG,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,wBAAgB,mBAAmB,IAAI,kBAAkB,CAExD;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8ItJ"}