@webiny/app 0.0.0-unstable.79032b23a5 → 0.0.0-unstable.7be00a75a9
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/App.d.ts +14 -18
- package/App.js +79 -102
- package/App.js.map +1 -1
- package/AppContainer.d.ts +23 -0
- package/AppContainer.js +6 -0
- package/AppContainer.js.map +1 -0
- package/README.md +7 -15
- package/apollo-client/InMemoryCache.d.ts +3 -2
- package/apollo-client/InMemoryCache.js +17 -55
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
- package/apollo-client/IntrospectionFragmentMatcher.js +33 -0
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
- package/components/Image.d.ts +2 -3
- package/components/Image.js +16 -29
- package/components/Image.js.map +1 -1
- package/components/index.d.ts +1 -2
- package/components/index.js +1 -19
- package/config/RouterConfig/Route.d.ts +29 -0
- package/config/RouterConfig/Route.js +28 -0
- package/config/RouterConfig/Route.js.map +1 -0
- package/config/RouterConfig.d.ts +31 -0
- package/config/RouterConfig.js +19 -0
- package/config/RouterConfig.js.map +1 -0
- package/config.d.ts +1 -1
- package/config.js +21 -27
- package/config.js.map +1 -1
- package/contexts/Ui/index.d.ts +4 -4
- package/contexts/Ui/index.js +28 -57
- package/contexts/Ui/index.js.map +1 -1
- package/core/Plugin.d.ts +3 -3
- package/core/Plugin.js +11 -20
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.d.ts +6 -3
- package/core/Plugins.js +19 -43
- package/core/Plugins.js.map +1 -1
- package/core/Provider.d.ts +3 -4
- package/core/Provider.js +9 -20
- package/core/Provider.js.map +1 -1
- package/core/createProvider.d.ts +7 -3
- package/core/createProvider.js +5 -12
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.d.ts +2 -2
- package/core/createProviderPlugin.js +11 -20
- package/core/createProviderPlugin.js.map +1 -1
- package/errors/AuthenticationErrorEvent.d.ts +9 -0
- package/errors/AuthenticationErrorEvent.js +13 -0
- package/errors/AuthenticationErrorEvent.js.map +1 -0
- package/errors/NetworkErrorEvent.d.ts +15 -0
- package/errors/NetworkErrorEvent.js +13 -0
- package/errors/NetworkErrorEvent.js.map +1 -0
- package/errors/abstractions.d.ts +12 -0
- package/errors/abstractions.js +6 -0
- package/errors/abstractions.js.map +1 -0
- package/errors/index.d.ts +6 -0
- package/errors/index.js +3 -0
- package/exports/admin/env-config.d.ts +2 -0
- package/exports/admin/env-config.js +2 -0
- package/exports/admin/graphql-client.d.ts +1 -0
- package/exports/admin/graphql-client.js +1 -0
- package/exports/admin/local-storage.d.ts +2 -0
- package/exports/admin/local-storage.js +2 -0
- package/exports/admin/router.d.ts +5 -0
- package/exports/admin/router.js +5 -0
- package/exports/admin/security.d.ts +1 -0
- package/exports/admin/security.js +1 -0
- package/exports/admin.d.ts +7 -0
- package/exports/admin.js +7 -0
- package/features/envConfig/EnvConfig.d.ts +7 -0
- package/features/envConfig/EnvConfig.js +16 -0
- package/features/envConfig/EnvConfig.js.map +1 -0
- package/features/envConfig/abstractions.d.ts +28 -0
- package/features/envConfig/abstractions.js +5 -0
- package/features/envConfig/abstractions.js.map +1 -0
- package/features/envConfig/feature.d.ts +17 -0
- package/features/envConfig/feature.js +15 -0
- package/features/envConfig/feature.js.map +1 -0
- package/features/envConfig/index.d.ts +1 -0
- package/features/envConfig/index.js +1 -0
- package/features/eventPublisher/EventPublisher.d.ts +8 -0
- package/features/eventPublisher/EventPublisher.js +19 -0
- package/features/eventPublisher/EventPublisher.js.map +1 -0
- package/features/eventPublisher/abstractions.d.ts +18 -0
- package/features/eventPublisher/abstractions.js +12 -0
- package/features/eventPublisher/abstractions.js.map +1 -0
- package/features/eventPublisher/feature.d.ts +3 -0
- package/features/eventPublisher/feature.js +17 -0
- package/features/eventPublisher/feature.js.map +1 -0
- package/features/eventPublisher/index.d.ts +3 -0
- package/features/eventPublisher/index.js +2 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
- package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
- package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
- package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
- package/features/graphqlClient/FetchGraphQLClient.js +51 -0
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
- package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
- package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
- package/features/graphqlClient/RequestValue.d.ts +21 -0
- package/features/graphqlClient/RequestValue.js +46 -0
- package/features/graphqlClient/RequestValue.js.map +1 -0
- package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
- package/features/graphqlClient/RetryGraphQLClient.js +45 -0
- package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js +397 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
- package/features/graphqlClient/abstractions.d.ts +18 -0
- package/features/graphqlClient/abstractions.js +5 -0
- package/features/graphqlClient/abstractions.js.map +1 -0
- package/features/graphqlClient/feature.d.ts +6 -0
- package/features/graphqlClient/feature.js +25 -0
- package/features/graphqlClient/feature.js.map +1 -0
- package/features/graphqlClient/index.d.ts +1 -0
- package/features/graphqlClient/index.js +1 -0
- package/features/graphqlClient/types.d.ts +5 -0
- package/features/graphqlClient/types.js +0 -0
- package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
- package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
- package/features/localStorage/LocalStorage.d.ts +12 -0
- package/features/localStorage/LocalStorage.js +34 -0
- package/features/localStorage/LocalStorage.js.map +1 -0
- package/features/localStorage/LocalStorageRepository.d.ts +20 -0
- package/features/localStorage/LocalStorageRepository.js +82 -0
- package/features/localStorage/LocalStorageRepository.js.map +1 -0
- package/features/localStorage/abstractions.d.ts +48 -0
- package/features/localStorage/abstractions.js +8 -0
- package/features/localStorage/abstractions.js.map +1 -0
- package/features/localStorage/feature.d.ts +12 -0
- package/features/localStorage/feature.js +23 -0
- package/features/localStorage/feature.js.map +1 -0
- package/features/localStorage/index.d.ts +1 -0
- package/features/localStorage/index.js +1 -0
- package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
- package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
- package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
- package/features/mainGraphQLClient/abstractions.d.ts +17 -0
- package/features/mainGraphQLClient/abstractions.js +5 -0
- package/features/mainGraphQLClient/abstractions.js.map +1 -0
- package/features/mainGraphQLClient/feature.d.ts +3 -0
- package/features/mainGraphQLClient/feature.js +17 -0
- package/features/mainGraphQLClient/feature.js.map +1 -0
- package/features/mainGraphQLClient/index.d.ts +1 -0
- package/features/mainGraphQLClient/index.js +1 -0
- package/features/router/HistoryRouterGateway.d.ts +22 -0
- package/features/router/HistoryRouterGateway.js +88 -0
- package/features/router/HistoryRouterGateway.js.map +1 -0
- package/features/router/HistoryRouterGateway.test.d.ts +1 -0
- package/features/router/HistoryRouterGateway.test.js +195 -0
- package/features/router/HistoryRouterGateway.test.js.map +1 -0
- package/features/router/Route.d.ts +19 -0
- package/features/router/Route.js +43 -0
- package/features/router/Route.js.map +1 -0
- package/features/router/RouteUrl.d.ts +85 -0
- package/features/router/RouteUrl.js +99 -0
- package/features/router/RouteUrl.js.map +1 -0
- package/features/router/Router.d.ts +45 -0
- package/features/router/Router.js +72 -0
- package/features/router/Router.js.map +1 -0
- package/features/router/RouterPresenter.d.ts +21 -0
- package/features/router/RouterPresenter.js +52 -0
- package/features/router/RouterPresenter.js.map +1 -0
- package/features/router/RouterRepository.d.ts +30 -0
- package/features/router/RouterRepository.js +117 -0
- package/features/router/RouterRepository.js.map +1 -0
- package/features/router/RouterRepository.test.d.ts +1 -0
- package/features/router/RouterRepository.test.js +138 -0
- package/features/router/RouterRepository.test.js.map +1 -0
- package/features/router/abstractions.d.ts +81 -0
- package/features/router/abstractions.js +7 -0
- package/features/router/abstractions.js.map +1 -0
- package/features/router/feature.d.ts +4 -0
- package/features/router/feature.js +19 -0
- package/features/router/feature.js.map +1 -0
- package/features/router/index.d.ts +2 -0
- package/features/router/index.js +1 -0
- package/helpers/InterfaceGenerator/date.d.ts +15 -0
- package/helpers/InterfaceGenerator/date.js +0 -0
- package/helpers/InterfaceGenerator/id.d.ts +23 -0
- package/helpers/InterfaceGenerator/id.js +0 -0
- package/helpers/InterfaceGenerator/identity.d.ts +10 -0
- package/helpers/InterfaceGenerator/identity.js +0 -0
- package/helpers/InterfaceGenerator/index.d.ts +5 -0
- package/helpers/InterfaceGenerator/index.js +0 -0
- package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
- package/helpers/InterfaceGenerator/numeric.js +0 -0
- package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
- package/helpers/InterfaceGenerator/truthful.js +0 -0
- package/hooks/useAutocomplete/index.d.ts +1 -1
- package/hooks/useAutocomplete/index.js +1 -12
- package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +16 -28
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +4 -11
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +4 -11
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +4 -11
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.d.ts +3 -3
- package/hooks/useDataList/functions/index.js +3 -27
- package/hooks/useDataList/functions/searchDataByKey.js +11 -21
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.d.ts +1 -1
- package/hooks/useDataList/index.js +1 -12
- package/hooks/useDataList/useDataList.d.ts +2 -3
- package/hooks/useDataList/useDataList.js +140 -180
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.d.ts +1 -2
- package/hooks/useDataList/utils/index.js +1 -20
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
- package/hooks/useDataList/utils/prepareLoadListParams.js +27 -36
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useHandler.js +14 -17
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.d.ts +3 -3
- package/hooks/useHandlers.js +20 -26
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
- package/hooks/useRegisterLegacyPlugin.js +12 -0
- package/hooks/useRegisterLegacyPlugin.js.map +1 -0
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +5 -11
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +10 -13
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +1 -13
- package/index.d.ts +23 -13
- package/index.js +23 -147
- package/package.json +38 -41
- package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
- package/plugins/AddQuerySelectionPlugin.js +41 -116
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +16 -37
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.d.ts +3 -2
- package/plugins/ApolloDynamicLink.js +25 -56
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.d.ts +1 -1
- package/plugins/ApolloLinkPlugin.js +22 -45
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.d.ts +1 -1
- package/plugins/ConsoleLinkPlugin.js +21 -45
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +48 -76
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +27 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +23 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -7
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -17
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js +13 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +14 -30
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
- package/plugins/NetworkErrorLinkPlugin.js +52 -47
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +13 -38
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
- package/plugins/TenantHeaderLinkPlugin.js +27 -59
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/components/Image.d.ts +6 -0
- package/plugins/components/Image.js +12 -0
- package/plugins/components/Image.js.map +1 -0
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +97 -142
- package/plugins/image.js.map +1 -1
- package/plugins/index.d.ts +5 -5
- package/plugins/index.js +39 -86
- package/plugins/index.js.map +1 -1
- package/presentation/envConfig/useEnvConfig.d.ts +6 -0
- package/presentation/envConfig/useEnvConfig.js +9 -0
- package/presentation/envConfig/useEnvConfig.js.map +1 -0
- package/presentation/localStorage/index.d.ts +3 -0
- package/presentation/localStorage/index.js +3 -0
- package/presentation/localStorage/useLocalStorage.d.ts +6 -0
- package/presentation/localStorage/useLocalStorage.js +15 -0
- package/presentation/localStorage/useLocalStorage.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
- package/presentation/localStorage/useLocalStorageValue.js +22 -0
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
- package/presentation/localStorage/useLocalStorageValues.js +32 -0
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
- package/presentation/router/RouteElementRegistry.d.ts +14 -0
- package/presentation/router/RouteElementRegistry.js +29 -0
- package/presentation/router/RouteElementRegistry.js.map +1 -0
- package/presentation/router/abstractions.d.ts +13 -0
- package/presentation/router/abstractions.js +5 -0
- package/presentation/router/abstractions.js.map +1 -0
- package/presentation/router/components/Redirect.d.ts +14 -0
- package/presentation/router/components/Redirect.js +13 -0
- package/presentation/router/components/Redirect.js.map +1 -0
- package/presentation/router/components/RouteContent.d.ts +2 -0
- package/presentation/router/components/RouteContent.js +20 -0
- package/presentation/router/components/RouteContent.js.map +1 -0
- package/presentation/router/components/RouteLink.d.ts +50 -0
- package/presentation/router/components/RouteLink.js +17 -0
- package/presentation/router/components/RouteLink.js.map +1 -0
- package/presentation/router/components/SimpleLink.d.ts +44 -0
- package/presentation/router/components/SimpleLink.js +24 -0
- package/presentation/router/components/SimpleLink.js.map +1 -0
- package/presentation/router/hooks/useRoute.d.ts +6 -0
- package/presentation/router/hooks/useRoute.js +22 -0
- package/presentation/router/hooks/useRoute.js.map +1 -0
- package/presentation/router/hooks/useRouter.d.ts +11 -0
- package/presentation/router/hooks/useRouter.js +29 -0
- package/presentation/router/hooks/useRouter.js.map +1 -0
- package/presentation/router/index.d.ts +4 -0
- package/presentation/router/index.js +3 -0
- package/presentation/router/types.d.ts +5 -0
- package/presentation/router/types.js +0 -0
- package/renderApp.d.ts +2 -0
- package/renderApp.js +10 -0
- package/renderApp.js.map +1 -0
- package/router.d.ts +5 -0
- package/router.js +5 -0
- package/rslib-runtime.js +14 -0
- package/rslib-runtime.js.map +1 -0
- package/shared/di/DiContainerProvider.d.ts +8 -0
- package/shared/di/DiContainerProvider.js +13 -0
- package/shared/di/DiContainerProvider.js.map +1 -0
- package/shared/di/createFeature.d.ts +11 -0
- package/shared/di/createFeature.js +10 -0
- package/shared/di/createFeature.js.map +1 -0
- package/shared/di/useFeature.d.ts +2 -0
- package/shared/di/useFeature.js +12 -0
- package/shared/di/useFeature.js.map +1 -0
- package/static/svg/close_24px.33adaadc.svg +1 -0
- package/types.d.ts +16 -28
- package/types.js +0 -12
- package/utils/createGenericContext.d.ts +13 -0
- package/utils/createGenericContext.js +21 -0
- package/utils/createGenericContext.js.map +1 -0
- package/utils/createHashing.d.ts +2 -0
- package/utils/createHashing.js +15 -0
- package/utils/createHashing.js.map +1 -0
- package/utils/index.d.ts +2 -8
- package/utils/index.js +2 -93
- package/utils/legacyPluginToReactComponent.d.ts +7 -0
- package/utils/legacyPluginToReactComponent.js +15 -0
- package/utils/legacyPluginToReactComponent.js.map +1 -0
- package/components/Routes.d.ts +0 -2
- package/components/Routes.js +0 -45
- package/components/Routes.js.map +0 -1
- package/components/View.d.ts +0 -8
- package/components/View.js +0 -30
- package/components/View.js.map +0 -1
- package/components/index.js.map +0 -1
- package/core/AddRoute.d.ts +0 -3
- package/core/AddRoute.js +0 -19
- package/core/AddRoute.js.map +0 -1
- package/core/DebounceRender.d.ts +0 -11
- package/core/DebounceRender.js +0 -41
- package/core/DebounceRender.js.map +0 -1
- package/core/Routes.d.ts +0 -6
- package/core/Routes.js +0 -42
- package/core/Routes.js.map +0 -1
- package/hooks/useAutocomplete/index.js.map +0 -1
- package/hooks/useDataList/functions/index.js.map +0 -1
- package/hooks/useDataList/index.js.map +0 -1
- package/hooks/useDataList/utils/index.js.map +0 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -29
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
- package/hooks/useDataList/utils/types.d.ts +0 -34
- package/hooks/useDataList/utils/types.js +0 -5
- package/hooks/useDataList/utils/types.js.map +0 -1
- package/i18n/index.js.map +0 -1
- package/index.js.map +0 -1
- package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
- package/plugins/LocaleHeaderLinkPlugin.js +0 -53
- package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
- package/plugins/RoutePlugin.d.ts +0 -12
- package/plugins/RoutePlugin.js +0 -38
- package/plugins/RoutePlugin.js.map +0 -1
- package/plugins/ViewPlugin.d.ts +0 -14
- package/plugins/ViewPlugin.js +0 -43
- package/plugins/ViewPlugin.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/getApiUrl.d.ts +0 -1
- package/utils/getApiUrl.js +0 -11
- package/utils/getApiUrl.js.map +0 -1
- package/utils/getGqlApiUrl.d.ts +0 -1
- package/utils/getGqlApiUrl.js +0 -11
- package/utils/getGqlApiUrl.js.map +0 -1
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
- package/utils/getHeadlessCmsGqlApiUrl.js +0 -17
- package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
- package/utils/getLocaleCode.d.ts +0 -6
- package/utils/getLocaleCode.js +0 -42
- package/utils/getLocaleCode.js.map +0 -1
- package/utils/getPrerenderId.d.ts +0 -6
- package/utils/getPrerenderId.js +0 -10
- package/utils/getPrerenderId.js.map +0 -1
- package/utils/getTenantId.d.ts +0 -6
- package/utils/getTenantId.js +0 -34
- package/utils/getTenantId.js.map +0 -1
- package/utils/index.js.map +0 -1
- package/utils/isLocalhost.d.ts +0 -1
- package/utils/isLocalhost.js +0 -14
- package/utils/isLocalhost.js.map +0 -1
- package/utils/isPrerendering.d.ts +0 -1
- package/utils/isPrerendering.js +0 -10
- package/utils/isPrerendering.js.map +0 -1
package/plugins/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/image.js","sources":["../../src/plugins/image.tsx"],"sourcesContent":["import React from \"react\";\nimport { Image } from \"./components/Image.js\";\nimport type { ImageComponentPlugin } from \"~/types.js\";\n\nconst SUPPORTED_IMAGE_RESIZE_WIDTHS = [128, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840];\n\n/**\n * Width of the image should not be just any random number. For optimization reasons,\n * we only allow the ones listed in SUPPORTED_IMAGE_RESIZE_WIDTHS list (Webiny Cloud supports only these).\n */\nconst getSupportedImageResizeWidth = (width: number) => {\n let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];\n let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;\n while (i >= 0) {\n if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n break;\n }\n\n if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {\n // Use next larger width. If there isn't any, use current.\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];\n if (!output) {\n output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];\n }\n break;\n }\n\n i--;\n }\n\n return output;\n};\n\ninterface SanitizeTransformArgsParams {\n width?: string;\n}\ninterface SanitizeTransformArgsResult {\n width?: number;\n}\n/**\n * Currently we only allow \"width\" as a transform option.\n * @param args\n */\nconst sanitizeTransformArgs = (args?: SanitizeTransformArgsParams): SanitizeTransformArgsResult => {\n const output: SanitizeTransformArgsResult = {};\n if (!args || args.width === undefined || args.width === null) {\n return output;\n }\n const width = parseInt(args.width);\n if (width > 0) {\n output.width = getSupportedImageResizeWidth(width);\n }\n\n return output;\n};\n\nconst getSizes = (width?: string | number): string | undefined => {\n if (typeof width !== \"string\") {\n return undefined;\n }\n // Check if width was set as percentage, with \"%\" in the value.\n if (width.endsWith(\"%\")) {\n return `${parseInt(width)}vw`;\n }\n // Check if width was set as viewport width, with \"vw\" in the value.\n if (width.endsWith(\"vw\")) {\n return `${parseInt(width)}vw`;\n }\n\n // Check if width was set as relative, with \"em\" in the value.\n if (width.endsWith(\"em\")) {\n return `${parseInt(width)}em`;\n }\n\n return undefined;\n};\n\nconst isFixedImageWidth = (width?: number | string) => {\n if (Number.isFinite(width)) {\n return true;\n }\n\n if (typeof width === \"string\" && width.endsWith(\"px\")) {\n return true;\n }\n return false;\n};\n\nconst getSrcSetAutoSizes = (max?: string | number) => {\n max = isFixedImageWidth(max) ? parseInt(\"\" + max) : 2500;\n const maxWidth = getSupportedImageResizeWidth(max);\n return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth: number) => {\n return supportedWidth <= maxWidth;\n });\n};\n\nconst convertTransformToQueryParams = (transform: Record<string, any>): string => {\n return Object.keys(transform)\n .map(key => `${key}=${transform[key]}`)\n .join(\"&\");\n};\n\nexport default () => {\n const imagePlugin: ImageComponentPlugin = {\n name: \"image-component\",\n type: \"image-component\",\n presets: {\n avatar: { width: 300 }\n },\n getImageSrc: (props?: Record<string, any>) => {\n if (!props) {\n return \"\";\n }\n\n const { src, transform } = props;\n if (!transform) {\n return src;\n }\n\n if (!src || src.startsWith(\"data:\") || src.endsWith(\"svg\")) {\n return src;\n }\n\n const sanitizedParams = sanitizeTransformArgs(transform);\n const params = convertTransformToQueryParams(sanitizedParams);\n return src + \"?\" + params;\n },\n render(props) {\n const { transform, srcSet: srcSetInitial, ...imageProps } = props;\n let srcSet: any = srcSetInitial;\n let sizes: string | undefined;\n const src = imageProps.src;\n if (srcSet && srcSet === \"auto\") {\n srcSet = {};\n\n // Check if image width was forced, and additionally if width was set as pixels, with \"px\" in the value.\n const forcedWidth = props.width || (props.style && props.style.width);\n const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);\n srcSetAutoWidths.forEach(width => {\n srcSet[width + \"w\"] = imagePlugin.getImageSrc({\n src,\n transform: { ...transform, width }\n });\n });\n sizes = getSizes(forcedWidth);\n }\n\n return <Image {...imageProps} srcSet={srcSet} src={src} sizes={sizes} />;\n }\n };\n\n return imagePlugin;\n};\n"],"names":["SUPPORTED_IMAGE_RESIZE_WIDTHS","getSupportedImageResizeWidth","width","output","i","sanitizeTransformArgs","args","undefined","parseInt","getSizes","isFixedImageWidth","Number","getSrcSetAutoSizes","max","maxWidth","supportedWidth","convertTransformToQueryParams","transform","Object","key","imagePlugin","props","src","sanitizedParams","params","srcSetInitial","imageProps","srcSet","sizes","forcedWidth","srcSetAutoWidths","Image"],"mappings":";;AAIA,MAAMA,gCAAgC;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAM;IAAM;IAAM;IAAM;CAAK;AAM7F,MAAMC,+BAA+B,CAACC;IAClC,IAAIC,SAASH,6BAA6B,CAAC,EAAE;IAC7C,IAAII,IAAIJ,8BAA8B,MAAM;IAC5C,MAAOI,KAAK,EAAG;QACX,IAAIF,UAAUF,6BAA6B,CAACI,EAAE,EAAE;YAC5CD,SAASH,6BAA6B,CAACI,EAAE;YACzC;QACJ;QAEA,IAAIF,QAAQF,6BAA6B,CAACI,EAAE,EAAE;YAE1CD,SAASH,6BAA6B,CAACI,IAAI,EAAE;YAC7C,IAAI,CAACD,QACDA,SAASH,6BAA6B,CAACI,EAAE;YAE7C;QACJ;QAEAA;IACJ;IAEA,OAAOD;AACX;AAYA,MAAME,wBAAwB,CAACC;IAC3B,MAAMH,SAAsC,CAAC;IAC7C,IAAI,CAACG,QAAQA,AAAeC,WAAfD,KAAK,KAAK,IAAkBA,AAAe,SAAfA,KAAK,KAAK,EAC/C,OAAOH;IAEX,MAAMD,QAAQM,SAASF,KAAK,KAAK;IACjC,IAAIJ,QAAQ,GACRC,OAAO,KAAK,GAAGF,6BAA6BC;IAGhD,OAAOC;AACX;AAEA,MAAMM,WAAW,CAACP;IACd,IAAI,AAAiB,YAAjB,OAAOA,OACP;IAGJ,IAAIA,MAAM,QAAQ,CAAC,MACf,OAAO,GAAGM,SAASN,OAAO,EAAE,CAAC;IAGjC,IAAIA,MAAM,QAAQ,CAAC,OACf,OAAO,GAAGM,SAASN,OAAO,EAAE,CAAC;IAIjC,IAAIA,MAAM,QAAQ,CAAC,OACf,OAAO,GAAGM,SAASN,OAAO,EAAE,CAAC;AAIrC;AAEA,MAAMQ,oBAAoB,CAACR;IACvB,IAAIS,OAAO,QAAQ,CAACT,QAChB,OAAO;IAGX,IAAI,AAAiB,YAAjB,OAAOA,SAAsBA,MAAM,QAAQ,CAAC,OAC5C,OAAO;IAEX,OAAO;AACX;AAEA,MAAMU,qBAAqB,CAACC;IACxBA,MAAMH,kBAAkBG,OAAOL,SAAS,KAAKK,OAAO;IACpD,MAAMC,WAAWb,6BAA6BY;IAC9C,OAAOb,8BAA8B,MAAM,CAAC,CAACe,iBAClCA,kBAAkBD;AAEjC;AAEA,MAAME,gCAAgC,CAACC,YAC5BC,OAAO,IAAI,CAACD,WACd,GAAG,CAACE,CAAAA,MAAO,GAAGA,IAAI,CAAC,EAAEF,SAAS,CAACE,IAAI,EAAE,EACrC,IAAI,CAAC;AAGd,sBAAgB;IACZ,MAAMC,cAAoC;QACtC,MAAM;QACN,MAAM;QACN,SAAS;YACL,QAAQ;gBAAE,OAAO;YAAI;QACzB;QACA,aAAa,CAACC;YACV,IAAI,CAACA,OACD,OAAO;YAGX,MAAM,EAAEC,GAAG,EAAEL,SAAS,EAAE,GAAGI;YAC3B,IAAI,CAACJ,WACD,OAAOK;YAGX,IAAI,CAACA,OAAOA,IAAI,UAAU,CAAC,YAAYA,IAAI,QAAQ,CAAC,QAChD,OAAOA;YAGX,MAAMC,kBAAkBlB,sBAAsBY;YAC9C,MAAMO,SAASR,8BAA8BO;YAC7C,OAAOD,MAAM,MAAME;QACvB;QACA,QAAOH,KAAK;YACR,MAAM,EAAEJ,SAAS,EAAE,QAAQQ,aAAa,EAAE,GAAGC,YAAY,GAAGL;YAC5D,IAAIM,SAAcF;YAClB,IAAIG;YACJ,MAAMN,MAAMI,WAAW,GAAG;YAC1B,IAAIC,UAAUA,AAAW,WAAXA,QAAmB;gBAC7BA,SAAS,CAAC;gBAGV,MAAME,cAAcR,MAAM,KAAK,IAAKA,MAAM,KAAK,IAAIA,MAAM,KAAK,CAAC,KAAK;gBACpE,MAAMS,mBAAmBlB,mBAAmBiB;gBAC5CC,iBAAiB,OAAO,CAAC5B,CAAAA;oBACrByB,MAAM,CAACzB,QAAQ,IAAI,GAAGkB,YAAY,WAAW,CAAC;wBAC1CE;wBACA,WAAW;4BAAE,GAAGL,SAAS;4BAAEf;wBAAM;oBACrC;gBACJ;gBACA0B,QAAQnB,SAASoB;YACrB;YAEA,OAAO,WAAP,GAAO,oBAACE,OAAKA;gBAAE,GAAGL,UAAU;gBAAE,QAAQC;gBAAQ,KAAKL;gBAAK,OAAOM;;QACnE;IACJ;IAEA,OAAOR;AACX"}
|
package/plugins/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { Plugin } from "@webiny/plugins/types";
|
|
3
|
-
import imagePlugin from "./image";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { Plugin } from "@webiny/plugins/types.js";
|
|
3
|
+
import imagePlugin from "./image.js";
|
|
4
4
|
export { imagePlugin };
|
|
5
|
-
|
|
5
|
+
type RenderPluginOptions<T> = {
|
|
6
6
|
wrapper?: boolean;
|
|
7
7
|
fn?: string;
|
|
8
8
|
filter?: (value: T, index: number, array: T[]) => boolean;
|
|
@@ -16,5 +16,5 @@ interface RenderPlugins {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const renderPlugin: RenderPlugin;
|
|
18
18
|
export declare const renderPlugins: RenderPlugins;
|
|
19
|
-
declare const _default: (() => import("../types").ImageComponentPlugin)[];
|
|
19
|
+
declare const _default: (() => import("../types.js").ImageComponentPlugin)[];
|
|
20
20
|
export default _default;
|
package/plugins/index.js
CHANGED
|
@@ -1,89 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return props.children;
|
|
21
|
-
};
|
|
22
|
-
var PluginsComponent = function PluginsComponent(props) {
|
|
23
|
-
return props.children;
|
|
24
|
-
};
|
|
25
|
-
var renderPlugin = function renderPlugin(name) {
|
|
26
|
-
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
28
|
-
var _options$wrapper = options.wrapper,
|
|
29
|
-
wrapper = _options$wrapper === void 0 ? true : _options$wrapper,
|
|
30
|
-
_options$fn = options.fn,
|
|
31
|
-
fn = _options$fn === void 0 ? "render" : _options$fn;
|
|
32
|
-
var plugin = _plugins.plugins.byName(name);
|
|
33
|
-
(0, _warning.default)(plugin, "No such plugin \"".concat(name, "\""));
|
|
34
|
-
if (!plugin) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
var content = plugin[fn](params);
|
|
38
|
-
if (content) {
|
|
39
|
-
return wrapper ? /*#__PURE__*/_react.default.createElement(PluginComponent, {
|
|
40
|
-
key: plugin.name,
|
|
41
|
-
name: name,
|
|
42
|
-
params: params,
|
|
43
|
-
fn: fn
|
|
44
|
-
}, content) : /*#__PURE__*/_react.default.cloneElement(content, {
|
|
45
|
-
key: plugin.name
|
|
1
|
+
import react from "react";
|
|
2
|
+
import warning from "warning";
|
|
3
|
+
import { plugins } from "@webiny/plugins";
|
|
4
|
+
import image_0 from "./image.js";
|
|
5
|
+
const PluginComponent = (props)=>props.children;
|
|
6
|
+
const PluginsComponent = (props)=>props.children;
|
|
7
|
+
const renderPlugin = (name, params = {}, options = {})=>{
|
|
8
|
+
const { wrapper = true, fn = "render" } = options;
|
|
9
|
+
const plugin = plugins.byName(name);
|
|
10
|
+
warning(plugin, `No such plugin "${name}"`);
|
|
11
|
+
if (!plugin) return null;
|
|
12
|
+
const content = plugin[fn](params);
|
|
13
|
+
if (content) return wrapper ? /*#__PURE__*/ react.createElement(PluginComponent, {
|
|
14
|
+
key: plugin.name,
|
|
15
|
+
name: name,
|
|
16
|
+
params: params,
|
|
17
|
+
fn: fn
|
|
18
|
+
}, content) : /*#__PURE__*/ react.cloneElement(content, {
|
|
19
|
+
key: plugin.name
|
|
46
20
|
});
|
|
47
|
-
|
|
48
|
-
return null;
|
|
21
|
+
return null;
|
|
49
22
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} :
|
|
62
|
-
reverse = options.reverse;
|
|
63
|
-
var content = _plugins.plugins.byType(type).filter(function (pl) {
|
|
64
|
-
/**
|
|
65
|
-
* TODO @ts-refactor Problem with possibility of a different subtype.
|
|
66
|
-
*/
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
return filter(pl);
|
|
69
|
-
})
|
|
70
|
-
/**
|
|
71
|
-
* We cast as string because renderPlugin checks for the plugin.name
|
|
72
|
-
*/.map(function (plugin) {
|
|
73
|
-
return renderPlugin(plugin.name, params, {
|
|
74
|
-
wrapper: wrapper,
|
|
75
|
-
fn: fn
|
|
76
|
-
});
|
|
77
|
-
}).filter(Boolean);
|
|
78
|
-
if (reverse) {
|
|
79
|
-
content.reverse();
|
|
80
|
-
}
|
|
81
|
-
return wrapper ? /*#__PURE__*/_react.default.createElement(PluginsComponent, {
|
|
82
|
-
type: type,
|
|
83
|
-
params: params,
|
|
84
|
-
fn: fn
|
|
85
|
-
}, content) : content;
|
|
23
|
+
const renderPlugins = (type, params = {}, options = {})=>{
|
|
24
|
+
const { wrapper = true, fn = "render", filter = (v)=>v, reverse } = options;
|
|
25
|
+
const content = plugins.byType(type).filter((pl)=>filter(pl)).map((plugin)=>renderPlugin(plugin.name, params, {
|
|
26
|
+
wrapper,
|
|
27
|
+
fn
|
|
28
|
+
})).filter(Boolean);
|
|
29
|
+
if (reverse) content.reverse();
|
|
30
|
+
return wrapper ? /*#__PURE__*/ react.createElement(PluginsComponent, {
|
|
31
|
+
type: type,
|
|
32
|
+
params: params,
|
|
33
|
+
fn: fn
|
|
34
|
+
}, content) : content;
|
|
86
35
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
36
|
+
const src_plugins = [
|
|
37
|
+
image_0
|
|
38
|
+
];
|
|
39
|
+
export default src_plugins;
|
|
40
|
+
export { image_0 as imagePlugin, renderPlugin, renderPlugins };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
package/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/index.js","sources":["../../src/plugins/index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\nimport warning from \"warning\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport imagePlugin from \"./image.js\";\n\nexport { imagePlugin };\n\ntype RenderPluginOptions<T> = {\n wrapper?: boolean;\n fn?: string;\n filter?: (value: T, index: number, array: T[]) => boolean;\n reverse?: boolean;\n};\n\ninterface RenderPlugin {\n <T extends Plugin = Plugin>(\n name: string,\n params?: any,\n options?: RenderPluginOptions<T>\n ): ReactNode | ReactNode[];\n}\n\ninterface RenderPlugins {\n <T extends Plugin = Plugin>(\n type: string,\n params?: any,\n options?: RenderPluginOptions<T>\n ): ReactNode | ReactNode[];\n}\n\ninterface PluginComponentProps {\n name: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginComponent = (props: PluginComponentProps) => {\n return props.children as React.ReactElement;\n};\ninterface PluginsComponentProps {\n type: string;\n params: Record<string, any>;\n fn: string;\n children: React.ReactNode;\n}\nconst PluginsComponent = (props: PluginsComponentProps) => {\n return props.children as React.ReactElement;\n};\n\nexport const renderPlugin: RenderPlugin = (name, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\" } = options;\n\n const plugin = plugins.byName(name);\n warning(plugin, `No such plugin \"${name}\"`);\n\n if (!plugin) {\n return null;\n }\n\n const content = plugin[fn](params);\n if (content) {\n return wrapper ? (\n <PluginComponent key={plugin.name} name={name} params={params} fn={fn}>\n {content}\n </PluginComponent>\n ) : (\n React.cloneElement(content, { key: plugin.name })\n );\n }\n return null;\n};\n\nexport const renderPlugins: RenderPlugins = (type, params = {}, options = {}) => {\n const { wrapper = true, fn = \"render\", filter = v => v, reverse } = options;\n\n const content = plugins\n .byType(type)\n .filter(pl => {\n /**\n * TODO @ts-refactor Problem with possibility of a different subtype.\n */\n // @ts-expect-error\n return filter(pl);\n })\n /**\n * We cast as string because renderPlugin checks for the plugin.name\n */\n .map(plugin => renderPlugin(plugin.name as string, params, { wrapper, fn }))\n .filter(Boolean);\n\n if (reverse) {\n content.reverse();\n }\n\n return wrapper ? (\n <PluginsComponent type={type} params={params} fn={fn}>\n {content}\n </PluginsComponent>\n ) : (\n content\n );\n};\n\nexport default [imagePlugin];\n"],"names":["PluginComponent","props","PluginsComponent","renderPlugin","name","params","options","wrapper","fn","plugin","plugins","warning","content","React","renderPlugins","type","filter","v","reverse","pl","Boolean","imagePlugin"],"mappings":";;;;AAsCA,MAAMA,kBAAkB,CAACC,QACdA,MAAM,QAAQ;AAQzB,MAAMC,mBAAmB,CAACD,QACfA,MAAM,QAAQ;AAGlB,MAAME,eAA6B,CAACC,MAAMC,SAAS,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACtE,MAAM,EAAEC,UAAU,IAAI,EAAEC,KAAK,QAAQ,EAAE,GAAGF;IAE1C,MAAMG,SAASC,QAAQ,MAAM,CAACN;IAC9BO,QAAQF,QAAQ,CAAC,gBAAgB,EAAEL,KAAK,CAAC,CAAC;IAE1C,IAAI,CAACK,QACD,OAAO;IAGX,MAAMG,UAAUH,MAAM,CAACD,GAAG,CAACH;IAC3B,IAAIO,SACA,OAAOL,UAAU,WAAVA,GACH,oBAACP,iBAAeA;QAAC,KAAKS,OAAO,IAAI;QAAE,MAAML;QAAM,QAAQC;QAAQ,IAAIG;OAC9DI,WAAAA,WAAAA,GAGLC,MAAAA,YAAkB,CAACD,SAAS;QAAE,KAAKH,OAAO,IAAI;IAAC;IAGvD,OAAO;AACX;AAEO,MAAMK,gBAA+B,CAACC,MAAMV,SAAS,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACxE,MAAM,EAAEC,UAAU,IAAI,EAAEC,KAAK,QAAQ,EAAEQ,SAASC,CAAAA,IAAKA,CAAC,EAAEC,OAAO,EAAE,GAAGZ;IAEpE,MAAMM,UAAUF,QAAAA,MACL,CAACK,MACP,MAAM,CAACI,CAAAA,KAKGH,OAAOG,KAKjB,GAAG,CAACV,CAAAA,SAAUN,aAAaM,OAAO,IAAI,EAAYJ,QAAQ;YAAEE;YAASC;QAAG,IACxE,MAAM,CAACY;IAEZ,IAAIF,SACAN,QAAQ,OAAO;IAGnB,OAAOL,UAAU,WAAVA,GACH,oBAACL,kBAAgBA;QAAC,MAAMa;QAAM,QAAQV;QAAQ,IAAIG;OAC7CI,WAGLA;AAER;AAEA,oBAAe;IAACS;CAAY"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useFeature } from "../../shared/di/useFeature.js";
|
|
2
|
+
import { EnvConfigFeature } from "../../features/envConfig/feature.js";
|
|
3
|
+
function useEnvConfig() {
|
|
4
|
+
const envConfig = useFeature(EnvConfigFeature);
|
|
5
|
+
return envConfig.getAll();
|
|
6
|
+
}
|
|
7
|
+
export { useEnvConfig };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=useEnvConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/envConfig/useEnvConfig.js","sources":["../../../src/presentation/envConfig/useEnvConfig.ts"],"sourcesContent":["import { useFeature } from \"~/shared/di/useFeature.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\nimport { EnvConfigFeature } from \"~/features/envConfig/feature.js\";\n\n/**\n * Returns the EnvConfig instance from DI.\n * Useful when you want to access EnvConfig inside components and hooks.\n */\nexport function useEnvConfig(): EnvConfig.Config {\n const envConfig = useFeature(EnvConfigFeature);\n\n return envConfig.getAll();\n}\n"],"names":["useEnvConfig","envConfig","useFeature","EnvConfigFeature"],"mappings":";;AAQO,SAASA;IACZ,MAAMC,YAAYC,WAAWC;IAE7B,OAAOF,UAAU,MAAM;AAC3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LocalStorage } from "../../features/localStorage/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the LocalStorage instance from DI.
|
|
4
|
+
* Useful when you want to call service methods imperatively inside components.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useLocalStorage(): LocalStorage.Interface;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LocalStorageFeature } from "../../features/localStorage/feature.js";
|
|
2
|
+
import { useFeature } from "../../shared/di/useFeature.js";
|
|
3
|
+
function useLocalStorage() {
|
|
4
|
+
const { localStorageService } = useFeature(LocalStorageFeature);
|
|
5
|
+
return {
|
|
6
|
+
get: localStorageService.get.bind(localStorageService),
|
|
7
|
+
set: localStorageService.set.bind(localStorageService),
|
|
8
|
+
remove: localStorageService.remove.bind(localStorageService),
|
|
9
|
+
clear: localStorageService.clear.bind(localStorageService),
|
|
10
|
+
keys: localStorageService.keys.bind(localStorageService)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { useLocalStorage };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/localStorage/useLocalStorage.js","sources":["../../../src/presentation/localStorage/useLocalStorage.ts"],"sourcesContent":["import { LocalStorageFeature } from \"~/features/localStorage/feature.js\";\nimport { LocalStorage } from \"~/features/localStorage/index.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\n/**\n * Returns the LocalStorage instance from DI.\n * Useful when you want to call service methods imperatively inside components.\n */\nexport function useLocalStorage(): LocalStorage.Interface {\n const { localStorageService } = useFeature(LocalStorageFeature);\n\n return {\n get: localStorageService.get.bind(localStorageService),\n set: localStorageService.set.bind(localStorageService),\n remove: localStorageService.remove.bind(localStorageService),\n clear: localStorageService.clear.bind(localStorageService),\n keys: localStorageService.keys.bind(localStorageService)\n };\n}\n"],"names":["useLocalStorage","localStorageService","useFeature","LocalStorageFeature"],"mappings":";;AAQO,SAASA;IACZ,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,WAAWC;IAE3C,OAAO;QACH,KAAKF,oBAAoB,GAAG,CAAC,IAAI,CAACA;QAClC,KAAKA,oBAAoB,GAAG,CAAC,IAAI,CAACA;QAClC,QAAQA,oBAAoB,MAAM,CAAC,IAAI,CAACA;QACxC,OAAOA,oBAAoB,KAAK,CAAC,IAAI,CAACA;QACtC,MAAMA,oBAAoB,IAAI,CAAC,IAAI,CAACA;IACxC;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLocalStorageValue<T = string>(key: string): T | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { autorun } from "mobx";
|
|
3
|
+
import { LocalStorageFeature } from "../../features/localStorage/feature.js";
|
|
4
|
+
import { useFeature } from "../../shared/di/useFeature.js";
|
|
5
|
+
function useLocalStorageValue(key) {
|
|
6
|
+
const { localStorageService } = useFeature(LocalStorageFeature);
|
|
7
|
+
const [value, setValue] = useState(()=>localStorageService.get(key));
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
const dispose = autorun(()=>{
|
|
10
|
+
const value = localStorageService.get(key);
|
|
11
|
+
setValue(value);
|
|
12
|
+
});
|
|
13
|
+
return ()=>dispose();
|
|
14
|
+
}, [
|
|
15
|
+
localStorageService,
|
|
16
|
+
key
|
|
17
|
+
]);
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
export { useLocalStorageValue };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=useLocalStorageValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/localStorage/useLocalStorageValue.js","sources":["../../../src/presentation/localStorage/useLocalStorageValue.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { autorun } from \"mobx\";\nimport { LocalStorageFeature } from \"~/features/localStorage/feature.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\nexport function useLocalStorageValue<T = string>(key: string): T | undefined {\n const { localStorageService } = useFeature(LocalStorageFeature);\n\n const [value, setValue] = useState<T | undefined>(() => localStorageService.get<T>(key));\n\n useEffect(() => {\n const dispose = autorun(() => {\n const value = localStorageService.get<T>(key);\n setValue(value);\n });\n return () => dispose();\n }, [localStorageService, key]);\n\n return value;\n}\n"],"names":["useLocalStorageValue","key","localStorageService","useFeature","LocalStorageFeature","value","setValue","useState","useEffect","dispose","autorun"],"mappings":";;;;AAKO,SAASA,qBAAiCC,GAAW;IACxD,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,WAAWC;IAE3C,MAAM,CAACC,OAAOC,SAAS,GAAGC,SAAwB,IAAML,oBAAoB,GAAG,CAAID;IAEnFO,UAAU;QACN,MAAMC,UAAUC,QAAQ;YACpB,MAAML,QAAQH,oBAAoB,GAAG,CAAID;YACzCK,SAASD;QACb;QACA,OAAO,IAAMI;IACjB,GAAG;QAACP;QAAqBD;KAAI;IAE7B,OAAOI;AACX"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { autorun } from "mobx";
|
|
3
|
+
import isEqual from "lodash/isEqual.js";
|
|
4
|
+
import { LocalStorageFeature } from "../../features/localStorage/feature.js";
|
|
5
|
+
import { useFeature } from "../../shared/di/useFeature.js";
|
|
6
|
+
function useLocalStorageValues(keys) {
|
|
7
|
+
const { localStorageService } = useFeature(LocalStorageFeature);
|
|
8
|
+
const [values, setValues] = useState(()=>{
|
|
9
|
+
const initial = {};
|
|
10
|
+
for (const key of keys)initial[key] = localStorageService.get(key);
|
|
11
|
+
return initial;
|
|
12
|
+
});
|
|
13
|
+
const valuesRef = useRef(values);
|
|
14
|
+
useEffect(()=>{
|
|
15
|
+
const dispose = autorun(()=>{
|
|
16
|
+
const snapshot = {};
|
|
17
|
+
for (const key of keys)snapshot[key] = localStorageService.get(key);
|
|
18
|
+
if (!isEqual(snapshot, valuesRef.current)) {
|
|
19
|
+
setValues(snapshot);
|
|
20
|
+
valuesRef.current = snapshot;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return ()=>dispose();
|
|
24
|
+
}, [
|
|
25
|
+
localStorageService,
|
|
26
|
+
keys.join(",")
|
|
27
|
+
]);
|
|
28
|
+
return values;
|
|
29
|
+
}
|
|
30
|
+
export { useLocalStorageValues };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=useLocalStorageValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/localStorage/useLocalStorageValues.js","sources":["../../../src/presentation/localStorage/useLocalStorageValues.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { autorun } from \"mobx\";\nimport isEqual from \"lodash/isEqual.js\";\nimport { LocalStorageFeature } from \"~/features/localStorage/feature.js\";\nimport { useFeature } from \"~/shared/di/useFeature.js\";\n\n/**\n * Observes multiple keys in LocalStorage and returns an object of { key: value }.\n * Re-renders when any of the observed keys change.\n */\nexport function useLocalStorageValues<T extends Record<string, any>>(\n keys: (keyof T & string)[]\n): Partial<T> {\n const { localStorageService } = useFeature(LocalStorageFeature);\n\n const [values, setValues] = useState<Partial<T>>(() => {\n const initial: Partial<T> = {};\n for (const key of keys) {\n initial[key] = localStorageService.get<any>(key);\n }\n return initial;\n });\n\n const valuesRef = useRef(values);\n\n useEffect(() => {\n const dispose = autorun(() => {\n const snapshot: Partial<T> = {};\n for (const key of keys) {\n snapshot[key] = localStorageService.get<any>(key);\n }\n\n if (!isEqual(snapshot, valuesRef.current)) {\n setValues(snapshot);\n valuesRef.current = snapshot;\n }\n });\n return () => dispose();\n }, [localStorageService, keys.join(\",\")]);\n\n return values;\n}\n"],"names":["useLocalStorageValues","keys","localStorageService","useFeature","LocalStorageFeature","values","setValues","useState","initial","key","valuesRef","useRef","useEffect","dispose","autorun","snapshot","isEqual"],"mappings":";;;;;AAUO,SAASA,sBACZC,IAA0B;IAE1B,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,WAAWC;IAE3C,MAAM,CAACC,QAAQC,UAAU,GAAGC,SAAqB;QAC7C,MAAMC,UAAsB,CAAC;QAC7B,KAAK,MAAMC,OAAOR,KACdO,OAAO,CAACC,IAAI,GAAGP,oBAAoB,GAAG,CAAMO;QAEhD,OAAOD;IACX;IAEA,MAAME,YAAYC,OAAON;IAEzBO,UAAU;QACN,MAAMC,UAAUC,QAAQ;YACpB,MAAMC,WAAuB,CAAC;YAC9B,KAAK,MAAMN,OAAOR,KACdc,QAAQ,CAACN,IAAI,GAAGP,oBAAoB,GAAG,CAAMO;YAGjD,IAAI,CAACO,QAAQD,UAAUL,UAAU,OAAO,GAAG;gBACvCJ,UAAUS;gBACVL,UAAU,OAAO,GAAGK;YACxB;QACJ;QACA,OAAO,IAAMF;IACjB,GAAG;QAACX;QAAqBD,KAAK,IAAI,CAAC;KAAK;IAExC,OAAOI;AACX"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare class RouteElementRegistryImplementation {
|
|
3
|
+
private readonly elements;
|
|
4
|
+
/** Register a React element for a given route. */
|
|
5
|
+
register(routeName: string, element: React.ReactNode): void;
|
|
6
|
+
/** Get the element for a matched route by name. */
|
|
7
|
+
getElement(routeName: string): React.ReactNode | null;
|
|
8
|
+
/** Clear all registered elements. Useful in tests or hot reloads. */
|
|
9
|
+
clear(): void;
|
|
10
|
+
/** List all registered route names. */
|
|
11
|
+
list(): string[];
|
|
12
|
+
}
|
|
13
|
+
export declare const DefaultRouteElementRegistry: import("@webiny/di").Implementation<typeof RouteElementRegistryImplementation>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { RouteElementRegistry } from "./abstractions.js";
|
|
3
|
+
class RouteElementRegistryImplementation {
|
|
4
|
+
register(routeName, element) {
|
|
5
|
+
this.elements.set(routeName, element);
|
|
6
|
+
}
|
|
7
|
+
getElement(routeName) {
|
|
8
|
+
return this.elements.get(routeName) ?? null;
|
|
9
|
+
}
|
|
10
|
+
clear() {
|
|
11
|
+
this.elements.clear();
|
|
12
|
+
}
|
|
13
|
+
list() {
|
|
14
|
+
return [
|
|
15
|
+
...this.elements.keys()
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
constructor(){
|
|
19
|
+
this.elements = new Map();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const DefaultRouteElementRegistry = createImplementation({
|
|
23
|
+
implementation: RouteElementRegistryImplementation,
|
|
24
|
+
abstraction: RouteElementRegistry,
|
|
25
|
+
dependencies: []
|
|
26
|
+
});
|
|
27
|
+
export { DefaultRouteElementRegistry };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=RouteElementRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/router/RouteElementRegistry.js","sources":["../../../src/presentation/router/RouteElementRegistry.ts"],"sourcesContent":["import React from \"react\";\nimport { createImplementation } from \"@webiny/di\";\nimport { RouteElementRegistry } from \"./abstractions.js\";\n\nclass RouteElementRegistryImplementation {\n private readonly elements = new Map<string, React.ReactNode>();\n\n /** Register a React element for a given route. */\n register(routeName: string, element: React.ReactNode): void {\n this.elements.set(routeName, element);\n }\n\n /** Get the element for a matched route by name. */\n getElement(routeName: string): React.ReactNode | null {\n return this.elements.get(routeName) ?? null;\n }\n\n /** Clear all registered elements. Useful in tests or hot reloads. */\n clear(): void {\n this.elements.clear();\n }\n\n /** List all registered route names. */\n list(): string[] {\n return [...this.elements.keys()];\n }\n}\n\nexport const DefaultRouteElementRegistry = createImplementation({\n implementation: RouteElementRegistryImplementation,\n abstraction: RouteElementRegistry,\n dependencies: []\n});\n"],"names":["RouteElementRegistryImplementation","routeName","element","Map","DefaultRouteElementRegistry","createImplementation","RouteElementRegistry"],"mappings":";;AAIA,MAAMA;IAIF,SAASC,SAAiB,EAAEC,OAAwB,EAAQ;QACxD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACD,WAAWC;IACjC;IAGA,WAAWD,SAAiB,EAA0B;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,cAAc;IAC3C;IAGA,QAAc;QACV,IAAI,CAAC,QAAQ,CAAC,KAAK;IACvB;IAGA,OAAiB;QACb,OAAO;eAAI,IAAI,CAAC,QAAQ,CAAC,IAAI;SAAG;IACpC;;aApBiB,QAAQ,GAAG,IAAIE;;AAqBpC;AAEO,MAAMC,8BAA8BC,qBAAqB;IAC5D,gBAAgBL;IAChB,aAAaM;IACb,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Abstraction } from "@webiny/di";
|
|
3
|
+
interface IRouteElementRegistry {
|
|
4
|
+
register(name: string, element: React.ReactElement): void;
|
|
5
|
+
getElement(routeName: string): React.ReactNode | null;
|
|
6
|
+
clear(): void;
|
|
7
|
+
list(): string[];
|
|
8
|
+
}
|
|
9
|
+
export declare const RouteElementRegistry: Abstraction<IRouteElementRegistry>;
|
|
10
|
+
export declare namespace RouteElementRegistry {
|
|
11
|
+
type Interface = IRouteElementRegistry;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/router/abstractions.js","sources":["../../../src/presentation/router/abstractions.ts"],"sourcesContent":["import React from \"react\";\nimport { Abstraction } from \"@webiny/di\";\n\ninterface IRouteElementRegistry {\n register(name: string, element: React.ReactElement): void;\n getElement(routeName: string): React.ReactNode | null;\n clear(): void;\n list(): string[];\n}\n\nexport const RouteElementRegistry = new Abstraction<IRouteElementRegistry>(\"RouteElementRegistry\");\n\nexport namespace RouteElementRegistry {\n export type Interface = IRouteElementRegistry;\n}\n"],"names":["RouteElementRegistry","Abstraction"],"mappings":";AAUO,MAAMA,uBAAuB,IAAIC,YAAmC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Route, RouteParamsDefinition, RouteParamsInfer } from "../../../features/router/Route.js";
|
|
2
|
+
import type { RequiredKeysOf } from "type-fest";
|
|
3
|
+
export type RedirectProps<TParams extends RouteParamsDefinition | undefined> = [
|
|
4
|
+
TParams extends RouteParamsDefinition ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never ? {
|
|
5
|
+
route: Route<TParams>;
|
|
6
|
+
params?: RouteParamsInfer<TParams>;
|
|
7
|
+
} : {
|
|
8
|
+
route: Route<TParams>;
|
|
9
|
+
params: RouteParamsInfer<TParams>;
|
|
10
|
+
} : {
|
|
11
|
+
route: Route<TParams>;
|
|
12
|
+
}
|
|
13
|
+
][0];
|
|
14
|
+
export declare const RedirectComponent: <TParams extends RouteParamsDefinition | undefined>(props: RedirectProps<TParams>) => null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useRouter } from "../../../router.js";
|
|
3
|
+
const RedirectComponent = (props)=>{
|
|
4
|
+
const router = useRouter();
|
|
5
|
+
const { route, ...rest } = props;
|
|
6
|
+
useEffect(()=>{
|
|
7
|
+
router.goToRoute(route, rest.params);
|
|
8
|
+
}, []);
|
|
9
|
+
return null;
|
|
10
|
+
};
|
|
11
|
+
export { RedirectComponent };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=Redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/router/components/Redirect.js","sources":["../../../../src/presentation/router/components/Redirect.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"~/features/router/Route.js\";\nimport { useRouter } from \"~/router.js\";\nimport type { RequiredKeysOf } from \"type-fest\";\n\nexport type RedirectProps<TParams extends RouteParamsDefinition | undefined> = [\n TParams extends RouteParamsDefinition\n ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never\n ? { route: Route<TParams>; params?: RouteParamsInfer<TParams> }\n : { route: Route<TParams>; params: RouteParamsInfer<TParams> }\n : { route: Route<TParams> }\n][0];\n\nexport const RedirectComponent = <TParams extends RouteParamsDefinition | undefined>(\n props: RedirectProps<TParams>\n) => {\n const router = useRouter();\n const { route, ...rest } = props as any;\n\n useEffect(() => {\n router.goToRoute(route, rest.params);\n }, []);\n\n return null;\n};\n"],"names":["RedirectComponent","props","router","useRouter","route","rest","useEffect"],"mappings":";;AAaO,MAAMA,oBAAoB,CAC7BC;IAEA,MAAMC,SAASC;IACf,MAAM,EAAEC,KAAK,EAAE,GAAGC,MAAM,GAAGJ;IAE3BK,UAAU;QACNJ,OAAO,SAAS,CAACE,OAAOC,KAAK,MAAM;IACvC,GAAG,EAAE;IAEL,OAAO;AACX"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { DevToolsSection } from "@webiny/react-properties";
|
|
3
|
+
import { RouteElementRegistry, useRoute } from "../index.js";
|
|
4
|
+
import { useContainer } from "../../../shared/di/DiContainerProvider.js";
|
|
5
|
+
const RouteContent = ()=>{
|
|
6
|
+
const { route } = useRoute();
|
|
7
|
+
const container = useContainer();
|
|
8
|
+
const elementRegistry = container.resolve(RouteElementRegistry);
|
|
9
|
+
if (!route) return null;
|
|
10
|
+
const element = elementRegistry.getElement(route.name);
|
|
11
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(DevToolsSection, {
|
|
12
|
+
name: "Current Route",
|
|
13
|
+
group: "Router",
|
|
14
|
+
data: route,
|
|
15
|
+
views: "raw"
|
|
16
|
+
}), element ?? null);
|
|
17
|
+
};
|
|
18
|
+
export { RouteContent };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=RouteContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/router/components/RouteContent.js","sources":["../../../../src/presentation/router/components/RouteContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { DevToolsSection } from \"@webiny/react-properties\";\nimport { RouteElementRegistry, useRoute } from \"~/presentation/router/index.js\";\nimport { useContainer } from \"~/shared/di/DiContainerProvider.js\";\n\nexport const RouteContent = () => {\n const { route } = useRoute();\n const container = useContainer();\n const elementRegistry = container.resolve(RouteElementRegistry);\n\n if (!route) {\n return null;\n }\n\n const element = elementRegistry.getElement(route.name);\n\n return (\n <>\n <DevToolsSection name={\"Current Route\"} group={\"Router\"} data={route} views={\"raw\"} />\n {element ?? null}\n </>\n );\n};\n"],"names":["RouteContent","route","useRoute","container","useContainer","elementRegistry","RouteElementRegistry","element","DevToolsSection"],"mappings":";;;;AAKO,MAAMA,eAAe;IACxB,MAAM,EAAEC,KAAK,EAAE,GAAGC;IAClB,MAAMC,YAAYC;IAClB,MAAMC,kBAAkBF,UAAU,OAAO,CAACG;IAE1C,IAAI,CAACL,OACD,OAAO;IAGX,MAAMM,UAAUF,gBAAgB,UAAU,CAACJ,MAAM,IAAI;IAErD,OAAO,WAAP,GACI,wDACI,oBAACO,iBAAeA;QAAC,MAAM;QAAiB,OAAO;QAAU,MAAMP;QAAO,OAAO;QAC5EM,WAAW;AAGxB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Route, RouteParamsDefinition, RouteParamsInfer } from "../../../features/router/Route.js";
|
|
3
|
+
type BaseAnchorAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href">;
|
|
4
|
+
export type RouteLinkProps<TParams extends RouteParamsDefinition | undefined> = [
|
|
5
|
+
TParams extends RouteParamsDefinition ? {
|
|
6
|
+
route: Route<TParams>;
|
|
7
|
+
params: RouteParamsInfer<TParams>;
|
|
8
|
+
} : {
|
|
9
|
+
route: Route<TParams>;
|
|
10
|
+
}
|
|
11
|
+
][0] & BaseAnchorAttributes;
|
|
12
|
+
export declare const RouteLink: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
|
|
13
|
+
original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
|
|
14
|
+
originalName: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
} & {
|
|
17
|
+
original: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
|
|
18
|
+
original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
|
|
19
|
+
originalName: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
originalName: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
} & {
|
|
25
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
|
|
26
|
+
original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
|
|
27
|
+
originalName: string;
|
|
28
|
+
displayName: string;
|
|
29
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
export declare const RouteLinkComponent: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
|
|
32
|
+
original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
|
|
33
|
+
originalName: string;
|
|
34
|
+
displayName: string;
|
|
35
|
+
} & {
|
|
36
|
+
original: (<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
|
|
37
|
+
original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
|
|
38
|
+
originalName: string;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
41
|
+
originalName: string;
|
|
42
|
+
displayName: string;
|
|
43
|
+
} & {
|
|
44
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(<TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element) & {
|
|
45
|
+
original: <TParams extends RouteParamsDefinition | undefined>(props: RouteLinkProps<TParams>) => React.JSX.Element;
|
|
46
|
+
originalName: string;
|
|
47
|
+
displayName: string;
|
|
48
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { makeDecoratable } from "@webiny/react-composition";
|
|
3
|
+
import { SimpleLink } from "./SimpleLink.js";
|
|
4
|
+
import { useRouter } from "../../../router.js";
|
|
5
|
+
const RouteLink = makeDecoratable("RouteLink", (props)=>{
|
|
6
|
+
const router = useRouter();
|
|
7
|
+
const { children, route, ...rest } = props;
|
|
8
|
+
const href = rest.params ? router.getLink(route, rest.params) : router.getLink(route);
|
|
9
|
+
return /*#__PURE__*/ react.createElement(SimpleLink, {
|
|
10
|
+
to: href,
|
|
11
|
+
...rest
|
|
12
|
+
}, children);
|
|
13
|
+
});
|
|
14
|
+
const RouteLinkComponent = RouteLink;
|
|
15
|
+
export { RouteLink, RouteLinkComponent };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=RouteLink.js.map
|