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
package/debug-pilet.d.ts
ADDED
package/debug-pilet.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.integrate = void 0;
|
|
4
|
+
var piral_debug_utils_1 = require("piral-debug-utils");
|
|
5
|
+
function integrate(context, options) {
|
|
6
|
+
options.fetchPilets = (0, piral_debug_utils_1.withEmulatorPilets)(options.fetchPilets, {
|
|
7
|
+
injectPilet: context.injectPilet,
|
|
8
|
+
createApi: options.createApi,
|
|
9
|
+
loadPilet: options.loadPilet
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.integrate = integrate;
|
package/debug-pilet.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LoadPiletsOptions } from 'piral-base';
|
|
2
|
+
import { withEmulatorPilets } from 'piral-debug-utils';
|
|
3
|
+
import { GlobalStateContext } from './lib/types';
|
|
4
|
+
|
|
5
|
+
export function integrate(context: GlobalStateContext, options: LoadPiletsOptions) {
|
|
6
|
+
options.fetchPilets = withEmulatorPilets(options.fetchPilets, {
|
|
7
|
+
injectPilet: context.injectPilet,
|
|
8
|
+
createApi: options.createApi,
|
|
9
|
+
loadPilet: options.loadPilet,
|
|
10
|
+
});
|
|
11
|
+
}
|
package/debug-piral.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LoadPiletsOptions } from 'piral-base';
|
|
2
|
+
import { DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
3
|
+
import { GlobalStateContext } from './lib/types';
|
|
4
|
+
export declare function integrate(context: GlobalStateContext, options: LoadPiletsOptions, debug?: DebuggerExtensionOptions): void;
|
package/debug-piral.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
exports.__esModule = true;
|
|
23
|
+
exports.integrate = void 0;
|
|
24
|
+
var react_atom_1 = require("@dbeining/react-atom");
|
|
25
|
+
var piral_debug_utils_1 = require("piral-debug-utils");
|
|
26
|
+
function integrate(context, options, debug) {
|
|
27
|
+
if (debug === void 0) { debug = {}; }
|
|
28
|
+
(0, piral_debug_utils_1.installPiralDebug)(__assign(__assign({}, debug), { createApi: options.createApi, loadPilet: options.loadPilet, injectPilet: context.injectPilet, fireEvent: context.emit, getDependencies: function () {
|
|
29
|
+
return Object.keys(options.dependencies);
|
|
30
|
+
}, getExtensions: function () {
|
|
31
|
+
return context.readState(function (s) { return Object.keys(s.registry.extensions); });
|
|
32
|
+
}, getRoutes: function () {
|
|
33
|
+
var registeredRoutes = context.readState(function (state) { return Object.keys(state.registry.pages); });
|
|
34
|
+
var componentRoutes = context.readState(function (state) { return Object.keys(state.routes); });
|
|
35
|
+
return __spreadArray(__spreadArray([], componentRoutes, true), registeredRoutes, true);
|
|
36
|
+
}, getGlobalState: function () {
|
|
37
|
+
return context.readState(function (s) { return s; });
|
|
38
|
+
}, getPilets: function () {
|
|
39
|
+
return context.readState(function (s) { return s.modules; });
|
|
40
|
+
}, setPilets: function (modules) {
|
|
41
|
+
context.dispatch(function (state) { return (__assign(__assign({}, state), { modules: modules })); });
|
|
42
|
+
}, integrate: function (dbg) {
|
|
43
|
+
context.dispatch(function (s) { return (__assign(__assign({}, s), { components: __assign(__assign({}, s.components), dbg.components), routes: __assign(__assign({}, s.routes), dbg.routes), registry: __assign(__assign({}, s.registry), { wrappers: __assign(__assign({}, s.registry.wrappers), dbg.wrappers) }) })); });
|
|
44
|
+
(0, react_atom_1.addChangeHandler)(context.state, 'debugging', function (_a) {
|
|
45
|
+
var previous = _a.previous, current = _a.current;
|
|
46
|
+
var pilets = current.modules !== previous.modules;
|
|
47
|
+
var pages = current.registry.pages !== previous.registry.pages || current.routes !== previous.routes;
|
|
48
|
+
var extensions = current.registry.extensions !== previous.registry.extensions;
|
|
49
|
+
var state = current !== previous;
|
|
50
|
+
dbg.onChange(previous, current, {
|
|
51
|
+
pilets: pilets,
|
|
52
|
+
pages: pages,
|
|
53
|
+
extensions: extensions,
|
|
54
|
+
state: state
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
} }));
|
|
58
|
+
}
|
|
59
|
+
exports.integrate = integrate;
|
package/debug-piral.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { addChangeHandler } from '@dbeining/react-atom';
|
|
2
|
+
import { LoadPiletsOptions } from 'piral-base';
|
|
3
|
+
import { installPiralDebug, DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
4
|
+
import { GlobalStateContext } from './lib/types';
|
|
5
|
+
|
|
6
|
+
export function integrate(
|
|
7
|
+
context: GlobalStateContext,
|
|
8
|
+
options: LoadPiletsOptions,
|
|
9
|
+
debug: DebuggerExtensionOptions = {},
|
|
10
|
+
) {
|
|
11
|
+
installPiralDebug({
|
|
12
|
+
...debug,
|
|
13
|
+
createApi: options.createApi,
|
|
14
|
+
loadPilet: options.loadPilet,
|
|
15
|
+
injectPilet: context.injectPilet,
|
|
16
|
+
fireEvent: context.emit,
|
|
17
|
+
getDependencies() {
|
|
18
|
+
return Object.keys(options.dependencies);
|
|
19
|
+
},
|
|
20
|
+
getExtensions() {
|
|
21
|
+
return context.readState((s) => Object.keys(s.registry.extensions));
|
|
22
|
+
},
|
|
23
|
+
getRoutes() {
|
|
24
|
+
const registeredRoutes = context.readState((state) => Object.keys(state.registry.pages));
|
|
25
|
+
const componentRoutes = context.readState((state) => Object.keys(state.routes));
|
|
26
|
+
return [...componentRoutes, ...registeredRoutes];
|
|
27
|
+
},
|
|
28
|
+
getGlobalState() {
|
|
29
|
+
return context.readState((s) => s);
|
|
30
|
+
},
|
|
31
|
+
getPilets() {
|
|
32
|
+
return context.readState((s) => s.modules);
|
|
33
|
+
},
|
|
34
|
+
setPilets(modules) {
|
|
35
|
+
context.dispatch((state) => ({
|
|
36
|
+
...state,
|
|
37
|
+
modules,
|
|
38
|
+
}));
|
|
39
|
+
},
|
|
40
|
+
integrate(dbg) {
|
|
41
|
+
context.dispatch((s) => ({
|
|
42
|
+
...s,
|
|
43
|
+
components: {
|
|
44
|
+
...s.components,
|
|
45
|
+
...dbg.components,
|
|
46
|
+
},
|
|
47
|
+
routes: {
|
|
48
|
+
...s.routes,
|
|
49
|
+
...dbg.routes,
|
|
50
|
+
},
|
|
51
|
+
registry: {
|
|
52
|
+
...s.registry,
|
|
53
|
+
wrappers: {
|
|
54
|
+
...s.registry.wrappers,
|
|
55
|
+
...dbg.wrappers,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
addChangeHandler(context.state, 'debugging', ({ previous, current }) => {
|
|
61
|
+
const pilets = current.modules !== previous.modules;
|
|
62
|
+
const pages = current.registry.pages !== previous.registry.pages || current.routes !== previous.routes;
|
|
63
|
+
const extensions = current.registry.extensions !== previous.registry.extensions;
|
|
64
|
+
const state = current !== previous;
|
|
65
|
+
dbg.onChange(previous, current, {
|
|
66
|
+
pilets,
|
|
67
|
+
pages,
|
|
68
|
+
extensions,
|
|
69
|
+
state,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
package/esm/Piral.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { StateContext } from './state';
|
|
3
3
|
import { createInstance } from './createInstance';
|
|
4
|
-
import { PiralView, Mediator, ResponsiveLayout } from './components';
|
|
4
|
+
import { PiralView, Mediator, ResponsiveLayout, PortalRenderer } from './components';
|
|
5
5
|
/**
|
|
6
6
|
* Represents the Piral app shell frame. Use this component together
|
|
7
7
|
* with an existing instance to render the app shell.
|
|
@@ -17,12 +17,10 @@ const app = (
|
|
|
17
17
|
);
|
|
18
18
|
```
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
React.createElement(PiralView, null, children)));
|
|
26
|
-
};
|
|
20
|
+
export const Piral = ({ instance = createInstance(), breakpoints, children }) => (React.createElement(StateContext.Provider, { value: instance.context },
|
|
21
|
+
React.createElement(PortalRenderer, { id: "root" }),
|
|
22
|
+
React.createElement(ResponsiveLayout, { breakpoints: breakpoints }),
|
|
23
|
+
React.createElement(Mediator, { options: instance.options }),
|
|
24
|
+
React.createElement(PiralView, null, children)));
|
|
27
25
|
Piral.displayName = 'Piral';
|
|
28
26
|
//# sourceMappingURL=Piral.js.map
|
package/esm/Piral.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGrF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAA0B,CAAC,EAAE,QAAQ,GAAG,cAAc,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACtG,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,OAAO;IAC5C,oBAAC,cAAc,IAAC,EAAE,EAAC,MAAM,GAAG;IAC5B,oBAAC,gBAAgB,IAAC,WAAW,EAAE,WAAW,GAAI;IAC9C,oBAAC,QAAQ,IAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,GAAI;IACvC,oBAAC,SAAS,QAAE,QAAQ,CAAa,CACX,CACzB,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
|
package/esm/actions/app.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { cloneElement, createElement } from 'react';
|
|
3
2
|
import { withKey, replaceOrAddItem, removeNested } from '../utils';
|
|
4
3
|
export function changeLayout(ctx, current) {
|
|
5
|
-
ctx.dispatch(
|
|
4
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: withKey(state.app, 'layout', current) })));
|
|
6
5
|
}
|
|
7
6
|
export function initialize(ctx, loading, error, modules) {
|
|
8
|
-
ctx.dispatch(
|
|
9
|
-
loading
|
|
7
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: Object.assign(Object.assign({}, state.app), { error,
|
|
8
|
+
loading }), modules })));
|
|
10
9
|
}
|
|
11
10
|
export function injectPilet(ctx, pilet) {
|
|
12
|
-
ctx.dispatch(
|
|
11
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { modules: replaceOrAddItem(state.modules, pilet, (m) => m.name === pilet.name), registry: removeNested(state.registry, (m) => m.pilet === pilet.name) })));
|
|
13
12
|
ctx.emit('unload-pilet', {
|
|
14
13
|
name: pilet.name,
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
export function setComponent(ctx, name, component) {
|
|
18
|
-
ctx.dispatch(
|
|
17
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { components: withKey(state.components, name, component) })));
|
|
19
18
|
}
|
|
20
19
|
export function setErrorComponent(ctx, type, component) {
|
|
21
|
-
ctx.dispatch(
|
|
20
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { errorComponents: withKey(state.errorComponents, type, component) })));
|
|
22
21
|
}
|
|
23
22
|
export function setRoute(ctx, path, component) {
|
|
24
|
-
ctx.dispatch(
|
|
23
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { routes: withKey(state.routes, path, component) })));
|
|
25
24
|
}
|
|
26
25
|
export function includeProvider(ctx, provider) {
|
|
27
|
-
|
|
28
|
-
ctx.dispatch(
|
|
26
|
+
const wrapper = (props) => cloneElement(provider, props);
|
|
27
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { provider: !state.provider ? wrapper : (props) => createElement(state.provider, undefined, wrapper(props)) })));
|
|
29
28
|
}
|
|
30
29
|
//# sourceMappingURL=app.js.map
|
package/esm/actions/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAWnE,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,OAAmB;IACvE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,IAC1C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAuB,EAAE,OAAgB,EAAE,KAAwB,EAAE,OAAqB;IACnH,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,GAAG,kCACE,KAAK,CAAC,GAAG,KACZ,KAAK;YACL,OAAO,KAET,OAAO,IACP,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAuB,EAAE,KAAY;IAC/D,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,EAC7E,QAAQ,EAAE,YAAY,CAAkC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,CAAC,IACtG,CAAC,CAAC;IAEJ,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE;QACvB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,GAAuB,EACvB,IAAU,EACV,SAAgC;IAEhC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,IACtD,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,GAAuB,EACvB,IAAU,EACV,SAAqC;IAErC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,IAChE,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,GAAuB,EACvB,IAAY,EACZ,SAAgD;IAEhD,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,IAC9C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAuB,EAAE,QAAqB;IAC5E,MAAM,OAAO,GAAa,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEnE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,IACzG,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { appendItem, excludeOn, withKey, withoutKey } from '../utils';
|
|
3
2
|
export function registerPage(ctx, name, value) {
|
|
4
|
-
ctx.dispatch(
|
|
3
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { pages: withKey(state.registry.pages, name, value) }) })));
|
|
5
4
|
}
|
|
6
5
|
export function unregisterPage(ctx, name) {
|
|
7
|
-
ctx.dispatch(
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { pages: withoutKey(state.registry.pages, name) }) })));
|
|
8
7
|
}
|
|
9
8
|
export function registerExtension(ctx, name, value) {
|
|
10
|
-
ctx.dispatch(
|
|
9
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, appendItem(state.registry.extensions[name], value)) }) })));
|
|
11
10
|
}
|
|
12
11
|
export function unregisterExtension(ctx, name, reference) {
|
|
13
|
-
ctx.dispatch(
|
|
12
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, excludeOn(state.registry.extensions[name], (m) => m.reference === reference)) }) })));
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/actions/components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/actions/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtE,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,IAAY,EAAE,KAAuB;IACzF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,OAEnD,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAuB,EAAE,IAAY;IAClE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,OAE/C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA4B;IACnG,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,OAE1G,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAuB,EAAE,IAAY,EAAE,SAAc;IACvF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,UAAU,EAAE,OAAO,CACjB,KAAK,CAAC,QAAQ,CAAC,UAAU,EACzB,IAAI,EACJ,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAC7E,OAEH,CAAC,CAAC;AACN,CAAC"}
|
package/esm/actions/data.js
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import { updateKey } from '../utils';
|
|
3
2
|
export function resetData(ctx) {
|
|
4
|
-
ctx.dispatch(
|
|
3
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { data: {} })));
|
|
5
4
|
}
|
|
6
5
|
export function readDataItem(ctx, key) {
|
|
7
|
-
return ctx.readState(
|
|
6
|
+
return ctx.readState((state) => state.data[key]);
|
|
8
7
|
}
|
|
9
8
|
export function readDataValue(ctx, key) {
|
|
10
|
-
|
|
9
|
+
const item = readDataItem(ctx, key);
|
|
11
10
|
return item && item.value;
|
|
12
11
|
}
|
|
13
12
|
export function writeDataItem(ctx, key, value, owner, target, expires) {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const isNull = !value && typeof value === 'object';
|
|
14
|
+
const data = isNull
|
|
16
15
|
? value
|
|
17
16
|
: {
|
|
18
|
-
value
|
|
19
|
-
owner
|
|
20
|
-
target
|
|
21
|
-
expires
|
|
17
|
+
value,
|
|
18
|
+
owner,
|
|
19
|
+
target,
|
|
20
|
+
expires,
|
|
22
21
|
};
|
|
23
|
-
ctx.dispatch(
|
|
22
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { data: updateKey(state.data, key, data) })));
|
|
24
23
|
ctx.emit('store-data', {
|
|
25
24
|
name: key,
|
|
26
|
-
target
|
|
27
|
-
value
|
|
28
|
-
owner
|
|
29
|
-
expires
|
|
25
|
+
target,
|
|
26
|
+
value,
|
|
27
|
+
owner,
|
|
28
|
+
expires,
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
export function tryWriteDataItem(ctx, key, value, owner, target, expires) {
|
|
33
|
-
|
|
32
|
+
const item = readDataItem(ctx, key);
|
|
34
33
|
if (item && item.owner !== owner) {
|
|
35
|
-
console.error(
|
|
34
|
+
console.error(`Invalid data write to '${key}'. This item currently belongs to '${item.owner}' (write attempted from '${owner}'). The action has been ignored.`);
|
|
36
35
|
return false;
|
|
37
36
|
}
|
|
38
37
|
writeDataItem(ctx, key, value, owner, target, expires);
|
package/esm/actions/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/actions/data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/actions/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,UAAU,SAAS,CAAC,GAAuB;IAC/C,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,IAAI,EAAE,EAAE,IACR,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,GAAW;IAC/D,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,GAAW;IAChE,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,GAAuB,EACvB,GAAW,EACX,KAAU,EACV,KAAa,EACb,MAAuB,EACvB,OAAe;IAEf,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;IACnD,MAAM,IAAI,GAAG,MAAM;QACjB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC;YACE,KAAK;YACL,KAAK;YACL,MAAM;YACN,OAAO;SACR,CAAC;IACN,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,IACtC,CAAC,CAAC;IAEJ,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE;QACrB,IAAI,EAAE,GAAG;QACT,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,GAAuB,EACvB,GAAW,EACX,KAAU,EACV,KAAa,EACb,MAAuB,EACvB,OAAe;IAEf,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEpC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;QAChC,OAAO,CAAC,KAAK,CACX,0BAA0B,GAAG,sCAAsC,IAAI,CAAC,KAAK,4BAA4B,KAAK,kCAAkC,CACjJ,CAAC;QACF,OAAO,KAAK,CAAC;KACd;IAED,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/esm/actions/define.js
CHANGED
|
@@ -2,9 +2,8 @@ export function defineAction(ctx, actionName, action) {
|
|
|
2
2
|
ctx[actionName] = action.bind(ctx, ctx);
|
|
3
3
|
}
|
|
4
4
|
export function defineActions(ctx, actions) {
|
|
5
|
-
for (
|
|
6
|
-
|
|
7
|
-
var action = actions[actionName];
|
|
5
|
+
for (const actionName of Object.keys(actions)) {
|
|
6
|
+
const action = actions[actionName];
|
|
8
7
|
defineAction(ctx, actionName, action);
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/actions/define.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,UAAkB,EAAE,MAAW;IACnF,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,OAAY;IACjE,
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/actions/define.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,UAAkB,EAAE,MAAW;IACnF,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,OAAY;IACjE,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACnC,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;KACvC;AACH,CAAC"}
|
package/esm/actions/portal.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactPortal } from 'react';
|
|
2
2
|
import { GlobalStateContext } from '../types';
|
|
3
3
|
export declare function destroyPortal(ctx: GlobalStateContext, id: string): void;
|
|
4
|
+
export declare function hidePortal(ctx: GlobalStateContext, id: string, entry: ReactPortal): void;
|
|
5
|
+
export declare function updatePortal(ctx: GlobalStateContext, id: string, current: ReactPortal, next: ReactPortal): void;
|
|
4
6
|
export declare function showPortal(ctx: GlobalStateContext, id: string, entry: ReactPortal): void;
|
package/esm/actions/portal.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { withoutKey, includeItem, withKey } from '../utils';
|
|
1
|
+
import { withoutKey, withKey, includeItem, excludeItem, replaceOrAddItem } from '../utils';
|
|
3
2
|
export function destroyPortal(ctx, id) {
|
|
4
|
-
ctx.dispatch(
|
|
3
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withoutKey(state.portals, id) })));
|
|
4
|
+
}
|
|
5
|
+
export function hidePortal(ctx, id, entry) {
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withKey(state.portals, id, excludeItem(state.portals[id], entry)) })));
|
|
7
|
+
}
|
|
8
|
+
export function updatePortal(ctx, id, current, next) {
|
|
9
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withKey(state.portals, id, replaceOrAddItem(state.portals[id], next, (m) => m === current)) })));
|
|
5
10
|
}
|
|
6
11
|
export function showPortal(ctx, id, entry) {
|
|
7
|
-
ctx.dispatch(
|
|
12
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withKey(state.portals, id, includeItem(state.portals[id], entry)) })));
|
|
8
13
|
}
|
|
9
14
|
//# sourceMappingURL=portal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../src/actions/portal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../src/actions/portal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG3F,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,EAAU;IAC/D,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,IACtC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAuB,EAAE,EAAU,EAAE,KAAkB;IAChF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAC1E,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,EAAU,EAAE,OAAoB,EAAE,IAAiB;IACvG,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,OAAO,EAAE,OAAO,CACd,KAAK,CAAC,OAAO,EACb,EAAE,EACF,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,CAChE,IACD,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAuB,EAAE,EAAU,EAAE,KAAkB;IAChF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAC1E,CAAC,CAAC;AACN,CAAC"}
|
package/esm/actions/state.js
CHANGED
package/esm/actions/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,GAAuB,EAAE,IAA+B;IACnF,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,GAAuB,EAAE,IAA+B;IACnF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { ExtensionSlot } from './ExtensionSlot';
|
|
4
3
|
import { SwitchErrorInfo } from './SwitchErrorInfo';
|
|
@@ -7,6 +6,6 @@ import { SwitchErrorInfo } from './SwitchErrorInfo';
|
|
|
7
6
|
* Leverage the default one by registration of respective extensions using
|
|
8
7
|
* the "error" name.
|
|
9
8
|
*/
|
|
10
|
-
export
|
|
9
|
+
export const DefaultErrorInfo = (props) => (React.createElement(ExtensionSlot, { name: "error", params: props, empty: () => React.createElement(SwitchErrorInfo, Object.assign({ key: "default_error" }, props)) }));
|
|
11
10
|
DefaultErrorInfo.displayName = 'DefaultErrorInfo';
|
|
12
11
|
//# sourceMappingURL=DefaultErrorInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/components/DefaultErrorInfo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/components/DefaultErrorInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B,CAAC,KAAK,EAAE,EAAE,CAAC,CACnE,oBAAC,aAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,oBAAC,eAAe,kBAAC,GAAG,EAAC,eAAe,IAAK,KAAK,EAAI,GAAI,CAC/G,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -2,9 +2,6 @@ import { defaultRender } from '../utils';
|
|
|
2
2
|
/**
|
|
3
3
|
* The default layout only rendering the provided children.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
var children = _a.children;
|
|
7
|
-
return defaultRender(children);
|
|
8
|
-
};
|
|
5
|
+
export const DefaultLayout = ({ children }) => defaultRender(children);
|
|
9
6
|
DefaultLayout.displayName = 'DefaultLayout';
|
|
10
7
|
//# sourceMappingURL=DefaultLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/components/DefaultLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/components/DefaultLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC9F,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -2,6 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* The default loading indicator only displaying "Loading".
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export const DefaultLoadingIndicator = () => React.createElement("div", null, "Loading");
|
|
6
6
|
DefaultLoadingIndicator.displayName = 'DefaultLoadingIndicator';
|
|
7
7
|
//# sourceMappingURL=DefaultLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultLoader.js","sourceRoot":"","sources":["../../src/components/DefaultLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;GAEG;AACH,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"DefaultLoader.js","sourceRoot":"","sources":["../../src/components/DefaultLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAoC,GAAG,EAAE,CAAC,2CAAkB,CAAC;AACjG,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { isfunc } from 'piral-base';
|
|
4
3
|
/**
|
|
5
4
|
* The React component for catching errors and displaying error information.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_this.state = {
|
|
6
|
+
export class ErrorBoundary extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.state = {
|
|
12
10
|
error: undefined,
|
|
13
11
|
};
|
|
14
|
-
return _this;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
componentDidCatch(error) {
|
|
14
|
+
const { onError } = this.props;
|
|
18
15
|
if (isfunc(onError)) {
|
|
19
16
|
onError(error);
|
|
20
17
|
}
|
|
21
18
|
this.setState({
|
|
22
|
-
error
|
|
19
|
+
error,
|
|
23
20
|
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
const { children, renderError, renderChild, renderProps } = this.props;
|
|
24
|
+
const { error } = this.state;
|
|
28
25
|
if (error) {
|
|
29
26
|
if (isfunc(renderError)) {
|
|
30
27
|
return renderError(error, renderProps);
|
|
@@ -32,8 +29,6 @@ var ErrorBoundary = /** @class */ (function (_super) {
|
|
|
32
29
|
return React.createElement("div", { style: { whiteSpace: 'pre-wrap' } }, error && error.message);
|
|
33
30
|
}
|
|
34
31
|
return isfunc(renderChild) ? renderChild(children, renderProps) : children;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}(React.Component));
|
|
38
|
-
export { ErrorBoundary };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
39
34
|
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA6CpC;;GAEG;AACH,MAAM,OAAO,aAAiB,SAAQ,KAAK,CAAC,SAAoD;IAC9F,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACX,KAAK,EAAE,SAAS;SACjB,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE/B,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,CAAC;SAChB;QAED,IAAI,CAAC,QAAQ,CAAC;YACZ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACvE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE7B,IAAI,KAAK,EAAE;YACT,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;gBACvB,OAAO,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;aACxC;YAED,OAAO,6BAAK,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,IAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAO,CAAC;SAC/E;QAED,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7E,CAAC;CACF"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { isfunc } from 'piral-base';
|
|
4
3
|
import { useGlobalState } from '../hooks';
|
|
5
|
-
import { defaultRender } from '../utils';
|
|
4
|
+
import { defaultRender, none } from '../utils';
|
|
6
5
|
/**
|
|
7
6
|
* The extension slot component to be used when the available
|
|
8
7
|
* extensions of a given name should be rendered at a specific
|
|
9
8
|
* location.
|
|
10
9
|
*/
|
|
11
10
|
export function ExtensionSlot(props) {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const { name, render = defaultRender, empty, params } = props;
|
|
12
|
+
const extensions = useGlobalState((s) => s.registry.extensions[name] || none);
|
|
14
13
|
return render(extensions.length === 0 && isfunc(empty)
|
|
15
14
|
? [defaultRender(empty(), 'empty')]
|
|
16
|
-
: extensions.map(
|
|
17
|
-
var Component = _a.component, reference = _a.reference, _b = _a.defaults, defaults = _b === void 0 ? {} : _b;
|
|
18
|
-
return (React.createElement(Component, { key: "" + ((reference === null || reference === void 0 ? void 0 : reference.displayName) || '_') + i, params: __assign(__assign({}, defaults), (params || {})) }));
|
|
19
|
-
}));
|
|
15
|
+
: extensions.map(({ component: Component, reference, defaults = {} }, i) => (React.createElement(Component, { key: `${(reference === null || reference === void 0 ? void 0 : reference.displayName) || '_'}${i}`, params: Object.assign(Object.assign({}, defaults), (params || {})) }))));
|
|
20
16
|
}
|
|
21
|
-
ExtensionSlot.displayName =
|
|
17
|
+
ExtensionSlot.displayName = `ExtensionSlot`;
|
|
22
18
|
//# sourceMappingURL=ExtensionSlot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionSlot.js","sourceRoot":"","sources":["../../src/components/ExtensionSlot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionSlot.js","sourceRoot":"","sources":["../../src/components/ExtensionSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAG/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAmB,KAA4B;IAC1E,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC9D,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;IAC9E,OAAO,MAAM,CACX,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CACxE,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,KAAI,GAAG,GAAG,CAAC,EAAE,EAC3C,MAAM,kCACD,QAAQ,GACR,CAAC,MAAM,IAAI,EAAE,CAAC,IAEnB,CACH,CAAC,CACP,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|