@ng-prism/core 21.9.1 → 21.10.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/canvas/prism-canvas-bg-pill.component.d.ts +10 -0
- package/dist/app/canvas/prism-canvas-bg-pill.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-bg-pill.component.js +51 -0
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +5 -0
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +82 -17
- package/dist/app/canvas/prism-code-drawer.component.d.ts +2 -0
- package/dist/app/canvas/prism-code-drawer.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-code-drawer.component.js +6 -4
- package/dist/app/canvas/prism-template-popover.component.d.ts +16 -0
- package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-template-popover.component.js +162 -0
- package/dist/app/icons/prism-icon.component.d.ts.map +1 -1
- package/dist/app/icons/prism-icon.component.js +3 -1
- package/dist/app/renderer/prism-renderer.component.d.ts +2 -0
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +25 -15
- package/dist/app/services/prism-canvas.service.d.ts +2 -1
- package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
- package/dist/app/services/prism-canvas.service.js +2 -1
- package/dist/app/services/prism-layout.service.d.ts +3 -0
- package/dist/app/services/prism-layout.service.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.js +13 -5
- package/dist/app/services/prism-theme.service.d.ts +1 -1
- package/dist/app/services/prism-variant-bg.service.d.ts +19 -0
- package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -0
- package/dist/app/services/prism-variant-bg.service.js +45 -0
- package/dist/app/shell/prism-shell.component.js +13 -14
- package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/component.scanner.js +25 -5
- package/dist/decorator/showcase.types.d.ts +10 -0
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/dist/shared/canvas-bg.type.d.ts +3 -0
- package/dist/shared/canvas-bg.type.d.ts.map +1 -0
- package/dist/shared/canvas-bg.type.js +7 -0
- package/dist/transformer/showcase-strip.transformer.d.ts.map +1 -1
- package/dist/transformer/showcase-strip.transformer.js +49 -12
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class PrismCanvasBgPillComponent {
|
|
3
|
+
private readonly variantBg;
|
|
4
|
+
protected readonly recommended: import("@angular/core").Signal<import("../services/prism-canvas.service.js").CanvasBg | null>;
|
|
5
|
+
protected readonly visible: import("@angular/core").Signal<boolean>;
|
|
6
|
+
protected reset(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PrismCanvasBgPillComponent, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PrismCanvasBgPillComponent, "prism-canvas-bg-pill", never, {}, {}, never, never, true, never>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=prism-canvas-bg-pill.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prism-canvas-bg-pill.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-bg-pill.component.ts"],"names":[],"mappings":";AAGA,qBAkEa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAE3D,SAAS,CAAC,QAAQ,CAAC,WAAW,gGAA8B;IAC5D,SAAS,CAAC,QAAQ,CAAC,OAAO,0CAA8B;IAExD,SAAS,CAAC,KAAK,IAAI,IAAI;yCANZ,0BAA0B;2CAA1B,0BAA0B;CAStC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
|
2
|
+
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
function PrismCanvasBgPillComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
5
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
6
|
+
i0.ɵɵdomElementStart(0, "div", 0)(1, "span", 1);
|
|
7
|
+
i0.ɵɵtext(2);
|
|
8
|
+
i0.ɵɵdomElementEnd();
|
|
9
|
+
i0.ɵɵdomElementStart(3, "button", 2);
|
|
10
|
+
i0.ɵɵdomListener("click", function PrismCanvasBgPillComponent_Conditional_0_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.reset()); });
|
|
11
|
+
i0.ɵɵtext(4, " Reset ");
|
|
12
|
+
i0.ɵɵdomElementEnd()();
|
|
13
|
+
} if (rf & 2) {
|
|
14
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
15
|
+
i0.ɵɵadvance(2);
|
|
16
|
+
i0.ɵɵtextInterpolate1("Recommended: ", ctx_r1.recommended());
|
|
17
|
+
} }
|
|
18
|
+
export class PrismCanvasBgPillComponent {
|
|
19
|
+
variantBg = inject(PrismVariantBgService);
|
|
20
|
+
recommended = this.variantBg.recommended;
|
|
21
|
+
visible = this.variantBg.isDeviating;
|
|
22
|
+
reset() {
|
|
23
|
+
this.variantBg.clearOverride();
|
|
24
|
+
}
|
|
25
|
+
static ɵfac = function PrismCanvasBgPillComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCanvasBgPillComponent)(); };
|
|
26
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCanvasBgPillComponent, selectors: [["prism-canvas-bg-pill"]], decls: 1, vars: 1, consts: [[1, "prism-bg-pill"], [1, "label"], ["type", "button", "title", "Reset to recommended background", "aria-label", "Reset to recommended background", 1, "reset", 3, "click"]], template: function PrismCanvasBgPillComponent_Template(rf, ctx) { if (rf & 1) {
|
|
27
|
+
i0.ɵɵconditionalCreate(0, PrismCanvasBgPillComponent_Conditional_0_Template, 5, 1, "div", 0);
|
|
28
|
+
} if (rf & 2) {
|
|
29
|
+
i0.ɵɵconditional(ctx.visible() ? 0 : -1);
|
|
30
|
+
} }, styles: ["[_nghost-%COMP%] {\n position: absolute;\n top: 12px;\n right: 20px;\n pointer-events: none;\n z-index: 2;\n }\n .prism-bg-pill[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 4px 4px 10px;\n border-radius: 999px;\n font-size: var(--fs-xs);\n font-family: var(--font-sans);\n background: color-mix(in srgb, var(--prism-bg-elevated) 90%, transparent);\n border: 1px solid var(--prism-border);\n color: var(--prism-text-muted);\n backdrop-filter: blur(8px);\n pointer-events: auto;\n animation: _ngcontent-%COMP%_fadeIn var(--dur-base) ease-out;\n }\n .label[_ngcontent-%COMP%] { letter-spacing: 0.02em; }\n .reset[_ngcontent-%COMP%] {\n height: 22px;\n padding: 0 10px;\n border-radius: 999px;\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n color: var(--prism-text);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n font-family: inherit;\n font-size: inherit;\n font-weight: 500;\n cursor: pointer;\n transition: background var(--dur-fast);\n }\n .reset[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n @keyframes _ngcontent-%COMP%_fadeIn {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n }"], changeDetection: 0 });
|
|
31
|
+
}
|
|
32
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismCanvasBgPillComponent, [{
|
|
33
|
+
type: Component,
|
|
34
|
+
args: [{ selector: 'prism-canvas-bg-pill', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
35
|
+
@if (visible()) {
|
|
36
|
+
<div class="prism-bg-pill">
|
|
37
|
+
<span class="label">Recommended: {{ recommended() }}</span>
|
|
38
|
+
<button
|
|
39
|
+
type="button"
|
|
40
|
+
class="reset"
|
|
41
|
+
title="Reset to recommended background"
|
|
42
|
+
aria-label="Reset to recommended background"
|
|
43
|
+
(click)="reset()"
|
|
44
|
+
>
|
|
45
|
+
Reset
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
}
|
|
49
|
+
`, styles: ["\n :host {\n position: absolute;\n top: 12px;\n right: 20px;\n pointer-events: none;\n z-index: 2;\n }\n .prism-bg-pill {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 4px 4px 10px;\n border-radius: 999px;\n font-size: var(--fs-xs);\n font-family: var(--font-sans);\n background: color-mix(in srgb, var(--prism-bg-elevated) 90%, transparent);\n border: 1px solid var(--prism-border);\n color: var(--prism-text-muted);\n backdrop-filter: blur(8px);\n pointer-events: auto;\n animation: fadeIn var(--dur-base) ease-out;\n }\n .label { letter-spacing: 0.02em; }\n .reset {\n height: 22px;\n padding: 0 10px;\n border-radius: 999px;\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n color: var(--prism-text);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n font-family: inherit;\n font-size: inherit;\n font-weight: 500;\n cursor: pointer;\n transition: background var(--dur-fast);\n }\n .reset:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n @keyframes fadeIn {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "] }]
|
|
50
|
+
}], null, null); })();
|
|
51
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasBgPillComponent, { className: "PrismCanvasBgPillComponent", filePath: "app/canvas/prism-canvas-bg-pill.component.ts", lineNumber: 70 }); })();
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { PrismCanvasService, type CanvasBg } from '../services/prism-canvas.service.js';
|
|
2
|
+
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
3
|
+
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
2
4
|
import * as i0 from "@angular/core";
|
|
3
5
|
export declare class PrismCanvasToolbarComponent {
|
|
4
6
|
protected readonly canvas: PrismCanvasService;
|
|
7
|
+
protected readonly variantBg: PrismVariantBgService;
|
|
8
|
+
protected readonly layout: PrismLayoutService;
|
|
9
|
+
protected setBg(bg: CanvasBg): void;
|
|
5
10
|
protected readonly bgs: CanvasBg[];
|
|
6
11
|
protected readonly zooms: {
|
|
7
12
|
value: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-canvas-toolbar.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-toolbar.component.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,KAAK,QAAQ,EACd,MAAM,qCAAqC,CAAC;;
|
|
1
|
+
{"version":3,"file":"prism-canvas-toolbar.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-toolbar.component.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,KAAK,QAAQ,EACd,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;;AAEzE,qBA+Ka,2BAA2B;IACtC,SAAS,CAAC,QAAQ,CAAC,MAAM,qBAA8B;IACvD,SAAS,CAAC,QAAQ,CAAC,SAAS,wBAAiC;IAC7D,SAAS,CAAC,QAAQ,CAAC,MAAM,qBAA8B;IAEvD,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI;IAQnC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,CAMhC;IACF,SAAS,CAAC,QAAQ,CAAC,KAAK;;;QAKtB;IAEF,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;yCA3B5B,2BAA2B;2CAA3B,2BAA2B;CA8BvC"}
|
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
import { Component, inject, ChangeDetectionStrategy } from '@angular/core';
|
|
2
2
|
import { PrismIconComponent } from '../icons/prism-icon.component.js';
|
|
3
3
|
import { PrismCanvasService, } from '../services/prism-canvas.service.js';
|
|
4
|
+
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
5
|
+
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
4
6
|
import * as i0 from "@angular/core";
|
|
5
7
|
const _forTrack0 = ($index, $item) => $item.value;
|
|
8
|
+
function PrismCanvasToolbarComponent_For_5_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
9
|
+
i0.ɵɵnamespaceSVG();
|
|
10
|
+
i0.ɵɵelementStart(0, "svg", 14);
|
|
11
|
+
i0.ɵɵelement(1, "path", 15);
|
|
12
|
+
i0.ɵɵelementEnd();
|
|
13
|
+
} }
|
|
6
14
|
function PrismCanvasToolbarComponent_For_5_Template(rf, ctx) { if (rf & 1) {
|
|
7
15
|
const _r1 = i0.ɵɵgetCurrentView();
|
|
8
|
-
i0.ɵɵelementStart(0, "button",
|
|
9
|
-
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_For_5_Template_button_click_0_listener() { const bg_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.
|
|
10
|
-
i0.ɵɵ
|
|
16
|
+
i0.ɵɵelementStart(0, "button", 13);
|
|
17
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_For_5_Template_button_click_0_listener() { const bg_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.setBg(bg_r2)); });
|
|
18
|
+
i0.ɵɵconditionalCreate(1, PrismCanvasToolbarComponent_For_5_Conditional_1_Template, 2, 0, ":svg:svg", 14);
|
|
19
|
+
i0.ɵɵtext(2);
|
|
11
20
|
i0.ɵɵelementEnd();
|
|
12
21
|
} if (rf & 2) {
|
|
13
22
|
const bg_r2 = ctx.$implicit;
|
|
14
23
|
const ctx_r2 = i0.ɵɵnextContext();
|
|
15
|
-
i0.ɵɵclassProp("tool-btn--active", ctx_r2.
|
|
24
|
+
i0.ɵɵclassProp("tool-btn--active", ctx_r2.variantBg.effective() === bg_r2)("tool-btn--recommended", ctx_r2.variantBg.recommended() === bg_r2);
|
|
25
|
+
i0.ɵɵproperty("title", ctx_r2.variantBg.recommended() === bg_r2 ? "Recommended background for this variant" : null);
|
|
26
|
+
i0.ɵɵadvance();
|
|
27
|
+
i0.ɵɵconditional(ctx_r2.variantBg.recommended() === bg_r2 ? 1 : -1);
|
|
16
28
|
i0.ɵɵadvance();
|
|
17
29
|
i0.ɵɵtextInterpolate1(" ", ctx_r2.capitalize(bg_r2), " ");
|
|
18
30
|
} }
|
|
19
31
|
function PrismCanvasToolbarComponent_For_11_Template(rf, ctx) { if (rf & 1) {
|
|
20
32
|
const _r4 = i0.ɵɵgetCurrentView();
|
|
21
|
-
i0.ɵɵelementStart(0, "button",
|
|
33
|
+
i0.ɵɵelementStart(0, "button", 16);
|
|
22
34
|
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_For_11_Template_button_click_0_listener() { const z_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.canvas.setZoom(z_r5.value)); });
|
|
23
35
|
i0.ɵɵtext(1);
|
|
24
36
|
i0.ɵɵelementEnd();
|
|
@@ -31,6 +43,16 @@ function PrismCanvasToolbarComponent_For_11_Template(rf, ctx) { if (rf & 1) {
|
|
|
31
43
|
} }
|
|
32
44
|
export class PrismCanvasToolbarComponent {
|
|
33
45
|
canvas = inject(PrismCanvasService);
|
|
46
|
+
variantBg = inject(PrismVariantBgService);
|
|
47
|
+
layout = inject(PrismLayoutService);
|
|
48
|
+
setBg(bg) {
|
|
49
|
+
if (this.variantBg.recommended() !== null) {
|
|
50
|
+
this.variantBg.setOverride(bg);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.canvas.setBg(bg);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
34
56
|
bgs = [
|
|
35
57
|
'dots',
|
|
36
58
|
'plain',
|
|
@@ -48,30 +70,36 @@ export class PrismCanvasToolbarComponent {
|
|
|
48
70
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
49
71
|
}
|
|
50
72
|
static ɵfac = function PrismCanvasToolbarComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCanvasToolbarComponent)(); };
|
|
51
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCanvasToolbarComponent, selectors: [["prism-canvas-toolbar"]], decls:
|
|
73
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCanvasToolbarComponent, selectors: [["prism-canvas-toolbar"]], decls: 23, vars: 9, consts: [[1, "canvas-toolbar"], [1, "tool-label"], [1, "tool-group"], [1, "tool-btn", 3, "tool-btn--active", "tool-btn--recommended", "title"], [1, "tool-sep"], [1, "tool-btn", 3, "tool-btn--active"], ["title", "Toggle guides", "aria-label", "Toggle guides", 1, "tool-btn", 3, "click"], ["name", "crosshair", 3, "size"], ["title", "Toggle rulers", "aria-label", "Toggle rulers", 1, "tool-btn", 3, "click"], ["name", "move", 3, "size"], [1, "tool-spacer"], ["title", "Toggle Angular template", "aria-label", "Toggle Angular template", 1, "tool-btn", "tool-btn--tpl", 3, "click"], ["name", "code", 3, "size"], [1, "tool-btn", 3, "click", "title"], ["width", "11", "height", "11", "viewBox", "0 0 24 24", "fill", "#facc15", "aria-label", "Recommended", 1, "bg-star"], ["d", "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z"], [1, "tool-btn", 3, "click"]], template: function PrismCanvasToolbarComponent_Template(rf, ctx) { if (rf & 1) {
|
|
52
74
|
i0.ɵɵelementStart(0, "div", 0)(1, "span", 1);
|
|
53
75
|
i0.ɵɵtext(2, "Canvas");
|
|
54
76
|
i0.ɵɵelementEnd();
|
|
55
77
|
i0.ɵɵelementStart(3, "div", 2);
|
|
56
|
-
i0.ɵɵrepeaterCreate(4, PrismCanvasToolbarComponent_For_5_Template,
|
|
78
|
+
i0.ɵɵrepeaterCreate(4, PrismCanvasToolbarComponent_For_5_Template, 3, 7, "button", 3, i0.ɵɵrepeaterTrackByIdentity);
|
|
57
79
|
i0.ɵɵelementEnd();
|
|
58
80
|
i0.ɵɵelement(6, "div", 4);
|
|
59
81
|
i0.ɵɵelementStart(7, "span", 1);
|
|
60
82
|
i0.ɵɵtext(8, "Zoom");
|
|
61
83
|
i0.ɵɵelementEnd();
|
|
62
84
|
i0.ɵɵelementStart(9, "div", 2);
|
|
63
|
-
i0.ɵɵrepeaterCreate(10, PrismCanvasToolbarComponent_For_11_Template, 2, 3, "button",
|
|
85
|
+
i0.ɵɵrepeaterCreate(10, PrismCanvasToolbarComponent_For_11_Template, 2, 3, "button", 5, _forTrack0);
|
|
64
86
|
i0.ɵɵelementEnd();
|
|
65
87
|
i0.ɵɵelement(12, "div", 4);
|
|
66
|
-
i0.ɵɵelementStart(13, "button",
|
|
88
|
+
i0.ɵɵelementStart(13, "button", 6);
|
|
67
89
|
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_Template_button_click_13_listener() { return ctx.canvas.toggleGuides(); });
|
|
68
|
-
i0.ɵɵelement(14, "prism-icon",
|
|
90
|
+
i0.ɵɵelement(14, "prism-icon", 7);
|
|
69
91
|
i0.ɵɵtext(15, " Guides ");
|
|
70
92
|
i0.ɵɵelementEnd();
|
|
71
|
-
i0.ɵɵelementStart(16, "button",
|
|
93
|
+
i0.ɵɵelementStart(16, "button", 8);
|
|
72
94
|
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_Template_button_click_16_listener() { return ctx.canvas.toggleRulers(); });
|
|
73
|
-
i0.ɵɵelement(17, "prism-icon",
|
|
95
|
+
i0.ɵɵelement(17, "prism-icon", 9);
|
|
74
96
|
i0.ɵɵtext(18, " Rulers ");
|
|
97
|
+
i0.ɵɵelementEnd();
|
|
98
|
+
i0.ɵɵelement(19, "div", 10);
|
|
99
|
+
i0.ɵɵelementStart(20, "button", 11);
|
|
100
|
+
i0.ɵɵlistener("click", function PrismCanvasToolbarComponent_Template_button_click_20_listener() { return ctx.layout.toggleTemplatePopover(); });
|
|
101
|
+
i0.ɵɵelement(21, "prism-icon", 12);
|
|
102
|
+
i0.ɵɵtext(22, " Template ");
|
|
75
103
|
i0.ɵɵelementEnd()();
|
|
76
104
|
} if (rf & 2) {
|
|
77
105
|
i0.ɵɵadvance(4);
|
|
@@ -86,7 +114,11 @@ export class PrismCanvasToolbarComponent {
|
|
|
86
114
|
i0.ɵɵclassProp("tool-btn--active", ctx.canvas.rulers());
|
|
87
115
|
i0.ɵɵadvance();
|
|
88
116
|
i0.ɵɵproperty("size", 13);
|
|
89
|
-
|
|
117
|
+
i0.ɵɵadvance(3);
|
|
118
|
+
i0.ɵɵclassProp("tool-btn--tpl-active", ctx.layout.templatePopoverVisible());
|
|
119
|
+
i0.ɵɵadvance();
|
|
120
|
+
i0.ɵɵproperty("size", 13);
|
|
121
|
+
} }, dependencies: [PrismIconComponent], styles: [".canvas-toolbar[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 20px;\n border-bottom: 1px solid var(--prism-border);\n background: var(--prism-bg);\n min-height: 44px;\n }\n\n .tool-group[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 1px;\n padding: 2px;\n background: var(--prism-input-bg);\n border: 1px solid var(--prism-border);\n border-radius: var(--radius-md);\n }\n\n .tool-btn[_ngcontent-%COMP%] {\n height: 24px;\n padding: 0 9px;\n border-radius: var(--radius-sm);\n display: flex;\n align-items: center;\n gap: 5px;\n font-size: var(--fs-sm);\n color: var(--prism-text-muted);\n transition: all var(--dur-fast);\n font-weight: 500;\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .tool-btn[_ngcontent-%COMP%]:hover {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .tool-btn--active[_ngcontent-%COMP%] {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 15%, transparent);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prism-primary) 30%, transparent);\n }\n .bg-star[_ngcontent-%COMP%] {\n flex-shrink: 0;\n filter: drop-shadow(0 0 2px rgba(250, 204, 21, 0.4));\n }\n\n .tool-sep[_ngcontent-%COMP%] {\n width: 1px;\n height: 18px;\n background: var(--prism-border);\n margin: 0 4px;\n }\n\n .tool-label[_ngcontent-%COMP%] {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n margin-right: 2px;\n }\n\n .tool-spacer[_ngcontent-%COMP%] { flex: 1; }\n\n .tool-btn--tpl[_ngcontent-%COMP%] {\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 10%, transparent);\n border: 1px solid\n color-mix(in srgb, var(--prism-primary) 25%, transparent);\n font-family: var(--font-mono);\n }\n .tool-btn--tpl[_ngcontent-%COMP%]:hover {\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 18%, transparent);\n }\n .tool-btn--tpl.tool-btn--tpl-active[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--prism-primary) 22%, transparent);\n box-shadow: inset 0 0 0 1px\n color-mix(in srgb, var(--prism-primary) 35%, transparent);\n }"], changeDetection: 0 });
|
|
90
122
|
}
|
|
91
123
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismCanvasToolbarComponent, [{
|
|
92
124
|
type: Component,
|
|
@@ -97,9 +129,29 @@ export class PrismCanvasToolbarComponent {
|
|
|
97
129
|
@for (bg of bgs; track bg) {
|
|
98
130
|
<button
|
|
99
131
|
class="tool-btn"
|
|
100
|
-
[class.tool-btn--active]="
|
|
101
|
-
|
|
132
|
+
[class.tool-btn--active]="variantBg.effective() === bg"
|
|
133
|
+
[class.tool-btn--recommended]="variantBg.recommended() === bg"
|
|
134
|
+
[title]="
|
|
135
|
+
variantBg.recommended() === bg
|
|
136
|
+
? 'Recommended background for this variant'
|
|
137
|
+
: null
|
|
138
|
+
"
|
|
139
|
+
(click)="setBg(bg)"
|
|
102
140
|
>
|
|
141
|
+
@if (variantBg.recommended() === bg) {
|
|
142
|
+
<svg
|
|
143
|
+
class="bg-star"
|
|
144
|
+
width="11"
|
|
145
|
+
height="11"
|
|
146
|
+
viewBox="0 0 24 24"
|
|
147
|
+
fill="#facc15"
|
|
148
|
+
aria-label="Recommended"
|
|
149
|
+
>
|
|
150
|
+
<path
|
|
151
|
+
d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z"
|
|
152
|
+
/>
|
|
153
|
+
</svg>
|
|
154
|
+
}
|
|
103
155
|
{{ capitalize(bg) }}
|
|
104
156
|
</button>
|
|
105
157
|
}
|
|
@@ -138,7 +190,20 @@ export class PrismCanvasToolbarComponent {
|
|
|
138
190
|
<prism-icon name="move" [size]="13" />
|
|
139
191
|
Rulers
|
|
140
192
|
</button>
|
|
193
|
+
|
|
194
|
+
<div class="tool-spacer"></div>
|
|
195
|
+
|
|
196
|
+
<button
|
|
197
|
+
class="tool-btn tool-btn--tpl"
|
|
198
|
+
[class.tool-btn--tpl-active]="layout.templatePopoverVisible()"
|
|
199
|
+
(click)="layout.toggleTemplatePopover()"
|
|
200
|
+
title="Toggle Angular template"
|
|
201
|
+
aria-label="Toggle Angular template"
|
|
202
|
+
>
|
|
203
|
+
<prism-icon name="code" [size]="13" />
|
|
204
|
+
Template
|
|
205
|
+
</button>
|
|
141
206
|
</div>
|
|
142
|
-
`, styles: ["\n .canvas-toolbar {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 20px;\n border-bottom: 1px solid var(--prism-border);\n background: var(--prism-bg);\n min-height: 44px;\n }\n\n .tool-group {\n display: flex;\n align-items: center;\n gap: 1px;\n padding: 2px;\n background: var(--prism-input-bg);\n border: 1px solid var(--prism-border);\n border-radius: var(--radius-md);\n }\n\n .tool-btn {\n height: 24px;\n padding: 0 9px;\n border-radius: var(--radius-sm);\n display: flex;\n align-items: center;\n gap: 5px;\n font-size: var(--fs-sm);\n color: var(--prism-text-muted);\n transition: all var(--dur-fast);\n font-weight: 500;\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .tool-btn:hover {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .tool-btn--active {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 15%, transparent);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prism-primary) 30%, transparent);\n }\n\n .tool-sep {\n width: 1px;\n height: 18px;\n background: var(--prism-border);\n margin: 0 4px;\n }\n\n .tool-label {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n margin-right: 2px;\n }\n\n "] }]
|
|
207
|
+
`, styles: ["\n .canvas-toolbar {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 20px;\n border-bottom: 1px solid var(--prism-border);\n background: var(--prism-bg);\n min-height: 44px;\n }\n\n .tool-group {\n display: flex;\n align-items: center;\n gap: 1px;\n padding: 2px;\n background: var(--prism-input-bg);\n border: 1px solid var(--prism-border);\n border-radius: var(--radius-md);\n }\n\n .tool-btn {\n height: 24px;\n padding: 0 9px;\n border-radius: var(--radius-sm);\n display: flex;\n align-items: center;\n gap: 5px;\n font-size: var(--fs-sm);\n color: var(--prism-text-muted);\n transition: all var(--dur-fast);\n font-weight: 500;\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .tool-btn:hover {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 8%, transparent);\n }\n .tool-btn--active {\n color: var(--prism-text);\n background: color-mix(in srgb, var(--prism-primary) 15%, transparent);\n box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prism-primary) 30%, transparent);\n }\n .bg-star {\n flex-shrink: 0;\n filter: drop-shadow(0 0 2px rgba(250, 204, 21, 0.4));\n }\n\n .tool-sep {\n width: 1px;\n height: 18px;\n background: var(--prism-border);\n margin: 0 4px;\n }\n\n .tool-label {\n font-size: var(--fs-xs);\n color: var(--prism-text-ghost);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n font-weight: 600;\n margin-right: 2px;\n }\n\n .tool-spacer { flex: 1; }\n\n .tool-btn--tpl {\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 10%, transparent);\n border: 1px solid\n color-mix(in srgb, var(--prism-primary) 25%, transparent);\n font-family: var(--font-mono);\n }\n .tool-btn--tpl:hover {\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 18%, transparent);\n }\n .tool-btn--tpl.tool-btn--tpl-active {\n background: color-mix(in srgb, var(--prism-primary) 22%, transparent);\n box-shadow: inset 0 0 0 1px\n color-mix(in srgb, var(--prism-primary) 35%, transparent);\n }\n "] }]
|
|
143
208
|
}], null, null); })();
|
|
144
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasToolbarComponent, { className: "PrismCanvasToolbarComponent", filePath: "app/canvas/prism-canvas-toolbar.component.ts", lineNumber:
|
|
209
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasToolbarComponent, { className: "PrismCanvasToolbarComponent", filePath: "app/canvas/prism-canvas-toolbar.component.ts", lineNumber: 185 }); })();
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
3
|
export declare class PrismCodeDrawerComponent {
|
|
3
4
|
private readonly navigationService;
|
|
4
5
|
private readonly rendererService;
|
|
6
|
+
protected readonly layoutService: PrismLayoutService;
|
|
5
7
|
protected readonly collapsed: import("@angular/core").WritableSignal<boolean>;
|
|
6
8
|
protected readonly snippet: import("@angular/core").Signal<string>;
|
|
7
9
|
protected readonly highlighted: import("@angular/core").Signal<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-code-drawer.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-code-drawer.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prism-code-drawer.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-code-drawer.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;;AAkCzE,qBAuGa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,SAAS,CAAC,QAAQ,CAAC,aAAa,qBAA8B;IAE9D,SAAS,CAAC,QAAQ,CAAC,SAAS,kDAA0C;IAEtE,SAAS,CAAC,QAAQ,CAAC,OAAO,yCAqBvB;IAEH,SAAS,CAAC,QAAQ,CAAC,WAAW,yCAI3B;IAEH,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;yCApCxB,wBAAwB;2CAAxB,wBAAwB;CAyCpC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Component, inject, computed,
|
|
1
|
+
import { Component, inject, computed, ChangeDetectionStrategy, } from '@angular/core';
|
|
2
2
|
import { PrismIconComponent } from '../icons/prism-icon.component.js';
|
|
3
|
+
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
3
4
|
import { PrismNavigationService } from '../services/prism-navigation.service.js';
|
|
4
5
|
import { PrismRendererService } from '../services/prism-renderer.service.js';
|
|
5
6
|
import { generateSnippet } from '../renderer/snippet-generator.js';
|
|
@@ -39,7 +40,8 @@ function tokenizeXml(code) {
|
|
|
39
40
|
export class PrismCodeDrawerComponent {
|
|
40
41
|
navigationService = inject(PrismNavigationService);
|
|
41
42
|
rendererService = inject(PrismRendererService);
|
|
42
|
-
|
|
43
|
+
layoutService = inject(PrismLayoutService);
|
|
44
|
+
collapsed = this.layoutService.codeDrawerCollapsed;
|
|
43
45
|
snippet = computed(() => {
|
|
44
46
|
const comp = this.navigationService.activeComponent();
|
|
45
47
|
if (!comp)
|
|
@@ -68,7 +70,7 @@ export class PrismCodeDrawerComponent {
|
|
|
68
70
|
static ɵfac = function PrismCodeDrawerComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCodeDrawerComponent)(); };
|
|
69
71
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismCodeDrawerComponent, selectors: [["prism-code-drawer"]], decls: 11, vars: 6, consts: [[1, "code-drawer"], [1, "code-head", 3, "click"], ["name", "chevron-down", 1, "chev", 3, "size"], ["name", "copy", 3, "size"], [1, "code-head-actions"], ["title", "Copy to clipboard", 1, "mini", 3, "click"], [1, "code-body", 3, "innerHTML"]], template: function PrismCodeDrawerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
70
72
|
i0.ɵɵelementStart(0, "div", 0)(1, "div", 1);
|
|
71
|
-
i0.ɵɵlistener("click", function PrismCodeDrawerComponent_Template_div_click_1_listener() { return ctx.
|
|
73
|
+
i0.ɵɵlistener("click", function PrismCodeDrawerComponent_Template_div_click_1_listener() { return ctx.layoutService.toggleCodeDrawer(); });
|
|
72
74
|
i0.ɵɵelement(2, "prism-icon", 2)(3, "prism-icon", 3);
|
|
73
75
|
i0.ɵɵelementStart(4, "span");
|
|
74
76
|
i0.ɵɵtext(5, "Angular Template");
|
|
@@ -96,7 +98,7 @@ export class PrismCodeDrawerComponent {
|
|
|
96
98
|
type: Component,
|
|
97
99
|
args: [{ selector: 'prism-code-drawer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: `
|
|
98
100
|
<div class="code-drawer" [class.is-collapsed]="collapsed()">
|
|
99
|
-
<div class="code-head" (click)="
|
|
101
|
+
<div class="code-head" (click)="layoutService.toggleCodeDrawer()">
|
|
100
102
|
<prism-icon name="chevron-down" [size]="12" class="chev" />
|
|
101
103
|
<prism-icon name="copy" [size]="12" />
|
|
102
104
|
<span>Angular Template</span>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class PrismTemplatePopoverComponent {
|
|
4
|
+
private readonly navigationService;
|
|
5
|
+
private readonly rendererService;
|
|
6
|
+
protected readonly layoutService: PrismLayoutService;
|
|
7
|
+
protected readonly copied: import("@angular/core").WritableSignal<boolean>;
|
|
8
|
+
private copiedResetTimer;
|
|
9
|
+
protected readonly snippet: import("@angular/core").Signal<string>;
|
|
10
|
+
protected readonly highlighted: import("@angular/core").Signal<string>;
|
|
11
|
+
protected copy(): void;
|
|
12
|
+
protected onEscape(): void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PrismTemplatePopoverComponent, never>;
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PrismTemplatePopoverComponent, "prism-template-popover", never, {}, {}, never, never, true, never>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=prism-template-popover.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prism-template-popover.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-template-popover.component.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;;AAkCzE,qBAkKa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,SAAS,CAAC,QAAQ,CAAC,aAAa,qBAA8B;IAE9D,SAAS,CAAC,QAAQ,CAAC,MAAM,kDAAiB;IAC1C,OAAO,CAAC,gBAAgB,CAA8C;IAEtE,SAAS,CAAC,QAAQ,CAAC,OAAO,yCAqBvB;IAEH,SAAS,CAAC,QAAQ,CAAC,WAAW,yCAI3B;IAEH,SAAS,CAAC,IAAI,IAAI,IAAI;IAUtB,SAAS,CAAC,QAAQ,IAAI,IAAI;yCA/Cf,6BAA6B;2CAA7B,6BAA6B;CAoDzC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Component, inject, computed, signal, ChangeDetectionStrategy, HostListener, } from '@angular/core';
|
|
2
|
+
import { PrismIconComponent } from '../icons/prism-icon.component.js';
|
|
3
|
+
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
4
|
+
import { PrismNavigationService } from '../services/prism-navigation.service.js';
|
|
5
|
+
import { PrismRendererService } from '../services/prism-renderer.service.js';
|
|
6
|
+
import { generateSnippet } from '../renderer/snippet-generator.js';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
function PrismTemplatePopoverComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
9
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
10
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
11
|
+
i0.ɵɵlistener("click", function PrismTemplatePopoverComponent_Conditional_0_Template_div_click_0_listener($event) { return $event.stopPropagation(); });
|
|
12
|
+
i0.ɵɵelementStart(1, "div", 2);
|
|
13
|
+
i0.ɵɵelement(2, "prism-icon", 3);
|
|
14
|
+
i0.ɵɵelementStart(3, "span");
|
|
15
|
+
i0.ɵɵtext(4, "Angular Template");
|
|
16
|
+
i0.ɵɵelementEnd();
|
|
17
|
+
i0.ɵɵelementStart(5, "button", 4);
|
|
18
|
+
i0.ɵɵlistener("click", function PrismTemplatePopoverComponent_Conditional_0_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.copy()); });
|
|
19
|
+
i0.ɵɵelement(6, "prism-icon", 5);
|
|
20
|
+
i0.ɵɵtext(7);
|
|
21
|
+
i0.ɵɵelementEnd();
|
|
22
|
+
i0.ɵɵelementStart(8, "button", 6);
|
|
23
|
+
i0.ɵɵlistener("click", function PrismTemplatePopoverComponent_Conditional_0_Template_button_click_8_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.layoutService.closeTemplatePopover()); });
|
|
24
|
+
i0.ɵɵelement(9, "prism-icon", 7);
|
|
25
|
+
i0.ɵɵelementEnd()();
|
|
26
|
+
i0.ɵɵelement(10, "pre", 8);
|
|
27
|
+
i0.ɵɵelementEnd();
|
|
28
|
+
} if (rf & 2) {
|
|
29
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
30
|
+
i0.ɵɵadvance(2);
|
|
31
|
+
i0.ɵɵproperty("size", 13);
|
|
32
|
+
i0.ɵɵadvance(3);
|
|
33
|
+
i0.ɵɵproperty("title", ctx_r1.copied() ? "Copied!" : "Copy to clipboard");
|
|
34
|
+
i0.ɵɵadvance();
|
|
35
|
+
i0.ɵɵproperty("name", ctx_r1.copied() ? "shield-check" : "copy")("size", 12);
|
|
36
|
+
i0.ɵɵadvance();
|
|
37
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.copied() ? "Copied" : "Copy", " ");
|
|
38
|
+
i0.ɵɵadvance(2);
|
|
39
|
+
i0.ɵɵproperty("size", 13);
|
|
40
|
+
i0.ɵɵadvance();
|
|
41
|
+
i0.ɵɵproperty("innerHTML", ctx_r1.highlighted(), i0.ɵɵsanitizeHtml);
|
|
42
|
+
} }
|
|
43
|
+
function esc(s) {
|
|
44
|
+
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
45
|
+
}
|
|
46
|
+
function tokenizeXml(code) {
|
|
47
|
+
const re = /(\/\/[^\n]*)|(<\/?[\w-]+)|(\[[\w.]+\]|[\w-]+)=|"([^"]*)"|(\/>|>)|(\n)|([^<\["\n/>=]+|[/=])/g;
|
|
48
|
+
let out = '';
|
|
49
|
+
let m;
|
|
50
|
+
while ((m = re.exec(code)) !== null) {
|
|
51
|
+
if (m[1] != null) {
|
|
52
|
+
out += `<span class="tok-com">${esc(m[1])}</span>`;
|
|
53
|
+
}
|
|
54
|
+
else if (m[2] != null) {
|
|
55
|
+
out += `<span class="tok-tag">${esc(m[2])}</span>`;
|
|
56
|
+
}
|
|
57
|
+
else if (m[3] != null) {
|
|
58
|
+
out += `<span class="tok-attr">${esc(m[3])}</span>=`;
|
|
59
|
+
}
|
|
60
|
+
else if (m[4] != null) {
|
|
61
|
+
out += `"<span class="tok-str">${esc(m[4])}</span>"`;
|
|
62
|
+
}
|
|
63
|
+
else if (m[5] != null) {
|
|
64
|
+
out += `<span class="tok-tag">${esc(m[5])}</span>`;
|
|
65
|
+
}
|
|
66
|
+
else if (m[6] != null) {
|
|
67
|
+
out += '\n';
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
out += esc(m[0]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
export class PrismTemplatePopoverComponent {
|
|
76
|
+
navigationService = inject(PrismNavigationService);
|
|
77
|
+
rendererService = inject(PrismRendererService);
|
|
78
|
+
layoutService = inject(PrismLayoutService);
|
|
79
|
+
copied = signal(false, ...(ngDevMode ? [{ debugName: "copied" }] : []));
|
|
80
|
+
copiedResetTimer = null;
|
|
81
|
+
snippet = computed(() => {
|
|
82
|
+
const comp = this.navigationService.activeComponent();
|
|
83
|
+
if (!comp)
|
|
84
|
+
return '';
|
|
85
|
+
const variant = comp.meta.showcaseConfig.variants?.[this.rendererService.activeVariantIndex()];
|
|
86
|
+
const explicitKeys = variant?.inputs
|
|
87
|
+
? new Set(Object.keys(variant.inputs))
|
|
88
|
+
: undefined;
|
|
89
|
+
const directiveOptions = comp.meta.componentMeta.isDirective
|
|
90
|
+
? { host: comp.meta.showcaseConfig.host }
|
|
91
|
+
: undefined;
|
|
92
|
+
return generateSnippet(comp.meta.componentMeta.selector, comp.meta.inputs, this.rendererService.inputValues(), explicitKeys, this.rendererService.activeContent(), directiveOptions);
|
|
93
|
+
}, ...(ngDevMode ? [{ debugName: "snippet" }] : []));
|
|
94
|
+
highlighted = computed(() => {
|
|
95
|
+
const code = this.snippet();
|
|
96
|
+
if (!code)
|
|
97
|
+
return '';
|
|
98
|
+
return tokenizeXml(code);
|
|
99
|
+
}, ...(ngDevMode ? [{ debugName: "highlighted" }] : []));
|
|
100
|
+
copy() {
|
|
101
|
+
const code = this.snippet();
|
|
102
|
+
if (!code)
|
|
103
|
+
return;
|
|
104
|
+
navigator.clipboard?.writeText(code);
|
|
105
|
+
this.copied.set(true);
|
|
106
|
+
if (this.copiedResetTimer)
|
|
107
|
+
clearTimeout(this.copiedResetTimer);
|
|
108
|
+
this.copiedResetTimer = setTimeout(() => this.copied.set(false), 1500);
|
|
109
|
+
}
|
|
110
|
+
onEscape() {
|
|
111
|
+
if (this.layoutService.templatePopoverVisible()) {
|
|
112
|
+
this.layoutService.closeTemplatePopover();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
static ɵfac = function PrismTemplatePopoverComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismTemplatePopoverComponent)(); };
|
|
116
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismTemplatePopoverComponent, selectors: [["prism-template-popover"]], hostBindings: function PrismTemplatePopoverComponent_HostBindings(rf, ctx) { if (rf & 1) {
|
|
117
|
+
i0.ɵɵlistener("keydown.escape", function PrismTemplatePopoverComponent_keydown_escape_HostBindingHandler() { return ctx.onEscape(); }, i0.ɵɵresolveDocument);
|
|
118
|
+
} }, decls: 1, vars: 1, consts: [["role", "dialog", "aria-label", "Angular template", 1, "tpl-popover"], ["role", "dialog", "aria-label", "Angular template", 1, "tpl-popover", 3, "click"], [1, "tpl-popover-head"], ["name", "code", 3, "size"], [1, "tpl-popover-copy", 3, "click", "title"], [3, "name", "size"], ["aria-label", "Close", "title", "Close (Esc)", 1, "tpl-popover-close", 3, "click"], ["name", "x", 3, "size"], [1, "tpl-popover-body", 3, "innerHTML"]], template: function PrismTemplatePopoverComponent_Template(rf, ctx) { if (rf & 1) {
|
|
119
|
+
i0.ɵɵconditionalCreate(0, PrismTemplatePopoverComponent_Conditional_0_Template, 11, 7, "div", 0);
|
|
120
|
+
} if (rf & 2) {
|
|
121
|
+
i0.ɵɵconditional(ctx.layoutService.templatePopoverVisible() ? 0 : -1);
|
|
122
|
+
} }, dependencies: [PrismIconComponent], styles: ["[_nghost-%COMP%] { display: contents; }\n\n .tpl-popover[_ngcontent-%COMP%] {\n position: absolute;\n right: 20px;\n top: 8px;\n width: 520px;\n max-width: calc(100% - 40px);\n max-height: min(420px, calc(100% - 16px));\n background: var(--prism-bg-elevated);\n border: 1px solid var(--prism-border-strong);\n border-radius: var(--radius-lg, 10px);\n box-shadow:\n 0 20px 60px rgba(0, 0, 0, 0.45),\n 0 0 0 1px color-mix(in srgb, var(--prism-primary) 10%, transparent);\n display: flex;\n flex-direction: column;\n z-index: 30;\n overflow: hidden;\n animation: _ngcontent-%COMP%_tpl-fade-in var(--dur-fast, 0.15s) var(--ease-default, ease-out);\n }\n\n @keyframes _ngcontent-%COMP%_tpl-fade-in {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .tpl-popover-head[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 0 12px 0 16px;\n height: 40px;\n border-bottom: 1px solid var(--prism-border);\n background: linear-gradient(\n 180deg,\n var(--prism-bg-surface),\n var(--prism-bg-elevated)\n );\n flex-shrink: 0;\n }\n .tpl-popover-head[_ngcontent-%COMP%] > prism-icon[_ngcontent-%COMP%] {\n color: var(--prism-text-muted);\n }\n .tpl-popover-head[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] {\n flex: 1;\n font-size: var(--fs-xs);\n font-weight: 700;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--prism-text-2);\n }\n\n .tpl-popover-copy[_ngcontent-%COMP%] {\n height: 26px;\n padding: 0 10px;\n font-size: var(--fs-sm);\n font-family: var(--font-sans);\n font-weight: 500;\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n border-radius: var(--radius-sm, 5px);\n display: flex;\n align-items: center;\n gap: 5px;\n cursor: pointer;\n transition: background var(--dur-fast);\n }\n .tpl-popover-copy[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n\n .tpl-popover-close[_ngcontent-%COMP%] {\n width: 26px;\n height: 26px;\n display: grid;\n place-items: center;\n border-radius: var(--radius-sm, 5px);\n color: var(--prism-text-muted);\n background: transparent;\n border: 0;\n cursor: pointer;\n transition: background var(--dur-fast), color var(--dur-fast);\n }\n .tpl-popover-close[_ngcontent-%COMP%]:hover {\n color: var(--prism-text);\n background: var(--prism-input-bg);\n }\n\n .tpl-popover-body[_ngcontent-%COMP%] {\n margin: 0;\n padding: 14px 18px;\n font-family: var(--font-mono);\n font-size: var(--fs-md);\n line-height: 1.7;\n color: var(--prism-text-2);\n overflow: auto;\n background: var(--prism-bg);\n flex: 1;\n min-height: 0;\n white-space: pre;\n }\n .tpl-popover-body[_ngcontent-%COMP%]::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n }\n .tpl-popover-body[_ngcontent-%COMP%]::-webkit-scrollbar-thumb {\n background: var(--prism-border-strong);\n border-radius: 3px;\n }\n\n [_nghost-%COMP%] .tok-tag { color: var(--prism-code-tag); }\n [_nghost-%COMP%] .tok-attr { color: var(--prism-code-attr); }\n [_nghost-%COMP%] .tok-str { color: var(--prism-code-str); }\n [_nghost-%COMP%] .tok-com { color: var(--prism-code-com); font-style: italic; }"], changeDetection: 0 });
|
|
123
|
+
}
|
|
124
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismTemplatePopoverComponent, [{
|
|
125
|
+
type: Component,
|
|
126
|
+
args: [{ selector: 'prism-template-popover', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: `
|
|
127
|
+
@if (layoutService.templatePopoverVisible()) {
|
|
128
|
+
<div
|
|
129
|
+
class="tpl-popover"
|
|
130
|
+
role="dialog"
|
|
131
|
+
aria-label="Angular template"
|
|
132
|
+
(click)="$event.stopPropagation()"
|
|
133
|
+
>
|
|
134
|
+
<div class="tpl-popover-head">
|
|
135
|
+
<prism-icon name="code" [size]="13" />
|
|
136
|
+
<span>Angular Template</span>
|
|
137
|
+
<button
|
|
138
|
+
class="tpl-popover-copy"
|
|
139
|
+
(click)="copy()"
|
|
140
|
+
[title]="copied() ? 'Copied!' : 'Copy to clipboard'"
|
|
141
|
+
>
|
|
142
|
+
<prism-icon [name]="copied() ? 'shield-check' : 'copy'" [size]="12" />
|
|
143
|
+
{{ copied() ? 'Copied' : 'Copy' }}
|
|
144
|
+
</button>
|
|
145
|
+
<button
|
|
146
|
+
class="tpl-popover-close"
|
|
147
|
+
(click)="layoutService.closeTemplatePopover()"
|
|
148
|
+
aria-label="Close"
|
|
149
|
+
title="Close (Esc)"
|
|
150
|
+
>
|
|
151
|
+
<prism-icon name="x" [size]="13" />
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
<pre class="tpl-popover-body" [innerHTML]="highlighted()"></pre>
|
|
155
|
+
</div>
|
|
156
|
+
}
|
|
157
|
+
`, styles: ["\n :host { display: contents; }\n\n .tpl-popover {\n position: absolute;\n right: 20px;\n top: 8px;\n width: 520px;\n max-width: calc(100% - 40px);\n max-height: min(420px, calc(100% - 16px));\n background: var(--prism-bg-elevated);\n border: 1px solid var(--prism-border-strong);\n border-radius: var(--radius-lg, 10px);\n box-shadow:\n 0 20px 60px rgba(0, 0, 0, 0.45),\n 0 0 0 1px color-mix(in srgb, var(--prism-primary) 10%, transparent);\n display: flex;\n flex-direction: column;\n z-index: 30;\n overflow: hidden;\n animation: tpl-fade-in var(--dur-fast, 0.15s) var(--ease-default, ease-out);\n }\n\n @keyframes tpl-fade-in {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .tpl-popover-head {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 0 12px 0 16px;\n height: 40px;\n border-bottom: 1px solid var(--prism-border);\n background: linear-gradient(\n 180deg,\n var(--prism-bg-surface),\n var(--prism-bg-elevated)\n );\n flex-shrink: 0;\n }\n .tpl-popover-head > prism-icon {\n color: var(--prism-text-muted);\n }\n .tpl-popover-head > span {\n flex: 1;\n font-size: var(--fs-xs);\n font-weight: 700;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--prism-text-2);\n }\n\n .tpl-popover-copy {\n height: 26px;\n padding: 0 10px;\n font-size: var(--fs-sm);\n font-family: var(--font-sans);\n font-weight: 500;\n color: var(--prism-primary);\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n border-radius: var(--radius-sm, 5px);\n display: flex;\n align-items: center;\n gap: 5px;\n cursor: pointer;\n transition: background var(--dur-fast);\n }\n .tpl-popover-copy:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n\n .tpl-popover-close {\n width: 26px;\n height: 26px;\n display: grid;\n place-items: center;\n border-radius: var(--radius-sm, 5px);\n color: var(--prism-text-muted);\n background: transparent;\n border: 0;\n cursor: pointer;\n transition: background var(--dur-fast), color var(--dur-fast);\n }\n .tpl-popover-close:hover {\n color: var(--prism-text);\n background: var(--prism-input-bg);\n }\n\n .tpl-popover-body {\n margin: 0;\n padding: 14px 18px;\n font-family: var(--font-mono);\n font-size: var(--fs-md);\n line-height: 1.7;\n color: var(--prism-text-2);\n overflow: auto;\n background: var(--prism-bg);\n flex: 1;\n min-height: 0;\n white-space: pre;\n }\n .tpl-popover-body::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n }\n .tpl-popover-body::-webkit-scrollbar-thumb {\n background: var(--prism-border-strong);\n border-radius: 3px;\n }\n\n :host ::ng-deep .tok-tag { color: var(--prism-code-tag); }\n :host ::ng-deep .tok-attr { color: var(--prism-code-attr); }\n :host ::ng-deep .tok-str { color: var(--prism-code-str); }\n :host ::ng-deep .tok-com { color: var(--prism-code-com); font-style: italic; }\n "] }]
|
|
158
|
+
}], null, { onEscape: [{
|
|
159
|
+
type: HostListener,
|
|
160
|
+
args: ['document:keydown.escape']
|
|
161
|
+
}] }); })();
|
|
162
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismTemplatePopoverComponent, { className: "PrismTemplatePopoverComponent", filePath: "app/canvas/prism-template-popover.component.ts", lineNumber: 206 }); })();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-icon.component.d.ts","sourceRoot":"","sources":["../../../src/app/icons/prism-icon.component.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"prism-icon.component.d.ts","sourceRoot":"","sources":["../../../src/app/icons/prism-icon.component.ts"],"names":[],"mappings":";AAkDA,qBAOa,kBAAkB;IAC7B,QAAQ,CAAC,IAAI,8CAA4B;IACzC,QAAQ,CAAC,IAAI,8CAAa;IAE1B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAmC;;yCAJ3C,kBAAkB;2CAAlB,kBAAkB;CAkC9B"}
|
|
@@ -24,6 +24,8 @@ const ICONS = {
|
|
|
24
24
|
copy: '<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',
|
|
25
25
|
'maximize-2': '<path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3m8 0h3a2 2 0 0 0 2-2v-3"/>',
|
|
26
26
|
eye: '<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',
|
|
27
|
+
code: '<path d="m18 16 4-4-4-4M6 8l-4 4 4 4m8.5-12-5 16"/>',
|
|
28
|
+
x: '<path d="M18 6 6 18M6 6l12 12"/>',
|
|
27
29
|
};
|
|
28
30
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
29
31
|
export class PrismIconComponent {
|
|
@@ -61,4 +63,4 @@ export class PrismIconComponent {
|
|
|
61
63
|
type: Component,
|
|
62
64
|
args: [{ selector: 'prism-icon', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: ``, styles: [":host { display: inline-flex; align-items: center; justify-content: center; }"] }]
|
|
63
65
|
}], () => [], { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] }); })();
|
|
64
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismIconComponent, { className: "PrismIconComponent", filePath: "app/icons/prism-icon.component.ts", lineNumber:
|
|
66
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismIconComponent, { className: "PrismIconComponent", filePath: "app/icons/prism-icon.component.ts", lineNumber: 58 }); })();
|
|
@@ -2,12 +2,14 @@ import { Injector, type Type } from '@angular/core';
|
|
|
2
2
|
import { PrismNavigationService } from '../services/prism-navigation.service.js';
|
|
3
3
|
import { PrismRendererService } from '../services/prism-renderer.service.js';
|
|
4
4
|
import { PrismCanvasService } from '../services/prism-canvas.service.js';
|
|
5
|
+
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class PrismRendererComponent {
|
|
7
8
|
protected readonly Math: Math;
|
|
8
9
|
protected readonly navigationService: PrismNavigationService;
|
|
9
10
|
protected readonly rendererService: PrismRendererService;
|
|
10
11
|
protected readonly canvasService: PrismCanvasService;
|
|
12
|
+
protected readonly variantBg: PrismVariantBgService;
|
|
11
13
|
private readonly eventLogService;
|
|
12
14
|
private readonly manifestService;
|
|
13
15
|
private readonly injector;
|
|
@@ -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;;
|
|
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;;AAIhF,qBA8Ha,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,SAAS,CAAC,QAAQ,CAAC,aAAa;;MAA6C;IAC7E,SAAS,CAAC,QAAQ,CAAC,eAAe,yFAG/B;;IA0FH,OAAO,CAAC,eAAe;IA6FvB,OAAO,CAAC,OAAO;yCAxNJ,sBAAsB;2CAAtB,sBAAsB;CAsOlC"}
|