@ng-prism/core 22.5.0 → 22.7.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. package/README.md +13 -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 +25 -3
  14. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  15. package/dist/app/canvas/prism-canvas-toolbar.component.js +154 -89
  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/canvas/state-chips.d.ts +50 -0
  19. package/dist/app/canvas/state-chips.d.ts.map +1 -0
  20. package/dist/app/canvas/state-chips.js +40 -0
  21. package/dist/app/component-head/head-metrics.d.ts +35 -19
  22. package/dist/app/component-head/head-metrics.d.ts.map +1 -1
  23. package/dist/app/component-head/head-metrics.js +57 -27
  24. package/dist/app/component-head/pipe-facts.d.ts +9 -0
  25. package/dist/app/component-head/pipe-facts.d.ts.map +1 -0
  26. package/dist/app/component-head/pipe-facts.js +15 -0
  27. package/dist/app/component-head/prism-component-head.component.d.ts +20 -22
  28. package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
  29. package/dist/app/component-head/prism-component-head.component.js +85 -96
  30. package/dist/app/component-head/prism-head-gauge.component.d.ts +8 -12
  31. package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -1
  32. package/dist/app/component-head/prism-head-gauge.component.js +51 -67
  33. package/dist/app/component-head/prism-head-info.component.d.ts +14 -2
  34. package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
  35. package/dist/app/component-head/prism-head-info.component.js +84 -20
  36. package/dist/app/component-head/prism-stat.component.d.ts +4 -5
  37. package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
  38. package/dist/app/component-head/prism-stat.component.js +16 -12
  39. package/dist/app/component-head/service-facts.d.ts +8 -0
  40. package/dist/app/component-head/service-facts.d.ts.map +1 -0
  41. package/dist/app/component-head/service-facts.js +11 -0
  42. package/dist/app/controls/boolean-control.component.js +2 -2
  43. package/dist/app/controls/json-control.component.js +2 -2
  44. package/dist/app/controls/union-control.component.js +4 -3
  45. package/dist/app/directives/resize-value.d.ts +1 -1
  46. package/dist/app/directives/resize-value.js +1 -1
  47. package/dist/app/discovery-manifest.d.ts +2 -2
  48. package/dist/app/discovery-manifest.d.ts.map +1 -1
  49. package/dist/app/discovery-manifest.js +15 -3
  50. package/dist/app/header/header-brand.d.ts +25 -0
  51. package/dist/app/header/header-brand.d.ts.map +1 -0
  52. package/dist/app/header/header-brand.js +10 -0
  53. package/dist/app/header/prism-header.component.d.ts +2 -2
  54. package/dist/app/header/prism-header.component.d.ts.map +1 -1
  55. package/dist/app/header/prism-header.component.js +73 -57
  56. package/dist/app/icons/icon-registry.d.ts.map +1 -1
  57. package/dist/app/icons/icon-registry.js +4 -1
  58. package/dist/app/index.d.ts +12 -0
  59. package/dist/app/index.d.ts.map +1 -1
  60. package/dist/app/index.js +12 -1
  61. package/dist/app/layout-menu/prism-layout-menu.component.d.ts +3 -0
  62. package/dist/app/layout-menu/prism-layout-menu.component.d.ts.map +1 -1
  63. package/dist/app/layout-menu/prism-layout-menu.component.js +72 -58
  64. package/dist/app/overview/open-in-playground.d.ts +19 -0
  65. package/dist/app/overview/open-in-playground.d.ts.map +1 -0
  66. package/dist/app/overview/open-in-playground.js +25 -0
  67. package/dist/app/overview/overview-matrix.d.ts +85 -0
  68. package/dist/app/overview/overview-matrix.d.ts.map +1 -0
  69. package/dist/app/overview/overview-matrix.js +98 -0
  70. package/dist/app/overview/overview-visibility.d.ts +10 -2
  71. package/dist/app/overview/overview-visibility.d.ts.map +1 -1
  72. package/dist/app/overview/overview-visibility.js +14 -3
  73. package/dist/app/overview/prism-overview-cell.component.d.ts +27 -2
  74. package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
  75. package/dist/app/overview/prism-overview-cell.component.js +145 -28
  76. package/dist/app/overview/prism-overview-matrix.component.d.ts +29 -0
  77. package/dist/app/overview/prism-overview-matrix.component.d.ts.map +1 -0
  78. package/dist/app/overview/prism-overview-matrix.component.js +155 -0
  79. package/dist/app/overview/prism-overview.component.d.ts +4 -0
  80. package/dist/app/overview/prism-overview.component.d.ts.map +1 -1
  81. package/dist/app/overview/prism-overview.component.js +37 -14
  82. package/dist/app/page-renderer/prism-page-renderer.component.js +2 -2
  83. package/dist/app/panels/a11y/a11y-core.plugin.d.ts.map +1 -1
  84. package/dist/app/panels/a11y/a11y-core.plugin.js +0 -1
  85. package/dist/app/panels/a11y/a11y-header-badge.component.d.ts +1 -4
  86. package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
  87. package/dist/app/panels/a11y/a11y-header-badge.component.js +8 -19
  88. package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +2 -2
  89. package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts +1 -0
  90. package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts.map +1 -1
  91. package/dist/app/panels/a11y/a11y-overlay-host.component.js +4 -3
  92. package/dist/app/panels/a11y/a11y-panel.component.d.ts +4 -1
  93. package/dist/app/panels/a11y/a11y-panel.component.d.ts.map +1 -1
  94. package/dist/app/panels/a11y/a11y-panel.component.js +32 -54
  95. package/dist/app/panels/a11y/a11y-score.component.d.ts +8 -3
  96. package/dist/app/panels/a11y/a11y-score.component.d.ts.map +1 -1
  97. package/dist/app/panels/a11y/a11y-score.component.js +19 -35
  98. package/dist/app/panels/a11y/a11y-sr-overlay.component.js +2 -2
  99. package/dist/app/panels/a11y/a11y-sr.component.js +2 -2
  100. package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
  101. package/dist/app/panels/a11y/a11y-summary.js +8 -1
  102. package/dist/app/panels/a11y/a11y-tree.component.js +2 -2
  103. package/dist/app/panels/a11y/a11y-violations.component.d.ts +23 -2
  104. package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
  105. package/dist/app/panels/a11y/a11y-violations.component.js +104 -89
  106. package/dist/app/panels/a11y/severity.d.ts +9 -0
  107. package/dist/app/panels/a11y/severity.d.ts.map +1 -0
  108. package/dist/app/panels/a11y/severity.js +12 -0
  109. package/dist/app/panels/controls/controls-plugin.d.ts.map +1 -1
  110. package/dist/app/panels/controls/controls-plugin.js +1 -2
  111. package/dist/app/panels/controls/non-editable-input-types.d.ts +9 -1
  112. package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -1
  113. package/dist/app/panels/controls/non-editable-input-types.js +18 -0
  114. package/dist/app/panels/controls/prism-controls-panel.component.d.ts +2 -1
  115. package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
  116. package/dist/app/panels/controls/prism-controls-panel.component.js +77 -59
  117. package/dist/app/panels/events/events-plugin.d.ts.map +1 -1
  118. package/dist/app/panels/events/events-plugin.js +1 -2
  119. package/dist/app/panels/events/prism-events-panel.component.d.ts +2 -0
  120. package/dist/app/panels/events/prism-events-panel.component.d.ts.map +1 -1
  121. package/dist/app/panels/events/prism-events-panel.component.js +20 -7
  122. package/dist/app/panels/events/prism-json-node.utils.d.ts +6 -0
  123. package/dist/app/panels/events/prism-json-node.utils.d.ts.map +1 -1
  124. package/dist/app/panels/events/prism-json-node.utils.js +8 -0
  125. package/dist/app/panels/panel-host/addon-panels.d.ts +11 -0
  126. package/dist/app/panels/panel-host/addon-panels.d.ts.map +1 -0
  127. package/dist/app/panels/panel-host/addon-panels.js +12 -0
  128. package/dist/app/panels/panel-host/panel-badge.d.ts +22 -0
  129. package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
  130. package/dist/app/panels/panel-host/panel-badge.js +56 -11
  131. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +4 -1
  132. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
  133. package/dist/app/panels/panel-host/prism-panel-host.component.js +36 -70
  134. package/dist/app/pseudo/pseudo-state-marker.d.ts +32 -10
  135. package/dist/app/pseudo/pseudo-state-marker.d.ts.map +1 -1
  136. package/dist/app/pseudo/pseudo-state-marker.js +83 -67
  137. package/dist/app/pseudo/pseudo-targets.d.ts +11 -0
  138. package/dist/app/pseudo/pseudo-targets.d.ts.map +1 -0
  139. package/dist/app/pseudo/pseudo-targets.js +46 -0
  140. package/dist/app/pseudo/state-fit.d.ts +28 -0
  141. package/dist/app/pseudo/state-fit.d.ts.map +1 -0
  142. package/dist/app/pseudo/state-fit.js +97 -0
  143. package/dist/app/renderer/composition.d.ts +20 -0
  144. package/dist/app/renderer/composition.d.ts.map +1 -0
  145. package/dist/app/renderer/composition.js +26 -0
  146. package/dist/app/renderer/input-bindings.d.ts +28 -0
  147. package/dist/app/renderer/input-bindings.d.ts.map +1 -0
  148. package/dist/app/renderer/input-bindings.js +42 -0
  149. package/dist/app/renderer/known-inputs.d.ts +8 -1
  150. package/dist/app/renderer/known-inputs.d.ts.map +1 -1
  151. package/dist/app/renderer/known-inputs.js +13 -5
  152. package/dist/app/renderer/prism-renderer.component.d.ts +18 -4
  153. package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
  154. package/dist/app/renderer/prism-renderer.component.js +78 -44
  155. package/dist/app/renderer/projectable-content.d.ts +8 -1
  156. package/dist/app/renderer/projectable-content.d.ts.map +1 -1
  157. package/dist/app/renderer/projectable-content.js +40 -29
  158. package/dist/app/renderer/rendered-key.d.ts +20 -6
  159. package/dist/app/renderer/rendered-key.d.ts.map +1 -1
  160. package/dist/app/renderer/rendered-key.js +25 -8
  161. package/dist/app/renderer/snippet-generator.d.ts +14 -2
  162. package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
  163. package/dist/app/renderer/snippet-generator.js +138 -81
  164. package/dist/app/services/navigation-item.d.ts +10 -0
  165. package/dist/app/services/navigation-item.d.ts.map +1 -0
  166. package/dist/app/services/navigation-item.js +20 -0
  167. package/dist/app/services/navigation-item.types.d.ts +8 -0
  168. package/dist/app/services/navigation-item.types.d.ts.map +1 -1
  169. package/dist/app/services/prism-layout.service.d.ts +12 -0
  170. package/dist/app/services/prism-layout.service.d.ts.map +1 -1
  171. package/dist/app/services/prism-layout.service.js +17 -7
  172. package/dist/app/services/prism-manifest.service.d.ts +4 -0
  173. package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
  174. package/dist/app/services/prism-manifest.service.js +4 -0
  175. package/dist/app/services/prism-navigation.service.d.ts +12 -0
  176. package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
  177. package/dist/app/services/prism-navigation.service.js +85 -19
  178. package/dist/app/services/prism-panel.service.d.ts +7 -3
  179. package/dist/app/services/prism-panel.service.d.ts.map +1 -1
  180. package/dist/app/services/prism-panel.service.js +13 -4
  181. package/dist/app/services/prism-pseudo-state.service.d.ts +59 -14
  182. package/dist/app/services/prism-pseudo-state.service.d.ts.map +1 -1
  183. package/dist/app/services/prism-pseudo-state.service.js +86 -29
  184. package/dist/app/services/prism-renderer.service.d.ts +23 -0
  185. package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
  186. package/dist/app/services/prism-renderer.service.js +77 -8
  187. package/dist/app/services/prism-search.service.d.ts +4 -0
  188. package/dist/app/services/prism-search.service.d.ts.map +1 -1
  189. package/dist/app/services/prism-search.service.js +29 -6
  190. package/dist/app/services/prism-theme.service.d.ts +11 -3
  191. package/dist/app/services/prism-theme.service.d.ts.map +1 -1
  192. package/dist/app/services/prism-theme.service.js +27 -19
  193. package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
  194. package/dist/app/services/prism-url-state.service.js +81 -12
  195. package/dist/app/shared/badge.types.d.ts +7 -0
  196. package/dist/app/shared/badge.types.d.ts.map +1 -0
  197. package/dist/app/shared/badge.types.js +9 -0
  198. package/dist/app/shared/brand-mark.d.ts +35 -0
  199. package/dist/app/shared/brand-mark.d.ts.map +1 -0
  200. package/dist/app/shared/brand-mark.js +52 -0
  201. package/dist/app/shared/metric-bar.d.ts +6 -0
  202. package/dist/app/shared/metric-bar.d.ts.map +1 -0
  203. package/dist/app/shared/metric-bar.js +7 -0
  204. package/dist/app/shared/prism-badge.component.d.ts +21 -0
  205. package/dist/app/shared/prism-badge.component.d.ts.map +1 -0
  206. package/dist/app/shared/prism-badge.component.js +68 -0
  207. package/dist/app/shared/prism-button.component.d.ts +12 -0
  208. package/dist/app/shared/prism-button.component.d.ts.map +1 -0
  209. package/dist/app/shared/prism-button.component.js +28 -0
  210. package/dist/app/shared/prism-icon-button.component.d.ts +17 -0
  211. package/dist/app/shared/prism-icon-button.component.d.ts.map +1 -0
  212. package/dist/app/shared/prism-icon-button.component.js +37 -0
  213. package/dist/app/shared/prism-list-row.component.d.ts +17 -0
  214. package/dist/app/shared/prism-list-row.component.d.ts.map +1 -0
  215. package/dist/app/shared/prism-list-row.component.js +57 -0
  216. package/dist/app/shared/prism-logo.component.d.ts +24 -0
  217. package/dist/app/shared/prism-logo.component.d.ts.map +1 -0
  218. package/dist/app/shared/prism-logo.component.js +77 -0
  219. package/dist/app/shared/prism-metric-badge.component.d.ts +9 -4
  220. package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
  221. package/dist/app/shared/prism-metric-badge.component.js +33 -12
  222. package/dist/app/shared/prism-metric-card.component.d.ts +30 -0
  223. package/dist/app/shared/prism-metric-card.component.d.ts.map +1 -0
  224. package/dist/app/shared/prism-metric-card.component.js +111 -0
  225. package/dist/app/shared/prism-panel-toolbar.component.d.ts +13 -0
  226. package/dist/app/shared/prism-panel-toolbar.component.d.ts.map +1 -0
  227. package/dist/app/shared/prism-panel-toolbar.component.js +28 -0
  228. package/dist/app/shared/prism-segmented.component.d.ts +25 -0
  229. package/dist/app/shared/prism-segmented.component.d.ts.map +1 -0
  230. package/dist/app/shared/prism-segmented.component.js +77 -0
  231. package/dist/app/shared/prism-tabs.component.d.ts +44 -0
  232. package/dist/app/shared/prism-tabs.component.d.ts.map +1 -0
  233. package/dist/app/shared/prism-tabs.component.js +134 -0
  234. package/dist/app/shared/roving-focus.d.ts +13 -0
  235. package/dist/app/shared/roving-focus.d.ts.map +1 -0
  236. package/dist/app/shared/roving-focus.js +34 -0
  237. package/dist/app/shell/prism-shell.component.d.ts +13 -0
  238. package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
  239. package/dist/app/shell/prism-shell.component.js +57 -28
  240. package/dist/app/shell/should-select-first.d.ts +17 -0
  241. package/dist/app/shell/should-select-first.d.ts.map +1 -0
  242. package/dist/app/shell/should-select-first.js +13 -0
  243. package/dist/app/sidebar/navigation-decorations.d.ts +23 -1
  244. package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
  245. package/dist/app/sidebar/navigation-decorations.js +33 -2
  246. package/dist/app/sidebar/prism-sidebar.component.d.ts +5 -15
  247. package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
  248. package/dist/app/sidebar/prism-sidebar.component.js +89 -77
  249. package/dist/app/theme/deprecated-tokens.d.ts +15 -0
  250. package/dist/app/theme/deprecated-tokens.d.ts.map +1 -0
  251. package/dist/app/theme/deprecated-tokens.js +22 -0
  252. package/dist/app/theme/favicon.d.ts +3 -0
  253. package/dist/app/theme/favicon.d.ts.map +1 -0
  254. package/dist/app/theme/favicon.js +3 -0
  255. package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
  256. package/dist/app/theme/prism-default-theme.js +122 -66
  257. package/dist/app/theme/resolve-theme-tokens.d.ts +29 -0
  258. package/dist/app/theme/resolve-theme-tokens.d.ts.map +1 -0
  259. package/dist/app/theme/resolve-theme-tokens.js +43 -0
  260. package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts +4 -7
  261. package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
  262. package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +31 -69
  263. package/dist/app/view-tab-bar/next-view-id.d.ts +7 -1
  264. package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -1
  265. package/dist/app/view-tab-bar/next-view-id.js +9 -1
  266. package/dist/app/view-tab-bar/panel-inputs.d.ts +28 -0
  267. package/dist/app/view-tab-bar/panel-inputs.d.ts.map +1 -0
  268. package/dist/app/view-tab-bar/panel-inputs.js +41 -0
  269. package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts +2 -3
  270. package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
  271. package/dist/app/view-tab-bar/prism-view-panel-host.component.js +9 -9
  272. package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts +6 -0
  273. package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
  274. package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +22 -29
  275. package/dist/builder/config-loader/deprecated-options.d.ts +9 -0
  276. package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -0
  277. package/dist/builder/config-loader/deprecated-options.js +34 -0
  278. package/dist/builder/manifest/composition-wrapper.generator.d.ts +14 -0
  279. package/dist/builder/manifest/composition-wrapper.generator.d.ts.map +1 -0
  280. package/dist/builder/manifest/composition-wrapper.generator.js +66 -0
  281. package/dist/builder/manifest/host-parser.d.ts +2 -0
  282. package/dist/builder/manifest/host-parser.d.ts.map +1 -1
  283. package/dist/builder/manifest/host-parser.js +9 -4
  284. package/dist/builder/manifest/manifest-imports.d.ts +34 -0
  285. package/dist/builder/manifest/manifest-imports.d.ts.map +1 -0
  286. package/dist/builder/manifest/manifest-imports.js +91 -0
  287. package/dist/builder/manifest/runtime-manifest.generator.d.ts +13 -0
  288. package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
  289. package/dist/builder/manifest/runtime-manifest.generator.js +137 -65
  290. package/dist/builder/manifest/selector-element.d.ts +16 -0
  291. package/dist/builder/manifest/selector-element.d.ts.map +1 -0
  292. package/dist/builder/manifest/selector-element.js +46 -0
  293. package/dist/builder/manifest/template-literal.d.ts +3 -0
  294. package/dist/builder/manifest/template-literal.d.ts.map +1 -0
  295. package/dist/builder/manifest/template-literal.js +4 -0
  296. package/dist/builder/plugin-runner/plugin-runner.d.ts.map +1 -1
  297. package/dist/builder/plugin-runner/plugin-runner.js +29 -26
  298. package/dist/builder/scanner/api/angular-decorators.d.ts +84 -0
  299. package/dist/builder/scanner/api/angular-decorators.d.ts.map +1 -0
  300. package/dist/builder/scanner/api/angular-decorators.js +157 -0
  301. package/dist/builder/scanner/api/component-api.extractor.d.ts +13 -0
  302. package/dist/builder/scanner/api/component-api.extractor.d.ts.map +1 -0
  303. package/dist/builder/scanner/api/component-api.extractor.js +104 -0
  304. package/dist/builder/scanner/api/doc-tags.d.ts +13 -0
  305. package/dist/builder/scanner/api/doc-tags.d.ts.map +1 -0
  306. package/dist/builder/scanner/api/doc-tags.js +101 -0
  307. package/dist/builder/scanner/api/export-index.d.ts +18 -0
  308. package/dist/builder/scanner/api/export-index.d.ts.map +1 -0
  309. package/dist/builder/scanner/api/export-index.js +22 -0
  310. package/dist/builder/scanner/api/member.extractor.d.ts +90 -0
  311. package/dist/builder/scanner/api/member.extractor.d.ts.map +1 -0
  312. package/dist/builder/scanner/api/member.extractor.js +270 -0
  313. package/dist/builder/scanner/api/pipe-api.extractor.d.ts +12 -0
  314. package/dist/builder/scanner/api/pipe-api.extractor.d.ts.map +1 -0
  315. package/dist/builder/scanner/api/pipe-api.extractor.js +52 -0
  316. package/dist/builder/scanner/api/service-api.extractor.d.ts +14 -0
  317. package/dist/builder/scanner/api/service-api.extractor.d.ts.map +1 -0
  318. package/dist/builder/scanner/api/service-api.extractor.js +119 -0
  319. package/dist/builder/scanner/api/setup.reader.d.ts +26 -0
  320. package/dist/builder/scanner/api/setup.reader.d.ts.map +1 -0
  321. package/dist/builder/scanner/api/setup.reader.js +89 -0
  322. package/dist/builder/scanner/api/type-collector.d.ts +24 -0
  323. package/dist/builder/scanner/api/type-collector.d.ts.map +1 -0
  324. package/dist/builder/scanner/api/type-collector.js +211 -0
  325. package/dist/builder/scanner/ast-utils.d.ts +8 -0
  326. package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
  327. package/dist/builder/scanner/ast-utils.js +37 -1
  328. package/dist/builder/scanner/class-hierarchy.d.ts +5 -3
  329. package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -1
  330. package/dist/builder/scanner/class-hierarchy.js +12 -6
  331. package/dist/builder/scanner/component.scanner.d.ts +60 -6
  332. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  333. package/dist/builder/scanner/component.scanner.js +229 -58
  334. package/dist/builder/scanner/composition/compose-template.d.ts +36 -0
  335. package/dist/builder/scanner/composition/compose-template.d.ts.map +1 -0
  336. package/dist/builder/scanner/composition/compose-template.js +187 -0
  337. package/dist/builder/scanner/composition/declarables.d.ts +54 -0
  338. package/dist/builder/scanner/composition/declarables.d.ts.map +1 -0
  339. package/dist/builder/scanner/composition/declarables.js +182 -0
  340. package/dist/builder/scanner/composition/match-declarables.d.ts +43 -0
  341. package/dist/builder/scanner/composition/match-declarables.d.ts.map +1 -0
  342. package/dist/builder/scanner/composition/match-declarables.js +131 -0
  343. package/dist/builder/scanner/composition/read-composition.d.ts +77 -0
  344. package/dist/builder/scanner/composition/read-composition.d.ts.map +1 -0
  345. package/dist/builder/scanner/composition/read-composition.js +302 -0
  346. package/dist/builder/scanner/composition/template-elements.d.ts +12 -0
  347. package/dist/builder/scanner/composition/template-elements.d.ts.map +1 -0
  348. package/dist/builder/scanner/composition/template-elements.js +41 -0
  349. package/dist/builder/scanner/entry-point-discovery.d.ts +5 -0
  350. package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
  351. package/dist/builder/scanner/entry-point-discovery.js +14 -0
  352. package/dist/builder/scanner/entry-point.scanner.d.ts +3 -1
  353. package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
  354. package/dist/builder/scanner/entry-point.scanner.js +7 -6
  355. package/dist/builder/scanner/index.d.ts +4 -0
  356. package/dist/builder/scanner/index.d.ts.map +1 -1
  357. package/dist/builder/scanner/index.js +2 -0
  358. package/dist/builder/scanner/input.extractor.d.ts +31 -2
  359. package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
  360. package/dist/builder/scanner/input.extractor.js +73 -17
  361. package/dist/builder/scanner/pipe.scanner.d.ts +29 -0
  362. package/dist/builder/scanner/pipe.scanner.d.ts.map +1 -0
  363. package/dist/builder/scanner/pipe.scanner.js +65 -0
  364. package/dist/builder/scanner/pseudo-states.d.ts +1 -0
  365. package/dist/builder/scanner/pseudo-states.d.ts.map +1 -1
  366. package/dist/builder/scanner/pseudo-states.js +1 -1
  367. package/dist/builder/scanner/scanner.d.ts +27 -3
  368. package/dist/builder/scanner/scanner.d.ts.map +1 -1
  369. package/dist/builder/scanner/scanner.js +68 -24
  370. package/dist/builder/scanner/service/angular-decorators.d.ts +80 -0
  371. package/dist/builder/scanner/service/angular-decorators.d.ts.map +1 -0
  372. package/dist/builder/scanner/service/angular-decorators.js +154 -0
  373. package/dist/builder/scanner/service/doc-tags.d.ts +13 -0
  374. package/dist/builder/scanner/service/doc-tags.d.ts.map +1 -0
  375. package/dist/builder/scanner/service/doc-tags.js +97 -0
  376. package/dist/builder/scanner/service/export-index.d.ts +18 -0
  377. package/dist/builder/scanner/service/export-index.d.ts.map +1 -0
  378. package/dist/builder/scanner/service/export-index.js +22 -0
  379. package/dist/builder/scanner/service/member.extractor.d.ts +65 -0
  380. package/dist/builder/scanner/service/member.extractor.d.ts.map +1 -0
  381. package/dist/builder/scanner/service/member.extractor.js +216 -0
  382. package/dist/builder/scanner/service/pipe-api.extractor.d.ts +12 -0
  383. package/dist/builder/scanner/service/pipe-api.extractor.d.ts.map +1 -0
  384. package/dist/builder/scanner/service/pipe-api.extractor.js +72 -0
  385. package/dist/builder/scanner/service/service-api.extractor.d.ts +14 -0
  386. package/dist/builder/scanner/service/service-api.extractor.d.ts.map +1 -0
  387. package/dist/builder/scanner/service/service-api.extractor.js +119 -0
  388. package/dist/builder/scanner/service/setup.reader.d.ts +26 -0
  389. package/dist/builder/scanner/service/setup.reader.d.ts.map +1 -0
  390. package/dist/builder/scanner/service/setup.reader.js +89 -0
  391. package/dist/builder/scanner/service/type-collector.d.ts +23 -0
  392. package/dist/builder/scanner/service/type-collector.d.ts.map +1 -0
  393. package/dist/builder/scanner/service/type-collector.js +210 -0
  394. package/dist/builder/scanner/service.scanner.d.ts +26 -0
  395. package/dist/builder/scanner/service.scanner.d.ts.map +1 -0
  396. package/dist/builder/scanner/service.scanner.js +61 -0
  397. package/dist/builder/scanner/showcase-diagnostics.d.ts +60 -1
  398. package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -1
  399. package/dist/builder/scanner/showcase-diagnostics.js +123 -10
  400. package/dist/builder/scanner/showcase-states.d.ts +17 -0
  401. package/dist/builder/scanner/showcase-states.d.ts.map +1 -0
  402. package/dist/builder/scanner/showcase-states.js +58 -0
  403. package/dist/builder/scanner/source-file-cache.d.ts +26 -0
  404. package/dist/builder/scanner/source-file-cache.d.ts.map +1 -0
  405. package/dist/builder/scanner/source-file-cache.js +60 -0
  406. package/dist/builder/shared/prism-pipeline.d.ts +6 -0
  407. package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
  408. package/dist/builder/shared/prism-pipeline.js +71 -18
  409. package/dist/decorator/index.d.ts +1 -1
  410. package/dist/decorator/index.d.ts.map +1 -1
  411. package/dist/decorator/showcase.types.d.ts +102 -9
  412. package/dist/decorator/showcase.types.d.ts.map +1 -1
  413. package/dist/plugin/index.d.ts +6 -1
  414. package/dist/plugin/index.d.ts.map +1 -1
  415. package/dist/plugin/index.js +4 -0
  416. package/dist/plugin/pipe.types.d.ts +36 -0
  417. package/dist/plugin/pipe.types.d.ts.map +1 -0
  418. package/dist/plugin/pipe.types.js +1 -0
  419. package/dist/plugin/plugin.types.d.ts +184 -8
  420. package/dist/plugin/plugin.types.d.ts.map +1 -1
  421. package/dist/plugin/service.types.d.ts +124 -0
  422. package/dist/plugin/service.types.d.ts.map +1 -0
  423. package/dist/plugin/service.types.js +1 -0
  424. package/dist/plugin/status.d.ts +27 -0
  425. package/dist/plugin/status.d.ts.map +1 -0
  426. package/dist/plugin/status.js +26 -0
  427. package/dist/shared/composition.d.ts +30 -0
  428. package/dist/shared/composition.d.ts.map +1 -0
  429. package/dist/shared/composition.js +29 -0
  430. package/dist/shared/pseudo-state.type.d.ts +2 -1
  431. package/dist/shared/pseudo-state.type.d.ts.map +1 -1
  432. package/dist/shared/void-elements.d.ts +3 -0
  433. package/dist/shared/void-elements.d.ts.map +1 -0
  434. package/dist/shared/void-elements.js +2 -0
  435. package/package.json +1 -1
  436. package/src/builder/build/schema.json +6 -6
  437. package/src/builder/serve/schema.json +6 -6
