@resistdesign/voltra 3.0.0-alpha.24 → 3.0.0-alpha.26

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.
@@ -1,4 +1,4 @@
1
- import type { AuthInfo, CORSPatter, RouteAuthConfig, RouteMap } from "../Router/Types";
1
+ import type { AuthInfo, CORSPattern, RouteAuthConfig, RouteMap } from "../Router/Types";
2
2
  import type { DataItemDBDriver, DataItemDBDriverConfig, ItemRelationshipDBDriver } from "../ORM/drivers/common/Types";
3
3
  import type { TypeInfoDataItem, TypeInfoMap } from "../../common/TypeParsing/TypeInfo";
4
4
  import type { TypeInfoORMDACConfig, TypeInfoORMIndexingConfig } from "../ORM/TypeInfoORMService";
@@ -53,7 +53,7 @@ export type DBXRuntimeConfig = {
53
53
  /**
54
54
  * Allowed origins used to generate CORS headers.
55
55
  */
56
- allowedOrigins?: CORSPatter[];
56
+ allowedOrigins?: CORSPattern[];
57
57
  /**
58
58
  * Optional DAC configuration (excluding accessing role).
59
59
  */
@@ -86,7 +86,7 @@ export type DBXRuntime = {
86
86
  /**
87
87
  * Allowed origins for CORS headers.
88
88
  */
89
- allowedOrigins: CORSPatter[];
89
+ allowedOrigins: CORSPattern[];
90
90
  /**
91
91
  * Driver resolver for item types.
92
92
  */
@@ -28,7 +28,7 @@ export * from "./exact/ExactDdb";
28
28
  export * from "./exact/ExactIndex";
29
29
  export * from "./exact/ExactS3";
30
30
  export * from "./fulltext/FullTextMemoryBackend";
31
- export { FullTextDdbBackend, FullTextDdbWriter, type BatchGetItemInput, type BatchGetItemOutput, type BatchWriteItemInput, type BatchWriteItemOutput, type FullTextTableNames, type GetItemInput, type GetItemOutput, type KeysAndAttributes, type QueryInput, type QueryOutput, } from "./fulltext/FullTextDdbBackend";
31
+ export { FullTextDdbBackend, FullTextDdbWriter, type FullTextTableNames, } from "./fulltext/FullTextDdbBackend";
32
32
  export * from "./fulltext/Schema";
33
33
  export * from "./lossy/LossyDdb";
34
34
  export * from "./lossy/LossyIndex";
@@ -1,2 +1,12 @@
1
1
  export * from "./Types";
2
2
  export * from "./SupportedTypeInfoORMDBDrivers";
3
+ /**
4
+ * @category api
5
+ * @group Type Dependencies
6
+ */
7
+ export type { ListItemsConfig, ListItemsResults, } from "../../../../common/SearchTypes";
8
+ /**
9
+ * @category api
10
+ * @group Type Dependencies
11
+ */
12
+ export type { TypeInfoDataItem, TypeInfoPack, } from "../../../../common/TypeParsing/TypeInfo";
@@ -5,3 +5,18 @@ export * from "./InMemoryItemRelationshipDBDriver";
5
5
  export * from "./InMemoryFileItemDBDriver";
6
6
  export * from "./IndexingRelationshipDriver";
7
7
  export * from "./common";
8
+ /**
9
+ * @category api
10
+ * @group Type Dependencies
11
+ */
12
+ export type { ListRelationshipsConfig, SearchCriteria, } from "../../../common/SearchTypes";
13
+ /**
14
+ * @category api
15
+ * @group Type Dependencies
16
+ */
17
+ export type { TypeInfoMap, } from "../../../common/TypeParsing/TypeInfo";
18
+ /**
19
+ * @category api
20
+ * @group Type Dependencies
21
+ */
22
+ export type { S3SpecificConfig, } from "./S3FileItemDBDriver/ConfigTypes";
@@ -5,3 +5,29 @@ export * from "./drivers";
5
5
  export * from "./TypeInfoORMService";
6
6
  export * from "./DACUtils";
7
7
  export * from "./ORMRouteMap";
8
+ /**
9
+ * @category api
10
+ * @group Type Dependencies
11
+ */
12
+ export type { DeleteRelationshipResults, ORMOperation, RelationshipOperation, TypeInfoORMAPI, TypeInfoORMContext, } from "../../common/TypeInfoORM/Types";
13
+ /**
14
+ * @category api
15
+ * @group Type Dependencies
16
+ */
17
+ export type { LiteralValue, TypeInfo, TypeInfoField, TypeOperation, } from "../../common/TypeParsing/TypeInfo";
18
+ /**
19
+ * @category api
20
+ * @group Type Dependencies
21
+ */
22
+ export type { CustomTypeInfoFieldValidatorMap, TypeInfoValidationResults, } from "../../common/TypeParsing/Validation";
23
+ /**
24
+ * @category api
25
+ * @group Type Dependencies
26
+ */
27
+ export type { BaseDACRole, DACAccessResult, DACConstraint, DACDataItemResourceAccessResultMap, DACRole, } from "../DataAccessControl";
28
+ export { DACConstraintType } from "../DataAccessControl";
29
+ /**
30
+ * @category api
31
+ * @group Type Dependencies
32
+ */
33
+ export type { AuthInfo, NormalizedCloudFunctionEventData, Route, RouteAuthConfig, RouteHandler, RouteMap, } from "../Router/Types";
@@ -1,4 +1,4 @@
1
- import { CORSPatter } from "./Types";
1
+ import { CORSPattern } from "./Types";
2
2
  /**
3
3
  * Check origin equality against an allowed string.
4
4
  * @returns True when the origin exactly matches the string.
@@ -37,7 +37,7 @@ origin?: string,
37
37
  /**
38
38
  * Allowed origin matcher (string equality or regex test).
39
39
  */
40
- corsPattern?: CORSPatter) => boolean;
40
+ corsPattern?: CORSPattern) => boolean;
41
41
  /**
42
42
  * Resolve the origin if it is allowed by the CORS patterns.
43
43
  * @returns The origin if allowed, otherwise an empty string.
@@ -50,7 +50,7 @@ origin?: string,
50
50
  /**
51
51
  * Allowed origin matchers to check.
52
52
  */
