@ng-prism/core 22.2.0-beta.2 → 22.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +18 -8
  2. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  3. package/dist/app/canvas/prism-canvas-toolbar.component.js +32 -21
  4. package/dist/app/component-head/prism-component-head.component.d.ts +12 -0
  5. package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
  6. package/dist/app/component-head/prism-component-head.component.js +45 -10
  7. package/dist/app/component-head/prism-stat.component.d.ts +1 -1
  8. package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
  9. package/dist/app/component-head/prism-stat.component.js +12 -9
  10. package/dist/app/panels/panel-host/panel-badge.d.ts +29 -0
  11. package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -0
  12. package/dist/app/panels/panel-host/panel-badge.js +42 -0
  13. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +1 -4
  14. package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
  15. package/dist/app/panels/panel-host/prism-panel-host.component.js +10 -27
  16. package/dist/app/services/prism-capture.service.d.ts +10 -2
  17. package/dist/app/services/prism-capture.service.d.ts.map +1 -1
  18. package/dist/app/services/prism-capture.service.js +89 -2
  19. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  20. package/dist/builder/scanner/component.scanner.js +30 -3
  21. package/dist/plugin/index.d.ts +1 -1
  22. package/dist/plugin/index.d.ts.map +1 -1
  23. package/dist/plugin/plugin.types.d.ts +19 -0
  24. package/dist/plugin/plugin.types.d.ts.map +1 -1
  25. package/dist/shared/canvas-bg.type.d.ts +24 -6
  26. package/dist/shared/canvas-bg.type.d.ts.map +1 -1
  27. package/dist/shared/canvas-bg.type.js +6 -5
  28. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import { PrismCanvasService, type CanvasBg } from '../services/prism-canvas.service.js';
1
+ import { type CanvasBg } from '../../shared/canvas-bg.type.js';
2
+ import { PrismCanvasService } from '../services/prism-canvas.service.js';
2
3
  import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
3
4
  import { PrismLayoutService } from '../services/prism-layout.service.js';
4
5
  import * as i0 from "@angular/core";
