@ng-prism/core 22.2.1 → 22.4.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 (359) hide show
  1. package/README.md +34 -36
  2. package/builders.json +11 -11
  3. package/dist/app/canvas/canvas-bg.styles.d.ts +7 -12
  4. package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
  5. package/dist/app/canvas/canvas-bg.styles.js +37 -22
  6. package/dist/app/canvas/measure-geometry.d.ts +140 -0
  7. package/dist/app/canvas/measure-geometry.d.ts.map +1 -0
  8. package/dist/app/canvas/measure-geometry.js +217 -0
  9. package/dist/app/canvas/measure-keyboard.d.ts +20 -0
  10. package/dist/app/canvas/measure-keyboard.d.ts.map +1 -0
  11. package/dist/app/canvas/measure-keyboard.js +34 -0
  12. package/dist/app/canvas/measure-quad.d.ts +114 -0
  13. package/dist/app/canvas/measure-quad.d.ts.map +1 -0
  14. package/dist/app/canvas/measure-quad.js +173 -0
  15. package/dist/app/canvas/measure-snap.d.ts +35 -0
  16. package/dist/app/canvas/measure-snap.d.ts.map +1 -0
  17. package/dist/app/canvas/measure-snap.js +63 -0
  18. package/dist/app/canvas/prism-canvas-bg-pill.component.d.ts.map +1 -1
  19. package/dist/app/canvas/prism-canvas-bg-pill.component.js +3 -18
  20. package/dist/app/canvas/prism-canvas-measure.component.d.ts +142 -0
  21. package/dist/app/canvas/prism-canvas-measure.component.d.ts.map +1 -0
  22. package/dist/app/canvas/prism-canvas-measure.component.js +554 -0
  23. package/dist/app/canvas/prism-canvas-pin-row.component.d.ts +23 -0
  24. package/dist/app/canvas/prism-canvas-pin-row.component.d.ts.map +1 -0
  25. package/dist/app/canvas/prism-canvas-pin-row.component.js +64 -0
  26. package/dist/app/canvas/prism-canvas-rulers.component.d.ts +1 -0
  27. package/dist/app/canvas/prism-canvas-rulers.component.d.ts.map +1 -1
  28. package/dist/app/canvas/prism-canvas-rulers.component.js +9 -14
  29. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +28 -28
  30. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  31. package/dist/app/canvas/prism-canvas-toolbar.component.js +124 -162
  32. package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -1
  33. package/dist/app/canvas/prism-template-popover.component.js +8 -49
  34. package/dist/app/canvas/viewport-snap.d.ts +12 -0
  35. package/dist/app/canvas/viewport-snap.d.ts.map +1 -0
  36. package/dist/app/canvas/viewport-snap.js +23 -0
  37. package/dist/app/component-head/head-metrics.d.ts +2 -2
  38. package/dist/app/component-head/head-metrics.d.ts.map +1 -1
  39. package/dist/app/component-head/head-metrics.js +3 -3
  40. package/dist/app/component-head/prism-component-head.component.d.ts +3 -3
  41. package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
  42. package/dist/app/component-head/prism-component-head.component.js +24 -64
  43. package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -1
  44. package/dist/app/component-head/prism-head-gauge.component.js +4 -36
  45. package/dist/app/component-head/prism-head-info.component.d.ts +1 -1
  46. package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
  47. package/dist/app/component-head/prism-head-info.component.js +4 -37
  48. package/dist/app/component-head/prism-stat.component.d.ts +1 -1
  49. package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
  50. package/dist/app/component-head/prism-stat.component.js +4 -15
  51. package/dist/app/controls/boolean-control.component.d.ts.map +1 -1
  52. package/dist/app/controls/boolean-control.component.js +4 -12
  53. package/dist/app/controls/json-control.component.d.ts.map +1 -1
  54. package/dist/app/controls/json-control.component.js +4 -24
  55. package/dist/app/controls/number-control.component.d.ts.map +1 -1
  56. package/dist/app/controls/number-control.component.js +4 -11
  57. package/dist/app/controls/string-control.component.d.ts.map +1 -1
  58. package/dist/app/controls/string-control.component.js +4 -11
  59. package/dist/app/controls/union-control.component.d.ts.map +1 -1
  60. package/dist/app/controls/union-control.component.js +4 -16
  61. package/dist/app/directives/prism-resizer.directive.d.ts +24 -1
  62. package/dist/app/directives/prism-resizer.directive.d.ts.map +1 -1
  63. package/dist/app/directives/prism-resizer.directive.js +44 -7
  64. package/dist/app/directives/resize-value.d.ts +22 -0
  65. package/dist/app/directives/resize-value.d.ts.map +1 -0
  66. package/dist/app/directives/resize-value.js +23 -0
  67. package/dist/app/discovery-manifest.d.ts +2 -2
  68. package/dist/app/discovery-manifest.d.ts.map +1 -1
  69. package/dist/app/discovery-manifest.js +16 -22
  70. package/dist/app/header/prism-header-widget-host.component.d.ts.map +1 -1
  71. package/dist/app/header/prism-header-widget-host.component.js +4 -8
  72. package/dist/app/header/prism-header.component.d.ts.map +1 -1
  73. package/dist/app/header/prism-header.component.js +9 -78
  74. package/dist/app/hmr.d.ts.map +1 -1
  75. package/dist/app/icons/icon-registry.d.ts +2 -2
  76. package/dist/app/icons/icon-registry.d.ts.map +1 -1
  77. package/dist/app/icons/icon-registry.js +5 -3
  78. package/dist/app/icons/prism-icon.component.d.ts +2 -2
  79. package/dist/app/icons/prism-icon.component.d.ts.map +1 -1
  80. package/dist/app/icons/prism-icon.component.js +9 -9
  81. package/dist/app/index.d.ts +3 -3
  82. package/dist/app/index.d.ts.map +1 -1
  83. package/dist/app/index.js +17 -24
  84. package/dist/app/layout-menu/prism-layout-menu.component.d.ts.map +1 -1
  85. package/dist/app/layout-menu/prism-layout-menu.component.js +3 -77
  86. package/dist/app/overview/overview-panel.js +1 -1
  87. package/dist/app/overview/overview-visibility.d.ts +1 -1
  88. package/dist/app/overview/overview-visibility.d.ts.map +1 -1
  89. package/dist/app/overview/overview-visibility.js +1 -1
  90. package/dist/app/overview/prism-overview-cell.component.d.ts +2 -2
  91. package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
  92. package/dist/app/overview/prism-overview-cell.component.js +17 -25
  93. package/dist/app/overview/prism-overview.component.d.ts +2 -2
  94. package/dist/app/overview/prism-overview.component.d.ts.map +1 -1
  95. package/dist/app/overview/prism-overview.component.js +6 -14
  96. package/dist/app/page-renderer/prism-page-renderer.component.d.ts.map +1 -1
  97. package/dist/app/page-renderer/prism-page-renderer.component.js +4 -17
  98. package/dist/app/panels/a11y/a11y-audit.service.d.ts.map +1 -1
  99. package/dist/app/panels/a11y/a11y-audit.service.js +14 -2
  100. package/dist/app/panels/a11y/a11y-core.plugin.d.ts.map +1 -1
  101. package/dist/app/panels/a11y/a11y-core.plugin.js +1 -1
  102. package/dist/app/panels/a11y/a11y-dom-utils.d.ts.map +1 -1
  103. package/dist/app/panels/a11y/a11y-dom-utils.js +9 -6
  104. package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
  105. package/dist/app/panels/a11y/a11y-header-badge.component.js +6 -22
  106. package/dist/app/panels/a11y/a11y-keyboard-overlay.component.d.ts.map +1 -1
  107. package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +6 -25
  108. package/dist/app/panels/a11y/a11y-keyboard.component.d.ts.map +1 -1
  109. package/dist/app/panels/a11y/a11y-keyboard.component.js +5 -36
  110. package/dist/app/panels/a11y/a11y-keyboard.service.d.ts.map +1 -1
  111. package/dist/app/panels/a11y/a11y-keyboard.service.js +2 -2
  112. package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts.map +1 -1
  113. package/dist/app/panels/a11y/a11y-overlay-host.component.js +5 -32
  114. package/dist/app/panels/a11y/a11y-panel-state.service.d.ts.map +1 -1
  115. package/dist/app/panels/a11y/a11y-panel.component.d.ts +1 -1
  116. package/dist/app/panels/a11y/a11y-panel.component.d.ts.map +1 -1
  117. package/dist/app/panels/a11y/a11y-panel.component.js +7 -69
  118. package/dist/app/panels/a11y/a11y-perspective.service.d.ts.map +1 -1
  119. package/dist/app/panels/a11y/a11y-score.component.d.ts.map +1 -1
  120. package/dist/app/panels/a11y/a11y-score.component.js +4 -31
  121. package/dist/app/panels/a11y/a11y-sr-overlay.component.d.ts.map +1 -1
  122. package/dist/app/panels/a11y/a11y-sr-overlay.component.js +8 -28
  123. package/dist/app/panels/a11y/a11y-sr.component.d.ts.map +1 -1
  124. package/dist/app/panels/a11y/a11y-sr.component.js +5 -28
  125. package/dist/app/panels/a11y/a11y-sr.service.d.ts.map +1 -1
  126. package/dist/app/panels/a11y/a11y-sr.service.js +4 -7
  127. package/dist/app/panels/a11y/a11y-summary.d.ts +3 -4
  128. package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
  129. package/dist/app/panels/a11y/a11y-summary.js +5 -9
  130. package/dist/app/panels/a11y/a11y-thresholds.d.ts +1 -1
  131. package/dist/app/panels/a11y/a11y-thresholds.d.ts.map +1 -1
  132. package/dist/app/panels/a11y/a11y-thresholds.js +2 -2
  133. package/dist/app/panels/a11y/a11y-tree.component.d.ts.map +1 -1
  134. package/dist/app/panels/a11y/a11y-tree.component.js +9 -46
  135. package/dist/app/panels/a11y/a11y-tree.service.d.ts.map +1 -1
  136. package/dist/app/panels/a11y/a11y-tree.service.js +3 -5
  137. package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
  138. package/dist/app/panels/a11y/a11y-violations.component.js +7 -58
  139. package/dist/app/panels/a11y/a11y.types.d.ts +1 -1
  140. package/dist/app/panels/a11y/a11y.types.d.ts.map +1 -1
  141. package/dist/app/panels/builtin-header-widgets.js +2 -2
  142. package/dist/app/panels/builtin-navigation-decorations.d.ts +1 -1
  143. package/dist/app/panels/builtin-navigation-decorations.d.ts.map +1 -1
  144. package/dist/app/panels/builtin-navigation-decorations.js +3 -3
  145. package/dist/app/panels/builtin-panels.d.ts.map +1 -1
  146. package/dist/app/panels/builtin-panels.js +2 -7
  147. package/dist/app/panels/controls/controls-plugin.js +3 -3
  148. package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -1
  149. package/dist/app/panels/controls/non-editable-input-types.js +2 -6
  150. package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
  151. package/dist/app/panels/controls/prism-controls-panel.component.js +5 -95
  152. package/dist/app/panels/events/events-plugin.js +3 -3
  153. package/dist/app/panels/events/prism-events-panel.component.d.ts.map +1 -1
  154. package/dist/app/panels/events/prism-events-panel.component.js +5 -23
  155. package/dist/app/panels/events/prism-json-node.component.d.ts.map +1 -1
  156. package/dist/app/panels/events/prism-json-node.component.js +4 -86
  157. package/dist/app/panels/events/prism-json-node.utils.d.ts.map +1 -1
  158. package/dist/app/panels/panel-host/panel-badge.d.ts +1 -1
  159. package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
  160. package/dist/app/panels/panel-host/panel-badge.js +2 -4
  161. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +1 -1
  162. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
  163. package/dist/app/panels/panel-host/prism-panel-host.component.js +12 -67
  164. package/dist/app/provide-prism.d.ts +1 -1
  165. package/dist/app/provide-prism.d.ts.map +1 -1
  166. package/dist/app/provide-prism.js +8 -12
  167. package/dist/app/renderer/known-inputs.d.ts +1 -1
  168. package/dist/app/renderer/known-inputs.d.ts.map +1 -1
  169. package/dist/app/renderer/known-inputs.js +1 -1
  170. package/dist/app/renderer/overlay-resolver.d.ts +17 -3
  171. package/dist/app/renderer/overlay-resolver.d.ts.map +1 -1
  172. package/dist/app/renderer/overlay-resolver.js +10 -5
  173. package/dist/app/renderer/prism-renderer.component.d.ts +28 -3
  174. package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
  175. package/dist/app/renderer/prism-renderer.component.js +107 -80
  176. package/dist/app/renderer/projectable-content.d.ts.map +1 -1
  177. package/dist/app/renderer/projectable-content.js +4 -6
  178. package/dist/app/renderer/snippet-generator.d.ts +1 -1
  179. package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
  180. package/dist/app/renderer/snippet-generator.js +7 -22
  181. package/dist/app/services/navigation-item.types.d.ts +1 -1
  182. package/dist/app/services/navigation-item.types.d.ts.map +1 -1
  183. package/dist/app/services/prism-canvas.service.d.ts +33 -0
  184. package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
  185. package/dist/app/services/prism-canvas.service.js +71 -6
  186. package/dist/app/services/prism-capture.service.d.ts +24 -50
  187. package/dist/app/services/prism-capture.service.d.ts.map +1 -1
  188. package/dist/app/services/prism-capture.service.js +62 -146
  189. package/dist/app/services/prism-event-log.service.d.ts.map +1 -1
  190. package/dist/app/services/prism-event-log.service.js +1 -4
  191. package/dist/app/services/prism-layout.service.d.ts.map +1 -1
  192. package/dist/app/services/prism-layout.service.js +5 -4
  193. package/dist/app/services/prism-manifest.service.d.ts +1 -1
  194. package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
  195. package/dist/app/services/prism-manifest.service.js +1 -1
  196. package/dist/app/services/prism-measure.service.d.ts +44 -0
  197. package/dist/app/services/prism-measure.service.d.ts.map +1 -0
  198. package/dist/app/services/prism-measure.service.js +91 -0
  199. package/dist/app/services/prism-navigation.service.d.ts +1 -1
  200. package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
  201. package/dist/app/services/prism-navigation.service.js +5 -13
  202. package/dist/app/services/prism-panel.service.d.ts +2 -2
  203. package/dist/app/services/prism-panel.service.d.ts.map +1 -1
  204. package/dist/app/services/prism-panel.service.js +4 -7
  205. package/dist/app/services/prism-persistence.service.d.ts.map +1 -1
  206. package/dist/app/services/prism-persistence.service.js +9 -11
  207. package/dist/app/services/prism-plugin.service.d.ts.map +1 -1
  208. package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
  209. package/dist/app/services/prism-renderer.service.js +5 -9
  210. package/dist/app/services/prism-search.service.d.ts.map +1 -1
  211. package/dist/app/services/prism-search.service.js +1 -2
  212. package/dist/app/services/prism-theme.service.d.ts.map +1 -1
  213. package/dist/app/services/prism-theme.service.js +6 -4
  214. package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
  215. package/dist/app/services/prism-url-state.service.js +4 -10
  216. package/dist/app/services/prism-variant-bg.service.d.ts +10 -24
  217. package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -1
  218. package/dist/app/services/prism-variant-bg.service.js +13 -29
  219. package/dist/app/shared/prism-metric-badge.component.d.ts +9 -15
  220. package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
  221. package/dist/app/shared/prism-metric-badge.component.js +13 -32
  222. package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
  223. package/dist/app/shell/prism-shell.component.js +26 -125
  224. package/dist/app/sidebar/navigation-decorations.d.ts +4 -4
  225. package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
  226. package/dist/app/sidebar/navigation-decorations.js +3 -3
  227. package/dist/app/sidebar/prism-sidebar.component.d.ts +3 -3
  228. package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
  229. package/dist/app/sidebar/prism-sidebar.component.js +21 -156
  230. package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
  231. package/dist/app/theme/prism-default-theme.js +6 -6
  232. package/dist/app/tokens/prism-tokens.d.ts.map +1 -1
  233. package/dist/app/tokens/prism-tokens.js +1 -1
  234. package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
  235. package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +4 -49
  236. package/dist/app/variant-ribbon/spectrum.d.ts +1 -1
  237. package/dist/app/variant-ribbon/spectrum.d.ts.map +1 -1
  238. package/dist/app/variant-ribbon/spectrum.js +1 -1
  239. package/dist/app/view-tab-bar/next-view-id.d.ts +1 -1
  240. package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -1
  241. package/dist/app/view-tab-bar/next-view-id.js +2 -4
  242. package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
  243. package/dist/app/view-tab-bar/prism-view-panel-host.component.js +5 -17
  244. package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
  245. package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +4 -27
  246. package/dist/builder/a11y/a11y-report-reader.d.ts +2 -2
  247. package/dist/builder/a11y/a11y-report-reader.d.ts.map +1 -1
  248. package/dist/builder/a11y/a11y-report-reader.js +8 -8
  249. package/dist/builder/build/index.d.ts.map +1 -1
  250. package/dist/builder/build/index.js +5 -9
  251. package/dist/builder/build/schema.d.ts.map +1 -1
  252. package/dist/builder/config-loader/config-loader.d.ts.map +1 -1
  253. package/dist/builder/config-loader/config-loader.js +4 -5
  254. package/dist/builder/manifest/host-parser.d.ts.map +1 -1
  255. package/dist/builder/manifest/host-parser.js +1 -1
  256. package/dist/builder/manifest/runtime-manifest.generator.d.ts +1 -1
  257. package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
  258. package/dist/builder/manifest/runtime-manifest.generator.js +14 -35
  259. package/dist/builder/plugin-runner/plugin-runner.d.ts.map +1 -1
  260. package/dist/builder/plugin-runner/plugin-runner.js +2 -4
  261. package/dist/builder/scanner/ast-utils.d.ts +46 -2
  262. package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
  263. package/dist/builder/scanner/ast-utils.js +338 -38
  264. package/dist/builder/scanner/class-hierarchy.d.ts +33 -0
  265. package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -0
  266. package/dist/builder/scanner/class-hierarchy.js +87 -0
  267. package/dist/builder/scanner/component.scanner.d.ts +7 -1
  268. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  269. package/dist/builder/scanner/component.scanner.js +113 -72
  270. package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
  271. package/dist/builder/scanner/entry-point-discovery.js +3 -5
  272. package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
  273. package/dist/builder/scanner/entry-point.scanner.js +1 -3
  274. package/dist/builder/scanner/index.d.ts +1 -1
  275. package/dist/builder/scanner/index.d.ts.map +1 -1
  276. package/dist/builder/scanner/input.extractor.d.ts +7 -4
  277. package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
  278. package/dist/builder/scanner/input.extractor.js +157 -76
  279. package/dist/builder/scanner/manifest.generator.d.ts.map +1 -1
  280. package/dist/builder/scanner/manifest.generator.js +8 -6
  281. package/dist/builder/scanner/scanner.d.ts +3 -1
  282. package/dist/builder/scanner/scanner.d.ts.map +1 -1
  283. package/dist/builder/scanner/scanner.js +10 -8
  284. package/dist/builder/scanner/showcase-diagnostics.d.ts +25 -0
  285. package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -0
  286. package/dist/builder/scanner/showcase-diagnostics.js +96 -0
  287. package/dist/builder/serve/index.d.ts.map +1 -1
  288. package/dist/builder/serve/index.js +8 -10
  289. package/dist/builder/serve/schema.d.ts.map +1 -1
  290. package/dist/builder/shared/index.d.ts +1 -1
  291. package/dist/builder/shared/index.d.ts.map +1 -1
  292. package/dist/builder/shared/index.js +1 -1
  293. package/dist/builder/shared/prism-pipeline.d.ts +1 -1
  294. package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
  295. package/dist/builder/shared/prism-pipeline.js +29 -38
  296. package/dist/builder/shared/resolve-cache-dir.d.ts.map +1 -1
  297. package/dist/builder/shared/resolve-cache-dir.js +1 -1
  298. package/dist/builder/watcher/index.d.ts +1 -1
  299. package/dist/builder/watcher/index.d.ts.map +1 -1
  300. package/dist/builder/watcher/prism-watcher.d.ts.map +1 -1
  301. package/dist/builder/watcher/prism-watcher.js +14 -12
  302. package/dist/config/index.d.ts +2 -2
  303. package/dist/config/index.d.ts.map +1 -1
  304. package/dist/config/index.js +1 -1
  305. package/dist/decorator/index.d.ts +1 -1
  306. package/dist/decorator/index.d.ts.map +1 -1
  307. package/dist/decorator/showcase.decorator.d.ts.map +1 -1
  308. package/dist/decorator/showcase.types.d.ts +11 -9
  309. package/dist/decorator/showcase.types.d.ts.map +1 -1
  310. package/dist/index.js +3 -3
  311. package/dist/plugin/define-config.js +1 -1
  312. package/dist/plugin/index.d.ts +4 -4
  313. package/dist/plugin/index.d.ts.map +1 -1
  314. package/dist/plugin/index.js +7 -11
  315. package/dist/plugin/page-helpers.d.ts +1 -1
  316. package/dist/plugin/page-helpers.d.ts.map +1 -1
  317. package/dist/plugin/page-helpers.js +2 -2
  318. package/dist/plugin/page.types.d.ts.map +1 -1
  319. package/dist/plugin/plugin.types.d.ts +31 -14
  320. package/dist/plugin/plugin.types.d.ts.map +1 -1
  321. package/dist/schematics/migrations/v21-13-manifest-cache/index.d.ts.map +1 -1
  322. package/dist/schematics/migrations/v21-13-manifest-cache/index.js +4 -10
  323. package/dist/schematics/migrations/v22-0-cache-dir-rename/index.d.ts.map +1 -1
  324. package/dist/schematics/migrations/v22-0-cache-dir-rename/index.js +6 -10
  325. package/dist/schematics/ng-add/index.d.ts.map +1 -1
  326. package/dist/schematics/ng-add/index.js +122 -56
  327. package/dist/schematics/ng-add/schema.d.ts.map +1 -1
  328. package/dist/schematics/utils/config-ast.d.ts.map +1 -1
  329. package/dist/schematics/utils/config-ast.js +8 -15
  330. package/dist/schematics/utils/tsconfig-paths.d.ts.map +1 -1
  331. package/dist/schematics/utils/tsconfig-paths.js +1 -1
  332. package/dist/shared/canvas-bg.type.d.ts +5 -6
  333. package/dist/shared/canvas-bg.type.d.ts.map +1 -1
  334. package/dist/shared/canvas-bg.type.js +5 -13
  335. package/dist/shared/canvas-layout.type.d.ts.map +1 -1
  336. package/dist/shared/canvas-layout.type.js +1 -4
  337. package/dist/shared/measure.type.d.ts +52 -0
  338. package/dist/shared/measure.type.d.ts.map +1 -0
  339. package/dist/shared/measure.type.js +21 -0
  340. package/dist/shared/variant-bg.d.ts +20 -31
  341. package/dist/shared/variant-bg.d.ts.map +1 -1
  342. package/dist/shared/variant-bg.js +20 -31
  343. package/dist/shared/viewport.type.d.ts +43 -0
  344. package/dist/shared/viewport.type.d.ts.map +1 -0
  345. package/dist/shared/viewport.type.js +44 -0
  346. package/dist/transformer/cli.js +0 -0
  347. package/dist/transformer/index.d.ts +2 -2
  348. package/dist/transformer/index.d.ts.map +1 -1
  349. package/dist/transformer/index.js +2 -2
  350. package/dist/transformer/showcase-strip.transformer.d.ts.map +1 -1
  351. package/dist/transformer/showcase-strip.transformer.js +7 -16
  352. package/dist/transformer/strip-directory.d.ts.map +1 -1
  353. package/dist/transformer/strip-directory.js +2 -4
  354. package/package.json +5 -2
  355. package/schematics/collection.json +7 -7
  356. package/schematics/migrations.json +12 -12
  357. package/schematics/ng-add/schema.json +22 -22
  358. package/src/builder/build/schema.json +36 -36
  359. package/src/builder/serve/schema.json +37 -37
