sample-piral 0.14.1-beta.3256 → 0.14.3-beta.3296

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.
@@ -1377,7 +1377,8 @@ __webpack_require__.r(__webpack_exports__);
1377
1377
  /* harmony export */ "blazingStrategy": () => (/* binding */ blazingStrategy),
1378
1378
  /* harmony export */ "asyncStrategy": () => (/* binding */ asyncStrategy),
1379
1379
  /* harmony export */ "standardStrategy": () => (/* binding */ standardStrategy),
1380
- /* harmony export */ "syncStrategy": () => (/* binding */ syncStrategy)
1380
+ /* harmony export */ "syncStrategy": () => (/* binding */ syncStrategy),
1381
+ /* harmony export */ "createDeferredStrategy": () => (/* binding */ createDeferredStrategy)
1381
1382
  /* harmony export */ });
1382
1383
  /* harmony import */ var _loader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./loader */ "../../framework/piral-base/esm/loader.js");
1383
1384
  /* harmony import */ var _load__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./load */ "../../framework/piral-base/esm/load.js");
@@ -1572,6 +1573,24 @@ function syncStrategy(options, cb) {
1572
1573
  });
1573
1574
  });
1574
1575
  }
1576
+ /**
1577
+ * Creates a strategy that deferres the actual loading until a trigger promise resolves.
1578
+ * The loading spinner is not shown during this time and pilets are supposed to appear directly.
1579
+ * @param trigger The trigger resolving when the strategy should be applied.
1580
+ * @param strategy The strategy to apply. Falls back to the standard strategy.
1581
+ * @returns A pilet loading strategy.
1582
+ */
1583
+
1584
+ function createDeferredStrategy(trigger) {
1585
+ var strategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : standardStrategy;
1586
+ return function (options, cb) {
1587
+ cb(undefined, []);
1588
+ trigger.then(function () {
1589
+ return strategy(options, cb);
1590
+ });
1591
+ return Promise.resolve();
1592
+ };
1593
+ }
1575
1594
 
1576
1595
  /***/ }),
1577
1596
 
@@ -3167,7 +3186,7 @@ function createInstance() {
3167
3186
  var createApi = apiFactory(context, usedPlugins);
3168
3187
  var root = createApi({
3169
3188
  name: 'root',
3170
- version: "0.14.1-beta.3256" || 0,
3189
+ version: "0.14.3-beta.3296" || 0,
3171
3190
  spec: ''
3172
3191
  });
3173
3192
  var options = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.createPiletOptions)({
@@ -3265,9 +3284,7 @@ __webpack_require__.r(__webpack_exports__);
3265
3284
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3266
3285
  /* harmony export */ "useAction": () => (/* binding */ useAction)
3267
3286
  /* harmony export */ });
3268
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
3269
- /* harmony import */ var _state_stateContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../state/stateContext */ "../../framework/piral-core/esm/state/stateContext.js");
3270
-
3287
+ /* harmony import */ var _globalState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./globalState */ "../../framework/piral-core/esm/hooks/globalState.js");
3271
3288
 
3272
3289
  /**
3273
3290
  * Hook that gets an action for manipulating the global state.
@@ -3275,7 +3292,7 @@ __webpack_require__.r(__webpack_exports__);
3275
3292
  */
3276
3293
 
3277
3294
  function useAction(action) {
3278
- var ctx = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_state_stateContext__WEBPACK_IMPORTED_MODULE_1__.StateContext);
3295
+ var ctx = (0,_globalState__WEBPACK_IMPORTED_MODULE_0__.useGlobalStateContext)();
3279
3296
  return ctx[action];
3280
3297
  }
3281
3298
 
@@ -3321,6 +3338,7 @@ function useActions() {
3321
3338
  "use strict";
3322
3339
  __webpack_require__.r(__webpack_exports__);
3323
3340
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3341
+ /* harmony export */ "useGlobalStateContext": () => (/* binding */ useGlobalStateContext),
3324
3342
  /* harmony export */ "useGlobalState": () => (/* binding */ useGlobalState)
3325
3343
  /* harmony export */ });
3326
3344
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
@@ -3337,10 +3355,20 @@ function useDirectAtom(atom, opts) {
3337
3355
  var select = opts && opts.select;
3338
3356
  return typeof select === 'function' ? select(state) : state;
3339
3357
  }
3358
+ /**
3359
+ * Hook to obtain the global state context, which gives you directly
3360
+ * all actions, state, and more of the Piral instance.
3361
+ * If you are only interested in reading out the state, use the
3362
+ * `useGlobalState` hook instead.
3363
+ */
3364
+
3340
3365
 
3366
+ function useGlobalStateContext() {
3367
+ return (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_state_stateContext__WEBPACK_IMPORTED_MODULE_2__.StateContext);
3368
+ }
3341
3369
  function useGlobalState(select) {
3342
- var _useContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_state_stateContext__WEBPACK_IMPORTED_MODULE_2__.StateContext),
3343
- state = _useContext.state;
3370
+ var _useGlobalStateContex = useGlobalStateContext(),
3371
+ state = _useGlobalStateContex.state;
3344
3372
 
