@ng-prism/core 22.3.0 → 22.4.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/README.md +13 -13
- package/dist/app/canvas/canvas-bg.styles.d.ts +7 -12
- package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
- package/dist/app/canvas/canvas-bg.styles.js +35 -37
- package/dist/app/canvas/measure-geometry.d.ts +140 -0
- package/dist/app/canvas/measure-geometry.d.ts.map +1 -0
- package/dist/app/canvas/measure-geometry.js +217 -0
- package/dist/app/canvas/measure-keyboard.d.ts +20 -0
- package/dist/app/canvas/measure-keyboard.d.ts.map +1 -0
- package/dist/app/canvas/measure-keyboard.js +34 -0
- package/dist/app/canvas/measure-quad.d.ts +114 -0
- package/dist/app/canvas/measure-quad.d.ts.map +1 -0
- package/dist/app/canvas/measure-quad.js +173 -0
- package/dist/app/canvas/measure-snap.d.ts +35 -0
- package/dist/app/canvas/measure-snap.d.ts.map +1 -0
- package/dist/app/canvas/measure-snap.js +63 -0
- package/dist/app/canvas/prism-canvas-measure.component.d.ts +142 -0
- package/dist/app/canvas/prism-canvas-measure.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-measure.component.js +554 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.d.ts +23 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.js +64 -0
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +22 -39
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +61 -69
- package/dist/app/canvas/prism-template-popover.component.js +1 -1
- package/dist/app/canvas/viewport-snap.d.ts +1 -1
- package/dist/app/canvas/viewport-snap.js +1 -1
- package/dist/app/component-head/head-metrics.d.ts +2 -2
- package/dist/app/component-head/head-metrics.js +1 -1
- package/dist/app/component-head/prism-component-head.component.d.ts +2 -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 +11 -18
- package/dist/app/component-head/prism-head-gauge.component.js +1 -1
- package/dist/app/component-head/prism-head-info.component.d.ts +1 -1
- package/dist/app/component-head/prism-head-info.component.js +2 -2
- package/dist/app/component-head/prism-stat.component.d.ts +1 -1
- package/dist/app/component-head/prism-stat.component.js +2 -2
- package/dist/app/directives/prism-resizer.directive.d.ts +1 -1
- package/dist/app/directives/prism-resizer.directive.js +2 -2
- package/dist/app/directives/resize-value.d.ts +2 -2
- package/dist/app/directives/resize-value.js +2 -2
- package/dist/app/discovery-manifest.d.ts +2 -2
- package/dist/app/discovery-manifest.d.ts.map +1 -1
- package/dist/app/discovery-manifest.js +11 -15
- package/dist/app/header/prism-header.component.js +1 -1
- package/dist/app/icons/icon-registry.d.ts +2 -2
- package/dist/app/icons/icon-registry.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.js +3 -2
- package/dist/app/icons/prism-icon.component.d.ts +2 -2
- package/dist/app/icons/prism-icon.component.js +4 -4
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +14 -21
- package/dist/app/overview/overview-visibility.d.ts +1 -1
- package/dist/app/overview/overview-visibility.js +1 -1
- package/dist/app/overview/prism-overview-cell.component.d.ts +2 -2
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview-cell.component.js +9 -10
- package/dist/app/overview/prism-overview.component.d.ts +2 -2
- package/dist/app/overview/prism-overview.component.js +2 -2
- package/dist/app/page-renderer/prism-page-renderer.component.js +1 -1
- package/dist/app/panels/a11y/a11y-audit.service.js +2 -2
- package/dist/app/panels/a11y/a11y-summary.d.ts +3 -4
- package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-summary.js +3 -4
- package/dist/app/panels/a11y/a11y-thresholds.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-thresholds.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-thresholds.js +1 -1
- package/dist/app/panels/a11y/a11y.types.d.ts +1 -1
- package/dist/app/panels/a11y/a11y.types.d.ts.map +1 -1
- package/dist/app/panels/builtin-navigation-decorations.d.ts +1 -1
- package/dist/app/panels/builtin-navigation-decorations.js +1 -1
- package/dist/app/panels/controls/non-editable-input-types.js +1 -1
- package/dist/app/panels/panel-host/panel-badge.d.ts +1 -1
- package/dist/app/provide-prism.js +1 -1
- package/dist/app/renderer/known-inputs.d.ts +1 -1
- package/dist/app/renderer/known-inputs.js +1 -1
- package/dist/app/renderer/overlay-resolver.d.ts +17 -3
- package/dist/app/renderer/overlay-resolver.d.ts.map +1 -1
- package/dist/app/renderer/overlay-resolver.js +9 -4
- package/dist/app/renderer/prism-renderer.component.d.ts +3 -3
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +25 -16
- package/dist/app/renderer/projectable-content.js +3 -3
- package/dist/app/services/prism-canvas.service.d.ts +12 -1
- package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
- package/dist/app/services/prism-canvas.service.js +23 -5
- package/dist/app/services/prism-capture.service.d.ts +24 -50
- package/dist/app/services/prism-capture.service.d.ts.map +1 -1
- package/dist/app/services/prism-capture.service.js +60 -140
- package/dist/app/services/prism-measure.service.d.ts +44 -0
- package/dist/app/services/prism-measure.service.d.ts.map +1 -0
- package/dist/app/services/prism-measure.service.js +91 -0
- package/dist/app/services/prism-panel.service.d.ts +2 -2
- package/dist/app/services/prism-panel.service.js +2 -2
- package/dist/app/services/prism-persistence.service.js +1 -1
- package/dist/app/services/prism-renderer.service.js +1 -1
- package/dist/app/services/prism-url-state.service.js +1 -1
- package/dist/app/services/prism-variant-bg.service.d.ts +10 -24
- package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -1
- package/dist/app/services/prism-variant-bg.service.js +10 -24
- package/dist/app/shared/prism-metric-badge.component.d.ts +9 -15
- package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
- package/dist/app/shared/prism-metric-badge.component.js +10 -16
- package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
- package/dist/app/shell/prism-shell.component.js +12 -9
- package/dist/app/sidebar/navigation-decorations.d.ts +4 -4
- package/dist/app/sidebar/navigation-decorations.js +2 -2
- package/dist/app/sidebar/prism-sidebar.component.d.ts +2 -2
- package/dist/app/sidebar/prism-sidebar.component.js +3 -3
- package/dist/app/theme/prism-default-theme.js +3 -3
- package/dist/app/variant-ribbon/spectrum.d.ts +1 -1
- package/dist/app/variant-ribbon/spectrum.js +1 -1
- package/dist/app/view-tab-bar/next-view-id.d.ts +1 -1
- package/dist/app/view-tab-bar/next-view-id.js +1 -1
- package/dist/builder/a11y/a11y-report-reader.d.ts +1 -1
- package/dist/builder/a11y/a11y-report-reader.js +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.js +6 -2
- package/dist/builder/plugin-runner/plugin-runner.js +1 -1
- package/dist/builder/scanner/ast-utils.d.ts +46 -2
- package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
- package/dist/builder/scanner/ast-utils.js +337 -31
- package/dist/builder/scanner/class-hierarchy.d.ts +33 -0
- package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -0
- package/dist/builder/scanner/class-hierarchy.js +87 -0
- package/dist/builder/scanner/component.scanner.d.ts +7 -1
- package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/component.scanner.js +106 -58
- package/dist/builder/scanner/input.extractor.d.ts +7 -4
- package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.js +153 -55
- package/dist/builder/scanner/manifest.generator.js +6 -2
- package/dist/builder/scanner/scanner.d.ts +3 -1
- package/dist/builder/scanner/scanner.d.ts.map +1 -1
- package/dist/builder/scanner/scanner.js +6 -4
- package/dist/builder/scanner/showcase-diagnostics.d.ts +25 -0
- package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -0
- package/dist/builder/scanner/showcase-diagnostics.js +96 -0
- package/dist/builder/shared/prism-pipeline.d.ts +1 -1
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +12 -14
- package/dist/builder/watcher/prism-watcher.js +2 -2
- package/dist/decorator/showcase.types.d.ts +11 -9
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/plugin/define-config.js +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +5 -9
- package/dist/plugin/plugin.types.d.ts +30 -13
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.js +2 -2
- package/dist/schematics/ng-add/index.js +4 -4
- package/dist/shared/canvas-bg.type.d.ts +5 -6
- package/dist/shared/canvas-bg.type.d.ts.map +1 -1
- package/dist/shared/canvas-bg.type.js +4 -5
- package/dist/shared/measure.type.d.ts +52 -0
- package/dist/shared/measure.type.d.ts.map +1 -0
- package/dist/shared/measure.type.js +21 -0
- package/dist/shared/variant-bg.d.ts +20 -31
- package/dist/shared/variant-bg.d.ts.map +1 -1
- package/dist/shared/variant-bg.js +20 -31
- package/dist/shared/viewport.type.d.ts +15 -19
- package/dist/shared/viewport.type.d.ts.map +1 -1
- package/dist/shared/viewport.type.js +15 -19
- package/dist/transformer/showcase-strip.transformer.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { type UnevaluableIssue } from './ast-utils.js';
|
|
3
|
+
import type { UnreadableBase } from './class-hierarchy.js';
|
|
4
|
+
/**
|
|
5
|
+
* Describe one value the scanner had to drop from a `@Showcase` config:
|
|
6
|
+
* which component, where in the config, what the source said and where.
|
|
7
|
+
*
|
|
8
|
+
* `SguiFileInputComponent › variants[3] "Auto hint" › inputs.maxFileSize — "megabytes(5)" (src/file-input.component.ts:27:22) cannot be evaluated statically and was dropped.`
|
|
9
|
+
*/
|
|
10
|
+
export declare function describeUnevaluable(className: string, config: ts.Expression, issue: UnevaluableIssue): string;
|
|
11
|
+
/**
|
|
12
|
+
* `providers` never reached the manifest: classes, factories and instances
|
|
13
|
+
* cannot be written into static data. One message for the field, not one per
|
|
14
|
+
* provider, because none of them could have been kept. It points at the
|
|
15
|
+
* literal property if there is one, else at `found`, a provider the scan came
|
|
16
|
+
* across through a spread or a constant, else at the whole config.
|
|
17
|
+
*/
|
|
18
|
+
export declare function describeDeprecatedProviders(className: string, config: ts.Expression, found?: ts.Node): string;
|
|
19
|
+
/**
|
|
20
|
+
* A base class from a package only ships its declarations: no `input()`
|
|
21
|
+
* call, no required flag, no default. Its inputs are named so the reader
|
|
22
|
+
* knows which variant values will not reach the component.
|
|
23
|
+
*/
|
|
24
|
+
export declare function describeUnreadableBase(className: string, base: UnreadableBase): string;
|
|
25
|
+
//# sourceMappingURL=showcase-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showcase-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/showcase-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAA2C,KAAK,gBAAgB,EAA4B,MAAM,gBAAgB,CAAC;AAC1H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAa3D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAY7G;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAO7G;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAOtF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { relative } from 'node:path';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import { evaluateExpression } from './ast-utils.js';
|
|
4
|
+
const MAX_EXCERPT_LENGTH = 60;
|
|
5
|
+
const CAUSES = {
|
|
6
|
+
let: 'is declared with let; only const declarations can be read',
|
|
7
|
+
var: 'is declared with var; only const declarations can be read',
|
|
8
|
+
'no-value': 'is declared without a value, as in a .d.ts file or with declare',
|
|
9
|
+
cycle: 'refers back to itself',
|
|
10
|
+
'runtime-value': 'is a function or class, which only exists at runtime'
|
|
11
|
+
};
|
|
12
|
+
const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
13
|
+
/**
|
|
14
|
+
* Describe one value the scanner had to drop from a `@Showcase` config:
|
|
15
|
+
* which component, where in the config, what the source said and where.
|
|
16
|
+
*
|
|
17
|
+
* `SguiFileInputComponent › variants[3] "Auto hint" › inputs.maxFileSize — "megabytes(5)" (src/file-input.component.ts:27:22) cannot be evaluated statically and was dropped.`
|
|
18
|
+
*/
|
|
19
|
+
export function describeUnevaluable(className, config, issue) {
|
|
20
|
+
const isRoot = issue.node === config;
|
|
21
|
+
const where = issue.path.length === 0 ? '@Showcase' : formatShowcasePath(issue.path, config);
|
|
22
|
+
const consequence = isRoot
|
|
23
|
+
? 'cannot be evaluated statically, so the component is skipped'
|
|
24
|
+
: issue.reason === 'runtime-value'
|
|
25
|
+
? 'is a runtime value (function, class or instance) and cannot be part of the static manifest; it was dropped'
|
|
26
|
+
: 'cannot be evaluated statically and was dropped';
|
|
27
|
+
const cause = issue.cause ? `: ${excerpt(issue.cause.node)} ${CAUSES[issue.cause.kind]}` : '';
|
|
28
|
+
return `${className} › ${where} — "${excerpt(issue.node)}" (${location(issue.node)}) ${consequence}${cause}.`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* `providers` never reached the manifest: classes, factories and instances
|
|
32
|
+
* cannot be written into static data. One message for the field, not one per
|
|
33
|
+
* provider, because none of them could have been kept. It points at the
|
|
34
|
+
* literal property if there is one, else at `found`, a provider the scan came
|
|
35
|
+
* across through a spread or a constant, else at the whole config.
|
|
36
|
+
*/
|
|
37
|
+
export function describeDeprecatedProviders(className, config, found) {
|
|
38
|
+
const literal = ts.isObjectLiteralExpression(config) ? findProperty(config, 'providers') : undefined;
|
|
39
|
+
return (`${className} declares @Showcase providers (${location(literal ?? found ?? config)}), which are deprecated and will be removed in 23.0.0; ` +
|
|
40
|
+
`the manifest is static and cannot hold them, so they never reach the styleguide. Use defineConfig({ appProviders }) instead.`);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A base class from a package only ships its declarations: no `input()`
|
|
44
|
+
* call, no required flag, no default. Its inputs are named so the reader
|
|
45
|
+
* knows which variant values will not reach the component.
|
|
46
|
+
*/
|
|
47
|
+
export function describeUnreadableBase(className, base) {
|
|
48
|
+
const baseName = base.classDecl.name?.text ?? 'an anonymous class';
|
|
49
|
+
return (`${className} inherits ${base.inputs.join(', ')} from ${baseName}, which only exists as a declaration (${location(base.classDecl)}); ` +
|
|
50
|
+
`without its source these inputs cannot be read, so they are missing from the manifest and variants cannot set them.`);
|
|
51
|
+
}
|
|
52
|
+
/** A variant is named by its `name` as well as its index, since that is what the styleguide shows. */
|
|
53
|
+
function formatShowcasePath(path, config) {
|
|
54
|
+
const [head, index, ...rest] = path;
|
|
55
|
+
if (head !== 'variants' || typeof index !== 'number')
|
|
56
|
+
return formatPath(path);
|
|
57
|
+
const name = variantName(config, index);
|
|
58
|
+
const variant = name === undefined ? `variants[${index}]` : `variants[${index}] ${JSON.stringify(name)}`;
|
|
59
|
+
return rest.length === 0 ? variant : `${variant} › ${formatPath(rest)}`;
|
|
60
|
+
}
|
|
61
|
+
function formatPath(path) {
|
|
62
|
+
return path
|
|
63
|
+
.map((segment, i) => {
|
|
64
|
+
if (typeof segment === 'number')
|
|
65
|
+
return `[${segment}]`;
|
|
66
|
+
if (!IDENTIFIER.test(segment))
|
|
67
|
+
return `[${JSON.stringify(segment)}]`;
|
|
68
|
+
return i === 0 ? segment : `.${segment}`;
|
|
69
|
+
})
|
|
70
|
+
.join('');
|
|
71
|
+
}
|
|
72
|
+
/** Read from the source, because the evaluated array has already lost the elements before the index. */
|
|
73
|
+
function variantName(config, index) {
|
|
74
|
+
const variants = ts.isObjectLiteralExpression(config) ? findInitializer(config, 'variants') : undefined;
|
|
75
|
+
const variant = variants && ts.isArrayLiteralExpression(variants) ? variants.elements[index] : undefined;
|
|
76
|
+
const name = variant && ts.isObjectLiteralExpression(variant) ? findInitializer(variant, 'name') : undefined;
|
|
77
|
+
const value = name && evaluateExpression(name);
|
|
78
|
+
return typeof value === 'string' ? value : undefined;
|
|
79
|
+
}
|
|
80
|
+
function findProperty(object, key) {
|
|
81
|
+
return object.properties.find((prop) => prop.name !== undefined && (ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)) && prop.name.text === key);
|
|
82
|
+
}
|
|
83
|
+
function findInitializer(object, key) {
|
|
84
|
+
const prop = findProperty(object, key);
|
|
85
|
+
return prop && ts.isPropertyAssignment(prop) ? prop.initializer : undefined;
|
|
86
|
+
}
|
|
87
|
+
function excerpt(node) {
|
|
88
|
+
const text = node.getText().replace(/\s+/g, ' ');
|
|
89
|
+
return text.length > MAX_EXCERPT_LENGTH ? `${text.slice(0, MAX_EXCERPT_LENGTH - 1)}…` : text;
|
|
90
|
+
}
|
|
91
|
+
/** Relative to the working directory and with line and column, so that terminals and editors can link it. */
|
|
92
|
+
function location(node) {
|
|
93
|
+
const sourceFile = node.getSourceFile();
|
|
94
|
+
const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
95
|
+
return `${relative(process.cwd(), sourceFile.fileName)}:${line + 1}:${character + 1}`;
|
|
96
|
+
}
|
|
@@ -17,7 +17,7 @@ export interface PrismPipelineResult {
|
|
|
17
17
|
}
|
|
18
18
|
export interface PrismPipelineState {
|
|
19
19
|
scanner: Scanner | undefined;
|
|
20
|
-
/** Sorted, joined entry-file paths
|
|
20
|
+
/** Sorted, joined entry-file paths. Used to detect when the entry set changed between rebuilds. */
|
|
21
21
|
lastEntrySetKey: string | undefined;
|
|
22
22
|
}
|
|
23
23
|
export declare function createPipelineState(): PrismPipelineState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-pipeline.d.ts","sourceRoot":"","sources":["../../../src/builder/shared/prism-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"prism-pipeline.d.ts","sourceRoot":"","sources":["../../../src/builder/shared/prism-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAShE,OAAO,EAAiB,KAAK,OAAO,EAAmB,MAAM,uBAAuB,CAAC;AAErF,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,mGAAmG;IACnG,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,wBAAgB,mBAAmB,IAAI,kBAAkB,CAExD;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAuFtJ"}
|
|
@@ -18,10 +18,13 @@ export async function runPrismPipeline(options, context, state) {
|
|
|
18
18
|
configFileName: options.configFile
|
|
19
19
|
});
|
|
20
20
|
context.reportStatus('Scanning components...');
|
|
21
|
-
const
|
|
21
|
+
const { components, diagnostics } = scanEntryPoints(workspaceRoot, options, state);
|
|
22
|
+
if (config.strictShowcase && diagnostics.length > 0) {
|
|
23
|
+
throw new Error(`ng-prism: strictShowcase is enabled and ${diagnostics.length} @Showcase value(s) were dropped; see the warnings above.`);
|
|
24
|
+
}
|
|
22
25
|
const pages = config.pages ? [...config.pages] : [];
|
|
23
26
|
context.reportStatus('Running plugin hooks...');
|
|
24
|
-
let manifest = await runPluginHooks({
|
|
27
|
+
let manifest = await runPluginHooks({ components, pages }, config.plugins ?? []);
|
|
25
28
|
const a11yReportPath = config.a11y?.reportPath ?? DEFAULT_A11Y_REPORT_PATH;
|
|
26
29
|
const a11yReportPathAbs = join(workspaceRoot, a11yReportPath);
|
|
27
30
|
const a11yMeta = readA11yMeta(a11yReportPathAbs, config.a11y?.thresholds);
|
|
@@ -29,7 +32,7 @@ export async function runPrismPipeline(options, context, state) {
|
|
|
29
32
|
const violations = checkA11yThresholds(a11yMeta);
|
|
30
33
|
if (violations.length > 0) {
|
|
31
34
|
const summary = violations.map((v) => `${v.metric}: ${v.actual} (threshold ${v.threshold})`).join(', ');
|
|
32
|
-
throw new Error(`ng-prism: a11y thresholds violated
|
|
35
|
+
throw new Error(`ng-prism: a11y thresholds violated: ${summary}. ` + `Update components or relax thresholds via config.a11y.thresholds.`);
|
|
33
36
|
}
|
|
34
37
|
// Read once, not once per component: the reader re-stats the file on every
|
|
35
38
|
// call even when its cache hits, so a per-component lookup scales the
|
|
@@ -69,7 +72,7 @@ export async function runPrismPipeline(options, context, state) {
|
|
|
69
72
|
context.logger.info(`ng-prism: ${written ? 'Generated' : 'Verified (unchanged)'} manifest ` +
|
|
70
73
|
`with ${manifest.components.length} component(s)` +
|
|
71
74
|
(pageCount > 0 ? ` and ${pageCount} page(s)` : '') +
|
|
72
|
-
`
|
|
75
|
+
` at ${manifestPath}`);
|
|
73
76
|
return {
|
|
74
77
|
manifestPath,
|
|
75
78
|
componentCount: manifest.components.length,
|
|
@@ -84,16 +87,11 @@ function writeManifestIfChanged(manifestPath, newContent) {
|
|
|
84
87
|
return false;
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
// rename, and never picks up subsequent rewrites. The result for the user
|
|
93
|
-
// is that @Showcase changes never trigger an HMR / reload. The window
|
|
94
|
-
// between truncate and write is small (single syscall for kilobyte-sized
|
|
95
|
-
// manifests), so the risk of a bundler observing a partial file is
|
|
96
|
-
// negligible in practice.
|
|
90
|
+
// Write in place (truncate + write, same inode). A temp file + atomic
|
|
91
|
+
// rename creates a new inode each time, and Vite's watcher loses the file
|
|
92
|
+
// when the manifest lives in a cache dir outside the project's source
|
|
93
|
+
// root, so @Showcase changes would stop triggering HMR. The manifest is
|
|
94
|
+
// only kilobytes, so a bundler seeing a partial write is unlikely.
|
|
97
95
|
writeFileSync(manifestPath, newContent, 'utf-8');
|
|
98
96
|
return true;
|
|
99
97
|
}
|
|
@@ -25,7 +25,7 @@ export function createChangeHandler(options) {
|
|
|
25
25
|
}
|
|
26
26
|
catch (err) {
|
|
27
27
|
if (!disposed) {
|
|
28
|
-
logger.error(`ng-prism: Re-scan failed
|
|
28
|
+
logger.error(`ng-prism: Re-scan failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
finally {
|
|
@@ -81,7 +81,7 @@ export function startWatcher(options) {
|
|
|
81
81
|
watcher.on('change', (filePath) => handler.handleChange(filePath));
|
|
82
82
|
watcher.on('add', (filePath) => handler.handleChange(filePath));
|
|
83
83
|
watcher.on('unlink', (filePath) => handler.handleChange(filePath));
|
|
84
|
-
watcher.on('error', (err) => logger.error(`ng-prism: Watcher error
|
|
84
|
+
watcher.on('error', (err) => logger.error(`ng-prism: Watcher error: ${err instanceof Error ? err.message : String(err)}`));
|
|
85
85
|
logger.info(`ng-prism: Watching ${watchPaths.join(', ')} for changes...`);
|
|
86
86
|
return {
|
|
87
87
|
close() {
|
|
@@ -16,7 +16,7 @@ type UnwrapSignalInput<S> = S extends InputSignalWithTransform<any, infer WriteT
|
|
|
16
16
|
* (`input()`, `input.required()`, `model()`), unwrapping each to its value type.
|
|
17
17
|
* `output()` and other properties are excluded.
|
|
18
18
|
*
|
|
19
|
-
* When `T` is `unknown` (the default
|
|
19
|
+
* When `T` is `unknown` (the default, i.e. no generic argument given), falls back
|
|
20
20
|
* to `Record<string, unknown>` so existing call sites without a generic param
|
|
21
21
|
* keep working.
|
|
22
22
|
*/
|
|
@@ -26,7 +26,7 @@ export type InputsOf<T> = [unknown] extends [T] ? Record<string, unknown> : {
|
|
|
26
26
|
export interface ShowcaseConfig<T = unknown> {
|
|
27
27
|
/** Display name in the ng-prism UI */
|
|
28
28
|
title: string;
|
|
29
|
-
/** Description text
|
|
29
|
+
/** Description text, Markdown supported */
|
|
30
30
|
description?: string;
|
|
31
31
|
/** Groups the component in the sidebar */
|
|
32
32
|
category?: string;
|
|
@@ -36,14 +36,14 @@ export interface ShowcaseConfig<T = unknown> {
|
|
|
36
36
|
componentOrder?: number;
|
|
37
37
|
/**
|
|
38
38
|
* Top-level section in the sidebar. Auto-detected if omitted:
|
|
39
|
-
*
|
|
39
|
+
* 'Directives' for a `@Directive`, otherwise 'Components'. Free-form string:
|
|
40
40
|
* any value creates a new top-level section (e.g. 'Pipes', 'Utilities').
|
|
41
41
|
*/
|
|
42
42
|
section?: string;
|
|
43
43
|
/**
|
|
44
44
|
* Sort order of this section in the sidebar (lower = higher in list).
|
|
45
45
|
* The section's effective order is the minimum `sectionOrder` of all its items.
|
|
46
|
-
* Defaults: 'Components'
|
|
46
|
+
* Defaults: 'Components' 0, 'Directives' 10, all others 100.
|
|
47
47
|
*/
|
|
48
48
|
sectionOrder?: number;
|
|
49
49
|
/** Predefined variants shown as tabs */
|
|
@@ -51,9 +51,11 @@ export interface ShowcaseConfig<T = unknown> {
|
|
|
51
51
|
/** Tags for search and filtering */
|
|
52
52
|
tags?: string[];
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* @deprecated Deprecated since 22.4.0, removed in 23.0.0. Never reached
|
|
55
|
+
* the styleguide: providers are classes, factories or instances, which the
|
|
56
|
+
* static manifest cannot hold, so the build drops them with a warning. Use
|
|
57
|
+
* `defineConfig({ appProviders })`, or, for one component, a component
|
|
58
|
+
* page (`renderPage`) that declares them.
|
|
57
59
|
*/
|
|
58
60
|
providers?: Provider[];
|
|
59
61
|
/** Arbitrary metadata for plugins (e.g. { figma: 'https://...' }) */
|
|
@@ -93,8 +95,8 @@ export interface Variant<T = unknown> {
|
|
|
93
95
|
inputs?: Partial<InputsOf<T>>;
|
|
94
96
|
/**
|
|
95
97
|
* Content projected into <ng-content>.
|
|
96
|
-
* - string
|
|
97
|
-
* - Record<string, string
|
|
98
|
+
* - string: projected into the default (unnamed) slot
|
|
99
|
+
* - Record<string, string>: keys are slot selectors (e.g. '[card-header]'), 'default' is the unnamed slot
|
|
98
100
|
*/
|
|
99
101
|
content?: string | Record<string, string>;
|
|
100
102
|
/** Optional description for this variant */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"showcase.types.d.ts","sourceRoot":"","sources":["../../src/decorator/showcase.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,MAAM,eAAe,G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,EAAE,CAAC;IACvB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,6HAA6H;IAC7H,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,mPAAmP;IACnP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,OAAO;IAChC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,0IAA0I;IAC1I,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,qFAAqF;IACrF,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,qIAAqI;IACrI,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Public API
|
|
1
|
+
// Public API: decorator
|
|
2
2
|
export * from './decorator/index.js';
|
|
3
|
-
// Public API
|
|
3
|
+
// Public API: plugin
|
|
4
4
|
export * from './plugin/index.js';
|
|
5
|
-
// Public API
|
|
5
|
+
// Public API: app (styleguide)
|
|
6
6
|
export * from './app/index.js';
|
|
@@ -19,6 +19,6 @@ function warnOnDuplicatePluginNames(config) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
for (const name of duplicates) {
|
|
22
|
-
console.warn(`⚠ ng-prism: plugin "${name}" is registered more than once
|
|
22
|
+
console.warn(`⚠ ng-prism: plugin "${name}" is registered more than once, so later hooks may overwrite earlier ones.`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,YAAY,EACR,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,EACT,oBAAoB,EACpB,8BAA8B,EAC9B,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjF,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,YAAY,EACR,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,EACT,oBAAoB,EACpB,8BAA8B,EAC9B,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjF,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMlD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACnG,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -2,14 +2,10 @@ export { CANVAS_BGS } from '../shared/canvas-bg.type.js';
|
|
|
2
2
|
export { DEFAULT_VARIANT_BG, resolveVariantBg } from '../shared/variant-bg.js';
|
|
3
3
|
export { componentPage, customPage } from './page-helpers.js';
|
|
4
4
|
export { defineConfig } from './define-config.js';
|
|
5
|
-
//
|
|
6
|
-
// The builder evaluates plugin config
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Not a blanket "no Angular below this line": `prism-tokens.js` a few lines
|
|
11
|
-
// down imports `InjectionToken`, and evaluating a plain class constructor in
|
|
12
|
-
// Node is harmless. The line being drawn is decorated declarations, not the
|
|
13
|
-
// package.
|
|
5
|
+
// Imported from the dependency-free registry module, not from
|
|
6
|
+
// `prism-icon.component.js`. The builder evaluates plugin config in Node.js,
|
|
7
|
+
// and importing the component module would run its `@Component` decorator
|
|
8
|
+
// there. Plain Angular classes are fine (`prism-tokens.js` below imports
|
|
9
|
+
// `InjectionToken`); decorated declarations are not.
|
|
14
10
|
export { ICON_NAMES } from '../app/icons/icon-registry.js';
|
|
15
11
|
export { PRISM_CONFIG, PRISM_MANIFEST, PRISM_RENDERER_HOOKS } from '../app/tokens/prism-tokens.js';
|
|
@@ -2,7 +2,7 @@ import type { Provider, Type } from '@angular/core';
|
|
|
2
2
|
import type { CanvasBg } from '../shared/canvas-bg.type.js';
|
|
3
3
|
import type { StyleguidePage } from './page.types.js';
|
|
4
4
|
export interface NgPrismPlugin {
|
|
5
|
-
/** Unique plugin name
|
|
5
|
+
/** Unique plugin name, used for debugging and conflict detection */
|
|
6
6
|
name: string;
|
|
7
7
|
onComponentScanned?: (component: ScannedComponent) => ScannedComponent | void | Promise<ScannedComponent | void>;
|
|
8
8
|
onPageScanned?: (page: StyleguidePage) => StyleguidePage | void | Promise<StyleguidePage | void>;
|
|
@@ -17,12 +17,12 @@ export interface NgPrismPlugin {
|
|
|
17
17
|
wrapComponent?: Type<unknown>;
|
|
18
18
|
}
|
|
19
19
|
export interface HeaderWidgetDefinition {
|
|
20
|
-
/** Unique widget id
|
|
20
|
+
/** Unique widget id, used for de-duplication and tracking. */
|
|
21
21
|
id: string;
|
|
22
22
|
/** Eager component reference. */
|
|
23
23
|
component?: Type<unknown>;
|
|
24
24
|
/**
|
|
25
|
-
* Lazy-loaded component
|
|
25
|
+
* Lazy-loaded component. Use it when the widget pulls in browser-only or
|
|
26
26
|
* heavy dependencies that should not run at config-load time.
|
|
27
27
|
*/
|
|
28
28
|
loadComponent?: () => Promise<Type<unknown>>;
|
|
@@ -33,7 +33,7 @@ export interface HeaderWidgetDefinition {
|
|
|
33
33
|
}
|
|
34
34
|
/** A short marker rendered on a panel's tab, usually a count. */
|
|
35
35
|
export interface PanelBadge {
|
|
36
|
-
/** Kept to a couple of characters
|
|
36
|
+
/** Kept to a couple of characters because the tab bar scrolls horizontally. */
|
|
37
37
|
text: string;
|
|
38
38
|
/**
|
|
39
39
|
* Colour role. `default` is the neutral primary tint used for a plain count;
|
|
@@ -44,7 +44,7 @@ export interface PanelBadge {
|
|
|
44
44
|
/** What one source has to say about one component in the navigation. */
|
|
45
45
|
export interface NavigationDecoration {
|
|
46
46
|
/**
|
|
47
|
-
* Colour role.
|
|
47
|
+
* Colour role. Only two: an 'ok' state would make the marker
|
|
48
48
|
* permanent, and a marker that is always present stops being a signal.
|
|
49
49
|
*/
|
|
50
50
|
variant: 'warn' | 'danger';
|
|
@@ -52,7 +52,7 @@ export interface NavigationDecoration {
|
|
|
52
52
|
label: string;
|
|
53
53
|
}
|
|
54
54
|
export interface NavigationDecorationDefinition {
|
|
55
|
-
/** Unique id
|
|
55
|
+
/** Unique id, used for de-duplication when two plugins contribute the same source. */
|
|
56
56
|
id: string;
|
|
57
57
|
/** Icon name from the built-in registry (`ICON_NAMES`). */
|
|
58
58
|
icon: string;
|
|
@@ -77,7 +77,7 @@ export interface PanelDefinition {
|
|
|
77
77
|
label: string;
|
|
78
78
|
/** Angular standalone component for the panel content */
|
|
79
79
|
component?: Type<unknown>;
|
|
80
|
-
/** Lazy-loaded component
|
|
80
|
+
/** Lazy-loaded component. Use when the component import would pull in browser-only dependencies (e.g. DomSanitizer) */
|
|
81
81
|
loadComponent?: () => Promise<Type<unknown>>;
|
|
82
82
|
overlayComponent?: Type<unknown>;
|
|
83
83
|
loadOverlayComponent?: () => Promise<Type<unknown>>;
|
|
@@ -91,7 +91,7 @@ export interface PanelDefinition {
|
|
|
91
91
|
isVisible?: (component: RuntimeComponent) => boolean;
|
|
92
92
|
/**
|
|
93
93
|
* When provided, the panel's tab carries this badge for the active
|
|
94
|
-
* component. Return `null` for "nothing worth saying"
|
|
94
|
+
* component. Return `null` for "nothing worth saying": a badge that is
|
|
95
95
|
* always present stops being a signal.
|
|
96
96
|
*
|
|
97
97
|
* Called during change detection, so it has to be cheap and pure: read what
|
|
@@ -102,7 +102,7 @@ export interface PanelDefinition {
|
|
|
102
102
|
* Keep the panel's component instance alive across tab switches.
|
|
103
103
|
* When `true`, the panel is rendered once on first activation and merely hidden
|
|
104
104
|
* (instead of destroyed) when the user switches tabs. Use for panels with
|
|
105
|
-
* expensive setup (iframes, network calls, heavy DOM)
|
|
105
|
+
* expensive setup (iframes, network calls, heavy DOM), e.g. embedded designs,
|
|
106
106
|
* remote previews.
|
|
107
107
|
*
|
|
108
108
|
* Default: `false`.
|
|
@@ -134,6 +134,15 @@ export interface ScannedComponent {
|
|
|
134
134
|
};
|
|
135
135
|
/** Import path for the component's entry point (e.g. 'my-lib/atoms/pill') */
|
|
136
136
|
importPath?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Base classes with source the component extends, nearest first, for a
|
|
139
|
+
* plugin to read what the component inherits. Build time only: the
|
|
140
|
+
* manifest does not carry it.
|
|
141
|
+
*/
|
|
142
|
+
baseClasses?: {
|
|
143
|
+
className: string;
|
|
144
|
+
filePath: string;
|
|
145
|
+
}[];
|
|
137
146
|
/** Arbitrary plugin metadata */
|
|
138
147
|
meta?: Record<string, unknown>;
|
|
139
148
|
}
|
|
@@ -174,7 +183,7 @@ export interface DiscoveryManifest {
|
|
|
174
183
|
}
|
|
175
184
|
export interface DiscoveryComponent {
|
|
176
185
|
className: string;
|
|
177
|
-
/** `ShowcaseConfig.title
|
|
186
|
+
/** `ShowcaseConfig.title`, i.e. the display name, not the class name. */
|
|
178
187
|
title: string;
|
|
179
188
|
variants: DiscoveryVariant[];
|
|
180
189
|
/** Sanitised `ShowcaseConfig.meta`. Omitted when empty. */
|
|
@@ -182,14 +191,14 @@ export interface DiscoveryComponent {
|
|
|
182
191
|
}
|
|
183
192
|
export interface DiscoveryVariant {
|
|
184
193
|
name: string;
|
|
185
|
-
/** 0-based index into the `variants` array
|
|
194
|
+
/** 0-based index into the `variants` array (the `?variant=` URL value). */
|
|
186
195
|
index: number;
|
|
187
196
|
/**
|
|
188
197
|
* The canvas background this variant renders on, already resolved:
|
|
189
198
|
* `Variant.bg`, else `ShowcaseConfig.bg`, else `DEFAULT_VARIANT_BG`.
|
|
190
199
|
*
|
|
191
200
|
* Always present, because a screenshot runner cannot act on "nothing
|
|
192
|
-
* declared"
|
|
201
|
+
* declared". It is also the background capture mode paints, so the value
|
|
193
202
|
* here and the pixels in the capture agree.
|
|
194
203
|
*/
|
|
195
204
|
bg: CanvasBg;
|
|
@@ -202,7 +211,7 @@ export interface DiscoveryPage {
|
|
|
202
211
|
export interface NgPrismConfig {
|
|
203
212
|
plugins?: NgPrismPlugin[];
|
|
204
213
|
pages?: StyleguidePage[];
|
|
205
|
-
/** Providers added to the Prism app bootstrap
|
|
214
|
+
/** Providers added to the Prism app bootstrap, for library-wide services */
|
|
206
215
|
appProviders?: Provider[];
|
|
207
216
|
theme?: Record<string, string>;
|
|
208
217
|
darkTheme?: Record<string, string>;
|
|
@@ -235,5 +244,13 @@ export interface NgPrismConfig {
|
|
|
235
244
|
};
|
|
236
245
|
/** Accessibility (build-time audit + runtime live audit) configuration. */
|
|
237
246
|
a11y?: import('../app/panels/a11y/a11y.types.js').NgPrismA11yConfig;
|
|
247
|
+
/**
|
|
248
|
+
* When true, the build fails instead of warning whenever the scanner has
|
|
249
|
+
* to drop a `@Showcase` value: one it cannot evaluate statically, an
|
|
250
|
+
* invalid `bg`, `status` or `canvasLayout`, a missing `title`, or the
|
|
251
|
+
* deprecated `providers`, which never reach the styleguide.
|
|
252
|
+
* Default: `false`.
|
|
253
|
+
*/
|
|
254
|
+
strictShowcase?: boolean;
|
|
238
255
|
}
|
|
239
256
|
//# sourceMappingURL=plugin.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.types.d.ts","sourceRoot":"","sources":["../../src/plugin/plugin.types.ts"],"names":[],"mappings":"AAAA,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;QACzB,aAAa,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,kCAAkC,EAAE,iBAAiB,CAAC;IACpE;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -46,7 +46,7 @@ function updateTsConfigMapping(tree, context) {
|
|
|
46
46
|
}
|
|
47
47
|
const existing = parsed.compilerOptions?.paths?.['prism-manifest/*'];
|
|
48
48
|
if (!existing) {
|
|
49
|
-
// No existing mapping
|
|
49
|
+
// No existing mapping, so fall through to addTsConfigPath which inserts the new default.
|
|
50
50
|
addTsConfigPath(tree, 'tsconfig.json', 'prism-manifest/*', [NEW_PATH_MAPPING]);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
@@ -127,7 +127,7 @@ export function migrate() {
|
|
|
127
127
|
}
|
|
128
128
|
renameGitignoreEntry(tree);
|
|
129
129
|
context.logger.info('ng-prism migration: cache directory renamed from .ng-prism/ to ng-prism-cache/. ' +
|
|
130
|
-
'You can safely delete the old .ng-prism/ directory from your workspace
|
|
130
|
+
'You can safely delete the old .ng-prism/ directory from your workspace; ' +
|
|
131
131
|
'the builder will regenerate the manifest on next serve/build run.');
|
|
132
132
|
return tree;
|
|
133
133
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { chain, SchematicsException } from '@angular-devkit/schematics';
|
|
2
2
|
// `@angular-devkit/schematics` has no `exports` map, so its subpaths must name
|
|
3
|
-
// a file
|
|
3
|
+
// a file. Node's ESM resolver does not honour the legacy `tasks/package.json`
|
|
4
4
|
// `main` field the way CommonJS `require()` does. See issue #32.
|
|
5
5
|
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks/index.js';
|
|
6
6
|
import { addTsConfigPath } from '../utils/tsconfig-paths.js';
|
|
@@ -20,8 +20,8 @@ function readJsonIfPresent(tree, path) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Angular CLI workspaces install `@angular-devkit/build-angular`; Nx and newer
|
|
22
22
|
* Angular workspaces install `@angular/build`. Presence in node_modules is not a
|
|
23
|
-
* usable signal
|
|
24
|
-
* itself
|
|
23
|
+
* usable signal (`@angular-devkit/build-angular` depends on `@angular/build`
|
|
24
|
+
* itself), so only a direct entry in package.json counts.
|
|
25
25
|
*/
|
|
26
26
|
function resolveAppBuilder(tree) {
|
|
27
27
|
const pkg = readJsonIfPresent(tree, 'package.json');
|
|
@@ -84,7 +84,7 @@ function readWorkspace(tree) {
|
|
|
84
84
|
const buffer = tree.read('angular.json');
|
|
85
85
|
if (!buffer) {
|
|
86
86
|
throw new SchematicsException('Could not find angular.json. Run this from an Angular workspace root, or ' +
|
|
87
|
-
'in an Nx workspace via `nx g @ng-prism/core:ng-add --project=<library
|
|
87
|
+
'in an Nx workspace via `nx g @ng-prism/core:ng-add --project=<library>`. ' +
|
|
88
88
|
'Nx supplies the workspace configuration the schematic reads.');
|
|
89
89
|
}
|
|
90
90
|
return JSON.parse(buffer.toString('utf-8'));
|
|
@@ -10,7 +10,7 @@ export type CanvasBg = 'dots' | 'plain' | 'light' | 'dark'
|
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated Deprecated since 22.2.0, removed in 23.0.0. It draws the same
|
|
12
12
|
* checkerboard as `transparent` while browsing, so the canvas cannot tell
|
|
13
|
-
* the two apart
|
|
13
|
+
* the two apart. But it captures as `--prism-bg-surface`, a *theme* token,
|
|
14
14
|
* which makes a baseline recorded on it depend on the theme the runner's
|
|
15
15
|
* browser started in. Use `transparent` for the same look with a capture
|
|
16
16
|
* that keeps its alpha, or `light`/`dark` for an absolute colour.
|
|
@@ -19,11 +19,10 @@ export type CanvasBg = 'dots' | 'plain' | 'light' | 'dark'
|
|
|
19
19
|
/**
|
|
20
20
|
* Every value {@link CanvasBg} accepts, deprecated ones included.
|
|
21
21
|
*
|
|
22
|
-
* Also the list the canvas toolbar renders.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* value only a decorator can reach still round-trips.
|
|
22
|
+
* Also the list the canvas toolbar renders. The toolbar marks the active
|
|
23
|
+
* background, so a value missing here could not be shown as active. Persisted
|
|
24
|
+
* canvas state is validated against this list too, so a value only a decorator
|
|
25
|
+
* can reach still round-trips.
|
|
27
26
|
*/
|
|
28
27
|
export declare const CANVAS_BGS: readonly CanvasBg[];
|
|
29
28
|
//# sourceMappingURL=canvas-bg.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-bg.type.d.ts","sourceRoot":"","sources":["../../src/shared/canvas-bg.type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GACd,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM;AACR;;;;;;;GAOG;GACD,SAAS,GACT,aAAa,CAAC;AAEpB
|
|
1
|
+
{"version":3,"file":"canvas-bg.type.d.ts","sourceRoot":"","sources":["../../src/shared/canvas-bg.type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GACd,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM;AACR;;;;;;;GAOG;GACD,SAAS,GACT,aAAa,CAAC;AAEpB;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAA0E,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Every value {@link CanvasBg} accepts, deprecated ones included.
|
|
3
3
|
*
|
|
4
|
-
* Also the list the canvas toolbar renders.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* value only a decorator can reach still round-trips.
|
|
4
|
+
* Also the list the canvas toolbar renders. The toolbar marks the active
|
|
5
|
+
* background, so a value missing here could not be shown as active. Persisted
|
|
6
|
+
* canvas state is validated against this list too, so a value only a decorator
|
|
7
|
+
* can reach still round-trips.
|
|
9
8
|
*/
|
|
10
9
|
export const CANVAS_BGS = ['dots', 'plain', 'light', 'dark', 'checker', 'transparent'];
|