@@ -8,15 +9,24 @@ export declare class PrismCanvasToolbarComponent {
8
9
  protected readonly layout: PrismLayoutService;
9
10
  protected setBg(bg: CanvasBg): void;
10
11
  /**
11
- * The backgrounds a user can cycle through — deliberately not every
12
- * {@link CanvasBg}.
12
+ * Every {@link CanvasBg}, and the canonical list rather than a copy of it.
13
13
  *
14
- * `transparent` is missing on purpose. It renders as the checkerboard while
15
- * browsing, so offering it next to `checker` would be two buttons that paint
16
- * the same thing; the difference only exists in a capture, which is not a
17
- * thing this toolbar can show. It stays a value a `@Showcase` declares.
14
+ * This group is a readout as much as a control: the active button is
15
+ * `effective()` and the starred one is `recommended()`. A value missing here
16
+ * therefore cannot be *shown* either — a variant declaring it leaves the
17
+ * whole group with nothing active and the star with nowhere to sit. That is
18
+ * what a shorter list bought when `transparent` was left out of it, so the
19
+ * list is now the type's own.
20
+ *
21
+ * `checker` and `transparent` do paint the same checkerboard here, which is
22
+ * why they carry titles: the difference between them is what a capture does,
23
+ * and the canvas cannot show that. `checker` is deprecated for exactly that
24
+ * reason and says so, but it stays in the list until 23.0.0 — a component
25
+ * can still declare it, and the group has to be able to show what it has.
18
26
  */
19
- protected readonly bgs: CanvasBg[];
27
+ protected readonly bgs: readonly CanvasBg[];
28
+ /** What a background means, where the canvas cannot show the difference. */
29
+ protected bgTitle(bg: CanvasBg): string | null;
20
30
  protected readonly zooms: {
21
31
  value: number;
22
32
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"prism-canvas-toolbar.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-toolbar.component.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EA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;IAEpC,4EAA4E;IAC5E,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI;IAY9C,SAAS,CAAC,QAAQ,CAAC,KAAK;;;QAKtB;IAEF,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;yCAnD5B,2BAA2B;2CAA3B,2BAA2B;CAsDvC"}
@@ -1,6 +1,7 @@
1
1
  import { Component, inject, ChangeDetectionStrategy } from '@angular/core';
2
2
  import { PrismIconComponent } from '../icons/prism-icon.component.js';
3
- import { PrismCanvasService, } from '../services/prism-canvas.service.js';
3
+ import { CANVAS_BGS } from '../../shared/canvas-bg.type.js';
4
+ import { PrismCanvasService } from '../services/prism-canvas.service.js';
4
5
  import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
5
6
  import { PrismLayoutService } from '../services/prism-layout.service.js';
6
7
  import * as i0 from "@angular/core";
@@ -22,7 +23,7 @@ function PrismCanvasToolbarComponent_For_5_Template(rf, ctx) { if (rf & 1) {
22
23
  const bg_r2 = ctx.$implicit;
23
24
  const ctx_r2 = i0.ɵɵnextContext();
24
25
  i0.ɵɵclassProp("tool-btn--active", ctx_r2.variantBg.effective() === bg_r2)("tool-btn--recommended", ctx_r2.variantBg.recommended() === bg_r2);
25
- i0.ɵɵproperty("title", ctx_r2.variantBg.recommended() === bg_r2 ? "Recommended background for this variant" : null);
26
+ i0.ɵɵproperty("title", ctx_r2.bgTitle(bg_r2));
26
27
  i0.ɵɵadvance();
27
28
  i0.ɵɵconditional(ctx_r2.variantBg.recommended() === bg_r2 ? 1 : -1);
28
29
  i0.ɵɵadvance();
@@ -54,21 +55,35 @@ export class PrismCanvasToolbarComponent {
54
55
  }
55
56
  }
56
57
  /**
57
- * The backgrounds a user can cycle through — deliberately not every
58
- * {@link CanvasBg}.
58
+ * Every {@link CanvasBg}, and the canonical list rather than a copy of it.
59
59
  *
60
- * `transparent` is missing on purpose. It renders as the checkerboard while
61
- * browsing, so offering it next to `checker` would be two buttons that paint
62
- * the same thing; the difference only exists in a capture, which is not a
63
- * thing this toolbar can show. It stays a value a `@Showcase` declares.
60
+ * This group is a readout as much as a control: the active button is
61
+ * `effective()` and the starred one is `recommended()`. A value missing here
62
+ * therefore cannot be *shown* either — a variant declaring it leaves the
63
+ * whole group with nothing active and the star with nowhere to sit. That is
64
+ * what a shorter list bought when `transparent` was left out of it, so the
65
+ * list is now the type's own.
66
+ *
67
+ * `checker` and `transparent` do paint the same checkerboard here, which is
68
+ * why they carry titles: the difference between them is what a capture does,
69
+ * and the canvas cannot show that. `checker` is deprecated for exactly that
70
+ * reason and says so, but it stays in the list until 23.0.0 — a component
71
+ * can still declare it, and the group has to be able to show what it has.
64
72
  */
65
- bgs = [
66
- 'dots',
67
- 'plain',
68
- 'light',
69
- 'dark',
70
- 'checker',
71
- ];
73
+ bgs = CANVAS_BGS;
74
+ /** What a background means, where the canvas cannot show the difference. */
75
+ bgTitle(bg) {
76
+ if (this.variantBg.recommended() === bg) {
77
+ return 'Recommended background for this variant';
78
+ }
79
+ if (bg === 'transparent') {
80
+ return 'Checkerboard here, a real alpha channel in a capture';
81
+ }
82
+ if (bg === 'checker') {
83
+ return 'Deprecated — same look as Transparent, but a capture keeps the themed colour';
84
+ }
85
+ return null;
86
+ }
72
87
  zooms = [
73
88
  { value: 0.75, label: '75%' },
74
89
  { value: 1, label: '100%' },
@@ -140,11 +155,7 @@ export class PrismCanvasToolbarComponent {
140
155
  class="tool-btn"
141
156
  [class.tool-btn--active]="variantBg.effective() === bg"
142
157
  [class.tool-btn--recommended]="variantBg.recommended() === bg"
143
- [title]="
144
- variantBg.recommended() === bg
145
- ? 'Recommended background for this variant'
146
- : null
147
- "
158
+ [title]="bgTitle(bg)"
148
159
  (click)="setBg(bg)"
149
160
  >
150
161
  @if (variantBg.recommended() === bg) {
@@ -215,4 +226,4 @@ export class PrismCanvasToolbarComponent {
215
226
  </div>
216
227
  `, styles: ["\n .canvas-toolbar {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 20px;\n border-bottom: 1px solid var(--prism-border);\n background: var(--prism-bg);\n min-height: 44px;\n }\n\n .tool-group {\n display: flex;\n align-items: center;\n gap: 1px;\n padding: 2px;\n background: var(--prism-input-bg);\n border: 1px solid var(--prism-border);\n border-radius: var(--radius-md);\n }\n\n .tool-btn {\n height: 24px;\n padding: 0 9px;\n border-radius: var(--radius-sm);\n display: flex;\n align-items: center;\n gap: 5px;\n font-size: var(--fs-sm);\n color: var(--prism-text-muted);\n transition: all var(--dur-fast);\n font-weight: 500;\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .tool-btn:hover {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .tool-btn--active {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 15%, transparent);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prism-primary) 30%, transparent);\n }\n .bg-star {\n flex-shrink: 0;\n filter: drop-shadow(0 0 2px rgba(250, 204, 21, 0.4));\n }\n\n .tool-sep {\n width: 1px;\n height: 18px;\n background: var(--prism-border);\n margin: 0 4px;\n }\n\n .tool-label {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n margin-right: 2px;\n }\n\n .tool-spacer { flex: 1; }\n\n .tool-btn--tpl {\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 10%, transparent);\n border: 1px solid\n color-mix(in srgb, var(--prism-primary) 25%, transparent);\n font-family: var(--font-mono);\n }\n .tool-btn--tpl:hover {\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 18%, transparent);\n }\n .tool-btn--tpl.tool-btn--tpl-active {\n background: color-mix(in srgb, var(--prism-primary) 22%, transparent);\n box-shadow: inset 0 0 0 1px\n color-mix(in srgb, var(--prism-primary) 35%, transparent);\n }\n "] }]
217
228
  }], null, null); })();
218
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasToolbarComponent, { className: "PrismCanvasToolbarComponent", filePath: "app/canvas/prism-canvas-toolbar.component.ts", lineNumber: 185 }); })();
229
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasToolbarComponent, { className: "PrismCanvasToolbarComponent", filePath: "app/canvas/prism-canvas-toolbar.component.ts", lineNumber: 179 }); })();
@@ -15,6 +15,18 @@ export declare class PrismComponentHeadComponent {
15
15
  protected readonly coveragePercent: import("@angular/core").Signal<number | null>;
16
16
  protected readonly bundleSize: import("@angular/core").Signal<string | null>;
17
17
  protected readonly a11yScore: import("@angular/core").Signal<number | null>;
18
+ /**
19
+ * The visual regression headline, as the plugin already derived it.
20
+ *
21
+ * Read whole rather than recomputed: the colour follows the plugin's status
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
+ * plugin's own panel could disagree about the same component.
25
+ */
26
+ protected readonly vrtStat: import("@angular/core").Signal<{
27
+ value: string;
28
+ variant: "ok" | "warn" | "danger";
29
+ } | null>;
18
30
  private readonly componentMeta;
19
31
  static ɵfac: i0.ɵɵFactoryDeclaration<PrismComponentHeadComponent, never>;
20
32
  static ɵcmp: i0.ɵɵComponentDeclaration<PrismComponentHeadComponent, "prism-component-head", never, {}, {}, never, never, true, never>;
@@ -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":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;;AAEzE,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAqBD,qBAsNa,2BAA2B;IACtC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,Y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C,OAAO;eACjB,MAAM;iBACJ,IAAI,GAAG,MAAM,GAAG,QAAQ;cAUhC;IAEH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAM3B;yCA9EQ,2BAA2B;2CAA3B,2BAA2B;CA+EvC"}
@@ -5,20 +5,20 @@ import { A11yAuditService } from '../panels/a11y/a11y-audit.service.js';
5
5
  import { PrismStatComponent } from './prism-stat.component.js';
6
6
  import * as i0 from "@angular/core";
7
7
  function PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_1_Template(rf, ctx) { if (rf & 1) {
8
- i0.ɵɵelement(0, "prism-icon", 14);
8
+ i0.ɵɵelement(0, "prism-icon", 15);
9
9
  } if (rf & 2) {
10
10
  i0.ɵɵproperty("size", 13);
11
11
  } }
12
12
  function PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_2_Template(rf, ctx) { if (rf & 1) {
13
- i0.ɵɵelement(0, "span", 15);
13
+ i0.ɵɵelement(0, "span", 16);
14
14
  } }
15
15
  function PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_3_Template(rf, ctx) { if (rf & 1) {
16
- i0.ɵɵelement(0, "span", 16);
16
+ i0.ɵɵelement(0, "span", 17);
17
17
  } }
18
18
  function PrismComponentHeadComponent_Conditional_0_Conditional_13_Template(rf, ctx) { if (rf & 1) {
19
19
  i0.ɵɵelementStart(0, "span");
20
- i0.ɵɵconditionalCreate(1, PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_1_Template, 1, 1, "prism-icon", 14)(2, PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_2_Template, 1, 0, "span", 15)(3, PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_3_Template, 1, 0, "span", 16);
21
- i0.ɵɵelementStart(4, "span", 17);
20
+ i0.ɵɵconditionalCreate(1, PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_1_Template, 1, 1, "prism-icon", 15)(2, PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_2_Template, 1, 0, "span", 16)(3, PrismComponentHeadComponent_Conditional_0_Conditional_13_Conditional_3_Template, 1, 0, "span", 17);
21
+ i0.ɵɵelementStart(4, "span", 18);
22
22
  i0.ɵɵtext(5);
23
23
  i0.ɵɵelementEnd()();
24
24
  } if (rf & 2) {
@@ -41,7 +41,7 @@ function PrismComponentHeadComponent_Conditional_0_Conditional_14_Template(rf, c
41
41
  i0.ɵɵtextInterpolate(c_r3.meta.showcaseConfig.description);
42
42
  } }
43
43
  function PrismComponentHeadComponent_Conditional_0_Conditional_15_For_2_Template(rf, ctx) { if (rf & 1) {
44
- i0.ɵɵelementStart(0, "span", 18);
44
+ i0.ɵɵelementStart(0, "span", 19);
45
45
  i0.ɵɵtext(1);
46
46
  i0.ɵɵelementEnd();
47
47
  } if (rf & 2) {
@@ -51,7 +51,7 @@ function PrismComponentHeadComponent_Conditional_0_Conditional_15_For_2_Template
51
51
  } }
52
52
  function PrismComponentHeadComponent_Conditional_0_Conditional_15_Template(rf, ctx) { if (rf & 1) {
53
53
  i0.ɵɵelementStart(0, "div", 8);
54
- i0.ɵɵrepeaterCreate(1, PrismComponentHeadComponent_Conditional_0_Conditional_15_For_2_Template, 2, 1, "span", 18, i0.ɵɵrepeaterTrackByIdentity);
54
+ i0.ɵɵrepeaterCreate(1, PrismComponentHeadComponent_Conditional_0_Conditional_15_For_2_Template, 2, 1, "span", 19, i0.ɵɵrepeaterTrackByIdentity);
55
55
  i0.ɵɵelementEnd();
56
56
  } if (rf & 2) {
57
57
  const c_r3 = i0.ɵɵnextContext();
@@ -82,6 +82,12 @@ function PrismComponentHeadComponent_Conditional_0_Conditional_20_Template(rf, c
82
82
  const ctx_r1 = i0.ɵɵnextContext(2);
83
83
  i0.ɵɵproperty("value", ctx_r1.a11yScore())("pillVariant", ctx_r1.a11yScore() >= 90 ? "ok" : "warn");
84
84
  } }
85
+ function PrismComponentHeadComponent_Conditional_0_Conditional_21_Template(rf, ctx) { if (rf & 1) {
86
+ i0.ɵɵelement(0, "prism-stat", 14);
87
+ } if (rf & 2) {
88
+ const vrt_r5 = ctx;
89
+ i0.ɵɵproperty("value", vrt_r5.value)("pillVariant", vrt_r5.variant);
90
+ } }
85
91
  function PrismComponentHeadComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
86
92
  i0.ɵɵelementStart(0, "section", 0)(1, "div", 1)(2, "div")(3, "div", 2)(4, "span");
87
93
  i0.ɵɵtext(5);
@@ -105,9 +111,11 @@ function PrismComponentHeadComponent_Conditional_0_Template(rf, ctx) { if (rf &
105
111
  i0.ɵɵconditionalCreate(18, PrismComponentHeadComponent_Conditional_0_Conditional_18_Template, 1, 3, "prism-stat", 11);
106
112
  i0.ɵɵconditionalCreate(19, PrismComponentHeadComponent_Conditional_0_Conditional_19_Template, 1, 1, "prism-stat", 12);
107
113
  i0.ɵɵconditionalCreate(20, PrismComponentHeadComponent_Conditional_0_Conditional_20_Template, 1, 2, "prism-stat", 13);
114
+ i0.ɵɵconditionalCreate(21, PrismComponentHeadComponent_Conditional_0_Conditional_21_Template, 1, 2, "prism-stat", 14);
108
115
  i0.ɵɵelementEnd()()();
109
116
  } if (rf & 2) {
110
117
  let tmp_7_0;
118
+ let tmp_14_0;
111
119
  const c_r3 = ctx;
112
120
  const ctx_r1 = i0.ɵɵnextContext();
113
121
  i0.ɵɵadvance(5);
@@ -134,6 +142,8 @@ function PrismComponentHeadComponent_Conditional_0_Template(rf, ctx) { if (rf &
134
142
  i0.ɵɵconditional(ctx_r1.bundleSize() !== null ? 19 : -1);
135
143
  i0.ɵɵadvance();
136
144
  i0.ɵɵconditional(ctx_r1.a11yScore() !== null ? 20 : -1);
145
+ i0.ɵɵadvance();
146
+ i0.ɵɵconditional((tmp_14_0 = ctx_r1.vrtStat()) ? 21 : -1, tmp_14_0);
137
147
  } }
138
148
  const STATUS_BADGES = {
139
149
  stable: {
@@ -198,6 +208,24 @@ export class PrismComponentHeadComponent {
198
208
  return this.auditService.scoreResult()?.score ?? null;
199
209
  }, /* @ts-ignore */
200
210
  ...(ngDevMode ? [{ debugName: "a11yScore" }] : /* istanbul ignore next */ []));
211
+ /**
212
+ * The visual regression headline, as the plugin already derived it.
213
+ *
214
+ * Read whole rather than recomputed: the colour follows the plugin's status
215
+ * semantics — red for any changed variant, amber for ones that could not be
216
+ * compared — and duplicating that rule here would mean the stat and the
217
+ * plugin's own panel could disagree about the same component.
218
+ */
219
+ vrtStat = computed(() => {
220
+ const vrt = this.componentMeta()?.['visualRegression'];
221
+ if (!vrt?.found || !vrt.summary)
222
+ return null;
223
+ const { value, variant } = vrt.summary;
224
+ return variant === 'ok' || variant === 'warn' || variant === 'danger'
225
+ ? { value, variant }
226
+ : null;
227
+ }, /* @ts-ignore */
228
+ ...(ngDevMode ? [{ debugName: "vrtStat" }] : /* istanbul ignore next */ []));
201
229
  componentMeta = computed(() => {
202
230
  const c = this.comp();
203
231
  const meta = c?.meta.showcaseConfig.meta;
@@ -207,8 +235,8 @@ export class PrismComponentHeadComponent {
207
235
  }, /* @ts-ignore */
208
236
  ...(ngDevMode ? [{ debugName: "componentMeta" }] : /* istanbul ignore next */ []));
209
237
  static ɵfac = function PrismComponentHeadComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismComponentHeadComponent)(); };
210
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismComponentHeadComponent, selectors: [["prism-component-head"]], decls: 1, vars: 1, consts: [[1, "comp-head"], [1, "comp-head-top"], [1, "comp-crumb"], ["name", "chevron-right", 3, "size"], [1, "comp-title"], [1, "comp-selector"], [3, "class"], [1, "comp-desc"], [1, "comp-tags"], [1, "comp-head-stats"], ["label", "Variants", 3, "value"], ["label", "Coverage", 3, "value", "pill", "pillVariant"], ["label", "Bundle", 3, "value"], ["label", "Score", "pill", "A11y", 3, "value", "pillVariant"], ["name", "check", 3, "size"], ["aria-hidden", "true", 1, "comp-status-ring"], ["aria-hidden", "true", 1, "comp-status-dot"], [1, "comp-status-label"], [1, "comp-tag"]], template: function PrismComponentHeadComponent_Template(rf, ctx) { if (rf & 1) {
211
- i0.ɵɵconditionalCreate(0, PrismComponentHeadComponent_Conditional_0_Template, 21, 12, "section", 0);
238
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismComponentHeadComponent, selectors: [["prism-component-head"]], decls: 1, vars: 1, consts: [[1, "comp-head"], [1, "comp-head-top"], [1, "comp-crumb"], ["name", "chevron-right", 3, "size"], [1, "comp-title"], [1, "comp-selector"], [3, "class"], [1, "comp-desc"], [1, "comp-tags"], [1, "comp-head-stats"], ["label", "Variants", 3, "value"], ["label", "Coverage", 3, "value", "pill", "pillVariant"], ["label", "Bundle", 3, "value"], ["label", "Score", "pill", "A11y", 3, "value", "pillVariant"], ["label", "VRT Diff", "pill", "VRT", 3, "value", "pillVariant"], ["name", "check", 3, "size"], ["aria-hidden", "true", 1, "comp-status-ring"], ["aria-hidden", "true", 1, "comp-status-dot"], [1, "comp-status-label"], [1, "comp-tag"]], template: function PrismComponentHeadComponent_Template(rf, ctx) { if (rf & 1) {
239
+ i0.ɵɵconditionalCreate(0, PrismComponentHeadComponent_Conditional_0_Template, 22, 13, "section", 0);
212
240
  } if (rf & 2) {
213
241
  let tmp_0_0;
214
242
  i0.ɵɵconditional((tmp_0_0 = ctx.comp()) ? 0 : -1, tmp_0_0);
@@ -276,6 +304,13 @@ export class PrismComponentHeadComponent {
276
304
  pill="A11y"
277
305
  [pillVariant]="a11yScore()! >= 90 ? 'ok' : 'warn'"
278
306
  />
307
+ } @if (vrtStat(); as vrt) {
308
+ <prism-stat
309
+ [value]="vrt.value"
310
+ label="VRT Diff"
311
+ pill="VRT"
312
+ [pillVariant]="vrt.variant"
313
+ />
279
314
  }
280
315
  </div>
281
316
  </div>
@@ -283,4 +318,4 @@ export class PrismComponentHeadComponent {
283
318
  }
284
319
  `, styles: ["\n :host { display: block; flex-shrink: 0; }\n\n .comp-head {\n padding: 12px 28px;\n background: var(--prism-bg);\n border-bottom: 1px solid var(--prism-border);\n position: relative;\n }\n .comp-head::before {\n content: '';\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 6px;\n background: linear-gradient(180deg, var(--prism-primary-from) 0%, var(--prism-accent) 50%, var(--prism-primary-to) 100%);\n }\n\n .comp-head-top {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n }\n\n .comp-crumb {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: var(--fs-sm);\n color: var(--prism-text-ghost);\n margin-bottom: 6px;\n font-weight: 500;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n }\n .comp-crumb prism-icon { opacity: 0.6; }\n\n .comp-title {\n margin: 0;\n font-size: var(--fs-2xl);\n font-weight: 700;\n letter-spacing: -0.02em;\n color: var(--prism-text);\n display: flex;\n align-items: center;\n gap: 10px;\n }\n\n .comp-selector {\n font-family: var(--font-mono);\n font-size: 12px;\n color: var(--prism-primary);\n padding: 3px 8px;\n border-radius: var(--radius-sm);\n background: color-mix(in srgb, var(--prism-primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 20%, transparent);\n font-weight: 500;\n }\n\n .comp-status {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n height: 24px;\n padding: 0 10px 0 8px;\n border-radius: 5px;\n font-size: 11.5px;\n font-weight: 600;\n letter-spacing: 0.02em;\n border: 1px solid;\n background: transparent;\n }\n .comp-status-label { line-height: 1; }\n .comp-status-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background: currentColor;\n }\n .comp-status-ring {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n border: 1.5px solid currentColor;\n background: transparent;\n box-sizing: border-box;\n }\n .comp-status prism-icon { display: inline-flex; }\n\n .comp-status--stable {\n color: var(--prism-success);\n background: color-mix(in srgb, var(--prism-success) 10%, transparent);\n border-color: color-mix(in srgb, var(--prism-success) 35%, transparent);\n }\n .comp-status--beta {\n color: #60a5fa;\n background: color-mix(in srgb, #60a5fa 10%, transparent);\n border-color: color-mix(in srgb, #60a5fa 35%, transparent);\n }\n .comp-status--wip {\n color: var(--prism-warn);\n background: color-mix(in srgb, var(--prism-warn) 10%, transparent);\n border-color: color-mix(in srgb, var(--prism-warn) 35%, transparent);\n }\n .comp-status--deprecated {\n color: var(--prism-text-muted);\n background: var(--prism-input-bg);\n border-color: var(--prism-border-strong);\n }\n\n .comp-desc {\n margin: 6px 0 0;\n font-size: var(--fs-lg);\n color: var(--prism-text-2);\n max-width: 72ch;\n line-height: 1.55;\n }\n\n .comp-tags {\n margin-top: 10px;\n display: flex;\n gap: 6px;\n flex-wrap: wrap;\n }\n .comp-tag {\n padding: 2px 8px;\n font-size: 11px;\n font-weight: 500;\n border-radius: var(--radius-xs);\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n color: var(--prism-primary);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n\n .comp-head-stats {\n display: flex;\n gap: 18px;\n flex-shrink: 0;\n }\n "] }]
285
320
  }], null, null); })();
