@webiny/app 0.0.0-unstable.d7f521b032 → 0.0.0-unstable.de38392959
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.js +3 -1
- package/App.js.map +1 -1
- package/apollo-client/InMemoryCache.js +4 -5
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/components/Image.d.ts +2 -2
- package/components/Image.js +5 -3
- package/components/Image.js.map +1 -1
- package/components/Routes.js +3 -1
- package/components/Routes.js.map +1 -1
- package/components/View.js +3 -1
- package/components/View.js.map +1 -1
- package/components/index.js +3 -1
- package/components/index.js.map +1 -1
- package/config.js +3 -1
- package/config.js.map +1 -1
- package/contexts/Ui/index.d.ts +2 -2
- package/contexts/Ui/index.js +3 -1
- package/contexts/Ui/index.js.map +1 -1
- package/core/AddRoute.d.ts +1 -2
- package/core/AddRoute.js +3 -1
- package/core/AddRoute.js.map +1 -1
- package/core/DebounceRender.d.ts +2 -1
- package/core/DebounceRender.js +5 -3
- package/core/DebounceRender.js.map +1 -1
- package/core/Plugin.js +3 -1
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.d.ts +5 -2
- package/core/Plugins.js +3 -1
- package/core/Plugins.js.map +1 -1
- package/core/Provider.d.ts +1 -2
- package/core/Provider.js +3 -1
- package/core/Provider.js.map +1 -1
- package/core/Routes.d.ts +2 -2
- package/core/Routes.js +3 -1
- package/core/Routes.js.map +1 -1
- package/core/createProvider.js +3 -1
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.d.ts +2 -2
- package/core/createProviderPlugin.js +3 -1
- package/core/createProviderPlugin.js.map +1 -1
- package/hooks/useAutocomplete/index.js +3 -1
- package/hooks/useAutocomplete/index.js.map +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +5 -3
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +3 -1
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +3 -1
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +3 -1
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.js +3 -1
- package/hooks/useDataList/functions/index.js.map +1 -1
- package/hooks/useDataList/functions/searchDataByKey.js +3 -1
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.js +3 -1
- package/hooks/useDataList/index.js.map +1 -1
- package/hooks/useDataList/useDataList.js +9 -7
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.js +3 -1
- package/hooks/useDataList/utils/index.js.map +1 -1
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
- package/hooks/useDataList/utils/prepareLoadListParams.js +32 -25
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +3 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -1
- package/hooks/useDataList/utils/types.d.ts +18 -12
- package/hooks/useDataList/utils/types.js +3 -1
- package/hooks/useDataList/utils/types.js.map +1 -1
- package/hooks/useHandler.js +7 -1
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.js +3 -1
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useUi.js +3 -1
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +3 -1
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.js +3 -1
- package/i18n/index.js.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +21 -25
- package/plugins/AddQuerySelectionPlugin.d.ts +8 -1
- package/plugins/AddQuerySelectionPlugin.js +29 -9
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +3 -3
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.js +3 -1
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.js +3 -5
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.js +3 -1
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -5
- package/plugins/LocaleHeaderLinkPlugin.js +5 -9
- package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +2 -2
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +3 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -4
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +3 -1
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +3 -1
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.js +3 -1
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +3 -1
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/RoutePlugin.js +3 -3
- package/plugins/RoutePlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +0 -5
- package/plugins/TenantHeaderLinkPlugin.js +5 -9
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/ViewPlugin.js +3 -3
- package/plugins/ViewPlugin.js.map +1 -1
- package/plugins/image.js +3 -1
- package/plugins/image.js.map +1 -1
- package/plugins/index.js +4 -2
- package/plugins/index.js.map +1 -1
- package/types.d.ts +14 -19
- package/types.js +3 -1
- package/types.js.map +1 -1
- package/utils/getApiUrl.d.ts +1 -0
- package/utils/getApiUrl.js +13 -0
- package/utils/getApiUrl.js.map +1 -0
- package/utils/getGqlApiUrl.d.ts +1 -0
- package/utils/getGqlApiUrl.js +13 -0
- package/utils/getGqlApiUrl.js.map +1 -0
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +5 -0
- package/utils/getHeadlessCmsGqlApiUrl.js +19 -0
- package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -0
- package/utils/getLocaleCode.d.ts +6 -0
- package/utils/getLocaleCode.js +44 -0
- package/utils/getLocaleCode.js.map +1 -0
- package/utils/getPrerenderId.d.ts +6 -0
- package/utils/getPrerenderId.js +12 -0
- package/utils/getPrerenderId.js.map +1 -0
- package/utils/getTenantId.d.ts +6 -0
- package/utils/getTenantId.js +36 -0
- package/utils/getTenantId.js.map +1 -0
- package/utils/index.d.ts +8 -0
- package/utils/index.js +95 -0
- package/utils/index.js.map +1 -0
- package/utils/isLocalhost.d.ts +1 -0
- package/utils/isLocalhost.js +16 -0
- package/utils/isLocalhost.js.map +1 -0
- package/utils/isPrerendering.d.ts +1 -0
- package/utils/isPrerendering.js +12 -0
- package/utils/isPrerendering.js.map +1 -0
package/App.js
CHANGED
package/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AppContext","createContext","undefined","displayName","useApp","appContext","useContext","Error","App","debounceRender","routes","providers","children","useState","reduce","acc","item","path","plugins","state","setState","addRoute","useCallback","route","props","addProvider","component","findIndex","m","addPlugin","element","useMemo","AppRouter","Object","values","length","Providers","compose"],"sources":["App.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useMemo,\n useState,\n useCallback,\n FunctionComponentElement,\n ReactElement\n} from \"react\";\nimport { BrowserRouter, RouteProps, Route } from \"@webiny/react-router\";\nimport { compose, HigherOrderComponent, CompositionProvider } from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\n\ntype RoutesByPath = {\n [key: string]: ReactElement<RouteProps>;\n};\n\ninterface State {\n routes: RoutesByPath;\n plugins: JSX.Element[];\n providers: HigherOrderComponent[];\n}\n\ninterface AppContext extends State {\n addRoute(route: JSX.Element): void;\n addProvider(hoc: HigherOrderComponent): 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 debounceRender?: number;\n routes?: Array<RouteProps>;\n providers?: Array<HigherOrderComponent>;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const App = ({ debounceRender = 50, routes = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n routes: routes.reduce<RoutesByPath>((acc, item) => {\n return { ...acc, [item.path as string]: <Route {...item} /> };\n }, {}),\n plugins: [],\n providers\n });\n\n const addRoute = useCallback((route: FunctionComponentElement<RouteProps>) => {\n setState(state => {\n return {\n ...state,\n routes: { ...state.routes, [route.props.path as string]: route }\n };\n });\n }, []);\n\n const addProvider = useCallback(component => {\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 => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addRoute,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routes = Object.values(state.routes);\n return <SortRoutes key={routes.length} routes={routes} />;\n };\n }, [state.routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: any) => (\n <DebounceRender wait={debounceRender}>{children}</DebounceRender>\n ));\n }, [state.providers.length]);\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n <CompositionProvider>\n {children}\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <AppRouter />\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </CompositionProvider>\n </AppContext.Provider>\n );\n};\n\nApp.displayName = \"App\";\n"],"mappings":";;;;;;;;;;;;AAAA;AASA;AACA;AACA;AACA;AACA;AAkBA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactRouter","_reactComposition","_Routes","_DebounceRender","_Plugins","AppContext","createContext","undefined","displayName","useApp","appContext","useContext","Error","exports","App","_ref","_ref$debounceRender","debounceRender","_ref$routes","routes","_ref$providers","providers","children","_useState","useState","reduce","acc","item","_objectSpread4","default","_defineProperty2","path","createElement","Route","plugins","_useState2","_slicedToArray2","state","setState","addRoute","useCallback","route","props","addProvider","component","findIndex","m","concat","_toConsumableArray2","addPlugin","element","useMemo","AppRouter","Object","values","Routes","key","length","Providers","compose","apply","_ref2","DebounceRender","wait","Provider","value","CompositionProvider","BrowserRouter","PluginsProvider"],"sources":["App.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useMemo,\n useState,\n useCallback,\n FunctionComponentElement,\n ReactElement\n} from \"react\";\nimport { BrowserRouter, RouteProps, Route } from \"@webiny/react-router\";\nimport { compose, HigherOrderComponent, CompositionProvider } from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\n\ntype RoutesByPath = {\n [key: string]: ReactElement<RouteProps>;\n};\n\ninterface State {\n routes: RoutesByPath;\n plugins: JSX.Element[];\n providers: HigherOrderComponent[];\n}\n\ninterface AppContext extends State {\n addRoute(route: JSX.Element): void;\n addProvider(hoc: HigherOrderComponent): 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 debounceRender?: number;\n routes?: Array<RouteProps>;\n providers?: Array<HigherOrderComponent>;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nexport const App = ({ debounceRender = 50, routes = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n routes: routes.reduce<RoutesByPath>((acc, item) => {\n return { ...acc, [item.path as string]: <Route {...item} /> };\n }, {}),\n plugins: [],\n providers\n });\n\n const addRoute = useCallback((route: FunctionComponentElement<RouteProps>) => {\n setState(state => {\n return {\n ...state,\n routes: { ...state.routes, [route.props.path as string]: route }\n };\n });\n }, []);\n\n const addProvider = useCallback(component => {\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 => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addRoute,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routes = Object.values(state.routes);\n return <SortRoutes key={routes.length} routes={routes} />;\n };\n }, [state.routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: any) => (\n <DebounceRender wait={debounceRender}>{children}</DebounceRender>\n ));\n }, [state.providers.length]);\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n <CompositionProvider>\n {children}\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <AppRouter />\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </CompositionProvider>\n </AppContext.Provider>\n );\n};\n\nApp.displayName = \"App\";\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAA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AAE,CAACe,KAAK,CAAChB,SAAS,CAACoC,MAAM,CAAC,CAAC;EAE5BC,SAAS,CAAClD,WAAW,GAAG,WAAW;EAEnC,oBACIX,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC3B,UAAU,CAAC2D,QAAQ;IAACC,KAAK,EAAEvD;EAAW,gBACnCb,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC/B,iBAAA,CAAAiE,mBAAmB,QACf5C,QAAQ,eACTzB,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAChC,YAAA,CAAAmE,aAAa,qBACVtE,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC0B,SAAS,qBACN7D,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC5B,QAAA,CAAAgE,eAAe,QAAE/B,KAAK,CAACH,OAAyB,CAAC,eAClDrC,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC7B,eAAA,CAAA2D,cAAc;IAACC,IAAI,EAAE9C;EAAe,gBACjCpB,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAACoB,SAAS,MAAE,CACA,CACT,CACA,CACE,CACJ,CAAC;AAE9B,CAAC;AAACvC,OAAA,CAAAC,GAAA,GAAAA,GAAA;AAEFA,GAAG,CAACN,WAAW,GAAG,KAAK"}
|
|
@@ -8,12 +8,10 @@ exports.InMemoryCache = void 0;
|
|
|
8
8
|
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
11
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
14
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
15
|
var _apolloCacheInmemory = require("apollo-cache-inmemory");
|
|
18
16
|
var _plugins = require("@webiny/plugins");
|
|
19
17
|
var _AddQuerySelectionPlugin = require("../plugins/AddQuerySelectionPlugin");
|
|
@@ -25,7 +23,6 @@ var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
|
|
|
25
23
|
var _this;
|
|
26
24
|
(0, _classCallCheck2.default)(this, InMemoryCache);
|
|
27
25
|
_this = _super.call(this, config);
|
|
28
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "transformPlugins", void 0);
|
|
29
26
|
_this.transformPlugins = _plugins.plugins.byType(_ApolloLinkPlugin.ApolloLinkPlugin.type).filter(function (pl) {
|
|
30
27
|
return pl instanceof _AddQuerySelectionPlugin.AddQuerySelectionPlugin;
|
|
31
28
|
});
|
|
@@ -34,7 +31,7 @@ var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
|
|
|
34
31
|
(0, _createClass2.default)(InMemoryCache, [{
|
|
35
32
|
key: "transformDocument",
|
|
36
33
|
value: function transformDocument(document) {
|
|
37
|
-
// @ts-
|
|
34
|
+
// @ts-expect-error
|
|
38
35
|
var operationName = document.definitions[0].name.value;
|
|
39
36
|
var _iterator = (0, _createForOfIteratorHelper2.default)(this.transformPlugins),
|
|
40
37
|
_step;
|
|
@@ -53,4 +50,6 @@ var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
|
|
|
53
50
|
}]);
|
|
54
51
|
return InMemoryCache;
|
|
55
52
|
}(_apolloCacheInmemory.InMemoryCache);
|
|
56
|
-
exports.InMemoryCache = InMemoryCache;
|
|
53
|
+
exports.InMemoryCache = InMemoryCache;
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=InMemoryCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["InMemoryCache","config","transformPlugins","plugins","byType","ApolloLinkPlugin","type","filter","pl","AddQuerySelectionPlugin","document","operationName","definitions","name","
|
|
1
|
+
{"version":3,"names":["_apolloCacheInmemory","require","_plugins","_AddQuerySelectionPlugin","_ApolloLinkPlugin","InMemoryCache","_BaseInMemoryCache","_inherits2","default","_super","_createSuper2","config","_this","_classCallCheck2","call","transformPlugins","plugins","byType","ApolloLinkPlugin","type","filter","pl","AddQuerySelectionPlugin","_createClass2","key","value","transformDocument","document","operationName","definitions","name","_iterator","_createForOfIteratorHelper2","_step","s","n","done","addSelectionToQuery","err","e","f","_get2","_getPrototypeOf2","prototype","BaseInMemoryCache","exports"],"sources":["InMemoryCache.ts"],"sourcesContent":["import { InMemoryCache as BaseInMemoryCache, InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { 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":";;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;A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,8BAAA7B,IAAA,OAA+Ba,QAAQ;IAC3C;EAAC;EAAA,OAAAtB,aAAA;AAAA,EApB8BuC,kCAAiB;AAAAC,OAAA,CAAAxC,aAAA,GAAAA,aAAA"}
|
package/components/Image.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ImageProps } from "../types";
|
|
3
|
-
export declare const Image:
|
|
3
|
+
export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
package/components/Image.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.Image = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
-
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
10
9
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
11
10
|
var _plugins = require("@webiny/plugins");
|
|
11
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
12
12
|
var _excluded = ["preset"];
|
|
13
13
|
var Image = function Image(_ref) {
|
|
14
14
|
var presetName = _ref.preset,
|
|
@@ -18,7 +18,7 @@ var Image = function Image(_ref) {
|
|
|
18
18
|
throw new Error("Image component plugin (type \"image-component\") not defined.");
|
|
19
19
|
}
|
|
20
20
|
if (presetName) {
|
|
21
|
-
var preset = (0,
|
|
21
|
+
var preset = (0, _get.default)(plugin, "presets.".concat(presetName));
|
|
22
22
|
(0, _invariant.default)(preset, "Transform preset \"".concat(presetName, "\" not found."));
|
|
23
23
|
props.transform = preset;
|
|
24
24
|
}
|
|
@@ -27,4 +27,6 @@ var Image = function Image(_ref) {
|
|
|
27
27
|
}
|
|
28
28
|
return plugin.render(props);
|
|
29
29
|
};
|
|
30
|
-
exports.Image = Image;
|
|
30
|
+
exports.Image = Image;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=Image.js.map
|
package/components/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Image","presetName","preset","props","plugin","plugins","byName","Error","invariant","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_invariant","_interopRequireDefault","require","_plugins","_get","_excluded","Image","_ref","presetName","preset","props","_objectWithoutProperties2","default","plugin","plugins","byName","Error","get","concat","invariant","transform","src","getImageSrc","render","exports"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get\";\nimport { 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,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA6B,IAAAG,SAAA;AAGtB,IAAMC,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAAqD;EAAA,IAAvCC,UAAU,GAAAD,IAAA,CAAlBE,MAAM;IAAiBC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAL,IAAA,EAAAF,SAAA;EAChD,IAAMQ,MAAM,GAAGC,gBAAO,CAACC,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACF,MAAM,EAAE;IACT,MAAM,IAAIG,KAAK,iEAA+D,CAAC;EACnF;EAEA,IAAIR,UAAU,EAAE;IACZ,IAAMC,MAAM,GAAG,IAAAQ,YAAG,EAACJ,MAAM,aAAAK,MAAA,CAAaV,UAAU,CAAE,CAAC;IACnD,IAAAW,kBAAS,EAACV,MAAM,wBAAAS,MAAA,CAAuBV,UAAU,kBAAc,CAAC;IAChEE,KAAK,CAACU,SAAS,GAAGX,MAAM;EAC5B;EAEA,IAAIC,KAAK,CAACU,SAAS,EAAE;IACjBV,KAAK,CAACW,GAAG,GAAGR,MAAM,CAACS,WAAW,CAACZ,KAAK,CAAC;EACzC;EAEA,OAAOG,MAAM,CAACU,MAAM,CAACb,KAAK,CAAC;AAC/B,CAAC;AAACc,OAAA,CAAAlB,KAAA,GAAAA,KAAA"}
|
package/components/Routes.js
CHANGED
package/components/Routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Routes","routes","plugins","byType","sort","a","b","pathA","route","props","path","pathB","includes","map","name","React","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["// This file is necessary only for backwards compatibility.\n// We'll remove this once the legacy rendering engine is removed.\nimport React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"../types\";\n\nexport const Routes = () => {\n // We cannot call `sort` on the array returned by the `plugins.byType` call - it is read-only.\n const routes = [...plugins.byType<RoutePlugin>(\"route\")].sort((a, b) => {\n const pathA = a.route.props.path || \"*\";\n const pathB = b.route.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map(({ route, name }) => React.cloneElement(route, { key: name }))}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAEA;AACA;AACA;AAJA;AACA;;AAMO,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_plugins","_reactRouter","Routes","routes","_toConsumableArray2","default","plugins","byType","sort","a","b","pathA","route","props","path","pathB","includes","createElement","map","_ref","name","React","cloneElement","key","exports"],"sources":["Routes.tsx"],"sourcesContent":["// This file is necessary only for backwards compatibility.\n// We'll remove this once the legacy rendering engine is removed.\nimport React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"../types\";\n\nexport const Routes = () => {\n // We cannot call `sort` on the array returned by the `plugins.byType` call - it is read-only.\n const routes = [...plugins.byType<RoutePlugin>(\"route\")].sort((a, b) => {\n const pathA = a.route.props.path || \"*\";\n const pathB = b.route.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map(({ route, name }) => React.cloneElement(route, { key: name }))}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAJA;AACA;;AAMO,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAA,EAAS;EACxB;EACA,IAAMC,MAAM,GAAG,IAAAC,mBAAA,CAAAC,OAAA,EAAIC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,EAAEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACpE,IAAMC,KAAK,GAAGF,CAAC,CAACG,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;IACvC,IAAMC,KAAK,GAAGL,CAAC,CAACE,KAAK,CAACC,KAAK,CAACC,IAAI,IAAI,GAAG;;IAEvC;IACA,IAAIH,KAAK,KAAK,GAAG,IAAII,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIJ,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACK,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACIlB,MAAA,CAAAQ,OAAA,CAAAY,aAAA,CAAChB,YAAA,CAAAC,MAAiB,QACbC,MAAM,CAACe,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGP,KAAK,GAAAO,IAAA,CAALP,KAAK;MAAEQ,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAA,oBAAOC,cAAK,CAACC,YAAY,CAACV,KAAK,EAAE;MAAEW,GAAG,EAAEH;IAAK,CAAC,CAAC;EAAA,EAC1D,CAAC;AAE5B,CAAC;AAACI,OAAA,CAAAtB,MAAA,GAAAA,MAAA"}
|
package/components/View.js
CHANGED
package/components/View.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","name","children","props","viewPlugins","plugins","byType","ViewPlugin","type","filter","pl","key","length","reduce","el","render"],"sources":["View.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ViewPlugin } from \"../plugins/ViewPlugin\";\n\ninterface Props {\n name: string;\n props?: Record<string, any>;\n children?: React.ReactNode;\n}\n\nexport const View = ({ name, children, props = {} }: Props) => {\n const viewPlugins = plugins.byType<ViewPlugin>(ViewPlugin.type).filter(pl => pl.key === name);\n\n if (viewPlugins.length) {\n children = viewPlugins.reduce((el, pl) => pl.render({ children: el, ...props }), children);\n }\n\n return <Fragment>{children || null}</Fragment>;\n};\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAQO,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_plugins","_ViewPlugin","View","_ref","name","children","_ref$props","props","viewPlugins","plugins","byType","ViewPlugin","type","filter","pl","key","length","reduce","el","render","_objectSpread2","default","createElement","Fragment","exports"],"sources":["View.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ViewPlugin } from \"../plugins/ViewPlugin\";\n\ninterface Props {\n name: string;\n props?: Record<string, any>;\n children?: React.ReactNode;\n}\n\nexport const View = ({ name, children, props = {} }: Props) => {\n const viewPlugins = plugins.byType<ViewPlugin>(ViewPlugin.type).filter(pl => pl.key === name);\n\n if (viewPlugins.length) {\n children = viewPlugins.reduce((el, pl) => pl.render({ children: el, ...props }), children);\n }\n\n return <Fragment>{children || null}</Fragment>;\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQO,IAAMG,IAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA,EAA8C;EAAA,IAAxCC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,UAAA,GAAAH,IAAA,CAAEI,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,CAAC,CAAC,GAAAA,UAAA;EAC7C,IAAME,WAAW,GAAGC,gBAAO,CAACC,MAAM,CAAaC,sBAAU,CAACC,IAAI,CAAC,CAACC,MAAM,CAAC,UAAAC,EAAE;IAAA,OAAIA,EAAE,CAACC,GAAG,KAAKX,IAAI;EAAA,EAAC;EAE7F,IAAII,WAAW,CAACQ,MAAM,EAAE;IACpBX,QAAQ,GAAGG,WAAW,CAACS,MAAM,CAAC,UAACC,EAAE,EAAEJ,EAAE;MAAA,OAAKA,EAAE,CAACK,MAAM,KAAAC,cAAA,CAAAC,OAAA;QAAGhB,QAAQ,EAAEa;MAAE,GAAKX,KAAK,CAAE,CAAC;IAAA,GAAEF,QAAQ,CAAC;EAC9F;EAEA,oBAAOR,MAAA,CAAAwB,OAAA,CAAAC,aAAA,CAACzB,MAAA,CAAA0B,QAAQ,QAAElB,QAAQ,IAAI,IAAe,CAAC;AAClD,CAAC;AAACmB,OAAA,CAAAtB,IAAA,GAAAA,IAAA"}
|
package/components/index.js
CHANGED
package/components/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image\";\nexport { Routes } from \"./Routes\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA"}
|
|
1
|
+
{"version":3,"names":["_Image","require","_Routes"],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image\";\nexport { Routes } from \"./Routes\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA"}
|
package/config.js
CHANGED
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deepFreeze","obj","Object","keys","forEach","prop","isFrozen","freeze","createConfig","_config","set","config","get","getKey","key","defaultValue"],"sources":["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"],"mappings":";;;;;;AAQA,IAAMA,UAAU,GAAG,SAAbA,
|
|
1
|
+
{"version":3,"names":["deepFreeze","obj","Object","keys","forEach","prop","isFrozen","freeze","createConfig","_config","set","config","get","getKey","key","defaultValue","exports"],"sources":["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"],"mappings":";;;;;;AAQA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,GAAwB,EAA0B;EAClEC,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAACG,OAAO,CAAC,UAAAC,IAAI,EAAI;IAC7B,IAAI,OAAOJ,GAAG,CAACI,IAAI,CAAC,KAAK,QAAQ,IAAI,CAACH,MAAM,CAACI,QAAQ,CAACL,GAAG,CAACI,IAAI,CAAC,CAAC,EAAE;MAC9DL,UAAU,CAACC,GAAG,CAACI,IAAI,CAAC,CAAC;IACzB;EACJ,CAAC,CAAC;EACF,OAAOH,MAAM,CAACK,MAAM,CAACN,GAAG,CAAC;AAC7B,CAAC;AAED,SAASO,YAAYA,CAAA,EAAc;EAC/B,IAAIC,OAA4B,GAAG,CAAC,CAAC;EAErC,OAAO;IACHC,GAAG,WAAAA,IAACC,MAAc,EAAE;MAChBF,OAAO,GAAGT,UAAU,CAACW,MAAM,CAAC;IAChC,CAAC;IACDC,GAAG,WAAAA,IAAA,EAAG;MACF,OAAOH,OAAO;IAClB,CAAC;IACDI,MAAM,WAAAA,OAACC,GAAG,EAAEC,YAAY,EAAE;MACtB,OAAOD,GAAG,IAAIL,OAAO,GAAGA,OAAO,CAACK,GAAG,CAAC,GAAGC,YAAY;IACvD;EACJ,CAAC;AACL;AAEO,IAAMJ,MAAM,GAAGH,YAAY,CAAC,CAAC;AAACQ,OAAA,CAAAL,MAAA,GAAAA,MAAA"}
|
package/contexts/Ui/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const UiContext: React.Context<
|
|
3
|
-
declare type Props =
|
|
2
|
+
export declare const UiContext: React.Context<Record<string, any>>;
|
|
3
|
+
declare type Props = Record<string, any>;
|
|
4
4
|
declare type State = {
|
|
5
5
|
ui: {
|
|
6
6
|
[key: string]: any;
|
package/contexts/Ui/index.js
CHANGED
package/contexts/Ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UiContext","React","createContext","UiProvider","ui","setter","setState","state","value","setData","uiStatePlugins","plugins","byType","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_plugins","UiContext","React","createContext","exports","UiProvider","_React$Component","_inherits2","default","_super","_createSuper2","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty2","_assertThisInitialized2","ui","setter","setState","state","_objectSpread2","_createClass2","key","value","render","setData","uiStatePlugins","plugins","byType","createElement","Provider","map","pl","cloneElement","name","props","children","Component"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { 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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,IAAME,SAAS,gBAAGC,cAAK,CAACC,aAAa,CAAsB,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAH,SAAA,GAAAA,SAAA;AAAA,IAqBzDI,UAAU,0BAAAC,gBAAA;EAAA,IAAAC,UAAA,CAAAC,OAAA,EAAAH,UAAA,EAAAC,gBAAA;EAAA,IAAAG,MAAA,OAAAC,aAAA,CAAAF,OAAA,EAAAH,UAAA;EAAA,SAAAA,WAAA;IAAA,IAAAM,KAAA;IAAA,IAAAC,gBAAA,CAAAJ,OAAA,QAAAH,UAAA;IAAA,SAAAQ,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,SAAAY,MAAA,CAAAL,IAAA;IAAA,IAAAM,gBAAA,CAAAd,OAAA,MAAAe,uBAAA,CAAAf,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AddRoute.js
CHANGED
package/core/AddRoute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AddRoute","props","useApp","addRoute","useEffect"],"sources":["AddRoute.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useApp } from \"~/App\";\nimport { Route, RouteProps } from \"@webiny/react-router\";\n\nexport const AddRoute
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_App","_reactRouter","AddRoute","props","_useApp","useApp","addRoute","useEffect","default","createElement","Route","exports"],"sources":["AddRoute.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useApp } from \"~/App\";\nimport { Route, RouteProps } from \"@webiny/react-router\";\n\nexport const AddRoute = (props: RouteProps) => {\n const { addRoute } = useApp();\n\n useEffect(() => {\n addRoute(<Route {...props} />);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEO,IAAMG,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,KAAiB,EAAK;EAC3C,IAAAC,OAAA,GAAqB,IAAAC,WAAM,EAAC,CAAC;IAArBC,QAAQ,GAAAF,OAAA,CAARE,QAAQ;EAEhB,IAAAC,gBAAS,EAAC,YAAM;IACZD,QAAQ,eAACT,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,YAAA,CAAAS,KAAK,EAAKP,KAAQ,CAAC,CAAC;EAClC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAACQ,OAAA,CAAAT,QAAA,GAAAA,QAAA"}
|
package/core/DebounceRender.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
interface Props {
|
|
3
3
|
wait?: number;
|
|
4
|
+
children?: React.ReactNode;
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
7
|
* We need to debounce the rendering of children during app bootstrap, since many plugins
|
|
7
8
|
* can add more and more Providers which will recompose the entire hierarchy of React Context providers.
|
|
8
9
|
* During this stage, we don't want to render anything.
|
|
9
10
|
*/
|
|
10
|
-
export declare const DebounceRender:
|
|
11
|
+
export declare const DebounceRender: ({ wait, children }: Props) => JSX.Element;
|
|
11
12
|
export {};
|
package/core/DebounceRender.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.DebounceRender = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
12
|
/**
|
|
13
13
|
* We need to debounce the rendering of children during app bootstrap, since many plugins
|
|
14
14
|
* can add more and more Providers which will recompose the entire hierarchy of React Context providers.
|
|
@@ -23,7 +23,7 @@ var DebounceRender = function DebounceRender(_ref) {
|
|
|
23
23
|
render = _useState2[0],
|
|
24
24
|
setRender = _useState2[1];
|
|
25
25
|
var debouncedRender = (0, _react.useMemo)(function () {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, _debounce.default)(function () {
|
|
27
27
|
setRender(true);
|
|
28
28
|
}, wait);
|
|
29
29
|
}, [setRender]);
|
|
@@ -38,4 +38,6 @@ var DebounceRender = function DebounceRender(_ref) {
|
|
|
38
38
|
}, []);
|
|
39
39
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, render ? children : null);
|
|
40
40
|
};
|
|
41
|
-
exports.DebounceRender = DebounceRender;
|
|
41
|
+
exports.DebounceRender = DebounceRender;
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=DebounceRender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DebounceRender","wait","children","useState","render","setRender","debouncedRender","useMemo","debounce","useEffect","cancel"],"sources":["DebounceRender.tsx"],"sourcesContent":["import React from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport debounce from \"lodash
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_debounce","_interopRequireDefault","DebounceRender","_ref","_ref$wait","wait","children","_useState","useState","_useState2","_slicedToArray2","default","render","setRender","debouncedRender","useMemo","debounce","useEffect","cancel","createElement","Fragment","exports"],"sources":["DebounceRender.tsx"],"sourcesContent":["import React from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport debounce from \"lodash/debounce\";\n\ninterface Props {\n wait?: number;\n children?: React.ReactNode;\n}\n/**\n * We need to debounce the rendering of children during app bootstrap, since many plugins\n * can add more and more Providers which will recompose the entire hierarchy of React Context providers.\n * During this stage, we don't want to render anything.\n */\nexport const DebounceRender = ({ wait = 50, children }: Props) => {\n const [render, setRender] = useState(wait === 0);\n\n const debouncedRender = useMemo(() => {\n return debounce(() => {\n setRender(true);\n }, wait);\n }, [setRender]);\n\n useEffect(() => {\n if (render) {\n return;\n }\n\n debouncedRender();\n\n return () => {\n debouncedRender.cancel();\n };\n }, []);\n\n return <>{render ? children : null}</>;\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA;AACA;AACA;AACA;AACA;AACO,IAAMG,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAAuC;EAAA,IAAAC,SAAA,GAAAD,IAAA,CAAjCE,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,EAAE,GAAAA,SAAA;IAAEE,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAChD,IAAAC,SAAA,GAA4B,IAAAC,eAAQ,EAACH,IAAI,KAAK,CAAC,CAAC;IAAAI,UAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAJ,SAAA;IAAzCK,MAAM,GAAAH,UAAA;IAAEI,SAAS,GAAAJ,UAAA;EAExB,IAAMK,eAAe,GAAG,IAAAC,cAAO,EAAC,YAAM;IAClC,OAAO,IAAAC,iBAAQ,EAAC,YAAM;MAClBH,SAAS,CAAC,IAAI,CAAC;IACnB,CAAC,EAAER,IAAI,CAAC;EACZ,CAAC,EAAE,CAACQ,SAAS,CAAC,CAAC;EAEf,IAAAI,gBAAS,EAAC,YAAM;IACZ,IAAIL,MAAM,EAAE;MACR;IACJ;IAEAE,eAAe,CAAC,CAAC;IAEjB,OAAO,YAAM;MACTA,eAAe,CAACI,MAAM,CAAC,CAAC;IAC5B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOrB,MAAA,CAAAc,OAAA,CAAAQ,aAAA,CAAAtB,MAAA,CAAAc,OAAA,CAAAS,QAAA,QAAGR,MAAM,GAAGN,QAAQ,GAAG,IAAO,CAAC;AAC1C,CAAC;AAACe,OAAA,CAAAnB,cAAA,GAAAA,cAAA"}
|
package/core/Plugin.js
CHANGED
|
@@ -18,4 +18,6 @@ var Plugin = /*#__PURE__*/_react.default.memo(function Plugin(_ref) {
|
|
|
18
18
|
});
|
|
19
19
|
}), children ? /*#__PURE__*/_react.default.createElement(_Plugins.Plugins, null, children) : null);
|
|
20
20
|
});
|
|
21
|
-
exports.Plugin = Plugin;
|
|
21
|
+
exports.Plugin = Plugin;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=Plugin.js.map
|
package/core/Plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Plugin","React","memo","providers","children","map","provider","index"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: HigherOrderComponent[];\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;AACA;AACA;AAQO,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Provider","_Plugins","Plugin","React","memo","_ref","providers","children","default","createElement","Fragment","map","provider","index","Provider","key","hoc","Plugins","exports"],"sources":["Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider\";\nimport { Plugins } from \"./Plugins\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: HigherOrderComponent[];\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAQO,IAAMG,MAAM,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,MAAMA,CAAAG,IAAA,EAAuC;EAAA,IAApCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAClE,oBACIV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAAAZ,MAAA,CAAAW,OAAA,CAAAE,QAAA,QACK,CAACJ,SAAS,IAAI,EAAE,EAAEK,GAAG,CAAC,UAACC,QAAQ,EAAEC,KAAK;IAAA,oBACnChB,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACT,SAAA,CAAAc,QAAQ;MAACC,GAAG,EAAEF,KAAM;MAACG,GAAG,EAAEJ;IAAS,CAAE,CAAC;EAAA,CAC1C,CAAC,EACDL,QAAQ,gBAAGV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,QAAA,CAAAgB,OAAO,QAAEV,QAAkB,CAAC,GAAG,IAC9C,CAAC;AAEX,CAAC,CAAC;AAACW,OAAA,CAAAhB,MAAA,GAAAA,MAAA"}
|
package/core/Plugins.d.ts
CHANGED
|
@@ -3,10 +3,13 @@ export declare const PluginsContext: React.Context<boolean>;
|
|
|
3
3
|
interface PluginsProviderComponentProps {
|
|
4
4
|
children: JSX.Element[];
|
|
5
5
|
}
|
|
6
|
-
export declare const PluginsProvider: React.
|
|
6
|
+
export declare const PluginsProvider: React.MemoExoticComponent<({ children }: PluginsProviderComponentProps) => JSX.Element>;
|
|
7
7
|
/**
|
|
8
8
|
* @param children
|
|
9
9
|
* @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
interface PluginsComponentsProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const Plugins: ({ children }: PluginsComponentsProps) => JSX.Element | null;
|
|
12
15
|
export {};
|
package/core/Plugins.js
CHANGED
|
@@ -42,4 +42,6 @@ var Plugins = function Plugins(_ref2) {
|
|
|
42
42
|
}, []);
|
|
43
43
|
return hasParentPlugin ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children) : null;
|
|
44
44
|
};
|
|
45
|
-
exports.Plugins = Plugins;
|
|
45
|
+
exports.Plugins = Plugins;
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=Plugins.js.map
|
package/core/Plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PluginsContext","createContext","displayName","PluginsProviderComponent","children","PluginsProvider","memo","Plugins","useApp","addPlugin","hasParentPlugin","useContext","useEffect","Children","forEach","child"],"sources":["Plugins.tsx"],"sourcesContent":["import React, { Fragment, Children, createContext, useContext, useEffect, memo } from \"react\";\nimport { useApp } from \"~/App\";\n\nexport const PluginsContext = createContext<boolean>(false);\nPluginsContext.displayName = \"PluginsContext\";\n\ninterface PluginsProviderComponentProps {\n children: JSX.Element[];\n}\nconst PluginsProviderComponent
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_App","PluginsContext","createContext","exports","displayName","PluginsProviderComponent","_ref","children","default","createElement","Provider","value","PluginsProvider","memo","Plugins","_ref2","_useApp","useApp","addPlugin","hasParentPlugin","useContext","useEffect","Children","forEach","child","Fragment"],"sources":["Plugins.tsx"],"sourcesContent":["import React, { Fragment, Children, createContext, useContext, useEffect, memo } from \"react\";\nimport { useApp } from \"~/App\";\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 = ({ 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"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,gBAAG,IAAAC,oBAAa,EAAU,KAAK,CAAC;AAACC,OAAA,CAAAF,cAAA,GAAAA,cAAA;AAC5DA,cAAc,CAACG,WAAW,GAAG,gBAAgB;AAK7C,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAAoD;EAAA,IAA9CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACxC;AACJ;AACA;AACA;EACI,oBAAOV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,cAAc,CAACS,QAAQ;IAACC,KAAK,EAAE;EAAK,GAAEJ,QAAkC,CAAC;AACrF,CAAC;AAEM,IAAMK,eAAe,gBAAG,IAAAC,WAAI,EAACR,wBAAwB,CAAC;;AAE7D;AACA;AACA;AACA;AAHAF,OAAA,CAAAS,eAAA,GAAAA,eAAA;AAOO,IAAME,OAAO,GAAG,SAAVA,OAAOA,CAAAC,KAAA,EAA6C;EAAA,IAAvCR,QAAQ,GAAAQ,KAAA,CAARR,QAAQ;EAC9B,IAAAS,OAAA,GAAsB,IAAAC,WAAM,EAAC,CAAC;IAAtBC,SAAS,GAAAF,OAAA,CAATE,SAAS;EACjB,IAAMC,eAAe,GAAG,IAAAC,iBAAU,EAACnB,cAAc,CAAC;EAElD,IAAAoB,gBAAS,EAAC,YAAM;IACZ,IAAIF,eAAe,EAAE;MACjB;IACJ;IAEAG,eAAQ,CAACC,OAAO,CAAChB,QAAQ,EAAE,UAAAiB,KAAK;MAAA,OAAIN,SAAS,CAACM,KAAK,CAAC;IAAA,EAAC;EACzD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,eAAe,gBAAGtB,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACZ,MAAA,CAAA4B,QAAQ,QAAElB,QAAmB,CAAC,GAAG,IAAI;AACnE,CAAC;AAACJ,OAAA,CAAAW,OAAA,GAAAA,OAAA"}
|
package/core/Provider.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { HigherOrderComponent } from "../index";
|
|
3
2
|
export interface ProviderProps {
|
|
4
3
|
hoc: HigherOrderComponent;
|
|
@@ -6,4 +5,4 @@ export interface ProviderProps {
|
|
|
6
5
|
/**
|
|
7
6
|
* Register a new React context provider.
|
|
8
7
|
*/
|
|
9
|
-
export declare const Provider:
|
|
8
|
+
export declare const Provider: ({ hoc }: ProviderProps) => null;
|
package/core/Provider.js
CHANGED
package/core/Provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Provider","hoc","useApp","addProvider","useEffect"],"sources":["Provider.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_react","require","_","Provider","_ref","hoc","_useApp","useApp","addProvider","useEffect","exports"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { HigherOrderComponent, useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: HigherOrderComponent;\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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,IAAME,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,GAAG,GAAAD,IAAA,CAAHC,GAAG;EAC1B,IAAAC,OAAA,GAAwB,IAAAC,QAAM,EAAC,CAAC;IAAxBC,WAAW,GAAAF,OAAA,CAAXE,WAAW;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAOD,WAAW,CAACH,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC;AAACK,OAAA,CAAAP,QAAA,GAAAA,QAAA"}
|
package/core/Routes.d.ts
CHANGED
package/core/Routes.js
CHANGED
package/core/Routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Routes","props","routes","plugins","byType","map","route","sort","a","b","pathA","path","pathB","includes","index","React","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"~/types\";\n\ninterface RoutesProps {\n routes: JSX.Element[];\n}\n\nexport const Routes
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_plugins","_reactRouter","Routes","props","routes","concat","_toConsumableArray2","default","plugins","byType","map","_ref","route","sort","a","b","pathA","path","pathB","includes","createElement","index","React","cloneElement","key","exports"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"~/types\";\n\ninterface RoutesProps {\n routes: JSX.Element[];\n}\n\nexport const Routes = (props: RoutesProps) => {\n const routes = [\n ...props.routes,\n // For backwards compatibility, we need to support the RoutePlugin routes as well.\n ...plugins.byType<RoutePlugin>(\"route\").map(({ route }) => route)\n ].sort((a, b) => {\n const pathA = a.props.path || \"*\";\n const pathB = b.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map((route, index) =>\n React.cloneElement(route, { key: `${route.props.path}:${index}` })\n )}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAOO,IAAMG,MAAM,GAAG,SAATA,MAAMA,CAAIC,KAAkB,EAAK;EAC1C,IAAMC,MAAM,GAAG,GAAAC,MAAA,KAAAC,mBAAA,CAAAC,OAAA,EACRJ,KAAK,CAACC,MAAM,OAAAE,mBAAA,CAAAC,OAAA,EAEZC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,CAACC,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAA,OAAOA,KAAK;EAAA,EAAC,GACnEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACb,IAAMC,KAAK,GAAGF,CAAC,CAACX,KAAK,CAACc,IAAI,IAAI,GAAG;IACjC,IAAMC,KAAK,GAAGH,CAAC,CAACZ,KAAK,CAACc,IAAI,IAAI,GAAG;;IAEjC;IACA,IAAID,KAAK,KAAK,GAAG,IAAIE,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIF,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACG,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACIrB,MAAA,CAAAU,OAAA,CAAAa,aAAA,CAACnB,YAAA,CAAAC,MAAiB,QACbE,MAAM,CAACM,GAAG,CAAC,UAACE,KAAK,EAAES,KAAK;IAAA,oBACrBC,cAAK,CAACC,YAAY,CAACX,KAAK,EAAE;MAAEY,GAAG,KAAAnB,MAAA,CAAKO,KAAK,CAACT,KAAK,CAACc,IAAI,OAAAZ,MAAA,CAAIgB,KAAK;IAAG,CAAC,CAAC;EAAA,CACtE,CACe,CAAC;AAE5B,CAAC;AAACI,OAAA,CAAAvB,MAAA,GAAAA,MAAA"}
|
package/core/createProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createProvider","hoc"],"sources":["createProvider.tsx"],"sourcesContent":["import { HigherOrderComponent } from \"@webiny/react-composition\";\n\n/**\n * Creates a Higher Order Component which is meant to wrap the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(hoc: HigherOrderComponent): HigherOrderComponent {\n return hoc;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,
|
|
1
|
+
{"version":3,"names":["createProvider","hoc"],"sources":["createProvider.tsx"],"sourcesContent":["import { HigherOrderComponent } from \"@webiny/react-composition\";\n\n/**\n * Creates a Higher Order Component which is meant to wrap the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(hoc: HigherOrderComponent): HigherOrderComponent {\n return hoc;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAACC,GAAyB,EAAwB;EAC5E,OAAOA,GAAG;AACd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { HigherOrderComponent } from "@webiny/react-composition";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a component, which, when mounted, will register an app provider.
|
|
5
5
|
* This is particularly useful for wrapping the entire app with custom React Context providers.
|
|
6
6
|
* For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
|
|
7
7
|
*/
|
|
8
|
-
export declare function createProviderPlugin(hoc: HigherOrderComponent):
|
|
8
|
+
export declare function createProviderPlugin(hoc: HigherOrderComponent): () => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createProviderPlugin","hoc","ProviderPlugin"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { HigherOrderComponent } 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(hoc: HigherOrderComponent)
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Provider","createProviderPlugin","hoc","ProviderPlugin","default","createElement","Provider"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { HigherOrderComponent } 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(hoc: HigherOrderComponent) {\n return function ProviderPlugin() {\n return <Provider hoc={hoc} />;\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAACC,GAAyB,EAAE;EAC5D,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAON,MAAA,CAAAO,OAAA,CAAAC,aAAA,CAACL,SAAA,CAAAM,QAAQ;MAACJ,GAAG,EAAEA;IAAI,CAAE,CAAC;EACjC,CAAC;AACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":";;;;;;;;;;;AAAA"}
|
|
1
|
+
{"version":3,"names":["_useAutocomplete","require"],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA"}
|