@ng-prism/core 22.0.0 → 22.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +1 -1
- package/dist/builder/scanner/component.scanner.js +2 -4
- package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.js +49 -16
- package/dist/schematics/migrations/v21-13-manifest-cache/index.d.ts.map +1 -1
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.d.ts.map +1 -1
- package/dist/schematics/ng-add/index.js +1 -1
- package/dist/shared/canvas-layout.type.d.ts.map +1 -1
- package/dist/shared/canvas-layout.type.js +4 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-renderer.component.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/prism-renderer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAER,KAAK,IAAI,EAIV,MAAM,eAAe,CAAC;AAYvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAGjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;;AAIhF,qBA8Ia,sBAAsB;IACjC,SAAS,CAAC,QAAQ,CAAC,IAAI,OAAQ;IAC/B,SAAS,CAAC,QAAQ,CAAC,iBAAiB,yBAAkC;IACtE,SAAS,CAAC,QAAQ,CAAC,eAAe,uBAAgC;IAClE,SAAS,CAAC,QAAQ,CAAC,aAAa,qBAA8B;IAC9D,SAAS,CAAC,QAAQ,CAAC,SAAS,wBAAiC;IAC7D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,eAAe,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A8B;IAC9D,SAAS,CAAC,QAAQ,CAAC,SAAS,wBAAiC;IAC7D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmC;IACxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE3B;IAEH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;IAE5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAEpB;IACH,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,mBAAmB,CAAsC;IACjE,OAAO,CAAC,oBAAoB,CAChB;IACZ,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoC;IACjE,QAAQ,CAAC,aAAa,+DAAsC;IAC5D,wFAAwF;IACxF,SAAS,CAAC,QAAQ,CAAC,WAAW,gDAQ3B;IACH,6GAA6G;IAC7G,SAAS,CAAC,QAAQ,CAAC,YAAY,4FAU5B;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa;;MAA6C;IAC7E,SAAS,CAAC,QAAQ,CAAC,eAAe,yFAG/B;;IA0FH,OAAO,CAAC,eAAe;IA6FvB,OAAO,CAAC,OAAO;yCA9OJ,sBAAsB;2CAAtB,sBAAsB;CA4PlC"}
|
|
@@ -66,7 +66,7 @@ export class PrismRendererComponent {
|
|
|
66
66
|
if (!comp)
|
|
67
67
|
return 'fit';
|
|
68
68
|
const variant = comp.meta.showcaseConfig.variants?.[this.rendererService.activeVariantIndex()];
|
|
69
|
-
return variant?.canvasLayout ?? comp.meta.showcaseConfig.canvasLayout ?? 'fit';
|
|
69
|
+
return (variant?.canvasLayout ?? comp.meta.showcaseConfig.canvasLayout ?? 'fit');
|
|
70
70
|
}, /* @ts-ignore */
|
|
71
71
|
...(ngDevMode ? [{ debugName: "canvasLayout" }] : /* istanbul ignore next */ []));
|
|
72
72
|
overlayInputs = { rendererService: this.rendererService };
|
|
@@ -99,8 +99,7 @@ function extractShowcaseConfig(decorator, className) {
|
|
|
99
99
|
config.status = obj['status'];
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
|
-
console.warn(`⚠ ng-prism: ${className} declares invalid status "${String(obj['status'])}" — ` +
|
|
103
|
-
`expected one of: ${COMPONENT_STATUSES.join(', ')}. Skipping.`);
|
|
102
|
+
console.warn(`⚠ ng-prism: ${className} declares invalid status "${String(obj['status'])}" — ` + `expected one of: ${COMPONENT_STATUSES.join(', ')}. Skipping.`);
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
if (obj['bg'] !== undefined) {
|
|
@@ -117,8 +116,7 @@ function extractShowcaseConfig(decorator, className) {
|
|
|
117
116
|
config.canvasLayout = obj['canvasLayout'];
|
|
118
117
|
}
|
|
119
118
|
else {
|
|
120
|
-
console.warn(`⚠ ng-prism: ${className} declares invalid canvasLayout "${String(obj['canvasLayout'])}" — ` +
|
|
121
|
-
`expected one of: ${CANVAS_LAYOUTS.join(', ')}. Skipping.`);
|
|
119
|
+
console.warn(`⚠ ng-prism: ${className} declares invalid canvasLayout "${String(obj['canvasLayout'])}" — ` + `expected one of: ${CANVAS_LAYOUTS.join(', ')}. Skipping.`);
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
if (Array.isArray(obj['variants'])) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.extractor.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/input.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"input.extractor.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/input.extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAQ1E;;GAEG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAC9B,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,SAAS,EAAE,CA4Db;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAC9B,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,UAAU,EAAE,CA0Bd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { evaluateExpression, findDecorator, getDecoratorArgument, getJsDocComment } from './ast-utils.js';
|
|
2
|
+
import { evaluateExpression, findDecorator, getDecoratorArgument, getJsDocComment, } from './ast-utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* Extract all @Input(), input() and model() signal metadata from a class declaration.
|
|
5
5
|
*/
|
|
@@ -8,16 +8,28 @@ export function extractInputs(classDecl, checker) {
|
|
|
8
8
|
for (const member of classDecl.members) {
|
|
9
9
|
if (!ts.isPropertyDeclaration(member))
|
|
10
10
|
continue;
|
|
11
|
-
const name = member.name && ts.isIdentifier(member.name)
|
|
11
|
+
const name = member.name && ts.isIdentifier(member.name)
|
|
12
|
+
? member.name.text
|
|
13
|
+
: undefined;
|
|
12
14
|
if (!name)
|
|
13
15
|
continue;
|
|
14
16
|
const inputDecorator = findDecorator(member, 'Input');
|
|
15
17
|
if (inputDecorator) {
|
|
16
18
|
const required = isDecoratorInputRequired(inputDecorator);
|
|
17
|
-
const defaultValue = member.initializer
|
|
19
|
+
const defaultValue = member.initializer
|
|
20
|
+
? evaluateExpression(member.initializer)
|
|
21
|
+
: undefined;
|
|
18
22
|
const doc = getJsDocComment(member, checker);
|
|
19
23
|
const { type, values, rawType } = resolveDecoratorInputType(member, checker);
|
|
20
|
-
inputs.push({
|
|
24
|
+
inputs.push({
|
|
25
|
+
name,
|
|
26
|
+
type,
|
|
27
|
+
rawType,
|
|
28
|
+
required,
|
|
29
|
+
...(values && { values }),
|
|
30
|
+
...(defaultValue !== undefined && { defaultValue }),
|
|
31
|
+
...(doc && { doc }),
|
|
32
|
+
});
|
|
21
33
|
continue;
|
|
22
34
|
}
|
|
23
35
|
const signalCall = getInputSignalCall(member);
|
|
@@ -28,7 +40,15 @@ export function extractInputs(classDecl, checker) {
|
|
|
28
40
|
: undefined;
|
|
29
41
|
const doc = getJsDocComment(member, checker);
|
|
30
42
|
const { type, values, rawType } = resolveSignalInputType(signalCall, checker);
|
|
31
|
-
inputs.push({
|
|
43
|
+
inputs.push({
|
|
44
|
+
name,
|
|
45
|
+
type,
|
|
46
|
+
rawType,
|
|
47
|
+
required,
|
|
48
|
+
...(values && { values }),
|
|
49
|
+
...(defaultValue !== undefined && { defaultValue }),
|
|
50
|
+
...(doc && { doc }),
|
|
51
|
+
});
|
|
32
52
|
}
|
|
33
53
|
}
|
|
34
54
|
return inputs;
|
|
@@ -41,7 +61,9 @@ export function extractOutputs(classDecl, checker) {
|
|
|
41
61
|
for (const member of classDecl.members) {
|
|
42
62
|
if (!ts.isPropertyDeclaration(member))
|
|
43
63
|
continue;
|
|
44
|
-
const name = member.name && ts.isIdentifier(member.name)
|
|
64
|
+
const name = member.name && ts.isIdentifier(member.name)
|
|
65
|
+
? member.name.text
|
|
66
|
+
: undefined;
|
|
45
67
|
if (!name)
|
|
46
68
|
continue;
|
|
47
69
|
const outputDecorator = findDecorator(member, 'Output');
|
|
@@ -65,8 +87,10 @@ function getInputSignalCall(member) {
|
|
|
65
87
|
if (ts.isIdentifier(expr) && (expr.text === 'input' || expr.text === 'model'))
|
|
66
88
|
return init;
|
|
67
89
|
if (ts.isPropertyAccessExpression(expr) &&
|
|
68
|
-
ts.isIdentifier(expr.expression) &&
|
|
69
|
-
|
|
90
|
+
ts.isIdentifier(expr.expression) &&
|
|
91
|
+
(expr.expression.text === 'input' || expr.expression.text === 'model') &&
|
|
92
|
+
ts.isIdentifier(expr.name) &&
|
|
93
|
+
expr.name.text === 'required') {
|
|
70
94
|
return init;
|
|
71
95
|
}
|
|
72
96
|
return null;
|
|
@@ -86,8 +110,9 @@ function isOutputSignal(member) {
|
|
|
86
110
|
}
|
|
87
111
|
function resolveSignalInputType(callExpr, checker) {
|
|
88
112
|
if (callExpr.typeArguments && callExpr.typeArguments.length > 0) {
|
|
89
|
-
const
|
|
90
|
-
|
|
113
|
+
const typeNode = callExpr.typeArguments[0];
|
|
114
|
+
const resolved = checker.getTypeFromTypeNode(typeNode);
|
|
115
|
+
return mapType(resolved, checker, normalizeTypeText(typeNode.getText()));
|
|
91
116
|
}
|
|
92
117
|
if (callExpr.arguments.length > 0) {
|
|
93
118
|
const argType = checker.getTypeAtLocation(callExpr.arguments[0]);
|
|
@@ -110,10 +135,19 @@ function isDecoratorInputRequired(decorator) {
|
|
|
110
135
|
}
|
|
111
136
|
function resolveDecoratorInputType(member, checker) {
|
|
112
137
|
const tsType = checker.getTypeAtLocation(member);
|
|
113
|
-
|
|
138
|
+
const declaredText = member.type
|
|
139
|
+
? normalizeTypeText(member.type.getText())
|
|
140
|
+
: undefined;
|
|
141
|
+
return mapType(tsType, checker, declaredText);
|
|
142
|
+
}
|
|
143
|
+
function normalizeTypeText(text) {
|
|
144
|
+
return text.replace(/\s+/g, ' ').trim();
|
|
114
145
|
}
|
|
115
146
|
function getRawTypeLabel(tsType, checker) {
|
|
116
|
-
if (tsType.flags &
|
|
147
|
+
if (tsType.flags &
|
|
148
|
+
(ts.TypeFlags.Boolean |
|
|
149
|
+
ts.TypeFlags.BooleanLike |
|
|
150
|
+
ts.TypeFlags.BooleanLiteral)) {
|
|
117
151
|
return 'boolean';
|
|
118
152
|
}
|
|
119
153
|
if (tsType.isUnion()) {
|
|
@@ -130,8 +164,8 @@ function getRawTypeLabel(tsType, checker) {
|
|
|
130
164
|
}
|
|
131
165
|
return checker.typeToString(tsType);
|
|
132
166
|
}
|
|
133
|
-
function mapType(tsType, checker) {
|
|
134
|
-
const rawType = getRawTypeLabel(tsType, checker);
|
|
167
|
+
function mapType(tsType, checker, rawTypeOverride) {
|
|
168
|
+
const rawType = rawTypeOverride ?? getRawTypeLabel(tsType, checker);
|
|
135
169
|
if (tsType.flags & ts.TypeFlags.BooleanLike) {
|
|
136
170
|
return { type: 'boolean', rawType };
|
|
137
171
|
}
|
|
@@ -139,8 +173,7 @@ function mapType(tsType, checker) {
|
|
|
139
173
|
return { type: 'boolean', rawType };
|
|
140
174
|
}
|
|
141
175
|
if (tsType.isUnion()) {
|
|
142
|
-
const filtered = tsType.types.filter((t) => !(t.flags & ts.TypeFlags.Undefined) &&
|
|
143
|
-
!(t.flags & ts.TypeFlags.Null));
|
|
176
|
+
const filtered = tsType.types.filter((t) => !(t.flags & ts.TypeFlags.Undefined) && !(t.flags & ts.TypeFlags.Null));
|
|
144
177
|
if (filtered.every((t) => t.flags & ts.TypeFlags.BooleanLiteral)) {
|
|
145
178
|
return { type: 'boolean', rawType };
|
|
146
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v21-13-manifest-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v21-13-manifest-cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAgM/E,wBAAgB,OAAO,IAAI,IAAI,CAiB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v22-0-cache-dir-rename/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/schematics/migrations/v22-0-cache-dir-rename/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAgJ/E,wBAAgB,OAAO,IAAI,IAAI,CAsB9B"}
|
|
@@ -22,7 +22,7 @@ function addPrismAppProject(options) {
|
|
|
22
22
|
const prismRoot = `projects/${prismProjectName}`;
|
|
23
23
|
const prismSrc = `${prismRoot}/src`;
|
|
24
24
|
const zoneless = options.zoneless === true;
|
|
25
|
-
const hotConst =
|
|
25
|
+
const hotConst = 'const hot = (import.meta as ImportMeta & { hot?: { accept(dep: string, cb: (mod: { PRISM_RUNTIME_MANIFEST: typeof PRISM_RUNTIME_MANIFEST } | undefined) => void): void } }).hot;';
|
|
26
26
|
const hmrThen = [
|
|
27
27
|
'.then((appRef) => {',
|
|
28
28
|
` hot?.accept('prism-manifest/${prismProjectName}', (mod) => {`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-layout.type.d.ts","sourceRoot":"","sources":["../../src/shared/canvas-layout.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"canvas-layout.type.d.ts","sourceRoot":"","sources":["../../src/shared/canvas-layout.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAE7C,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAGxC,CAAC"}
|
package/package.json
CHANGED