@@ -1 +1 @@
1
- {"version":3,"file":"prism-canvas.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-canvas.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;;AAG3E,YAAY,EAAE,QAAQ,EAAE,CAAC;AAIzB,qBACa,kBAAkB;IAC7B,QAAQ,CAAC,EAAE,mDAA4B;IACvC,QAAQ,CAAC,IAAI,iDAAa;IAC1B,QAAQ,CAAC,MAAM,kDAAiB;IAChC,QAAQ,CAAC,MAAM,kDAAiB;IAEhC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;;IAWvD,KAAK,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAKzB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKxB,YAAY,IAAI,IAAI;IAKpB,YAAY,IAAI,IAAI;IAKpB,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,IAAI;yCAnDD,kBAAkB;;CAiE9B"}
1
+ {"version":3,"file":"prism-canvas.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-canvas.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;;AAI3E,YAAY,EAAE,QAAQ,EAAE,CAAC;AAIzB,qBACa,kBAAkB;IAC3B,QAAQ,CAAC,EAAE,mDAA4B;IACvC,QAAQ,CAAC,IAAI,iDAAa;IAC1B,QAAQ,CAAC,MAAM,kDAAiB;IAChC,QAAQ,CAAC,MAAM,kDAAiB;IAEhC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,kDAAiB;IAEjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,wDAA+B;IAErD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IAEvD;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB,CAAoB;;IAW7C,KAAK,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAKzB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKxB,YAAY,IAAI,IAAI;IAKpB,YAAY,IAAI,IAAI;IAKpB,aAAa,IAAI,IAAI;IAKrB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAYxC,cAAc,IAAI,IAAI;IAItB,OAAO,CAAC,eAAe;IAyBvB,OAAO,CAAC,IAAI;yCApHH,kBAAkB;;CAuI9B"}
@@ -1,5 +1,6 @@
1
1
  import { inject, Injectable, signal } from '@angular/core';
