@ng-prism/core 22.3.0 → 22.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +13 -13
  2. package/dist/app/canvas/canvas-bg.styles.d.ts +7 -12
  3. package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
  4. package/dist/app/canvas/canvas-bg.styles.js +35 -37
  5. package/dist/app/canvas/measure-geometry.d.ts +140 -0
  6. package/dist/app/canvas/measure-geometry.d.ts.map +1 -0
  7. package/dist/app/canvas/measure-geometry.js +217 -0
  8. package/dist/app/canvas/measure-keyboard.d.ts +20 -0
  9. package/dist/app/canvas/measure-keyboard.d.ts.map +1 -0
  10. package/dist/app/canvas/measure-keyboard.js +34 -0
  11. package/dist/app/canvas/measure-quad.d.ts +114 -0
  12. package/dist/app/canvas/measure-quad.d.ts.map +1 -0
  13. package/dist/app/canvas/measure-quad.js +173 -0
  14. package/dist/app/canvas/measure-snap.d.ts +35 -0
  15. package/dist/app/canvas/measure-snap.d.ts.map +1 -0
  16. package/dist/app/canvas/measure-snap.js +63 -0
  17. package/dist/app/canvas/prism-canvas-measure.component.d.ts +142 -0
  18. package/dist/app/canvas/prism-canvas-measure.component.d.ts.map +1 -0
  19. package/dist/app/canvas/prism-canvas-measure.component.js +554 -0
  20. package/dist/app/canvas/prism-canvas-pin-row.component.d.ts +23 -0
  21. package/dist/app/canvas/prism-canvas-pin-row.component.d.ts.map +1 -0
  22. package/dist/app/canvas/prism-canvas-pin-row.component.js +64 -0
  23. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +22 -39
  24. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  25. package/dist/app/canvas/prism-canvas-toolbar.component.js +61 -69
  26. package/dist/app/canvas/prism-template-popover.component.js +1 -1
  27. package/dist/app/canvas/viewport-snap.d.ts +1 -1
  28. package/dist/app/canvas/viewport-snap.js +1 -1
  29. package/dist/app/component-head/head-metrics.d.ts +2 -2
  30. package/dist/app/component-head/head-metrics.js +1 -1
  31. package/dist/app/component-head/prism-component-head.component.d.ts +2 -2
  32. package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
  33. package/dist/app/component-head/prism-component-head.component.js +11 -18
  34. package/dist/app/component-head/prism-head-gauge.component.js +1 -1
  35. package/dist/app/component-head/prism-head-info.component.d.ts +1 -1
  36. package/dist/app/component-head/prism-head-info.component.js +2 -2
  37. package/dist/app/component-head/prism-stat.component.d.ts +1 -1
  38. package/dist/app/component-head/prism-stat.component.js +2 -2
  39. package/dist/app/directives/prism-resizer.directive.d.ts +1 -1
  40. package/dist/app/directives/prism-resizer.directive.js +2 -2
  41. package/dist/app/directives/resize-value.d.ts +2 -2
  42. package/dist/app/directives/resize-value.js +2 -2
  43. package/dist/app/discovery-manifest.d.ts +2 -2
  44. package/dist/app/discovery-manifest.d.ts.map +1 -1
  45. package/dist/app/discovery-manifest.js +11 -15
  46. package/dist/app/header/prism-header.component.js +1 -1
  47. package/dist/app/icons/icon-registry.d.ts +2 -2
  48. package/dist/app/icons/icon-registry.d.ts.map +1 -1
  49. package/dist/app/icons/icon-registry.js +3 -2
  50. package/dist/app/icons/prism-icon.component.d.ts +2 -2
  51. package/dist/app/icons/prism-icon.component.js +4 -4
  52. package/dist/app/index.d.ts.map +1 -1
  53. package/dist/app/index.js +14 -21
  54. package/dist/app/overview/overview-visibility.d.ts +1 -1
  55. package/dist/app/overview/overview-visibility.js +1 -1
  56. package/dist/app/overview/prism-overview-cell.component.d.ts +2 -2
  57. package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
  58. package/dist/app/overview/prism-overview-cell.component.js +9 -10
  59. package/dist/app/overview/prism-overview.component.d.ts +2 -2
  60. package/dist/app/overview/prism-overview.component.js +2 -2
  61. package/dist/app/page-renderer/prism-page-renderer.component.js +1 -1
  62. package/dist/app/panels/a11y/a11y-audit.service.js +2 -2
  63. package/dist/app/panels/a11y/a11y-summary.d.ts +3 -4
  64. package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
  65. package/dist/app/panels/a11y/a11y-summary.js +3 -4
  66. package/dist/app/panels/a11y/a11y-thresholds.d.ts +1 -1
  67. package/dist/app/panels/a11y/a11y-thresholds.d.ts.map +1 -1
  68. package/dist/app/panels/a11y/a11y-thresholds.js +1 -1
  69. package/dist/app/panels/a11y/a11y.types.d.ts +1 -1
  70. package/dist/app/panels/a11y/a11y.types.d.ts.map +1 -1
  71. package/dist/app/panels/builtin-navigation-decorations.d.ts +1 -1
  72. package/dist/app/panels/builtin-navigation-decorations.js +1 -1
  73. package/dist/app/panels/controls/non-editable-input-types.js +1 -1
  74. package/dist/app/panels/panel-host/panel-badge.d.ts +1 -1
  75. package/dist/app/provide-prism.js +1 -1
  76. package/dist/app/renderer/known-inputs.d.ts +1 -1
  77. package/dist/app/renderer/known-inputs.js +1 -1
  78. package/dist/app/renderer/overlay-resolver.d.ts +17 -3
  79. package/dist/app/renderer/overlay-resolver.d.ts.map +1 -1
  80. package/dist/app/renderer/overlay-resolver.js +9 -4
  81. package/dist/app/renderer/prism-renderer.component.d.ts +3 -3
  82. package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
  83. package/dist/app/renderer/prism-renderer.component.js +25 -16
  84. package/dist/app/renderer/projectable-content.js +3 -3
  85. package/dist/app/services/prism-canvas.service.d.ts +12 -1
  86. package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
  87. package/dist/app/services/prism-canvas.service.js +23 -5
  88. package/dist/app/services/prism-capture.service.d.ts +24 -50
  89. package/dist/app/services/prism-capture.service.d.ts.map +1 -1
  90. package/dist/app/services/prism-capture.service.js +60 -140
  91. package/dist/app/services/prism-measure.service.d.ts +44 -0
  92. package/dist/app/services/prism-measure.service.d.ts.map +1 -0
  93. package/dist/app/services/prism-measure.service.js +91 -0
  94. package/dist/app/services/prism-panel.service.d.ts +2 -2
  95. package/dist/app/services/prism-panel.service.js +2 -2
  96. package/dist/app/services/prism-persistence.service.js +1 -1
  97. package/dist/app/services/prism-renderer.service.js +1 -1
  98. package/dist/app/services/prism-url-state.service.js +1 -1
  99. package/dist/app/services/prism-variant-bg.service.d.ts +10 -24
  100. package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -1
  101. package/dist/app/services/prism-variant-bg.service.js +10 -24
  102. package/dist/app/shared/prism-metric-badge.component.d.ts +9 -15
  103. package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
  104. package/dist/app/shared/prism-metric-badge.component.js +10 -16
  105. package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
  106. package/dist/app/shell/prism-shell.component.js +12 -9
  107. package/dist/app/sidebar/navigation-decorations.d.ts +4 -4
  108. package/dist/app/sidebar/navigation-decorations.js +2 -2
  109. package/dist/app/sidebar/prism-sidebar.component.d.ts +2 -2
  110. package/dist/app/sidebar/prism-sidebar.component.js +3 -3
  111. package/dist/app/theme/prism-default-theme.js +3 -3
  112. package/dist/app/variant-ribbon/spectrum.d.ts +1 -1
  113. package/dist/app/variant-ribbon/spectrum.js +1 -1
  114. package/dist/app/view-tab-bar/next-view-id.d.ts +1 -1
  115. package/dist/app/view-tab-bar/next-view-id.js +1 -1
  116. package/dist/builder/a11y/a11y-report-reader.d.ts +1 -1
  117. package/dist/builder/a11y/a11y-report-reader.js +1 -1
  118. package/dist/builder/manifest/runtime-manifest.generator.js +6 -2
  119. package/dist/builder/plugin-runner/plugin-runner.js +1 -1
  120. package/dist/builder/scanner/ast-utils.d.ts +46 -2
  121. package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
  122. package/dist/builder/scanner/ast-utils.js +337 -31
  123. package/dist/builder/scanner/class-hierarchy.d.ts +33 -0
  124. package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -0
  125. package/dist/builder/scanner/class-hierarchy.js +87 -0
  126. package/dist/builder/scanner/component.scanner.d.ts +7 -1
  127. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  128. package/dist/builder/scanner/component.scanner.js +106 -58
  129. package/dist/builder/scanner/input.extractor.d.ts +7 -4
  130. package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
  131. package/dist/builder/scanner/input.extractor.js +153 -55
  132. package/dist/builder/scanner/manifest.generator.js +6 -2
  133. package/dist/builder/scanner/scanner.d.ts +3 -1
  134. package/dist/builder/scanner/scanner.d.ts.map +1 -1
  135. package/dist/builder/scanner/scanner.js +6 -4
  136. package/dist/builder/scanner/showcase-diagnostics.d.ts +25 -0
  137. package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -0
  138. package/dist/builder/scanner/showcase-diagnostics.js +96 -0
  139. package/dist/builder/shared/prism-pipeline.d.ts +1 -1
  140. package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
  141. package/dist/builder/shared/prism-pipeline.js +12 -14
  142. package/dist/builder/watcher/prism-watcher.js +2 -2
  143. package/dist/decorator/showcase.types.d.ts +11 -9
  144. package/dist/decorator/showcase.types.d.ts.map +1 -1
  145. package/dist/index.js +3 -3
  146. package/dist/plugin/define-config.js +1 -1
  147. package/dist/plugin/index.d.ts.map +1 -1
  148. package/dist/plugin/index.js +5 -9
  149. package/dist/plugin/plugin.types.d.ts +30 -13
  150. package/dist/plugin/plugin.types.d.ts.map +1 -1
  151. package/dist/schematics/migrations/v22-0-cache-dir-rename/index.js +2 -2
  152. package/dist/schematics/ng-add/index.js +4 -4
  153. package/dist/shared/canvas-bg.type.d.ts +5 -6
  154. package/dist/shared/canvas-bg.type.d.ts.map +1 -1
  155. package/dist/shared/canvas-bg.type.js +4 -5
  156. package/dist/shared/measure.type.d.ts +52 -0
  157. package/dist/shared/measure.type.d.ts.map +1 -0
  158. package/dist/shared/measure.type.js +21 -0
  159. package/dist/shared/variant-bg.d.ts +20 -31
  160. package/dist/shared/variant-bg.d.ts.map +1 -1
  161. package/dist/shared/variant-bg.js +20 -31
  162. package/dist/shared/viewport.type.d.ts +15 -19
  163. package/dist/shared/viewport.type.d.ts.map +1 -1
  164. package/dist/shared/viewport.type.js +15 -19
  165. package/dist/transformer/showcase-strip.transformer.js +1 -1
  166. package/package.json +5 -5
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The measuring tool measures geometry, not cascade: a point knows the edge
3
+ * it sits on, but not the CSS property that produced it. Mapping pixels to a
4
+ * property is deliberately a follow-up step, see Spec §13.
5
+ */
6
+ export type SnapKind = 'border' | 'padding' | 'content';
7
+ export type EdgeSide = 'top' | 'right' | 'bottom' | 'left';
8
+ /** What a point snapped to — `null` when no target was within tolerance. */
9
+ export interface SnapRef {
10
+ kind: SnapKind;
11
+ side: EdgeSide;
12
+ from: Element;
13
+ }
14
+ /**
15
+ * A measure point in `.demo-wrap`-local CSS pixels.
16
+ *
17
+ * Not in screen coordinates: `.demo-wrap` carries
18
+ * `transform: scale(var(--zoom))`, and local coordinates turn the distance
19
+ * into a CSS-pixel distance with no further division. Zooming after a pin is
20
+ * placed then does not shift it relative to the specimen.
21
+ */
22
+ export interface MeasurePoint {
23
+ x: number;
24
+ y: number;
25
+ snap: SnapRef | null;
26
+ }
27
+ export interface Measurement {
28
+ a: MeasurePoint;
29
+ b: MeasurePoint;
30
+ }
31
+ /**
32
+ * How close the pointer has to come to an edge, in **screen** pixels.
33
+ *
34
+ * Screen and not document pixels, because the tolerance describes a
35
+ * precision of the hand and not a property of the document: it has to feel
36
+ * the same at 50% zoom as at 200%. Same value as `VIEWPORT_SNAP_TOLERANCE`,
37
+ * for the same reason.
38
+ */
39
+ export declare const MEASURE_SNAP_TOLERANCE = 8;
40
+ /**
41
+ * The span, in CSS pixels, above which the value fits between the end ticks.
42
+ *
43
+ * Below it the ticks and the number overlap, and the measurement becomes
44
+ * unreadable exactly where it needs to be most precise. The value then
45
+ * moves outside instead.
46
+ */
47
+ export declare const MEASURE_LABEL_MIN_SPAN = 28;
48
+ /** How far the value steps aside, perpendicular to the line, for short spans. */
49
+ export declare const MEASURE_LABEL_OFFSET = 15;
50
+ /** Length of an end tick, centered on the endpoint. */
51
+ export declare const MEASURE_TICK_LENGTH = 7;
52
+ //# sourceMappingURL=measure.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure.type.d.ts","sourceRoot":"","sources":["../../src/shared/measure.type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3D,4EAA4E;AAC5E,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IACxB,CAAC,EAAE,YAAY,CAAC;IAChB,CAAC,EAAE,YAAY,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,IAAI,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * How close the pointer has to come to an edge, in **screen** pixels.
3
+ *
4
+ * Screen and not document pixels, because the tolerance describes a
5
+ * precision of the hand and not a property of the document: it has to feel
6
+ * the same at 50% zoom as at 200%. Same value as `VIEWPORT_SNAP_TOLERANCE`,
7
+ * for the same reason.
8
+ */
9
+ export const MEASURE_SNAP_TOLERANCE = 8;
10
+ /**
11
+ * The span, in CSS pixels, above which the value fits between the end ticks.
12
+ *
13
+ * Below it the ticks and the number overlap, and the measurement becomes
14
+ * unreadable exactly where it needs to be most precise. The value then
15
+ * moves outside instead.
16
+ */
17
+ export const MEASURE_LABEL_MIN_SPAN = 28;
18
+ /** How far the value steps aside, perpendicular to the line, for short spans. */
19
+ export const MEASURE_LABEL_OFFSET = 15;
20
+ /** Length of an end tick, centered on the endpoint. */
21
+ export const MEASURE_TICK_LENGTH = 7;
@@ -2,37 +2,26 @@ import type { CanvasBg } from './canvas-bg.type.js';
2
2
  /**
3
3
  * The surface a variant is reported to render on when nothing declares one.
4
4
  *
5
- * An undeclared variant is the "no opinion" case, and `transparent` is the
6
- * honest capture of no opinion. The alternative, `checker`, patterns over
7
- * `--prism-bg-surface` — a *theme* token — and capture mode strips the pattern
8
- * and keeps the colour, so an undeclared variant used to be photographed on
9
- * whichever theme the runner's browser happened to start in. That is not a
10
- * neutral default; it is the runner's theme leaking into a baseline. Alpha
11
- * carries no such dependency, and it is not the thing capture mode's
12
- * determinism argument rules out: a pattern has a phase that shifts when a
13
- * centred component resizes, an alpha channel is a per-pixel value that does
14
- * not move.
15
- *
16
- * In the app both values look identical — `transparent` renders as the same
17
- * checkerboard, which is the UI's way of saying "no surface here". The change
18
- * is only visible in a capture.
19
- *
20
- * The cost is real and worth stating plainly: a runner that does not pass
21
- * `omitBackground: true` gets an opaque capture over whatever the browser
22
- * painted, because the page's own backdrop is below every stylesheet. See
5
+ * `transparent`, because an undeclared variant has no opinion about its
6
+ * surface. `checker` patterns over `--prism-bg-surface`, a theme token, and
7
+ * capture mode keeps the colour, so the runner's theme would leak into the
8
+ * baseline. Alpha has no such dependency and, unlike a pattern, does not shift
9
+ * when a centred component resizes. In the app both render the same
10
+ * checkerboard; the difference only shows in a capture.
11
+ *
12
+ * A runner must pass `omitBackground: true`, otherwise the capture is opaque
13
+ * over whatever the browser painted. See
23
14
  * `docs/guide/visual-regression.md#capturing-transparency`.
24
15
  *
25
- * What to declare, now that the default no longer decides it for you:
16
+ * What to declare:
26
17
  *
27
- * - `light` or `dark` when the component was designed against a surface.
28
- * Their colours are absolute rather than theme tokens, which is what makes
29
- * them stable across runners.
30
- * - `transparent` when the component's own transparency is the thing under
31
- * test — an outlined button, an icon, a divider. Flattening one onto an
32
- * opaque colour makes a transparent fill and a painted fill produce the
33
- * same pixels.
34
- * - `dots`, `plain` or `checker` for browsing. All three follow the active
35
- * theme, so a baseline recorded on one is only as stable as the theme.
18
+ * - `light` or `dark` when the component was designed against a surface. Their
19
+ * colours are absolute, not theme tokens, so they are stable across runners.
20
+ * - `transparent` when the component's own transparency is under test (an
21
+ * outlined button, an icon, a divider). On an opaque colour a transparent
22
+ * fill and a painted fill produce the same pixels.
23
+ * - `dots`, `plain` or `checker` for browsing. They follow the active theme, so
24
+ * a baseline recorded on one is only as stable as the theme.
36
25
  */
