@ng-prism/core 22.2.0-beta.4 → 22.2.0
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-rulers.component.js +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +31 -7
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +158 -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/controls/boolean-control.component.js +1 -1
- package/dist/app/controls/json-control.component.js +1 -1
- package/dist/app/controls/number-control.component.js +1 -1
- package/dist/app/controls/string-control.component.js +1 -1
- package/dist/app/controls/union-control.component.js +1 -1
- package/dist/app/header/prism-header.component.js +2 -2
- package/dist/app/icons/icon-registry.d.ts +15 -0
- package/dist/app/icons/icon-registry.d.ts.map +1 -0
- package/dist/app/icons/icon-registry.js +44 -0
- package/dist/app/icons/prism-icon.component.d.ts +2 -2
- package/dist/app/icons/prism-icon.component.d.ts.map +1 -1
- package/dist/app/icons/prism-icon.component.js +7 -32
- 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 +3 -3
- 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-audit.service.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-audit.service.d.ts.map +1 -1
- 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/a11y/a11y-keyboard-overlay.component.js +1 -1
- package/dist/app/panels/a11y/a11y-keyboard.component.js +1 -1
- package/dist/app/panels/a11y/a11y-keyboard.service.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-keyboard.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-overlay-host.component.js +1 -1
- package/dist/app/panels/a11y/a11y-panel-state.service.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-panel-state.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-panel.component.js +1 -1
- package/dist/app/panels/a11y/a11y-perspective.service.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-perspective.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-score.component.js +1 -1
- package/dist/app/panels/a11y/a11y-sr-overlay.component.js +1 -1
- package/dist/app/panels/a11y/a11y-sr.component.js +1 -1
- package/dist/app/panels/a11y/a11y-sr.service.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-sr.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-summary.d.ts +15 -0
- package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -0
- package/dist/app/panels/a11y/a11y-summary.js +33 -0
- package/dist/app/panels/a11y/a11y-tree.component.js +2 -2
- package/dist/app/panels/a11y/a11y-tree.service.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-tree.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-violations.component.js +3 -3
- package/dist/app/panels/a11y/a11y.types.d.ts +14 -0
- package/dist/app/panels/a11y/a11y.types.d.ts.map +1 -1
- package/dist/app/panels/builtin-navigation-decorations.d.ts +8 -0
- package/dist/app/panels/builtin-navigation-decorations.d.ts.map +1 -0
- package/dist/app/panels/builtin-navigation-decorations.js +20 -0
- package/dist/app/panels/builtin-panels.d.ts.map +1 -1
- package/dist/app/panels/builtin-panels.js +2 -0
- package/dist/app/panels/controls/prism-controls-panel.component.js +1 -1
- package/dist/app/panels/events/prism-events-panel.component.js +1 -1
- package/dist/app/panels/events/prism-json-node.component.js +1 -1
- package/dist/app/panels/panel-host/panel-badge.d.ts +8 -2
- package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
- package/dist/app/panels/panel-host/panel-badge.js +8 -13
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +8 -2
- 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 +33 -22
- package/dist/app/renderer/overlay-resolver.d.ts.map +1 -1
- package/dist/app/renderer/overlay-resolver.js +12 -1
- 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 +11 -75
- 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-canvas.service.d.ts +1 -1
- package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
- package/dist/app/services/prism-capture.service.d.ts +7 -1
- package/dist/app/services/prism-capture.service.d.ts.map +1 -1
- package/dist/app/services/prism-capture.service.js +27 -1
- package/dist/app/services/prism-event-log.service.d.ts +1 -1
- package/dist/app/services/prism-event-log.service.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.d.ts +1 -4
- 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-manifest.service.d.ts +1 -1
- package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
- package/dist/app/services/prism-navigation.service.d.ts +1 -1
- package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
- package/dist/app/services/prism-panel.service.d.ts +19 -1
- 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/services/prism-persistence.service.d.ts +1 -1
- package/dist/app/services/prism-persistence.service.d.ts.map +1 -1
- package/dist/app/services/prism-plugin.service.d.ts +8 -2
- package/dist/app/services/prism-plugin.service.d.ts.map +1 -1
- package/dist/app/services/prism-plugin.service.js +15 -0
- package/dist/app/services/prism-renderer.service.d.ts +1 -1
- package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
- package/dist/app/services/prism-search.service.d.ts +1 -1
- package/dist/app/services/prism-search.service.d.ts.map +1 -1
- package/dist/app/services/prism-theme.service.d.ts +1 -1
- package/dist/app/services/prism-theme.service.d.ts.map +1 -1
- package/dist/app/services/prism-url-state.service.d.ts +1 -1
- package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
- package/dist/app/services/prism-variant-bg.service.d.ts +1 -1
- package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -1
- 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 +57 -49
- package/dist/app/sidebar/navigation-decorations.d.ts +70 -0
- package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -0
- package/dist/app/sidebar/navigation-decorations.js +87 -0
- package/dist/app/sidebar/prism-sidebar.component.d.ts +29 -8
- package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
- package/dist/app/sidebar/prism-sidebar.component.js +129 -76
- 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 +11 -12
- 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/builder/a11y/a11y-report-reader.d.ts +15 -1
- package/dist/builder/a11y/a11y-report-reader.d.ts.map +1 -1
- package/dist/builder/a11y/a11y-report-reader.js +37 -0
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +19 -2
- package/dist/plugin/index.d.ts +2 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +10 -0
- package/dist/plugin/plugin.types.d.ts +33 -0
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- 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
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PrismLayoutService } from '../services/prism-layout.service.js';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class PrismCodeDrawerComponent {
|
|
4
|
-
private readonly navigationService;
|
|
5
|
-
private readonly rendererService;
|
|
6
|
-
protected readonly layoutService: PrismLayoutService;
|
|
7
|
-
protected readonly collapsed: import("@angular/core").WritableSignal<boolean>;
|
|
8
|
-
protected readonly snippet: import("@angular/core").Signal<string>;
|
|
9
|
-
protected readonly highlighted: import("@angular/core").Signal<string>;
|
|
10
|
-
protected copy(e: MouseEvent): void;
|
|
11
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PrismCodeDrawerComponent, never>;
|
|
12
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PrismCodeDrawerComponent, "prism-code-drawer", never, {}, {}, never, never, true, never>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=prism-code-drawer.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,116 +0,0 @@
|
|
|
1
|
-
import { Component, inject, computed, ChangeDetectionStrategy, } 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 esc(s) {
|
|
9
|
-
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
10
|
-
}
|
|
11
|
-
function tokenizeXml(code) {
|
|
12
|
-
const re = /(\/\/[^\n]*)|(<\/?[\w-]+)|(\[[\w.]+\]|[\w-]+)=|"([^"]*)"|(\/>|>)|(\n)|([^<\["\n/>=]+|[/=])/g;
|
|
13
|
-
let out = '';
|
|
14
|
-
let m;
|
|
15
|
-
while ((m = re.exec(code)) !== null) {
|
|
16
|
-
if (m[1] != null) {
|
|
17
|
-
out += `<span class="tok-com">${esc(m[1])}</span>`;
|
|
18
|
-
}
|
|
19
|
-
else if (m[2] != null) {
|
|
20
|
-
out += `<span class="tok-tag">${esc(m[2])}</span>`;
|
|
21
|
-
}
|
|
22
|
-
else if (m[3] != null) {
|
|
23
|
-
out += `<span class="tok-attr">${esc(m[3])}</span>=`;
|
|
24
|
-
}
|
|
25
|
-
else if (m[4] != null) {
|
|
26
|
-
out += `"<span class="tok-str">${esc(m[4])}</span>"`;
|
|
27
|
-
}
|
|
28
|
-
else if (m[5] != null) {
|
|
29
|
-
out += `<span class="tok-tag">${esc(m[5])}</span>`;
|
|
30
|
-
}
|
|
31
|
-
else if (m[6] != null) {
|
|
32
|
-
out += '\n';
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
out += esc(m[0]);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
|
-
export class PrismCodeDrawerComponent {
|
|
41
|
-
navigationService = inject(PrismNavigationService);
|
|
42
|
-
rendererService = inject(PrismRendererService);
|
|
43
|
-
layoutService = inject(PrismLayoutService);
|
|
44
|
-
collapsed = this.layoutService.codeDrawerCollapsed;
|
|
45
|
-
snippet = computed(() => {
|
|
46
|
-
const comp = this.navigationService.activeComponent();
|
|
47
|
-
if (!comp)
|
|
48
|
-
return '';
|
|
49
|
-
const variant = comp.meta.showcaseConfig.variants?.[this.rendererService.activeVariantIndex()];
|
|
50
|
-
const explicitKeys = variant?.inputs
|
|
51
|
-
? new Set(Object.keys(variant.inputs))
|
|
52
|
-
: undefined;
|
|
53
|
-
const directiveOptions = comp.meta.componentMeta.isDirective
|
|
54
|
-
? { host: comp.meta.showcaseConfig.host }
|
|
55
|
-
: undefined;
|
|
56
|
-
return generateSnippet(comp.meta.componentMeta.selector, comp.meta.inputs, this.rendererService.inputValues(), explicitKeys, this.rendererService.activeContent(), directiveOptions);
|
|
57
|
-
}, ...(ngDevMode ? [{ debugName: "snippet" }] : []));
|
|
58
|
-
highlighted = computed(() => {
|
|
59
|
-
const code = this.snippet();
|
|
60
|
-
if (!code)
|
|
61
|
-
return '';
|
|
62
|
-
return tokenizeXml(code);
|
|
63
|
-
}, ...(ngDevMode ? [{ debugName: "highlighted" }] : []));
|
|
64
|
-
copy(e) {
|
|
65
|
-
e.stopPropagation();
|
|
66
|
-
const code = this.snippet();
|
|
67
|
-
if (code)
|
|
68
|
-
navigator.clipboard.writeText(code);
|
|
69
|
-
}
|
|
70
|
-
static ɵfac = function PrismCodeDrawerComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismCodeDrawerComponent)(); };
|
|
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) {
|
|
72
|
-
i0.ɵɵelementStart(0, "div", 0)(1, "div", 1);
|
|
73
|
-
i0.ɵɵlistener("click", function PrismCodeDrawerComponent_Template_div_click_1_listener() { return ctx.layoutService.toggleCodeDrawer(); });
|
|
74
|
-
i0.ɵɵelement(2, "prism-icon", 2)(3, "prism-icon", 3);
|
|
75
|
-
i0.ɵɵelementStart(4, "span");
|
|
76
|
-
i0.ɵɵtext(5, "Angular Template");
|
|
77
|
-
i0.ɵɵelementEnd();
|
|
78
|
-
i0.ɵɵelementStart(6, "div", 4)(7, "button", 5);
|
|
79
|
-
i0.ɵɵlistener("click", function PrismCodeDrawerComponent_Template_button_click_7_listener($event) { return ctx.copy($event); });
|
|
80
|
-
i0.ɵɵelement(8, "prism-icon", 3);
|
|
81
|
-
i0.ɵɵtext(9, " Copy ");
|
|
82
|
-
i0.ɵɵelementEnd()()();
|
|
83
|
-
i0.ɵɵelement(10, "pre", 6);
|
|
84
|
-
i0.ɵɵelementEnd();
|
|
85
|
-
} if (rf & 2) {
|
|
86
|
-
i0.ɵɵclassProp("is-collapsed", ctx.collapsed());
|
|
87
|
-
i0.ɵɵadvance(2);
|
|
88
|
-
i0.ɵɵproperty("size", 12);
|
|
89
|
-
i0.ɵɵadvance();
|
|
90
|
-
i0.ɵɵproperty("size", 12);
|
|
91
|
-
i0.ɵɵadvance(5);
|
|
92
|
-
i0.ɵɵproperty("size", 11);
|
|
93
|
-
i0.ɵɵadvance(2);
|
|
94
|
-
i0.ɵɵproperty("innerHTML", ctx.highlighted(), i0.ɵɵsanitizeHtml);
|
|
95
|
-
} }, dependencies: [PrismIconComponent], styles: [".code-drawer[_ngcontent-%COMP%] {\n border-top: 1px solid var(--prism-border);\n background: var(--prism-bg);\n max-height: 260px;\n transition: max-height 0.25s var(--ease-default), opacity var(--dur-base);\n overflow: hidden;\n }\n .code-drawer.is-collapsed[_ngcontent-%COMP%] { max-height: 40px; }\n .code-drawer.is-collapsed[_ngcontent-%COMP%] .code-body[_ngcontent-%COMP%] { opacity: 0; }\n\n .code-head[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 8px;\n height: 40px;\n padding: 0 20px;\n color: var(--prism-text-muted);\n font-size: var(--fs-sm);\n font-weight: 600;\n letter-spacing: 0.04em;\n cursor: pointer;\n border-bottom: 1px solid var(--prism-border);\n background: linear-gradient(180deg, var(--prism-bg-surface), var(--prism-bg));\n }\n .code-head[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:first-of-type {\n text-transform: uppercase;\n letter-spacing: 0.08em;\n color: var(--prism-text-2);\n }\n .code-head[_ngcontent-%COMP%] .chev[_ngcontent-%COMP%] {\n transition: transform var(--dur-fast);\n }\n .is-collapsed[_ngcontent-%COMP%] .code-head[_ngcontent-%COMP%] .chev[_ngcontent-%COMP%] {\n transform: rotate(-90deg);\n }\n\n .code-head-actions[_ngcontent-%COMP%] {\n margin-left: auto;\n display: flex;\n gap: 2px;\n }\n .mini[_ngcontent-%COMP%] {\n height: 22px;\n padding: 0 8px;\n font-size: 10.5px;\n border-radius: 4px;\n color: var(--prism-text-ghost);\n display: flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .mini[_ngcontent-%COMP%]:hover {\n color: var(--prism-text);\n background: var(--prism-input-bg);\n }\n\n .code-body[_ngcontent-%COMP%] {\n margin: 0;\n padding: 12px 20px 16px;\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-x: auto;\n transition: opacity var(--dur-base);\n background: var(--prism-bg);\n white-space: pre;\n }\n .code-body[_ngcontent-%COMP%]::-webkit-scrollbar { height: 6px; }\n .code-body[_ngcontent-%COMP%]::-webkit-scrollbar-thumb { background: var(--prism-border-strong); border-radius: 3px; }\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 });
|
|
96
|
-
}
|
|
97
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismCodeDrawerComponent, [{
|
|
98
|
-
type: Component,
|
|
99
|
-
args: [{ selector: 'prism-code-drawer', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [PrismIconComponent], template: `
|
|
100
|
-
<div class="code-drawer" [class.is-collapsed]="collapsed()">
|
|
101
|
-
<div class="code-head" (click)="layoutService.toggleCodeDrawer()">
|
|
102
|
-
<prism-icon name="chevron-down" [size]="12" class="chev" />
|
|
103
|
-
<prism-icon name="copy" [size]="12" />
|
|
104
|
-
<span>Angular Template</span>
|
|
105
|
-
<div class="code-head-actions">
|
|
106
|
-
<button class="mini" (click)="copy($event)" title="Copy to clipboard">
|
|
107
|
-
<prism-icon name="copy" [size]="11" />
|
|
108
|
-
Copy
|
|
109
|
-
</button>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
<pre class="code-body" [innerHTML]="highlighted()"></pre>
|
|
113
|
-
</div>
|
|
114
|
-
`, styles: ["\n .code-drawer {\n border-top: 1px solid var(--prism-border);\n background: var(--prism-bg);\n max-height: 260px;\n transition: max-height 0.25s var(--ease-default), opacity var(--dur-base);\n overflow: hidden;\n }\n .code-drawer.is-collapsed { max-height: 40px; }\n .code-drawer.is-collapsed .code-body { opacity: 0; }\n\n .code-head {\n display: flex;\n align-items: center;\n gap: 8px;\n height: 40px;\n padding: 0 20px;\n color: var(--prism-text-muted);\n font-size: var(--fs-sm);\n font-weight: 600;\n letter-spacing: 0.04em;\n cursor: pointer;\n border-bottom: 1px solid var(--prism-border);\n background: linear-gradient(180deg, var(--prism-bg-surface), var(--prism-bg));\n }\n .code-head > span:first-of-type {\n text-transform: uppercase;\n letter-spacing: 0.08em;\n color: var(--prism-text-2);\n }\n .code-head .chev {\n transition: transform var(--dur-fast);\n }\n .is-collapsed .code-head .chev {\n transform: rotate(-90deg);\n }\n\n .code-head-actions {\n margin-left: auto;\n display: flex;\n gap: 2px;\n }\n .mini {\n height: 22px;\n padding: 0 8px;\n font-size: 10.5px;\n border-radius: 4px;\n color: var(--prism-text-ghost);\n display: flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n cursor: pointer;\n font-family: var(--font-sans);\n }\n .mini:hover {\n color: var(--prism-text);\n background: var(--prism-input-bg);\n }\n\n .code-body {\n margin: 0;\n padding: 12px 20px 16px;\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-x: auto;\n transition: opacity var(--dur-base);\n background: var(--prism-bg);\n white-space: pre;\n }\n .code-body::-webkit-scrollbar { height: 6px; }\n .code-body::-webkit-scrollbar-thumb { background: var(--prism-border-strong); border-radius: 3px; }\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 "] }]
|
|
115
|
-
}], null, null); })();
|
|
116
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCodeDrawerComponent, { className: "PrismCodeDrawerComponent", filePath: "app/canvas/prism-code-drawer.component.ts", lineNumber: 145 }); })();
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PrismNavigationService } from '../services/prism-navigation.service.js';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class PrismComponentHeaderComponent {
|
|
4
|
-
protected readonly navigationService: PrismNavigationService;
|
|
5
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PrismComponentHeaderComponent, never>;
|
|
6
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PrismComponentHeaderComponent, "prism-component-header", never, {}, {}, never, never, true, never>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=prism-component-header.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prism-component-header.component.d.ts","sourceRoot":"","sources":["../../../src/app/component-header/prism-component-header.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;;AAEjF,qBAkEa,6BAA6B;IACxC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;yCAD3D,6BAA6B;2CAA7B,6BAA6B;CAEzC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Component, inject } from '@angular/core';
|
|
2
|
-
import { PrismNavigationService } from '../services/prism-navigation.service.js';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
function PrismComponentHeaderComponent_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
5
|
-
i0.ɵɵdomElementStart(0, "p", 2);
|
|
6
|
-
i0.ɵɵtext(1);
|
|
7
|
-
i0.ɵɵdomElementEnd();
|
|
8
|
-
} if (rf & 2) {
|
|
9
|
-
const comp_r1 = i0.ɵɵnextContext();
|
|
10
|
-
i0.ɵɵadvance();
|
|
11
|
-
i0.ɵɵtextInterpolate(comp_r1.meta.showcaseConfig.description);
|
|
12
|
-
} }
|
|
13
|
-
function PrismComponentHeaderComponent_Conditional_0_Conditional_4_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
14
|
-
i0.ɵɵdomElementStart(0, "span", 4);
|
|
15
|
-
i0.ɵɵtext(1);
|
|
16
|
-
i0.ɵɵdomElementEnd();
|
|
17
|
-
} if (rf & 2) {
|
|
18
|
-
const tag_r2 = ctx.$implicit;
|
|
19
|
-
i0.ɵɵadvance();
|
|
20
|
-
i0.ɵɵtextInterpolate(tag_r2);
|
|
21
|
-
} }
|
|
22
|
-
function PrismComponentHeaderComponent_Conditional_0_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
23
|
-
i0.ɵɵdomElementStart(0, "div", 3);
|
|
24
|
-
i0.ɵɵrepeaterCreate(1, PrismComponentHeaderComponent_Conditional_0_Conditional_4_For_2_Template, 2, 1, "span", 4, i0.ɵɵrepeaterTrackByIdentity);
|
|
25
|
-
i0.ɵɵdomElementEnd();
|
|
26
|
-
} if (rf & 2) {
|
|
27
|
-
const comp_r1 = i0.ɵɵnextContext();
|
|
28
|
-
i0.ɵɵadvance();
|
|
29
|
-
i0.ɵɵrepeater(comp_r1.meta.showcaseConfig.tags);
|
|
30
|
-
} }
|
|
31
|
-
function PrismComponentHeaderComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
32
|
-
i0.ɵɵdomElementStart(0, "div", 0)(1, "h2", 1);
|
|
33
|
-
i0.ɵɵtext(2);
|
|
34
|
-
i0.ɵɵdomElementEnd();
|
|
35
|
-
i0.ɵɵconditionalCreate(3, PrismComponentHeaderComponent_Conditional_0_Conditional_3_Template, 2, 1, "p", 2);
|
|
36
|
-
i0.ɵɵconditionalCreate(4, PrismComponentHeaderComponent_Conditional_0_Conditional_4_Template, 3, 0, "div", 3);
|
|
37
|
-
i0.ɵɵdomElementEnd();
|
|
38
|
-
} if (rf & 2) {
|
|
39
|
-
const comp_r1 = ctx;
|
|
40
|
-
i0.ɵɵadvance(2);
|
|
41
|
-
i0.ɵɵtextInterpolate(comp_r1.meta.showcaseConfig.title);
|
|
42
|
-
i0.ɵɵadvance();
|
|
43
|
-
i0.ɵɵconditional(comp_r1.meta.showcaseConfig.description ? 3 : -1);
|
|
44
|
-
i0.ɵɵadvance();
|
|
45
|
-
i0.ɵɵconditional(comp_r1.meta.showcaseConfig.tags?.length ? 4 : -1);
|
|
46
|
-
} }
|
|
47
|
-
export class PrismComponentHeaderComponent {
|
|
48
|
-
navigationService = inject(PrismNavigationService);
|
|
49
|
-
static ɵfac = function PrismComponentHeaderComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismComponentHeaderComponent)(); };
|
|
50
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PrismComponentHeaderComponent, selectors: [["prism-component-header"]], decls: 1, vars: 1, consts: [[1, "prism-component-header"], [1, "prism-component-header__title"], [1, "prism-component-header__description"], [1, "prism-component-header__tags"], [1, "prism-component-header__tag"]], template: function PrismComponentHeaderComponent_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
-
i0.ɵɵconditionalCreate(0, PrismComponentHeaderComponent_Conditional_0_Template, 5, 3, "div", 0);
|
|
52
|
-
} if (rf & 2) {
|
|
53
|
-
let tmp_0_0;
|
|
54
|
-
i0.ɵɵconditional((tmp_0_0 = ctx.navigationService.activeComponent()) ? 0 : -1, tmp_0_0);
|
|
55
|
-
} }, styles: [".prism-component-header[_ngcontent-%COMP%] {\n padding: 16px 20px;\n border-bottom: 1px solid var(--prism-border);\n border-left: 3px solid;\n border-image: linear-gradient(180deg, var(--prism-primary-from), var(--prism-primary-to)) 1;\n background: var(--prism-bg-surface);\n }\n\n .prism-component-header__title[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 18px;\n font-weight: 600;\n letter-spacing: -0.01em;\n color: var(--prism-text);\n font-family: var(--prism-font-sans);\n }\n\n .prism-component-header__description[_ngcontent-%COMP%] {\n margin: 4px 0 0;\n font-size: 13px;\n line-height: 1.6;\n color: var(--prism-text-2);\n font-family: var(--prism-font-sans);\n }\n\n .prism-component-header__tags[_ngcontent-%COMP%] {\n display: flex;\n gap: 6px;\n margin-top: 10px;\n flex-wrap: wrap;\n }\n\n .prism-component-header__tag[_ngcontent-%COMP%] {\n padding: 2px 8px;\n font-size: 11px;\n font-weight: 500;\n border-radius: var(--prism-radius-xs);\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n color: var(--prism-primary);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 20%, transparent);\n letter-spacing: 0.02em;\n font-family: var(--prism-font-sans);\n }"] });
|
|
56
|
-
}
|
|
57
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismComponentHeaderComponent, [{
|
|
58
|
-
type: Component,
|
|
59
|
-
args: [{ selector: 'prism-component-header', standalone: true, template: `
|
|
60
|
-
@if (navigationService.activeComponent(); as comp) {
|
|
61
|
-
<div class="prism-component-header">
|
|
62
|
-
<h2 class="prism-component-header__title">{{ comp.meta.showcaseConfig.title }}</h2>
|
|
63
|
-
@if (comp.meta.showcaseConfig.description) {
|
|
64
|
-
<p class="prism-component-header__description">{{ comp.meta.showcaseConfig.description }}</p>
|
|
65
|
-
}
|
|
66
|
-
@if (comp.meta.showcaseConfig.tags?.length) {
|
|
67
|
-
<div class="prism-component-header__tags">
|
|
68
|
-
@for (tag of comp.meta.showcaseConfig.tags; track tag) {
|
|
69
|
-
<span class="prism-component-header__tag">{{ tag }}</span>
|
|
70
|
-
}
|
|
71
|
-
</div>
|
|
72
|
-
}
|
|
73
|
-
</div>
|
|
74
|
-
}
|
|
75
|
-
`, styles: ["\n .prism-component-header {\n padding: 16px 20px;\n border-bottom: 1px solid var(--prism-border);\n border-left: 3px solid;\n border-image: linear-gradient(180deg, var(--prism-primary-from), var(--prism-primary-to)) 1;\n background: var(--prism-bg-surface);\n }\n\n .prism-component-header__title {\n margin: 0;\n font-size: 18px;\n font-weight: 600;\n letter-spacing: -0.01em;\n color: var(--prism-text);\n font-family: var(--prism-font-sans);\n }\n\n .prism-component-header__description {\n margin: 4px 0 0;\n font-size: 13px;\n line-height: 1.6;\n color: var(--prism-text-2);\n font-family: var(--prism-font-sans);\n }\n\n .prism-component-header__tags {\n display: flex;\n gap: 6px;\n margin-top: 10px;\n flex-wrap: wrap;\n }\n\n .prism-component-header__tag {\n padding: 2px 8px;\n font-size: 11px;\n font-weight: 500;\n border-radius: var(--prism-radius-xs);\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n color: var(--prism-primary);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 20%, transparent);\n letter-spacing: 0.02em;\n font-family: var(--prism-font-sans);\n }\n "] }]
|
|
76
|
-
}], null, null); })();
|
|
77
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismComponentHeaderComponent, { className: "PrismComponentHeaderComponent", filePath: "app/component-header/prism-component-header.component.ts", lineNumber: 70 }); })();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { A11yReport, A11yScoreResult } from '../../app/panels/a11y/a11y.types.js';
|
|
2
|
-
export interface RawAuditResult {
|
|
3
|
-
className: string;
|
|
4
|
-
variantName: string;
|
|
5
|
-
variantIndex: number;
|
|
6
|
-
/** Result from `calculateScore(axeResults)` in the running app. */
|
|
7
|
-
score: A11yScoreResult;
|
|
8
|
-
}
|
|
9
|
-
export declare function aggregateAuditResults(results: RawAuditResult[]): A11yReport;
|
|
10
|
-
//# sourceMappingURL=aggregator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../../src/cli/audit-a11y/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,UAAU,CAkD3E"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export function aggregateAuditResults(results) {
|
|
2
|
-
if (results.length === 0) {
|
|
3
|
-
return {
|
|
4
|
-
total: {
|
|
5
|
-
score: 100,
|
|
6
|
-
violations: 0,
|
|
7
|
-
critical: 0,
|
|
8
|
-
serious: 0,
|
|
9
|
-
moderate: 0,
|
|
10
|
-
minor: 0,
|
|
11
|
-
passes: 0,
|
|
12
|
-
incomplete: 0,
|
|
13
|
-
auditedComponents: 0,
|
|
14
|
-
auditedVariants: 0,
|
|
15
|
-
},
|
|
16
|
-
components: {},
|
|
17
|
-
generatedAt: new Date().toISOString(),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const byComponent = new Map();
|
|
21
|
-
for (const r of results) {
|
|
22
|
-
const list = byComponent.get(r.className) ?? [];
|
|
23
|
-
list.push(r.score);
|
|
24
|
-
byComponent.set(r.className, list);
|
|
25
|
-
}
|
|
26
|
-
const componentBreakdown = {};
|
|
27
|
-
for (const [className, scores] of byComponent) {
|
|
28
|
-
componentBreakdown[className] = averageScore(scores);
|
|
29
|
-
}
|
|
30
|
-
const all = results.map((r) => r.score);
|
|
31
|
-
const total = averageScore(all);
|
|
32
|
-
return {
|
|
33
|
-
total: {
|
|
34
|
-
...total,
|
|
35
|
-
// Sum (not average) of violation counts — they aggregate across the library.
|
|
36
|
-
violations: sum(all, (s) => s.violations),
|
|
37
|
-
critical: sum(all, (s) => s.critical),
|
|
38
|
-
serious: sum(all, (s) => s.serious),
|
|
39
|
-
moderate: sum(all, (s) => s.moderate),
|
|
40
|
-
minor: sum(all, (s) => s.minor),
|
|
41
|
-
auditedComponents: byComponent.size,
|
|
42
|
-
auditedVariants: results.length,
|
|
43
|
-
},
|
|
44
|
-
components: componentBreakdown,
|
|
45
|
-
generatedAt: new Date().toISOString(),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function averageScore(scores) {
|
|
49
|
-
const n = scores.length;
|
|
50
|
-
const sumF = (sel) => scores.reduce((acc, s) => acc + sel(s), 0);
|
|
51
|
-
return {
|
|
52
|
-
score: Math.round(sumF((s) => s.score) / n),
|
|
53
|
-
violations: Math.round(sumF((s) => s.violations) / n),
|
|
54
|
-
critical: Math.round(sumF((s) => s.critical) / n),
|
|
55
|
-
serious: Math.round(sumF((s) => s.serious) / n),
|
|
56
|
-
moderate: Math.round(sumF((s) => s.moderate) / n),
|
|
57
|
-
minor: Math.round(sumF((s) => s.minor) / n),
|
|
58
|
-
passes: Math.round(sumF((s) => s.passes) / n),
|
|
59
|
-
incomplete: Math.round(sumF((s) => s.incomplete) / n),
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function sum(scores, sel) {
|
|
63
|
-
return scores.reduce((acc, s) => acc + sel(s), 0);
|
|
64
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RawAuditResult } from './aggregator.js';
|
|
2
|
-
export interface AuditOptions {
|
|
3
|
-
baseUrl: string;
|
|
4
|
-
/** Component class names to limit the audit to. Empty = all. */
|
|
5
|
-
include?: string[];
|
|
6
|
-
/** Component class names to skip. */
|
|
7
|
-
exclude?: string[];
|
|
8
|
-
/** Per-page navigation/render timeout in ms. Default 10_000. */
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
/** Logger for progress output. */
|
|
11
|
-
log?: (msg: string) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function auditPrismApp(opts: AuditOptions): Promise<RawAuditResult[]>;
|
|
14
|
-
//# sourceMappingURL=auditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["../../../src/cli/audit-a11y/auditor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAWtD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAyGjF"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
|
-
const require = createRequire(import.meta.url);
|
|
3
|
-
export async function auditPrismApp(opts) {
|
|
4
|
-
const log = opts.log ?? (() => undefined);
|
|
5
|
-
const timeoutMs = opts.timeoutMs ?? 10_000;
|
|
6
|
-
const playwright = await loadPlaywright();
|
|
7
|
-
const axeSource = loadAxeSource();
|
|
8
|
-
const browser = await playwright.chromium.launch({ headless: true });
|
|
9
|
-
try {
|
|
10
|
-
const context = await browser.newContext();
|
|
11
|
-
const page = await context.newPage();
|
|
12
|
-
await page.goto(opts.baseUrl, { waitUntil: 'networkidle', timeout: timeoutMs });
|
|
13
|
-
await page.waitForFunction(() => globalThis['__PRISM_MANIFEST__'] !== undefined, undefined, { timeout: timeoutMs });
|
|
14
|
-
const manifest = (await page.evaluate(() => globalThis['__PRISM_MANIFEST__']));
|
|
15
|
-
const targets = manifest.components.filter((c) => {
|
|
16
|
-
if (opts.include?.length && !opts.include.includes(c.className))
|
|
17
|
-
return false;
|
|
18
|
-
if (opts.exclude?.length && opts.exclude.includes(c.className))
|
|
19
|
-
return false;
|
|
20
|
-
return true;
|
|
21
|
-
});
|
|
22
|
-
const results = [];
|
|
23
|
-
for (const comp of targets) {
|
|
24
|
-
for (const variant of comp.variants) {
|
|
25
|
-
const url = new URL(opts.baseUrl);
|
|
26
|
-
url.searchParams.set('component', comp.className);
|
|
27
|
-
if (variant.index > 0) {
|
|
28
|
-
url.searchParams.set('variant', String(variant.index));
|
|
29
|
-
}
|
|
30
|
-
log(`Auditing ${comp.className} :: ${variant.name} (#${variant.index})`);
|
|
31
|
-
await page.goto(url.toString(), { waitUntil: 'load', timeout: timeoutMs });
|
|
32
|
-
await page.waitForFunction(([expected]) => {
|
|
33
|
-
const el = document.querySelector('.demo-wrap');
|
|
34
|
-
const key = el?.getAttribute('data-prism-rendered');
|
|
35
|
-
return typeof key === 'string' && key.startsWith(expected);
|
|
36
|
-
}, [`${comp.className}:`], { timeout: timeoutMs });
|
|
37
|
-
await page.addScriptTag({ content: axeSource });
|
|
38
|
-
const score = (await page.evaluate(async () => {
|
|
39
|
-
const target = document.querySelector('.demo-wrap');
|
|
40
|
-
const axe = globalThis['axe'];
|
|
41
|
-
if (!target) {
|
|
42
|
-
return {
|
|
43
|
-
score: 0,
|
|
44
|
-
violations: 0,
|
|
45
|
-
critical: 0,
|
|
46
|
-
serious: 0,
|
|
47
|
-
moderate: 0,
|
|
48
|
-
minor: 0,
|
|
49
|
-
passes: 0,
|
|
50
|
-
incomplete: 0,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
const r = await axe.run(target);
|
|
54
|
-
const critical = r.violations.filter((v) => v.impact === 'critical').length;
|
|
55
|
-
const serious = r.violations.filter((v) => v.impact === 'serious').length;
|
|
56
|
-
const moderate = r.violations.filter((v) => v.impact === 'moderate').length;
|
|
57
|
-
const minor = r.violations.filter((v) => v.impact === 'minor').length;
|
|
58
|
-
const deductions = critical * 25 + serious * 10 + moderate * 5 + minor * 1;
|
|
59
|
-
return {
|
|
60
|
-
score: Math.max(0, 100 - deductions),
|
|
61
|
-
violations: r.violations.length,
|
|
62
|
-
critical,
|
|
63
|
-
serious,
|
|
64
|
-
moderate,
|
|
65
|
-
minor,
|
|
66
|
-
passes: r.passes.length,
|
|
67
|
-
incomplete: r.incomplete.length,
|
|
68
|
-
};
|
|
69
|
-
}));
|
|
70
|
-
results.push({
|
|
71
|
-
className: comp.className,
|
|
72
|
-
variantName: variant.name,
|
|
73
|
-
variantIndex: variant.index,
|
|
74
|
-
score,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return results;
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
await browser.close();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async function loadPlaywright() {
|
|
85
|
-
try {
|
|
86
|
-
return (await import('playwright'));
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
throw new Error('ng-prism-audit-a11y: `playwright` is not installed. Run `npm install --save-dev playwright` ' +
|
|
90
|
-
'and `npx playwright install chromium`. Original error: ' +
|
|
91
|
-
(err instanceof Error ? err.message : String(err)));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function loadAxeSource() {
|
|
95
|
-
try {
|
|
96
|
-
const path = require.resolve('axe-core/axe.min.js');
|
|
97
|
-
return require('node:fs').readFileSync(path, 'utf-8');
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
throw new Error('ng-prism-audit-a11y: `axe-core` is not installed. Run `npm install --save-dev axe-core`. ' +
|
|
101
|
-
'Original error: ' +
|
|
102
|
-
(err instanceof Error ? err.message : String(err)));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/cli/audit-a11y/cli.ts"],"names":[],"mappings":""}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { writeFileSync } from 'node:fs';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { aggregateAuditResults } from './aggregator.js';
|
|
5
|
-
import { auditPrismApp } from './auditor.js';
|
|
6
|
-
import { startStaticServer } from './static-server.js';
|
|
7
|
-
import { checkA11yThresholds, } from '../../builder/a11y/a11y-report-reader.js';
|
|
8
|
-
import { resolveA11yThresholds } from '../../app/panels/a11y/a11y-thresholds.js';
|
|
9
|
-
function parseArgs(argv) {
|
|
10
|
-
const args = {
|
|
11
|
-
dist: '',
|
|
12
|
-
output: 'a11y-report.json',
|
|
13
|
-
port: 4317,
|
|
14
|
-
thresholds: {},
|
|
15
|
-
include: [],
|
|
16
|
-
exclude: [],
|
|
17
|
-
failOnViolation: true,
|
|
18
|
-
};
|
|
19
|
-
for (let i = 2; i < argv.length; i++) {
|
|
20
|
-
const a = argv[i];
|
|
21
|
-
const next = () => {
|
|
22
|
-
const v = argv[++i];
|
|
23
|
-
if (v === undefined) {
|
|
24
|
-
throw new Error(`Missing value for ${a}`);
|
|
25
|
-
}
|
|
26
|
-
return v;
|
|
27
|
-
};
|
|
28
|
-
switch (a) {
|
|
29
|
-
case '--dist':
|
|
30
|
-
args.dist = next();
|
|
31
|
-
break;
|
|
32
|
-
case '--output':
|
|
33
|
-
case '-o':
|
|
34
|
-
args.output = next();
|
|
35
|
-
break;
|
|
36
|
-
case '--port':
|
|
37
|
-
args.port = parseInt(next(), 10);
|
|
38
|
-
break;
|
|
39
|
-
case '--include':
|
|
40
|
-
args.include = next().split(',').map((s) => s.trim()).filter(Boolean);
|
|
41
|
-
break;
|
|
42
|
-
case '--exclude':
|
|
43
|
-
args.exclude = next().split(',').map((s) => s.trim()).filter(Boolean);
|
|
44
|
-
break;
|
|
45
|
-
case '--score':
|
|
46
|
-
args.thresholds.score = parseInt(next(), 10);
|
|
47
|
-
break;
|
|
48
|
-
case '--max-critical':
|
|
49
|
-
args.thresholds.critical = parseInt(next(), 10);
|
|
50
|
-
break;
|
|
51
|
-
case '--max-serious':
|
|
52
|
-
args.thresholds.serious = parseInt(next(), 10);
|
|
53
|
-
break;
|
|
54
|
-
case '--max-moderate':
|
|
55
|
-
args.thresholds.moderate = parseInt(next(), 10);
|
|
56
|
-
break;
|
|
57
|
-
case '--no-fail':
|
|
58
|
-
args.failOnViolation = false;
|
|
59
|
-
break;
|
|
60
|
-
case '-h':
|
|
61
|
-
case '--help':
|
|
62
|
-
printHelp();
|
|
63
|
-
process.exit(0);
|
|
64
|
-
default:
|
|
65
|
-
throw new Error(`Unknown argument: ${a}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (!args.dist) {
|
|
69
|
-
throw new Error('Missing required --dist <path-to-built-prism-app>');
|
|
70
|
-
}
|
|
71
|
-
return args;
|
|
72
|
-
}
|
|
73
|
-
function printHelp() {
|
|
74
|
-
process.stdout.write(`ng-prism-audit-a11y — accessibility audit for a built Prism app.\n\n` +
|
|
75
|
-
`Usage:\n` +
|
|
76
|
-
` ng-prism-audit-a11y --dist <path> [options]\n\n` +
|
|
77
|
-
`Required:\n` +
|
|
78
|
-
` --dist <path> Path to the built Prism app (contains index.html)\n\n` +
|
|
79
|
-
`Output:\n` +
|
|
80
|
-
` --output <file> Report output path (default: a11y-report.json)\n\n` +
|
|
81
|
-
`Server:\n` +
|
|
82
|
-
` --port <n> Static server port (default: 4317)\n\n` +
|
|
83
|
-
`Filtering:\n` +
|
|
84
|
-
` --include A,B Only audit these component class names\n` +
|
|
85
|
-
` --exclude A,B Skip these component class names\n\n` +
|
|
86
|
-
`Thresholds (CI failure):\n` +
|
|
87
|
-
` --score <n> Minimum avg score (default 80)\n` +
|
|
88
|
-
` --max-critical <n> Allowed critical violations (default 0)\n` +
|
|
89
|
-
` --max-serious <n> Allowed serious violations (default 0)\n` +
|
|
90
|
-
` --max-moderate <n> Allowed moderate violations (default unlimited)\n` +
|
|
91
|
-
` --no-fail Write report but never exit non-zero\n\n`);
|
|
92
|
-
}
|
|
93
|
-
async function main() {
|
|
94
|
-
const args = parseArgs(process.argv);
|
|
95
|
-
const server = await startStaticServer(args.dist, args.port);
|
|
96
|
-
process.stdout.write(`Serving ${args.dist} at ${server.url}\n`);
|
|
97
|
-
try {
|
|
98
|
-
const rawResults = await auditPrismApp({
|
|
99
|
-
baseUrl: server.url,
|
|
100
|
-
include: args.include,
|
|
101
|
-
exclude: args.exclude,
|
|
102
|
-
log: (msg) => process.stdout.write(` ${msg}\n`),
|
|
103
|
-
});
|
|
104
|
-
const report = aggregateAuditResults(rawResults);
|
|
105
|
-
const resolvedThresholds = resolveA11yThresholds(args.thresholds);
|
|
106
|
-
const outputPath = resolve(args.output);
|
|
107
|
-
writeFileSync(outputPath, JSON.stringify(report, null, 2), 'utf-8');
|
|
108
|
-
process.stdout.write(`\nReport written: ${outputPath}\n`);
|
|
109
|
-
process.stdout.write(`Library score: ${report.total.score}% ` +
|
|
110
|
-
`(${report.total.auditedVariants} variants across ${report.total.auditedComponents} components)\n` +
|
|
111
|
-
`Violations: ${report.total.critical} critical · ${report.total.serious} serious · ` +
|
|
112
|
-
`${report.total.moderate} moderate · ${report.total.minor} minor\n`);
|
|
113
|
-
const violations = checkA11yThresholds({
|
|
114
|
-
total: report.total,
|
|
115
|
-
thresholds: resolvedThresholds,
|
|
116
|
-
});
|
|
117
|
-
if (violations.length > 0) {
|
|
118
|
-
process.stderr.write('\nThreshold violations:\n');
|
|
119
|
-
for (const v of violations) {
|
|
120
|
-
process.stderr.write(` - ${formatViolation(v)}\n`);
|
|
121
|
-
}
|
|
122
|
-
if (args.failOnViolation) {
|
|
123
|
-
process.exitCode = 1;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
process.stdout.write('\nAll thresholds met.\n');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
finally {
|
|
131
|
-
await server.close();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function formatViolation(v) {
|
|
135
|
-
if (v.metric === 'score') {
|
|
136
|
-
return `score ${v.actual}% < ${v.threshold}%`;
|
|
137
|
-
}
|
|
138
|
-
return `${v.metric}: ${v.actual} > ${v.threshold} allowed`;
|
|
139
|
-
}
|
|
140
|
-
main().catch((err) => {
|
|
141
|
-
process.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
142
|
-
process.exit(1);
|
|
143
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/audit-a11y/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface StaticServerHandle {
|
|
2
|
-
url: string;
|
|
3
|
-
port: number;
|
|
4
|
-
close(): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Minimal static file server for Angular SPA output.
|
|
8
|
-
* Serves files relative to `root`; for unknown routes returns index.html (SPA fallback).
|
|
9
|
-
*/
|
|
10
|
-
export declare function startStaticServer(root: string, port: number): Promise<StaticServerHandle>;
|
|
11
|
-
//# sourceMappingURL=static-server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static-server.d.ts","sourceRoot":"","sources":["../../../src/cli/audit-a11y/static-server.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA8CzF"}
|