@atscript/ui-fns 0.1.168 → 0.1.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +9 -2
- package/dist/index.d.mts +9 -2
- package/dist/index.mjs +3 -3
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -190,7 +190,7 @@ function buildFieldEntry(prop, baseScope, path, opts) {
|
|
|
190
190
|
...baseScope,
|
|
191
191
|
entry
|
|
192
192
|
};
|
|
193
|
-
entry.options = (0, _atscript_ui.resolveOptions)(prop, scope);
|
|
193
|
+
entry.options = (0, _atscript_ui.resolveOptions)(prop, scope, void 0, baseScope.t, opts?.modelT);
|
|
194
194
|
return scope;
|
|
195
195
|
}
|
|
196
196
|
//#endregion
|
|
@@ -246,7 +246,7 @@ function uiFnsValidatorPlugin() {
|
|
|
246
246
|
if (typeof fnStr !== "string") continue;
|
|
247
247
|
const result = compileValidatorFn(fnStr)(scope);
|
|
248
248
|
if (result !== true) {
|
|
249
|
-
ctx.error(t(typeof result === "string" ? result : "UI_VALIDATION_FAILED"));
|
|
249
|
+
ctx.error(t(typeof result === "string" ? result : "UI_VALIDATION_FAILED"), void 0, void 0, { code: _atscript_ui.UI_FORM_VALIDATE_ERROR_CODE });
|
|
250
250
|
if (container) ctx.validateAnnotatedType(def, value);
|
|
251
251
|
return false;
|
|
252
252
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldResolver, TFormEntryOptions, TResolveOptions, UiT } from "@atscript/ui";
|
|
1
|
+
import { FieldResolver, TFormEntryOptions, TResolveOptions, UiT, UserTextT } from "@atscript/ui";
|
|
2
2
|
import { TAtscriptAnnotatedType, TValidatorPlugin } from "@atscript/typescript/utils";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/types.d.ts
|
|
@@ -92,7 +92,14 @@ declare function compileValidatorFn(fnStr: string): (scope: TFnScope) => string
|
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/runtime/dynamic-resolver.d.ts
|
|
94
94
|
/** Options for buildFieldEntry — allows pre-resolved overrides. */
|
|
95
|
-
type TBuildFieldEntryOpts = Partial<Pick<TFieldEvaluated, "name" | "type" | "component" | "optional" | "disabled" | "hidden" | "readonly"
|
|
95
|
+
type TBuildFieldEntryOpts = Partial<Pick<TFieldEvaluated, "name" | "type" | "component" | "optional" | "disabled" | "hidden" | "readonly">> & {
|
|
96
|
+
/**
|
|
97
|
+
* Translates the texts the model declares (the option labels of `entry.options`): the app's
|
|
98
|
+
* model-text translator (`useAsModelTexts()()`). Omit for the source texts — a served type
|
|
99
|
+
* is translated already. The default boolean labels are worded with the scope's `t`.
|
|
100
|
+
*/
|
|
101
|
+
modelT?: UserTextT;
|
|
102
|
+
};
|
|
96
103
|
/**
|
|
97
104
|
* Dynamic field resolver — extends static resolution with `new Function` compilation
|
|
98
105
|
* for `ui.fn.*` annotation keys.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldResolver, TFormEntryOptions, TResolveOptions, UiT } from "@atscript/ui";
|
|
1
|
+
import { FieldResolver, TFormEntryOptions, TResolveOptions, UiT, UserTextT } from "@atscript/ui";
|
|
2
2
|
import { TAtscriptAnnotatedType, TValidatorPlugin } from "@atscript/typescript/utils";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/types.d.ts
|
|
@@ -92,7 +92,14 @@ declare function compileValidatorFn(fnStr: string): (scope: TFnScope) => string
|
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/runtime/dynamic-resolver.d.ts
|
|
94
94
|
/** Options for buildFieldEntry — allows pre-resolved overrides. */
|
|
95
|
-
type TBuildFieldEntryOpts = Partial<Pick<TFieldEvaluated, "name" | "type" | "component" | "optional" | "disabled" | "hidden" | "readonly"
|
|
95
|
+
type TBuildFieldEntryOpts = Partial<Pick<TFieldEvaluated, "name" | "type" | "component" | "optional" | "disabled" | "hidden" | "readonly">> & {
|
|
96
|
+
/**
|
|
97
|
+
* Translates the texts the model declares (the option labels of `entry.options`): the app's
|
|
98
|
+
* model-text translator (`useAsModelTexts()()`). Omit for the source texts — a served type
|
|
99
|
+
* is translated already. The default boolean labels are worded with the scope's `t`.
|
|
100
|
+
*/
|
|
101
|
+
modelT?: UserTextT;
|
|
102
|
+
};
|
|
96
103
|
/**
|
|
97
104
|
* Dynamic field resolver — extends static resolution with `new Function` compilation
|
|
98
105
|
* for `ui.fn.*` annotation keys.
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { META_READONLY, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, 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_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_HIDDEN, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_TABLE_FN_ATTR, UI_TABLE_FN_PREFIX, UI_TYPE, asArray, getFieldMeta, getUiTexts, isContainerKind, resolveFieldProp, resolveOptions, resolveStatic, setDefaultValidatorPlugins, setResolver } from "@atscript/ui";
|
|
1
|
+
import { META_READONLY, UI_FORM_COMPONENT, UI_FORM_DISABLED, UI_FORM_FN_ATTR, 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_SUBMIT_TEXT, UI_FORM_FN_TITLE, UI_FORM_HIDDEN, UI_FORM_TYPE, UI_FORM_VALIDATE, UI_FORM_VALIDATE_ERROR_CODE, UI_TABLE_FN_ATTR, UI_TABLE_FN_PREFIX, UI_TYPE, asArray, getFieldMeta, getUiTexts, isContainerKind, resolveFieldProp, resolveOptions, resolveStatic, setDefaultValidatorPlugins, setResolver } from "@atscript/ui";
|
|
2
2
|
import { FNPool } from "@prostojs/deserialize-fn";
|
|
3
3
|
//#region src/runtime/fn-compiler.ts
|
|
4
4
|
const pool = new FNPool();
|
|
@@ -190,7 +190,7 @@ function buildFieldEntry(prop, baseScope, path, opts) {
|
|
|
190
190
|
...baseScope,
|
|
191
191
|
entry
|
|
192
192
|
};
|
|
193
|
-
entry.options = resolveOptions(prop, scope);
|
|
193
|
+
entry.options = resolveOptions(prop, scope, void 0, baseScope.t, opts?.modelT);
|
|
194
194
|
return scope;
|
|
195
195
|
}
|
|
196
196
|
//#endregion
|
|
@@ -246,7 +246,7 @@ function uiFnsValidatorPlugin() {
|
|
|
246
246
|
if (typeof fnStr !== "string") continue;
|
|
247
247
|
const result = compileValidatorFn(fnStr)(scope);
|
|
248
248
|
if (result !== true) {
|
|
249
|
-
ctx.error(t(typeof result === "string" ? result : "UI_VALIDATION_FAILED"));
|
|
249
|
+
ctx.error(t(typeof result === "string" ? result : "UI_VALIDATION_FAILED"), void 0, void 0, { code: UI_FORM_VALIDATE_ERROR_CODE });
|
|
250
250
|
if (container) ctx.validateAnnotatedType(def, value);
|
|
251
251
|
return false;
|
|
252
252
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/ui-fns",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.170",
|
|
4
4
|
"description": "Dynamic fn-compiled field properties for @atscript/ui (opt-in, uses new Function)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@prostojs/deserialize-fn": "^0.0.6",
|
|
51
|
-
"@atscript/ui": "^0.1.
|
|
51
|
+
"@atscript/ui": "^0.1.170"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@atscript/core": "^0.2.
|
|
55
|
-
"@atscript/typescript": "^0.2.
|
|
54
|
+
"@atscript/core": "^0.2.11",
|
|
55
|
+
"@atscript/typescript": "^0.2.11",
|
|
56
56
|
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atscript/core": "^0.2.
|
|
60
|
-
"@atscript/typescript": "^0.2.
|
|
59
|
+
"@atscript/core": "^0.2.11",
|
|
60
|
+
"@atscript/typescript": "^0.2.11"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "vp pack",
|