37
26
  export declare const DEFAULT_VARIANT_BG: CanvasBg;
38
27
  /**
@@ -50,7 +39,7 @@ export interface VariantBgSource {
50
39
  /**
51
40
  * The background a variant *declares*, or `null` when it declares none.
52
41
  *
53
- * Priority is variant, then component. `null` is a meaningful answer — it is
42
+ * Priority is variant, then component. `null` is a meaningful answer. It is
54
43
  * what lets the canvas keep the user's own background choice instead of
55
44
  * overwriting it, and what makes the background pill able to say "this is your
56
45
  * choice, not the component's".
@@ -64,8 +53,8 @@ export declare function declaredVariantBg(config: VariantBgSource, variantIndex:
64
53
  /**
65
54
  * The background a variant renders on, always resolved to a concrete value.
66
55
  *
67
- * This is the answer external tooling needs — a screenshot runner cannot act
68
- * on "nothing declared" — and the one capture mode paints, so the value
56
+ * This is the answer external tooling needs, since a screenshot runner cannot act
57
+ * on "nothing declared". It is also what capture mode paints, so the value
69
58
  * reported by `__PRISM_MANIFEST__` and the pixels in the capture agree.
70
59
  */
71
60
  export declare function resolveVariantBg(config: VariantBgSource, variantIndex: number): CanvasBg;
