@webiny/app 0.0.0-unstable.e622468070 → 0.0.0-unstable.e9333b3f0b
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 +3 -3
- package/App.js +70 -80
- package/App.js.map +1 -1
- package/AppContainer.js +3 -6
- package/AppContainer.js.map +1 -1
- package/components/Image.js +11 -17
- package/components/Image.js.map +1 -1
- package/components/index.js +0 -2
- package/config/RouterConfig/Route.js +23 -28
- package/config/RouterConfig/Route.js.map +1 -1
- package/config/RouterConfig.d.ts +1 -3
- package/config/RouterConfig.js +11 -10
- package/config/RouterConfig.js.map +1 -1
- package/config.js +19 -20
- package/config.js.map +1 -1
- package/contexts/Ui/index.js +26 -28
- package/contexts/Ui/index.js.map +1 -1
- package/core/Plugin.d.ts +1 -1
- package/core/Plugin.js +7 -9
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.d.ts +3 -2
- package/core/Plugins.js +15 -34
- package/core/Plugins.js.map +1 -1
- package/core/Provider.js +5 -13
- package/core/Provider.js.map +1 -1
- package/core/createProvider.js +3 -6
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.js +8 -13
- package/core/createProviderPlugin.js.map +1 -1
- package/errors/AuthenticationErrorEvent.js +8 -5
- package/errors/AuthenticationErrorEvent.js.map +1 -1
- package/errors/NetworkErrorEvent.js +8 -5
- package/errors/NetworkErrorEvent.js.map +1 -1
- package/errors/abstractions.js +3 -2
- package/errors/abstractions.js.map +1 -1
- package/errors/index.js +1 -4
- package/errors/overlay/ErrorOverlay.js +43 -0
- package/errors/overlay/ErrorOverlay.js.map +1 -0
- package/errors/overlay/GqlErrorOverlay.js +27 -0
- package/errors/overlay/GqlErrorOverlay.js.map +1 -0
- package/errors/overlay/LocalAwsLambdaTimeoutMessage.js +20 -0
- package/errors/overlay/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/errors/overlay/StyledComponents.d.ts +7 -0
- package/errors/overlay/StyledComponents.js +10 -0
- package/errors/overlay/StyledComponents.js.map +1 -0
- package/errors/overlay/Typography.js +13 -0
- package/errors/overlay/Typography.js.map +1 -0
- package/errors/overlay/assets/close_24px.js +19 -0
- package/errors/overlay/assets/close_24px.js.map +1 -0
- package/errors/overlay/createErrorOverlay.js +15 -0
- package/errors/overlay/createErrorOverlay.js.map +1 -0
- package/exports/admin/env-config.d.ts +2 -0
- package/exports/admin/env-config.js +2 -0
- package/exports/admin/{graphqlClient.js → graphql-client.js} +0 -2
- package/exports/admin/{localStorage.js → local-storage.js} +0 -2
- package/exports/admin/router.d.ts +1 -0
- package/exports/admin/router.js +1 -2
- package/exports/admin/security.js +0 -2
- package/exports/admin.d.ts +2 -0
- package/exports/admin.js +2 -2
- package/features/apiStreamClient/FetchApiStreamClient.d.ts +9 -0
- package/features/apiStreamClient/FetchApiStreamClient.js +63 -0
- package/features/apiStreamClient/FetchApiStreamClient.js.map +1 -0
- package/features/apiStreamClient/__tests__/FetchApiStreamClient.test.d.ts +1 -0
- package/features/apiStreamClient/__tests__/FetchApiStreamClient.test.js +170 -0
- package/features/apiStreamClient/__tests__/FetchApiStreamClient.test.js.map +1 -0
- package/features/apiStreamClient/__tests__/readServerSentEvents.test.d.ts +1 -0
- package/features/apiStreamClient/__tests__/readServerSentEvents.test.js +160 -0
- package/features/apiStreamClient/__tests__/readServerSentEvents.test.js.map +1 -0
- package/features/apiStreamClient/abstractions.d.ts +44 -0
- package/features/apiStreamClient/abstractions.js +10 -0
- package/features/apiStreamClient/abstractions.js.map +1 -0
- package/features/apiStreamClient/feature.d.ts +3 -0
- package/features/apiStreamClient/feature.js +17 -0
- package/features/apiStreamClient/feature.js.map +1 -0
- package/features/apiStreamClient/index.d.ts +5 -0
- package/features/apiStreamClient/index.js +5 -0
- package/features/apiStreamClient/readServerSentEvents.d.ts +10 -0
- package/features/apiStreamClient/readServerSentEvents.js +29 -0
- package/features/apiStreamClient/readServerSentEvents.js.map +1 -0
- package/features/apiStreamClient/toPayloadHash.d.ts +14 -0
- package/features/apiStreamClient/toPayloadHash.js +7 -0
- package/features/apiStreamClient/toPayloadHash.js.map +1 -0
- package/features/envConfig/EnvConfig.d.ts +1 -0
- package/features/envConfig/EnvConfig.js +12 -10
- package/features/envConfig/EnvConfig.js.map +1 -1
- package/features/envConfig/abstractions.d.ts +1 -0
- package/features/envConfig/abstractions.js +2 -1
- package/features/envConfig/abstractions.js.map +1 -1
- package/features/envConfig/feature.js +9 -8
- package/features/envConfig/feature.js.map +1 -1
- package/features/envConfig/index.js +0 -2
- package/features/eventPublisher/EventPublisher.js +13 -21
- package/features/eventPublisher/EventPublisher.js.map +1 -1
- package/features/eventPublisher/abstractions.js +7 -9
- package/features/eventPublisher/abstractions.js.map +1 -1
- package/features/eventPublisher/feature.d.ts +3 -1
- package/features/eventPublisher/feature.js +13 -7
- package/features/eventPublisher/feature.js.map +1 -1
- package/features/eventPublisher/index.js +1 -3
- package/features/graphqlClient/AuthenticationErrorPublishing.js +26 -26
- package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -1
- package/features/graphqlClient/BatchingGraphQLClient.d.ts +1 -3
- package/features/graphqlClient/BatchingGraphQLClient.js +104 -150
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -1
- package/features/graphqlClient/FetchGraphQLClient.d.ts +0 -3
- package/features/graphqlClient/FetchGraphQLClient.js +41 -52
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -1
- package/features/graphqlClient/NetworkErrorPublishing.js +35 -42
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -1
- package/features/graphqlClient/RequestValue.d.ts +1 -0
- package/features/graphqlClient/RequestValue.js +42 -38
- package/features/graphqlClient/RequestValue.js.map +1 -1
- package/features/graphqlClient/RetryGraphQLClient.js +36 -45
- package/features/graphqlClient/RetryGraphQLClient.js.map +1 -1
- package/features/graphqlClient/__tests__/GraphQLClient.test.js +457 -336
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -1
- package/features/graphqlClient/abstractions.d.ts +1 -0
- package/features/graphqlClient/abstractions.js +2 -1
- package/features/graphqlClient/abstractions.js.map +1 -1
- package/features/graphqlClient/feature.js +14 -20
- package/features/graphqlClient/feature.js.map +1 -1
- package/features/graphqlClient/index.js +0 -2
- package/features/graphqlClient/types.js +0 -3
- package/features/localStorage/BrowserLocalStorageGateway.js +56 -63
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -1
- package/features/localStorage/LocalStorage.js +27 -24
- package/features/localStorage/LocalStorage.js.map +1 -1
- package/features/localStorage/LocalStorageRepository.js +75 -88
- package/features/localStorage/LocalStorageRepository.js.map +1 -1
- package/features/localStorage/abstractions.js +5 -16
- package/features/localStorage/abstractions.js.map +1 -1
- package/features/localStorage/feature.js +17 -28
- package/features/localStorage/feature.js.map +1 -1
- package/features/localStorage/index.js +1 -3
- 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 +10 -3
- package/features/router/HistoryRouterGateway.js +91 -73
- package/features/router/HistoryRouterGateway.js.map +1 -1
- package/features/router/HistoryRouterGateway.test.js +184 -193
- package/features/router/HistoryRouterGateway.test.js.map +1 -1
- package/features/router/Route.d.ts +1 -1
- package/features/router/Route.js +38 -54
- package/features/router/Route.js.map +1 -1
- package/features/router/RouteUrl.js +84 -217
- package/features/router/RouteUrl.js.map +1 -1
- package/features/router/Router.js +67 -124
- package/features/router/Router.js.map +1 -1
- package/features/router/RouterPresenter.d.ts +8 -2
- package/features/router/RouterPresenter.js +54 -37
- package/features/router/RouterPresenter.js.map +1 -1
- package/features/router/RouterRepository.d.ts +14 -3
- package/features/router/RouterRepository.js +113 -61
- package/features/router/RouterRepository.js.map +1 -1
- package/features/router/RouterRepository.test.js +120 -136
- package/features/router/RouterRepository.test.js.map +1 -1
- package/features/router/abstractions.d.ts +29 -7
- package/features/router/abstractions.js +4 -12
- package/features/router/abstractions.js.map +1 -1
- package/features/router/feature.js +13 -12
- package/features/router/feature.js.map +1 -1
- package/features/router/index.d.ts +1 -0
- package/features/router/index.js +1 -3
- package/helpers/InterfaceGenerator/date.js +0 -3
- package/helpers/InterfaceGenerator/id.js +0 -3
- package/helpers/InterfaceGenerator/identity.js +0 -3
- package/helpers/InterfaceGenerator/index.js +0 -3
- package/helpers/InterfaceGenerator/numeric.js +0 -3
- package/helpers/InterfaceGenerator/truthful.js +0 -3
- package/hooks/useHandler.js +12 -16
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.js +18 -20
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.js +7 -6
- package/hooks/useRegisterLegacyPlugin.js.map +1 -1
- package/hooks/useUi.js +2 -3
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +8 -4
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.js +0 -2
- package/index.d.ts +1 -4
- package/index.js +4 -12
- package/package.json +31 -41
- package/plugins/components/Image.js +8 -15
- package/plugins/components/Image.js.map +1 -1
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +94 -133
- package/plugins/image.js.map +1 -1
- package/plugins/index.js +35 -59
- 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.js +0 -2
- package/presentation/localStorage/useLocalStorage.js +10 -16
- package/presentation/localStorage/useLocalStorage.js.map +1 -1
- package/presentation/localStorage/useLocalStorageValue.js +15 -13
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -1
- package/presentation/localStorage/useLocalStorageValues.js +23 -30
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -1
- package/presentation/router/RouteElementRegistry.js +22 -25
- package/presentation/router/RouteElementRegistry.js.map +1 -1
- package/presentation/router/abstractions.js +2 -1
- package/presentation/router/abstractions.js.map +1 -1
- 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.js +15 -12
- package/presentation/router/components/RouteContent.js.map +1 -1
- package/presentation/router/components/RouteLink.js +11 -16
- package/presentation/router/components/RouteLink.js.map +1 -1
- package/presentation/router/components/RouteParamsSync.d.ts +22 -0
- package/presentation/router/components/RouteParamsSync.js +53 -0
- package/presentation/router/components/RouteParamsSync.js.map +1 -0
- package/presentation/router/components/SimpleLink.js +18 -24
- package/presentation/router/components/SimpleLink.js.map +1 -1
- package/presentation/router/hooks/useRoute.d.ts +1 -0
- package/presentation/router/hooks/useRoute.js +16 -23
- package/presentation/router/hooks/useRoute.js.map +1 -1
- package/presentation/router/hooks/useRouter.d.ts +6 -1
- package/presentation/router/hooks/useRouter.js +23 -19
- package/presentation/router/hooks/useRouter.js.map +1 -1
- package/presentation/router/index.d.ts +2 -0
- package/presentation/router/index.js +1 -2
- package/presentation/router/types.d.ts +1 -1
- package/presentation/router/types.js +0 -3
- package/renderApp.d.ts +1 -1
- package/renderApp.js +7 -6
- package/renderApp.js.map +1 -1
- package/router.js +0 -3
- package/rslib-runtime.js +14 -0
- package/rslib-runtime.js.map +1 -0
- package/shared/di/DiContainerProvider.js +8 -12
- package/shared/di/DiContainerProvider.js.map +1 -1
- package/shared/di/createFeature.js +7 -8
- package/shared/di/createFeature.js.map +1 -1
- package/shared/di/useFeature.js +8 -14
- package/shared/di/useFeature.js.map +1 -1
- package/static/svg/close_24px.33adaadc.svg +1 -0
- package/types.d.ts +0 -21
- package/types.js +0 -3
- package/utils/createGenericContext.js +17 -21
- package/utils/createGenericContext.js.map +1 -1
- package/utils/createHashing.js +13 -16
- package/utils/createHashing.js.map +1 -1
- package/utils/index.js +0 -2
- package/utils/legacyPluginToReactComponent.js +11 -10
- package/utils/legacyPluginToReactComponent.js.map +1 -1
- package/apollo-client/InMemoryCache.d.ts +0 -8
- package/apollo-client/InMemoryCache.js +0 -20
- package/apollo-client/InMemoryCache.js.map +0 -1
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +0 -11
- package/apollo-client/IntrospectionFragmentMatcher.js +0 -45
- package/apollo-client/IntrospectionFragmentMatcher.js.map +0 -1
- package/components/index.js.map +0 -1
- package/core/DebounceRender.d.ts +0 -12
- package/core/DebounceRender.js +0 -31
- package/core/DebounceRender.js.map +0 -1
- package/core/Routes.d.ts +0 -7
- package/core/Routes.js +0 -33
- package/core/Routes.js.map +0 -1
- package/errors/index.js.map +0 -1
- package/exports/admin/envConfig.d.ts +0 -1
- package/exports/admin/envConfig.js +0 -3
- package/exports/admin/envConfig.js.map +0 -1
- package/exports/admin/graphqlClient.js.map +0 -1
- package/exports/admin/localStorage.js.map +0 -1
- package/exports/admin/router.js.map +0 -1
- package/exports/admin/security.js.map +0 -1
- package/exports/admin.js.map +0 -1
- package/features/envConfig/index.js.map +0 -1
- package/features/eventPublisher/index.js.map +0 -1
- package/features/graphqlClient/index.js.map +0 -1
- package/features/graphqlClient/types.js.map +0 -1
- package/features/localStorage/index.js.map +0 -1
- package/features/router/index.js.map +0 -1
- package/helpers/InterfaceGenerator/date.js.map +0 -1
- package/helpers/InterfaceGenerator/id.js.map +0 -1
- package/helpers/InterfaceGenerator/identity.js.map +0 -1
- package/helpers/InterfaceGenerator/index.js.map +0 -1
- package/helpers/InterfaceGenerator/numeric.js.map +0 -1
- package/helpers/InterfaceGenerator/truthful.js.map +0 -1
- package/hooks/useAutocomplete/index.d.ts +0 -1
- package/hooks/useAutocomplete/index.js +0 -3
- package/hooks/useAutocomplete/index.js.map +0 -1
- package/hooks/useAutocomplete/useAutocomplete.d.ts +0 -11
- package/hooks/useAutocomplete/useAutocomplete.js +0 -20
- package/hooks/useAutocomplete/useAutocomplete.js.map +0 -1
- package/hooks/useDataList/functions/getData.d.ts +0 -2
- package/hooks/useDataList/functions/getData.js +0 -4
- package/hooks/useDataList/functions/getData.js.map +0 -1
- package/hooks/useDataList/functions/getError.d.ts +0 -2
- package/hooks/useDataList/functions/getError.js +0 -4
- package/hooks/useDataList/functions/getError.js.map +0 -1
- package/hooks/useDataList/functions/getMeta.d.ts +0 -2
- package/hooks/useDataList/functions/getMeta.js +0 -4
- package/hooks/useDataList/functions/getMeta.js.map +0 -1
- package/hooks/useDataList/functions/index.d.ts +0 -3
- package/hooks/useDataList/functions/index.js +0 -5
- package/hooks/useDataList/functions/index.js.map +0 -1
- package/hooks/useDataList/functions/searchDataByKey.d.ts +0 -2
- package/hooks/useDataList/functions/searchDataByKey.js +0 -18
- package/hooks/useDataList/functions/searchDataByKey.js.map +0 -1
- package/hooks/useDataList/index.d.ts +0 -1
- package/hooks/useDataList/index.js +0 -3
- package/hooks/useDataList/index.js.map +0 -1
- package/hooks/useDataList/useDataList.d.ts +0 -35
- package/hooks/useDataList/useDataList.js +0 -163
- package/hooks/useDataList/useDataList.js.map +0 -1
- package/hooks/useDataList/utils/index.d.ts +0 -1
- package/hooks/useDataList/utils/index.js +0 -3
- package/hooks/useDataList/utils/index.js.map +0 -1
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +0 -10
- package/hooks/useDataList/utils/prepareLoadListParams.js +0 -38
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +0 -1
- package/i18n/index.js.map +0 -1
- package/index.js.map +0 -1
- package/plugins/AddQuerySelectionPlugin.d.ts +0 -22
- package/plugins/AddQuerySelectionPlugin.js +0 -72
- package/plugins/AddQuerySelectionPlugin.js.map +0 -1
- package/plugins/ApolloCacheObjectIdPlugin.d.ts +0 -15
- package/plugins/ApolloCacheObjectIdPlugin.js +0 -16
- package/plugins/ApolloCacheObjectIdPlugin.js.map +0 -1
- package/plugins/ApolloDynamicLink.d.ts +0 -7
- package/plugins/ApolloDynamicLink.js +0 -31
- package/plugins/ApolloDynamicLink.js.map +0 -1
- package/plugins/ApolloLinkPlugin.d.ts +0 -13
- package/plugins/ApolloLinkPlugin.js +0 -22
- package/plugins/ApolloLinkPlugin.js.map +0 -1
- package/plugins/ConsoleLinkPlugin.d.ts +0 -8
- package/plugins/ConsoleLinkPlugin.js +0 -26
- package/plugins/ConsoleLinkPlugin.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +0 -55
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +0 -31
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +0 -31
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +0 -8
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +0 -78
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.js +0 -18
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +0 -22
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +0 -10
- package/plugins/NetworkErrorLinkPlugin.js +0 -70
- package/plugins/NetworkErrorLinkPlugin.js.map +0 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +0 -8
- package/plugins/OmitTypenameLinkPlugin.js +0 -21
- package/plugins/OmitTypenameLinkPlugin.js.map +0 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +0 -10
- package/plugins/TenantHeaderLinkPlugin.js +0 -37
- package/plugins/TenantHeaderLinkPlugin.js.map +0 -1
- package/presentation/localStorage/index.js.map +0 -1
- package/presentation/router/index.js.map +0 -1
- package/presentation/router/types.js.map +0 -1
- package/react-butterfiles/Files.d.ts +0 -69
- package/react-butterfiles/Files.js +0 -227
- package/react-butterfiles/Files.js.map +0 -1
- package/react-butterfiles/file.todo +0 -1
- package/react-butterfiles/index.d.ts +0 -2
- package/react-butterfiles/index.js +0 -4
- package/react-butterfiles/index.js.map +0 -1
- package/react-butterfiles/utils/generateId.d.ts +0 -1
- package/react-butterfiles/utils/generateId.js +0 -5
- package/react-butterfiles/utils/generateId.js.map +0 -1
- package/react-butterfiles/utils/readFileContent.d.ts +0 -1
- package/react-butterfiles/utils/readFileContent.js +0 -15
- package/react-butterfiles/utils/readFileContent.js.map +0 -1
- package/router.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/index.js.map +0 -1
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/ErrorOverlay.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/GqlErrorOverlay.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/LocalAwsLambdaTimeoutMessage.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/Typography.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.svg +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/createErrorOverlay.d.ts +0 -0
- /package/exports/admin/{graphqlClient.d.ts → graphql-client.d.ts} +0 -0
- /package/exports/admin/{localStorage.d.ts → local-storage.d.ts} +0 -0
package/App.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Decorator, DecoratorsCollection, GenericComponent } from "@webiny/react-composition";
|
|
3
3
|
interface State {
|
|
4
|
-
plugins: JSX.Element[];
|
|
4
|
+
plugins: React.JSX.Element[];
|
|
5
5
|
providers: Decorator<GenericComponent<ProviderProps>>[];
|
|
6
6
|
}
|
|
7
7
|
interface AppContext extends State {
|
|
@@ -11,8 +11,8 @@ interface AppContext extends State {
|
|
|
11
11
|
declare const AppContext: React.Context<AppContext | undefined>;
|
|
12
12
|
export declare const useApp: () => AppContext;
|
|
13
13
|
export interface AppProps {
|
|
14
|
-
debounceRender?: number;
|
|
15
14
|
routes?: Array<any>;
|
|
15
|
+
plugins?: any[];
|
|
16
16
|
providers?: Array<Decorator<GenericComponent<ProviderProps>>>;
|
|
17
17
|
decorators?: DecoratorsCollection;
|
|
18
18
|
children?: React.ReactNode | React.ReactNode[];
|
|
@@ -20,6 +20,6 @@ export interface AppProps {
|
|
|
20
20
|
interface ProviderProps {
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
}
|
|
23
|
-
export declare const AppBase: React.MemoExoticComponent<({
|
|
23
|
+
export declare const AppBase: React.MemoExoticComponent<({ routes, plugins, providers, children }: AppProps) => React.JSX.Element>;
|
|
24
24
|
export declare const App: ({ decorators, ...props }: AppProps) => React.JSX.Element;
|
|
25
25
|
export {};
|
package/App.js
CHANGED
|
@@ -1,92 +1,82 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { DebounceRender } from "./core/DebounceRender.js";
|
|
1
|
+
import react, { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { CompositionProvider, compose } from "@webiny/react-composition";
|
|
4
3
|
import { PluginsProvider } from "./core/Plugins.js";
|
|
5
4
|
import { RouterWithConfig, useRouterConfig } from "./config/RouterConfig.js";
|
|
6
5
|
import { AppContainer } from "./AppContainer.js";
|
|
7
6
|
import { RouteContent } from "./presentation/router/components/RouteContent.js";
|
|
8
7
|
import { useRouter } from "./router.js";
|
|
9
|
-
const AppContext = /*#__PURE__*/createContext(
|
|
8
|
+
const AppContext = /*#__PURE__*/ createContext(void 0);
|
|
10
9
|
AppContext.displayName = "AppContext";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return appContext;
|
|
10
|
+
const useApp = ()=>{
|
|
11
|
+
const appContext = useContext(AppContext);
|
|
12
|
+
if (!appContext) throw Error('AppContext provider was not found. Are you using the "useApp()" hook in the right place?');
|
|
13
|
+
return appContext;
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
children
|
|
23
|
-
}) => {
|
|
24
|
-
const [state, setState] = useState({
|
|
25
|
-
plugins: [],
|
|
26
|
-
providers
|
|
27
|
-
});
|
|
28
|
-
const addProvider = useCallback(component => {
|
|
29
|
-
setState(state => {
|
|
30
|
-
if (state.providers.findIndex(m => m === component) > -1) {
|
|
31
|
-
return state;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
...state,
|
|
35
|
-
providers: [...state.providers, component]
|
|
36
|
-
};
|
|
15
|
+
const AppBase = /*#__PURE__*/ react.memo(({ routes = [], plugins = [], providers = [], children })=>{
|
|
16
|
+
const [state, setState] = useState({
|
|
17
|
+
plugins,
|
|
18
|
+
providers
|
|
37
19
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
addPlugin
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
20
|
+
const addProvider = useCallback((component)=>{
|
|
21
|
+
setState((state)=>{
|
|
22
|
+
if (state.providers.findIndex((m)=>m === component) > -1) return state;
|
|
23
|
+
return {
|
|
24
|
+
...state,
|
|
25
|
+
providers: [
|
|
26
|
+
...state.providers,
|
|
27
|
+
component
|
|
28
|
+
]
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
const addPlugin = useCallback((element)=>{
|
|
33
|
+
setState((state)=>({
|
|
34
|
+
...state,
|
|
35
|
+
plugins: [
|
|
36
|
+
...state.plugins,
|
|
37
|
+
element
|
|
38
|
+
]
|
|
39
|
+
}));
|
|
40
|
+
}, []);
|
|
41
|
+
const appContext = useMemo(()=>({
|
|
42
|
+
...state,
|
|
43
|
+
addProvider,
|
|
44
|
+
addPlugin
|
|
45
|
+
}), [
|
|
46
|
+
state
|
|
47
|
+
]);
|
|
48
|
+
const AppRouter = useMemo(()=>function() {
|
|
49
|
+
const router = useRouter();
|
|
50
|
+
const routerConfig = useRouterConfig();
|
|
51
|
+
const routesFromConfig = routerConfig.routes;
|
|
52
|
+
const combinedRoutes = [
|
|
53
|
+
...routes,
|
|
54
|
+
...routesFromConfig
|
|
55
|
+
];
|
|
56
|
+
useEffect(()=>{
|
|
57
|
+
router.setRoutes(combinedRoutes);
|
|
58
|
+
}, [
|
|
59
|
+
combinedRoutes.length
|
|
60
|
+
]);
|
|
61
|
+
return null;
|
|
62
|
+
}, []);
|
|
63
|
+
const Providers = useMemo(()=>/*#__PURE__*/ react.memo(compose(...state.providers || [])(({ children })=>/*#__PURE__*/ react.createElement(react.Fragment, null, children))), [
|
|
64
|
+
state.providers.length
|
|
65
|
+
]);
|
|
66
|
+
Providers.displayName = "Providers";
|
|
67
|
+
return /*#__PURE__*/ react.createElement(AppContext.Provider, {
|
|
68
|
+
value: appContext
|
|
69
|
+
}, children, /*#__PURE__*/ react.createElement(AppContainer, null, /*#__PURE__*/ react.createElement(Providers, null, /*#__PURE__*/ react.createElement(PluginsProvider, null, state.plugins.map((plugin, index)=>/*#__PURE__*/ react.createElement(Fragment, {
|
|
70
|
+
key: index
|
|
71
|
+
}, plugin))), /*#__PURE__*/ react.createElement(RouterWithConfig, null, /*#__PURE__*/ react.createElement(AppRouter, null), /*#__PURE__*/ react.createElement(RouteContent, null)))));
|
|
79
72
|
});
|
|
80
73
|
AppBase.displayName = "AppBase";
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
decorators: decorators
|
|
89
|
-
}, props)));
|
|
90
|
-
};
|
|
74
|
+
const App = ({ decorators, ...props })=>/*#__PURE__*/ react.createElement(CompositionProvider, {
|
|
75
|
+
decorators: decorators
|
|
76
|
+
}, /*#__PURE__*/ react.createElement(AppBase, {
|
|
77
|
+
decorators: decorators,
|
|
78
|
+
...props
|
|
79
|
+
}));
|
|
80
|
+
export { App, AppBase, useApp };
|
|
91
81
|
|
|
92
82
|
//# sourceMappingURL=App.js.map
|
package/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"App.js","sources":["../src/App.tsx"],"sourcesContent":["import React, {\n createContext,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState\n} from \"react\";\nimport {\n compose,\n CompositionProvider,\n Decorator,\n DecoratorsCollection,\n GenericComponent\n} from \"@webiny/react-composition\";\nimport { PluginsProvider } from \"./core/Plugins.js\";\nimport { RouterWithConfig, useRouterConfig } from \"./config/RouterConfig.js\";\nimport { AppContainer } from \"./AppContainer.js\";\nimport { RouteContent } from \"~/presentation/router/components/RouteContent.js\";\nimport { useRouter } from \"~/router.js\";\n\ninterface State {\n plugins: React.JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\n addPlugin(plugin: React.ReactNode): void;\n}\n\nconst AppContext = createContext<AppContext | undefined>(undefined);\n\nAppContext.displayName = \"AppContext\";\n\nexport const useApp = () => {\n const appContext = useContext(AppContext);\n if (!appContext) {\n throw Error(\n `AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?`\n );\n }\n return appContext;\n};\n\nexport interface AppProps {\n routes?: Array<any>;\n plugins?: any[];\n providers?: Array<Decorator<GenericComponent<ProviderProps>>>;\n decorators?: DecoratorsCollection;\n children?: React.ReactNode | React.ReactNode[];\n}\n\ninterface ProviderProps {\n children: React.ReactNode;\n}\n\ntype ComponentWithChildren = React.ComponentType<{ children?: React.ReactNode }>;\n\nexport const AppBase = React.memo(\n ({ routes = [], plugins = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n plugins,\n providers\n });\n\n const addProvider = useCallback((component: Decorator<any>) => {\n setState(state => {\n if (state.providers.findIndex(m => m === component) > -1) {\n return state;\n }\n\n return {\n ...state,\n providers: [...state.providers, component]\n };\n });\n }, []);\n\n const addPlugin = useCallback((element: React.JSX.Element) => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const router = useRouter();\n const routerConfig = useRouterConfig();\n const routesFromConfig = routerConfig.routes;\n const combinedRoutes = [...routes, ...routesFromConfig];\n\n useEffect(() => {\n router.setRoutes(combinedRoutes);\n }, [combinedRoutes.length]);\n\n return null;\n };\n }, []);\n\n const Providers = useMemo(() => {\n return React.memo(\n compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <>{children}</>;\n })\n );\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n {children}\n <AppContainer>\n <Providers>\n <PluginsProvider>\n {state.plugins.map((plugin, index) => (\n <Fragment key={index}>{plugin}</Fragment>\n ))}\n </PluginsProvider>\n <RouterWithConfig>\n <AppRouter />\n <RouteContent />\n </RouterWithConfig>\n </Providers>\n </AppContainer>\n </AppContext.Provider>\n );\n }\n);\n\nAppBase.displayName = \"AppBase\";\n\nexport const App = ({ decorators, ...props }: AppProps) => {\n return (\n <CompositionProvider decorators={decorators}>\n <AppBase decorators={decorators} {...props} />\n </CompositionProvider>\n );\n};\n"],"names":["AppContext","createContext","undefined","useApp","appContext","useContext","Error","AppBase","React","routes","plugins","providers","children","state","setState","useState","addProvider","useCallback","component","m","addPlugin","element","useMemo","AppRouter","router","useRouter","routerConfig","useRouterConfig","routesFromConfig","combinedRoutes","useEffect","Providers","compose","AppContainer","PluginsProvider","plugin","index","Fragment","RouterWithConfig","RouteContent","App","decorators","props","CompositionProvider"],"mappings":";;;;;;;AAgCA,MAAMA,aAAa,WAAHA,GAAGC,cAAsCC;AAEzDF,WAAW,WAAW,GAAG;AAElB,MAAMG,SAAS;IAClB,MAAMC,aAAaC,WAAWL;IAC9B,IAAI,CAACI,YACD,MAAME,MACF;IAGR,OAAOF;AACX;AAgBO,MAAMG,UAAU,WAAHA,GAAGC,MAAAA,IAAU,CAC7B,CAAC,EAAEC,SAAS,EAAE,EAAEC,UAAU,EAAE,EAAEC,YAAY,EAAE,EAAEC,QAAQ,EAAY;IAC9D,MAAM,CAACC,OAAOC,SAAS,GAAGC,SAAgB;QACtCL;QACAC;IACJ;IAEA,MAAMK,cAAcC,YAAY,CAACC;QAC7BJ,SAASD,CAAAA;YACL,IAAIA,MAAM,SAAS,CAAC,SAAS,CAACM,CAAAA,IAAKA,MAAMD,aAAa,IAClD,OAAOL;YAGX,OAAO;gBACH,GAAGA,KAAK;gBACR,WAAW;uBAAIA,MAAM,SAAS;oBAAEK;iBAAU;YAC9C;QACJ;IACJ,GAAG,EAAE;IAEL,MAAME,YAAYH,YAAY,CAACI;QAC3BP,SAASD,CAAAA,QACE;gBACH,GAAGA,KAAK;gBACR,SAAS;uBAAIA,MAAM,OAAO;oBAAEQ;iBAAQ;YACxC;IAER,GAAG,EAAE;IAEL,MAAMjB,aAAakB,QACf,IAAO;YACH,GAAGT,KAAK;YACRG;YACAI;QACJ,IACA;QAACP;KAAM;IAGX,MAAMU,YAAYD,QAAQ,IACf;YACH,MAAME,SAASC;YACf,MAAMC,eAAeC;YACrB,MAAMC,mBAAmBF,aAAa,MAAM;YAC5C,MAAMG,iBAAiB;mBAAIpB;mBAAWmB;aAAiB;YAEvDE,UAAU;gBACNN,OAAO,SAAS,CAACK;YACrB,GAAG;gBAACA,eAAe,MAAM;aAAC;YAE1B,OAAO;QACX,GACD,EAAE;IAEL,MAAME,YAAYT,QAAQ,IACf,WAAP,GAAOd,MAAAA,IAAU,CACbwB,WAAYnB,MAAM,SAAS,IAAI,EAAE,EAAG,CAAC,EAAED,QAAQ,EAAiB,GACrD,WAAP,GAAO,0CAAGA,aAGnB;QAACC,MAAM,SAAS,CAAC,MAAM;KAAC;IAE3BkB,UAAU,WAAW,GAAG;IAExB,OAAO,WAAP,GACI,oBAAC/B,WAAW,QAAQ;QAAC,OAAOI;OACvBQ,UAAAA,WAAAA,GACD,oBAACqB,cAAYA,MAAAA,WAAAA,GACT,oBAACF,WAAAA,MAAAA,WAAAA,GACG,oBAACG,iBAAeA,MACXrB,MAAM,OAAO,CAAC,GAAG,CAAC,CAACsB,QAAQC,QAAAA,WAAAA,GACxB,oBAACC,UAAQA;YAAC,KAAKD;WAAQD,WAAAA,WAAAA,GAG/B,oBAACG,kBAAgBA,MAAAA,WAAAA,GACb,oBAACf,WAAAA,OAAAA,WAAAA,GACD,oBAACgB,cAAYA;AAMrC;AAGJhC,QAAQ,WAAW,GAAG;AAEf,MAAMiC,MAAM,CAAC,EAAEC,UAAU,EAAE,GAAGC,OAAiB,GAC3C,WAAP,GACI,oBAACC,qBAAmBA;QAAC,YAAYF;qBAC7B,oBAAClC,SAAOA;QAAC,YAAYkC;QAAa,GAAGC,KAAK"}
|
package/AppContainer.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { makeDecoratable } from "@webiny/react-composition";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) => {
|
|
6
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
7
|
-
});
|
|
3
|
+
const AppContainer = makeDecoratable("AppContainer", ({ children })=>/*#__PURE__*/ react.createElement(react.Fragment, null, children));
|
|
4
|
+
export { AppContainer };
|
|
8
5
|
|
|
9
6
|
//# sourceMappingURL=AppContainer.js.map
|
package/AppContainer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"AppContainer.js","sources":["../src/AppContainer.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface AppContentProps {\n children: React.ReactNode;\n}\n\nexport const AppContainer = makeDecoratable(\"AppContainer\", ({ children }: AppContentProps) => {\n return <>{children}</>;\n});\n"],"names":["AppContainer","makeDecoratable","children"],"mappings":";;AAOO,MAAMA,eAAeC,gBAAgB,gBAAgB,CAAC,EAAEC,QAAQ,EAAmB,GAC/E,WAAP,GAAO,0CAAGA"}
|
package/components/Image.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import invariant from "invariant";
|
|
2
2
|
import { plugins } from "@webiny/plugins";
|
|
3
3
|
import get from "lodash/get.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
invariant(preset, `Transform preset "${presetName}" not found.`);
|
|
15
|
-
props.transform = preset;
|
|
16
|
-
}
|
|
17
|
-
if (props.transform) {
|
|
18
|
-
props.src = plugin.getImageSrc(props);
|
|
19
|
-
}
|
|
20
|
-
return plugin.render(props);
|
|
4
|
+
const Image = ({ preset: presetName, ...props })=>{
|
|
5
|
+
const plugin = plugins.byName("image-component");
|
|
6
|
+
if (!plugin) throw new Error('Image component plugin (type "image-component") not defined.');
|
|
7
|
+
if (presetName) {
|
|
8
|
+
const preset = get(plugin, `presets.${presetName}`);
|
|
9
|
+
invariant(preset, `Transform preset "${presetName}" not found.`);
|
|
10
|
+
props.transform = preset;
|
|
11
|
+
}
|
|
12
|
+
if (props.transform) props.src = plugin.getImageSrc(props);
|
|
13
|
+
return plugin.render(props);
|
|
21
14
|
};
|
|
15
|
+
export { Image };
|
|
22
16
|
|
|
23
17
|
//# sourceMappingURL=Image.js.map
|
package/components/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"components/Image.js","sources":["../../src/components/Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get.js\";\nimport type { ImageComponentPlugin, ImageProps } from \"~/types.js\";\n\nexport const Image = ({ preset: presetName, ...props }: ImageProps) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"names":["Image","presetName","props","plugin","plugins","Error","preset","get","invariant"],"mappings":";;;AAKO,MAAMA,QAAQ,CAAC,EAAE,QAAQC,UAAU,EAAE,GAAGC,OAAmB;IAC9D,MAAMC,SAASC,QAAQ,MAAM,CAAuB;IACpD,IAAI,CAACD,QACD,MAAM,IAAIE,MAAM;IAGpB,IAAIJ,YAAY;QACZ,MAAMK,SAASC,IAAIJ,QAAQ,CAAC,QAAQ,EAAEF,YAAY;QAClDO,UAAUF,QAAQ,CAAC,kBAAkB,EAAEL,WAAW,YAAY,CAAC;QAC/DC,MAAM,SAAS,GAAGI;IACtB;IAEA,IAAIJ,MAAM,SAAS,EACfA,MAAM,GAAG,GAAGC,OAAO,WAAW,CAACD;IAGnC,OAAOC,OAAO,MAAM,CAACD;AACzB"}
|
package/components/index.js
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { makeDecoratable } from "@webiny/react-composition";
|
|
3
3
|
import { Property, useIdGenerator } from "@webiny/react-properties";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
value: route
|
|
26
|
-
}), /*#__PURE__*/React.createElement(Property, {
|
|
27
|
-
id: getId(name, "element"),
|
|
28
|
-
name: "element",
|
|
29
|
-
value: element
|
|
30
|
-
}));
|
|
4
|
+
const Route = makeDecoratable("Route", ({ route, element, remove, before, after })=>{
|
|
5
|
+
const name = route.name;
|
|
6
|
+
const getId = useIdGenerator("Route");
|
|
7
|
+
const placeAfter = void 0 !== after ? getId(after) : void 0;
|
|
8
|
+
const placeBefore = void 0 !== before ? getId(before) : void 0;
|
|
9
|
+
return /*#__PURE__*/ react.createElement(Property, {
|
|
10
|
+
id: getId(name),
|
|
11
|
+
name: "routes",
|
|
12
|
+
remove: remove,
|
|
13
|
+
array: true,
|
|
14
|
+
before: placeBefore,
|
|
15
|
+
after: placeAfter
|
|
16
|
+
}, /*#__PURE__*/ react.createElement(Property, {
|
|
17
|
+
id: getId(name, "route"),
|
|
18
|
+
name: "route",
|
|
19
|
+
value: route
|
|
20
|
+
}), /*#__PURE__*/ react.createElement(Property, {
|
|
21
|
+
id: getId(name, "element"),
|
|
22
|
+
name: "element",
|
|
23
|
+
value: element
|
|
24
|
+
}));
|
|
31
25
|
});
|
|
26
|
+
export { Route };
|
|
32
27
|
|
|
33
28
|
//# sourceMappingURL=Route.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"config/RouterConfig/Route.js","sources":["../../../src/config/RouterConfig/Route.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { Property, useIdGenerator } from \"@webiny/react-properties\";\nimport type { Route as BaseRoute } from \"~/router.js\";\n\nexport interface RouteProps {\n route: BaseRoute<any>;\n element: React.ReactElement;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport type RouteConfig = Pick<RouteProps, \"route\" | \"element\">;\n\nexport const Route = makeDecoratable(\n \"Route\",\n ({ route, element, remove, before, after }: RouteProps) => {\n const name = route.name;\n\n const getId = useIdGenerator(\"Route\");\n\n const placeAfter = after !== undefined ? getId(after) : undefined;\n const placeBefore = before !== undefined ? getId(before) : undefined;\n\n return (\n <Property\n id={getId(name)}\n name={\"routes\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={getId(name, \"route\")} name={\"route\"} value={route} />\n <Property id={getId(name, \"element\")} name={\"element\"} value={element} />\n </Property>\n );\n }\n);\n"],"names":["Route","makeDecoratable","route","element","remove","before","after","name","getId","useIdGenerator","placeAfter","undefined","placeBefore","Property"],"mappings":";;;AAeO,MAAMA,QAAQC,gBACjB,SACA,CAAC,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAc;IAClD,MAAMC,OAAOL,MAAM,IAAI;IAEvB,MAAMM,QAAQC,eAAe;IAE7B,MAAMC,aAAaJ,AAAUK,WAAVL,QAAsBE,MAAMF,SAASK;IACxD,MAAMC,cAAcP,AAAWM,WAAXN,SAAuBG,MAAMH,UAAUM;IAE3D,OAAO,WAAP,GACI,oBAACE,UAAQA;QACL,IAAIL,MAAMD;QACV,MAAM;QACN,QAAQH;QACR,OAAO;QACP,QAAQQ;QACR,OAAOF;qBAEP,oBAACG,UAAQA;QAAC,IAAIL,MAAMD,MAAM;QAAU,MAAM;QAAS,OAAOL;sBAC1D,oBAACW,UAAQA;QAAC,IAAIL,MAAMD,MAAM;QAAY,MAAM;QAAW,OAAOJ;;AAG1E"}
|
package/config/RouterConfig.d.ts
CHANGED
|
@@ -25,7 +25,5 @@ export declare const RouterConfig: (({ priority, children }: import("@webiny/rea
|
|
|
25
25
|
displayName: string;
|
|
26
26
|
}>) => (props: unknown) => React.JSX.Element;
|
|
27
27
|
};
|
|
28
|
-
useRouterConfig:
|
|
29
|
-
routes: RouteConfig[];
|
|
30
|
-
};
|
|
28
|
+
useRouterConfig: typeof useRouterConfig;
|
|
31
29
|
};
|
package/config/RouterConfig.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { createConfigurableComponent } from "@webiny/react-properties";
|
|
2
2
|
import { Route } from "./RouterConfig/Route.js";
|
|
3
3
|
const base = createConfigurableComponent("RouterConfig");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const RouterWithConfig = Object.assign(base.WithConfig, {
|
|
5
|
+
displayName: "RouterWithConfig"
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const useRouterConfig = ()=>{
|
|
8
|
+
const baseConfig = base.useConfig();
|
|
9
|
+
return {
|
|
10
|
+
routes: baseConfig.routes ?? []
|
|
11
|
+
};
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const RouterConfig = Object.assign(base.Config, {
|
|
14
|
+
Route: Route,
|
|
15
|
+
useRouterConfig: useRouterConfig
|
|
16
16
|
});
|
|
17
|
+
export { RouterConfig, RouterWithConfig, useRouterConfig };
|
|
17
18
|
|
|
18
19
|
//# sourceMappingURL=RouterConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"config/RouterConfig.js","sources":["../../src/config/RouterConfig.tsx"],"sourcesContent":["import { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Route, type RouteConfig } from \"./RouterConfig/Route.js\";\n\nconst base = createConfigurableComponent<RouterConfig>(\"RouterConfig\");\n\nexport const RouterWithConfig = Object.assign(base.WithConfig, {\n displayName: \"RouterWithConfig\"\n});\n\ninterface RouterConfig {\n routes: RouteConfig[];\n}\n\nexport const useRouterConfig = () => {\n const baseConfig = base.useConfig();\n\n return {\n routes: baseConfig.routes ?? []\n };\n};\n\nexport const RouterConfig = Object.assign(base.Config, {\n Route,\n useRouterConfig\n});\n"],"names":["base","createConfigurableComponent","RouterWithConfig","Object","useRouterConfig","baseConfig","RouterConfig","Route"],"mappings":";;AAGA,MAAMA,OAAOC,4BAA0C;AAEhD,MAAMC,mBAAmBC,OAAO,MAAM,CAACH,KAAK,UAAU,EAAE;IAC3D,aAAa;AACjB;AAMO,MAAMI,kBAAkB;IAC3B,MAAMC,aAAaL,KAAK,SAAS;IAEjC,OAAO;QACH,QAAQK,WAAW,MAAM,IAAI,EAAE;IACnC;AACJ;AAEO,MAAMC,eAAeH,OAAO,MAAM,CAACH,KAAK,MAAM,EAAE;IACnDO,OAAKA;IACLH,iBAAAA;AACJ"}
|
package/config.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
const deepFreeze = obj
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
return Object.freeze(obj);
|
|
1
|
+
const deepFreeze = (obj)=>{
|
|
2
|
+
Object.keys(obj).forEach((prop)=>{
|
|
3
|
+
if ("object" == typeof obj[prop] && !Object.isFrozen(obj[prop])) deepFreeze(obj[prop]);
|
|
4
|
+
});
|
|
5
|
+
return Object.freeze(obj);
|
|
8
6
|
};
|
|
9
7
|
function createConfig() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
let _config = {};
|
|
9
|
+
return {
|
|
10
|
+
set (config) {
|
|
11
|
+
_config = deepFreeze(config);
|
|
12
|
+
},
|
|
13
|
+
get () {
|
|
14
|
+
return _config;
|
|
15
|
+
},
|
|
16
|
+
getKey (key, defaultValue) {
|
|
17
|
+
return key in _config ? _config[key] : defaultValue;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
22
20
|
}
|
|
23
|
-
|
|
21
|
+
const config_config = createConfig();
|
|
22
|
+
export { config_config as config };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=config.js.map
|
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../src/config.ts"],"sourcesContent":["export type Config = Record<string, any>;\n\ninterface AppConfig {\n set(config: Config): void;\n get(): Config;\n getKey<T = string>(key: string, defaultValue: T): T;\n}\n\nconst deepFreeze = (obj: Record<string, any>): Record<string, any> => {\n Object.keys(obj).forEach(prop => {\n if (typeof obj[prop] === \"object\" && !Object.isFrozen(obj[prop])) {\n deepFreeze(obj[prop]);\n }\n });\n return Object.freeze(obj);\n};\n\nfunction createConfig(): AppConfig {\n let _config: Record<string, any> = {};\n\n return {\n set(config: Config) {\n _config = deepFreeze(config);\n },\n get() {\n return _config;\n },\n getKey(key, defaultValue) {\n return key in _config ? _config[key] : defaultValue;\n }\n };\n}\n\nexport const config = createConfig();\n"],"names":["deepFreeze","obj","Object","prop","createConfig","_config","config","key","defaultValue"],"mappings":"AAQA,MAAMA,aAAa,CAACC;IAChBC,OAAO,IAAI,CAACD,KAAK,OAAO,CAACE,CAAAA;QACrB,IAAI,AAAqB,YAArB,OAAOF,GAAG,CAACE,KAAK,IAAiB,CAACD,OAAO,QAAQ,CAACD,GAAG,CAACE,KAAK,GAC3DH,WAAWC,GAAG,CAACE,KAAK;IAE5B;IACA,OAAOD,OAAO,MAAM,CAACD;AACzB;AAEA,SAASG;IACL,IAAIC,UAA+B,CAAC;IAEpC,OAAO;QACH,KAAIC,MAAc;YACdD,UAAUL,WAAWM;QACzB;QACA;YACI,OAAOD;QACX;QACA,QAAOE,GAAG,EAAEC,YAAY;YACpB,OAAOD,OAAOF,UAAUA,OAAO,CAACE,IAAI,GAAGC;QAC3C;IACJ;AACJ;AAEO,MAAMF,gBAASF"}
|
package/contexts/Ui/index.js
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { plugins } from "@webiny/plugins";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
key: pl.name
|
|
28
|
-
})), this.props.children);
|
|
29
|
-
}
|
|
3
|
+
const UiContext = /*#__PURE__*/ react.createContext({});
|
|
4
|
+
class UiProvider extends react.Component {
|
|
5
|
+
render() {
|
|
6
|
+
const value = {
|
|
7
|
+
...this.state.ui,
|
|
8
|
+
setState: this.setData
|
|
9
|
+
};
|
|
10
|
+
const uiStatePlugins = plugins.byType("ui-state");
|
|
11
|
+
return /*#__PURE__*/ react.createElement(UiContext.Provider, {
|
|
12
|
+
value: value
|
|
13
|
+
}, uiStatePlugins.map((pl)=>/*#__PURE__*/ react.cloneElement(pl.render(), {
|
|
14
|
+
key: pl.name
|
|
15
|
+
})), this.props.children);
|
|
16
|
+
}
|
|
17
|
+
constructor(...args){
|
|
18
|
+
super(...args), this.state = {
|
|
19
|
+
ui: {}
|
|
20
|
+
}, this.setData = (setter)=>this.setState((state)=>({
|
|
21
|
+
ui: {
|
|
22
|
+
...state.ui,
|
|
23
|
+
...setter(state.ui)
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
30
27
|
}
|
|
28
|
+
export { UiContext, UiProvider };
|
|
31
29
|
|
|
32
30
|
//# sourceMappingURL=index.js.map
|
package/contexts/Ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"contexts/Ui/index.js","sources":["../../../src/contexts/Ui/index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { UiStatePlugin } from \"~/types.js\";\nimport { plugins } from \"@webiny/plugins\";\n\nexport const UiContext = React.createContext<Record<string, any>>({});\n\ntype Props = Record<string, any>;\n\ntype State = {\n ui: { [key: string]: any };\n};\n\ninterface UiData {\n [key: string]: any;\n}\n\ninterface UiDataSetter {\n (ui: UiData): UiData;\n}\n\nexport interface UiContextValue {\n setState: (setter: UiDataSetter) => void;\n [key: string]: any;\n}\n\nexport class UiProvider extends React.Component<Props, State> {\n public override state: State = {\n ui: {}\n };\n\n private readonly setData = (setter: UiDataSetter): void => {\n return this.setState((state: State) => {\n return { ui: { ...state.ui, ...setter(state.ui) } };\n });\n };\n\n public override render() {\n const value: UiContextValue = { ...this.state.ui, setState: this.setData };\n const uiStatePlugins = plugins.byType<UiStatePlugin>(\"ui-state\");\n return (\n <UiContext.Provider value={value}>\n {uiStatePlugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}\n {this.props.children}\n </UiContext.Provider>\n );\n }\n}\n"],"names":["UiContext","React","UiProvider","value","uiStatePlugins","plugins","pl","setter","state"],"mappings":";;AAIO,MAAMA,YAAY,WAAHA,GAAGC,MAAAA,aAAmB,CAAsB,CAAC;AAqB5D,MAAMC,mBAAmBD,MAAAA,SAAe;IAW3B,SAAS;QACrB,MAAME,QAAwB;YAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE;YAAE,UAAU,IAAI,CAAC,OAAO;QAAC;QACzE,MAAMC,iBAAiBC,QAAQ,MAAM,CAAgB;QACrD,OAAO,WAAP,GACI,oBAACL,UAAU,QAAQ;YAAC,OAAOG;WACtBC,eAAe,GAAG,CAACE,CAAAA,KAAAA,WAAAA,GAAML,MAAAA,YAAkB,CAACK,GAAG,MAAM,IAAI;gBAAE,KAAKA,GAAG,IAAI;YAAC,KACxE,IAAI,CAAC,KAAK,CAAC,QAAQ;IAGhC;;QApBG,qBACa,KAAK,GAAU;YAC3B,IAAI,CAAC;QACT,QAEiB,OAAO,GAAG,CAACC,SACjB,IAAI,CAAC,QAAQ,CAAC,CAACC,QACX;oBAAE,IAAI;wBAAE,GAAGA,MAAM,EAAE;wBAAE,GAAGD,OAAOC,MAAM,EAAE,CAAC;oBAAC;gBAAE;;AAc9D"}
|
package/core/Plugin.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ interface PluginProps {
|
|
|
4
4
|
providers?: Decorator<GenericComponent>[];
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare const Plugin: React.
|
|
7
|
+
export declare const Plugin: React.MemoExoticComponent<({ providers, children }: PluginProps) => React.JSX.Element>;
|
|
8
8
|
export {};
|