@ng-prism/core 21.9.0 → 21.9.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.
@@ -1,3 +1,4 @@
1
+ import { PrismRendererService } from '../../services/prism-renderer.service.js';
1
2
  import * as i0 from "@angular/core";
2
3
  interface Bounds {
3
4
  top: number;
@@ -6,7 +7,7 @@ interface Bounds {
6
7
  height: number;
7
8
  }
8
9
  export declare class A11yOverlayHostComponent {
9
- private readonly rendererService;
10
+ readonly rendererService: import("@angular/core").InputSignal<PrismRendererService>;
10
11
  private readonly keyboardService;
11
12
  private readonly elementRef;
12
13
  private readonly layoutTick;
@@ -15,7 +16,7 @@ export declare class A11yOverlayHostComponent {
15
16
  protected readonly tabLabel: import("@angular/core").Signal<string | null>;
16
17
  constructor();
17
18
  static ɵfac: i0.ɵɵFactoryDeclaration<A11yOverlayHostComponent, never>;
18
- static ɵcmp: i0.ɵɵComponentDeclaration<A11yOverlayHostComponent, "prism-a11y-overlay-host", never, {}, {}, never, never, true, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<A11yOverlayHostComponent, "prism-a11y-overlay-host", never, { "rendererService": { "alias": "rendererService"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
19
20
  }
20
21
  export {};
21
22
  //# sourceMappingURL=a11y-overlay-host.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"a11y-overlay-host.component.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/a11y/a11y-overlay-host.component.ts"],"names":[],"mappings":";AAYA,UAAU,MAAM;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAyDa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+B;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAE9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,SAAS,CAAC,QAAQ,CAAC,MAAM,gDActB;IAEH,SAAS,CAAC,QAAQ,CAAC,SAAS,gDAKzB;IAEH,SAAS,CAAC,QAAQ,CAAC,QAAQ,gDAUxB;;yCAxCQ,wBAAwB;2CAAxB,wBAAwB;CA2DpC"}
1
+ {"version":3,"file":"a11y-overlay-host.component.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/a11y/a11y-overlay-host.component.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;;AAEhF,UAAU,MAAM;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAyDa,wBAAwB;IACnC,QAAQ,CAAC,eAAe,4DAA0C;IAClE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+B;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAE9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,SAAS,CAAC,QAAQ,CAAC,MAAM,gDActB;IAEH,SAAS,CAAC,QAAQ,CAAC,SAAS,gDAKzB;IAEH,SAAS,CAAC,QAAQ,CAAC,QAAQ,gDAUxB;;yCAxCQ,wBAAwB;2CAAxB,wBAAwB;CA2DpC"}
@@ -1,6 +1,5 @@
1
- import { ChangeDetectionStrategy, Component, computed, effect, ElementRef, inject, signal, } from '@angular/core';
1
+ import { ChangeDetectionStrategy, Component, computed, effect, ElementRef, inject, input, signal, } from '@angular/core';
2
2
  import { A11yKeyboardService } from './a11y-keyboard.service.js';
3
- import { PrismRendererService } from '../../services/prism-renderer.service.js';
4
3
  import * as i0 from "@angular/core";
5
4
  function A11yOverlayHostComponent_Conditional_0_Conditional_1_Template(rf, ctx) { if (rf & 1) {
6
5
  i0.ɵɵdomElementStart(0, "div", 3)(1, "span", 4);
@@ -38,12 +37,12 @@ function A11yOverlayHostComponent_Conditional_0_Template(rf, ctx) { if (rf & 1)
38
37
  i0.ɵɵconditional(ctx_r1.tabLabel() ? 2 : -1);
39
38
  } }
40
39
  export class A11yOverlayHostComponent {
41
- rendererService = inject(PrismRendererService);
40
+ rendererService = input.required(...(ngDevMode ? [{ debugName: "rendererService" }] : []));
42
41
  keyboardService = inject(A11yKeyboardService);
43
42
  elementRef = inject((ElementRef));
44
43
  layoutTick = signal(0, ...(ngDevMode ? [{ debugName: "layoutTick" }] : []));
45
44
  bounds = computed(() => {
46
- const el = this.rendererService.renderedElement();
45
+ const el = this.rendererService().renderedElement();
47
46
  this.layoutTick();
48
47
  if (!el)
49
48
  return null;
@@ -60,14 +59,14 @@ export class A11yOverlayHostComponent {
60
59
  };
61
60
  }, ...(ngDevMode ? [{ debugName: "bounds" }] : []));
62
61
  roleLabel = computed(() => {
63
- const el = this.rendererService.renderedElement();
62
+ const el = this.rendererService().renderedElement();
64
63
  if (!el)
65
64
  return null;
66
65
  const role = el.getAttribute('role') ?? implicitRole(el);
67
66
  return role ? `role="${role}"` : null;
68
67
  }, ...(ngDevMode ? [{ debugName: "roleLabel" }] : []));
69
68
  tabLabel = computed(() => {
70
- const el = this.rendererService.renderedElement();
69
+ const el = this.rendererService().renderedElement();
71
70
  if (!el)
72
71
  return null;
73
72
  const doc = el.ownerDocument;
@@ -78,7 +77,7 @@ export class A11yOverlayHostComponent {
78
77
  }, ...(ngDevMode ? [{ debugName: "tabLabel" }] : []));
79
78
  constructor() {
80
79
  effect((onCleanup) => {
81
- const el = this.rendererService.renderedElement();
80
+ const el = this.rendererService().renderedElement();
82
81
  if (!el)
83
82
  return;
84
83
  const ro = new ResizeObserver(() => this.layoutTick.update((v) => v + 1));
@@ -89,13 +88,13 @@ export class A11yOverlayHostComponent {
89
88
  onCleanup(() => ro.disconnect());
90
89
  });
91
90
  effect(() => {
92
- this.rendererService.inputValues();
93
- this.rendererService.activeVariantIndex();
91
+ this.rendererService().inputValues();
92
+ this.rendererService().activeVariantIndex();
94
93
  this.layoutTick.update((v) => v + 1);
95
94
  });
96
95
  }
97
96
  static ɵfac = function A11yOverlayHostComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || A11yOverlayHostComponent)(); };
98
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: A11yOverlayHostComponent, selectors: [["prism-a11y-overlay-host"]], decls: 1, vars: 1, consts: [[1, "a11y-mark", "outline"], [1, "a11y-mark", 3, "top", "left"], [1, "a11y-mark", "kb", 2, "transform", "translateX(-100%)", 3, "top", "left"], [1, "a11y-mark"], [1, "tag"], [1, "a11y-mark", "kb", 2, "transform", "translateX(-100%)"]], template: function A11yOverlayHostComponent_Template(rf, ctx) { if (rf & 1) {
97
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: A11yOverlayHostComponent, selectors: [["prism-a11y-overlay-host"]], inputs: { rendererService: [1, "rendererService"] }, decls: 1, vars: 1, consts: [[1, "a11y-mark", "outline"], [1, "a11y-mark", 3, "top", "left"], [1, "a11y-mark", "kb", 2, "transform", "translateX(-100%)", 3, "top", "left"], [1, "a11y-mark"], [1, "tag"], [1, "a11y-mark", "kb", 2, "transform", "translateX(-100%)"]], template: function A11yOverlayHostComponent_Template(rf, ctx) { if (rf & 1) {
99
98
  i0.ɵɵconditionalCreate(0, A11yOverlayHostComponent_Conditional_0_Template, 3, 10);
100
99
  } if (rf & 2) {
101
100
  let tmp_0_0;
@@ -132,8 +131,8 @@ export class A11yOverlayHostComponent {
132
131
  </div>
133
132
  } }
134
133
  `, styles: ["\n :host { display: contents; }\n .a11y-mark {\n position: absolute;\n pointer-events: none;\n z-index: 1;\n }\n .outline {\n border: 2px solid rgba(59, 130, 246, 0.95);\n border-radius: 4px;\n background: rgba(59, 130, 246, 0.08);\n }\n .tag {\n display: inline-block;\n padding: 2px 6px;\n border-radius: 4px;\n background: rgba(17, 24, 39, 0.92);\n color: var(--prism-text-light, #fff);\n font: 11px/1.4 var(--font-mono);\n white-space: nowrap;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);\n }\n .kb .tag { background: rgba(5, 150, 105, 0.95); }\n "] }]
135
- }], () => [], null); })();
136
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(A11yOverlayHostComponent, { className: "A11yOverlayHostComponent", filePath: "app/panels/a11y/a11y-overlay-host.component.ts", lineNumber: 77 }); })();
134
+ }], () => [], { rendererService: [{ type: i0.Input, args: [{ isSignal: true, alias: "rendererService", required: true }] }] }); })();
135
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(A11yOverlayHostComponent, { className: "A11yOverlayHostComponent", filePath: "app/panels/a11y/a11y-overlay-host.component.ts", lineNumber: 78 }); })();
137
136
  function implicitRole(el) {
138
137
  const tag = el.tagName.toLowerCase();
139
138
  if (tag === 'button')
@@ -1,7 +1,7 @@
1
- import { EnvironmentInjector, OnDestroy, type Type } from '@angular/core';
1
+ import { EnvironmentInjector, type Type } from '@angular/core';
2
2
  import { PrismPanelService } from '../../services/prism-panel.service.js';
3
3
  import * as i0 from "@angular/core";
4
- export declare class PrismPanelHostComponent implements OnDestroy {
4
+ export declare class PrismPanelHostComponent {
5
5
  private readonly pluginService;
6
6
  private readonly nav;
7
7
  protected readonly panelService: PrismPanelService;
@@ -22,10 +22,8 @@ export declare class PrismPanelHostComponent implements OnDestroy {
22
22
  activeComponent: import("../../../index.js").RuntimeComponent | null;
23
23
  }>;
24
24
  private readonly lazyCache;
25
- private readonly injectorCache;
26
25
  protected readonly activeInjector: import("@angular/core").Signal<EnvironmentInjector>;
27
26
  constructor();
28
- ngOnDestroy(): void;
29
27
  static ɵfac: i0.ɵɵFactoryDeclaration<PrismPanelHostComponent, never>;
30
28
  static ɵcmp: i0.ɵɵComponentDeclaration<PrismPanelHostComponent, "prism-panel-host", never, {}, {}, never, never, true, never>;
31
29
  }
@@ -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,EAKL,mBAAmB,EAEnB,SAAS,EAET,KAAK,IAAI,EAEV,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;;AAK1E,qBA+Ka,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,OAAO,CAAC,QAAQ,CAAC,SAAS,CAExB;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAK3B;IAEH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGxB;IAEH,SAAS,CAAC,UAAU,CAClB,OAAO,EAAE,MAAM,GACd;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAA;KAAE,GAAG,IAAI;IAwBzE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAEhD,SAAS,CAAC,QAAQ,CAAC,SAAS,gFAQzB;IAEH,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,sDAgB9B;;IA8DH,WAAW,IAAI,IAAI;yCApJR,uBAAuB;2CAAvB,uBAAuB;CAuJnC"}
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,EAEV,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;;AAK1E,qBA+Ka,uBAAuB;IAClC,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,OAAO,CAAC,QAAQ,CAAC,SAAS,CAExB;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAK3B;IAEH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAGxB;IAEH,SAAS,CAAC,UAAU,CAClB,OAAO,EAAE,MAAM,GACd;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAA;KAAE,GAAG,IAAI;IAwBzE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkB;IAEhD,SAAS,CAAC,QAAQ,CAAC,SAAS,gFAQzB;IAEH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,+DAAsC;IAC1E,SAAS,CAAC,QAAQ,CAAC,WAAW;;OAE1B;IAEJ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAE9D,SAAS,CAAC,QAAQ,CAAC,cAAc,sDAE/B;;yCAvES,uBAAuB;2CAAvB,uBAAuB;CA6HnC"}
@@ -1,5 +1,5 @@
1
1
  import { NgComponentOutlet } from '@angular/common';
2
- import { Component, computed, createEnvironmentInjector, effect, EnvironmentInjector, inject, signal, ChangeDetectionStrategy, } from '@angular/core';
2
+ import { Component, computed, effect, EnvironmentInjector, inject, signal, ChangeDetectionStrategy, } from '@angular/core';
3
3
  import { PrismIconComponent } from '../../icons/prism-icon.component.js';
4
4
  import { BUILTIN_PANELS } from '../builtin-panels.js';
5
5
  import { A11yAuditService } from '../a11y/a11y-audit.service.js';
@@ -115,22 +115,8 @@ export class PrismPanelHostComponent {
115
115
  activeComponent: this.nav.activeComponent(),
116
116
  }), ...(ngDevMode ? [{ debugName: "panelInputs" }] : []));
117
117
  lazyCache = new Map();
118
- injectorCache = new Map();
119
- activeInjector = computed(() => {
120
- const panelId = this.panelService.activePanelId();
121
- const panel = this.allPanels().find((p) => p.id === panelId);
122
- if (!panel?.providers?.length)
123
- return this.envInjector;
124
- if (!this.injectorCache.has(panel.id)) {
125
- this.injectorCache.set(panel.id, createEnvironmentInjector(panel.providers, this.envInjector, `PrismPanel[${panel.id}]`));
126
- }
127
- return this.injectorCache.get(panel.id);
128
- }, ...(ngDevMode ? [{ debugName: "activeInjector" }] : []));
118
+ activeInjector = computed(() => this.panelService.activePanelInjector() ?? this.envInjector, ...(ngDevMode ? [{ debugName: "activeInjector" }] : []));
129
119
  constructor() {
130
- effect(() => {
131
- const injector = this.activeInjector();
132
- this.panelService.activePanelInjector.set(injector === this.envInjector ? null : injector);
133
- });
134
120
  effect(() => {
135
121
  const element = this.rendererService.renderedElement();
136
122
  const comp = this.nav.activeComponent();
@@ -171,9 +157,6 @@ export class PrismPanelHostComponent {
171
157
  }
172
158
  });
173
159
  }
174
- ngOnDestroy() {
175
- this.injectorCache.forEach((injector) => injector.destroy());
176
- }
177
160
  static ɵfac = function PrismPanelHostComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismPanelHostComponent)(); };
178
161
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismPanelHostComponent, selectors: [["prism-panel-host"]], decls: 6, vars: 2, consts: [[1, "panel"], ["role", "tablist", 1, "panel-tabs"], ["role", "tab", 1, "p-tab", 3, "p-tab--active"], ["role", "tabpanel", 1, "panel-body", 3, "id"], ["role", "tab", 1, "p-tab", 3, "click"], [3, "name", "size"], [1, "p-tab-badge", 3, "ok", "warn", "danger"], [1, "p-tab-badge"], [4, "ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector"]], template: function PrismPanelHostComponent_Template(rf, ctx) { if (rf & 1) {
179
162
  i0.ɵɵelementStart(0, "div", 0)(1, "nav", 1);
@@ -243,4 +226,4 @@ export class PrismPanelHostComponent {
243
226
  </div>
244
227
  `, 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 :focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 2px;\n }\n "] }]
245
228
  }], () => [], null); })();
246
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismPanelHostComponent, { className: "PrismPanelHostComponent", filePath: "app/panels/panel-host/prism-panel-host.component.ts", lineNumber: 198 }); })();
229
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismPanelHostComponent, { className: "PrismPanelHostComponent", filePath: "app/panels/panel-host/prism-panel-host.component.ts", lineNumber: 196 }); })();
@@ -1 +1 @@
1
- {"version":3,"file":"provide-prism.d.ts","sourceRoot":"","sources":["../../src/app/provide-prism.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAItE,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACzC;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,oBAAoB,CAiBtB"}
1
+ {"version":3,"file":"provide-prism.d.ts","sourceRoot":"","sources":["../../src/app/provide-prism.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAStE,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACzC;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,oBAAoB,CAkBtB"}
@@ -1,13 +1,15 @@
1
1
  import { makeEnvironmentProviders } from '@angular/core';
2
2
  import { provideHighlightOptions } from 'ngx-highlightjs';
3
3
  import { componentPage } from '../plugin/page-helpers.js';
4
- import { PRISM_CONFIG, PRISM_MANIFEST } from './tokens/prism-tokens.js';
4
+ import { BUILTIN_PANELS } from './panels/builtin-panels.js';
5
+ import { PRISM_BUILTIN_PANELS, PRISM_CONFIG, PRISM_MANIFEST, } from './tokens/prism-tokens.js';
5
6
  export function providePrism(manifest, config, options) {
6
7
  const mergedManifest = options?.componentPages?.length
7
8
  ? { ...manifest, pages: [...(manifest.pages ?? []), ...options.componentPages.map(o => componentPage(o))] }
8
9
  : manifest;
9
10
  return makeEnvironmentProviders([
10
11
  { provide: PRISM_MANIFEST, useValue: mergedManifest },
12
+ { provide: PRISM_BUILTIN_PANELS, useValue: BUILTIN_PANELS },
11
13
  ...(config ? [{ provide: PRISM_CONFIG, useValue: config }] : []),
12
14
  ...(config?.appProviders ?? []),
13
15
  provideHighlightOptions({
@@ -1,9 +1,13 @@
1
1
  import { EnvironmentInjector } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class PrismPanelService {
4
+ private readonly envInjector;
5
+ private readonly pluginService;
6
+ private readonly builtinPanels;
7
+ private readonly injectorCache;
4
8
  readonly activePanelId: import("@angular/core").WritableSignal<string>;
5
9
  readonly activeViewId: import("@angular/core").WritableSignal<string>;
6
- readonly activePanelInjector: import("@angular/core").WritableSignal<EnvironmentInjector | null>;
10
+ readonly activePanelInjector: import("@angular/core").Signal<EnvironmentInjector | null>;
7
11
  static ɵfac: i0.ɵɵFactoryDeclaration<PrismPanelService, never>;
8
12
  static ɵprov: i0.ɵɵInjectableDeclaration<PrismPanelService>;
9
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prism-panel.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-panel.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAsB,MAAM,eAAe,CAAC;;AAExE,qBACa,iBAAiB;IAC5B,QAAQ,CAAC,aAAa,iDAA8B;IACpD,QAAQ,CAAC,YAAY,iDAA8B;IACnD,QAAQ,CAAC,mBAAmB,qEAA4C;yCAH7D,iBAAiB;6CAAjB,iBAAiB;CAI7B"}
1
+ {"version":3,"file":"prism-panel.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-panel.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAIpB,MAAM,eAAe,CAAC;;AAIvB,qBACa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IAExE,QAAQ,CAAC,aAAa,iDAA8B;IACpD,QAAQ,CAAC,YAAY,iDAA8B;IAEnD,QAAQ,CAAC,mBAAmB,6DAgBzB;yCAzBQ,iBAAiB;6CAAjB,iBAAiB;CA0B7B"}
@@ -1,9 +1,27 @@
1
- import { Injectable, signal } from '@angular/core';
1
+ import { computed, createEnvironmentInjector, EnvironmentInjector, inject, Injectable, signal, } from '@angular/core';
2
+ import { PRISM_BUILTIN_PANELS } from '../tokens/prism-tokens.js';
3
+ import { PrismPluginService } from './prism-plugin.service.js';
2
4
  import * as i0 from "@angular/core";
3
5
  export class PrismPanelService {
6
+ envInjector = inject(EnvironmentInjector);
7
+ pluginService = inject(PrismPluginService);
8
+ builtinPanels = inject(PRISM_BUILTIN_PANELS);
9
+ injectorCache = new Map();
4
10
  activePanelId = signal('controls', ...(ngDevMode ? [{ debugName: "activePanelId" }] : []));
5
11
  activeViewId = signal('renderer', ...(ngDevMode ? [{ debugName: "activeViewId" }] : []));
6
- activePanelInjector = signal(null, ...(ngDevMode ? [{ debugName: "activePanelInjector" }] : []));
12
+ activePanelInjector = computed(() => {
13
+ const panelId = this.activePanelId();
14
+ const allPanels = [...this.builtinPanels, ...this.pluginService.panels()];
15
+ const panel = allPanels.find((p) => p.id === panelId);
16
+ if (!panel?.providers?.length)
17
+ return null;
18
+ let injector = this.injectorCache.get(panel.id);
19
+ if (!injector) {
20
+ injector = createEnvironmentInjector(panel.providers, this.envInjector, `PrismPanel[${panel.id}]`);
21
+ this.injectorCache.set(panel.id, injector);
22
+ }
23
+ return injector;
24
+ }, ...(ngDevMode ? [{ debugName: "activePanelInjector" }] : []));
7
25
  static ɵfac = function PrismPanelService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismPanelService)(); };
8
26
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: PrismPanelService, factory: PrismPanelService.ɵfac, providedIn: 'root' });
9
27
  }
@@ -1,5 +1,5 @@
1
1
  import { InjectionToken } from '@angular/core';
2
- import type { NgPrismConfig, RuntimeManifest } from '../../plugin/plugin.types.js';
2
+ import type { NgPrismConfig, PanelDefinition, RuntimeManifest } from '../../plugin/plugin.types.js';
3
3
  export declare const PRISM_MANIFEST: InjectionToken<RuntimeManifest>;
4
4
  export declare const PRISM_CONFIG: InjectionToken<NgPrismConfig>;
5
5
  export interface PrismRendererHooks {
@@ -8,4 +8,5 @@ export interface PrismRendererHooks {
8
8
  onAfterDestroy?(selector: string): void;
9
9
  }
10
10
  export declare const PRISM_RENDERER_HOOKS: InjectionToken<PrismRendererHooks>;
11
+ export declare const PRISM_BUILTIN_PANELS: InjectionToken<PanelDefinition[]>;
11
12
  //# sourceMappingURL=prism-tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prism-tokens.d.ts","sourceRoot":"","sources":["../../../src/app/tokens/prism-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,eAAO,MAAM,cAAc,iCAAwD,CAAC;AAEpF,eAAO,MAAM,YAAY,+BAGvB,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,aAAa,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,oBAAoB,oCAC+B,CAAC"}
1
+ {"version":3,"file":"prism-tokens.d.ts","sourceRoot":"","sources":["../../../src/app/tokens/prism-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,cAAc,iCAAwD,CAAC;AAEpF,eAAO,MAAM,YAAY,+BAGvB,CAAC;AAEH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,aAAa,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,cAAc,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,oBAAoB,oCAC+B,CAAC;AAEjE,eAAO,MAAM,oBAAoB,mCAGhC,CAAC"}
@@ -5,3 +5,4 @@ export const PRISM_CONFIG = new InjectionToken('PRISM_CONFIG', {
5
5
  factory: () => ({}),
6
6
  });
7
7
  export const PRISM_RENDERER_HOOKS = new InjectionToken('PRISM_RENDERER_HOOKS');
8
+ export const PRISM_BUILTIN_PANELS = new InjectionToken('PRISM_BUILTIN_PANELS', { providedIn: 'root', factory: () => [] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-prism/core",
3
- "version": "21.9.0",
3
+ "version": "21.9.1",
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",