@@ -1 +1 @@
1
- {"version":3,"file":"variant-bg.d.ts","sourceRoot":"","sources":["../../src/shared/variant-bg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAwB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS;QAAE,EAAE,CAAC,EAAE,QAAQ,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAEhG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,CAExF"}
1
+ {"version":3,"file":"variant-bg.d.ts","sourceRoot":"","sources":["../../src/shared/variant-bg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAwB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC5B,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS;QAAE,EAAE,CAAC,EAAE,QAAQ,CAAA;KAAE,EAAE,CAAC;CAC3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAEhG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,CAExF"}
@@ -1,43 +1,32 @@
1
1
  /**
2
2
  * The surface a variant is reported to render on when nothing declares one.
3
3
  *
4
- * An undeclared variant is the "no opinion" case, and `transparent` is the
5
- * honest capture of no opinion. The alternative, `checker`, patterns over
6
- * `--prism-bg-surface` — a *theme* token — and capture mode strips the pattern
7
- * and keeps the colour, so an undeclared variant used to be photographed on
8
- * whichever theme the runner's browser happened to start in. That is not a
9
- * neutral default; it is the runner's theme leaking into a baseline. Alpha
10
- * carries no such dependency, and it is not the thing capture mode's
11
- * determinism argument rules out: a pattern has a phase that shifts when a
12
- * centred component resizes, an alpha channel is a per-pixel value that does
13
- * not move.
14
- *
15
- * In the app both values look identical — `transparent` renders as the same
16
- * checkerboard, which is the UI's way of saying "no surface here". The change
17
- * is only visible in a capture.
18
- *
19
- * The cost is real and worth stating plainly: a runner that does not pass
20
- * `omitBackground: true` gets an opaque capture over whatever the browser
21
- * painted, because the page's own backdrop is below every stylesheet. See
4
+ * `transparent`, because an undeclared variant has no opinion about its
5
+ * surface. `checker` patterns over `--prism-bg-surface`, a theme token, and
6
+ * capture mode keeps the colour, so the runner's theme would leak into the
7
+ * baseline. Alpha has no such dependency and, unlike a pattern, does not shift
8
+ * when a centred component resizes. In the app both render the same
9
+ * checkerboard; the difference only shows in a capture.
10
+ *
11
+ * A runner must pass `omitBackground: true`, otherwise the capture is opaque
12
+ * over whatever the browser painted. See
22
13
  * `docs/guide/visual-regression.md#capturing-transparency`.
23
14
  *
24
- * What to declare, now that the default no longer decides it for you:
15
+ * What to declare:
25
16
  *
26
- * - `light` or `dark` when the component was designed against a surface.
27
- * Their colours are absolute rather than theme tokens, which is what makes
28
- * them stable across runners.
29
- * - `transparent` when the component's own transparency is the thing under
30
- * test — an outlined button, an icon, a divider. Flattening one onto an
31
- * opaque colour makes a transparent fill and a painted fill produce the
32
- * same pixels.
33
- * - `dots`, `plain` or `checker` for browsing. All three follow the active
34
- * theme, so a baseline recorded on one is only as stable as the theme.
17
+ * - `light` or `dark` when the component was designed against a surface. Their
18
+ * colours are absolute, not theme tokens, so they are stable across runners.
19
+ * - `transparent` when the component's own transparency is under test (an
20
+ * outlined button, an icon, a divider). On an opaque colour a transparent
21
+ * fill and a painted fill produce the same pixels.
22
+ * - `dots`, `plain` or `checker` for browsing. They follow the active theme, so
23
+ * a baseline recorded on one is only as stable as the theme.
35
24
  */
36
25
  export const DEFAULT_VARIANT_BG = 'transparent';
37
26
  /**
38
27
  * The background a variant *declares*, or `null` when it declares none.
39
28
  *
40
- * Priority is variant, then component. `null` is a meaningful answer — it is
29
+ * Priority is variant, then component. `null` is a meaningful answer. It is
41
30
  * what lets the canvas keep the user's own background choice instead of
42
31
  * overwriting it, and what makes the background pill able to say "this is your
43
32
  * choice, not the component's".
@@ -53,8 +42,8 @@ export function declaredVariantBg(config, variantIndex) {
53
42
  /**
54
43
  * The background a variant renders on, always resolved to a concrete value.
55
44
  *
56
- * This is the answer external tooling needs — a screenshot runner cannot act
57
- * on "nothing declared" — and the one capture mode paints, so the value
45
+ * This is the answer external tooling needs, since a screenshot runner cannot act
46
+ * on "nothing declared". It is also what capture mode paints, so the value
58
47
  * reported by `__PRISM_MANIFEST__` and the pixels in the capture agree.
59
48
  */
60
49
  export function resolveVariantBg(config, variantIndex) {
@@ -1,20 +1,18 @@
1
1
  /**
2
2
  * The canvas viewport: one nullable number, not a device list.
3
3
  *
4
- * The question this tool answers is "where does the layout break", not "how
5
- * does it look on a Pixel 8" — so the presets below are plain widths and carry
6
- * no device names. A name would imply a simulation the constraint does not
7
- * perform: it narrows the box and nothing else. Media queries still read the
8
- * real browser viewport; only `@container` rules respond.
4
+ * The tool is for finding where a layout breaks, so the presets are plain
5
+ * widths without device names. A device name would suggest a simulation; the
6
+ * constraint only narrows the box. Media queries still read the real browser
7
+ * viewport; only `@container` rules respond.
9
8
  */
10
9
  /**
11
10
  * The narrowest the constraint will go.
12
11
  *
13
- * Below any real device on purpose. The presets cover the widths people design
14
- * against; this floor is for the other half of the job — dragging past where a
15
- * layout still works to find the point at which it gives up. A floor set to the
16
- * narrowest real phone would put that point out of reach on exactly the
17
- * components most worth checking.
12
+ * Below any real device. The presets cover the widths people design against;
13
+ * the floor lets a drag go past them to find where a layout breaks. A floor at
14
+ * the narrowest real phone would hide that point for the components most worth
15
+ * checking.
18
16
  */
19
17
  export declare const VIEWPORT_MIN = 100;
20
18
  /** Wide enough for a desktop breakpoint, short of the point where the stage scrolls on any realistic screen. */
@@ -27,21 +25,19 @@ export declare const VIEWPORT_SNAP_TOLERANCE = 8;
27
25
  * The named widths, as numbers.
28
26
  *
29
27
  * Common CSS breakpoints plus the two phone widths that actually differ from
30
- * them. Rendered as the "Width" group in the canvas tools menu, exactly like
31
- * the zoom chooser next to it.
28
+ * them. Rendered as the "Width" group in the canvas tools menu, like the zoom
29
+ * chooser next to it.
32
30
  */
33
31
  export declare const VIEWPORT_SNAPS: readonly number[];
34
32
  /**
35
33
  * `width` brought inside the legal range and onto a whole pixel.
36
34
  *
37
- * Lives beside the bounds it enforces rather than next to the canvas's
38
- * snapping: the clamp is the service's business — it is what keeps a stored
39
- * or programmatic width legal — and a service reaching into the canvas UI
40
- * folder for arithmetic over these two constants was the wrong direction.
35
+ * Lives next to the bounds, not the canvas snapping, because the service uses
36
+ * it to keep stored and programmatic widths legal and should not import from
37
+ * the canvas UI folder.
41
38
  *
42
- * Rounded rather than truncated: the value is read back out as a label on the
43
- * canvas, and `389.6 px` under a drag reads as a rendering fault rather than as
44
- * the sub-pixel arithmetic it is.
39
+ * Rounded, not truncated: the value is shown as a label on the canvas, and
40
+ * `389.6 px` during a drag looks like a rendering bug.
45
41
  */
46
42
  export declare function clampViewportWidth(width: number): number;
47
43
  //# sourceMappingURL=viewport.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewport.type.d.ts","sourceRoot":"","sources":["../../src/shared/viewport.type.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,gHAAgH;AAChH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAAoC,CAAC;AAEjF;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD"}
1
+ {"version":3,"file":"viewport.type.d.ts","sourceRoot":"","sources":["../../src/shared/viewport.type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,gHAAgH;AAChH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAAoC,CAAC;AAEjF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -1,20 +1,18 @@
1
1
  /**
2
2
  * The canvas viewport: one nullable number, not a device list.
3
3
  *
4
- * The question this tool answers is "where does the layout break", not "how
5
- * does it look on a Pixel 8" — so the presets below are plain widths and carry
6
- * no device names. A name would imply a simulation the constraint does not
7
- * perform: it narrows the box and nothing else. Media queries still read the
8
- * real browser viewport; only `@container` rules respond.
4
+ * The tool is for finding where a layout breaks, so the presets are plain
5
+ * widths without device names. A device name would suggest a simulation; the
6
+ * constraint only narrows the box. Media queries still read the real browser
7
+ * viewport; only `@container` rules respond.
9
8
  */
10
9
  /**
11
10
  * The narrowest the constraint will go.
12
11
  *
13
- * Below any real device on purpose. The presets cover the widths people design
14
- * against; this floor is for the other half of the job — dragging past where a
15
- * layout still works to find the point at which it gives up. A floor set to the
16
- * narrowest real phone would put that point out of reach on exactly the
17
- * components most worth checking.
12
+ * Below any real device. The presets cover the widths people design against;
13
+ * the floor lets a drag go past them to find where a layout breaks. A floor at
14
+ * the narrowest real phone would hide that point for the components most worth
15
+ * checking.
18
16
  */
19
17
  export const VIEWPORT_MIN = 100;
20
18
  /** Wide enough for a desktop breakpoint, short of the point where the stage scrolls on any realistic screen. */
@@ -27,21 +25,19 @@ export const VIEWPORT_SNAP_TOLERANCE = 8;
27
25
  * The named widths, as numbers.
28
26
  *
29
27
  * Common CSS breakpoints plus the two phone widths that actually differ from
30
- * them. Rendered as the "Width" group in the canvas tools menu, exactly like
31
- * the zoom chooser next to it.
28
+ * them. Rendered as the "Width" group in the canvas tools menu, like the zoom
29
+ * chooser next to it.
32
30
  */
33
31
  export const VIEWPORT_SNAPS = [320, 390, 480, 640, 768, 1024];
34
32
  /**
35
33
  * `width` brought inside the legal range and onto a whole pixel.
36
34
  *
37
- * Lives beside the bounds it enforces rather than next to the canvas's
38
- * snapping: the clamp is the service's business — it is what keeps a stored
39
- * or programmatic width legal — and a service reaching into the canvas UI
40
- * folder for arithmetic over these two constants was the wrong direction.
35
+ * Lives next to the bounds, not the canvas snapping, because the service uses
36
+ * it to keep stored and programmatic widths legal and should not import from
37
+ * the canvas UI folder.
41
38
  *
42
- * Rounded rather than truncated: the value is read back out as a label on the
43
- * canvas, and `389.6 px` under a drag reads as a rendering fault rather than as
44
- * the sub-pixel arithmetic it is.
39
+ * Rounded, not truncated: the value is shown as a label on the canvas, and
40
+ * `389.6 px` during a drag looks like a rendering bug.
45
41
  */
46
42
  export function clampViewportWidth(width) {
47
43
  return Math.round(Math.max(VIEWPORT_MIN, Math.min(VIEWPORT_MAX, width)));
@@ -168,7 +168,7 @@ export function stripShowcaseDecorators(source, fileName = 'file.ts') {
168
168
  const leak = findShowcaseLeak(audited, importInfo.localNames);
169
169
  if (leak) {
170
170
  throw new Error(`[ng-prism] Showcase reference '${leak.name}' left in output after stripping at ${fileName}:${leak.line}. ` +
171
- `The Showcase import was removed but a reference remains — this would cause a ReferenceError at runtime. ` +
171
+ `The Showcase import was removed but a reference remains, which would cause a ReferenceError at runtime. ` +
172
172
  `This is a transformer bug; please report the input source.`);
173
173
  }
174
174
  return output;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ng-prism/core",
3
- "version": "22.3.0",
4
- "description": "ng-prism — the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
3
+ "version": "22.4.1",
4
+ "description": "ng-prism: the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
5
5
  "keywords": [
6
6
  "ng-prism",
7
7
  "angular",
@@ -100,9 +100,9 @@
100
100
  },
101
101
  "repository": {
102
102
  "type": "git",
103
- "url": "https://github.com/dyingangel666/ng-prism.git",
103
+ "url": "https://github.com/ng-prism/ng-prism.git",
104
104
  "directory": "packages/ng-prism"
105
105
  },
106
- "homepage": "https://dyingangel666.github.io/ng-prism/",
107
- "bugs": "https://github.com/dyingangel666/ng-prism/issues"
106
+ "homepage": "https://ng-prism.github.io/ng-prism/",
107
+ "bugs": "https://github.com/ng-prism/ng-prism/issues"
108
108
  }