53
- corsPatterns?: CORSPatter[]) => string;
53
+ corsPatterns?: CORSPattern[]) => string;
54
54
  /**
55
55
  * Build CORS response headers for a given origin and allow list.
56
56
  * @returns CORS headers for the response.
@@ -63,4 +63,4 @@ origin?: string,
63
63
  /**
64
64
  * Allowed origin matchers to check.
65
65
  */
66
- corsPatterns?: CORSPatter[]) => Record<string, string>;
66
+ corsPatterns?: CORSPattern[]) => Record<string, string>;
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * A pattern for a CORS origin.
3
3
  * */
4
- export type CORSPatter = string | RegExp;
4
+ export type CORSPattern = string | RegExp;
5
+ export type CORSPatter = CORSPattern;
5
6
  /**
6
7
  * User authentication information.
7
8
  * Typically, from Cognito.
@@ -134,4 +135,4 @@ export type CloudFunctionEventTransformer = (event: any) => NormalizedCloudFunct
134
135
  * @param debug When true, log handler inputs and outputs.
135
136
  * @returns Cloud function response object.
136
137
  */
137
- export type CloudFunctionEventRouter = (event: any, eventTransformer: CloudFunctionEventTransformer, routeMap: RouteMap, allowedOrigins: CORSPatter[], errorShouldBeExposedToClient?: (error: unknown) => boolean, debug?: boolean) => Promise<CloudFunctionResponse>;
138
+ export type CloudFunctionEventRouter = (event: any, eventTransformer: CloudFunctionEventTransformer, routeMap: RouteMap, allowedOrigins: CORSPattern[], errorShouldBeExposedToClient?: (error: unknown) => boolean, debug?: boolean) => Promise<CloudFunctionResponse>;
@@ -9,3 +9,8 @@ export * from "./resolveSuite";
9
9
  export * from "./createAutoField";
10
10
  export * from "./createFormRenderer";
11
11
  export * from "./mergeSuites";
