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

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 +3551 -1946
  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
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Core engine logic for managing form state.
5
+ */
6
+ import type { TypeInfo } from "../../common/TypeParsing/TypeInfo";
7
+ import { TypeOperation } from "../../common/TypeParsing/TypeInfo";
8
+ import { type FieldValueValidatorMap } from "../../common/TypeParsing/Validation";
9
+ import type { FormController, FormValues } from "./types";
10
+ /**
11
+ * Hook that derives form state and field controllers from type metadata.
12
+ *
13
+ * @param initialValues - Initial form values.
14
+ * @param typeInfo - Type metadata for the form.
15
+ * @param options - Optional behavior overrides.
16
+ * @returns Form controller with state, fields, and validation helpers.
17
+ */
18
+ export declare const useFormEngine: (initialValues: FormValues | undefined, typeInfo: TypeInfo, options?: {
19
+ /** Operation to evaluate when deriving field state. */
20
+ operation?: TypeOperation;
21
+ /** Optional custom validators keyed by field name. */
22
+ customValidatorMap?: FieldValueValidatorMap;
23
+ }) => FormController;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Shared AutoForm UI components driven by renderer suites.
5
+ */
6
+ import type { ReactElement } from "react";
7
+ import { FC } from "react";
8
+ import type { TypeInfo, TypeOperation } from "../../common/TypeParsing/TypeInfo";
9
+ import type { AutoFieldProps, CustomTypeActionPayload, CustomValidatorMap, FormController, FormValues, RelationActionPayload, TranslateValidationErrorCode } from "./types";
10
+ import type { ResolvedSuite } from "./core/types";
11
+ /**
12
+ * Renderer contract used by shared AutoForm components.
13
+ */
14
+ export interface AutoFormRenderer {
15
+ /** Suite-backed field component for each field controller. */
16
+ AutoField: FC<AutoFieldProps>;
17
+ /** Resolved suite that provides primitives for container controls. */
18
+ suite: ResolvedSuite<ReactElement>;
19
+ }
20
+ /**
21
+ * Props for the shared AutoFormView component.
22
+ */
23
+ export interface AutoFormViewProps {
24
+ /** Prepared controller that supplies field state. */
25
+ controller: FormController;
26
+ /** Submit handler invoked with validated form values. */
27
+ onSubmit: (values: FormValues) => void;
28
+ /** Renderer containing AutoField and suite primitives. */
29
+ renderer: AutoFormRenderer;
30
+ /** Disable the submit button when true. */
31
+ submitDisabled?: boolean;
32
+ /** Optional relation action handler for reference fields. */
33
+ onRelationAction?: (payload: RelationActionPayload) => void;
34
+ /** Optional custom type action handler. */
35
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
36
+ /** Optional translator for validation error descriptors. */
37
+ translateValidationErrorCode?: TranslateValidationErrorCode;
38
+ }
39
+ /**
40
+ * Render a form UI from a prepared form controller.
41
+ *
42
+ * @param props - View props including controller and callbacks.
43
+ * @returns Rendered form view.
44
+ */
45
+ export declare const AutoFormView: FC<AutoFormViewProps>;
46
+ /**
47
+ * Props for the shared AutoForm component.
48
+ */
49
+ export interface AutoFormProps {
50
+ /** Type metadata used to build the form. */
51
+ typeInfo: TypeInfo;
52
+ /** Submit handler invoked with validated form values. */
53
+ onSubmit: (values: FormValues) => void;
54
+ /** Renderer containing AutoField and suite primitives. */
55
+ renderer: AutoFormRenderer;
56
+ /** Optional initial values applied before defaults. */
57
+ initialValues?: FormValues;
58
+ /** Optional change handler invoked when values update. */
59
+ onValuesChange?: (values: FormValues) => void;
60
+ /** Optional relation action handler for reference fields. */
61
+ onRelationAction?: (payload: RelationActionPayload) => void;
62
+ /** Optional custom type action handler. */
63
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
64
+ /** Optional operation override for field state. */
65
+ operation?: TypeOperation;
66
+ /** Disable the submit button when true. */
67
+ submitDisabled?: boolean;
68
+ /** Optional translator for validation error descriptors. */
69
+ translateValidationErrorCode?: TranslateValidationErrorCode;
70
+ /** Optional custom validators keyed by field name. */
71
+ customValidatorMap?: CustomValidatorMap;
72
+ }
73
+ /**
74
+ * Default translation from error descriptors to readable messages.
75
+ */
76
+ export declare const defaultTranslateValidationErrorCode: TranslateValidationErrorCode;
77
+ /**
78
+ * Build a controller from type metadata and render an auto form.
79
+ *
80
+ * @param props - Auto form props including type info and callbacks.
81
+ * @returns Rendered form bound to a new controller.
82
+ */
83
+ export declare const AutoForm: FC<AutoFormProps>;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Factory for AutoField that delegates rendering to a resolved suite.
5
+ */
6
+ import { type FC, type ReactElement } from "react";
7
+ import type { TypeInfoField } from "../../../common/TypeParsing/TypeInfo";
8
+ import { type ErrorDescriptor, type ArrayItemErrorMap } from "../../../common/TypeParsing/Validation";
9
+ import type { CustomTypeActionPayload, FieldValue, RelationActionPayload, ResolvedSuite } from "./types";
10
+ /**
11
+ * Input props for AutoField render delegation.
12
+ */
13
+ export type AutoFieldInput = {
14
+ /** Type info describing the field to render. */
15
+ field: TypeInfoField;
16
+ /** Key that identifies the field in the form values. */
17
+ fieldKey: string;
18
+ /** Current value for the field. */
19
+ value: FieldValue | undefined;
20
+ /** Change handler for the field value. */
21
+ onChange: (value: FieldValue) => void;
22
+ /** Optional error descriptor to display under the field. */
23
+ error?: ErrorDescriptor;
24
+ /** Optional value-level errors for the field. */
25
+ errors?: ErrorDescriptor[];
26
+ /** Optional per-index errors for array fields. */
27
+ arrayItemErrorMap?: ArrayItemErrorMap;
28
+ /** Optional translator for validation error descriptors. */
29
+ translateValidationErrorCode?: (error: ErrorDescriptor) => string;
30
+ /** Disables the field UI when true. */
31
+ disabled?: boolean;
32
+ /** Optional callback for relation actions. */
33
+ onRelationAction?: (payload: RelationActionPayload) => void;
34
+ /** Optional callback for custom type actions. */
35
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
36
+ };
37
+ /**
38
+ * Create an AutoField renderer that delegates to a resolved suite.
39
+ *
40
+ * @param suite - Resolved component suite.
41
+ * @returns AutoField renderer function.
42
+ */
43
+ export declare const createAutoField: <RenderOutput = ReactElement>(suite: ResolvedSuite<RenderOutput>) => FC<AutoFieldInput>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Factory for building form renderers backed by component suites.
5
+ */
6
+ import type { ReactElement } from "react";
7
+ import type { ResolvedSuite, ComponentSuite } from "./types";
8
+ import { type AutoFieldInput } from "./createAutoField";
9
+ /**
10
+ * Build form renderers backed by resolved component suites.
11
+ *
12
+ * @param options - Suite configuration.
13
+ * @returns Renderer helpers tied to resolved suites.
14
+ */
15
+ export declare const createFormRenderer: <RenderOutput = ReactElement>(options: {
16
+ fallbackSuite: ComponentSuite<RenderOutput>;
17
+ suite?: ComponentSuite<RenderOutput>;
18
+ }) => {
19
+ AutoField: import("react").FC<AutoFieldInput>;
20
+ suite: ResolvedSuite<RenderOutput>;
21
+ };
22
+ /**
23
+ * Props for AutoField produced by {@link createFormRenderer}.
24
+ */
25
+ export type AutoFieldRendererProps = AutoFieldInput;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Resolve the field kind used for renderer selection.
5
+ */
6
+ import type { TypeInfoField } from "../../../common/TypeParsing/TypeInfo";
7
+ import type { FieldKind } from "./types";
8
+ /**
9
+ * Derive a {@link FieldKind} from type info metadata.
10
+ *
11
+ * @param field - Field metadata to evaluate.
12
+ * @returns Field kind for renderer selection.
13
+ */
14
+ export declare const getFieldKind: (field: TypeInfoField) => FieldKind;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Core, platform-agnostic form types and helpers.
5
+ */
6
+ export * from "./types";
7
+ export * from "./getFieldKind";
8
+ export * from "./resolveSuite";
9
+ export * from "./createAutoField";
10
+ export * from "./createFormRenderer";
11
+ export * from "./mergeSuites";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Helpers for composing component suites.
5
+ */
6
+ import type { ReactElement } from "react";
7
+ import type { ComponentSuite, FieldKind, FieldRenderer } from "./types";
8
+ /**
9
+ * Deep-merge component suites, allowing overrides for renderers and primitives.
10
+ *
11
+ * @param base - Base suite to extend.
12
+ * @param overrides - Partial suite overrides.
13
+ * @returns Merged suite.
14
+ */
15
+ export declare const mergeSuites: <RenderOutput = ReactElement>(base: ComponentSuite<RenderOutput>, overrides: ComponentSuite<RenderOutput>) => ComponentSuite<RenderOutput>;
16
+ /**
17
+ * Convenience helper to override a single renderer.
18
+ *
19
+ * @param kind - Field kind to override.
20
+ * @param renderer - Replacement renderer.
21
+ * @returns Suite with renderer override.
22
+ */
23
+ export declare const withRendererOverride: <RenderOutput = ReactElement>(kind: FieldKind, renderer: FieldRenderer<RenderOutput>) => ComponentSuite<RenderOutput>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Resolve a component suite by merging overrides with fallback defaults.
5
+ */
6
+ import type { ReactElement } from "react";
7
+ import type { ComponentSuite, ResolvedSuite } from "./types";
8
+ /**
9
+ * Merge a fallback suite with overrides and ensure completeness.
10
+ *
11
+ * @param overrides - Partial suite to apply on top of fallback.
12
+ * @param fallback - Default suite providing full coverage.
13
+ * @returns Fully resolved suite with all renderers present.
14
+ */
15
+ export declare const resolveSuite: <RenderOutput = ReactElement>(overrides: ComponentSuite<RenderOutput> | undefined, fallback: ComponentSuite<RenderOutput>) => ResolvedSuite<RenderOutput>;
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Core, platform-agnostic types for form rendering.
5
+ */
6
+ import type { ComponentType, ReactElement } from "react";
7
+ import type { LiteralValue, TypeInfoDataItem, TypeInfoField } from "../../../common/TypeParsing/TypeInfo";
8
+ import type { ArrayItemErrorMap, ErrorDescriptor } from "../../../common/TypeParsing/Validation";
9
+ import type { ItemRelationshipInfoType } from "../../../common/ItemRelationshipInfoTypes";
10
+ /**
11
+ * Supported field kinds for renderer selection.
12
+ */
13
+ export type FieldKind = "string" | "number" | "boolean" | "enum_select" | "array" | "relation_single" | "relation_array" | "custom_single" | "custom_array";
14
+ /**
15
+ * Value type for a single form field.
16
+ */
17
+ export type FieldValue = TypeInfoDataItem[keyof TypeInfoDataItem];
18
+ /**
19
+ * Constraints extracted from TypeInfo field tags.
20
+ */
21
+ type FieldConstraints = NonNullable<TypeInfoField["tags"]>["constraints"];
22
+ /**
23
+ * Supported relation actions emitted by fields.
24
+ */
25
+ export type RelationAction = "open" | "add" | "edit" | "remove";
26
+ /**
27
+ * Payload for relation action callbacks.
28
+ */
29
+ export type RelationActionPayload = {
30
+ /** Relation action to perform. */
31
+ action: RelationAction;
32
+ /** Field key that initiated the action. */
33
+ fieldKey: string;
34
+ /** Field metadata for the relation. */
35
+ field: TypeInfoField;
36
+ /** Current relation value for the field. */
37
+ value: ItemRelationshipInfoType | ItemRelationshipInfoType[] | undefined;
38
+ /** Whether relation selection should use full paging. */
39
+ fullPaging?: boolean;
40
+ /** Index when acting on an array item. */
41
+ index?: number;
42
+ /** Change handler to update the relation value. */
43
+ onChange: (value: FieldValue) => void;
44
+ };
45
+ /**
46
+ * Supported actions for custom type handlers.
47
+ */
48
+ export type CustomTypeAction = "open" | "add" | "edit" | "remove";
49
+ /**
50
+ * Payload for custom type action callbacks.
51
+ */
52
+ export type CustomTypeActionPayload = {
53
+ /** Custom type action to perform. */
54
+ action: CustomTypeAction;
55
+ /** Field key that initiated the action. */
56
+ fieldKey: string;
57
+ /** Field metadata for the custom type. */
58
+ field: TypeInfoField;
59
+ /** Custom type identifier. */
60
+ customType: string;
61
+ /** Current value for the custom type. */
62
+ value: FieldValue | undefined;
63
+ /** Index when acting on an array item. */
64
+ index?: number;
65
+ /** Change handler to update the custom value. */
66
+ onChange: (value: FieldValue) => void;
67
+ };
68
+ /**
69
+ * Context passed to field renderers.
70
+ */
71
+ export type FieldRenderContext<RenderOutput = unknown> = {
72
+ /** Type info describing the field to render. */
73
+ field: TypeInfoField;
74
+ /** Key that identifies the field in the form values. */
75
+ fieldKey: string;
76
+ /** Display label for the field. */
77
+ label: string;
78
+ /** True when the field must be provided. */
79
+ required: boolean;
80
+ /** True when the field UI should be disabled. */
81
+ disabled: boolean;
82
+ /** Optional error descriptor to display under the field. */
83
+ error?: ErrorDescriptor;
84
+ /** Optional value-level errors for the field. */
85
+ errors?: ErrorDescriptor[];
86
+ /** Optional per-index errors for array fields. */
87
+ arrayItemErrorMap?: ArrayItemErrorMap;
88
+ /** Translate an error descriptor to a user-facing message. */
89
+ translateValidationErrorCode: (error: ErrorDescriptor) => string;
90
+ /** Current value for the field. */
91
+ value: FieldValue | undefined;
92
+ /** Change handler for the field value. */
93
+ onChange: (value: FieldValue) => void;
94
+ /** Optional validation and UI constraints. */
95
+ constraints?: FieldConstraints;
96
+ /** Optional format hint for the field. */
97
+ format?: string;
98
+ /** Allowed literal values for the field. */
99
+ possibleValues?: LiteralValue[];
100
+ /** Whether custom entries are allowed for selectable values. */
101
+ allowCustomSelection?: boolean;
102
+ /** Optional custom type identifier. */
103
+ customType?: string;
104
+ /** Optional callback for relation actions. */
105
+ onRelationAction?: (payload: RelationActionPayload) => void;
106
+ /** Optional callback for custom type actions. */
107
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
108
+ /** Render any field with the same dispatch rules as the parent AutoField call. */
109
+ renderField: (input: {
110
+ field: TypeInfoField;
111
+ fieldKey: string;
112
+ value: FieldValue | undefined;
113
+ onChange: (value: FieldValue) => void;
114
+ error?: ErrorDescriptor;
115
+ errors?: ErrorDescriptor[];
116
+ arrayItemErrorMap?: ArrayItemErrorMap;
117
+ translateValidationErrorCode?: (error: ErrorDescriptor) => string;
118
+ disabled?: boolean;
119
+ onRelationAction?: (payload: RelationActionPayload) => void;
120
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
121
+ }) => RenderOutput;
122
+ };
123
+ /**
124
+ * Renderer component for a single field kind.
125
+ */
126
+ export type FieldRenderer<RenderOutput = ReactElement> = ComponentType<FieldRenderContext<RenderOutput>>;
127
+ /**
128
+ * Optional primitive component contract for suites.
129
+ */
130
+ export type PrimitiveComponent<Props, RenderOutput = ReactElement> = (props: Props) => RenderOutput;
131
+ /**
132
+ * Primitive components that suites may override.
133
+ */
134
+ export type PrimitiveComponents<RenderOutput = ReactElement> = {
135
+ /** Root container for the form view. */
136
+ FormRoot: PrimitiveComponent<{
137
+ children: RenderOutput;
138
+ onSubmit?: () => void;
139
+ }, RenderOutput>;
140
+ /** Wrapper for grouped field content. */
141
+ FieldWrapper: PrimitiveComponent<{
142
+ children: RenderOutput;
143
+ }, RenderOutput>;
144
+ /** Inline error message renderer. */
145
+ ErrorMessage: PrimitiveComponent<{
146
+ children: RenderOutput;
147
+ }, RenderOutput>;
148
+ /** Field label renderer. */
149
+ Label: PrimitiveComponent<{
150
+ children: RenderOutput;
151
+ htmlFor?: string;
152
+ }, RenderOutput>;
153
+ /** Button renderer. */
154
+ Button: PrimitiveComponent<{
155
+ children: RenderOutput;
156
+ disabled?: boolean;
157
+ type?: "button" | "submit";
158
+ onClick?: () => void;
159
+ "data-signifier"?: string;
160
+ }, RenderOutput>;
161
+ };
162
+ /**
163
+ * Suite definition with optional renderers/primitives.
164
+ */
165
+ export type ComponentSuite<RenderOutput = ReactElement> = {
166
+ /** Field renderers keyed by kind. */
167
+ renderers: Partial<Record<FieldKind, FieldRenderer<RenderOutput>>>;
168
+ /** Optional primitive component overrides. */
169
+ primitives?: Partial<PrimitiveComponents<RenderOutput>>;
170
+ };
171
+ /**
172
+ * Fully resolved suite with required renderers.
173
+ */
174
+ export type ResolvedSuite<RenderOutput = ReactElement> = {
175
+ /** Field renderers keyed by kind. */
176
+ renderers: Record<FieldKind, FieldRenderer<RenderOutput>>;
177
+ /** Optional primitive component overrides. */
178
+ primitives?: Partial<PrimitiveComponents<RenderOutput>>;
179
+ };
180
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Form generation module.
5
+ */
6
+ export * from "./types";
7
+ export * from "./core";
8
+ export * from "./Engine";
9
+ export * from "./UI";
@@ -0,0 +1,137 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Types for the form generation system.
5
+ */
6
+ import type { TypeInfo, TypeInfoDataItem, TypeInfoField, TypeOperation } from "../../common/TypeParsing/TypeInfo";
7
+ import type { ArrayErrorDescriptorCollection, ArrayItemErrorMap, ErrorDescriptor, FieldValueValidatorMap, TypeInfoValidationResults } from "../../common/TypeParsing/Validation";
8
+ import type { CustomTypeActionPayload, RelationActionPayload } from "./core/types";
9
+ export * from "./core/types";
10
+ /**
11
+ * Translates validation error descriptors into UI messages.
12
+ */
13
+ export type TranslateValidationErrorCode = (error: ErrorDescriptor) => string;
14
+ /**
15
+ * Optional custom field validators keyed by field name.
16
+ */
17
+ export type CustomValidatorMap = FieldValueValidatorMap;
18
+ /**
19
+ * Loose map of form values keyed by field.
20
+ */
21
+ export type FormValues = Partial<TypeInfoDataItem>;
22
+ /**
23
+ * Value type for a single form field.
24
+ */
25
+ export type FormValue = TypeInfoDataItem[keyof TypeInfoDataItem];
26
+ /**
27
+ * Constraints extracted from TypeInfo field tags.
28
+ */
29
+ type FieldConstraints = NonNullable<TypeInfoField["tags"]>["constraints"];
30
+ /**
31
+ * Props for primitive input components.
32
+ */
33
+ export interface PrimitiveInputProps<T = unknown> {
34
+ /** Current value for the input. */
35
+ value: T;
36
+ /** Callback invoked when the value changes. */
37
+ onChange: (value: T) => void;
38
+ /** Optional DOM id applied to the input. */
39
+ id?: string;
40
+ /** Placeholder text shown when the input is empty. */
41
+ placeholder?: string;
42
+ /** Disables the input when true. */
43
+ disabled?: boolean;
44
+ /** Flags the input as invalid for styling. */
45
+ hasError?: boolean;
46
+ }
47
+ /**
48
+ * Props for the AutoField component.
49
+ */
50
+ export interface AutoFieldProps {
51
+ /** Type info describing the field to render. */
52
+ field: TypeInfoField;
53
+ /** Key that identifies the field in the form values. */
54
+ fieldKey: string;
55
+ /** Current value for the field. */
56
+ value: FormValue | undefined;
57
+ /** Change handler for the field value. */
58
+ onChange: (value: FormValue) => void;
59
+ /** Optional primary error descriptor for convenience/backward compatibility. */
60
+ error?: ErrorDescriptor;
61
+ /** Optional list of value-level errors for the field. */
62
+ errors?: ErrorDescriptor[];
63
+ /** Optional per-index errors for array fields. */
64
+ arrayItemErrorMap?: ArrayItemErrorMap;
65
+ /** Optional translator from error descriptor to user-facing message. */
66
+ translateValidationErrorCode?: TranslateValidationErrorCode;
67
+ /** Disables the field UI when true. */
68
+ disabled?: boolean;
69
+ /** Optional callback for relation actions. */
70
+ onRelationAction?: (payload: RelationActionPayload) => void;
71
+ /** Optional callback for custom type actions. */
72
+ onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
73
+ }
74
+ /**
75
+ * Controller metadata for a single field instance.
76
+ */
77
+ export type FormFieldController = {
78
+ /** Field key as defined in the TypeInfo map. */
79
+ key: string;
80
+ /** Field metadata from the type info. */
81
+ field: TypeInfoField;
82
+ /** Display label for the field. */
83
+ label: string;
84
+ /** True when the field must be provided. */
85
+ required: boolean;
86
+ /** True when the field UI should be disabled. */
87
+ disabled: boolean;
88
+ /** True when the field should be hidden from view. */
89
+ hidden: boolean;
90
+ /** True when the field is the primary identifier. */
91
+ primary: boolean;
92
+ /** Optional format hint for the field. */
93
+ format?: string;
94
+ /** Optional validation and UI constraints. */
95
+ constraints?: FieldConstraints;
96
+ /** Current value for the field. */
97
+ value: FormValue | undefined;
98
+ /** Change handler for the field value. */
99
+ onChange: (value: FormValue) => void;
100
+ /** Optional primary error descriptor for the field. */
101
+ error?: ErrorDescriptor;
102
+ /** Optional list of value-level errors for the field. */
103
+ errors?: ErrorDescriptor[];
104
+ /** Optional per-index errors for array fields. */
105
+ arrayItemErrorMap?: ArrayItemErrorMap;
106
+ };
107
+ /**
108
+ * Validation errors keyed by field and represented as descriptors/codes.
109
+ */
110
+ export type FormErrorMap = Record<string, (ErrorDescriptor | ArrayErrorDescriptorCollection)[]>;
111
+ /**
112
+ * Input map used to set form errors, accepting descriptors or raw codes.
113
+ */
114
+ export type FormErrorInputMap = Record<string, ErrorDescriptor | string | ErrorDescriptor[] | ArrayItemErrorMap | (ErrorDescriptor | ArrayErrorDescriptorCollection)[]>;
115
+ /**
116
+ * Controller for a form instance and its fields.
117
+ */
118
+ export type FormController = {
119
+ /** Type metadata used to build the form. */
120
+ typeInfo: TypeInfo;
121
+ /** Optional type-level tags from the metadata. */
122
+ typeTags?: TypeInfo["tags"];
123
+ /** Active operation driving field state. */
124
+ operation: TypeOperation;
125
+ /** Current form values keyed by field. */
126
+ values: FormValues;
127
+ /** Validation errors keyed by field. */
128
+ errors: FormErrorMap;
129
+ /** Derived controllers for each field. */
130
+ fields: FormFieldController[];
131
+ /** Update a field value by key. */
132
+ setFieldValue: (key: string, value: FormValue) => void;
133
+ /** Validate the form and return success. */
134
+ validate: () => TypeInfoValidationResults;
135
+ /** Override form errors with a provided map. */
136
+ setErrors: (errors: FormErrorInputMap) => void;
137
+ };
@@ -0,0 +1,3 @@
1
+ export * from "styled-components";
2
+ declare const styled: any;
3
+ export default styled;