piral-core 0.14.0-pre.3018 → 0.14.0-pre.3085
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/debug-pilet.d.ts +3 -0
- package/debug-pilet.js +12 -0
- package/debug-pilet.ts +11 -0
- package/debug-piral.d.ts +4 -0
- package/debug-piral.js +59 -0
- package/debug-piral.ts +74 -0
- package/esm/Piral.js +6 -8
- package/esm/Piral.js.map +1 -1
- package/esm/actions/app.js +9 -10
- package/esm/actions/app.js.map +1 -1
- package/esm/actions/components.js +4 -5
- package/esm/actions/components.js.map +1 -1
- package/esm/actions/data.js +16 -17
- package/esm/actions/data.js.map +1 -1
- package/esm/actions/define.js +2 -3
- package/esm/actions/define.js.map +1 -1
- package/esm/actions/portal.d.ts +2 -0
- package/esm/actions/portal.js +9 -4
- package/esm/actions/portal.js.map +1 -1
- package/esm/actions/state.js +1 -1
- package/esm/actions/state.js.map +1 -1
- package/esm/components/DefaultErrorInfo.js +1 -2
- package/esm/components/DefaultErrorInfo.js.map +1 -1
- package/esm/components/DefaultLayout.js +1 -4
- package/esm/components/DefaultLayout.js.map +1 -1
- package/esm/components/DefaultLoader.js +1 -1
- package/esm/components/DefaultLoader.js.map +1 -1
- package/esm/components/ErrorBoundary.js +13 -18
- package/esm/components/ErrorBoundary.js.map +1 -1
- package/esm/components/ExtensionSlot.js +5 -9
- package/esm/components/ExtensionSlot.js.map +1 -1
- package/esm/components/Mediator.js +8 -8
- package/esm/components/Mediator.js.map +1 -1
- package/esm/components/PiralRoutes.js +8 -8
- package/esm/components/PiralRoutes.js.map +1 -1
- package/esm/components/PiralView.js +11 -16
- package/esm/components/PiralView.js.map +1 -1
- package/esm/components/PortalRenderer.d.ts +5 -0
- package/esm/components/PortalRenderer.js +7 -0
- package/esm/components/PortalRenderer.js.map +1 -0
- package/esm/components/ResponsiveLayout.js +5 -6
- package/esm/components/ResponsiveLayout.js.map +1 -1
- package/esm/components/SetComponent.js +3 -4
- package/esm/components/SetComponent.js.map +1 -1
- package/esm/components/SetError.js +3 -4
- package/esm/components/SetError.js.map +1 -1
- package/esm/components/SetErrors.js +2 -3
- package/esm/components/SetErrors.js.map +1 -1
- package/esm/components/SetLayout.js +2 -3
- package/esm/components/SetLayout.js.map +1 -1
- package/esm/components/SetProvider.js +3 -4
- package/esm/components/SetProvider.js.map +1 -1
- package/esm/components/SetRedirect.js +3 -4
- package/esm/components/SetRedirect.js.map +1 -1
- package/esm/components/SetRoute.js +3 -4
- package/esm/components/SetRoute.js.map +1 -1
- package/esm/components/SwitchErrorInfo.js +12 -10
- package/esm/components/SwitchErrorInfo.js.map +1 -1
- package/esm/components/components.js +8 -9
- package/esm/components/components.js.map +1 -1
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +1 -0
- package/esm/components/index.js.map +1 -1
- package/esm/createInstance.js +24 -25
- package/esm/createInstance.js.map +1 -1
- package/esm/helpers.d.ts +11 -26
- package/esm/helpers.js +18 -56
- package/esm/helpers.js.map +1 -1
- package/esm/hooks/action.js +1 -1
- package/esm/hooks/action.js.map +1 -1
- package/esm/hooks/actions.js +1 -1
- package/esm/hooks/actions.js.map +1 -1
- package/esm/hooks/globalState.js +5 -5
- package/esm/hooks/globalState.js.map +1 -1
- package/esm/hooks/index.d.ts +0 -5
- package/esm/hooks/index.js +0 -5
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/media.js +8 -7
- package/esm/hooks/media.js.map +1 -1
- package/esm/hooks/setter.js +3 -2
- package/esm/hooks/setter.js.map +1 -1
- package/esm/hooks/sharedData.js +2 -2
- package/esm/hooks/sharedData.js.map +1 -1
- package/esm/modules/api.js +79 -28
- package/esm/modules/api.js.map +1 -1
- package/esm/modules/dependencies.d.ts +3 -4
- package/esm/modules/dependencies.js +11 -14
- package/esm/modules/dependencies.js.map +1 -1
- package/esm/state/createActions.js +7 -12
- package/esm/state/createActions.js.map +1 -1
- package/esm/state/createGlobalState.js +6 -8
- package/esm/state/createGlobalState.js.map +1 -1
- package/esm/state/stateContext.js +1 -1
- package/esm/state/stateContext.js.map +1 -1
- package/esm/state/withApi.js +59 -62
- package/esm/state/withApi.js.map +1 -1
- package/esm/types/config.d.ts +23 -16
- package/esm/types/state.d.ts +13 -0
- package/esm/utils/compare.js +4 -4
- package/esm/utils/compare.js.map +1 -1
- package/esm/utils/data.js +6 -7
- package/esm/utils/data.js.map +1 -1
- package/esm/utils/foreign.d.ts +4 -2
- package/esm/utils/foreign.js +16 -8
- package/esm/utils/foreign.js.map +1 -1
- package/esm/utils/guid.js +3 -3
- package/esm/utils/guid.js.map +1 -1
- package/esm/utils/helpers.d.ts +11 -8
- package/esm/utils/helpers.js +28 -17
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/media.js +8 -7
- package/esm/utils/media.js.map +1 -1
- package/esm/utils/storage.js +13 -14
- package/esm/utils/storage.js.map +1 -1
- package/lib/Piral.js +9 -11
- package/lib/Piral.js.map +1 -1
- package/lib/actions/app.js +11 -12
- package/lib/actions/app.js.map +1 -1
- package/lib/actions/components.js +5 -6
- package/lib/actions/components.js.map +1 -1
- package/lib/actions/data.js +17 -18
- package/lib/actions/data.js.map +1 -1
- package/lib/actions/define.js +2 -3
- package/lib/actions/define.js.map +1 -1
- package/lib/actions/index.js +7 -7
- package/lib/actions/index.js.map +1 -1
- package/lib/actions/portal.d.ts +2 -0
- package/lib/actions/portal.js +12 -5
- package/lib/actions/portal.js.map +1 -1
- package/lib/actions/state.js +3 -3
- package/lib/actions/state.js.map +1 -1
- package/lib/components/DefaultErrorInfo.js +4 -5
- package/lib/components/DefaultErrorInfo.js.map +1 -1
- package/lib/components/DefaultLayout.js +2 -5
- package/lib/components/DefaultLayout.js.map +1 -1
- package/lib/components/DefaultLoader.js +2 -2
- package/lib/components/DefaultLoader.js.map +1 -1
- package/lib/components/ErrorBoundary.js +18 -22
- package/lib/components/ErrorBoundary.js.map +1 -1
- package/lib/components/ExtensionSlot.js +10 -14
- package/lib/components/ExtensionSlot.js.map +1 -1
- package/lib/components/Mediator.js +11 -11
- package/lib/components/Mediator.js.map +1 -1
- package/lib/components/PiralRoutes.js +11 -11
- package/lib/components/PiralRoutes.js.map +1 -1
- package/lib/components/PiralView.js +16 -21
- package/lib/components/PiralView.js.map +1 -1
- package/lib/components/PortalRenderer.d.ts +5 -0
- package/lib/components/PortalRenderer.js +11 -0
- package/lib/components/PortalRenderer.js.map +1 -0
- package/lib/components/ResponsiveLayout.js +9 -10
- package/lib/components/ResponsiveLayout.js.map +1 -1
- package/lib/components/SetComponent.js +4 -5
- package/lib/components/SetComponent.js.map +1 -1
- package/lib/components/SetError.js +4 -5
- package/lib/components/SetError.js.map +1 -1
- package/lib/components/SetErrors.js +4 -5
- package/lib/components/SetErrors.js.map +1 -1
- package/lib/components/SetLayout.js +4 -5
- package/lib/components/SetLayout.js.map +1 -1
- package/lib/components/SetProvider.js +4 -5
- package/lib/components/SetProvider.js.map +1 -1
- package/lib/components/SetRedirect.js +6 -7
- package/lib/components/SetRedirect.js.map +1 -1
- package/lib/components/SetRoute.js +4 -5
- package/lib/components/SetRoute.js.map +1 -1
- package/lib/components/SwitchErrorInfo.js +14 -12
- package/lib/components/SwitchErrorInfo.js.map +1 -1
- package/lib/components/components.js +5 -6
- package/lib/components/components.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +20 -19
- package/lib/components/index.js.map +1 -1
- package/lib/createInstance.js +31 -32
- package/lib/createInstance.js.map +1 -1
- package/lib/helpers.d.ts +11 -26
- package/lib/helpers.js +19 -59
- package/lib/helpers.js.map +1 -1
- package/lib/hooks/action.js +3 -3
- package/lib/hooks/action.js.map +1 -1
- package/lib/hooks/actions.js +4 -4
- package/lib/hooks/actions.js.map +1 -1
- package/lib/hooks/globalState.js +8 -8
- package/lib/hooks/globalState.js.map +1 -1
- package/lib/hooks/index.d.ts +0 -5
- package/lib/hooks/index.js +7 -12
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/media.js +10 -9
- package/lib/hooks/media.js.map +1 -1
- package/lib/hooks/setter.js +4 -3
- package/lib/hooks/setter.js.map +1 -1
- package/lib/hooks/sharedData.js +3 -3
- package/lib/hooks/sharedData.js.map +1 -1
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/modules/api.js +86 -35
- package/lib/modules/api.js.map +1 -1
- package/lib/modules/dependencies.d.ts +3 -4
- package/lib/modules/dependencies.js +13 -16
- package/lib/modules/dependencies.js.map +1 -1
- package/lib/modules/index.js +3 -3
- package/lib/modules/index.js.map +1 -1
- package/lib/state/createActions.js +8 -13
- package/lib/state/createActions.js.map +1 -1
- package/lib/state/createGlobalState.js +9 -11
- package/lib/state/createGlobalState.js.map +1 -1
- package/lib/state/index.js +5 -5
- package/lib/state/index.js.map +1 -1
- package/lib/state/stateContext.js +1 -1
- package/lib/state/stateContext.js.map +1 -1
- package/lib/state/withApi.js +67 -70
- package/lib/state/withApi.js.map +1 -1
- package/lib/types/config.d.ts +23 -16
- package/lib/types/index.js +13 -13
- package/lib/types/index.js.map +1 -1
- package/lib/types/state.d.ts +13 -0
- package/lib/utils/compare.js +4 -4
- package/lib/utils/compare.js.map +1 -1
- package/lib/utils/data.js +6 -7
- package/lib/utils/data.js.map +1 -1
- package/lib/utils/foreign.d.ts +4 -2
- package/lib/utils/foreign.js +21 -11
- package/lib/utils/foreign.js.map +1 -1
- package/lib/utils/guid.js +3 -3
- package/lib/utils/guid.js.map +1 -1
- package/lib/utils/helpers.d.ts +11 -8
- package/lib/utils/helpers.js +30 -17
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/index.js +9 -9
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/media.js +7 -6
- package/lib/utils/media.js.map +1 -1
- package/lib/utils/react.js +1 -1
- package/lib/utils/react.js.map +1 -1
- package/lib/utils/storage.js +11 -12
- package/lib/utils/storage.js.map +1 -1
- package/package.json +12 -5
- package/src/Piral.tsx +2 -1
- package/src/actions/portal.ts +19 -1
- package/src/components/ExtensionSlot.tsx +2 -2
- package/src/components/Mediator.tsx +2 -1
- package/src/components/PortalRenderer.tsx +12 -0
- package/src/components/SwitchErrorInfo.tsx +5 -1
- package/src/components/index.ts +1 -0
- package/src/createInstance.tsx +6 -7
- package/src/helpers.test.tsx +7 -39
- package/src/helpers.tsx +32 -85
- package/src/hooks/index.ts +0 -5
- package/src/hooks/media.ts +2 -1
- package/src/hooks/setter.ts +2 -1
- package/src/modules/api.ts +72 -4
- package/src/modules/dependencies.test.ts +18 -5
- package/src/modules/dependencies.ts +12 -18
- package/src/state/withApi.tsx +12 -14
- package/src/types/config.ts +23 -17
- package/src/types/state.ts +13 -0
- package/src/utils/foreign.test.ts +4 -4
- package/src/utils/foreign.ts +28 -5
- package/src/utils/helpers.ts +21 -7
- package/src/utils/media.ts +2 -1
- package/esm/hooks/debounce.d.ts +0 -8
- package/esm/hooks/debounce.js +0 -18
- package/esm/hooks/debounce.js.map +0 -1
- package/esm/hooks/lockBodyScroll.d.ts +0 -6
- package/esm/hooks/lockBodyScroll.js +0 -15
- package/esm/hooks/lockBodyScroll.js.map +0 -1
- package/esm/hooks/onClickOutside.d.ts +0 -8
- package/esm/hooks/onClickOutside.js +0 -23
- package/esm/hooks/onClickOutside.js.map +0 -1
- package/esm/hooks/onScreenVisible.d.ts +0 -11
- package/esm/hooks/onScreenVisible.js +0 -28
- package/esm/hooks/onScreenVisible.js.map +0 -1
- package/esm/hooks/promise.d.ts +0 -13
- package/esm/hooks/promise.js +0 -21
- package/esm/hooks/promise.js.map +0 -1
- package/lib/hooks/debounce.d.ts +0 -8
- package/lib/hooks/debounce.js +0 -22
- package/lib/hooks/debounce.js.map +0 -1
- package/lib/hooks/lockBodyScroll.d.ts +0 -6
- package/lib/hooks/lockBodyScroll.js +0 -19
- package/lib/hooks/lockBodyScroll.js.map +0 -1
- package/lib/hooks/onClickOutside.d.ts +0 -8
- package/lib/hooks/onClickOutside.js +0 -27
- package/lib/hooks/onClickOutside.js.map +0 -1
- package/lib/hooks/onScreenVisible.d.ts +0 -11
- package/lib/hooks/onScreenVisible.js +0 -32
- package/lib/hooks/onScreenVisible.js.map +0 -1
- package/lib/hooks/promise.d.ts +0 -13
- package/lib/hooks/promise.js +0 -25
- package/lib/hooks/promise.js.map +0 -1
- package/src/hooks/debounce.test.ts +0 -67
- package/src/hooks/debounce.ts +0 -19
- package/src/hooks/lockBodyScroll.test.ts +0 -24
- package/src/hooks/lockBodyScroll.ts +0 -15
- package/src/hooks/onClickOutside.test.ts +0 -113
- package/src/hooks/onClickOutside.ts +0 -25
- package/src/hooks/onScreenVisible.test.ts +0 -68
- package/src/hooks/onScreenVisible.ts +0 -28
- package/src/hooks/promise.test.ts +0 -76
- package/src/hooks/promise.ts +0 -35
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { startLoadingPilets } from 'piral-base';
|
|
3
3
|
import { useAction } from '../hooks';
|
|
4
|
+
import { none } from '../utils';
|
|
4
5
|
/**
|
|
5
6
|
* The Mediator component for interfacing with pilets loading.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var notifier = function (error, pilets, loaded) {
|
|
8
|
+
export const Mediator = ({ options }) => {
|
|
9
|
+
const initialize = useAction('initialize');
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const { connect, disconnect } = startLoadingPilets(options);
|
|
12
|
+
const notifier = (error, pilets, loaded) => {
|
|
13
13
|
initialize(!loaded, error, pilets);
|
|
14
14
|
};
|
|
15
15
|
connect(notifier);
|
|
16
|
-
return
|
|
17
|
-
},
|
|
16
|
+
return () => disconnect(notifier);
|
|
17
|
+
}, none);
|
|
18
18
|
// tslint:disable-next-line:no-null-keyword
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mediator.js","sourceRoot":"","sources":["../../src/components/Mediator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Mediator.js","sourceRoot":"","sources":["../../src/components/Mediator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAYhC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/D,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC5D,MAAM,QAAQ,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxD,UAAU,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,OAAO,CAAC,QAAQ,CAAC,CAAC;QAClB,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC,EAAE,IAAI,CAAC,CAAC;IACT,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Route, Switch } from 'react-router';
|
|
4
4
|
import { useGlobalState } from '../hooks';
|
|
5
5
|
/**
|
|
6
6
|
* The component for defining the exclusive routes to be used.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
var NotFound = _a
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (React.createElement(Switch,
|
|
13
|
-
Object.keys(routes).map(
|
|
14
|
-
Object.keys(pages).map(
|
|
8
|
+
export const PiralRoutes = (_a) => {
|
|
9
|
+
var { NotFound } = _a, props = __rest(_a, ["NotFound"]);
|
|
10
|
+
const routes = useGlobalState((s) => s.routes);
|
|
11
|
+
const pages = useGlobalState((s) => s.registry.pages);
|
|
12
|
+
return (React.createElement(Switch, Object.assign({}, props),
|
|
13
|
+
Object.keys(routes).map((url) => (React.createElement(Route, { exact: true, key: url, path: url, component: routes[url] }))),
|
|
14
|
+
Object.keys(pages).map((url) => (React.createElement(Route, { exact: true, key: url, path: url, component: pages[url].component }))),
|
|
15
15
|
React.createElement(Route, { component: NotFound })));
|
|
16
16
|
};
|
|
17
17
|
PiralRoutes.displayName = 'Routes';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PiralRoutes.js","sourceRoot":"","sources":["../../src/components/PiralRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAoC,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAY1C;;GAEG;AACH,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"PiralRoutes.js","sourceRoot":"","sources":["../../src/components/PiralRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAoC,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAY1C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAA0B,CAAC,EAAsB,EAAE,EAAE;QAA1B,EAAE,QAAQ,OAAY,EAAP,KAAK,cAApB,YAAsB,CAAF;IACrE,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEtD,OAAO,CACL,oBAAC,MAAM,oBAAK,KAAK;QACd,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAChC,oBAAC,KAAK,IAAC,KAAK,QAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,GAAI,CAC7D,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAC/B,oBAAC,KAAK,IAAC,KAAK,QAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,GAAI,CACtE,CAAC;QACF,oBAAC,KAAK,IAAC,SAAS,EAAE,QAAQ,GAAI,CACvB,CACV,CAAC;AACJ,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { StaticRouter } from 'react-router';
|
|
4
3
|
import { PiralError, PiralRouter, PiralLoadingIndicator, PiralLayout, PiralDebug } from './components';
|
|
5
4
|
import { PiralRoutes } from './PiralRoutes';
|
|
6
5
|
import { useGlobalState } from '../hooks';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const NotFound = (props) => React.createElement(PiralError, Object.assign({ type: "not_found" }, props));
|
|
7
|
+
const PiralContent = () => {
|
|
8
|
+
const { error, loading, layout } = useGlobalState((m) => m.app);
|
|
10
9
|
return error ? (React.createElement(PiralError, { type: "loading", error: error })) : loading ? (React.createElement(PiralLoadingIndicator, null)) : (React.createElement(PiralLayout, { currentLayout: layout },
|
|
11
10
|
React.createElement(PiralRoutes, { NotFound: NotFound })));
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var provider = useGlobalState(function (m) { return m.provider; }) || React.Fragment;
|
|
12
|
+
const Router = typeof window === 'undefined' ? (props) => React.createElement(StaticRouter, Object.assign({ location: "/" }, props)) : PiralRouter;
|
|
13
|
+
const PiralProvider = ({ children }) => {
|
|
14
|
+
const provider = useGlobalState((m) => m.provider) || React.Fragment;
|
|
17
15
|
return React.createElement(provider, undefined, children);
|
|
18
16
|
};
|
|
19
17
|
/**
|
|
20
18
|
* The component responsible for the generic view of the application.
|
|
21
19
|
* This includes the global providers, the used Router, the current content and some convenience.
|
|
22
20
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
children,
|
|
29
|
-
React.createElement(PiralDebug, null))));
|
|
30
|
-
};
|
|
21
|
+
export const PiralView = ({ children }) => (React.createElement(PiralProvider, null,
|
|
22
|
+
React.createElement(Router, null,
|
|
23
|
+
React.createElement(PiralContent, null),
|
|
24
|
+
children,
|
|
25
|
+
React.createElement(PiralDebug, null))));
|
|
31
26
|
PiralView.displayName = 'PiralView';
|
|
32
27
|
//# sourceMappingURL=PiralView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PiralView.js","sourceRoot":"","sources":["../../src/components/PiralView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PiralView.js","sourceRoot":"","sources":["../../src/components/PiralView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAuB,YAAY,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,qBAAqB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,QAAQ,GAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,UAAU,kBAAC,IAAI,EAAC,WAAW,IAAK,KAAK,EAAI,CAAC;AAEtG,MAAM,YAAY,GAAa,GAAG,EAAE;IAClC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,oBAAC,UAAU,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,GAAI,CAC5C,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,oBAAC,qBAAqB,OAAG,CAC1B,CAAC,CAAC,CAAC,CACF,oBAAC,WAAW,IAAC,aAAa,EAAE,MAAM;QAChC,oBAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,GAAI,CACvB,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,YAAY,kBAAC,QAAQ,EAAC,GAAG,IAAK,KAAK,EAAI,CAAC,CAAC,CAAC,WAAW,CAAC;AAEjH,MAAM,aAAa,GAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC;IACrE,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC5D,CAAC,CAAC;AAOF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACnE,oBAAC,aAAa;IACZ,oBAAC,MAAM;QACL,oBAAC,YAAY,OAAG;QACf,QAAQ;QACT,oBAAC,UAAU,OAAG,CACP,CACK,CACjB,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useGlobalState } from '../hooks';
|
|
2
|
+
import { defaultRender, none } from '../utils';
|
|
3
|
+
export const PortalRenderer = ({ id }) => {
|
|
4
|
+
const children = useGlobalState((m) => m.portals[id]) || none;
|
|
5
|
+
return defaultRender(children);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=PortalRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalRenderer.js","sourceRoot":"","sources":["../../src/components/PortalRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAM/C,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;IAC9D,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
|
@@ -4,12 +4,11 @@ import { defaultLayouts, defaultRender, defaultBreakpoints } from '../utils';
|
|
|
4
4
|
/**
|
|
5
5
|
* The component capable of identifying and switching the currently used layout.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
React.useEffect(function () {
|
|
7
|
+
export const ResponsiveLayout = ({ breakpoints = defaultBreakpoints, children }) => {
|
|
8
|
+
const current = useGlobalState((m) => m.app.layout) || 'desktop';
|
|
9
|
+
const changeTo = useAction('changeLayout');
|
|
10
|
+
const selected = useMedia(breakpoints, defaultLayouts, current);
|
|
11
|
+
React.useEffect(() => {
|
|
13
12
|
if (selected !== current) {
|
|
14
13
|
changeTo(selected);
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAa7E;;GAEG;AACH,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAa7E;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAAE,WAAW,GAAG,kBAAkB,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClH,MAAM,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;IACjE,MAAM,QAAQ,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAEhE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,QAAQ,KAAK,OAAO,EAAE;YACxB,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACpB;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -2,10 +2,9 @@ import { useAction, useSetter } from '../hooks';
|
|
|
2
2
|
/**
|
|
3
3
|
* The component capable of setting a layout component at mounting.
|
|
4
4
|
*/
|
|
5
|
-
export function SetComponent(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useSetter(function () { return component && setComponent(name, component); });
|
|
5
|
+
export function SetComponent({ name, component, }) {
|
|
6
|
+
const setComponent = useAction('setComponent');
|
|
7
|
+
useSetter(() => component && setComponent(name, component));
|
|
9
8
|
// tslint:disable-next-line:no-null-keyword
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetComponent.js","sourceRoot":"","sources":["../../src/components/SetComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBhD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAqC,
|
|
1
|
+
{"version":3,"file":"SetComponent.js","sourceRoot":"","sources":["../../src/components/SetComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBhD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAqC,EAC/D,IAAI,EACJ,SAAS,GACe;IACxB,MAAM,YAAY,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IAC/C,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -2,10 +2,9 @@ import { useAction, useSetter } from '../hooks';
|
|
|
2
2
|
/**
|
|
3
3
|
* The component capable of setting a globally defined error handler component at mounting.
|
|
4
4
|
*/
|
|
5
|
-
export function SetError(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useSetter(function () { return component && setErrorComponent(type, component); });
|
|
5
|
+
export function SetError({ type, component, }) {
|
|
6
|
+
const setErrorComponent = useAction('setErrorComponent');
|
|
7
|
+
useSetter(() => component && setErrorComponent(type, component));
|
|
9
8
|
// tslint:disable-next-line:no-null-keyword
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetError.js","sourceRoot":"","sources":["../../src/components/SetError.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBhD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAA0C,
|
|
1
|
+
{"version":3,"file":"SetError.js","sourceRoot":"","sources":["../../src/components/SetError.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBhD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAA0C,EAChE,IAAI,EACJ,SAAS,GACW;IACpB,MAAM,iBAAiB,GAAG,SAAS,CAAC,mBAAmB,CAAC,CAAC;IACzD,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACjE,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -3,8 +3,7 @@ import { SetError } from './SetError';
|
|
|
3
3
|
/**
|
|
4
4
|
* The component capable of batch setting error handling components.
|
|
5
5
|
*/
|
|
6
|
-
export function SetErrors(
|
|
7
|
-
|
|
8
|
-
return (React.createElement(React.Fragment, null, Object.keys(errors).map(function (key) { return (React.createElement(SetError, { type: key, component: errors[key], key: key })); })));
|
|
6
|
+
export function SetErrors({ errors = {} }) {
|
|
7
|
+
return (React.createElement(React.Fragment, null, Object.keys(errors).map((key) => (React.createElement(SetError, { type: key, component: errors[key], key: key })))));
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=SetErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetErrors.js","sourceRoot":"","sources":["../../src/components/SetErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"SetErrors.js","sourceRoot":"","sources":["../../src/components/SetErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE,EAAkB;IACvD,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CACrC,oBAAC,QAAQ,IAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAC1D,CAAC,CACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -3,8 +3,7 @@ import { SetComponent } from './SetComponent';
|
|
|
3
3
|
/**
|
|
4
4
|
* The component capable of batch setting layout components.
|
|
5
5
|
*/
|
|
6
|
-
export function SetLayout(
|
|
7
|
-
|
|
8
|
-
return (React.createElement(React.Fragment, null, Object.keys(layout).map(function (key) { return (React.createElement(SetComponent, { name: key, component: layout[key], key: key })); })));
|
|
6
|
+
export function SetLayout({ layout = {} }) {
|
|
7
|
+
return (React.createElement(React.Fragment, null, Object.keys(layout).map((key) => (React.createElement(SetComponent, { name: key, component: layout[key], key: key })))));
|
|
9
8
|
}
|
|
10
9
|
//# sourceMappingURL=SetLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetLayout.js","sourceRoot":"","sources":["../../src/components/SetLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa9C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"SetLayout.js","sourceRoot":"","sources":["../../src/components/SetLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa9C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE,EAAkB;IACvD,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CACrC,oBAAC,YAAY,IAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAC9D,CAAC,CACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -2,10 +2,9 @@ import { useAction, useSetter } from '../hooks';
|
|
|
2
2
|
/**
|
|
3
3
|
* The component capable of setting a global provider at mounting.
|
|
4
4
|
*/
|
|
5
|
-
export function SetProvider(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useSetter(function () { return provider && includeProvider(provider); });
|
|
5
|
+
export function SetProvider({ provider }) {
|
|
6
|
+
const includeProvider = useAction('includeProvider');
|
|
7
|
+
useSetter(() => provider && includeProvider(provider));
|
|
9
8
|
// tslint:disable-next-line:no-null-keyword
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetProvider.js","sourceRoot":"","sources":["../../src/components/SetProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAYhD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"SetProvider.js","sourceRoot":"","sources":["../../src/components/SetProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAYhD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IACxD,MAAM,eAAe,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACrD,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -4,10 +4,9 @@ import { useAction, useSetter } from '../hooks';
|
|
|
4
4
|
/**
|
|
5
5
|
* The component capable of setting a global redirect route at mounting.
|
|
6
6
|
*/
|
|
7
|
-
export function SetRedirect(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
useSetter(function () { return setRoute(from, function () { return React.createElement(Redirect, { to: to }); }); });
|
|
7
|
+
export function SetRedirect({ from, to }) {
|
|
8
|
+
const setRoute = useAction('setRoute');
|
|
9
|
+
useSetter(() => setRoute(from, () => React.createElement(Redirect, { to: to })));
|
|
11
10
|
// tslint:disable-next-line:no-null-keyword
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetRedirect.js","sourceRoot":"","sources":["../../src/components/SetRedirect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgBhD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"SetRedirect.js","sourceRoot":"","sources":["../../src/components/SetRedirect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgBhD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,EAAoB;IACxD,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,oBAAC,QAAQ,IAAC,EAAE,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -2,10 +2,9 @@ import { useAction, useSetter } from '../hooks';
|
|
|
2
2
|
/**
|
|
3
3
|
* The component capable of setting a global route at mounting.
|
|
4
4
|
*/
|
|
5
|
-
export function SetRoute(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useSetter(function () { return component && setRoute(path, component); });
|
|
5
|
+
export function SetRoute({ path, component }) {
|
|
6
|
+
const setRoute = useAction('setRoute');
|
|
7
|
+
useSetter(() => component && setRoute(path, component));
|
|
9
8
|
// tslint:disable-next-line:no-null-keyword
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/components/SetRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgBhD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAS,
|
|
1
|
+
{"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/components/SetRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgBhD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAS,EAAE,IAAI,EAAE,SAAS,EAAoB;IACpE,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useGlobalState } from '../hooks';
|
|
4
|
-
import { defaultRender } from '../utils';
|
|
3
|
+
import { defaultRender, none } from '../utils';
|
|
5
4
|
function renderComponent(components, props) {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const name = props.type;
|
|
6
|
+
const Component = components[name];
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
React.useEffect(() => console.error('[dev-info] An error occurred in the Piral instance.', props), none);
|
|
9
|
+
}
|
|
8
10
|
if (!Component) {
|
|
9
|
-
|
|
11
|
+
const Unknown = components.unknown;
|
|
10
12
|
if (Unknown) {
|
|
11
|
-
return React.createElement(Unknown,
|
|
13
|
+
return React.createElement(Unknown, Object.assign({}, props, { type: "unknown" }));
|
|
12
14
|
}
|
|
13
|
-
return defaultRender(
|
|
15
|
+
return defaultRender(`Error: ${props.type}`);
|
|
14
16
|
}
|
|
15
|
-
return React.createElement(Component,
|
|
17
|
+
return React.createElement(Component, Object.assign({}, props));
|
|
16
18
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
+
export const SwitchErrorInfo = (props) => {
|
|
20
|
+
const components = useGlobalState((m) => m.errorComponents);
|
|
19
21
|
return renderComponent(components, props);
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=SwitchErrorInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchErrorInfo.js","sourceRoot":"","sources":["../../src/components/SwitchErrorInfo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwitchErrorInfo.js","sourceRoot":"","sources":["../../src/components/SwitchErrorInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAG/C,SAAS,eAAe,CACtB,UAAgC,EAChC,KAAmB;IAEnB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAEnC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qDAAqD,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;KAC1G;IAED,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAEnC,IAAI,OAAO,EAAE;YACX,OAAO,oBAAC,OAAO,oBAAM,KAAa,IAAE,IAAI,EAAC,SAAS,IAAG,CAAC;SACvD;QAED,OAAO,aAAa,CAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,oBAAC,SAAS,oBAAM,KAAa,EAAI,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAA6B,CAAC,KAAK,EAAE,EAAE;IACjE,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC5D,OAAO,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useGlobalState } from '../hooks';
|
|
4
3
|
export function getPiralComponent(name) {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
return Component ? React.createElement(Component,
|
|
4
|
+
return (props) => {
|
|
5
|
+
const Component = useGlobalState((s) => s.components[name]);
|
|
6
|
+
return Component ? React.createElement(Component, Object.assign({}, props)) : null;
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* Gets the currently registered ErrorInfo component.
|
|
12
11
|
* By default the DefaultErrorInfo component is used.
|
|
13
12
|
*/
|
|
14
|
-
export
|
|
13
|
+
export const PiralError = getPiralComponent('ErrorInfo');
|
|
15
14
|
/**
|
|
16
15
|
* Gets the currently registered LoadingIndicator component.
|
|
17
16
|
* By default only Loading is rendered.
|
|
18
17
|
*/
|
|
19
|
-
export
|
|
18
|
+
export const PiralLoadingIndicator = getPiralComponent('LoadingIndicator');
|
|
20
19
|
/**
|
|
21
20
|
* Gets the currently registered Router component.
|
|
22
21
|
* By default the BrowserRouter is used.
|
|
23
22
|
*/
|
|
24
|
-
export
|
|
23
|
+
export const PiralRouter = getPiralComponent('Router');
|
|
25
24
|
/**
|
|
26
25
|
* Gets the currently registered Layout component.
|
|
27
26
|
* By default the children are rendered.
|
|
28
27
|
*/
|
|
29
|
-
export
|
|
28
|
+
export const PiralLayout = getPiralComponent('Layout');
|
|
30
29
|
/**
|
|
31
30
|
* Gets the currently registered Debug component.
|
|
32
31
|
* By default nothing is used.
|
|
33
32
|
*/
|
|
34
|
-
export
|
|
33
|
+
export const PiralDebug = getPiralComponent('Debug');
|
|
35
34
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,UAAU,iBAAiB,CAAqC,IAAU;IAC9E,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAC,SAAS,oBAAK,KAAK,EAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwC,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA+C,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAEvH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAqC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAEzF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAqC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAEzF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwB,iBAAiB,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ export * from './ExtensionSlot';
|
|
|
7
7
|
export * from './Mediator';
|
|
8
8
|
export * from './PiralRoutes';
|
|
9
9
|
export * from './PiralView';
|
|
10
|
+
export * from './PortalRenderer';
|
|
10
11
|
export * from './ResponsiveLayout';
|
|
11
12
|
export * from './SetComponent';
|
|
12
13
|
export * from './SetError';
|
package/esm/components/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './ExtensionSlot';
|
|
|
7
7
|
export * from './Mediator';
|
|
8
8
|
export * from './PiralRoutes';
|
|
9
9
|
export * from './PiralView';
|
|
10
|
+
export * from './PortalRenderer';
|
|
10
11
|
export * from './ResponsiveLayout';
|
|
11
12
|
export * from './SetComponent';
|
|
12
13
|
export * from './SetError';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
package/esm/createInstance.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
2
|
import { blazingStrategy, standardStrategy, createListener, isfunc } from 'piral-base';
|
|
3
|
-
import {
|
|
3
|
+
import { defaultApiFactory, defaultDependencySelector, defaultModuleRequester } from './modules';
|
|
4
4
|
import { createGlobalState, createActions, includeActions } from './state';
|
|
5
5
|
import { createPiletOptions } from './helpers';
|
|
6
6
|
/**
|
|
@@ -23,41 +23,40 @@ const app = (
|
|
|
23
23
|
render(app, document.querySelector('#app'));
|
|
24
24
|
```
|
|
25
25
|
*/
|
|
26
|
-
export function createInstance(config) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var root = createApi({
|
|
26
|
+
export function createInstance(config = {}) {
|
|
27
|
+
const { state, actions, availablePilets = [], plugins, requestPilets = defaultModuleRequester, loaderConfig, async = false, shareDependencies = defaultDependencySelector, loadPilet, loaders, debug, apiFactory = defaultApiFactory, } = config;
|
|
28
|
+
const globalState = createGlobalState(state);
|
|
29
|
+
const events = createListener(globalState);
|
|
30
|
+
const context = createActions(globalState, events);
|
|
31
|
+
const definedPlugins = plugins || [];
|
|
32
|
+
const usedPlugins = Array.isArray(definedPlugins) ? definedPlugins : [definedPlugins];
|
|
33
|
+
const createApi = apiFactory(context, usedPlugins);
|
|
34
|
+
const root = createApi({
|
|
36
35
|
name: 'root',
|
|
37
36
|
version: process.env.BUILD_PCKG_VERSION || '1.0.0',
|
|
38
37
|
spec: '',
|
|
39
38
|
});
|
|
40
|
-
|
|
41
|
-
context
|
|
42
|
-
createApi
|
|
43
|
-
loaders
|
|
44
|
-
loadPilet
|
|
45
|
-
availablePilets
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
getDependencies: getDependencies,
|
|
39
|
+
const options = createPiletOptions({
|
|
40
|
+
context,
|
|
41
|
+
createApi,
|
|
42
|
+
loaders,
|
|
43
|
+
loadPilet,
|
|
44
|
+
availablePilets,
|
|
45
|
+
loaderConfig,
|
|
46
|
+
shareDependencies,
|
|
49
47
|
strategy: isfunc(async) ? async : async ? blazingStrategy : standardStrategy,
|
|
50
|
-
requestPilets
|
|
48
|
+
requestPilets,
|
|
49
|
+
debug,
|
|
51
50
|
});
|
|
52
51
|
if (actions) {
|
|
53
52
|
includeActions(context, actions);
|
|
54
53
|
}
|
|
55
54
|
context.options = options;
|
|
56
55
|
return __assign(events, {
|
|
57
|
-
createApi
|
|
58
|
-
context
|
|
59
|
-
root
|
|
60
|
-
options
|
|
56
|
+
createApi,
|
|
57
|
+
context,
|
|
58
|
+
root,
|
|
59
|
+
options,
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
//# sourceMappingURL=createInstance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInstance.js","sourceRoot":"","sources":["../src/createInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createInstance.js","sourceRoot":"","sources":["../src/createInstance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,cAAc,CAAC,SAA6B,EAAE;IAC5D,MAAM,EACJ,KAAK,EACL,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,OAAO,EACP,aAAa,GAAG,sBAAsB,EACtC,YAAY,EACZ,KAAK,GAAG,KAAK,EACb,iBAAiB,GAAG,yBAAyB,EAC7C,SAAS,EACT,OAAO,EACP,KAAK,EACL,UAAU,GAAG,iBAAiB,GAC/B,GAAG,MAAM,CAAC;IACX,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACtF,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,SAAS,CAAC;QACrB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,OAAO;QAClD,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,kBAAkB,CAAC;QACjC,OAAO;QACP,SAAS;QACT,OAAO;QACP,SAAS;QACT,eAAe;QACf,YAAY;QACZ,iBAAiB;QACjB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB;QAC5E,aAAa;QACb,KAAK;KACN,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE;QACX,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAClC;IAED,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAE1B,OAAO,QAAQ,CAAC,MAAM,EAAE;QACtB,SAAS;QACT,OAAO;QACP,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
package/esm/helpers.d.ts
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
import { PiletApiCreator, LoadPiletsOptions, CustomSpecLoaders, DefaultLoaderConfig,
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
* Creates a dependency getter that sets the shared dependencies explicitly.
|
|
5
|
-
* Overrides the potentially set shared dependencies from the Piral CLI, but
|
|
6
|
-
* keeps all global dependencies such as react, react-dom, ...
|
|
7
|
-
* @param sharedDependencies The shared dependencies to declare.
|
|
8
|
-
*/
|
|
9
|
-
export declare function setSharedDependencies(sharedDependencies: AvailableDependencies): () => {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Creates a dependency getter that extends the shared dependencies with additional dependencies.
|
|
14
|
-
* @param additionalDependencies The additional dependencies to declare.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extendSharedDependencies(additionalDependencies: AvailableDependencies): () => {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
};
|
|
1
|
+
import { PiletApiCreator, LoadPiletsOptions, CustomSpecLoaders, DefaultLoaderConfig, PiletLoader } from 'piral-base';
|
|
2
|
+
import { DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
3
|
+
import type { Pilet, PiletRequester, GlobalStateContext, PiletLoadingStrategy, DependencySelector } from './types';
|
|
19
4
|
export interface PiletOptionsConfig {
|
|
5
|
+
context: GlobalStateContext;
|
|
6
|
+
loaders?: CustomSpecLoaders;
|
|
7
|
+
loaderConfig?: DefaultLoaderConfig;
|
|
20
8
|
availablePilets: Array<Pilet>;
|
|
21
|
-
createApi: PiletApiCreator;
|
|
22
|
-
fetchDependency: PiletDependencyFetcher;
|
|
23
|
-
getDependencies: PiletDependencyGetter;
|
|
24
9
|
strategy: PiletLoadingStrategy;
|
|
25
|
-
|
|
26
|
-
loaderConfig?: DefaultLoaderConfig;
|
|
27
|
-
loaders?: CustomSpecLoaders;
|
|
10
|
+
createApi: PiletApiCreator;
|
|
28
11
|
loadPilet: PiletLoader;
|
|
29
|
-
|
|
12
|
+
requestPilets: PiletRequester;
|
|
13
|
+
shareDependencies: DependencySelector;
|
|
14
|
+
debug?: DebuggerExtensionOptions;
|
|
30
15
|
}
|
|
31
|
-
export declare function createPiletOptions({ context,
|
|
16
|
+
export declare function createPiletOptions({ context, loaders, loaderConfig, availablePilets, strategy, createApi, loadPilet, requestPilets, shareDependencies, debug, }: PiletOptionsConfig): LoadPiletsOptions;
|