12
+ /**
13
+ * @category app
14
+ * @group Type Dependencies
15
+ */
16
+ export type { LiteralValue, TypeInfoDataItem, TypeInfoField, } from "../../../common/TypeParsing/TypeInfo";
@@ -66,7 +66,7 @@ export type CustomTypeActionPayload = {
66
66
  /**
67
67
  * Context passed to field renderers.
68
68
  */
69
- export type FieldRenderContext = {
69
+ export type FieldRenderContext<RenderOutput = unknown> = {
70
70
  /** Type info describing the field to render. */
71
71
  field: TypeInfoField;
72
72
  /** Key that identifies the field in the form values. */
@@ -97,11 +97,22 @@ export type FieldRenderContext = {
97
97
  onRelationAction?: (payload: RelationActionPayload) => void;
98
98
  /** Optional callback for custom type actions. */
99
99
  onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
100
+ /** Render any field with the same dispatch rules as the parent AutoField call. */
101
+ renderField: (input: {
102
+ field: TypeInfoField;
103
+ fieldKey: string;
104
+ value: FieldValue | undefined;
105
+ onChange: (value: FieldValue) => void;
106
+ error?: string;
107
+ disabled?: boolean;
108
+ onRelationAction?: (payload: RelationActionPayload) => void;
109
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
110
+ }) => RenderOutput;
100
111
  };
101
112
  /**
102
113
  * Renderer function for a single field kind.
103
114
  */
104
- export type FieldRenderer<RenderOutput = unknown> = (context: FieldRenderContext) => RenderOutput;
115
+ export type FieldRenderer<RenderOutput = unknown> = (context: FieldRenderContext<RenderOutput>) => RenderOutput;
105
116
  /**
106
117
  * Optional primitive component contract for suites.
107
118
  */
@@ -8,3 +8,8 @@ export type { ComponentSuite, FieldKind, FieldRenderContext, FieldRenderer, Fiel
8
8
  export { createAutoField, createFormRenderer, getFieldKind, mergeSuites, resolveSuite, withRendererOverride, } from "./core";
9
9
  export * from "./Engine";
10
10
  export * from "./UI";
11
+ /**
12
+ * @category app
13
+ * @group Type Dependencies
14
+ */
15
+ export type { LiteralValue, TypeInfo, TypeInfoDataItem, TypeInfoField, TypeOperation, } from "../../common/TypeParsing/TypeInfo";
package/app/index.js CHANGED
@@ -1473,7 +1473,7 @@ var resolveSuite = (overrides, fallback) => {
1473
1473
 
1474
1474
  // src/app/forms/core/createAutoField.ts
1475
1475
  var createAutoField = (suite) => {
1476
- return (props) => {
1476
+ const renderField = (props) => {
1477
1477
  const { field, fieldKey, value, onChange, error, disabled } = props;
1478
1478
  const { tags } = field;
1479
1479
  const context = {
@@ -1491,11 +1491,13 @@ var createAutoField = (suite) => {
1491
1491
  allowCustomSelection: tags?.allowCustomSelection,
1492
1492
  customType: tags?.customType,
1493
1493
  onRelationAction: props.onRelationAction,
1494
- onCustomTypeAction: props.onCustomTypeAction
1494
+ onCustomTypeAction: props.onCustomTypeAction,
1495
+ renderField
1495
1496
  };
1496
1497
  const kind = getFieldKind(field);
1497
1498
  return suite.renderers[kind](context);
1498
1499
  };
1500
+ return renderField;
1499
1501
  };
1500
1502
 
1501
1503
  // src/app/forms/core/createFormRenderer.ts
@@ -22,3 +22,18 @@ export * from "./UniversalRouteAdapter";
22
22
  export * from "./Service";
23
23
  export * from "./TypeInfoORMAPIUtils";
24
24
  export * from "./TypeInfoORMClient";
25
+ /**
26
+ * @category app
27
+ * @group Type Dependencies
28
+ */
29
+ export type { ListItemsConfig, ListItemsResults, ListRelationshipsConfig, } from "../../common/SearchTypes";
30
+ /**
31
+ * @category app
32
+ * @group Type Dependencies
33
+ */
34
+ export type { DeleteRelationshipResults, TypeInfoORMAPIRoutePaths, TypeInfoORMClientAPI, TypeInfoORMServiceError, } from "../../common/TypeInfoORM/Types";
35
+ /**
36
+ * @category app
37
+ * @group Type Dependencies
38
+ */
39
+ export type { TypeInfoDataItem, } from "../../common/TypeParsing/TypeInfo";
@@ -1 +1,6 @@
1
1
  export * from "./ItemRelationshipValidation";
2
+ /**
3
+ * @category common
4
+ * @group Type Dependencies
5
+ */
6
+ export type { TypeInfoValidationResults, } from "../TypeParsing/Validation";
@@ -12,7 +12,7 @@ import { TypeInfoDataItem, TypeOperation } from "../TypeParsing/TypeInfo";
12
12
  * */
13
13
  export declare const ITEM_RELATIONSHIP_DAC_RESOURCE_NAME = "TYPE_INFO_ORM_ITEM_RELATIONSHIP";
14
14
  /**
15
- * A set of possible operations for a {@link ItemRelationshipInfo}.
15
+ * A set of possible operations for an item relationship record.
16
16
  * */
17
17
  export declare enum RelationshipOperation {
18
18
  /**
@@ -1 +1,11 @@
1
1
  export * from "./Types";
2
+ /**
3
+ * @category common
4
+ * @group Type Dependencies
5
+ */
6
+ export type { ListItemsConfig, ListItemsResults, ListRelationshipsConfig, } from "../SearchTypes";
7
+ /**
8
+ * @category common
9
+ * @group Type Dependencies
10
+ */
11
+ export type { TypeInfoDataItem, TypeOperation, } from "../TypeParsing/TypeInfo";
@@ -3,38 +3,31 @@
3
3
  *
4
4
  * React Native primitives for the form generation system.
5
5
  */
6
+ import { Text, View } from "react-native";
6
7
  /**
7
8
  * Wrapper for grouped field content.
8
9
  */
9
10
  export declare const FieldWrapper: (props: {
10
11
  children?: React.ReactNode;
11
- }) => import("react").CElement<{}, import("react").Component<{}, any, any>>;
12
+ }) => import("react").CElement<import("react-native").ViewProps, View>;
12
13
  /**
13
14
  * Inline error message renderer.
14
15
  */
15
16
  export declare const ErrorMessage: ({ children }: {
16
17
  children: React.ReactNode;
17
- }) => import("react").CElement<{
18
- style: {
19
- color: string;
20
- };
21
- }, import("react").Component<{
22
- style: {
23
- color: string;
24
- };
25
- }, any, any>>;
18
+ }) => import("react").CElement<import("react-native").TextProps, Text>;
26
19
  /**
27
20
  * Container for array field items.
28
21
  */
29
22
  export declare const ArrayContainer: (props: {
30
23
  children?: React.ReactNode;
31
- }) => import("react").CElement<{}, import("react").Component<{}, any, any>>;
24
+ }) => import("react").CElement<import("react-native").ViewProps, View>;
32
25
  /**
33
26
  * Wrapper for an individual array item row.
34
27
  */
35
28
  export declare const ArrayItemWrapper: (props: {
36
29
  children?: React.ReactNode;
37
- }) => import("react").CElement<{}, import("react").Component<{}, any, any>>;
30
+ }) => import("react").CElement<import("react-native").ViewProps, View>;
38
31
  /**
39
32
  * Minimal button primitive.
40
33
  */
