@ng-prism/core 21.3.0 → 21.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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,85 @@ 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 => ({ inputMeta: a0 });
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
+ i0.ɵɵproperty("ngComponentOutlet", ctx.component)("ngComponentOutletInputs", i0.ɵɵpureFunction1(2, _c0, input_r1));
20
+ } }
21
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_0_Template(rf, ctx) { if (rf & 1) {
22
+ const _r2 = i0.ɵɵgetCurrentView();
23
+ i0.ɵɵelementStart(0, "prism-boolean-control", 6);
24
+ i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_0_Template_prism_boolean_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r2); const input_r1 = i0.ɵɵnextContext(2).$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r1.name, $event)); });
16
25
  i0.ɵɵelementEnd();
17
26
  } if (rf & 2) {
18
- const input_r2 = i0.ɵɵnextContext().$implicit;
27
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
19
28
  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 ?? "");
29
+ i0.ɵɵproperty("value", ctx_r2.asBoolean(ctx_r2.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "");
21
30
  } }
22
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_2_Template(rf, ctx) { if (rf & 1) {
31
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_1_Template(rf, ctx) { if (rf & 1) {
23
32
  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)); });
33
+ i0.ɵɵelementStart(0, "prism-number-control", 6);
34
+ 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_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r1.name, $event)); });
26
35
  i0.ɵɵelementEnd();
27
36
  } if (rf & 2) {
28
- const input_r2 = i0.ɵɵnextContext().$implicit;
37
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
29
38
  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 ?? "");
39
+ i0.ɵɵproperty("value", ctx_r2.asNumber(ctx_r2.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "");
31
40
  } }
32
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_3_Template(rf, ctx) { if (rf & 1) {
41
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_2_Template(rf, ctx) { if (rf & 1) {
33
42
  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)); });
43
+ i0.ɵɵelementStart(0, "prism-union-control", 7);
44
+ 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_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r1.name, $event)); });
36
45
  i0.ɵɵelementEnd();
37
46
  } if (rf & 2) {
38
- const input_r2 = i0.ɵɵnextContext().$implicit;
47
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
39
48
  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));
49
+ i0.ɵɵproperty("value", ctx_r2.asString(ctx_r2.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "")("options", input_r1.values ?? i0.ɵɵpureFunction0(4, _c1));
41
50
  } }
42
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_4_Template(rf, ctx) { if (rf & 1) {
51
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_3_Template(rf, ctx) { if (rf & 1) {
43
52
  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)); });
53
+ i0.ɵɵelementStart(0, "prism-string-control", 6);
54
+ 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_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r1.name, $event)); });
46
55
  i0.ɵɵelementEnd();
47
56
  } if (rf & 2) {
48
- const input_r2 = i0.ɵɵnextContext().$implicit;
57
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
49
58
  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 ?? "");
59
+ i0.ɵɵproperty("value", ctx_r2.asString(ctx_r2.rendererService.inputValues()[input_r1.name]))("label", input_r1.name)("typeName", input_r1.rawType ?? "");
51
60
  } }
52
- function PrismControlsPanelComponent_Conditional_0_For_2_Case_5_Template(rf, ctx) { if (rf & 1) {
61
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Case_4_Template(rf, ctx) { if (rf & 1) {
53
62
  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)); });
63
+ i0.ɵɵelementStart(0, "prism-json-control", 6);
64
+ 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_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.rendererService.updateInput(input_r1.name, $event)); });
56
65
  i0.ɵɵelementEnd();
57
66
  } if (rf & 2) {
58
- const input_r2 = i0.ɵɵnextContext().$implicit;
67
+ const input_r1 = i0.ɵɵnextContext(2).$implicit;
59
68
  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 ?? "");
69
+ i0.ɵɵproperty("value", ctx_r2.rendererService.inputValues()[input_r1.name])("label", input_r1.name)("typeName", input_r1.rawType ?? "");
70
+ } }
71
+ function PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
72
+ 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);
73
+ } if (rf & 2) {
74
+ let tmp_13_0;
75
+ const input_r1 = i0.ɵɵnextContext().$implicit;
76
+ 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
77
  } }
62
78
  function PrismControlsPanelComponent_Conditional_0_For_2_Template(rf, ctx) { if (rf & 1) {
63
79
  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);
80
+ i0.ɵɵconditionalCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_1_Template, 1, 4, "ng-container", 3)(2, PrismControlsPanelComponent_Conditional_0_For_2_Conditional_2_Template, 5, 1);
65
81
  i0.ɵɵelementEnd();
66
82
  } if (rf & 2) {
67
83
  let tmp_12_0;
68
- const input_r2 = ctx.$implicit;
84
+ const input_r1 = ctx.$implicit;
85
+ const ctx_r2 = i0.ɵɵnextContext(2);
69
86
  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);
87
+ i0.ɵɵconditional((tmp_12_0 = ctx_r2.getCustomControl(input_r1)) ? 1 : 2, tmp_12_0);
71
88
  } }
72
89
  function PrismControlsPanelComponent_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
73
90
  i0.ɵɵelementStart(0, "p", 2);
@@ -76,7 +93,7 @@ function PrismControlsPanelComponent_Conditional_0_Conditional_3_Template(rf, ct
76
93
  } }