2
2
  import { CANVAS_BGS } from '../../shared/canvas-bg.type.js';
3
+ import { clampViewportWidth, VIEWPORT_DEFAULT } from '../../shared/viewport.type.js';
3
4
  import { PrismCaptureService } from './prism-capture.service.js';
4
5
  import * as i0 from "@angular/core";
5
6
  const STORAGE_KEY = 'ng-prism-canvas';
@@ -12,12 +13,44 @@ export class PrismCanvasService {
12
13
  ...(ngDevMode ? [{ debugName: "guides" }] : /* istanbul ignore next */ []));
13
14
  rulers = signal(false, /* @ts-ignore */
14
15
  ...(ngDevMode ? [{ debugName: "rulers" }] : /* istanbul ignore next */ []));
16
+ /**
17
+ * Whether the measuring tool is active.
18
+ *
19
+ * Lives here rather than in `PrismMeasureService` because it is the same
20
+ * kind of state as `guides` and `rulers`: a preference about the working
21
+ * environment, not a statement about this variant. That also means the
22
+ * toggle inherits the constructor's capture-mode behaviour below for
23
+ * free, without having to repeat it.
24
+ */
25
+ measure = signal(false, /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "measure" }] : /* istanbul ignore next */ []));
27
+ /**
28
+ * The width `.demo-wrap` is constrained to, or `null` for "as wide as it
29
+ * wants".
30
+ *
31
+ * Nullable rather than a `0`/`-1` sentinel because "off" is a
32
+ * different state and not a width: the renderer keys a whole set of CSS off
33
+ * `[data-viewport]`, and a falsy number would make `viewportWidth() ? ... `
34
+ * silently treat a legal narrow width as "off" the moment the floor ever
35
+ * moved to 0.
36
+ */
37
+ viewportWidth = signal(null, /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "viewportWidth" }] : /* istanbul ignore next */ []));
15
39
  capture = inject(PrismCaptureService);
