@resistdesign/voltra 3.0.0-alpha.5 → 3.0.0-alpha.51

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 (222) hide show
  1. package/README.md +392 -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 +70 -0
  51. package/api/ORM/TypeInfoORMService.d.ts +879 -0
  52. package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
  53. package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +90 -0
  54. package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
  55. package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +56 -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 +202 -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/getTypeInfoORMIndexingConfigFromTypeInfoMap.d.ts +31 -0
  68. package/api/ORM/index.d.ts +10 -0
  69. package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +22 -0
  70. package/api/Router/AWS.d.ts +80 -0
  71. package/api/Router/Auth.d.ts +14 -0
  72. package/api/Router/CORS.d.ts +66 -0
  73. package/api/Router/Types.d.ts +138 -0
  74. package/api/Router/index.d.ts +89 -0
  75. package/api/index.d.ts +72 -6
  76. package/api/index.js +3553 -1948
  77. package/app/forms/Engine.d.ts +23 -0
  78. package/app/forms/UI.d.ts +83 -0
  79. package/app/forms/core/createAutoField.d.ts +43 -0
  80. package/app/forms/core/createFormRenderer.d.ts +25 -0
  81. package/app/forms/core/getFieldKind.d.ts +14 -0
  82. package/app/forms/core/index.d.ts +11 -0
  83. package/app/forms/core/mergeSuites.d.ts +23 -0
  84. package/app/forms/core/resolveSuite.d.ts +15 -0
  85. package/app/forms/core/types.d.ts +180 -0
  86. package/app/forms/index.d.ts +9 -0
  87. package/app/forms/types.d.ts +137 -0
  88. package/app/helpers/styled.d.ts +3 -0
  89. package/app/index.d.ts +116 -5
  90. package/app/index.js +120 -382
  91. package/app/utils/ApplicationState.d.ts +161 -0
  92. package/app/utils/ApplicationStateLoader.d.ts +91 -0
  93. package/app/utils/Controller.d.ts +10 -0
  94. package/app/utils/Debug.d.ts +14 -0
  95. package/app/utils/EasyLayout.d.ts +89 -0
  96. package/app/utils/History.d.ts +165 -0
  97. package/app/utils/Route.d.ts +207 -0
  98. package/app/utils/RouteHistory.d.ts +27 -0
  99. package/app/utils/Service.d.ts +45 -0
  100. package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
  101. package/app/utils/TypeInfoORMClient.d.ts +104 -0
  102. package/app/utils/UniversalRouteAdapter.d.ts +73 -0
  103. package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
  104. package/app/utils/easy-layout/computeTracks.d.ts +16 -0
  105. package/app/utils/easy-layout/index.d.ts +5 -0
  106. package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
  107. package/app/utils/easy-layout/types.d.ts +52 -0
  108. package/app/utils/easy-layout/validateAreas.d.ts +5 -0
  109. package/app/utils/index.d.ts +24 -0
  110. package/build/TypeMapping.d.ts +17 -0
  111. package/build/TypeParsing.d.ts +10 -0
  112. package/build/index.d.ts +15 -0
  113. package/build/index.js +569 -0
  114. package/chunk-2JDOM6PB.js +138 -0
  115. package/chunk-3HVYVX3S.js +546 -0
  116. package/chunk-ATO2455Q.js +258 -0
  117. package/chunk-BSHQIRBV.js +71 -0
  118. package/chunk-I2KLQ2HA.js +19 -0
  119. package/chunk-K4R2PFNG.js +1258 -0
  120. package/chunk-TJFTWPXQ.js +39 -0
  121. package/chunk-XHOMAXLR.js +84 -0
  122. package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
  123. package/common/CommandLine/index.d.ts +6 -0
  124. package/common/HelperTypes.d.ts +9 -0
  125. package/common/IdGeneration/getSimpleId.d.ts +8 -0
  126. package/common/IdGeneration/index.d.ts +1 -0
  127. package/common/ItemRelationshipInfoTypes.d.ts +64 -0
  128. package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
  129. package/common/ItemRelationships/index.d.ts +2 -0
  130. package/common/Logging/Utils.d.ts +10 -0
  131. package/common/Logging/index.d.ts +1 -0
  132. package/common/Routing.d.ts +81 -0
  133. package/common/SearchTypes.d.ts +227 -0
  134. package/common/SearchUtils.d.ts +55 -0
  135. package/common/SearchValidation.d.ts +27 -0
  136. package/common/StringTransformers.d.ts +28 -0
  137. package/common/Testing/CLI.d.ts +6 -0
  138. package/common/Testing/Types.d.ts +216 -0
  139. package/common/Testing/Utils.d.ts +112 -0
  140. package/common/Testing/index.d.ts +8 -0
  141. package/common/TypeInfoDataItemUtils.d.ts +39 -0
  142. package/{Types-C7XjUjoF.d.ts → common/TypeInfoORM/Types.d.ts} +150 -20
  143. package/common/TypeInfoORM/index.d.ts +3 -0
  144. package/common/TypeParsing/Constants.d.ts +4 -0
  145. package/common/TypeParsing/ParsingUtils/Constants.d.ts +8 -0
  146. package/common/TypeParsing/ParsingUtils/checkType.d.ts +14 -0
  147. package/common/TypeParsing/ParsingUtils/checkUnionType.d.ts +12 -0
  148. package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
  149. package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
  150. package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
  151. package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
  152. package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
  153. package/common/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +9 -0
  154. package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
  155. package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
  156. package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
  157. package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
  158. package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
  159. package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
  160. package/common/TypeParsing/TypeInfo.d.ts +235 -0
  161. package/common/TypeParsing/Utils.d.ts +47 -0
  162. package/common/TypeParsing/Validation.d.ts +327 -0
  163. package/common/TypeParsing/index.d.ts +8 -0
  164. package/common/index.d.ts +47 -4
  165. package/common/index.js +25 -1737
  166. package/{index-BkFZlfit.d.ts → iac/SimpleCFT.d.ts} +5 -25
  167. package/iac/index.d.ts +40 -2
  168. package/iac/index.js +2 -1661
  169. package/iac/packs/auth.d.ts +131 -0
  170. package/iac/packs/build/utils.d.ts +289 -0
  171. package/iac/packs/build.d.ts +92 -0
  172. package/iac/packs/cdn.d.ts +33 -0
  173. package/iac/packs/cloud-function.d.ts +67 -0
  174. package/iac/packs/database.d.ts +32 -0
  175. package/iac/packs/dns.d.ts +34 -0
  176. package/iac/packs/file-storage.d.ts +46 -0
  177. package/iac/packs/gateway.d.ts +82 -0
  178. package/iac/packs/index.d.ts +60 -1
  179. package/iac/packs/index.js +391 -594
  180. package/iac/packs/repo.d.ts +28 -0
  181. package/iac/packs/ssl-certificate.d.ts +28 -0
  182. package/iac/types/Constants.d.ts +24 -0
  183. package/{index-DcvJOZ_c.d.ts → iac/types/IaCTypes.d.ts} +23 -1018
  184. package/iac/types/Renderers.d.ts +96 -0
  185. package/iac/types/Types.d.ts +131 -0
  186. package/iac/types/Utils.d.ts +9 -0
  187. package/iac/types/generate.d.ts +1 -0
  188. package/iac/utils/index.d.ts +87 -0
  189. package/iac/utils/patch-utils.d.ts +66 -0
  190. package/iac-packs/index.d.ts +6 -0
  191. package/native/forms/UI.d.ts +73 -0
  192. package/native/forms/createNativeFormRenderer.d.ts +21 -0
  193. package/native/forms/index.d.ts +25 -0
  194. package/native/forms/primitives/index.d.ts +38 -0
  195. package/native/forms/suite.d.ts +15 -0
  196. package/native/index.d.ts +19 -0
  197. package/native/index.js +792 -0
  198. package/native/testing/react-native.d.ts +46 -0
  199. package/native/utils/EasyLayout.d.ts +88 -0
  200. package/native/utils/History.d.ts +124 -0
  201. package/native/utils/NavButton.d.ts +25 -0
  202. package/native/utils/Route.d.ts +41 -0
  203. package/native/utils/index.d.ts +25 -0
  204. package/package.json +54 -21
  205. package/web/forms/UI.d.ts +74 -0
  206. package/web/forms/createWebFormRenderer.d.ts +21 -0
  207. package/web/forms/index.d.ts +9 -0
  208. package/web/forms/primitives/index.d.ts +21 -0
  209. package/web/forms/suite.d.ts +15 -0
  210. package/web/index.d.ts +15 -0
  211. package/web/index.js +701 -0
  212. package/web/utils/EasyLayout.d.ts +47 -0
  213. package/web/utils/NavLink.d.ts +24 -0
  214. package/web/utils/Route.d.ts +16 -0
  215. package/web/utils/index.d.ts +8 -0
  216. package/SearchTypes-DjN6YQzE.d.ts +0 -577
  217. package/Validation-CFP59oIP.d.ts +0 -226
  218. package/index-C3-iD9Mh.d.ts +0 -690
  219. package/index-CK5Qwvfb.d.ts +0 -5378
  220. package/index-IokxSNxm.d.ts +0 -745
  221. package/index.d.ts +0 -13
  222. package/index.js +0 -11005
