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/lib/createInstance.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createInstance = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const piral_base_1 = require("piral-base");
|
|
6
|
+
const modules_1 = require("./modules");
|
|
7
|
+
const state_1 = require("./state");
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
9
|
/**
|
|
10
10
|
* Creates a new PiralInstance component, which can be used for
|
|
11
11
|
* bootstrapping the application easily.
|
|
@@ -26,41 +26,40 @@ const app = (
|
|
|
26
26
|
render(app, document.querySelector('#app'));
|
|
27
27
|
```
|
|
28
28
|
*/
|
|
29
|
-
function createInstance(config) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var root = createApi({
|
|
29
|
+
function createInstance(config = {}) {
|
|
30
|
+
const { state, actions, availablePilets = [], plugins, requestPilets = modules_1.defaultModuleRequester, loaderConfig, async = false, shareDependencies = modules_1.defaultDependencySelector, loadPilet, loaders, debug, apiFactory = modules_1.defaultApiFactory, } = config;
|
|
31
|
+
const globalState = (0, state_1.createGlobalState)(state);
|
|
32
|
+
const events = (0, piral_base_1.createListener)(globalState);
|
|
33
|
+
const context = (0, state_1.createActions)(globalState, events);
|
|
34
|
+
const definedPlugins = plugins || [];
|
|
35
|
+
const usedPlugins = Array.isArray(definedPlugins) ? definedPlugins : [definedPlugins];
|
|
36
|
+
const createApi = apiFactory(context, usedPlugins);
|
|
37
|
+
const root = createApi({
|
|
39
38
|
name: 'root',
|
|
40
39
|
version: process.env.BUILD_PCKG_VERSION || '1.0.0',
|
|
41
40
|
spec: '',
|
|
42
41
|
});
|
|
43
|
-
|
|
44
|
-
context
|
|
45
|
-
createApi
|
|
46
|
-
loaders
|
|
47
|
-
loadPilet
|
|
48
|
-
availablePilets
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
const options = (0, helpers_1.createPiletOptions)({
|
|
43
|
+
context,
|
|
44
|
+
createApi,
|
|
45
|
+
loaders,
|
|
46
|
+
loadPilet,
|
|
47
|
+
availablePilets,
|
|
48
|
+
loaderConfig,
|
|
49
|
+
shareDependencies,
|
|
50
|
+
strategy: (0, piral_base_1.isfunc)(async) ? async : async ? piral_base_1.blazingStrategy : piral_base_1.standardStrategy,
|
|
51
|
+
requestPilets,
|
|
52
|
+
debug,
|
|
54
53
|
});
|
|
55
54
|
if (actions) {
|
|
56
|
-
state_1.includeActions(context, actions);
|
|
55
|
+
(0, state_1.includeActions)(context, actions);
|
|
57
56
|
}
|
|
58
57
|
context.options = options;
|
|
59
|
-
return tslib_1.__assign(events, {
|
|
60
|
-
createApi
|
|
61
|
-
context
|
|
62
|
-
root
|
|
63
|
-
options
|
|
58
|
+
return (0, tslib_1.__assign)(events, {
|
|
59
|
+
createApi,
|
|
60
|
+
context,
|
|
61
|
+
root,
|
|
62
|
+
options,
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
65
|
exports.createInstance = createInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInstance.js","sourceRoot":"","sources":["../src/createInstance.tsx"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"createInstance.js","sourceRoot":"","sources":["../src/createInstance.tsx"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,2CAAuF;AACvF,uCAAiG;AACjG,mCAA2E;AAC3E,uCAA+C;AAG/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,cAAc,CAAC,SAA6B,EAAE;IAC5D,MAAM,EACJ,KAAK,EACL,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,OAAO,EACP,aAAa,GAAG,gCAAsB,EACtC,YAAY,EACZ,KAAK,GAAG,KAAK,EACb,iBAAiB,GAAG,mCAAyB,EAC7C,SAAS,EACT,OAAO,EACP,KAAK,EACL,UAAU,GAAG,2BAAiB,GAC/B,GAAG,MAAM,CAAC;IACX,MAAM,WAAW,GAAG,IAAA,yBAAiB,EAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAA,2BAAc,EAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACtF,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,SAAS,CAAC;QACrB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,OAAO;QAClD,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAA,4BAAkB,EAAC;QACjC,OAAO;QACP,SAAS;QACT,OAAO;QACP,SAAS;QACT,eAAe;QACf,YAAY;QACZ,iBAAiB;QACjB,QAAQ,EAAE,IAAA,mBAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,4BAAe,CAAC,CAAC,CAAC,6BAAgB;QAC5E,aAAa;QACb,KAAK;KACN,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE;QACX,IAAA,sBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAClC;IAED,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAE1B,OAAO,IAAA,gBAAQ,EAAC,MAAM,EAAE;QACtB,SAAS;QACT,OAAO;QACP,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAnDD,wCAmDC"}
|
package/lib/helpers.d.ts
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
import { PiletApiCreator, LoadPiletsOptions, CustomSpecLoaders, DefaultLoaderConfig,
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
* Creates a dependency getter that sets the shared dependencies explicitly.
|
|
5
|
-
* Overrides the potentially set shared dependencies from the Piral CLI, but
|
|
6
|
-
* keeps all global dependencies such as react, react-dom, ...
|
|
7
|
-
* @param sharedDependencies The shared dependencies to declare.
|
|
8
|
-
*/
|
|
9
|
-
export declare function setSharedDependencies(sharedDependencies: AvailableDependencies): () => {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Creates a dependency getter that extends the shared dependencies with additional dependencies.
|
|
14
|
-
* @param additionalDependencies The additional dependencies to declare.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extendSharedDependencies(additionalDependencies: AvailableDependencies): () => {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
};
|
|
1
|
+
import { PiletApiCreator, LoadPiletsOptions, CustomSpecLoaders, DefaultLoaderConfig, PiletLoader } from 'piral-base';
|
|
2
|
+
import { DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
3
|
+
import type { Pilet, PiletRequester, GlobalStateContext, PiletLoadingStrategy, DependencySelector } from './types';
|
|
19
4
|
export interface PiletOptionsConfig {
|
|
5
|
+
context: GlobalStateContext;
|
|
6
|
+
loaders?: CustomSpecLoaders;
|
|
7
|
+
loaderConfig?: DefaultLoaderConfig;
|
|
20
8
|
availablePilets: Array<Pilet>;
|
|
21
|
-
createApi: PiletApiCreator;
|
|
22
|
-
fetchDependency: PiletDependencyFetcher;
|
|
23
|
-
getDependencies: PiletDependencyGetter;
|
|
24
9
|
strategy: PiletLoadingStrategy;
|
|
25
|
-
|
|
26
|
-
loaderConfig?: DefaultLoaderConfig;
|
|
27
|
-
loaders?: CustomSpecLoaders;
|
|
10
|
+
createApi: PiletApiCreator;
|
|
28
11
|
loadPilet: PiletLoader;
|
|
29
|
-
|
|
12
|
+
requestPilets: PiletRequester;
|
|
13
|
+
shareDependencies: DependencySelector;
|
|
14
|
+
debug?: DebuggerExtensionOptions;
|
|
30
15
|
}
|
|
31
|
-
export declare function createPiletOptions({ context,
|
|
16
|
+
export declare function createPiletOptions({ context, loaders, loaderConfig, availablePilets, strategy, createApi, loadPilet, requestPilets, shareDependencies, debug, }: PiletOptionsConfig): LoadPiletsOptions;
|
package/lib/helpers.js
CHANGED
|
@@ -1,69 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPiletOptions =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return function () { return dependencies; };
|
|
17
|
-
}
|
|
18
|
-
exports.setSharedDependencies = setSharedDependencies;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a dependency getter that extends the shared dependencies with additional dependencies.
|
|
21
|
-
* @param additionalDependencies The additional dependencies to declare.
|
|
22
|
-
*/
|
|
23
|
-
function extendSharedDependencies(additionalDependencies) {
|
|
24
|
-
var dependencies = tslib_1.__assign(tslib_1.__assign({}, modules_1.getLocalDependencies()), additionalDependencies);
|
|
25
|
-
return function () { return dependencies; };
|
|
26
|
-
}
|
|
27
|
-
exports.extendSharedDependencies = extendSharedDependencies;
|
|
28
|
-
function createPiletOptions(_a) {
|
|
29
|
-
var context = _a.context, createApi = _a.createApi, availablePilets = _a.availablePilets, fetchDependency = _a.fetchDependency, getDependencies = _a.getDependencies, loaderConfig = _a.loaderConfig, loadPilet = _a.loadPilet, strategy = _a.strategy, loaders = _a.loaders, requestPilets = _a.requestPilets;
|
|
30
|
-
getDependencies = piral_base_1.getDependencyResolver(modules_1.globalDependencies, getDependencies);
|
|
31
|
-
loadPilet = piral_base_1.extendLoader(loadPilet !== null && loadPilet !== void 0 ? loadPilet : piral_base_1.getDefaultLoader(getDependencies, fetchDependency, loaderConfig), loaders);
|
|
3
|
+
exports.createPiletOptions = void 0;
|
|
4
|
+
const piral_base_1 = require("piral-base");
|
|
5
|
+
const modules_1 = require("./modules");
|
|
6
|
+
function createPiletOptions({ context, loaders, loaderConfig, availablePilets, strategy, createApi, loadPilet, requestPilets, shareDependencies, debug, }) {
|
|
7
|
+
const options = {
|
|
8
|
+
config: loaderConfig,
|
|
9
|
+
strategy,
|
|
10
|
+
loadPilet: (0, piral_base_1.extendLoader)(loadPilet !== null && loadPilet !== void 0 ? loadPilet : (0, piral_base_1.getDefaultLoader)(loaderConfig), loaders),
|
|
11
|
+
createApi,
|
|
12
|
+
pilets: availablePilets,
|
|
13
|
+
fetchPilets: requestPilets,
|
|
14
|
+
dependencies: shareDependencies(modules_1.globalDependencies),
|
|
15
|
+
};
|
|
32
16
|
// if we build the debug version of piral (debug and emulator build)
|
|
33
17
|
if (process.env.DEBUG_PIRAL) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
context: context,
|
|
37
|
-
createApi: createApi,
|
|
38
|
-
getDependencies: getDependencies,
|
|
39
|
-
loadPilet: loadPilet,
|
|
40
|
-
requestPilets: requestPilets,
|
|
41
|
-
onChange: function (cb) {
|
|
42
|
-
react_atom_1.addChangeHandler(context.state, 'debugging', function (_a) {
|
|
43
|
-
var previous = _a.previous, current = _a.current;
|
|
44
|
-
cb(previous, current);
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
});
|
|
18
|
+
const { integrate } = require('../debug-piral');
|
|
19
|
+
integrate(context, options, debug);
|
|
48
20
|
}
|
|
21
|
+
// if we build the emulator version of piral (shipped to pilets)
|
|
49
22
|
if (process.env.DEBUG_PILET) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
inject: context.injectPilet,
|
|
53
|
-
createApi: createApi,
|
|
54
|
-
loadPilet: loadPilet,
|
|
55
|
-
});
|
|
23
|
+
const { integrate } = require('../debug-pilet');
|
|
24
|
+
integrate(context, options);
|
|
56
25
|
}
|
|
57
|
-
return
|
|
58
|
-
config: loaderConfig,
|
|
59
|
-
strategy: strategy,
|
|
60
|
-
loadPilet: loadPilet,
|
|
61
|
-
createApi: createApi,
|
|
62
|
-
getDependencies: getDependencies,
|
|
63
|
-
pilets: availablePilets,
|
|
64
|
-
fetchPilets: requestPilets,
|
|
65
|
-
dependencies: modules_1.globalDependencies,
|
|
66
|
-
};
|
|
26
|
+
return options;
|
|
67
27
|
}
|
|
68
28
|
exports.createPiletOptions = createPiletOptions;
|
|
69
29
|
//# sourceMappingURL=helpers.js.map
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.tsx"],"names":[],"mappings":";;;AAAA,2CAQoB;AAEpB,uCAA+C;AAgB/C,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,OAAO,EACP,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,SAAS,EACT,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,KAAK,GACc;IACnB,MAAM,OAAO,GAAsB;QACjC,MAAM,EAAE,YAAY;QACpB,QAAQ;QACR,SAAS,EAAE,IAAA,yBAAY,EAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAA,6BAAgB,EAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAC7E,SAAS;QACT,MAAM,EAAE,eAAe;QACvB,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,iBAAiB,CAAC,4BAAkB,CAAC;KACpD,CAAC;IAEF,oEAAoE;IACpE,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QAC3B,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAChD,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;KACpC;IAED,gEAAgE;IAChE,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QAC3B,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAChD,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAC7B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAnCD,gDAmCC"}
|
package/lib/hooks/action.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAction = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const stateContext_1 = require("../state/stateContext");
|
|
6
6
|
/**
|
|
7
7
|
* Hook that gets an action for manipulating the global state.
|
|
8
8
|
* @param action The name of the action to retrieve.
|
|
9
9
|
*/
|
|
10
10
|
function useAction(action) {
|
|
11
|
-
|
|
11
|
+
const ctx = (0, react_1.useContext)(stateContext_1.StateContext);
|
|
12
12
|
return ctx[action];
|
|
13
13
|
}
|
|
14
14
|
exports.useAction = useAction;
|
package/lib/hooks/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/hooks/action.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/hooks/action.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,wDAAqD;AAGrD;;;GAGG;AACH,SAAgB,SAAS,CAA+B,MAAS;IAC/D,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,2BAAY,CAAC,CAAC;IACrC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC;AAHD,8BAGC"}
|
package/lib/hooks/actions.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useActions = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const stateContext_1 = require("../state/stateContext");
|
|
7
7
|
/**
|
|
8
8
|
* Hook that gets the actions for manipulating the global state.
|
|
9
9
|
*/
|
|
10
10
|
function useActions() {
|
|
11
|
-
|
|
11
|
+
const _a = (0, react_1.useContext)(stateContext_1.StateContext), { state } = _a, actions = (0, tslib_1.__rest)(_a, ["state"]);
|
|
12
12
|
return actions;
|
|
13
13
|
}
|
|
14
14
|
exports.useActions = useActions;
|
package/lib/hooks/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/hooks/actions.ts"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/hooks/actions.ts"],"names":[],"mappings":";;;;AAAA,iCAAmC;AACnC,wDAAqD;AAGrD;;GAEG;AACH,SAAgB,UAAU;IACxB,MAAM,KAAwB,IAAA,kBAAU,EAAqB,2BAAY,CAAC,EAApE,EAAE,KAAK,OAA6D,EAAxD,OAAO,2BAAnB,SAAqB,CAA+C,CAAC;IAC3E,OAAO,OAAuB,CAAC;AACjC,CAAC;AAHD,gCAGC"}
|
package/lib/hooks/globalState.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useGlobalState = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_atom_1 = require("@dbeining/react-atom");
|
|
6
|
+
const stateContext_1 = require("../state/stateContext");
|
|
7
|
+
const useGlobalAtom = typeof window !== 'undefined' ? react_atom_1.useAtom : useDirectAtom;
|
|
8
8
|
function useDirectAtom(atom, opts) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const state = (0, react_atom_1.deref)(atom);
|
|
10
|
+
const select = opts && opts.select;
|
|
11
11
|
return typeof select === 'function' ? select(state) : state;
|
|
12
12
|
}
|
|
13
13
|
function useGlobalState(select) {
|
|
14
|
-
|
|
15
|
-
return useGlobalAtom(state, select && { select
|
|
14
|
+
const { state } = (0, react_1.useContext)(stateContext_1.StateContext);
|
|
15
|
+
return useGlobalAtom(state, select && { select });
|
|
16
16
|
}
|
|
17
17
|
exports.useGlobalState = useGlobalState;
|
|
18
18
|
//# sourceMappingURL=globalState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalState.js","sourceRoot":"","sources":["../../src/hooks/globalState.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"globalState.js","sourceRoot":"","sources":["../../src/hooks/globalState.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,qDAAsD;AACtD,wDAAqD;AAGrD,MAAM,aAAa,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,oBAAO,CAAC,CAAC,CAAC,aAAa,CAAC;AAE9E,SAAS,aAAa,CAAC,IAAS,EAAE,IAAS;IACzC,MAAM,KAAK,GAAG,IAAA,kBAAK,EAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,MAAM,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC;IACnC,OAAO,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9D,CAAC;AAeD,SAAgB,cAAc,CAAI,MAAkC;IAClE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,kBAAU,EAAC,2BAAY,CAAC,CAAC;IAC3C,OAAO,aAAa,CAAC,KAAK,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAHD,wCAGC"}
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export * from './action';
|
|
2
2
|
export * from './actions';
|
|
3
|
-
export * from './debounce';
|
|
4
3
|
export * from './globalState';
|
|
5
|
-
export * from './lockBodyScroll';
|
|
6
4
|
export * from './media';
|
|
7
|
-
export * from './onClickOutside';
|
|
8
|
-
export * from './onScreenVisible';
|
|
9
|
-
export * from './promise';
|
|
10
5
|
export * from './setter';
|
|
11
6
|
export * from './sharedData';
|
package/lib/hooks/index.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./action"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./actions"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./
|
|
7
|
-
tslib_1.__exportStar(require("./
|
|
8
|
-
tslib_1.__exportStar(require("./
|
|
9
|
-
tslib_1.__exportStar(require("./
|
|
10
|
-
tslib_1.__exportStar(require("./onClickOutside"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./onScreenVisible"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./promise"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./setter"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./sharedData"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./action"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./actions"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./globalState"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./media"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./setter"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./sharedData"), exports);
|
|
15
10
|
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyB;AACzB,yDAA0B;AAC1B,6DAA8B;AAC9B,uDAAwB;AACxB,wDAAyB;AACzB,4DAA6B"}
|
package/lib/hooks/media.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMedia = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const helpers_1 = require("../utils/helpers");
|
|
6
|
+
const media_1 = require("../utils/media");
|
|
6
7
|
/**
|
|
7
8
|
* Hook to detect layout changes (e.g., which UI breakpoint was hit).
|
|
8
9
|
* @param queries The available queries matching the breakpoints.
|
|
@@ -10,15 +11,15 @@ var media_1 = require("../utils/media");
|
|
|
10
11
|
* @param defaultValue The default value.
|
|
11
12
|
*/
|
|
12
13
|
function useMedia(queries, values, defaultValue) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
react_1.useEffect(
|
|
14
|
+
const match = () => (0, media_1.getCurrentLayout)(queries, values, defaultValue);
|
|
15
|
+
const [value, update] = (0, react_1.useState)(match);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
16
17
|
if (typeof document !== 'undefined') {
|
|
17
|
-
|
|
18
|
-
window.addEventListener('resize',
|
|
19
|
-
return
|
|
18
|
+
const handler = () => update(match);
|
|
19
|
+
window.addEventListener('resize', handler);
|
|
20
|
+
return () => window.removeEventListener('resize', handler);
|
|
20
21
|
}
|
|
21
|
-
},
|
|
22
|
+
}, helpers_1.none);
|
|
22
23
|
return value;
|
|
23
24
|
}
|
|
24
25
|
exports.useMedia = useMedia;
|
package/lib/hooks/media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/hooks/media.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/hooks/media.ts"],"names":[],"mappings":";;;AAAA,iCAA4C;AAC5C,8CAAwC;AACxC,0CAAkD;AAElD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAI,OAAsB,EAAE,MAAgB,EAAE,YAAe;IACnF,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,IAAA,wBAAgB,EAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACpE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAExC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC3C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAC5D;IACH,CAAC,EAAE,cAAI,CAAC,CAAC;IAET,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,4BAaC"}
|
package/lib/hooks/setter.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSetter = void 0;
|
|
4
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const helpers_1 = require("../utils/helpers");
|
|
5
6
|
function useMainEffect(cb) {
|
|
6
7
|
cb();
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
const useEffect = typeof window !== 'undefined' ? react_1.useEffect : useMainEffect;
|
|
9
10
|
/**
|
|
10
11
|
* Hook for running the callback once on mount.
|
|
11
12
|
* @param cb The callback to be invoked on mounting.
|
|
12
13
|
*/
|
|
13
14
|
function useSetter(cb) {
|
|
14
|
-
useEffect(cb,
|
|
15
|
+
useEffect(cb, helpers_1.none);
|
|
15
16
|
}
|
|
16
17
|
exports.useSetter = useSetter;
|
|
17
18
|
//# sourceMappingURL=setter.js.map
|
package/lib/hooks/setter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setter.js","sourceRoot":"","sources":["../../src/hooks/setter.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"setter.js","sourceRoot":"","sources":["../../src/hooks/setter.ts"],"names":[],"mappings":";;;AAAA,iCAAmD;AACnD,8CAAwC;AAExC,SAAS,aAAa,CAAC,EAAc;IACnC,EAAE,EAAE,CAAC;AACP,CAAC;AAED,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,iBAAa,CAAC,CAAC,CAAC,aAAa,CAAC;AAEhF;;;GAGG;AACH,SAAgB,SAAS,CAAC,EAAc;IACtC,SAAS,CAAC,EAAE,EAAE,cAAI,CAAC,CAAC;AACtB,CAAC;AAFD,8BAEC"}
|
package/lib/hooks/sharedData.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSharedData = void 0;
|
|
4
|
-
|
|
4
|
+
const globalState_1 = require("./globalState");
|
|
5
5
|
function useSharedData(s) {
|
|
6
|
-
|
|
7
|
-
return globalState_1.useGlobalState(
|
|
6
|
+
const select = s || ((m) => m);
|
|
7
|
+
return (0, globalState_1.useGlobalState)((s) => select(s.data));
|
|
8
8
|
}
|
|
9
9
|
exports.useSharedData = useSharedData;
|
|
10
10
|
//# sourceMappingURL=sharedData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedData.js","sourceRoot":"","sources":["../../src/hooks/sharedData.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"sharedData.js","sourceRoot":"","sources":["../../src/hooks/sharedData.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAgB/C,SAAgB,aAAa,CAAI,CAAiD;IAChF,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,IAAA,4BAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC;AAHD,sCAGC"}
|
package/lib/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("./createInstance"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./Piral"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./helpers"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./components"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./hooks"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./state"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./utils"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./createInstance"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./Piral"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./helpers"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./components"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./hooks"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./state"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./utils"), exports);
|
|
11
|
+
(0, tslib_1.__exportStar)(require("./types"), exports);
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;AAAA,gEAAiC;AACjC,uDAAwB;AACxB,yDAA0B;AAC1B,4DAA6B;AAC7B,uDAAwB;AACxB,uDAAwB;AACxB,uDAAwB;AACxB,uDAAwB"}
|