@@ -42,7 +35,4 @@ export declare const Button: ({ children, disabled, onPress, }: {
42
35
  children?: React.ReactNode;
43
36
  disabled?: boolean;
44
37
  onPress?: () => void;
45
- }) => import("react").FunctionComponentElement<{
46
- onPress: (() => void) | undefined;
47
- disabled: boolean | undefined;
48
- }>;
38
+ }) => import("react").FunctionComponentElement<import("react-native").PressableProps & import("react").RefAttributes<View>>;
package/native/index.js CHANGED
@@ -1,41 +1,8 @@
1
1
  import { createContext, createElement, useMemo, useEffect, useState, useCallback } from 'react';
2
+ import { View, Text, Pressable, TextInput, Switch, Platform } from 'react-native';
2
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
4
 
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
-
11
- // src/app/forms/core/getFieldKind.ts
12
- var hasSelectableValues = (field) => {
13
- const possibleValues = field.possibleValues ?? [];
14
- return possibleValues.some(
15
- (value) => typeof value === "string" || typeof value === "number"
16
- );
17
- };
18
- var getFieldKind = (field) => {
19
- if (field.typeReference) {
20
- return field.array ? "relation_array" : "relation_single";
21
- }
22
- if (field.tags?.customType) {
23
- return field.array ? "custom_array" : "custom_single";
24
- }
25
- if (field.array) {
26
- return "array";
27
- }
28
- if (hasSelectableValues(field)) {
29
- return "enum_select";
30
- }
31
- if (field.type === "boolean") {
32
- return "boolean";
33
- }
34
- if (field.type === "number") {
35
- return "number";
36
- }
37
- return "string";
38
- };
5
+ // src/native/forms/suite.ts
39
6
 
40
7
  // src/app/forms/core/resolveSuite.ts
