@resistdesign/voltra 3.0.0-alpha.2 → 3.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +327 -7
- package/api/DBX/DBXAsserts.d.ts +95 -0
- package/api/DBX/DBXRequest.d.ts +5 -0
- package/api/DBX/DBXRuntime.d.ts +5 -0
- package/api/DBX/DBXScenarioConfig.d.ts +9 -0
- package/api/DBX/DBXSeed.d.ts +124 -0
- package/api/DBX/DBXTypes.d.ts +176 -0
- package/api/DBX/index.d.ts +8 -0
- package/api/DataAccessControl.d.ts +220 -0
- package/api/Indexing/API.d.ts +224 -0
- package/api/Indexing/Cursor.d.ts +101 -0
- package/api/Indexing/Handler/Config.d.ts +39 -0
- package/api/Indexing/Handler.d.ts +166 -0
- package/api/Indexing/Trace.d.ts +54 -0
- package/api/Indexing/Types.d.ts +204 -0
- package/api/Indexing/ddb/AwsSdkV3Adapter.d.ts +8 -0
- package/api/Indexing/ddb/Types.d.ts +169 -0
- package/api/Indexing/docId.d.ts +27 -0
- package/api/Indexing/exact/ExactDdb.d.ts +58 -0
- package/api/Indexing/exact/ExactIndex.d.ts +90 -0
- package/api/Indexing/exact/ExactS3.d.ts +41 -0
- package/api/Indexing/fieldQualification.d.ts +12 -0
- package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +210 -0
- package/api/Indexing/fulltext/FullTextMemoryBackend.d.ts +93 -0
- package/api/Indexing/fulltext/Schema.d.ts +164 -0
- package/api/Indexing/hashUniversal.d.ts +13 -0
- package/api/Indexing/index.d.ts +45 -0
- package/api/Indexing/lossy/LossyDdb.d.ts +43 -0
- package/api/Indexing/lossy/LossyIndex.d.ts +72 -0
- package/api/Indexing/lossy/LossyS3.d.ts +40 -0
- package/api/Indexing/rel/Cursor.d.ts +25 -0
- package/api/Indexing/rel/Handlers.d.ts +143 -0
- package/api/Indexing/rel/RelationalDdb.d.ts +169 -0
- package/api/Indexing/rel/RelationalInMemoryBackend.d.ts +38 -0
- package/api/Indexing/rel/Types.d.ts +69 -0
- package/api/Indexing/structured/Cursor.d.ts +26 -0
- package/api/Indexing/structured/Handlers.d.ts +128 -0
- package/api/Indexing/structured/SearchStructured.d.ts +44 -0
- package/api/Indexing/structured/StructuredDdb.d.ts +166 -0
- package/api/Indexing/structured/StructuredDdbBackend.d.ts +109 -0
- package/api/Indexing/structured/StructuredInMemoryBackend.d.ts +34 -0
- package/api/Indexing/structured/StructuredInMemoryIndex.d.ts +58 -0
- package/api/Indexing/structured/StructuredStringLike.d.ts +25 -0
- package/api/Indexing/structured/StructuredWriter.d.ts +61 -0
- package/api/Indexing/structured/Types.d.ts +126 -0
- package/api/Indexing/structured/index.d.ts +9 -0
- package/api/Indexing/tokenize.d.ts +31 -0
- package/api/ORM/DACUtils.d.ts +270 -0
- package/api/ORM/ListItemUtils.d.ts +40 -0
- package/api/ORM/ORMRouteMap.d.ts +55 -0
- package/api/ORM/TypeInfoORMService.d.ts +555 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +229 -0
- package/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +89 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver/ConfigTypes.d.ts +4 -0
- package/api/ORM/drivers/InMemoryDataItemDBDriver.d.ts +55 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver/ConfigTypes.d.ts +13 -0
- package/api/ORM/drivers/InMemoryFileItemDBDriver.d.ts +98 -0
- package/api/ORM/drivers/InMemoryItemRelationshipDBDriver.d.ts +16 -0
- package/api/ORM/drivers/IndexingRelationshipDriver.d.ts +123 -0
- package/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +322 -0
- package/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +118 -0
- package/{src/api → api}/ORM/drivers/S3FileItemDBDriver.d.ts +27 -0
- package/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +36 -0
- package/{src/api → api}/ORM/drivers/common/Types.d.ts +120 -0
- package/api/ORM/drivers/index.d.ts +7 -0
- package/api/ORM/index.d.ts +7 -0
- package/api/ORM/indexing/criteriaToStructuredWhere.d.ts +17 -0
- package/api/Router/AWS.d.ts +80 -0
- package/api/Router/Auth.d.ts +14 -0
- package/api/Router/CORS.d.ts +66 -0
- package/{src/api → api}/Router/Types.d.ts +70 -4
- package/api/Router/index.d.ts +89 -0
- package/api/index.d.ts +68 -0
- package/api/index.js +9204 -0
- package/app/forms/Engine.d.ts +20 -0
- package/app/forms/core/createAutoField.d.ts +35 -0
- package/app/forms/core/createFormRenderer.d.ts +24 -0
- package/app/forms/core/getFieldKind.d.ts +14 -0
- package/app/forms/core/index.d.ts +11 -0
- package/app/forms/core/mergeSuites.d.ts +22 -0
- package/app/forms/core/resolveSuite.d.ts +14 -0
- package/app/forms/core/types.d.ts +153 -0
- package/app/forms/index.d.ts +9 -0
- package/app/forms/types.d.ts +156 -0
- package/app/helpers/styled.d.ts +3 -0
- package/app/index.d.ts +98 -0
- package/app/index.js +1386 -0
- package/{src/app → app}/utils/ApplicationState.d.ts +115 -0
- package/{src/app → app}/utils/ApplicationStateLoader.d.ts +40 -0
- package/app/utils/Controller.d.ts +10 -0
- package/app/utils/Debug.d.ts +14 -0
- package/app/utils/EasyLayout.d.ts +89 -0
- package/app/utils/History.d.ts +148 -0
- package/app/utils/Route.d.ts +129 -0
- package/app/utils/RouteHistory.d.ts +26 -0
- package/app/utils/Service.d.ts +45 -0
- package/app/utils/TypeInfoORMAPIUtils.d.ts +94 -0
- package/app/utils/TypeInfoORMClient.d.ts +103 -0
- package/app/utils/easy-layout/computeAreaBounds.d.ts +5 -0
- package/app/utils/easy-layout/computeTracks.d.ts +16 -0
- package/app/utils/easy-layout/index.d.ts +5 -0
- package/app/utils/easy-layout/parseTemplate.d.ts +12 -0
- package/app/utils/easy-layout/types.d.ts +52 -0
- package/app/utils/easy-layout/validateAreas.d.ts +5 -0
- package/app/utils/index.d.ts +23 -0
- package/{src/common/TypeParsing → build}/TypeMapping.d.ts +8 -0
- package/build/TypeParsing.d.ts +10 -0
- package/build/index.d.ts +15 -0
- package/build/index.js +579 -0
- package/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +9 -0
- package/common/CommandLine/index.d.ts +6 -0
- package/common/HelperTypes.d.ts +9 -0
- package/common/IdGeneration/getSimpleId.d.ts +8 -0
- package/{src/common → common}/ItemRelationshipInfoTypes.d.ts +19 -1
- package/common/ItemRelationships/ItemRelationshipValidation.d.ts +21 -0
- package/common/Logging/Utils.d.ts +19 -0
- package/common/Routing.d.ts +67 -0
- package/common/SearchTypes.d.ts +248 -0
- package/common/SearchUtils.d.ts +55 -0
- package/{src/common → common}/SearchValidation.d.ts +10 -0
- package/{src/common → common}/StringTransformers.d.ts +11 -0
- package/common/Testing/CLI.d.ts +6 -0
- package/common/Testing/CLI.js +432 -0
- package/{src/common → common}/Testing/Types.d.ts +103 -4
- package/{src/common → common}/Testing/Utils.d.ts +65 -1
- package/common/Testing/index.d.ts +8 -0
- package/common/TypeInfoDataItemUtils.d.ts +39 -0
- package/common/TypeInfoORM/Types.d.ts +342 -0
- package/common/TypeParsing/Constants.d.ts +4 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/Constants.d.ts +3 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/checkType.d.ts +6 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/checkUnionType.d.ts +6 -0
- package/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +8 -0
- package/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +14 -0
- package/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +18 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +9 -0
- package/{src/common → common}/TypeParsing/ParsingUtils/getTypeInfoField.d.ts +6 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +12 -0
- package/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +9 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +11 -0
- package/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +8 -0
- package/{src/common → common}/TypeParsing/TypeInfo.d.ts +61 -1
- package/{src/common → common}/TypeParsing/Utils.d.ts +26 -0
- package/{src/common → common}/TypeParsing/Validation.d.ts +105 -0
- package/common/TypeParsing/index.d.ts +8 -0
- package/common/index.d.ts +50 -0
- package/common/index.js +413 -0
- package/{src/iac → iac}/SimpleCFT.d.ts +46 -2
- package/iac/index.d.ts +40 -0
- package/iac/index.js +258 -0
- package/iac/packs/auth/user-management.d.ts +80 -0
- package/iac/packs/auth.d.ts +86 -0
- package/iac/packs/build/utils.d.ts +289 -0
- package/iac/packs/build.d.ts +92 -0
- package/iac/packs/cdn.d.ts +33 -0
- package/iac/packs/cloud-function.d.ts +67 -0
- package/{src/iac → iac}/packs/database.d.ts +4 -1
- package/{src/iac → iac}/packs/dns.d.ts +22 -1
- package/iac/packs/file-storage.d.ts +46 -0
- package/iac/packs/gateway.d.ts +79 -0
- package/iac/packs/index.d.ts +60 -0
- package/iac/packs/index.js +1622 -0
- package/iac/packs/repo.d.ts +28 -0
- package/iac/packs/ssl-certificate.d.ts +28 -0
- package/{src/iac → iac}/types/Constants.d.ts +15 -0
- package/iac/types/Renderers.d.ts +96 -0
- package/iac/types/Types.d.ts +131 -0
- package/iac/types/Utils.d.ts +9 -0
- package/{src/iac → iac}/utils/index.d.ts +56 -5
- package/iac/utils/patch-utils.d.ts +66 -0
- package/native/forms/createNativeFormRenderer.d.ts +21 -0
- package/native/forms/index.d.ts +8 -0
- package/native/forms/primitives/index.d.ts +48 -0
- package/native/forms/suite.d.ts +15 -0
- package/native/index.d.ts +15 -0
- package/native/index.js +1323 -0
- package/native/utils/EasyLayout.d.ts +88 -0
- package/native/utils/History.d.ts +113 -0
- package/native/utils/NativeRoute.d.ts +44 -0
- package/native/utils/Route.d.ts +50 -0
- package/native/utils/index.d.ts +11 -0
- package/package.json +87 -42
- package/web/forms/UI.d.ts +67 -0
- package/web/forms/createWebFormRenderer.d.ts +21 -0
- package/web/forms/index.d.ts +9 -0
- package/web/forms/primitives/index.d.ts +21 -0
- package/web/forms/suite.d.ts +15 -0
- package/web/index.d.ts +15 -0
- package/web/index.js +1297 -0
- package/web/utils/EasyLayout.d.ts +47 -0
- package/web/utils/Route.d.ts +20 -0
- package/web/utils/index.d.ts +7 -0
- package/src/api/DataAccessControl.d.ts +0 -85
- package/src/api/DataAccessControl.js +0 -159
- package/src/api/ORM/DACUtils.d.ts +0 -60
- package/src/api/ORM/DACUtils.js +0 -197
- package/src/api/ORM/ListItemUtils.d.ts +0 -7
- package/src/api/ORM/ListItemUtils.js +0 -22
- package/src/api/ORM/ORMRouteMap.d.ts +0 -19
- package/src/api/ORM/ORMRouteMap.js +0 -82
- package/src/api/ORM/TypeInfoORMService.d.ts +0 -103
- package/src/api/ORM/TypeInfoORMService.js +0 -581
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.d.ts +0 -63
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver/ConfigTypes.js +0 -2
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver.d.ts +0 -36
- package/src/api/ORM/drivers/DynamoDBDataItemDBDriver.js +0 -282
- package/src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.d.ts +0 -90
- package/src/api/ORM/drivers/S3FileItemDBDriver/ConfigTypes.js +0 -2
- package/src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.d.ts +0 -45
- package/src/api/ORM/drivers/S3FileItemDBDriver/S3FileDriver.js +0 -127
- package/src/api/ORM/drivers/S3FileItemDBDriver.js +0 -182
- package/src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.d.ts +0 -12
- package/src/api/ORM/drivers/common/SupportedTypeInfoORMDBDrivers.js +0 -20
- package/src/api/ORM/drivers/common/Types.js +0 -14
- package/src/api/ORM/drivers/common/index.js +0 -18
- package/src/api/ORM/drivers/index.d.ts +0 -3
- package/src/api/ORM/drivers/index.js +0 -19
- package/src/api/ORM/index.d.ts +0 -4
- package/src/api/ORM/index.js +0 -43
- package/src/api/Router/AWS.d.ts +0 -26
- package/src/api/Router/AWS.js +0 -76
- package/src/api/Router/Auth.d.ts +0 -2
- package/src/api/Router/Auth.js +0 -9
- package/src/api/Router/CORS.d.ts +0 -6
- package/src/api/Router/CORS.js +0 -27
- package/src/api/Router/Types.js +0 -2
- package/src/api/Router/index.d.ts +0 -18
- package/src/api/Router/index.js +0 -145
- package/src/api/index.d.ts +0 -3
- package/src/api/index.js +0 -39
- package/src/app/index.d.ts +0 -1
- package/src/app/index.js +0 -37
- package/src/app/utils/ApplicationState.js +0 -86
- package/src/app/utils/ApplicationStateLoader.js +0 -57
- package/src/app/utils/Controller.d.ts +0 -4
- package/src/app/utils/Controller.js +0 -47
- package/src/app/utils/Debug.d.ts +0 -4
- package/src/app/utils/Debug.js +0 -30
- package/src/app/utils/EasyLayout.d.ts +0 -49
- package/src/app/utils/EasyLayout.js +0 -122
- package/src/app/utils/Route.d.ts +0 -28
- package/src/app/utils/Route.js +0 -102
- package/src/app/utils/Service.d.ts +0 -12
- package/src/app/utils/Service.js +0 -34
- package/src/app/utils/TypeInfoORMAPIUtils.d.ts +0 -20
- package/src/app/utils/TypeInfoORMAPIUtils.js +0 -62
- package/src/app/utils/TypeInfoORMClient.d.ts +0 -24
- package/src/app/utils/TypeInfoORMClient.js +0 -69
- package/src/app/utils/index.d.ts +0 -8
- package/src/app/utils/index.js +0 -24
- package/src/common/CommandLine/collectRequiredEnvironmentVariables.d.ts +0 -1
- package/src/common/CommandLine/collectRequiredEnvironmentVariables.js +0 -16
- package/src/common/HelperTypes.d.ts +0 -3
- package/src/common/HelperTypes.js +0 -2
- package/src/common/IdGeneration/getSimpleId.d.ts +0 -4
- package/src/common/IdGeneration/getSimpleId.js +0 -16
- package/src/common/IdGeneration/index.js +0 -17
- package/src/common/ItemRelationshipInfoTypes.js +0 -20
- package/src/common/ItemRelationships/ItemRelationshipValidation.d.ts +0 -10
- package/src/common/ItemRelationships/ItemRelationshipValidation.js +0 -43
- package/src/common/ItemRelationships/index.js +0 -17
- package/src/common/Logging/Utils.d.ts +0 -10
- package/src/common/Logging/Utils.js +0 -33
- package/src/common/Logging/index.js +0 -17
- package/src/common/Routing.d.ts +0 -25
- package/src/common/Routing.js +0 -102
- package/src/common/SearchTypes.d.ts +0 -98
- package/src/common/SearchTypes.js +0 -39
- package/src/common/SearchUtils.d.ts +0 -22
- package/src/common/SearchUtils.js +0 -134
- package/src/common/SearchValidation.js +0 -90
- package/src/common/Storyboarding/Types.d.ts +0 -25
- package/src/common/Storyboarding/Types.js +0 -2
- package/src/common/StringTransformers.js +0 -36
- package/src/common/Testing/CLI.d.ts +0 -2
- package/src/common/Testing/CLI.js +0 -56
- package/src/common/Testing/Types.js +0 -19
- package/src/common/Testing/Utils.js +0 -334
- package/src/common/Testing/index.d.ts +0 -2
- package/src/common/Testing/index.js +0 -18
- package/src/common/TypeInfoDataItemUtils.d.ts +0 -10
- package/src/common/TypeInfoDataItemUtils.js +0 -55
- package/src/common/TypeInfoORM/Types.d.ts +0 -76
- package/src/common/TypeInfoORM/Types.js +0 -55
- package/src/common/TypeInfoORM/index.js +0 -17
- package/src/common/TypeParsing/Constants.d.ts +0 -1
- package/src/common/TypeParsing/Constants.js +0 -4
- package/src/common/TypeParsing/ParsingUtils/Constants.js +0 -8
- package/src/common/TypeParsing/ParsingUtils/checkType.js +0 -46
- package/src/common/TypeParsing/ParsingUtils/checkUnionType.js +0 -15
- package/src/common/TypeParsing/ParsingUtils/extractCommentTags.d.ts +0 -2
- package/src/common/TypeParsing/ParsingUtils/extractCommentTags.js +0 -105
- package/src/common/TypeParsing/ParsingUtils/extractLiteralValues.d.ts +0 -6
- package/src/common/TypeParsing/ParsingUtils/extractLiteralValues.js +0 -42
- package/src/common/TypeParsing/ParsingUtils/extractTypeDetails.d.ts +0 -8
- package/src/common/TypeParsing/ParsingUtils/extractTypeDetails.js +0 -14
- package/src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.d.ts +0 -5
- package/src/common/TypeParsing/ParsingUtils/getPrimaryFieldForTypeInfo.js +0 -27
- package/src/common/TypeParsing/ParsingUtils/getTypeInfo.d.ts +0 -3
- package/src/common/TypeParsing/ParsingUtils/getTypeInfo.js +0 -27
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoField.js +0 -44
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromAliasType.js +0 -28
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromFieldFilter.js +0 -105
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getTypeInfoFromTypeAlias.js +0 -20
- package/src/common/TypeParsing/ParsingUtils/getTypeKeyword.d.ts +0 -3
- package/src/common/TypeParsing/ParsingUtils/getTypeKeyword.js +0 -17
- package/src/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.d.ts +0 -4
- package/src/common/TypeParsing/ParsingUtils/getUnionOrIntersectionTypeInfo.js +0 -49
- package/src/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.d.ts +0 -2
- package/src/common/TypeParsing/ParsingUtils/getUnionOrLiteralStringValues.js +0 -24
- package/src/common/TypeParsing/TypeInfo.js +0 -13
- package/src/common/TypeParsing/TypeMapping.js +0 -32
- package/src/common/TypeParsing/TypeParsing.d.ts +0 -5
- package/src/common/TypeParsing/TypeParsing.js +0 -39
- package/src/common/TypeParsing/Utils.js +0 -94
- package/src/common/TypeParsing/Validation.js +0 -340
- package/src/common/TypeParsing/index.d.ts +0 -5
- package/src/common/TypeParsing/index.js +0 -44
- package/src/common/index.d.ts +0 -11
- package/src/common/index.js +0 -47
- package/src/iac/SimpleCFT.js +0 -82
- package/src/iac/index.d.ts +0 -9
- package/src/iac/index.js +0 -48
- package/src/iac/packs/auth/user-management.d.ts +0 -14
- package/src/iac/packs/auth/user-management.js +0 -302
- package/src/iac/packs/auth.d.ts +0 -19
- package/src/iac/packs/auth.js +0 -47
- package/src/iac/packs/build/utils.d.ts +0 -100
- package/src/iac/packs/build/utils.js +0 -23
- package/src/iac/packs/build.d.ts +0 -29
- package/src/iac/packs/build.js +0 -217
- package/src/iac/packs/cdn.d.ts +0 -12
- package/src/iac/packs/cdn.js +0 -113
- package/src/iac/packs/cloud-function.d.ts +0 -17
- package/src/iac/packs/cloud-function.js +0 -69
- package/src/iac/packs/database.js +0 -27
- package/src/iac/packs/dns.js +0 -26
- package/src/iac/packs/file-storage.d.ts +0 -14
- package/src/iac/packs/file-storage.js +0 -71
- package/src/iac/packs/gateway.d.ts +0 -27
- package/src/iac/packs/gateway.js +0 -342
- package/src/iac/packs/index.d.ts +0 -11
- package/src/iac/packs/index.js +0 -27
- package/src/iac/packs/repo.d.ts +0 -10
- package/src/iac/packs/repo.js +0 -34
- package/src/iac/packs/ssl-certificate.d.ts +0 -10
- package/src/iac/packs/ssl-certificate.js +0 -36
- package/src/iac/types/Constants.js +0 -20
- package/src/iac/types/IaCTypes.js +0 -14
- package/src/iac/types/Renderers.d.ts +0 -12
- package/src/iac/types/Renderers.js +0 -112
- package/src/iac/types/Types.d.ts +0 -37
- package/src/iac/types/Types.js +0 -2
- package/src/iac/types/Utils.d.ts +0 -2
- package/src/iac/types/Utils.js +0 -60
- package/src/iac/types/generate.js +0 -31
- package/src/iac/utils/index.js +0 -105
- package/src/iac/utils/patch-utils.d.ts +0 -15
- package/src/iac/utils/patch-utils.js +0 -62
- package/src/index.d.ts +0 -178
- package/src/index.js +0 -214
- /package/{src/api → api}/ORM/drivers/common/index.d.ts +0 -0
- /package/{src/common → common}/IdGeneration/index.d.ts +0 -0
- /package/{src/common → common}/ItemRelationships/index.d.ts +0 -0
- /package/{src/common → common}/Logging/index.d.ts +0 -0
- /package/{src/common → common}/TypeInfoORM/index.d.ts +0 -0
- /package/{src/iac → iac}/types/CloudFormationResourceSpecification.d.ts +0 -0
- /package/{src/iac → iac}/types/IaCTypes.d.ts +0 -0
- /package/{src/iac → iac}/types/generate.d.ts +0 -0
package/web/index.js
ADDED
|
@@ -0,0 +1,1297 @@
|
|
|
1
|
+
import * as styledBase from 'styled-components';
|
|
2
|
+
import styledBase__default from 'styled-components';
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { createContext, useContext, useEffect, useRef, useMemo, useState, useCallback } from 'react';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
23
|
+
|
|
24
|
+
// src/app/forms/core/getFieldKind.ts
|
|
25
|
+
var hasSelectableValues = (field) => {
|
|
26
|
+
const possibleValues = field.possibleValues ?? [];
|
|
27
|
+
return possibleValues.some(
|
|
28
|
+
(value) => typeof value === "string" || typeof value === "number"
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
var getFieldKind = (field) => {
|
|
32
|
+
if (field.typeReference) {
|
|
33
|
+
return field.array ? "relation_array" : "relation_single";
|
|
34
|
+
}
|
|
35
|
+
if (field.tags?.customType) {
|
|
36
|
+
return field.array ? "custom_array" : "custom_single";
|
|
37
|
+
}
|
|
38
|
+
if (field.array) {
|
|
39
|
+
return "array";
|
|
40
|
+
}
|
|
41
|
+
if (hasSelectableValues(field)) {
|
|
42
|
+
return "enum_select";
|
|
43
|
+
}
|
|
44
|
+
if (field.type === "boolean") {
|
|
45
|
+
return "boolean";
|
|
46
|
+
}
|
|
47
|
+
if (field.type === "number") {
|
|
48
|
+
return "number";
|
|
49
|
+
}
|
|
50
|
+
return "string";
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/app/forms/core/resolveSuite.ts
|
|
54
|
+
var fieldKinds = [
|
|
55
|
+
"string",
|
|
56
|
+
"number",
|
|
57
|
+
"boolean",
|
|
58
|
+
"enum_select",
|
|
59
|
+
"array",
|
|
60
|
+
"relation_single",
|
|
61
|
+
"relation_array",
|
|
62
|
+
"custom_single",
|
|
63
|
+
"custom_array"
|
|
64
|
+
];
|
|
65
|
+
var getMissingKinds = (renderers) => {
|
|
66
|
+
return fieldKinds.filter((kind) => !renderers[kind]);
|
|
67
|
+
};
|
|
68
|
+
var resolveSuite = (overrides, fallback) => {
|
|
69
|
+
const mergedRenderers = {
|
|
70
|
+
...fallback.renderers ?? {},
|
|
71
|
+
...overrides?.renderers ?? {}
|
|
72
|
+
};
|
|
73
|
+
const missingKinds = getMissingKinds(mergedRenderers);
|
|
74
|
+
if (missingKinds.length) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
`Missing renderers for field kinds: ${missingKinds.join(", ")}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const mergedPrimitives = {
|
|
80
|
+
...fallback.primitives ?? {},
|
|
81
|
+
...overrides?.primitives ?? {}
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
renderers: mergedRenderers,
|
|
85
|
+
primitives: Object.keys(mergedPrimitives).length ? mergedPrimitives : void 0
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/app/forms/core/createAutoField.ts
|
|
90
|
+
var createAutoField = (suite) => {
|
|
91
|
+
return (props) => {
|
|
92
|
+
const { field, fieldKey, value, onChange, error, disabled } = props;
|
|
93
|
+
const { tags } = field;
|
|
94
|
+
const context = {
|
|
95
|
+
field,
|
|
96
|
+
fieldKey,
|
|
97
|
+
label: tags?.label ?? fieldKey,
|
|
98
|
+
required: !field.optional,
|
|
99
|
+
disabled: !!disabled,
|
|
100
|
+
error,
|
|
101
|
+
value,
|
|
102
|
+
onChange,
|
|
103
|
+
constraints: tags?.constraints,
|
|
104
|
+
format: tags?.format,
|
|
105
|
+
possibleValues: field.possibleValues,
|
|
106
|
+
allowCustomSelection: tags?.allowCustomSelection,
|
|
107
|
+
customType: tags?.customType,
|
|
108
|
+
onRelationAction: props.onRelationAction,
|
|
109
|
+
onCustomTypeAction: props.onCustomTypeAction
|
|
110
|
+
};
|
|
111
|
+
const kind = getFieldKind(field);
|
|
112
|
+
return suite.renderers[kind](context);
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/app/forms/core/createFormRenderer.ts
|
|
117
|
+
var createFormRenderer = (options) => {
|
|
118
|
+
const resolvedSuite = resolveSuite(
|
|
119
|
+
options.suite,
|
|
120
|
+
options.fallbackSuite
|
|
121
|
+
);
|
|
122
|
+
const AutoField2 = createAutoField(resolvedSuite);
|
|
123
|
+
return {
|
|
124
|
+
AutoField: AutoField2,
|
|
125
|
+
suite: resolvedSuite
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// src/app/helpers/styled.ts
|
|
130
|
+
var styled_exports = {};
|
|
131
|
+
__export(styled_exports, {
|
|
132
|
+
default: () => styled_default
|
|
133
|
+
});
|
|
134
|
+
__reExport(styled_exports, styledBase);
|
|
135
|
+
var styled = typeof styledBase__default.default === "function" ? styledBase__default.default : styledBase__default;
|
|
136
|
+
var styled_default = styled;
|
|
137
|
+
|
|
138
|
+
// src/web/forms/primitives/index.ts
|
|
139
|
+
var FieldWrapper = styled_default("div")`
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-direction: column;
|
|
142
|
+
align-items: flex-start;
|
|
143
|
+
justify-content: flex-start;
|
|
144
|
+
gap: 0.25em;
|
|
145
|
+
`;
|
|
146
|
+
var ErrorMessage = styled_default("span")`
|
|
147
|
+
color: #AA0000;
|
|
148
|
+
`;
|
|
149
|
+
var ArrayContainer = styled_default("div")`
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
align-items: flex-start;
|
|
153
|
+
justify-content: flex-start;
|
|
154
|
+
gap: 0.5em;
|
|
155
|
+
`;
|
|
156
|
+
var ArrayItemWrapper = styled_default("div")`
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: row;
|
|
159
|
+
align-items: flex-end;
|
|
160
|
+
justify-content: space-between;
|
|
161
|
+
gap: 0.5em;
|
|
162
|
+
`;
|
|
163
|
+
var createArrayItemField = (field) => ({
|
|
164
|
+
...field,
|
|
165
|
+
array: false,
|
|
166
|
+
tags: {
|
|
167
|
+
...field.tags,
|
|
168
|
+
label: void 0
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
var toOptionValue = (val) => {
|
|
172
|
+
if (val === null || val === void 0) return void 0;
|
|
173
|
+
if (typeof val === "boolean") return void 0;
|
|
174
|
+
return String(val);
|
|
175
|
+
};
|
|
176
|
+
var parseNumberValue = (raw) => raw === "" ? null : Number(raw);
|
|
177
|
+
var getSelectableValues = (possibleValues) => {
|
|
178
|
+
return possibleValues?.filter(
|
|
179
|
+
(v) => typeof v === "string" || typeof v === "number"
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
var formatCustomValue = (val) => {
|
|
183
|
+
if (val === null || val === void 0) return "None";
|
|
184
|
+
if (typeof val === "string" || typeof val === "number") return String(val);
|
|
185
|
+
return JSON.stringify(val, null, 2);
|
|
186
|
+
};
|
|
187
|
+
var renderRelationSingle = (context) => {
|
|
188
|
+
const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
|
|
189
|
+
const id = `field-${fieldKey}`;
|
|
190
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
191
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
192
|
+
label,
|
|
193
|
+
" ",
|
|
194
|
+
required && "*"
|
|
195
|
+
] }),
|
|
196
|
+
onRelationAction ? /* @__PURE__ */ jsx(
|
|
197
|
+
"button",
|
|
198
|
+
{
|
|
199
|
+
"data-signifier": "manage",
|
|
200
|
+
type: "button",
|
|
201
|
+
disabled,
|
|
202
|
+
onClick: () => onRelationAction({
|
|
203
|
+
action: "open",
|
|
204
|
+
fieldKey,
|
|
205
|
+
field,
|
|
206
|
+
value: void 0,
|
|
207
|
+
fullPaging: field.tags?.fullPaging,
|
|
208
|
+
onChange: context.onChange
|
|
209
|
+
}),
|
|
210
|
+
children: "Manage"
|
|
211
|
+
}
|
|
212
|
+
) : void 0,
|
|
213
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
214
|
+
] });
|
|
215
|
+
};
|
|
216
|
+
var renderRelationArray = (context) => {
|
|
217
|
+
const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
|
|
218
|
+
const id = `field-${fieldKey}`;
|
|
219
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
220
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
221
|
+
label,
|
|
222
|
+
" ",
|
|
223
|
+
required && "*"
|
|
224
|
+
] }),
|
|
225
|
+
onRelationAction ? /* @__PURE__ */ jsx(
|
|
226
|
+
"button",
|
|
227
|
+
{
|
|
228
|
+
"data-signifier": "manage-related",
|
|
229
|
+
type: "button",
|
|
230
|
+
disabled,
|
|
231
|
+
onClick: () => onRelationAction({
|
|
232
|
+
action: "open",
|
|
233
|
+
fieldKey,
|
|
234
|
+
field,
|
|
235
|
+
value: void 0,
|
|
236
|
+
fullPaging: field.tags?.fullPaging,
|
|
237
|
+
onChange: context.onChange
|
|
238
|
+
}),
|
|
239
|
+
children: "Manage"
|
|
240
|
+
}
|
|
241
|
+
) : void 0,
|
|
242
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
243
|
+
] });
|
|
244
|
+
};
|
|
245
|
+
var renderCustomSingle = (context) => {
|
|
246
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
247
|
+
const id = `field-${fieldKey}`;
|
|
248
|
+
const customType = field.tags?.customType;
|
|
249
|
+
const onCustomTypeAction = context.onCustomTypeAction;
|
|
250
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
251
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
252
|
+
label,
|
|
253
|
+
" ",
|
|
254
|
+
required && "*"
|
|
255
|
+
] }),
|
|
256
|
+
/* @__PURE__ */ jsx(RelationValue, { children: formatCustomValue(context.value) }),
|
|
257
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
258
|
+
"button",
|
|
259
|
+
{
|
|
260
|
+
"data-signifier": "manage",
|
|
261
|
+
type: "button",
|
|
262
|
+
disabled,
|
|
263
|
+
onClick: () => onCustomTypeAction({
|
|
264
|
+
action: "open",
|
|
265
|
+
fieldKey,
|
|
266
|
+
field,
|
|
267
|
+
customType,
|
|
268
|
+
value: context.value,
|
|
269
|
+
onChange: context.onChange
|
|
270
|
+
}),
|
|
271
|
+
children: "Manage"
|
|
272
|
+
}
|
|
273
|
+
) : void 0,
|
|
274
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
275
|
+
] });
|
|
276
|
+
};
|
|
277
|
+
var renderCustomArray = (context) => {
|
|
278
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
279
|
+
const id = `field-${fieldKey}`;
|
|
280
|
+
const customType = field.tags?.customType;
|
|
281
|
+
const onCustomTypeAction = context.onCustomTypeAction;
|
|
282
|
+
const arrayValue = Array.isArray(context.value) ? context.value : [];
|
|
283
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
284
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
285
|
+
label,
|
|
286
|
+
" ",
|
|
287
|
+
required && "*"
|
|
288
|
+
] }),
|
|
289
|
+
/* @__PURE__ */ jsxs(RelationList, { children: [
|
|
290
|
+
arrayValue.length === 0 && /* @__PURE__ */ jsx(RelationValue, { children: "No items yet." }),
|
|
291
|
+
arrayValue.map((item, index) => /* @__PURE__ */ jsxs(RelationItem, { children: [
|
|
292
|
+
/* @__PURE__ */ jsx(RelationValue, { children: formatCustomValue(item) }),
|
|
293
|
+
/* @__PURE__ */ jsxs(RelationActions, { children: [
|
|
294
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
295
|
+
"button",
|
|
296
|
+
{
|
|
297
|
+
"data-signifier": "manage",
|
|
298
|
+
type: "button",
|
|
299
|
+
disabled,
|
|
300
|
+
onClick: () => onCustomTypeAction({
|
|
301
|
+
action: "edit",
|
|
302
|
+
fieldKey,
|
|
303
|
+
field,
|
|
304
|
+
customType,
|
|
305
|
+
value: context.value,
|
|
306
|
+
index,
|
|
307
|
+
onChange: context.onChange
|
|
308
|
+
}),
|
|
309
|
+
children: "Manage"
|
|
310
|
+
}
|
|
311
|
+
) : void 0,
|
|
312
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
313
|
+
"button",
|
|
314
|
+
{
|
|
315
|
+
type: "button",
|
|
316
|
+
disabled,
|
|
317
|
+
onClick: () => onCustomTypeAction({
|
|
318
|
+
action: "remove",
|
|
319
|
+
fieldKey,
|
|
320
|
+
field,
|
|
321
|
+
customType,
|
|
322
|
+
value: context.value,
|
|
323
|
+
index,
|
|
324
|
+
onChange: context.onChange
|
|
325
|
+
}),
|
|
326
|
+
children: "Remove"
|
|
327
|
+
}
|
|
328
|
+
) : void 0
|
|
329
|
+
] })
|
|
330
|
+
] }, `${fieldKey}-${index}`))
|
|
331
|
+
] }),
|
|
332
|
+
customType && onCustomTypeAction ? /* @__PURE__ */ jsx(
|
|
333
|
+
"button",
|
|
334
|
+
{
|
|
335
|
+
type: "button",
|
|
336
|
+
disabled,
|
|
337
|
+
onClick: () => onCustomTypeAction({
|
|
338
|
+
action: "add",
|
|
339
|
+
fieldKey,
|
|
340
|
+
field,
|
|
341
|
+
customType,
|
|
342
|
+
value: context.value,
|
|
343
|
+
onChange: context.onChange
|
|
344
|
+
}),
|
|
345
|
+
children: "Add Item"
|
|
346
|
+
}
|
|
347
|
+
) : void 0,
|
|
348
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
349
|
+
] });
|
|
350
|
+
};
|
|
351
|
+
var autoFieldRenderer;
|
|
352
|
+
var renderArray = (context) => {
|
|
353
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
354
|
+
const id = `field-${fieldKey}`;
|
|
355
|
+
const itemField = createArrayItemField(field);
|
|
356
|
+
const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
|
|
357
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
358
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
359
|
+
label,
|
|
360
|
+
" ",
|
|
361
|
+
required && "*"
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ jsxs(ArrayContainer, { children: [
|
|
364
|
+
arrayValue.map((item, index) => /* @__PURE__ */ jsxs(ArrayItemWrapper, { children: [
|
|
365
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: autoFieldRenderer({
|
|
366
|
+
field: itemField,
|
|
367
|
+
fieldKey: `${fieldKey}[${index}]`,
|
|
368
|
+
value: item,
|
|
369
|
+
onChange: (newItem) => {
|
|
370
|
+
const newValue = [...arrayValue];
|
|
371
|
+
newValue[index] = newItem;
|
|
372
|
+
context.onChange(newValue);
|
|
373
|
+
},
|
|
374
|
+
disabled
|
|
375
|
+
}) }),
|
|
376
|
+
/* @__PURE__ */ jsx(
|
|
377
|
+
"button",
|
|
378
|
+
{
|
|
379
|
+
type: "button",
|
|
380
|
+
disabled,
|
|
381
|
+
onClick: () => {
|
|
382
|
+
const newValue = [...arrayValue];
|
|
383
|
+
newValue.splice(index, 1);
|
|
384
|
+
context.onChange(newValue);
|
|
385
|
+
},
|
|
386
|
+
children: "Remove"
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
] }, index)),
|
|
390
|
+
/* @__PURE__ */ jsx(
|
|
391
|
+
"button",
|
|
392
|
+
{
|
|
393
|
+
type: "button",
|
|
394
|
+
disabled,
|
|
395
|
+
onClick: () => {
|
|
396
|
+
const baseValue = Array.isArray(context.value) ? context.value : [];
|
|
397
|
+
const newValue = [...baseValue];
|
|
398
|
+
const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
|
|
399
|
+
newValue.push(newItem);
|
|
400
|
+
context.onChange(newValue);
|
|
401
|
+
},
|
|
402
|
+
children: "Add Item"
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] }),
|
|
406
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
407
|
+
] });
|
|
408
|
+
};
|
|
409
|
+
var renderString = (context) => {
|
|
410
|
+
const { fieldKey, label, required, disabled, error } = context;
|
|
411
|
+
const id = `field-${fieldKey}`;
|
|
412
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
413
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
414
|
+
label,
|
|
415
|
+
" ",
|
|
416
|
+
required && "*"
|
|
417
|
+
] }),
|
|
418
|
+
/* @__PURE__ */ jsx(
|
|
419
|
+
"input",
|
|
420
|
+
{
|
|
421
|
+
id,
|
|
422
|
+
type: context.format || "text",
|
|
423
|
+
value: context.value || "",
|
|
424
|
+
onChange: (e) => context.onChange(e.target.value),
|
|
425
|
+
disabled,
|
|
426
|
+
pattern: context.constraints?.pattern
|
|
427
|
+
}
|
|
428
|
+
),
|
|
429
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
430
|
+
] });
|
|
431
|
+
};
|
|
432
|
+
var renderNumber = (context) => {
|
|
433
|
+
const { fieldKey, label, required, disabled, error } = context;
|
|
434
|
+
const id = `field-${fieldKey}`;
|
|
435
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
436
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
437
|
+
label,
|
|
438
|
+
" ",
|
|
439
|
+
required && "*"
|
|
440
|
+
] }),
|
|
441
|
+
/* @__PURE__ */ jsx(
|
|
442
|
+
"input",
|
|
443
|
+
{
|
|
444
|
+
id,
|
|
445
|
+
type: "number",
|
|
446
|
+
value: context.value ?? "",
|
|
447
|
+
onChange: (e) => context.onChange(parseNumberValue(e.target.value)),
|
|
448
|
+
disabled,
|
|
449
|
+
min: context.constraints?.min,
|
|
450
|
+
max: context.constraints?.max,
|
|
451
|
+
step: context.constraints?.step
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
455
|
+
] });
|
|
456
|
+
};
|
|
457
|
+
var renderBoolean = (context) => {
|
|
458
|
+
const { fieldKey, label, disabled, error } = context;
|
|
459
|
+
const id = `field-${fieldKey}`;
|
|
460
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
461
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
462
|
+
/* @__PURE__ */ jsx(
|
|
463
|
+
"input",
|
|
464
|
+
{
|
|
465
|
+
id,
|
|
466
|
+
type: "checkbox",
|
|
467
|
+
checked: !!context.value,
|
|
468
|
+
onChange: (e) => context.onChange(e.target.checked),
|
|
469
|
+
disabled
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
473
|
+
" ",
|
|
474
|
+
label,
|
|
475
|
+
" "
|
|
476
|
+
] })
|
|
477
|
+
] }),
|
|
478
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
479
|
+
] });
|
|
480
|
+
};
|
|
481
|
+
var renderEnumSelect = (context) => {
|
|
482
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
483
|
+
const id = `field-${fieldKey}`;
|
|
484
|
+
const selectableValues = getSelectableValues(context.possibleValues);
|
|
485
|
+
const allowCustom = context.allowCustomSelection;
|
|
486
|
+
return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
|
|
487
|
+
/* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
|
|
488
|
+
label,
|
|
489
|
+
" ",
|
|
490
|
+
required && "*"
|
|
491
|
+
] }),
|
|
492
|
+
(field.type === "string" || field.type === "number") && selectableValues && allowCustom && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
493
|
+
/* @__PURE__ */ jsx(
|
|
494
|
+
"input",
|
|
495
|
+
{
|
|
496
|
+
id,
|
|
497
|
+
type: "text",
|
|
498
|
+
list: `list-${id}`,
|
|
499
|
+
value: context.value ?? "",
|
|
500
|
+
onChange: (e) => context.onChange(
|
|
501
|
+
field.type === "number" ? parseNumberValue(e.target.value) : e.target.value
|
|
502
|
+
),
|
|
503
|
+
placeholder: "Select or type...",
|
|
504
|
+
disabled
|
|
505
|
+
}
|
|
506
|
+
),
|
|
507
|
+
/* @__PURE__ */ jsx("datalist", { id: `list-${id}`, children: selectableValues.map((val) => /* @__PURE__ */ jsx("option", { value: toOptionValue(val) }, String(val))) })
|
|
508
|
+
] }),
|
|
509
|
+
(field.type === "string" || field.type === "number") && selectableValues && !allowCustom && /* @__PURE__ */ jsxs(
|
|
510
|
+
"select",
|
|
511
|
+
{
|
|
512
|
+
id,
|
|
513
|
+
value: context.value ?? "",
|
|
514
|
+
onChange: (e) => context.onChange(
|
|
515
|
+
field.type === "number" ? parseNumberValue(e.target.value) : e.target.value
|
|
516
|
+
),
|
|
517
|
+
disabled,
|
|
518
|
+
children: [
|
|
519
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
|
|
520
|
+
selectableValues.map((val) => /* @__PURE__ */ jsx("option", { value: toOptionValue(val), children: String(val) }, String(val)))
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
|
|
525
|
+
] });
|
|
526
|
+
};
|
|
527
|
+
var webSuite = {
|
|
528
|
+
renderers: {
|
|
529
|
+
string: renderString,
|
|
530
|
+
number: renderNumber,
|
|
531
|
+
boolean: renderBoolean,
|
|
532
|
+
enum_select: renderEnumSelect,
|
|
533
|
+
array: renderArray,
|
|
534
|
+
relation_single: renderRelationSingle,
|
|
535
|
+
relation_array: renderRelationArray,
|
|
536
|
+
custom_single: renderCustomSingle,
|
|
537
|
+
custom_array: renderCustomArray
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
var resolvedWebSuite = resolveSuite(void 0, webSuite);
|
|
541
|
+
autoFieldRenderer = createAutoField(resolvedWebSuite);
|
|
542
|
+
var webAutoField = autoFieldRenderer;
|
|
543
|
+
var RelationList = styled_default("div")`
|
|
544
|
+
display: flex;
|
|
545
|
+
flex-direction: column;
|
|
546
|
+
gap: 0.5em;
|
|
547
|
+
margin-bottom: 0.5em;
|
|
548
|
+
`;
|
|
549
|
+
var RelationItem = styled_default("div")`
|
|
550
|
+
display: flex;
|
|
551
|
+
flex-direction: column;
|
|
552
|
+
gap: 0.5em;
|
|
553
|
+
padding: 0.5em;
|
|
554
|
+
`;
|
|
555
|
+
var RelationValue = styled_default("pre")`
|
|
556
|
+
margin: 0;
|
|
557
|
+
padding: 0.5em;
|
|
558
|
+
font-size: 0.85em;
|
|
559
|
+
white-space: pre-wrap;
|
|
560
|
+
`;
|
|
561
|
+
var RelationActions = styled_default("div")`
|
|
562
|
+
display: flex;
|
|
563
|
+
gap: 0.5em;
|
|
564
|
+
flex-wrap: wrap;
|
|
565
|
+
`;
|
|
566
|
+
var getDeniedOperation = (deniedOperations, operation) => {
|
|
567
|
+
if (!deniedOperations) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
const denied = deniedOperations[operation];
|
|
571
|
+
if (typeof denied === "boolean") {
|
|
572
|
+
return denied;
|
|
573
|
+
}
|
|
574
|
+
return deniedOperations[operation.toLowerCase()] ?? false;
|
|
575
|
+
};
|
|
576
|
+
var buildInitialValues = (initialValues, typeInfo) => {
|
|
577
|
+
const values = { ...initialValues };
|
|
578
|
+
for (const [key, field] of Object.entries(typeInfo.fields ?? {})) {
|
|
579
|
+
if (values[key] !== void 0) {
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
const defaultValue = field.tags?.constraints?.defaultValue;
|
|
583
|
+
if (defaultValue !== void 0) {
|
|
584
|
+
let parsedDefaultValue = defaultValue;
|
|
585
|
+
try {
|
|
586
|
+
parsedDefaultValue = JSON.parse(defaultValue);
|
|
587
|
+
} catch (error) {
|
|
588
|
+
}
|
|
589
|
+
values[key] = parsedDefaultValue;
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
if (field.array && !field.typeReference && !field.optional) {
|
|
593
|
+
values[key] = [];
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (field.type === "boolean" && !field.optional) {
|
|
597
|
+
values[key] = false;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return values;
|
|
601
|
+
};
|
|
602
|
+
var useFormEngine = (initialValues = {}, typeInfo, options) => {
|
|
603
|
+
const operation = options?.operation ?? "CREATE" /* CREATE */;
|
|
604
|
+
const [values, setValues] = useState(
|
|
605
|
+
buildInitialValues(initialValues, typeInfo)
|
|
606
|
+
);
|
|
607
|
+
const [errors, setErrors] = useState({});
|
|
608
|
+
const setFieldValue = useCallback((path, value) => {
|
|
609
|
+
setValues((prev) => {
|
|
610
|
+
return {
|
|
611
|
+
...prev,
|
|
612
|
+
[path]: value
|
|
613
|
+
};
|
|
614
|
+
});
|
|
615
|
+
}, []);
|
|
616
|
+
const validate = useCallback(() => {
|
|
617
|
+
const newErrors = {};
|
|
618
|
+
for (const [key, field] of Object.entries(typeInfo.fields ?? {})) {
|
|
619
|
+
if (field.tags?.hidden) {
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
const val = values[key];
|
|
623
|
+
if (field.readonly && (val === void 0 || val === null || val === "")) {
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
const isMissing = val === void 0 || val === null || val === "" || field.array && (!Array.isArray(val) || val.length === 0);
|
|
627
|
+
if (!field.optional && isMissing) {
|
|
628
|
+
newErrors[key] = "This field is required";
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
if (isMissing) {
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
const constraints = field.tags?.constraints;
|
|
635
|
+
if (constraints?.pattern && typeof val === "string") {
|
|
636
|
+
const pattern = new RegExp(constraints.pattern);
|
|
637
|
+
if (!pattern.test(val)) {
|
|
638
|
+
newErrors[key] = "Value does not match required pattern";
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
if (field.type === "number" && typeof val === "number") {
|
|
643
|
+
if (constraints?.min !== void 0 && val < constraints.min) {
|
|
644
|
+
newErrors[key] = `Value must be at least ${constraints.min}`;
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
if (constraints?.max !== void 0 && val > constraints.max) {
|
|
648
|
+
newErrors[key] = `Value must be at most ${constraints.max}`;
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
setErrors(newErrors);
|
|
654
|
+
return Object.keys(newErrors).length === 0;
|
|
655
|
+
}, [typeInfo, values]);
|
|
656
|
+
const fields = useMemo(() => {
|
|
657
|
+
return Object.entries(typeInfo.fields ?? {}).map(([key, field]) => {
|
|
658
|
+
const { tags } = field;
|
|
659
|
+
const isPrimary = tags?.primaryField || typeInfo.primaryField === key;
|
|
660
|
+
return {
|
|
661
|
+
key,
|
|
662
|
+
field,
|
|
663
|
+
label: tags?.label ?? key,
|
|
664
|
+
required: !field.optional,
|
|
665
|
+
disabled: field.readonly || getDeniedOperation(typeInfo.tags?.deniedOperations, operation) || getDeniedOperation(tags?.deniedOperations, operation) || operation === "UPDATE" /* UPDATE */ && isPrimary,
|
|
666
|
+
hidden: !!tags?.hidden,
|
|
667
|
+
primary: isPrimary,
|
|
668
|
+
format: tags?.format,
|
|
669
|
+
constraints: tags?.constraints,
|
|
670
|
+
value: values[key],
|
|
671
|
+
onChange: (value) => setFieldValue(key, value),
|
|
672
|
+
error: errors[key]
|
|
673
|
+
};
|
|
674
|
+
});
|
|
675
|
+
}, [typeInfo, values, errors, setFieldValue, operation]);
|
|
676
|
+
return {
|
|
677
|
+
typeInfo,
|
|
678
|
+
typeTags: typeInfo.tags,
|
|
679
|
+
operation,
|
|
680
|
+
values,
|
|
681
|
+
errors,
|
|
682
|
+
fields,
|
|
683
|
+
setFieldValue,
|
|
684
|
+
validate,
|
|
685
|
+
setErrors
|
|
686
|
+
};
|
|
687
|
+
};
|
|
688
|
+
var AutoField = (props) => {
|
|
689
|
+
return webAutoField({
|
|
690
|
+
field: props.field,
|
|
691
|
+
fieldKey: props.fieldKey,
|
|
692
|
+
value: props.value,
|
|
693
|
+
onChange: props.onChange,
|
|
694
|
+
error: props.error,
|
|
695
|
+
disabled: props.disabled,
|
|
696
|
+
onRelationAction: props.onRelationAction,
|
|
697
|
+
onCustomTypeAction: props.onCustomTypeAction
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
var AutoFormView = ({
|
|
701
|
+
controller,
|
|
702
|
+
onSubmit,
|
|
703
|
+
submitDisabled,
|
|
704
|
+
onRelationAction,
|
|
705
|
+
onCustomTypeAction
|
|
706
|
+
}) => {
|
|
707
|
+
const handleSubmit = (e) => {
|
|
708
|
+
e.preventDefault();
|
|
709
|
+
if (controller.validate()) {
|
|
710
|
+
onSubmit(controller.values);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
return /* @__PURE__ */ jsxs(FormContainer, { onSubmit: handleSubmit, children: [
|
|
714
|
+
controller.fields.filter((fieldController) => !fieldController.hidden).map((fieldController) => /* @__PURE__ */ jsx(
|
|
715
|
+
AutoField,
|
|
716
|
+
{
|
|
717
|
+
field: fieldController.field,
|
|
718
|
+
fieldKey: fieldController.key,
|
|
719
|
+
value: fieldController.value,
|
|
720
|
+
onChange: fieldController.onChange,
|
|
721
|
+
error: fieldController.error,
|
|
722
|
+
onRelationAction,
|
|
723
|
+
disabled: fieldController.disabled,
|
|
724
|
+
onCustomTypeAction
|
|
725
|
+
},
|
|
726
|
+
fieldController.key
|
|
727
|
+
)),
|
|
728
|
+
/* @__PURE__ */ jsx("button", { type: "submit", disabled: submitDisabled, children: "Submit" })
|
|
729
|
+
] });
|
|
730
|
+
};
|
|
731
|
+
var AutoForm = ({
|
|
732
|
+
typeInfo,
|
|
733
|
+
onSubmit,
|
|
734
|
+
initialValues,
|
|
735
|
+
onValuesChange,
|
|
736
|
+
onRelationAction,
|
|
737
|
+
onCustomTypeAction,
|
|
738
|
+
operation,
|
|
739
|
+
submitDisabled
|
|
740
|
+
}) => {
|
|
741
|
+
const controller = useFormEngine(initialValues, typeInfo, { operation });
|
|
742
|
+
useEffect(() => {
|
|
743
|
+
if (onValuesChange) {
|
|
744
|
+
onValuesChange(controller.values);
|
|
745
|
+
}
|
|
746
|
+
}, [controller.values, onValuesChange]);
|
|
747
|
+
return /* @__PURE__ */ jsx(
|
|
748
|
+
AutoFormView,
|
|
749
|
+
{
|
|
750
|
+
controller,
|
|
751
|
+
onSubmit,
|
|
752
|
+
onRelationAction,
|
|
753
|
+
onCustomTypeAction,
|
|
754
|
+
submitDisabled
|
|
755
|
+
}
|
|
756
|
+
);
|
|
757
|
+
};
|
|
758
|
+
var FormContainer = styled_default("form")`
|
|
759
|
+
display: flex;
|
|
760
|
+
flex-direction: column;
|
|
761
|
+
align-items: flex-start;
|
|
762
|
+
justify-content: flex-start;
|
|
763
|
+
gap: 1em;
|
|
764
|
+
`;
|
|
765
|
+
|
|
766
|
+
// src/web/forms/createWebFormRenderer.ts
|
|
767
|
+
var createWebFormRenderer = (options) => {
|
|
768
|
+
return createFormRenderer({
|
|
769
|
+
fallbackSuite: webSuite,
|
|
770
|
+
suite: options?.suite
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
// src/app/utils/easy-layout/parseTemplate.ts
|
|
775
|
+
var parseTrackSpec = (token) => {
|
|
776
|
+
const trimmed = token.trim();
|
|
777
|
+
const numericMatch = trimmed.match(/^([0-9]*\.?[0-9]+)(fr|px|%)$/);
|
|
778
|
+
if (!numericMatch) {
|
|
779
|
+
throw new Error(
|
|
780
|
+
`Invalid track token "${trimmed}". Supported units are fr, px, and %.`
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
const value = Number(numericMatch[1]);
|
|
784
|
+
const suffix = numericMatch[2];
|
|
785
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
786
|
+
throw new Error(`Track value must be a non-negative number. Received "${trimmed}".`);
|
|
787
|
+
}
|
|
788
|
+
if (suffix === "fr") {
|
|
789
|
+
return { kind: "fr", value };
|
|
790
|
+
}
|
|
791
|
+
if (suffix === "px") {
|
|
792
|
+
return { kind: "px", value };
|
|
793
|
+
}
|
|
794
|
+
return { kind: "pct", value };
|
|
795
|
+
};
|
|
796
|
+
var normalizeAreas = (areaPart) => {
|
|
797
|
+
return areaPart.trim().split(/\s+/g).map((token) => token.trim()).filter(Boolean);
|
|
798
|
+
};
|
|
799
|
+
var parseTemplate = (template = "") => {
|
|
800
|
+
const lines = template.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
801
|
+
const areaGrid = [];
|
|
802
|
+
const rowTracks = [];
|
|
803
|
+
let colTracks = null;
|
|
804
|
+
for (const line of lines) {
|
|
805
|
+
if (line.startsWith("\\")) {
|
|
806
|
+
if (colTracks) {
|
|
807
|
+
throw new Error("Template can include only one column-track line.");
|
|
808
|
+
}
|
|
809
|
+
const colTokens = line.replace(/\\/g, " ").trim().split(/\s+/g).filter(Boolean);
|
|
810
|
+
colTracks = colTokens.map(parseTrackSpec);
|
|
811
|
+
continue;
|
|
812
|
+
}
|
|
813
|
+
const parts = line.split(",").map((part) => part.trim());
|
|
814
|
+
const areaPart = parts[0] || "";
|
|
815
|
+
if (!areaPart) {
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
if (parts.length > 2) {
|
|
819
|
+
throw new Error(
|
|
820
|
+
`Invalid row definition "${line}". Expected "<areas>, <row-track>".`
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
const areas = normalizeAreas(areaPart);
|
|
824
|
+
if (!areas.length) {
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
areaGrid.push(areas);
|
|
828
|
+
const rowTrack = parts[1];
|
|
829
|
+
if (rowTrack) {
|
|
830
|
+
rowTracks.push(parseTrackSpec(rowTrack));
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
if (!areaGrid.length) {
|
|
834
|
+
throw new Error("Template must include at least one area row.");
|
|
835
|
+
}
|
|
836
|
+
const expectedWidth = areaGrid[0].length;
|
|
837
|
+
for (let rowIndex = 0; rowIndex < areaGrid.length; rowIndex++) {
|
|
838
|
+
const width = areaGrid[rowIndex].length;
|
|
839
|
+
if (width !== expectedWidth) {
|
|
840
|
+
throw new Error(
|
|
841
|
+
`All area rows must have the same width. Expected ${expectedWidth}, received ${width} at row ${rowIndex + 1}.`
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
if (colTracks && colTracks.length !== expectedWidth) {
|
|
846
|
+
throw new Error(
|
|
847
|
+
`Column track count must match area width. Expected ${expectedWidth}, received ${colTracks.length}.`
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
const areaNames = Array.from(
|
|
851
|
+
new Set(
|
|
852
|
+
areaGrid.flat().map((name) => name.trim()).filter((name) => !!name && name !== ".")
|
|
853
|
+
)
|
|
854
|
+
);
|
|
855
|
+
return {
|
|
856
|
+
areaGrid,
|
|
857
|
+
rowTracks,
|
|
858
|
+
colTracks: colTracks || [],
|
|
859
|
+
areaNames
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
// src/app/utils/easy-layout/computeAreaBounds.ts
|
|
864
|
+
var computeAreaBounds = (parsed) => {
|
|
865
|
+
const result = {};
|
|
866
|
+
for (let rowIndex = 0; rowIndex < parsed.areaGrid.length; rowIndex++) {
|
|
867
|
+
const row = parsed.areaGrid[rowIndex];
|
|
868
|
+
for (let colIndex = 0; colIndex < row.length; colIndex++) {
|
|
869
|
+
const name = row[colIndex];
|
|
870
|
+
if (!name || name === ".") {
|
|
871
|
+
continue;
|
|
872
|
+
}
|
|
873
|
+
const row1 = rowIndex + 1;
|
|
874
|
+
const col1 = colIndex + 1;
|
|
875
|
+
const existing = result[name];
|
|
876
|
+
if (!existing) {
|
|
877
|
+
result[name] = {
|
|
878
|
+
name,
|
|
879
|
+
rowStart: row1,
|
|
880
|
+
rowEnd: row1,
|
|
881
|
+
colStart: col1,
|
|
882
|
+
colEnd: col1
|
|
883
|
+
};
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
existing.rowStart = Math.min(existing.rowStart, row1);
|
|
887
|
+
existing.rowEnd = Math.max(existing.rowEnd, row1);
|
|
888
|
+
existing.colStart = Math.min(existing.colStart, col1);
|
|
889
|
+
existing.colEnd = Math.max(existing.colEnd, col1);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
return result;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
// src/app/utils/easy-layout/validateAreas.ts
|
|
896
|
+
var validateAreas = (parsed) => {
|
|
897
|
+
const bounds = computeAreaBounds(parsed);
|
|
898
|
+
for (const areaName of parsed.areaNames) {
|
|
899
|
+
const bound = bounds[areaName];
|
|
900
|
+
if (!bound) {
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
for (let row = bound.rowStart; row <= bound.rowEnd; row++) {
|
|
904
|
+
for (let col = bound.colStart; col <= bound.colEnd; col++) {
|
|
905
|
+
const token = parsed.areaGrid[row - 1]?.[col - 1];
|
|
906
|
+
if (token !== areaName) {
|
|
907
|
+
throw new Error(
|
|
908
|
+
`Area "${areaName}" must be a rectangle. Missing "${areaName}" at row ${row}, col ${col}.`
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
// src/app/utils/EasyLayout.tsx
|
|
917
|
+
var getPascalCaseAreaName = (area) => {
|
|
918
|
+
return area.split("-").map((a) => a[0].toUpperCase() + a.slice(1)).join("");
|
|
919
|
+
};
|
|
920
|
+
var convertLayoutToCSS = (layout = "", spacing = {}) => {
|
|
921
|
+
const parsed = parseTemplate(layout);
|
|
922
|
+
validateAreas(parsed);
|
|
923
|
+
const renderTrack = (track) => {
|
|
924
|
+
if (track.kind === "px") {
|
|
925
|
+
return `${track.value}px`;
|
|
926
|
+
}
|
|
927
|
+
if (track.kind === "pct") {
|
|
928
|
+
return `${track.value}%`;
|
|
929
|
+
}
|
|
930
|
+
return `${track.value}fr`;
|
|
931
|
+
};
|
|
932
|
+
const areaRows = parsed.areaGrid.map((row) => row.join(" "));
|
|
933
|
+
const rows = parsed.rowTracks.map(renderTrack);
|
|
934
|
+
let css = "";
|
|
935
|
+
if (parsed.colTracks.length) {
|
|
936
|
+
css += `
|
|
937
|
+
grid-template-columns: ${parsed.colTracks.map(renderTrack).join(" ")};`;
|
|
938
|
+
}
|
|
939
|
+
css += `
|
|
940
|
+
grid-template-areas:
|
|
941
|
+
${areaRows.map((a) => ` "${a}"`).join("\n")};`;
|
|
942
|
+
if (rows.length) {
|
|
943
|
+
css += `
|
|
944
|
+
grid-template-rows: ${rows.join(" ")};`;
|
|
945
|
+
}
|
|
946
|
+
if (typeof spacing.gap !== "undefined") {
|
|
947
|
+
css += `
|
|
948
|
+
gap: ${typeof spacing.gap === "number" ? `${spacing.gap}px` : spacing.gap};`;
|
|
949
|
+
}
|
|
950
|
+
if (typeof spacing.padding !== "undefined") {
|
|
951
|
+
css += `
|
|
952
|
+
padding: ${typeof spacing.padding === "number" ? `${spacing.padding}px` : spacing.padding};`;
|
|
953
|
+
}
|
|
954
|
+
return {
|
|
955
|
+
areasList: parsed.areaNames,
|
|
956
|
+
css
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
var createEasyLayout = (config, extendFrom, areasExtendFrom, spacing = {}) => {
|
|
960
|
+
return (layoutTemplate, ...expressions) => {
|
|
961
|
+
const mergedTemplate = layoutTemplate.reduce((acc, l, ind) => {
|
|
962
|
+
const expr = expressions[ind - 1];
|
|
963
|
+
const exprStr = typeof expr === "undefined" ? "" : expr;
|
|
964
|
+
return `${acc}${l}${exprStr}`;
|
|
965
|
+
}, "");
|
|
966
|
+
const { areasList, css } = convertLayoutToCSS(mergedTemplate, spacing);
|
|
967
|
+
const layout = config.createLayout({ base: extendFrom, css });
|
|
968
|
+
const areas = areasList.reduce((acc, area) => {
|
|
969
|
+
const pascalCaseAreaName = getPascalCaseAreaName(area);
|
|
970
|
+
const component = config.createArea({ base: areasExtendFrom, area });
|
|
971
|
+
return {
|
|
972
|
+
...acc,
|
|
973
|
+
[pascalCaseAreaName]: component
|
|
974
|
+
};
|
|
975
|
+
}, {});
|
|
976
|
+
return {
|
|
977
|
+
layout,
|
|
978
|
+
areas
|
|
979
|
+
};
|
|
980
|
+
};
|
|
981
|
+
};
|
|
982
|
+
var EasyLayoutBase = styled_default("div")`
|
|
983
|
+
display: grid;
|
|
984
|
+
${({ $layoutCss }) => $layoutCss}
|
|
985
|
+
`;
|
|
986
|
+
var EasyAreaBase = styled_default("div")`
|
|
987
|
+
grid-area: ${({ $area }) => $area};
|
|
988
|
+
`;
|
|
989
|
+
var styledFactory = {
|
|
990
|
+
createLayout: ({ base, css }) => {
|
|
991
|
+
const LayoutComponent = ({ children }) => {
|
|
992
|
+
const layoutProps = {
|
|
993
|
+
$layoutCss: css,
|
|
994
|
+
children
|
|
995
|
+
};
|
|
996
|
+
if (base) {
|
|
997
|
+
layoutProps.as = base;
|
|
998
|
+
}
|
|
999
|
+
return /* @__PURE__ */ jsx(EasyLayoutBase, { ...layoutProps });
|
|
1000
|
+
};
|
|
1001
|
+
return LayoutComponent;
|
|
1002
|
+
},
|
|
1003
|
+
createArea: ({ base, area }) => {
|
|
1004
|
+
const AreaComponent = ({ children }) => {
|
|
1005
|
+
const areaProps = {
|
|
1006
|
+
$area: area,
|
|
1007
|
+
children
|
|
1008
|
+
};
|
|
1009
|
+
if (base) {
|
|
1010
|
+
areaProps.as = base;
|
|
1011
|
+
}
|
|
1012
|
+
return /* @__PURE__ */ jsx(EasyAreaBase, { ...areaProps });
|
|
1013
|
+
};
|
|
1014
|
+
return AreaComponent;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
var getEasyLayout = (extendFrom, areasExtendFrom, options = {}) => {
|
|
1018
|
+
return createEasyLayout(styledFactory, extendFrom, areasExtendFrom, options);
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
// src/common/Routing.ts
|
|
1022
|
+
var PATH_DELIMITER = "/";
|
|
1023
|
+
var getPotentialJSONValue = (value) => {
|
|
1024
|
+
try {
|
|
1025
|
+
return JSON.parse(value);
|
|
1026
|
+
} catch (error) {
|
|
1027
|
+
return value;
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
var getPathArray = (path, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriDecodeParts = true) => path.split(delimiter).filter(filterEmptyInput ? (p) => p !== "" : () => true).map(uriDecodeParts ? decodeURIComponent : (x) => x).map(useJson ? getPotentialJSONValue : (p) => p).filter(filterEmptyOutput ? (p) => p ?? false : () => true);
|
|
1031
|
+
var getPathString = (parts = [], delimiter = PATH_DELIMITER, filterEmptyInput = false, useJson = true, uriEncodeParts = false) => parts.filter(filterEmptyInput ? (p) => p ?? false : () => true).map(useJson ? (p) => JSON.stringify(p) : (x) => x).map(uriEncodeParts ? encodeURIComponent : (x) => x).join(delimiter);
|
|
1032
|
+
var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => getPathString(
|
|
1033
|
+
[
|
|
1034
|
+
...getPathArray(
|
|
1035
|
+
path1,
|
|
1036
|
+
delimiter,
|
|
1037
|
+
filterEmptyOutput,
|
|
1038
|
+
filterEmptyInput,
|
|
1039
|
+
useJson,
|
|
1040
|
+
uriEncodeParts
|
|
1041
|
+
),
|
|
1042
|
+
...getPathArray(
|
|
1043
|
+
path2,
|
|
1044
|
+
delimiter,
|
|
1045
|
+
filterEmptyOutput,
|
|
1046
|
+
filterEmptyInput,
|
|
1047
|
+
useJson,
|
|
1048
|
+
uriEncodeParts
|
|
1049
|
+
)
|
|
1050
|
+
],
|
|
1051
|
+
delimiter,
|
|
1052
|
+
filterEmptyInput,
|
|
1053
|
+
useJson,
|
|
1054
|
+
uriEncodeParts
|
|
1055
|
+
);
|
|
1056
|
+
var resolvePath = (currentPath, newPath) => {
|
|
1057
|
+
const newSegments = getPathArray(newPath, PATH_DELIMITER, true);
|
|
1058
|
+
let currentSegments = getPathArray(currentPath, PATH_DELIMITER, true);
|
|
1059
|
+
if (newPath.startsWith("/")) {
|
|
1060
|
+
currentSegments = [];
|
|
1061
|
+
}
|
|
1062
|
+
newSegments.forEach((segment) => {
|
|
1063
|
+
if (segment === "..") {
|
|
1064
|
+
if (currentSegments.length > 0) {
|
|
1065
|
+
currentSegments.pop();
|
|
1066
|
+
}
|
|
1067
|
+
} else if (segment !== ".") {
|
|
1068
|
+
currentSegments.push(segment);
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
return "/" + currentSegments.join("/");
|
|
1072
|
+
};
|
|
1073
|
+
var getParamsAndTestPath = (path, testPath, exact = false) => {
|
|
1074
|
+
const pathList = getPathArray(path);
|
|
1075
|
+
const testPathList = getPathArray(testPath);
|
|
1076
|
+
if (exact && pathList.length !== testPathList.length) {
|
|
1077
|
+
return false;
|
|
1078
|
+
} else {
|
|
1079
|
+
let params = {};
|
|
1080
|
+
if (pathList.length >= testPathList.length) {
|
|
1081
|
+
for (let i = 0; i < testPathList.length; i++) {
|
|
1082
|
+
const testPathPart = testPathList[i];
|
|
1083
|
+
const pathPart = pathList[i];
|
|
1084
|
+
if (testPathPart.startsWith(":")) {
|
|
1085
|
+
const paramName = testPathPart.slice(1);
|
|
1086
|
+
params[paramName] = pathPart;
|
|
1087
|
+
} else if (pathPart !== testPathPart) {
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
} else {
|
|
1092
|
+
return false;
|
|
1093
|
+
}
|
|
1094
|
+
return params;
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
var RouteContext = createContext({
|
|
1098
|
+
currentWindowPath: "",
|
|
1099
|
+
parentPath: "",
|
|
1100
|
+
params: {},
|
|
1101
|
+
isTopLevel: true
|
|
1102
|
+
});
|
|
1103
|
+
var {
|
|
1104
|
+
/**
|
|
1105
|
+
* @ignore
|
|
1106
|
+
*/
|
|
1107
|
+
Provider: RouteContextProvider,
|
|
1108
|
+
/**
|
|
1109
|
+
* @ignore
|
|
1110
|
+
*/
|
|
1111
|
+
Consumer: RouteContextConsumer
|
|
1112
|
+
} = RouteContext;
|
|
1113
|
+
var useRouteContext = () => useContext(RouteContext);
|
|
1114
|
+
var RouteProvider = ({
|
|
1115
|
+
adapter,
|
|
1116
|
+
initialPath,
|
|
1117
|
+
children
|
|
1118
|
+
}) => {
|
|
1119
|
+
const [currentPath, setCurrentPath] = useState(
|
|
1120
|
+
initialPath ?? adapter.getPath()
|
|
1121
|
+
);
|
|
1122
|
+
useEffect(() => {
|
|
1123
|
+
return adapter.subscribe((nextPath) => {
|
|
1124
|
+
setCurrentPath(nextPath);
|
|
1125
|
+
});
|
|
1126
|
+
}, [adapter]);
|
|
1127
|
+
const contextValue = useMemo(
|
|
1128
|
+
() => ({
|
|
1129
|
+
currentWindowPath: currentPath,
|
|
1130
|
+
parentPath: "",
|
|
1131
|
+
params: {},
|
|
1132
|
+
isTopLevel: true,
|
|
1133
|
+
adapter
|
|
1134
|
+
}),
|
|
1135
|
+
[currentPath, adapter]
|
|
1136
|
+
);
|
|
1137
|
+
return /* @__PURE__ */ jsx(RouteContextProvider, { value: contextValue, children });
|
|
1138
|
+
};
|
|
1139
|
+
var Route = ({
|
|
1140
|
+
/**
|
|
1141
|
+
* Use `:` as the first character to denote a parameter in the path.
|
|
1142
|
+
*/
|
|
1143
|
+
path = "",
|
|
1144
|
+
onParamsChange,
|
|
1145
|
+
exact = false,
|
|
1146
|
+
children
|
|
1147
|
+
}) => {
|
|
1148
|
+
const {
|
|
1149
|
+
currentWindowPath = "",
|
|
1150
|
+
parentPath = "",
|
|
1151
|
+
params: parentParams = {},
|
|
1152
|
+
adapter
|
|
1153
|
+
} = useRouteContext();
|
|
1154
|
+
const targetCurrentPath = useMemo(
|
|
1155
|
+
() => currentWindowPath,
|
|
1156
|
+
[currentWindowPath]
|
|
1157
|
+
);
|
|
1158
|
+
const fullPath = useMemo(
|
|
1159
|
+
() => mergeStringPaths(parentPath, path),
|
|
1160
|
+
[parentPath, path]
|
|
1161
|
+
);
|
|
1162
|
+
const newParams = useMemo(
|
|
1163
|
+
() => getParamsAndTestPath(targetCurrentPath, fullPath, exact),
|
|
1164
|
+
[targetCurrentPath, fullPath, exact]
|
|
1165
|
+
);
|
|
1166
|
+
const params = useMemo(
|
|
1167
|
+
() => ({
|
|
1168
|
+
...parentParams,
|
|
1169
|
+
...newParams ? newParams : {}
|
|
1170
|
+
}),
|
|
1171
|
+
[parentParams, newParams]
|
|
1172
|
+
);
|
|
1173
|
+
const newRouteContext = useMemo(
|
|
1174
|
+
() => ({
|
|
1175
|
+
currentWindowPath: targetCurrentPath,
|
|
1176
|
+
parentPath: fullPath,
|
|
1177
|
+
params,
|
|
1178
|
+
isTopLevel: false,
|
|
1179
|
+
adapter
|
|
1180
|
+
}),
|
|
1181
|
+
[targetCurrentPath, fullPath, params, adapter]
|
|
1182
|
+
);
|
|
1183
|
+
useEffect(() => {
|
|
1184
|
+
if (onParamsChange) {
|
|
1185
|
+
onParamsChange(params);
|
|
1186
|
+
}
|
|
1187
|
+
}, [params, onParamsChange]);
|
|
1188
|
+
return newParams ? /* @__PURE__ */ jsx(RouteContextProvider, { value: newRouteContext, children }) : null;
|
|
1189
|
+
};
|
|
1190
|
+
var getWindow = () => {
|
|
1191
|
+
if (typeof globalThis === "undefined") {
|
|
1192
|
+
return void 0;
|
|
1193
|
+
}
|
|
1194
|
+
if ("window" in globalThis) {
|
|
1195
|
+
return globalThis.window;
|
|
1196
|
+
}
|
|
1197
|
+
return void 0;
|
|
1198
|
+
};
|
|
1199
|
+
var createBrowserRouteAdapter = () => {
|
|
1200
|
+
const WINDOW = getWindow();
|
|
1201
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1202
|
+
const notify = () => {
|
|
1203
|
+
const path = WINDOW?.location?.pathname ?? "";
|
|
1204
|
+
listeners.forEach((listener) => listener(path));
|
|
1205
|
+
};
|
|
1206
|
+
const handlePopState = () => {
|
|
1207
|
+
notify();
|
|
1208
|
+
};
|
|
1209
|
+
const subscribe = (listener) => {
|
|
1210
|
+
listeners.add(listener);
|
|
1211
|
+
if (WINDOW) {
|
|
1212
|
+
WINDOW.addEventListener("popstate", handlePopState);
|
|
1213
|
+
WINDOW.addEventListener("statechanged", handlePopState);
|
|
1214
|
+
}
|
|
1215
|
+
return () => {
|
|
1216
|
+
listeners.delete(listener);
|
|
1217
|
+
if (WINDOW) {
|
|
1218
|
+
WINDOW.removeEventListener("popstate", handlePopState);
|
|
1219
|
+
WINDOW.removeEventListener("statechanged", handlePopState);
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
return {
|
|
1224
|
+
getPath: () => WINDOW?.location?.pathname ?? "",
|
|
1225
|
+
subscribe,
|
|
1226
|
+
push: (path, title = "") => {
|
|
1227
|
+
if (!WINDOW?.history) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
WINDOW.history.pushState({}, title, path);
|
|
1231
|
+
notify();
|
|
1232
|
+
},
|
|
1233
|
+
replace: (path, title = "") => {
|
|
1234
|
+
if (!WINDOW?.history?.replaceState) {
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
WINDOW.history.replaceState({}, title, path);
|
|
1238
|
+
notify();
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
};
|
|
1242
|
+
var useBrowserLinkInterceptor = (adapter) => {
|
|
1243
|
+
useEffect(() => {
|
|
1244
|
+
const WINDOW = getWindow();
|
|
1245
|
+
if (!WINDOW || !adapter?.push) {
|
|
1246
|
+
return void 0;
|
|
1247
|
+
}
|
|
1248
|
+
const handleAnchorClick = (event) => {
|
|
1249
|
+
let target = event.target;
|
|
1250
|
+
while (target && target.nodeName !== "A") {
|
|
1251
|
+
target = target.parentNode;
|
|
1252
|
+
}
|
|
1253
|
+
if (!target || target.nodeName !== "A") {
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
const anchor = target;
|
|
1257
|
+
const href = anchor.getAttribute("href");
|
|
1258
|
+
const title = anchor.getAttribute("title") ?? "";
|
|
1259
|
+
if (!href) {
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
try {
|
|
1263
|
+
new URL(href);
|
|
1264
|
+
return;
|
|
1265
|
+
} catch (error) {
|
|
1266
|
+
const nextPath = resolvePath(WINDOW.location?.pathname ?? "", href);
|
|
1267
|
+
event.preventDefault();
|
|
1268
|
+
adapter.push?.(nextPath, title);
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
WINDOW.document.addEventListener("click", handleAnchorClick);
|
|
1272
|
+
return () => {
|
|
1273
|
+
WINDOW.document.removeEventListener("click", handleAnchorClick);
|
|
1274
|
+
};
|
|
1275
|
+
}, [adapter]);
|
|
1276
|
+
};
|
|
1277
|
+
var RouteProvider2 = ({ children }) => {
|
|
1278
|
+
const adapterRef = useRef(null);
|
|
1279
|
+
if (!adapterRef.current) {
|
|
1280
|
+
adapterRef.current = createBrowserRouteAdapter();
|
|
1281
|
+
}
|
|
1282
|
+
useBrowserLinkInterceptor(adapterRef.current);
|
|
1283
|
+
return /* @__PURE__ */ jsx(RouteProvider, { adapter: adapterRef.current, children });
|
|
1284
|
+
};
|
|
1285
|
+
var Route2 = (props) => {
|
|
1286
|
+
const routeContext = useRouteContext();
|
|
1287
|
+
const hasAdapter = useMemo(
|
|
1288
|
+
() => typeof routeContext.adapter !== "undefined",
|
|
1289
|
+
[routeContext.adapter]
|
|
1290
|
+
);
|
|
1291
|
+
if (hasAdapter) {
|
|
1292
|
+
return /* @__PURE__ */ jsx(Route, { ...props });
|
|
1293
|
+
}
|
|
1294
|
+
return /* @__PURE__ */ jsx(RouteProvider2, { children: /* @__PURE__ */ jsx(Route, { ...props }) });
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
export { ArrayContainer, ArrayItemWrapper, AutoField, AutoForm, AutoFormView, ErrorMessage, FieldWrapper, Route2 as Route, RouteProvider2 as RouteProvider, createBrowserRouteAdapter, createWebFormRenderer, getEasyLayout, useRouteContext, webAutoField, webSuite };
|