@resistdesign/voltra 3.0.0-alpha.4 → 3.0.0-alpha.40

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 (219) hide show
  1. package/README.md +379 -14
  2. package/api/DBX/DBXAsserts.d.ts +95 -0
  3. package/api/DBX/DBXRequest.d.ts +5 -0
  4. package/api/DBX/DBXRuntime.d.ts +5 -0
  5. package/api/DBX/DBXScenarioConfig.d.ts +9 -0
  6. package/api/DBX/DBXSeed.d.ts +124 -0
  7. package/api/DBX/DBXTypes.d.ts +176 -0
  8. package/api/DBX/index.d.ts +8 -0
  9. package/api/DataAccessControl.d.ts +220 -0
  10. package/api/Indexing/API.d.ts +224 -0
  11. package/api/Indexing/Cursor.d.ts +101 -0
  12. package/api/Indexing/Handler/Config.d.ts +39 -0
  13. package/api/Indexing/Handler.d.ts +166 -0
  14. package/api/Indexing/Trace.d.ts +54 -0
  15. package/api/Indexing/Types.d.ts +204 -0
  16. package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
  17. package/api/Indexing/ddb/Types.d.ts +209 -0
  18. package/api/Indexing/docId.d.ts +27 -0
  19. package/api/Indexing/exact/ExactDdb.d.ts +58 -0
  20. package/api/Indexing/exact/ExactIndex.d.ts +90 -0
  21. package/api/Indexing/exact/ExactS3.d.ts +41 -0
  22. package/api/Indexing/fieldQualification.d.ts +12 -0
  23. package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +212 -0
  24. package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
  25. package/api/Indexing/fulltext/Schema.d.ts +164 -0
  26. package/api/Indexing/hashUniversal.d.ts +13 -0
  27. package/api/Indexing/index.d.ts +45 -0
  28. package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
  29. package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
  30. package/api/Indexing/lossy/LossyS3.d.ts +40 -0
  31. package/api/Indexing/rel/Cursor.d.ts +25 -0
  32. package/api/Indexing/rel/Handlers.d.ts +144 -0
  33. package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
  34. package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
  35. package/api/Indexing/rel/Types.d.ts +69 -0
  36. package/api/Indexing/structured/Cursor.d.ts +26 -0
  37. package/api/Indexing/structured/Handlers.d.ts +128 -0
  38. package/api/Indexing/structured/SearchStructured.d.ts +44 -0
  39. package/api/Indexing/structured/StructuredDdb.d.ts +184 -0
  40. package/api/Indexing/structured/StructuredDdbBackend.d.ts +112 -0
  41. package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +40 -0
  42. package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +61 -0
  43. package/api/Indexing/structured/StructuredStringLike.d.ts +54 -0
  44. package/api/Indexing/structured/StructuredWriter.d.ts +74 -0
  45. package/api/Indexing/structured/Types.d.ts +126 -0
  46. package/api/Indexing/structured/index.d.ts +9 -0
  47. package/api/Indexing/tokenize.d.ts +31 -0
  48. package/api/ORM/DACUtils.d.ts +270 -0
  49. package/api/ORM/ListItemUtils.d.ts +40 -0
  50. package/api/ORM/ORMRouteMap.d.ts +55 -0
  51. package/api/ORM/TypeInfoORMService.d.ts +740 -0
  52. package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
  53. package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +89 -0
  54. package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
  55. package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +55 -0
  56. package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
  57. package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
  58. package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
  59. package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
  60. package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
  61. package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
  62. package/api/ORM/drivers/S3FileItemDBDriver.d.ts +71 -0
  63. package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
  64. package/api/ORM/drivers/common/Types.d.ts +197 -0
  65. package/api/ORM/drivers/common/index.d.ts +2 -0
  66. package/api/ORM/drivers/index.d.ts +8 -0
  67. package/api/ORM/index.d.ts +9 -0
  68. package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +22 -0
  69. package/api/Router/AWS.d.ts +80 -0
  70. package/api/Router/Auth.d.ts +14 -0
  71. package/api/Router/CORS.d.ts +66 -0
  72. package/api/Router/Types.d.ts +138 -0
  73. package/api/Router/index.d.ts +89 -0
  74. package/api/index.d.ts +72 -6
  75. package/api/index.js +3291 -1954
  76. package/app/forms/Engine.d.ts +23 -0
  77. package/app/forms/UI.d.ts +83 -0
  78. package/app/forms/core/createAutoField.d.ts +43 -0
  79. package/app/forms/core/createFormRenderer.d.ts +25 -0
  80. package/app/forms/core/getFieldKind.d.ts +14 -0
  81. package/app/forms/core/index.d.ts +11 -0
  82. package/app/forms/core/mergeSuites.d.ts +23 -0
  83. package/app/forms/core/resolveSuite.d.ts +15 -0
  84. package/app/forms/core/types.d.ts +180 -0
  85. package/app/forms/index.d.ts +9 -0
  86. package/app/forms/types.d.ts +137 -0
  87. package/app/helpers/styled.d.ts +3 -0
  88. package/app/index.d.ts +102 -5
  89. package/app/index.js +98 -327
  90. package/app/utils/ApplicationState.d.ts +167 -0
  91. package/app/utils/ApplicationStateLoader.d.ts +86 -0
  92. package/app/utils/Controller.d.ts +10 -0
  93. package/app/utils/Debug.d.ts +14 -0
  94. package/app/utils/EasyLayout.d.ts +89 -0
  95. package/app/utils/History.d.ts +165 -0
  96. package/app/utils/Route.d.ts +173 -0
  97. package/app/utils/RouteHistory.d.ts +27 -0
  98. package/app/utils/Service.d.ts +45 -0
  99. package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
  100. package/app/utils/TypeInfoORMClient.d.ts +103 -0
  101. package/app/utils/UniversalRouteAdapter.d.ts +73 -0
  102. package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
  103. package/app/utils/easy-layout/computeTracks.d.ts +16 -0
  104. package/app/utils/easy-layout/index.d.ts +5 -0
  105. package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
  106. package/app/utils/easy-layout/types.d.ts +52 -0
  107. package/app/utils/easy-layout/validateAreas.d.ts +5 -0
  108. package/app/utils/index.d.ts +24 -0
  109. package/build/TypeMapping.d.ts +17 -0
  110. package/build/TypeParsing.d.ts +10 -0
  111. package/build/index.d.ts +15 -0
  112. package/build/index.js +569 -0
  113. package/chunk-2MOLWZMQ.js +71 -0
  114. package/chunk-7AMEFPPP.js +78 -0
  115. package/chunk-ATO2455Q.js +258 -0
  116. package/chunk-DT6WWJUI.js +1185 -0
  117. package/chunk-I2KLQ2HA.js +19 -0
  118. package/chunk-TJFTWPXQ.js +39 -0
  119. package/chunk-WNFRDIBW.js +121 -0
  120. package/chunk-YCTVEW2I.js +546 -0
  121. package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
  122. package/common/CommandLine/index.d.ts +6 -0
  123. package/common/HelperTypes.d.ts +9 -0
  124. package/common/IdGeneration/getSimpleId.d.ts +8 -0
  125. package/common/IdGeneration/index.d.ts +1 -0
  126. package/common/ItemRelationshipInfoTypes.d.ts +64 -0
  127. package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
  128. package/common/ItemRelationships/index.d.ts +2 -0
  129. package/common/Logging/Utils.d.ts +10 -0
  130. package/common/Logging/index.d.ts +1 -0
  131. package/common/Routing.d.ts +81 -0
  132. package/common/SearchTypes.d.ts +227 -0
  133. package/common/SearchUtils.d.ts +55 -0
  134. package/common/SearchValidation.d.ts +27 -0
  135. package/common/StringTransformers.d.ts +28 -0
  136. package/common/Testing/CLI.d.ts +6 -0
  137. package/common/Testing/Types.d.ts +216 -0
  138. package/common/Testing/Utils.d.ts +112 -0
  139. package/common/Testing/index.d.ts +8 -0
  140. package/common/TypeInfoDataItemUtils.d.ts +39 -0
  141. package/{Types-C7XjUjoF.d.ts → common/TypeInfoORM/Types.d.ts} +117 -15
  142. package/common/TypeInfoORM/index.d.ts +3 -0
  143. package/common/TypeParsing/Constants.d.ts +4 -0
  144. package/common/TypeParsing/ParsingUtils/Constants.d.ts +8 -0
  145. package/common/TypeParsing/ParsingUtils/checkType.d.ts +14 -0
  146. package/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +12 -0
  147. package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
  148. package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
  149. package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
  150. package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
  151. package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
  152. package/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +9 -0
  153. package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
  154. package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
  155. package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
  156. package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
  157. package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
  158. package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
  159. package/common/TypeParsing/TypeInfo.d.ts +222 -0
  160. package/common/TypeParsing/Utils.d.ts +47 -0
  161. package/common/TypeParsing/Validation.d.ts +327 -0
  162. package/common/TypeParsing/index.d.ts +8 -0
  163. package/common/index.d.ts +40 -4
  164. package/common/index.js +25 -1737
  165. package/{index-BkFZlfit.d.ts → iac/SimpleCFT.d.ts} +5 -25
  166. package/iac/index.d.ts +40 -2
  167. package/iac/index.js +2 -1661
  168. package/iac/packs/auth.d.ts +131 -0
  169. package/iac/packs/build/utils.d.ts +289 -0
  170. package/iac/packs/build.d.ts +92 -0
  171. package/iac/packs/cdn.d.ts +33 -0
  172. package/iac/packs/cloud-function.d.ts +67 -0
  173. package/iac/packs/database.d.ts +32 -0
  174. package/iac/packs/dns.d.ts +34 -0
  175. package/iac/packs/file-storage.d.ts +46 -0
  176. package/iac/packs/gateway.d.ts +82 -0
  177. package/iac/packs/index.d.ts +60 -1
  178. package/iac/packs/index.js +311 -566
  179. package/iac/packs/repo.d.ts +28 -0
  180. package/iac/packs/ssl-certificate.d.ts +28 -0
  181. package/iac/types/Constants.d.ts +24 -0
  182. package/{index-DcvJOZ_c.d.ts → iac/types/IaCTypes.d.ts} +23 -1018
  183. package/iac/types/Renderers.d.ts +96 -0
  184. package/iac/types/Types.d.ts +131 -0
  185. package/iac/types/Utils.d.ts +9 -0
  186. package/iac/types/generate.d.ts +1 -0
  187. package/iac/utils/index.d.ts +87 -0
  188. package/iac/utils/patch-utils.d.ts +66 -0
  189. package/iac-packs/index.d.ts +6 -0
  190. package/native/forms/UI.d.ts +73 -0
  191. package/native/forms/createNativeFormRenderer.d.ts +21 -0
  192. package/native/forms/index.d.ts +25 -0
  193. package/native/forms/primitives/index.d.ts +38 -0
  194. package/native/forms/suite.d.ts +15 -0
  195. package/native/index.d.ts +19 -0
  196. package/native/index.js +748 -0
  197. package/native/testing/react-native.d.ts +46 -0
  198. package/native/utils/EasyLayout.d.ts +88 -0
  199. package/native/utils/History.d.ts +102 -0
  200. package/native/utils/Route.d.ts +80 -0
  201. package/native/utils/index.d.ts +20 -0
  202. package/package.json +54 -21
  203. package/web/forms/UI.d.ts +74 -0
  204. package/web/forms/createWebFormRenderer.d.ts +21 -0
  205. package/web/forms/index.d.ts +9 -0
  206. package/web/forms/primitives/index.d.ts +21 -0
  207. package/web/forms/suite.d.ts +15 -0
  208. package/web/index.d.ts +15 -0
  209. package/web/index.js +668 -0
  210. package/web/utils/EasyLayout.d.ts +47 -0
  211. package/web/utils/Route.d.ts +16 -0
  212. package/web/utils/index.d.ts +7 -0
  213. package/SearchTypes-DjN6YQzE.d.ts +0 -577
  214. package/Validation-CFP59oIP.d.ts +0 -226
  215. package/index-C3-iD9Mh.d.ts +0 -690
  216. package/index-DZ2BB4iX.d.ts +0 -5357
  217. package/index-IokxSNxm.d.ts +0 -745
  218. package/index.d.ts +0 -13
  219. package/index.js +0 -10973
