@reformer/renderer-json 9.0.0-beta.1 → 9.0.0-beta.2
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/{index-Bu5XPCQ7.js → index-DrpWfdbU.js} +24 -14
- package/dist/index.d.ts +11 -4
- package/dist/index.js +541 -162
- package/dist/locale/i18n.d.ts +21 -0
- package/dist/locale/locale-context.d.ts +36 -0
- package/dist/locale/locale-service.d.ts +76 -0
- package/dist/locale/locale-service.test.d.ts +1 -0
- package/dist/locale/use-signal-value.d.ts +15 -0
- package/dist/locale/use-signal-value.test.d.ts +1 -0
- package/dist/operators.d.ts +37 -3
- package/dist/operators.test.d.ts +1 -0
- package/dist/registry/component-registry.d.ts +2 -0
- package/dist/registry/component-registry.test.d.ts +1 -0
- package/dist/registry/constants.d.ts +17 -0
- package/dist/registry/types.d.ts +24 -3
- package/dist/schema/index.d.ts +18 -0
- package/dist/validate.d.ts +5 -1
- package/dist/validate.js +1156 -1155
- package/llms.txt +663 -12
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const s = /^\$(model|component|dataSource)\((.+)\)$/;
|
|
2
|
-
function
|
|
1
|
+
const s = /^\$(model|component|dataSource|fn|locale)\((.+)\)$/;
|
|
2
|
+
function o(e) {
|
|
3
3
|
if (typeof e != "string") return null;
|
|
4
4
|
const t = s.exec(e);
|
|
5
5
|
return t ? { op: t[1], arg: t[2] } : null;
|
|
6
6
|
}
|
|
7
|
-
const $ = (e) =>
|
|
7
|
+
const $ = (e) => o(e)?.op === "model", g = (e) => o(e)?.op === "component", b = (e) => o(e)?.op === "dataSource", S = (e) => o(e)?.op === "fn", O = (e) => o(e)?.op === "locale", p = "http://json-schema.org/draft-07/schema#", c = "https://reformer.dev/schemas/form-schema.schema.json", m = "ReFormer JSON form schema (M1, string-operator DSL)", d = "Base meta-schema: validates node structure + operator string syntax ($model/$component/$dataSource). Component-name enum is tightened per-app via buildFormSchemaMetaSchema; $dataSource names and $model paths are checked outside this schema.", l = "object", f = ["root"], u = !1, h = { $schema: { type: "string" }, version: { type: "string" }, root: { $ref: "#/definitions/node" } }, y = { modelOp: { type: "string", pattern: "^\\$model\\(.+\\)$", description: 'Model binding: "$model(path)" — path resolved at runtime (not validated here).' }, componentOp: { type: "string", pattern: "^\\$component\\(.+\\)$", description: 'Registry component: "$component(Name)". Name is tightened to a registry enum by buildFormSchemaMetaSchema.' }, node: { $comment: "Discriminated by which operator key is present (array→value→component), mirroring the isArrayNode/isFieldNode/isContainerNode runtime guards. Using oneOf here made ajv (allErrors) report failures against all three branches for any single mistake, burying the real cause; if/then/else surfaces only the relevant branch's errors.", if: { type: "object", required: ["array"] }, then: { $ref: "#/definitions/arrayNode" }, else: { if: { type: "object", required: ["value"] }, then: { $ref: "#/definitions/fieldNode" }, else: { $ref: "#/definitions/containerNode" } } }, fieldNode: { type: "object", required: ["value"], additionalProperties: !1, properties: { selector: { type: "string" }, value: { $ref: "#/definitions/modelOp" }, component: { $ref: "#/definitions/componentOp" }, componentProps: { type: "object" }, wrapper: { $ref: "#/definitions/node" } } }, arrayNode: { type: "object", required: ["array", "item"], additionalProperties: !1, properties: { selector: { type: "string" }, array: { $ref: "#/definitions/modelOp" }, item: { type: "object", required: ["$template"], additionalProperties: !1, properties: { $template: { $ref: "#/definitions/node" } } }, initialValue: { type: "object" }, componentProps: { type: "object" } } }, containerNode: { type: "object", required: ["component"], additionalProperties: !1, properties: { selector: { type: "string" }, component: { $ref: "#/definitions/componentOp" }, componentProps: { type: "object" }, children: { type: "array", items: { $ref: "#/definitions/node" } } } } }, a = {
|
|
8
8
|
$schema: p,
|
|
9
9
|
$id: c,
|
|
10
10
|
title: m,
|
|
@@ -14,28 +14,38 @@ const $ = (e) => n(e)?.op === "model", g = (e) => n(e)?.op === "component", b =
|
|
|
14
14
|
additionalProperties: u,
|
|
15
15
|
properties: h,
|
|
16
16
|
definitions: y
|
|
17
|
-
},
|
|
18
|
-
function
|
|
17
|
+
}, N = a;
|
|
18
|
+
function j(e) {
|
|
19
19
|
return e.names().filter((t) => e.get(t)?.type === "component");
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function v(e) {
|
|
22
22
|
return e.names().filter((t) => e.get(t)?.type === "dataSource");
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
function P(e) {
|
|
25
|
+
return e.names().filter((t) => e.get(t)?.type === "fn");
|
|
26
|
+
}
|
|
27
|
+
function q(e) {
|
|
28
|
+
return e.getLocale?.()?.keys;
|
|
29
|
+
}
|
|
30
|
+
function F(e) {
|
|
31
|
+
const t = JSON.parse(JSON.stringify(a)), n = e?.componentNames;
|
|
32
|
+
if (n && n.length > 0) {
|
|
27
33
|
const r = t.definitions.componentOp;
|
|
28
|
-
delete r.pattern, r.enum =
|
|
34
|
+
delete r.pattern, r.enum = n.map((i) => `$component(${i})`);
|
|
29
35
|
}
|
|
30
36
|
return t;
|
|
31
37
|
}
|
|
32
38
|
export {
|
|
33
39
|
g as a,
|
|
34
40
|
b,
|
|
35
|
-
|
|
41
|
+
S as c,
|
|
36
42
|
O as d,
|
|
37
|
-
|
|
38
|
-
N as
|
|
43
|
+
F as e,
|
|
44
|
+
N as f,
|
|
45
|
+
j as g,
|
|
46
|
+
v as h,
|
|
39
47
|
$ as i,
|
|
40
|
-
|
|
48
|
+
P as j,
|
|
49
|
+
q as k,
|
|
50
|
+
o as p
|
|
41
51
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,12 +11,19 @@ export { SchemaErrorPanel } from './components/schema-error-panel';
|
|
|
11
11
|
export type { SchemaErrorPanelProps } from './components/schema-error-panel';
|
|
12
12
|
export type { JsonFormSchema, JsonNode, JsonFieldNode, JsonArrayNode, JsonContainerNode, } from './types/json-schema';
|
|
13
13
|
export { isFieldNode, isArrayNode, isContainerNode } from './types/json-schema';
|
|
14
|
-
export { parseOperator, isModelOp, isComponentOp, isDataSourceOp } from './operators';
|
|
15
|
-
export type { ModelOp, ComponentOp, DataSourceOp, JsonOperator, ParsedOperator } from './operators';
|
|
14
|
+
export { parseOperator, isModelOp, isComponentOp, isDataSourceOp, isFnOp, isLocaleOp, } from './operators';
|
|
15
|
+
export type { ModelOp, ComponentOp, DataSourceOp, FnOp, LocaleOp, JsonOperator, ParsedOperator, } from './operators';
|
|
16
16
|
export { defineRegistry } from './registry/component-registry';
|
|
17
|
-
export { FIELD_WRAPPER } from './registry/constants';
|
|
17
|
+
export { FIELD_WRAPPER, LOCALE_SERVICE } from './registry/constants';
|
|
18
18
|
export type { ComponentRegistry, ComponentMetadata, RegistryBuilder } from './registry/types';
|
|
19
|
+
export { createLocaleResolver, createLocaleService, defaultLocaleResolver, } from './locale/locale-service';
|
|
20
|
+
export type { LocaleResolver, LocaleService, LocaleParams } from './locale/locale-service';
|
|
21
|
+
export { LocaleProvider, useLocale } from './locale/locale-context';
|
|
22
|
+
export type { LocaleProviderProps } from './locale/locale-context';
|
|
23
|
+
export { I18n } from './locale/i18n';
|
|
24
|
+
export type { I18nProps } from './locale/i18n';
|
|
25
|
+
export { useSignalValues, unwrapSignalValues } from './locale/use-signal-value';
|
|
19
26
|
export { JsonRendererProvider, useJsonRendererSettings } from './context/json-renderer-context';
|
|
20
27
|
export type { JsonRendererSettings, JsonRendererProviderProps, } from './context/json-renderer-context';
|
|
21
28
|
export { createRenderSchemaFromJsonM1, convertJsonToM1Tree, } from './converter/json-to-render-schema';
|
|
22
|
-
export { formSchemaMetaSchema, buildFormSchemaMetaSchema, getComponentNames, getDataSourceNames, } from './schema';
|
|
29
|
+
export { formSchemaMetaSchema, buildFormSchemaMetaSchema, getComponentNames, getDataSourceNames, getFnNames, getLocaleKeys, } from './schema';
|