286
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismComponentHeadComponent, { className: "PrismComponentHeadComponent", filePath: "app/component-head/prism-component-head.component.ts", lineNumber: 251 }); })();
321
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismComponentHeadComponent, { className: "PrismComponentHeadComponent", filePath: "app/component-head/prism-component-head.component.ts", lineNumber: 258 }); })();
@@ -3,7 +3,7 @@ export declare class PrismStatComponent {
3
3
  readonly value: import("@angular/core").InputSignal<string | number>;
4
4
  readonly label: import("@angular/core").InputSignal<string>;
5
5
  readonly pill: import("@angular/core").InputSignal<string | undefined>;
6
- readonly pillVariant: import("@angular/core").InputSignal<"ok" | "warn">;
6
+ readonly pillVariant: import("@angular/core").InputSignal<"ok" | "warn" | "danger">;
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<PrismStatComponent, never>;
8
8
  static ɵcmp: i0.ɵɵComponentDeclaration<PrismStatComponent, "prism-stat", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "pill": { "alias": "pill"; "required": false; "isSignal": true; }; "pillVariant": { "alias": "pillVariant"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prism-stat.component.d.ts","sourceRoot":"","sources":["../../../src/app/component-head/prism-stat.component.ts"],"names":[],"mappings":";AAEA,qBAwDa,kBAAkB;IAC7B,QAAQ,CAAC,KAAK,uDAAqC;IACnD,QAAQ,CAAC,KAAK,8CAA4B;IAC1C,QAAQ,CAAC,IAAI,0DAAmB;IAChC,QAAQ,CAAC,WAAW,qDAA8B;yCAJvC,kBAAkB;2CAAlB,kBAAkB;CAK9B"}
1
+ {"version":3,"file":"prism-stat.component.d.ts","sourceRoot":"","sources":["../../../src/app/component-head/prism-stat.component.ts"],"names":[],"mappings":";AAEA,qBA+Da,kBAAkB;IAC7B,QAAQ,CAAC,KAAK,uDAAqC;IACnD,QAAQ,CAAC,KAAK,8CAA4B;IAC1C,QAAQ,CAAC,IAAI,0DAAmB;IAChC,QAAQ,CAAC,WAAW,gEAAyC;yCAJlD,kBAAkB;2CAAlB,kBAAkB;CAK9B"}
@@ -6,7 +6,7 @@ function PrismStatComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
6
6
  i0.ɵɵdomElementEnd();
7
7
  } if (rf & 2) {
8
8
  const ctx_r0 = i0.ɵɵnextContext();
9
- i0.ɵɵclassProp("warn", ctx_r0.pillVariant() === "warn");
9
+ i0.ɵɵclassProp("warn", ctx_r0.pillVariant() === "warn")("danger", ctx_r0.pillVariant() === "danger");
10
10
  i0.ɵɵadvance();
11
11
  i0.ɵɵtextInterpolate(ctx_r0.pill());
12
12
  } }
