@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/native/index.js
ADDED
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
import { createContext, useContext, createElement, useState, useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
+
}) : x)(function(x) {
|
|
7
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// src/app/forms/core/getFieldKind.ts
|
|
12
|
+
var hasSelectableValues = (field) => {
|
|
13
|
+
const possibleValues = field.possibleValues ?? [];
|
|
14
|
+
return possibleValues.some(
|
|
15
|
+
(value) => typeof value === "string" || typeof value === "number"
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
var getFieldKind = (field) => {
|
|
19
|
+
if (field.typeReference) {
|
|
20
|
+
return field.array ? "relation_array" : "relation_single";
|
|
21
|
+
}
|
|
22
|
+
if (field.tags?.customType) {
|
|
23
|
+
return field.array ? "custom_array" : "custom_single";
|
|
24
|
+
}
|
|
25
|
+
if (field.array) {
|
|
26
|
+
return "array";
|
|
27
|
+
}
|
|
28
|
+
if (hasSelectableValues(field)) {
|
|
29
|
+
return "enum_select";
|
|
30
|
+
}
|
|
31
|
+
if (field.type === "boolean") {
|
|
32
|
+
return "boolean";
|
|
33
|
+
}
|
|
34
|
+
if (field.type === "number") {
|
|
35
|
+
return "number";
|
|
36
|
+
}
|
|
37
|
+
return "string";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/app/forms/core/resolveSuite.ts
|
|
41
|
+
var fieldKinds = [
|
|
42
|
+
"string",
|
|
43
|
+
"number",
|
|
44
|
+
"boolean",
|
|
45
|
+
"enum_select",
|
|
46
|
+
"array",
|
|
47
|
+
"relation_single",
|
|
48
|
+
"relation_array",
|
|
49
|
+
"custom_single",
|
|
50
|
+
"custom_array"
|
|
51
|
+
];
|
|
52
|
+
var getMissingKinds = (renderers) => {
|
|
53
|
+
return fieldKinds.filter((kind) => !renderers[kind]);
|
|
54
|
+
};
|
|
55
|
+
var resolveSuite = (overrides, fallback) => {
|
|
56
|
+
const mergedRenderers = {
|
|
57
|
+
...fallback.renderers ?? {},
|
|
58
|
+
...overrides?.renderers ?? {}
|
|
59
|
+
};
|
|
60
|
+
const missingKinds = getMissingKinds(mergedRenderers);
|
|
61
|
+
if (missingKinds.length) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Missing renderers for field kinds: ${missingKinds.join(", ")}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const mergedPrimitives = {
|
|
67
|
+
...fallback.primitives ?? {},
|
|
68
|
+
...overrides?.primitives ?? {}
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
renderers: mergedRenderers,
|
|
72
|
+
primitives: Object.keys(mergedPrimitives).length ? mergedPrimitives : void 0
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// src/app/forms/core/createAutoField.ts
|
|
77
|
+
var createAutoField = (suite) => {
|
|
78
|
+
return (props) => {
|
|
79
|
+
const { field, fieldKey, value, onChange, error, disabled } = props;
|
|
80
|
+
const { tags } = field;
|
|
81
|
+
const context = {
|
|
82
|
+
field,
|
|
83
|
+
fieldKey,
|
|
84
|
+
label: tags?.label ?? fieldKey,
|
|
85
|
+
required: !field.optional,
|
|
86
|
+
disabled: !!disabled,
|
|
87
|
+
error,
|
|
88
|
+
value,
|
|
89
|
+
onChange,
|
|
90
|
+
constraints: tags?.constraints,
|
|
91
|
+
format: tags?.format,
|
|
92
|
+
possibleValues: field.possibleValues,
|
|
93
|
+
allowCustomSelection: tags?.allowCustomSelection,
|
|
94
|
+
customType: tags?.customType,
|
|
95
|
+
onRelationAction: props.onRelationAction,
|
|
96
|
+
onCustomTypeAction: props.onCustomTypeAction
|
|
97
|
+
};
|
|
98
|
+
const kind = getFieldKind(field);
|
|
99
|
+
return suite.renderers[kind](context);
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/app/forms/core/createFormRenderer.ts
|
|
104
|
+
var createFormRenderer = (options) => {
|
|
105
|
+
const resolvedSuite = resolveSuite(
|
|
106
|
+
options.suite,
|
|
107
|
+
options.fallbackSuite
|
|
108
|
+
);
|
|
109
|
+
const AutoField = createAutoField(resolvedSuite);
|
|
110
|
+
return {
|
|
111
|
+
AutoField,
|
|
112
|
+
suite: resolvedSuite
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
var getNative = () => __require("react-native");
|
|
116
|
+
var FieldWrapper = (props) => {
|
|
117
|
+
const { View } = getNative();
|
|
118
|
+
return createElement(View, null, props.children);
|
|
119
|
+
};
|
|
120
|
+
var ErrorMessage = ({ children }) => {
|
|
121
|
+
const { Text } = getNative();
|
|
122
|
+
return createElement(Text, { style: { color: "#AA0000" } }, children);
|
|
123
|
+
};
|
|
124
|
+
var ArrayContainer = (props) => {
|
|
125
|
+
const { View } = getNative();
|
|
126
|
+
return createElement(View, null, props.children);
|
|
127
|
+
};
|
|
128
|
+
var ArrayItemWrapper = (props) => {
|
|
129
|
+
const { View } = getNative();
|
|
130
|
+
return createElement(View, null, props.children);
|
|
131
|
+
};
|
|
132
|
+
var Button = ({
|
|
133
|
+
children,
|
|
134
|
+
disabled,
|
|
135
|
+
onPress
|
|
136
|
+
}) => {
|
|
137
|
+
const { Pressable, Text } = getNative();
|
|
138
|
+
return createElement(
|
|
139
|
+
Pressable,
|
|
140
|
+
{ onPress, disabled },
|
|
141
|
+
createElement(Text, null, children)
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// src/native/forms/suite.ts
|
|
146
|
+
var getNative2 = () => __require("react-native");
|
|
147
|
+
var createArrayItemField = (field) => ({
|
|
148
|
+
...field,
|
|
149
|
+
array: false,
|
|
150
|
+
tags: {
|
|
151
|
+
...field.tags,
|
|
152
|
+
label: void 0
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
var parseNumberValue = (raw) => raw === "" ? null : Number(raw);
|
|
156
|
+
var getSelectableValues = (possibleValues) => {
|
|
157
|
+
return possibleValues?.filter(
|
|
158
|
+
(v) => typeof v === "string" || typeof v === "number"
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
var formatCustomValue = (val) => {
|
|
162
|
+
if (val === null || val === void 0) return "None";
|
|
163
|
+
if (typeof val === "string" || typeof val === "number") return String(val);
|
|
164
|
+
return JSON.stringify(val, null, 2);
|
|
165
|
+
};
|
|
166
|
+
var renderRelationSingle = (context) => {
|
|
167
|
+
const { Text } = getNative2();
|
|
168
|
+
const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
|
|
169
|
+
return createElement(
|
|
170
|
+
FieldWrapper,
|
|
171
|
+
null,
|
|
172
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
173
|
+
onRelationAction ? createElement(
|
|
174
|
+
Button,
|
|
175
|
+
{
|
|
176
|
+
disabled,
|
|
177
|
+
onPress: () => onRelationAction({
|
|
178
|
+
action: "open",
|
|
179
|
+
fieldKey,
|
|
180
|
+
field,
|
|
181
|
+
value: void 0,
|
|
182
|
+
fullPaging: field.tags?.fullPaging,
|
|
183
|
+
onChange: context.onChange
|
|
184
|
+
})
|
|
185
|
+
},
|
|
186
|
+
"Manage"
|
|
187
|
+
) : null,
|
|
188
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
var renderRelationArray = (context) => {
|
|
192
|
+
const { Text } = getNative2();
|
|
193
|
+
const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
|
|
194
|
+
return createElement(
|
|
195
|
+
FieldWrapper,
|
|
196
|
+
null,
|
|
197
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
198
|
+
onRelationAction ? createElement(
|
|
199
|
+
Button,
|
|
200
|
+
{
|
|
201
|
+
disabled,
|
|
202
|
+
onPress: () => onRelationAction({
|
|
203
|
+
action: "open",
|
|
204
|
+
fieldKey,
|
|
205
|
+
field,
|
|
206
|
+
value: void 0,
|
|
207
|
+
fullPaging: field.tags?.fullPaging,
|
|
208
|
+
onChange: context.onChange
|
|
209
|
+
})
|
|
210
|
+
},
|
|
211
|
+
"Manage"
|
|
212
|
+
) : null,
|
|
213
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
var renderCustomSingle = (context) => {
|
|
217
|
+
const { Text } = getNative2();
|
|
218
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
219
|
+
const customType = field.tags?.customType;
|
|
220
|
+
const onCustomTypeAction = context.onCustomTypeAction;
|
|
221
|
+
return createElement(
|
|
222
|
+
FieldWrapper,
|
|
223
|
+
null,
|
|
224
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
225
|
+
createElement(Text, null, formatCustomValue(context.value)),
|
|
226
|
+
customType && onCustomTypeAction ? createElement(
|
|
227
|
+
Button,
|
|
228
|
+
{
|
|
229
|
+
disabled,
|
|
230
|
+
onPress: () => onCustomTypeAction({
|
|
231
|
+
action: "open",
|
|
232
|
+
fieldKey,
|
|
233
|
+
field,
|
|
234
|
+
customType,
|
|
235
|
+
value: context.value,
|
|
236
|
+
onChange: context.onChange
|
|
237
|
+
})
|
|
238
|
+
},
|
|
239
|
+
"Manage"
|
|
240
|
+
) : null,
|
|
241
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
var renderCustomArray = (context) => {
|
|
245
|
+
const { Text, View } = getNative2();
|
|
246
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
247
|
+
const customType = field.tags?.customType;
|
|
248
|
+
const onCustomTypeAction = context.onCustomTypeAction;
|
|
249
|
+
const arrayValue = Array.isArray(context.value) ? context.value : [];
|
|
250
|
+
return createElement(
|
|
251
|
+
FieldWrapper,
|
|
252
|
+
null,
|
|
253
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
254
|
+
createElement(
|
|
255
|
+
View,
|
|
256
|
+
{ style: { gap: 8, marginBottom: 8 } },
|
|
257
|
+
arrayValue.length === 0 ? createElement(Text, null, "No items yet.") : arrayValue.map(
|
|
258
|
+
(item, index) => createElement(
|
|
259
|
+
View,
|
|
260
|
+
{ key: `${fieldKey}-${index}`, style: { gap: 4 } },
|
|
261
|
+
createElement(Text, null, formatCustomValue(item)),
|
|
262
|
+
createElement(
|
|
263
|
+
View,
|
|
264
|
+
{ style: { flexDirection: "row", gap: 8, flexWrap: "wrap" } },
|
|
265
|
+
customType && onCustomTypeAction ? createElement(
|
|
266
|
+
Button,
|
|
267
|
+
{
|
|
268
|
+
disabled,
|
|
269
|
+
onPress: () => onCustomTypeAction({
|
|
270
|
+
action: "edit",
|
|
271
|
+
fieldKey,
|
|
272
|
+
field,
|
|
273
|
+
customType,
|
|
274
|
+
value: context.value,
|
|
275
|
+
index,
|
|
276
|
+
onChange: context.onChange
|
|
277
|
+
})
|
|
278
|
+
},
|
|
279
|
+
"Manage"
|
|
280
|
+
) : null,
|
|
281
|
+
customType && onCustomTypeAction ? createElement(
|
|
282
|
+
Button,
|
|
283
|
+
{
|
|
284
|
+
disabled,
|
|
285
|
+
onPress: () => onCustomTypeAction({
|
|
286
|
+
action: "remove",
|
|
287
|
+
fieldKey,
|
|
288
|
+
field,
|
|
289
|
+
customType,
|
|
290
|
+
value: context.value,
|
|
291
|
+
index,
|
|
292
|
+
onChange: context.onChange
|
|
293
|
+
})
|
|
294
|
+
},
|
|
295
|
+
"Remove"
|
|
296
|
+
) : null
|
|
297
|
+
)
|
|
298
|
+
)
|
|
299
|
+
)
|
|
300
|
+
),
|
|
301
|
+
customType && onCustomTypeAction ? createElement(
|
|
302
|
+
Button,
|
|
303
|
+
{
|
|
304
|
+
disabled,
|
|
305
|
+
onPress: () => onCustomTypeAction({
|
|
306
|
+
action: "add",
|
|
307
|
+
fieldKey,
|
|
308
|
+
field,
|
|
309
|
+
customType,
|
|
310
|
+
value: context.value,
|
|
311
|
+
onChange: context.onChange
|
|
312
|
+
})
|
|
313
|
+
},
|
|
314
|
+
"Add Item"
|
|
315
|
+
) : null,
|
|
316
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
317
|
+
);
|
|
318
|
+
};
|
|
319
|
+
var autoFieldRenderer;
|
|
320
|
+
var renderArray = (context) => {
|
|
321
|
+
const { Text, View } = getNative2();
|
|
322
|
+
const { field, fieldKey, label, required, disabled, error } = context;
|
|
323
|
+
const itemField = createArrayItemField(field);
|
|
324
|
+
const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
|
|
325
|
+
return createElement(
|
|
326
|
+
FieldWrapper,
|
|
327
|
+
null,
|
|
328
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
329
|
+
createElement(
|
|
330
|
+
ArrayContainer,
|
|
331
|
+
null,
|
|
332
|
+
arrayValue.map(
|
|
333
|
+
(item, index) => createElement(
|
|
334
|
+
ArrayItemWrapper,
|
|
335
|
+
{ key: index },
|
|
336
|
+
createElement(
|
|
337
|
+
View,
|
|
338
|
+
{ style: { flex: 1 } },
|
|
339
|
+
autoFieldRenderer({
|
|
340
|
+
field: itemField,
|
|
341
|
+
fieldKey: `${fieldKey}[${index}]`,
|
|
342
|
+
value: item,
|
|
343
|
+
onChange: (newItem) => {
|
|
344
|
+
const newValue = [...arrayValue];
|
|
345
|
+
newValue[index] = newItem;
|
|
346
|
+
context.onChange(newValue);
|
|
347
|
+
},
|
|
348
|
+
disabled
|
|
349
|
+
})
|
|
350
|
+
),
|
|
351
|
+
createElement(
|
|
352
|
+
Button,
|
|
353
|
+
{
|
|
354
|
+
disabled,
|
|
355
|
+
onPress: () => {
|
|
356
|
+
const newValue = [...arrayValue];
|
|
357
|
+
newValue.splice(index, 1);
|
|
358
|
+
context.onChange(newValue);
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"Remove"
|
|
362
|
+
)
|
|
363
|
+
)
|
|
364
|
+
),
|
|
365
|
+
createElement(
|
|
366
|
+
Button,
|
|
367
|
+
{
|
|
368
|
+
disabled,
|
|
369
|
+
onPress: () => {
|
|
370
|
+
const baseValue = Array.isArray(context.value) ? context.value : [];
|
|
371
|
+
const newValue = [...baseValue];
|
|
372
|
+
const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
|
|
373
|
+
newValue.push(newItem);
|
|
374
|
+
context.onChange(newValue);
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"Add Item"
|
|
378
|
+
)
|
|
379
|
+
),
|
|
380
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
381
|
+
);
|
|
382
|
+
};
|
|
383
|
+
var renderString = (context) => {
|
|
384
|
+
const { Text, TextInput } = getNative2();
|
|
385
|
+
const { label, required, disabled, error } = context;
|
|
386
|
+
return createElement(
|
|
387
|
+
FieldWrapper,
|
|
388
|
+
null,
|
|
389
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
390
|
+
createElement(TextInput, {
|
|
391
|
+
value: context.value || "",
|
|
392
|
+
onChangeText: (value) => context.onChange(value),
|
|
393
|
+
editable: !disabled,
|
|
394
|
+
placeholder: label
|
|
395
|
+
}),
|
|
396
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
397
|
+
);
|
|
398
|
+
};
|
|
399
|
+
var renderNumber = (context) => {
|
|
400
|
+
const { Text, TextInput } = getNative2();
|
|
401
|
+
const { label, required, disabled, error } = context;
|
|
402
|
+
return createElement(
|
|
403
|
+
FieldWrapper,
|
|
404
|
+
null,
|
|
405
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
406
|
+
createElement(TextInput, {
|
|
407
|
+
value: context.value !== void 0 ? String(context.value) : "",
|
|
408
|
+
onChangeText: (value) => context.onChange(parseNumberValue(value)),
|
|
409
|
+
editable: !disabled,
|
|
410
|
+
keyboardType: "numeric",
|
|
411
|
+
placeholder: label
|
|
412
|
+
}),
|
|
413
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
414
|
+
);
|
|
415
|
+
};
|
|
416
|
+
var renderBoolean = (context) => {
|
|
417
|
+
const { Text, View, Switch } = getNative2();
|
|
418
|
+
const { label, disabled, error } = context;
|
|
419
|
+
return createElement(
|
|
420
|
+
FieldWrapper,
|
|
421
|
+
null,
|
|
422
|
+
createElement(
|
|
423
|
+
View,
|
|
424
|
+
{ style: { flexDirection: "row", alignItems: "center", gap: 8 } },
|
|
425
|
+
createElement(Switch, {
|
|
426
|
+
value: !!context.value,
|
|
427
|
+
onValueChange: (value) => context.onChange(value),
|
|
428
|
+
disabled
|
|
429
|
+
}),
|
|
430
|
+
createElement(Text, null, label)
|
|
431
|
+
),
|
|
432
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
433
|
+
);
|
|
434
|
+
};
|
|
435
|
+
var renderEnumSelect = (context) => {
|
|
436
|
+
const { Text, View } = getNative2();
|
|
437
|
+
const { field, label, required, disabled, error } = context;
|
|
438
|
+
const selectableValues = getSelectableValues(context.possibleValues) ?? [];
|
|
439
|
+
return createElement(
|
|
440
|
+
FieldWrapper,
|
|
441
|
+
null,
|
|
442
|
+
createElement(Text, null, `${label} ${required ? "*" : ""}`),
|
|
443
|
+
createElement(
|
|
444
|
+
View,
|
|
445
|
+
{ style: { gap: 8 } },
|
|
446
|
+
selectableValues.map(
|
|
447
|
+
(val) => createElement(
|
|
448
|
+
Button,
|
|
449
|
+
{
|
|
450
|
+
key: String(val),
|
|
451
|
+
disabled,
|
|
452
|
+
onPress: () => context.onChange(
|
|
453
|
+
field.type === "number" ? Number(val) : String(val)
|
|
454
|
+
)
|
|
455
|
+
},
|
|
456
|
+
String(val)
|
|
457
|
+
)
|
|
458
|
+
)
|
|
459
|
+
),
|
|
460
|
+
error ? createElement(ErrorMessage, null, error) : null
|
|
461
|
+
);
|
|
462
|
+
};
|
|
463
|
+
var nativeSuite = {
|
|
464
|
+
renderers: {
|
|
465
|
+
string: renderString,
|
|
466
|
+
number: renderNumber,
|
|
467
|
+
boolean: renderBoolean,
|
|
468
|
+
enum_select: renderEnumSelect,
|
|
469
|
+
array: renderArray,
|
|
470
|
+
relation_single: renderRelationSingle,
|
|
471
|
+
relation_array: renderRelationArray,
|
|
472
|
+
custom_single: renderCustomSingle,
|
|
473
|
+
custom_array: renderCustomArray
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
var resolvedNativeSuite = resolveSuite(void 0, nativeSuite);
|
|
477
|
+
autoFieldRenderer = createAutoField(resolvedNativeSuite);
|
|
478
|
+
var nativeAutoField = autoFieldRenderer;
|
|
479
|
+
|
|
480
|
+
// src/native/forms/createNativeFormRenderer.ts
|
|
481
|
+
var createNativeFormRenderer = (options) => {
|
|
482
|
+
return createFormRenderer({
|
|
483
|
+
fallbackSuite: nativeSuite,
|
|
484
|
+
suite: options?.suite
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// src/common/Routing.ts
|
|
489
|
+
var PATH_DELIMITER = "/";
|
|
490
|
+
var getPotentialJSONValue = (value) => {
|
|
491
|
+
try {
|
|
492
|
+
return JSON.parse(value);
|
|
493
|
+
} catch (error) {
|
|
494
|
+
return value;
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
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);
|
|
498
|
+
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);
|
|
499
|
+
var mergeStringPaths = (path1, path2, delimiter = PATH_DELIMITER, filterEmptyOutput = false, filterEmptyInput = true, useJson = true, uriEncodeParts = false) => getPathString(
|
|
500
|
+
[
|
|
501
|
+
...getPathArray(
|
|
502
|
+
path1,
|
|
503
|
+
delimiter,
|
|
504
|
+
filterEmptyOutput,
|
|
505
|
+
filterEmptyInput,
|
|
506
|
+
useJson,
|
|
507
|
+
uriEncodeParts
|
|
508
|
+
),
|
|
509
|
+
...getPathArray(
|
|
510
|
+
path2,
|
|
511
|
+
delimiter,
|
|
512
|
+
filterEmptyOutput,
|
|
513
|
+
filterEmptyInput,
|
|
514
|
+
useJson,
|
|
515
|
+
uriEncodeParts
|
|
516
|
+
)
|
|
517
|
+
],
|
|
518
|
+
delimiter,
|
|
519
|
+
filterEmptyInput,
|
|
520
|
+
useJson,
|
|
521
|
+
uriEncodeParts
|
|
522
|
+
);
|
|
523
|
+
var getParamsAndTestPath = (path, testPath, exact = false) => {
|
|
524
|
+
const pathList = getPathArray(path);
|
|
525
|
+
const testPathList = getPathArray(testPath);
|
|
526
|
+
if (exact && pathList.length !== testPathList.length) {
|
|
527
|
+
return false;
|
|
528
|
+
} else {
|
|
529
|
+
let params = {};
|
|
530
|
+
if (pathList.length >= testPathList.length) {
|
|
531
|
+
for (let i = 0; i < testPathList.length; i++) {
|
|
532
|
+
const testPathPart = testPathList[i];
|
|
533
|
+
const pathPart = pathList[i];
|
|
534
|
+
if (testPathPart.startsWith(":")) {
|
|
535
|
+
const paramName = testPathPart.slice(1);
|
|
536
|
+
params[paramName] = pathPart;
|
|
537
|
+
} else if (pathPart !== testPathPart) {
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
} else {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
return params;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
var createManualRouteAdapter = (initialPath = "/") => {
|
|
548
|
+
let currentPath = initialPath;
|
|
549
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
550
|
+
const updatePath = (nextPath) => {
|
|
551
|
+
currentPath = nextPath;
|
|
552
|
+
listeners.forEach((listener) => listener(nextPath));
|
|
553
|
+
};
|
|
554
|
+
const adapter = {
|
|
555
|
+
getPath: () => currentPath,
|
|
556
|
+
subscribe: (listener) => {
|
|
557
|
+
listeners.add(listener);
|
|
558
|
+
return () => {
|
|
559
|
+
listeners.delete(listener);
|
|
560
|
+
};
|
|
561
|
+
},
|
|
562
|
+
push: (path) => updatePath(path),
|
|
563
|
+
replace: (path) => updatePath(path)
|
|
564
|
+
};
|
|
565
|
+
return {
|
|
566
|
+
adapter,
|
|
567
|
+
updatePath
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
var buildQueryString = (query = {}) => {
|
|
571
|
+
const parts = [];
|
|
572
|
+
for (const [key, rawValue] of Object.entries(query)) {
|
|
573
|
+
if (rawValue === void 0) {
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
const values = Array.isArray(rawValue) ? rawValue : [rawValue];
|
|
577
|
+
for (const value of values) {
|
|
578
|
+
if (value === void 0) {
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
const encodedKey = encodeURIComponent(key);
|
|
582
|
+
const encodedValue = value === null ? "" : encodeURIComponent(String(value));
|
|
583
|
+
parts.push(`${encodedKey}=${encodedValue}`);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return parts.join("&");
|
|
587
|
+
};
|
|
588
|
+
var buildRoutePath = (segments, query) => {
|
|
589
|
+
const normalizedSegments = segments.map((segment) => String(segment));
|
|
590
|
+
const basePath = "/" + getPathString(normalizedSegments, "/", true, false, true);
|
|
591
|
+
const queryString = query ? buildQueryString(query) : "";
|
|
592
|
+
return queryString ? `${basePath}?${queryString}` : basePath;
|
|
593
|
+
};
|
|
594
|
+
var RouteContext = createContext({
|
|
595
|
+
currentWindowPath: "",
|
|
596
|
+
parentPath: "",
|
|
597
|
+
params: {},
|
|
598
|
+
isTopLevel: true
|
|
599
|
+
});
|
|
600
|
+
var {
|
|
601
|
+
/**
|
|
602
|
+
* @ignore
|
|
603
|
+
*/
|
|
604
|
+
Provider: RouteContextProvider,
|
|
605
|
+
/**
|
|
606
|
+
* @ignore
|
|
607
|
+
*/
|
|
608
|
+
Consumer: RouteContextConsumer
|
|
609
|
+
} = RouteContext;
|
|
610
|
+
var useRouteContext = () => useContext(RouteContext);
|
|
611
|
+
var RouteProvider = ({
|
|
612
|
+
adapter,
|
|
613
|
+
initialPath,
|
|
614
|
+
children
|
|
615
|
+
}) => {
|
|
616
|
+
const [currentPath, setCurrentPath] = useState(
|
|
617
|
+
initialPath ?? adapter.getPath()
|
|
618
|
+
);
|
|
619
|
+
useEffect(() => {
|
|
620
|
+
return adapter.subscribe((nextPath) => {
|
|
621
|
+
setCurrentPath(nextPath);
|
|
622
|
+
});
|
|
623
|
+
}, [adapter]);
|
|
624
|
+
const contextValue = useMemo(
|
|
625
|
+
() => ({
|
|
626
|
+
currentWindowPath: currentPath,
|
|
627
|
+
parentPath: "",
|
|
628
|
+
params: {},
|
|
629
|
+
isTopLevel: true,
|
|
630
|
+
adapter
|
|
631
|
+
}),
|
|
632
|
+
[currentPath, adapter]
|
|
633
|
+
);
|
|
634
|
+
return /* @__PURE__ */ jsx(RouteContextProvider, { value: contextValue, children });
|
|
635
|
+
};
|
|
636
|
+
var Route = ({
|
|
637
|
+
/**
|
|
638
|
+
* Use `:` as the first character to denote a parameter in the path.
|
|
639
|
+
*/
|
|
640
|
+
path = "",
|
|
641
|
+
onParamsChange,
|
|
642
|
+
exact = false,
|
|
643
|
+
children
|
|
644
|
+
}) => {
|
|
645
|
+
const {
|
|
646
|
+
currentWindowPath = "",
|
|
647
|
+
parentPath = "",
|
|
648
|
+
params: parentParams = {},
|
|
649
|
+
adapter
|
|
650
|
+
} = useRouteContext();
|
|
651
|
+
const targetCurrentPath = useMemo(
|
|
652
|
+
() => currentWindowPath,
|
|
653
|
+
[currentWindowPath]
|
|
654
|
+
);
|
|
655
|
+
const fullPath = useMemo(
|
|
656
|
+
() => mergeStringPaths(parentPath, path),
|
|
657
|
+
[parentPath, path]
|
|
658
|
+
);
|
|
659
|
+
const newParams = useMemo(
|
|
660
|
+
() => getParamsAndTestPath(targetCurrentPath, fullPath, exact),
|
|
661
|
+
[targetCurrentPath, fullPath, exact]
|
|
662
|
+
);
|
|
663
|
+
const params = useMemo(
|
|
664
|
+
() => ({
|
|
665
|
+
...parentParams,
|
|
666
|
+
...newParams ? newParams : {}
|
|
667
|
+
}),
|
|
668
|
+
[parentParams, newParams]
|
|
669
|
+
);
|
|
670
|
+
const newRouteContext = useMemo(
|
|
671
|
+
() => ({
|
|
672
|
+
currentWindowPath: targetCurrentPath,
|
|
673
|
+
parentPath: fullPath,
|
|
674
|
+
params,
|
|
675
|
+
isTopLevel: false,
|
|
676
|
+
adapter
|
|
677
|
+
}),
|
|
678
|
+
[targetCurrentPath, fullPath, params, adapter]
|
|
679
|
+
);
|
|
680
|
+
useEffect(() => {
|
|
681
|
+
if (onParamsChange) {
|
|
682
|
+
onParamsChange(params);
|
|
683
|
+
}
|
|
684
|
+
}, [params, onParamsChange]);
|
|
685
|
+
return newParams ? /* @__PURE__ */ jsx(RouteContextProvider, { value: newRouteContext, children }) : null;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
// src/app/utils/History.ts
|
|
689
|
+
var ensurePrefix = (value, prefix) => value ? value.startsWith(prefix) ? value : `${prefix}${value}` : "";
|
|
690
|
+
var parseHistoryPath = (inputPath) => {
|
|
691
|
+
const raw = String(inputPath ?? "").trim();
|
|
692
|
+
if (!raw) {
|
|
693
|
+
return { path: "/" };
|
|
694
|
+
}
|
|
695
|
+
try {
|
|
696
|
+
const absoluteUrl = new URL(raw);
|
|
697
|
+
return {
|
|
698
|
+
path: absoluteUrl.pathname || "/",
|
|
699
|
+
...absoluteUrl.search ? { search: absoluteUrl.search } : {},
|
|
700
|
+
...absoluteUrl.hash ? { hash: absoluteUrl.hash } : {}
|
|
701
|
+
};
|
|
702
|
+
} catch (error) {
|
|
703
|
+
let target = raw;
|
|
704
|
+
let hash = "";
|
|
705
|
+
let search = "";
|
|
706
|
+
const hashIndex = target.indexOf("#");
|
|
707
|
+
if (hashIndex >= 0) {
|
|
708
|
+
hash = target.slice(hashIndex);
|
|
709
|
+
target = target.slice(0, hashIndex);
|
|
710
|
+
}
|
|
711
|
+
const searchIndex = target.indexOf("?");
|
|
712
|
+
if (searchIndex >= 0) {
|
|
713
|
+
search = target.slice(searchIndex);
|
|
714
|
+
target = target.slice(0, searchIndex);
|
|
715
|
+
}
|
|
716
|
+
const path = target ? target.startsWith("/") ? target : `/${target}` : "/";
|
|
717
|
+
return {
|
|
718
|
+
path,
|
|
719
|
+
...search && search !== "?" ? { search } : {},
|
|
720
|
+
...hash && hash !== "#" ? { hash } : {}
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
var buildHistoryPath = ({
|
|
725
|
+
path,
|
|
726
|
+
search,
|
|
727
|
+
hash
|
|
728
|
+
}) => {
|
|
729
|
+
const normalizedPath = path ? path.startsWith("/") ? path : `/${path}` : "/";
|
|
730
|
+
const normalizedSearch = search ? ensurePrefix(search, "?") : "";
|
|
731
|
+
const normalizedHash = hash ? ensurePrefix(hash, "#") : "";
|
|
732
|
+
return `${normalizedPath}${normalizedSearch}${normalizedHash}`;
|
|
733
|
+
};
|
|
734
|
+
var getHistoryLocation = (inputPath, state, getNextKey, currentLocation, replaceSearch = false) => {
|
|
735
|
+
const parsed = parseHistoryPath(inputPath);
|
|
736
|
+
const nextSearch = typeof parsed.search === "undefined" ? replaceSearch ? void 0 : currentLocation?.search : parsed.search;
|
|
737
|
+
return {
|
|
738
|
+
path: parsed.path,
|
|
739
|
+
...typeof nextSearch !== "undefined" ? { search: nextSearch } : {},
|
|
740
|
+
...parsed.hash ? { hash: parsed.hash } : {},
|
|
741
|
+
...typeof state !== "undefined" ? { state } : {},
|
|
742
|
+
key: getNextKey()
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
var createMemoryHistory = (initialPath = "/") => {
|
|
746
|
+
let keyCounter = 0;
|
|
747
|
+
const getNextKey = () => `h${keyCounter++}`;
|
|
748
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
749
|
+
const entries = [
|
|
750
|
+
{
|
|
751
|
+
location: getHistoryLocation(
|
|
752
|
+
initialPath,
|
|
753
|
+
void 0,
|
|
754
|
+
getNextKey,
|
|
755
|
+
void 0,
|
|
756
|
+
true
|
|
757
|
+
)
|
|
758
|
+
}
|
|
759
|
+
];
|
|
760
|
+
let currentIndex = 0;
|
|
761
|
+
const getCurrentLocation = () => entries[currentIndex].location;
|
|
762
|
+
const notify = () => {
|
|
763
|
+
const location = getCurrentLocation();
|
|
764
|
+
listeners.forEach((listener) => listener(location));
|
|
765
|
+
};
|
|
766
|
+
const push = (path, opts) => {
|
|
767
|
+
const location = getHistoryLocation(
|
|
768
|
+
path,
|
|
769
|
+
opts?.state,
|
|
770
|
+
getNextKey,
|
|
771
|
+
getCurrentLocation(),
|
|
772
|
+
opts?.replaceSearch === true
|
|
773
|
+
);
|
|
774
|
+
if (currentIndex < entries.length - 1) {
|
|
775
|
+
entries.splice(currentIndex + 1);
|
|
776
|
+
}
|
|
777
|
+
entries.push({ location });
|
|
778
|
+
currentIndex = entries.length - 1;
|
|
779
|
+
notify();
|
|
780
|
+
};
|
|
781
|
+
const replace = (path, opts) => {
|
|
782
|
+
const location = getHistoryLocation(
|
|
783
|
+
path,
|
|
784
|
+
opts?.state,
|
|
785
|
+
getNextKey,
|
|
786
|
+
getCurrentLocation(),
|
|
787
|
+
opts?.replaceSearch === true
|
|
788
|
+
);
|
|
789
|
+
entries[currentIndex] = { location };
|
|
790
|
+
notify();
|
|
791
|
+
};
|
|
792
|
+
const go = (delta) => {
|
|
793
|
+
if (!Number.isFinite(delta)) {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
const targetIndex = Math.max(
|
|
797
|
+
0,
|
|
798
|
+
Math.min(entries.length - 1, currentIndex + Math.trunc(delta))
|
|
799
|
+
);
|
|
800
|
+
if (targetIndex === currentIndex) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
currentIndex = targetIndex;
|
|
804
|
+
notify();
|
|
805
|
+
};
|
|
806
|
+
return {
|
|
807
|
+
get location() {
|
|
808
|
+
return getCurrentLocation();
|
|
809
|
+
},
|
|
810
|
+
get length() {
|
|
811
|
+
return entries.length;
|
|
812
|
+
},
|
|
813
|
+
get index() {
|
|
814
|
+
return currentIndex;
|
|
815
|
+
},
|
|
816
|
+
push,
|
|
817
|
+
replace,
|
|
818
|
+
go,
|
|
819
|
+
back: () => go(-1),
|
|
820
|
+
forward: () => go(1),
|
|
821
|
+
listen: (listener) => {
|
|
822
|
+
listeners.add(listener);
|
|
823
|
+
return () => listeners.delete(listener);
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// src/app/utils/easy-layout/computeAreaBounds.ts
|
|
829
|
+
var computeAreaBounds = (parsed) => {
|
|
830
|
+
const result = {};
|
|
831
|
+
for (let rowIndex = 0; rowIndex < parsed.areaGrid.length; rowIndex++) {
|
|
832
|
+
const row = parsed.areaGrid[rowIndex];
|
|
833
|
+
for (let colIndex = 0; colIndex < row.length; colIndex++) {
|
|
834
|
+
const name = row[colIndex];
|
|
835
|
+
if (!name || name === ".") {
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
const row1 = rowIndex + 1;
|
|
839
|
+
const col1 = colIndex + 1;
|
|
840
|
+
const existing = result[name];
|
|
841
|
+
if (!existing) {
|
|
842
|
+
result[name] = {
|
|
843
|
+
name,
|
|
844
|
+
rowStart: row1,
|
|
845
|
+
rowEnd: row1,
|
|
846
|
+
colStart: col1,
|
|
847
|
+
colEnd: col1
|
|
848
|
+
};
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
existing.rowStart = Math.min(existing.rowStart, row1);
|
|
852
|
+
existing.rowEnd = Math.max(existing.rowEnd, row1);
|
|
853
|
+
existing.colStart = Math.min(existing.colStart, col1);
|
|
854
|
+
existing.colEnd = Math.max(existing.colEnd, col1);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return result;
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
// src/app/utils/easy-layout/computeTracks.ts
|
|
861
|
+
var computeTrackPixels = ({
|
|
862
|
+
tracks,
|
|
863
|
+
totalPx,
|
|
864
|
+
gapPx = 0,
|
|
865
|
+
paddingPx = 0
|
|
866
|
+
}) => {
|
|
867
|
+
if (!tracks.length) {
|
|
868
|
+
return [];
|
|
869
|
+
}
|
|
870
|
+
const gapsPx = Math.max(0, tracks.length - 1) * Math.max(0, gapPx);
|
|
871
|
+
const usablePx = Math.max(0, totalPx - Math.max(0, paddingPx) * 2 - gapsPx);
|
|
872
|
+
let fixedPx = 0;
|
|
873
|
+
let frTotal = 0;
|
|
874
|
+
for (const track of tracks) {
|
|
875
|
+
if (track.kind === "px") {
|
|
876
|
+
fixedPx += track.value;
|
|
877
|
+
} else if (track.kind === "pct") {
|
|
878
|
+
fixedPx += usablePx * track.value / 100;
|
|
879
|
+
} else {
|
|
880
|
+
frTotal += track.value;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
const remainderPx = Math.max(0, usablePx - fixedPx);
|
|
884
|
+
return tracks.map((track) => {
|
|
885
|
+
if (track.kind === "px") {
|
|
886
|
+
return track.value;
|
|
887
|
+
}
|
|
888
|
+
if (track.kind === "pct") {
|
|
889
|
+
return usablePx * track.value / 100;
|
|
890
|
+
}
|
|
891
|
+
if (frTotal <= 0) {
|
|
892
|
+
return 0;
|
|
893
|
+
}
|
|
894
|
+
return remainderPx * track.value / frTotal;
|
|
895
|
+
});
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// src/app/utils/easy-layout/parseTemplate.ts
|
|
899
|
+
var parseTrackSpec = (token) => {
|
|
900
|
+
const trimmed = token.trim();
|
|
901
|
+
const numericMatch = trimmed.match(/^([0-9]*\.?[0-9]+)(fr|px|%)$/);
|
|
902
|
+
if (!numericMatch) {
|
|
903
|
+
throw new Error(
|
|
904
|
+
`Invalid track token "${trimmed}". Supported units are fr, px, and %.`
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
const value = Number(numericMatch[1]);
|
|
908
|
+
const suffix = numericMatch[2];
|
|
909
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
910
|
+
throw new Error(`Track value must be a non-negative number. Received "${trimmed}".`);
|
|
911
|
+
}
|
|
912
|
+
if (suffix === "fr") {
|
|
913
|
+
return { kind: "fr", value };
|
|
914
|
+
}
|
|
915
|
+
if (suffix === "px") {
|
|
916
|
+
return { kind: "px", value };
|
|
917
|
+
}
|
|
918
|
+
return { kind: "pct", value };
|
|
919
|
+
};
|
|
920
|
+
var normalizeAreas = (areaPart) => {
|
|
921
|
+
return areaPart.trim().split(/\s+/g).map((token) => token.trim()).filter(Boolean);
|
|
922
|
+
};
|
|
923
|
+
var parseTemplate = (template = "") => {
|
|
924
|
+
const lines = template.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
925
|
+
const areaGrid = [];
|
|
926
|
+
const rowTracks = [];
|
|
927
|
+
let colTracks = null;
|
|
928
|
+
for (const line of lines) {
|
|
929
|
+
if (line.startsWith("\\")) {
|
|
930
|
+
if (colTracks) {
|
|
931
|
+
throw new Error("Template can include only one column-track line.");
|
|
932
|
+
}
|
|
933
|
+
const colTokens = line.replace(/\\/g, " ").trim().split(/\s+/g).filter(Boolean);
|
|
934
|
+
colTracks = colTokens.map(parseTrackSpec);
|
|
935
|
+
continue;
|
|
936
|
+
}
|
|
937
|
+
const parts = line.split(",").map((part) => part.trim());
|
|
938
|
+
const areaPart = parts[0] || "";
|
|
939
|
+
if (!areaPart) {
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
if (parts.length > 2) {
|
|
943
|
+
throw new Error(
|
|
944
|
+
`Invalid row definition "${line}". Expected "<areas>, <row-track>".`
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
const areas = normalizeAreas(areaPart);
|
|
948
|
+
if (!areas.length) {
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
951
|
+
areaGrid.push(areas);
|
|
952
|
+
const rowTrack = parts[1];
|
|
953
|
+
if (rowTrack) {
|
|
954
|
+
rowTracks.push(parseTrackSpec(rowTrack));
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
if (!areaGrid.length) {
|
|
958
|
+
throw new Error("Template must include at least one area row.");
|
|
959
|
+
}
|
|
960
|
+
const expectedWidth = areaGrid[0].length;
|
|
961
|
+
for (let rowIndex = 0; rowIndex < areaGrid.length; rowIndex++) {
|
|
962
|
+
const width = areaGrid[rowIndex].length;
|
|
963
|
+
if (width !== expectedWidth) {
|
|
964
|
+
throw new Error(
|
|
965
|
+
`All area rows must have the same width. Expected ${expectedWidth}, received ${width} at row ${rowIndex + 1}.`
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
if (colTracks && colTracks.length !== expectedWidth) {
|
|
970
|
+
throw new Error(
|
|
971
|
+
`Column track count must match area width. Expected ${expectedWidth}, received ${colTracks.length}.`
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
const areaNames = Array.from(
|
|
975
|
+
new Set(
|
|
976
|
+
areaGrid.flat().map((name) => name.trim()).filter((name) => !!name && name !== ".")
|
|
977
|
+
)
|
|
978
|
+
);
|
|
979
|
+
return {
|
|
980
|
+
areaGrid,
|
|
981
|
+
rowTracks,
|
|
982
|
+
colTracks: colTracks || [],
|
|
983
|
+
areaNames
|
|
984
|
+
};
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
// src/app/utils/easy-layout/validateAreas.ts
|
|
988
|
+
var validateAreas = (parsed) => {
|
|
989
|
+
const bounds = computeAreaBounds(parsed);
|
|
990
|
+
for (const areaName of parsed.areaNames) {
|
|
991
|
+
const bound = bounds[areaName];
|
|
992
|
+
if (!bound) {
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
for (let row = bound.rowStart; row <= bound.rowEnd; row++) {
|
|
996
|
+
for (let col = bound.colStart; col <= bound.colEnd; col++) {
|
|
997
|
+
const token = parsed.areaGrid[row - 1]?.[col - 1];
|
|
998
|
+
if (token !== areaName) {
|
|
999
|
+
throw new Error(
|
|
1000
|
+
`Area "${areaName}" must be a rectangle. Missing "${areaName}" at row ${row}, col ${col}.`
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
// src/native/utils/EasyLayout.tsx
|
|
1009
|
+
var roundTo = (value, decimals) => {
|
|
1010
|
+
const places = Number.isFinite(decimals) ? Math.max(0, decimals) : 3;
|
|
1011
|
+
const factor = Math.pow(10, places);
|
|
1012
|
+
return Math.round(value * factor) / factor;
|
|
1013
|
+
};
|
|
1014
|
+
var sumTrackWindow = (tracks, startIndex, endIndex, gapPx) => {
|
|
1015
|
+
if (endIndex < startIndex) {
|
|
1016
|
+
return 0;
|
|
1017
|
+
}
|
|
1018
|
+
const trackSum = tracks.slice(startIndex, endIndex + 1).reduce((acc, value) => acc + value, 0);
|
|
1019
|
+
const gaps = (endIndex - startIndex) * gapPx;
|
|
1020
|
+
return trackSum + Math.max(0, gaps);
|
|
1021
|
+
};
|
|
1022
|
+
var sumBeforeTrack = (tracks, startIndex, gapPx) => {
|
|
1023
|
+
if (startIndex <= 0) {
|
|
1024
|
+
return 0;
|
|
1025
|
+
}
|
|
1026
|
+
const trackSum = tracks.slice(0, startIndex).reduce((acc, value) => acc + value, 0);
|
|
1027
|
+
const gaps = startIndex * Math.max(0, gapPx);
|
|
1028
|
+
return trackSum + gaps;
|
|
1029
|
+
};
|
|
1030
|
+
var computeCoords = (parsed, bounds, { width, height, padding = 0, gap = 0, roundToDecimals = 3 }) => {
|
|
1031
|
+
const rowTracks = parsed.rowTracks.length ? parsed.rowTracks : parsed.areaGrid.map(() => ({ kind: "fr", value: 1 }));
|
|
1032
|
+
const colTracks = parsed.colTracks.length ? parsed.colTracks : parsed.areaGrid[0].map(() => ({ kind: "fr", value: 1 }));
|
|
1033
|
+
const rowPixels = computeTrackPixels({
|
|
1034
|
+
tracks: rowTracks,
|
|
1035
|
+
totalPx: Math.max(0, height),
|
|
1036
|
+
gapPx: gap,
|
|
1037
|
+
paddingPx: padding
|
|
1038
|
+
});
|
|
1039
|
+
const colPixels = computeTrackPixels({
|
|
1040
|
+
tracks: colTracks,
|
|
1041
|
+
totalPx: Math.max(0, width),
|
|
1042
|
+
gapPx: gap,
|
|
1043
|
+
paddingPx: padding
|
|
1044
|
+
});
|
|
1045
|
+
const result = {};
|
|
1046
|
+
for (const areaName of parsed.areaNames) {
|
|
1047
|
+
const area = bounds[areaName];
|
|
1048
|
+
if (!area) {
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1051
|
+
const left = Math.max(0, padding) + sumBeforeTrack(colPixels, area.colStart - 1, Math.max(0, gap));
|
|
1052
|
+
const top = Math.max(0, padding) + sumBeforeTrack(rowPixels, area.rowStart - 1, Math.max(0, gap));
|
|
1053
|
+
const areaWidth = sumTrackWindow(
|
|
1054
|
+
colPixels,
|
|
1055
|
+
area.colStart - 1,
|
|
1056
|
+
area.colEnd - 1,
|
|
1057
|
+
Math.max(0, gap)
|
|
1058
|
+
);
|
|
1059
|
+
const areaHeight = sumTrackWindow(
|
|
1060
|
+
rowPixels,
|
|
1061
|
+
area.rowStart - 1,
|
|
1062
|
+
area.rowEnd - 1,
|
|
1063
|
+
Math.max(0, gap)
|
|
1064
|
+
);
|
|
1065
|
+
result[areaName] = {
|
|
1066
|
+
left: roundTo(left, roundToDecimals),
|
|
1067
|
+
top: roundTo(top, roundToDecimals),
|
|
1068
|
+
width: roundTo(areaWidth, roundToDecimals),
|
|
1069
|
+
height: roundTo(areaHeight, roundToDecimals)
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
};
|
|
1074
|
+
var makeNativeEasyLayout = (template) => {
|
|
1075
|
+
const parsed = parseTemplate(template);
|
|
1076
|
+
validateAreas(parsed);
|
|
1077
|
+
const bounds = computeAreaBounds(parsed);
|
|
1078
|
+
return {
|
|
1079
|
+
template,
|
|
1080
|
+
parsed,
|
|
1081
|
+
bounds,
|
|
1082
|
+
areaNames: parsed.areaNames,
|
|
1083
|
+
computeNativeCoords: (input) => computeCoords(parsed, bounds, input)
|
|
1084
|
+
};
|
|
1085
|
+
};
|
|
1086
|
+
var useNativeEasyLayout = (layout, input) => {
|
|
1087
|
+
return useMemo(
|
|
1088
|
+
() => layout.computeNativeCoords(input),
|
|
1089
|
+
[
|
|
1090
|
+
layout,
|
|
1091
|
+
input.width,
|
|
1092
|
+
input.height,
|
|
1093
|
+
input.padding,
|
|
1094
|
+
input.gap,
|
|
1095
|
+
input.roundToDecimals
|
|
1096
|
+
]
|
|
1097
|
+
);
|
|
1098
|
+
};
|
|
1099
|
+
var NativeEasyLayoutView = ({
|
|
1100
|
+
layout,
|
|
1101
|
+
areaChildren = {},
|
|
1102
|
+
ViewComponent,
|
|
1103
|
+
containerStyle = {},
|
|
1104
|
+
areaStyle = {},
|
|
1105
|
+
onLayout,
|
|
1106
|
+
...input
|
|
1107
|
+
}) => {
|
|
1108
|
+
const coords = useNativeEasyLayout(layout, input);
|
|
1109
|
+
const Container = ViewComponent || "div";
|
|
1110
|
+
return createElement(
|
|
1111
|
+
Container,
|
|
1112
|
+
{
|
|
1113
|
+
onLayout,
|
|
1114
|
+
style: {
|
|
1115
|
+
position: "relative",
|
|
1116
|
+
width: input.width,
|
|
1117
|
+
height: input.height,
|
|
1118
|
+
...containerStyle
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
layout.areaNames.map(
|
|
1122
|
+
(areaName) => createElement(
|
|
1123
|
+
Container,
|
|
1124
|
+
{
|
|
1125
|
+
key: areaName,
|
|
1126
|
+
style: {
|
|
1127
|
+
position: "absolute",
|
|
1128
|
+
...coords[areaName],
|
|
1129
|
+
...areaStyle
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
areaChildren[areaName] ?? null
|
|
1133
|
+
)
|
|
1134
|
+
)
|
|
1135
|
+
);
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
// src/native/utils/History.ts
|
|
1139
|
+
var mapNativeURLToPath = (url) => buildHistoryPath(parseHistoryPath(url));
|
|
1140
|
+
var createNativeHistory = (options = {}) => {
|
|
1141
|
+
const {
|
|
1142
|
+
adapter,
|
|
1143
|
+
initialPath = "/",
|
|
1144
|
+
onIncomingURL = "replace",
|
|
1145
|
+
mapURLToPath = mapNativeURLToPath
|
|
1146
|
+
} = options;
|
|
1147
|
+
const history = createMemoryHistory(initialPath);
|
|
1148
|
+
let unsubscribe;
|
|
1149
|
+
let started = false;
|
|
1150
|
+
const applyIncomingURL = (url) => {
|
|
1151
|
+
if (!url) {
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
const targetPath = mapURLToPath(url);
|
|
1155
|
+
if (!targetPath) {
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
if (onIncomingURL === "push") {
|
|
1159
|
+
history.push(targetPath, { replaceSearch: true });
|
|
1160
|
+
} else {
|
|
1161
|
+
history.replace(targetPath, { replaceSearch: true });
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
return {
|
|
1165
|
+
get location() {
|
|
1166
|
+
return history.location;
|
|
1167
|
+
},
|
|
1168
|
+
get length() {
|
|
1169
|
+
return history.length;
|
|
1170
|
+
},
|
|
1171
|
+
get index() {
|
|
1172
|
+
return history.index;
|
|
1173
|
+
},
|
|
1174
|
+
push: history.push,
|
|
1175
|
+
replace: history.replace,
|
|
1176
|
+
go: history.go,
|
|
1177
|
+
back: history.back,
|
|
1178
|
+
forward: history.forward,
|
|
1179
|
+
listen: history.listen,
|
|
1180
|
+
start: async () => {
|
|
1181
|
+
if (started) {
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
started = true;
|
|
1185
|
+
if (!adapter) {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
const startKey = history.location.key;
|
|
1189
|
+
const startIndex = history.index;
|
|
1190
|
+
unsubscribe = adapter.subscribe((url) => {
|
|
1191
|
+
const targetPath = mapURLToPath(url);
|
|
1192
|
+
if (!targetPath) {
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
const userNavigated = history.location.key !== startKey || history.index !== startIndex;
|
|
1196
|
+
if (userNavigated && targetPath === initialPath) {
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
if (onIncomingURL === "push") {
|
|
1200
|
+
history.push(targetPath, { replaceSearch: true });
|
|
1201
|
+
} else {
|
|
1202
|
+
history.replace(targetPath, { replaceSearch: true });
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
const initialURL = await adapter.getInitialURL();
|
|
1206
|
+
if (history.location.key === startKey && history.index === startIndex) {
|
|
1207
|
+
applyIncomingURL(initialURL);
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
stop: () => {
|
|
1211
|
+
if (!started) {
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
unsubscribe?.();
|
|
1215
|
+
unsubscribe = void 0;
|
|
1216
|
+
started = false;
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
};
|
|
1220
|
+
var createNativeBackHandler = (history) => {
|
|
1221
|
+
return {
|
|
1222
|
+
/**
|
|
1223
|
+
* @returns True when back navigation was handled by history.
|
|
1224
|
+
*/
|
|
1225
|
+
handle: () => {
|
|
1226
|
+
if (history.index > 0) {
|
|
1227
|
+
history.back();
|
|
1228
|
+
return true;
|
|
1229
|
+
}
|
|
1230
|
+
return false;
|
|
1231
|
+
}
|
|
1232
|
+
};
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
// src/app/utils/RouteHistory.ts
|
|
1236
|
+
var createRouteAdapterFromHistory = (history) => {
|
|
1237
|
+
return {
|
|
1238
|
+
getPath: () => history.location.path,
|
|
1239
|
+
subscribe: (listener) => {
|
|
1240
|
+
return history.listen((location) => {
|
|
1241
|
+
listener(location.path);
|
|
1242
|
+
});
|
|
1243
|
+
},
|
|
1244
|
+
push: (path) => {
|
|
1245
|
+
history.push(path, { replaceSearch: true });
|
|
1246
|
+
},
|
|
1247
|
+
replace: (path) => {
|
|
1248
|
+
history.replace(path, { replaceSearch: true });
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
};
|
|
1252
|
+
var NativeRouteProvider = ({
|
|
1253
|
+
children,
|
|
1254
|
+
history,
|
|
1255
|
+
...historyOptions
|
|
1256
|
+
}) => {
|
|
1257
|
+
const historyRef = useRef(history ?? null);
|
|
1258
|
+
if (!historyRef.current) {
|
|
1259
|
+
historyRef.current = createNativeHistory(historyOptions);
|
|
1260
|
+
}
|
|
1261
|
+
const adapterRef = useRef(createRouteAdapterFromHistory(historyRef.current));
|
|
1262
|
+
useEffect(() => {
|
|
1263
|
+
const targetHistory = historyRef.current;
|
|
1264
|
+
if (!targetHistory) {
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
void targetHistory.start();
|
|
1268
|
+
return () => {
|
|
1269
|
+
targetHistory.stop();
|
|
1270
|
+
};
|
|
1271
|
+
}, []);
|
|
1272
|
+
return /* @__PURE__ */ jsx(RouteProvider, { adapter: adapterRef.current, children });
|
|
1273
|
+
};
|
|
1274
|
+
var NativeRoute = (props) => {
|
|
1275
|
+
const routeContext = useRouteContext();
|
|
1276
|
+
const hasAdapter = useMemo(
|
|
1277
|
+
() => typeof routeContext.adapter !== "undefined",
|
|
1278
|
+
[routeContext.adapter]
|
|
1279
|
+
);
|
|
1280
|
+
if (hasAdapter) {
|
|
1281
|
+
return /* @__PURE__ */ jsx(Route, { ...props });
|
|
1282
|
+
}
|
|
1283
|
+
return /* @__PURE__ */ jsx(NativeRouteProvider, { children: /* @__PURE__ */ jsx(Route, { ...props }) });
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
// src/native/utils/Route.ts
|
|
1287
|
+
var createNavigationStateRouteAdapter = (options) => {
|
|
1288
|
+
const getPath = () => options.toPath(options.getState());
|
|
1289
|
+
return {
|
|
1290
|
+
getPath,
|
|
1291
|
+
subscribe: (listener) => options.subscribe(() => {
|
|
1292
|
+
listener(getPath());
|
|
1293
|
+
}),
|
|
1294
|
+
push: options.navigate ? (path) => options.navigate?.(path) : void 0,
|
|
1295
|
+
replace: options.replace ? (path) => options.replace?.(path) : void 0
|
|
1296
|
+
};
|
|
1297
|
+
};
|
|
1298
|
+
var expandPattern = (pattern, params = {}) => {
|
|
1299
|
+
const segments = getPathArray(pattern, "/", true, true, false, false);
|
|
1300
|
+
return segments.map((segment) => {
|
|
1301
|
+
if (segment.startsWith(":")) {
|
|
1302
|
+
const key = segment.slice(1);
|
|
1303
|
+
if (!(key in params)) {
|
|
1304
|
+
throw new Error(`Missing param "${key}" for route pattern "${pattern}".`);
|
|
1305
|
+
}
|
|
1306
|
+
return params[key];
|
|
1307
|
+
}
|
|
1308
|
+
return segment;
|
|
1309
|
+
});
|
|
1310
|
+
};
|
|
1311
|
+
var buildPathFromRouteChain = (routeChain, config, query) => {
|
|
1312
|
+
const segments = [];
|
|
1313
|
+
routeChain.forEach((route) => {
|
|
1314
|
+
const pattern = config[route.name];
|
|
1315
|
+
if (!pattern) {
|
|
1316
|
+
throw new Error(`Missing route pattern for "${route.name}".`);
|
|
1317
|
+
}
|
|
1318
|
+
segments.push(...expandPattern(pattern, route.params));
|
|
1319
|
+
});
|
|
1320
|
+
return buildRoutePath(segments, query);
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
export { ArrayContainer, ArrayItemWrapper, Button, ErrorMessage, FieldWrapper, NativeEasyLayoutView, NativeRoute, NativeRouteProvider, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildPathFromRouteChain, buildQueryString, buildRoutePath, createManualRouteAdapter, createMemoryHistory, createNativeBackHandler, createNativeFormRenderer, createNativeHistory, createNavigationStateRouteAdapter, makeNativeEasyLayout, mapNativeURLToPath, nativeAutoField, nativeSuite, parseHistoryPath, useNativeEasyLayout, useRouteContext };
|