ngx-json-render 0.7.2 → 0.7.4
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 +44 -5
- package/fesm2022/ngx-json-render-testing.mjs +20 -2
- package/fesm2022/ngx-json-render-testing.mjs.map +1 -1
- package/fesm2022/ngx-json-render.mjs +5 -0
- package/fesm2022/ngx-json-render.mjs.map +1 -1
- package/package.json +7 -3
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.cjs +55 -0
- package/types/ngx-json-render.d.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-json-render",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Angular renderer for json-render — stream AI-generated JSON specs into real Angular components with signals.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"url": "https://github.com/shteynu/ngx-json-render/issues"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@angular/common": ">=
|
|
26
|
-
"@angular/core": ">=
|
|
25
|
+
"@angular/common": ">=19.0.0",
|
|
26
|
+
"@angular/core": ">=19.0.0",
|
|
27
27
|
"@json-render/core": ">=0.20.0 <0.22.0",
|
|
28
28
|
"zod": "^4.0.0"
|
|
29
29
|
},
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"tslib": "^2.3.0"
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
|
+
"schematics": "./schematics/collection.json",
|
|
35
|
+
"ng-add": {
|
|
36
|
+
"save": "dependencies"
|
|
37
|
+
},
|
|
34
38
|
"module": "fesm2022/ngx-json-render.mjs",
|
|
35
39
|
"typings": "types/ngx-json-render.d.ts",
|
|
36
40
|
"exports": {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Adds ngx-json-render's peer dependencies (@json-render/core and zod) to the workspace.",
|
|
6
|
+
"factory": "./ng-add/index.cjs#ngAdd"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = ngAdd;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
6
|
+
const self = require('../../package.json');
|
|
7
|
+
/** Peers a workspace has to declare itself; `@angular/*` is already there. */
|
|
8
|
+
const PEERS = ['@json-render/core', 'zod'];
|
|
9
|
+
const README = 'https://github.com/shteynu/ngx-json-render/tree/main/projects/ngx-json-render#readme';
|
|
10
|
+
/**
|
|
11
|
+
* `ng add ngx-json-render`: declares the peers the renderer needs, at the
|
|
12
|
+
* ranges its own manifest admits, and leaves any the workspace already has
|
|
13
|
+
* untouched. The CLI installs the package itself; npm would install the peers
|
|
14
|
+
* too, but without a `package.json` entry nothing pins them.
|
|
15
|
+
*/
|
|
16
|
+
function ngAdd() {
|
|
17
|
+
return (tree, context) => {
|
|
18
|
+
const workspace = readManifest(tree);
|
|
19
|
+
warnOnOldAngular(workspace, (message) => context.logger.warn(message));
|
|
20
|
+
const rules = [];
|
|
21
|
+
for (const name of PEERS) {
|
|
22
|
+
if (declares(workspace, name))
|
|
23
|
+
continue;
|
|
24
|
+
const range = self.peerDependencies?.[name];
|
|
25
|
+
if (!range)
|
|
26
|
+
throw new schematics_1.SchematicsException(`ngx-json-render declares no peer range for ${name}.`);
|
|
27
|
+
rules.push((0, utility_1.addDependency)(name, range));
|
|
28
|
+
context.logger.info(`Adding ${name}@${range}`);
|
|
29
|
+
}
|
|
30
|
+
context.logger.info([
|
|
31
|
+
'',
|
|
32
|
+
'ngx-json-render is ready. Next: describe your components in a catalog,',
|
|
33
|
+
`register them, and render a spec with <json-render> — see ${README}`,
|
|
34
|
+
'No components of your own yet? `ng add ngx-json-render-material` adds',
|
|
35
|
+
'28 ready-made Angular Material ones.',
|
|
36
|
+
].join('\n'));
|
|
37
|
+
return (0, schematics_1.chain)(rules);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function readManifest(tree) {
|
|
41
|
+
if (!tree.exists('/package.json')) {
|
|
42
|
+
throw new schematics_1.SchematicsException('No package.json at the workspace root.');
|
|
43
|
+
}
|
|
44
|
+
return tree.readJson('/package.json');
|
|
45
|
+
}
|
|
46
|
+
function declares(manifest, name) {
|
|
47
|
+
return !!(manifest.dependencies?.[name] ?? manifest.devDependencies?.[name]);
|
|
48
|
+
}
|
|
49
|
+
function warnOnOldAngular(manifest, warn) {
|
|
50
|
+
const range = manifest.dependencies?.['@angular/core'];
|
|
51
|
+
const major = range ? Number(/\d+/.exec(range)?.[0]) : NaN;
|
|
52
|
+
if (major < 20) {
|
|
53
|
+
warn(`ngx-json-render needs Angular 20 or newer; this workspace has @angular/core ${range}.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -2,7 +2,7 @@ import * as _json_render_core from '@json-render/core';
|
|
|
2
2
|
import { ResolvedAction, ActionHandler, ActionBinding, SpecIssue, Spec, Catalog, InferCatalogActions, InferActionParams, StateModel, InferCatalogComponents, UIElement, StateStore, ValidationFunction, ComputedFunction, DirectiveDefinition, ActionConfirm, DirectiveRegistry, ValidationResult, ValidationConfig, JsonPatch, FlatElement } from '@json-render/core';
|
|
3
3
|
export { ActionBinding, ActionHandler, JsonPatch, Spec, SpecIssue, StateModel, StateStore, UIElement, VisibilityCondition, autoFixSpec, createStateStore, formatSpecIssues, nestedToFlat, validateSpec } from '@json-render/core';
|
|
4
4
|
import * as _angular_core from '@angular/core';
|
|
5
|
-
import { Signal, Type, InjectionToken } from '@angular/core';
|
|
5
|
+
import { Signal, Type, Injector, InjectionToken } from '@angular/core';
|
|
6
6
|
import * as ngx_json_render from 'ngx-json-render';
|
|
7
7
|
|
|
8
8
|
interface PendingConfirmation {
|
|
@@ -547,7 +547,7 @@ declare class JsonRenderer {
|
|
|
547
547
|
* one token wide instead of a component contract the renderer would have to
|
|
548
548
|
* bind to.
|
|
549
549
|
*/
|
|
550
|
-
protected readonly confirmInjector: _angular_core.Signal<
|
|
550
|
+
protected readonly confirmInjector: _angular_core.Signal<Injector | null>;
|
|
551
551
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonRenderer, never>;
|
|
552
552
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<JsonRenderer, "json-render", never, { "spec": { "alias": "spec"; "required": true; "isSignal": true; }; "registry": { "alias": "registry"; "required": true; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; "validate": { "alias": "validate"; "required": false; "isSignal": true; }; "renderLimits": { "alias": "renderLimits"; "required": false; "isSignal": true; }; "catalog": { "alias": "catalog"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "store": { "alias": "store"; "required": false; "isSignal": true; }; "handlers": { "alias": "handlers"; "required": false; "isSignal": true; }; "onAction": { "alias": "onAction"; "required": false; "isSignal": true; }; "navigate": { "alias": "navigate"; "required": false; "isSignal": true; }; "validationFunctions": { "alias": "validationFunctions"; "required": false; "isSignal": true; }; "functions": { "alias": "functions"; "required": false; "isSignal": true; }; "directives": { "alias": "directives"; "required": false; "isSignal": true; }; }, { "stateChange": "stateChange"; }, never, never, true, never>;
|
|
553
553
|
}
|
|
@@ -689,7 +689,7 @@ declare class JrElement {
|
|
|
689
689
|
*/
|
|
690
690
|
protected readonly refusal: Signal<"cycle" | "depth" | null>;
|
|
691
691
|
private readonly renderCtx;
|
|
692
|
-
protected readonly outletInjector:
|
|
692
|
+
protected readonly outletInjector: Injector;
|
|
693
693
|
constructor();
|
|
694
694
|
/**
|
|
695
695
|
* Resolve this element against the whole current state and warn, once per
|