@ng-prism/core 22.0.1 → 22.1.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/dist/app/controls/json-control.component.d.ts +2 -1
- package/dist/app/controls/json-control.component.d.ts.map +1 -1
- package/dist/app/controls/json-control.component.js +17 -11
- package/dist/app/panels/controls/non-editable-input-types.d.ts +3 -0
- package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -0
- package/dist/app/panels/controls/non-editable-input-types.js +20 -0
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts +1 -0
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
- package/dist/app/panels/controls/prism-controls-panel.component.js +54 -33
- package/dist/app/renderer/known-inputs.d.ts +9 -0
- package/dist/app/renderer/known-inputs.d.ts.map +1 -0
- package/dist/app/renderer/known-inputs.js +13 -0
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +4 -3
- package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
- package/dist/app/renderer/snippet-generator.js +12 -4
- package/dist/app/services/prism-navigation.service.d.ts +13 -2
- package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
- package/dist/app/services/prism-navigation.service.js +79 -44
- package/dist/app/sidebar/prism-sidebar.component.d.ts +11 -3
- package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
- package/dist/app/sidebar/prism-sidebar.component.js +101 -86
- package/dist/builder/manifest/host-parser.d.ts +1 -0
- package/dist/builder/manifest/host-parser.d.ts.map +1 -1
- package/dist/builder/manifest/host-parser.js +17 -6
- package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.js +3 -1
- package/dist/builder/scanner/component.scanner.js +5 -0
- package/dist/decorator/showcase.types.d.ts +12 -0
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
+
export declare function highlightJson(json: unknown): string;
|
|
3
|
+
export declare function stringifyForJsonControl(val: unknown): string;
|
|
2
4
|
export declare class JsonControlComponent {
|
|
3
5
|
readonly value: import("@angular/core").InputSignal<unknown>;
|
|
4
6
|
readonly label: import("@angular/core").InputSignal<string>;
|
|
@@ -10,7 +12,6 @@ export declare class JsonControlComponent {
|
|
|
10
12
|
private readonly preEl;
|
|
11
13
|
readonly displayText: import("@angular/core").Signal<string>;
|
|
12
14
|
readonly highlightedHtml: import("@angular/core").Signal<string>;
|
|
13
|
-
stringify(val: unknown): string;
|
|
14
15
|
onInput(raw: string): void;
|
|
15
16
|
syncScroll(): void;
|
|
16
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<JsonControlComponent, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-control.component.d.ts","sourceRoot":"","sources":["../../../src/app/controls/json-control.component.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"json-control.component.d.ts","sourceRoot":"","sources":["../../../src/app/controls/json-control.component.ts"],"names":[],"mappings":";AAWA,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAanD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAU5D;AAED,qBAuFa,oBAAoB;IAC/B,QAAQ,CAAC,KAAK,+CAAwB;IACtC,QAAQ,CAAC,KAAK,8CAAa;IAC3B,QAAQ,CAAC,QAAQ,8CAAa;IAC9B,QAAQ,CAAC,WAAW,oDAAqB;IAEzC,QAAQ,CAAC,UAAU,kDAAiB;IACpC,QAAQ,CAAC,SAAS,wDAA+B;IAEjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CACgC;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkD;IAExE,QAAQ,CAAC,WAAW,yCAIjB;IAEH,QAAQ,CAAC,eAAe,yCAAqD;IAE7E,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAW1B,UAAU,IAAI,IAAI;yCAhCP,oBAAoB;2CAApB,oBAAoB;CAwChC"}
|
|
@@ -7,7 +7,9 @@ function JsonControlComponent_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
|
7
7
|
i0.ɵɵtext(1, "Invalid JSON");
|
|
8
8
|
i0.ɵɵdomElementEnd();
|
|
9
9
|
} }
|
|
10
|
-
function highlightJson(json) {
|
|
10
|
+
export function highlightJson(json) {
|
|
11
|
+
if (typeof json !== 'string')
|
|
12
|
+
return '';
|
|
11
13
|
return json.replace(/("(?:\\.|[^"\\])*")\s*(:)|("(?:\\.|[^"\\])*")|(true|false)|(null)|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g, (match, key, colon, str, bool, nil, num) => {
|
|
12
14
|
if (key && colon)
|
|
13
15
|
return `<span class="jh-key">${key}</span>${colon}`;
|
|
@@ -22,6 +24,18 @@ function highlightJson(json) {
|
|
|
22
24
|
return match;
|
|
23
25
|
});
|
|
24
26
|
}
|
|
27
|
+
export function stringifyForJsonControl(val) {
|
|
28
|
+
try {
|
|
29
|
+
const serialized = JSON.stringify(val, null, 2);
|
|
30
|
+
// JSON.stringify returns `undefined` (the value, not a string) for
|
|
31
|
+
// `undefined`, functions, and symbols. Surface that as visible text so the
|
|
32
|
+
// textarea + highlighter never see a non-string.
|
|
33
|
+
return serialized ?? 'undefined';
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return String(val);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
25
39
|
export class JsonControlComponent {
|
|
26
40
|
value = input(null, /* @ts-ignore */
|
|
27
41
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
@@ -42,19 +56,11 @@ export class JsonControlComponent {
|
|
|
42
56
|
const local = this.localText();
|
|
43
57
|
if (local !== null)
|
|
44
58
|
return local;
|
|
45
|
-
return
|
|
59
|
+
return stringifyForJsonControl(this.value());
|
|
46
60
|
}, /* @ts-ignore */
|
|
47
61
|
...(ngDevMode ? [{ debugName: "displayText" }] : /* istanbul ignore next */ []));
|
|
48
62
|
highlightedHtml = computed(() => highlightJson(this.displayText()), /* @ts-ignore */
|
|
49
63
|
...(ngDevMode ? [{ debugName: "highlightedHtml" }] : /* istanbul ignore next */ []));
|
|
50
|
-
stringify(val) {
|
|
51
|
-
try {
|
|
52
|
-
return JSON.stringify(val, null, 2);
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
return String(val);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
64
|
onInput(raw) {
|
|
59
65
|
this.localText.set(raw);
|
|
60
66
|
try {
|
|
@@ -121,4 +127,4 @@ export class JsonControlComponent {
|
|
|
121
127
|
</div>
|
|
122
128
|
`, styles: ["\n .json-editor { flex: 1; min-width: 0; }\n\n .json-overlay {\n position: relative;\n border: 1px solid var(--prism-border);\n border-radius: var(--radius-sm);\n overflow: hidden;\n transition: border-color var(--dur-fast);\n }\n .json-overlay:focus-within {\n border-color: var(--prism-primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--prism-primary) 30%, transparent);\n }\n\n .json-pre, .json-input {\n margin: 0;\n padding: 4px 8px;\n font-family: var(--font-mono);\n font-size: 12px;\n line-height: 1.4;\n white-space: pre-wrap;\n word-wrap: break-word;\n tab-size: 2;\n }\n\n .json-pre {\n min-height: 56px;\n pointer-events: none;\n }\n .json-pre code { font-family: inherit; }\n\n :host ::ng-deep .jh-key { color: var(--prism-code-attr); }\n :host ::ng-deep .jh-string { color: var(--prism-code-str); }\n :host ::ng-deep .jh-number { color: var(--prism-warn); }\n :host ::ng-deep .jh-bool { color: var(--prism-primary); }\n :host ::ng-deep .jh-null { color: var(--prism-text-ghost); }\n\n .json-input {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n background: transparent;\n color: transparent;\n caret-color: var(--prism-text);\n border: none;\n resize: none;\n overflow: auto;\n box-sizing: border-box;\n }\n .json-input:focus { outline: none; }\n .json-input::selection { background: rgba(99, 102, 241, 0.3); }\n\n .json-error {\n font-size: 11px;\n color: var(--prism-danger);\n display: block;\n margin-top: 2px;\n }\n "] }]
|
|
123
129
|
}], null, { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], typeName: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeName", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], textareaEl: [{ type: i0.ViewChild, args: ['textareaEl', { isSignal: true }] }], preEl: [{ type: i0.ViewChild, args: ['preEl', { isSignal: true }] }] }); })();
|
|
124
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(JsonControlComponent, { className: "JsonControlComponent", filePath: "app/controls/json-control.component.ts", lineNumber:
|
|
130
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(JsonControlComponent, { className: "JsonControlComponent", filePath: "app/controls/json-control.component.ts", lineNumber: 126 }); })();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-editable-input-types.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/controls/non-editable-input-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAoBjE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAIhE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular framework reference types that aren't meaningfully editable via
|
|
3
|
+
* a JSON textarea (they wrap live framework objects, not data). When a
|
|
4
|
+
* showcased component declares an input of one of these types, the controls
|
|
5
|
+
* panel renders a "Not editable" placeholder instead of routing it through
|
|
6
|
+
* the JsonControl — which would otherwise crash on `undefined`/non-serializable
|
|
7
|
+
* defaults and presents a misleading editor to the developer anyway.
|
|
8
|
+
*/
|
|
9
|
+
const NON_EDITABLE_TYPE_NAMES = [
|
|
10
|
+
'TemplateRef',
|
|
11
|
+
'ElementRef',
|
|
12
|
+
'ViewContainerRef',
|
|
13
|
+
];
|
|
14
|
+
const NON_EDITABLE_TYPE_PATTERN = new RegExp(`\\b(?:${NON_EDITABLE_TYPE_NAMES.join('|')})\\b`);
|
|
15
|
+
export function isNonEditableInputType(input) {
|
|
16
|
+
const raw = input.rawType;
|
|
17
|
+
if (!raw)
|
|
18
|
+
return false;
|
|
19
|
+
return NON_EDITABLE_TYPE_PATTERN.test(raw);
|
|
20
|
+
}
|
|
@@ -8,6 +8,7 @@ export declare class PrismControlsPanelComponent {
|
|
|
8
8
|
private readonly pluginService;
|
|
9
9
|
readonly activeComponent: import("@angular/core").InputSignal<RuntimeComponent | null>;
|
|
10
10
|
protected getCustomControl(input: InputMeta): ControlDefinition | null;
|
|
11
|
+
protected isNonEditable(input: InputMeta): boolean;
|
|
11
12
|
protected asBoolean(val: unknown): boolean;
|
|
12
13
|
protected asNumber(val: unknown): number;
|
|
13
14
|
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":"
|
|
1
|
+
{"version":3,"file":"prism-controls-panel.component.d.ts","sourceRoot":"","sources":["../../../../src/app/panels/controls/prism-controls-panel.component.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;;AAGhF,qBA2Ma,2BAA2B;IACtC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;IACtE,SAAS,CAAC,QAAQ,CAAC,eAAe,uBAAgC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAE5D,QAAQ,CAAC,eAAe,+DAAwC;IAEhE,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,GAAG,IAAI;IAOtE,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIlD,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;yCA1B7B,2BAA2B;2CAA3B,2BAA2B;CA6BvC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NgComponentOutlet } from '@angular/common';
|
|
2
|
-
import { Component, inject, input, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { Component, inject, input, ChangeDetectionStrategy, } from '@angular/core';
|
|
3
3
|
import { BooleanControlComponent } from '../../controls/boolean-control.component.js';
|
|
4
4
|
import { JsonControlComponent } from '../../controls/json-control.component.js';
|
|
5
5
|
import { NumberControlComponent } from '../../controls/number-control.component.js';
|
|
@@ -8,6 +8,7 @@ import { UnionControlComponent } from '../../controls/union-control.component.js
|
|
|
8
8
|
import { PrismNavigationService } from '../../services/prism-navigation.service.js';
|
|
9
9
|
import { PrismPluginService } from '../../services/prism-plugin.service.js';
|
|
10
10
|
import { PrismRendererService } from '../../services/prism-renderer.service.js';
|
|
11
|
+
import { isNonEditableInputType } from './non-editable-input-types.js';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
const _c0 = (a0, a1) => ({ inputMeta: a0, rendererService: a1 });
|
|
13
14
|
const _c1 = () => [];
|
|
@@ -37,56 +38,68 @@ function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_1_Template(
|
|
|
37
38
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
38
39
|
i0.ɵɵproperty("ngComponentOutlet", ctx.component)("ngComponentOutletInputs", i0.ɵɵpureFunction2(2, _c0, input_r4, ctx_r1.rendererService));
|
|
39
40
|
} }
|
|
40
|
-
function
|
|
41
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
42
|
+
i0.ɵɵelementStart(0, "span", 13);
|
|
43
|
+
i0.ɵɵtext(1, "Not editable");
|
|
44
|
+
i0.ɵɵelementEnd();
|
|
45
|
+
} }
|
|
46
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_0_Template(rf, ctx) { if (rf & 1) {
|
|
41
47
|
const _r5 = i0.ɵɵgetCurrentView();
|
|
42
|
-
i0.ɵɵelementStart(0, "prism-boolean-control",
|
|
43
|
-
i0.ɵɵlistener("valueChange", function
|
|
48
|
+
i0.ɵɵelementStart(0, "prism-boolean-control", 16);
|
|
49
|
+
i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_0_Template_prism_boolean_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r5); const input_r4 = i0.ɵɵnextContext(3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r4.name, $event)); });
|
|
44
50
|
i0.ɵɵelementEnd();
|
|
45
51
|
} if (rf & 2) {
|
|
46
|
-
const input_r4 = i0.ɵɵnextContext(
|
|
52
|
+
const input_r4 = i0.ɵɵnextContext(3).$implicit;
|
|
47
53
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
48
54
|
i0.ɵɵproperty("value", ctx_r1.asBoolean(ctx_r1.rendererService.inputValues()[input_r4.name]));
|
|
49
55
|
} }
|
|
50
|
-
function
|
|
56
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_1_Template(rf, ctx) { if (rf & 1) {
|
|
51
57
|
const _r6 = i0.ɵɵgetCurrentView();
|
|
52
|
-
i0.ɵɵelementStart(0, "prism-number-control",
|
|
53
|
-
i0.ɵɵlistener("valueChange", function
|
|
58
|
+
i0.ɵɵelementStart(0, "prism-number-control", 16);
|
|
59
|
+
i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_1_Template_prism_number_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const input_r4 = i0.ɵɵnextContext(3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r4.name, $event)); });
|
|
54
60
|
i0.ɵɵelementEnd();
|
|
55
61
|
} if (rf & 2) {
|
|
56
|
-
const input_r4 = i0.ɵɵnextContext(
|
|
62
|
+
const input_r4 = i0.ɵɵnextContext(3).$implicit;
|
|
57
63
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
58
64
|
i0.ɵɵproperty("value", ctx_r1.asNumber(ctx_r1.rendererService.inputValues()[input_r4.name]));
|
|
59
65
|
} }
|
|
60
|
-
function
|
|
66
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_2_Template(rf, ctx) { if (rf & 1) {
|
|
61
67
|
const _r7 = i0.ɵɵgetCurrentView();
|
|
62
|
-
i0.ɵɵelementStart(0, "prism-union-control",
|
|
63
|
-
i0.ɵɵlistener("valueChange", function
|
|
68
|
+
i0.ɵɵelementStart(0, "prism-union-control", 17);
|
|
69
|
+
i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_2_Template_prism_union_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const input_r4 = i0.ɵɵnextContext(3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r4.name, $event)); });
|
|
64
70
|
i0.ɵɵelementEnd();
|
|
65
71
|
} if (rf & 2) {
|
|
66
|
-
const input_r4 = i0.ɵɵnextContext(
|
|
72
|
+
const input_r4 = i0.ɵɵnextContext(3).$implicit;
|
|
67
73
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
68
74
|
i0.ɵɵproperty("value", ctx_r1.asString(ctx_r1.rendererService.inputValues()[input_r4.name]))("options", input_r4.values ?? i0.ɵɵpureFunction0(2, _c1));
|
|
69
75
|
} }
|
|
70
|
-
function
|
|
76
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_3_Template(rf, ctx) { if (rf & 1) {
|
|
71
77
|
const _r8 = i0.ɵɵgetCurrentView();
|
|
72
|
-
i0.ɵɵelementStart(0, "prism-string-control",
|
|
73
|
-
i0.ɵɵlistener("valueChange", function
|
|
78
|
+
i0.ɵɵelementStart(0, "prism-string-control", 16);
|
|
79
|
+
i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_3_Template_prism_string_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r8); const input_r4 = i0.ɵɵnextContext(3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r4.name, $event)); });
|
|
74
80
|
i0.ɵɵelementEnd();
|
|
75
81
|
} if (rf & 2) {
|
|
76
|
-
const input_r4 = i0.ɵɵnextContext(
|
|
82
|
+
const input_r4 = i0.ɵɵnextContext(3).$implicit;
|
|
77
83
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
78
84
|
i0.ɵɵproperty("value", ctx_r1.asString(ctx_r1.rendererService.inputValues()[input_r4.name]));
|
|
79
85
|
} }
|
|
80
|
-
function
|
|
86
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_4_Template(rf, ctx) { if (rf & 1) {
|
|
81
87
|
const _r9 = i0.ɵɵgetCurrentView();
|
|
82
|
-
i0.ɵɵelementStart(0, "prism-json-control",
|
|
83
|
-
i0.ɵɵlistener("valueChange", function
|
|
88
|
+
i0.ɵɵelementStart(0, "prism-json-control", 16);
|
|
89
|
+
i0.ɵɵlistener("valueChange", function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_4_Template_prism_json_control_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r9); const input_r4 = i0.ɵɵnextContext(3).$implicit; const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.rendererService.updateInput(input_r4.name, $event)); });
|
|
84
90
|
i0.ɵɵelementEnd();
|
|
85
91
|
} if (rf & 2) {
|
|
86
|
-
const input_r4 = i0.ɵɵnextContext(
|
|
92
|
+
const input_r4 = i0.ɵɵnextContext(3).$implicit;
|
|
87
93
|
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
88
94
|
i0.ɵɵproperty("value", ctx_r1.rendererService.inputValues()[input_r4.name]);
|
|
89
95
|
} }
|
|
96
|
+
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
97
|
+
i0.ɵɵconditionalCreate(0, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_0_Template, 1, 1, "prism-boolean-control", 14)(1, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_1_Template, 1, 1, "prism-number-control", 14)(2, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_2_Template, 1, 3, "prism-union-control", 15)(3, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_3_Template, 1, 1, "prism-string-control", 14)(4, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Case_4_Template, 1, 1, "prism-json-control", 14);
|
|
98
|
+
} if (rf & 2) {
|
|
99
|
+
let tmp_14_0;
|
|
100
|
+
const input_r4 = i0.ɵɵnextContext(2).$implicit;
|
|
101
|
+
i0.ɵɵconditional((tmp_14_0 = input_r4.type) === "boolean" ? 0 : tmp_14_0 === "number" ? 1 : tmp_14_0 === "union" ? 2 : tmp_14_0 === "string" ? 3 : 4);
|
|
102
|
+
} }
|
|
90
103
|
function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
91
104
|
i0.ɵɵelementStart(0, "div", 9)(1, "span", 10);
|
|
92
105
|
i0.ɵɵtext(2);
|
|
@@ -95,21 +108,21 @@ function PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Template(
|
|
|
95
108
|
i0.ɵɵtext(5);
|
|
96
109
|
i0.ɵɵelementEnd()()();
|
|
97
110
|
i0.ɵɵelementStart(6, "div", 12);
|
|
98
|
-
i0.ɵɵconditionalCreate(7,
|
|
111
|
+
i0.ɵɵconditionalCreate(7, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_7_Template, 2, 0, "span", 13)(8, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Conditional_8_Template, 5, 1);
|
|
99
112
|
i0.ɵɵelementEnd();
|
|
100
113
|
} if (rf & 2) {
|
|
101
|
-
let tmp_15_0;
|
|
102
114
|
const input_r4 = i0.ɵɵnextContext().$implicit;
|
|
115
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
103
116
|
i0.ɵɵadvance(2);
|
|
104
117
|
i0.ɵɵtextInterpolate(input_r4.name);
|
|
105
118
|
i0.ɵɵadvance(3);
|
|
106
119
|
i0.ɵɵtextInterpolate(input_r4.rawType ?? input_r4.type);
|
|
107
120
|
i0.ɵɵadvance(2);
|
|
108
|
-
i0.ɵɵconditional((
|
|
121
|
+
i0.ɵɵconditional(ctx_r1.isNonEditable(input_r4) ? 7 : 8);
|
|
109
122
|
} }
|
|
110
123
|
function PrismControlsPanelComponent_Conditional_0_For_3_Template(rf, ctx) { if (rf & 1) {
|
|
111
124
|
i0.ɵɵelementStart(0, "div", 2);
|
|
112
|
-
i0.ɵɵconditionalCreate(1, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_1_Template, 1, 5, "ng-container", 8)(2, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Template,
|
|
125
|
+
i0.ɵɵconditionalCreate(1, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_1_Template, 1, 5, "ng-container", 8)(2, PrismControlsPanelComponent_Conditional_0_For_3_Conditional_2_Template, 9, 3);
|
|
113
126
|
i0.ɵɵelementEnd();
|
|
114
127
|
} if (rf & 2) {
|
|
115
128
|
let tmp_12_0;
|
|
@@ -150,6 +163,9 @@ export class PrismControlsPanelComponent {
|
|
|
150
163
|
return (this.pluginService.controls().find((ctrl) => ctrl.matchType(input)) ??
|
|
151
164
|
null);
|
|
152
165
|
}
|
|
166
|
+
isNonEditable(input) {
|
|
167
|
+
return isNonEditableInputType(input);
|
|
168
|
+
}
|
|
153
169
|
asBoolean(val) {
|
|
154
170
|
return Boolean(val);
|
|
155
171
|
}
|
|
@@ -160,7 +176,7 @@ export class PrismControlsPanelComponent {
|
|
|
160
176
|
return String(val ?? '');
|
|
161
177
|
}
|
|
162
178
|
static ɵfac = function PrismControlsPanelComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismControlsPanelComponent)(); };
|
|
163
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismControlsPanelComponent, selectors: [["prism-controls-panel"]], inputs: { activeComponent: [1, "activeComponent"] }, decls: 1, vars: 1, consts: [[1, "ctl-panel"], [1, "ctl-toolbar"], [1, "ctl-row"], [1, "ctl-empty"], [1, "ctl-dirty-info"], ["aria-hidden", "true", 1, "ctl-dirty-dot"], ["type", "button", "title", "Reset all inputs to variant defaults", 1, "ctl-reset-btn", 3, "click"], ["aria-hidden", "true"], [3, "ngComponentOutlet", "ngComponentOutletInputs"], [1, "ctl-label"], [1, "ctl-name"], [1, "ctl-type"], [1, "ctl-input"], [3, "value"], [3, "value", "options"], [3, "valueChange", "value"], [3, "valueChange", "value", "options"]], template: function PrismControlsPanelComponent_Template(rf, ctx) { if (rf & 1) {
|
|
179
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismControlsPanelComponent, selectors: [["prism-controls-panel"]], inputs: { activeComponent: [1, "activeComponent"] }, decls: 1, vars: 1, consts: [[1, "ctl-panel"], [1, "ctl-toolbar"], [1, "ctl-row"], [1, "ctl-empty"], [1, "ctl-dirty-info"], ["aria-hidden", "true", 1, "ctl-dirty-dot"], ["type", "button", "title", "Reset all inputs to variant defaults", 1, "ctl-reset-btn", 3, "click"], ["aria-hidden", "true"], [3, "ngComponentOutlet", "ngComponentOutletInputs"], [1, "ctl-label"], [1, "ctl-name"], [1, "ctl-type"], [1, "ctl-input"], ["title", "This input type can't be edited from the controls panel", 1, "ctl-not-editable"], [3, "value"], [3, "value", "options"], [3, "valueChange", "value"], [3, "valueChange", "value", "options"]], template: function PrismControlsPanelComponent_Template(rf, ctx) { if (rf & 1) {
|
|
164
180
|
i0.ɵɵconditionalCreate(0, PrismControlsPanelComponent_Conditional_0_Template, 5, 2, "div", 0);
|
|
165
181
|
} if (rf & 2) {
|
|
166
182
|
let tmp_0_0;
|
|
@@ -170,7 +186,7 @@ export class PrismControlsPanelComponent {
|
|
|
170
186
|
StringControlComponent,
|
|
171
187
|
NumberControlComponent,
|
|
172
188
|
UnionControlComponent,
|
|
173
|
-
JsonControlComponent], styles: [".ctl-panel[_ngcontent-%COMP%] {\n overflow-y: auto;\n height: 100%;\n }\n\n .ctl-toolbar[_ngcontent-%COMP%] {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 20px;\n background: var(--prism-bg-elevated);\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-dirty-info[_ngcontent-%COMP%] {\n font-size: 11.5px;\n font-family: var(--font-mono);\n color: var(--prism-text-muted);\n display: inline-flex;\n align-items: center;\n gap: 6px;\n }\n .ctl-dirty-dot[_ngcontent-%COMP%] {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--prism-primary);\n box-shadow: 0 0 6px color-mix(in srgb, var(--prism-primary) 60%, transparent);\n }\n .ctl-reset-btn[_ngcontent-%COMP%] {\n height: 24px;\n padding: 0 10px;\n border-radius: 5px;\n font-size: 11.5px;\n font-weight: 500;\n font-family: var(--font-sans);\n color: var(--prism-text-muted);\n background: transparent;\n border: 1px solid var(--prism-border);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);\n }\n .ctl-reset-btn[_ngcontent-%COMP%]:hover {\n color: var(--prism-text);\n border-color: color-mix(in srgb, var(--prism-primary) 40%, var(--prism-border));\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .ctl-reset-btn[_ngcontent-%COMP%]:focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n }\n\n .ctl-row[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: 180px 1fr;\n align-items: center;\n gap: 12px;\n padding: 8px 20px;\n min-height: 40px;\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-row[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--prism-primary) 3%, transparent);\n }\n\n .ctl-label[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .ctl-name[_ngcontent-%COMP%] {\n font-size: 13px;\n color: var(--prism-text);\n font-weight: 500;\n }\n .ctl-type[_ngcontent-%COMP%] {\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--prism-text-ghost);\n }\n .ctl-type[_ngcontent-%COMP%] b[_ngcontent-%COMP%] {\n color: var(--prism-primary);\n font-weight: 500;\n }\n\n .ctl-input[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n }\n\n .ctl-empty[_ngcontent-%COMP%] {\n color: var(--prism-text-ghost);\n font-size: 13px;\n margin: 0;\n padding: 16px 20px;\n }"] });
|
|
189
|
+
JsonControlComponent], styles: [".ctl-panel[_ngcontent-%COMP%] {\n overflow-y: auto;\n height: 100%;\n }\n\n .ctl-toolbar[_ngcontent-%COMP%] {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 20px;\n background: var(--prism-bg-elevated);\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-dirty-info[_ngcontent-%COMP%] {\n font-size: 11.5px;\n font-family: var(--font-mono);\n color: var(--prism-text-muted);\n display: inline-flex;\n align-items: center;\n gap: 6px;\n }\n .ctl-dirty-dot[_ngcontent-%COMP%] {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--prism-primary);\n box-shadow: 0 0 6px color-mix(in srgb, var(--prism-primary) 60%, transparent);\n }\n .ctl-reset-btn[_ngcontent-%COMP%] {\n height: 24px;\n padding: 0 10px;\n border-radius: 5px;\n font-size: 11.5px;\n font-weight: 500;\n font-family: var(--font-sans);\n color: var(--prism-text-muted);\n background: transparent;\n border: 1px solid var(--prism-border);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);\n }\n .ctl-reset-btn[_ngcontent-%COMP%]:hover {\n color: var(--prism-text);\n border-color: color-mix(in srgb, var(--prism-primary) 40%, var(--prism-border));\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .ctl-reset-btn[_ngcontent-%COMP%]:focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n }\n\n .ctl-row[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: 180px 1fr;\n align-items: center;\n gap: 12px;\n padding: 8px 20px;\n min-height: 40px;\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-row[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--prism-primary) 3%, transparent);\n }\n\n .ctl-label[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .ctl-name[_ngcontent-%COMP%] {\n font-size: 13px;\n color: var(--prism-text);\n font-weight: 500;\n }\n .ctl-type[_ngcontent-%COMP%] {\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--prism-text-ghost);\n }\n .ctl-type[_ngcontent-%COMP%] b[_ngcontent-%COMP%] {\n color: var(--prism-primary);\n font-weight: 500;\n }\n\n .ctl-input[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n }\n\n .ctl-not-editable[_ngcontent-%COMP%] {\n font-family: var(--font-mono);\n font-size: 11.5px;\n color: var(--prism-text-ghost);\n font-style: italic;\n }\n\n .ctl-empty[_ngcontent-%COMP%] {\n color: var(--prism-text-ghost);\n font-size: 13px;\n margin: 0;\n padding: 16px 20px;\n }"] });
|
|
174
190
|
}
|
|
175
191
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismControlsPanelComponent, [{
|
|
176
192
|
type: Component,
|
|
@@ -199,8 +215,7 @@ export class PrismControlsPanelComponent {
|
|
|
199
215
|
<span aria-hidden="true">↻</span> Reset
|
|
200
216
|
</button>
|
|
201
217
|
</div>
|
|
202
|
-
}
|
|
203
|
-
@for (input of comp.meta.inputs; track input.name) {
|
|
218
|
+
} @for (input of comp.meta.inputs; track input.name) {
|
|
204
219
|
<div class="ctl-row">
|
|
205
220
|
@if (getCustomControl(input); as customCtrl) {
|
|
206
221
|
<ng-container
|
|
@@ -218,7 +233,13 @@ export class PrismControlsPanelComponent {
|
|
|
218
233
|
>
|
|
219
234
|
</div>
|
|
220
235
|
<div class="ctl-input">
|
|
221
|
-
@
|
|
236
|
+
@if (isNonEditable(input)) {
|
|
237
|
+
<span
|
|
238
|
+
class="ctl-not-editable"
|
|
239
|
+
title="This input type can't be edited from the controls panel"
|
|
240
|
+
>Not editable</span
|
|
241
|
+
>
|
|
242
|
+
} @else { @switch (input.type) { @case ('boolean') {
|
|
222
243
|
<prism-boolean-control
|
|
223
244
|
[value]="asBoolean(rendererService.inputValues()[input.name])"
|
|
224
245
|
(valueChange)="rendererService.updateInput(input.name, $event)"
|
|
@@ -244,7 +265,7 @@ export class PrismControlsPanelComponent {
|
|
|
244
265
|
[value]="rendererService.inputValues()[input.name]"
|
|
245
266
|
(valueChange)="rendererService.updateInput(input.name, $event)"
|
|
246
267
|
/>
|
|
247
|
-
} }
|
|
268
|
+
} } }
|
|
248
269
|
</div>
|
|
249
270
|
}
|
|
250
271
|
</div>
|
|
@@ -253,6 +274,6 @@ export class PrismControlsPanelComponent {
|
|
|
253
274
|
}
|
|
254
275
|
</div>
|
|
255
276
|
}
|
|
256
|
-
`, styles: ["\n .ctl-panel {\n overflow-y: auto;\n height: 100%;\n }\n\n .ctl-toolbar {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 20px;\n background: var(--prism-bg-elevated);\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-dirty-info {\n font-size: 11.5px;\n font-family: var(--font-mono);\n color: var(--prism-text-muted);\n display: inline-flex;\n align-items: center;\n gap: 6px;\n }\n .ctl-dirty-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--prism-primary);\n box-shadow: 0 0 6px color-mix(in srgb, var(--prism-primary) 60%, transparent);\n }\n .ctl-reset-btn {\n height: 24px;\n padding: 0 10px;\n border-radius: 5px;\n font-size: 11.5px;\n font-weight: 500;\n font-family: var(--font-sans);\n color: var(--prism-text-muted);\n background: transparent;\n border: 1px solid var(--prism-border);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);\n }\n .ctl-reset-btn:hover {\n color: var(--prism-text);\n border-color: color-mix(in srgb, var(--prism-primary) 40%, var(--prism-border));\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .ctl-reset-btn:focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n }\n\n .ctl-row {\n display: grid;\n grid-template-columns: 180px 1fr;\n align-items: center;\n gap: 12px;\n padding: 8px 20px;\n min-height: 40px;\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-row:hover {\n background: color-mix(in srgb, var(--prism-primary) 3%, transparent);\n }\n\n .ctl-label {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .ctl-name {\n font-size: 13px;\n color: var(--prism-text);\n font-weight: 500;\n }\n .ctl-type {\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--prism-text-ghost);\n }\n .ctl-type b {\n color: var(--prism-primary);\n font-weight: 500;\n }\n\n .ctl-input {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n }\n\n .ctl-empty {\n color: var(--prism-text-ghost);\n font-size: 13px;\n margin: 0;\n padding: 16px 20px;\n }\n "] }]
|
|
277
|
+
`, styles: ["\n .ctl-panel {\n overflow-y: auto;\n height: 100%;\n }\n\n .ctl-toolbar {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 20px;\n background: var(--prism-bg-elevated);\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-dirty-info {\n font-size: 11.5px;\n font-family: var(--font-mono);\n color: var(--prism-text-muted);\n display: inline-flex;\n align-items: center;\n gap: 6px;\n }\n .ctl-dirty-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--prism-primary);\n box-shadow: 0 0 6px color-mix(in srgb, var(--prism-primary) 60%, transparent);\n }\n .ctl-reset-btn {\n height: 24px;\n padding: 0 10px;\n border-radius: 5px;\n font-size: 11.5px;\n font-weight: 500;\n font-family: var(--font-sans);\n color: var(--prism-text-muted);\n background: transparent;\n border: 1px solid var(--prism-border);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);\n }\n .ctl-reset-btn:hover {\n color: var(--prism-text);\n border-color: color-mix(in srgb, var(--prism-primary) 40%, var(--prism-border));\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .ctl-reset-btn:focus-visible {\n outline: 2px solid var(--prism-primary);\n outline-offset: 1px;\n }\n\n .ctl-row {\n display: grid;\n grid-template-columns: 180px 1fr;\n align-items: center;\n gap: 12px;\n padding: 8px 20px;\n min-height: 40px;\n border-bottom: 1px solid var(--prism-border);\n }\n .ctl-row:hover {\n background: color-mix(in srgb, var(--prism-primary) 3%, transparent);\n }\n\n .ctl-label {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .ctl-name {\n font-size: 13px;\n color: var(--prism-text);\n font-weight: 500;\n }\n .ctl-type {\n font-family: var(--font-mono);\n font-size: 10.5px;\n color: var(--prism-text-ghost);\n }\n .ctl-type b {\n color: var(--prism-primary);\n font-weight: 500;\n }\n\n .ctl-input {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n }\n\n .ctl-not-editable {\n font-family: var(--font-mono);\n font-size: 11.5px;\n color: var(--prism-text-ghost);\n font-style: italic;\n }\n\n .ctl-empty {\n color: var(--prism-text-ghost);\n font-size: 13px;\n margin: 0;\n padding: 16px 20px;\n }\n "] }]
|
|
257
278
|
}], null, { activeComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeComponent", required: false }] }] }); })();
|
|
258
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismControlsPanelComponent, { className: "PrismControlsPanelComponent", filePath: "app/panels/controls/prism-controls-panel.component.ts", lineNumber:
|
|
279
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismControlsPanelComponent, { className: "PrismControlsPanelComponent", filePath: "app/panels/controls/prism-controls-panel.component.ts", lineNumber: 226 }); })();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RuntimeComponent } from '../../plugin/plugin.types.js';
|
|
2
|
+
/** Synthetic input the manifest generator emits on directive wrapper classes
|
|
3
|
+
* to project per-variant `content` text into the host element. The directive
|
|
4
|
+
* itself doesn't declare it, so it isn't in `meta.inputs` — code that
|
|
5
|
+
* validates / filters inputs against that list must allow this key through.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PRISM_CONTENT_INPUT = "__prismContent__";
|
|
8
|
+
export declare function buildKnownInputs(comp: RuntimeComponent): Set<string>;
|
|
9
|
+
//# sourceMappingURL=known-inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-inputs.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/known-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,CAMpE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Synthetic input the manifest generator emits on directive wrapper classes
|
|
2
|
+
* to project per-variant `content` text into the host element. The directive
|
|
3
|
+
* itself doesn't declare it, so it isn't in `meta.inputs` — code that
|
|
4
|
+
* validates / filters inputs against that list must allow this key through.
|
|
5
|
+
*/
|
|
6
|
+
export const PRISM_CONTENT_INPUT = '__prismContent__';
|
|
7
|
+
export function buildKnownInputs(comp) {
|
|
8
|
+
const known = new Set(comp.meta.inputs.map((i) => i.name));
|
|
9
|
+
if (comp.meta.componentMeta.isDirective) {
|
|
10
|
+
known.add(PRISM_CONTENT_INPUT);
|
|
11
|
+
}
|
|
12
|
+
return known;
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-renderer.component.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/prism-renderer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAER,KAAK,IAAI,EAIV,MAAM,eAAe,CAAC;AAYvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAGjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;;
|
|
1
|
+
{"version":3,"file":"prism-renderer.component.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/prism-renderer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAER,KAAK,IAAI,EAIV,MAAM,eAAe,CAAC;AAYvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAGjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;;AAKhF,qBA8Ia,sBAAsB;IACjC,SAAS,CAAC,QAAQ,CAAC,IAAI,OAAQ;IAC/B,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;IACtE,SAAS,CAAC,QAAQ,CAAC,eAAe,uBAAgC;IAClE,SAAS,CAAC,QAAQ,CAAC,aAAa,qBAA8B;IAC9D,SAAS,CAAC,QAAQ,CAAC,SAAS,wBAAiC;IAC7D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmC;IACxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE3B;IAEH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAE5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAEpB;IACH,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,mBAAmB,CAAsC;IACjE,OAAO,CAAC,oBAAoB,CAChB;IACZ,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoC;IACjE,QAAQ,CAAC,aAAa,+DAAsC;IAC5D,wFAAwF;IACxF,SAAS,CAAC,QAAQ,CAAC,WAAW,gDAQ3B;IACH,6GAA6G;IAC7G,SAAS,CAAC,QAAQ,CAAC,YAAY,4FAU5B;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa;;MAA6C;IAC7E,SAAS,CAAC,QAAQ,CAAC,eAAe,yFAG/B;;IA0FH,OAAO,CAAC,eAAe;IA6FvB,OAAO,CAAC,OAAO;yCA9OJ,sBAAsB;2CAAtB,sBAAsB;CA4PlC"}
|
|
@@ -12,6 +12,7 @@ import { PrismCanvasService } from '../services/prism-canvas.service.js';
|
|
|
12
12
|
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
13
13
|
import { PrismCanvasRulersComponent } from '../canvas/prism-canvas-rulers.component.js';
|
|
14
14
|
import { PrismCanvasBgPillComponent } from '../canvas/prism-canvas-bg-pill.component.js';
|
|
15
|
+
import { buildKnownInputs } from './known-inputs.js';
|
|
15
16
|
import * as i0 from "@angular/core";
|
|
16
17
|
const _c0 = ["outlet"];
|
|
17
18
|
function PrismRendererComponent_Conditional_10_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
@@ -104,7 +105,7 @@ export class PrismRendererComponent {
|
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
107
|
performance.mark('prism:rerender:start');
|
|
107
|
-
const knownInputs =
|
|
108
|
+
const knownInputs = buildKnownInputs(comp);
|
|
108
109
|
for (const [key, value] of Object.entries(inputs)) {
|
|
109
110
|
if (!knownInputs.has(key)) {
|
|
110
111
|
console.warn(`[ng-prism] Unknown input "${key}" on <${comp.meta.componentMeta.selector}> — skipping. Remove it from @Showcase variants.`);
|
|
@@ -196,7 +197,7 @@ export class PrismRendererComponent {
|
|
|
196
197
|
this.outputSubscriptions.push(sub);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
|
-
const knownInputs =
|
|
200
|
+
const knownInputs = buildKnownInputs(comp);
|
|
200
201
|
for (const [key, value] of Object.entries(this.rendererService.inputValues())) {
|
|
201
202
|
if (!knownInputs.has(key)) {
|
|
202
203
|
console.warn(`[ng-prism] Unknown input "${key}" on <${selector}> — skipping. Remove it from @Showcase variants.`);
|
|
@@ -299,7 +300,7 @@ export class PrismRendererComponent {
|
|
|
299
300
|
}], () => [], { outlet: [{ type: i0.ViewChild, args: ['outlet', { ...{
|
|
300
301
|
read: ViewContainerRef,
|
|
301
302
|
}, isSignal: true }] }] }); })();
|
|
302
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber:
|
|
303
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber: 180 }); })();
|
|
303
304
|
function parseContentToNodes(content) {
|
|
304
305
|
if (typeof content === 'string') {
|
|
305
306
|
return [htmlToNodes(content)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-generator.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/snippet-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"snippet-generator.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/snippet-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CAC/B;AAwBD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,EAAE,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAClC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,gBAAgB,CAAC,EAAE,uBAAuB,GACzC,MAAM,CAmER"}
|
|
@@ -76,7 +76,9 @@ function directiveSelectorToAttr(selector) {
|
|
|
76
76
|
return match ? match[1] : selector;
|
|
77
77
|
}
|
|
78
78
|
function parseHostStringSimple(host) {
|
|
79
|
-
const match = host
|
|
79
|
+
const match = host
|
|
80
|
+
.trim()
|
|
81
|
+
.match(/^<\s*([a-zA-Z][a-zA-Z0-9-]*)((?:\s+[^>]*?)?)\s*\/?\s*>$/);
|
|
80
82
|
if (!match)
|
|
81
83
|
return { tag: 'div', attrs: '' };
|
|
82
84
|
return { tag: match[1], attrs: match[2].trim() };
|
|
@@ -100,7 +102,7 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
|
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
const attributes = [];
|
|
103
|
-
const processed = new Set();
|
|
105
|
+
const processed = new Set(['__prismContent__']);
|
|
104
106
|
for (const input of inputs) {
|
|
105
107
|
processed.add(input.name);
|
|
106
108
|
const value = values[input.name];
|
|
@@ -123,15 +125,21 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
|
|
|
123
125
|
continue;
|
|
124
126
|
pushAttribute(attributes, name, value);
|
|
125
127
|
}
|
|
128
|
+
const projectedContent = content ??
|
|
129
|
+
(typeof values['__prismContent__'] === 'string'
|
|
130
|
+
? values['__prismContent__']
|
|
131
|
+
: undefined);
|
|
126
132
|
const allAttrs = [...hostAttrs, directiveAttr, ...attributes].join(' ');
|
|
127
|
-
const contentHtml = resolveContentHtml(
|
|
133
|
+
const contentHtml = resolveContentHtml(projectedContent);
|
|
128
134
|
if (!contentHtml) {
|
|
129
135
|
if (!allAttrs)
|
|
130
136
|
return `<${tag} />`;
|
|
131
137
|
const singleLine = `<${tag} ${allAttrs} />`;
|
|
132
138
|
if (singleLine.length <= 80)
|
|
133
139
|
return singleLine;
|
|
134
|
-
const indented = [...hostAttrs, directiveAttr, ...attributes]
|
|
140
|
+
const indented = [...hostAttrs, directiveAttr, ...attributes]
|
|
141
|
+
.map((a) => ` ${a}`)
|
|
142
|
+
.join('\n');
|
|
135
143
|
return `<${tag}\n${indented} />`;
|
|
136
144
|
}
|
|
137
145
|
const openTag = `<${tag} ${allAttrs}>`;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import type { RuntimeComponent } from '../../plugin/plugin.types.js';
|
|
1
|
+
import type { RuntimeComponent, ScannedComponent } from '../../plugin/plugin.types.js';
|
|
2
2
|
import type { StyleguidePage } from '../../plugin/page.types.js';
|
|
3
3
|
import type { NavigationItem } from './navigation-item.types.js';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
+
export interface CategoryNode {
|
|
6
|
+
name: string;
|
|
7
|
+
items: NavigationItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface SectionNode {
|
|
10
|
+
name: string;
|
|
11
|
+
order: number;
|
|
12
|
+
totalCount: number;
|
|
13
|
+
categories: CategoryNode[];
|
|
14
|
+
}
|
|
15
|
+
export declare function resolveSection(c: ScannedComponent): string;
|
|
5
16
|
export declare class PrismNavigationService {
|
|
6
17
|
private readonly searchService;
|
|
7
18
|
private readonly manifestService;
|
|
8
19
|
readonly activeItem: import("@angular/core").WritableSignal<NavigationItem | null>;
|
|
9
20
|
readonly activeComponent: import("@angular/core").Signal<RuntimeComponent | null>;
|
|
10
21
|
readonly activePage: import("@angular/core").Signal<StyleguidePage | null>;
|
|
11
|
-
readonly
|
|
22
|
+
readonly sectionTree: import("@angular/core").Signal<SectionNode[]>;
|
|
12
23
|
select(comp: RuntimeComponent): void;
|
|
13
24
|
selectPage(page: StyleguidePage): void;
|
|
14
25
|
selectFirst(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-navigation.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-navigation.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"prism-navigation.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-navigation.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;;AAWjE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,YAAY,EAAE,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAG1D;AAeD,qBACa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAEhE,QAAQ,CAAC,UAAU,gEAAuC;IAE1D,QAAQ,CAAC,eAAe,0DAQrB;IAEH,QAAQ,CAAC,UAAU,wDAQhB;IAEH,QAAQ,CAAC,WAAW,gDAiFjB;IAEH,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAIpC,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAItC,WAAW,IAAI,IAAI;yCArHR,sBAAsB;6CAAtB,sBAAsB;CAkIlC"}
|