@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.
- package/README.md +13 -13
- package/dist/app/canvas/canvas-bg.styles.d.ts +7 -12
- package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
- package/dist/app/canvas/canvas-bg.styles.js +35 -37
- package/dist/app/canvas/measure-geometry.d.ts +140 -0
- package/dist/app/canvas/measure-geometry.d.ts.map +1 -0
- package/dist/app/canvas/measure-geometry.js +217 -0
- package/dist/app/canvas/measure-keyboard.d.ts +20 -0
- package/dist/app/canvas/measure-keyboard.d.ts.map +1 -0
- package/dist/app/canvas/measure-keyboard.js +34 -0
- package/dist/app/canvas/measure-quad.d.ts +114 -0
- package/dist/app/canvas/measure-quad.d.ts.map +1 -0
- package/dist/app/canvas/measure-quad.js +173 -0
- package/dist/app/canvas/measure-snap.d.ts +35 -0
- package/dist/app/canvas/measure-snap.d.ts.map +1 -0
- package/dist/app/canvas/measure-snap.js +63 -0
- package/dist/app/canvas/prism-canvas-measure.component.d.ts +142 -0
- package/dist/app/canvas/prism-canvas-measure.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-measure.component.js +554 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.d.ts +23 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.js +64 -0
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +22 -39
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +61 -69
- package/dist/app/canvas/prism-template-popover.component.js +1 -1
- package/dist/app/canvas/viewport-snap.d.ts +1 -1
- package/dist/app/canvas/viewport-snap.js +1 -1
- package/dist/app/component-head/head-metrics.d.ts +2 -2
- package/dist/app/component-head/head-metrics.js +1 -1
- package/dist/app/component-head/prism-component-head.component.d.ts +2 -2
- package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-component-head.component.js +11 -18
- package/dist/app/component-head/prism-head-gauge.component.js +1 -1
- package/dist/app/component-head/prism-head-info.component.d.ts +1 -1
- package/dist/app/component-head/prism-head-info.component.js +2 -2
- package/dist/app/component-head/prism-stat.component.d.ts +1 -1
- package/dist/app/component-head/prism-stat.component.js +2 -2
- package/dist/app/directives/prism-resizer.directive.d.ts +1 -1
- package/dist/app/directives/prism-resizer.directive.js +2 -2
- package/dist/app/directives/resize-value.d.ts +2 -2
- package/dist/app/directives/resize-value.js +2 -2
- package/dist/app/discovery-manifest.d.ts +2 -2
- package/dist/app/discovery-manifest.d.ts.map +1 -1
- package/dist/app/discovery-manifest.js +11 -15
- package/dist/app/header/prism-header.component.js +1 -1
- package/dist/app/icons/icon-registry.d.ts +2 -2
- package/dist/app/icons/icon-registry.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.js +3 -2
- package/dist/app/icons/prism-icon.component.d.ts +2 -2
- package/dist/app/icons/prism-icon.component.js +4 -4
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +14 -21
- package/dist/app/overview/overview-visibility.d.ts +1 -1
- package/dist/app/overview/overview-visibility.js +1 -1
- package/dist/app/overview/prism-overview-cell.component.d.ts +2 -2
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview-cell.component.js +9 -10
- package/dist/app/overview/prism-overview.component.d.ts +2 -2
- package/dist/app/overview/prism-overview.component.js +2 -2
- package/dist/app/page-renderer/prism-page-renderer.component.js +1 -1
- package/dist/app/panels/a11y/a11y-audit.service.js +2 -2
- package/dist/app/panels/a11y/a11y-summary.d.ts +3 -4
- package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-summary.js +3 -4
- package/dist/app/panels/a11y/a11y-thresholds.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-thresholds.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-thresholds.js +1 -1
- package/dist/app/panels/a11y/a11y.types.d.ts +1 -1
- package/dist/app/panels/a11y/a11y.types.d.ts.map +1 -1
- package/dist/app/panels/builtin-navigation-decorations.d.ts +1 -1
- package/dist/app/panels/builtin-navigation-decorations.js +1 -1
- package/dist/app/panels/controls/non-editable-input-types.js +1 -1
- package/dist/app/panels/panel-host/panel-badge.d.ts +1 -1
- package/dist/app/provide-prism.js +1 -1
- package/dist/app/renderer/known-inputs.d.ts +1 -1
- package/dist/app/renderer/known-inputs.js +1 -1
- package/dist/app/renderer/overlay-resolver.d.ts +17 -3
- package/dist/app/renderer/overlay-resolver.d.ts.map +1 -1
- package/dist/app/renderer/overlay-resolver.js +9 -4
- package/dist/app/renderer/prism-renderer.component.d.ts +3 -3
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +25 -16
- package/dist/app/renderer/projectable-content.js +3 -3
- package/dist/app/services/prism-canvas.service.d.ts +12 -1
- package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
- package/dist/app/services/prism-canvas.service.js +23 -5
- package/dist/app/services/prism-capture.service.d.ts +24 -50
- package/dist/app/services/prism-capture.service.d.ts.map +1 -1
- package/dist/app/services/prism-capture.service.js +60 -140
- package/dist/app/services/prism-measure.service.d.ts +44 -0
- package/dist/app/services/prism-measure.service.d.ts.map +1 -0
- package/dist/app/services/prism-measure.service.js +91 -0
- package/dist/app/services/prism-panel.service.d.ts +2 -2
- package/dist/app/services/prism-panel.service.js +2 -2
- package/dist/app/services/prism-persistence.service.js +1 -1
- package/dist/app/services/prism-renderer.service.js +1 -1
- package/dist/app/services/prism-url-state.service.js +1 -1
- package/dist/app/services/prism-variant-bg.service.d.ts +10 -24
- package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -1
- package/dist/app/services/prism-variant-bg.service.js +10 -24
- package/dist/app/shared/prism-metric-badge.component.d.ts +9 -15
- package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
- package/dist/app/shared/prism-metric-badge.component.js +10 -16
- package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
- package/dist/app/shell/prism-shell.component.js +12 -9
- package/dist/app/sidebar/navigation-decorations.d.ts +4 -4
- package/dist/app/sidebar/navigation-decorations.js +2 -2
- package/dist/app/sidebar/prism-sidebar.component.d.ts +2 -2
- package/dist/app/sidebar/prism-sidebar.component.js +3 -3
- package/dist/app/theme/prism-default-theme.js +3 -3
- package/dist/app/variant-ribbon/spectrum.d.ts +1 -1
- package/dist/app/variant-ribbon/spectrum.js +1 -1
- package/dist/app/view-tab-bar/next-view-id.d.ts +1 -1
- package/dist/app/view-tab-bar/next-view-id.js +1 -1
- package/dist/builder/a11y/a11y-report-reader.d.ts +1 -1
- package/dist/builder/a11y/a11y-report-reader.js +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.js +6 -2
- package/dist/builder/plugin-runner/plugin-runner.js +1 -1
- package/dist/builder/scanner/ast-utils.d.ts +46 -2
- package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
- package/dist/builder/scanner/ast-utils.js +337 -31
- package/dist/builder/scanner/class-hierarchy.d.ts +33 -0
- package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -0
- package/dist/builder/scanner/class-hierarchy.js +87 -0
- package/dist/builder/scanner/component.scanner.d.ts +7 -1
- package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/component.scanner.js +106 -58
- package/dist/builder/scanner/input.extractor.d.ts +7 -4
- package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.js +153 -55
- package/dist/builder/scanner/manifest.generator.js +6 -2
- package/dist/builder/scanner/scanner.d.ts +3 -1
- package/dist/builder/scanner/scanner.d.ts.map +1 -1
- package/dist/builder/scanner/scanner.js +6 -4
- package/dist/builder/scanner/showcase-diagnostics.d.ts +25 -0
- package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -0
- package/dist/builder/scanner/showcase-diagnostics.js +96 -0
- package/dist/builder/shared/prism-pipeline.d.ts +1 -1
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +12 -14
- package/dist/builder/watcher/prism-watcher.js +2 -2
- package/dist/decorator/showcase.types.d.ts +11 -9
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/plugin/define-config.js +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +5 -9
- package/dist/plugin/plugin.types.d.ts +30 -13
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.js +2 -2
- package/dist/schematics/ng-add/index.js +4 -4
- package/dist/shared/canvas-bg.type.d.ts +5 -6
- package/dist/shared/canvas-bg.type.d.ts.map +1 -1
- package/dist/shared/canvas-bg.type.js +4 -5
- package/dist/shared/measure.type.d.ts +52 -0
- package/dist/shared/measure.type.d.ts.map +1 -0
- package/dist/shared/measure.type.js +21 -0
- package/dist/shared/variant-bg.d.ts +20 -31
- package/dist/shared/variant-bg.d.ts.map +1 -1
- package/dist/shared/variant-bg.js +20 -31
- package/dist/shared/viewport.type.d.ts +15 -19
- package/dist/shared/viewport.type.d.ts.map +1 -1
- package/dist/shared/viewport.type.js +15 -19
- package/dist/transformer/showcase-strip.transformer.js +1 -1
- 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
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
|
16
|
+
* What to declare:
|
|
26
17
|
*
|
|
27
|
-
* - `light` or `dark` when the component was designed against a surface.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
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
|
|
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
|
|
68
|
-
* on "nothing declared"
|
|
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
|
|
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
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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
|
|
15
|
+
* What to declare:
|
|
25
16
|
*
|
|
26
|
-
* - `light` or `dark` when the component was designed against a surface.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
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
|
|
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
|
|
57
|
-
* on "nothing declared"
|
|
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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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,
|
|
31
|
-
*
|
|
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
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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
|
|
43
|
-
*
|
|
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
|
|
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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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,
|
|
31
|
-
*
|
|
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
|
|
38
|
-
*
|
|
39
|
-
*
|
|
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
|
|
43
|
-
*
|
|
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
|
|
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.
|
|
4
|
-
"description": "ng-prism
|
|
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/
|
|
103
|
+
"url": "https://github.com/ng-prism/ng-prism.git",
|
|
104
104
|
"directory": "packages/ng-prism"
|
|
105
105
|
},
|
|
106
|
-
"homepage": "https://
|
|
107
|
-
"bugs": "https://github.com/
|
|
106
|
+
"homepage": "https://ng-prism.github.io/ng-prism/",
|
|
107
|
+
"bugs": "https://github.com/ng-prism/ng-prism/issues"
|
|
108
108
|
}
|