@ng-prism/core 21.3.0 → 21.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ Lightweight, Angular-native component showcase tool. Annotate components with `@
11
11
  - **Zero-config discovery** — TypeScript Compiler API scans your library at build time
12
12
  - **Signal-native** — works with `input()` / `output()` signals
13
13
  - **Directive support** — showcase directives with configurable host elements
14
- - **Plugin architecture** — JSDoc, A11y, Figma, Performance, Box Model plugins
14
+ - **Plugin architecture** — JSDoc, A11y, Figma, Performance, Box Model, Coverage plugins
15
15
  - **Live Controls** — auto-generated input controls with type-aware editors
16
16
  - **Code Snippets** — live-updating Angular template snippets per variant
17
17
  - **Component Pages** — free-form demo pages for complex components
@@ -150,6 +150,7 @@ export class TableComponent { ... }
150
150
  | Figma | `@ng-prism/plugin-figma` | Figma design embed + visual diff |
151
151
  | Box Model | `@ng-prism/plugin-box-model` | CSS box model inspector |
152
152
  | Perf | `@ng-prism/plugin-perf` | Render performance profiling |
153
+ | Coverage | `@ng-prism/plugin-coverage` | Per-component test coverage from Istanbul/v8 |
153
154
 
154
155
  > **Note:** Accessibility auditing (axe-core) is built into ng-prism core — no plugin needed.
155
156
 
@@ -1,9 +1,12 @@
1
+ import type { ControlDefinition, InputMeta } from '../../../plugin/plugin.types.js';
1
2
  import { PrismNavigationService } from '../../services/prism-navigation.service.js';
2
3
  import { PrismRendererService } from '../../services/prism-renderer.service.js';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class PrismControlsPanelComponent {
5
6
  protected readonly navigationService: PrismNavigationService;
6
7
  protected readonly rendererService: PrismRendererService;
8
+ private readonly pluginService;
9
+ protected getCustomControl(input: InputMeta): ControlDefinition | null;
7
10
  protected asBoolean(val: unknown): boolean;
8
11
  protected asNumber(val: unknown): number;
9
12
  protected asString(val: unknown): string;
@@ -1 +1 @@
1
- {"version":3,"file":"prism-controls-panel.component.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/controls/prism-controls-panel.component.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;;AAEhF,qBAyFa,2BAA2B;IACtC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;IACtE,SAAS,CAAC,QAAQ,CAAC,eAAe,uBAAgC;IAElE,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO;IAI1C,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;IAIxC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;yCAZ7B,2BAA2B;2CAA3B,2BAA2B;CAevC"}
1
+ {"version":3,"file":"prism-controls-panel.component.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/controls/prism-controls-panel.component.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;;AAEhF,qBAiGa,2BAA2B;IACtC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;IACtE,SAAS,CAAC,QAAQ,CAAC,eAAe,uBAAgC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAE5D,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,GAAG,IAAI;IAItE,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO;IAI1C,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;IAIxC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM;yCAjB7B,2BAA2B;2CAA3B,2BAA2B;CAoBvC"}
@@ -1,3 +1,4 @@
1
+ import { NgComponentOutlet } from '@angular/common';
1
2
  import { Component, inject } from '@angular/core';
2
3
  import { BooleanControlComponent } from '../../controls/boolean-control.component.js';
3
4
  import { JsonControlComponent } from '../../controls/json-control.component.js';
@@ -5,69 +6,86 @@ import { NumberControlComponent } from '../../controls/number-control.component.
5
6
  import { StringControlComponent } from '../../controls/string-control.component.js';
6
7
  import { UnionControlComponent } from '../../controls/union-control.component.js';
7
8
  import { PrismNavigationService } from '../../services/prism-navigation.service.js';
9
+ import { PrismPluginService } from '../../services/prism-plugin.service.js';
8
10
  import { PrismRendererService } from '../../services/prism-renderer.service.js';
9
11
  import * as i0 from "@angular/core";
10
- const _c0 = () => [];
12
+ const _c0 = (a0, a1) => ({ inputMeta: a0, rendererService: a1 });
13
+ const _c1 = () => [];
11
14
  const _forTrack0 = ($index, $item) => $item.name;
12
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_1_Template(rf, ctx) { if (rf & 1) {
13
- const _r1 = i0.ɵɵgetCurrentView();
14
- i0.ɵɵelementStart(0, "prism-boolean-control", 5);
15
- i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Case_1_Template_prism_boolean_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r1); const input_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r2.name, $event)); });
15
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
16
+ i0.ɵɵelementContainer(0, 3);
17
+ } if (rf & 2) {
18
+ const input_r1 = i0.ɵɵnextContext().$implicit;
19
+ const ctx_r1 = i0.ɵɵnextContext(2);
20
+ i0.ɵɵproperty("ngComponentOutlet", ctx.component)("ngComponentOutletInputs", i0.ɵɵpureFunction2(2, _c0, input_r1, ctx_r1.rendererService));
21
+ } }
22
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_0_Template(rf, ctx) { if (rf & 1) {
23
+ const _r3 = i0.ɵɵgetCurrentView();
24
+ i0.ɵɵelementStart(0, "prism-boolean-control", 6);
25
+ i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_0_Template_prism_boolean_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r3); const input_r1 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r1.name, $event)); });
16
26
  i0.ɵɵelementEnd();
17
27
  } if (rf & 2) {
18
- const input_r2 = i0.ɵɵnextContext().$implicit;
19
- const ctx_r2 = i0.ɵɵnextContext(2);
20
- i0.ɵɵproperty("value", ctx_r2.asBoolean(ctx_r2.rendererService.inputValues()[input_r2.name]))("label", input_r2.name)("typeName", input_r2.rawType ?? "");
28
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
29
+ const ctx_r1 = i0.ɵɵnextContext(2);
30
+ i0.ɵɵproperty("value", ctx_r1.asBoolean(ctx_r1.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "");
21
31
  } }
22
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_2_Template(rf, ctx) { if (rf & 1) {
32
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_1_Template(rf, ctx) { if (rf & 1) {
23
33
  const _r4 = i0.ɵɵgetCurrentView();
24
- i0.ɵɵelementStart(0, "prism-number-control", 5);
25
- i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Case_2_Template_prism_number_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const input_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r2.name, $event)); });
34
+ i0.ɵɵelementStart(0, "prism-number-control", 6);
35
+ i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_1_Template_prism_number_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const input_r1 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r1.name, $event)); });
26
36
  i0.ɵɵelementEnd();
27
37
  } if (rf & 2) {
28
- const input_r2 = i0.ɵɵnextContext().$implicit;
29
- const ctx_r2 = i0.ɵɵnextContext(2);
30
- i0.ɵɵproperty("value", ctx_r2.asNumber(ctx_r2.rendererService.inputValues()[input_r2.name]))("label", input_r2.name)("typeName", input_r2.rawType ?? "");
38
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
39
+ const ctx_r1 = i0.ɵɵnextContext(2);
40
+ i0.ɵɵproperty("value", ctx_r1.asNumber(ctx_r1.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "");
31
41
  } }
32
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_3_Template(rf, ctx) { if (rf & 1) {
42
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_2_Template(rf, ctx) { if (rf & 1) {
33
43
  const _r5 = i0.ɵɵgetCurrentView();
34
- i0.ɵɵelementStart(0, "prism-union-control", 6);
35
- i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Case_3_Template_prism_union_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r5); const input_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r2.name, $event)); });
44
+ i0.ɵɵelementStart(0, "prism-union-control", 7);
45
+ i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_2_Template_prism_union_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r5); const input_r1 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r1.name, $event)); });
36
46
  i0.ɵɵelementEnd();
37
47
  } if (rf & 2) {
38
- const input_r2 = i0.ɵɵnextContext().$implicit;
39
- const ctx_r2 = i0.ɵɵnextContext(2);
40
- i0.ɵɵproperty("value", ctx_r2.asString(ctx_r2.rendererService.inputValues()[input_r2.name]))("label", input_r2.name)("typeName", input_r2.rawType ?? "")("options", input_r2.values ?? i0.ɵɵpureFunction0(4, _c0));
48
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
49
+ const ctx_r1 = i0.ɵɵnextContext(2);
50
+ i0.ɵɵproperty("value", ctx_r1.asString(ctx_r1.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "")("options", input_r1.values ?? i0.ɵɵpureFunction0(4, _c1));
41
51
  } }
42
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_4_Template(rf, ctx) { if (rf & 1) {
52
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_3_Template(rf, ctx) { if (rf & 1) {
43
53
  const _r6 = i0.ɵɵgetCurrentView();
44
- i0.ɵɵelementStart(0, "prism-string-control", 5);
45
- i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Case_4_Template_prism_string_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const input_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r2.name, $event)); });
54
+ i0.ɵɵelementStart(0, "prism-string-control", 6);
55
+ i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_3_Template_prism_string_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const input_r1 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r1.name, $event)); });
46
56
  i0.ɵɵelementEnd();
47
57
  } if (rf & 2) {
48
- const input_r2 = i0.ɵɵnextContext().$implicit;
49
- const ctx_r2 = i0.ɵɵnextContext(2);
50
- i0.ɵɵproperty("value", ctx_r2.asString(ctx_r2.rendererService.inputValues()[input_r2.name]))("label", input_r2.name)("typeName", input_r2.rawType ?? "");
58
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
59
+ const ctx_r1 = i0.ɵɵnextContext(2);
60
+ i0.ɵɵproperty("value", ctx_r1.asString(ctx_r1.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "");
51
61
  } }
52
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_5_Template(rf, ctx) { if (rf & 1) {
62
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_4_Template(rf, ctx) { if (rf & 1) {
53
63
  const _r7 = i0.ɵɵgetCurrentView();
54
- i0.ɵɵelementStart(0, "prism-json-control", 5);
55
- i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Case_5_Template_prism_json_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const input_r2 = i0.ɵɵnextContext().$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r2.name, $event)); });
64
+ i0.ɵɵelementStart(0, "prism-json-control", 6);
65
+ i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_4_Template_prism_json_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const input_r1 = i0.ɵɵnextContext(2).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r1.name, $event)); });
56
66
  i0.ɵɵelementEnd();
57
67
  } if (rf & 2) {
58
- const input_r2 = i0.ɵɵnextContext().$implicit;
59
- const ctx_r2 = i0.ɵɵnextContext(2);
60
- i0.ɵɵproperty("value", ctx_r2.rendererService.inputValues()[input_r2.name])("label", input_r2.name)("typeName", input_r2.rawType ?? "");
68
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
69
+ const ctx_r1 = i0.ɵɵnextContext(2);
70
+ i0.ɵɵproperty("value", ctx_r1.rendererService.inputValues()[input_r1.name])("label", input_r1.name)("typeName", input_r1.rawType ?? "");
71
+ } }
72
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
73
+ i0.ɵɵconditionalCreate(0, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_0_Template, 1, 3, "prism-boolean-control", 4)(1, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_1_Template, 1, 3, "prism-number-control", 4)(2, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_2_Template, 1, 5, "prism-union-control", 5)(3, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_3_Template, 1, 3, "prism-string-control", 4)(4, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_4_Template, 1, 3, "prism-json-control", 4);
74
+ } if (rf & 2) {
75
+ let tmp_13_0;
76
+ const input_r1 = i0.ɵɵnextContext().$implicit;
77
+ i0.ɵɵconditional((tmp_13_0 = input_r1.type) === "boolean" ? 0 : tmp_13_0 === "number" ? 1 : tmp_13_0 === "union" ? 2 : tmp_13_0 === "string" ? 3 : 4);
61
78
  } }
62
79
  function PrismControlsPanelComponent_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
63
80
  i0.ɵɵelementStart(0, "div", 1);
64
- i0.ɵɵconditionalCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Case_1_Template, 1, 3, "prism-boolean-control", 3)(2, PrismControlsPanelComponent_Conditional_0_For_2_Case_2_Template, 1, 3, "prism-number-control", 3)(3, PrismControlsPanelComponent_Conditional_0_For_2_Case_3_Template, 1, 5, "prism-union-control", 4)(4, PrismControlsPanelComponent_Conditional_0_For_2_Case_4_Template, 1, 3, "prism-string-control", 3)(5, PrismControlsPanelComponent_Conditional_0_For_2_Case_5_Template, 1, 3, "prism-json-control", 3);
81
+ i0.ɵɵconditionalCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_1_Template, 1, 5, "ng-container", 3)(2, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Template, 5, 1);
65
82
  i0.ɵɵelementEnd();
66
83
  } if (rf & 2) {
67
84
  let tmp_12_0;
68
- const input_r2 = ctx.$implicit;
85
+ const input_r1 = ctx.$implicit;
86
+ const ctx_r1 = i0.ɵɵnextContext(2);
69
87
  i0.ɵɵadvance();
70
- i0.ɵɵconditional((tmp_12_0 = input_r2.type) === "boolean" ? 1 : tmp_12_0 === "number" ? 2 : tmp_12_0 === "union" ? 3 : tmp_12_0 === "string" ? 4 : 5);
88
+ i0.ɵɵconditional((tmp_12_0 = ctx_r1.getCustomControl(input_r1)) ? 1 : 2, tmp_12_0);
71
89
  } }
72
90
  function PrismControlsPanelComponent_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
73
91
  i0.ɵɵelementStart(0, "p", 2);
@@ -76,7 +94,7 @@ function PrismControlsPanelComponent_Conditional_0_Conditional_3_Template(rf, ct
76
94
  } }
77
95
  function PrismControlsPanelComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
78
96
  i0.ɵɵelementStart(0, "div", 0);
79
- i0.ɵɵrepeaterCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Template, 6, 1, "div", 1, _forTrack0);
97
+ i0.ɵɵrepeaterCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Template, 3, 1, "div", 1, _forTrack0);
80
98
  i0.ɵɵconditionalCreate(3, PrismControlsPanelComponent_Conditional_0_Conditional_3_Template, 2, 0, "p", 2);
81
99
  i0.ɵɵelementEnd();
82
100
  } if (rf & 2) {
@@ -89,6 +107,10 @@ function PrismControlsPanelComponent_Conditional_0_Template(rf, ctx) { if (rf &
89
107
  export class PrismControlsPanelComponent {
90
108
  navigationService = inject(PrismNavigationService);
91
109
  rendererService = inject(PrismRendererService);
110
+ pluginService = inject(PrismPluginService);
111
+ getCustomControl(input) {
112
+ return this.pluginService.controls().find((ctrl) => ctrl.matchType(input)) ?? null;
113
+ }
92
114
  asBoolean(val) {
93
115
  return Boolean(val);
94
116
  }
@@ -99,12 +121,13 @@ export class PrismControlsPanelComponent {
99
121
  return String(val ?? '');
100
122
  }
101
123
  static ɵfac = function PrismControlsPanelComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismControlsPanelComponent)(); };
102
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismControlsPanelComponent, selectors: [["prism-controls-panel"]], decls: 1, vars: 1, consts: [[1, "prism-controls-panel"], [1, "prism-controls-panel__row"], [1, "prism-controls-panel__empty"], [3, "value", "label", "typeName"], [3, "value", "label", "typeName", "options"], [3, "valueChange", "value", "label", "typeName"], [3, "valueChange", "value", "label", "typeName", "options"]], template: function PrismControlsPanelComponent_Template(rf, ctx) { if (rf & 1) {
124
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismControlsPanelComponent, selectors: [["prism-controls-panel"]], decls: 1, vars: 1, consts: [[1, "prism-controls-panel"], [1, "prism-controls-panel__row"], [1, "prism-controls-panel__empty"], [3, "ngComponentOutlet", "ngComponentOutletInputs"], [3, "value", "label", "typeName"], [3, "value", "label", "typeName", "options"], [3, "valueChange", "value", "label", "typeName"], [3, "valueChange", "value", "label", "typeName", "options"]], template: function PrismControlsPanelComponent_Template(rf, ctx) { if (rf & 1) {
103
125
  i0.ɵɵconditionalCreate(0, PrismControlsPanelComponent_Conditional_0_Template, 4, 1, "div", 0);
104
126
  } if (rf & 2) {
105
127
  let tmp_0_0;
106
128
  i0.ɵɵconditional((tmp_0_0 = ctx.navigationService.activeComponent()) ? 0 : -1, tmp_0_0);
107
- } }, dependencies: [BooleanControlComponent,
129
+ } }, dependencies: [NgComponentOutlet,
130
+ BooleanControlComponent,
108
131
  StringControlComponent,
109
132
  NumberControlComponent,
110
133
  UnionControlComponent,
@@ -113,6 +136,7 @@ export class PrismControlsPanelComponent {
113
136
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismControlsPanelComponent, [{
114
137
  type: Component,
115
138
  args: [{ selector: 'prism-controls-panel', standalone: true, imports: [
139
+ NgComponentOutlet,
116
140
  BooleanControlComponent,
117
141
  StringControlComponent,
118
142
  NumberControlComponent,
@@ -123,47 +147,54 @@ export class PrismControlsPanelComponent {
123
147
  <div class="prism-controls-panel">
124
148
  @for (input of comp.meta.inputs; track input.name) {
125
149
  <div class="prism-controls-panel__row">
126
- @switch (input.type) {
127
- @case ('boolean') {
128
- <prism-boolean-control
129
- [value]="asBoolean(rendererService.inputValues()[input.name])"
130
- [label]="input.name"
131
- [typeName]="input.rawType ?? ''"
132
- (valueChange)="rendererService.updateInput(input.name, $event)"
133
- />
134
- }
135
- @case ('number') {
136
- <prism-number-control
137
- [value]="asNumber(rendererService.inputValues()[input.name])"
138
- [label]="input.name"
139
- [typeName]="input.rawType ?? ''"
140
- (valueChange)="rendererService.updateInput(input.name, $event)"
141
- />
142
- }
143
- @case ('union') {
144
- <prism-union-control
145
- [value]="asString(rendererService.inputValues()[input.name])"
146
- [label]="input.name"
147
- [typeName]="input.rawType ?? ''"
148
- [options]="input.values ?? []"
149
- (valueChange)="rendererService.updateInput(input.name, $event)"
150
- />
151
- }
152
- @case ('string') {
153
- <prism-string-control
154
- [value]="asString(rendererService.inputValues()[input.name])"
155
- [label]="input.name"
156
- [typeName]="input.rawType ?? ''"
157
- (valueChange)="rendererService.updateInput(input.name, $event)"
158
- />
159
- }
160
- @default {
161
- <prism-json-control
162
- [value]="rendererService.inputValues()[input.name]"
163
- [label]="input.name"
164
- [typeName]="input.rawType ?? ''"
165
- (valueChange)="rendererService.updateInput(input.name, $event)"
166
- />
150
+ @if (getCustomControl(input); as customCtrl) {
151
+ <ng-container
152
+ [ngComponentOutlet]="customCtrl.component"
153
+ [ngComponentOutletInputs]="{ inputMeta: input, rendererService: rendererService }"
154
+ />
155
+ } @else {
156
+ @switch (input.type) {
157
+ @case ('boolean') {
158
+ <prism-boolean-control
159
+ [value]="asBoolean(rendererService.inputValues()[input.name])"
160
+ [label]="input.name"
161
+ [typeName]="input.rawType ?? ''"
162
+ (valueChange)="rendererService.updateInput(input.name, $event)"
163
+ />
164
+ }
165
+ @case ('number') {
166
+ <prism-number-control
167
+ [value]="asNumber(rendererService.inputValues()[input.name])"
168
+ [label]="input.name"
169
+ [typeName]="input.rawType ?? ''"
170
+ (valueChange)="rendererService.updateInput(input.name, $event)"
171
+ />
172
+ }
173
+ @case ('union') {
174
+ <prism-union-control
175
+ [value]="asString(rendererService.inputValues()[input.name])"
176
+ [label]="input.name"
177
+ [typeName]="input.rawType ?? ''"
178
+ [options]="input.values ?? []"
179
+ (valueChange)="rendererService.updateInput(input.name, $event)"
180
+ />
181
+ }
182
+ @case ('string') {
183
+ <prism-string-control
184
+ [value]="asString(rendererService.inputValues()[input.name])"
185
+ [label]="input.name"
186
+ [typeName]="input.rawType ?? ''"
187
+ (valueChange)="rendererService.updateInput(input.name, $event)"
188
+ />
189
+ }
190
+ @default {
191
+ <prism-json-control
192
+ [value]="rendererService.inputValues()[input.name]"
193
+ [label]="input.name"
194
+ [typeName]="input.rawType ?? ''"
195
+ (valueChange)="rendererService.updateInput(input.name, $event)"
196
+ />
197
+ }
167
198
  }
168
199
  }
169
200
  </div>
@@ -175,4 +206,4 @@ export class PrismControlsPanelComponent {
175
206
  }
176
207
  `, styles: ["\n .prism-controls-panel {\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n height: 100%;\n }\n\n .prism-controls-panel__row {\n border-bottom: 1px solid var(--prism-border);\n }\n\n .prism-controls-panel__row:last-child { border-bottom: none; }\n\n .prism-controls-panel__empty {\n color: var(--prism-text-ghost);\n font-size: 13px;\n font-family: var(--prism-font-sans);\n margin: 0;\n padding: 16px;\n }\n "] }]
