@atscript/ui 0.1.164 → 0.1.165

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.
Files changed (60) hide show
  1. package/dist/client-factory.d.cts +6 -1
  2. package/dist/client-factory.d.mts +6 -1
  3. package/dist/form/create-form-def.cjs +28 -6
  4. package/dist/form/create-form-def.mjs +29 -7
  5. package/dist/form/labels.cjs +7 -4
  6. package/dist/form/labels.d.cts +6 -2
  7. package/dist/form/labels.d.mts +6 -2
  8. package/dist/form/labels.mjs +7 -4
  9. package/dist/form/types.d.cts +14 -0
  10. package/dist/form/types.d.mts +14 -0
  11. package/dist/form/validate.cjs +59 -23
  12. package/dist/form/validate.d.cts +37 -6
  13. package/dist/form/validate.d.mts +37 -6
  14. package/dist/form/validate.mjs +58 -23
  15. package/dist/i18n/ui-texts.cjs +135 -0
  16. package/dist/i18n/ui-texts.d.cts +81 -0
  17. package/dist/i18n/ui-texts.d.mts +81 -0
  18. package/dist/i18n/ui-texts.mjs +132 -0
  19. package/dist/index.cjs +6 -0
  20. package/dist/index.d.cts +7 -6
  21. package/dist/index.d.mts +7 -6
  22. package/dist/index.mjs +3 -2
  23. package/dist/messages.cjs +301 -0
  24. package/dist/messages.d.cts +302 -0
  25. package/dist/messages.d.mts +302 -0
  26. package/dist/messages.mjs +300 -0
  27. package/dist/plugin/annotations.cjs +30 -15
  28. package/dist/plugin/annotations.mjs +30 -15
  29. package/dist/plugin/value-help-validation.cjs +17 -7
  30. package/dist/plugin/value-help-validation.mjs +17 -7
  31. package/dist/shared/meta-cache.cjs +75 -37
  32. package/dist/shared/meta-cache.d.cts +40 -20
  33. package/dist/shared/meta-cache.d.mts +40 -20
  34. package/dist/shared/meta-cache.mjs +75 -37
  35. package/dist/table/create-table-def.cjs +17 -8
  36. package/dist/table/create-table-def.d.cts +5 -1
  37. package/dist/table/create-table-def.d.mts +5 -1
  38. package/dist/table/create-table-def.mjs +18 -9
  39. package/dist/table/types.d.cts +5 -2
  40. package/dist/table/types.d.mts +5 -2
  41. package/dist/table/value-kind.cjs +6 -6
  42. package/dist/table/value-kind.d.cts +8 -7
  43. package/dist/table/value-kind.d.mts +8 -7
  44. package/dist/table/value-kind.mjs +6 -6
  45. package/dist/value-help/extract-literals.cjs +61 -22
  46. package/dist/value-help/extract-literals.d.cts +20 -8
  47. package/dist/value-help/extract-literals.d.mts +20 -8
  48. package/dist/value-help/extract-literals.mjs +60 -23
  49. package/dist/value-help/index.d.mts +1 -1
  50. package/dist/value-help/resolve-options.cjs +8 -4
  51. package/dist/value-help/resolve-options.d.cts +8 -3
  52. package/dist/value-help/resolve-options.d.mts +8 -3
  53. package/dist/value-help/resolve-options.mjs +9 -5
  54. package/dist/value-help/resolve.cjs +7 -3
  55. package/dist/value-help/resolve.d.cts +7 -2
  56. package/dist/value-help/resolve.d.mts +7 -2
  57. package/dist/value-help/resolve.mjs +7 -3
  58. package/dist/value-help/types.d.cts +5 -0
  59. package/dist/value-help/types.d.mts +5 -0
  60. package/package.json +15 -10
@@ -1,10 +1,25 @@
1
1
  import "../shared/annotation-keys.mjs";
2
2
  import { childFields } from "./types.mjs";
3
+ import { getUiTexts } from "../i18n/ui-texts.mjs";
3
4
  import { isSkippedNavField } from "./skipped-nav.mjs";
4
5
  import { validatorErrorsToMap } from "./error-utils.mjs";
5
- import { Validator } from "@atscript/typescript/utils";
6
+ import { Validator, localizeErrors, normalizeForType } from "@atscript/typescript/utils";
6
7
  import { createDbValidatorPlugin } from "@atscript/db/validator";
7
8
  //#region src/form/validate.ts
9
+ /**
10
+ * `error`'s message in the language of `t` (looked up by code or text, see
11
+ * {@link TFormValidatorCallOptions.t}); the English message when `t` has none.
12
+ * Its `details` are dropped first: only the message is read.
13
+ */
14
+ function messageIn(error, t) {
15
+ return localizeErrors([{
16
+ ...error,
17
+ details: void 0
18
+ }], (id, params) => {
19
+ const text = t(id, params);
20
+ return text === id ? void 0 : text;
21
+ })[0].message;
22
+ }
8
23
  const dbPlugin = createDbValidatorPlugin();
9
24
  const INSERT_CONTEXT = { mode: "insert" };
10
25
  /**
@@ -68,20 +83,24 @@ function getDefaultValidatorPlugins() {
68
83
  return defaultValidatorPlugins;
69
84
  }
70
85
  /**
71
- * Returns a reusable validator function for a whole FormDef.
86
+ * Returns a reusable validator for a whole FormDef.
72
87
  *
73
88
  * Validator is created once and reused on every call.
74
89
  * ATScript's @expect.* validation runs automatically; server-managed db
75
90
  * fields (every `derived` field, absent `@db.default*` / version) pass.
76
91
  * For custom `ui.fn.*` validators, install ui-fns and pass its plugin via `opts.plugins`.
77
92
  *
78
- * Errors are keyed by dotted path. A root-level error (a failing
79
- * `@ui.form.validate` on the form's interface) is keyed `__form`.
93
+ * It validates the data as given: apply `@normalize.*` first with its
94
+ * `normalize(data)` and validate (and submit) the result, as the server does.
95
+ *
96
+ * Errors are keyed by dotted path, worded in the language of `callOpts.t`.
97
+ * A root-level error (a failing `@ui.form.validate` on the form's interface)
98
+ * is keyed `__form`.
80
99
  */
