@ng-prism/core 22.3.0 → 22.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- 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 +11 -8
- 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 +2 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
|
|
2
|
+
import { PrismIconComponent } from '../icons/prism-icon.component.js';
|
|
3
|
+
import { PrismMeasureService } from '../services/prism-measure.service.js';
|
|
4
|
+
import { formatMeasure, measureDistance } from './measure-geometry.js';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
function PrismCanvasPinRowComponent_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
7
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
8
|
+
i0.ɵɵelementStart(0, "span", 1);
|
|
9
|
+
i0.ɵɵtext(1);
|
|
10
|
+
i0.ɵɵelementStart(2, "button", 2);
|
|
11
|
+
i0.ɵɵlistener("click", function PrismCanvasPinRowComponent_Conditional_0_For_2_Template_button_click_2_listener() { const $index_r2 = i0.ɵɵrestoreView(_r1).$index; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.remove($index_r2)); });
|
|
12
|
+
i0.ɵɵelement(3, "prism-icon", 3);
|
|
13
|
+
i0.ɵɵelementEnd()();
|
|
14
|
+
} if (rf & 2) {
|
|
15
|
+
const chip_r4 = ctx.$implicit;
|
|
16
|
+
i0.ɵɵadvance();
|
|
17
|
+
i0.ɵɵtextInterpolate1(" ", chip_r4, " ");
|
|
18
|
+
i0.ɵɵadvance();
|
|
19
|
+
i0.ɵɵattribute("aria-label", "Remove measurement " + chip_r4);
|
|
20
|
+
i0.ɵɵadvance();
|
|
21
|
+
i0.ɵɵproperty("size", 10);
|
|
22
|
+
} }
|
|
23
|
+
function PrismCanvasPinRowComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
24
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
25
|
+
i0.ɵɵrepeaterCreate(1, PrismCanvasPinRowComponent_Conditional_0_For_2_Template, 4, 3, "span", 1, i0.ɵɵrepeaterTrackByIndex);
|
|
26
|
+
i0.ɵɵelementEnd();
|
|
27
|
+
} if (rf & 2) {
|
|
28
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
29
|
+
i0.ɵɵadvance();
|
|
30
|
+
i0.ɵɵrepeater(ctx_r2.chips());
|
|
31
|
+
} }
|
|
32
|
+
/**
|
|
33
|
+
* The pinned measurements, as a row below the canvas.
|
|
34
|
+
*
|
|
35
|
+
* Not a panel in a corner of the stage: the top overlay band already carries
|
|
36
|
+
* the background pill on the left, the viewport dimension line in the
|
|
37
|
+
* middle and the toolrail on the right. A fourth floating surface there
|
|
38
|
+
* would be the first one to collide with another.
|
|
39
|
+
*
|
|
40
|
+
* A direct child of `.prism-canvas-wrap` and therefore without a capture
|
|
41
|
+
* guard of its own: `CAPTURE_CANVAS_ONLY_SELECTOR` structurally removes
|
|
42
|
+
* every child of the wrap that does not contain the stage. The rule is
|
|
43
|
+
* deliberately written structurally rather than as a list of selectors, so
|
|
44
|
+
* exactly this case works without anyone maintaining it.
|
|
45
|
+
*/
|
|
46
|
+
export class PrismCanvasPinRowComponent {
|
|
47
|
+
measure = inject(PrismMeasureService);
|
|
48
|
+
chips = computed(() => this.measure.pins().map((m) => `${formatMeasure(measureDistance(m.a, m.b))} px`), /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []));
|
|
50
|
+
remove(index) {
|
|
51
|
+
this.measure.removePin(index);
|
|
52
|
+
}
|
|
53
|
+
static ɵfac = function PrismCanvasPinRowComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCanvasPinRowComponent)(); };
|
|
54
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCanvasPinRowComponent, selectors: [["prism-canvas-pin-row"]], decls: 1, vars: 1, consts: [["role", "group", "aria-label", "Pinned measurements", 1, "pin-row"], [1, "pin-chip"], ["type", "button", 1, "pin-chip__x", 3, "click"], ["name", "x", 3, "size"]], template: function PrismCanvasPinRowComponent_Template(rf, ctx) { if (rf & 1) {
|
|
55
|
+
i0.ɵɵconditionalCreate(0, PrismCanvasPinRowComponent_Conditional_0_Template, 3, 0, "div", 0);
|
|
56
|
+
} if (rf & 2) {
|
|
57
|
+
i0.ɵɵconditional(ctx.chips().length > 0 ? 0 : -1);
|
|
58
|
+
} }, dependencies: [PrismIconComponent], styles: [".pin-row[_ngcontent-%COMP%] {\n display: flex;\n gap: var(--%NS%sp-2);\n align-items: center;\n padding: var(--%NS%sp-2) var(--%NS%sp-3);\n overflow-x: auto;\n background: var(--%NS%prism-bg-surface);\n border-top: 1px solid var(--%NS%prism-border);\n}\n\n.pin-chip[_ngcontent-%COMP%] {\n display: inline-flex;\n gap: var(--%NS%sp-1);\n align-items: center;\n padding: var(--%NS%sp-1) var(--%NS%sp-2);\n font-family: var(--%NS%font-mono);\n font-size: var(--%NS%fs-xs);\n font-variant-numeric: tabular-nums;\n color: var(--%NS%prism-measure);\n white-space: nowrap;\n border: 1px solid var(--%NS%prism-border-strong);\n border-radius: var(--%NS%radius-xs);\n}\n\n.pin-chip__x[_ngcontent-%COMP%] {\n display: grid;\n place-items: center;\n padding: 0;\n color: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n opacity: 0.6;\n}\n\n.pin-chip__x[_ngcontent-%COMP%]:hover, \n.pin-chip__x[_ngcontent-%COMP%]:focus-visible {\n opacity: 1;\n}"] });
|
|
59
|
+
}
|
|
60
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismCanvasPinRowComponent, [{
|
|
61
|
+
type: Component,
|
|
62
|
+
args: [{ selector: 'prism-canvas-pin-row', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: "@if (chips().length > 0) {\n <div\n class=\"pin-row\"\n role=\"group\"\n aria-label=\"Pinned measurements\">\n @for (chip of chips(); track $index) {\n <span class=\"pin-chip\">\n {{ chip }}\n <button\n type=\"button\"\n class=\"pin-chip__x\"\n (click)=\"remove($index)\"\n [attr.aria-label]=\"'Remove measurement ' + chip\">\n <prism-icon\n name=\"x\"\n [size]=\"10\" />\n </button>\n </span>\n }\n </div>\n}\n", styles: [".pin-row {\n display: flex;\n gap: var(--sp-2);\n align-items: center;\n padding: var(--sp-2) var(--sp-3);\n overflow-x: auto;\n background: var(--prism-bg-surface);\n border-top: 1px solid var(--prism-border);\n}\n\n.pin-chip {\n display: inline-flex;\n gap: var(--sp-1);\n align-items: center;\n padding: var(--sp-1) var(--sp-2);\n font-family: var(--font-mono);\n font-size: var(--fs-xs);\n font-variant-numeric: tabular-nums;\n color: var(--prism-measure);\n white-space: nowrap;\n border: 1px solid var(--prism-border-strong);\n border-radius: var(--radius-xs);\n}\n\n.pin-chip__x {\n display: grid;\n place-items: center;\n padding: 0;\n color: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n opacity: 0.6;\n}\n\n.pin-chip__x:hover,\n.pin-chip__x:focus-visible {\n opacity: 1;\n}\n"] }]
|
|
63
|
+
}], null, null); })();
|
|
64
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasPinRowComponent, { className: "PrismCanvasPinRowComponent", filePath: "app/canvas/prism-canvas-pin-row.component.ts", lineNumber: 28 }); })();
|
|
@@ -3,32 +3,19 @@ import { PrismCanvasService } from '../services/prism-canvas.service.js';
|
|
|
3
3
|
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
6
|
-
* The canvas tools, as a rail floating over the canvas
|
|
7
|
-
* it.
|
|
6
|
+
* The canvas tools, as a rail floating over the canvas.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* entry, and like zoom it does not stay on one side of that split — zoom
|
|
15
|
-
* already surfaces as a chooser in the menu and a readout on the rail, and the
|
|
16
|
-
* viewport surfaces the same way, as a toggle on the rail because switching the
|
|
17
|
-
* constraint on and off is something you do constantly, and a width chooser in
|
|
18
|
-
* the menu because the specific width is something you set once you have
|
|
19
|
-
* decided to constrain at all.
|
|
8
|
+
* Things you toggle constantly (guides, rulers, the viewport constraint) get
|
|
9
|
+
* their own button; things you set once (background, zoom, viewport width) live
|
|
10
|
+
* in the menu. The template is a view rather than a setting and keeps its own
|
|
11
|
+
* button. Zoom and the active viewport width are shown as readouts; the width
|
|
12
|
+
* only appears while the viewport constraint is on.
|
|
20
13
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* The host deliberately generates no box. The rail has to be a direct child of
|
|
28
|
-
* `.prism-canvas-wrap` that does not contain the stage, because that is exactly
|
|
29
|
-
* what capture mode's structural rule in `prism-capture.service.ts` suppresses;
|
|
30
|
-
* a rail nested inside the renderer or the stage would survive into every
|
|
31
|
-
* screenshot and silently corrupt visual-regression baselines.
|
|
14
|
+
* The host generates no box. The rail must be a direct child of
|
|
15
|
+
* `.prism-canvas-wrap` outside the stage, because that is what capture mode's
|
|
16
|
+
* structural rule in `prism-capture.service.ts` hides. A rail nested in the
|
|
17
|
+
* renderer or the stage would end up in every screenshot and corrupt
|
|
18
|
+
* visual-regression baselines.
|
|
32
19
|
*/
|
|
33
20
|
export declare class PrismCanvasToolbarComponent {
|
|
34
21
|
protected readonly canvas: PrismCanvasService;
|
|
@@ -37,28 +24,24 @@ export declare class PrismCanvasToolbarComponent {
|
|
|
37
24
|
protected readonly Math: Math;
|
|
38
25
|
protected setBg(bg: CanvasBg): void;
|
|
39
26
|
/**
|
|
40
|
-
* Every {@link CanvasBg},
|
|
27
|
+
* Every {@link CanvasBg}, taken from the type's canonical list.
|
|
41
28
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* leaves the whole group with nothing active and the recommendation with
|
|
46
|
-
* nowhere to sit. That is what a shorter list bought when `transparent` was
|
|
47
|
-
* left out of it, so the list is now the type's own.
|
|
29
|
+
* The group is also a readout: the active button is `effective()` and the
|
|
30
|
+
* recommended one carries the `is-rec` edge. A value missing from the list
|
|
31
|
+
* cannot be shown, so a variant declaring it would leave nothing active.
|
|
48
32
|
*
|
|
49
|
-
* `checker` and `transparent`
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* reason and says so, but it stays in the list until 23.0.0 — a component
|
|
53
|
-
* can still declare it, and the group has to be able to show what it has.
|
|
33
|
+
* `checker` and `transparent` paint the same checkerboard here, so their
|
|
34
|
+
* titles explain the difference, which only a capture shows. `checker` is
|
|
35
|
+
* deprecated but stays until 23.0.0 because components can still declare it.
|
|
54
36
|
*/
|
|
55
37
|
protected readonly bgs: readonly CanvasBg[];
|
|
56
|
-
/** What a background means, where the canvas cannot show the difference. */
|
|
57
38
|
/**
|
|
39
|
+
* What a background means, where the canvas cannot show the difference.
|
|
40
|
+
*
|
|
58
41
|
* Bound with `[attr.title]`, never `[title]`. A property binding assigns to
|
|
59
42
|
* `HTMLElement.title`, a non-nullable DOMString, so the `null` below would
|
|
60
43
|
* be stringified and every unremarkable button would carry a tooltip
|
|
61
|
-
* reading "null"
|
|
44
|
+
* reading "null" (four of the six in the common case).
|
|
62
45
|
*/
|
|
63
46
|
protected bgTitle(bg: CanvasBg): string | null;
|
|
64
47
|
protected readonly zooms: {
|
|
@@ -66,7 +49,7 @@ export declare class PrismCanvasToolbarComponent {
|
|
|
66
49
|
label: string;
|
|
67
50
|
}[];
|
|
68
51
|
/**
|
|
69
|
-
* The named widths, offered
|
|
52
|
+
* The named widths, offered the same way as the zoom chooser.
|
|
70
53
|
*
|
|
71
54
|
* Plain numbers and no device names: this tool narrows a box and simulates
|
|
72
55
|
* nothing, so calling 390 "iPhone" would promise a fidelity it does not have.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-canvas-toolbar.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-toolbar.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;;AAEhF
|
|
1
|
+
{"version":3,"file":"prism-canvas-toolbar.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-toolbar.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;;AAEhF;;;;;;;;;;;;;;GAcG;AACH,qBAQa,2BAA2B;IACpC,SAAS,CAAC,QAAQ,CAAC,MAAM,qBAA8B;IACvD,SAAS,CAAC,QAAQ,CAAC,SAAS,wBAAiC;IAE7D,mFAAmF;IACnF,SAAS,CAAC,QAAQ,CAAC,IAAI,OAAQ;IAE/B,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAQnC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,QAAQ,CAAC,GAAG,sBAAc;IAEpC;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI;IAY9C,SAAS,CAAC,QAAQ,CAAC,KAAK;;;QAKtB;IAEF;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,oBAAkB;IAE9C,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;yCA/D9B,2BAA2B;2CAA3B,2BAA2B;CAkEvC"}
|
|
@@ -15,10 +15,10 @@ function PrismCanvasToolbarComponent_Conditional_3_Template(rf, ctx) { if (rf &
|
|
|
15
15
|
i0.ɵɵadvance();
|
|
16
16
|
i0.ɵɵtextInterpolate1("", ctx_r0.canvas.viewportWidth(), "px");
|
|
17
17
|
} }
|
|
18
|
-
function
|
|
18
|
+
function PrismCanvasToolbarComponent_For_22_Template(rf, ctx) { if (rf & 1) {
|
|
19
19
|
const _r2 = i0.ɵɵgetCurrentView();
|
|
20
|
-
i0.ɵɵelementStart(0, "button",
|
|
21
|
-
i0.ɵɵlistener("click", function
|
|
20
|
+
i0.ɵɵelementStart(0, "button", 21);
|
|
21
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_For_22_Template_button_click_0_listener() { const bg_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.setBg(bg_r3)); });
|
|
22
22
|
i0.ɵɵtext(1);
|
|
23
23
|
i0.ɵɵelementEnd();
|
|
24
24
|
} if (rf & 2) {
|
|
@@ -29,10 +29,10 @@ function PrismCanvasToolbarComponent_For_20_Template(rf, ctx) { if (rf & 1) {
|
|
|
29
29
|
i0.ɵɵadvance();
|
|
30
30
|
i0.ɵɵtextInterpolate1(" ", ctx_r0.capitalize(bg_r3), " ");
|
|
31
31
|
} }
|
|
32
|
-
function
|
|
32
|
+
function PrismCanvasToolbarComponent_For_27_Template(rf, ctx) { if (rf & 1) {
|
|
33
33
|
const _r4 = i0.ɵɵgetCurrentView();
|
|
34
|
-
i0.ɵɵelementStart(0, "button",
|
|
35
|
-
i0.ɵɵlistener("click", function
|
|
34
|
+
i0.ɵɵelementStart(0, "button", 21);
|
|
35
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_For_27_Template_button_click_0_listener() { const z_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.canvas.setZoom(z_r5.value)); });
|
|
36
36
|
i0.ɵɵtext(1);
|
|
37
37
|
i0.ɵɵelementEnd();
|
|
38
38
|
} if (rf & 2) {
|
|
@@ -42,10 +42,10 @@ function PrismCanvasToolbarComponent_For_25_Template(rf, ctx) { if (rf & 1) {
|
|
|
42
42
|
i0.ɵɵadvance();
|
|
43
43
|
i0.ɵɵtextInterpolate1(" ", z_r5.label, " ");
|
|
44
44
|
} }
|
|
45
|
-
function
|
|
45
|
+
function PrismCanvasToolbarComponent_For_34_Template(rf, ctx) { if (rf & 1) {
|
|
46
46
|
const _r6 = i0.ɵɵgetCurrentView();
|
|
47
|
-
i0.ɵɵelementStart(0, "button",
|
|
48
|
-
i0.ɵɵlistener("click", function
|
|
47
|
+
i0.ɵɵelementStart(0, "button", 21);
|
|
48
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_For_34_Template_button_click_0_listener() { const w_r7 = i0.ɵɵrestoreView(_r6).$implicit; const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.canvas.setViewportWidth(w_r7)); });
|
|
49
49
|
i0.ɵɵtext(1);
|
|
50
50
|
i0.ɵɵelementEnd();
|
|
51
51
|
} if (rf & 2) {
|
|
@@ -56,32 +56,19 @@ function PrismCanvasToolbarComponent_For_32_Template(rf, ctx) { if (rf & 1) {
|
|
|
56
56
|
i0.ɵɵtextInterpolate1(" ", w_r7, " ");
|
|
57
57
|
} }
|
|
58
58
|
/**
|
|
59
|
-
* The canvas tools, as a rail floating over the canvas
|
|
60
|
-
* it.
|
|
59
|
+
* The canvas tools, as a rail floating over the canvas.
|
|
61
60
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* entry, and like zoom it does not stay on one side of that split — zoom
|
|
68
|
-
* already surfaces as a chooser in the menu and a readout on the rail, and the
|
|
69
|
-
* viewport surfaces the same way, as a toggle on the rail because switching the
|
|
70
|
-
* constraint on and off is something you do constantly, and a width chooser in
|
|
71
|
-
* the menu because the specific width is something you set once you have
|
|
72
|
-
* decided to constrain at all.
|
|
61
|
+
* Things you toggle constantly (guides, rulers, the viewport constraint) get
|
|
62
|
+
* their own button; things you set once (background, zoom, viewport width) live
|
|
63
|
+
* in the menu. The template is a view rather than a setting and keeps its own
|
|
64
|
+
* button. Zoom and the active viewport width are shown as readouts; the width
|
|
65
|
+
* only appears while the viewport constraint is on.
|
|
73
66
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* The host deliberately generates no box. The rail has to be a direct child of
|
|
81
|
-
* `.prism-canvas-wrap` that does not contain the stage, because that is exactly
|
|
82
|
-
* what capture mode's structural rule in `prism-capture.service.ts` suppresses;
|
|
83
|
-
* a rail nested inside the renderer or the stage would survive into every
|
|
84
|
-
* screenshot and silently corrupt visual-regression baselines.
|
|
67
|
+
* The host generates no box. The rail must be a direct child of
|
|
68
|
+
* `.prism-canvas-wrap` outside the stage, because that is what capture mode's
|
|
69
|
+
* structural rule in `prism-capture.service.ts` hides. A rail nested in the
|
|
70
|
+
* renderer or the stage would end up in every screenshot and corrupt
|
|
71
|
+
* visual-regression baselines.
|
|
85
72
|
*/
|
|
86
73
|
export class PrismCanvasToolbarComponent {
|
|
87
74
|
canvas = inject(PrismCanvasService);
|
|
@@ -97,28 +84,24 @@ export class PrismCanvasToolbarComponent {
|
|
|
97
84
|
}
|
|
98
85
|
}
|
|
99
86
|
/**
|
|
100
|
-
* Every {@link CanvasBg},
|
|
87
|
+
* Every {@link CanvasBg}, taken from the type's canonical list.
|
|
101
88
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* leaves the whole group with nothing active and the recommendation with
|
|
106
|
-
* nowhere to sit. That is what a shorter list bought when `transparent` was
|
|
107
|
-
* left out of it, so the list is now the type's own.
|
|
89
|
+
* The group is also a readout: the active button is `effective()` and the
|
|
90
|
+
* recommended one carries the `is-rec` edge. A value missing from the list
|
|
91
|
+
* cannot be shown, so a variant declaring it would leave nothing active.
|
|
108
92
|
*
|
|
109
|
-
* `checker` and `transparent`
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* reason and says so, but it stays in the list until 23.0.0 — a component
|
|
113
|
-
* can still declare it, and the group has to be able to show what it has.
|
|
93
|
+
* `checker` and `transparent` paint the same checkerboard here, so their
|
|
94
|
+
* titles explain the difference, which only a capture shows. `checker` is
|
|
95
|
+
* deprecated but stays until 23.0.0 because components can still declare it.
|
|
114
96
|
*/
|
|
115
97
|
bgs = CANVAS_BGS;
|
|
116
|
-
/** What a background means, where the canvas cannot show the difference. */
|
|
117
98
|
/**
|
|
99
|
+
* What a background means, where the canvas cannot show the difference.
|
|
100
|
+
*
|
|
118
101
|
* Bound with `[attr.title]`, never `[title]`. A property binding assigns to
|
|
119
102
|
* `HTMLElement.title`, a non-nullable DOMString, so the `null` below would
|
|
120
103
|
* be stringified and every unremarkable button would carry a tooltip
|
|
121
|
-
* reading "null"
|
|
104
|
+
* reading "null" (four of the six in the common case).
|
|
122
105
|
*/
|
|
123
106
|
bgTitle(bg) {
|
|
124
107
|
if (this.variantBg.recommended() === bg) {
|
|
@@ -128,7 +111,7 @@ export class PrismCanvasToolbarComponent {
|
|
|
128
111
|
return 'Checkerboard here, a real alpha channel in a capture';
|
|
129
112
|
}
|
|
130
113
|
if (bg === 'checker') {
|
|
131
|
-
return 'Deprecated
|
|
114
|
+
return 'Deprecated: same look as Transparent, but a capture keeps the themed colour';
|
|
132
115
|
}
|
|
133
116
|
return null;
|
|
134
117
|
}
|
|
@@ -139,7 +122,7 @@ export class PrismCanvasToolbarComponent {
|
|
|
139
122
|
{ value: 2, label: '200%' }
|
|
140
123
|
];
|
|
141
124
|
/**
|
|
142
|
-
* The named widths, offered
|
|
125
|
+
* The named widths, offered the same way as the zoom chooser.
|
|
143
126
|
*
|
|
144
127
|
* Plain numbers and no device names: this tool narrows a box and simulates
|
|
145
128
|
* nothing, so calling 390 "iPhone" would promise a fidelity it does not have.
|
|
@@ -149,7 +132,7 @@ export class PrismCanvasToolbarComponent {
|
|
|
149
132
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
150
133
|
}
|
|
151
134
|
static ɵfac = function PrismCanvasToolbarComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCanvasToolbarComponent)(); };
|
|
152
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCanvasToolbarComponent, selectors: [["prism-canvas-toolbar"]], decls:
|
|
135
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCanvasToolbarComponent, selectors: [["prism-canvas-toolbar"]], decls: 35, vars: 24, consts: [[1, "prism-toolrail"], [1, "prism-toolrail__zoom"], [1, "prism-toolrail__vp"], ["type", "button", "title", "Toggle guides", "aria-label", "Toggle guides", 1, "prism-toolrail__btn", 3, "click"], ["name", "crosshair", 3, "size"], ["type", "button", "title", "Toggle rulers", "aria-label", "Toggle rulers", 1, "prism-toolrail__btn", 3, "click"], ["name", "move", 3, "size"], ["type", "button", "title", "Toggle viewport width", "aria-label", "Toggle viewport width", 1, "prism-toolrail__btn", 3, "click"], ["name", "ruler-dimension", 3, "size"], ["type", "button", "title", "Toggle measure tool", "aria-label", "Toggle measure tool", 1, "prism-toolrail__btn", 3, "click"], ["name", "ruler", 3, "size"], ["type", "button", "popovertarget", "prism-tools", "title", "Canvas, zoom and width", "aria-label", "Canvas, zoom and width", 1, "prism-toolrail__btn"], ["name", "sliders-horizontal", 3, "size"], [1, "prism-toolrail__sep"], ["type", "button", "popovertarget", "prism-template", "title", "Toggle Angular template", "aria-label", "Toggle Angular template", 1, "prism-toolrail__btn"], ["name", "code", 3, "size"], ["popover", "", "id", "prism-tools", "role", "dialog", "aria-label", "Canvas, zoom and width", 1, "prism-toolmenu"], [1, "prism-toolmenu__lbl"], [1, "prism-toolmenu__row"], ["type", "button", 3, "is-on", "is-rec"], ["type", "button", 3, "is-on"], ["type", "button", 3, "click"]], template: function PrismCanvasToolbarComponent_Template(rf, ctx) { if (rf & 1) {
|
|
153
136
|
i0.ɵɵelementStart(0, "div", 0)(1, "span", 1);
|
|
154
137
|
i0.ɵɵtext(2);
|
|
155
138
|
i0.ɵɵconditionalCreate(3, PrismCanvasToolbarComponent_Conditional_3_Template, 2, 1, "span", 2);
|
|
@@ -167,32 +150,36 @@ export class PrismCanvasToolbarComponent {
|
|
|
167
150
|
i0.ɵɵelement(9, "prism-icon", 8);
|
|
168
151
|
i0.ɵɵelementEnd();
|
|
169
152
|
i0.ɵɵelementStart(10, "button", 9);
|
|
153
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_Template_button_click_10_listener() { return ctx.canvas.toggleMeasure(); });
|
|
170
154
|
i0.ɵɵelement(11, "prism-icon", 10);
|
|
171
155
|
i0.ɵɵelementEnd();
|
|
172
|
-
i0.ɵɵ
|
|
173
|
-
i0.ɵɵ
|
|
174
|
-
i0.ɵɵ
|
|
156
|
+
i0.ɵɵelementStart(12, "button", 11);
|
|
157
|
+
i0.ɵɵelement(13, "prism-icon", 12);
|
|
158
|
+
i0.ɵɵelementEnd();
|
|
159
|
+
i0.ɵɵelement(14, "span", 13);
|
|
160
|
+
i0.ɵɵelementStart(15, "button", 14);
|
|
161
|
+
i0.ɵɵelement(16, "prism-icon", 15);
|
|
175
162
|
i0.ɵɵelementEnd()();
|
|
176
|
-
i0.ɵɵelementStart(
|
|
177
|
-
i0.ɵɵtext(
|
|
163
|
+
i0.ɵɵelementStart(17, "div", 16)(18, "span", 17);
|
|
164
|
+
i0.ɵɵtext(19, "Canvas");
|
|
178
165
|
i0.ɵɵelementEnd();
|
|
179
|
-
i0.ɵɵelementStart(
|
|
180
|
-
i0.ɵɵrepeaterCreate(
|
|
166
|
+
i0.ɵɵelementStart(20, "div", 18);
|
|
167
|
+
i0.ɵɵrepeaterCreate(21, PrismCanvasToolbarComponent_For_22_Template, 2, 6, "button", 19, i0.ɵɵrepeaterTrackByIdentity);
|
|
181
168
|
i0.ɵɵelementEnd();
|
|
182
|
-
i0.ɵɵelementStart(
|
|
183
|
-
i0.ɵɵtext(
|
|
169
|
+
i0.ɵɵelementStart(23, "span", 17);
|
|
170
|
+
i0.ɵɵtext(24, "Zoom");
|
|
184
171
|
i0.ɵɵelementEnd();
|
|
185
|
-
i0.ɵɵelementStart(
|
|
186
|
-
i0.ɵɵrepeaterCreate(
|
|
172
|
+
i0.ɵɵelementStart(25, "div", 18);
|
|
173
|
+
i0.ɵɵrepeaterCreate(26, PrismCanvasToolbarComponent_For_27_Template, 2, 3, "button", 20, _forTrack0);
|
|
187
174
|
i0.ɵɵelementEnd();
|
|
188
|
-
i0.ɵɵelementStart(
|
|
189
|
-
i0.ɵɵtext(
|
|
175
|
+
i0.ɵɵelementStart(28, "span", 17);
|
|
176
|
+
i0.ɵɵtext(29, "Width");
|
|
190
177
|
i0.ɵɵelementEnd();
|
|
191
|
-
i0.ɵɵelementStart(
|
|
192
|
-
i0.ɵɵlistener("click", function
|
|
193
|
-
i0.ɵɵtext(
|
|
178
|
+
i0.ɵɵelementStart(30, "div", 18)(31, "button", 21);
|
|
179
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_Template_button_click_31_listener() { return ctx.canvas.setViewportWidth(null); });
|
|
180
|
+
i0.ɵɵtext(32, " Auto ");
|
|
194
181
|
i0.ɵɵelementEnd();
|
|
195
|
-
i0.ɵɵrepeaterCreate(
|
|
182
|
+
i0.ɵɵrepeaterCreate(33, PrismCanvasToolbarComponent_For_34_Template, 2, 3, "button", 20, i0.ɵɵrepeaterTrackByIdentity);
|
|
196
183
|
i0.ɵɵelementEnd()();
|
|
197
184
|
} if (rf & 2) {
|
|
198
185
|
i0.ɵɵclassProp("has-rulers", ctx.canvas.rulers());
|
|
@@ -215,6 +202,11 @@ export class PrismCanvasToolbarComponent {
|
|
|
215
202
|
i0.ɵɵattribute("aria-pressed", ctx.canvas.viewportWidth() !== null);
|
|
216
203
|
i0.ɵɵadvance();
|
|
217
204
|
i0.ɵɵproperty("size", 14);
|
|
205
|
+
i0.ɵɵadvance();
|
|
206
|
+
i0.ɵɵclassProp("is-on", ctx.canvas.measure());
|
|
207
|
+
i0.ɵɵattribute("aria-pressed", ctx.canvas.measure());
|
|
208
|
+
i0.ɵɵadvance();
|
|
209
|
+
i0.ɵɵproperty("size", 14);
|
|
218
210
|
i0.ɵɵadvance(2);
|
|
219
211
|
i0.ɵɵproperty("size", 14);
|
|
220
212
|
i0.ɵɵadvance(3);
|
|
@@ -231,6 +223,6 @@ export class PrismCanvasToolbarComponent {
|
|
|
231
223
|
}
|
|
232
224
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismCanvasToolbarComponent, [{
|
|
233
225
|
type: Component,
|
|
234
|
-
args: [{ selector: 'prism-canvas-toolbar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: "<!-- Anchored in .prism-canvas-wrap,
|
|
226
|
+
args: [{ selector: 'prism-canvas-toolbar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: "<!-- Anchored in .prism-canvas-wrap, absolute, not fixed:\n a viewport-fixed rail would float over the sidebar and the panel, stay\n put while those are resized, and sit on top of running text in the API\n view where it has no business being. -->\n<div\n class=\"prism-toolrail\"\n [class.has-rulers]=\"canvas.rulers()\">\n <span class=\"prism-toolrail__zoom\">\n {{ Math.round(canvas.zoom() * 100) }}%\n @if (canvas.viewportWidth() !== null) {\n <span class=\"prism-toolrail__vp\">{{ canvas.viewportWidth() }}px</span>\n }\n </span>\n\n <button\n type=\"button\"\n class=\"prism-toolrail__btn\"\n [class.is-on]=\"canvas.guides()\"\n (click)=\"canvas.toggleGuides()\"\n title=\"Toggle guides\"\n aria-label=\"Toggle guides\"\n [attr.aria-pressed]=\"canvas.guides()\">\n <prism-icon\n name=\"crosshair\"\n [size]=\"14\" />\n </button>\n\n <button\n type=\"button\"\n class=\"prism-toolrail__btn\"\n [class.is-on]=\"canvas.rulers()\"\n (click)=\"canvas.toggleRulers()\"\n title=\"Toggle rulers\"\n aria-label=\"Toggle rulers\"\n [attr.aria-pressed]=\"canvas.rulers()\">\n <prism-icon\n name=\"move\"\n [size]=\"14\" />\n </button>\n\n <button\n type=\"button\"\n class=\"prism-toolrail__btn\"\n [class.is-on]=\"canvas.viewportWidth() !== null\"\n (click)=\"canvas.toggleViewport()\"\n title=\"Toggle viewport width\"\n aria-label=\"Toggle viewport width\"\n [attr.aria-pressed]=\"canvas.viewportWidth() !== null\">\n <prism-icon\n name=\"ruler-dimension\"\n [size]=\"14\" />\n </button>\n\n <button\n type=\"button\"\n class=\"prism-toolrail__btn\"\n [class.is-on]=\"canvas.measure()\"\n (click)=\"canvas.toggleMeasure()\"\n title=\"Toggle measure tool\"\n aria-label=\"Toggle measure tool\"\n [attr.aria-pressed]=\"canvas.measure()\">\n <prism-icon\n name=\"ruler\"\n [size]=\"14\" />\n </button>\n\n <button\n type=\"button\"\n class=\"prism-toolrail__btn\"\n popovertarget=\"prism-tools\"\n title=\"Canvas, zoom and width\"\n aria-label=\"Canvas, zoom and width\">\n <prism-icon\n name=\"sliders-horizontal\"\n [size]=\"14\" />\n </button>\n\n <span class=\"prism-toolrail__sep\"></span>\n\n <button\n type=\"button\"\n class=\"prism-toolrail__btn\"\n popovertarget=\"prism-template\"\n title=\"Toggle Angular template\"\n aria-label=\"Toggle Angular template\">\n <prism-icon\n name=\"code\"\n [size]=\"14\" />\n </button>\n</div>\n\n<!-- Only the three choosers. The toggles stay outside: you flip guides,\n rulers and the viewport constraint constantly while working, and a\n toggle two clicks deep is the classic mistake. What you only ever\n set may live in a menu. -->\n<div\n popover\n id=\"prism-tools\"\n class=\"prism-toolmenu\"\n role=\"dialog\"\n aria-label=\"Canvas, zoom and width\">\n <span class=\"prism-toolmenu__lbl\">Canvas</span>\n <div class=\"prism-toolmenu__row\">\n @for (bg of bgs; track bg) {\n <button\n type=\"button\"\n [class.is-on]=\"variantBg.effective() === bg\"\n [class.is-rec]=\"variantBg.recommended() === bg\"\n [attr.title]=\"bgTitle(bg)\"\n (click)=\"setBg(bg)\">\n {{ capitalize(bg) }}\n </button>\n }\n </div>\n\n <span class=\"prism-toolmenu__lbl\">Zoom</span>\n <div class=\"prism-toolmenu__row\">\n @for (z of zooms; track z.value) {\n <button\n type=\"button\"\n [class.is-on]=\"canvas.zoom() === z.value\"\n (click)=\"canvas.setZoom(z.value)\">\n {{ z.label }}\n </button>\n }\n </div>\n\n <span class=\"prism-toolmenu__lbl\">Width</span>\n <div class=\"prism-toolmenu__row\">\n <button\n type=\"button\"\n [class.is-on]=\"canvas.viewportWidth() === null\"\n (click)=\"canvas.setViewportWidth(null)\">\n Auto\n </button>\n @for (w of viewports; track w) {\n <button\n type=\"button\"\n [class.is-on]=\"canvas.viewportWidth() === w\"\n (click)=\"canvas.setViewportWidth(w)\">\n {{ w }}\n </button>\n }\n </div>\n</div>\n", styles: [":host {\n display: contents;\n}\n\n/* Canvas overlays sit at --prism-canvas-overlay-*, which the stage grows\n when the rulers claim its top and left edges (see the\n .prism-canvas-stage[data-rulers] rule in prism-renderer.component.ts).\n prism-canvas-bg-pill simply inherits those; this rail cannot, because\n capture mode requires it to be a direct child of .prism-canvas-wrap\n outside the stage. So it mirrors the same values off canvas.rulers()\n instead, so keep the two in step.\n\n z-index outranks the rulers' 4 rather than matching it: the rail is a\n control and they are chrome, and the toolbar renders before the\n renderer in the shell, so an equal z-index let the rulers paint over\n the buttons. */\n.prism-toolrail {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n right: var(--prism-canvas-overlay-inline, 20px);\n z-index: 5;\n display: flex;\n flex-direction: column;\n gap: var(--sp-1);\n align-items: center;\n padding: var(--sp-2);\n anchor-name: --prism-toolrail;\n background: var(--prism-bg-elevated);\n border: 1px solid var(--prism-border-strong);\n border-radius: var(--radius-md);\n box-shadow: 0 4px 16px -6px rgb(0 0 0 / 40%);\n}\n\n.prism-toolrail.has-rulers {\n --prism-canvas-overlay-top: 28px;\n --prism-canvas-overlay-inline: 28px;\n}\n\n.prism-toolrail__zoom {\n width: 100%;\n padding-bottom: var(--sp-1);\n font-family: var(--font-mono);\n font-size: 9px;\n color: var(--prism-text-ghost);\n text-align: center;\n border-bottom: 1px solid var(--prism-border);\n}\n\n/* The one number on this rail that is not a percentage, so it takes the\n measurement colour the theme already reserves for rulers and guides\n rather than a second neutral that would read as a second zoom. */\n.prism-toolrail__vp {\n display: block;\n color: var(--prism-measure);\n}\n\n.prism-toolrail__btn {\n display: grid;\n place-items: center;\n width: 26px;\n height: 26px;\n padding: 0;\n color: var(--prism-text-muted);\n cursor: pointer;\n background: transparent;\n border: 0;\n border-radius: var(--radius-xs);\n}\n\n.prism-toolrail__btn:hover {\n color: var(--prism-text);\n}\n\n.prism-toolrail__btn:focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n}\n\n.prism-toolrail__btn.is-on {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 18%, transparent);\n}\n\n.prism-toolrail__sep {\n width: 14px;\n height: 1px;\n margin: var(--sp-1) 0;\n background: var(--prism-border);\n}\n\n.prism-toolmenu {\n inset: auto;\n gap: var(--sp-2);\n padding: var(--sp-3);\n margin: 0;\n margin-inline-end: var(--sp-2);\n position-area: inline-start;\n position-anchor: --prism-toolrail;\n position-try-fallbacks: flip-inline;\n background: var(--prism-bg-elevated);\n border: 1px solid var(--prism-border-strong);\n border-radius: var(--radius-md);\n box-shadow: 0 8px 28px -10px rgb(0 0 0 / 45%);\n}\n\n/* display belongs on :popover-open and nowhere else (see the note in\n prism-template-popover.component.ts). An author display on the base\n rule outranks the UA's [popover]:not(:popover-open) { display: none }\n and pins the menu open. */\n.prism-toolmenu:popover-open {\n display: flex;\n flex-direction: column;\n}\n\n.prism-toolmenu__lbl {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n}\n\n.prism-toolmenu__row {\n display: flex;\n flex-wrap: wrap;\n gap: var(--sp-1);\n}\n\n.prism-toolmenu__row button {\n padding: 2px var(--sp-3);\n font-size: var(--fs-md);\n color: var(--prism-text-2);\n white-space: nowrap;\n cursor: pointer;\n background: transparent;\n border: 1px solid var(--prism-border);\n border-radius: var(--radius-xs);\n}\n\n.prism-toolmenu__row button.is-on {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 16%, transparent);\n border-color: color-mix(in srgb, var(--prism-primary) 38%, transparent);\n}\n\n.prism-toolmenu__row button.is-rec {\n border-color: color-mix(in srgb, var(--prism-primary) 30%, transparent);\n}\n"] }]
|
|
235
227
|
}], null, null); })();
|
|
236
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasToolbarComponent, { className: "PrismCanvasToolbarComponent", filePath: "app/canvas/prism-canvas-toolbar.component.ts", lineNumber:
|
|
228
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasToolbarComponent, { className: "PrismCanvasToolbarComponent", filePath: "app/canvas/prism-canvas-toolbar.component.ts", lineNumber: 31 }); })();
|
|
@@ -103,6 +103,6 @@ export class PrismTemplatePopoverComponent {
|
|
|
103
103
|
}
|
|
104
104
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismTemplatePopoverComponent, [{
|
|
105
105
|
type: Component,
|
|
106
|
-
args: [{ selector: 'prism-template-popover', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: "<!-- A native popover: the platform owns open, light-dismiss and Escape, so\n there is no visibility signal, no document click listener and no key\n handler here. The id is what the rail's button names in its\n popovertarget. -->\n<div\n popover\n id=\"prism-template\"\n class=\"tpl-popover\"\n role=\"dialog\"\n aria-label=\"Angular template\">\n <div class=\"tpl-popover-head\">\n <prism-icon\n name=\"code\"\n [size]=\"13\" />\n <span>Angular Template</span>\n <button\n type=\"button\"\n class=\"tpl-popover-copy\"\n (click)=\"copy()\"\n [title]=\"copied() ? 'Copied!' : 'Copy to clipboard'\">\n <prism-icon\n [name]=\"copied() ? 'shield-check' : 'copy'\"\n [size]=\"12\" />\n {{ copied() ? 'Copied' : 'Copy' }}\n </button>\n <button\n type=\"button\"\n class=\"tpl-popover-close\"\n popovertarget=\"prism-template\"\n popovertargetaction=\"hide\"\n aria-label=\"Close\"\n title=\"Close (Esc)\">\n <prism-icon\n name=\"x\"\n [size]=\"13\" />\n </button>\n </div>\n <pre\n class=\"tpl-popover-body\"\n [innerHTML]=\"highlighted()\"></pre>\n</div>\n", styles: [":host {\n display: contents;\n}\n\n/* No position of its own: a popover is in the top layer, where the\n containing block is the viewport, so the old right/top pair against the\n canvas would have parked this in the corner of the *window* and over the\n header. It hangs off the rail instead, the same way the head popovers\n hang off their triggers. Viewport units, not percentages
|
|
106
|
+
args: [{ selector: 'prism-template-popover', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: "<!-- A native popover: the platform owns open, light-dismiss and Escape, so\n there is no visibility signal, no document click listener and no key\n handler here. The id is what the rail's button names in its\n popovertarget. -->\n<div\n popover\n id=\"prism-template\"\n class=\"tpl-popover\"\n role=\"dialog\"\n aria-label=\"Angular template\">\n <div class=\"tpl-popover-head\">\n <prism-icon\n name=\"code\"\n [size]=\"13\" />\n <span>Angular Template</span>\n <button\n type=\"button\"\n class=\"tpl-popover-copy\"\n (click)=\"copy()\"\n [title]=\"copied() ? 'Copied!' : 'Copy to clipboard'\">\n <prism-icon\n [name]=\"copied() ? 'shield-check' : 'copy'\"\n [size]=\"12\" />\n {{ copied() ? 'Copied' : 'Copy' }}\n </button>\n <button\n type=\"button\"\n class=\"tpl-popover-close\"\n popovertarget=\"prism-template\"\n popovertargetaction=\"hide\"\n aria-label=\"Close\"\n title=\"Close (Esc)\">\n <prism-icon\n name=\"x\"\n [size]=\"13\" />\n </button>\n </div>\n <pre\n class=\"tpl-popover-body\"\n [innerHTML]=\"highlighted()\"></pre>\n</div>\n", styles: [":host {\n display: contents;\n}\n\n/* No position of its own: a popover is in the top layer, where the\n containing block is the viewport, so the old right/top pair against the\n canvas would have parked this in the corner of the *window* and over the\n header. It hangs off the rail instead, the same way the head popovers\n hang off their triggers. Viewport units, not percentages, because a\n percentage here resolves against the position area, not the canvas. */\n.tpl-popover {\n inset: auto;\n width: 520px;\n max-width: calc(100vw - var(--sp-6));\n max-height: min(420px, calc(100vh - var(--sp-7)));\n margin: var(--sp-2) 0 0 0;\n position-area: block-end span-inline-start;\n position-anchor: --prism-toolrail;\n position-try-fallbacks: flip-block, flip-inline;\n overflow: hidden;\n background: var(--prism-bg-elevated);\n border: 1px solid var(--prism-border-strong);\n border-radius: var(--radius-lg, 10px);\n box-shadow:\n 0 20px 60px rgb(0 0 0 / 45%),\n 0 0 0 1px color-mix(in srgb, var(--prism-primary) 10%, transparent);\n animation: tpl-fade-in var(--dur-fast, 0.15s) var(--ease-default, ease-out);\n}\n\n/* display belongs on :popover-open and nowhere else. The UA stylesheet\n hides a closed popover with [popover]:not(:popover-open) { display: none },\n and any author display on the base rule outranks it. The panel then\n shows permanently and neither Escape nor light-dismiss can hide it,\n because closing only drops :popover-open and leaves the author rule\n standing. */\n.tpl-popover:popover-open {\n display: flex;\n flex-direction: column;\n}\n\n@keyframes tpl-fade-in {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.tpl-popover-head {\n display: flex;\n flex-shrink: 0;\n gap: 8px;\n align-items: center;\n height: 40px;\n padding: 0 12px 0 16px;\n background: linear-gradient(180deg, var(--prism-bg-surface), var(--prism-bg-elevated));\n border-bottom: 1px solid var(--prism-border);\n}\n\n.tpl-popover-head > prism-icon {\n color: var(--prism-text-muted);\n}\n\n.tpl-popover-head > span {\n flex: 1;\n font-size: var(--fs-xs);\n font-weight: 700;\n color: var(--prism-text-2);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n}\n\n.tpl-popover-copy {\n display: flex;\n gap: 5px;\n align-items: center;\n height: 26px;\n padding: 0 10px;\n font-family: var(--font-sans);\n font-size: var(--fs-sm);\n font-weight: 500;\n color: var(--prism-primary);\n cursor: pointer;\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n border-radius: var(--radius-sm, 5px);\n transition: background var(--dur-fast);\n}\n\n.tpl-popover-copy:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n}\n\n.tpl-popover-close {\n display: grid;\n place-items: center;\n width: 26px;\n height: 26px;\n color: var(--prism-text-muted);\n cursor: pointer;\n background: transparent;\n border: 0;\n border-radius: var(--radius-sm, 5px);\n transition:\n background var(--dur-fast),\n color var(--dur-fast);\n}\n\n.tpl-popover-close:hover {\n color: var(--prism-text);\n background: var(--prism-input-bg);\n}\n\n.tpl-popover-body {\n flex: 1;\n min-height: 0;\n padding: 14px 18px;\n margin: 0;\n overflow: auto;\n font-family: var(--font-mono);\n font-size: var(--fs-md);\n line-height: 1.7;\n color: var(--prism-text-2);\n white-space: pre;\n background: var(--prism-bg);\n}\n\n.tpl-popover-body::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n}\n\n.tpl-popover-body::-webkit-scrollbar-thumb {\n background: var(--prism-border-strong);\n border-radius: 3px;\n}\n\n:host ::ng-deep .tok-tag {\n color: var(--prism-code-tag);\n}\n\n:host ::ng-deep .tok-attr {\n color: var(--prism-code-attr);\n}\n\n:host ::ng-deep .tok-str {\n color: var(--prism-code-str);\n}\n\n:host ::ng-deep .tok-com {\n font-style: italic;\n color: var(--prism-code-com);\n}\n"] }]
|
|
107
107
|
}], null, null); })();
|
|
108
108
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismTemplatePopoverComponent, { className: "PrismTemplatePopoverComponent", filePath: "app/canvas/prism-template-popover.component.ts", lineNumber: 44 }); })();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The tolerance is what makes a drag land on 390 instead of 388: without it,
|
|
5
5
|
* hitting a named width by hand is a game of pixels, and the presets in the
|
|
6
6
|
* menu would be the only way to reach them exactly. Outside the tolerance the
|
|
7
|
-
* width is returned untouched
|
|
7
|
+
* width is returned untouched. Searching for a breakpoint between the presets
|
|
8
8
|
* is the other half of what this tool is for, and a grid that always snapped
|
|
9
9
|
* would make that impossible.
|
|
10
10
|
*/
|
|
@@ -5,7 +5,7 @@ import { VIEWPORT_SNAP_TOLERANCE, VIEWPORT_SNAPS } from '../../shared/viewport.t
|
|
|
5
5
|
* The tolerance is what makes a drag land on 390 instead of 388: without it,
|
|
6
6
|
* hitting a named width by hand is a game of pixels, and the presets in the
|
|
7
7
|
* menu would be the only way to reach them exactly. Outside the tolerance the
|
|
8
|
-
* width is returned untouched
|
|
8
|
+
* width is returned untouched. Searching for a breakpoint between the presets
|
|
9
9
|
* is the other half of what this tool is for, and a grid that always snapped
|
|
10
10
|
* would make that impossible.
|
|
11
11
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* How a metric compares to its threshold.
|
|
3
3
|
*
|
|
4
|
-
* `none` means there is no verdict to give
|
|
4
|
+
* `none` means there is no verdict to give: either the value is missing, or
|
|
5
5
|
* it is a plain fact with no threshold to compare against, like a count of
|
|
6
6
|
* variants. Those render grey and stay out of the gauge's tally, which counts
|
|
7
7
|
* the metrics that actually passed something.
|
|
@@ -28,7 +28,7 @@ export interface GaugeSummary {
|
|
|
28
28
|
/**
|
|
29
29
|
* Folds the head's metrics into what one chip can say.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
31
|
+
* A pure function instead of a computed inside the component:
|
|
32
32
|
* components using signal inputs cannot be rendered through TestBed in this
|
|
33
33
|
* repo's Jest setup, so any logic left in a template is logic that never gets
|
|
34
34
|
* a test. This mirrors `decorateItem` in the sidebar, which resolves the same
|
|
@@ -7,7 +7,7 @@ const SEVERITY = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Folds the head's metrics into what one chip can say.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* A pure function instead of a computed inside the component:
|
|
11
11
|
* components using signal inputs cannot be rendered through TestBed in this
|
|
12
12
|
* repo's Jest setup, so any logic left in a template is logic that never gets
|
|
13
13
|
* a test. This mirrors `decorateItem` in the sidebar, which resolves the same
|
|
@@ -19,8 +19,8 @@ export declare class PrismComponentHeadComponent {
|
|
|
19
19
|
* The visual regression headline, as the plugin already derived it.
|
|
20
20
|
*
|
|
21
21
|
* Read whole rather than recomputed: the colour follows the plugin's status
|
|
22
|
-
* semantics
|
|
23
|
-
* compared
|
|
22
|
+
* semantics (red for any changed variant, amber for ones that could not be
|
|
23
|
+
* compared), and duplicating that rule here would mean the stat and the
|
|
24
24
|
* plugin's own panel could disagree about the same component.
|
|
25
25
|
*/
|
|
26
26
|
protected readonly vrtStat: import("@angular/core").Signal<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-component-head.component.d.ts","sourceRoot":"","sources":["../../../src/app/component-head/prism-component-head.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;;AAIpD,UAAU,WAAW;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAqBD,qBAQa,2BAA2B;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IAEzD,SAAS,CAAC,QAAQ,CAAC,IAAI,mFAA4D;IAEnF,SAAS,CAAC,QAAQ,CAAC,QAAQ,yCAIxB;IAEH,SAAS,CAAC,QAAQ,CAAC,YAAY,yCAI5B;IAEH,SAAS,CAAC,QAAQ,CAAC,MAAM,8DAAwF;IAEjH,SAAS,CAAC,QAAQ,CAAC,WAAW,qDAI3B;IAEH,SAAS,CAAC,QAAQ,CAAC,eAAe,gDAM/B;
|
|
1
|
+
{"version":3,"file":"prism-component-head.component.d.ts","sourceRoot":"","sources":["../../../src/app/component-head/prism-component-head.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;;AAIpD,UAAU,WAAW;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAqBD,qBAQa,2BAA2B;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IAEzD,SAAS,CAAC,QAAQ,CAAC,IAAI,mFAA4D;IAEnF,SAAS,CAAC,QAAQ,CAAC,QAAQ,yCAIxB;IAEH,SAAS,CAAC,QAAQ,CAAC,YAAY,yCAI5B;IAEH,SAAS,CAAC,QAAQ,CAAC,MAAM,8DAAwF;IAEjH,SAAS,CAAC,QAAQ,CAAC,WAAW,qDAI3B;IAEH,SAAS,CAAC,QAAQ,CAAC,eAAe,gDAM/B;IAWH,SAAS,CAAC,QAAQ,CAAC,SAAS,gDAEzB;IAEH;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO;eACf,MAAM;iBACJ,IAAI,GAAG,MAAM,GAAG,QAAQ;cAQlC;IAEH;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,+CAyBvB;IAEH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAK3B;yCA1GM,2BAA2B;2CAA3B,2BAA2B;CA2GvC"}
|