40
+ /**
41
+ * What `toggleViewport()` restores.
42
+ *
43
+ * Kept in a field rather than persisted: it exists so that flicking the rail
44
+ * button off and on again does not throw away a width you just dragged to,
45
+ * which is a within-session concern. The width that *is* worth carrying
46
+ * across sessions is the live one, and that is already in `viewportWidth`.
47
+ */
48
+ lastViewportWidth = VIEWPORT_DEFAULT;
16
49
  constructor() {
17
- // Capture mode renders for a screenshot tool: persisted zoom, guides and
18
- // rulers would leak a previous session's state into the image, so the
19
- // defaults (zoom 1, no guides, no rulers) are kept and nothing is written
20
- // back.
50
+ // Capture mode renders for a screenshot tool: persisted zoom, guides,
51
+ // rulers and the measure toggle would leak a previous session's state
52
+ // into the image, so the defaults (zoom 1, no guides, no rulers, measure
53
+ // off) are kept and nothing is written back.
21
54
  if (this.capture.active())
22
55
  return;
23
56
  this.loadFromStorage();
@@ -38,6 +71,24 @@ export class PrismCanvasService {
38
71
  this.rulers.update((v) => !v);
39
72
  this.save();
40
73
  }
74
+ toggleMeasure() {
75
+ this.measure.update((v) => !v);
76
+ this.save();
77
+ }
78
+ setViewportWidth(w) {
79
+ if (w === null) {
80
+ this.viewportWidth.set(null);
81
+ }
82
+ else {
83
+ const clamped = clampViewportWidth(w);
84
+ this.lastViewportWidth = clamped;
85
+ this.viewportWidth.set(clamped);
86
+ }
87
+ this.save();
88
+ }
89
+ toggleViewport() {
90
+ this.setViewportWidth(this.viewportWidth() === null ? this.lastViewportWidth : null);
91
+ }
41
92
  loadFromStorage() {
42
93
  try {
43
94
  const raw = localStorage.getItem(STORAGE_KEY);
@@ -53,8 +104,17 @@ export class PrismCanvasService {
53
104
  this.guides.set(d['guides']);
54
105
  if (typeof d['rulers'] === 'boolean')
55
106
  this.rulers.set(d['rulers']);
107
+ if (typeof d['measure'] === 'boolean')
108
+ this.measure.set(d['measure']);
109
+ if (typeof d['viewportWidth'] === 'number') {
110
+ const w = clampViewportWidth(d['viewportWidth']);
111
+ this.lastViewportWidth = w;
112
+ this.viewportWidth.set(w);
113
+ }
114
+ }
115
+ catch {
116
+ // Malformed JSON or no storage access: keep the field defaults.
56
117
  }
57
- catch { }
58
118
  }
59
119
  save() {
60
120
  if (this.capture.active())
@@ -65,9 +125,14 @@ export class PrismCanvasService {
65
125
  zoom: this.zoom(),
66
126
  guides: this.guides(),
67
127
  rulers: this.rulers(),
128
+ measure: this.measure(),
129
+ viewportWidth: this.viewportWidth()
68
130
  }));
69
131
  }