81
100
  function getFormValidator(def, opts) {
82
101
  const derived = collectDerivedProps(def);
83
102
  const derivedPlugin = (_ctx, prop) => derived.has(prop) ? true : void 0;
84
- const validator = new Validator(def.type, {
103
+ const options = {
85
104
  unknownProps: "ignore",
86
105
  ...opts,
87
106
  plugins: [
@@ -90,14 +109,21 @@ function getFormValidator(def, opts) {
90
109
  ...defaultValidatorPlugins,
91
110
  ...opts?.plugins ?? []
92
111
  ]
93
- });
94
- return (callOpts) => {
112
+ };
113
+ const validator = new Validator(def.type, options);
114
+ const validate = (callOpts) => {
95
115
  if (validator.validate(callOpts.data, true, {
96
116
  data: callOpts.data,
97
- context: callOpts.context ?? {}
117
+ context: callOpts.context ?? {},
118
+ t: callOpts.t
98
119
  })) return {};
99
- return validatorErrorsToMap(validator.errors);
120
+ const t = callOpts.t ?? getUiTexts().t;
121
+ return validatorErrorsToMap(validator.errors.map((e) => ({
122
+ path: e.path,
123
+ message: messageIn(e, t)
124
+ })));
100
125
  };
126
+ return Object.assign(validate, { normalize: (data) => normalizeForType(def.type, data, options) });
101
127
  }
102
128
  /**
103
129
  * Root-only plugin: passes every descendant without visiting it. Only
@@ -120,27 +146,36 @@ function isContainerKind(kind) {
120
146
  * Creates a cached validator function for a single ATScript prop.
121
147
  *
122
148
  * The `Validator` instance is created lazily on first call and reused.
123
- * Returns `true` when valid, or the first error message string when invalid.
149
+ * Returns `true` when valid, or the first error message string when invalid,
150
+ * worded in the language of `externalCtx.t` (else `opts.t`, else the active
151
+ * UI texts) — looked up by the error's code, see {@link TFormValidatorCallOptions.t}.
152
+ * The value is judged with the prop's `@normalize.*` applied, as a submit
153
+ * judges it (the value itself is not changed).
124
154
  * With `rootOnly`, an object / array / tuple prop is validated at its root
125
155
  * only (descendants are not walked — their errors would be discarded anyway).
126
156
  */
127
157
  function createFieldValidator(prop, opts) {
128
158
  let cached;
159
+ let options;
160
+ const rootOfContainer = opts?.rootOnly === true && isContainerKind(prop.type.kind);
129
161
  return (value, externalCtx) => {
130
- cached ??= new Validator(prop, { plugins: opts?.rootOnly && isContainerKind(prop.type.kind) ? [
131
- skipDescendantsPlugin,
132
- serverManagedPlugin,
133
- ...defaultValidatorPlugins
134
- ] : [serverManagedPlugin, ...defaultValidatorPlugins] });
135
- if (!cached.validate(value, true, externalCtx)) {
136
- if (opts?.rootOnly) {
137
- const rootError = cached.errors?.find((e) => e.path === "");
138
- if (rootError) return rootError.message;
139
- return true;
140
- }
141
- return cached.errors?.[0]?.message || "Invalid value";
162
+ if (!cached) {
163
+ options = { plugins: rootOfContainer ? [
164
+ skipDescendantsPlugin,
165
+ serverManagedPlugin,
166
+ ...defaultValidatorPlugins
167
+ ] : [serverManagedPlugin, ...defaultValidatorPlugins] };
168
+ cached = new Validator(prop, options);
169
+ }
170
+ const judged = rootOfContainer ? value : normalizeForType(prop, value, options);
171
+ if (cached.validate(judged, true, externalCtx)) return true;
172
+ const t = externalCtx?.t ?? opts?.t ?? getUiTexts().t;
173
+ if (opts?.rootOnly) {
174
+ const rootError = cached.errors?.find((e) => e.path === "");
175
+ return rootError ? messageIn(rootError, t) : true;
142
176
  }
143
- return true;
177
+ const error = cached.errors?.[0];
178
+ return error && messageIn(error, t) || t("UI_INVALID_VALUE");
144
179
  };
145
180
  }
146
181
  //#endregion
@@ -0,0 +1,135 @@
1
+ const require_messages = require("../messages.cjs");
2
+ //#region src/i18n/ui-texts.ts
3
+ const PLACEHOLDER = /\{(\w+)\}/g;
4
+ /**
5
+ * Fills `{name}` placeholders in one pass (arrays joined with `, `); a
6
+ * placeholder without a param stays, filled-in values are never filled again.
7
+ */
8
+ function fill(template, params) {
9
+ if (!params || !template.includes("{")) return template;
10
+ return template.replace(PLACEHOLDER, (match, name) => {
11
+ const value = Object.hasOwn(params, name) ? params[name] : void 0;
12
+ if (value === void 0) return match;
13
+ return Array.isArray(value) ? value.map(String).join(", ") : String(value);
14
+ });
15
+ }
16
+ let failureLogged = false;
17
+ /** The translator's text; `undefined` when it has none or throws (logged once). */
18
+ function callTranslator(translate, id, params, locale) {
19
+ try {
20
+ const out = translate(id, params, locale);
21
+ return typeof out === "string" ? out : void 0;
22
+ } catch (error) {
23
+ if (!failureLogged) {
24
+ failureLogged = true;
25
+ console.error(`[atscript-ui] The UI translator threw for "${id}" (logged once)`, error);
26
+ }
27
+ return;
28
+ }
29
+ }
30
+ /** The string entries of a served `$i18n` dict, `undefined` when it has none. */
31
+ function servedEntries(served) {
32
+ if (typeof served !== "object" || served === null || Array.isArray(served)) return void 0;
33
+ let out;
34
+ for (const [id, text] of Object.entries(served)) if (typeof text === "string") (out ??= {})[id] = text;
35
+ return out;
36
+ }
37
+ /**
38
+ * Creates a source of UI texts. `dicts` holds the served texts — pass a Vue
39
+ * `shallowRef({})` for reactive lookups; it is replaced wholesale on merge.
40
+ *
41
+ * @internal Shared with the `@atscript/vue-*` packages.
42
+ */
43
+ function createUiTexts(opts) {
44
+ const { locale, translate } = opts;
45
+ const dicts = opts.dicts ?? { value: {} };
46
+ const t = (id, params) => {
47
+ const loc = locale();
48
+ const translator = translate?.();
49
+ if (translator) {
50
+ const own = callTranslator(translator, id, params, loc);
51
+ if (own !== void 0 && own !== id) return own;
52
+ }
53
+ const dict = dicts.value[loc ?? ""];
54
+ return fill(dict && Object.hasOwn(dict, id) ? dict[id] : Object.hasOwn(require_messages.AS_UI_MESSAGES, id) ? require_messages.AS_UI_MESSAGES[id] : id, params);
55
+ };
56
+ const merge = (loc, served) => {
57
+ const entries = servedEntries(served);
58
+ if (!entries) return;
59
+ const key = loc ?? "";
60
+ const prev = dicts.value[key];
61
+ if (prev && Object.keys(entries).every((id) => prev[id] === entries[id])) return;
62
+ dicts.value = {
63
+ ...dicts.value,
64
+ [key]: Object.freeze({
65
+ ...prev,
66
+ ...entries
67
+ })
68
+ };
69
+ };
70
+ return {
71
+ locale,
72
+ t,
73
+ merge
74
+ };
75
+ }
76
+ let globalLocale;
77
+ let globalTranslate;
78
+ const globalSource = createUiTexts({
79
+ locale: () => globalLocale,
80
+ translate: () => globalTranslate
81
+ });
82
+ const globalTexts = {
83
+ ...globalSource,
84
+ merge: (locale, served) => {
85
+ if (typeof window !== "undefined") globalSource.merge(locale, served);
86
+ }
87
+ };
88
+ /** Activated sources, most recent last; the global one when empty. */
89
+ const activated = [];
90
+ /**
91
+ * Sets the locale of the built-in UI texts, and optionally your own
92
+ * translator for them, for an app that does not use the Vue provider
93
+ * (`provideAsLocale` in `@atscript/vue-form`). Browser-global: never call it
94
+ * on a server that renders for many users.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * setUiLocale("de", (id, params) => i18n.t(id, params));
99
+ * ```
100
+ */
101
+ function setUiLocale(locale, translate) {
102
+ globalLocale = locale;
103
+ globalTranslate = translate;
104
+ }
105
+ /**
106
+ * The texts code outside a component reads (definitions built from
107
+ * metadata, table state): the browser-side app provider's when one is
108
+ * active, else the browser-global ones (`setUiLocale`).
109
+ *
110
+ * @internal Shared with the `@atscript/vue-*` packages.
111
+ */
112
+ function getUiTexts() {
113
+ return activated.at(-1) ?? globalTexts;
114
+ }
115
+ /**
116
+ * Makes `texts` the ones {@link getUiTexts} returns (browser only — the Vue
117
+ * provider never calls it on a server) until undone; undoing one of several
118
+ * gives the most recent remaining one back. Returns the undo (idempotent).
119
+ *
120
+ * @internal Shared with `@atscript/vue-form`.
121
+ */
122
+ function activateUiTexts(texts) {
123
+ activated.push(texts);
124
+ let undone = false;
125
+ return () => {
126
+ if (undone) return;
127
+ undone = true;
128
+ activated.splice(activated.lastIndexOf(texts), 1);
129
+ };
130
+ }
131
+ //#endregion
132
+ exports.activateUiTexts = activateUiTexts;
133
+ exports.createUiTexts = createUiTexts;
134
+ exports.getUiTexts = getUiTexts;
135
+ exports.setUiLocale = setUiLocale;
@@ -0,0 +1,81 @@
1
+ //#region src/i18n/ui-texts.d.ts
2
+ /** Message params: the values a text's `{name}` placeholders are filled with. */
3
+ type UiTextParams = Record<string, unknown>;
4
+ /**
5
+ * An app's own translator for the built-in UI texts: return the final text
6
+ * (params already filled in), or `undefined` to fall back to the texts the
7
+ * server served for the locale, then to English. `id` is a code of
8
+ * `AS_UI_MESSAGES` (`UI_CANCEL`, …) or a literal text.
9
+ */
10
+ type UiTranslate = (id: string, params: UiTextParams | undefined, locale: string | undefined) => string | undefined;
11
+ /** `t(id, params?)` — a UI text in the current locale. */
12
+ type UiT = (id: string, params?: UiTextParams) => string;
13
+ /** Served texts per locale: `{ [locale]: { [code or text]: template } }` (`""` = no locale). */
14
+ type UiDicts = Readonly<Record<string, Readonly<Record<string, string>>>>;
15
+ /**
16
+ * One source of UI texts: the browser-global one (`setUiLocale`) or an app's
17
+ * (`provideAsLocale` in `@atscript/vue-form`).
18
+ *
19
+ * @internal Shared with the `@atscript/vue-*` packages.
20
+ */
21
+ interface UiTexts {
22
+ /** The current locale. */
23
+ locale: () => string | undefined;
24
+ /**
25
+ * A text in the current locale — reactive when the locale and the dict
26
+ * are: your translator's text, else the text the server served for the
27
+ * locale, else English (`AS_UI_MESSAGES`), else `id` — with `{name}`
28
+ * placeholders filled.
29
+ */
30
+ t: UiT;
31
+ /**
32
+ * Merges texts the server served for `locale` (an `$i18n` dict: codes and
33
+ * literal texts) into that locale's dict. Pass the locale the request was
34
+ * made for: a late answer for a previous locale lands in that locale's dict,
35
+ * never in the current one.
36
+ */
37
+ merge: (locale: string | undefined, served: unknown) => void;
38
+ }
39
+ /**
40
+ * Creates a source of UI texts. `dicts` holds the served texts — pass a Vue
41
+ * `shallowRef({})` for reactive lookups; it is replaced wholesale on merge.
42
+ *
43
+ * @internal Shared with the `@atscript/vue-*` packages.
44
+ */
45
+ declare function createUiTexts(opts: {
46
+ locale: () => string | undefined;
47
+ translate?: () => UiTranslate | undefined;
48
+ dicts?: {
49
+ value: UiDicts;
50
+ };
51
+ }): UiTexts;
52
+ /**
53
+ * Sets the locale of the built-in UI texts, and optionally your own
54
+ * translator for them, for an app that does not use the Vue provider
55
+ * (`provideAsLocale` in `@atscript/vue-form`). Browser-global: never call it
56
+ * on a server that renders for many users.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * setUiLocale("de", (id, params) => i18n.t(id, params));
61
+ * ```
62
+ */
63
+ declare function setUiLocale(locale: string | undefined, translate?: UiTranslate): void;
64
+ /**
65
+ * The texts code outside a component reads (definitions built from
66
+ * metadata, table state): the browser-side app provider's when one is
67
+ * active, else the browser-global ones (`setUiLocale`).
68
+ *
69
+ * @internal Shared with the `@atscript/vue-*` packages.
70
+ */
71
+ declare function getUiTexts(): UiTexts;
72
+ /**
73
+ * Makes `texts` the ones {@link getUiTexts} returns (browser only — the Vue
74
+ * provider never calls it on a server) until undone; undoing one of several
75
+ * gives the most recent remaining one back. Returns the undo (idempotent).
76
+ *
77
+ * @internal Shared with `@atscript/vue-form`.
78
+ */
79
+ declare function activateUiTexts(texts: UiTexts): () => void;
80
+ //#endregion
81
+ export { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, setUiLocale };
@@ -0,0 +1,81 @@
1
+ //#region src/i18n/ui-texts.d.ts
2
+ /** Message params: the values a text's `{name}` placeholders are filled with. */
3
+ type UiTextParams = Record<string, unknown>;
4
+ /**
5
+ * An app's own translator for the built-in UI texts: return the final text
6
+ * (params already filled in), or `undefined` to fall back to the texts the
7
+ * server served for the locale, then to English. `id` is a code of
8
+ * `AS_UI_MESSAGES` (`UI_CANCEL`, …) or a literal text.
9
+ */
10
+ type UiTranslate = (id: string, params: UiTextParams | undefined, locale: string | undefined) => string | undefined;
11
+ /** `t(id, params?)` — a UI text in the current locale. */
12
+ type UiT = (id: string, params?: UiTextParams) => string;
13
+ /** Served texts per locale: `{ [locale]: { [code or text]: template } }` (`""` = no locale). */
14
+ type UiDicts = Readonly<Record<string, Readonly<Record<string, string>>>>;
15
+ /**
16
+ * One source of UI texts: the browser-global one (`setUiLocale`) or an app's
17
+ * (`provideAsLocale` in `@atscript/vue-form`).
18
+ *
19
+ * @internal Shared with the `@atscript/vue-*` packages.
20
+ */
21
+ interface UiTexts {
22
+ /** The current locale. */
23
+ locale: () => string | undefined;
24
+ /**
25
+ * A text in the current locale — reactive when the locale and the dict
26
+ * are: your translator's text, else the text the server served for the
27
+ * locale, else English (`AS_UI_MESSAGES`), else `id` — with `{name}`
28
+ * placeholders filled.
29
+ */
30
+ t: UiT;
31
+ /**
32
+ * Merges texts the server served for `locale` (an `$i18n` dict: codes and
33
+ * literal texts) into that locale's dict. Pass the locale the request was
34
+ * made for: a late answer for a previous locale lands in that locale's dict,
35
+ * never in the current one.
36
+ */
37
+ merge: (locale: string | undefined, served: unknown) => void;
38
+ }
39
+ /**
40
+ * Creates a source of UI texts. `dicts` holds the served texts — pass a Vue
41
+ * `shallowRef({})` for reactive lookups; it is replaced wholesale on merge.
42
+ *
43
+ * @internal Shared with the `@atscript/vue-*` packages.
44
+ */
45
+ declare function createUiTexts(opts: {
46
+ locale: () => string | undefined;
47
+ translate?: () => UiTranslate | undefined;
48
+ dicts?: {
49
+ value: UiDicts;
50
+ };
51
+ }): UiTexts;
52
+ /**
53
+ * Sets the locale of the built-in UI texts, and optionally your own
54
+ * translator for them, for an app that does not use the Vue provider
55
+ * (`provideAsLocale` in `@atscript/vue-form`). Browser-global: never call it
56
+ * on a server that renders for many users.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * setUiLocale("de", (id, params) => i18n.t(id, params));
61
+ * ```
62
+ */
63
+ declare function setUiLocale(locale: string | undefined, translate?: UiTranslate): void;
64
+ /**
65
+ * The texts code outside a component reads (definitions built from
66
+ * metadata, table state): the browser-side app provider's when one is
67
+ * active, else the browser-global ones (`setUiLocale`).
68
+ *
69
+ * @internal Shared with the `@atscript/vue-*` packages.
70
+ */
71
+ declare function getUiTexts(): UiTexts;
72
+ /**
73
+ * Makes `texts` the ones {@link getUiTexts} returns (browser only — the Vue
74
+ * provider never calls it on a server) until undone; undoing one of several
75
+ * gives the most recent remaining one back. Returns the undo (idempotent).
76
+ *
77
+ * @internal Shared with `@atscript/vue-form`.
78
+ */
79
+ declare function activateUiTexts(texts: UiTexts): () => void;
80
+ //#endregion
81
+ export { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, setUiLocale };
@@ -0,0 +1,132 @@
1
+ import { AS_UI_MESSAGES } from "../messages.mjs";
2
+ //#region src/i18n/ui-texts.ts
3
+ const PLACEHOLDER = /\{(\w+)\}/g;
4
+ /**
5
+ * Fills `{name}` placeholders in one pass (arrays joined with `, `); a
6
+ * placeholder without a param stays, filled-in values are never filled again.
7
+ */
8
+ function fill(template, params) {
9
+ if (!params || !template.includes("{")) return template;
10
+ return template.replace(PLACEHOLDER, (match, name) => {
11
+ const value = Object.hasOwn(params, name) ? params[name] : void 0;
12
+ if (value === void 0) return match;
13
+ return Array.isArray(value) ? value.map(String).join(", ") : String(value);
14
+ });
15
+ }
16
+ let failureLogged = false;
17
+ /** The translator's text; `undefined` when it has none or throws (logged once). */
18
+ function callTranslator(translate, id, params, locale) {
19
+ try {
20
+ const out = translate(id, params, locale);
21
+ return typeof out === "string" ? out : void 0;
22
+ } catch (error) {
23
+ if (!failureLogged) {
24
+ failureLogged = true;
25
+ console.error(`[atscript-ui] The UI translator threw for "${id}" (logged once)`, error);
26
+ }
27
+ return;
28
+ }
29
+ }
30
+ /** The string entries of a served `$i18n` dict, `undefined` when it has none. */
31
+ function servedEntries(served) {
32
+ if (typeof served !== "object" || served === null || Array.isArray(served)) return void 0;
33
+ let out;
34
+ for (const [id, text] of Object.entries(served)) if (typeof text === "string") (out ??= {})[id] = text;
35
+ return out;
36
+ }
37
+ /**
38
+ * Creates a source of UI texts. `dicts` holds the served texts — pass a Vue
39
+ * `shallowRef({})` for reactive lookups; it is replaced wholesale on merge.
40
+ *
41
+ * @internal Shared with the `@atscript/vue-*` packages.
42
+ */
43
+ function createUiTexts(opts) {
44
+ const { locale, translate } = opts;
45
+ const dicts = opts.dicts ?? { value: {} };
46
+ const t = (id, params) => {
47
+ const loc = locale();
48
+ const translator = translate?.();
49
+ if (translator) {
50
+ const own = callTranslator(translator, id, params, loc);
51
+ if (own !== void 0 && own !== id) return own;
52
+ }
53
+ const dict = dicts.value[loc ?? ""];
54
+ return fill(dict && Object.hasOwn(dict, id) ? dict[id] : Object.hasOwn(AS_UI_MESSAGES, id) ? AS_UI_MESSAGES[id] : id, params);
55
+ };
56
+ const merge = (loc, served) => {
57
+ const entries = servedEntries(served);
58
+ if (!entries) return;
59
+ const key = loc ?? "";
60
+ const prev = dicts.value[key];
61
+ if (prev && Object.keys(entries).every((id) => prev[id] === entries[id])) return;
62
+ dicts.value = {
63
+ ...dicts.value,
64
+ [key]: Object.freeze({
65
+ ...prev,
66
+ ...entries
67
+ })
68
+ };
69
+ };
70
+ return {
71
+ locale,
72
+ t,
73
+ merge
74
+ };
75
+ }
76
+ let globalLocale;
77
+ let globalTranslate;
78
+ const globalSource = createUiTexts({
79
+ locale: () => globalLocale,
80
+ translate: () => globalTranslate
81
+ });
82
+ const globalTexts = {
83
+ ...globalSource,
84
+ merge: (locale, served) => {
85
+ if (typeof window !== "undefined") globalSource.merge(locale, served);
86
+ }
87
+ };
88
+ /** Activated sources, most recent last; the global one when empty. */
89
+ const activated = [];
90
+ /**
91
+ * Sets the locale of the built-in UI texts, and optionally your own
92
+ * translator for them, for an app that does not use the Vue provider
93
+ * (`provideAsLocale` in `@atscript/vue-form`). Browser-global: never call it
94
+ * on a server that renders for many users.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * setUiLocale("de", (id, params) => i18n.t(id, params));
99
+ * ```
100
+ */
101
+ function setUiLocale(locale, translate) {
102
+ globalLocale = locale;
103
+ globalTranslate = translate;
104
+ }
105
+ /**
106
+ * The texts code outside a component reads (definitions built from
107
+ * metadata, table state): the browser-side app provider's when one is
108
+ * active, else the browser-global ones (`setUiLocale`).
109
+ *
110
+ * @internal Shared with the `@atscript/vue-*` packages.
111
+ */
112
+ function getUiTexts() {
113
+ return activated.at(-1) ?? globalTexts;
114
+ }
115
+ /**
116
+ * Makes `texts` the ones {@link getUiTexts} returns (browser only — the Vue
117
+ * provider never calls it on a server) until undone; undoing one of several
118
+ * gives the most recent remaining one back. Returns the undo (idempotent).
119
+ *
120
+ * @internal Shared with `@atscript/vue-form`.
121
+ */
122
+ function activateUiTexts(texts) {
123
+ activated.push(texts);
124
+ let undone = false;
125
+ return () => {
126
+ if (undone) return;
127
+ undone = true;
128
+ activated.splice(activated.lastIndexOf(texts), 1);
129
+ };
130
+ }
131
+ //#endregion
132
+ export { activateUiTexts, createUiTexts, getUiTexts, setUiLocale };
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_annotation_keys = require("./shared/annotation-keys.cjs");
3
3
  const require_types = require("./form/types.cjs");
4
4
  const require_field_resolver = require("./shared/field-resolver.cjs");
5
+ const require_ui_texts = require("./i18n/ui-texts.cjs");
5
6
  const require_extract_literals = require("./value-help/extract-literals.cjs");
6
7
  const require_extract_ref = require("./value-help/extract-ref.cjs");
7
8
  const require_clone = require("./form/clone.cjs");
@@ -40,6 +41,7 @@ exports.DB_HTTP_PATH = require_annotation_keys.DB_HTTP_PATH;
40
41
  exports.DB_REL_FK = require_annotation_keys.DB_REL_FK;
41
42
  exports.DB_UNIT = require_annotation_keys.DB_UNIT;
42
43
  exports.DB_UNIT_REF = require_annotation_keys.DB_UNIT_REF;
44
+ exports.DEFAULT_BOOLEAN_LABELS = require_extract_literals.DEFAULT_BOOLEAN_LABELS;
43
45
  exports.DEFAULT_COL_SPAN = require_grid.DEFAULT_COL_SPAN;
44
46
  exports.DEFAULT_ROW_SPAN = require_grid.DEFAULT_ROW_SPAN;
45
47
  exports.EXPECT_MAX_LENGTH = require_annotation_keys.EXPECT_MAX_LENGTH;
@@ -118,6 +120,7 @@ exports.UI_TABLE_WIDTH = require_annotation_keys.UI_TABLE_WIDTH;
118
120
  exports.UI_TYPE = require_annotation_keys.UI_TYPE;
119
121
  exports.ValueHelpClient = require_value_help_client.ValueHelpClient;
120
122
  exports.WF_ACTION_WITH_DATA = require_annotation_keys.WF_ACTION_WITH_DATA;
123
+ exports.activateUiTexts = require_ui_texts.activateUiTexts;
121
124
  exports.applyFormChanges = require_apply.applyFormChanges;
122
125
  exports.asArray = require_field_resolver.asArray;
123
126
  exports.buildDescendantErrorCounts = require_error_utils.buildDescendantErrorCounts;
@@ -132,6 +135,7 @@ exports.createFormData = require_path_utils.createFormData;
132
135
  exports.createFormDef = require_create_form_def.createFormDef;
133
136
  exports.createFormValueResolver = require_path_utils.createFormValueResolver;
134
137
  exports.createTableDef = require_create_table_def.createTableDef;
138
+ exports.createUiTexts = require_ui_texts.createUiTexts;
135
139
  exports.deepClone = require_clone.deepClone;
136
140
  exports.deepEqual = require_diff.deepEqual;
137
141
  exports.defaultResolver = require_field_resolver.defaultResolver;
@@ -162,6 +166,7 @@ exports.getMetaTableDef = require_meta_cache.getMetaTableDef;
162
166
  exports.getResolver = require_field_resolver.getResolver;
163
167
  exports.getSortableColumns = require_column_resolver.getSortableColumns;
164
168
  exports.getThousandsSeparator = require_decimal_format.getThousandsSeparator;
169
+ exports.getUiTexts = require_ui_texts.getUiTexts;
165
170
  exports.groupInteger = require_decimal_format.groupInteger;
166
171
  exports.hasComputedAnnotations = require_field_resolver.hasComputedAnnotations;
167
172
  exports.hasFieldMeta = require_field_resolver.hasFieldMeta;
@@ -210,6 +215,7 @@ exports.setDefaultValidatorPlugins = require_validate.setDefaultValidatorPlugins
210
215
  exports.setMetaCacheIdentity = require_meta_cache.setMetaCacheIdentity;
211
216
  exports.setMetaCacheMaxEntries = require_meta_cache.setMetaCacheMaxEntries;
212
217
  exports.setResolver = require_field_resolver.setResolver;
218
+ exports.setUiLocale = require_ui_texts.setUiLocale;
213
219
  exports.setValueHelpCacheTtl = require_value_help_client.setValueHelpCacheTtl;
214
220
  exports.splitDecimalString = require_decimal_format.splitDecimalString;
215
221
  exports.str = require_str.str;
package/dist/index.d.cts CHANGED
@@ -4,16 +4,20 @@ import { FormArrayFieldDef, FormDef, FormFieldDef, FormObjectFieldDef, FormTuple
4
4
  import { CreateFormDefOptions, buildUnionVariants, createFormDef } from "./form/create-form-def.cjs";
5
5
  import { FormActionInfo, getDeclaredFormActions } from "./form/form-actions.cjs";
6
6
  import { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver } from "./shared/field-resolver.cjs";
7
+ import { ClientFactory, ClientFactoryOptions, TypedClientFactory, getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "./client-factory.cjs";
8
+ import { ColumnDef, ColumnValueKind, FieldMeta, MetaResponse, PaginationControl, RelationInfo, SearchIndexInfo, SortControl, TableActionsModel, TableDef, TableQueryState } from "./table/types.cjs";
9
+ import { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, setUiLocale } from "./i18n/ui-texts.cjs";
10
+ import { MetaCacheEntry, MetaEntryOptions, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.cjs";
7
11
  import { ResolvedValueHelp, resetValueHelpCache, resolveValueHelp } from "./value-help/resolve.cjs";
8
12
  import { ValueHelpClient, ValueHelpResult, ValueHelpSearchOptions, invalidateValueHelpCache, setValueHelpCacheTtl } from "./value-help/value-help-client.cjs";
9
13
  import { valueHelpDictPaths } from "./value-help/dict-paths.cjs";
10
- import { extractFieldLiteralOptions, extractLiteralOptions, isPureLiteralUnion } from "./value-help/extract-literals.cjs";
14
+ import { DEFAULT_BOOLEAN_LABELS, extractFieldLiteralOptions, extractLiteralOptions, isPureLiteralUnion } from "./value-help/extract-literals.cjs";
11
15
  import { extractValueHelp } from "./value-help/extract-ref.cjs";
12
16
  import { optKey, optLabel, optionLabel, parseStaticOptions, resolveOptions } from "./value-help/resolve-options.cjs";
13
17
  import { fetchDistinctValues, isPickerDeclined } from "./value-help/distinct-client.cjs";
14
18
  import { TFormValueResolver, createFormData, createFormValueResolver, deleteByPath, detectUnionVariant, getByPath, joinPath, setByPath } from "./form/path-utils.cjs";
15
19
  import { CloneUnwrap, deepClone } from "./form/clone.cjs";
16
- import { TFieldValidatorOptions, TFormValidatorCallOptions, createFieldValidator, getDefaultValidatorPlugins, getFormValidator, isContainerKind, setDefaultValidatorPlugins } from "./form/validate.cjs";
20
+ import { FormValidator, TFieldValidatorOptions, TFormValidatorCallOptions, createFieldValidator, getDefaultValidatorPlugins, getFormValidator, isContainerKind, setDefaultValidatorPlugins } from "./form/validate.cjs";
17
21
  import { FormDiffOptions, FormDiffResult, FormFieldChange, buildFormDiff, deepEqual } from "./form/diff.cjs";
18
22
  import { omitSkippedNavFields } from "./form/skipped-nav.cjs";
19
23
  import { collectDirtyPaths, isPathDirty } from "./form/dirty.cjs";
@@ -25,14 +29,11 @@ import { DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, GridSpanArgs, GridSpec, buildGridCl
25
29
  import { resolveSingularLabel } from "./form/labels.cjs";
26
30
  import { MeasurementInfo, extractMeasurement } from "./form/measurement.cjs";
27
31
  import { CurrencyDisplay, DecimalParts, FormatDecimalOptions, enforceScale, formatDecimalForDisplay, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getThousandsSeparator, groupInteger, joinDecimalString, parseDecimalInput, splitDecimalString } from "./form/decimal-format.cjs";
28
- import { ColumnDef, ColumnValueKind, FieldMeta, MetaResponse, PaginationControl, RelationInfo, SearchIndexInfo, SortControl, TableActionsModel, TableDef, TableQueryState } from "./table/types.cjs";
29
32
  import { createTableDef } from "./table/create-table-def.cjs";
30
33
  import { NUMERIC_VALUE_KINDS, optionValue } from "./table/value-kind.cjs";
31
- import { ClientFactory, ClientFactoryOptions, TypedClientFactory, getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "./client-factory.cjs";
32
- import { MetaCacheEntry, MetaEntryOptions, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.cjs";
33
34
  import { escapeRegex, str } from "./shared/str.cjs";
34
35
  import { getColumn, getFilterableColumns, getSortableColumns } from "./table/column-resolver.cjs";
35
36
  import { navigateHrefFor } from "./table/navigate-href.cjs";
36
37
  import { TModelRoute, buildModelRoutes } from "./nav/model-routes.cjs";
37
38
  import { TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor } from "@atscript/db-client";
38
- export { type ClientFactory, type ClientFactoryOptions, type CloneUnwrap, type ColumnDef, type ColumnValueKind, type CreateFormDefOptions, type CurrencyDisplay, DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, type DecimalParts, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, type FieldMeta, type FieldResolver, type FormActionInfo, type FormArrayFieldDef, type FormDef, type FormDiffOptions, type FormDiffResult, type FormFieldChange, type FormFieldDef, type FormObjectFieldDef, type FormRebaseOptions, type FormRebaseResult, type FormTupleFieldDef, type FormUnionFieldDef, type FormUnionVariant, type FormatDecimalOptions, type GridSpanArgs, type GridSpec, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, type MeasurementInfo, type MetaCacheEntry, type MetaEntryOptions, type MetaResponse, NUMERIC_VALUE_KINDS, type PaginationControl, type RelationInfo, type ResolvedValueHelp, type SearchIndexInfo, type SortControl, StaticFieldResolver, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TFieldValidatorOptions, type TFormAction, type TFormEntryOptions, type TFormValidatorCallOptions, type TFormValueResolver, type TModelRoute, type TResolveOptions, type TableActionsModel, type TableDef, type TableQueryState, type TypedClientFactory, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, ValueHelpClient, type ValueHelpInfo, type ValueHelpResult, type ValueHelpSearchOptions, WF_ACTION_WITH_DATA, applyFormChanges, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, collectDirtyPaths, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createTableDef, deepClone, deepEqual, defaultResolver, deleteByPath, detectUnionVariant, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, mergeErrorMaps, navigateHrefFor, omitPaths, omitSkippedNavFields, onMetaCacheReset, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, validatorErrorsToMap, valueHelpDictPaths };
39
+ export { type ClientFactory, type ClientFactoryOptions, type CloneUnwrap, type ColumnDef, type ColumnValueKind, type CreateFormDefOptions, type CurrencyDisplay, DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, DEFAULT_BOOLEAN_LABELS, DEFAULT_COL_SPAN, DEFAULT_ROW_SPAN, type DecimalParts, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, type FieldMeta, type FieldResolver, type FormActionInfo, type FormArrayFieldDef, type FormDef, type FormDiffOptions, type FormDiffResult, type FormFieldChange, type FormFieldDef, type FormObjectFieldDef, type FormRebaseOptions, type FormRebaseResult, type FormTupleFieldDef, type FormUnionFieldDef, type FormUnionVariant, type FormValidator, type FormatDecimalOptions, type GridSpanArgs, type GridSpec, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, type MeasurementInfo, type MetaCacheEntry, type MetaEntryOptions, type MetaResponse, NUMERIC_VALUE_KINDS, type PaginationControl, type RelationInfo, type ResolvedValueHelp, type SearchIndexInfo, type SortControl, StaticFieldResolver, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TFieldValidatorOptions, type TFormAction, type TFormEntryOptions, type TFormValidatorCallOptions, type TFormValueResolver, type TModelRoute, type TResolveOptions, type TableActionsModel, type TableDef, type TableQueryState, type TypedClientFactory, UI_DICT_ATTR, UI_DICT_DESCR, UI_DICT_FILTERABLE, UI_DICT_LABEL, UI_DICT_SEARCHABLE, UI_DICT_SORTABLE, UI_FORM_ACTION, UI_FORM_ATTR, UI_FORM_AUTOCOMPLETE, UI_FORM_CLASSES, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, UI_FORM_FN_CLASSES, UI_FORM_FN_DESCRIPTION, UI_FORM_FN_DISABLED, UI_FORM_FN_HIDDEN, UI_FORM_FN_HINT, UI_FORM_FN_LABEL, UI_FORM_FN_OPTIONS, UI_FORM_FN_PLACEHOLDER, UI_FORM_FN_PREFIX, UI_FORM_FN_READONLY, UI_FORM_FN_STYLES, UI_FORM_FN_SUBMIT_DISABLED, UI_FORM_FN_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_FN_VALUE, UI_FORM_GRID_COL_SPAN, UI_FORM_GRID_ROW_SPAN, UI_FORM_HIDDEN, UI_FORM_HINT, UI_FORM_LABEL_SINGULAR, UI_FORM_OPTIONS, UI_FORM_ORDER, UI_FORM_PLACEHOLDER, UI_FORM_PREFIX, UI_FORM_PREFIX_ICON, UI_FORM_PREFIX_REF, UI_FORM_STYLES, UI_FORM_SUBMIT_TEXT, UI_FORM_SUFFIX, UI_FORM_SUFFIX_ICON, UI_FORM_SUFFIX_REF, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_NAV_GROUP, UI_NAV_HIDDEN, UI_NAV_ORDER, UI_TABLE_ATTR, UI_TABLE_CLASSES, UI_TABLE_COMPONENT, UI_TABLE_EXCLUDE, UI_TABLE_FN_ATTR, UI_TABLE_FN_CLASSES, UI_TABLE_FN_PREFIX, UI_TABLE_FN_STYLES, UI_TABLE_ORDER, UI_TABLE_SELECT_WITH, UI_TABLE_STYLES, UI_TABLE_TYPE, UI_TABLE_WIDTH, UI_TYPE, type UiT, type UiTextParams, type UiTexts, type UiTranslate, ValueHelpClient, type ValueHelpInfo, type ValueHelpResult, type ValueHelpSearchOptions, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, collectDirtyPaths, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createTableDef, createUiTexts, deepClone, deepEqual, defaultResolver, deleteByPath, detectUnionVariant, enforceScale, escapeRegex, extractFieldLiteralOptions, extractLiteralOptions, extractMeasurement, extractValueHelp, fetchDistinctValues, formatDecimalForDisplay, getByPath, getColumn, getCurrencyDecimals, getCurrencyDisplayParts, getDecimalSeparator, getDeclaredFormActions, getDefaultClientFactory, getDefaultValidatorPlugins, getFieldMeta, getFilterableColumns, getFormValidator, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, getResolver, getSortableColumns, getThousandsSeparator, getUiTexts, groupInteger, hasComputedAnnotations, hasFieldMeta, invalidateValueHelpCache, isArrayField, isContainerKind, isFieldHidden, isObjectField, isPathDirty, isPickerDeclined, isPureLiteralUnion, isTupleField, isUnionField, iteratePathAncestors, joinDecimalString, joinPath, mergeErrorMaps, navigateHrefFor, omitPaths, omitSkippedNavFields, onMetaCacheReset, optKey, optLabel, optionLabel, optionValue, parseColSpan, parseDecimalInput, parseRowSpan, parseStaticAttrs, parseStaticOptions, resetDefaultClientFactory, resetMetaCache, resetValueHelpCache, resolveAttrs, resolveFieldProp, resolveFormProp, resolveGridSpec, resolveOptions, resolveSingularLabel, resolveStatic, resolveValueHelp, retainMetaEntry, setByPath, setDefaultClientFactory, setDefaultValidatorPlugins, setMetaCacheIdentity, setMetaCacheMaxEntries, setResolver, setUiLocale, setValueHelpCacheTtl, splitDecimalString, str, unionVariantChanged, validatorErrorsToMap, valueHelpDictPaths };