@@ -0,0 +1,748 @@
1
+ import { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
2
+ import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, Route, buildRoutePath } from '../chunk-DT6WWJUI.js';
3
+ import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
4
+ import { resolveRouteAdapterPath, getPathArray } from '../chunk-WNFRDIBW.js';
5
+ import '../chunk-I2KLQ2HA.js';
6
+ import { createElement, useMemo } from 'react';
7
+ import { Text, View, Platform, Switch, TextInput, Pressable, BackHandler } from 'react-native';
8
+ import { jsx } from 'react/jsx-runtime';
9
+
10
+ var FieldWrapper = (props) => {
11
+ return createElement(View, null, props.children);
12
+ };
13
+ var ErrorMessage = ({ children }) => {
14
+ return createElement(Text, { style: { color: "#AA0000" } }, children);
15
+ };
16
+ var ArrayContainer = (props) => {
17
+ return createElement(View, null, props.children);
18
+ };
19
+ var ArrayItemWrapper = (props) => {
20
+ return createElement(View, null, props.children);
21
+ };
22
+ var Button = ({
23
+ children,
24
+ disabled,
25
+ onPress
26
+ }) => {
27
+ return createElement(
28
+ Pressable,
29
+ { onPress, disabled },
30
+ createElement(Text, null, children)
31
+ );
32
+ };
33
+
34
+ // src/native/forms/suite.ts
35
+ var createArrayItemField = (field) => ({
36
+ ...field,
37
+ array: false,
38
+ tags: {
39
+ ...field.tags,
40
+ label: void 0
41
+ }
42
+ });
43
+ var parseNumberValue = (raw) => raw === "" ? null : Number(raw);
44
+ var getSelectableValues = (possibleValues) => {
45
+ return possibleValues?.filter(
46
+ (v) => typeof v === "string" || typeof v === "number"
47
+ );
48
+ };
49
+ var formatCustomValue = (val) => {
50
+ if (val === null || val === void 0) return "None";
51
+ if (typeof val === "string" || typeof val === "number") return String(val);
52
+ return JSON.stringify(val, null, 2);
53
+ };
54
+ var renderErrorMessage = (context) => {
55
+ const { error, errors = [], translateValidationErrorCode } = context;
56
+ const descriptors = (errors.length ? errors : error ? [error] : []).filter(
57
+ (descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
58
+ );
59
+ if (!descriptors.length) {
60
+ return null;
61
+ }
62
+ return createElement(
63
+ View,
64
+ { style: { gap: 4 } },
65
+ descriptors.map((descriptor, index) => {
66
+ const message = translateValidationErrorCode(descriptor);
67
+ if (!message) {
68
+ return null;
69
+ }
70
+ return createElement(
71
+ ErrorMessage,
72
+ { key: `${descriptor.code}-${index}`, children: message }
73
+ );
74
+ })
75
+ );
76
+ };
77
+ var RelationSingleField = (context) => {
78
+ const { field, fieldKey, label, required, disabled, onRelationAction } = context;
79
+ return createElement(
80
+ FieldWrapper,
81
+ null,
82
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
83
+ onRelationAction ? createElement(
84
+ Button,
85
+ {
86
+ disabled,
87
+ onPress: () => onRelationAction({
88
+ action: "open",
89
+ fieldKey,
90
+ field,
91
+ value: void 0,
92
+ fullPaging: field.tags?.fullPaging,
93
+ onChange: context.onChange
94
+ })
95
+ },
96
+ "Manage"
97
+ ) : null,
98
+ renderErrorMessage(context)
99
+ );
100
+ };
101
+ var RelationArrayField = (context) => {
102
+ const { field, fieldKey, label, required, disabled, onRelationAction } = context;
103
+ return createElement(
104
+ FieldWrapper,
105
+ null,
106
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
107
+ onRelationAction ? createElement(
108
+ Button,
109
+ {
110
+ disabled,
111
+ onPress: () => onRelationAction({
112
+ action: "open",
113
+ fieldKey,
114
+ field,
115
+ value: void 0,
116
+ fullPaging: field.tags?.fullPaging,
117
+ onChange: context.onChange
118
+ })
119
+ },
120
+ "Manage"
121
+ ) : null,
122
+ renderErrorMessage(context)
123
+ );
124
+ };
125
+ var CustomSingleField = (context) => {
126
+ const { field, fieldKey, label, required, disabled } = context;
127
+ const customType = field.tags?.customType;
128
+ const onCustomTypeAction = context.onCustomTypeAction;
129
+ return createElement(
130
+ FieldWrapper,
131
+ null,
132
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
133
+ createElement(Text, null, formatCustomValue(context.value)),
134
+ customType && onCustomTypeAction ? createElement(
135
+ Button,
136
+ {
137
+ disabled,
138
+ onPress: () => onCustomTypeAction({
139
+ action: "open",
140
+ fieldKey,
141
+ field,
142
+ customType,
143
+ value: context.value,
144
+ onChange: context.onChange
145
+ })
146
+ },
147
+ "Manage"
148
+ ) : null,
149
+ renderErrorMessage(context)
150
+ );
151
+ };
152
+ var CustomArrayField = (context) => {
153
+ const { field, fieldKey, label, required, disabled } = context;
154
+ const customType = field.tags?.customType;
155
+ const onCustomTypeAction = context.onCustomTypeAction;
156
+ const arrayValue = Array.isArray(context.value) ? context.value : [];
157
+ return createElement(
158
+ FieldWrapper,
159
+ null,
160
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
161
+ createElement(
162
+ View,
163
+ { style: { gap: 8, marginBottom: 8 } },
164
+ arrayValue.length === 0 ? createElement(Text, null, "No items yet.") : arrayValue.map(
165
+ (item, index) => createElement(
166
+ View,
167
+ { key: `${fieldKey}-${index}`, style: { gap: 4 } },
168
+ createElement(Text, null, formatCustomValue(item)),
169
+ createElement(
170
+ View,
171
+ { style: { flexDirection: "row", gap: 8, flexWrap: "wrap" } },
172
+ customType && onCustomTypeAction ? createElement(
173
+ Button,
174
+ {
175
+ disabled,
176
+ onPress: () => onCustomTypeAction({
177
+ action: "edit",
178
+ fieldKey,
179
+ field,
180
+ customType,
181
+ value: context.value,
182
+ index,
183
+ onChange: context.onChange
184
+ })
185
+ },
186
+ "Manage"
187
+ ) : null,
188
+ customType && onCustomTypeAction ? createElement(
189
+ Button,
190
+ {
191
+ disabled,
192
+ onPress: () => onCustomTypeAction({
193
+ action: "remove",
194
+ fieldKey,
195
+ field,
196
+ customType,
197
+ value: context.value,
198
+ index,
199
+ onChange: context.onChange
200
+ })
201
+ },
202
+ "Remove"
203
+ ) : null
204
+ )
205
+ )
206
+ )
207
+ ),
208
+ customType && onCustomTypeAction ? createElement(
209
+ Button,
210
+ {
211
+ disabled,
212
+ onPress: () => onCustomTypeAction({
213
+ action: "add",
214
+ fieldKey,
215
+ field,
216
+ customType,
217
+ value: context.value,
218
+ onChange: context.onChange
219
+ })
220
+ },
221
+ "Add Item"
222
+ ) : null,
223
+ renderErrorMessage(context)
224
+ );
225
+ };
226
+ var ArrayField = (context) => {
227
+ const { field, fieldKey, label, required, disabled } = context;
228
+ const itemField = createArrayItemField(field);
229
+ const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
230
+ return createElement(
231
+ FieldWrapper,
232
+ null,
233
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
234
+ createElement(
235
+ ArrayContainer,
236
+ null,
237
+ arrayValue.map(
238
+ (item, index) => createElement(
239
+ ArrayItemWrapper,
240
+ { key: index },
241
+ createElement(
242
+ View,
243
+ { style: { flex: 1 } },
244
+ context.renderField({
245
+ field: itemField,
246
+ fieldKey: `${fieldKey}[${index}]`,
247
+ value: item,
248
+ onChange: (newItem) => {
249
+ const newValue = [...arrayValue];
250
+ newValue[index] = newItem;
251
+ context.onChange(newValue);
252
+ },
253
+ errors: context.arrayItemErrorMap?.[index] ?? [],
254
+ error: context.arrayItemErrorMap?.[index]?.find(
255
+ (descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
256
+ ) ?? void 0,
257
+ translateValidationErrorCode: context.translateValidationErrorCode,
258
+ disabled
259
+ })
260
+ ),
261
+ createElement(
262
+ Button,
263
+ {
264
+ disabled,
265
+ onPress: () => {
266
+ const newValue = [...arrayValue];
267
+ newValue.splice(index, 1);
268
+ context.onChange(newValue);
269
+ }
270
+ },
271
+ "Remove"
272
+ )
273
+ )
274
+ ),
275
+ createElement(
276
+ Button,
277
+ {
278
+ disabled,
279
+ onPress: () => {
280
+ const baseValue = Array.isArray(context.value) ? context.value : [];
281
+ const newValue = [...baseValue];
282
+ const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
283
+ newValue.push(newItem);
284
+ context.onChange(newValue);
285
+ }
286
+ },
287
+ "Add Item"
288
+ )
289
+ ),
290
+ renderErrorMessage(context)
291
+ );
292
+ };
293
+ var StringField = (context) => {
294
+ const { label, required, disabled } = context;
295
+ return createElement(
296
+ FieldWrapper,
297
+ null,
298
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
299
+ createElement(TextInput, {
300
+ value: context.value || "",
301
+ onChangeText: (value) => context.onChange(value),
302
+ editable: !disabled,
303
+ placeholder: label
304
+ }),
305
+ renderErrorMessage(context)
306
+ );
307
+ };
308
+ var NumberField = (context) => {
309
+ const { label, required, disabled } = context;
310
+ return createElement(
311
+ FieldWrapper,
312
+ null,
313
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
314
+ createElement(TextInput, {
315
+ value: context.value !== void 0 ? String(context.value) : "",
316
+ onChangeText: (value) => context.onChange(parseNumberValue(value)),
317
+ editable: !disabled,
318
+ keyboardType: "numeric",
319
+ placeholder: label
320
+ }),
321
+ renderErrorMessage(context)
322
+ );
323
+ };
324
+ var BooleanField = (context) => {
325
+ const { label, disabled } = context;
326
+ return createElement(
327
+ FieldWrapper,
328
+ null,
329
+ createElement(
330
+ View,
331
+ { style: { flexDirection: "row", alignItems: "center", gap: 8 } },
332
+ createElement(Switch, {
333
+ value: !!context.value,
334
+ onValueChange: (value) => context.onChange(value),
335
+ disabled
336
+ }),
337
+ createElement(Text, null, label)
338
+ ),
339
+ renderErrorMessage(context)
340
+ );
341
+ };
342
+ var EnumSelectField = (context) => {
343
+ const { field, label, required, disabled } = context;
344
+ const selectableValues = getSelectableValues(context.possibleValues) ?? [];
345
+ return createElement(
346
+ FieldWrapper,
347
+ null,
348
+ createElement(Text, null, `${label} ${required ? "*" : ""}`),
349
+ createElement(
350
+ View,
351
+ { style: { gap: 8 } },
352
+ selectableValues.map(
353
+ (val) => createElement(
354
+ Button,
355
+ {
356
+ key: String(val),
357
+ disabled,
358
+ onPress: () => context.onChange(
359
+ field.type === "number" ? Number(val) : String(val)
360
+ )
361
+ },
362
+ String(val)
363
+ )
364
+ )
365
+ ),
366
+ renderErrorMessage(context)
367
+ );
368
+ };
369
+ var FormRoot = ({
370
+ children,
371
+ onSubmit
372
+ }) => {
373
+ if (Platform?.OS === "web") {
374
+ return createElement(
375
+ "form",
376
+ {
377
+ onSubmit: (event) => {
378
+ event?.preventDefault?.();
379
+ onSubmit?.();
380
+ }
381
+ },
382
+ children
383
+ );
384
+ }
385
+ return createElement(View, null, children);
386
+ };
387
+ var SuiteButton = ({
388
+ children,
389
+ disabled,
390
+ onClick
391
+ }) => {
392
+ return createElement(Button, { disabled, onPress: onClick }, children);
393
+ };
394
+ var nativeSuite = {
395
+ renderers: {
396
+ string: StringField,
397
+ number: NumberField,
398
+ boolean: BooleanField,
399
+ enum_select: EnumSelectField,
400
+ array: ArrayField,
401
+ relation_single: RelationSingleField,
402
+ relation_array: RelationArrayField,
403
+ custom_single: CustomSingleField,
404
+ custom_array: CustomArrayField
405
+ },
406
+ primitives: {
407
+ FormRoot,
408
+ FieldWrapper,
409
+ ErrorMessage,
410
+ Label: ({ children }) => createElement(Text, null, children),
411
+ Button: SuiteButton
412
+ }
413
+ };
414
+ var nativeAutoField = createFormRenderer({
415
+ fallbackSuite: nativeSuite
416
+ }).AutoField;
417
+
418
+ // src/native/forms/createNativeFormRenderer.ts
419
+ var createNativeFormRenderer = (options) => {
420
+ return createFormRenderer({
421
+ fallbackSuite: nativeSuite,
422
+ suite: options?.suite
423
+ });
424
+ };
425
+ var defaultNativeRenderer = createNativeFormRenderer();
426
+ var AutoField = (props) => {
427
+ return createElement(nativeAutoField, {
428
+ field: props.field,
429
+ fieldKey: props.fieldKey,
430
+ value: props.value,
431
+ onChange: props.onChange,
432
+ error: props.error,
433
+ errors: props.errors,
434
+ arrayItemErrorMap: props.arrayItemErrorMap,
435
+ translateValidationErrorCode: props.translateValidationErrorCode,
436
+ disabled: props.disabled,
437
+ onRelationAction: props.onRelationAction,
438
+ onCustomTypeAction: props.onCustomTypeAction
439
+ });
440
+ };
441
+ var AutoFormView2 = (props) => {
442
+ return /* @__PURE__ */ jsx(AutoFormView, { ...props, renderer: defaultNativeRenderer });
443
+ };
444
+ var AutoForm2 = (props) => {
445
+ return /* @__PURE__ */ jsx(AutoForm, { ...props, renderer: defaultNativeRenderer });
446
+ };
447
+ var roundTo = (value, decimals) => {
448
+ const places = Number.isFinite(decimals) ? Math.max(0, decimals) : 3;
449
+ const factor = Math.pow(10, places);
450
+ return Math.round(value * factor) / factor;
451
+ };
452
+ var sumTrackWindow = (tracks, startIndex, endIndex, gapPx) => {
453
+ if (endIndex < startIndex) {
454
+ return 0;
455
+ }
456
+ const trackSum = tracks.slice(startIndex, endIndex + 1).reduce((acc, value) => acc + value, 0);
457
+ const gaps = (endIndex - startIndex) * gapPx;
458
+ return trackSum + Math.max(0, gaps);
459
+ };
460
+ var sumBeforeTrack = (tracks, startIndex, gapPx) => {
461
+ if (startIndex <= 0) {
462
+ return 0;
463
+ }
464
+ const trackSum = tracks.slice(0, startIndex).reduce((acc, value) => acc + value, 0);
465
+ const gaps = startIndex * Math.max(0, gapPx);
466
+ return trackSum + gaps;
467
+ };
468
+ var computeCoords = (parsed, bounds, { width, height, padding = 0, gap = 0, roundToDecimals = 3 }) => {
469
+ const rowTracks = parsed.rowTracks.length ? parsed.rowTracks : parsed.areaGrid.map(() => ({ kind: "fr", value: 1 }));
470
+ const colTracks = parsed.colTracks.length ? parsed.colTracks : parsed.areaGrid[0].map(() => ({ kind: "fr", value: 1 }));
471
+ const rowPixels = computeTrackPixels({
472
+ tracks: rowTracks,
473
+ totalPx: Math.max(0, height),
474
+ gapPx: gap,
475
+ paddingPx: padding
476
+ });
477
+ const colPixels = computeTrackPixels({
478
+ tracks: colTracks,
479
+ totalPx: Math.max(0, width),
480
+ gapPx: gap,
481
+ paddingPx: padding
482
+ });
483
+ const result = {};
484
+ for (const areaName of parsed.areaNames) {
485
+ const area = bounds[areaName];
486
+ if (!area) {
487
+ continue;
488
+ }
489
+ const left = Math.max(0, padding) + sumBeforeTrack(colPixels, area.colStart - 1, Math.max(0, gap));
490
+ const top = Math.max(0, padding) + sumBeforeTrack(rowPixels, area.rowStart - 1, Math.max(0, gap));
491
+ const areaWidth = sumTrackWindow(
492
+ colPixels,
493
+ area.colStart - 1,
494
+ area.colEnd - 1,
495
+ Math.max(0, gap)
496
+ );
497
+ const areaHeight = sumTrackWindow(
498
+ rowPixels,
499
+ area.rowStart - 1,
500
+ area.rowEnd - 1,
501
+ Math.max(0, gap)
502
+ );
503
+ result[areaName] = {
504
+ left: roundTo(left, roundToDecimals),
505
+ top: roundTo(top, roundToDecimals),
506
+ width: roundTo(areaWidth, roundToDecimals),
507
+ height: roundTo(areaHeight, roundToDecimals)
508
+ };
509
+ }
510
+ return result;
511
+ };
512
+ var makeNativeEasyLayout = (template) => {
513
+ const parsed = parseTemplate(template);
514
+ validateAreas(parsed);
515
+ const bounds = computeAreaBounds(parsed);
516
+ return {
517
+ template,
518
+ parsed,
519
+ bounds,
520
+ areaNames: parsed.areaNames,
521
+ computeNativeCoords: (input) => computeCoords(parsed, bounds, input)
522
+ };
523
+ };
524
+ var useNativeEasyLayout = (layout, input) => {
525
+ return useMemo(
526
+ () => layout.computeNativeCoords(input),
527
+ [
528
+ layout,
529
+ input.width,
530
+ input.height,
531
+ input.padding,
532
+ input.gap,
533
+ input.roundToDecimals
534
+ ]
535
+ );
536
+ };
537
+ var NativeEasyLayoutView = ({
538
+ layout,
539
+ areaChildren = {},
540
+ ViewComponent,
541
+ containerStyle = {},
542
+ areaStyle = {},
543
+ onLayout,
544
+ ...input
545
+ }) => {
546
+ const coords = useNativeEasyLayout(layout, input);
547
+ const Container = ViewComponent || "div";
548
+ return createElement(
549
+ Container,
550
+ {
551
+ onLayout,
552
+ style: {
553
+ position: "relative",
554
+ width: input.width,
555
+ height: input.height,
556
+ ...containerStyle
557
+ }
558
+ },
559
+ layout.areaNames.map(
560
+ (areaName) => createElement(
561
+ Container,
562
+ {
563
+ key: areaName,
564
+ style: {
565
+ position: "absolute",
566
+ ...coords[areaName],
567
+ ...areaStyle
568
+ }
569
+ },
570
+ areaChildren[areaName] ?? null
571
+ )
572
+ )
573
+ );
574
+ };
575
+
576
+ // src/native/utils/History.ts
577
+ var mapNativeURLToPath = (url) => buildHistoryPath(parseHistoryPath(url));
578
+ var createNativeHistory = (options = {}) => {
579
+ const {
580
+ adapter,
581
+ initialPath = "/",
582
+ onIncomingURL = "replace",
583
+ mapURLToPath = mapNativeURLToPath
584
+ } = options;
585
+ const history = createMemoryHistory(initialPath);
586
+ let unsubscribe;
587
+ let started = false;
588
+ const applyIncomingURL = (url) => {
589
+ if (!url) {
590
+ return;
591
+ }
592
+ const targetPath = mapURLToPath(url);
593
+ if (!targetPath) {
594
+ return;
595
+ }
596
+ if (onIncomingURL === "push") {
597
+ history.push(targetPath, { replaceSearch: true });
598
+ } else {
599
+ history.replace(targetPath, { replaceSearch: true });
600
+ }
601
+ };
602
+ return {
603
+ get location() {
604
+ return history.location;
605
+ },
606
+ get length() {
607
+ return history.length;
608
+ },
609
+ get index() {
610
+ return history.index;
611
+ },
612
+ push: history.push,
613
+ replace: history.replace,
614
+ go: history.go,
615
+ back: history.back,
616
+ forward: history.forward,
617
+ listen: history.listen,
618
+ start: async () => {
619
+ if (started) {
620
+ return;
621
+ }
622
+ started = true;
623
+ if (!adapter) {
624
+ return;
625
+ }
626
+ const startKey = history.location.key;
627
+ const startIndex = history.index;
628
+ unsubscribe = adapter.subscribe((url) => {
629
+ const targetPath = mapURLToPath(url);
630
+ if (!targetPath) {
631
+ return;
632
+ }
633
+ const userNavigated = history.location.key !== startKey || history.index !== startIndex;
634
+ if (userNavigated && targetPath === initialPath) {
635
+ return;
636
+ }
637
+ if (onIncomingURL === "push") {
638
+ history.push(targetPath, { replaceSearch: true });
639
+ } else {
640
+ history.replace(targetPath, { replaceSearch: true });
641
+ }
642
+ });
643
+ const initialURL = await adapter.getInitialURL();
644
+ if (history.location.key === startKey && history.index === startIndex) {
645
+ applyIncomingURL(initialURL);
646
+ }
647
+ },
648
+ stop: () => {
649
+ if (!started) {
650
+ return;
651
+ }
652
+ unsubscribe?.();
653
+ unsubscribe = void 0;
654
+ started = false;
655
+ }
656
+ };
657
+ };
658
+ var createNativeBackHandler = (history) => createHistoryBackHandler(history);
659
+ var createNavigationStateRouteAdapter = (options) => {
660
+ const getPath = () => options.toPath(options.getState());
661
+ const resolvePath = (path) => resolveRouteAdapterPath(getPath(), path);
662
+ return {
663
+ getPath,
664
+ subscribe: (listener) => options.subscribe(() => {
665
+ listener(getPath());
666
+ }),
667
+ push: options.navigate ? (path) => options.navigate?.(resolvePath(path)) : void 0,
668
+ replace: options.replace ? (path) => options.replace?.(resolvePath(path)) : void 0
669
+ };
670
+ };
671
+ var createNativeHardwareBackHandler = (adapter) => {
672
+ return () => {
673
+ if (adapter.canGoBack?.()) {
674
+ adapter.back?.();
675
+ return true;
676
+ }
677
+ return false;
678
+ };
679
+ };
680
+ var registerNativeHardwareBackHandler = (adapter, backHandler) => {
681
+ const listener = createNativeHardwareBackHandler(adapter);
682
+ const subscription = backHandler.addEventListener(
683
+ "hardwareBackPress",
684
+ listener
685
+ );
686
+ return () => {
687
+ if (typeof subscription?.remove === "function") {
688
+ subscription.remove();
689
+ return;
690
+ }
691
+ backHandler.removeEventListener?.("hardwareBackPress", listener);
692
+ };
693
+ };
694
+ var createNativeRouteBackIntegration = (backHandler) => {
695
+ return {
696
+ setup: (adapter) => registerNativeHardwareBackHandler(adapter, backHandler)
697
+ };
698
+ };
699
+ var Route2 = (props) => {
700
+ const hasMatcherProps = typeof props.path !== "undefined" || typeof props.exact !== "undefined" || typeof props.onParamsChange !== "undefined";
701
+ const nativeRuntime = {
702
+ platformOS: String(Platform?.OS ?? ""),
703
+ backHandler: BackHandler
704
+ };
705
+ const runtimeIntegration = (() => {
706
+ if (hasMatcherProps || nativeRuntime.platformOS === "web") {
707
+ return void 0;
708
+ }
709
+ const backHandler = nativeRuntime.backHandler;
710
+ if (!backHandler) {
711
+ return void 0;
712
+ }
713
+ return createNativeRouteBackIntegration(backHandler);
714
+ })();
715
+ return /* @__PURE__ */ jsx(
716
+ Route,
717
+ {
718
+ ...props,
719
+ runtimeIntegration
720
+ }
721
+ );
722
+ };
723
+ var expandPattern = (pattern, params = {}) => {
724
+ const segments = getPathArray(pattern, "/", true, true, false, false);
725
+ return segments.map((segment) => {
726
+ if (segment.startsWith(":")) {
727
+ const key = segment.slice(1);
728
+ if (!(key in params)) {
729
+ throw new Error(`Missing param "${key}" for route pattern "${pattern}".`);
730
+ }
731
+ return params[key];
732
+ }
733
+ return segment;
734
+ });
735
+ };
736
+ var buildPathFromRouteChain = (routeChain, config, query) => {
737
+ const segments = [];
738
+ routeChain.forEach((route) => {
739
+ const pattern = config[route.name];
740
+ if (!pattern) {
741
+ throw new Error(`Missing route pattern for "${route.name}".`);
742
+ }
743
+ segments.push(...expandPattern(pattern, route.params));
744
+ });
745
+ return buildRoutePath(segments, query);
746
+ };
747
+
748
+ export { ArrayContainer, ArrayItemWrapper, AutoField, AutoForm2 as AutoForm, AutoFormView2 as AutoFormView, Button, ErrorMessage, FieldWrapper, NativeEasyLayoutView, Route2 as Route, buildPathFromRouteChain, createNativeBackHandler, createNativeFormRenderer, createNativeHardwareBackHandler, createNativeHistory, createNativeRouteBackIntegration, createNavigationStateRouteAdapter, makeNativeEasyLayout, mapNativeURLToPath, nativeAutoField, nativeSuite, registerNativeHardwareBackHandler, useNativeEasyLayout };