70
- catch { }
132
+ catch {
133
+ // Storage may be full or disabled (e.g. private browsing); the
134
+ // canvas state just stays unpersisted for this session.
135
+ }
71
136
  }
72
137
  static ɵfac = function PrismCanvasService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCanvasService)(); };
73
138
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: PrismCanvasService, factory: PrismCanvasService.ɵfac, providedIn: 'root' });
@@ -6,59 +6,33 @@ export declare const CAPTURE_ATTRIBUTE = "data-prism-capture";
6
6
  /**
7
7
  * Everything capture mode makes see-through for `bg: 'transparent'`.
8
8
  *
9
- * A screenshot tool clips the *composited* page, so a transparent stage alone
10
- * buys nothing: the wrappers behind it keep painting and the PNG comes back
11
- * opaque. The stage and every ancestor that paints have to go at once, which
12
- * is why this is one selector rather than a rule per layer.
13
- *
14
- * `html` and `body` are insurance rather than observation — ng-prism paints
15
- * neither, but a consuming app's global stylesheet can, and the guarantee this
16
- * makes is "nothing opaque between the component and the document root".
17
- * Above `html` the backdrop is the browser's own and no stylesheet reaches it;
18
- * a runner has to clear that with `omitBackground: true`.
19
- *
20
- * `prism-shell` is the *host element* the app bootstraps into, not the
21
- * `div.prism-shell` inside its template — both are in the chain and either can
22
- * be given a background, a `:host` rule being the easy way to do it by
23
- * accident. `.prism-body` is the grid between the shell and `.prism-main` and
24
- * is listed on the same insurance grounds.
25
- *
26
- * Scoped by `:has()` to a *transparent* stage, so the other five backgrounds
27
- * behave exactly as before. Exported so a test can assert the invariant
28
- * against the real DOM rather than against this list — the list is the
29
- * fragile part of the feature. A renamed wrapper or a newly introduced
30
- * painting layer turns the capture opaque again, and an opaque capture still
31
- * looks correct; it just silently stops testing transparency.
9
+ * A screenshot tool clips the composited page, so the stage and every painting
10
+ * ancestor must clear together or the PNG comes back opaque. `html`, `body`,
11
+ * the `prism-shell` host element and `.prism-body` are insurance: ng-prism
12
+ * paints none of them, but an app stylesheet or a `:host` rule can. The
13
+ * browser's own backdrop above `html` needs `omitBackground: true` in the runner.
14
+ *
15
+ * Scoped by `:has()` to a transparent stage so the other backgrounds are
16
+ * untouched. Exported so a test can check it against the real DOM: a renamed
17
+ * wrapper or a new painting layer makes captures opaque again, and an opaque
18
+ * capture still looks correct.
32
19
  */
33
20
  export declare const CAPTURE_TRANSPARENT_SELECTOR: string;
34
21
  /**
35
- * Capture-isolation mode.
36
- *
37
- * Screenshot tools clip the composited page to the capture target's box, so
38
- * anything painted behind or inside `.demo-wrap` ends up in the image. Capture
39
- * mode strips the canvas background down to its patternless colour — keeping
40
- * whatever `@Showcase({ bg })` declared, or clearing the whole paint chain to
41
- * real transparency for `bg: 'transparent'` — suppresses every piece of
42
- * canvas chrome, removes every other shell region from layout so the canvas
43
- * owns the viewport, locks zoom to 1 and freezes animation, so a variant
44
- * renders identically on every run.
45
- *
46
- * What that buys a runner is the right to screenshot `.demo-wrap` directly:
47
- * the target is composited against the declared background over its whole box,
48
- * not merely over the part that fits inside the canvas viewport. The one thing
49
- * the mode cannot do is make room that the viewport does not have — a
50
- * component larger than the viewport still overflows, and sizing the viewport
51
- * to fit is the runner's job.
52
- *
53
- * The flag is read once from the URL at construction time and never written
54
- * back — {@link PrismUrlStateService} rebuilds the query string from scratch,
55
- * so navigating inside the app drops `?capture=1` from the address bar while
56
- * the mode itself stays on for the lifetime of the document.
57
- *
58
- * Reading in the constructor (rather than during `PrismUrlStateService.init()`)
59
- * is deliberate: `PrismCanvasService` restores persisted zoom in *its* own
60
- * constructor, which can run first, so anything init-order dependent would
61
- * make zoom-locking racy.
22
+ * Capture-isolation mode, for external screenshot runners.
23
+ *
24
+ * Keeps the declared canvas colour but strips its pattern (or clears the whole
25
+ * paint chain for `bg: 'transparent'`), hides canvas chrome and every other
26
+ * shell region, locks zoom to 1 and freezes animation, so a variant renders the
27
+ * same on every run and a runner can screenshot `.demo-wrap` directly. It
28
+ * cannot make room the viewport lacks: sizing the viewport is the runner's job.
29
+ *
30
+ * The flag is read once from the URL in the constructor and never written back.
31
+ * {@link PrismUrlStateService} rebuilds the query string, so `?capture=1` leaves
32
+ * the address bar on navigation while the mode stays on. Reading it during
33
+ * `PrismUrlStateService.init()` instead would make zoom-locking racy:
34
+ * `PrismCanvasService` restores persisted zoom in its own constructor, which
35
+ * can run first.
62
36
  */
