@ng-prism/core 22.1.0 → 22.1.2
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/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 }); })();
|
package/package.json
CHANGED