@@ -20,10 +20,10 @@ export class PrismStatComponent {
20
20
  pillVariant = input('ok', /* @ts-ignore */
21
21
  ...(ngDevMode ? [{ debugName: "pillVariant" }] : /* istanbul ignore next */ []));
22
22
  static ɵfac = function PrismStatComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismStatComponent)(); };
23
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismStatComponent, selectors: [["prism-stat"]], inputs: { value: [1, "value"], label: [1, "label"], pill: [1, "pill"], pillVariant: [1, "pillVariant"] }, decls: 6, vars: 3, consts: [[1, "stat"], [1, "stat-val"], [1, "pill", 3, "warn"], [1, "stat-lbl"], [1, "pill"]], template: function PrismStatComponent_Template(rf, ctx) { if (rf & 1) {
23
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismStatComponent, selectors: [["prism-stat"]], inputs: { value: [1, "value"], label: [1, "label"], pill: [1, "pill"], pillVariant: [1, "pillVariant"] }, decls: 6, vars: 3, consts: [[1, "stat"], [1, "stat-val"], [1, "pill", 3, "warn", "danger"], [1, "stat-lbl"], [1, "pill"]], template: function PrismStatComponent_Template(rf, ctx) { if (rf & 1) {
24
24
  i0.ɵɵdomElementStart(0, "div", 0)(1, "div", 1);
25
25
  i0.ɵɵtext(2);
26
- i0.ɵɵconditionalCreate(3, PrismStatComponent_Conditional_3_Template, 2, 3, "span", 2);
26
+ i0.ɵɵconditionalCreate(3, PrismStatComponent_Conditional_3_Template, 2, 5, "span", 2);
27
27
  i0.ɵɵdomElementEnd();
28
28
  i0.ɵɵdomElementStart(4, "div", 3);
29
29
  i0.ɵɵtext(5);
@@ -35,7 +35,7 @@ export class PrismStatComponent {
35
35
  i0.ɵɵconditional(ctx.pill() ? 3 : -1);
36
36
  i0.ɵɵadvance(2);
37
37
  i0.ɵɵtextInterpolate(ctx.label());
38
- } }, styles: [".stat[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n min-width: 64px;\n }\n .stat-val[_ngcontent-%COMP%] {\n font-family: var(--font-mono);\n font-size: var(--fs-xl);\n font-weight: 600;\n color: var(--prism-text);\n display: flex;\n align-items: center;\n gap: 5px;\n }\n .pill[_ngcontent-%COMP%] {\n padding: 0 5px;\n font-size: 9.5px;\n border-radius: 3px;\n background: color-mix(in srgb, var(--prism-success) 15%, transparent);\n color: var(--prism-success);\n font-weight: 700;\n letter-spacing: 0.04em;\n }\n .pill.warn[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--prism-warn) 15%, transparent);\n color: var(--prism-warn);\n }\n .stat-lbl[_ngcontent-%COMP%] {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n }"] });
38
+ } }, styles: [".stat[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n min-width: 64px;\n }\n .stat-val[_ngcontent-%COMP%] {\n font-family: var(--font-mono);\n font-size: var(--fs-xl);\n font-weight: 600;\n color: var(--prism-text);\n display: flex;\n align-items: center;\n gap: 5px;\n }\n .pill[_ngcontent-%COMP%] {\n padding: 0 5px;\n font-size: 9.5px;\n border-radius: 3px;\n background: color-mix(in srgb, var(--prism-success) 15%, transparent);\n color: var(--prism-success);\n font-weight: 700;\n letter-spacing: 0.04em;\n }\n .pill.warn[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--prism-warn) 15%, transparent);\n color: var(--prism-warn);\n }\n .pill.danger[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--prism-danger) 15%, transparent);\n color: var(--prism-danger);\n }\n .stat-lbl[_ngcontent-%COMP%] {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n }"] });
39
39
  }