77
94
  function PrismControlsPanelComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
78
95
  i0.ɵɵelementStart(0, "div", 0);
79
- i0.ɵɵrepeaterCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Template, 6, 1, "div", 1, _forTrack0);
96
+ i0.ɵɵrepeaterCreate(1, PrismControlsPanelComponent_Conditional_0_For_2_Template, 3, 1, "div", 1, _forTrack0);
80
97
  i0.ɵɵconditionalCreate(3, PrismControlsPanelComponent_Conditional_0_Conditional_3_Template, 2, 0, "p", 2);
81
98
  i0.ɵɵelementEnd();
82
99
  } if (rf & 2) {
@@ -89,6 +106,10 @@ function PrismControlsPanelComponent_Conditional_0_Template(rf, ctx) { if (rf &
89
106
  export class PrismControlsPanelComponent {
90
107
  navigationService = inject(PrismNavigationService);
91
108
  rendererService = inject(PrismRendererService);
109
+ pluginService = inject(PrismPluginService);
110
+ getCustomControl(input) {
111
+ return this.pluginService.controls().find((ctrl) => ctrl.matchType(input)) ?? null;
112
+ }
92
113
  asBoolean(val) {
93
114
  return Boolean(val);
94
115
  }
@@ -99,12 +120,13 @@ export class PrismControlsPanelComponent {
99
120
  return String(val ?? '');
100
121
  }
101
122
  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) {
123
+ 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
124
  i0.ɵɵconditionalCreate(0, PrismControlsPanelComponent_Conditional_0_Template, 4, 1, "div", 0);
104
125
  } if (rf & 2) {
105
126
  let tmp_0_0;
106
127
  i0.ɵɵconditional((tmp_0_0 = ctx.navigationService.activeComponent()) ? 0 : -1, tmp_0_0);
107
- } }, dependencies: [BooleanControlComponent,
128
+ } }, dependencies: [NgComponentOutlet,
129
+ BooleanControlComponent,
108
130
  StringControlComponent,
109
131
  NumberControlComponent,
110
132
  UnionControlComponent,
@@ -113,6 +135,7 @@ export class PrismControlsPanelComponent {
113
135
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismControlsPanelComponent, [{
114
136
  type: Component,
115
137
  args: [{ selector: 'prism-controls-panel', standalone: true, imports: [
138
+ NgComponentOutlet,
116
139
  BooleanControlComponent,
117
140
  StringControlComponent,
118
141
  NumberControlComponent,
@@ -123,47 +146,54 @@ export class PrismControlsPanelComponent {
123
146
  <div class="prism-controls-panel">
124
147
  @for (input of comp.meta.inputs; track input.name) {
125
148
  <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
- />
149
+ @if (getCustomControl(input); as customCtrl) {
150
+ <ng-container
151
+ [ngComponentOutlet]="customCtrl.component"
152
+ [ngComponentOutletInputs]="{ inputMeta: input }"
153
+ />
154
+ } @else {
155
+ @switch (input.type) {
156
+ @case ('boolean') {
157
+ <prism-boolean-control
158
+ [value]="asBoolean(rendererService.inputValues()[input.name])"
159
+ [label]="input.name"
160
+ [typeName]="input.rawType ?? ''"
161
+ (valueChange)="rendererService.updateInput(input.name, $event)"
162
+ />
163
+ }
164
+ @case ('number') {
165
+ <prism-number-control
166
+ [value]="asNumber(rendererService.inputValues()[input.name])"
167
+ [label]="input.name"
168
+ [typeName]="input.rawType ?? ''"
169
+ (valueChange)="rendererService.updateInput(input.name, $event)"
170
+ />
171
+ }
172
+ @case ('union') {
173
+ <prism-union-control
174
+ [value]="asString(rendererService.inputValues()[input.name])"
175
+ [label]="input.name"
176
+ [typeName]="input.rawType ?? ''"
177
+ [options]="input.values ?? []"
178
+ (valueChange)="rendererService.updateInput(input.name, $event)"
179
+ />
180
+ }
181
+ @case ('string') {
182
+ <prism-string-control
183
+ [value]="asString(rendererService.inputValues()[input.name])"
184
+ [label]="input.name"
185
+ [typeName]="input.rawType ?? ''"
186
+ (valueChange)="rendererService.updateInput(input.name, $event)"
187
+ />
188
+ }
189
+ @default {
190
+ <prism-json-control
191
+ [value]="rendererService.inputValues()[input.name]"
192
+ [label]="input.name"
193
+ [typeName]="input.rawType ?? ''"
194
+ (valueChange)="rendererService.updateInput(input.name, $event)"
195
+ />
196
+ }
167
197
  }
168
198
  }
169
199
  </div>
@@ -175,4 +205,4 @@ export class PrismControlsPanelComponent {
175
205
  }
176
206
  `, 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
207
  }], null, null); })();
178
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismControlsPanelComponent, { className: "PrismControlsPanelComponent", filePath: "app/panels/controls/prism-controls-panel.component.ts", lineNumber: 99 }); })();
208
+ (() => { (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.0",
4
4
  "description": "Lightweight Angular-native component showcase — no story files needed.",
5
5
  "keywords": [
6
6
  "angular",