3345
3373
  return useGlobalAtom(state, select && {
3346
3374
  select: select
@@ -3361,6 +3389,7 @@ __webpack_require__.r(__webpack_exports__);
3361
3389
  /* harmony export */ "useAction": () => (/* reexport safe */ _action__WEBPACK_IMPORTED_MODULE_0__.useAction),
3362
3390
  /* harmony export */ "useActions": () => (/* reexport safe */ _actions__WEBPACK_IMPORTED_MODULE_1__.useActions),
3363
3391
  /* harmony export */ "useGlobalState": () => (/* reexport safe */ _globalState__WEBPACK_IMPORTED_MODULE_2__.useGlobalState),
3392
+ /* harmony export */ "useGlobalStateContext": () => (/* reexport safe */ _globalState__WEBPACK_IMPORTED_MODULE_2__.useGlobalStateContext),
3364
3393
  /* harmony export */ "useMedia": () => (/* reexport safe */ _media__WEBPACK_IMPORTED_MODULE_3__.useMedia),
3365
3394
  /* harmony export */ "useSetter": () => (/* reexport safe */ _setter__WEBPACK_IMPORTED_MODULE_4__.useSetter),
3366
3395
  /* harmony export */ "useSharedData": () => (/* reexport safe */ _sharedData__WEBPACK_IMPORTED_MODULE_5__.useSharedData)
@@ -3539,6 +3568,7 @@ __webpack_require__.r(__webpack_exports__);
3539
3568
  /* harmony export */ "useAction": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useAction),
3540
3569
  /* harmony export */ "useActions": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useActions),
3541
3570
  /* harmony export */ "useGlobalState": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useGlobalState),
3571
+ /* harmony export */ "useGlobalStateContext": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useGlobalStateContext),
3542
3572
  /* harmony export */ "useMedia": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useMedia),
3543
3573
  /* harmony export */ "useSetter": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useSetter),
3544
3574
  /* harmony export */ "useSharedData": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useSharedData),
@@ -4098,11 +4128,11 @@ __webpack_require__.r(__webpack_exports__);
4098
4128
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
4099
4129
  /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/utils.js");
4100
4130
  /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-router */ "../../../node_modules/react-router/esm/react-router.js");
4101
- /* harmony import */ var _stateContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stateContext */ "../../framework/piral-core/esm/state/stateContext.js");
4102
4131
  /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/ErrorBoundary.js");
4103
4132
  /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/PortalRenderer.js");
4104
4133
  /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/components.js");
4105
4134
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks */ "../../framework/piral-core/esm/hooks/actions.js");
4135
+ /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks */ "../../framework/piral-core/esm/hooks/globalState.js");
4106
4136
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/react.js");
4107
4137
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/helpers.js");
4108
4138
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/foreign.js");
@@ -4133,7 +4163,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
4133
4163
 
4134
4164
 
4135
4165
 
4136
-
4137
4166
  // this is an arbitrary start number to have 6 digits
4138
4167
 
4139
4168
  var portalIdBase = 123456;
@@ -4247,8 +4276,8 @@ function wrapForeignComponent(component, stasisOptions, piral, Wrapper) {
4247
4276
  var _useActions = (0,_hooks__WEBPACK_IMPORTED_MODULE_4__.useActions)(),
4248
4277
  destroyPortal = _useActions.destroyPortal;
4249
4278
 
4250
- var _React$useContext = react__WEBPACK_IMPORTED_MODULE_0__.useContext(_stateContext__WEBPACK_IMPORTED_MODULE_5__.StateContext),
4251
- state = _React$useContext.state;
4279
+ var _useGlobalStateContex = (0,_hooks__WEBPACK_IMPORTED_MODULE_5__.useGlobalStateContext)(),
4280
+ state = _useGlobalStateContex.state;
4252
4281
 
4253
4282
  var router = react__WEBPACK_IMPORTED_MODULE_0__.useContext(react_router__WEBPACK_IMPORTED_MODULE_6__.__RouterContext);
4254
4283
  var id = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(function () {
@@ -5175,6 +5204,7 @@ __webpack_require__.r(__webpack_exports__);
5175
5204
  /* harmony export */ "useAction": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useAction),
5176
5205
  /* harmony export */ "useActions": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useActions),
5177
5206
  /* harmony export */ "useGlobalState": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useGlobalState),
5207
+ /* harmony export */ "useGlobalStateContext": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useGlobalStateContext),
5178
5208
  /* harmony export */ "useMedia": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useMedia),
5179
5209
  /* harmony export */ "useSetter": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useSetter),
5180
5210
  /* harmony export */ "useSharedData": () => (/* reexport safe */ piral_core__WEBPACK_IMPORTED_MODULE_0__.useSharedData),
@@ -8689,12 +8719,12 @@ function installPiralDebug(options) {
8689
8719
  debug: debugApiVersion,
8690
8720
  instance: {
8691
8721
  name: "sample-piral",
8692
- version: "0.14.1-beta.3256",
8722
+ version: "0.14.3-beta.3296",
8693
8723
  dependencies: "reactstrap,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
8694
8724
  },
8695
8725
  build: {
8696
- date: "2021-11-16T14:02:08.912Z",
8697
- cli: "0.14.0",
8726
+ date: "2021-11-24T14:30:26.764Z",
8727
+ cli: "0.14.2",
8698
8728
  compat: "0.14"
8699
8729
  },
8700
8730
  pilets: {
@@ -79992,4 +80022,4 @@ var layout_1 = __webpack_require__(/*! ./layout */ "./src/layout.tsx");
79992
80022
 
79993
80023
  /******/ })()
79994
80024
  ;
79995
- //# sourceMappingURL=index.f71419.js.map
80025
+ //# sourceMappingURL=index.b159b3.js.map