@ng-prism/core 21.12.0 → 23.0.0-beta.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/README.md +10 -13
- package/dist/app/canvas/prism-canvas-bg-pill.component.js +1 -1
- package/dist/app/canvas/prism-canvas-rulers.component.js +5 -3
- package/dist/app/canvas/prism-canvas-toolbar.component.js +1 -1
- package/dist/app/canvas/prism-template-popover.component.js +7 -4
- package/dist/app/component-head/prism-component-head.component.js +20 -11
- package/dist/app/component-head/prism-stat.component.js +9 -5
- package/dist/app/component-header/prism-component-header.component.js +1 -1
- package/dist/app/controls/boolean-control.component.js +7 -4
- package/dist/app/controls/json-control.component.js +19 -10
- package/dist/app/controls/number-control.component.js +7 -4
- package/dist/app/controls/string-control.component.js +7 -4
- package/dist/app/controls/union-control.component.js +9 -5
- package/dist/app/directives/prism-resizer.directive.js +8 -4
- package/dist/app/header/prism-header-widget-host.component.js +5 -3
- package/dist/app/header/prism-header.component.js +13 -7
- package/dist/app/icons/prism-icon.component.js +5 -3
- package/dist/app/layout-menu/prism-layout-menu.component.js +2 -1
- package/dist/app/page-renderer/prism-page-renderer.component.d.ts.map +1 -1
- package/dist/app/page-renderer/prism-page-renderer.component.js +13 -16
- package/dist/app/panels/a11y/a11y-audit.service.js +8 -4
- package/dist/app/panels/a11y/a11y-header-badge.component.js +3 -2
- package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +3 -2
- package/dist/app/panels/a11y/a11y-keyboard.component.js +3 -2
- package/dist/app/panels/a11y/a11y-overlay-host.component.js +11 -6
- package/dist/app/panels/a11y/a11y-panel-state.service.js +2 -1
- package/dist/app/panels/a11y/a11y-panel.component.js +7 -4
- package/dist/app/panels/a11y/a11y-perspective.service.js +2 -1
- package/dist/app/panels/a11y/a11y-score.component.js +7 -4
- package/dist/app/panels/a11y/a11y-sr-overlay.component.js +5 -3
- package/dist/app/panels/a11y/a11y-sr.component.js +3 -2
- package/dist/app/panels/a11y/a11y-tree.component.js +14 -8
- package/dist/app/panels/a11y/a11y-violations.component.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-violations.component.js +9 -11
- package/dist/app/panels/controls/prism-controls-panel.component.js +3 -2
- package/dist/app/panels/events/prism-events-panel.component.js +3 -2
- package/dist/app/panels/events/prism-json-node.component.js +14 -7
- package/dist/app/panels/panel-host/prism-panel-host.component.js +15 -8
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +9 -6
- package/dist/app/services/prism-canvas.service.js +8 -4
- package/dist/app/services/prism-event-log.service.js +2 -1
- package/dist/app/services/prism-layout.service.js +16 -8
- package/dist/app/services/prism-manifest.service.js +10 -5
- package/dist/app/services/prism-navigation.service.js +8 -4
- package/dist/app/services/prism-panel.service.js +6 -3
- package/dist/app/services/prism-plugin.service.js +14 -7
- package/dist/app/services/prism-renderer.service.js +10 -5
- package/dist/app/services/prism-search.service.js +6 -3
- package/dist/app/services/prism-theme.service.js +4 -2
- package/dist/app/services/prism-variant-bg.service.js +8 -4
- package/dist/app/shell/prism-shell.component.js +7 -4
- package/dist/app/sidebar/prism-sidebar.component.js +15 -8
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +7 -4
- package/dist/app/view-tab-bar/prism-view-panel-host.component.js +8 -4
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +2 -1
- package/dist/builder/build/index.d.ts.map +1 -1
- package/dist/builder/build/index.js +11 -4
- package/dist/builder/build/schema.d.ts +1 -0
- package/dist/builder/build/schema.d.ts.map +1 -1
- package/dist/builder/serve/index.d.ts.map +1 -1
- package/dist/builder/serve/index.js +21 -6
- package/dist/builder/serve/schema.d.ts +1 -0
- package/dist/builder/serve/schema.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.d.ts +2 -0
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +3 -5
- package/dist/builder/shared/resolve-cache-dir.d.ts +8 -0
- package/dist/builder/shared/resolve-cache-dir.d.ts.map +1 -0
- package/dist/builder/shared/resolve-cache-dir.js +12 -0
- package/dist/schematics/migrations/v21-13-manifest-cache/index.d.ts +3 -0
- package/dist/schematics/migrations/v21-13-manifest-cache/index.d.ts.map +1 -0
- package/dist/schematics/migrations/v21-13-manifest-cache/index.js +103 -0
- package/dist/schematics/ng-add/index.d.ts.map +1 -1
- package/dist/schematics/ng-add/index.js +31 -44
- package/dist/schematics/utils/index.d.ts +1 -0
- package/dist/schematics/utils/index.d.ts.map +1 -1
- package/dist/schematics/utils/index.js +1 -0
- package/dist/schematics/utils/tsconfig-paths.d.ts +8 -0
- package/dist/schematics/utils/tsconfig-paths.d.ts.map +1 -0
- package/dist/schematics/utils/tsconfig-paths.js +20 -0
- package/package.json +9 -6
- package/schematics/migrations.json +10 -0
- package/src/builder/build/schema.json +4 -0
- package/src/builder/serve/schema.json +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { chain, SchematicsException, } from '@angular-devkit/schematics';
|
|
2
2
|
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
|
3
|
-
import {
|
|
3
|
+
import { addTsConfigPath } from '../utils/tsconfig-paths.js';
|
|
4
4
|
function readWorkspace(tree) {
|
|
5
5
|
const buffer = tree.read('angular.json');
|
|
6
6
|
if (!buffer) {
|
|
@@ -27,7 +27,7 @@ function addPrismAppProject(options) {
|
|
|
27
27
|
"import { provideZonelessChangeDetection } from '@angular/core';",
|
|
28
28
|
"import { bootstrapApplication } from '@angular/platform-browser';",
|
|
29
29
|
"import { PrismShellComponent, providePrism } from '@ng-prism/core';",
|
|
30
|
-
|
|
30
|
+
`import { PRISM_RUNTIME_MANIFEST } from 'prism-manifest/${prismProjectName}';`,
|
|
31
31
|
"import config from 'ng-prism.config';",
|
|
32
32
|
'',
|
|
33
33
|
'bootstrapApplication(PrismShellComponent, {',
|
|
@@ -41,7 +41,7 @@ function addPrismAppProject(options) {
|
|
|
41
41
|
: [
|
|
42
42
|
"import { bootstrapApplication } from '@angular/platform-browser';",
|
|
43
43
|
"import { PrismShellComponent, providePrism } from '@ng-prism/core';",
|
|
44
|
-
|
|
44
|
+
`import { PRISM_RUNTIME_MANIFEST } from 'prism-manifest/${prismProjectName}';`,
|
|
45
45
|
"import config from 'ng-prism.config';",
|
|
46
46
|
'',
|
|
47
47
|
'bootstrapApplication(PrismShellComponent, {',
|
|
@@ -180,32 +180,20 @@ function addBuilderTargets(options) {
|
|
|
180
180
|
function addTsConfigPaths(options) {
|
|
181
181
|
return (tree, _context) => {
|
|
182
182
|
const tsConfigPath = 'tsconfig.json';
|
|
183
|
-
|
|
184
|
-
if (!buffer) {
|
|
183
|
+
if (!tree.read(tsConfigPath))
|
|
185
184
|
return tree;
|
|
186
|
-
}
|
|
187
|
-
const sourceText = buffer.toString('utf-8');
|
|
188
|
-
const tsConfig = parseJsonc(sourceText);
|
|
189
|
-
const existingPaths = tsConfig.compilerOptions?.paths ?? {};
|
|
190
185
|
const workspace = readWorkspace(tree);
|
|
191
186
|
const project = workspace.projects[options.project];
|
|
192
187
|
const sourceRoot = project.sourceRoot ?? `${project.root}/src`;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const edits = modifyJsonc(nextText, ['compilerOptions', 'paths', options.project], [`${sourceRoot}/public-api.ts`], { formattingOptions });
|
|
203
|
-
nextText = applyJsoncEdits(nextText, edits);
|
|
204
|
-
changed = true;
|
|
205
|
-
}
|
|
206
|
-
if (changed) {
|
|
207
|
-
tree.overwrite(tsConfigPath, nextText);
|
|
208
|
-
}
|
|
188
|
+
addTsConfigPath(tree, tsConfigPath, 'ng-prism.config', [
|
|
189
|
+
'ng-prism.config.ts',
|
|
190
|
+
]);
|
|
191
|
+
addTsConfigPath(tree, tsConfigPath, options.project, [
|
|
192
|
+
`${sourceRoot}/public-api.ts`,
|
|
193
|
+
]);
|
|
194
|
+
addTsConfigPath(tree, tsConfigPath, 'prism-manifest/*', [
|
|
195
|
+
'.ng-prism/*/prism-manifest.ts',
|
|
196
|
+
]);
|
|
209
197
|
return tree;
|
|
210
198
|
};
|
|
211
199
|
}
|
|
@@ -225,24 +213,6 @@ function createConfigFile() {
|
|
|
225
213
|
return tree;
|
|
226
214
|
};
|
|
227
215
|
}
|
|
228
|
-
function addGitignoreEntry(options) {
|
|
229
|
-
return (tree) => {
|
|
230
|
-
const prismProjectName = `${options.project}-prism`;
|
|
231
|
-
const entry = `projects/${prismProjectName}/src/prism-manifest.ts`;
|
|
232
|
-
const gitignorePath = '.gitignore';
|
|
233
|
-
const buffer = tree.read(gitignorePath);
|
|
234
|
-
if (buffer) {
|
|
235
|
-
const content = buffer.toString('utf-8');
|
|
236
|
-
if (content.includes(entry))
|
|
237
|
-
return tree;
|
|
238
|
-
tree.overwrite(gitignorePath, content.trimEnd() + '\n' + entry + '\n');
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
tree.create(gitignorePath, entry + '\n');
|
|
242
|
-
}
|
|
243
|
-
return tree;
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
216
|
const RUNTIME_PEER_DEPS = {
|
|
247
217
|
'highlight.js': '^11.0.0',
|
|
248
218
|
'ngx-highlightjs': '^14.0.0',
|
|
@@ -284,6 +254,23 @@ function logSetupSummary(options) {
|
|
|
284
254
|
context.logger.info('');
|
|
285
255
|
};
|
|
286
256
|
}
|
|
257
|
+
function addNgPrismGitignoreEntry() {
|
|
258
|
+
return (tree) => {
|
|
259
|
+
const entry = '.ng-prism/';
|
|
260
|
+
const gitignorePath = '.gitignore';
|
|
261
|
+
const buffer = tree.read(gitignorePath);
|
|
262
|
+
if (buffer) {
|
|
263
|
+
const content = buffer.toString('utf-8');
|
|
264
|
+
if (content.split('\n').some((line) => line.trim() === entry))
|
|
265
|
+
return tree;
|
|
266
|
+
tree.overwrite(gitignorePath, content.trimEnd() + '\n' + entry + '\n');
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
tree.create(gitignorePath, entry + '\n');
|
|
270
|
+
}
|
|
271
|
+
return tree;
|
|
272
|
+
};
|
|
273
|
+
}
|
|
287
274
|
function addStripShowcaseScript(options) {
|
|
288
275
|
return (tree) => {
|
|
289
276
|
const pkgPath = 'package.json';
|
|
@@ -306,9 +293,9 @@ export function ngAdd(options) {
|
|
|
306
293
|
addPrismAppProject(options),
|
|
307
294
|
addBuilderTargets(options),
|
|
308
295
|
addTsConfigPaths(options),
|
|
296
|
+
addNgPrismGitignoreEntry(),
|
|
309
297
|
createConfigFile(),
|
|
310
298
|
addStripShowcaseScript(options),
|
|
311
|
-
addGitignoreEntry(options),
|
|
312
299
|
addRuntimePeerDeps(),
|
|
313
300
|
logSetupSummary(options),
|
|
314
301
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schematics/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Adds `compilerOptions.paths[<key>] = <value>` to a tsconfig.json (JSONC-safe).
|
|
4
|
+
* Idempotent: does not overwrite an existing entry.
|
|
5
|
+
* Returns true when an entry was added, false otherwise (already present or file missing).
|
|
6
|
+
*/
|
|
7
|
+
export declare function addTsConfigPath(tree: Tree, tsConfigPath: string, key: string, value: string[]): boolean;
|
|
8
|
+
//# sourceMappingURL=tsconfig-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../../../src/schematics/utils/tsconfig-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAevD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAkBT"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parse as parseJsonc, modify as modifyJsonc, applyEdits as applyJsoncEdits, } from 'jsonc-parser';
|
|
2
|
+
/**
|
|
3
|
+
* Adds `compilerOptions.paths[<key>] = <value>` to a tsconfig.json (JSONC-safe).
|
|
4
|
+
* Idempotent: does not overwrite an existing entry.
|
|
5
|
+
* Returns true when an entry was added, false otherwise (already present or file missing).
|
|
6
|
+
*/
|
|
7
|
+
export function addTsConfigPath(tree, tsConfigPath, key, value) {
|
|
8
|
+
const buffer = tree.read(tsConfigPath);
|
|
9
|
+
if (!buffer)
|
|
10
|
+
return false;
|
|
11
|
+
const sourceText = buffer.toString('utf-8');
|
|
12
|
+
const parsed = parseJsonc(sourceText);
|
|
13
|
+
const existing = parsed.compilerOptions?.paths ?? {};
|
|
14
|
+
if (existing[key])
|
|
15
|
+
return false;
|
|
16
|
+
const edits = modifyJsonc(sourceText, ['compilerOptions', 'paths', key], value, { formattingOptions: { tabSize: 2, insertSpaces: true } });
|
|
17
|
+
const nextText = applyJsoncEdits(sourceText, edits);
|
|
18
|
+
tree.overwrite(tsConfigPath, nextText);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-prism/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-beta.0",
|
|
4
4
|
"description": "ng-prism — the Angular-native Storybook alternative. Lightweight component showcase with @Showcase decorator, no story files needed.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ng-prism",
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
"ng-add": {
|
|
61
61
|
"save": "devDependencies"
|
|
62
62
|
},
|
|
63
|
+
"ng-update": {
|
|
64
|
+
"migrations": "./schematics/migrations.json"
|
|
65
|
+
},
|
|
63
66
|
"schematics": "./schematics/collection.json",
|
|
64
67
|
"builders": "./builders.json",
|
|
65
68
|
"files": [
|
|
@@ -71,11 +74,11 @@
|
|
|
71
74
|
"!**/*.tsbuildinfo"
|
|
72
75
|
],
|
|
73
76
|
"peerDependencies": {
|
|
74
|
-
"@angular/core": ">=
|
|
75
|
-
"@angular/common": ">=
|
|
76
|
-
"@angular-devkit/architect": ">=0.
|
|
77
|
-
"@angular-devkit/core": ">=
|
|
78
|
-
"@angular-devkit/schematics": ">=
|
|
77
|
+
"@angular/core": ">=20.0.0",
|
|
78
|
+
"@angular/common": ">=20.0.0",
|
|
79
|
+
"@angular-devkit/architect": ">=0.2000.0",
|
|
80
|
+
"@angular-devkit/core": ">=20.0.0",
|
|
81
|
+
"@angular-devkit/schematics": ">=20.0.0",
|
|
79
82
|
"typescript": ">=5.5.0",
|
|
80
83
|
"highlight.js": ">=11.0.0",
|
|
81
84
|
"ngx-highlightjs": ">=14.0.0"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"migration-v22-manifest-cache": {
|
|
5
|
+
"version": "22.0.0",
|
|
6
|
+
"description": "Move generated prism-manifest.ts into <workspaceRoot>/.ng-prism/<prismProject>/ and resolve it via a wildcard tsconfig path mapping.",
|
|
7
|
+
"factory": "../dist/schematics/migrations/v21-13-manifest-cache/index#migrate"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"type": "string",
|
|
29
29
|
"default": "ng-prism.config.ts",
|
|
30
30
|
"description": "Path to the ng-prism config file"
|
|
31
|
+
},
|
|
32
|
+
"cacheDir": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Override directory for the generated prism-manifest.ts. Default: <workspaceRoot>/.ng-prism/<prismProject>/. Relative paths resolve against workspaceRoot."
|
|
31
35
|
}
|
|
32
36
|
},
|
|
33
37
|
"required": ["entryPoint", "prismProject"],
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"type": "string",
|
|
30
30
|
"default": "ng-prism.config.ts",
|
|
31
31
|
"description": "Path to the ng-prism config file"
|
|
32
|
+
},
|
|
33
|
+
"cacheDir": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Override directory for the generated prism-manifest.ts. Default: <workspaceRoot>/.ng-prism/<prismProject>/. Relative paths resolve against workspaceRoot."
|
|
32
36
|
}
|
|
33
37
|
},
|
|
34
38
|
"required": ["entryPoint", "prismProject"],
|