package/web/index.js ADDED
@@ -0,0 +1,701 @@
1
+ import { createEasyLayout } from '../chunk-BSHQIRBV.js';
2
+ import { createFormRenderer, AutoFormView, AutoForm, useRouteContext, createBrowserRouteAdapter, Route } from '../chunk-K4R2PFNG.js';
3
+ import { ERROR_MESSAGE_CONSTANTS } from '../chunk-3HVYVX3S.js';
4
+ import { resolveRouteAdapterPath } from '../chunk-2JDOM6PB.js';
5
+ import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
6
+ import { createElement, useCallback, useRef } from 'react';
7
+ import * as styledBase from 'styled-components';
8
+ import styledBase__default from 'styled-components';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
+
11
+ // src/app/helpers/styled.ts
12
+ var styled_exports = {};
13
+ __export(styled_exports, {
14
+ default: () => styled_default
15
+ });
16
+ __reExport(styled_exports, styledBase);
17
+ var styled = typeof styledBase__default.default === "function" ? styledBase__default.default : styledBase__default;
18
+ var styled_default = styled;
19
+
20
+ // src/web/forms/primitives/index.ts
21
+ var FieldWrapper = styled_default("div")`
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: flex-start;
25
+ justify-content: flex-start;
26
+ gap: 0.25em;
27
+ `;
28
+ var ErrorMessage = styled_default("span")`
29
+ color: #AA0000;
30
+ `;
31
+ var ArrayContainer = styled_default("div")`
32
+ display: flex;
33
+ flex-direction: column;
34
+ align-items: flex-start;
35
+ justify-content: flex-start;
36
+ gap: 0.5em;
37
+ `;
38
+ var ArrayItemWrapper = styled_default("div")`
39
+ display: flex;
40
+ flex-direction: row;
41
+ align-items: flex-end;
42
+ justify-content: space-between;
43
+ gap: 0.5em;
44
+ `;
45
+ var createArrayItemField = (field) => ({
46
+ ...field,
47
+ array: false,
48
+ tags: {
49
+ ...field.tags,
50
+ label: void 0
51
+ }
52
+ });
53
+ var toOptionValue = (val) => {
54
+ if (val === null || val === void 0) return void 0;
55
+ if (typeof val === "boolean") return void 0;
56
+ return String(val);
57
+ };
58
+ var parseNumberValue = (raw) => raw === "" ? null : Number(raw);
59
+ var getSelectableValues = (possibleValues) => {
60
+ return possibleValues?.filter(
61
+ (v) => typeof v === "string" || typeof v === "number"
62
+ );
63
+ };
64
+ var formatCustomValue = (val) => {
65
+ if (val === null || val === void 0) return "None";
66
+ if (typeof val === "string" || typeof val === "number") return String(val);
67
+ return JSON.stringify(val, null, 2);
68
+ };
69
+ var renderErrorMessage = (context) => {
70
+ const { error, errors = [], translateValidationErrorCode } = context;
71
+ const descriptors = (errors.length ? errors : error ? [error] : []).filter(
72
+ (descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
73
+ );
74
+ if (!descriptors.length) {
75
+ return null;
76
+ }
77
+ return /* @__PURE__ */ jsx(Fragment, { children: descriptors.map((descriptor, index) => {
78
+ const message = translateValidationErrorCode(descriptor);
79
+ if (!message) {
80
+ return null;
81
+ }
82
+ return /* @__PURE__ */ jsx(ErrorMessage, { children: message }, `${descriptor.code}-${index}`);
83
+ }) });
84
+ };
85
+ var RelationSingleField = (context) => {
86
+ const { field, fieldKey, label, required, disabled, onRelationAction } = context;
87
+ const id = `field-${fieldKey}`;
88
+ const handleManageRelation = useCallback(() => {
89
+ onRelationAction?.({
90
+ action: "open",
91
+ fieldKey,
92
+ field,
93
+ value: void 0,
94
+ fullPaging: field.tags?.fullPaging,
95
+ onChange: context.onChange
96
+ });
97
+ }, [context.onChange, field, fieldKey, onRelationAction]);
98
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
99
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
100
+ label,
101
+ " ",
102
+ required && "*"
103
+ ] }),
104
+ onRelationAction ? /* @__PURE__ */ jsx(
105
+ "button",
106
+ {
107
+ "data-signifier": "manage",
108
+ type: "button",
109
+ disabled,
110
+ onClick: handleManageRelation,
111
+ children: "Manage"
112
+ }
113
+ ) : void 0,
114
+ renderErrorMessage(context)
115
+ ] });
116
+ };
117
+ var RelationArrayField = (context) => {
118
+ const { field, fieldKey, label, required, disabled, onRelationAction } = context;
119
+ const id = `field-${fieldKey}`;
120
+ const handleManageRelation = useCallback(() => {
121
+ onRelationAction?.({
122
+ action: "open",
123
+ fieldKey,
124
+ field,
125
+ value: void 0,
126
+ fullPaging: field.tags?.fullPaging,
127
+ onChange: context.onChange
128
+ });
129
+ }, [context.onChange, field, fieldKey, onRelationAction]);
130
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
131
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
132
+ label,
133
+ " ",
134
+ required && "*"
135
+ ] }),
136
+ onRelationAction ? /* @__PURE__ */ jsx(
137
+ "button",
138
+ {
139
+ "data-signifier": "manage-related",
140
+ type: "button",
141
+ disabled,
142
+ onClick: handleManageRelation,
143
+ children: "Manage"
144
+ }
145
+ ) : void 0,
146
+ renderErrorMessage(context)
147
+ ] });
148
+ };
149
+ var CustomSingleField = (context) => {
150
+ const { field, fieldKey, label, required, disabled } = context;
151
+ const id = `field-${fieldKey}`;
152
+ const customType = field.tags?.customType;
153
+ const onCustomTypeAction = context.onCustomTypeAction;
154
+ const handleManageCustomType = useCallback(() => {
155
+ if (!customType) {
156
+ return;
157
+ }
158
+ onCustomTypeAction?.({
159
+ action: "open",
160
+ fieldKey,
161
+ field,
162
+ customType,
163
+ value: context.value,
164
+ onChange: context.onChange
165
+ });
166
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
167
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
168
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
169
+ label,
170
+ " ",
171
+ required && "*"
172
+ ] }),
173
+ /* @__PURE__ */ jsx(RelationValue, { children: formatCustomValue(context.value) }),
174
+ customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
175
+ "button",
176
+ {
177
+ "data-signifier": "manage",
178
+ type: "button",
179
+ disabled,
180
+ onClick: handleManageCustomType,
181
+ children: "Manage"
182
+ }
183
+ ) : void 0,
184
+ renderErrorMessage(context)
185
+ ] });
186
+ };
187
+ var CustomArrayField = (context) => {
188
+ const { field, fieldKey, label, required, disabled } = context;
189
+ const id = `field-${fieldKey}`;
190
+ const customType = field.tags?.customType;
191
+ const onCustomTypeAction = context.onCustomTypeAction;
192
+ const arrayValue = Array.isArray(context.value) ? context.value : [];
193
+ const handleEditItem = useCallback((event) => {
194
+ if (!customType) {
195
+ return;
196
+ }
197
+ const indexRaw = event.currentTarget.getAttribute("data-array-index");
198
+ if (!indexRaw) {
199
+ return;
200
+ }
201
+ const index = Number(indexRaw);
202
+ if (!Number.isFinite(index)) {
203
+ return;
204
+ }
205
+ onCustomTypeAction?.({
206
+ action: "edit",
207
+ fieldKey,
208
+ field,
209
+ customType,
210
+ value: context.value,
211
+ index,
212
+ onChange: context.onChange
213
+ });
214
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
215
+ const handleRemoveItem = useCallback((event) => {
216
+ if (!customType) {
217
+ return;
218
+ }
219
+ const indexRaw = event.currentTarget.getAttribute("data-array-index");
220
+ if (!indexRaw) {
221
+ return;
222
+ }
223
+ const index = Number(indexRaw);
224
+ if (!Number.isFinite(index)) {
225
+ return;
226
+ }
227
+ onCustomTypeAction?.({
228
+ action: "remove",
229
+ fieldKey,
230
+ field,
231
+ customType,
232
+ value: context.value,
233
+ index,
234
+ onChange: context.onChange
235
+ });
236
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
237
+ const handleAddItem = useCallback(() => {
238
+ if (!customType) {
239
+ return;
240
+ }
241
+ onCustomTypeAction?.({
242
+ action: "add",
243
+ fieldKey,
244
+ field,
245
+ customType,
246
+ value: context.value,
247
+ onChange: context.onChange
248
+ });
249
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
250
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
251
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
252
+ label,
253
+ " ",
254
+ required && "*"
255
+ ] }),
256
+ /* @__PURE__ */ jsxs(RelationList, { children: [
257
+ arrayValue.length === 0 && /* @__PURE__ */ jsx(RelationValue, { children: "No items yet." }),
258
+ arrayValue.map((item, index) => /* @__PURE__ */ jsxs(RelationItem, { children: [
259
+ /* @__PURE__ */ jsx(RelationValue, { children: formatCustomValue(item) }),
260
+ /* @__PURE__ */ jsxs(RelationActions, { children: [
261
+ customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
262
+ "button",
263
+ {
264
+ "data-signifier": "manage",
265
+ "data-array-index": String(index),
266
+ type: "button",
267
+ disabled,
268
+ onClick: handleEditItem,
269
+ children: "Manage"
270
+ }
271
+ ) : void 0,
272
+ customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
273
+ "button",
274
+ {
275
+ type: "button",
276
+ "data-array-index": String(index),
277
+ disabled,
278
+ onClick: handleRemoveItem,
279
+ children: "Remove"
280
+ }
281
+ ) : void 0
282
+ ] })
283
+ ] }, `${fieldKey}-${index}`))
284
+ ] }),
285
+ customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
286
+ "button",
287
+ {
288
+ type: "button",
289
+ disabled,
290
+ onClick: handleAddItem,
291
+ children: "Add Item"
292
+ }
293
+ ) : void 0,
294
+ renderErrorMessage(context)
295
+ ] });
296
+ };
297
+ var ArrayField = (context) => {
298
+ const { field, fieldKey, label, required, disabled } = context;
299
+ const id = `field-${fieldKey}`;
300
+ const itemField = createArrayItemField(field);
301
+ const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
302
+ const handleRemoveArrayItem = useCallback((event) => {
303
+ const indexRaw = event.currentTarget.getAttribute("data-array-index");
304
+ if (!indexRaw) {
305
+ return;
306
+ }
307
+ const index = Number(indexRaw);
308
+ if (!Number.isFinite(index)) {
309
+ return;
310
+ }
311
+ const newValue = [...arrayValue];
312
+ newValue.splice(index, 1);
313
+ context.onChange(newValue);
314
+ }, [arrayValue, context]);
315
+ const handleAddArrayItem = useCallback(() => {
316
+ const baseValue = Array.isArray(context.value) ? context.value : [];
317
+ const newValue = [...baseValue];
318
+ const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
319
+ newValue.push(newItem);
320
+ context.onChange(newValue);
321
+ }, [context, field.type]);
322
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
323
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
324
+ label,
325
+ " ",
326
+ required && "*"
327
+ ] }),
328
+ /* @__PURE__ */ jsxs(ArrayContainer, { children: [
329
+ arrayValue.map((item, index) => /* @__PURE__ */ jsxs(ArrayItemWrapper, { children: [
330
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: context.renderField({
331
+ field: itemField,
332
+ fieldKey: `${fieldKey}[${index}]`,
333
+ value: item,
334
+ onChange: (newItem) => {
335
+ const newValue = [...arrayValue];
336
+ newValue[index] = newItem;
337
+ context.onChange(newValue);
338
+ },
339
+ errors: context.arrayItemErrorMap?.[index] ?? [],
340
+ error: context.arrayItemErrorMap?.[index]?.find(
341
+ (descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
342
+ ) ?? void 0,
343
+ translateValidationErrorCode: context.translateValidationErrorCode,
344
+ disabled
345
+ }) }),
346
+ /* @__PURE__ */ jsx(
347
+ "button",
348
+ {
349
+ type: "button",
350
+ "data-array-index": String(index),
351
+ disabled,
352
+ onClick: handleRemoveArrayItem,
353
+ children: "Remove"
354
+ }
355
+ )
356
+ ] }, index)),
357
+ /* @__PURE__ */ jsx(
358
+ "button",
359
+ {
360
+ type: "button",
361
+ disabled,
362
+ onClick: handleAddArrayItem,
363
+ children: "Add Item"
364
+ }
365
+ )
366
+ ] }),
367
+ renderErrorMessage(context)
368
+ ] });
369
+ };
370
+ var StringField = (context) => {
371
+ const { fieldKey, label, required, disabled } = context;
372
+ const id = `field-${fieldKey}`;
373
+ const handleChange = useCallback((event) => {
374
+ context.onChange(event.target.value);
375
+ }, [context]);
376
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
377
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
378
+ label,
379
+ " ",
380
+ required && "*"
381
+ ] }),
382
+ /* @__PURE__ */ jsx(
383
+ "input",
384
+ {
385
+ id,
386
+ type: context.format || "text",
387
+ value: context.value || "",
388
+ onChange: handleChange,
389
+ disabled,
390
+ pattern: context.constraints?.pattern
391
+ }
392
+ ),
393
+ renderErrorMessage(context)
394
+ ] });
395
+ };
396
+ var NumberField = (context) => {
397
+ const { fieldKey, label, required, disabled } = context;
398
+ const id = `field-${fieldKey}`;
399
+ const handleChange = useCallback((event) => {
400
+ context.onChange(parseNumberValue(event.target.value));
401
+ }, [context]);
402
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
403
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
404
+ label,
405
+ " ",
406
+ required && "*"
407
+ ] }),
408
+ /* @__PURE__ */ jsx(
409
+ "input",
410
+ {
411
+ id,
412
+ type: "number",
413
+ value: context.value ?? "",
414
+ onChange: handleChange,
415
+ disabled,
416
+ min: context.constraints?.min,
417
+ max: context.constraints?.max,
418
+ step: context.constraints?.step
419
+ }
420
+ ),
421
+ renderErrorMessage(context)
422
+ ] });
423
+ };
424
+ var BooleanField = (context) => {
425
+ const { fieldKey, label, disabled } = context;
426
+ const id = `field-${fieldKey}`;
427
+ const handleChange = useCallback((event) => {
428
+ context.onChange(event.target.checked);
429
+ }, [context]);
430
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
431
+ /* @__PURE__ */ jsxs("div", { children: [
432
+ /* @__PURE__ */ jsx(
433
+ "input",
434
+ {
435
+ id,
436
+ type: "checkbox",
437
+ checked: !!context.value,
438
+ onChange: handleChange,
439
+ disabled
440
+ }
441
+ ),
442
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
443
+ " ",
444
+ label,
445
+ " "
446
+ ] })
447
+ ] }),
448
+ renderErrorMessage(context)
449
+ ] });
450
+ };
451
+ var EnumSelectField = (context) => {
452
+ const { field, fieldKey, label, required, disabled } = context;
453
+ const id = `field-${fieldKey}`;
454
+ const selectableValues = getSelectableValues(context.possibleValues);
455
+ const allowCustom = context.allowCustomSelection;
456
+ const handleCustomSelectionChange = useCallback(
457
+ (event) => {
458
+ context.onChange(
459
+ field.type === "number" ? parseNumberValue(event.target.value) : event.target.value
460
+ );
461
+ },
462
+ [context, field.type]
463
+ );
464
+ const handleSelectChange = useCallback(
465
+ (event) => {
466
+ context.onChange(
467
+ field.type === "number" ? parseNumberValue(event.target.value) : event.target.value
468
+ );
469
+ },
470
+ [context, field.type]
471
+ );
472
+ return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
473
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
474
+ label,
475
+ " ",
476
+ required && "*"
477
+ ] }),
478
+ (field.type === "string" || field.type === "number") && selectableValues && allowCustom && /* @__PURE__ */ jsxs(Fragment, { children: [
479
+ /* @__PURE__ */ jsx(
480
+ "input",
481
+ {
482
+ id,
483
+ type: "text",
484
+ list: `list-${id}`,
485
+ value: context.value ?? "",
486
+ onChange: handleCustomSelectionChange,
487
+ placeholder: "Select or type...",
488
+ disabled
489
+ }
490
+ ),
491
+ /* @__PURE__ */ jsx("datalist", { id: `list-${id}`, children: selectableValues.map((val) => /* @__PURE__ */ jsx("option", { value: toOptionValue(val) }, String(val))) })
492
+ ] }),
493
+ (field.type === "string" || field.type === "number") && selectableValues && !allowCustom && /* @__PURE__ */ jsxs(
494
+ "select",
495
+ {
496
+ id,
497
+ value: context.value ?? "",
498
+ onChange: handleSelectChange,
499
+ disabled,
500
+ children: [
501
+ /* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
502
+ selectableValues.map((val) => /* @__PURE__ */ jsx("option", { value: toOptionValue(val), children: String(val) }, String(val)))
503
+ ]
504
+ }
505
+ ),
506
+ renderErrorMessage(context)
507
+ ] });
508
+ };
509
+ var FormRoot = ({
510
+ children,
511
+ onSubmit
512
+ }) => {
513
+ const handleSubmit = (event) => {
514
+ event.preventDefault();
515
+ onSubmit?.();
516
+ };
517
+ return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit, children });
518
+ };
519
+ var SuiteButton = ({
520
+ children,
521
+ disabled,
522
+ type,
523
+ onClick,
524
+ "data-signifier": dataSignifier
525
+ }) => {
526
+ return createElement(
527
+ "button",
528
+ {
529
+ type: type ?? "button",
530
+ disabled,
531
+ onClick: type === "submit" ? void 0 : onClick,
532
+ "data-signifier": dataSignifier
533
+ },
534
+ children
535
+ );
536
+ };
537
+ var webSuite = {
538
+ renderers: {
539
+ string: StringField,
540
+ number: NumberField,
541
+ boolean: BooleanField,
542
+ enum_select: EnumSelectField,
543
+ array: ArrayField,
544
+ relation_single: RelationSingleField,
545
+ relation_array: RelationArrayField,
546
+ custom_single: CustomSingleField,
547
+ custom_array: CustomArrayField
548
+ },
549
+ primitives: {
550
+ FormRoot,
551
+ FieldWrapper,
552
+ ErrorMessage,
553
+ Label: ({ children, htmlFor }) => createElement("label", { htmlFor }, children),
554
+ Button: SuiteButton
555
+ }
556
+ };
557
+ var webAutoField = createFormRenderer({
558
+ fallbackSuite: webSuite
559
+ }).AutoField;
560
+ var RelationList = styled_default("div")`
561
+ display: flex;
562
+ flex-direction: column;
563
+ gap: 0.5em;
564
+ margin-bottom: 0.5em;
565
+ `;
566
+ var RelationItem = styled_default("div")`
567
+ display: flex;
568
+ flex-direction: column;
569
+ gap: 0.5em;
570
+ padding: 0.5em;
571
+ `;
572
+ var RelationValue = styled_default("pre")`
573
+ margin: 0;
574
+ padding: 0.5em;
575
+ font-size: 0.85em;
576
+ white-space: pre-wrap;
577
+ `;
578
+ var RelationActions = styled_default("div")`
579
+ display: flex;
580
+ gap: 0.5em;
581
+ flex-wrap: wrap;
582
+ `;
583
+
584
+ // src/web/forms/createWebFormRenderer.ts
585
+ var createWebFormRenderer = (options) => {
586
+ return createFormRenderer({
587
+ fallbackSuite: webSuite,
588
+ suite: options?.suite
589
+ });
590
+ };
591
+ var defaultWebRenderer = createWebFormRenderer();
592
+ var AutoField = (props) => {
593
+ return createElement(webAutoField, {
594
+ field: props.field,
595
+ fieldKey: props.fieldKey,
596
+ value: props.value,
597
+ onChange: props.onChange,
598
+ error: props.error,
599
+ errors: props.errors,
600
+ arrayItemErrorMap: props.arrayItemErrorMap,
601
+ translateValidationErrorCode: props.translateValidationErrorCode,
602
+ disabled: props.disabled,
603
+ onRelationAction: props.onRelationAction,
604
+ onCustomTypeAction: props.onCustomTypeAction
605
+ });
606
+ };
607
+ var AutoFormView2 = (props) => {
608
+ return /* @__PURE__ */ jsx(AutoFormView, { ...props, renderer: defaultWebRenderer });
609
+ };
610
+ var AutoForm2 = (props) => {
611
+ return /* @__PURE__ */ jsx(AutoForm, { ...props, renderer: defaultWebRenderer });
612
+ };
613
+ var EasyLayoutBase = styled_default("div")`
614
+ display: grid;
615
+ ${({ $layoutCss }) => $layoutCss}
616
+ `;
617
+ var EasyAreaBase = styled_default("div")`
618
+ grid-area: ${({ $area }) => $area};
619
+ `;
620
+ var styledFactory = {
621
+ createLayout: ({ base, css }) => {
622
+ const LayoutComponent = ({ children }) => {
623
+ const layoutProps = {
624
+ $layoutCss: css,
625
+ children
626
+ };
627
+ if (base) {
628
+ layoutProps.as = base;
629
+ }
630
+ return /* @__PURE__ */ jsx(EasyLayoutBase, { ...layoutProps });
631
+ };
632
+ return LayoutComponent;
633
+ },
634
+ createArea: ({ base, area }) => {
635
+ const AreaComponent = ({ children }) => {
636
+ const areaProps = {
637
+ $area: area,
638
+ children
639
+ };
640
+ if (base) {
641
+ areaProps.as = base;
642
+ }
643
+ return /* @__PURE__ */ jsx(EasyAreaBase, { ...areaProps });
644
+ };
645
+ return AreaComponent;
646
+ }
647
+ };
648
+ var getEasyLayout = (extendFrom, areasExtendFrom, options = {}) => {
649
+ return createEasyLayout(styledFactory, extendFrom, areasExtendFrom, options);
650
+ };
651
+ var NavLink = ({
652
+ path,
653
+ replace = false,
654
+ onClick,
655
+ title,
656
+ children,
657
+ ...other
658
+ }) => {
659
+ const { adapter, adapterBasePath } = useRouteContext();
660
+ const href = resolveRouteAdapterPath(adapterBasePath, path);
661
+ const onClickInternal = (event) => {
662
+ onClick?.(event);
663
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) {
664
+ return;
665
+ }
666
+ const navigate = replace ? adapter?.replace : adapter?.push;
667
+ if (!navigate) {
668
+ return;
669
+ }
670
+ event.preventDefault();
671
+ navigate(path, title);
672
+ };
673
+ return createElement(
674
+ "a",
675
+ {
676
+ ...other,
677
+ href,
678
+ title,
679
+ onClick: onClickInternal
680
+ },
681
+ children
682
+ );
683
+ };
684
+ var Route2 = (props) => {
685
+ const hasMatcherProps = typeof props.path !== "undefined" || typeof props.exact !== "undefined" || typeof props.onParamsChange !== "undefined";
686
+ const adapterRef = useRef(null);
687
+ const shouldUseAutoBrowserAdapter = !hasMatcherProps && typeof props.adapter === "undefined" && typeof props.ingress === "undefined";
688
+ const routeProps = props;
689
+ if (shouldUseAutoBrowserAdapter && !adapterRef.current) {
690
+ adapterRef.current = createBrowserRouteAdapter();
691
+ }
692
+ return shouldUseAutoBrowserAdapter ? /* @__PURE__ */ jsx(
693
+ Route,
694
+ {
695
+ ...routeProps,
696
+ adapter: adapterRef.current ?? void 0
697
+ }
698
+ ) : /* @__PURE__ */ jsx(Route, { ...routeProps });
699
+ };
700
+
701
+ export { ArrayContainer, ArrayItemWrapper, AutoField, AutoForm2 as AutoForm, AutoFormView2 as AutoFormView, ErrorMessage, FieldWrapper, NavLink, Route2 as Route, createWebFormRenderer, getEasyLayout, webAutoField, webSuite };