41
8
  var fieldKinds = [
@@ -73,9 +40,38 @@ var resolveSuite = (overrides, fallback) => {
73
40
  };
74
41
  };
75
42
 
43
+ // src/app/forms/core/getFieldKind.ts
44
+ var hasSelectableValues = (field) => {
45
+ const possibleValues = field.possibleValues ?? [];
46
+ return possibleValues.some(
47
+ (value) => typeof value === "string" || typeof value === "number"
48
+ );
49
+ };
50
+ var getFieldKind = (field) => {
51
+ if (field.typeReference) {
52
+ return field.array ? "relation_array" : "relation_single";
53
+ }
54
+ if (field.tags?.customType) {
55
+ return field.array ? "custom_array" : "custom_single";
56
+ }
57
+ if (field.array) {
58
+ return "array";
59
+ }
60
+ if (hasSelectableValues(field)) {
61
+ return "enum_select";
62
+ }
63
+ if (field.type === "boolean") {
64
+ return "boolean";
65
+ }
66
+ if (field.type === "number") {
67
+ return "number";
68
+ }
69
+ return "string";
70
+ };
71
+
76
72
  // src/app/forms/core/createAutoField.ts
77
73
  var createAutoField = (suite) => {
78
- return (props) => {
74
+ const renderField = (props) => {
79
75
  const { field, fieldKey, value, onChange, error, disabled } = props;
80
76
  const { tags } = field;
81
77
  const context = {
@@ -93,11 +89,13 @@ var createAutoField = (suite) => {
93
89
  allowCustomSelection: tags?.allowCustomSelection,
94
90
  customType: tags?.customType,
95
91
  onRelationAction: props.onRelationAction,
96
- onCustomTypeAction: props.onCustomTypeAction
92
+ onCustomTypeAction: props.onCustomTypeAction,
93
+ renderField
97
94
  };
98
95
  const kind = getFieldKind(field);
99
96
  return suite.renderers[kind](context);
100
97
  };
98
+ return renderField;
101
99
  };
102
100
 
103
101
  // src/app/forms/core/createFormRenderer.ts
@@ -112,21 +110,16 @@ var createFormRenderer = (options) => {
112
110
  suite: resolvedSuite
113
111
  };
114
112
  };
115
- var getNative = () => __require("react-native");
116
113
  var FieldWrapper = (props) => {
117
- const { View } = getNative();
118
114
  return createElement(View, null, props.children);
119
115
  };
120
116
  var ErrorMessage = ({ children }) => {
121
- const { Text } = getNative();
122
117
  return createElement(Text, { style: { color: "#AA0000" } }, children);
123
118
  };
124
119
  var ArrayContainer = (props) => {
125
- const { View } = getNative();
126
120
  return createElement(View, null, props.children);
127
121
  };
128
122
  var ArrayItemWrapper = (props) => {
129
- const { View } = getNative();
130
123
  return createElement(View, null, props.children);
131
124
  };
132
125
  var Button = ({
@@ -134,7 +127,6 @@ var Button = ({
134
127
  disabled,
135
128
  onPress
136
129
  }) => {
137
- const { Pressable, Text } = getNative();
138
130
  return createElement(
139
131
  Pressable,
140
132
  { onPress, disabled },
@@ -143,7 +135,6 @@ var Button = ({
143
135
  };
144
136
 
145
137
  // src/native/forms/suite.ts
146
- var getNative2 = () => __require("react-native");
147
138
  var createArrayItemField = (field) => ({
148
139
  ...field,
149
140
  array: false,
@@ -164,7 +155,6 @@ var formatCustomValue = (val) => {
164
155
  return JSON.stringify(val, null, 2);
165
156
  };
166
157
  var renderRelationSingle = (context) => {
167
- const { Text } = getNative2();
168
158
  const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
169
159
  return createElement(
170
160
  FieldWrapper,
@@ -189,7 +179,6 @@ var renderRelationSingle = (context) => {
189
179
  );
190
180
  };
191
181
  var renderRelationArray = (context) => {
192
- const { Text } = getNative2();
193
182
  const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
194
183
  return createElement(
195
184
  FieldWrapper,
@@ -214,7 +203,6 @@ var renderRelationArray = (context) => {
214
203
  );
215
204
  };
216
205
  var renderCustomSingle = (context) => {
217
- const { Text } = getNative2();
218
206
  const { field, fieldKey, label, required, disabled, error } = context;
219
207
  const customType = field.tags?.customType;
220
208
  const onCustomTypeAction = context.onCustomTypeAction;
@@ -242,7 +230,6 @@ var renderCustomSingle = (context) => {
242
230
  );
243
231
  };
244
232
  var renderCustomArray = (context) => {
245
- const { Text, View } = getNative2();
246
233
  const { field, fieldKey, label, required, disabled, error } = context;
247
234
  const customType = field.tags?.customType;
248
235
  const onCustomTypeAction = context.onCustomTypeAction;
@@ -316,9 +303,7 @@ var renderCustomArray = (context) => {
316
303
  error ? createElement(ErrorMessage, null, error) : null
317
304
  );
318
305
  };
319
- var autoFieldRenderer;
320
306
  var renderArray = (context) => {
321
- const { Text, View } = getNative2();
322
307
  const { field, fieldKey, label, required, disabled, error } = context;
323
308
  const itemField = createArrayItemField(field);
324
309
  const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
@@ -336,7 +321,7 @@ var renderArray = (context) => {
336
321
  createElement(
337
322
  View,
338
323
  { style: { flex: 1 } },
339
- autoFieldRenderer({
324
+ context.renderField({
340
325
  field: itemField,
341
326
  fieldKey: `${fieldKey}[${index}]`,
342
327
  value: item,
@@ -381,7 +366,6 @@ var renderArray = (context) => {
381
366
  );
382
367
  };
383
368
  var renderString = (context) => {
384
- const { Text, TextInput } = getNative2();
385
369
  const { label, required, disabled, error } = context;
386
370
  return createElement(
387
371
  FieldWrapper,
@@ -397,7 +381,6 @@ var renderString = (context) => {
397
381
  );
398
382
  };
399
383
  var renderNumber = (context) => {
400
- const { Text, TextInput } = getNative2();
401
384
  const { label, required, disabled, error } = context;
402
385
  return createElement(
403
386
  FieldWrapper,
@@ -414,7 +397,6 @@ var renderNumber = (context) => {
414
397
  );
415
398
  };
416
399
  var renderBoolean = (context) => {
417
- const { Text, View, Switch } = getNative2();
418
400
  const { label, disabled, error } = context;
419
401
  return createElement(
420
402
  FieldWrapper,
@@ -433,7 +415,6 @@ var renderBoolean = (context) => {
433
415
  );
434
416
  };
435
417
  var renderEnumSelect = (context) => {
436
- const { Text, View } = getNative2();
437
418
  const { field, label, required, disabled, error } = context;
438
419
  const selectableValues = getSelectableValues(context.possibleValues) ?? [];
439
420
  return createElement(
@@ -464,7 +445,6 @@ var FormRoot = ({
464
445
  children,
465
446
  onSubmit
466
447
  }) => {
467
- const { Platform, View } = getNative2();
468
448
  if (Platform?.OS === "web") {
469
449
  return createElement(
470
450
  "form",
@@ -502,16 +482,13 @@ var nativeSuite = {
502
482
  FormRoot,
503
483
  FieldWrapper,
504
484
  ErrorMessage,
505
- Label: ({ children }) => {
506
- const { Text } = getNative2();
507
- return createElement(Text, null, children);
508
- },
485
+ Label: ({ children }) => createElement(Text, null, children),
509
486
  Button: SuiteButton
510
487
  }
511
488
  };
512
- var resolvedNativeSuite = resolveSuite(void 0, nativeSuite);
513
- autoFieldRenderer = createAutoField(resolvedNativeSuite);
514
- var nativeAutoField = autoFieldRenderer;
489
+ var nativeAutoField = createFormRenderer({
490
+ fallbackSuite: nativeSuite
491
+ }).AutoField;
515
492
  var getDeniedOperation = (deniedOperations, operation) => {
516
493
  if (!deniedOperations) {
517
494
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resistdesign/voltra",
3
- "version": "3.0.0-alpha.24",
3
+ "version": "3.0.0-alpha.26",
4
4
  "description": "With our powers combined!",
5
5
  "homepage": "https://voltra.app",
6
6
  "repository": "git@github.com:resistdesign/voltra.git",
package/web/index.js CHANGED
@@ -21,35 +21,6 @@ var __copyProps = (to, from, except, desc) => {
21
21
  };
22
22
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
23
23
 
24
- // src/app/forms/core/getFieldKind.ts
25
- var hasSelectableValues = (field) => {
26
- const possibleValues = field.possibleValues ?? [];
27
- return possibleValues.some(
28
- (value) => typeof value === "string" || typeof value === "number"
29
- );
30
- };
31
- var getFieldKind = (field) => {
32
- if (field.typeReference) {
33
- return field.array ? "relation_array" : "relation_single";
34
- }
35
- if (field.tags?.customType) {
36
- return field.array ? "custom_array" : "custom_single";
37
- }
38
- if (field.array) {
39
- return "array";
40
- }
41
- if (hasSelectableValues(field)) {
42
- return "enum_select";
43
- }
44
- if (field.type === "boolean") {
45
- return "boolean";
46
- }
47
- if (field.type === "number") {
48
- return "number";
49
- }
50
- return "string";
51
- };
52
-
53
24
  // src/app/forms/core/resolveSuite.ts
54
25
  var fieldKinds = [
55
26
  "string",
@@ -86,9 +57,38 @@ var resolveSuite = (overrides, fallback) => {
86
57
  };
87
58
  };
88
59
 
60
+ // src/app/forms/core/getFieldKind.ts
61
+ var hasSelectableValues = (field) => {
62
+ const possibleValues = field.possibleValues ?? [];
63
+ return possibleValues.some(
64
+ (value) => typeof value === "string" || typeof value === "number"
65
+ );
66
+ };
67
+ var getFieldKind = (field) => {
68
+ if (field.typeReference) {
69
+ return field.array ? "relation_array" : "relation_single";
70
+ }
71
+ if (field.tags?.customType) {
72
+ return field.array ? "custom_array" : "custom_single";
73
+ }
74
+ if (field.array) {
75
+ return "array";
76
+ }
77
+ if (hasSelectableValues(field)) {
78
+ return "enum_select";
79
+ }
80
+ if (field.type === "boolean") {
81
+ return "boolean";
82
+ }
83
+ if (field.type === "number") {
84
+ return "number";
85
+ }
86
+ return "string";
87
+ };
88
+
89
89
  // src/app/forms/core/createAutoField.ts
90
90
  var createAutoField = (suite) => {
91
- return (props) => {
91
+ const renderField = (props) => {
92
92
  const { field, fieldKey, value, onChange, error, disabled } = props;
93
93
  const { tags } = field;
94
94
  const context = {
@@ -106,11 +106,13 @@ var createAutoField = (suite) => {
106
106
  allowCustomSelection: tags?.allowCustomSelection,
107
107
  customType: tags?.customType,
108
108
  onRelationAction: props.onRelationAction,
109
- onCustomTypeAction: props.onCustomTypeAction
109
+ onCustomTypeAction: props.onCustomTypeAction,
110
+ renderField
110
111
  };
111
112
  const kind = getFieldKind(field);
112
113
  return suite.renderers[kind](context);
113
114
  };
115
+ return renderField;
114
116
  };
115
117
 
116
118
  // src/app/forms/core/createFormRenderer.ts
@@ -348,7 +350,6 @@ var renderCustomArray = (context) => {
348
350
  error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
349
351
  ] });
350
352
  };
351
- var autoFieldRenderer;
352
353
  var renderArray = (context) => {
353
354
  const { field, fieldKey, label, required, disabled, error } = context;
354
355
  const id = `field-${fieldKey}`;
@@ -362,7 +363,7 @@ var renderArray = (context) => {
362
363
  ] }),
363
364
  /* @__PURE__ */ jsxs(ArrayContainer, { children: [
364
365
  arrayValue.map((item, index) => /* @__PURE__ */ jsxs(ArrayItemWrapper, { children: [
365
- /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: autoFieldRenderer({
366
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: context.renderField({
366
367
  field: itemField,
367
368
  fieldKey: `${fieldKey}[${index}]`,
368
369
  value: item,
@@ -572,9 +573,9 @@ var webSuite = {
572
573
  Button: SuiteButton
573
574
  }
574
575
  };
575
- var resolvedWebSuite = resolveSuite(void 0, webSuite);
576
- autoFieldRenderer = createAutoField(resolvedWebSuite);
577
- var webAutoField = autoFieldRenderer;
576
+ var webAutoField = createFormRenderer({
577
+ fallbackSuite: webSuite
578
+ }).AutoField;
578
579
  var RelationList = styled_default("div")`
579
580
  display: flex;
580
581
  flex-direction: column;