40
40
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismStatComponent, [{
41
41
  type: Component,
@@ -44,13 +44,16 @@ export class PrismStatComponent {
44
44
  <div class="stat-val">
45
45
  {{ value() }}
46
46
  @if (pill()) {
47
- <span class="pill" [class.warn]="pillVariant() === 'warn'">{{
48
- pill()
49
- }}</span>
47
+ <span
48
+ class="pill"
49
+ [class.warn]="pillVariant() === 'warn'"
50
+ [class.danger]="pillVariant() === 'danger'"
51
+ >{{ pill() }}</span
52
+ >
50
53
  }
51
54
  </div>
52
55
  <div class="stat-lbl">{{ label() }}</div>
53
56
  </div>
54
- `, styles: ["\n .stat {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n min-width: 64px;\n }\n .stat-val {\n font-family: var(--font-mono);\n font-size: var(--fs-xl);\n font-weight: 600;\n color: var(--prism-text);\n display: flex;\n align-items: center;\n gap: 5px;\n }\n .pill {\n padding: 0 5px;\n font-size: 9.5px;\n border-radius: 3px;\n background: color-mix(in srgb, var(--prism-success) 15%, transparent);\n color: var(--prism-success);\n font-weight: 700;\n letter-spacing: 0.04em;\n }\n .pill.warn {\n background: color-mix(in srgb, var(--prism-warn) 15%, transparent);\n color: var(--prism-warn);\n }\n .stat-lbl {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n }\n "] }]
57
+ `, styles: ["\n .stat {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 2px;\n min-width: 64px;\n }\n .stat-val {\n font-family: var(--font-mono);\n font-size: var(--fs-xl);\n font-weight: 600;\n color: var(--prism-text);\n display: flex;\n align-items: center;\n gap: 5px;\n }\n .pill {\n padding: 0 5px;\n font-size: 9.5px;\n border-radius: 3px;\n background: color-mix(in srgb, var(--prism-success) 15%, transparent);\n color: var(--prism-success);\n font-weight: 700;\n letter-spacing: 0.04em;\n }\n .pill.warn {\n background: color-mix(in srgb, var(--prism-warn) 15%, transparent);\n color: var(--prism-warn);\n }\n .pill.danger {\n background: color-mix(in srgb, var(--prism-danger) 15%, transparent);\n color: var(--prism-danger);\n }\n .stat-lbl {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n }\n "] }]
55
58
  }], null, { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], pill: [{ type: i0.Input, args: [{ isSignal: true, alias: "pill", required: false }] }], pillVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "pillVariant", required: false }] }] }); })();
