@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
|
@@ -3,6 +3,7 @@ import { ChangeDetectionStrategy, Component, computed, DestroyRef, effect, Eleme
|
|
|
3
3
|
import { VIEWPORT_MAX, VIEWPORT_MIN } from '../../shared/viewport.type.js';
|
|
4
4
|
import { CANVAS_BG_STYLES } from '../canvas/canvas-bg.styles.js';
|
|
5
5
|
import { PrismCanvasBgPillComponent } from '../canvas/prism-canvas-bg-pill.component.js';
|
|
6
|
+
import { PrismCanvasMeasureComponent } from '../canvas/prism-canvas-measure.component.js';
|
|
6
7
|
import { PrismCanvasRulersComponent } from '../canvas/prism-canvas-rulers.component.js';
|
|
7
8
|
import { snapViewportWidth } from '../canvas/viewport-snap.js';
|
|
8
9
|
import { PrismResizerDirective } from '../directives/prism-resizer.directive.js';
|
|
@@ -22,7 +23,10 @@ import { resolveOverlay } from './overlay-resolver.js';
|
|
|
22
23
|
import { parseContentToNodes } from './projectable-content.js';
|
|
23
24
|
import * as i0 from "@angular/core";
|
|
24
25
|
const _c0 = ["outlet"];
|
|
25
|
-
function
|
|
26
|
+
function PrismRendererComponent_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
27
|
+
i0.ɵɵelement(0, "prism-canvas-measure");
|
|
28
|
+
} }
|
|
29
|
+
function PrismRendererComponent_Conditional_1_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
26
30
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
27
31
|
i0.ɵɵelementStart(0, "span", 4);
|
|
28
32
|
i0.ɵɵelement(1, "span", 5);
|
|
@@ -32,11 +36,11 @@ function PrismRendererComponent_Conditional_1_Conditional_3_Template(rf, ctx) {
|
|
|
32
36
|
i0.ɵɵelement(4, "span", 5);
|
|
33
37
|
i0.ɵɵelementEnd();
|
|
34
38
|
i0.ɵɵelementStart(5, "div", 7);
|
|
35
|
-
i0.ɵɵlistener("valueChange", function
|
|
39
|
+
i0.ɵɵlistener("valueChange", function PrismRendererComponent_Conditional_1_Conditional_4_Template_div_valueChange_5_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.onViewportResize($event)); });
|
|
36
40
|
i0.ɵɵelement(6, "span", 8);
|
|
37
41
|
i0.ɵɵelementEnd();
|
|
38
42
|
i0.ɵɵelementStart(7, "div", 9);
|
|
39
|
-
i0.ɵɵlistener("valueChange", function
|
|
43
|
+
i0.ɵɵlistener("valueChange", function PrismRendererComponent_Conditional_1_Conditional_4_Template_div_valueChange_7_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.onViewportResize($event)); });
|
|
40
44
|
i0.ɵɵelement(8, "span", 8);
|
|
41
45
|
i0.ɵɵelementEnd();
|
|
42
46
|
} if (rf & 2) {
|
|
@@ -51,13 +55,17 @@ function PrismRendererComponent_Conditional_1_Conditional_3_Template(rf, ctx) {
|
|
|
51
55
|
i0.ɵɵattribute("aria-valuenow", ctx_r1.viewportWidth())("aria-valuemin", ctx_r1.VIEWPORT_MIN)("aria-valuemax", ctx_r1.VIEWPORT_MAX);
|
|
52
56
|
} }
|
|
53
57
|
function PrismRendererComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
54
|
-
i0.ɵɵelement(0, "div", 3)(1, "prism-canvas-rulers")
|
|
55
|
-
i0.ɵɵconditionalCreate(
|
|
58
|
+
i0.ɵɵelement(0, "div", 3)(1, "prism-canvas-rulers");
|
|
59
|
+
i0.ɵɵconditionalCreate(2, PrismRendererComponent_Conditional_1_Conditional_2_Template, 1, 0, "prism-canvas-measure");
|
|
60
|
+
i0.ɵɵelement(3, "prism-canvas-bg-pill");
|
|
61
|
+
i0.ɵɵconditionalCreate(4, PrismRendererComponent_Conditional_1_Conditional_4_Template, 9, 15);
|
|
56
62
|
} if (rf & 2) {
|
|
57
63
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
58
64
|
i0.ɵɵclassProp("visible", ctx_r1.canvasService.guides());
|
|
59
|
-
i0.ɵɵadvance(
|
|
60
|
-
i0.ɵɵconditional(ctx_r1.
|
|
65
|
+
i0.ɵɵadvance(2);
|
|
66
|
+
i0.ɵɵconditional(ctx_r1.canvasService.measure() ? 2 : -1);
|
|
67
|
+
i0.ɵɵadvance(2);
|
|
68
|
+
i0.ɵɵconditional(ctx_r1.viewportWidth() !== null ? 4 : -1);
|
|
61
69
|
} }
|
|
62
70
|
function PrismRendererComponent_Conditional_5_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
63
71
|
i0.ɵɵelementContainer(0);
|
|
@@ -80,7 +88,7 @@ export class PrismRendererComponent {
|
|
|
80
88
|
* Every viewport binding reads this rather than the service directly, so
|
|
81
89
|
* capture mode cannot be constrained by any route. Previously only the grips
|
|
82
90
|
* and the dimension line sat behind the capture guard while the attributes
|
|
83
|
-
* that change `.demo-wrap`'s box did not
|
|
91
|
+
* that change `.demo-wrap`'s box did not. Safe in practice, because capture
|
|
84
92
|
* never restores a persisted width and every setter is suppressed, but safe
|
|
85
93
|
* by reachability argument rather than by construction. A future caller of
|
|
86
94
|
* `setViewportWidth` during a capture run would have recorded every
|
|
@@ -94,7 +102,7 @@ export class PrismRendererComponent {
|
|
|
94
102
|
/**
|
|
95
103
|
* A drag on either grip, rested on a preset if it came close enough.
|
|
96
104
|
*
|
|
97
|
-
* The snapping lives here and not in `PrismResizerDirective`
|
|
105
|
+
* The snapping lives here and not in `PrismResizerDirective` because the
|
|
98
106
|
* directive also drives the sidebar and the panel, where there is nothing to
|
|
99
107
|
* snap to, and a generic control that knows about viewport presets would be
|
|
100
108
|
* the wrong shape.
|
|
@@ -131,7 +139,7 @@ export class PrismRendererComponent {
|
|
|
131
139
|
return `${comp.meta.className}:${this.rendererService.activeVariantIndex()}`;
|
|
132
140
|
}, /* @ts-ignore */
|
|
133
141
|
...(ngDevMode ? [{ debugName: "renderedKey" }] : /* istanbul ignore next */ []));
|
|
134
|
-
/** Resolved canvas layout for the active variant
|
|
142
|
+
/** Resolved canvas layout for the active variant. Variant overrides component config; defaults to 'fit'. */
|
|
135
143
|
canvasLayout = computed(() => {
|
|
136
144
|
const comp = this.navigationService.activeComponent();
|
|
137
145
|
if (!comp)
|
|
@@ -178,7 +186,7 @@ export class PrismRendererComponent {
|
|
|
178
186
|
const knownInputs = buildKnownInputs(comp);
|
|
179
187
|
for (const [key, value] of Object.entries(inputs)) {
|
|
180
188
|
if (!knownInputs.has(key)) {
|
|
181
|
-
console.warn(`[ng-prism] Unknown input "${key}" on <${comp.meta.componentMeta.selector}
|
|
189
|
+
console.warn(`[ng-prism] Unknown input "${key}" on <${comp.meta.componentMeta.selector}>, skipping. Remove it from @Showcase variants.`);
|
|
182
190
|
continue;
|
|
183
191
|
}
|
|
184
192
|
ref.setInput(key, value);
|
|
@@ -192,6 +200,7 @@ export class PrismRendererComponent {
|
|
|
192
200
|
const allPanels = [...BUILTIN_PANELS, ...this.pluginService.panels()];
|
|
193
201
|
const resolution = resolveOverlay(allPanels, panelId, {
|
|
194
202
|
captureActive: this.capture.active(),
|
|
203
|
+
measureActive: this.canvasService.measure(),
|
|
195
204
|
cache: this.overlayCache
|
|
196
205
|
});
|
|
197
206
|
if (resolution.kind === 'eager') {
|
|
@@ -256,7 +265,7 @@ export class PrismRendererComponent {
|
|
|
256
265
|
const knownInputs = buildKnownInputs(comp);
|
|
257
266
|
for (const [key, value] of Object.entries(this.rendererService.inputValues())) {
|
|
258
267
|
if (!knownInputs.has(key)) {
|
|
259
|
-
console.warn(`[ng-prism] Unknown input "${key}" on <${selector}
|
|
268
|
+
console.warn(`[ng-prism] Unknown input "${key}" on <${selector}>, skipping. Remove it from @Showcase variants.`);
|
|
260
269
|
continue;
|
|
261
270
|
}
|
|
262
271
|
this.componentRef.setInput(key, value);
|
|
@@ -288,7 +297,7 @@ export class PrismRendererComponent {
|
|
|
288
297
|
i0.ɵɵqueryAdvance();
|
|
289
298
|
} }, decls: 6, vars: 14, consts: [["outlet", ""], [1, "prism-canvas-stage"], [1, "demo-wrap"], [1, "stage-crosshair"], [1, "vp-dim"], [1, "vp-dim__rule"], [1, "vp-dim__v"], ["prismResizer", "", "axis", "x", "aria-label", "Viewport width, left edge", 1, "vp-grip", 3, "valueChange", "scale", "min", "max", "value"], [1, "vp-grip__bar"], ["prismResizer", "", "axis", "x", "aria-label", "Viewport width, right edge", 1, "vp-grip", "vp-grip--end", 3, "valueChange", "scale", "min", "max", "value"], [4, "ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector"]], template: function PrismRendererComponent_Template(rf, ctx) { if (rf & 1) {
|
|
290
299
|
i0.ɵɵelementStart(0, "div", 1);
|
|
291
|
-
i0.ɵɵconditionalCreate(1, PrismRendererComponent_Conditional_1_Template,
|
|
300
|
+
i0.ɵɵconditionalCreate(1, PrismRendererComponent_Conditional_1_Template, 5, 4);
|
|
292
301
|
i0.ɵɵelementStart(2, "div", 2);
|
|
293
302
|
i0.ɵɵelementContainer(3, null, 0);
|
|
294
303
|
i0.ɵɵconditionalCreate(5, PrismRendererComponent_Conditional_5_Template, 1, 3, "ng-container");
|
|
@@ -303,12 +312,12 @@ export class PrismRendererComponent {
|
|
|
303
312
|
i0.ɵɵattribute("data-prism-rendered", ctx.renderedKey())("data-canvas-layout", ctx.canvasLayout())("data-viewport", ctx.viewportWidth() !== null ? "" : null);
|
|
304
313
|
i0.ɵɵadvance(3);
|
|
305
314
|
i0.ɵɵconditional(ctx.activeOverlay() ? 5 : -1);
|
|
306
|
-
} }, dependencies: [PrismCanvasRulersComponent, PrismCanvasBgPillComponent, NgComponentOutlet, PrismResizerDirective], styles: ["[_nghost-%COMP%] {\n display: block;\n flex: 1;\n min-height: 0;\n}\n\n.prism-canvas-stage[_ngcontent-%COMP%] {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n min-height: 200px;\n padding: 32px;\n overflow: auto;\n\n \n\n\n\n\n\n\n\n\n\n\n outline: 1px solid var(--%NS%prism-stage-edge);\n outline-offset: -1px;\n background-color: var(--%NS%prism-stage);\n box-shadow:\n 0 1px 3px rgb(0 0 0 / 10%),\n 0 8px 24px -12px rgb(0 0 0 / 18%);\n transition: filter var(--%NS%dur-base);\n\n --%NS%prism-canvas-overlay-top: 12px;\n --%NS%prism-canvas-overlay-inline: 20px;\n}\n\n.prism-canvas-stage[data-rulers][_ngcontent-%COMP%] {\n --%NS%prism-canvas-overlay-top: 28px;\n --%NS%prism-canvas-overlay-inline: 28px;\n}\n\n.stage-crosshair[_ngcontent-%COMP%] {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--%NS%dur-base);\n}\n\n.stage-crosshair.visible[_ngcontent-%COMP%] {\n opacity: 1;\n}\n\n.stage-crosshair[_ngcontent-%COMP%]::before, \n.stage-crosshair[_ngcontent-%COMP%]::after {\n position: absolute;\n content: '';\n background: color-mix(in srgb, var(--%NS%prism-primary) 20%, transparent);\n}\n\n.stage-crosshair[_ngcontent-%COMP%]::before {\n top: 50%;\n right: 0;\n left: 0;\n height: 1px;\n}\n\n.stage-crosshair[_ngcontent-%COMP%]::after {\n top: 0;\n bottom: 0;\n left: 50%;\n width: 1px;\n}\n\n.demo-wrap[_ngcontent-%COMP%] {\n position: relative;\n display: inline-block;\n transform: scale(var(--%NS%zoom, 1));\n transition: transform 0.18s;\n}\n\n.demo-wrap[data-canvas-layout='stretch'][_ngcontent-%COMP%] {\n display: block;\n width: 100%;\n max-width: 800px;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
|
|
315
|
+
} }, dependencies: [PrismCanvasRulersComponent, PrismCanvasBgPillComponent, PrismCanvasMeasureComponent, NgComponentOutlet, PrismResizerDirective], styles: ["[_nghost-%COMP%] {\n display: block;\n flex: 1;\n min-height: 0;\n}\n\n.prism-canvas-stage[_ngcontent-%COMP%] {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n min-height: 200px;\n padding: 32px;\n overflow: auto;\n\n \n\n\n\n\n\n\n\n\n\n\n outline: 1px solid var(--%NS%prism-stage-edge);\n outline-offset: -1px;\n background-color: var(--%NS%prism-stage);\n box-shadow:\n 0 1px 3px rgb(0 0 0 / 10%),\n 0 8px 24px -12px rgb(0 0 0 / 18%);\n transition: filter var(--%NS%dur-base);\n\n --%NS%prism-canvas-overlay-top: 12px;\n --%NS%prism-canvas-overlay-inline: 20px;\n}\n\n.prism-canvas-stage[data-rulers][_ngcontent-%COMP%] {\n --%NS%prism-canvas-overlay-top: 28px;\n --%NS%prism-canvas-overlay-inline: 28px;\n}\n\n.stage-crosshair[_ngcontent-%COMP%] {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--%NS%dur-base);\n}\n\n.stage-crosshair.visible[_ngcontent-%COMP%] {\n opacity: 1;\n}\n\n.stage-crosshair[_ngcontent-%COMP%]::before, \n.stage-crosshair[_ngcontent-%COMP%]::after {\n position: absolute;\n content: '';\n background: color-mix(in srgb, var(--%NS%prism-primary) 20%, transparent);\n}\n\n.stage-crosshair[_ngcontent-%COMP%]::before {\n top: 50%;\n right: 0;\n left: 0;\n height: 1px;\n}\n\n.stage-crosshair[_ngcontent-%COMP%]::after {\n top: 0;\n bottom: 0;\n left: 50%;\n width: 1px;\n}\n\n.demo-wrap[_ngcontent-%COMP%] {\n position: relative;\n display: inline-block;\n transform: scale(var(--%NS%zoom, 1));\n transition: transform 0.18s;\n}\n\n.demo-wrap[data-canvas-layout='stretch'][_ngcontent-%COMP%] {\n display: block;\n width: 100%;\n max-width: 800px;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n.demo-wrap[data-viewport][_ngcontent-%COMP%] {\n display: grid;\n\n \n\n\n\n\n\n\n\n\n flex: none;\n\n \n\n\n\n\n\n\n justify-items: safe center;\n width: var(--%NS%prism-vp-w);\n max-width: none;\n container-type: inline-size;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n.vp-grip[_ngcontent-%COMP%] {\n position: absolute;\n top: var(--%NS%prism-canvas-overlay-top, 12px);\n bottom: 0;\n left: calc(50% - var(--%NS%prism-vp-w) * var(--%NS%zoom, 1) / 2 - 4.5px);\n z-index: 4;\n display: grid;\n width: 9px;\n\n \n\n\n\n\n\n pointer-events: none;\n background: transparent;\n}\n\n.vp-grip--end[_ngcontent-%COMP%] {\n right: calc(50% - var(--%NS%prism-vp-w) * var(--%NS%zoom, 1) / 2 - 4.5px);\n left: auto;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n.vp-grip__bar[_ngcontent-%COMP%] {\n z-index: 1;\n box-sizing: content-box;\n grid-area: 1 / 1;\n place-self: center center;\n width: 3px;\n height: 34px;\n padding: 5px 3px;\n pointer-events: auto;\n background: color-mix(in srgb, var(--%NS%prism-measure) 80%, transparent);\n background-clip: content-box;\n border-radius: 2px;\n transition: background var(--%NS%dur-fast);\n}\n\n\n\n\n\n\n.vp-grip[_ngcontent-%COMP%]::after {\n grid-area: 1 / 1;\n place-self: stretch center;\n width: 1px;\n content: '';\n background: color-mix(in srgb, var(--%NS%prism-measure) 75%, transparent);\n transition: background var(--%NS%dur-fast);\n}\n\n.vp-grip[_ngcontent-%COMP%]:hover::after, \n.vp-grip.active[_ngcontent-%COMP%]::after, \n.vp-grip[_ngcontent-%COMP%]:focus-visible::after {\n background: color-mix(in srgb, var(--%NS%prism-measure) 55%, transparent);\n}\n\n.vp-grip[_ngcontent-%COMP%]:hover .vp-grip__bar[_ngcontent-%COMP%], \n.vp-grip.active[_ngcontent-%COMP%] .vp-grip__bar[_ngcontent-%COMP%], \n.vp-grip[_ngcontent-%COMP%]:focus-visible .vp-grip__bar[_ngcontent-%COMP%] {\n background: var(--%NS%prism-measure);\n background-clip: content-box;\n}\n\n\n\n\n.vp-grip[_ngcontent-%COMP%]:focus-visible {\n outline: none;\n}\n\n.vp-grip[_ngcontent-%COMP%]:focus-visible .vp-grip__bar[_ngcontent-%COMP%] {\n outline: 2px solid var(--%NS%prism-primary);\n outline-offset: 1px;\n}\n\n\n\n\n\n\n\n\n\n\n.vp-dim[_ngcontent-%COMP%] {\n position: absolute;\n top: var(--%NS%prism-canvas-overlay-top, 12px);\n left: 50%;\n z-index: 4;\n display: flex;\n gap: var(--%NS%sp-3);\n align-items: center;\n width: calc(var(--%NS%prism-vp-w) * var(--%NS%zoom, 1));\n pointer-events: none;\n transform: translateX(-50%);\n}\n\n\n\n\n.vp-dim__rule[_ngcontent-%COMP%] {\n position: relative;\n flex: 1;\n height: 1px;\n background: color-mix(in srgb, var(--%NS%prism-measure) 70%, transparent);\n}\n\n\n\n\n.vp-dim__rule[_ngcontent-%COMP%]::before {\n position: absolute;\n top: -3px;\n width: 1px;\n height: 7px;\n content: '';\n background: color-mix(in srgb, var(--%NS%prism-measure) 90%, transparent);\n}\n\n.vp-dim__rule[_ngcontent-%COMP%]:first-child::before {\n left: 0;\n}\n\n.vp-dim__rule[_ngcontent-%COMP%]:last-child::before {\n right: 0;\n}\n\n.vp-dim__v[_ngcontent-%COMP%] {\n flex: none;\n font-family: var(--%NS%font-mono);\n font-size: 9px;\n color: var(--%NS%prism-measure);\n white-space: nowrap;\n}", "[data-bg=\"dots\"][_ngcontent-%COMP%] {\n background-image: radial-gradient(circle, var(--%NS%prism-dot) 1px, transparent 1px);\n background-size: 20px 20px;\n }\n\n [data-bg=\"plain\"][_ngcontent-%COMP%] {\n background-image: none;\n }\n\n \n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n [data-bg=\"light\"][_ngcontent-%COMP%] {\n background-color: var(--%NS%prism-void-light, #f7f5fc);\n background-image: none;\n --%NS%prism-measure: #ca00c1;\n --%NS%prism-measure-plate: var(--%NS%prism-void-light, #f7f5fc);\n }\n [data-bg=\"dark\"][_ngcontent-%COMP%] {\n background-color: var(--%NS%prism-void-dark, #07050f);\n background-image: none;\n --%NS%prism-measure: #f632ff;\n --%NS%prism-measure-plate: var(--%NS%prism-void-dark, #07050f);\n }\n\n \n\n\n [data-bg=\"checker\"][_ngcontent-%COMP%], \n [data-bg=\"transparent\"][_ngcontent-%COMP%] {\n background-image:\n linear-gradient(45deg, var(--%NS%prism-border) 25%, transparent 25%),\n linear-gradient(-45deg, var(--%NS%prism-border) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--%NS%prism-border) 75%),\n linear-gradient(-45deg, transparent 75%, var(--%NS%prism-border) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n }"] });
|
|
307
316
|
}
|
|
308
317
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismRendererComponent, [{
|
|
309
318
|
type: Component,
|
|
310
|
-
args: [{ selector: 'prism-renderer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismCanvasRulersComponent, PrismCanvasBgPillComponent, NgComponentOutlet, PrismResizerDirective], template: "<div\n class=\"prism-canvas-stage\"\n [attr.data-bg]=\"variantBg.effective()\"\n [attr.data-rulers]=\"canvasService.rulers() ? '' : null\"\n [attr.data-viewport]=\"viewportWidth() !== null ? '' : null\"\n [style.--prism-vp-w.px]=\"viewportWidth()\"\n [style.--zoom]=\"canvasService.zoom()\">\n @if (!capture.active()) {\n <div\n class=\"stage-crosshair\"\n [class.visible]=\"canvasService.guides()\"></div>\n <prism-canvas-rulers />\n <prism-canvas-bg-pill />\n @if (viewportWidth() !== null) {\n <!-- Grips and the dimension line are siblings of .demo-wrap, never\n children of it: .demo-wrap is what plugin-visual-regression\n screenshots, and anything inside it composites into every baseline.\n They sit inside the capture guard for the same reason the rulers and\n the pill do. -->\n <span class=\"vp-dim\">\n <span class=\"vp-dim__rule\"></span>\n <span class=\"vp-dim__v\">{{ viewportWidth() }} px</span>\n <span class=\"vp-dim__rule\"></span>\n </span>\n <div\n class=\"vp-grip\"\n prismResizer\n axis=\"x\"\n [scale]=\"-2 / (canvasService.zoom() || 1)\"\n [min]=\"VIEWPORT_MIN\"\n [max]=\"VIEWPORT_MAX\"\n [value]=\"viewportWidth()!\"\n (valueChange)=\"onViewportResize($event)\"\n aria-label=\"Viewport width, left edge\"\n [attr.aria-valuenow]=\"viewportWidth()\"\n [attr.aria-valuemin]=\"VIEWPORT_MIN\"\n [attr.aria-valuemax]=\"VIEWPORT_MAX\">\n <span class=\"vp-grip__bar\"></span>\n </div>\n <div\n class=\"vp-grip vp-grip--end\"\n prismResizer\n axis=\"x\"\n [scale]=\"2 / (canvasService.zoom() || 1)\"\n [min]=\"VIEWPORT_MIN\"\n [max]=\"VIEWPORT_MAX\"\n [value]=\"viewportWidth()!\"\n (valueChange)=\"onViewportResize($event)\"\n aria-label=\"Viewport width, right edge\"\n [attr.aria-valuenow]=\"viewportWidth()\"\n [attr.aria-valuemin]=\"VIEWPORT_MIN\"\n [attr.aria-valuemax]=\"VIEWPORT_MAX\">\n <span class=\"vp-grip__bar\"></span>\n </div>\n }\n }\n\n <div\n class=\"demo-wrap\"\n [style.--zoom]=\"canvasService.zoom()\"\n [attr.data-prism-rendered]=\"renderedKey()\"\n [attr.data-canvas-layout]=\"canvasLayout()\"\n [attr.data-viewport]=\"viewportWidth() !== null ? '' : null\">\n <ng-container #outlet />\n @if (activeOverlay()) {\n <ng-container *ngComponentOutlet=\"activeOverlay()!; inputs: overlayInputs; injector: overlayInjector()\" />\n }\n </div>\n</div>\n", styles: [":host {\n display: block;\n flex: 1;\n min-height: 0;\n}\n\n.prism-canvas-stage {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n min-height: 200px;\n padding: 32px;\n overflow: auto;\n\n /* The edge is outline + shadow, never border and never extra padding.\n plugin-visual-regression screenshots .demo-wrap, which is centred in\n this element; a border would shrink the content box by 2px and move\n that centre, shifting all 15 baselines in test-workspace/vrt/baseline\n without a single component having changed. Capture mode resets this\n element's padding but not its border, and this repo has no VRT runner\n to catch the drift. outline and box-shadow do not participate in\n layout, so the box is provably unchanged. Keep it that way.\n They do still paint, and outline-offset is negative, so the line lands\n inside the box: CAPTURE_STYLES in prism-capture.service.ts sets both\n to none, which is only safe because neither is load-bearing here. */\n outline: 1px solid var(--prism-stage-edge);\n outline-offset: -1px;\n background-color: var(--prism-stage);\n box-shadow:\n 0 1px 3px rgb(0 0 0 / 10%),\n 0 8px 24px -12px rgb(0 0 0 / 18%);\n transition: filter var(--dur-base);\n\n --prism-canvas-overlay-top: 12px;\n --prism-canvas-overlay-inline: 20px;\n}\n\n.prism-canvas-stage[data-rulers] {\n --prism-canvas-overlay-top: 28px;\n --prism-canvas-overlay-inline: 28px;\n}\n\n.stage-crosshair {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--dur-base);\n}\n\n.stage-crosshair.visible {\n opacity: 1;\n}\n\n.stage-crosshair::before,\n.stage-crosshair::after {\n position: absolute;\n content: '';\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n}\n\n.stage-crosshair::before {\n top: 50%;\n right: 0;\n left: 0;\n height: 1px;\n}\n\n.stage-crosshair::after {\n top: 0;\n bottom: 0;\n left: 50%;\n width: 1px;\n}\n\n.demo-wrap {\n position: relative;\n display: inline-block;\n transform: scale(var(--zoom, 1));\n transition: transform 0.18s;\n}\n\n.demo-wrap[data-canvas-layout='stretch'] {\n display: block;\n width: 100%;\n max-width: 800px;\n}\n\n/* max-width: none rather than min(800px, var(--prism-vp-w)): an explicitly\n requested width beats a layout default, and min() would silently cap a\n 1024 viewport at 800 on any component declaring canvasLayout:\n 'stretch'.\n\n container-type is confined to this rule, and that confinement is\n load-bearing. It implies contain: inline-size, which on the width:auto\n inline-block .demo-wrap is at rest would decouple its width from its\n contents \u2014 collapsing the box and shifting every baseline in\n test-workspace/vrt/baseline without a component having changed. Here\n the width is explicit, so containment costs nothing and is what makes\n a component's own @container rules respond. Media queries do not and\n cannot: they read the real browser viewport.\n\n grid + justify-items: center, and not text-align: center, which is the\n obvious way to centre an inline-level child and the wrong one. The\n showcase component is created through ViewContainerRef, so its host\n element carries none of this component's _ngcontent attribute and no\n scoped rule here can reach it to undo an inherited value. text-align\n would therefore leak all the way into the specimen and silently\n re-align its own text the moment the viewport is switched on \u2014 a\n canvas that lies about what it is showing. Centring at the container\n instead touches nothing inside.\n\n Shrinking is not a side effect of that choice, it is the resting\n behaviour preserved: at rest .demo-wrap is an inline-block that\n already shrink-wraps its child, so a block-level specimen sizes to its\n content here exactly as it does with the constraint off. The implicit\n auto column still fills the declared width, so a component that asks\n for width: 100% \u2014 the canvasLayout: 'stretch' case \u2014 keeps getting the\n whole viewport. */\n.demo-wrap[data-viewport] {\n display: grid;\n\n /* flex: none, and it is load-bearing. The stage is a flex container\n and this is its only item, so the default flex-shrink: 1 lets the\n box render narrower than the width just asked for whenever the\n canvas is the smaller of the two \u2014 and container-type below drops\n the automatic minimum size to zero, so nothing stops the shrink.\n The result is the one failure this whole feature cannot afford:\n the dimension line states 1024 while every @container rule in the\n specimen answers whatever the canvas happened to allow. The stage\n is overflow: auto, so refusing to shrink scrolls instead. */\n flex: none;\n\n /* safe center, not bare center. Centring is right while the specimen\n fits and wrong the moment it does not: bare centring spills an\n over-wide specimen equally past both edges, where a real viewport of\n that width clips at zero and scrolls in one direction. The safe\n keyword falls back to start exactly when the item overflows, which\n is the browser making a case distinction CSS cannot otherwise\n express. */\n justify-items: safe center;\n width: var(--prism-vp-w);\n max-width: none;\n container-type: inline-size;\n}\n\n/* Both grips derive their position arithmetically, because .demo-wrap is\n centred by the stage's own flexbox and then scaled in place by\n transform: scale(var(--zoom)): the transform preserves that centre, so\n each edge sits half the *painted* width \u2014 --prism-vp-w times --zoom \u2014 away\n from the middle. No measurement, no ResizeObserver, and nothing to\n fall out of step when either the width or the zoom changes.\n\n The grip's own [scale] input (in the template) undoes the same factor\n in the other direction: a pointer that has moved dx across the painted\n box must change --prism-vp-w by dx / zoom for the grip to stay under the\n cursor, so the directive multiplier is 2 / zoom on the right grip and\n -2 / zoom on the left, not the flat \u00B12 a permanent zoom of 1 would\n need. */\n.vp-grip {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n bottom: 0;\n left: calc(50% - var(--prism-vp-w) * var(--zoom, 1) / 2 - 4.5px);\n z-index: 4;\n display: grid;\n width: 9px;\n\n /* The element is the guide line's full-height track and nothing else\n may be clickable about it. It runs from the overlay band to the\n bottom of the stage at z-index 4, straight over prism-canvas-bg-pill\n at z-index 2, so leaving it hit-testable made part of the pill's\n Reset button unreachable whenever a viewport was on. Only the bar\n below takes pointer events back. */\n pointer-events: none;\n background: transparent;\n}\n\n.vp-grip--end {\n right: calc(50% - var(--prism-vp-w) * var(--zoom, 1) / 2 - 4.5px);\n left: auto;\n}\n\n/* The part you grab, and the only part of the grip that takes pointer\n events back. It shares the guide line's grid cell \u2014 hence the matching\n grid-area \u2014 and is raised above it so the 1px rule does not paint a\n seam down the middle of the 3px bar.\n\n The padding is the hit box and the background is the bar: content-box\n sizing plus background-clip: content-box paints 3x34 while leaving\n 9x44 clickable, so the target is comfortable without the mark growing\n to match. It is still narrow for WCAG 2.5.8, which the Width chooser\n in the tools menu answers \u2014 the same widths are reachable there, and\n both grips take Home/End and the arrow keys. */\n.vp-grip__bar {\n z-index: 1;\n box-sizing: content-box;\n grid-area: 1 / 1;\n place-self: center center;\n width: 3px;\n height: 34px;\n padding: 5px 3px;\n pointer-events: auto;\n background: color-mix(in srgb, var(--prism-measure) 80%, transparent);\n background-clip: content-box;\n border-radius: 2px;\n transition: background var(--dur-fast);\n}\n\n/* The edge itself, carried the whole height of the stage. Without it a\n grip is a floating nub that says where you may pull but not what it is\n pulling: the line is what makes the constrained region legible as a\n region rather than as two loose handles. Faint on purpose \u2014 it crosses\n the specimen, so it has to stay readable as chrome. */\n.vp-grip::after {\n grid-area: 1 / 1;\n place-self: stretch center;\n width: 1px;\n content: '';\n background: color-mix(in srgb, var(--prism-measure) 75%, transparent);\n transition: background var(--dur-fast);\n}\n\n.vp-grip:hover::after,\n.vp-grip.active::after,\n.vp-grip:focus-visible::after {\n background: color-mix(in srgb, var(--prism-measure) 55%, transparent);\n}\n\n.vp-grip:hover .vp-grip__bar,\n.vp-grip.active .vp-grip__bar,\n.vp-grip:focus-visible .vp-grip__bar {\n background: var(--prism-measure);\n background-clip: content-box;\n}\n\n/* The ring goes on the bar, not on the host: the host is the full-height\n track, and outlining that would draw a rule the length of the stage\n for a control 34px tall. */\n.vp-grip:focus-visible {\n outline: none;\n}\n\n.vp-grip:focus-visible .vp-grip__bar {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n}\n\n/* The third resident of the overlay band: pill left, dimension centre,\n rail right. It reads the same --prism-canvas-overlay-top the other two\n do, so switching rulers on moves all three together.\n\n Spans the painted width rather than sitting in the middle of it as a\n badge, and carries the same --prism-vp-w * --zoom the grips do so the\n three stay locked together. A badge states a number; a dimension line\n states which distance the number measures, and that is the whole\n claim this overlay makes. */\n.vp-dim {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n left: 50%;\n z-index: 4;\n display: flex;\n gap: var(--sp-3);\n align-items: center;\n width: calc(var(--prism-vp-w) * var(--zoom, 1));\n pointer-events: none;\n transform: translateX(-50%);\n}\n\n/* Two halves with the value in the gap, rather than one rule behind it:\n a line running under the digits would need a background plate to stay\n readable, and the plate is the badge this replaced. */\n.vp-dim__rule {\n position: relative;\n flex: 1;\n height: 1px;\n background: color-mix(in srgb, var(--prism-measure) 70%, transparent);\n}\n\n/* The end ticks. They are what make the rule read as a measurement of\n the span between them instead of as a divider laid across the canvas,\n and they mark the two edges the grips can be dragged to. */\n.vp-dim__rule::before {\n position: absolute;\n top: -3px;\n width: 1px;\n height: 7px;\n content: '';\n background: color-mix(in srgb, var(--prism-measure) 90%, transparent);\n}\n\n.vp-dim__rule:first-child::before {\n left: 0;\n}\n\n.vp-dim__rule:last-child::before {\n right: 0;\n}\n\n.vp-dim__v {\n flex: none;\n font-family: var(--font-mono);\n font-size: 9px;\n color: var(--prism-measure);\n white-space: nowrap;\n}\n", "\n [data-bg=\"dots\"] {\n background-image: radial-gradient(circle, var(--prism-dot) 1px, transparent 1px);\n background-size: 20px 20px;\n }\n\n [data-bg=\"plain\"] {\n background-image: none;\n }\n\n /* Flat, not dotted. \"light\" and \"dark\" name a surface a component was\n designed against \u2014 and they are the two backgrounds whose colour is\n absolute rather than a theme token, which is what makes them the values\n to declare for a screenshot baseline. \"dots\" already exists for anyone\n who wants the grid. */\n /* These two also re-point --prism-measure, and that is not decoration.\n Every other canvas overlay is drawn in a theme colour over a theme\n surface, so the two move together. These two backgrounds are absolute:\n \"light\" stays near-white while the app runs the dark theme, and \"dark\"\n stays near-black while it runs the light one. The measurement colour\n picked for one theme is then sitting on the other theme's ground \u2014\n measured, the dark theme's blue reaches 1.8:1 on the light background,\n which is a viewport overlay you cannot see. Pinning the colour to the\n ground rather than to the theme is what makes \"always visible\" true\n instead of true-in-the-common-case.\n\n Literal values because this file is theme-independent by construction \u2014\n it is the one place that already hard-codes the two absolute grounds\n below, for the same reason. Keep them in step with --prism-measure in\n prism-default-theme.ts; semantic-colours.spec.ts fails if they drift. */\n [data-bg=\"light\"] {\n background-color: var(--prism-void-light, #f7f5fc);\n background-image: none;\n --prism-measure: #004d8a;\n }\n [data-bg=\"dark\"] {\n background-color: var(--prism-void-dark, #07050f);\n background-image: none;\n --prism-measure: #41bcff;\n }\n\n /* \"transparent\" shares the checkerboard on purpose. The two say the same\n thing in the two media the canvas has: while browsing, the checkerboard\n is already the UI's word for \"no surface here\"; in a capture it becomes\n literal transparency. A stage that were really see-through in the app\n would just show the shell through the canvas, which means nothing. The\n split between the two lives entirely in CAPTURE_STYLES. */\n [data-bg=\"checker\"],\n [data-bg=\"transparent\"] {\n background-image:\n linear-gradient(45deg, var(--prism-border) 25%, transparent 25%),\n linear-gradient(-45deg, var(--prism-border) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--prism-border) 75%),\n linear-gradient(-45deg, transparent 75%, var(--prism-border) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n }\n"] }]
|
|
319
|
+
args: [{ selector: 'prism-renderer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismCanvasRulersComponent, PrismCanvasBgPillComponent, PrismCanvasMeasureComponent, NgComponentOutlet, PrismResizerDirective], template: "<div\n class=\"prism-canvas-stage\"\n [attr.data-bg]=\"variantBg.effective()\"\n [attr.data-rulers]=\"canvasService.rulers() ? '' : null\"\n [attr.data-viewport]=\"viewportWidth() !== null ? '' : null\"\n [style.--prism-vp-w.px]=\"viewportWidth()\"\n [style.--zoom]=\"canvasService.zoom()\">\n @if (!capture.active()) {\n <div\n class=\"stage-crosshair\"\n [class.visible]=\"canvasService.guides()\"></div>\n <prism-canvas-rulers />\n @if (canvasService.measure()) {\n <prism-canvas-measure />\n }\n <prism-canvas-bg-pill />\n @if (viewportWidth() !== null) {\n <!-- Grips and the dimension line are siblings of .demo-wrap, never\n children of it: .demo-wrap is what plugin-visual-regression\n screenshots, and anything inside it composites into every baseline.\n They sit inside the capture guard for the same reason the rulers and\n the pill do. -->\n <span class=\"vp-dim\">\n <span class=\"vp-dim__rule\"></span>\n <span class=\"vp-dim__v\">{{ viewportWidth() }} px</span>\n <span class=\"vp-dim__rule\"></span>\n </span>\n <div\n class=\"vp-grip\"\n prismResizer\n axis=\"x\"\n [scale]=\"-2 / (canvasService.zoom() || 1)\"\n [min]=\"VIEWPORT_MIN\"\n [max]=\"VIEWPORT_MAX\"\n [value]=\"viewportWidth()!\"\n (valueChange)=\"onViewportResize($event)\"\n aria-label=\"Viewport width, left edge\"\n [attr.aria-valuenow]=\"viewportWidth()\"\n [attr.aria-valuemin]=\"VIEWPORT_MIN\"\n [attr.aria-valuemax]=\"VIEWPORT_MAX\">\n <span class=\"vp-grip__bar\"></span>\n </div>\n <div\n class=\"vp-grip vp-grip--end\"\n prismResizer\n axis=\"x\"\n [scale]=\"2 / (canvasService.zoom() || 1)\"\n [min]=\"VIEWPORT_MIN\"\n [max]=\"VIEWPORT_MAX\"\n [value]=\"viewportWidth()!\"\n (valueChange)=\"onViewportResize($event)\"\n aria-label=\"Viewport width, right edge\"\n [attr.aria-valuenow]=\"viewportWidth()\"\n [attr.aria-valuemin]=\"VIEWPORT_MIN\"\n [attr.aria-valuemax]=\"VIEWPORT_MAX\">\n <span class=\"vp-grip__bar\"></span>\n </div>\n }\n }\n\n <div\n class=\"demo-wrap\"\n [style.--zoom]=\"canvasService.zoom()\"\n [attr.data-prism-rendered]=\"renderedKey()\"\n [attr.data-canvas-layout]=\"canvasLayout()\"\n [attr.data-viewport]=\"viewportWidth() !== null ? '' : null\">\n <ng-container #outlet />\n @if (activeOverlay()) {\n <ng-container *ngComponentOutlet=\"activeOverlay()!; inputs: overlayInputs; injector: overlayInjector()\" />\n }\n </div>\n</div>\n", styles: [":host {\n display: block;\n flex: 1;\n min-height: 0;\n}\n\n.prism-canvas-stage {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n min-height: 200px;\n padding: 32px;\n overflow: auto;\n\n /* The edge is outline + shadow, never border and never extra padding.\n plugin-visual-regression screenshots .demo-wrap, which is centred in\n this element; a border would shrink the content box by 2px and move\n that centre, shifting all 15 baselines in test-workspace/vrt/baseline\n without a single component having changed. Capture mode resets this\n element's padding but not its border, and this repo has no VRT runner\n to catch the drift. outline and box-shadow do not participate in\n layout, so the box is provably unchanged. Keep it that way.\n They do still paint, and outline-offset is negative, so the line lands\n inside the box: CAPTURE_STYLES in prism-capture.service.ts sets both\n to none, which is only safe because neither affects layout here. */\n outline: 1px solid var(--prism-stage-edge);\n outline-offset: -1px;\n background-color: var(--prism-stage);\n box-shadow:\n 0 1px 3px rgb(0 0 0 / 10%),\n 0 8px 24px -12px rgb(0 0 0 / 18%);\n transition: filter var(--dur-base);\n\n --prism-canvas-overlay-top: 12px;\n --prism-canvas-overlay-inline: 20px;\n}\n\n.prism-canvas-stage[data-rulers] {\n --prism-canvas-overlay-top: 28px;\n --prism-canvas-overlay-inline: 28px;\n}\n\n.stage-crosshair {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--dur-base);\n}\n\n.stage-crosshair.visible {\n opacity: 1;\n}\n\n.stage-crosshair::before,\n.stage-crosshair::after {\n position: absolute;\n content: '';\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n}\n\n.stage-crosshair::before {\n top: 50%;\n right: 0;\n left: 0;\n height: 1px;\n}\n\n.stage-crosshair::after {\n top: 0;\n bottom: 0;\n left: 50%;\n width: 1px;\n}\n\n.demo-wrap {\n position: relative;\n display: inline-block;\n transform: scale(var(--zoom, 1));\n transition: transform 0.18s;\n}\n\n.demo-wrap[data-canvas-layout='stretch'] {\n display: block;\n width: 100%;\n max-width: 800px;\n}\n\n/* max-width: none rather than min(800px, var(--prism-vp-w)): an explicitly\n requested width beats a layout default, and min() would silently cap a\n 1024 viewport at 800 on any component declaring canvasLayout:\n 'stretch'.\n\n container-type must stay confined to this rule. It implies contain: inline-size, which on the width:auto\n inline-block .demo-wrap is at rest would decouple its width from its\n contents, collapsing the box and shifting every baseline in\n test-workspace/vrt/baseline without a component having changed. Here\n the width is explicit, so containment costs nothing and is what makes\n a component's own @container rules respond. Media queries do not and\n cannot: they read the real browser viewport.\n\n grid + justify-items: center, and not text-align: center, which is the\n obvious way to centre an inline-level child and the wrong one. The\n showcase component is created through ViewContainerRef, so its host\n element carries none of this component's _ngcontent attribute and no\n scoped rule here can reach it to undo an inherited value. text-align\n would therefore leak all the way into the specimen and silently\n re-align its own text the moment the viewport is switched on. That is a\n canvas that lies about what it is showing. Centring at the container\n instead touches nothing inside.\n\n Shrinking is not a side effect of that choice, it is the resting\n behaviour preserved: at rest .demo-wrap is an inline-block that\n already shrink-wraps its child, so a block-level specimen sizes to its\n content here the same as with the constraint off. The implicit\n auto column still fills the declared width, so a component that asks\n for width: 100% (the canvasLayout: 'stretch' case) keeps getting the\n whole viewport. */\n.demo-wrap[data-viewport] {\n display: grid;\n\n /* flex: none is required. The stage is a flex container\n and this is its only item, so the default flex-shrink: 1 lets the\n box render narrower than the width just asked for whenever the\n canvas is the smaller of the two, and container-type below drops\n the automatic minimum size to zero, so nothing stops the shrink.\n The result is the one failure this whole feature cannot afford:\n the dimension line states 1024 while every @container rule in the\n specimen answers whatever the canvas happened to allow. The stage\n is overflow: auto, so refusing to shrink scrolls instead. */\n flex: none;\n\n /* safe center, not bare center. Centring is right while the specimen\n fits and wrong the moment it does not: bare centring spills an\n over-wide specimen equally past both edges, where a real viewport of\n that width clips at zero and scrolls in one direction. The safe\n keyword falls back to start only when the item overflows, which\n is the browser making a case distinction CSS cannot otherwise\n express. */\n justify-items: safe center;\n width: var(--prism-vp-w);\n max-width: none;\n container-type: inline-size;\n}\n\n/* Both grips derive their position arithmetically, because .demo-wrap is\n centred by the stage's own flexbox and then scaled in place by\n transform: scale(var(--zoom)): the transform preserves that centre, so\n each edge sits half the *painted* width (--prism-vp-w times --zoom) away\n from the middle. No measurement, no ResizeObserver, and nothing to\n fall out of step when either the width or the zoom changes.\n\n The grip's own [scale] input (in the template) undoes the same factor\n in the other direction: a pointer that has moved dx across the painted\n box must change --prism-vp-w by dx / zoom for the grip to stay under the\n cursor, so the directive multiplier is 2 / zoom on the right grip and\n -2 / zoom on the left, not the flat \u00B12 a permanent zoom of 1 would\n need. */\n.vp-grip {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n bottom: 0;\n left: calc(50% - var(--prism-vp-w) * var(--zoom, 1) / 2 - 4.5px);\n z-index: 4;\n display: grid;\n width: 9px;\n\n /* The element is the guide line's full-height track and must not be\n clickable. It runs from the overlay band to the\n bottom of the stage at z-index 4, straight over prism-canvas-bg-pill\n at z-index 2, so leaving it hit-testable made part of the pill's\n Reset button unreachable whenever a viewport was on. Only the bar\n below takes pointer events back. */\n pointer-events: none;\n background: transparent;\n}\n\n.vp-grip--end {\n right: calc(50% - var(--prism-vp-w) * var(--zoom, 1) / 2 - 4.5px);\n left: auto;\n}\n\n/* The part you grab, and the only part of the grip that takes pointer\n events back. It shares the guide line's grid cell (hence the matching\n grid-area) and is raised above it so the 1px rule does not paint a\n seam down the middle of the 3px bar.\n\n The padding is the hit box and the background is the bar: content-box\n sizing plus background-clip: content-box paints 3x34 while leaving\n 9x44 clickable, so the target is comfortable without the mark growing\n to match. It is still narrow for WCAG 2.5.8, which the Width chooser\n in the tools menu answers: the same widths are reachable there, and\n both grips take Home/End and the arrow keys. */\n.vp-grip__bar {\n z-index: 1;\n box-sizing: content-box;\n grid-area: 1 / 1;\n place-self: center center;\n width: 3px;\n height: 34px;\n padding: 5px 3px;\n pointer-events: auto;\n background: color-mix(in srgb, var(--prism-measure) 80%, transparent);\n background-clip: content-box;\n border-radius: 2px;\n transition: background var(--dur-fast);\n}\n\n/* The edge itself, carried the whole height of the stage. Without it a\n grip is a floating nub that says where you may pull but not what it is\n pulling: the line is what makes the constrained region legible as a\n region rather than as two loose handles. Kept faint because it crosses\n the specimen, so it has to stay readable as chrome. */\n.vp-grip::after {\n grid-area: 1 / 1;\n place-self: stretch center;\n width: 1px;\n content: '';\n background: color-mix(in srgb, var(--prism-measure) 75%, transparent);\n transition: background var(--dur-fast);\n}\n\n.vp-grip:hover::after,\n.vp-grip.active::after,\n.vp-grip:focus-visible::after {\n background: color-mix(in srgb, var(--prism-measure) 55%, transparent);\n}\n\n.vp-grip:hover .vp-grip__bar,\n.vp-grip.active .vp-grip__bar,\n.vp-grip:focus-visible .vp-grip__bar {\n background: var(--prism-measure);\n background-clip: content-box;\n}\n\n/* The ring goes on the bar, not on the host: the host is the full-height\n track, and outlining that would draw a rule the length of the stage\n for a control 34px tall. */\n.vp-grip:focus-visible {\n outline: none;\n}\n\n.vp-grip:focus-visible .vp-grip__bar {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n}\n\n/* The third resident of the overlay band: pill left, dimension centre,\n rail right. It reads the same --prism-canvas-overlay-top the other two\n do, so switching rulers on moves all three together.\n\n Spans the painted width rather than sitting in the middle of it as a\n badge, and carries the same --prism-vp-w * --zoom the grips do so the\n three stay locked together. A badge states a number; a dimension line\n states which distance the number measures, and that is the whole\n claim this overlay makes. */\n.vp-dim {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n left: 50%;\n z-index: 4;\n display: flex;\n gap: var(--sp-3);\n align-items: center;\n width: calc(var(--prism-vp-w) * var(--zoom, 1));\n pointer-events: none;\n transform: translateX(-50%);\n}\n\n/* Two halves with the value in the gap, rather than one rule behind it:\n a line running under the digits would need a background plate to stay\n readable, and the plate is the badge this replaced. */\n.vp-dim__rule {\n position: relative;\n flex: 1;\n height: 1px;\n background: color-mix(in srgb, var(--prism-measure) 70%, transparent);\n}\n\n/* The end ticks. They are what make the rule read as a measurement of\n the span between them instead of as a divider laid across the canvas,\n and they mark the two edges the grips can be dragged to. */\n.vp-dim__rule::before {\n position: absolute;\n top: -3px;\n width: 1px;\n height: 7px;\n content: '';\n background: color-mix(in srgb, var(--prism-measure) 90%, transparent);\n}\n\n.vp-dim__rule:first-child::before {\n left: 0;\n}\n\n.vp-dim__rule:last-child::before {\n right: 0;\n}\n\n.vp-dim__v {\n flex: none;\n font-family: var(--font-mono);\n font-size: 9px;\n color: var(--prism-measure);\n white-space: nowrap;\n}\n", "\n [data-bg=\"dots\"] {\n background-image: radial-gradient(circle, var(--prism-dot) 1px, transparent 1px);\n background-size: 20px 20px;\n }\n\n [data-bg=\"plain\"] {\n background-image: none;\n }\n\n /* Flat, not dotted. \"light\" and \"dark\" name the surface a component was\n designed against, and their colour is absolute rather than a theme token,\n which makes them the values to declare for a screenshot baseline. Use\n \"dots\" for the grid. */\n /* These two also re-point --prism-measure. Other overlays use theme colours\n on theme surfaces, but these grounds ignore the theme: \"light\" stays\n near-white in the dark theme and \"dark\" stays near-black in the light one.\n The dark theme's magenta reaches only 2.85:1 on the light ground, under the\n 4.5:1 its 9px readout needs, so the measurement colour has to follow the\n ground, not the theme.\n\n --prism-measure-plate follows it for the same reason. It is the surface\n the measuring tool's value label paints itself on, so the label reads as a\n gap in the measurement line rather than a badge on top of it. At its\n --prism-stage fallback it would be the theme's stage under a re-pointed\n foreground: the light theme's magenta on the dark theme's stage reads\n 3.71:1, the dark theme's on white 3.08:1. Pinned to the ground the same way,\n the pairs reach 4.54:1 and 6.57:1. A color-mix against the ground would\n work too, but this file already states both grounds literally, and one\n mechanism per decision is enough.\n\n Literal values because this file is theme-independent, like the two\n grounds below. Keep them in step with --prism-measure in\n prism-default-theme.ts; semantic-colours.spec.ts fails if they drift. */\n [data-bg=\"light\"] {\n background-color: var(--prism-void-light, #f7f5fc);\n background-image: none;\n --prism-measure: #ca00c1;\n --prism-measure-plate: var(--prism-void-light, #f7f5fc);\n }\n [data-bg=\"dark\"] {\n background-color: var(--prism-void-dark, #07050f);\n background-image: none;\n --prism-measure: #f632ff;\n --prism-measure-plate: var(--prism-void-dark, #07050f);\n }\n\n /* \"transparent\" shares the checkerboard. In the app the checkerboard is\n already the UI's sign for \"no surface\", and a see-through stage would only\n show the shell behind it. Only CAPTURE_STYLES tells the two apart. */\n [data-bg=\"checker\"],\n [data-bg=\"transparent\"] {\n background-image:\n linear-gradient(45deg, var(--prism-border) 25%, transparent 25%),\n linear-gradient(-45deg, var(--prism-border) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--prism-border) 75%),\n linear-gradient(-45deg, transparent 75%, var(--prism-border) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n }\n"] }]
|
|
311
320
|
}], () => [], { outlet: [{ type: i0.ViewChild, args: ['outlet', { ...{
|
|
312
321
|
read: ViewContainerRef
|
|
313
322
|
}, isSignal: true }] }] }); })();
|
|
314
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber:
|
|
323
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber: 51 }); })();
|
|
@@ -20,12 +20,12 @@ export function parseContentToNodes(content) {
|
|
|
20
20
|
if (selector === 'default')
|
|
21
21
|
continue;
|
|
22
22
|
const wrapper = document.createElement('div');
|
|
23
|
-
// SAFETY: trusted developer-authored HTML
|
|
23
|
+
// SAFETY: trusted developer-authored HTML, see SECURITY.md.
|
|
24
24
|
wrapper.innerHTML = html;
|
|
25
25
|
const nodes = [];
|
|
26
26
|
for (const child of Array.from(wrapper.childNodes)) {
|
|
27
27
|
const el = document.createElement('div');
|
|
28
|
-
// SAFETY: trusted developer-authored HTML
|
|
28
|
+
// SAFETY: trusted developer-authored HTML (see SECURITY.md).
|
|
29
29
|
el.innerHTML = child.outerHTML ?? child.textContent ?? '';
|
|
30
30
|
const projected = el.firstChild;
|
|
31
31
|
if (projected && projected instanceof Element) {
|
|
@@ -43,7 +43,7 @@ export function parseContentToNodes(content) {
|
|
|
43
43
|
}
|
|
44
44
|
return result;
|
|
45
45
|
}
|
|
46
|
-
// SAFETY: see `parseContentToNodes` above and SECURITY.md
|
|
46
|
+
// SAFETY: see `parseContentToNodes` above and SECURITY.md. `html` is trusted
|
|
47
47
|
// developer-authored variant content from the `@Showcase` decorator.
|
|
48
48
|
function htmlToNodes(html) {
|
|
49
49
|
const wrapper = document.createElement('div');
|
|
@@ -6,11 +6,21 @@ export declare class PrismCanvasService {
|
|
|
6
6
|
readonly zoom: import("@angular/core").WritableSignal<number>;
|
|
7
7
|
readonly guides: import("@angular/core").WritableSignal<boolean>;
|
|
8
8
|
readonly rulers: import("@angular/core").WritableSignal<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the measuring tool is active.
|
|
11
|
+
*
|
|
12
|
+
* Lives here rather than in `PrismMeasureService` because it is the same
|
|
13
|
+
* kind of state as `guides` and `rulers`: a preference about the working
|
|
14
|
+
* environment, not a statement about this variant. That also means the
|
|
15
|
+
* toggle inherits the constructor's capture-mode behaviour below for
|
|
16
|
+
* free, without having to repeat it.
|
|
17
|
+
*/
|
|
18
|
+
readonly measure: import("@angular/core").WritableSignal<boolean>;
|
|
9
19
|
/**
|
|
10
20
|
* The width `.demo-wrap` is constrained to, or `null` for "as wide as it
|
|
11
21
|
* wants".
|
|
12
22
|
*
|
|
13
|
-
* Nullable rather than a `0`/`-1` sentinel because "off" is
|
|
23
|
+
* Nullable rather than a `0`/`-1` sentinel because "off" is a
|
|
14
24
|
* different state and not a width: the renderer keys a whole set of CSS off
|
|
15
25
|
* `[data-viewport]`, and a falsy number would make `viewportWidth() ? ... `
|
|
16
26
|
* silently treat a legal narrow width as "off" the moment the floor ever
|
|
@@ -32,6 +42,7 @@ export declare class PrismCanvasService {
|
|
|
32
42
|
setZoom(z: number): void;
|
|
33
43
|
toggleGuides(): void;
|
|
34
44
|
toggleRulers(): void;
|
|
45
|
+
toggleMeasure(): void;
|
|
35
46
|
setViewportWidth(w: number | null): void;
|
|
36
47
|
toggleViewport(): void;
|
|
37
48
|
private loadFromStorage;
|
|
@@ -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;;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;;;;;;;;;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,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAYxC,cAAc,IAAI,IAAI;IAItB,OAAO,CAAC,eAAe;
|
|
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"}
|
|
@@ -13,11 +13,22 @@ export class PrismCanvasService {
|
|
|
13
13
|
...(ngDevMode ? [{ debugName: "guides" }] : /* istanbul ignore next */ []));
|
|
14
14
|
rulers = signal(false, /* @ts-ignore */
|
|
15
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 */ []));
|
|
16
27
|
/**
|
|
17
28
|
* The width `.demo-wrap` is constrained to, or `null` for "as wide as it
|
|
18
29
|
* wants".
|
|
19
30
|
*
|
|
20
|
-
* Nullable rather than a `0`/`-1` sentinel because "off" is
|
|
31
|
+
* Nullable rather than a `0`/`-1` sentinel because "off" is a
|
|
21
32
|
* different state and not a width: the renderer keys a whole set of CSS off
|
|
22
33
|
* `[data-viewport]`, and a falsy number would make `viewportWidth() ? ... `
|
|
23
34
|
* silently treat a legal narrow width as "off" the moment the floor ever
|
|
@@ -36,10 +47,10 @@ export class PrismCanvasService {
|
|
|
36
47
|
*/
|
|
37
48
|
lastViewportWidth = VIEWPORT_DEFAULT;
|
|
38
49
|
constructor() {
|
|
39
|
-
// Capture mode renders for a screenshot tool: persisted zoom, guides
|
|
40
|
-
// rulers would leak a previous session's state
|
|
41
|
-
// defaults (zoom 1, no guides, no rulers
|
|
42
|
-
// 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.
|
|
43
54
|
if (this.capture.active())
|
|
44
55
|
return;
|
|
45
56
|
this.loadFromStorage();
|
|
@@ -60,6 +71,10 @@ export class PrismCanvasService {
|
|
|
60
71
|
this.rulers.update((v) => !v);
|
|
61
72
|
this.save();
|
|
62
73
|
}
|
|
74
|
+
toggleMeasure() {
|
|
75
|
+
this.measure.update((v) => !v);
|
|
76
|
+
this.save();
|
|
77
|
+
}
|
|
63
78
|
setViewportWidth(w) {
|
|
64
79
|
if (w === null) {
|
|
65
80
|
this.viewportWidth.set(null);
|
|
@@ -89,6 +104,8 @@ export class PrismCanvasService {
|
|
|
89
104
|
this.guides.set(d['guides']);
|
|
90
105
|
if (typeof d['rulers'] === 'boolean')
|
|
91
106
|
this.rulers.set(d['rulers']);
|
|
107
|
+
if (typeof d['measure'] === 'boolean')
|
|
108
|
+
this.measure.set(d['measure']);
|
|
92
109
|
if (typeof d['viewportWidth'] === 'number') {
|
|
93
110
|
const w = clampViewportWidth(d['viewportWidth']);
|
|
94
111
|
this.lastViewportWidth = w;
|
|
@@ -108,6 +125,7 @@ export class PrismCanvasService {
|
|
|
108
125
|
zoom: this.zoom(),
|
|
109
126
|
guides: this.guides(),
|
|
110
127
|
rulers: this.rulers(),
|
|
128
|
+
measure: this.measure(),
|
|
111
129
|
viewportWidth: this.viewportWidth()
|
|
112
130
|
}));
|
|
113
131
|
}
|
|
@@ -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
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
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
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
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
|
|
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"}
|