177
208
  }], null, null); })();
178
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismControlsPanelComponent, { className: "PrismControlsPanelComponent", filePath: "app/panels/controls/prism-controls-panel.component.ts", lineNumber: 99 }); })();
209
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismControlsPanelComponent, { className: "PrismControlsPanelComponent", filePath: "app/panels/controls/prism-controls-panel.component.ts", lineNumber: 110 }); })();
@@ -9,6 +9,7 @@ export declare class PrismPanelHostComponent implements OnDestroy {
9
9
  private readonly auditService;
10
10
  private readonly rendererService;
11
11
  protected readonly a11yScore: import("@angular/core").Signal<number | null>;
12
+ protected readonly coverageScore: import("@angular/core").Signal<number | null>;
12
13
  private readonly builtInPanels;
13
14
  protected readonly allPanels: import("@angular/core").Signal<import("../../../index.js").PanelDefinition[]>;
14
15
  protected readonly resolvedComponent: import("@angular/core").WritableSignal<Type<unknown> | null>;
@@ -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,EAA0D,mBAAmB,EAAU,SAAS,EAAU,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAKlJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;;AAK1E,qBAkFa,uBAAwB,YAAW,SAAS;IACvD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkC;IACtD,SAAS,CAAC,QAAQ,CAAC,YAAY,oBAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAEhE,SAAS,CAAC,QAAQ,CAAC,SAAS,gDAAkE;IAE9F,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAEhD,SAAS,CAAC,QAAQ,CAAC,SAAS,gFAGzB;IACH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,+DAAsC;IAC1E,SAAS,CAAC,QAAQ,CAAC,WAAW;;OAE1B;IAEJ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IAExE,SAAS,CAAC,QAAQ,CAAC,cAAc,sDAY9B;;IAmDH,WAAW,IAAI,IAAI;yCAvFR,uBAAuB;2CAAvB,uBAAuB;CA0FnC"}
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,EAA0D,mBAAmB,EAAU,SAAS,EAAU,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAKlJ,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;;AAK1E,qBAqFa,uBAAwB,YAAW,SAAS;IACvD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkC;IACtD,SAAS,CAAC,QAAQ,CAAC,YAAY,oBAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAEhE,SAAS,CAAC,QAAQ,CAAC,SAAS,gDAAkE;IAE9F,SAAS,CAAC,QAAQ,CAAC,aAAa,gDAK7B;IAEH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAEhD,SAAS,CAAC,QAAQ,CAAC,SAAS,gFAGzB;IACH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,+DAAsC;IAC1E,SAAS,CAAC,QAAQ,CAAC,WAAW;;OAE1B;IAEJ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IAExE,SAAS,CAAC,QAAQ,CAAC,cAAc,sDAY9B;;IAmDH,WAAW,IAAI,IAAI;yCA9FR,uBAAuB;2CAAvB,uBAAuB;CAiGnC"}
@@ -15,12 +15,19 @@ function PrismPanelHostComponent_For_3_Conditional_1_Template(rf, ctx) { if (rf
15
15
  const ctx_r2 = i0.ɵɵnextContext(2);
16
16
  i0.ɵɵproperty("score", ctx_r2.a11yScore())("compact", true);
17
17
  } }
18
+ function PrismPanelHostComponent_For_3_Conditional_2_Template(rf, ctx) { if (rf & 1) {
19
+ i0.ɵɵelement(0, "prism-a11y-score", 5);
20
+ } if (rf & 2) {
21
+ const ctx_r2 = i0.ɵɵnextContext(2);
22
+ i0.ɵɵproperty("score", ctx_r2.coverageScore())("compact", true);
23
+ } }
18
24
  function PrismPanelHostComponent_For_3_Template(rf, ctx) { if (rf & 1) {
19
25
  const _r1 = i0.ɵɵgetCurrentView();
20
26
  i0.ɵɵelementStart(0, "button", 4);
21
27
  i0.ɵɵlistener("click", function PrismPanelHostComponent_For_3_Template_button_click_0_listener() { const panel_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.panelService.activePanelId.set(panel_r2.id)); });
22
28
  i0.ɵɵconditionalCreate(1, PrismPanelHostComponent_For_3_Conditional_1_Template, 1, 2, "prism-a11y-score", 5);
23
- i0.ɵɵtext(2);
29
+ i0.ɵɵconditionalCreate(2, PrismPanelHostComponent_For_3_Conditional_2_Template, 1, 2, "prism-a11y-score", 5);
30
+ i0.ɵɵtext(3);
24
31
  i0.ɵɵelementEnd();
25
32
  } if (rf & 2) {
26
33
  const panel_r2 = ctx.$implicit;
@@ -29,6 +36,8 @@ function PrismPanelHostComponent_For_3_Template(rf, ctx) { if (rf & 1) {
29
36
  i0.ɵɵadvance();
30
37
  i0.ɵɵconditional(panel_r2.id === "a11y" && ctx_r2.a11yScore() !== null ? 1 : -1);
31
38
  i0.ɵɵadvance();
39
+ i0.ɵɵconditional(panel_r2.id === "coverage" && ctx_r2.coverageScore() !== null ? 2 : -1);
40
+ i0.ɵɵadvance();
32
41
  i0.ɵɵtextInterpolate1(" ", panel_r2.label, " ");
33
42
  } }
34
43
  function PrismPanelHostComponent_Conditional_5_ng_container_0_Template(rf, ctx) { if (rf & 1) {
@@ -48,6 +57,13 @@ export class PrismPanelHostComponent {
48
57
  auditService = inject(A11yAuditService);
49
58
  rendererService = inject(PrismRendererService);
50
59
  a11yScore = computed(() => this.auditService.scoreResult()?.score ?? null, ...(ngDevMode ? [{ debugName: "a11yScore" }] : []));
60
+ coverageScore = computed(() => {
61
+ const comp = this.nav.activeComponent();
62
+ const coverage = comp?.meta?.showcaseConfig?.meta?.['coverage'];
63
+ if (!coverage?.found)
64
+ return null;
65
+ return coverage.score;
66
+ }, ...(ngDevMode ? [{ debugName: "coverageScore" }] : []));
51
67
  builtInPanels = BUILTIN_PANELS;
52
68
  allPanels = computed(() => [
53
69
  ...this.builtInPanels.filter((p) => p.placement !== 'view'),
@@ -116,7 +132,7 @@ export class PrismPanelHostComponent {
116
132
  static ɵfac = function PrismPanelHostComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismPanelHostComponent)(); };
117
133
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismPanelHostComponent, selectors: [["prism-panel-host"]], decls: 6, vars: 1, consts: [[1, "prism-panel-host"], [1, "prism-panel-host__tabs"], [1, "prism-panel-host__tab", 3, "prism-panel-host__tab--active"], [1, "prism-panel-host__content"], [1, "prism-panel-host__tab", 3, "click"], [2, "width", "18px", "height", "18px", 3, "score", "compact"], [4, "ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector"]], template: function PrismPanelHostComponent_Template(rf, ctx) { if (rf & 1) {
118
134
  i0.ɵɵelementStart(0, "div", 0)(1, "div", 1);
119
- i0.ɵɵrepeaterCreate(2, PrismPanelHostComponent_For_3_Template, 3, 4, "button", 2, _forTrack0);
135
+ i0.ɵɵrepeaterCreate(2, PrismPanelHostComponent_For_3_Template, 4, 5, "button", 2, _forTrack0);
120
136
  i0.ɵɵelementEnd();
121
137
  i0.ɵɵelementStart(4, "div", 3);
122
138
  i0.ɵɵconditionalCreate(5, PrismPanelHostComponent_Conditional_5_Template, 1, 3, "ng-container");
@@ -142,6 +158,9 @@ export class PrismPanelHostComponent {
142
158
  @if (panel.id === 'a11y' && a11yScore() !== null) {
143
159
  <prism-a11y-score [score]="a11yScore()!" [compact]="true" style="width:18px;height:18px;" />
144
160
  }
161
+ @if (panel.id === 'coverage' && coverageScore() !== null) {
162
+ <prism-a11y-score [score]="coverageScore()!" [compact]="true" style="width:18px;height:18px;" />
163
+ }
145
164
  {{ panel.label }}
146
165
  </button>
147
166
  }
@@ -154,4 +173,4 @@ export class PrismPanelHostComponent {
154
173
  </div>
155
174
  `, styles: ["\n .prism-panel-host {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--prism-bg-elevated);\n }\n\n .prism-panel-host__tabs {\n display: flex;\n border-bottom: 1px solid var(--prism-border);\n padding: 0 8px;\n flex-shrink: 0;\n background: var(--prism-bg-elevated);\n }\n\n .prism-panel-host__tab {\n padding: 9px 14px;\n font-size: 13px;\n font-family: var(--prism-font-sans);\n border: none;\n background: none;\n color: var(--prism-text-muted);\n cursor: pointer;\n position: relative;\n margin-bottom: -1px;\n transition: color 0.12s;\n }\n\n .prism-panel-host__tab::after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 8px;\n right: 8px;\n height: 2px;\n background: linear-gradient(90deg, var(--prism-primary-from), var(--prism-primary-to));\n opacity: 0;\n transition: opacity 0.12s;\n }\n\n .prism-panel-host__tab:hover { color: var(--prism-text-2); }\n\n .prism-panel-host__tab--active { color: var(--prism-primary); font-weight: 500; }\n\n .prism-panel-host__tab--active::after { opacity: 1; }\n\n .prism-panel-host__tab { display: flex; align-items: center; gap: 6px; }\n\n .prism-panel-host__content {\n flex: 1;\n overflow: auto;\n }\n "] }]
156
175
  }], () => [], null); })();
157
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismPanelHostComponent, { className: "PrismPanelHostComponent", filePath: "app/panels/panel-host/prism-panel-host.component.ts", lineNumber: 94 }); })();
176
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismPanelHostComponent, { className: "PrismPanelHostComponent", filePath: "app/panels/panel-host/prism-panel-host.component.ts", lineNumber: 97 }); })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-prism/core",
3
- "version": "21.3.0",
3
+ "version": "21.4.1",
4
4
  "description": "Lightweight Angular-native component showcase — no story files needed.",
5
5
  "keywords": [
6
6
  "angular",