@ng-prism/core 22.2.0-beta.5 → 22.2.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/canvas-bg.styles.d.ts +19 -0
- package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -0
- package/dist/app/canvas/canvas-bg.styles.js +58 -0
- package/dist/app/canvas/prism-canvas-bg-pill.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-bg-pill.component.js +3 -3
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +25 -7
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +152 -121
- package/dist/app/canvas/prism-template-popover.component.d.ts +0 -3
- package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-template-popover.component.js +43 -59
- package/dist/app/component-head/head-metrics.d.ts +41 -0
- package/dist/app/component-head/head-metrics.d.ts.map +1 -0
- package/dist/app/component-head/head-metrics.js +39 -0
- package/dist/app/component-head/prism-component-head.component.d.ts +10 -2
- package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-component-head.component.js +107 -209
- package/dist/app/component-head/prism-head-gauge.component.d.ts +23 -0
- package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -0
- package/dist/app/component-head/prism-head-gauge.component.js +123 -0
- package/dist/app/component-head/prism-head-info.component.d.ts +23 -0
- package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -0
- package/dist/app/component-head/prism-head-info.component.js +124 -0
- package/dist/app/component-head/prism-stat.component.d.ts +10 -4
- package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-stat.component.js +34 -44
- package/dist/app/header/prism-header.component.js +2 -2
- package/dist/app/icons/icon-registry.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.js +2 -0
- package/dist/app/index.d.ts +3 -1
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +26 -1
- package/dist/app/layout-menu/prism-layout-menu.component.js +2 -2
- package/dist/app/overview/overview-panel.d.ts +3 -0
- package/dist/app/overview/overview-panel.d.ts.map +1 -0
- package/dist/app/overview/overview-panel.js +9 -0
- package/dist/app/overview/overview-visibility.d.ts +15 -0
- package/dist/app/overview/overview-visibility.d.ts.map +1 -0
- package/dist/app/overview/overview-visibility.js +18 -0
- package/dist/app/overview/prism-overview-cell.component.d.ts +29 -0
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -0
- package/dist/app/overview/prism-overview-cell.component.js +136 -0
- package/dist/app/overview/prism-overview.component.d.ts +17 -0
- package/dist/app/overview/prism-overview.component.d.ts.map +1 -0
- package/dist/app/overview/prism-overview.component.js +53 -0
- package/dist/app/page-renderer/prism-page-renderer.component.d.ts.map +1 -1
- package/dist/app/page-renderer/prism-page-renderer.component.js +3 -3
- package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-header-badge.component.js +21 -30
- package/dist/app/panels/builtin-panels.d.ts.map +1 -1
- package/dist/app/panels/builtin-panels.js +2 -0
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.js +15 -11
- package/dist/app/renderer/prism-renderer.component.d.ts +0 -1
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +9 -71
- package/dist/app/renderer/projectable-content.d.ts +10 -0
- package/dist/app/renderer/projectable-content.d.ts.map +1 -0
- package/dist/app/renderer/projectable-content.js +60 -0
- package/dist/app/services/prism-capture.service.d.ts.map +1 -1
- package/dist/app/services/prism-capture.service.js +20 -0
- package/dist/app/services/prism-layout.service.d.ts +0 -3
- package/dist/app/services/prism-layout.service.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.js +0 -8
- package/dist/app/services/prism-panel.service.d.ts +18 -0
- package/dist/app/services/prism-panel.service.d.ts.map +1 -1
- package/dist/app/services/prism-panel.service.js +28 -0
- package/dist/app/shared/prism-metric-badge.component.d.ts +32 -0
- package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -0
- package/dist/app/shared/prism-metric-badge.component.js +70 -0
- package/dist/app/shell/prism-shell.component.d.ts +0 -1
- package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
- package/dist/app/shell/prism-shell.component.js +56 -48
- package/dist/app/sidebar/navigation-decorations.d.ts +6 -3
- package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
- package/dist/app/sidebar/navigation-decorations.js +7 -4
- package/dist/app/sidebar/prism-sidebar.component.d.ts +11 -7
- package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
- package/dist/app/sidebar/prism-sidebar.component.js +61 -83
- package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
- package/dist/app/theme/prism-default-theme.js +44 -4
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts +4 -1
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +13 -26
- package/dist/app/variant-ribbon/spectrum.d.ts +19 -0
- package/dist/app/variant-ribbon/spectrum.d.ts.map +1 -0
- package/dist/app/variant-ribbon/spectrum.js +15 -0
- package/dist/app/view-tab-bar/next-view-id.d.ts +12 -0
- package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -0
- package/dist/app/view-tab-bar/next-view-id.js +16 -0
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts +0 -1
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-panel-host.component.js +10 -11
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts +0 -1
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +6 -13
- package/dist/transformer/cli.js +0 -0
- package/package.json +1 -1
- package/dist/app/canvas/prism-code-drawer.component.d.ts +0 -14
- package/dist/app/canvas/prism-code-drawer.component.d.ts.map +0 -1
- package/dist/app/canvas/prism-code-drawer.component.js +0 -116
- package/dist/app/component-header/prism-component-header.component.d.ts +0 -8
- package/dist/app/component-header/prism-component-header.component.d.ts.map +0 -1
- package/dist/app/component-header/prism-component-header.component.js +0 -77
- package/dist/cli/audit-a11y/aggregator.d.ts +0 -10
- package/dist/cli/audit-a11y/aggregator.d.ts.map +0 -1
- package/dist/cli/audit-a11y/aggregator.js +0 -64
- package/dist/cli/audit-a11y/auditor.d.ts +0 -14
- package/dist/cli/audit-a11y/auditor.d.ts.map +0 -1
- package/dist/cli/audit-a11y/auditor.js +0 -104
- package/dist/cli/audit-a11y/cli.d.ts +0 -3
- package/dist/cli/audit-a11y/cli.d.ts.map +0 -1
- package/dist/cli/audit-a11y/cli.js +0 -143
- package/dist/cli/audit-a11y/index.d.ts +0 -4
- package/dist/cli/audit-a11y/index.d.ts.map +0 -1
- package/dist/cli/audit-a11y/index.js +0 -3
- package/dist/cli/audit-a11y/static-server.d.ts +0 -11
- package/dist/cli/audit-a11y/static-server.d.ts.map +0 -1
- package/dist/cli/audit-a11y/static-server.js +0 -61
|
@@ -13,33 +13,28 @@ import { PrismCaptureService } from '../services/prism-capture.service.js';
|
|
|
13
13
|
import { PrismVariantBgService } from '../services/prism-variant-bg.service.js';
|
|
14
14
|
import { PrismCanvasRulersComponent } from '../canvas/prism-canvas-rulers.component.js';
|
|
15
15
|
import { PrismCanvasBgPillComponent } from '../canvas/prism-canvas-bg-pill.component.js';
|
|
16
|
+
import { CANVAS_BG_STYLES } from '../canvas/canvas-bg.styles.js';
|
|
16
17
|
import { buildKnownInputs } from './known-inputs.js';
|
|
17
18
|
import { resolveOverlay } from './overlay-resolver.js';
|
|
19
|
+
import { parseContentToNodes } from './projectable-content.js';
|
|
18
20
|
import * as i0 from "@angular/core";
|
|
19
21
|
const _c0 = ["outlet"];
|
|
20
22
|
function PrismRendererComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
21
|
-
i0.ɵɵ
|
|
22
|
-
i0.ɵɵtext(2);
|
|
23
|
-
i0.ɵɵelementEnd()();
|
|
24
|
-
i0.ɵɵelement(3, "div", 5)(4, "prism-canvas-rulers")(5, "prism-canvas-bg-pill");
|
|
23
|
+
i0.ɵɵelement(0, "div", 3)(1, "prism-canvas-rulers")(2, "prism-canvas-bg-pill");
|
|
25
24
|
} if (rf & 2) {
|
|
26
25
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
27
|
-
i0.ɵɵadvance(2);
|
|
28
|
-
i0.ɵɵtextInterpolate1("", ctx_r0.Math.round(ctx_r0.canvasService.zoom() * 100), "%");
|
|
29
|
-
i0.ɵɵadvance();
|
|
30
26
|
i0.ɵɵclassProp("visible", ctx_r0.canvasService.guides());
|
|
31
27
|
} }
|
|
32
28
|
function PrismRendererComponent_Conditional_5_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
33
29
|
i0.ɵɵelementContainer(0);
|
|
34
30
|
} }
|
|
35
31
|
function PrismRendererComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
-
i0.ɵɵtemplate(0, PrismRendererComponent_Conditional_5_ng_container_0_Template, 1, 0, "ng-container",
|
|
32
|
+
i0.ɵɵtemplate(0, PrismRendererComponent_Conditional_5_ng_container_0_Template, 1, 0, "ng-container", 4);
|
|
37
33
|
} if (rf & 2) {
|
|
38
34
|
const ctx_r0 = i0.ɵɵnextContext();
|
|
39
35
|
i0.ɵɵproperty("ngComponentOutlet", ctx_r0.activeOverlay())("ngComponentOutletInputs", ctx_r0.overlayInputs)("ngComponentOutletInjector", ctx_r0.overlayInjector());
|
|
40
36
|
} }
|
|
41
37
|
export class PrismRendererComponent {
|
|
42
|
-
Math = Math;
|
|
43
38
|
navigationService = inject(PrismNavigationService);
|
|
44
39
|
rendererService = inject(PrismRendererService);
|
|
45
40
|
canvasService = inject(PrismCanvasService);
|
|
@@ -235,9 +230,9 @@ export class PrismRendererComponent {
|
|
|
235
230
|
i0.ɵɵviewQuerySignal(ctx.outlet, _c0, 5, ViewContainerRef);
|
|
236
231
|
} if (rf & 2) {
|
|
237
232
|
i0.ɵɵqueryAdvance();
|
|
238
|
-
} }, decls: 6, vars: 8, consts: [["outlet", ""], [1, "prism-canvas-stage"], [1, "demo-wrap"], [1, "
|
|
233
|
+
} }, decls: 6, vars: 8, consts: [["outlet", ""], [1, "prism-canvas-stage"], [1, "demo-wrap"], [1, "stage-crosshair"], [4, "ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector"]], template: function PrismRendererComponent_Template(rf, ctx) { if (rf & 1) {
|
|
239
234
|
i0.ɵɵelementStart(0, "div", 1);
|
|
240
|
-
i0.ɵɵconditionalCreate(1, PrismRendererComponent_Conditional_1_Template,
|
|
235
|
+
i0.ɵɵconditionalCreate(1, PrismRendererComponent_Conditional_1_Template, 3, 2);
|
|
241
236
|
i0.ɵɵelementStart(2, "div", 2);
|
|
242
237
|
i0.ɵɵelementContainer(3, null, 0);
|
|
243
238
|
i0.ɵɵconditionalCreate(5, PrismRendererComponent_Conditional_5_Template, 1, 3, "ng-container");
|
|
@@ -253,7 +248,7 @@ export class PrismRendererComponent {
|
|
|
253
248
|
i0.ɵɵconditional(ctx.activeOverlay() ? 5 : -1);
|
|
254
249
|
} }, dependencies: [PrismCanvasRulersComponent,
|
|
255
250
|
PrismCanvasBgPillComponent,
|
|
256
|
-
NgComponentOutlet], styles: ["[_nghost-%COMP%] {
|
|
251
|
+
NgComponentOutlet], styles: ["[_nghost-%COMP%] {\n display: block;\n min-height: 0;\n flex: 1;\n }\n\n .prism-canvas-stage[_ngcontent-%COMP%] {\n position: relative;\n overflow: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 32px;\n min-height: 200px;\n height: 100%;\n background-color: var(--%NS%prism-stage);\n\n \n\n\n\n\n\n\n\n\n\n\n outline: 1px solid var(--%NS%prism-stage-edge);\n outline-offset: -1px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),\n 0 8px 24px -12px rgba(0, 0, 0, 0.18);\n transition: filter var(--%NS%dur-base);\n --%NS%prism-canvas-overlay-top: 12px;\n --%NS%prism-canvas-overlay-inline: 20px;\n }\n .prism-canvas-stage[data-rulers][_ngcontent-%COMP%] {\n --%NS%prism-canvas-overlay-top: 28px;\n --%NS%prism-canvas-overlay-inline: 28px;\n }\n\n .stage-crosshair[_ngcontent-%COMP%] {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--%NS%dur-base);\n }\n .stage-crosshair.visible[_ngcontent-%COMP%] {\n opacity: 1;\n }\n .stage-crosshair[_ngcontent-%COMP%]::before, \n .stage-crosshair[_ngcontent-%COMP%]::after {\n content: '';\n position: absolute;\n background: color-mix(in srgb, var(--%NS%prism-primary) 20%, transparent);\n }\n .stage-crosshair[_ngcontent-%COMP%]::before {\n left: 0;\n right: 0;\n top: 50%;\n height: 1px;\n }\n .stage-crosshair[_ngcontent-%COMP%]::after {\n top: 0;\n bottom: 0;\n left: 50%;\n width: 1px;\n }\n\n .demo-wrap[_ngcontent-%COMP%] {\n position: relative;\n display: inline-block;\n transform: scale(var(--%NS%zoom, 1));\n transition: transform 0.18s;\n }\n .demo-wrap[data-canvas-layout='stretch'][_ngcontent-%COMP%] {\n display: block;\n width: 100%;\n max-width: 800px;\n }", "[data-bg=\"dots\"][_ngcontent-%COMP%] {\n background-image: radial-gradient(circle, var(--%NS%prism-dot) 1px, transparent 1px);\n background-size: 20px 20px;\n }\n\n [data-bg=\"plain\"][_ngcontent-%COMP%] {\n background-image: none;\n }\n\n \n\n\n\n\n [data-bg=\"light\"][_ngcontent-%COMP%] {\n background-color: var(--%NS%prism-void-light, #f7f5fc);\n background-image: none;\n }\n [data-bg=\"dark\"][_ngcontent-%COMP%] {\n background-color: var(--%NS%prism-void-dark, #07050f);\n background-image: none;\n }\n\n \n\n\n\n\n\n [data-bg=\"checker\"][_ngcontent-%COMP%], \n [data-bg=\"transparent\"][_ngcontent-%COMP%] {\n background-image:\n linear-gradient(45deg, var(--%NS%prism-border) 25%, transparent 25%),\n linear-gradient(-45deg, var(--%NS%prism-border) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--%NS%prism-border) 75%),\n linear-gradient(-45deg, transparent 75%, var(--%NS%prism-border) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n }"] });
|
|
257
252
|
}
|
|
258
253
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismRendererComponent, [{
|
|
259
254
|
type: Component,
|
|
@@ -268,11 +263,6 @@ export class PrismRendererComponent {
|
|
|
268
263
|
[attr.data-rulers]="canvasService.rulers() ? '' : null"
|
|
269
264
|
>
|
|
270
265
|
@if (!capture.active()) {
|
|
271
|
-
<div class="canvas-badges">
|
|
272
|
-
<span class="c-badge"
|
|
273
|
-
>{{ Math.round(canvasService.zoom() * 100) }}%</span
|
|
274
|
-
>
|
|
275
|
-
</div>
|
|
276
266
|
<div
|
|
277
267
|
class="stage-crosshair"
|
|
278
268
|
[class.visible]="canvasService.guides()"
|
|
@@ -299,60 +289,8 @@ export class PrismRendererComponent {
|
|
|
299
289
|
}
|
|
300
290
|
</div>
|
|
301
291
|
</div>
|
|
302
|
-
`, styles: ["\n
|
|
292
|
+
`, styles: ["\n :host {\n display: block;\n min-height: 0;\n flex: 1;\n }\n\n .prism-canvas-stage {\n position: relative;\n overflow: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 32px;\n min-height: 200px;\n height: 100%;\n background-color: var(--prism-stage);\n\n /* The edge is outline + shadow, never border and never extra padding.\n plugin-visual-regression screenshots .demo-wrap, which is centred in\n this element; a border would shrink the content box by 2px and move\n that centre, shifting all 15 baselines in test-workspace/vrt/baseline\n without a single component having changed. Capture mode resets this\n element's padding but not its border, and this repo has no VRT runner\n to catch the drift. outline and box-shadow do not participate in\n layout, so the box is provably unchanged. Keep it that way.\n They do still paint, and outline-offset is negative, so the line lands\n inside the box: CAPTURE_STYLES in prism-capture.service.ts sets both\n to none, which is only safe because neither is load-bearing here. */\n outline: 1px solid var(--prism-stage-edge);\n outline-offset: -1px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1),\n 0 8px 24px -12px rgba(0, 0, 0, 0.18);\n transition: filter var(--dur-base);\n --prism-canvas-overlay-top: 12px;\n --prism-canvas-overlay-inline: 20px;\n }\n .prism-canvas-stage[data-rulers] {\n --prism-canvas-overlay-top: 28px;\n --prism-canvas-overlay-inline: 28px;\n }\n\n .stage-crosshair {\n position: absolute;\n inset: 0;\n pointer-events: none;\n opacity: 0;\n transition: opacity var(--dur-base);\n }\n .stage-crosshair.visible {\n opacity: 1;\n }\n .stage-crosshair::before,\n .stage-crosshair::after {\n content: '';\n position: absolute;\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n .stage-crosshair::before {\n left: 0;\n right: 0;\n top: 50%;\n height: 1px;\n }\n .stage-crosshair::after {\n top: 0;\n bottom: 0;\n left: 50%;\n width: 1px;\n }\n\n .demo-wrap {\n position: relative;\n display: inline-block;\n transform: scale(var(--zoom, 1));\n transition: transform 0.18s;\n }\n .demo-wrap[data-canvas-layout='stretch'] {\n display: block;\n width: 100%;\n max-width: 800px;\n }\n ", "\n [data-bg=\"dots\"] {\n background-image: radial-gradient(circle, var(--prism-dot) 1px, transparent 1px);\n background-size: 20px 20px;\n }\n\n [data-bg=\"plain\"] {\n background-image: none;\n }\n\n /* Flat, not dotted. \"light\" and \"dark\" name a surface a component was\n designed against \u2014 and they are the two backgrounds whose colour is\n absolute rather than a theme token, which is what makes them the values\n to declare for a screenshot baseline. \"dots\" already exists for anyone\n who wants the grid. */\n [data-bg=\"light\"] {\n background-color: var(--prism-void-light, #f7f5fc);\n background-image: none;\n }\n [data-bg=\"dark\"] {\n background-color: var(--prism-void-dark, #07050f);\n background-image: none;\n }\n\n /* \"transparent\" shares the checkerboard on purpose. The two say the same\n thing in the two media the canvas has: while browsing, the checkerboard\n is already the UI's word for \"no surface here\"; in a capture it becomes\n literal transparency. A stage that were really see-through in the app\n would just show the shell through the canvas, which means nothing. The\n split between the two lives entirely in CAPTURE_STYLES. */\n [data-bg=\"checker\"],\n [data-bg=\"transparent\"] {\n background-image:\n linear-gradient(45deg, var(--prism-border) 25%, transparent 25%),\n linear-gradient(-45deg, var(--prism-border) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--prism-border) 75%),\n linear-gradient(-45deg, transparent 75%, var(--prism-border) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n }\n"] }]
|
|
303
293
|
}], () => [], { outlet: [{ type: i0.ViewChild, args: ['outlet', { ...{
|
|
304
294
|
read: ViewContainerRef,
|
|
305
295
|
}, isSignal: true }] }] }); })();
|
|
306
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber:
|
|
307
|
-
// SAFETY: `content` originates from `@Showcase({ variants: [{ content }] })`
|
|
308
|
-
// in developer-authored source code. It is trusted by ng-prism's threat model
|
|
309
|
-
// (see SECURITY.md). Sanitization would strip the Angular component/directive
|
|
310
|
-
// selectors that variant content is meant to project.
|
|
311
|
-
function parseContentToNodes(content) {
|
|
312
|
-
if (typeof content === 'string') {
|
|
313
|
-
return [htmlToNodes(content)];
|
|
314
|
-
}
|
|
315
|
-
const defaultNodes = content['default']
|
|
316
|
-
? htmlToNodes(content['default'])
|
|
317
|
-
: [];
|
|
318
|
-
const result = [defaultNodes];
|
|
319
|
-
for (const [selector, html] of Object.entries(content)) {
|
|
320
|
-
if (selector === 'default')
|
|
321
|
-
continue;
|
|
322
|
-
const wrapper = document.createElement('div');
|
|
323
|
-
// SAFETY: trusted developer-authored HTML — see SECURITY.md.
|
|
324
|
-
wrapper.innerHTML = html;
|
|
325
|
-
const nodes = [];
|
|
326
|
-
for (const child of Array.from(wrapper.childNodes)) {
|
|
327
|
-
const el = document.createElement('div');
|
|
328
|
-
// SAFETY: trusted developer-authored HTML — see SECURITY.md.
|
|
329
|
-
el.innerHTML = child.outerHTML ?? child.textContent ?? '';
|
|
330
|
-
const projected = el.firstChild;
|
|
331
|
-
if (projected && projected instanceof Element) {
|
|
332
|
-
applySelector(projected, selector);
|
|
333
|
-
nodes.push(projected);
|
|
334
|
-
}
|
|
335
|
-
else if (projected) {
|
|
336
|
-
const span = document.createElement('span');
|
|
337
|
-
applySelector(span, selector);
|
|
338
|
-
span.textContent = child.textContent;
|
|
339
|
-
nodes.push(span);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
result.push(nodes);
|
|
343
|
-
}
|
|
344
|
-
return result;
|
|
345
|
-
}
|
|
346
|
-
// SAFETY: see `parseContentToNodes` above and SECURITY.md — `html` is trusted
|
|
347
|
-
// developer-authored variant content from the `@Showcase` decorator.
|
|
348
|
-
function htmlToNodes(html) {
|
|
349
|
-
const wrapper = document.createElement('div');
|
|
350
|
-
wrapper.innerHTML = html;
|
|
351
|
-
return Array.from(wrapper.childNodes);
|
|
352
|
-
}
|
|
353
|
-
function applySelector(el, selector) {
|
|
354
|
-
const attrMatch = selector.match(/^\[([^\]=]+)]$/);
|
|
355
|
-
if (attrMatch) {
|
|
356
|
-
el.setAttribute(attrMatch[1], '');
|
|
357
|
-
}
|
|
358
|
-
}
|
|
296
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismRendererComponent, { className: "PrismRendererComponent", filePath: "app/renderer/prism-renderer.component.ts", lineNumber: 172 }); })();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns per-variant `content` into the `projectableNodes` argument of
|
|
3
|
+
* `ViewContainerRef.createComponent`.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the Playground stage and the Overview cells: both project the same
|
|
6
|
+
* developer-authored content, and the slot-selector handling is the one piece
|
|
7
|
+
* of that neither wants to own twice.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseContentToNodes(content: string | Record<string, string>): Node[][];
|
|
10
|
+
//# sourceMappingURL=projectable-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectable-content.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/projectable-content.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,IAAI,EAAE,EAAE,CAmCV"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns per-variant `content` into the `projectableNodes` argument of
|
|
3
|
+
* `ViewContainerRef.createComponent`.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the Playground stage and the Overview cells: both project the same
|
|
6
|
+
* developer-authored content, and the slot-selector handling is the one piece
|
|
7
|
+
* of that neither wants to own twice.
|
|
8
|
+
*/
|
|
9
|
+
// SAFETY: `content` originates from `@Showcase({ variants: [{ content }] })`
|
|
10
|
+
// in developer-authored source code. It is trusted by ng-prism's threat model
|
|
11
|
+
// (see SECURITY.md). Sanitization would strip the Angular component/directive
|
|
12
|
+
// selectors that variant content is meant to project.
|
|
13
|
+
export function parseContentToNodes(content) {
|
|
14
|
+
if (typeof content === 'string') {
|
|
15
|
+
return [htmlToNodes(content)];
|
|
16
|
+
}
|
|
17
|
+
const defaultNodes = content['default']
|
|
18
|
+
? htmlToNodes(content['default'])
|
|
19
|
+
: [];
|
|
20
|
+
const result = [defaultNodes];
|
|
21
|
+
for (const [selector, html] of Object.entries(content)) {
|
|
22
|
+
if (selector === 'default')
|
|
23
|
+
continue;
|
|
24
|
+
const wrapper = document.createElement('div');
|
|
25
|
+
// SAFETY: trusted developer-authored HTML — see SECURITY.md.
|
|
26
|
+
wrapper.innerHTML = html;
|
|
27
|
+
const nodes = [];
|
|
28
|
+
for (const child of Array.from(wrapper.childNodes)) {
|
|
29
|
+
const el = document.createElement('div');
|
|
30
|
+
// SAFETY: trusted developer-authored HTML — see SECURITY.md.
|
|
31
|
+
el.innerHTML = child.outerHTML ?? child.textContent ?? '';
|
|
32
|
+
const projected = el.firstChild;
|
|
33
|
+
if (projected && projected instanceof Element) {
|
|
34
|
+
applySelector(projected, selector);
|
|
35
|
+
nodes.push(projected);
|
|
36
|
+
}
|
|
37
|
+
else if (projected) {
|
|
38
|
+
const span = document.createElement('span');
|
|
39
|
+
applySelector(span, selector);
|
|
40
|
+
span.textContent = child.textContent;
|
|
41
|
+
nodes.push(span);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
result.push(nodes);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
// SAFETY: see `parseContentToNodes` above and SECURITY.md — `html` is trusted
|
|
49
|
+
// developer-authored variant content from the `@Showcase` decorator.
|
|
50
|
+
function htmlToNodes(html) {
|
|
51
|
+
const wrapper = document.createElement('div');
|
|
52
|
+
wrapper.innerHTML = html;
|
|
53
|
+
return Array.from(wrapper.childNodes);
|
|
54
|
+
}
|
|
55
|
+
function applySelector(el, selector) {
|
|
56
|
+
const attrMatch = selector.match(/^\[([^\]=]+)]$/);
|
|
57
|
+
if (attrMatch) {
|
|
58
|
+
el.setAttribute(attrMatch[1], '');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,4BAA4B,QAE0H,CAAC;
|
|
1
|
+
{"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,4BAA4B,QAE0H,CAAC;AAmJpK;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IAEF,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAdZ,mBAAmB;;CAuB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIzD"}
|
|
@@ -119,6 +119,24 @@ const CAPTURE_CANVAS_ONLY_SELECTOR = `[${CAPTURE_ATTRIBUTE}] ` +
|
|
|
119
119
|
* 200x700 component at 1280x720 still leaks 22px past the canvas with the
|
|
120
120
|
* regions gone but the padding kept. None of that padding is ever inside a
|
|
121
121
|
* `.demo-wrap` screenshot, so nothing is lost by removing it.
|
|
122
|
+
*
|
|
123
|
+
* The stage's edge goes with them, and it is stripped rather than reshaped for
|
|
124
|
+
* the same reason it exists in that shape at all. The edge is deliberately
|
|
125
|
+
* built from `outline` plus `box-shadow` and never from a border or padding,
|
|
126
|
+
* because neither participates in layout: `plugin-visual-regression`
|
|
127
|
+
* screenshots `.demo-wrap`, which is centred in the stage, and a border would
|
|
128
|
+
* shrink the stage's content box by 2px and move that centre, shifting every
|
|
129
|
+
* recorded baseline without a component having changed. Not participating in
|
|
130
|
+
* layout is not the same as not painting. `outline-offset: -1px` draws the
|
|
131
|
+
* line *inside* the border box, and with the padding above gone the stage edge
|
|
132
|
+
* sits flush against the component, so for anything whose `.demo-wrap` reaches
|
|
133
|
+
* it that 1px line and the shadow under it composite straight into the
|
|
134
|
+
* screenshot. So capture mode removes the paint and leaves the geometry
|
|
135
|
+
* untouched — the same division of labour the edge was chosen for, and the
|
|
136
|
+
* only one that keeps both halves of the guarantee.
|
|
137
|
+
*
|
|
138
|
+
* {@link CAPTURE_TRANSPARENT_SELECTOR} cannot cover this: it clears background
|
|
139
|
+
* colour, and an outline is not a background.
|
|
122
140
|
*/
|
|
123
141
|
const CAPTURE_STYLES = `
|
|
124
142
|
[${CAPTURE_ATTRIBUTE}] *,
|
|
@@ -133,6 +151,8 @@ const CAPTURE_STYLES = `
|
|
|
133
151
|
[${CAPTURE_ATTRIBUTE}] .prism-canvas-stage {
|
|
134
152
|
background-image: none !important;
|
|
135
153
|
padding: 0 !important;
|
|
154
|
+
outline: none !important;
|
|
155
|
+
box-shadow: none !important;
|
|
136
156
|
}
|
|
137
157
|
|
|
138
158
|
${CAPTURE_TRANSPARENT_SELECTOR} {
|
|
@@ -7,14 +7,11 @@ export declare class PrismLayoutService {
|
|
|
7
7
|
readonly sidebarWidth: import("@angular/core").WritableSignal<number>;
|
|
8
8
|
readonly panelHeight: import("@angular/core").WritableSignal<number>;
|
|
9
9
|
readonly panelWidth: import("@angular/core").WritableSignal<number>;
|
|
10
|
-
readonly templatePopoverVisible: import("@angular/core").WritableSignal<boolean>;
|
|
11
10
|
constructor();
|
|
12
11
|
toggleSidebar(): void;
|
|
13
12
|
toggleAddons(): void;
|
|
14
13
|
toggleToolbar(): void;
|
|
15
14
|
toggleOrientation(): void;
|
|
16
|
-
toggleTemplatePopover(): void;
|
|
17
|
-
closeTemplatePopover(): void;
|
|
18
15
|
setSidebarWidth(px: number): void;
|
|
19
16
|
setPanelHeight(px: number): void;
|
|
20
17
|
setPanelWidth(px: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-layout.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-layout.service.ts"],"names":[],"mappings":";AAIA,qBACa,kBAAkB;IAC7B,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,aAAa,kDAAgB;IACtC,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,iBAAiB,6DAAwC;IAClE,QAAQ,CAAC,YAAY,iDAAe;IACpC,QAAQ,CAAC,WAAW,iDAAe;IACnC,QAAQ,CAAC,UAAU,iDAAe
|
|
1
|
+
{"version":3,"file":"prism-layout.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-layout.service.ts"],"names":[],"mappings":";AAIA,qBACa,kBAAkB;IAC7B,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,aAAa,kDAAgB;IACtC,QAAQ,CAAC,cAAc,kDAAgB;IACvC,QAAQ,CAAC,iBAAiB,6DAAwC;IAClE,QAAQ,CAAC,YAAY,iDAAe;IACpC,QAAQ,CAAC,WAAW,iDAAe;IACnC,QAAQ,CAAC,UAAU,iDAAe;;IAMlC,aAAa,IAAI,IAAI;IAKrB,YAAY,IAAI,IAAI;IAKpB,aAAa,IAAI,IAAI;IAKrB,iBAAiB,IAAI,IAAI;IAKzB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKjC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKhC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK/B,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,aAAa;yCA1EV,kBAAkB;;CAsF9B"}
|
|
@@ -16,8 +16,6 @@ export class PrismLayoutService {
|
|
|
16
16
|
...(ngDevMode ? [{ debugName: "panelHeight" }] : /* istanbul ignore next */ []));
|
|
17
17
|
panelWidth = signal(320, /* @ts-ignore */
|
|
18
18
|
...(ngDevMode ? [{ debugName: "panelWidth" }] : /* istanbul ignore next */ []));
|
|
19
|
-
templatePopoverVisible = signal(false, /* @ts-ignore */
|
|
20
|
-
...(ngDevMode ? [{ debugName: "templatePopoverVisible" }] : /* istanbul ignore next */ []));
|
|
21
19
|
constructor() {
|
|
22
20
|
this.loadFromStorage();
|
|
23
21
|
}
|
|
@@ -37,12 +35,6 @@ export class PrismLayoutService {
|
|
|
37
35
|
this.addonsOrientation.update((v) => (v === 'bottom' ? 'right' : 'bottom'));
|
|
38
36
|
this.saveToStorage();
|
|
39
37
|
}
|
|
40
|
-
toggleTemplatePopover() {
|
|
41
|
-
this.templatePopoverVisible.update((v) => !v);
|
|
42
|
-
}
|
|
43
|
-
closeTemplatePopover() {
|
|
44
|
-
this.templatePopoverVisible.set(false);
|
|
45
|
-
}
|
|
46
38
|
setSidebarWidth(px) {
|
|
47
39
|
this.sidebarWidth.set(Math.max(160, Math.min(600, px)));
|
|
48
40
|
this.saveToStorage();
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import { EnvironmentInjector } from '@angular/core';
|
|
2
|
+
import type { PanelDefinition } from '../../plugin/plugin.types.js';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class PrismPanelService {
|
|
4
5
|
private readonly envInjector;
|
|
5
6
|
private readonly pluginService;
|
|
7
|
+
private readonly navigationService;
|
|
6
8
|
private readonly builtinPanels;
|
|
7
9
|
private readonly injectorCache;
|
|
8
10
|
readonly activePanelId: import("@angular/core").WritableSignal<string>;
|
|
9
11
|
readonly activeViewId: import("@angular/core").WritableSignal<string>;
|
|
10
12
|
readonly activePanelInjector: import("@angular/core").Signal<EnvironmentInjector | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Every panel that renders as a view tab, builtin before plugin.
|
|
15
|
+
*
|
|
16
|
+
* Unfiltered on purpose: `prism-view-panel-host` resolves the active view
|
|
17
|
+
* through this list. Filtering here would let the host come up empty for a
|
|
18
|
+
* frame whenever a component switch invalidates the active view — the
|
|
19
|
+
* fallback in `prism-shell` runs in the same change-detection round.
|
|
20
|
+
*/
|
|
21
|
+
readonly viewPanels: import("@angular/core").Signal<PanelDefinition[]>;
|
|
22
|
+
/**
|
|
23
|
+
* The view panels the active component actually offers.
|
|
24
|
+
*
|
|
25
|
+
* Empty when no component is active, which is how pages end up without view
|
|
26
|
+
* tabs: it falls out of the data instead of needing a case of its own.
|
|
27
|
+
*/
|
|
28
|
+
readonly visibleViewPanels: import("@angular/core").Signal<PanelDefinition[]>;
|
|
11
29
|
/**
|
|
12
30
|
* Returns (and lazily creates) the EnvironmentInjector scoped to the given panel.
|
|
13
31
|
* Returns `null` when the panel has no providers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-panel.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-panel.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAIpB,MAAM,eAAe,CAAC;;
|
|
1
|
+
{"version":3,"file":"prism-panel.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-panel.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EAIpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAKpE,qBACa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAC5D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgC;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IAExE,QAAQ,CAAC,aAAa,iDAA8B;IACpD,QAAQ,CAAC,YAAY,iDAA8B;IAEnD,QAAQ,CAAC,mBAAmB,6DAE1B;IAEF;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,oDAGhB;IAEH;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,oDAMvB;IAEH;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI;yCA7C7C,iBAAiB;;CA6D7B"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { computed, createEnvironmentInjector, EnvironmentInjector, inject, Injectable, signal, } from '@angular/core';
|
|
2
2
|
import { PRISM_BUILTIN_PANELS } from '../tokens/prism-tokens.js';
|
|
3
|
+
import { PrismNavigationService } from './prism-navigation.service.js';
|
|
3
4
|
import { PrismPluginService } from './prism-plugin.service.js';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
export class PrismPanelService {
|
|
6
7
|
envInjector = inject(EnvironmentInjector);
|
|
7
8
|
pluginService = inject(PrismPluginService);
|
|
9
|
+
navigationService = inject(PrismNavigationService);
|
|
8
10
|
builtinPanels = inject(PRISM_BUILTIN_PANELS);
|
|
9
11
|
injectorCache = new Map();
|
|
10
12
|
activePanelId = signal('controls', /* @ts-ignore */
|
|
@@ -13,6 +15,32 @@ export class PrismPanelService {
|
|
|
13
15
|
...(ngDevMode ? [{ debugName: "activeViewId" }] : /* istanbul ignore next */ []));
|
|
14
16
|
activePanelInjector = computed(() => this.getInjector(this.activePanelId()), /* @ts-ignore */
|
|
15
17
|
...(ngDevMode ? [{ debugName: "activePanelInjector" }] : /* istanbul ignore next */ []));
|
|
18
|
+
/**
|
|
19
|
+
* Every panel that renders as a view tab, builtin before plugin.
|
|
20
|
+
*
|
|
21
|
+
* Unfiltered on purpose: `prism-view-panel-host` resolves the active view
|
|
22
|
+
* through this list. Filtering here would let the host come up empty for a
|
|
23
|
+
* frame whenever a component switch invalidates the active view — the
|
|
24
|
+
* fallback in `prism-shell` runs in the same change-detection round.
|
|
25
|
+
*/
|
|
26
|
+
viewPanels = computed(() => [
|
|
27
|
+
...this.builtinPanels.filter((p) => p.placement === 'view'),
|
|
28
|
+
...this.pluginService.viewPanels(),
|
|
29
|
+
], /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "viewPanels" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/**
|
|
32
|
+
* The view panels the active component actually offers.
|
|
33
|
+
*
|
|
34
|
+
* Empty when no component is active, which is how pages end up without view
|
|
35
|
+
* tabs: it falls out of the data instead of needing a case of its own.
|
|
36
|
+
*/
|
|
37
|
+
visibleViewPanels = computed(() => {
|
|
38
|
+
const component = this.navigationService.activeComponent();
|
|
39
|
+
if (!component)
|
|
40
|
+
return [];
|
|
41
|
+
return this.viewPanels().filter((p) => !p.isVisible || p.isVisible(component));
|
|
42
|
+
}, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "visibleViewPanels" }] : /* istanbul ignore next */ []));
|
|
16
44
|
/**
|
|
17
45
|
* Returns (and lazily creates) the EnvironmentInjector scoped to the given panel.
|
|
18
46
|
* Returns `null` when the panel has no providers.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Library-wide metric badge for the header.
|
|
4
|
+
*
|
|
5
|
+
* Presentational only — it takes an already-formatted value and a variant and
|
|
6
|
+
* knows nothing about thresholds, manifests or where the number came from.
|
|
7
|
+
* That keeps the three badges that use it (a11y in core, coverage and visual
|
|
8
|
+
* regression in their plugins) owning their own data logic while sharing one
|
|
9
|
+
* appearance.
|
|
10
|
+
*
|
|
11
|
+
* It carries an icon rather than a text label on purpose. The glyph is the
|
|
12
|
+
* same one the source contributes to the navigation marks and its panel tab,
|
|
13
|
+
* so one symbol means one source wherever it appears — and the badge gets
|
|
14
|
+
* narrow enough that three of them fit a 40px header without crowding it.
|
|
15
|
+
* The icon is `aria-hidden` — it is decoration, not content. The accessible
|
|
16
|
+
* name is composed here as "label: value" (e.g. "Library coverage: 23%"), so
|
|
17
|
+
* the figure that is the whole point of the badge cannot be dropped by a
|
|
18
|
+
* consumer that only passes `label`. `title` stays the full text the
|
|
19
|
+
* consumer passes, for the hover tooltip.
|
|
20
|
+
*/
|
|
21
|
+
export declare class PrismMetricBadgeComponent {
|
|
22
|
+
readonly icon: import("@angular/core").InputSignal<string>;
|
|
23
|
+
readonly value: import("@angular/core").InputSignal<string>;
|
|
24
|
+
readonly label: import("@angular/core").InputSignal<string>;
|
|
25
|
+
readonly title: import("@angular/core").InputSignal<string>;
|
|
26
|
+
readonly variant: import("@angular/core").InputSignal<"ok" | "warn" | "danger">;
|
|
27
|
+
/** "label: value" — the accessible name, so the figure is never dropped. */
|
|
28
|
+
readonly accessibleName: import("@angular/core").Signal<string>;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PrismMetricBadgeComponent, never>;
|
|
30
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PrismMetricBadgeComponent, "prism-metric-badge", never, { "icon": { "alias": "icon"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=prism-metric-badge.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prism-metric-badge.component.d.ts","sourceRoot":"","sources":["../../../src/app/shared/prism-metric-badge.component.ts"],"names":[],"mappings":";AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBA6Da,yBAAyB;IACpC,QAAQ,CAAC,IAAI,8CAA4B;IACzC,QAAQ,CAAC,KAAK,8CAA4B;IAC1C,QAAQ,CAAC,KAAK,8CAA4B;IAC1C,QAAQ,CAAC,KAAK,8CAAqB;IACnC,QAAQ,CAAC,OAAO,gEAAyC;IAEzD,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,yCAAsD;yCARlE,yBAAyB;2CAAzB,yBAAyB;CASrC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, input, } from '@angular/core';
|
|
2
|
+
import { PrismIconComponent } from '../icons/prism-icon.component.js';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Library-wide metric badge for the header.
|
|
6
|
+
*
|
|
7
|
+
* Presentational only — it takes an already-formatted value and a variant and
|
|
8
|
+
* knows nothing about thresholds, manifests or where the number came from.
|
|
9
|
+
* That keeps the three badges that use it (a11y in core, coverage and visual
|
|
10
|
+
* regression in their plugins) owning their own data logic while sharing one
|
|
11
|
+
* appearance.
|
|
12
|
+
*
|
|
13
|
+
* It carries an icon rather than a text label on purpose. The glyph is the
|
|
14
|
+
* same one the source contributes to the navigation marks and its panel tab,
|
|
15
|
+
* so one symbol means one source wherever it appears — and the badge gets
|
|
16
|
+
* narrow enough that three of them fit a 40px header without crowding it.
|
|
17
|
+
* The icon is `aria-hidden` — it is decoration, not content. The accessible
|
|
18
|
+
* name is composed here as "label: value" (e.g. "Library coverage: 23%"), so
|
|
19
|
+
* the figure that is the whole point of the badge cannot be dropped by a
|
|
20
|
+
* consumer that only passes `label`. `title` stays the full text the
|
|
21
|
+
* consumer passes, for the hover tooltip.
|
|
22
|
+
*/
|
|
23
|
+
export class PrismMetricBadgeComponent {
|
|
24
|
+
icon = input.required(/* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
26
|
+
value = input.required(/* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
28
|
+
label = input.required(/* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
30
|
+
title = input('', /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
32
|
+
variant = input('ok', /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
34
|
+
/** "label: value" — the accessible name, so the figure is never dropped. */
|
|
35
|
+
accessibleName = computed(() => `${this.label()}: ${this.value()}`, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
37
|
+
static ɵfac = function PrismMetricBadgeComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismMetricBadgeComponent)(); };
|
|
38
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismMetricBadgeComponent, selectors: [["prism-metric-badge"]], inputs: { icon: [1, "icon"], value: [1, "value"], label: [1, "label"], title: [1, "title"], variant: [1, "variant"] }, decls: 4, vars: 11, consts: [["role", "img", 1, "metric-badge"], ["aria-hidden", "true", 3, "name", "size"], [1, "metric-badge__value"]], template: function PrismMetricBadgeComponent_Template(rf, ctx) { if (rf & 1) {
|
|
39
|
+
i0.ɵɵelementStart(0, "span", 0);
|
|
40
|
+
i0.ɵɵelement(1, "prism-icon", 1);
|
|
41
|
+
i0.ɵɵelementStart(2, "span", 2);
|
|
42
|
+
i0.ɵɵtext(3);
|
|
43
|
+
i0.ɵɵelementEnd()();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
i0.ɵɵclassProp("metric-badge--ok", ctx.variant() === "ok")("metric-badge--warn", ctx.variant() === "warn")("metric-badge--danger", ctx.variant() === "danger");
|
|
46
|
+
i0.ɵɵattribute("title", ctx.title() || ctx.label())("aria-label", ctx.accessibleName());
|
|
47
|
+
i0.ɵɵadvance();
|
|
48
|
+
i0.ɵɵproperty("name", ctx.icon())("size", 12);
|
|
49
|
+
i0.ɵɵadvance(2);
|
|
50
|
+
i0.ɵɵtextInterpolate(ctx.value());
|
|
51
|
+
} }, dependencies: [PrismIconComponent], styles: ["[_nghost-%COMP%] { display: inline-flex; align-items: center; }\n\n .metric-badge[_ngcontent-%COMP%] {\n display: inline-flex;\n align-items: center;\n gap: var(--%NS%sp-2);\n height: 20px;\n padding: 0 var(--%NS%sp-3) 0 var(--%NS%sp-2);\n border-radius: var(--%NS%radius-sm);\n border: 1px solid var(--%NS%prism-border);\n background: var(--%NS%prism-input-bg);\n color: var(--%NS%prism-text-muted);\n font-family: var(--%NS%font-mono);\n font-size: var(--%NS%fs-xs);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n .metric-badge__value[_ngcontent-%COMP%] { color: var(--%NS%prism-text); font-weight: 600; }\n\n .metric-badge--ok[_ngcontent-%COMP%] {\n color: var(--%NS%prism-mark-nominal);\n border-color: color-mix(in srgb, var(--%NS%prism-mark-nominal) 35%, transparent);\n background: color-mix(in srgb, var(--%NS%prism-mark-nominal) 10%, transparent);\n }\n .metric-badge--ok[_ngcontent-%COMP%] .metric-badge__value[_ngcontent-%COMP%] { color: var(--%NS%prism-mark-nominal); }\n\n .metric-badge--warn[_ngcontent-%COMP%] {\n color: var(--%NS%prism-mark-attention);\n border-color: color-mix(in srgb, var(--%NS%prism-mark-attention) 35%, transparent);\n background: color-mix(in srgb, var(--%NS%prism-mark-attention) 10%, transparent);\n }\n .metric-badge--warn[_ngcontent-%COMP%] .metric-badge__value[_ngcontent-%COMP%] { color: var(--%NS%prism-mark-attention); }\n\n .metric-badge--danger[_ngcontent-%COMP%] {\n color: var(--%NS%prism-mark-critical);\n border-color: color-mix(in srgb, var(--%NS%prism-mark-critical) 40%, transparent);\n background: color-mix(in srgb, var(--%NS%prism-mark-critical) 10%, transparent);\n }\n .metric-badge--danger[_ngcontent-%COMP%] .metric-badge__value[_ngcontent-%COMP%] { color: var(--%NS%prism-mark-critical); }"] });
|
|
52
|
+
}
|
|
53
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismMetricBadgeComponent, [{
|
|
54
|
+
type: Component,
|
|
55
|
+
args: [{ selector: 'prism-metric-badge', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: `
|
|
56
|
+
<span
|
|
57
|
+
class="metric-badge"
|
|
58
|
+
role="img"
|
|
59
|
+
[class.metric-badge--ok]="variant() === 'ok'"
|
|
60
|
+
[class.metric-badge--warn]="variant() === 'warn'"
|
|
61
|
+
[class.metric-badge--danger]="variant() === 'danger'"
|
|
62
|
+
[attr.title]="title() || label()"
|
|
63
|
+
[attr.aria-label]="accessibleName()"
|
|
64
|
+
>
|
|
65
|
+
<prism-icon [name]="icon()" [size]="12" aria-hidden="true" />
|
|
66
|
+
<span class="metric-badge__value">{{ value() }}</span>
|
|
67
|
+
</span>
|
|
68
|
+
`, styles: ["\n :host { display: inline-flex; align-items: center; }\n\n .metric-badge {\n display: inline-flex;\n align-items: center;\n gap: var(--sp-2);\n height: 20px;\n padding: 0 var(--sp-3) 0 var(--sp-2);\n border-radius: var(--radius-sm);\n border: 1px solid var(--prism-border);\n background: var(--prism-input-bg);\n color: var(--prism-text-muted);\n font-family: var(--font-mono);\n font-size: var(--fs-xs);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n }\n .metric-badge__value { color: var(--prism-text); font-weight: 600; }\n\n .metric-badge--ok {\n color: var(--prism-mark-nominal);\n border-color: color-mix(in srgb, var(--prism-mark-nominal) 35%, transparent);\n background: color-mix(in srgb, var(--prism-mark-nominal) 10%, transparent);\n }\n .metric-badge--ok .metric-badge__value { color: var(--prism-mark-nominal); }\n\n .metric-badge--warn {\n color: var(--prism-mark-attention);\n border-color: color-mix(in srgb, var(--prism-mark-attention) 35%, transparent);\n background: color-mix(in srgb, var(--prism-mark-attention) 10%, transparent);\n }\n .metric-badge--warn .metric-badge__value { color: var(--prism-mark-attention); }\n\n .metric-badge--danger {\n color: var(--prism-mark-critical);\n border-color: color-mix(in srgb, var(--prism-mark-critical) 40%, transparent);\n background: color-mix(in srgb, var(--prism-mark-critical) 10%, transparent);\n }\n .metric-badge--danger .metric-badge__value { color: var(--prism-mark-critical); }\n "] }]
|
|
69
|
+
}], null, { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] }); })();
|
|
70
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismMetricBadgeComponent, { className: "PrismMetricBadgeComponent", filePath: "app/shared/prism-metric-badge.component.ts", lineNumber: 89 }); })();
|
|
@@ -8,7 +8,6 @@ export declare class PrismShellComponent {
|
|
|
8
8
|
private readonly themeService;
|
|
9
9
|
protected readonly layout: PrismLayoutService;
|
|
10
10
|
protected readonly panelService: PrismPanelService;
|
|
11
|
-
private readonly pluginService;
|
|
12
11
|
private readonly urlStateService;
|
|
13
12
|
private readonly persistenceService;
|
|
14
13
|
protected readonly viewPanels: import("@angular/core").Signal<import("../../plugin/plugin.types.js").PanelDefinition[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-shell.component.d.ts","sourceRoot":"","sources":["../../../src/app/shell/prism-shell.component.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;;
|
|
1
|
+
{"version":3,"file":"prism-shell.component.d.ts","sourceRoot":"","sources":["../../../src/app/shell/prism-shell.component.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;;AAiBvE,qBAkQa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAC9D,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;IACtE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,SAAS,CAAC,QAAQ,CAAC,MAAM,qBAA8B;IACvD,SAAS,CAAC,QAAQ,CAAC,YAAY,oBAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAmC;IAEtE,SAAS,CAAC,QAAQ,CAAC,UAAU,2FAAuC;IAEpE,SAAS,CAAC,QAAQ,CAAC,SAAS,0CAK1B;IAEF,SAAS,CAAC,QAAQ,CAAC,UAAU,yCAG1B;;IAoCH,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;yCAzDhC,mBAAmB;2CAAnB,mBAAmB;CA6E/B"}
|