@@ -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,14 +68,89 @@ 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
  }
52
- /** A variant is named by its `name` as well as its index, since that is what the styleguide shows. */
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
+ }
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;
55
- if (head !== 'variants' || typeof index !== 'number')
149
+ if ((head !== 'variants' && head !== 'states') || typeof index !== 'number')
56
150
  return formatPath(path);
57
- const name = variantName(config, index);
58
- const variant = name === undefined ? `variants[${index}]` : `variants[${index}] ${JSON.stringify(name)}`;
59
- return rest.length === 0 ? variant : `${variant} › ${formatPath(rest)}`;
151
+ const name = elementName(config, head, index);
152
+ const element = name === undefined ? `${head}[${index}]` : `${head}[${index}] ${JSON.stringify(name)}`;
153
+ return rest.length === 0 ? element : `${element} › ${formatPath(rest)}`;
60
154
  }
61
155
  function formatPath(path) {
62
156
  return path
@@ -70,13 +164,32 @@ function formatPath(path) {
70
164
  .join('');
71
165
  }
72
166
  /** Read from the source, because the evaluated array has already lost the elements before the index. */
73
- function variantName(config, index) {
74
- const variants = ts.isObjectLiteralExpression(config) ? findInitializer(config, 'variants') : undefined;
75
- const variant = variants && ts.isArrayLiteralExpression(variants) ? variants.elements[index] : undefined;
76
- const name = variant && ts.isObjectLiteralExpression(variant) ? findInitializer(variant, 'name') : undefined;
167
+ function elementName(config, key, index) {
168
+ const elements = ts.isObjectLiteralExpression(config) ? findInitializer(config, key) : undefined;
169
+ const element = elements && ts.isArrayLiteralExpression(elements) ? elements.elements[index] : undefined;
170
+ const name = element && ts.isObjectLiteralExpression(element) ? findInitializer(element, 'name') : undefined;
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
  }
@@ -0,0 +1,17 @@
1
+ import type { ShowcaseState } from '../../decorator/showcase.types.js';
2
+ /**
3
+ * `ShowcaseConfig.states` as the scanner evaluated it, with everything it
4
+ * cannot use reported. `undefined` when it is no list, or an empty one.
5
+ *
6
+ * Every slot of the list survives, because a state is identified by its
7
+ * position (the URL, the marker and the discovery manifest use it): an
8
+ * unusable entry becomes a state without pseudo states, which the styleguide
9
+ * shows as an empty column, instead of shifting the entries behind it.
10
+ * A state without a usable name is called `State <position>`.
11
+ *
12
+ * `unevaluable` holds the source positions of the entries the evaluator could
13
+ * not read at all. They are missing from `value`, so an empty slot goes back
14
+ * in at each of them, without a message of its own.
15
+ */
16
+ export declare function readShowcaseStates(value: unknown, className: string, report: (message: string) => void, unevaluable?: ReadonlySet<number>): ShowcaseState[] | undefined;
17
+ //# sourceMappingURL=showcase-states.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"showcase-states.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/showcase-states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAUvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EACjC,WAAW,GAAE,WAAW,CAAC,MAAM,CAAa,GAC7C,aAAa,EAAE,GAAG,SAAS,CA4C7B"}
@@ -0,0 +1,58 @@
1
+ import { describeValue, readPseudoStates } from './pseudo-states.js';
2
+ function isEmptyObject(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).length === 0;
4
+ }
5
+ /** Stands in for a state the evaluator dropped, which its own diagnostic already explains. */
6
+ const GAP = Symbol('unevaluable state');
7
+ /**
8
+ * `ShowcaseConfig.states` as the scanner evaluated it, with everything it
9
+ * cannot use reported. `undefined` when it is no list, or an empty one.
10
+ *
11
+ * Every slot of the list survives, because a state is identified by its
12
+ * position (the URL, the marker and the discovery manifest use it): an
13
+ * unusable entry becomes a state without pseudo states, which the styleguide
14
+ * shows as an empty column, instead of shifting the entries behind it.
15
+ * A state without a usable name is called `State <position>`.
16
+ *
17
+ * `unevaluable` holds the source positions of the entries the evaluator could
18
+ * not read at all. They are missing from `value`, so an empty slot goes back
19
+ * in at each of them, without a message of its own.
20
+ */
21
+ export function readShowcaseStates(value, className, report, unevaluable = new Set()) {
22
+ if (!Array.isArray(value)) {
23
+ report(`${className} declares invalid states ${describeValue(value)}, expected a list of { name, pseudo }. Skipping.`);
24
+ return undefined;
25
+ }
26
+ const entries = [...value];
27
+ // Ascending, so that each position is already the one the source gives it once the earlier gaps are back.
28
+ for (const index of [...unevaluable].sort((a, b) => a - b))
29
+ entries.splice(index, 0, GAP);
30
+ if (entries.length === 0)
31
+ return undefined;
32
+ const firstIndexOfName = new Map();
33
+ return entries.map((entry, index) => {
34
+ const state = typeof entry === 'object' && entry !== null && !Array.isArray(entry) ? entry : undefined;
35
+ const declaredName = state?.['name'];
36
+ const hasName = typeof declaredName === 'string' && declaredName.trim() !== '';
37
+ if (state && !hasName)
38
+ report(`${className} states[${index}] has no name, expected a non-empty string. Calling it "State ${index + 1}".`);
39
+ else if (!state && entry !== GAP)
40
+ report(`${className} states[${index}] is ${describeValue(entry)}, expected { name, pseudo }. Its column stays empty.`);
41
+ const name = hasName ? declaredName : `State ${index + 1}`;
42
+ const first = firstIndexOfName.get(name);
43
+ if (first !== undefined) {
44
+ report(`${className} state "${name}" repeats the name of states[${first}]; only the first one is used. Its column stays empty.`);
45
+ return { name, pseudo: {} };
46
+ }
47
+ firstIndexOfName.set(name, index);
48
+ if (!state)
49
+ return { name, pseudo: {} };
50
+ const pseudo = state['pseudo'];
51
+ // `readPseudoStates` reports what it drops, but an empty object has nothing to drop.
52
+ if (pseudo === undefined || isEmptyObject(pseudo)) {
53
+ report(`${className} state "${name}" declares no pseudo states. Its column stays empty.`);
54
+ return { name, pseudo: {} };
55
+ }
56
+ return { name, pseudo: readPseudoStates(pseudo, `${className} state "${name}"`, report) ?? {} };
57
+ });
58
+ }
@@ -0,0 +1,26 @@
1
+ import ts from 'typescript';
2
+ export interface SourceFileCache {
3
+ /** Pass to `ts.createProgram` together with the previous program. */
4
+ host: ts.CompilerHost;
5
+ /** Drop every cached file the given program no longer contains. */
6
+ prune(program: ts.Program): void;
7
+ }
8
+ /**
9
+ * A compiler host that hands out the same `SourceFile` for a file that has
10
+ * not changed since it was last parsed.
11
+ *
12
+ * `ts.createProgram(…, oldProgram)` only reuses a file from the old program
13
+ * when the host returns the identical object. The default host reads and
14
+ * parses on every call, so without this cache each rebuild re-parses the
15
+ * whole program, Angular's typings included.
16
+ *
17
+ * A file counts as unchanged while its mtime and size are. An edit that keeps
18
+ * the size and lands within the file system's mtime resolution goes unseen;
19
+ * APFS and ext4 record nanoseconds, so in practice that does not happen.
20
+ *
21
+ * Module resolutions are recomputed on every program. Reusing them would
22
+ * miss a file created after an import of it had already failed to resolve,
23
+ * because the importing file itself has not changed.
24
+ */
25
+ export declare function createSourceFileCache(compilerOptions: ts.CompilerOptions): SourceFileCache;
26
+ //# sourceMappingURL=source-file-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-cache.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/source-file-cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC5B,qEAAqE;IACrE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC;IACtB,mEAAmE;IACnE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC;CACpC;AAOD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,EAAE,CAAC,eAAe,GAAG,eAAe,CAmC1F"}
@@ -0,0 +1,60 @@
1
+ import { statSync } from 'fs';
2
+ import ts from 'typescript';
3
+ /**
4
+ * A compiler host that hands out the same `SourceFile` for a file that has
5
+ * not changed since it was last parsed.
6
+ *
7
+ * `ts.createProgram(…, oldProgram)` only reuses a file from the old program
8
+ * when the host returns the identical object. The default host reads and
9
+ * parses on every call, so without this cache each rebuild re-parses the
10
+ * whole program, Angular's typings included.
11
+ *
12
+ * A file counts as unchanged while its mtime and size are. An edit that keeps
13
+ * the size and lands within the file system's mtime resolution goes unseen;
14
+ * APFS and ext4 record nanoseconds, so in practice that does not happen.
15
+ *
16
+ * Module resolutions are recomputed on every program. Reusing them would
17
+ * miss a file created after an import of it had already failed to resolve,
18
+ * because the importing file itself has not changed.
19
+ */
20
+ export function createSourceFileCache(compilerOptions) {
21
+ const host = ts.createCompilerHost(compilerOptions);
22
+ const parse = host.getSourceFile.bind(host);
23
+ const cache = new Map();
24
+ host.getSourceFile = (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) => {
25
+ const stamp = readStamp(fileName);
26
+ if (stamp === undefined) {
27
+ cache.delete(fileName);
28
+ return undefined;
29
+ }
30
+ const cached = cache.get(fileName);
31
+ if (cached?.stamp === stamp && !shouldCreateNewSourceFile)
32
+ return cached.sourceFile;
33
+ const sourceFile = parse(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile);
34
+ if (sourceFile)
35
+ cache.set(fileName, { stamp, sourceFile });
36
+ else
37
+ cache.delete(fileName);
38
+ return sourceFile;
39
+ };
40
+ host.hasInvalidatedResolutions = () => true;
41
+ return {
42
+ host,
43
+ prune(program) {
44
+ const live = new Set(program.getSourceFiles().map((sf) => sf.fileName));
45
+ for (const fileName of cache.keys()) {
46
+ if (!live.has(fileName))
47
+ cache.delete(fileName);
48
+ }
49
+ }
50
+ };
51
+ }
52
+ function readStamp(fileName) {
53
+ try {
54
+ const { mtimeMs, size } = statSync(fileName);
55
+ return `${mtimeMs}:${size}`;
56
+ }
57
+ catch {
58
+ return undefined;
59
+ }
60
+ }
@@ -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;AAShE,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,CAuFtJ"}
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"}