63
37
  export declare class PrismCaptureService {
64
38
  private readonly _active;
@@ -1 +1 @@
1
- {"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,4BAA4B,QAE0H,CAAC;AAmJpK;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IAEF,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAdZ,mBAAmB;;CAuB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIzD"}
1
+ {"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,QAE4H,CAAC;AA2FtK;;;;;;;;;;;;;;;GAeG;AACH,qBACa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6F;IAErH,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAVd,mBAAmB;;CAoB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKzD"}
@@ -8,135 +8,66 @@ const STYLE_ELEMENT_ID = 'ng-prism-capture-styles';
8
8
  /**
9
9
  * Everything capture mode makes see-through for `bg: 'transparent'`.
10
10
  *
11
- * A screenshot tool clips the *composited* page, so a transparent stage alone
12
- * buys nothing: the wrappers behind it keep painting and the PNG comes back
13
- * opaque. The stage and every ancestor that paints have to go at once, which
14
- * is why this is one selector rather than a rule per layer.
15
- *
16
- * `html` and `body` are insurance rather than observation — ng-prism paints
17
- * neither, but a consuming app's global stylesheet can, and the guarantee this
18
- * makes is "nothing opaque between the component and the document root".
19
- * Above `html` the backdrop is the browser's own and no stylesheet reaches it;
20
- * a runner has to clear that with `omitBackground: true`.
21
- *
22
- * `prism-shell` is the *host element* the app bootstraps into, not the
23
- * `div.prism-shell` inside its template — both are in the chain and either can
24
- * be given a background, a `:host` rule being the easy way to do it by
25
- * accident. `.prism-body` is the grid between the shell and `.prism-main` and
26
- * is listed on the same insurance grounds.
27
- *
28
- * Scoped by `:has()` to a *transparent* stage, so the other five backgrounds
29
- * behave exactly as before. Exported so a test can assert the invariant
30
- * against the real DOM rather than against this list — the list is the
31
- * fragile part of the feature. A renamed wrapper or a newly introduced
32
- * painting layer turns the capture opaque again, and an opaque capture still
33
- * looks correct; it just silently stops testing transparency.
11
+ * A screenshot tool clips the composited page, so the stage and every painting
12
+ * ancestor must clear together or the PNG comes back opaque. `html`, `body`,
13
+ * the `prism-shell` host element and `.prism-body` are insurance: ng-prism
14
+ * paints none of them, but an app stylesheet or a `:host` rule can. The
15
+ * browser's own backdrop above `html` needs `omitBackground: true` in the runner.
16
+ *
17
+ * Scoped by `:has()` to a transparent stage so the other backgrounds are
18
+ * untouched. Exported so a test can check it against the real DOM: a renamed
19
+ * wrapper or a new painting layer makes captures opaque again, and an opaque
20
+ * capture still looks correct.
34
21
  */
35
22
  export const CAPTURE_TRANSPARENT_SELECTOR = `[${CAPTURE_ATTRIBUTE}] .prism-canvas-stage[data-bg='transparent'],\n` +
36
23
  `[${CAPTURE_ATTRIBUTE}] :is(html, body, prism-shell, .prism-shell, .prism-body, .prism-main, .prism-canvas-wrap):has(.prism-canvas-stage[data-bg='transparent'])`;
37
24
  /**
38
25
  * Everything capture mode removes from layout so the canvas owns the viewport.
39
26
  *
40
- * The canvas is not an overlay host: `.prism-canvas-wrap` is one flex sibling
41
- * among several inside `.prism-main`, which is itself one grid cell of
42
- * `.prism-body` inside `.prism-shell`. A screenshot tool captures the *screen
43
- * coordinates* of `.demo-wrap`, and `.demo-wrap` is centred in a stage that
44
- * scrolls — so whenever the component is larger than the canvas viewport, its
45
- * box extends past the canvas and the compositor fills those coordinates with
46
- * whichever sibling lives there. Measured in Chromium against the real
47
- * stylesheets, a 200x400 component at a 1280x720 viewport leaks 57px upwards
48
- * into the variant ribbon and 121px downwards into the panel. That is neither
49
- * a z-order nor a clipping bug: the capture target legitimately extends beyond
50
- * its scroll container and the page paints something there.
51
- *
52
- * `display: none` rather than `visibility: hidden`, and this is the one thing
53
- * not to "simplify" later. Keeping the layout box is the tempting minimal-churn
54
- * fix — nothing re-centres, no unaffected baseline moves — and it does not
55
- * work: the box still occupies its space, so what paints at those coordinates
56
- * becomes `.prism-main`'s own background instead of the panel. Measured at the
57
- * bottom row of a `bg: 'transparent'` capture: `#11284e` with the panel left
58
- * alone, `#11284e` with `visibility: hidden`, transparent only once the panel
59
- * leaves layout. The canvas is `flex: 1`; it has to reclaim the space for the
60
- * stage to paint there, and only removal from layout gives it back.
27
+ * Runners screenshot the screen coordinates of `.demo-wrap`, which is centred
28
+ * in a scrolling stage. A component larger than the canvas extends past it,
29
+ * and whichever sibling region paints there (ribbon, panel) leaks into the image.
61
30
  *
62
- * Written as a structural rule rather than a list of chrome selectors, because
63
- * enumeration is what makes this class of bug recur: the list has to be revised
64
- * every time the shell grows a region, nothing fails when it is not, and the
65
- * baselines recorded in the meantime look perfectly fine while guarding the
66
- * wrong image. At every level from the shell to the canvas wrap, the one child
67
- * that leads to the stage survives and every sibling is removed, so a region
68
- * added tomorrow is suppressed without anyone remembering this file exists.
31
+ * Use `display: none`, not `visibility: hidden`: a hidden box keeps its space
32
+ * and `.prism-main`'s background paints there instead. The canvas is `flex: 1`
33
+ * and only gets the space back once its siblings leave layout.
69
34
  *
70
- * The track collapses are not cosmetic. `.prism-shell` and `.prism-body` are
71
- * grids with sized tracks (`52px 1fr`, `var(--sw) 4px 1fr`); hiding the header
72
- * and the sidebar without collapsing them would auto-place the survivor into
73
- * the *first* track and render the canvas 52px tall or 264px wide.
35
+ * Structural rather than a list of chrome selectors: at each level from the
36
+ * shell to the canvas wrap, the child leading to the stage survives and every
37
+ * sibling goes, so a new shell region is covered without touching this file.
38
+ * The grid track overrides in `CAPTURE_STYLES` are required too: without them
39
+ * the survivor lands in the first sized track and the canvas renders 52px tall
40
+ * or 264px wide.
74
41
  *
75
- * Scoped by `:has(.prism-canvas-stage)` throughout: a component page or a view
76
- * panel has no canvas, and blanking the shell around it would leave a runner
77
- * with an empty screenshot rather than an honest one.
42
+ * Scoped by `:has(.prism-canvas-stage)`: a component page or view panel has no
43
+ * canvas, and blanking the shell there would give an empty screenshot.
78
44
  */
79
- const CAPTURE_CANVAS_ONLY_SELECTOR = `[${CAPTURE_ATTRIBUTE}] ` +
80
- `:is(.prism-shell, .prism-body, .prism-main, .prism-canvas-wrap)` +
81
- `:has(.prism-canvas-stage) > :not(:has(.prism-canvas-stage))`;
45
+ const CAPTURE_CANVAS_ONLY_SELECTOR = `[${CAPTURE_ATTRIBUTE}] ` + `:is(.prism-shell, .prism-body, .prism-main, .prism-canvas-wrap)` + `:has(.prism-canvas-stage) > :not(:has(.prism-canvas-stage))`;
82
46
  /**
83
47
  * Global stylesheet applied in capture mode.
84
48
  *
85
- * This has to be a document-level stylesheet rather than a component `styles`
86
- * block: Angular's emulated view encapsulation scopes component styles to that
87
- * component's own content attribute, so a rule written inside the renderer
88
- * could never reach into the dynamically created showcase component to stop
89
- * *its* transitions and animations.
90
- *
91
- * Stripping `background-image` is what makes the canvas capture-safe without
92
- * flattening it to one colour. Every `data-bg` value is a background *colour*
93
- * plus, for all but `plain`, a repeating *pattern* — dots or a checkerboard.
94
- * The colour is what `@Showcase({ bg })` declares and is deterministic; the
95
- * pattern is not, because the component is centred, so the pattern's phase
96
- * beneath it shifts whenever the component changes size and every pixel behind
97
- * it differs after an unrelated resize. `!important` is required: the stage's
98
- * own rules are component-scoped and therefore more specific than this one.
99
- *
100
- * `transparent` is the one value that drops the colour too, and it cannot do
101
- * that on the stage alone — see {@link CAPTURE_TRANSPARENT_SELECTOR} for the
102
- * layers involved. Alpha is not what the paragraph above rules out: a pattern
103
- * has a phase that moves when the component resizes, an alpha channel is a
104
- * per-pixel value that does not.
105
- *
106
- * Colour is only half of it. The rules from
107
- * {@link CAPTURE_CANVAS_ONLY_SELECTOR} down hand the whole viewport to the
108
- * canvas, which is what makes the declared background reach the *whole* of the
109
- * capture target's box rather than only the part that happens to fit inside
110
- * the canvas viewport.
111
- *
112
- * The stage's padding goes with them, and it buys more than the 32px it looks
113
- * like. The stage is `height: 100%` under `content-box`, so its padding lands
114
- * *outside* that height: the stage is 64px taller than the row it sits in,
115
- * overflows it, and centres the component 32px below the true centre of what
116
- * is actually painted. Dropping the padding makes the stage exactly the canvas
117
- * and the component's centre the viewport's centre, which turns the guarantee
118
- * crisp — a component is contained iff it fits the viewport. Measured: a
119
- * 200x700 component at 1280x720 still leaks 22px past the canvas with the
120
- * regions gone but the padding kept. None of that padding is ever inside a
121
- * `.demo-wrap` screenshot, so nothing is lost by removing it.
122
- *
123
- * The stage's edge goes with them, and it is stripped rather than reshaped for
124
- * the same reason it exists in that shape at all. The edge is deliberately
125
- * built from `outline` plus `box-shadow` and never from a border or padding,
126
- * because neither participates in layout: `plugin-visual-regression`
127
- * screenshots `.demo-wrap`, which is centred in the stage, and a border would
128
- * shrink the stage's content box by 2px and move that centre, shifting every
129
- * recorded baseline without a component having changed. Not participating in
130
- * layout is not the same as not painting. `outline-offset: -1px` draws the
131
- * line *inside* the border box, and with the padding above gone the stage edge
132
- * sits flush against the component, so for anything whose `.demo-wrap` reaches
133
- * it that 1px line and the shadow under it composite straight into the
134
- * screenshot. So capture mode removes the paint and leaves the geometry
135
- * untouched — the same division of labour the edge was chosen for, and the
136
- * only one that keeps both halves of the guarantee.
137
- *
138
- * {@link CAPTURE_TRANSPARENT_SELECTOR} cannot cover this: it clears background
139
- * colour, and an outline is not a background.
49
+ * Document-level because emulated encapsulation would stop a renderer rule from
50
+ * reaching the dynamically created showcase component's transitions and
51
+ * animations.
52
+ *
53
+ * `background-image` is stripped because the dot/checker pattern's phase shifts
54
+ * whenever the centred component resizes; the declared colour is deterministic
55
+ * and stays. `!important` is required to beat the component-scoped stage rules.
56
+ * `transparent` also drops the colour, across the layers in
57
+ * {@link CAPTURE_TRANSPARENT_SELECTOR}; alpha is per-pixel and does not shift.
58
+ * The rules from {@link CAPTURE_CANVAS_ONLY_SELECTOR} down give the canvas the
59
+ * whole viewport, so the background covers the capture target's whole box.
60
+ *
61
+ * The stage padding goes too. The stage is `height: 100%` under `content-box`,
62
+ * so the padding makes it 64px taller than its row and centres the component
63
+ * 32px too low. Without it the stage is the canvas, and a component is
64
+ * contained iff it fits the viewport.
65
+ *
66
+ * The stage edge is `outline` plus `box-shadow`, never a border, so it does not
67
+ * move `.demo-wrap`'s centre and shift baselines. It still paints, and with the
68
+ * padding gone it sits flush against the component, so capture mode removes the
69
+ * paint and keeps the geometry. {@link CAPTURE_TRANSPARENT_SELECTOR} does not
70
+ * cover this: an outline is not a background.
140
71
  */
141
72
  const CAPTURE_STYLES = `
142
73
  [${CAPTURE_ATTRIBUTE}] *,
@@ -177,38 +108,23 @@ ${CAPTURE_CANVAS_ONLY_SELECTOR} {
177
108
  }
178
109
  `;
179
110
  /**
180
- * Capture-isolation mode.
181
- *
182
- * Screenshot tools clip the composited page to the capture target's box, so
183
- * anything painted behind or inside `.demo-wrap` ends up in the image. Capture
184
- * mode strips the canvas background down to its patternless colour — keeping
185
- * whatever `@Showcase({ bg })` declared, or clearing the whole paint chain to
186
- * real transparency for `bg: 'transparent'` — suppresses every piece of
187
- * canvas chrome, removes every other shell region from layout so the canvas
188
- * owns the viewport, locks zoom to 1 and freezes animation, so a variant
189
- * renders identically on every run.
190
- *
191
- * What that buys a runner is the right to screenshot `.demo-wrap` directly:
192
- * the target is composited against the declared background over its whole box,
193
- * not merely over the part that fits inside the canvas viewport. The one thing
194
- * the mode cannot do is make room that the viewport does not have — a
195
- * component larger than the viewport still overflows, and sizing the viewport
196
- * to fit is the runner's job.
197
- *
198
- * The flag is read once from the URL at construction time and never written
199
- * back — {@link PrismUrlStateService} rebuilds the query string from scratch,
200
- * so navigating inside the app drops `?capture=1` from the address bar while
201
- * the mode itself stays on for the lifetime of the document.
202
- *
203
- * Reading in the constructor (rather than during `PrismUrlStateService.init()`)
204
- * is deliberate: `PrismCanvasService` restores persisted zoom in *its* own
205
- * constructor, which can run first, so anything init-order dependent would
206
- * make zoom-locking racy.
111
+ * Capture-isolation mode, for external screenshot runners.
112
+ *
113
+ * Keeps the declared canvas colour but strips its pattern (or clears the whole
114
+ * paint chain for `bg: 'transparent'`), hides canvas chrome and every other
115
+ * shell region, locks zoom to 1 and freezes animation, so a variant renders the
116
+ * same on every run and a runner can screenshot `.demo-wrap` directly. It
117
+ * cannot make room the viewport lacks: sizing the viewport is the runner's job.
118
+ *
119
+ * The flag is read once from the URL in the constructor and never written back.
120
+ * {@link PrismUrlStateService} rebuilds the query string, so `?capture=1` leaves
121
+ * the address bar on navigation while the mode stays on. Reading it during
122
+ * `PrismUrlStateService.init()` instead would make zoom-locking racy:
123
+ * `PrismCanvasService` restores persisted zoom in its own constructor, which
124
+ * can run first.
207
125
  */
208
126
  export class PrismCaptureService {
209
- _active = signal(typeof window !== 'undefined'
210
- ? parseCaptureParam(window.location.search)
211
- : false, /* @ts-ignore */
127
+ _active = signal(typeof window !== 'undefined' ? parseCaptureParam(window.location.search) : false, /* @ts-ignore */
212
128
  ...(ngDevMode ? [{ debugName: "_active" }] : /* istanbul ignore next */ []));
213
129
  /** True while the app renders for an external screenshot tool. */
214
130
  active = this._active.asReadonly();
@@ -1 +1 @@
1
- {"version":3,"file":"prism-event-log.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-event-log.service.ts"],"names":[],"mappings":";AAEA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,qBACa,oBAAoB;IAC/B,QAAQ,CAAC,MAAM,0DAA+B;IAC9C,OAAO,CAAC,OAAO,CAAK;IAEpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAOvC,KAAK,IAAI,IAAI;yCAXF,oBAAoB;;CAchC"}
1
+ {"version":3,"file":"prism-event-log.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-event-log.service.ts"],"names":[],"mappings":";AAEA,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,qBACa,oBAAoB;IAC7B,QAAQ,CAAC,MAAM,0DAA+B;IAC9C,OAAO,CAAC,OAAO,CAAK;IAEpB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIvC,KAAK,IAAI,IAAI;yCARJ,oBAAoB;;CAWhC"}
@@ -5,10 +5,7 @@ export class PrismEventLogService {
5
5
  ...(ngDevMode ? [{ debugName: "events" }] : /* istanbul ignore next */ []));
6
6
  _nextId = 0;
7
7
  log(name, value) {
8
- this.events.update((prev) => [
9
- { id: this._nextId++, timestamp: Date.now(), name, value },
10
- ...prev,
11
- ]);
8
+ this.events.update((prev) => [{ id: this._nextId++, timestamp: Date.now(), name, value }, ...prev]);
12
9
  }
13
10
  clear() {
14
11
  this.events.set([]);
@@ -1 +1 @@
1
- {"version":3,"file":"prism-layout.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-layout.service.ts"],"names":[],"mappings":";AAIA,qBACa,kBAAkB;IAC7B,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,aAAa,kDAAgB;IACtC,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,iBAAiB,6DAAwC;IAClE,QAAQ,CAAC,YAAY,iDAAe;IACpC,QAAQ,CAAC,WAAW,iDAAe;IACnC,QAAQ,CAAC,UAAU,iDAAe;;IAMlC,aAAa,IAAI,IAAI;IAKrB,YAAY,IAAI,IAAI;IAKpB,aAAa,IAAI,IAAI;IAKrB,iBAAiB,IAAI,IAAI;IAKzB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKjC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKhC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK/B,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,aAAa;yCA1EV,kBAAkB;;CAsF9B"}
1
+ {"version":3,"file":"prism-layout.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-layout.service.ts"],"names":[],"mappings":";AAIA,qBACa,kBAAkB;IAC3B,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,aAAa,kDAAgB;IACtC,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,iBAAiB,6DAAwC;IAClE,QAAQ,CAAC,YAAY,iDAAe;IACpC,QAAQ,CAAC,WAAW,iDAAe;IACnC,QAAQ,CAAC,UAAU,iDAAe;;IAMlC,aAAa,IAAI,IAAI;IAKrB,YAAY,IAAI,IAAI;IAKpB,aAAa,IAAI,IAAI;IAKrB,iBAAiB,IAAI,IAAI;IAKzB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKjC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKhC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK/B,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,aAAa;yCArEZ,kBAAkB;;CAkF9B"}
@@ -59,8 +59,7 @@ export class PrismLayoutService {
59
59
  this.addonsVisible.set(d['addonsVisible']);
60
60
  if (typeof d['toolbarVisible'] === 'boolean')
61
61
  this.toolbarVisible.set(d['toolbarVisible']);
62
- if (d['addonsOrientation'] === 'bottom' ||
63
- d['addonsOrientation'] === 'right') {
62
+ if (d['addonsOrientation'] === 'bottom' || d['addonsOrientation'] === 'right') {
64
63
  this.addonsOrientation.set(d['addonsOrientation']);
65
64
  }
66
65
  if (typeof d['sidebarWidth'] === 'number')
@@ -70,7 +69,9 @@ export class PrismLayoutService {
70
69
  if (typeof d['panelWidth'] === 'number')
71
70
  this.panelWidth.set(Math.max(200, Math.min(600, d['panelWidth'])));
72
71
  }
73
- catch { }
72
+ catch {
73
+ // Malformed JSON or no storage access: keep the field defaults.
74
+ }
74
75
  }
75
76
  saveToStorage() {
76
77
  const data = {
@@ -80,7 +81,7 @@ export class PrismLayoutService {
80
81
  addonsOrientation: this.addonsOrientation(),
81
82
  sidebarWidth: this.sidebarWidth(),
82
83
  panelHeight: this.panelHeight(),
83
- panelWidth: this.panelWidth(),
84
+ panelWidth: this.panelWidth()
84
85
  };
85
86
  localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
86
87
  }
@@ -1,5 +1,5 @@
1
- import type { RuntimeComponent, RuntimeManifest } from '../../plugin/plugin.types.js';
2
1
  import type { StyleguidePage } from '../../plugin/page.types.js';
2
+ import type { RuntimeComponent, RuntimeManifest } from '../../plugin/plugin.types.js';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class PrismManifestService {
5
5
  private readonly _manifest;
@@ -1 +1 @@
1
- {"version":3,"file":"prism-manifest.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-manifest.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;;AAGjE,qBACa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmD;IAE7E,QAAQ,CAAC,QAAQ,kDAA+B;IAEhD,QAAQ,CAAC,UAAU,qDAAmE;IAEtF,QAAQ,CAAC,KAAK,mDAAkE;IAEhF,QAAQ,CAAC,UAAU,2CAsBhB;IAEH,QAAQ,CAAC,iBAAiB,kEAUvB;IAEH,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;yCA7CpC,oBAAoB;;CAgDhC"}
1
+ {"version":3,"file":"prism-manifest.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-manifest.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAGtF,qBACa,oBAAoB;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmD;IAE7E,QAAQ,CAAC,QAAQ,kDAA+B;IAEhD,QAAQ,CAAC,UAAU,qDAAmE;IAEtF,QAAQ,CAAC,KAAK,mDAAkE;IAEhF,QAAQ,CAAC,UAAU,2CA0BhB;IAEH,QAAQ,CAAC,iBAAiB,kEAYvB;IAEH,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;yCAnDtC,oBAAoB;;CAsDhC"}
@@ -19,7 +19,7 @@ export class PrismManifestService {
19
19
  orderMap.set(cat, order);
20
20
  }
21
21
  }
22
- for (const page of (manifest.pages ?? [])) {
22
+ for (const page of manifest.pages ?? []) {
23
23
  const cat = page.category ?? 'Uncategorized';
24
24
  if (!orderMap.has(cat)) {
25
25
  orderMap.set(cat, Infinity);
@@ -0,0 +1,44 @@
1
+ import type { Measurement, MeasurePoint } from '../../shared/measure.type.js';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * The transient state of the measuring tool.
5
+ *
6
+ * Deliberately separate from `PrismCanvasService`, which holds durable
7
+ * preferences: the toggle lives there, the measurements live here. None of
8
+ * this is persisted — rescuing a half-finished measurement across a reload
9
+ * would be a burden, not a convenience.
10
+ */
11
+ export declare class PrismMeasureService {
12
+ private readonly navigation;
13
+ private readonly renderer;
14
+ private readonly canvas;
15
+ private readonly _draft;
16
+ private readonly _pins;
17
+ private readonly _hoverAnchor;
18
+ /** The measurement in progress, for as long as the pointer is down. */
19
+ readonly draft: import("@angular/core").Signal<Measurement | null>;
20
+ /** Pinned measurements, in the order they were set. */
21
+ readonly pins: import("@angular/core").Signal<readonly Measurement[]>;
22
+ /** The element fixed by click for alt-hover mode. */
23
+ readonly hoverAnchor: import("@angular/core").Signal<Element | null>;
24
+ constructor();
25
+ beginDraft(a: MeasurePoint): void;
26
+ updateDraft(b: MeasurePoint): void;
27
+ commitDraft(): void;
28
+ cancelDraft(): void;
29
+ removePin(index: number): void;
30
+ setHoverAnchor(element: Element | null): void;
31
+ /**
32
+ * What happens when the tool is switched off.
33
+ *
34
+ * Deliberately not `clearAll()`: the toggle is a mode, not a reset. Anyone
35
+ * who hits the rail by accident must not lose the pinned measurements —
36
+ * the running one, on the other hand, no longer makes sense without a
37
+ * pointer, and an anchor with no visible overlay even less so.
38
+ */
39
+ suspend(): void;
40
+ clearAll(): void;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<PrismMeasureService, never>;
42
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
43
+ }
44
+ //# sourceMappingURL=prism-measure.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prism-measure.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-measure.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;;AAK9E;;;;;;;GAOG;AACH,qBACa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IAErD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsC;IAC5D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgC;IAE7D,uEAAuE;IACvE,QAAQ,CAAC,KAAK,qDAA4B;IAE1C,uDAAuD;IACvD,QAAQ,CAAC,IAAI,yDAA2B;IAExC,qDAAqD;IACrD,QAAQ,CAAC,WAAW,iDAAkC;;IAmBtD,UAAU,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI;IAIjC,WAAW,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI;IAIlC,WAAW,IAAI,IAAI;IAQnB,WAAW,IAAI,IAAI;IAInB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI9B,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI;IAI7C;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;yCA5EP,mBAAmB;;CAiF/B"}