56
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismStatComponent, { className: "PrismStatComponent", filePath: "app/component-head/prism-stat.component.ts", lineNumber: 59 }); })();
59
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismStatComponent, { className: "PrismStatComponent", filePath: "app/component-head/prism-stat.component.ts", lineNumber: 66 }); })();
@@ -0,0 +1,29 @@
1
+ import type { PanelBadge, PanelDefinition, RuntimeComponent } from '../../../plugin/plugin.types.js';
2
+ /**
3
+ * The live figures the built-in tabs badge themselves with.
4
+ *
5
+ * Passed in rather than injected so this stays a pure function. The panel host
6
+ * reads them from its own services and hands them over; that is the whole
7
+ * reason the built-in chain could not simply be expressed as
8
+ * {@link PanelDefinition.badge} callbacks — `a11y` reports a running audit, not
9
+ * anything the component's meta holds.
10
+ */
11
+ export interface PanelBadgeContext {
12
+ inputCount: number;
13
+ a11yScore: number | null;
14
+ coverageScore: number | null;
15
+ }
16
+ /**
17
+ * The badge a panel's tab carries, if any.
18
+ *
19
+ * A panel that declares its own {@link PanelDefinition.badge} wins outright,
20
+ * which is what lets a plugin put a number on its own tab without the panel
21
+ * host learning about it. The chain below it predates that hook and stays for
22
+ * the tabs it already covers.
23
+ *
24
+ * Returning `null` is the common case and the important one: a badge that is
25
+ * always present stops being a signal, so every branch here has a way to say
26
+ * "nothing worth reporting" rather than falling back to a zero.
27
+ */
28
+ export declare function resolvePanelBadge(panel: PanelDefinition, component: RuntimeComponent | null, context: PanelBadgeContext): PanelBadge | null;
29
+ //# sourceMappingURL=panel-badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel-badge.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/panel-host/panel-badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAUD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,gBAAgB,GAAG,IAAI,EAClC,OAAO,EAAE,iBAAiB,GACzB,UAAU,GAAG,IAAI,CA0BnB"}
@@ -0,0 +1,42 @@
1
+ /** Green at 90, amber down to 70, red below — shared by a11y and coverage. */
2
+ function gradeScore(score) {
3
+ return {
4
+ text: String(score),
5
+ variant: score >= 90 ? 'ok' : score >= 70 ? 'warn' : 'danger',
6
+ };
7
+ }
8
+ /**
9
+ * The badge a panel's tab carries, if any.
10
+ *
11
+ * A panel that declares its own {@link PanelDefinition.badge} wins outright,
12
+ * which is what lets a plugin put a number on its own tab without the panel
13
+ * host learning about it. The chain below it predates that hook and stays for
14
+ * the tabs it already covers.
15
+ *
16
+ * Returning `null` is the common case and the important one: a badge that is
17
+ * always present stops being a signal, so every branch here has a way to say
18
+ * "nothing worth reporting" rather than falling back to a zero.
19
+ */
20
+ export function resolvePanelBadge(panel, component, context) {
21
+ if (panel.badge) {
22
+ // No component means no subject to report on; calling the hook with a
23
+ // placeholder would invite it to invent a number.
24
+ return component ? panel.badge(component) : null;
25
+ }
26
+ if (panel.id === 'controls') {
27
+ return context.inputCount > 0
28
+ ? { text: String(context.inputCount), variant: 'default' }
29
+ : null;
30
+ }
31
+ if (panel.id === 'a11y') {
32
+ // `=== null` rather than a falsy check: a score of 0 is a real, and the
33
+ // most urgent, thing to show.
34
+ return context.a11yScore === null ? null : gradeScore(context.a11yScore);
35
+ }
36
+ if (panel.id === 'coverage') {
37
+ return context.coverageScore === null
38
+ ? null
39
+ : gradeScore(context.coverageScore);
40
+ }
41
+ return null;
42
+ }
@@ -18,10 +18,7 @@ export declare class PrismPanelHostComponent {
18
18
  private readonly a11yScore;
19
19
  private readonly coverageScore;
20
20
  private readonly inputCount;
21
- protected panelBadge(panelId: string): {
22
- text: string;
23
- variant: 'default' | 'ok' | 'warn' | 'danger';
24
- } | null;
21
+ protected panelBadge(panel: PanelDefinition): import("../../../plugin/plugin.types.js").PanelBadge | null;
25
22
  private readonly builtInPanels;
26
23
  protected readonly allPanels: import("@angular/core").Signal<PanelDefinition[]>;
27
24
  protected readonly panelInputs: import("@angular/core").Signal<{
@@ -1 +1 @@
1
- {"version":3,"file":"prism-panel-host.component.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/panel-host/prism-panel-host.component.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,mBAAmB,EAGnB,KAAK,IAAI,EAGV,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAI1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;;AAEvE,KAAK,kBAAkB,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,qBAuLa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkC;IACtD,SAAS,CAAC,QAAQ,CAAC,YAAY,oBAA6B;IAC5D,SAAS,CAAC,QAAQ,CAAC,WAAW,sBAA+B;IAC7D,OAAO,CAAC,QAAQ,CAA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CACpB,CAAC;AAEF,qBAuLa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkC;IACtD,SAAS,CAAC,QAAQ,CAAC,YAAY,oBAA6B;IAC5D,SAAS,CAAC,QAAQ,CAAC,WAAW,sBAA+B;IAC7D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAEhE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAExB;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAK3B;IAEH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGxB;IAEH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,eAAe;IAQ3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAEhD,SAAS,CAAC,QAAQ,CAAC,SAAS,oDAQzB;IAEH,SAAS,CAAC,QAAQ,CAAC,WAAW;;OAE1B;IAEJ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAE9D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;IACF,SAAS,CAAC,QAAQ,CAAC,mBAAmB,uDAEpC;;IAsCF,OAAO,CAAC,iBAAiB;IAuBzB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,mBAAmB;yCAlIhB,uBAAuB;2CAAvB,uBAAuB;CAsJnC"}
@@ -7,6 +7,7 @@ import { PrismNavigationService } from '../../services/prism-navigation.service.
7
7
  import { PrismPanelService } from '../../services/prism-panel.service.js';
8
8
  import { PrismPluginService } from '../../services/prism-plugin.service.js';
9
9
  import { PrismRendererService } from '../../services/prism-renderer.service.js';
10
+ import { resolvePanelBadge } from './panel-badge.js';
10
11
  import * as i0 from "@angular/core";
11
12
  const _forTrack0 = ($index, $item) => $item.id;
12
13
  function PrismPanelHostComponent_For_3_Conditional_1_Template(rf, ctx) { if (rf & 1) {
@@ -44,7 +45,7 @@ function PrismPanelHostComponent_For_3_Template(rf, ctx) { if (rf & 1) {
44
45
  i0.ɵɵadvance();
45
46
  i0.ɵɵtextInterpolate1(" ", panel_r2.label, " ");
46
47
  i0.ɵɵadvance();
47
- i0.ɵɵconditional((tmp_15_0 = ctx_r2.panelBadge(panel_r2.id)) ? 3 : -1, tmp_15_0);
48
+ i0.ɵɵconditional((tmp_15_0 = ctx_r2.panelBadge(panel_r2)) ? 3 : -1, tmp_15_0);
48
49
  } }
49
50
  function PrismPanelHostComponent_For_6_ng_container_1_Template(rf, ctx) { if (rf & 1) {
50
51
  i0.ɵɵelementContainer(0);
@@ -82,30 +83,12 @@ export class PrismPanelHostComponent {
82
83
  return comp?.meta.inputs.length ?? 0;
83
84
  }, /* @ts-ignore */
84
85
  ...(ngDevMode ? [{ debugName: "inputCount" }] : /* istanbul ignore next */ []));
85
- panelBadge(panelId) {
86
- if (panelId === 'controls') {
87
- const count = this.inputCount();
88
- return count > 0 ? { text: String(count), variant: 'default' } : null;
89
- }
90
- if (panelId === 'a11y') {
91
- const score = this.a11yScore();
92
- if (score === null)
93
- return null;
94
- return {
95
- text: String(score),
96
- variant: score >= 90 ? 'ok' : score >= 70 ? 'warn' : 'danger',
97
- };
98
- }
99
- if (panelId === 'coverage') {
100
- const score = this.coverageScore();
101
- if (score === null)
102
- return null;
103
- return {
104
- text: String(score),
105
- variant: score >= 90 ? 'ok' : score >= 70 ? 'warn' : 'danger',
106
- };
107
- }
108
- return null;
86
+ panelBadge(panel) {
87
+ return resolvePanelBadge(panel, this.nav.activeComponent(), {
88
+ inputCount: this.inputCount(),
89
+ a11yScore: this.a11yScore(),
90
+ coverageScore: this.coverageScore(),
91
+ });
109
92
  }
110
93
  builtInPanels = BUILTIN_PANELS;
111
94
  allPanels = computed(() => {
@@ -245,7 +228,7 @@ export class PrismPanelHostComponent {
245
228
  <prism-icon [name]="panel.icon" [size]="13" />
246
229
  }
247
230
  {{ panel.label }}
248
- @if (panelBadge(panel.id); as badge) {
231
+ @if (panelBadge(panel); as badge) {
249
232
  <span
250
233
  class="p-tab-badge"
251
234
  [class.ok]="badge.variant === 'ok'"
@@ -280,4 +263,4 @@ export class PrismPanelHostComponent {
280
263
  </div>
281
264
  `, styles: ["\n .panel {\n background: var(--prism-bg-elevated);\n border-top: 1px solid var(--prism-border);\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n height: 100%;\n }\n\n .panel-tabs {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 0 16px;\n height: 40px;\n border-bottom: 1px solid var(--prism-border);\n background: var(--prism-bg);\n overflow-x: auto;\n scrollbar-width: none;\n flex-shrink: 0;\n }\n .panel-tabs::-webkit-scrollbar { display: none; }\n\n .p-tab {\n position: relative;\n height: 100%;\n display: flex;\n align-items: center;\n gap: 7px;\n padding: 0 12px;\n font-size: var(--fs-md);\n font-weight: 500;\n color: var(--prism-text-muted);\n white-space: nowrap;\n transition: color var(--dur-fast);\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .p-tab:hover { color: var(--prism-text-2); }\n .p-tab--active { color: var(--prism-text); }\n .p-tab--active::after {\n content: '';\n position: absolute;\n left: 8px;\n right: 8px;\n bottom: -1px;\n height: 2px;\n background: linear-gradient(90deg, var(--prism-primary-from), var(--prism-primary-to));\n border-radius: 1px;\n }\n\n .p-tab-badge {\n min-width: 16px;\n height: 16px;\n padding: 0 5px;\n border-radius: 8px;\n background: color-mix(in srgb, var(--prism-primary) 18%, transparent);\n color: var(--prism-primary);\n font-family: var(--font-mono);\n font-size: 10px;\n font-weight: 700;\n display: grid;\n place-items: center;\n }\n .p-tab-badge.ok {\n background: color-mix(in srgb, var(--prism-success) 18%, transparent);\n color: var(--prism-success);\n }\n .p-tab-badge.warn {\n background: color-mix(in srgb, var(--prism-warn) 18%, transparent);\n color: var(--prism-warn);\n }\n .p-tab-badge.danger {\n background: color-mix(in srgb, var(--prism-danger) 18%, transparent);\n color: var(--prism-danger);\n }\n\n .panel-tabs-right {\n margin-left: auto;\n display: flex;\n align-items: center;\n gap: 4px;\n padding-left: 10px;\n }\n\n .icon-btn {\n width: 28px;\n height: 28px;\n display: grid;\n place-items: center;\n border-radius: var(--radius-sm);\n color: var(--prism-text-muted);\n background: none;\n border: none;\n cursor: pointer;\n transition: all var(--dur-fast);\n }\n .icon-btn:hover {\n background: var(--prism-input-bg);\n color: var(--prism-text);\n }\n\n .panel-body {\n flex: 1;\n min-height: 0;\n overflow: auto;\n background: var(--prism-bg-elevated);\n }\n .panel-body::-webkit-scrollbar { width: 8px; height: 8px; }\n .panel-body::-webkit-scrollbar-thumb { background: var(--prism-border-strong); border-radius: 4px; }\n\n .panel-pane { height: 100%; }\n .panel-pane[hidden] { display: none; }\n\n :focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 2px;\n }\n "] }]
282
265
  }], () => [], null); })();
283
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismPanelHostComponent, { className: "PrismPanelHostComponent", filePath: "app/panels/panel-host/prism-panel-host.component.ts", lineNumber: 213 }); })();
266
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismPanelHostComponent, { className: "PrismPanelHostComponent", filePath: "app/panels/panel-host/prism-panel-host.component.ts", lineNumber: 214 }); })();
@@ -33,8 +33,16 @@ export declare const CAPTURE_TRANSPARENT_SELECTOR: string;
33
33
  * mode strips the canvas background down to its patternless colour — keeping
34
34
  * whatever `@Showcase({ bg })` declared, or clearing the whole paint chain to
35
35
  * real transparency for `bg: 'transparent'` — suppresses every piece of
36
- * canvas chrome, locks zoom to 1 and freezes animation, so a variant renders
37
- * identically on every run.
36
+ * canvas chrome, removes every other shell region from layout so the canvas
37
+ * owns the viewport, locks zoom to 1 and freezes animation, so a variant
38
+ * renders identically on every run.
39
+ *
40
+ * What that buys a runner is the right to screenshot `.demo-wrap` directly:
41
+ * the target is composited against the declared background over its whole box,
42
+ * not merely over the part that fits inside the canvas viewport. The one thing
43
+ * the mode cannot do is make room that the viewport does not have — a
44
+ * component larger than the viewport still overflows, and sizing the viewport
45
+ * to fit is the runner's job.
38
46
  *
39
47
  * The flag is read once from the URL at construction time and never written
40
48
  * back — {@link PrismUrlStateService} rebuilds the query string from scratch,
@@ -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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,4BAA4B,QAEgG,CAAC;AA8C1I;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IAEF,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAdZ,mBAAmB;6CAAnB,mBAAmB;CAuB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIzD"}
1
+ {"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,4BAA4B,QAEgG,CAAC;AA+H1I;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IAEF,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAdZ,mBAAmB;6CAAnB,mBAAmB;CAuB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIzD"}
@@ -28,6 +28,51 @@ const STYLE_ELEMENT_ID = 'ng-prism-capture-styles';
28
28
  */
29
29
  export const CAPTURE_TRANSPARENT_SELECTOR = `[${CAPTURE_ATTRIBUTE}] .prism-canvas-stage[data-bg='transparent'],\n` +
30
30
  `[${CAPTURE_ATTRIBUTE}] :is(html, body, .prism-shell, .prism-main, .prism-canvas-wrap):has(.prism-canvas-stage[data-bg='transparent'])`;
31
+ /**
32
+ * Everything capture mode removes from layout so the canvas owns the viewport.
33
+ *
34
+ * The canvas is not an overlay host: `.prism-canvas-wrap` is one flex sibling
35
+ * among several inside `.prism-main`, which is itself one grid cell of
36
+ * `.prism-body` inside `.prism-shell`. A screenshot tool captures the *screen
37
+ * coordinates* of `.demo-wrap`, and `.demo-wrap` is centred in a stage that
38
+ * scrolls — so whenever the component is larger than the canvas viewport, its
39
+ * box extends past the canvas and the compositor fills those coordinates with
40
+ * whichever sibling lives there. Measured in Chromium against the real
41
+ * stylesheets, a 200x400 component at a 1280x720 viewport leaks 57px upwards
42
+ * into the variant ribbon and 121px downwards into the panel. That is neither
43
+ * a z-order nor a clipping bug: the capture target legitimately extends beyond
44
+ * its scroll container and the page paints something there.
45
+ *
46
+ * `display: none` rather than `visibility: hidden`, and this is the one thing
47
+ * not to "simplify" later. Keeping the layout box is the tempting minimal-churn
48
+ * fix — nothing re-centres, no unaffected baseline moves — and it does not
49
+ * work: the box still occupies its space, so what paints at those coordinates
50
+ * becomes `.prism-main`'s own background instead of the panel. Measured at the
51
+ * bottom row of a `bg: 'transparent'` capture: `#11284e` with the panel left
52
+ * alone, `#11284e` with `visibility: hidden`, transparent only once the panel
53
+ * leaves layout. The canvas is `flex: 1`; it has to reclaim the space for the
54
+ * stage to paint there, and only removal from layout gives it back.
55
+ *
56
+ * Written as a structural rule rather than a list of chrome selectors, because
57
+ * enumeration is what makes this class of bug recur: the list has to be revised
58
+ * every time the shell grows a region, nothing fails when it is not, and the
59
+ * baselines recorded in the meantime look perfectly fine while guarding the
60
+ * wrong image. At every level from the shell to the canvas wrap, the one child
61
+ * that leads to the stage survives and every sibling is removed, so a region
62
+ * added tomorrow is suppressed without anyone remembering this file exists.
63
+ *
64
+ * The track collapses are not cosmetic. `.prism-shell` and `.prism-body` are
65
+ * grids with sized tracks (`52px 1fr`, `var(--sw) 4px 1fr`); hiding the header
66
+ * and the sidebar without collapsing them would auto-place the survivor into
67
+ * the *first* track and render the canvas 52px tall or 264px wide.
68
+ *
69
+ * Scoped by `:has(.prism-canvas-stage)` throughout: a component page or a view
70
+ * panel has no canvas, and blanking the shell around it would leave a runner
71
+ * with an empty screenshot rather than an honest one.
72
+ */
73
+ const CAPTURE_CANVAS_ONLY_SELECTOR = `[${CAPTURE_ATTRIBUTE}] ` +
74
+ `:is(.prism-shell, .prism-body, .prism-main, .prism-canvas-wrap)` +
75
+ `:has(.prism-canvas-stage) > :not(:has(.prism-canvas-stage))`;
31
76
  /**
32
77
  * Global stylesheet applied in capture mode.
33
78
  *
@@ -51,6 +96,23 @@ export const CAPTURE_TRANSPARENT_SELECTOR = `[${CAPTURE_ATTRIBUTE}] .prism-canva
51
96
  * layers involved. Alpha is not what the paragraph above rules out: a pattern
52
97
  * has a phase that moves when the component resizes, an alpha channel is a
53
98
  * per-pixel value that does not.
99
+ *
100
+ * Colour is only half of it. The rules from
101
+ * {@link CAPTURE_CANVAS_ONLY_SELECTOR} down hand the whole viewport to the
102
+ * canvas, which is what makes the declared background reach the *whole* of the
103
+ * capture target's box rather than only the part that happens to fit inside
104
+ * the canvas viewport.
105
+ *
106
+ * The stage's padding goes with them, and it buys more than the 32px it looks
107
+ * like. The stage is `height: 100%` under `content-box`, so its padding lands
108
+ * *outside* that height: the stage is 64px taller than the row it sits in,
109
+ * overflows it, and centres the component 32px below the true centre of what
110
+ * is actually painted. Dropping the padding makes the stage exactly the canvas
111
+ * and the component's centre the viewport's centre, which turns the guarantee
112
+ * crisp — a component is contained iff it fits the viewport. Measured: a
113
+ * 200x700 component at 1280x720 still leaks 22px past the canvas with the
114
+ * regions gone but the padding kept. None of that padding is ever inside a
115
+ * `.demo-wrap` screenshot, so nothing is lost by removing it.
54
116
  */
55
117
  const CAPTURE_STYLES = `
56
118
  [${CAPTURE_ATTRIBUTE}] *,
@@ -64,12 +126,29 @@ const CAPTURE_STYLES = `
64
126
 
65
127
  [${CAPTURE_ATTRIBUTE}] .prism-canvas-stage {
66
128
  background-image: none !important;
129
+ padding: 0 !important;
67
130
  }
68
131
 
69
132
  ${CAPTURE_TRANSPARENT_SELECTOR} {
70
133
  background-color: transparent !important;
71
134
  background-image: none !important;
72
135
  }
136
+
137
+ ${CAPTURE_CANVAS_ONLY_SELECTOR} {
138
+ display: none !important;
139
+ }
140
+
141
+ [${CAPTURE_ATTRIBUTE}] .prism-shell:has(.prism-canvas-stage) {
142
+ grid-template-rows: minmax(0, 1fr) !important;
143
+ }
144
+
145
+ [${CAPTURE_ATTRIBUTE}] .prism-body:has(.prism-canvas-stage) {
146
+ grid-template-columns: minmax(0, 1fr) !important;
147
+ }
148
+
149
+ [${CAPTURE_ATTRIBUTE}] .prism-canvas-wrap:has(.prism-canvas-stage) {
150
+ grid-template-rows: minmax(0, 1fr) !important;
151
+ }
73
152
  `;
74
153
  /**
75
154
  * Capture-isolation mode.
@@ -79,8 +158,16 @@ ${CAPTURE_TRANSPARENT_SELECTOR} {
79
158
  * mode strips the canvas background down to its patternless colour — keeping
80
159
  * whatever `@Showcase({ bg })` declared, or clearing the whole paint chain to
81
160
  * real transparency for `bg: 'transparent'` — suppresses every piece of
82
- * canvas chrome, locks zoom to 1 and freezes animation, so a variant renders
83
- * identically on every run.
161
+ * canvas chrome, removes every other shell region from layout so the canvas
162
+ * owns the viewport, locks zoom to 1 and freezes animation, so a variant
163
+ * renders identically on every run.
164
+ *
165
+ * What that buys a runner is the right to screenshot `.demo-wrap` directly:
166
+ * the target is composited against the declared background over its whole box,
167
+ * not merely over the part that fits inside the canvas viewport. The one thing
168
+ * the mode cannot do is make room that the viewport does not have — a
169
+ * component larger than the viewport still overflows, and sizing the viewport
170
+ * to fit is the runner's job.
84
171
  *
85
172
  * The flag is read once from the URL at construction time and never written
86
173
  * back — {@link PrismUrlStateService} rebuilds the query string from scratch,
@@ -1 +1 @@
1
- {"version":3,"file":"component.scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/component.scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAwCrE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EACpB,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,gBAAgB,EAAE,CA8CpB"}
1
+ {"version":3,"file":"component.scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/component.scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAmErE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EACpB,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,gBAAgB,EAAE,CA8CpB"}
@@ -8,6 +8,29 @@ function isComponentStatus(value) {
8
8
  }
9
9
  import { evaluateExpression, findDecorator, getDecoratorArgument, } from './ast-utils.js';
10
10
  import { extractInputs, extractOutputs } from './input.extractor.js';
11
+ /**
12
+ * Backgrounds that still work but should not be reached for any more.
13
+ *
14
+ * `checker` draws the same checkerboard as `transparent` while browsing, so
15
+ * the canvas cannot tell them apart — but it captures as `--prism-bg-surface`,
16
+ * a *theme* token, which makes a baseline recorded on it depend on the theme
17
+ * the runner's browser started in. Since `transparent` took over as the
18
+ * default, it is the value that looks like transparency and is not.
19
+ *
20
+ * Warned rather than rejected: the value is valid, and dropping it would
21
+ * change what a component renders on — a break wearing a warning's clothes.
22
+ * Scheduled for removal in 23.0.0, the next Angular-aligned major.
23
+ */
24
+ const DEPRECATED_BGS = {
25
+ checker: "use 'transparent' for the same look with a capture that keeps its alpha, or 'light'/'dark' for an absolute colour",
26
+ };
27
+ function warnDeprecatedBg(bg, where) {
28
+ const advice = DEPRECATED_BGS[bg];
29
+ if (!advice)
30
+ return;
31
+ console.warn(`⚠ ng-prism: ${where} declares bg "${bg}", which is deprecated and will ` +
32
+ `be removed in 23.0.0 — ${advice}.`);
33
+ }
11
34
  function isCanvasBg(value) {
12
35
  return (typeof value === 'string' &&
13
36
  CANVAS_BGS.includes(value));
@@ -110,10 +133,10 @@ function extractShowcaseConfig(decorator, className) {
110
133
  if (obj['bg'] !== undefined) {
111
134
  if (isCanvasBg(obj['bg'])) {
112
135
  config.bg = obj['bg'];
136
+ warnDeprecatedBg(obj['bg'], className);
113
137
  }
114
138
  else {
115
- console.warn(`⚠ ng-prism: ${className} declares invalid bg "${String(obj['bg'])}" — ` +
116
- `expected one of: dots, plain, light, dark, checker. Skipping.`);
139
+ console.warn(`⚠ ng-prism: ${className} declares invalid bg "${String(obj['bg'])}" — ` + `expected one of: ${CANVAS_BGS.join(', ')}. Skipping.`);
117
140
  }
118
141
  }
119
142
  if (obj['canvasLayout'] !== undefined) {
@@ -127,9 +150,13 @@ function extractShowcaseConfig(decorator, className) {
127
150
  if (Array.isArray(obj['variants'])) {
128
151
  config.variants = obj['variants'].map((variant) => {
129
152
  const cleaned = { ...variant };
153
+ if (isCanvasBg(variant['bg'])) {
154
+ warnDeprecatedBg(variant['bg'], `${className} variant "${String(variant['name'])}"`);
155
+ }
130
156
  if (variant['bg'] !== undefined && !isCanvasBg(variant['bg'])) {
131
157
  console.warn(`⚠ ng-prism: ${className} variant "${String(variant['name'])}" declares ` +
132
- `invalid bg "${String(variant['bg'])}" — expected one of: dots, plain, light, dark, checker. Skipping.`);
158
+ `invalid bg "${String(variant['bg'])}" — expected one of: ` +
159
+ `${CANVAS_BGS.join(', ')}. Skipping.`);
133
160
  delete cleaned['bg'];
134
161
  }
135
162
  if (variant['canvasLayout'] !== undefined &&
@@ -1,4 +1,4 @@
1
- export type { NgPrismPlugin, PanelDefinition, ControlDefinition, HeaderWidgetDefinition, NgPrismConfig, PrismManifest, ScannedComponent, InputMeta, OutputMeta, RuntimeManifest, RuntimeComponent, DiscoveryManifest, DiscoveryComponent, DiscoveryVariant, DiscoveryPage, } from './plugin.types.js';
1
+ export type { NgPrismPlugin, PanelBadge, PanelDefinition, ControlDefinition, HeaderWidgetDefinition, NgPrismConfig, PrismManifest, ScannedComponent, InputMeta, OutputMeta, RuntimeManifest, RuntimeComponent, DiscoveryManifest, DiscoveryComponent, DiscoveryVariant, DiscoveryPage, } from './plugin.types.js';
2
2
  export type { StyleguidePage, CustomPage, ComponentPage, } from './page.types.js';
3
3
  export type { CanvasBg } from '../shared/canvas-bg.type.js';
4
4
  export { CANVAS_BGS } from '../shared/canvas-bg.type.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,UAAU,EACV,aAAa,GACd,MAAM,iBAAiB,CAAC;AAKzB,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM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kB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -29,6 +29,16 @@ export interface HeaderWidgetDefinition {
29
29
  /** Sort order within the same placement (lower = earlier). Default: 0. */
30
30
  order?: number;
31
31
  }
32
+ /** A short marker rendered on a panel's tab, usually a count. */
33
+ export interface PanelBadge {
34
+ /** Kept to a couple of characters — the tab bar scrolls horizontally. */
35
+ text: string;
36
+ /**
37
+ * Colour role. `default` is the neutral primary tint used for a plain count;
38
+ * the other three carry a judgement and should be reserved for one.
39
+ */
40
+ variant?: 'default' | 'ok' | 'warn' | 'danger';
41
+ }
32
42
  export interface PanelDefinition {
33
43
  id: string;
34
44
  label: string;
@@ -46,6 +56,15 @@ export interface PanelDefinition {
46
56
  providers?: Provider[];
47
57
  /** When provided, the panel tab is only shown if this returns true for the active component */
48
58
  isVisible?: (component: RuntimeComponent) => boolean;
59
+ /**
60
+ * When provided, the panel's tab carries this badge for the active
61
+ * component. Return `null` for "nothing worth saying" — a badge that is
62
+ * always present stops being a signal.
63
+ *
64
+ * Called during change detection, so it has to be cheap and pure: read what
65
+ * the component's `meta` already holds, do not fetch and do not inject.
66
+ */
67
+ badge?: (component: RuntimeComponent) => PanelBadge | null;
49
68
  /**
50
69
  * Keep the panel's component instance alive across tab switches.
51
70
  * When `true`, the panel is rendered once on first activation and merely hidden
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.types.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IAGb,kBAAkB,CAAC,EAAE,CACnB,SAAS,EAAE,gBAAgB,KACxB,gBAAgB,GAAG,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AAC;CACrE"}
@@ -1,11 +1,29 @@
1
- export type CanvasBg = 'dots' | 'plain' | 'light' | 'dark' | 'checker' | 'transparent';
2
1
  /**
3
- * Every value {@link CanvasBg} accepts.
2
+ * A surface the canvas can paint behind a component.
4
3
  *
5
- * This is the type's value list, not the list a user can cycle through — the
6
- * canvas toolbar keeps its own, deliberately shorter one. Persisted canvas
7
- * state is validated against *this* list, so a value that only a decorator can
8
- * declare still round-trips rather than being discarded as unknown.
4
+ * Three groups, and the distinction only matters once a variant is under
5
+ * visual regression. `light` and `dark` are absolute colours. `dots` and
6
+ * `plain` follow the active theme. `transparent` has no colour at all and is
7
+ * the only one whose capture carries an alpha channel.
8
+ */
9
+ export type CanvasBg = 'dots' | 'plain' | 'light' | 'dark'
10
+ /**
11
+ * @deprecated Deprecated since 22.2.0, removed in 23.0.0. It draws the same
12
+ * checkerboard as `transparent` while browsing, so the canvas cannot tell
13
+ * the two apart — but it captures as `--prism-bg-surface`, a *theme* token,
14
+ * which makes a baseline recorded on it depend on the theme the runner's
15
+ * browser started in. Use `transparent` for the same look with a capture
16
+ * that keeps its alpha, or `light`/`dark` for an absolute colour.
17
+ */
18
+ | 'checker' | 'transparent';
19
+ /**
20
+ * Every value {@link CanvasBg} accepts, deprecated ones included.
21
+ *
22
+ * Also the list the canvas toolbar renders. That group is a readout as much as
23
+ * a control — it marks the active and the recommended background — so a value
24
+ * missing from it is a value the UI cannot *show*, not merely one it declines
25
+ * to offer. Persisted canvas state is validated against this list too, so a
26
+ * value only a decorator can reach still round-trips.
9
27
  */
10
28
  export declare const CANVAS_BGS: readonly CanvasBg[];
11
29
  //# sourceMappingURL=canvas-bg.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"canvas-bg.type.d.ts","sourceRoot":"","sources":["../../src/shared/canvas-bg.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,SAAS,GACT,aAAa,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAOhC,CAAC"}
1
+ {"version":3,"file":"canvas-bg.type.d.ts","sourceRoot":"","sources":["../../src/shared/canvas-bg.type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM;AACR;;;;;;;GAOG;GACD,SAAS,GACT,aAAa,CAAC;AAElB;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAOhC,CAAC"}
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Every value {@link CanvasBg} accepts.
2
+ * Every value {@link CanvasBg} accepts, deprecated ones included.
3
3
  *
4
- * This is the type's value list, not the list a user can cycle through — the
5
- * canvas toolbar keeps its own, deliberately shorter one. Persisted canvas
6
- * state is validated against *this* list, so a value that only a decorator can
7
- * declare still round-trips rather than being discarded as unknown.
4
+ * Also the list the canvas toolbar renders. That group is a readout as much as
5
+ * a control — it marks the active and the recommended background — so a value
6
+ * missing from it is a value the UI cannot *show*, not merely one it declines
7
+ * to offer. Persisted canvas state is validated against this list too, so a
8
+ * value only a decorator can reach still round-trips.
8
9
  */
9
10
  export const CANVAS_BGS = [
10
11
  'dots',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-prism/core",
3
- "version": "22.2.0-beta.2",
3
+ "version": "22.2.0-beta.4",
4
4
  "description": "ng-prism — the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
5
5
  "keywords": [
6
6
  "ng-prism",