minimal-piral 1.3.0-beta.6050 → 1.3.0-beta.6059

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.
@@ -872,11 +872,23 @@ __webpack_require__.r(__webpack_exports__);
872
872
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
873
873
  /* harmony export */ "PiralRoutes": () => (/* binding */ PiralRoutes)
874
874
  /* harmony export */ });
875
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
875
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
876
876
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
877
877
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
878
878
  /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../hooks */ "../../framework/piral-core/esm/hooks/globalState.js");
879
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/routes.js");
879
880
  /* harmony import */ var _app_codegen__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../app.codegen */ "../../framework/piral-core/app.codegen");
881
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
882
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
883
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
884
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
885
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
886
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
887
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
888
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
889
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
890
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
891
+
880
892
 
881
893
 
882
894
 
@@ -888,20 +900,27 @@ function useRoutes() {
888
900
  var pages = (0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useGlobalState)(function (s) {
889
901
  return s.registry.pages;
890
902
  });
891
- var paths = [];
892
- Object.keys(routes).map(function (path) {
893
- return paths.push({
903
+ return (0,_app_codegen__WEBPACK_IMPORTED_MODULE_2__.useRouteFilter)([].concat(_toConsumableArray(Object.entries(routes).map(function (_ref) {
904
+ var _ref2 = _slicedToArray(_ref, 2),
905
+ path = _ref2[0],
906
+ Component = _ref2[1];
907
+ return {
894
908
  path: path,
895
- Component: routes[path]
896
- });
897
- });
898
- Object.keys(pages).map(function (path) {
899
- return paths.push({
909
+ Component: Component,
910
+ meta: {},
911
+ matcher: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.createRouteMatcher)(path)
912
+ };
913
+ })), _toConsumableArray(Object.entries(pages).map(function (_ref3) {
914
+ var _ref4 = _slicedToArray(_ref3, 2),
915
+ path = _ref4[0],
916
+ entry = _ref4[1];
917
+ return {
900
918
  path: path,
901
- Component: pages[path].component
902
- });
903
- });
904
- return (0,_app_codegen__WEBPACK_IMPORTED_MODULE_2__.useRouteFilter)(paths);
919
+ Component: entry.component,
920
+ meta: entry.meta,
921
+ matcher: (0,_utils__WEBPACK_IMPORTED_MODULE_3__.createRouteMatcher)(path)
922
+ };
923
+ }))));
905
924
  }
906
925
  /**
907
926
  * The component for defining the exclusive routes to be used.
@@ -909,7 +928,7 @@ function useRoutes() {
909
928
  var PiralRoutes = function PiralRoutes(_a) {
910
929
  var NotFound = _a.NotFound,
911
930
  RouteSwitch = _a.RouteSwitch,
912
- props = (0,tslib__WEBPACK_IMPORTED_MODULE_3__.__rest)(_a, ["NotFound", "RouteSwitch"]);
931
+ props = (0,tslib__WEBPACK_IMPORTED_MODULE_4__.__rest)(_a, ["NotFound", "RouteSwitch"]);
913
932
  var paths = useRoutes();
914
933
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(RouteSwitch, Object.assign({
915
934
  NotFound: NotFound,
@@ -2991,6 +3010,26 @@ function defaultRender(children, key) {
2991
3010
 
2992
3011
  /***/ }),
2993
3012
 
3013
+ /***/ "../../framework/piral-core/esm/utils/routes.js":
3014
+ /*!******************************************************!*\
3015
+ !*** ../../framework/piral-core/esm/utils/routes.js ***!
3016
+ \******************************************************/
3017
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3018
+
3019
+ "use strict";
3020
+ __webpack_require__.r(__webpack_exports__);
3021
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3022
+ /* harmony export */ "createRouteMatcher": () => (/* binding */ createRouteMatcher)
3023
+ /* harmony export */ });
3024
+ // Unfortunately `require`d:
3025
+ // * exports are otherwise potentially converted by, e.g., Parcel (see #385)
3026
+ var ptr = __webpack_require__(/*! path-to-regexp */ "../../../node_modules/path-to-regexp/index.js");
3027
+ function createRouteMatcher(path) {
3028
+ return ptr(path);
3029
+ }
3030
+
3031
+ /***/ }),
3032
+
2994
3033
  /***/ "../../framework/piral-core/esm/utils/state.js":
2995
3034
  /*!*****************************************************!*\
2996
3035
  !*** ../../framework/piral-core/esm/utils/state.js ***!
@@ -3591,12 +3630,12 @@ function installPiralDebug(options) {
3591
3630
  debug: debugApiVersion,
3592
3631
  instance: {
3593
3632
  name: "minimal-piral",
3594
- version: "1.3.0-beta.6050",
3633
+ version: "1.3.0-beta.6059",
3595
3634
  dependencies: "tslib,react,react-dom,react-router,react-router-dom"
3596
3635
  },
3597
3636
  build: {
3598
- date: "2023-10-02T12:06:39.350Z",
3599
- cli: "1.3.0-beta.6050",
3637
+ date: "2023-10-05T17:24:04.667Z",
3638
+ cli: "1.3.0-beta.6059",
3600
3639
  compat: "1"
3601
3640
  }
3602
3641
  };
@@ -44489,4 +44528,4 @@ var instance = (0,piral_core__WEBPACK_IMPORTED_MODULE_2__.createInstance)({
44489
44528
 
44490
44529
  /******/ })()
44491
44530
  ;
44492
- //# sourceMappingURL=index.1bad3a.js.map
44531
+ //# sourceMappingURL=index.2d9706.js.map