ngx-json-render 0.6.0 → 0.7.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 +23 -7
- package/fesm2022/ngx-json-render.mjs +189 -29
- package/fesm2022/ngx-json-render.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-json-render.d.ts +32 -9
package/package.json
CHANGED
|
@@ -127,7 +127,8 @@ interface RenderLimits {
|
|
|
127
127
|
* terminate. A tree that recurses into its items is not this.
|
|
128
128
|
* - `too_deep` / `too_many_elements` — a {@link RenderLimits} cap was passed.
|
|
129
129
|
* - `unknown_component` — a `type` the catalog does not define.
|
|
130
|
-
* - `invalid_props` —
|
|
130
|
+
* - `invalid_props` — an element's props fail its component's schema, or the
|
|
131
|
+
* element fails the catalog's spec schema: a missing `children`, say.
|
|
131
132
|
*/
|
|
132
133
|
type SpecCheckIssueCode = SpecIssue['code'] | 'cycle' | 'too_deep' | 'too_many_elements' | 'unknown_component' | 'invalid_props';
|
|
133
134
|
/**
|
|
@@ -154,6 +155,19 @@ interface SpecCatalog {
|
|
|
154
155
|
readonly success: boolean;
|
|
155
156
|
readonly error?: unknown;
|
|
156
157
|
};
|
|
158
|
+
/**
|
|
159
|
+
* The definitions the catalog was created from. Where
|
|
160
|
+
* `data.components[type].props` is a schema — anything with a `safeParse`,
|
|
161
|
+
* as a Zod schema has — each element's props are checked against its own
|
|
162
|
+
* component's. Without it, props are checked only as far as `validate`
|
|
163
|
+
* checks them, which for a catalog of more than one component is not at
|
|
164
|
+
* all.
|
|
165
|
+
*
|
|
166
|
+
* `unknown` rather than that shape, so that a `Catalog` whose generic
|
|
167
|
+
* arguments were left off — and whose `data` is therefore `unknown` — still
|
|
168
|
+
* fits.
|
|
169
|
+
*/
|
|
170
|
+
readonly data?: unknown;
|
|
157
171
|
}
|
|
158
172
|
|
|
159
173
|
/**
|
|
@@ -176,9 +190,10 @@ interface SpecCheckOptions {
|
|
|
176
190
|
readonly limits?: RenderLimits | null;
|
|
177
191
|
/**
|
|
178
192
|
* The catalog the spec was generated for. Given one, the check also reports
|
|
179
|
-
* component types the catalog does not define
|
|
180
|
-
* rejects — the half of "is
|
|
181
|
-
* cannot answer.
|
|
193
|
+
* component types the catalog does not define, elements its spec schema
|
|
194
|
+
* rejects, and props their component's schema rejects — the half of "is
|
|
195
|
+
* this spec renderable" that structure alone cannot answer. A prop written
|
|
196
|
+
* as an expression is not judged: it has no value until render time.
|
|
182
197
|
*/
|
|
183
198
|
readonly catalog?: SpecCatalog | null;
|
|
184
199
|
}
|
|
@@ -477,7 +492,11 @@ declare class JsonRenderer {
|
|
|
477
492
|
/**
|
|
478
493
|
* The catalog the spec was generated for. Given one, `validate` also checks
|
|
479
494
|
* what structure alone cannot: that every `type` is a component the catalog
|
|
480
|
-
* defines,
|
|
495
|
+
* defines, that every element has the shape the catalog's spec schema asks
|
|
496
|
+
* for — a `children` array, even on a leaf — and that its props match its
|
|
497
|
+
* component's schema. A prop written as an expression — `$state`,
|
|
498
|
+
* `$bindState`, `$template`, a directive — has no value until render time,
|
|
499
|
+
* so it is not checked.
|
|
481
500
|
*
|
|
482
501
|
* Only read when `validate` is on, and — like the rest of the check —
|
|
483
502
|
* skipped while `loading`.
|
|
@@ -1141,8 +1160,10 @@ interface UIStreamOptions {
|
|
|
1141
1160
|
renderLimits?: RenderLimits | null;
|
|
1142
1161
|
/**
|
|
1143
1162
|
* The catalog the spec was generated for. Given one, `validate` also checks
|
|
1144
|
-
* every element `type` against the catalog and
|
|
1145
|
-
* schema — the half a structural check cannot see.
|
|
1163
|
+
* every element `type` against the catalog and each element's props against
|
|
1164
|
+
* its component's schema — the half a structural check cannot see. Props
|
|
1165
|
+
* written as expressions are left alone: they have no value until render
|
|
1166
|
+
* time.
|
|
1146
1167
|
*/
|
|
1147
1168
|
catalog?: SpecCatalog | null;
|
|
1148
1169
|
/**
|
|
@@ -1252,8 +1273,10 @@ interface ChatUIOptions {
|
|
|
1252
1273
|
renderLimits?: RenderLimits | null;
|
|
1253
1274
|
/**
|
|
1254
1275
|
* The catalog the spec was generated for. Given one, `validate` also checks
|
|
1255
|
-
* every element `type` against the catalog and
|
|
1256
|
-
* schema — the half a structural check cannot see.
|
|
1276
|
+
* every element `type` against the catalog and each element's props against
|
|
1277
|
+
* its component's schema — the half a structural check cannot see. Props
|
|
1278
|
+
* written as expressions are left alone: they have no value until render
|
|
1279
|
+
* time.
|
|
1257
1280
|
*/
|
|
1258
1281
|
catalog?: SpecCatalog | null;
|
|
1259
1282
|
}
|