piral-core 0.13.9 → 0.14.0-beta.3157
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-piral.d.ts +4 -0
- package/debug-piral.js +59 -0
- package/dependencies.codegen +1 -1
- 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 +21 -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/lib/types/config.d.ts
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import type { PiletRequester,
|
|
1
|
+
import type { PiletRequester, PiletLoadingStrategy, PiletLoader, Pilet, AvailableDependencies, CustomSpecLoaders, DefaultLoaderConfig, PiletApiCreator } from 'piral-base';
|
|
2
|
+
import { DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
2
3
|
import type { NestedPartial } from './common';
|
|
3
4
|
import type { PiralPlugin } from './plugin';
|
|
4
5
|
import type { GlobalState, GlobalStateContext, PiralDefineActions } from './state';
|
|
5
|
-
export { PiletLoadingStrategy,
|
|
6
|
+
export { PiletLoadingStrategy, PiletRequester, AvailableDependencies };
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Definition for customizing the shared dependencies.
|
|
8
9
|
*/
|
|
9
|
-
export interface
|
|
10
|
-
/**
|
|
11
|
-
* The callback for defining how a dependency will be fetched.
|
|
12
|
-
*/
|
|
13
|
-
fetchDependency?: PiletDependencyFetcher;
|
|
10
|
+
export interface DependencySelector {
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
12
|
+
* Selects the dependencies to share from the currently available dependencies.
|
|
13
|
+
* @param currentDependencies The currently available dependencies.
|
|
14
|
+
* @default currentDependencies All current dependencies are shared
|
|
15
|
+
* @returns The dependencies selected to be shared.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
(currentDependencies: AvailableDependencies): AvailableDependencies;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The configuration for loading the pilets of the Piral instance.
|
|
21
|
+
*/
|
|
22
|
+
export interface PiralPiletConfiguration {
|
|
18
23
|
/**
|
|
19
24
|
* Function to load the modules asynchronously, e.g., from a server 🚚.
|
|
20
25
|
*/
|
|
@@ -31,6 +36,10 @@ export interface PiralPiletConfiguration {
|
|
|
31
36
|
* Optionally, configures the default loader.
|
|
32
37
|
*/
|
|
33
38
|
loaderConfig?: DefaultLoaderConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Optionally, configures explicitly what dependencies are shared.
|
|
41
|
+
*/
|
|
42
|
+
shareDependencies?: DependencySelector;
|
|
34
43
|
/**
|
|
35
44
|
* Determines that pilets are loaded asynchronously, essentially showing the
|
|
36
45
|
* app right away without waiting for the pilets to load and evaluate.
|
|
@@ -42,12 +51,6 @@ export interface PiralPiletConfiguration {
|
|
|
42
51
|
* This can be used for customization or for debugging purposes.
|
|
43
52
|
*/
|
|
44
53
|
availablePilets?: Array<Pilet>;
|
|
45
|
-
/**
|
|
46
|
-
* Optionally provides a function to extend the API creator with some additional
|
|
47
|
-
* functionality.
|
|
48
|
-
* @deprecated Use plugins instead.
|
|
49
|
-
*/
|
|
50
|
-
extendApi?: PiralPlugin | Array<PiralPlugin>;
|
|
51
54
|
/**
|
|
52
55
|
* Extends the Piral instance with additional capabilities.
|
|
53
56
|
*/
|
|
@@ -80,6 +83,10 @@ export interface PiralStateConfiguration {
|
|
|
80
83
|
* Optionally, sets up some initial custom actions ⚡️.
|
|
81
84
|
*/
|
|
82
85
|
actions?: PiralDefineActions;
|
|
86
|
+
/**
|
|
87
|
+
* Optionally, sets up additional configuration for the debug tooling 🤖.
|
|
88
|
+
*/
|
|
89
|
+
debug?: DebuggerExtensionOptions;
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
85
92
|
* The configuration to be used in the Piral instance.
|
package/lib/types/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./api"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./common"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./components"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./config"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./custom"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./data"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./extension"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./instance"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./layout"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./plugin"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./state"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./utils"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./api"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./common"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./components"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./config"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./custom"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./data"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./extension"), exports);
|
|
11
|
+
(0, tslib_1.__exportStar)(require("./instance"), exports);
|
|
12
|
+
(0, tslib_1.__exportStar)(require("./layout"), exports);
|
|
13
|
+
(0, tslib_1.__exportStar)(require("./plugin"), exports);
|
|
14
|
+
(0, tslib_1.__exportStar)(require("./state"), exports);
|
|
15
|
+
(0, tslib_1.__exportStar)(require("./utils"), exports);
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
package/lib/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,qDAAsB;AACtB,wDAAyB;AACzB,4DAA6B;AAC7B,wDAAyB;AACzB,wDAAyB;AACzB,sDAAuB;AACvB,2DAA4B;AAC5B,0DAA2B;AAC3B,wDAAyB;AACzB,wDAAyB;AACzB,uDAAwB;AACxB,uDAAwB"}
|
package/lib/types/state.d.ts
CHANGED
|
@@ -261,6 +261,19 @@ export interface PiralActions extends PiralCustomActions {
|
|
|
261
261
|
* @param entry The child to render.
|
|
262
262
|
*/
|
|
263
263
|
showPortal(id: string, entry: ReactPortal): void;
|
|
264
|
+
/**
|
|
265
|
+
* Hides the provided portal in the rendering pipeline.
|
|
266
|
+
* @param id The id of the portal to use.
|
|
267
|
+
* @param entry The child to remove.
|
|
268
|
+
*/
|
|
269
|
+
hidePortal(id: string, entry: ReactPortal): void;
|
|
270
|
+
/**
|
|
271
|
+
* Updates the provided portal in the rendering pipeline.
|
|
272
|
+
* @param id The id of the portal to use.
|
|
273
|
+
* @param current The currently displayed child.
|
|
274
|
+
* @param next The updated child that should be displayed.
|
|
275
|
+
*/
|
|
276
|
+
updatePortal(id: string, current: ReactPortal, next: ReactPortal): void;
|
|
264
277
|
/**
|
|
265
278
|
* Dispatches a state change.
|
|
266
279
|
* @param update The update function creating a new state.
|
package/lib/utils/compare.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compare = void 0;
|
|
4
4
|
function compareObjects(a, b) {
|
|
5
|
-
for (
|
|
5
|
+
for (const i in a) {
|
|
6
6
|
if (!(i in b)) {
|
|
7
7
|
return false;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
for (
|
|
10
|
+
for (const i in b) {
|
|
11
11
|
if (!compare(a[i], b[i])) {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
@@ -16,8 +16,8 @@ function compareObjects(a, b) {
|
|
|
16
16
|
}
|
|
17
17
|
function compare(a, b) {
|
|
18
18
|
if (a !== b) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const ta = typeof a;
|
|
20
|
+
const tb = typeof b;
|
|
21
21
|
if (ta === tb && ta === 'object' && a && b) {
|
|
22
22
|
return compareObjects(a, b);
|
|
23
23
|
}
|
package/lib/utils/compare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/utils/compare.ts"],"names":[],"mappings":";;;AAAA,SAAS,cAAc,CAAC,CAAM,EAAE,CAAM;IACpC,KAAK,
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/utils/compare.ts"],"names":[],"mappings":";;;AAAA,SAAS,cAAc,CAAC,CAAM,EAAE,CAAM;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;YACb,OAAO,KAAK,CAAC;SACd;KACF;IAED,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,OAAO,CAAI,CAAI,EAAE,CAAI;IACnC,IAAI,CAAC,KAAK,CAAC,EAAE;QACX,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QACpB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QAEpB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAbD,0BAaC"}
|
package/lib/utils/data.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDataExpiration = exports.createDataOptions = exports.createDataView = void 0;
|
|
4
|
-
|
|
4
|
+
const defaultTarget = 'memory';
|
|
5
5
|
function createDataView(data) {
|
|
6
|
-
|
|
6
|
+
const proxyName = 'Proxy';
|
|
7
7
|
return (window[proxyName] &&
|
|
8
8
|
new Proxy(data, {
|
|
9
|
-
get
|
|
10
|
-
|
|
9
|
+
get(target, name) {
|
|
10
|
+
const item = target[name];
|
|
11
11
|
return item && item.value;
|
|
12
12
|
},
|
|
13
|
-
set
|
|
13
|
+
set(_target, _name, _value) {
|
|
14
14
|
return true;
|
|
15
15
|
},
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
18
|
exports.createDataView = createDataView;
|
|
19
|
-
function createDataOptions(options) {
|
|
20
|
-
if (options === void 0) { options = defaultTarget; }
|
|
19
|
+
function createDataOptions(options = defaultTarget) {
|
|
21
20
|
if (typeof options === 'string') {
|
|
22
21
|
return {
|
|
23
22
|
target: options,
|
package/lib/utils/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/utils/data.ts"],"names":[],"mappings":";;;AAEA,MAAM,aAAa,GAAoB,QAAQ,CAAC;AAEhD,SAAgB,cAAc,CAAC,IAA0B;IACvD,MAAM,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,CACL,MAAM,CAAC,SAAS,CAAC;QACjB,IAAI,KAAK,CAAC,IAAI,EAAE;YACd,GAAG,CAAC,MAAM,EAAE,IAAI;gBACd,MAAM,IAAI,GAAG,MAAM,CAAC,IAAc,CAAC,CAAC;gBACpC,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC;YAC5B,CAAC;YACD,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM;gBACxB,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC,CACH,CAAC;AACJ,CAAC;AAdD,wCAcC;AAED,SAAgB,iBAAiB,CAAC,UAA4B,aAAa;IACzE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO;YACL,MAAM,EAAE,OAAO;SAChB,CAAC;KACH;SAAM,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC5E,OAAO,OAAO,CAAC;KAChB;SAAM;QACL,OAAO;YACL,MAAM,EAAE,aAAa;SACtB,CAAC;KACH;AACH,CAAC;AAZD,8CAYC;AAED,SAAgB,iBAAiB,CAAC,OAAiC;IACjE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,OAAO,CAAC;KAChB;SAAM,IAAI,OAAO,YAAY,IAAI,EAAE;QAClC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAC1B;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC;AARD,8CAQC"}
|
package/lib/utils/foreign.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
1
|
+
import { ComponentType, ReactPortal } from 'react';
|
|
2
2
|
import { GlobalStateContext, ForeignComponent } from '../types';
|
|
3
|
+
export declare function attachDomPortal<TProps>(id: string, context: GlobalStateContext, element: HTMLElement | ShadowRoot, component: ComponentType<TProps>, props: TProps): [string, ReactPortal];
|
|
4
|
+
export declare function changeDomPortal<TProps>(id: string, current: ReactPortal, context: GlobalStateContext, element: HTMLElement | ShadowRoot, component: ComponentType<TProps>, props: TProps): [string, ReactPortal];
|
|
3
5
|
export declare function convertComponent<T extends {
|
|
4
6
|
type: string;
|
|
5
7
|
}, U>(converter: (component: T) => ForeignComponent<U>, component: T): ForeignComponent<U>;
|
|
6
|
-
export declare function renderInDom<TProps>(context: GlobalStateContext, element: HTMLElement | ShadowRoot, component: ComponentType<TProps>, props: TProps): string;
|
|
8
|
+
export declare function renderInDom<TProps>(context: GlobalStateContext, element: HTMLElement | ShadowRoot, component: ComponentType<TProps>, props: TProps): [string, ReactPortal];
|
package/lib/utils/foreign.js
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderInDom = exports.convertComponent = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
exports.renderInDom = exports.convertComponent = exports.changeDomPortal = exports.attachDomPortal = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_dom_1 = require("react-dom");
|
|
6
|
+
function attachDomPortal(id, context, element, component, props) {
|
|
7
|
+
const portal = (0, react_dom_1.createPortal)((0, react_1.createElement)(component, props), element);
|
|
8
|
+
context.showPortal(id, portal);
|
|
9
|
+
return [id, portal];
|
|
10
|
+
}
|
|
11
|
+
exports.attachDomPortal = attachDomPortal;
|
|
12
|
+
function changeDomPortal(id, current, context, element, component, props) {
|
|
13
|
+
const next = (0, react_dom_1.createPortal)((0, react_1.createElement)(component, props), element);
|
|
14
|
+
context.updatePortal(id, current, next);
|
|
15
|
+
return [id, next];
|
|
16
|
+
}
|
|
17
|
+
exports.changeDomPortal = changeDomPortal;
|
|
6
18
|
function convertComponent(converter, component) {
|
|
7
19
|
if (typeof converter !== 'function') {
|
|
8
|
-
throw new Error(
|
|
20
|
+
throw new Error(`No converter for component of type "${component.type}" registered.`);
|
|
9
21
|
}
|
|
10
22
|
return converter(component);
|
|
11
23
|
}
|
|
12
24
|
exports.convertComponent = convertComponent;
|
|
13
25
|
function renderInDom(context, element, component, props) {
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
const portalId = 'data-portal-id';
|
|
27
|
+
let parent = element;
|
|
16
28
|
while (parent) {
|
|
17
29
|
if (parent instanceof Element && parent.hasAttribute(portalId)) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
context.showPortal(id, portal);
|
|
21
|
-
return id;
|
|
30
|
+
const id = parent.getAttribute(portalId);
|
|
31
|
+
return attachDomPortal(id, context, element, component, props);
|
|
22
32
|
}
|
|
23
33
|
parent = parent.parentNode || parent.host;
|
|
24
34
|
}
|
|
25
|
-
return
|
|
35
|
+
return attachDomPortal('root', context, element, component, props);
|
|
26
36
|
}
|
|
27
37
|
exports.renderInDom = renderInDom;
|
|
28
38
|
//# sourceMappingURL=foreign.js.map
|
package/lib/utils/foreign.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foreign.js","sourceRoot":"","sources":["../../src/utils/foreign.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"foreign.js","sourceRoot":"","sources":["../../src/utils/foreign.ts"],"names":[],"mappings":";;;AAAA,iCAAkE;AAClE,yCAAyC;AAGzC,SAAgB,eAAe,CAC7B,EAAU,EACV,OAA2B,EAC3B,OAAiC,EACjC,SAAgC,EAChC,KAAa;IAEb,MAAM,MAAM,GAAG,IAAA,wBAAY,EAAC,IAAA,qBAAa,EAAC,SAAS,EAAE,KAAK,CAAC,EAAE,OAAsB,CAAC,CAAC;IACrF,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AACtB,CAAC;AAVD,0CAUC;AAED,SAAgB,eAAe,CAC7B,EAAU,EACV,OAAoB,EACpB,OAA2B,EAC3B,OAAiC,EACjC,SAAgC,EAChC,KAAa;IAEb,MAAM,IAAI,GAAG,IAAA,wBAAY,EAAC,IAAA,qBAAa,EAAC,SAAS,EAAE,KAAK,CAAC,EAAE,OAAsB,CAAC,CAAC;IACnF,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AACpB,CAAC;AAXD,0CAWC;AAED,SAAgB,gBAAgB,CAC9B,SAAgD,EAChD,SAAY;IAEZ,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,uCAAuC,SAAS,CAAC,IAAI,eAAe,CAAC,CAAC;KACvF;IAED,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;AAC9B,CAAC;AATD,4CASC;AAED,SAAgB,WAAW,CACzB,OAA2B,EAC3B,OAAiC,EACjC,SAAgC,EAChC,KAAa;IAEb,MAAM,QAAQ,GAAG,gBAAgB,CAAC;IAClC,IAAI,MAAM,GAAS,OAAO,CAAC;IAE3B,OAAO,MAAM,EAAE;QACb,IAAI,MAAM,YAAY,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;YAC9D,MAAM,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YACzC,OAAO,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;SAChE;QAED,MAAM,GAAG,MAAM,CAAC,UAAU,IAAK,MAAqB,CAAC,IAAI,CAAC;KAC3D;IAED,OAAO,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC;AAnBD,kCAmBC"}
|
package/lib/utils/guid.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildName = exports.generateId = void 0;
|
|
4
4
|
function rand(c) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const r = (Math.random() * 16) | 0;
|
|
6
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
7
7
|
return v.toString(16);
|
|
8
8
|
}
|
|
9
9
|
function generateId() {
|
|
@@ -11,7 +11,7 @@ function generateId() {
|
|
|
11
11
|
}
|
|
12
12
|
exports.generateId = generateId;
|
|
13
13
|
function buildName(prefix, name) {
|
|
14
|
-
return prefix
|
|
14
|
+
return `${prefix}://${name}`;
|
|
15
15
|
}
|
|
16
16
|
exports.buildName = buildName;
|
|
17
17
|
//# sourceMappingURL=guid.js.map
|
package/lib/utils/guid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guid.js","sourceRoot":"","sources":["../../src/utils/guid.ts"],"names":[],"mappings":";;;AAAA,SAAS,IAAI,CAAC,CAAY;IACxB,
|
|
1
|
+
{"version":3,"file":"guid.js","sourceRoot":"","sources":["../../src/utils/guid.ts"],"names":[],"mappings":";;;AAAA,SAAS,IAAI,CAAC,CAAY;IACxB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACvE,CAAC;AAFD,gCAEC;AAED,SAAgB,SAAS,CAAC,MAAc,EAAE,IAAqB;IAC7D,OAAO,GAAG,MAAM,MAAM,IAAI,EAAE,CAAC;AAC/B,CAAC;AAFD,8BAEC"}
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export declare const removeIndicator: any;
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
2
|
+
export declare const none: any[];
|
|
3
|
+
export declare const noop: () => void;
|
|
4
|
+
export declare function prependItem<T>(items: Array<T>, item: T): any[];
|
|
5
|
+
export declare function appendItem<T>(items: Array<T>, item: T): any[];
|
|
6
|
+
export declare function prependItems<T>(items: Array<T>, newItems: Array<T>): any[];
|
|
7
|
+
export declare function appendItems<T>(items: Array<T>, newItems: Array<T>): any[];
|
|
8
|
+
export declare function excludeItem<T>(items: Array<T>, item: T): any[];
|
|
9
|
+
export declare function includeItem<T>(items: Array<T>, item: T): any[];
|
|
10
|
+
export declare function replaceOrAddItem<T>(items: Array<T>, item: T, predicate: (item: T) => boolean): any[];
|
|
9
11
|
export declare function removeNested<T, U = any>(obj: T, predicate: (item: U) => boolean): T;
|
|
10
|
-
export declare function excludeOn<T>(items: Array<T>, predicate: (item: T) => boolean):
|
|
12
|
+
export declare function excludeOn<T>(items: Array<T>, predicate: (item: T) => boolean): any[];
|
|
11
13
|
export declare function updateKey<T, TKey extends keyof T>(obj: T, key: TKey, value: T[TKey]): T;
|
|
12
14
|
export declare function withKey<T, TKey extends keyof T>(obj: T, key: TKey, value: T[TKey]): T;
|
|
13
15
|
export declare function withoutKey<T, TKey extends keyof T>(obj: T, key: TKey): T;
|
|
16
|
+
export declare function tryParseJson(content: string): any;
|
package/lib/utils/helpers.js
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withoutKey = exports.withKey = exports.updateKey = exports.excludeOn = exports.removeNested = exports.replaceOrAddItem = exports.includeItem = exports.excludeItem = exports.appendItems = exports.prependItems = exports.appendItem = exports.prependItem = exports.removeIndicator = void 0;
|
|
4
|
-
|
|
3
|
+
exports.tryParseJson = exports.withoutKey = exports.withKey = exports.updateKey = exports.excludeOn = exports.removeNested = exports.replaceOrAddItem = exports.includeItem = exports.excludeItem = exports.appendItems = exports.prependItems = exports.appendItem = exports.prependItem = exports.noop = exports.none = exports.removeIndicator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
5
|
// tslint:disable-next-line
|
|
6
6
|
exports.removeIndicator = null;
|
|
7
|
+
// to avoid creating unnecessary empty arrays
|
|
8
|
+
exports.none = [];
|
|
9
|
+
// to avoid creating unnecessary empty functions
|
|
10
|
+
const noop = () => { };
|
|
11
|
+
exports.noop = noop;
|
|
7
12
|
function prependItem(items, item) {
|
|
8
|
-
return
|
|
13
|
+
return [item, ...(items || exports.none)];
|
|
9
14
|
}
|
|
10
15
|
exports.prependItem = prependItem;
|
|
11
16
|
function appendItem(items, item) {
|
|
12
|
-
return
|
|
17
|
+
return [...(items || exports.none), item];
|
|
13
18
|
}
|
|
14
19
|
exports.appendItem = appendItem;
|
|
15
20
|
function prependItems(items, newItems) {
|
|
16
|
-
return
|
|
21
|
+
return [...newItems, ...(items || exports.none)];
|
|
17
22
|
}
|
|
18
23
|
exports.prependItems = prependItems;
|
|
19
24
|
function appendItems(items, newItems) {
|
|
20
|
-
return
|
|
25
|
+
return [...(items || exports.none), ...newItems];
|
|
21
26
|
}
|
|
22
27
|
exports.appendItems = appendItems;
|
|
23
28
|
function excludeItem(items, item) {
|
|
24
|
-
return (items ||
|
|
29
|
+
return (items || exports.none).filter((m) => m !== item);
|
|
25
30
|
}
|
|
26
31
|
exports.excludeItem = excludeItem;
|
|
27
32
|
function includeItem(items, item) {
|
|
@@ -29,8 +34,8 @@ function includeItem(items, item) {
|
|
|
29
34
|
}
|
|
30
35
|
exports.includeItem = includeItem;
|
|
31
36
|
function replaceOrAddItem(items, item, predicate) {
|
|
32
|
-
|
|
33
|
-
for (
|
|
37
|
+
const newItems = [...(items || exports.none)];
|
|
38
|
+
for (let i = 0; i < newItems.length; i++) {
|
|
34
39
|
if (predicate(newItems[i])) {
|
|
35
40
|
newItems[i] = item;
|
|
36
41
|
return newItems;
|
|
@@ -41,10 +46,10 @@ function replaceOrAddItem(items, item, predicate) {
|
|
|
41
46
|
}
|
|
42
47
|
exports.replaceOrAddItem = replaceOrAddItem;
|
|
43
48
|
function removeNested(obj, predicate) {
|
|
44
|
-
return Object.keys(obj).reduce(
|
|
45
|
-
|
|
46
|
-
entries[key] = Object.keys(item).reduce(
|
|
47
|
-
|
|
49
|
+
return Object.keys(obj).reduce((entries, key) => {
|
|
50
|
+
const item = obj[key];
|
|
51
|
+
entries[key] = Object.keys(item).reduce((all, key) => {
|
|
52
|
+
const value = item[key];
|
|
48
53
|
if (Array.isArray(value)) {
|
|
49
54
|
all[key] = excludeOn(value, predicate);
|
|
50
55
|
}
|
|
@@ -58,7 +63,7 @@ function removeNested(obj, predicate) {
|
|
|
58
63
|
}
|
|
59
64
|
exports.removeNested = removeNested;
|
|
60
65
|
function excludeOn(items, predicate) {
|
|
61
|
-
return (items ||
|
|
66
|
+
return (items || exports.none).filter((m) => !predicate(m));
|
|
62
67
|
}
|
|
63
68
|
exports.excludeOn = excludeOn;
|
|
64
69
|
function updateKey(obj, key, value) {
|
|
@@ -66,13 +71,21 @@ function updateKey(obj, key, value) {
|
|
|
66
71
|
}
|
|
67
72
|
exports.updateKey = updateKey;
|
|
68
73
|
function withKey(obj, key, value) {
|
|
69
|
-
|
|
70
|
-
return tslib_1.__assign(tslib_1.__assign({}, obj), (_a = {}, _a[key] = value, _a));
|
|
74
|
+
return Object.assign(Object.assign({}, obj), { [key]: value });
|
|
71
75
|
}
|
|
72
76
|
exports.withKey = withKey;
|
|
73
77
|
function withoutKey(obj, key) {
|
|
74
|
-
|
|
78
|
+
const _a = obj || {}, _b = key, _ = _a[_b], newObj = (0, tslib_1.__rest)(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
75
79
|
return newObj;
|
|
76
80
|
}
|
|
77
81
|
exports.withoutKey = withoutKey;
|
|
82
|
+
function tryParseJson(content) {
|
|
83
|
+
try {
|
|
84
|
+
return JSON.parse(content);
|
|
85
|
+
}
|
|
86
|
+
catch (_a) {
|
|
87
|
+
return {};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.tryParseJson = tryParseJson;
|
|
78
91
|
//# sourceMappingURL=helpers.js.map
|
package/lib/utils/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":";;;;AAAA,2BAA2B;AACd,QAAA,eAAe,GAAG,IAAI,CAAC;AAEpC,SAAgB,WAAW,CAAI,KAAe,EAAE,IAAO;IACrD,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"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"}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./compare"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./data"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./foreign"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./guid"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./helpers"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./media"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./react"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./storage"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./compare"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./data"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./foreign"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./guid"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./helpers"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./media"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./react"), exports);
|
|
11
|
+
(0, tslib_1.__exportStar)(require("./storage"), exports);
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,yDAA0B;AAC1B,sDAAuB;AACvB,yDAA0B;AAC1B,sDAAuB;AACvB,yDAA0B;AAC1B,uDAAwB;AACxB,uDAAwB;AACxB,yDAA0B"}
|
package/lib/utils/media.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCurrentLayout = exports.defaultBreakpoints = exports.defaultLayouts = void 0;
|
|
4
|
-
|
|
4
|
+
const piral_base_1 = require("piral-base");
|
|
5
|
+
const helpers_1 = require("./helpers");
|
|
5
6
|
exports.defaultLayouts = ['desktop', 'tablet', 'mobile'];
|
|
6
7
|
exports.defaultBreakpoints = ['(min-width: 991px)', '(min-width: 481px)', '(max-width: 480px)'];
|
|
7
|
-
|
|
8
|
-
?
|
|
9
|
-
:
|
|
8
|
+
const mm = typeof window === 'undefined' || !(0, piral_base_1.isfunc)(window.matchMedia)
|
|
9
|
+
? () => ({ matches: helpers_1.none })
|
|
10
|
+
: (q) => window.matchMedia(q);
|
|
10
11
|
function getCurrentLayout(breakpoints, layouts, defaultLayout) {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const query = breakpoints.findIndex((q) => mm(q).matches);
|
|
13
|
+
const layout = layouts[query];
|
|
13
14
|
return layout !== undefined ? layout : defaultLayout;
|
|
14
15
|
}
|
|
15
16
|
exports.getCurrentLayout = getCurrentLayout;
|
package/lib/utils/media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AACpC,uCAAiC;AAGpB,QAAA,cAAc,GAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAE9D,QAAA,kBAAkB,GAAsB,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAExH,MAAM,EAAE,GACN,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,IAAA,mBAAM,EAAC,MAAM,CAAC,UAAU,CAAC;IACzD,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,cAAI,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE1C,SAAgB,gBAAgB,CAAI,WAA0B,EAAE,OAAiB,EAAE,aAAgB;IACjG,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC;AACvD,CAAC;AAJD,4CAIC"}
|
package/lib/utils/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultRender = void 0;
|
|
4
|
-
|
|
4
|
+
const React = require("react");
|
|
5
5
|
function defaultRender(children, key) {
|
|
6
6
|
return React.createElement(React.Fragment, { key: key }, children);
|
|
7
7
|
}
|
package/lib/utils/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/utils/react.tsx"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/utils/react.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,SAAgB,aAAa,CAAC,QAAyB,EAAE,GAAY;IACnE,OAAO,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,IAAG,QAAQ,CAAkB,CAAC;AAC/D,CAAC;AAFD,sCAEC"}
|
package/lib/utils/storage.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cookie = exports.storage = void 0;
|
|
4
|
-
|
|
4
|
+
const crx = /\s*(.*?)=(.*?)($|;|,(?! ))/g;
|
|
5
5
|
exports.storage = {
|
|
6
|
-
setItem
|
|
6
|
+
setItem(name, data) {
|
|
7
7
|
return localStorage.setItem(name, data);
|
|
8
8
|
},
|
|
9
|
-
getItem
|
|
9
|
+
getItem(name) {
|
|
10
10
|
return localStorage.getItem(name);
|
|
11
11
|
},
|
|
12
|
-
removeItem
|
|
12
|
+
removeItem(name) {
|
|
13
13
|
return localStorage.removeItem(name);
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
exports.cookie = {
|
|
17
|
-
setItem
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
document.cookie = name + "=" + encodeURIComponent(data) + ";expires=\"" + expires + "\";path=/;" + domainPart;
|
|
17
|
+
setItem(name, data, expires = '') {
|
|
18
|
+
const domain = location.hostname;
|
|
19
|
+
const domainPart = domain ? `domain=.${domain};` : '';
|
|
20
|
+
document.cookie = `${name}=${encodeURIComponent(data)};expires="${expires}";path=/;${domainPart}`;
|
|
22
21
|
},
|
|
23
|
-
getItem
|
|
24
|
-
return document.cookie.replace(crx,
|
|
22
|
+
getItem(name) {
|
|
23
|
+
return document.cookie.replace(crx, (_m, p1, p2) => (name === p1 ? p2 : ''));
|
|
25
24
|
},
|
|
26
|
-
removeItem
|
|
25
|
+
removeItem(name) {
|
|
27
26
|
this.setItem(name, '', '-1');
|
|
28
27
|
},
|
|
29
28
|
};
|
package/lib/utils/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/utils/storage.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/utils/storage.ts"],"names":[],"mappings":";;;AAEA,MAAM,GAAG,GAAG,6BAA6B,CAAC;AAE7B,QAAA,OAAO,GAAiB;IACnC,OAAO,CAAC,IAAY,EAAE,IAAY;QAChC,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,CAAC,IAAY;QAClB,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,UAAU,CAAC,IAAY;QACrB,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF,CAAC;AAEW,QAAA,MAAM,GAAiB;IAClC,OAAO,CAAC,IAAY,EAAE,IAAY,EAAE,OAAO,GAAG,EAAE;QAC9C,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACjC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,IAAI,kBAAkB,CAAC,IAAI,CAAC,aAAa,OAAO,YAAY,UAAU,EAAE,CAAC;IACpG,CAAC;IACD,OAAO,CAAC,IAAY;QAClB,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAO,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpG,CAAC;IACD,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta.3157",
|
|
4
4
|
"description": "The core library for creating a Piral instance.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"esm",
|
|
23
23
|
"lib",
|
|
24
24
|
"src",
|
|
25
|
+
"debug-pilet.d.ts",
|
|
26
|
+
"debug-piral.d.ts",
|
|
27
|
+
"debug-pilet.js",
|
|
28
|
+
"debug-piral.js",
|
|
25
29
|
"dependencies.codegen",
|
|
26
30
|
"dependencies.codegen.native.js"
|
|
27
31
|
],
|
|
@@ -37,7 +41,8 @@
|
|
|
37
41
|
"url": "https://github.com/smapiot/piral/issues"
|
|
38
42
|
},
|
|
39
43
|
"scripts": {
|
|
40
|
-
"build": "yarn build:commonjs && yarn build:esnext",
|
|
44
|
+
"build": "yarn build:commonjs && yarn build:esnext && yarn build:convert",
|
|
45
|
+
"build:convert": "tsc debug-pilet.ts debug-piral.ts --skipLibCheck --declaration",
|
|
41
46
|
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
|
|
42
47
|
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
|
|
43
48
|
"typedoc": "typedoc --json ../../../docs/types/piral-core.json src --exclude \"src/**/*.test.*\"",
|
|
@@ -57,10 +62,21 @@
|
|
|
57
62
|
"react-router": ">=5.0.0",
|
|
58
63
|
"react-router-dom": ">=5.0.0"
|
|
59
64
|
},
|
|
65
|
+
"sharedDependencies": [
|
|
66
|
+
"react",
|
|
67
|
+
"react-dom",
|
|
68
|
+
"react-router",
|
|
69
|
+
"react-router-dom",
|
|
70
|
+
"history",
|
|
71
|
+
"tslib",
|
|
72
|
+
"path-to-regexp",
|
|
73
|
+
"@libre/atom",
|
|
74
|
+
"@dbeining/react-atom"
|
|
75
|
+
],
|
|
60
76
|
"dependencies": {
|
|
61
77
|
"@dbeining/react-atom": "^4.0.0",
|
|
62
|
-
"piral-base": "^0.
|
|
63
|
-
"piral-debug-utils": "^0.
|
|
78
|
+
"piral-base": "^0.14.0-beta.3157",
|
|
79
|
+
"piral-debug-utils": "^0.14.0-beta.3157"
|
|
64
80
|
},
|
|
65
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "1928e46becee1444f84df8e80a81aa12712d17e2"
|
|
66
82
|
}
|