@atscript/ui 0.1.167 → 0.1.169

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.
@@ -158,6 +158,7 @@ function createFieldValidator(prop, opts) {
158
158
  let cached;
159
159
  let options;
160
160
  const rootOfContainer = opts?.rootOnly === true && isContainerKind(prop.type.kind);
161
+ const skipNormalize = rootOfContainer && !prop.metadata.has("ui.form.validate");
161
162
  return (value, externalCtx) => {
162
163
  if (!cached) {
163
164
  options = { plugins: rootOfContainer ? [
@@ -167,7 +168,7 @@ function createFieldValidator(prop, opts) {
167
168
  ] : [serverManagedPlugin, ...defaultValidatorPlugins] };
168
169
  cached = new _atscript_typescript_utils.Validator(prop, options);
169
170
  }
170
- const judged = rootOfContainer ? value : (0, _atscript_typescript_utils.normalizeForType)(prop, value, options);
171
+ const judged = skipNormalize ? value : (0, _atscript_typescript_utils.normalizeForType)(prop, value, options);
171
172
  if (cached.validate(judged, true, externalCtx)) return true;
172
173
  const t = externalCtx?.t ?? opts?.t ?? require_ui_texts.getUiTexts().t;
173
174
  if (opts?.rootOnly) {
@@ -158,6 +158,7 @@ function createFieldValidator(prop, opts) {
158
158
  let cached;
159
159
  let options;
160
160
  const rootOfContainer = opts?.rootOnly === true && isContainerKind(prop.type.kind);
161
+ const skipNormalize = rootOfContainer && !prop.metadata.has("ui.form.validate");
161
162
  return (value, externalCtx) => {
162
163
  if (!cached) {
163
164
  options = { plugins: rootOfContainer ? [
@@ -167,7 +168,7 @@ function createFieldValidator(prop, opts) {
167
168
  ] : [serverManagedPlugin, ...defaultValidatorPlugins] };
168
169
  cached = new Validator(prop, options);
169
170
  }
170
- const judged = rootOfContainer ? value : normalizeForType(prop, value, options);
171
+ const judged = skipNormalize ? value : normalizeForType(prop, value, options);
171
172
  if (cached.validate(judged, true, externalCtx)) return true;
172
173
  const t = externalCtx?.t ?? opts?.t ?? getUiTexts().t;
173
174
  if (opts?.rootOnly) {
@@ -99,8 +99,24 @@ const activated = [];
99
99
  * ```
100
100
  */
101
101
  function setUiLocale(locale, translate) {
102
+ const changed = locale !== globalLocale;
102
103
  globalLocale = locale;
103
104
  globalTranslate = translate;
105
+ if (changed) for (const listener of localeListeners) listener();
106
+ }
107
+ const localeListeners = /* @__PURE__ */ new Set();
108
+ /**
109
+ * Runs `listener` whenever `setUiLocale` changes the browser-global locale
110
+ * (it is not reactive); returns the unsubscribe. For views that follow a
111
+ * locale switch without a remount.
112
+ *
113
+ * @internal Shared with the `@atscript/vue-*` packages.
114
+ */
115
+ function onUiLocaleChange(listener) {
116
+ localeListeners.add(listener);
117
+ return () => {
118
+ localeListeners.delete(listener);
119
+ };
104
120
  }
105
121
  /**
106
122
  * The texts code outside a component reads (definitions built from
@@ -132,4 +148,5 @@ function activateUiTexts(texts) {
132
148
  exports.activateUiTexts = activateUiTexts;
133
149
  exports.createUiTexts = createUiTexts;
134
150
  exports.getUiTexts = getUiTexts;
151
+ exports.onUiLocaleChange = onUiLocaleChange;
135
152
  exports.setUiLocale = setUiLocale;
@@ -61,6 +61,14 @@ declare function createUiTexts(opts: {
61
61
  * ```
62
62
  */
63
63
  declare function setUiLocale(locale: string | undefined, translate?: UiTranslate): void;
64
+ /**
65
+ * Runs `listener` whenever `setUiLocale` changes the browser-global locale
66
+ * (it is not reactive); returns the unsubscribe. For views that follow a
67
+ * locale switch without a remount.
68
+ *
69
+ * @internal Shared with the `@atscript/vue-*` packages.
70
+ */
71
+ declare function onUiLocaleChange(listener: () => void): () => void;
64
72
  /**
65
73
  * The texts code outside a component reads (definitions built from
66
74
  * metadata, table state): the browser-side app provider's when one is
@@ -78,4 +86,4 @@ declare function getUiTexts(): UiTexts;
78
86
  */
79
87
  declare function activateUiTexts(texts: UiTexts): () => void;
80
88
  //#endregion
81
- export { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, setUiLocale };
89
+ export { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, onUiLocaleChange, setUiLocale };
@@ -61,6 +61,14 @@ declare function createUiTexts(opts: {
61
61
  * ```
62
62
  */
63
63
  declare function setUiLocale(locale: string | undefined, translate?: UiTranslate): void;
64
+ /**
65
+ * Runs `listener` whenever `setUiLocale` changes the browser-global locale
66
+ * (it is not reactive); returns the unsubscribe. For views that follow a
67
+ * locale switch without a remount.
68
+ *
69
+ * @internal Shared with the `@atscript/vue-*` packages.
70
+ */
71
+ declare function onUiLocaleChange(listener: () => void): () => void;
64
72
  /**
65
73
  * The texts code outside a component reads (definitions built from
66
74
  * metadata, table state): the browser-side app provider's when one is
@@ -78,4 +86,4 @@ declare function getUiTexts(): UiTexts;
78
86
  */
79
87
  declare function activateUiTexts(texts: UiTexts): () => void;
80
88
  //#endregion
81
- export { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, setUiLocale };
89
+ export { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, onUiLocaleChange, setUiLocale };
@@ -99,8 +99,24 @@ const activated = [];
99
99
  * ```
100
100
  */
101
101
  function setUiLocale(locale, translate) {
102
+ const changed = locale !== globalLocale;
102
103
  globalLocale = locale;
103
104
  globalTranslate = translate;
105
+ if (changed) for (const listener of localeListeners) listener();
106
+ }
107
+ const localeListeners = /* @__PURE__ */ new Set();
108
+ /**
109
+ * Runs `listener` whenever `setUiLocale` changes the browser-global locale
110
+ * (it is not reactive); returns the unsubscribe. For views that follow a
111
+ * locale switch without a remount.
112
+ *
113
+ * @internal Shared with the `@atscript/vue-*` packages.
114
+ */
115
+ function onUiLocaleChange(listener) {
116
+ localeListeners.add(listener);
117
+ return () => {
118
+ localeListeners.delete(listener);
119
+ };
104
120
  }
105
121
  /**
106
122
  * The texts code outside a component reads (definitions built from
@@ -129,4 +145,4 @@ function activateUiTexts(texts) {
129
145
  };
130
146
  }
131
147
  //#endregion
132
- export { activateUiTexts, createUiTexts, getUiTexts, setUiLocale };
148
+ export { activateUiTexts, createUiTexts, getUiTexts, onUiLocaleChange, setUiLocale };
package/dist/index.cjs CHANGED
@@ -134,6 +134,7 @@ exports.createFieldValidator = require_validate.createFieldValidator;
134
134
  exports.createFormData = require_path_utils.createFormData;
135
135
  exports.createFormDef = require_create_form_def.createFormDef;
136
136
  exports.createFormValueResolver = require_path_utils.createFormValueResolver;
137
+ exports.createMetaClient = require_meta_cache.createMetaClient;
137
138
  exports.createTableDef = require_create_table_def.createTableDef;
138
139
  exports.createUiTexts = require_ui_texts.createUiTexts;
139
140
  exports.deepClone = require_clone.deepClone;
@@ -188,6 +189,7 @@ exports.navigateHrefFor = require_navigate_href.navigateHrefFor;
188
189
  exports.omitPaths = require_error_utils.omitPaths;
189
190
  exports.omitSkippedNavFields = require_skipped_nav.omitSkippedNavFields;
190
191
  exports.onMetaCacheReset = require_meta_cache.onMetaCacheReset;
192
+ exports.onUiLocaleChange = require_ui_texts.onUiLocaleChange;
191
193
  exports.optKey = require_resolve_options.optKey;
192
194
  exports.optLabel = require_resolve_options.optLabel;
193
195
  exports.optionLabel = require_resolve_options.optionLabel;
package/dist/index.d.cts CHANGED
@@ -6,8 +6,8 @@ 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
7
  import { ClientFactory, ClientFactoryOptions, TypedClientFactory, getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "./client-factory.cjs";
8
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";
9
+ import { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, onUiLocaleChange, setUiLocale } from "./i18n/ui-texts.cjs";
10
+ import { MetaCacheEntry, MetaEntryOptions, createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.cjs";
11
11
  import { ResolvedValueHelp, resetValueHelpCache, resolveValueHelp } from "./value-help/resolve.cjs";
12
12
  import { ValueHelpClient, ValueHelpResult, ValueHelpSearchOptions, invalidateValueHelpCache, setValueHelpCacheTtl } from "./value-help/value-help-client.cjs";
13
13
  import { valueHelpDictPaths } from "./value-help/dict-paths.cjs";
@@ -36,4 +36,4 @@ import { getColumn, getFilterableColumns, getSortableColumns } from "./table/col
36
36
  import { navigateHrefFor } from "./table/navigate-href.cjs";
37
37
  import { TModelRoute, buildModelRoutes } from "./nav/model-routes.cjs";
38
38
  import { TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor } from "@atscript/db-client";
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 };
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, createMetaClient, 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, onUiLocaleChange, 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 };
package/dist/index.d.mts CHANGED
@@ -6,8 +6,8 @@ import { FormActionInfo, getDeclaredFormActions } from "./form/form-actions.mjs"
6
6
  import { FieldResolver, StaticFieldResolver, TResolveOptions, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver } from "./shared/field-resolver.mjs";
7
7
  import { ClientFactory, ClientFactoryOptions, TypedClientFactory, getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "./client-factory.mjs";
8
8
  import { ColumnDef, ColumnValueKind, FieldMeta, MetaResponse, PaginationControl, RelationInfo, SearchIndexInfo, SortControl, TableActionsModel, TableDef, TableQueryState } from "./table/types.mjs";
9
- import { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, setUiLocale } from "./i18n/ui-texts.mjs";
10
- import { MetaCacheEntry, MetaEntryOptions, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.mjs";
9
+ import { UiT, UiTextParams, UiTexts, UiTranslate, activateUiTexts, createUiTexts, getUiTexts, onUiLocaleChange, setUiLocale } from "./i18n/ui-texts.mjs";
10
+ import { MetaCacheEntry, MetaEntryOptions, createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.mjs";
11
11
  import { ResolvedValueHelp, resetValueHelpCache, resolveValueHelp } from "./value-help/resolve.mjs";
12
12
  import { ValueHelpClient, ValueHelpResult, ValueHelpSearchOptions, invalidateValueHelpCache, setValueHelpCacheTtl } from "./value-help/value-help-client.mjs";
13
13
  import { valueHelpDictPaths } from "./value-help/dict-paths.mjs";
@@ -36,4 +36,4 @@ import { getColumn, getFilterableColumns, getSortableColumns } from "./table/col
36
36
  import { navigateHrefFor } from "./table/navigate-href.mjs";
37
37
  import { TModelRoute, buildModelRoutes } from "./nav/model-routes.mjs";
38
38
  import { TCrudOp, TCrudPermissions, TDbActionInfo, TDbActionIntent, TDbActionLevel, TDbActionProcessor } from "@atscript/db-client";
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 };
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, createMetaClient, 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, onUiLocaleChange, 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 };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DB_AMOUNT_CURRENCY, DB_AMOUNT_CURRENCY_REF, DB_COLUMN_PRECISION, DB_HTTP_PATH, DB_REL_FK, DB_UNIT, DB_UNIT_REF, EXPECT_MAX_LENGTH, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, 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, WF_ACTION_WITH_DATA } from "./shared/annotation-keys.mjs";
2
2
  import { isArrayField, isObjectField, isTupleField, isUnionField } from "./form/types.mjs";
3
3
  import { StaticFieldResolver, asArray, defaultResolver, getFieldMeta, getResolver, hasComputedAnnotations, hasFieldMeta, isFieldHidden, parseStaticAttrs, resolveAttrs, resolveFieldProp, resolveFormProp, resolveStatic, setResolver } from "./shared/field-resolver.mjs";
4
- import { activateUiTexts, createUiTexts, getUiTexts, setUiLocale } from "./i18n/ui-texts.mjs";
4
+ import { activateUiTexts, createUiTexts, getUiTexts, onUiLocaleChange, setUiLocale } from "./i18n/ui-texts.mjs";
5
5
  import { DEFAULT_BOOLEAN_LABELS, extractFieldLiteralOptions, extractLiteralOptions, isPureLiteralUnion } from "./value-help/extract-literals.mjs";
6
6
  import { extractValueHelp } from "./value-help/extract-ref.mjs";
7
7
  import { deepClone } from "./form/clone.mjs";
@@ -17,7 +17,7 @@ import { fetchDistinctValues, isPickerDeclined } from "./value-help/distinct-cli
17
17
  import { getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "./client-factory.mjs";
18
18
  import { extractMeasurement } from "./form/measurement.mjs";
19
19
  import { createTableDef } from "./table/create-table-def.mjs";
20
- import { getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.mjs";
20
+ import { createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries } from "./shared/meta-cache.mjs";
21
21
  import { resetValueHelpCache, resolveValueHelp } from "./value-help/resolve.mjs";
22
22
  import { FORM_ERROR_KEY, buildDescendantErrorCounts, iteratePathAncestors, mergeErrorMaps, omitPaths, validatorErrorsToMap } from "./form/error-utils.mjs";
23
23
  import { createFieldValidator, getDefaultValidatorPlugins, getFormValidator, isContainerKind, setDefaultValidatorPlugins } from "./form/validate.mjs";
@@ -33,4 +33,4 @@ import { NUMERIC_VALUE_KINDS, optionValue } from "./table/value-kind.mjs";
33
33
  import { getColumn, getFilterableColumns, getSortableColumns } from "./table/column-resolver.mjs";
34
34
  import { navigateHrefFor } from "./table/navigate-href.mjs";
35
35
  import { buildModelRoutes } from "./nav/model-routes.mjs";
36
- export { 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, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, NUMERIC_VALUE_KINDS, StaticFieldResolver, 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, 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 };
36
+ export { 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, EXPECT_MAX_LENGTH, FORM_ERROR_KEY, META_DEFAULT, META_DESCRIPTION, META_ID, META_LABEL, META_READONLY, META_REQUIRED, META_SENSITIVE, NUMERIC_VALUE_KINDS, StaticFieldResolver, 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, WF_ACTION_WITH_DATA, activateUiTexts, applyFormChanges, asArray, buildDescendantErrorCounts, buildFormDiff, buildFormRebase, buildGridClasses, buildModelRoutes, buildUnionVariants, collectDirtyPaths, createFieldValidator, createFormData, createFormDef, createFormValueResolver, createMetaClient, 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, onUiLocaleChange, 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 };
@@ -29,6 +29,20 @@ function cacheKey(url, locale) {
29
29
  return locale === void 0 ? url : `${url}\n${locale}`;
30
30
  }
31
31
  /**
32
+ * `factory`'s client for `url` in `locale`, as a cache entry gets it: asked
33
+ * for `metaStore: false` without a browser `window`, else for `metaKey`.
34
+ *
35
+ * @internal Shared with `@atscript/vue-table`.
36
+ */
37
+ function createMetaClient(url, factory, locale, metaKey) {
38
+ const clientOptions = {};
39
+ if (typeof window === "undefined") clientOptions.metaStore = false;
40
+ else if (metaKey) clientOptions.metaKey = metaKey;
41
+ if (locale !== void 0) clientOptions.locale = locale;
42
+ const f = factory ?? require_client_factory.getDefaultClientFactory();
43
+ return Object.keys(clientOptions).length > 0 ? f(url, clientOptions) : f(url);
44
+ }
45
+ /**
32
46
  * Get or create the cache entry for `url` in the UI locale of
33
47
  * `options.texts`. First caller's `factory` (and `options.metaKey`) seeds the
34
48
  * `Client`; subsequent callers reuse it. On `meta` rejection, the entry is
@@ -47,12 +61,7 @@ function getMetaEntry(url, factory, options) {
47
61
  mergeServedTexts(existing, texts, locale);
48
62
  return existing;
49
63
  }
50
- const clientOptions = {};
51
- if (!browser) clientOptions.metaStore = false;
52
- else if (options?.metaKey) clientOptions.metaKey = options.metaKey;
53
- if (locale !== void 0) clientOptions.locale = locale;
54
- const f = factory ?? require_client_factory.getDefaultClientFactory();
55
- const client = Object.keys(clientOptions).length > 0 ? f(url, clientOptions) : f(url);
64
+ const client = createMetaClient(url, factory, locale, options?.metaKey);
56
65
  const meta = client.meta().catch((err) => {
57
66
  if (cache.get(key) === entry) evict(key, entry);
58
67
  throw err;
@@ -272,6 +281,7 @@ function onMetaCacheReset(listener) {
272
281
  };
273
282
  }
274
283
  //#endregion
284
+ exports.createMetaClient = createMetaClient;
275
285
  exports.getMetaCacheIdentity = getMetaCacheIdentity;
276
286
  exports.getMetaEntry = getMetaEntry;
277
287
  exports.getMetaTableDef = getMetaTableDef;
@@ -60,6 +60,13 @@ interface MetaEntryOptions {
60
60
  */
61
61
  texts?: Pick<UiTexts, "locale" | "merge">;
62
62
  }
63
+ /**
64
+ * `factory`'s client for `url` in `locale`, as a cache entry gets it: asked
65
+ * for `metaStore: false` without a browser `window`, else for `metaKey`.
66
+ *
67
+ * @internal Shared with `@atscript/vue-table`.
68
+ */
69
+ declare function createMetaClient(url: string, factory: ClientFactory | undefined, locale: string | undefined, metaKey?: string): Client;
63
70
  /**
64
71
  * Get or create the cache entry for `url` in the UI locale of
65
72
  * `options.texts`. First caller's `factory` (and `options.metaKey`) seeds the
@@ -127,4 +134,4 @@ declare function getMetaCacheIdentity(): string | null | undefined;
127
134
  */
128
135
  declare function onMetaCacheReset(listener: () => void): () => void;
129
136
  //#endregion
130
- export { MetaCacheEntry, MetaEntryOptions, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries };
137
+ export { MetaCacheEntry, MetaEntryOptions, createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries };
@@ -60,6 +60,13 @@ interface MetaEntryOptions {
60
60
  */
61
61
  texts?: Pick<UiTexts, "locale" | "merge">;
62
62
  }
63
+ /**
64
+ * `factory`'s client for `url` in `locale`, as a cache entry gets it: asked
65
+ * for `metaStore: false` without a browser `window`, else for `metaKey`.
66
+ *
67
+ * @internal Shared with `@atscript/vue-table`.
68
+ */
69
+ declare function createMetaClient(url: string, factory: ClientFactory | undefined, locale: string | undefined, metaKey?: string): Client;
63
70
  /**
64
71
  * Get or create the cache entry for `url` in the UI locale of
65
72
  * `options.texts`. First caller's `factory` (and `options.metaKey`) seeds the
@@ -127,4 +134,4 @@ declare function getMetaCacheIdentity(): string | null | undefined;
127
134
  */
128
135
  declare function onMetaCacheReset(listener: () => void): () => void;
129
136
  //#endregion
130
- export { MetaCacheEntry, MetaEntryOptions, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries };
137
+ export { MetaCacheEntry, MetaEntryOptions, createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries };
@@ -29,6 +29,20 @@ function cacheKey(url, locale) {
29
29
  return locale === void 0 ? url : `${url}\n${locale}`;
30
30
  }
31
31
  /**
32
+ * `factory`'s client for `url` in `locale`, as a cache entry gets it: asked
33
+ * for `metaStore: false` without a browser `window`, else for `metaKey`.
34
+ *
35
+ * @internal Shared with `@atscript/vue-table`.
36
+ */
37
+ function createMetaClient(url, factory, locale, metaKey) {
38
+ const clientOptions = {};
39
+ if (typeof window === "undefined") clientOptions.metaStore = false;
40
+ else if (metaKey) clientOptions.metaKey = metaKey;
41
+ if (locale !== void 0) clientOptions.locale = locale;
42
+ const f = factory ?? getDefaultClientFactory();
43
+ return Object.keys(clientOptions).length > 0 ? f(url, clientOptions) : f(url);
44
+ }
45
+ /**
32
46
  * Get or create the cache entry for `url` in the UI locale of
33
47
  * `options.texts`. First caller's `factory` (and `options.metaKey`) seeds the
34
48
  * `Client`; subsequent callers reuse it. On `meta` rejection, the entry is
@@ -47,12 +61,7 @@ function getMetaEntry(url, factory, options) {
47
61
  mergeServedTexts(existing, texts, locale);
48
62
  return existing;
49
63
  }
50
- const clientOptions = {};
51
- if (!browser) clientOptions.metaStore = false;
52
- else if (options?.metaKey) clientOptions.metaKey = options.metaKey;
53
- if (locale !== void 0) clientOptions.locale = locale;
54
- const f = factory ?? getDefaultClientFactory();
55
- const client = Object.keys(clientOptions).length > 0 ? f(url, clientOptions) : f(url);
64
+ const client = createMetaClient(url, factory, locale, options?.metaKey);
56
65
  const meta = client.meta().catch((err) => {
57
66
  if (cache.get(key) === entry) evict(key, entry);
58
67
  throw err;
@@ -272,4 +281,4 @@ function onMetaCacheReset(listener) {
272
281
  };
273
282
  }
274
283
  //#endregion
275
- export { getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries };
284
+ export { createMetaClient, getMetaCacheIdentity, getMetaEntry, getMetaTableDef, onMetaCacheReset, resetMetaCache, retainMetaEntry, setMetaCacheIdentity, setMetaCacheMaxEntries };
@@ -11,10 +11,13 @@ const require_meta_cache = require("../shared/meta-cache.cjs");
11
11
  * retry performs a fresh fetch.
12
12
  *
13
13
  * `options.texts` — the app's UI texts (see `getMetaEntry`); the active ones
14
- * by default.
14
+ * by default. `options.clientFactory` — the factory the host (a form's or a
15
+ * table's `clientFactory`) builds its clients with: it seeds the client when
16
+ * this call creates the entry for the URL and locale (default: the app-wide
17
+ * one). Since 0.1.168.
15
18
  */
16
19
  function resolveValueHelp(url, options) {
17
- const entry = require_meta_cache.getMetaEntry(url, void 0, options);
20
+ const entry = require_meta_cache.getMetaEntry(url, options?.clientFactory, { texts: options?.texts });
18
21
  if (entry.resolved) return entry.resolved;
19
22
  entry.resolved = Promise.all([entry.meta, entry.type]).then(([meta, type]) => buildResolved(url, meta, type));
20
23
  return entry.resolved;
@@ -1,3 +1,4 @@
1
+ import { ClientFactory } from "../client-factory.cjs";
1
2
  import { MetaEntryOptions } from "../shared/meta-cache.cjs";
2
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
3
4
 
@@ -27,9 +28,14 @@ interface ResolvedValueHelp {
27
28
  * retry performs a fresh fetch.
28
29
  *
29
30
  * `options.texts` — the app's UI texts (see `getMetaEntry`); the active ones
30
- * by default.
31
+ * by default. `options.clientFactory` — the factory the host (a form's or a
32
+ * table's `clientFactory`) builds its clients with: it seeds the client when
33
+ * this call creates the entry for the URL and locale (default: the app-wide
34
+ * one). Since 0.1.168.
31
35
  */
32
- declare function resolveValueHelp(url: string, options?: Pick<MetaEntryOptions, "texts">): Promise<ResolvedValueHelp>;
36
+ declare function resolveValueHelp(url: string, options?: Pick<MetaEntryOptions, "texts"> & {
37
+ clientFactory?: ClientFactory;
38
+ }): Promise<ResolvedValueHelp>;
33
39
  /** Thin alias over `resetMetaCache` — retained so existing test code keeps working. */
34
40
  declare function resetValueHelpCache(): void;
35
41
  //#endregion
@@ -1,3 +1,4 @@
1
+ import { ClientFactory } from "../client-factory.mjs";
1
2
  import { MetaEntryOptions } from "../shared/meta-cache.mjs";
2
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
3
4
 
@@ -27,9 +28,14 @@ interface ResolvedValueHelp {
27
28
  * retry performs a fresh fetch.
28
29
  *
29
30
  * `options.texts` — the app's UI texts (see `getMetaEntry`); the active ones
30
- * by default.
31
+ * by default. `options.clientFactory` — the factory the host (a form's or a
32
+ * table's `clientFactory`) builds its clients with: it seeds the client when
33
+ * this call creates the entry for the URL and locale (default: the app-wide
34
+ * one). Since 0.1.168.
31
35
  */
32
- declare function resolveValueHelp(url: string, options?: Pick<MetaEntryOptions, "texts">): Promise<ResolvedValueHelp>;
36
+ declare function resolveValueHelp(url: string, options?: Pick<MetaEntryOptions, "texts"> & {
37
+ clientFactory?: ClientFactory;
38
+ }): Promise<ResolvedValueHelp>;
33
39
  /** Thin alias over `resetMetaCache` — retained so existing test code keeps working. */
34
40
  declare function resetValueHelpCache(): void;
35
41
  //#endregion
@@ -11,10 +11,13 @@ import { getMetaEntry, resetMetaCache } from "../shared/meta-cache.mjs";
11
11
  * retry performs a fresh fetch.
12
12
  *
13
13
  * `options.texts` — the app's UI texts (see `getMetaEntry`); the active ones
14
- * by default.
14
+ * by default. `options.clientFactory` — the factory the host (a form's or a
15
+ * table's `clientFactory`) builds its clients with: it seeds the client when
16
+ * this call creates the entry for the URL and locale (default: the app-wide
17
+ * one). Since 0.1.168.
15
18
  */
16
19
  function resolveValueHelp(url, options) {
17
- const entry = getMetaEntry(url, void 0, options);
20
+ const entry = getMetaEntry(url, options?.clientFactory, { texts: options?.texts });
18
21
  if (entry.resolved) return entry.resolved;
19
22
  entry.resolved = Promise.all([entry.meta, entry.type]).then(([meta, type]) => buildResolved(url, meta, type));
20
23
  return entry.resolved;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/ui",
3
- "version": "0.1.167",
3
+ "version": "0.1.169",
4
4
  "description": "Framework-agnostic runtime for form and table definitions from atscript annotated types",
5
5
  "keywords": [
6
6
  "annotations",
@@ -52,20 +52,20 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@atscript/db-client": "^0.1.171"
55
+ "@atscript/db-client": "^0.1.174"
56
56
  },
57
57
  "devDependencies": {
58
- "@atscript/core": "^0.2.8",
59
- "@atscript/db": "^0.1.171",
60
- "@atscript/typescript": "^0.2.8",
58
+ "@atscript/core": "^0.2.9",
59
+ "@atscript/db": "^0.1.174",
60
+ "@atscript/typescript": "^0.2.9",
61
61
  "@uniqu/core": "^0.2.1",
62
- "unplugin-atscript": "^0.2.8",
62
+ "unplugin-atscript": "^0.2.9",
63
63
  "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14"
64
64
  },
65
65
  "peerDependencies": {
66
- "@atscript/core": "^0.2.8",
67
- "@atscript/db": "^0.1.171",
68
- "@atscript/typescript": "^0.2.8"
66
+ "@atscript/core": "^0.2.9",
67
+ "@atscript/db": "^0.1.174",
68
+ "@atscript/typescript": "^0.2.9"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "vp pack",