@webiny/app 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313
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 +4 -5
- package/App.js +26 -32
- package/App.js.map +1 -1
- package/README.md +7 -15
- package/apollo-client/InMemoryCache.js +2 -2
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/components/Image.d.ts +1 -2
- package/components/Image.js +1 -1
- package/components/Image.js.map +1 -1
- package/components/index.d.ts +1 -2
- package/components/index.js +1 -2
- package/components/index.js.map +1 -1
- package/config/RouterConfig/Route.d.ts +9 -10
- package/config/RouterConfig/Route.js +5 -14
- package/config/RouterConfig/Route.js.map +1 -1
- package/config/RouterConfig.d.ts +10 -11
- package/config/RouterConfig.js +1 -1
- package/config/RouterConfig.js.map +1 -1
- package/contexts/Ui/index.js.map +1 -1
- package/core/Plugin.js +2 -2
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.d.ts +1 -1
- package/core/Plugins.js +5 -4
- package/core/Plugins.js.map +1 -1
- package/core/Provider.d.ts +1 -1
- package/core/Provider.js +1 -1
- package/core/Provider.js.map +1 -1
- package/core/createProviderPlugin.js +1 -1
- package/core/createProviderPlugin.js.map +1 -1
- package/errors/AuthenticationErrorEvent.d.ts +9 -0
- package/errors/AuthenticationErrorEvent.js +10 -0
- package/errors/AuthenticationErrorEvent.js.map +1 -0
- package/errors/NetworkErrorEvent.d.ts +15 -0
- package/errors/NetworkErrorEvent.js +10 -0
- package/errors/NetworkErrorEvent.js.map +1 -0
- package/errors/abstractions.d.ts +12 -0
- package/errors/abstractions.js +5 -0
- package/errors/abstractions.js.map +1 -0
- package/errors/index.d.ts +6 -0
- package/errors/index.js +6 -0
- package/errors/index.js.map +1 -0
- package/exports/admin/env-config.d.ts +1 -0
- package/exports/admin/env-config.js +3 -0
- package/exports/admin/env-config.js.map +1 -0
- package/exports/admin/graphql-client.d.ts +1 -0
- package/exports/admin/graphql-client.js +3 -0
- package/exports/admin/graphql-client.js.map +1 -0
- package/exports/admin/local-storage.d.ts +2 -0
- package/exports/admin/local-storage.js +4 -0
- package/exports/admin/local-storage.js.map +1 -0
- package/exports/admin/router.d.ts +5 -0
- package/exports/admin/router.js +7 -0
- package/exports/admin/router.js.map +1 -0
- package/exports/admin/security.d.ts +1 -0
- package/exports/admin/security.js +3 -0
- package/exports/admin/security.js.map +1 -0
- package/exports/admin.d.ts +6 -0
- package/exports/admin.js +8 -0
- package/exports/admin.js.map +1 -0
- package/features/envConfig/EnvConfig.d.ts +6 -0
- package/features/envConfig/EnvConfig.js +14 -0
- package/features/envConfig/EnvConfig.js.map +1 -0
- package/features/envConfig/abstractions.d.ts +27 -0
- package/features/envConfig/abstractions.js +4 -0
- package/features/envConfig/abstractions.js.map +1 -0
- package/features/envConfig/feature.d.ts +17 -0
- package/features/envConfig/feature.js +14 -0
- package/features/envConfig/feature.js.map +1 -0
- package/features/envConfig/index.d.ts +1 -0
- package/features/envConfig/index.js +3 -0
- package/features/envConfig/index.js.map +1 -0
- package/features/eventPublisher/EventPublisher.d.ts +8 -0
- package/features/eventPublisher/EventPublisher.js +27 -0
- package/features/eventPublisher/EventPublisher.js.map +1 -0
- package/features/eventPublisher/abstractions.d.ts +18 -0
- package/features/eventPublisher/abstractions.js +14 -0
- package/features/eventPublisher/abstractions.js.map +1 -0
- package/features/eventPublisher/feature.d.ts +1 -0
- package/features/eventPublisher/feature.js +11 -0
- package/features/eventPublisher/feature.js.map +1 -0
- package/features/eventPublisher/index.d.ts +3 -0
- package/features/eventPublisher/index.js +4 -0
- package/features/eventPublisher/index.js.map +1 -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 +18 -0
- package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
- package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
- package/features/graphqlClient/FetchGraphQLClient.js +62 -0
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
- package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
- package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
- package/features/graphqlClient/RequestValue.d.ts +20 -0
- package/features/graphqlClient/RequestValue.js +42 -0
- package/features/graphqlClient/RequestValue.js.map +1 -0
- package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
- package/features/graphqlClient/RetryGraphQLClient.js +54 -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 +350 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
- package/features/graphqlClient/abstractions.d.ts +17 -0
- package/features/graphqlClient/abstractions.js +4 -0
- package/features/graphqlClient/abstractions.js.map +1 -0
- package/features/graphqlClient/feature.d.ts +6 -0
- package/features/graphqlClient/feature.js +31 -0
- package/features/graphqlClient/feature.js.map +1 -0
- package/features/graphqlClient/index.d.ts +1 -0
- package/features/graphqlClient/index.js +3 -0
- package/features/graphqlClient/index.js.map +1 -0
- package/features/graphqlClient/types.d.ts +5 -0
- package/features/graphqlClient/types.js.map +1 -0
- package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
- package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
- package/features/localStorage/LocalStorage.d.ts +12 -0
- package/features/localStorage/LocalStorage.js +31 -0
- package/features/localStorage/LocalStorage.js.map +1 -0
- package/features/localStorage/LocalStorageRepository.d.ts +20 -0
- package/features/localStorage/LocalStorageRepository.js +95 -0
- package/features/localStorage/LocalStorageRepository.js.map +1 -0
- package/features/localStorage/abstractions.d.ts +48 -0
- package/features/localStorage/abstractions.js +19 -0
- package/features/localStorage/abstractions.js.map +1 -0
- package/features/localStorage/feature.d.ts +12 -0
- package/features/localStorage/feature.js +34 -0
- package/features/localStorage/feature.js.map +1 -0
- package/features/localStorage/index.d.ts +1 -0
- package/features/localStorage/index.js +3 -0
- package/features/localStorage/index.js.map +1 -0
- package/features/router/HistoryRouterGateway.d.ts +18 -0
- package/features/router/HistoryRouterGateway.js +82 -0
- package/features/router/HistoryRouterGateway.js.map +1 -0
- package/features/router/HistoryRouterGateway.test.d.ts +1 -0
- package/features/router/HistoryRouterGateway.test.js +204 -0
- package/features/router/HistoryRouterGateway.test.js.map +1 -0
- package/features/router/Route.d.ts +19 -0
- package/features/router/Route.js +59 -0
- package/features/router/Route.js.map +1 -0
- package/features/router/RouteUrl.d.ts +85 -0
- package/features/router/RouteUrl.js +232 -0
- package/features/router/RouteUrl.js.map +1 -0
- package/features/router/Router.d.ts +45 -0
- package/features/router/Router.js +129 -0
- package/features/router/Router.js.map +1 -0
- package/features/router/RouterPresenter.d.ts +17 -0
- package/features/router/RouterPresenter.js +45 -0
- package/features/router/RouterPresenter.js.map +1 -0
- package/features/router/RouterRepository.d.ts +21 -0
- package/features/router/RouterRepository.js +71 -0
- package/features/router/RouterRepository.js.map +1 -0
- package/features/router/RouterRepository.test.d.ts +1 -0
- package/features/router/RouterRepository.test.js +154 -0
- package/features/router/RouterRepository.test.js.map +1 -0
- package/features/router/abstractions.d.ts +68 -0
- package/features/router/abstractions.js +15 -0
- package/features/router/abstractions.js.map +1 -0
- package/features/router/feature.d.ts +4 -0
- package/features/router/feature.js +18 -0
- package/features/router/feature.js.map +1 -0
- package/features/router/index.d.ts +1 -0
- package/features/router/index.js +3 -0
- package/features/router/index.js.map +1 -0
- package/helpers/InterfaceGenerator/date.d.ts +15 -0
- package/helpers/InterfaceGenerator/date.js +3 -0
- package/helpers/InterfaceGenerator/date.js.map +1 -0
- package/helpers/InterfaceGenerator/id.d.ts +23 -0
- package/helpers/InterfaceGenerator/id.js +3 -0
- package/helpers/InterfaceGenerator/id.js.map +1 -0
- package/helpers/InterfaceGenerator/identity.d.ts +10 -0
- package/helpers/InterfaceGenerator/identity.js +3 -0
- package/helpers/InterfaceGenerator/identity.js.map +1 -0
- package/helpers/InterfaceGenerator/index.d.ts +5 -0
- package/helpers/InterfaceGenerator/index.js +3 -0
- package/helpers/InterfaceGenerator/index.js.map +1 -0
- package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
- package/helpers/InterfaceGenerator/numeric.js +3 -0
- package/helpers/InterfaceGenerator/numeric.js.map +1 -0
- package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
- package/helpers/InterfaceGenerator/truthful.js +3 -0
- package/helpers/InterfaceGenerator/truthful.js.map +1 -0
- package/hooks/useAutocomplete/index.d.ts +1 -1
- package/hooks/useAutocomplete/index.js +1 -1
- package/hooks/useAutocomplete/index.js.map +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +3 -6
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +1 -1
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +1 -1
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +1 -1
- 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 -3
- package/hooks/useDataList/functions/index.js.map +1 -1
- package/hooks/useDataList/index.d.ts +1 -1
- package/hooks/useDataList/index.js +1 -1
- package/hooks/useDataList/index.js.map +1 -1
- package/hooks/useDataList/useDataList.d.ts +0 -1
- package/hooks/useDataList/useDataList.js +6 -26
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.d.ts +1 -2
- package/hooks/useDataList/utils/index.js +1 -2
- package/hooks/useDataList/utils/index.js.map +1 -1
- package/hooks/useDataList/utils/prepareLoadListParams.js +1 -1
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
- package/hooks/useRegisterLegacyPlugin.js.map +1 -1
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +1 -1
- package/hooks/useUi.js.map +1 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +1 -1
- package/i18n/index.js.map +1 -1
- package/index.d.ts +22 -15
- package/index.js +21 -14
- package/index.js.map +1 -1
- package/package.json +25 -23
- package/plugins/AddQuerySelectionPlugin.d.ts +1 -1
- package/plugins/AddQuerySelectionPlugin.js +1 -1
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.d.ts +1 -1
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.d.ts +1 -1
- package/plugins/ConsoleLinkPlugin.js +1 -1
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +15 -26
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +3 -3
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +4 -13
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
- package/plugins/NetworkErrorLinkPlugin.js +47 -7
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +1 -1
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +2 -2
- package/plugins/TenantHeaderLinkPlugin.js +2 -4
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/components/Image.d.ts +6 -0
- package/plugins/components/Image.js +19 -0
- package/plugins/components/Image.js.map +1 -0
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +2 -2
- package/plugins/image.js.map +1 -1
- package/plugins/index.d.ts +3 -3
- package/plugins/index.js +1 -1
- package/plugins/index.js.map +1 -1
- package/presentation/localStorage/index.d.ts +3 -0
- package/presentation/localStorage/index.js +5 -0
- package/presentation/localStorage/index.js.map +1 -0
- package/presentation/localStorage/useLocalStorage.d.ts +6 -0
- package/presentation/localStorage/useLocalStorage.js +21 -0
- package/presentation/localStorage/useLocalStorage.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
- package/presentation/localStorage/useLocalStorageValue.js +20 -0
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
- package/presentation/localStorage/useLocalStorageValues.js +39 -0
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
- package/presentation/router/RouteElementRegistry.d.ts +14 -0
- package/presentation/router/RouteElementRegistry.js +32 -0
- package/presentation/router/RouteElementRegistry.js.map +1 -0
- package/presentation/router/abstractions.d.ts +13 -0
- package/presentation/router/abstractions.js +4 -0
- package/presentation/router/abstractions.js.map +1 -0
- package/presentation/router/components/Redirect.d.ts +14 -0
- package/presentation/router/components/Redirect.js +15 -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 +17 -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 +22 -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 +30 -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 +30 -0
- package/presentation/router/hooks/useRoute.js.map +1 -0
- package/presentation/router/hooks/useRouter.d.ts +7 -0
- package/presentation/router/hooks/useRouter.js +26 -0
- package/presentation/router/hooks/useRouter.js.map +1 -0
- package/presentation/router/index.d.ts +4 -0
- package/presentation/router/index.js +5 -0
- package/presentation/router/index.js.map +1 -0
- package/presentation/router/types.d.ts +5 -0
- package/presentation/router/types.js +3 -0
- package/presentation/router/types.js.map +1 -0
- package/react-butterfiles/Files.js +3 -3
- package/react-butterfiles/Files.js.map +1 -1
- package/react-butterfiles/file.todo +1 -0
- package/react-butterfiles/index.d.ts +1 -1
- package/react-butterfiles/index.js +1 -1
- package/react-butterfiles/index.js.map +1 -1
- package/router.d.ts +5 -0
- package/router.js +8 -0
- package/router.js.map +1 -0
- package/shared/di/DiContainerProvider.d.ts +8 -0
- package/shared/di/DiContainerProvider.js +17 -0
- package/shared/di/DiContainerProvider.js.map +1 -0
- package/shared/di/createFeature.d.ts +11 -0
- package/shared/di/createFeature.js +11 -0
- package/shared/di/createFeature.js.map +1 -0
- package/shared/di/useFeature.d.ts +2 -0
- package/shared/di/useFeature.js +18 -0
- package/shared/di/useFeature.js.map +1 -0
- package/types.d.ts +7 -4
- package/types.js +1 -12
- package/types.js.map +1 -1
- package/utils/index.d.ts +2 -10
- package/utils/index.js +2 -10
- package/utils/index.js.map +1 -1
- package/utils/legacyPluginToReactComponent.js +1 -1
- package/utils/legacyPluginToReactComponent.js.map +1 -1
- package/components/Routes.d.ts +0 -2
- package/components/Routes.js +0 -36
- package/components/Routes.js.map +0 -1
- package/components/View.d.ts +0 -8
- package/components/View.js +0 -19
- package/components/View.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 -6
- package/core/Routes.js +0 -34
- package/core/Routes.js.map +0 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -26
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
- package/hooks/useDataList/utils/types.d.ts +0 -40
- package/hooks/useDataList/utils/types.js.map +0 -1
- package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
- package/plugins/LocaleHeaderLinkPlugin.js +0 -32
- package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
- package/plugins/RoutePlugin.d.ts +0 -12
- package/plugins/RoutePlugin.js +0 -16
- package/plugins/RoutePlugin.js.map +0 -1
- package/plugins/ViewPlugin.d.ts +0 -14
- package/plugins/ViewPlugin.js +0 -19
- package/plugins/ViewPlugin.js.map +0 -1
- package/utils/getApiUrl.d.ts +0 -1
- package/utils/getApiUrl.js +0 -5
- package/utils/getApiUrl.js.map +0 -1
- package/utils/getGqlApiUrl.d.ts +0 -1
- package/utils/getGqlApiUrl.js +0 -6
- package/utils/getGqlApiUrl.js.map +0 -1
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
- package/utils/getHeadlessCmsGqlApiUrl.js +0 -12
- package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
- package/utils/getLocaleCode.d.ts +0 -6
- package/utils/getLocaleCode.js +0 -33
- package/utils/getLocaleCode.js.map +0 -1
- package/utils/getPrerenderId.d.ts +0 -6
- package/utils/getPrerenderId.js +0 -5
- package/utils/getPrerenderId.js.map +0 -1
- package/utils/getTenantId.d.ts +0 -6
- package/utils/getTenantId.js +0 -45
- package/utils/getTenantId.js.map +0 -1
- package/utils/isLocalhost.d.ts +0 -1
- package/utils/isLocalhost.js +0 -7
- package/utils/isLocalhost.js.map +0 -1
- package/utils/isPrerendering.d.ts +0 -1
- package/utils/isPrerendering.js +0 -5
- package/utils/isPrerendering.js.map +0 -1
- /package/{hooks/useDataList/utils → features/graphqlClient}/types.js +0 -0
package/App.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import type { GenericComponent, Decorator, DecoratorsCollection } from "@webiny/react-composition";
|
|
2
|
+
import { Decorator, DecoratorsCollection, GenericComponent } from "@webiny/react-composition";
|
|
4
3
|
interface State {
|
|
5
4
|
plugins: JSX.Element[];
|
|
6
5
|
providers: Decorator<GenericComponent<ProviderProps>>[];
|
|
@@ -12,8 +11,8 @@ interface AppContext extends State {
|
|
|
12
11
|
declare const AppContext: React.Context<AppContext | undefined>;
|
|
13
12
|
export declare const useApp: () => AppContext;
|
|
14
13
|
export interface AppProps {
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
routes?: Array<any>;
|
|
15
|
+
plugins?: any[];
|
|
17
16
|
providers?: Array<Decorator<GenericComponent<ProviderProps>>>;
|
|
18
17
|
decorators?: DecoratorsCollection;
|
|
19
18
|
children?: React.ReactNode | React.ReactNode[];
|
|
@@ -21,6 +20,6 @@ export interface AppProps {
|
|
|
21
20
|
interface ProviderProps {
|
|
22
21
|
children: React.ReactNode;
|
|
23
22
|
}
|
|
24
|
-
export declare const AppBase: ({
|
|
23
|
+
export declare const AppBase: React.MemoExoticComponent<({ routes, plugins, providers, children }: AppProps) => React.JSX.Element>;
|
|
25
24
|
export declare const App: ({ decorators, ...props }: AppProps) => React.JSX.Element;
|
|
26
25
|
export {};
|
package/App.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React, { createContext, useContext, useMemo, useState
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { AppContainer } from "./AppContainer";
|
|
1
|
+
import React, { createContext, Fragment, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { compose, CompositionProvider } from "@webiny/react-composition";
|
|
3
|
+
import { PluginsProvider } from "./core/Plugins.js";
|
|
4
|
+
import { RouterWithConfig, useRouterConfig } from "./config/RouterConfig.js";
|
|
5
|
+
import { AppContainer } from "./AppContainer.js";
|
|
6
|
+
import { RouteContent } from "./presentation/router/components/RouteContent.js";
|
|
7
|
+
import { useRouter } from "./router.js";
|
|
9
8
|
const AppContext = /*#__PURE__*/createContext(undefined);
|
|
10
9
|
AppContext.displayName = "AppContext";
|
|
11
10
|
export const useApp = () => {
|
|
@@ -15,14 +14,14 @@ export const useApp = () => {
|
|
|
15
14
|
}
|
|
16
15
|
return appContext;
|
|
17
16
|
};
|
|
18
|
-
export const AppBase = ({
|
|
19
|
-
debounceRender = 50,
|
|
17
|
+
export const AppBase = /*#__PURE__*/React.memo(({
|
|
20
18
|
routes = [],
|
|
19
|
+
plugins = [],
|
|
21
20
|
providers = [],
|
|
22
21
|
children
|
|
23
22
|
}) => {
|
|
24
23
|
const [state, setState] = useState({
|
|
25
|
-
plugins
|
|
24
|
+
plugins,
|
|
26
25
|
providers
|
|
27
26
|
});
|
|
28
27
|
const addProvider = useCallback(component => {
|
|
@@ -51,36 +50,31 @@ export const AppBase = ({
|
|
|
51
50
|
}), [state]);
|
|
52
51
|
const AppRouter = useMemo(() => {
|
|
53
52
|
return function AppRouter() {
|
|
53
|
+
const router = useRouter();
|
|
54
54
|
const routerConfig = useRouterConfig();
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
return /*#__PURE__*/React.createElement(SortRoutes, {
|
|
63
|
-
key: routes.length,
|
|
64
|
-
routes: combinedRoutes
|
|
65
|
-
});
|
|
55
|
+
const routesFromConfig = routerConfig.routes;
|
|
56
|
+
const combinedRoutes = [...routes, ...routesFromConfig];
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
router.setRoutes(combinedRoutes);
|
|
59
|
+
}, [combinedRoutes.length]);
|
|
60
|
+
return null;
|
|
66
61
|
};
|
|
67
|
-
}, [
|
|
62
|
+
}, []);
|
|
68
63
|
const Providers = useMemo(() => {
|
|
69
|
-
return compose(...(state.providers || []))(({
|
|
64
|
+
return /*#__PURE__*/React.memo(compose(...(state.providers || []))(({
|
|
70
65
|
children
|
|
71
66
|
}) => {
|
|
72
|
-
return /*#__PURE__*/React.createElement(
|
|
73
|
-
|
|
74
|
-
}, children);
|
|
75
|
-
});
|
|
67
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
68
|
+
}));
|
|
76
69
|
}, [state.providers.length]);
|
|
77
70
|
Providers.displayName = "Providers";
|
|
78
71
|
return /*#__PURE__*/React.createElement(AppContext.Provider, {
|
|
79
72
|
value: appContext
|
|
80
|
-
}, children, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(
|
|
81
|
-
|
|
82
|
-
}, /*#__PURE__*/React.createElement(RouterWithConfig, null, /*#__PURE__*/React.createElement(AppRouter, null))))))
|
|
83
|
-
};
|
|
73
|
+
}, 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, {
|
|
74
|
+
key: index
|
|
75
|
+
}, plugin))), /*#__PURE__*/React.createElement(RouterWithConfig, null, /*#__PURE__*/React.createElement(AppRouter, null), /*#__PURE__*/React.createElement(RouteContent, null)))));
|
|
76
|
+
});
|
|
77
|
+
AppBase.displayName = "AppBase";
|
|
84
78
|
export const App = ({
|
|
85
79
|
decorators,
|
|
86
80
|
...props
|
package/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","
|
|
1
|
+
{"version":3,"names":["React","createContext","Fragment","useCallback","useContext","useEffect","useMemo","useState","compose","CompositionProvider","PluginsProvider","RouterWithConfig","useRouterConfig","AppContainer","RouteContent","useRouter","AppContext","undefined","displayName","useApp","appContext","Error","AppBase","memo","routes","plugins","providers","children","state","setState","addProvider","component","findIndex","m","addPlugin","element","AppRouter","router","routerConfig","routesFromConfig","combinedRoutes","setRoutes","length","Providers","createElement","Provider","value","map","plugin","index","key","App","decorators","props","Object","assign"],"sources":["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: 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: 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"],"mappings":"AAAA,OAAOA,KAAK,IACRC,aAAa,EACbC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SACIC,OAAO,EACPC,mBAAmB,QAIhB,2BAA2B;AAClC,SAASC,eAAe;AACxB,SAASC,gBAAgB,EAAEC,eAAe;AAC1C,SAASC,YAAY;AACrB,SAASC,YAAY;AACrB,SAASC,SAAS;AAYlB,MAAMC,UAAU,gBAAGf,aAAa,CAAyBgB,SAAS,CAAC;AAEnED,UAAU,CAACE,WAAW,GAAG,YAAY;AAErC,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EACxB,MAAMC,UAAU,GAAGhB,UAAU,CAACY,UAAU,CAAC;EACzC,IAAI,CAACI,UAAU,EAAE;IACb,MAAMC,KAAK,CACP,0FACJ,CAAC;EACL;EACA,OAAOD,UAAU;AACrB,CAAC;AAgBD,OAAO,MAAME,OAAO,gBAAGtB,KAAK,CAACuB,IAAI,CAC7B,CAAC;EAAEC,MAAM,GAAG,EAAE;EAAEC,OAAO,GAAG,EAAE;EAAEC,SAAS,GAAG,EAAE;EAAEC;AAAmB,CAAC,KAAK;EACnE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGtB,QAAQ,CAAQ;IACtCkB,OAAO;IACPC;EACJ,CAAC,CAAC;EAEF,MAAMI,WAAW,GAAG3B,WAAW,CAAE4B,SAAyB,IAAK;IAC3DF,QAAQ,CAACD,KAAK,IAAI;MACd,IAAIA,KAAK,CAACF,SAAS,CAACM,SAAS,CAACC,CAAC,IAAIA,CAAC,KAAKF,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE;QACtD,OAAOH,KAAK;MAChB;MAEA,OAAO;QACH,GAAGA,KAAK;QACRF,SAAS,EAAE,CAAC,GAAGE,KAAK,CAACF,SAAS,EAAEK,SAAS;MAC7C,CAAC;IACL,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMG,SAAS,GAAG/B,WAAW,CAAEgC,OAAoB,IAAK;IACpDN,QAAQ,CAACD,KAAK,IAAI;MACd,OAAO;QACH,GAAGA,KAAK;QACRH,OAAO,EAAE,CAAC,GAAGG,KAAK,CAACH,OAAO,EAAEU,OAAO;MACvC,CAAC;IACL,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMf,UAAU,GAAGd,OAAO,CACtB,OAAO;IACH,GAAGsB,KAAK;IACRE,WAAW;IACXI;EACJ,CAAC,CAAC,EACF,CAACN,KAAK,CACV,CAAC;EAED,MAAMQ,SAAS,GAAG9B,OAAO,CAAC,MAAM;IAC5B,OAAO,SAAS8B,SAASA,CAAA,EAAG;MACxB,MAAMC,MAAM,GAAGtB,SAAS,CAAC,CAAC;MAC1B,MAAMuB,YAAY,GAAG1B,eAAe,CAAC,CAAC;MACtC,MAAM2B,gBAAgB,GAAGD,YAAY,CAACd,MAAM;MAC5C,MAAMgB,cAAc,GAAG,CAAC,GAAGhB,MAAM,EAAE,GAAGe,gBAAgB,CAAC;MAEvDlC,SAAS,CAAC,MAAM;QACZgC,MAAM,CAACI,SAAS,CAACD,cAAc,CAAC;MACpC,CAAC,EAAE,CAACA,cAAc,CAACE,MAAM,CAAC,CAAC;MAE3B,OAAO,IAAI;IACf,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,SAAS,GAAGrC,OAAO,CAAC,MAAM;IAC5B,oBAAON,KAAK,CAACuB,IAAI,CACbf,OAAO,CAAC,IAAIoB,KAAK,CAACF,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;MAAEC;IAAwB,CAAC,KAAK;MACjE,oBAAO3B,KAAA,CAAA4C,aAAA,CAAA5C,KAAA,CAAAE,QAAA,QAAGyB,QAAW,CAAC;IAC1B,CAAC,CACL,CAAC;EACL,CAAC,EAAE,CAACC,KAAK,CAACF,SAAS,CAACgB,MAAM,CAAC,CAA0B;EAErDC,SAAS,CAACzB,WAAW,GAAG,WAAW;EAEnC,oBACIlB,KAAA,CAAA4C,aAAA,CAAC5B,UAAU,CAAC6B,QAAQ;IAACC,KAAK,EAAE1B;EAAW,GAClCO,QAAQ,eACT3B,KAAA,CAAA4C,aAAA,CAAC/B,YAAY,qBACTb,KAAA,CAAA4C,aAAA,CAACD,SAAS,qBACN3C,KAAA,CAAA4C,aAAA,CAAClC,eAAe,QACXkB,KAAK,CAACH,OAAO,CAACsB,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,kBAC7BjD,KAAA,CAAA4C,aAAA,CAAC1C,QAAQ;IAACgD,GAAG,EAAED;EAAM,GAAED,MAAiB,CAC3C,CACY,CAAC,eAClBhD,KAAA,CAAA4C,aAAA,CAACjC,gBAAgB,qBACbX,KAAA,CAAA4C,aAAA,CAACR,SAAS,MAAE,CAAC,eACbpC,KAAA,CAAA4C,aAAA,CAAC9B,YAAY,MAAE,CACD,CACX,CACD,CACG,CAAC;AAE9B,CACJ,CAAC;AAEDQ,OAAO,CAACJ,WAAW,GAAG,SAAS;AAE/B,OAAO,MAAMiC,GAAG,GAAGA,CAAC;EAAEC,UAAU;EAAE,GAAGC;AAAgB,CAAC,KAAK;EACvD,oBACIrD,KAAA,CAAA4C,aAAA,CAACnC,mBAAmB;IAAC2C,UAAU,EAAEA;EAAW,gBACxCpD,KAAA,CAAA4C,aAAA,CAACtB,OAAO,EAAAgC,MAAA,CAAAC,MAAA;IAACH,UAAU,EAAEA;EAAW,GAAKC,KAAK,CAAG,CAC5B,CAAC;AAE9B,CAAC","ignoreList":[]}
|
package/README.md
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
# @webiny/app
|
|
2
|
-
[](https://www.npmjs.com/package/@webiny/app)
|
|
3
|
-
[](https://www.npmjs.com/package/@webiny/app)
|
|
4
|
-
[](https://github.com/prettier/prettier)
|
|
5
|
-
[](http://makeapullrequest.com)
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
```
|
|
13
|
-
npm install --save @webiny/app
|
|
14
|
-
```
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InMemoryCache as BaseInMemoryCache } from "apollo-cache-inmemory";
|
|
2
2
|
import { plugins } from "@webiny/plugins";
|
|
3
|
-
import { AddQuerySelectionPlugin } from "../plugins/AddQuerySelectionPlugin";
|
|
4
|
-
import { ApolloLinkPlugin } from "../plugins/ApolloLinkPlugin";
|
|
3
|
+
import { AddQuerySelectionPlugin } from "../plugins/AddQuerySelectionPlugin.js";
|
|
4
|
+
import { ApolloLinkPlugin } from "../plugins/ApolloLinkPlugin.js";
|
|
5
5
|
export class InMemoryCache extends BaseInMemoryCache {
|
|
6
6
|
constructor(config) {
|
|
7
7
|
super(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InMemoryCache","BaseInMemoryCache","plugins","AddQuerySelectionPlugin","ApolloLinkPlugin","constructor","config","transformPlugins","byType","type","filter","pl","transformDocument","document","operationName","definitions","name","value","addSelectionToQuery"],"sources":["InMemoryCache.ts"],"sourcesContent":["import type { InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { InMemoryCache as BaseInMemoryCache } from \"apollo-cache-inmemory\";\nimport type { DocumentNode } from \"graphql\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AddQuerySelectionPlugin } from \"../plugins/AddQuerySelectionPlugin\";\nimport { ApolloLinkPlugin } from \"../plugins/ApolloLinkPlugin\";\n\nexport class InMemoryCache extends BaseInMemoryCache {\n private readonly transformPlugins: AddQuerySelectionPlugin[];\n\n constructor(config?: InMemoryCacheConfig) {\n super(config);\n\n this.transformPlugins = plugins\n .byType<AddQuerySelectionPlugin>(ApolloLinkPlugin.type)\n .filter(pl => pl instanceof AddQuerySelectionPlugin);\n }\n\n public override transformDocument(document: DocumentNode): DocumentNode {\n // @ts-expect-error\n const operationName = document.definitions[0].name.value;\n\n for (const pl of this.transformPlugins) {\n pl.addSelectionToQuery(operationName, document);\n }\n\n return super.transformDocument(document);\n }\n}\n"],"mappings":"AACA,SAASA,aAAa,IAAIC,iBAAiB,QAAQ,uBAAuB;AAE1E,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAEzB,OAAO,MAAMJ,aAAa,SAASC,iBAAiB,CAAC;EAGjDI,WAAWA,CAACC,MAA4B,EAAE;IACtC,KAAK,CAACA,MAAM,CAAC;IAEb,IAAI,CAACC,gBAAgB,GAAGL,OAAO,CAC1BM,MAAM,CAA0BJ,gBAAgB,CAACK,IAAI,CAAC,CACtDC,MAAM,CAACC,EAAE,IAAIA,EAAE,YAAYR,uBAAuB,CAAC;EAC5D;EAEgBS,iBAAiBA,CAACC,QAAsB,EAAgB;IACpE;IACA,MAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,KAAK;IAExD,KAAK,MAAMN,EAAE,IAAI,IAAI,CAACJ,gBAAgB,EAAE;MACpCI,EAAE,CAACO,mBAAmB,CAACJ,aAAa,EAAED,QAAQ,CAAC;IACnD;IAEA,OAAO,KAAK,CAACD,iBAAiB,CAACC,QAAQ,CAAC;EAC5C;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["InMemoryCache","BaseInMemoryCache","plugins","AddQuerySelectionPlugin","ApolloLinkPlugin","constructor","config","transformPlugins","byType","type","filter","pl","transformDocument","document","operationName","definitions","name","value","addSelectionToQuery"],"sources":["InMemoryCache.ts"],"sourcesContent":["import type { InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { InMemoryCache as BaseInMemoryCache } from \"apollo-cache-inmemory\";\nimport type { DocumentNode } from \"graphql\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AddQuerySelectionPlugin } from \"../plugins/AddQuerySelectionPlugin.js\";\nimport { ApolloLinkPlugin } from \"../plugins/ApolloLinkPlugin.js\";\n\nexport class InMemoryCache extends BaseInMemoryCache {\n private readonly transformPlugins: AddQuerySelectionPlugin[];\n\n constructor(config?: InMemoryCacheConfig) {\n super(config);\n\n this.transformPlugins = plugins\n .byType<AddQuerySelectionPlugin>(ApolloLinkPlugin.type)\n .filter(pl => pl instanceof AddQuerySelectionPlugin);\n }\n\n public override transformDocument(document: DocumentNode): DocumentNode {\n // @ts-expect-error\n const operationName = document.definitions[0].name.value;\n\n for (const pl of this.transformPlugins) {\n pl.addSelectionToQuery(operationName, document);\n }\n\n return super.transformDocument(document);\n }\n}\n"],"mappings":"AACA,SAASA,aAAa,IAAIC,iBAAiB,QAAQ,uBAAuB;AAE1E,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAEzB,OAAO,MAAMJ,aAAa,SAASC,iBAAiB,CAAC;EAGjDI,WAAWA,CAACC,MAA4B,EAAE;IACtC,KAAK,CAACA,MAAM,CAAC;IAEb,IAAI,CAACC,gBAAgB,GAAGL,OAAO,CAC1BM,MAAM,CAA0BJ,gBAAgB,CAACK,IAAI,CAAC,CACtDC,MAAM,CAACC,EAAE,IAAIA,EAAE,YAAYR,uBAAuB,CAAC;EAC5D;EAEgBS,iBAAiBA,CAACC,QAAsB,EAAgB;IACpE;IACA,MAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,KAAK;IAExD,KAAK,MAAMN,EAAE,IAAI,IAAI,CAACJ,gBAAgB,EAAE;MACpCI,EAAE,CAACO,mBAAmB,CAACJ,aAAa,EAAED,QAAQ,CAAC;IACnD;IAEA,OAAO,KAAK,CAACD,iBAAiB,CAACC,QAAQ,CAAC;EAC5C;AACJ","ignoreList":[]}
|
package/components/Image.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ImageProps } from "../types";
|
|
1
|
+
import type { ImageProps } from "../types.js";
|
|
3
2
|
export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
package/components/Image.js
CHANGED
package/components/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get\";\nimport type { ImageComponentPlugin, ImageProps } from \"~/types\";\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"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,
|
|
1
|
+
{"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["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"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,eAAe;AAG/B,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,MAAM,EAAEC,UAAU;EAAE,GAAGC;AAAkB,CAAC,KAAK;EACnE,MAAMC,MAAM,GAAGN,OAAO,CAACO,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,8DAA8D,CAAC;EACnF;EAEA,IAAIJ,UAAU,EAAE;IACZ,MAAMD,MAAM,GAAGF,GAAG,CAACK,MAAM,EAAE,WAAWF,UAAU,EAAE,CAAC;IACnDL,SAAS,CAACI,MAAM,EAAE,qBAAqBC,UAAU,cAAc,CAAC;IAChEC,KAAK,CAACI,SAAS,GAAGN,MAAM;EAC5B;EAEA,IAAIE,KAAK,CAACI,SAAS,EAAE;IACjBJ,KAAK,CAACK,GAAG,GAAGJ,MAAM,CAACK,WAAW,CAACN,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACM,MAAM,CAACP,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
|
package/components/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { Image } from "./Image";
|
|
2
|
-
export { Routes } from "./Routes";
|
|
1
|
+
export { Image } from "./Image.js";
|
package/components/index.js
CHANGED
package/components/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Image"
|
|
1
|
+
{"version":3,"names":["Image"],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image.js\";\n"],"mappings":"AAAA,SAASA,KAAK","ignoreList":[]}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { Route as BaseRoute } from "../../router.js";
|
|
2
3
|
export interface RouteProps {
|
|
3
|
-
|
|
4
|
-
path: string;
|
|
5
|
-
exact?: boolean;
|
|
4
|
+
route: BaseRoute<any>;
|
|
6
5
|
element: React.ReactElement;
|
|
7
6
|
remove?: boolean;
|
|
8
7
|
before?: string;
|
|
9
8
|
after?: string;
|
|
10
9
|
}
|
|
11
|
-
export type RouteConfig = Pick<RouteProps, "
|
|
12
|
-
export declare const Route: (({
|
|
13
|
-
original: ({
|
|
10
|
+
export type RouteConfig = Pick<RouteProps, "route" | "element">;
|
|
11
|
+
export declare const Route: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
|
|
12
|
+
original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
|
|
14
13
|
originalName: string;
|
|
15
14
|
displayName: string;
|
|
16
15
|
} & {
|
|
17
|
-
original: (({
|
|
18
|
-
original: ({
|
|
16
|
+
original: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
|
|
17
|
+
original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
|
|
19
18
|
originalName: string;
|
|
20
19
|
displayName: string;
|
|
21
20
|
};
|
|
22
21
|
originalName: string;
|
|
23
22
|
displayName: string;
|
|
24
23
|
} & {
|
|
25
|
-
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({
|
|
26
|
-
original: ({
|
|
24
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
|
|
25
|
+
original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
|
|
27
26
|
originalName: string;
|
|
28
27
|
displayName: string;
|
|
29
28
|
}>) => (props: unknown) => React.JSX.Element;
|
|
@@ -2,14 +2,13 @@ import React from "react";
|
|
|
2
2
|
import { makeDecoratable } from "@webiny/react-composition";
|
|
3
3
|
import { Property, useIdGenerator } from "@webiny/react-properties";
|
|
4
4
|
export const Route = makeDecoratable("Route", ({
|
|
5
|
-
|
|
6
|
-
path,
|
|
5
|
+
route,
|
|
7
6
|
element,
|
|
8
|
-
exact,
|
|
9
7
|
remove,
|
|
10
8
|
before,
|
|
11
9
|
after
|
|
12
10
|
}) => {
|
|
11
|
+
const name = route.name;
|
|
13
12
|
const getId = useIdGenerator("Route");
|
|
14
13
|
const placeAfter = after !== undefined ? getId(after) : undefined;
|
|
15
14
|
const placeBefore = before !== undefined ? getId(before) : undefined;
|
|
@@ -21,17 +20,9 @@ export const Route = makeDecoratable("Route", ({
|
|
|
21
20
|
before: placeBefore,
|
|
22
21
|
after: placeAfter
|
|
23
22
|
}, /*#__PURE__*/React.createElement(Property, {
|
|
24
|
-
id: getId(name, "
|
|
25
|
-
name: "
|
|
26
|
-
value:
|
|
27
|
-
}), /*#__PURE__*/React.createElement(Property, {
|
|
28
|
-
id: getId(name, "path"),
|
|
29
|
-
name: "path",
|
|
30
|
-
value: path
|
|
31
|
-
}), /*#__PURE__*/React.createElement(Property, {
|
|
32
|
-
id: getId(name, "exact"),
|
|
33
|
-
name: "exact",
|
|
34
|
-
value: exact
|
|
23
|
+
id: getId(name, "route"),
|
|
24
|
+
name: "route",
|
|
25
|
+
value: route
|
|
35
26
|
}), /*#__PURE__*/React.createElement(Property, {
|
|
36
27
|
id: getId(name, "element"),
|
|
37
28
|
name: "element",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","makeDecoratable","Property","useIdGenerator","Route","
|
|
1
|
+
{"version":3,"names":["React","makeDecoratable","Property","useIdGenerator","Route","route","element","remove","before","after","name","getId","placeAfter","undefined","placeBefore","createElement","id","array","value"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,QAAQ,EAAEC,cAAc,QAAQ,0BAA0B;AAanE,OAAO,MAAMC,KAAK,GAAGH,eAAe,CAChC,OAAO,EACP,CAAC;EAAEI,KAAK;EAAEC,OAAO;EAAEC,MAAM;EAAEC,MAAM;EAAEC;AAAkB,CAAC,KAAK;EACvD,MAAMC,IAAI,GAAGL,KAAK,CAACK,IAAI;EAEvB,MAAMC,KAAK,GAAGR,cAAc,CAAC,OAAO,CAAC;EAErC,MAAMS,UAAU,GAAGH,KAAK,KAAKI,SAAS,GAAGF,KAAK,CAACF,KAAK,CAAC,GAAGI,SAAS;EACjE,MAAMC,WAAW,GAAGN,MAAM,KAAKK,SAAS,GAAGF,KAAK,CAACH,MAAM,CAAC,GAAGK,SAAS;EAEpE,oBACIb,KAAA,CAAAe,aAAA,CAACb,QAAQ;IACLc,EAAE,EAAEL,KAAK,CAACD,IAAI,CAAE;IAChBA,IAAI,EAAE,QAAS;IACfH,MAAM,EAAEA,MAAO;IACfU,KAAK,EAAE,IAAK;IACZT,MAAM,EAAEM,WAAY;IACpBL,KAAK,EAAEG;EAAW,gBAElBZ,KAAA,CAAAe,aAAA,CAACb,QAAQ;IAACc,EAAE,EAAEL,KAAK,CAACD,IAAI,EAAE,OAAO,CAAE;IAACA,IAAI,EAAE,OAAQ;IAACQ,KAAK,EAAEb;EAAM,CAAE,CAAC,eACnEL,KAAA,CAAAe,aAAA,CAACb,QAAQ;IAACc,EAAE,EAAEL,KAAK,CAACD,IAAI,EAAE,SAAS,CAAE;IAACA,IAAI,EAAE,SAAU;IAACQ,KAAK,EAAEZ;EAAQ,CAAE,CAClE,CAAC;AAEnB,CACJ,CAAC","ignoreList":[]}
|
package/config/RouterConfig.d.ts
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const RouterWithConfig: (({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => import("react").JSX.Element) & {
|
|
1
|
+
import { type RouteConfig } from "./RouterConfig/Route.js";
|
|
2
|
+
export declare const RouterWithConfig: (({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element) & {
|
|
4
3
|
displayName: string;
|
|
5
4
|
};
|
|
6
5
|
export declare const useRouterConfig: () => {
|
|
7
6
|
routes: RouteConfig[];
|
|
8
7
|
};
|
|
9
|
-
export declare const RouterConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) =>
|
|
10
|
-
Route: (({
|
|
11
|
-
original: ({
|
|
8
|
+
export declare const RouterConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => React.JSX.Element) & {
|
|
9
|
+
Route: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
|
|
10
|
+
original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
|
|
12
11
|
originalName: string;
|
|
13
12
|
displayName: string;
|
|
14
13
|
} & {
|
|
15
|
-
original: (({
|
|
16
|
-
original: ({
|
|
14
|
+
original: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
|
|
15
|
+
original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
|
|
17
16
|
originalName: string;
|
|
18
17
|
displayName: string;
|
|
19
18
|
};
|
|
20
19
|
originalName: string;
|
|
21
20
|
displayName: string;
|
|
22
21
|
} & {
|
|
23
|
-
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({
|
|
24
|
-
original: ({
|
|
22
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
|
|
23
|
+
original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
|
|
25
24
|
originalName: string;
|
|
26
25
|
displayName: string;
|
|
27
|
-
}>) => (props: unknown) =>
|
|
26
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
28
27
|
};
|
|
29
28
|
useRouterConfig: () => {
|
|
30
29
|
routes: RouteConfig[];
|
package/config/RouterConfig.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createConfigurableComponent } from "@webiny/react-properties";
|
|
2
|
-
import { Route } from "./RouterConfig/Route";
|
|
2
|
+
import { Route } from "./RouterConfig/Route.js";
|
|
3
3
|
const base = createConfigurableComponent("RouterConfig");
|
|
4
4
|
export const RouterWithConfig = Object.assign(base.WithConfig, {
|
|
5
5
|
displayName: "RouterWithConfig"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createConfigurableComponent","Route","base","RouterWithConfig","Object","assign","WithConfig","displayName","useRouterConfig","baseConfig","useConfig","routes","RouterConfig","Config"],"sources":["RouterConfig.tsx"],"sourcesContent":["import { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Route, type RouteConfig } from \"./RouterConfig/Route\";\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"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,KAAK;AAEd,MAAMC,IAAI,GAAGF,2BAA2B,CAAe,cAAc,CAAC;AAEtE,OAAO,MAAMG,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAI,CAACI,UAAU,EAAE;EAC3DC,WAAW,EAAE;AACjB,CAAC,CAAC;AAMF,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACjC,MAAMC,UAAU,GAAGP,IAAI,CAACQ,SAAS,CAAC,CAAC;EAEnC,OAAO;IACHC,MAAM,EAAEF,UAAU,CAACE,MAAM,IAAI;EACjC,CAAC;AACL,CAAC;AAED,OAAO,MAAMC,YAAY,GAAGR,MAAM,CAACC,MAAM,CAACH,IAAI,CAACW,MAAM,EAAE;EACnDZ,KAAK;EACLO;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["createConfigurableComponent","Route","base","RouterWithConfig","Object","assign","WithConfig","displayName","useRouterConfig","baseConfig","useConfig","routes","RouterConfig","Config"],"sources":["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"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,KAAK;AAEd,MAAMC,IAAI,GAAGF,2BAA2B,CAAe,cAAc,CAAC;AAEtE,OAAO,MAAMG,gBAAgB,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAI,CAACI,UAAU,EAAE;EAC3DC,WAAW,EAAE;AACjB,CAAC,CAAC;AAMF,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM;EACjC,MAAMC,UAAU,GAAGP,IAAI,CAACQ,SAAS,CAAC,CAAC;EAEnC,OAAO;IACHC,MAAM,EAAEF,UAAU,CAACE,MAAM,IAAI;EACjC,CAAC;AACL,CAAC;AAED,OAAO,MAAMC,YAAY,GAAGR,MAAM,CAACC,MAAM,CAACH,IAAI,CAACW,MAAM,EAAE;EACnDZ,KAAK;EACLO;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/contexts/Ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","plugins","UiContext","createContext","UiProvider","Component","state","ui","setData","setter","setState","render","value","uiStatePlugins","byType","createElement","Provider","map","pl","cloneElement","key","name","props","children"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { UiStatePlugin } from \"~/types\";\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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAO,MAAMC,SAAS,gBAAGF,KAAK,CAACG,aAAa,CAAsB,CAAC,CAAC,CAAC;AAqBrE,OAAO,MAAMC,UAAU,SAASJ,KAAK,CAACK,SAAS,CAAe;EAC1CC,KAAK,GAAU;IAC3BC,EAAE,EAAE,CAAC;EACT,CAAC;EAEgBC,OAAO,GAAIC,MAAoB,IAAW;IACvD,OAAO,IAAI,CAACC,QAAQ,CAAEJ,KAAY,IAAK;MACnC,OAAO;QAAEC,EAAE,EAAE;UAAE,GAAGD,KAAK,CAACC,EAAE;UAAE,GAAGE,MAAM,CAACH,KAAK,CAACC,EAAE;QAAE;MAAE,CAAC;IACvD,CAAC,CAAC;EACN,CAAC;EAEeI,MAAMA,CAAA,EAAG;IACrB,MAAMC,KAAqB,GAAG;MAAE,GAAG,IAAI,CAACN,KAAK,CAACC,EAAE;MAAEG,QAAQ,EAAE,IAAI,CAACF;IAAQ,CAAC;IAC1E,MAAMK,cAAc,GAAGZ,OAAO,CAACa,MAAM,CAAgB,UAAU,CAAC;IAChE,oBACId,KAAA,CAAAe,aAAA,CAACb,SAAS,CAACc,QAAQ;MAACJ,KAAK,EAAEA;IAAM,GAC5BC,cAAc,CAACI,GAAG,CAACC,EAAE,iBAAIlB,KAAK,CAACmB,YAAY,CAACD,EAAE,CAACP,MAAM,CAAC,CAAC,EAAE;MAAES,GAAG,EAAEF,EAAE,CAACG;IAAK,CAAC,CAAC,CAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QACI,CAAC;EAE7B;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","plugins","UiContext","createContext","UiProvider","Component","state","ui","setData","setter","setState","render","value","uiStatePlugins","byType","createElement","Provider","map","pl","cloneElement","key","name","props","children"],"sources":["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"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,QAAQ,iBAAiB;AAEzC,OAAO,MAAMC,SAAS,gBAAGF,KAAK,CAACG,aAAa,CAAsB,CAAC,CAAC,CAAC;AAqBrE,OAAO,MAAMC,UAAU,SAASJ,KAAK,CAACK,SAAS,CAAe;EAC1CC,KAAK,GAAU;IAC3BC,EAAE,EAAE,CAAC;EACT,CAAC;EAEgBC,OAAO,GAAIC,MAAoB,IAAW;IACvD,OAAO,IAAI,CAACC,QAAQ,CAAEJ,KAAY,IAAK;MACnC,OAAO;QAAEC,EAAE,EAAE;UAAE,GAAGD,KAAK,CAACC,EAAE;UAAE,GAAGE,MAAM,CAACH,KAAK,CAACC,EAAE;QAAE;MAAE,CAAC;IACvD,CAAC,CAAC;EACN,CAAC;EAEeI,MAAMA,CAAA,EAAG;IACrB,MAAMC,KAAqB,GAAG;MAAE,GAAG,IAAI,CAACN,KAAK,CAACC,EAAE;MAAEG,QAAQ,EAAE,IAAI,CAACF;IAAQ,CAAC;IAC1E,MAAMK,cAAc,GAAGZ,OAAO,CAACa,MAAM,CAAgB,UAAU,CAAC;IAChE,oBACId,KAAA,CAAAe,aAAA,CAACb,SAAS,CAACc,QAAQ;MAACJ,KAAK,EAAEA;IAAM,GAC5BC,cAAc,CAACI,GAAG,CAACC,EAAE,iBAAIlB,KAAK,CAACmB,YAAY,CAACD,EAAE,CAACP,MAAM,CAAC,CAAC,EAAE;MAAES,GAAG,EAAEF,EAAE,CAACG;IAAK,CAAC,CAAC,CAAC,EAC3E,IAAI,CAACC,KAAK,CAACC,QACI,CAAC;EAE7B;AACJ","ignoreList":[]}
|
package/core/Plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Provider } from "./Provider";
|
|
3
|
-
import { Plugins } from "./Plugins";
|
|
2
|
+
import { Provider } from "./Provider.js";
|
|
3
|
+
import { Plugins } from "./Plugins.js";
|
|
4
4
|
export const Plugin = /*#__PURE__*/React.memo(function Plugin({
|
|
5
5
|
providers,
|
|
6
6
|
children
|
package/core/Plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Provider","Plugins","Plugin","memo","providers","children","createElement","Fragment","map","provider","index","key","hoc"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,SAASC,OAAO;AAQhB,OAAO,MAAMC,MAAM,gBAAGH,KAAK,CAACI,IAAI,CAAC,SAASD,MAAMA,CAAC;EAAEE,SAAS;EAAEC;AAAsB,CAAC,EAAE;EACnF,oBACIN,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACK,CAACH,SAAS,IAAI,EAAE,EAAEI,GAAG,CAAC,CAACC,QAAQ,EAAEC,KAAK,kBACnCX,KAAA,CAAAO,aAAA,CAACN,QAAQ;IAACW,GAAG,EAAED,KAAM;IAACE,GAAG,EAAEH;EAAS,CAAE,CACzC,CAAC,EACDJ,QAAQ,gBAAGN,KAAA,CAAAO,aAAA,CAACL,OAAO,QAAEI,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","Provider","Plugins","Plugin","memo","providers","children","createElement","Fragment","map","provider","index","key","hoc"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider.js\";\nimport { Plugins } from \"./Plugins.js\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ;AACjB,SAASC,OAAO;AAQhB,OAAO,MAAMC,MAAM,gBAAGH,KAAK,CAACI,IAAI,CAAC,SAASD,MAAMA,CAAC;EAAEE,SAAS;EAAEC;AAAsB,CAAC,EAAE;EACnF,oBACIN,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACK,CAACH,SAAS,IAAI,EAAE,EAAEI,GAAG,CAAC,CAACC,QAAQ,EAAEC,KAAK,kBACnCX,KAAA,CAAAO,aAAA,CAACN,QAAQ;IAACW,GAAG,EAAED,KAAM;IAACE,GAAG,EAAEH;EAAS,CAAE,CACzC,CAAC,EACDJ,QAAQ,gBAAGN,KAAA,CAAAO,aAAA,CAACL,OAAO,QAAEI,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
package/core/Plugins.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export declare const PluginsProvider: React.MemoExoticComponent<({ children }: P
|
|
|
11
11
|
interface PluginsComponentsProps {
|
|
12
12
|
children: React.ReactNode;
|
|
13
13
|
}
|
|
14
|
-
export declare const Plugins: ({ children }: PluginsComponentsProps) => React.JSX.Element | null
|
|
14
|
+
export declare const Plugins: React.MemoExoticComponent<({ children }: PluginsComponentsProps) => React.JSX.Element | null>;
|
|
15
15
|
export {};
|
package/core/Plugins.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { useApp } from "../App";
|
|
1
|
+
import React, { Children, createContext, Fragment, memo, useContext, useEffect } from "react";
|
|
2
|
+
import { useApp } from "../App.js";
|
|
3
3
|
export const PluginsContext = /*#__PURE__*/createContext(false);
|
|
4
4
|
PluginsContext.displayName = "PluginsContext";
|
|
5
5
|
const PluginsProviderComponent = ({
|
|
@@ -20,7 +20,7 @@ export const PluginsProvider = /*#__PURE__*/memo(PluginsProviderComponent);
|
|
|
20
20
|
* @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
export const Plugins = ({
|
|
23
|
+
export const Plugins = /*#__PURE__*/React.memo(({
|
|
24
24
|
children
|
|
25
25
|
}) => {
|
|
26
26
|
const {
|
|
@@ -34,6 +34,7 @@ export const Plugins = ({
|
|
|
34
34
|
Children.forEach(children, child => addPlugin(child));
|
|
35
35
|
}, []);
|
|
36
36
|
return hasParentPlugin ? /*#__PURE__*/React.createElement(Fragment, null, children) : null;
|
|
37
|
-
};
|
|
37
|
+
});
|
|
38
|
+
Plugins.displayName = "Plugins";
|
|
38
39
|
|
|
39
40
|
//# sourceMappingURL=Plugins.js.map
|
package/core/Plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","Children","createContext","Fragment","memo","useContext","useEffect","useApp","PluginsContext","displayName","PluginsProviderComponent","children","createElement","Provider","value","PluginsProvider","Plugins","addPlugin","hasParentPlugin","forEach","child"],"sources":["Plugins.tsx"],"sourcesContent":["import React, { Children, createContext, Fragment, memo, useContext, useEffect } from \"react\";\nimport { useApp } from \"~/App.js\";\n\nexport const PluginsContext = createContext<boolean>(false);\nPluginsContext.displayName = \"PluginsContext\";\n\ninterface PluginsProviderComponentProps {\n children: JSX.Element[];\n}\nconst PluginsProviderComponent = ({ children }: PluginsProviderComponentProps) => {\n /**\n * This context only serves as a safeguard. We need to warn users when they mount a plugin without using\n * the <Plugins> component. In that case, the context will not be available, and we can log warnings.\n */\n return <PluginsContext.Provider value={true}>{children}</PluginsContext.Provider>;\n};\n\nexport const PluginsProvider = memo(PluginsProviderComponent);\n\n/**\n * @param children\n * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.\n */\ninterface PluginsComponentsProps {\n children: React.ReactNode;\n}\nexport const Plugins = React.memo(({ children }: PluginsComponentsProps) => {\n const { addPlugin } = useApp();\n const hasParentPlugin = useContext(PluginsContext);\n\n useEffect(() => {\n if (hasParentPlugin) {\n return;\n }\n\n Children.forEach(children, child => addPlugin(child));\n }, []);\n\n return hasParentPlugin ? <Fragment>{children}</Fragment> : null;\n});\n\nPlugins.displayName = \"Plugins\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC7F,SAASC,MAAM;AAEf,OAAO,MAAMC,cAAc,gBAAGN,aAAa,CAAU,KAAK,CAAC;AAC3DM,cAAc,CAACC,WAAW,GAAG,gBAAgB;AAK7C,MAAMC,wBAAwB,GAAGA,CAAC;EAAEC;AAAwC,CAAC,KAAK;EAC9E;AACJ;AACA;AACA;EACI,oBAAOX,KAAA,CAAAY,aAAA,CAACJ,cAAc,CAACK,QAAQ;IAACC,KAAK,EAAE;EAAK,GAAEH,QAAkC,CAAC;AACrF,CAAC;AAED,OAAO,MAAMI,eAAe,gBAAGX,IAAI,CAACM,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;;AAIA,OAAO,MAAMM,OAAO,gBAAGhB,KAAK,CAACI,IAAI,CAAC,CAAC;EAAEO;AAAiC,CAAC,KAAK;EACxE,MAAM;IAAEM;EAAU,CAAC,GAAGV,MAAM,CAAC,CAAC;EAC9B,MAAMW,eAAe,GAAGb,UAAU,CAACG,cAAc,CAAC;EAElDF,SAAS,CAAC,MAAM;IACZ,IAAIY,eAAe,EAAE;MACjB;IACJ;IAEAjB,QAAQ,CAACkB,OAAO,CAACR,QAAQ,EAAES,KAAK,IAAIH,SAAS,CAACG,KAAK,CAAC,CAAC;EACzD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOF,eAAe,gBAAGlB,KAAA,CAAAY,aAAA,CAACT,QAAQ,QAAEQ,QAAmB,CAAC,GAAG,IAAI;AACnE,CAAC,CAAC;AAEFK,OAAO,CAACP,WAAW,GAAG,SAAS","ignoreList":[]}
|
package/core/Provider.d.ts
CHANGED
package/core/Provider.js
CHANGED
package/core/Provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useApp","Provider","hoc","addProvider"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { GenericComponent, Decorator } from \"~/index\";\nimport { useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: Decorator<GenericComponent>;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider = ({ hoc }: ProviderProps) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,MAAM;AAMf;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC;AAAmB,CAAC,KAAK;EAChD,MAAM;IAAEC;EAAY,CAAC,GAAGH,MAAM,CAAC,CAAC;EAEhCD,SAAS,CAAC,MAAM;IACZ,OAAOI,WAAW,CAACD,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","useApp","Provider","hoc","addProvider"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { GenericComponent, Decorator } from \"~/index.js\";\nimport { useApp } from \"~/index.js\";\n\nexport interface ProviderProps {\n hoc: Decorator<GenericComponent>;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider = ({ hoc }: ProviderProps) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,MAAM;AAMf;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC;AAAmB,CAAC,KAAK;EAChD,MAAM;IAAEC;EAAY,CAAC,GAAGH,MAAM,CAAC,CAAC;EAEhCD,SAAS,CAAC,MAAM;IACZ,OAAOI,WAAW,CAACD,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Provider","createProviderPlugin","decorator","ProviderPlugin","createElement","hoc"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(decorator: Decorator<GenericComponent>) {\n return function ProviderPlugin() {\n return <Provider hoc={decorator} />;\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAsC,EAAE;EACzE,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAOJ,KAAA,CAAAK,aAAA,CAACJ,QAAQ;MAACK,GAAG,EAAEH;IAAU,CAAE,CAAC;EACvC,CAAC;AACL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","Provider","createProviderPlugin","decorator","ProviderPlugin","createElement","hoc"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider.js\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(decorator: Decorator<GenericComponent>) {\n return function ProviderPlugin() {\n return <Provider hoc={decorator} />;\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAsC,EAAE;EACzE,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAOJ,KAAA,CAAAK,aAAA,CAACJ,QAAQ;MAACK,GAAG,EAAEH;IAAU,CAAE,CAAC;EACvC,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEvent } from "../features/eventPublisher/index.js";
|
|
2
|
+
export interface AuthenticationErrorPayload {
|
|
3
|
+
message: string;
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class AuthenticationErrorEvent extends BaseEvent<AuthenticationErrorPayload> {
|
|
7
|
+
eventType: "Authentication/Error";
|
|
8
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("~/features/eventPublisher/index.js").IEventHandler<AuthenticationErrorEvent>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthenticationErrorEventHandler } from "./abstractions.js";
|
|
2
|
+
import { BaseEvent } from "../features/eventPublisher/index.js";
|
|
3
|
+
export class AuthenticationErrorEvent extends BaseEvent {
|
|
4
|
+
eventType = "Authentication/Error";
|
|
5
|
+
getHandlerAbstraction() {
|
|
6
|
+
return AuthenticationErrorEventHandler;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=AuthenticationErrorEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AuthenticationErrorEventHandler","BaseEvent","AuthenticationErrorEvent","eventType","getHandlerAbstraction"],"sources":["AuthenticationErrorEvent.ts"],"sourcesContent":["import { AuthenticationErrorEventHandler } from \"./abstractions.js\";\nimport { BaseEvent } from \"~/features/eventPublisher/index.js\";\n\nexport interface AuthenticationErrorPayload {\n message: string;\n code: string;\n}\n\nexport class AuthenticationErrorEvent extends BaseEvent<AuthenticationErrorPayload> {\n eventType = \"Authentication/Error\" as const;\n\n getHandlerAbstraction() {\n return AuthenticationErrorEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,+BAA+B;AACxC,SAASC,SAAS;AAOlB,OAAO,MAAMC,wBAAwB,SAASD,SAAS,CAA6B;EAChFE,SAAS,GAAG,sBAAsB;EAElCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,+BAA+B;EAC1C;AACJ","ignoreList":[]}
|