piral-page-layouts 1.3.0-beta.6065 → 1.3.0-beta.6067
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/README.md +46 -0
- package/esm/create.js +2 -30
- package/esm/create.js.map +1 -1
- package/esm/utils.d.ts +5 -0
- package/esm/utils.js +31 -0
- package/esm/utils.js.map +1 -0
- package/lib/create.js +2 -30
- package/lib/create.js.map +1 -1
- package/lib/utils.d.ts +5 -0
- package/lib/utils.js +36 -0
- package/lib/utils.js.map +1 -0
- package/package.json +3 -3
- package/piral-page-layouts.min.js +1 -1
- package/src/create.ts +4 -46
- package/src/utils.ts +49 -0
package/README.md
CHANGED
|
@@ -180,6 +180,52 @@ const instance = createInstance({
|
|
|
180
180
|
});
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
+
You can also mark your app shell pages with a layout. To do that you need to provide a property called `meta` for such components:
|
|
184
|
+
|
|
185
|
+
```js
|
|
186
|
+
const MyPage = () => {
|
|
187
|
+
return (
|
|
188
|
+
<div>
|
|
189
|
+
My page content
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
MyPage.meta = {
|
|
194
|
+
layout: 'standard',
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// Register page in the app state
|
|
198
|
+
createInstance({
|
|
199
|
+
// ...
|
|
200
|
+
state: {
|
|
201
|
+
// ...
|
|
202
|
+
routes: {
|
|
203
|
+
'/my-page': MyPage,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Alternatively, you could register your pages in the app shell also within the root pilet using the `registerPage` API:
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
const MyPage = () => {
|
|
213
|
+
return (
|
|
214
|
+
<div>
|
|
215
|
+
My page content
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Register page in the app state
|
|
221
|
+
const instance = createInstance({
|
|
222
|
+
// ...
|
|
223
|
+
});
|
|
224
|
+
instance.root.registerPage('/my-page', MyPage, {
|
|
225
|
+
layout: 'standard',
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
183
229
|
:::
|
|
184
230
|
|
|
185
231
|
## License
|
package/esm/create.js
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
import * as actions from './actions';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { withApi, defaultRender, useGlobalState } from 'piral-core';
|
|
5
|
-
function getPageLayouts(items) {
|
|
6
|
-
const layouts = {};
|
|
7
|
-
if (items && typeof items === 'object') {
|
|
8
|
-
Object.keys(items).forEach((name) => {
|
|
9
|
-
layouts[name] = {
|
|
10
|
-
pilet: undefined,
|
|
11
|
-
component: items[name],
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
return layouts;
|
|
16
|
-
}
|
|
17
|
-
const DefaultLayout = props => defaultRender(props.children);
|
|
18
|
-
function createPageWrapper(Routes, fallback = 'default') {
|
|
19
|
-
return (props) => {
|
|
20
|
-
var _a;
|
|
21
|
-
const location = useLocation();
|
|
22
|
-
const data = props.paths.find(m => m.matcher.test(location.pathname));
|
|
23
|
-
const layout = ((_a = data === null || data === void 0 ? void 0 : data.meta) === null || _a === void 0 ? void 0 : _a.layout) || fallback;
|
|
24
|
-
const registration = useGlobalState((s) => s.registry.pageLayouts[layout] || s.registry.pageLayouts[fallback]);
|
|
25
|
-
const Layout = (registration === null || registration === void 0 ? void 0 : registration.component) || DefaultLayout;
|
|
26
|
-
return createElement(Layout, props, createElement(Routes, props));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function withPageLayouts(pageLayouts, fallback) {
|
|
30
|
-
return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign(Object.assign({}, state.components), { RouteSwitch: createPageWrapper(state.components.RouteSwitch, fallback) }), registry: Object.assign(Object.assign({}, state.registry), { pageLayouts }) }));
|
|
31
|
-
}
|
|
2
|
+
import { withApi } from 'piral-core';
|
|
3
|
+
import { getPageLayouts, withPageLayouts } from './utils';
|
|
32
4
|
/**
|
|
33
5
|
* Creates new Pilet API extensions for dealing with page layouts.
|
|
34
6
|
*/
|
package/esm/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,EAAmC,OAAO,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkB1D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA4B,EAAE;IACjE,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE1C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAEhG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAErE,OAAO,CAAC,GAAG,EAAE,EAAE;YACb,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5B,OAAO;gBACL,kBAAkB,CAAC,IAAI,EAAE,UAAU;oBACjC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;oBAErC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE;wBACvC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;wBAClE,OAAO,CAAC,kBAAkB,CAAC,IAAI,EAAE;4BAC/B,SAAS;4BACT,KAAK;yBACN,CAAC,CAAC;qBACJ;oBAED,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBACD,oBAAoB,CAAC,IAAI;oBACvB,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;oBAErC,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,MAAK,KAAK,EAAE;wBAC5B,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;qBACpC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { PageComponentProps, Dict, GlobalState } from 'piral-core';
|
|
3
|
+
import type { PageLayoutRegistration } from './types';
|
|
4
|
+
export declare function getPageLayouts(items: Record<string, ComponentType<PageComponentProps>>): Dict<PageLayoutRegistration>;
|
|
5
|
+
export declare function withPageLayouts(pageLayouts: Dict<PageLayoutRegistration>, fallback: string): (state: GlobalState) => GlobalState;
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import { defaultRender, useGlobalState } from 'piral-core';
|
|
4
|
+
const DefaultLayout = (props) => defaultRender(props.children);
|
|
5
|
+
function createPageWrapper(Routes, fallback = 'default') {
|
|
6
|
+
return (props) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const location = useLocation();
|
|
9
|
+
const data = props.paths.find((m) => m.matcher.test(location.pathname));
|
|
10
|
+
const layout = ((_a = data === null || data === void 0 ? void 0 : data.meta) === null || _a === void 0 ? void 0 : _a.layout) || fallback;
|
|
11
|
+
const registration = useGlobalState((s) => s.registry.pageLayouts[layout] || s.registry.pageLayouts[fallback]);
|
|
12
|
+
const Layout = (registration === null || registration === void 0 ? void 0 : registration.component) || DefaultLayout;
|
|
13
|
+
return createElement(Layout, props, createElement(Routes, props));
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function getPageLayouts(items) {
|
|
17
|
+
const layouts = {};
|
|
18
|
+
if (items && typeof items === 'object') {
|
|
19
|
+
Object.keys(items).forEach((name) => {
|
|
20
|
+
layouts[name] = {
|
|
21
|
+
pilet: undefined,
|
|
22
|
+
component: items[name],
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return layouts;
|
|
27
|
+
}
|
|
28
|
+
export function withPageLayouts(pageLayouts, fallback) {
|
|
29
|
+
return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign(Object.assign({}, state.components), { RouteSwitch: createPageWrapper(state.components.RouteSwitch, fallback) }), registry: Object.assign(Object.assign({}, state.registry), { pageLayouts }) }));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=utils.js.map
|
package/esm/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAqB,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAA4B,aAAa,EAAE,cAAc,EAAiC,MAAM,YAAY,CAAC;AAGpH,MAAM,aAAa,GAAgC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE5F,SAAS,iBAAiB,CACxB,MAAuC,EACvC,QAAQ,GAAG,SAAS;IAEpB,OAAO,CAAC,KAAK,EAAE,EAAE;;QACf,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,0CAAE,MAAM,KAAI,QAAQ,CAAC;QAC9C,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/G,MAAM,MAAM,GAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,KAAI,aAAa,CAAC;QACxD,OAAO,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAwD;IACrF,MAAM,OAAO,GAAiC,EAAE,CAAC;IAEjD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAClC,OAAO,CAAC,IAAI,CAAC,GAAG;gBACd,KAAK,EAAE,SAAS;gBAChB,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC;aACvB,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAAyC,EAAE,QAAgB;IACzF,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,iCACvC,KAAK,KACR,UAAU,kCACL,KAAK,CAAC,UAAU,KACnB,WAAW,EAAE,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,KAExE,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,WAAW,OAEb,CAAC;AACL,CAAC"}
|
package/lib/create.js
CHANGED
|
@@ -2,36 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPageLayoutsApi = void 0;
|
|
4
4
|
const actions = require("./actions");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
7
5
|
const piral_core_1 = require("piral-core");
|
|
8
|
-
|
|
9
|
-
const layouts = {};
|
|
10
|
-
if (items && typeof items === 'object') {
|
|
11
|
-
Object.keys(items).forEach((name) => {
|
|
12
|
-
layouts[name] = {
|
|
13
|
-
pilet: undefined,
|
|
14
|
-
component: items[name],
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return layouts;
|
|
19
|
-
}
|
|
20
|
-
const DefaultLayout = props => (0, piral_core_1.defaultRender)(props.children);
|
|
21
|
-
function createPageWrapper(Routes, fallback = 'default') {
|
|
22
|
-
return (props) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const location = (0, react_router_dom_1.useLocation)();
|
|
25
|
-
const data = props.paths.find(m => m.matcher.test(location.pathname));
|
|
26
|
-
const layout = ((_a = data === null || data === void 0 ? void 0 : data.meta) === null || _a === void 0 ? void 0 : _a.layout) || fallback;
|
|
27
|
-
const registration = (0, piral_core_1.useGlobalState)((s) => s.registry.pageLayouts[layout] || s.registry.pageLayouts[fallback]);
|
|
28
|
-
const Layout = (registration === null || registration === void 0 ? void 0 : registration.component) || DefaultLayout;
|
|
29
|
-
return (0, react_1.createElement)(Layout, props, (0, react_1.createElement)(Routes, props));
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function withPageLayouts(pageLayouts, fallback) {
|
|
33
|
-
return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign(Object.assign({}, state.components), { RouteSwitch: createPageWrapper(state.components.RouteSwitch, fallback) }), registry: Object.assign(Object.assign({}, state.registry), { pageLayouts }) }));
|
|
34
|
-
}
|
|
6
|
+
const utils_1 = require("./utils");
|
|
35
7
|
/**
|
|
36
8
|
* Creates new Pilet API extensions for dealing with page layouts.
|
|
37
9
|
*/
|
|
@@ -40,7 +12,7 @@ function createPageLayoutsApi(config = {}) {
|
|
|
40
12
|
return (context) => {
|
|
41
13
|
const findPageLayout = (name) => context.readState((s) => s.registry.pageLayouts[name]);
|
|
42
14
|
context.defineActions(actions);
|
|
43
|
-
context.dispatch(withPageLayouts(getPageLayouts(layouts), fallback));
|
|
15
|
+
context.dispatch((0, utils_1.withPageLayouts)((0, utils_1.getPageLayouts)(layouts), fallback));
|
|
44
16
|
return (api) => {
|
|
45
17
|
const pilet = api.meta.name;
|
|
46
18
|
return {
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAsE;AACtE,mCAA0D;AAkB1D;;GAEG;AACH,SAAgB,oBAAoB,CAAC,SAA4B,EAAE;IACjE,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE1C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAEhG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,QAAQ,CAAC,IAAA,uBAAe,EAAC,IAAA,sBAAc,EAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAErE,OAAO,CAAC,GAAG,EAAE,EAAE;YACb,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5B,OAAO;gBACL,kBAAkB,CAAC,IAAI,EAAE,UAAU;oBACjC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;oBAErC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE;wBACvC,MAAM,SAAS,GAAG,IAAA,oBAAO,EAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;wBAClE,OAAO,CAAC,kBAAkB,CAAC,IAAI,EAAE;4BAC/B,SAAS;4BACT,KAAK;yBACN,CAAC,CAAC;qBACJ;oBAED,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;gBAC9C,CAAC;gBACD,oBAAoB,CAAC,IAAI;oBACvB,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;oBAErC,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,MAAK,KAAK,EAAE;wBAC5B,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;qBACpC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AApCD,oDAoCC"}
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { PageComponentProps, Dict, GlobalState } from 'piral-core';
|
|
3
|
+
import type { PageLayoutRegistration } from './types';
|
|
4
|
+
export declare function getPageLayouts(items: Record<string, ComponentType<PageComponentProps>>): Dict<PageLayoutRegistration>;
|
|
5
|
+
export declare function withPageLayouts(pageLayouts: Dict<PageLayoutRegistration>, fallback: string): (state: GlobalState) => GlobalState;
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withPageLayouts = exports.getPageLayouts = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
6
|
+
const piral_core_1 = require("piral-core");
|
|
7
|
+
const DefaultLayout = (props) => (0, piral_core_1.defaultRender)(props.children);
|
|
8
|
+
function createPageWrapper(Routes, fallback = 'default') {
|
|
9
|
+
return (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const location = (0, react_router_dom_1.useLocation)();
|
|
12
|
+
const data = props.paths.find((m) => m.matcher.test(location.pathname));
|
|
13
|
+
const layout = ((_a = data === null || data === void 0 ? void 0 : data.meta) === null || _a === void 0 ? void 0 : _a.layout) || fallback;
|
|
14
|
+
const registration = (0, piral_core_1.useGlobalState)((s) => s.registry.pageLayouts[layout] || s.registry.pageLayouts[fallback]);
|
|
15
|
+
const Layout = (registration === null || registration === void 0 ? void 0 : registration.component) || DefaultLayout;
|
|
16
|
+
return (0, react_1.createElement)(Layout, props, (0, react_1.createElement)(Routes, props));
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function getPageLayouts(items) {
|
|
20
|
+
const layouts = {};
|
|
21
|
+
if (items && typeof items === 'object') {
|
|
22
|
+
Object.keys(items).forEach((name) => {
|
|
23
|
+
layouts[name] = {
|
|
24
|
+
pilet: undefined,
|
|
25
|
+
component: items[name],
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return layouts;
|
|
30
|
+
}
|
|
31
|
+
exports.getPageLayouts = getPageLayouts;
|
|
32
|
+
function withPageLayouts(pageLayouts, fallback) {
|
|
33
|
+
return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign(Object.assign({}, state.components), { RouteSwitch: createPageWrapper(state.components.RouteSwitch, fallback) }), registry: Object.assign(Object.assign({}, state.registry), { pageLayouts }) }));
|
|
34
|
+
}
|
|
35
|
+
exports.withPageLayouts = withPageLayouts;
|
|
36
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAwE;AACxE,uDAA+C;AAC/C,2CAAoH;AAGpH,MAAM,aAAa,GAAgC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE5F,SAAS,iBAAiB,CACxB,MAAuC,EACvC,QAAQ,GAAG,SAAS;IAEpB,OAAO,CAAC,KAAK,EAAE,EAAE;;QACf,MAAM,QAAQ,GAAG,IAAA,8BAAW,GAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,0CAAE,MAAM,KAAI,QAAQ,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAA,2BAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/G,MAAM,MAAM,GAAG,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,KAAI,aAAa,CAAC;QACxD,OAAO,IAAA,qBAAa,EAAC,MAAM,EAAE,KAAK,EAAE,IAAA,qBAAa,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,cAAc,CAAC,KAAwD;IACrF,MAAM,OAAO,GAAiC,EAAE,CAAC;IAEjD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAClC,OAAO,CAAC,IAAI,CAAC,GAAG;gBACd,KAAK,EAAE,SAAS;gBAChB,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC;aACvB,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAbD,wCAaC;AAED,SAAgB,eAAe,CAAC,WAAyC,EAAE,QAAgB;IACzF,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,iCACvC,KAAK,KACR,UAAU,kCACL,KAAK,CAAC,UAAU,KACnB,WAAW,EAAE,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,KAExE,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,WAAW,OAEb,CAAC;AACL,CAAC;AAZD,0CAYC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-page-layouts",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.6067",
|
|
4
4
|
"description": "Plugin for providing different page layouts in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"piral-core": "1.3.0-beta.
|
|
64
|
+
"piral-core": "1.3.0-beta.6067",
|
|
65
65
|
"react-router-dom": "^5.2.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "c437ea6f768be65c65b5c7251ca6e0bc9f83a4f7"
|
|
68
68
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var piralPageLayouts=(()=>{var nr=Object.create;var le=Object.defineProperty,or=Object.defineProperties,ir=Object.getOwnPropertyDescriptor,ar=Object.getOwnPropertyDescriptors,sr=Object.getOwnPropertyNames,ot=Object.getOwnPropertySymbols,cr=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable;var at=(e,t,r)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Q=(e,t)=>{for(var r in t||(t={}))it.call(t,r)&&at(e,r,t[r]);if(ot)for(var r of ot(t))ur.call(t,r)&&at(e,r,t[r]);return e},Z=(e,t)=>or(e,ar(t)),st=e=>le(e,"__esModule",{value:!0});var se=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ct=(e,t)=>{st(e);for(var r in t)le(e,r,{get:t[r],enumerable:!0})},pr=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of sr(t))!it.call(e,n)&&n!=="default"&&le(e,n,{get:()=>t[n],enumerable:!(r=ir(t,n))||r.enumerable});return e},J=e=>pr(st(le(e!=null?nr(cr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var pt=ee((Rn,ut)=>{"use strict";var hr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";ut.exports=hr});var dt=ee((xn,ht)=>{"use strict";var dr=pt();function ft(){}function lt(){}lt.resetWarningCache=ft;ht.exports=function(){function e(n,o,i,s,p,u){if(u!==dr){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:lt,resetWarningCache:ft};return r.PropTypes=r,r}});var mt=ee((Ln,vt)=>{vt.exports=dt()();var On,_n});var Vt=ee((kn,Mt)=>{Mt.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}});var Ut=ee((Wn,ce)=>{var we=Vt();ce.exports=Ht;ce.exports.parse=Be;ce.exports.compile=Dr;ce.exports.tokensToFunction=$t;ce.exports.tokensToRegExp=jt;var Sr=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function Be(e,t){for(var r=[],n=0,o=0,i="",s=t&&t.delimiter||"/",p;(p=Sr.exec(e))!=null;){var u=p[0],a=p[1],c=p.index;if(i+=e.slice(o,c),o=c+u.length,a){i+=a[1];continue}var f=e[o],l=p[2],v=p[3],m=p[4],R=p[5],N=p[6],C=p[7];i&&(r.push(i),i="");var D=l!=null&&f!=null&&f!==l,H=N==="+"||N==="*",k=N==="?"||N==="*",V=p[2]||s,x=m||R;r.push({name:v||n++,prefix:l||"",delimiter:V,optional:k,repeat:H,partial:D,asterisk:!!C,pattern:x?Vr(x):C?".*":"[^"+Te(V)+"]+?"})}return o<e.length&&(i+=e.substr(o)),i&&r.push(i),r}function Dr(e,t){return $t(Be(e,t),t)}function Ar(e){return encodeURI(e).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function Mr(e){return encodeURI(e).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function $t(e,t){for(var r=new Array(e.length),n=0;n<e.length;n++)typeof e[n]=="object"&&(r[n]=new RegExp("^(?:"+e[n].pattern+")$",We(t)));return function(o,i){for(var s="",p=o||{},u=i||{},a=u.pretty?Ar:encodeURIComponent,c=0;c<e.length;c++){var f=e[c];if(typeof f=="string"){s+=f;continue}var l=p[f.name],v;if(l==null)if(f.optional){f.partial&&(s+=f.prefix);continue}else throw new TypeError('Expected "'+f.name+'" to be defined');if(we(l)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(l.length===0){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var m=0;m<l.length;m++){if(v=a(l[m]),!r[c].test(v))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'", but received `'+JSON.stringify(v)+"`");s+=(m===0?f.prefix:f.delimiter)+v}continue}if(v=f.asterisk?Mr(l):a(l),!r[c].test(v))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but received "'+v+'"');s+=f.prefix+v}return s}}function Te(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function Vr(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function ke(e,t){return e.keys=t,e}function We(e){return e&&e.sensitive?"":"i"}function $r(e,t){var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return ke(e,t)}function jr(e,t,r){for(var n=[],o=0;o<e.length;o++)n.push(Ht(e[o],t,r).source);var i=new RegExp("(?:"+n.join("|")+")",We(r));return ke(i,t)}function Hr(e,t,r){return jt(Be(e,r),t,r)}function jt(e,t,r){we(t)||(r=t||r,t=[]),r=r||{};for(var n=r.strict,o=r.end!==!1,i="",s=0;s<e.length;s++){var p=e[s];if(typeof p=="string")i+=Te(p);else{var u=Te(p.prefix),a="(?:"+p.pattern+")";t.push(p),p.repeat&&(a+="(?:"+u+a+")*"),p.optional?p.partial?a=u+"("+a+")?":a="(?:"+u+"("+a+"))?":a=u+"("+a+")",i+=a}}var c=Te(r.delimiter||"/"),f=i.slice(-c.length)===c;return n||(i=(f?i.slice(0,-c.length):i)+"(?:"+c+"(?=$))?"),o?i+="$":i+=n&&f?"":"(?="+c+"|$)",ke(new RegExp("^"+i,We(r)),t)}function Ht(e,t,r){return we(t)||(r=t||r,t=[]),r=r||{},e instanceof RegExp?$r(e,t):we(e)?jr(e,t,r):Hr(e,t,r)}});var Bt=ee(w=>{"use strict";var S=typeof Symbol=="function"&&Symbol.for,Ye=S?Symbol.for("react.element"):60103,qe=S?Symbol.for("react.portal"):60106,be=S?Symbol.for("react.fragment"):60107,Ne=S?Symbol.for("react.strict_mode"):60108,Re=S?Symbol.for("react.profiler"):60114,xe=S?Symbol.for("react.provider"):60109,Oe=S?Symbol.for("react.context"):60110,Fe=S?Symbol.for("react.async_mode"):60111,_e=S?Symbol.for("react.concurrent_mode"):60111,Le=S?Symbol.for("react.forward_ref"):60112,Ce=S?Symbol.for("react.suspense"):60113,Ur=S?Symbol.for("react.suspense_list"):60120,Se=S?Symbol.for("react.memo"):60115,De=S?Symbol.for("react.lazy"):60116,Ir=S?Symbol.for("react.block"):60121,Br=S?Symbol.for("react.fundamental"):60117,kr=S?Symbol.for("react.responder"):60118,Wr=S?Symbol.for("react.scope"):60119;function Y(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ye:switch(e=e.type,e){case Fe:case _e:case be:case Re:case Ne:case Ce:return e;default:switch(e=e&&e.$$typeof,e){case Oe:case Le:case De:case Se:case xe:return e;default:return t}}case qe:return t}}}function It(e){return Y(e)===_e}w.AsyncMode=Fe;w.ConcurrentMode=_e;w.ContextConsumer=Oe;w.ContextProvider=xe;w.Element=Ye;w.ForwardRef=Le;w.Fragment=be;w.Lazy=De;w.Memo=Se;w.Portal=qe;w.Profiler=Re;w.StrictMode=Ne;w.Suspense=Ce;w.isAsyncMode=function(e){return It(e)||Y(e)===Fe};w.isConcurrentMode=It;w.isContextConsumer=function(e){return Y(e)===Oe};w.isContextProvider=function(e){return Y(e)===xe};w.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ye};w.isForwardRef=function(e){return Y(e)===Le};w.isFragment=function(e){return Y(e)===be};w.isLazy=function(e){return Y(e)===De};w.isMemo=function(e){return Y(e)===Se};w.isPortal=function(e){return Y(e)===qe};w.isProfiler=function(e){return Y(e)===Re};w.isStrictMode=function(e){return Y(e)===Ne};w.isSuspense=function(e){return Y(e)===Ce};w.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===be||e===_e||e===Re||e===Ne||e===Ce||e===Ur||typeof e=="object"&&e!==null&&(e.$$typeof===De||e.$$typeof===Se||e.$$typeof===xe||e.$$typeof===Oe||e.$$typeof===Le||e.$$typeof===Br||e.$$typeof===kr||e.$$typeof===Wr||e.$$typeof===Ir)};w.typeOf=Y});var Ge=ee((qn,kt)=>{"use strict";kt.exports=Bt()});var zt=ee((Gn,Kt)=>{"use strict";var Ke=Ge(),Yr={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},qr={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Fr={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Wt={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},ze={};ze[Ke.ForwardRef]=Fr;ze[Ke.Memo]=Wt;function Yt(e){return Ke.isMemo(e)?Wt:ze[e.$$typeof]||Yr}var Gr=Object.defineProperty,Kr=Object.getOwnPropertyNames,qt=Object.getOwnPropertySymbols,zr=Object.getOwnPropertyDescriptor,Jr=Object.getPrototypeOf,Ft=Object.prototype;function Gt(e,t,r){if(typeof t!="string"){if(Ft){var n=Jr(t);n&&n!==Ft&&Gt(e,n,r)}var o=Kr(t);qt&&(o=o.concat(qt(t)));for(var i=Yt(e),s=Yt(t),p=0;p<o.length;++p){var u=o[p];if(!qr[u]&&!(r&&r[u])&&!(s&&s[u])&&!(i&&i[u])){var a=zr(t,u);try{Gr(e,u,a)}catch{}}}}return e}Kt.exports=Gt});var Pn={};ct(Pn,{createPageLayoutsApi:()=>gn});var Me={};ct(Me,{registerPageLayout:()=>fr,unregisterPageLayout:()=>lr});var Pe=J(se("piral-core"));function fr(e,t,r){e.dispatch(n=>Z(Q({},n),{registry:Z(Q({},n.registry),{pageLayouts:(0,Pe.withKey)(n.registry.pageLayouts,t,r)})}))}function lr(e,t){e.dispatch(r=>Z(Q({},r),{registry:Z(Q({},r.registry),{pageLayouts:(0,Pe.withoutKey)(r.registry.pageLayouts,t)})}))}var rt=J(se("react"));function he(e,t){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},he(e,t)}function B(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,he(e,t)}var O=J(se("react"));function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},L.apply(this,arguments)}function Ee(e){return e.charAt(0)==="/"}function Ve(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}function vr(e,t){t===void 0&&(t="");var r=e&&e.split("/")||[],n=t&&t.split("/")||[],o=e&&Ee(e),i=t&&Ee(t),s=o||i;if(e&&Ee(e)?n=r:r.length&&(n.pop(),n=n.concat(r)),!n.length)return"/";var p;if(n.length){var u=n[n.length-1];p=u==="."||u===".."||u===""}else p=!1;for(var a=0,c=n.length;c>=0;c--){var f=n[c];f==="."?Ve(n,c):f===".."?(Ve(n,c),a++):a&&(Ve(n,c),a--)}if(!s)for(;a--;a)n.unshift("..");s&&n[0]!==""&&(!n[0]||!Ee(n[0]))&&n.unshift("");var l=n.join("/");return p&&l.substr(-1)!=="/"&&(l+="/"),l}var yt=vr;var mr=!0,$e="Invariant failed";function X(e,t){if(!e){if(mr)throw new Error($e);var r=typeof t=="function"?t():t,n=r?$e+": "+r:$e;throw new Error(n)}}function de(e){return e.charAt(0)==="/"?e:"/"+e}function gt(e){return e.charAt(0)==="/"?e.substr(1):e}function yr(e,t){return e.toLowerCase().indexOf(t.toLowerCase())===0&&"/?#".indexOf(e.charAt(t.length))!==-1}function Pt(e,t){return yr(e,t)?e.substr(t.length):e}function Et(e){return e.charAt(e.length-1)==="/"?e.slice(0,-1):e}function gr(e){var t=e||"/",r="",n="",o=t.indexOf("#");o!==-1&&(n=t.substr(o),t=t.substr(0,o));var i=t.indexOf("?");return i!==-1&&(r=t.substr(i),t=t.substr(0,i)),{pathname:t,search:r==="?"?"":r,hash:n==="#"?"":n}}function M(e){var t=e.pathname,r=e.search,n=e.hash,o=t||"/";return r&&r!=="?"&&(o+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(o+=n.charAt(0)==="#"?n:"#"+n),o}function j(e,t,r,n){var o;typeof e=="string"?(o=gr(e),o.state=t):(o=L({},e),o.pathname===void 0&&(o.pathname=""),o.search?o.search.charAt(0)!=="?"&&(o.search="?"+o.search):o.search="",o.hash?o.hash.charAt(0)!=="#"&&(o.hash="#"+o.hash):o.hash="",t!==void 0&&o.state===void 0&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(i){throw i instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):i}return r&&(o.key=r),n?o.pathname?o.pathname.charAt(0)!=="/"&&(o.pathname=yt(o.pathname,n.pathname)):o.pathname=n.pathname:o.pathname||(o.pathname="/"),o}function je(){var e=null;function t(s){return e=s,function(){e===s&&(e=null)}}function r(s,p,u,a){if(e!=null){var c=typeof e=="function"?e(s,p):e;typeof c=="string"?typeof u=="function"?u(c,a):a(!0):a(c!==!1)}else a(!0)}var n=[];function o(s){var p=!0;function u(){p&&s.apply(void 0,arguments)}return n.push(u),function(){p=!1,n=n.filter(function(a){return a!==u})}}function i(){for(var s=arguments.length,p=new Array(s),u=0;u<s;u++)p[u]=arguments[u];n.forEach(function(a){return a.apply(void 0,p)})}return{setPrompt:t,confirmTransitionTo:r,appendListener:o,notifyListeners:i}}var wt=!!(typeof window!="undefined"&&window.document&&window.document.createElement);function Tt(e,t){t(window.confirm(e))}function Pr(){var e=window.navigator.userAgent;return(e.indexOf("Android 2.")!==-1||e.indexOf("Android 4.0")!==-1)&&e.indexOf("Mobile Safari")!==-1&&e.indexOf("Chrome")===-1&&e.indexOf("Windows Phone")===-1?!1:window.history&&"pushState"in window.history}function Er(){return window.navigator.userAgent.indexOf("Trident")===-1}function wr(){return window.navigator.userAgent.indexOf("Firefox")===-1}function Tr(e){return e.state===void 0&&navigator.userAgent.indexOf("CriOS")===-1}var bt="popstate",Nt="hashchange";function Rt(){try{return window.history.state||{}}catch{return{}}}function xt(e){e===void 0&&(e={}),wt||X(!1);var t=window.history,r=Pr(),n=!Er(),o=e,i=o.forceRefresh,s=i===void 0?!1:i,p=o.getUserConfirmation,u=p===void 0?Tt:p,a=o.keyLength,c=a===void 0?6:a,f=e.basename?Et(de(e.basename)):"";function l(g){var T=g||{},h=T.key,d=T.state,E=window.location,b=E.pathname,G=E.search,W=E.hash,I=b+G+W;return f&&(I=Pt(I,f)),j(I,d,h)}function v(){return Math.random().toString(36).substr(2,c)}var m=je();function R(g){L(F,g),F.length=t.length,m.notifyListeners(F.location,F.action)}function N(g){Tr(g)||H(l(g.state))}function C(){H(l(Rt()))}var D=!1;function H(g){if(D)D=!1,R();else{var T="POP";m.confirmTransitionTo(g,T,u,function(h){h?R({action:T,location:g}):k(g)})}}function k(g){var T=F.location,h=x.indexOf(T.key);h===-1&&(h=0);var d=x.indexOf(g.key);d===-1&&(d=0);var E=h-d;E&&(D=!0,_(E))}var V=l(Rt()),x=[V.key];function P(g){return f+M(g)}function y(g,T){var h="PUSH",d=j(g,T,v(),F.location);m.confirmTransitionTo(d,h,u,function(E){if(!!E){var b=P(d),G=d.key,W=d.state;if(r)if(t.pushState({key:G,state:W},null,b),s)window.location.href=b;else{var I=x.indexOf(F.location.key),ae=x.slice(0,I+1);ae.push(d.key),x=ae,R({action:h,location:d})}else window.location.href=b}})}function A(g,T){var h="REPLACE",d=j(g,T,v(),F.location);m.confirmTransitionTo(d,h,u,function(E){if(!!E){var b=P(d),G=d.key,W=d.state;if(r)if(t.replaceState({key:G,state:W},null,b),s)window.location.replace(b);else{var I=x.indexOf(F.location.key);I!==-1&&(x[I]=d.key),R({action:h,location:d})}else window.location.replace(b)}})}function _(g){t.go(g)}function $(){_(-1)}function q(){_(1)}var re=0;function z(g){re+=g,re===1&&g===1?(window.addEventListener(bt,N),n&&window.addEventListener(Nt,C)):re===0&&(window.removeEventListener(bt,N),n&&window.removeEventListener(Nt,C))}var U=!1;function oe(g){g===void 0&&(g=!1);var T=m.setPrompt(g);return U||(z(1),U=!0),function(){return U&&(U=!1,z(-1)),T()}}function ie(g){var T=m.appendListener(g);return z(1),function(){z(-1),T()}}var F={length:t.length,action:"POP",location:V,createHref:P,push:y,replace:A,go:_,goBack:$,goForward:q,block:oe,listen:ie};return F}var Ot="hashchange",br={hashbang:{encodePath:function(t){return t.charAt(0)==="!"?t:"!/"+gt(t)},decodePath:function(t){return t.charAt(0)==="!"?t.substr(1):t}},noslash:{encodePath:gt,decodePath:de},slash:{encodePath:de,decodePath:de}};function _t(e){var t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function ve(){var e=window.location.href,t=e.indexOf("#");return t===-1?"":e.substring(t+1)}function Nr(e){window.location.hash=e}function He(e){window.location.replace(_t(window.location.href)+"#"+e)}function Lt(e){e===void 0&&(e={}),wt||X(!1);var t=window.history,r=wr(),n=e,o=n.getUserConfirmation,i=o===void 0?Tt:o,s=n.hashType,p=s===void 0?"slash":s,u=e.basename?Et(de(e.basename)):"",a=br[p],c=a.encodePath,f=a.decodePath;function l(){var h=f(ve());return u&&(h=Pt(h,u)),j(h)}var v=je();function m(h){L(T,h),T.length=t.length,v.notifyListeners(T.location,T.action)}var R=!1,N=null;function C(h,d){return h.pathname===d.pathname&&h.search===d.search&&h.hash===d.hash}function D(){var h=ve(),d=c(h);if(h!==d)He(d);else{var E=l(),b=T.location;if(!R&&C(b,E)||N===M(E))return;N=null,H(E)}}function H(h){if(R)R=!1,m();else{var d="POP";v.confirmTransitionTo(h,d,i,function(E){E?m({action:d,location:h}):k(h)})}}function k(h){var d=T.location,E=y.lastIndexOf(M(d));E===-1&&(E=0);var b=y.lastIndexOf(M(h));b===-1&&(b=0);var G=E-b;G&&(R=!0,q(G))}var V=ve(),x=c(V);V!==x&&He(x);var P=l(),y=[M(P)];function A(h){var d=document.querySelector("base"),E="";return d&&d.getAttribute("href")&&(E=_t(window.location.href)),E+"#"+c(u+M(h))}function _(h,d){var E="PUSH",b=j(h,void 0,void 0,T.location);v.confirmTransitionTo(b,E,i,function(G){if(!!G){var W=M(b),I=c(u+W),ae=ve()!==I;if(ae){N=W,Nr(I);var ge=y.lastIndexOf(M(T.location)),nt=y.slice(0,ge+1);nt.push(W),y=nt,m({action:E,location:b})}else m()}})}function $(h,d){var E="REPLACE",b=j(h,void 0,void 0,T.location);v.confirmTransitionTo(b,E,i,function(G){if(!!G){var W=M(b),I=c(u+W),ae=ve()!==I;ae&&(N=W,He(I));var ge=y.indexOf(M(T.location));ge!==-1&&(y[ge]=W),m({action:E,location:b})}})}function q(h){t.go(h)}function re(){q(-1)}function z(){q(1)}var U=0;function oe(h){U+=h,U===1&&h===1?window.addEventListener(Ot,D):U===0&&window.removeEventListener(Ot,D)}var ie=!1;function F(h){h===void 0&&(h=!1);var d=v.setPrompt(h);return ie||(oe(1),ie=!0),function(){return ie&&(ie=!1,oe(-1)),d()}}function g(h){var d=v.appendListener(h);return oe(1),function(){oe(-1),d()}}var T={length:t.length,action:"POP",location:P,createHref:A,push:_,replace:$,go:q,goBack:re,goForward:z,block:F,listen:g};return T}function Ct(e,t,r){return Math.min(Math.max(e,t),r)}function St(e){e===void 0&&(e={});var t=e,r=t.getUserConfirmation,n=t.initialEntries,o=n===void 0?["/"]:n,i=t.initialIndex,s=i===void 0?0:i,p=t.keyLength,u=p===void 0?6:p,a=je();function c(y){L(P,y),P.length=P.entries.length,a.notifyListeners(P.location,P.action)}function f(){return Math.random().toString(36).substr(2,u)}var l=Ct(s,0,o.length-1),v=o.map(function(y){return typeof y=="string"?j(y,void 0,f()):j(y,void 0,y.key||f())}),m=M;function R(y,A){var _="PUSH",$=j(y,A,f(),P.location);a.confirmTransitionTo($,_,r,function(q){if(!!q){var re=P.index,z=re+1,U=P.entries.slice(0);U.length>z?U.splice(z,U.length-z,$):U.push($),c({action:_,location:$,index:z,entries:U})}})}function N(y,A){var _="REPLACE",$=j(y,A,f(),P.location);a.confirmTransitionTo($,_,r,function(q){!q||(P.entries[P.index]=$,c({action:_,location:$}))})}function C(y){var A=Ct(P.index+y,0,P.entries.length-1),_="POP",$=P.entries[A];a.confirmTransitionTo($,_,r,function(q){q?c({action:_,location:$,index:A}):c()})}function D(){C(-1)}function H(){C(1)}function k(y){var A=P.index+y;return A>=0&&A<P.entries.length}function V(y){return y===void 0&&(y=!1),a.setPrompt(y)}function x(y){return a.appendListener(y)}var P={length:v.length,action:"POP",location:v[l],index:l,entries:v,createHref:m,push:R,replace:N,go:C,goBack:D,goForward:H,canGo:k,block:V,listen:x};return P}var me=J(se("react"));var Ue=J(mt());var Ie=1073741823,Dt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:{};function Rr(){var e="__global_unique_id__";return Dt[e]=(Dt[e]||0)+1}function xr(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function Or(e){var t=[];return{on:function(n){t.push(n)},off:function(n){t=t.filter(function(o){return o!==n})},get:function(){return e},set:function(n,o){e=n,t.forEach(function(i){return i(e,o)})}}}function _r(e){return Array.isArray(e)?e[0]:e}function Lr(e,t){var r,n,o="__create-react-context-"+Rr()+"__",i=function(p){B(u,p);function u(){var c;return c=p.apply(this,arguments)||this,c.emitter=Or(c.props.value),c}var a=u.prototype;return a.getChildContext=function(){var f;return f={},f[o]=this.emitter,f},a.componentWillReceiveProps=function(f){if(this.props.value!==f.value){var l=this.props.value,v=f.value,m;xr(l,v)?m=0:(m=typeof t=="function"?t(l,v):Ie,m|=0,m!==0&&this.emitter.set(f.value,m))}},a.render=function(){return this.props.children},u}(me.Component);i.childContextTypes=(r={},r[o]=Ue.default.object.isRequired,r);var s=function(p){B(u,p);function u(){var c;return c=p.apply(this,arguments)||this,c.state={value:c.getValue()},c.onUpdate=function(f,l){var v=c.observedBits|0;(v&l)!=0&&c.setState({value:c.getValue()})},c}var a=u.prototype;return a.componentWillReceiveProps=function(f){var l=f.observedBits;this.observedBits=l??Ie},a.componentDidMount=function(){this.context[o]&&this.context[o].on(this.onUpdate);var f=this.props.observedBits;this.observedBits=f??Ie},a.componentWillUnmount=function(){this.context[o]&&this.context[o].off(this.onUpdate)},a.getValue=function(){return this.context[o]?this.context[o].get():e},a.render=function(){return _r(this.props.children)(this.state.value)},u}(me.Component);return s.contextTypes=(n={},n[o]=Ue.default.object,n),{Provider:i,Consumer:s}}var Cr=me.default.createContext||Lr,At=Cr;var Jt=J(Ut()),eo=J(Ge());function ne(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i<n.length;i++)o=n[i],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var Xr=J(zt()),Xt=function(t){var r=At();return r.displayName=t,r},Qr=Xt("Router-History"),te=Xt("Router"),ue=function(e){B(t,e),t.computeRootMatch=function(o){return{path:"/",url:"/",params:{},isExact:o==="/"}};function t(n){var o;return o=e.call(this,n)||this,o.state={location:n.history.location},o._isMounted=!1,o._pendingLocation=null,n.staticContext||(o.unlisten=n.history.listen(function(i){o._pendingLocation=i})),o}var r=t.prototype;return r.componentDidMount=function(){var o=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen(function(i){o._isMounted&&o.setState({location:i})})),this._pendingLocation&&this.setState({location:this._pendingLocation})},r.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},r.render=function(){return O.default.createElement(te.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},O.default.createElement(Qr.Provider,{children:this.props.children||null,value:this.props.history}))},t}(O.default.Component),Zr=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.history=St(n.props),n}var r=t.prototype;return r.render=function(){return O.default.createElement(ue,{history:this.history,children:this.props.children})},t}(O.default.Component),no=function(e){B(t,e);function t(){return e.apply(this,arguments)||this}var r=t.prototype;return r.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},r.componentDidUpdate=function(o){this.props.onUpdate&&this.props.onUpdate.call(this,this,o)},r.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},r.render=function(){return null},t}(O.default.Component);var Qt={},en=1e4,Zt=0;function tn(e,t){var r=""+t.end+t.strict+t.sensitive,n=Qt[r]||(Qt[r]={});if(n[e])return n[e];var o=[],i=(0,Jt.default)(e,o,t),s={regexp:i,keys:o};return Zt<en&&(n[e]=s,Zt++),s}function ye(e,t){t===void 0&&(t={}),(typeof t=="string"||Array.isArray(t))&&(t={path:t});var r=t,n=r.path,o=r.exact,i=o===void 0?!1:o,s=r.strict,p=s===void 0?!1:s,u=r.sensitive,a=u===void 0?!1:u,c=[].concat(n);return c.reduce(function(f,l){if(!l&&l!=="")return null;if(f)return f;var v=tn(l,{end:i,strict:p,sensitive:a}),m=v.regexp,R=v.keys,N=m.exec(e);if(!N)return null;var C=N[0],D=N.slice(1),H=e===C;return i&&!H?null:{path:l,url:l==="/"&&C===""?"/":C,isExact:H,params:R.reduce(function(k,V,x){return k[V.name]=D[x],k},{})}},null)}function rn(e){return O.default.Children.count(e)===0}var nn=function(e){B(t,e);function t(){return e.apply(this,arguments)||this}var r=t.prototype;return r.render=function(){var o=this;return O.default.createElement(te.Consumer,null,function(i){i||X(!1);var s=o.props.location||i.location,p=o.props.computedMatch?o.props.computedMatch:o.props.path?ye(s.pathname,o.props):i.match,u=L({},i,{location:s,match:p}),a=o.props,c=a.children,f=a.component,l=a.render;return Array.isArray(c)&&rn(c)&&(c=null),O.default.createElement(te.Provider,{value:u},u.match?c?typeof c=="function"?c(u):c:f?O.default.createElement(f,u):l?l(u):null:typeof c=="function"?c(u):null)})},t}(O.default.Component);function Je(e){return e.charAt(0)==="/"?e:"/"+e}function on(e,t){return e?L({},t,{pathname:Je(e)+t.pathname}):t}function an(e,t){if(!e)return t;var r=Je(e);return t.pathname.indexOf(r)!==0?t:L({},t,{pathname:t.pathname.substr(r.length)})}function er(e){return typeof e=="string"?e:M(e)}function Xe(e){return function(){X(!1)}}function tr(){}var sn=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.handlePush=function(p){return n.navigateTo(p,"PUSH")},n.handleReplace=function(p){return n.navigateTo(p,"REPLACE")},n.handleListen=function(){return tr},n.handleBlock=function(){return tr},n}var r=t.prototype;return r.navigateTo=function(o,i){var s=this.props,p=s.basename,u=p===void 0?"":p,a=s.context,c=a===void 0?{}:a;c.action=i,c.location=on(u,j(o)),c.url=er(c.location)},r.render=function(){var o=this.props,i=o.basename,s=i===void 0?"":i,p=o.context,u=p===void 0?{}:p,a=o.location,c=a===void 0?"/":a,f=ne(o,["basename","context","location"]),l={createHref:function(m){return Je(s+er(m))},action:"POP",location:an(s,j(c)),push:this.handlePush,replace:this.handleReplace,go:Xe("go"),goBack:Xe("goBack"),goForward:Xe("goForward"),listen:this.handleListen,block:this.handleBlock};return O.default.createElement(ue,L({},f,{history:l,staticContext:u}))},t}(O.default.Component),cn=function(e){B(t,e);function t(){return e.apply(this,arguments)||this}var r=t.prototype;return r.render=function(){var o=this;return O.default.createElement(te.Consumer,null,function(i){i||X(!1);var s=o.props.location||i.location,p,u;return O.default.Children.forEach(o.props.children,function(a){if(u==null&&O.default.isValidElement(a)){p=a;var c=a.props.path||a.props.from;u=c?ye(s.pathname,L({},a.props,{path:c})):i.match}}),u?O.default.cloneElement(p,{location:s,computedMatch:u}):null})},t}(O.default.Component);var un=O.default.useContext;function Qe(){return un(te).location}var K=J(se("react"));var Po=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.history=xt(n.props),n}var r=t.prototype;return r.render=function(){return K.default.createElement(ue,{history:this.history,children:this.props.children})},t}(K.default.Component),Eo=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.history=Lt(n.props),n}var r=t.prototype;return r.render=function(){return K.default.createElement(ue,{history:this.history,children:this.props.children})},t}(K.default.Component),Ze=function(t,r){return typeof t=="function"?t(r):t},et=function(t,r){return typeof t=="string"?j(t,null,null,r):t},tt=function(t){return t},pe=K.default.forwardRef;typeof pe=="undefined"&&(pe=tt);function pn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var fn=pe(function(e,t){var r=e.innerRef,n=e.navigate,o=e.onClick,i=ne(e,["innerRef","navigate","onClick"]),s=i.target,p=L({},i,{onClick:function(a){try{o&&o(a)}catch(c){throw a.preventDefault(),c}!a.defaultPrevented&&a.button===0&&(!s||s==="_self")&&!pn(a)&&(a.preventDefault(),n())}});return tt!==pe?p.ref=t||r:p.ref=r,K.default.createElement("a",p)}),ln=pe(function(e,t){var r=e.component,n=r===void 0?fn:r,o=e.replace,i=e.to,s=e.innerRef,p=ne(e,["component","replace","to","innerRef"]);return K.default.createElement(te.Consumer,null,function(u){u||X(!1);var a=u.history,c=et(Ze(i,u.location),u.location),f=c?a.createHref(c):"",l=L({},p,{href:f,navigate:function(){var m=Ze(i,u.location),R=M(u.location)===M(et(m)),N=o||R?a.replace:a.push;N(m)}});return tt!==pe?l.ref=t||s:l.innerRef=s,K.default.createElement(n,l)})});var rr=function(t){return t},Ae=K.default.forwardRef;typeof Ae=="undefined"&&(Ae=rr);function hn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(function(n){return n}).join(" ")}var wo=Ae(function(e,t){var r=e["aria-current"],n=r===void 0?"page":r,o=e.activeClassName,i=o===void 0?"active":o,s=e.activeStyle,p=e.className,u=e.exact,a=e.isActive,c=e.location,f=e.sensitive,l=e.strict,v=e.style,m=e.to,R=e.innerRef,N=ne(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.default.createElement(te.Consumer,null,function(C){C||X(!1);var D=c||C.location,H=et(Ze(m,D),D),k=H.pathname,V=k&&k.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),x=V?ye(D.pathname,{path:V,exact:u,sensitive:f,strict:l}):null,P=!!(a?a(x,D):x),y=typeof p=="function"?p(P):p,A=typeof v=="function"?v(P):v;P&&(y=hn(y,i),A=L({},A,s));var _=L({"aria-current":P&&n||null,className:y,style:A,to:H},N);return rr!==Ae?_.ref=t||R:_.innerRef=R,K.default.createElement(ln,_)})});var fe=J(se("piral-core"));function dn(e){let t={};return e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t[r]={pilet:void 0,component:e[r]}}),t}var vn=e=>(0,fe.defaultRender)(e.children);function mn(e,t="default"){return r=>{var u;let n=Qe(),o=r.paths.find(a=>a.matcher.test(n.pathname)),i=((u=o==null?void 0:o.meta)==null?void 0:u.layout)||t,s=(0,fe.useGlobalState)(a=>a.registry.pageLayouts[i]||a.registry.pageLayouts[t]),p=(s==null?void 0:s.component)||vn;return(0,rt.createElement)(p,r,(0,rt.createElement)(e,r))}}function yn(e,t){return r=>Z(Q({},r),{components:Z(Q({},r.components),{RouteSwitch:mn(r.components.RouteSwitch,t)}),registry:Z(Q({},r.registry),{pageLayouts:e})})}function gn(e={}){let{layouts:t={},fallback:r}=e;return n=>{let o=i=>n.readState(s=>s.registry.pageLayouts[i]);return n.defineActions(Me),n.dispatch(yn(dn(t),r)),i=>{let s=i.meta.name;return{registerPageLayout(p,u){let a=o(p);if(!a||a.pilet===s){let c=(0,fe.withApi)(n,u,i,"pageLayout");n.registerPageLayout(p,{component:c,pilet:s})}return()=>i.unregisterPageLayout(p)},unregisterPageLayout(p){let u=o(p);(u==null?void 0:u.pilet)===s&&n.unregisterPageLayout(p)}}}}}return Pn;})();
|
|
1
|
+
var piralPageLayouts=(()=>{var ar=Object.create;var fe=Object.defineProperty,sr=Object.defineProperties,cr=Object.getOwnPropertyDescriptor,ur=Object.getOwnPropertyDescriptors,pr=Object.getOwnPropertyNames,ot=Object.getOwnPropertySymbols,fr=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable;var at=(e,t,r)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Q=(e,t)=>{for(var r in t||(t={}))it.call(t,r)&&at(e,r,t[r]);if(ot)for(var r of ot(t))lr.call(t,r)&&at(e,r,t[r]);return e},Z=(e,t)=>sr(e,ur(t)),st=e=>fe(e,"__esModule",{value:!0});var ne=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var ee=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ct=(e,t)=>{st(e);for(var r in t)fe(e,r,{get:t[r],enumerable:!0})},hr=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of pr(t))!it.call(e,n)&&n!=="default"&&fe(e,n,{get:()=>t[n],enumerable:!(r=cr(t,n))||r.enumerable});return e},J=e=>hr(st(fe(e!=null?ar(fr(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var pt=ee((xn,ut)=>{"use strict";var mr="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";ut.exports=mr});var dt=ee((On,ht)=>{"use strict";var yr=pt();function ft(){}function lt(){}lt.resetWarningCache=ft;ht.exports=function(){function e(n,o,i,s,p,u){if(u!==yr){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:lt,resetWarningCache:ft};return r.PropTypes=r,r}});var mt=ee((Cn,vt)=>{vt.exports=dt()();var _n,Ln});var Vt=ee((Wn,Mt)=>{Mt.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}});var Ut=ee((Yn,ce)=>{var Ee=Vt();ce.exports=Ht;ce.exports.parse=Be;ce.exports.compile=Vr;ce.exports.tokensToFunction=$t;ce.exports.tokensToRegExp=jt;var Mr=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function Be(e,t){for(var r=[],n=0,o=0,i="",s=t&&t.delimiter||"/",p;(p=Mr.exec(e))!=null;){var u=p[0],a=p[1],c=p.index;if(i+=e.slice(o,c),o=c+u.length,a){i+=a[1];continue}var f=e[o],l=p[2],v=p[3],m=p[4],R=p[5],N=p[6],C=p[7];i&&(r.push(i),i="");var D=l!=null&&f!=null&&f!==l,H=N==="+"||N==="*",k=N==="?"||N==="*",V=p[2]||s,x=m||R;r.push({name:v||n++,prefix:l||"",delimiter:V,optional:k,repeat:H,partial:D,asterisk:!!C,pattern:x?Hr(x):C?".*":"[^"+we(V)+"]+?"})}return o<e.length&&(i+=e.substr(o)),i&&r.push(i),r}function Vr(e,t){return $t(Be(e,t),t)}function $r(e){return encodeURI(e).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function jr(e){return encodeURI(e).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function $t(e,t){for(var r=new Array(e.length),n=0;n<e.length;n++)typeof e[n]=="object"&&(r[n]=new RegExp("^(?:"+e[n].pattern+")$",We(t)));return function(o,i){for(var s="",p=o||{},u=i||{},a=u.pretty?$r:encodeURIComponent,c=0;c<e.length;c++){var f=e[c];if(typeof f=="string"){s+=f;continue}var l=p[f.name],v;if(l==null)if(f.optional){f.partial&&(s+=f.prefix);continue}else throw new TypeError('Expected "'+f.name+'" to be defined');if(Ee(l)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(l.length===0){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var m=0;m<l.length;m++){if(v=a(l[m]),!r[c].test(v))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'", but received `'+JSON.stringify(v)+"`");s+=(m===0?f.prefix:f.delimiter)+v}continue}if(v=f.asterisk?jr(l):a(l),!r[c].test(v))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but received "'+v+'"');s+=f.prefix+v}return s}}function we(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function Hr(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function ke(e,t){return e.keys=t,e}function We(e){return e&&e.sensitive?"":"i"}function Ur(e,t){var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return ke(e,t)}function Ir(e,t,r){for(var n=[],o=0;o<e.length;o++)n.push(Ht(e[o],t,r).source);var i=new RegExp("(?:"+n.join("|")+")",We(r));return ke(i,t)}function Br(e,t,r){return jt(Be(e,r),t,r)}function jt(e,t,r){Ee(t)||(r=t||r,t=[]),r=r||{};for(var n=r.strict,o=r.end!==!1,i="",s=0;s<e.length;s++){var p=e[s];if(typeof p=="string")i+=we(p);else{var u=we(p.prefix),a="(?:"+p.pattern+")";t.push(p),p.repeat&&(a+="(?:"+u+a+")*"),p.optional?p.partial?a=u+"("+a+")?":a="(?:"+u+"("+a+"))?":a=u+"("+a+")",i+=a}}var c=we(r.delimiter||"/"),f=i.slice(-c.length)===c;return n||(i=(f?i.slice(0,-c.length):i)+"(?:"+c+"(?=$))?"),o?i+="$":i+=n&&f?"":"(?="+c+"|$)",ke(new RegExp("^"+i,We(r)),t)}function Ht(e,t,r){return Ee(t)||(r=t||r,t=[]),r=r||{},e instanceof RegExp?Ur(e,t):Ee(e)?Ir(e,t,r):Br(e,t,r)}});var Bt=ee(w=>{"use strict";var S=typeof Symbol=="function"&&Symbol.for,Ye=S?Symbol.for("react.element"):60103,qe=S?Symbol.for("react.portal"):60106,Te=S?Symbol.for("react.fragment"):60107,be=S?Symbol.for("react.strict_mode"):60108,Ne=S?Symbol.for("react.profiler"):60114,Re=S?Symbol.for("react.provider"):60109,xe=S?Symbol.for("react.context"):60110,Fe=S?Symbol.for("react.async_mode"):60111,Oe=S?Symbol.for("react.concurrent_mode"):60111,_e=S?Symbol.for("react.forward_ref"):60112,Le=S?Symbol.for("react.suspense"):60113,kr=S?Symbol.for("react.suspense_list"):60120,Ce=S?Symbol.for("react.memo"):60115,Se=S?Symbol.for("react.lazy"):60116,Wr=S?Symbol.for("react.block"):60121,Yr=S?Symbol.for("react.fundamental"):60117,qr=S?Symbol.for("react.responder"):60118,Fr=S?Symbol.for("react.scope"):60119;function Y(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ye:switch(e=e.type,e){case Fe:case Oe:case Te:case Ne:case be:case Le:return e;default:switch(e=e&&e.$$typeof,e){case xe:case _e:case Se:case Ce:case Re:return e;default:return t}}case qe:return t}}}function It(e){return Y(e)===Oe}w.AsyncMode=Fe;w.ConcurrentMode=Oe;w.ContextConsumer=xe;w.ContextProvider=Re;w.Element=Ye;w.ForwardRef=_e;w.Fragment=Te;w.Lazy=Se;w.Memo=Ce;w.Portal=qe;w.Profiler=Ne;w.StrictMode=be;w.Suspense=Le;w.isAsyncMode=function(e){return It(e)||Y(e)===Fe};w.isConcurrentMode=It;w.isContextConsumer=function(e){return Y(e)===xe};w.isContextProvider=function(e){return Y(e)===Re};w.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ye};w.isForwardRef=function(e){return Y(e)===_e};w.isFragment=function(e){return Y(e)===Te};w.isLazy=function(e){return Y(e)===Se};w.isMemo=function(e){return Y(e)===Ce};w.isPortal=function(e){return Y(e)===qe};w.isProfiler=function(e){return Y(e)===Ne};w.isStrictMode=function(e){return Y(e)===be};w.isSuspense=function(e){return Y(e)===Le};w.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Te||e===Oe||e===Ne||e===be||e===Le||e===kr||typeof e=="object"&&e!==null&&(e.$$typeof===Se||e.$$typeof===Ce||e.$$typeof===Re||e.$$typeof===xe||e.$$typeof===_e||e.$$typeof===Yr||e.$$typeof===qr||e.$$typeof===Fr||e.$$typeof===Wr)};w.typeOf=Y});var Ge=ee((Fn,kt)=>{"use strict";kt.exports=Bt()});var zt=ee((Kn,Kt)=>{"use strict";var Ke=Ge(),Gr={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Kr={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},zr={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Wt={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},ze={};ze[Ke.ForwardRef]=zr;ze[Ke.Memo]=Wt;function Yt(e){return Ke.isMemo(e)?Wt:ze[e.$$typeof]||Gr}var Jr=Object.defineProperty,Xr=Object.getOwnPropertyNames,qt=Object.getOwnPropertySymbols,Qr=Object.getOwnPropertyDescriptor,Zr=Object.getPrototypeOf,Ft=Object.prototype;function Gt(e,t,r){if(typeof t!="string"){if(Ft){var n=Zr(t);n&&n!==Ft&&Gt(e,n,r)}var o=Xr(t);qt&&(o=o.concat(qt(t)));for(var i=Yt(e),s=Yt(t),p=0;p<o.length;++p){var u=o[p];if(!Kr[u]&&!(r&&r[u])&&!(s&&s[u])&&!(i&&i[u])){var a=Qr(t,u);try{Jr(e,u,a)}catch{}}}}return e}Kt.exports=Gt});var En={};ct(En,{createPageLayoutsApi:()=>Pn});var Me={};ct(Me,{registerPageLayout:()=>dr,unregisterPageLayout:()=>vr});var ge=J(ne("piral-core"));function dr(e,t,r){e.dispatch(n=>Z(Q({},n),{registry:Z(Q({},n.registry),{pageLayouts:(0,ge.withKey)(n.registry.pageLayouts,t,r)})}))}function vr(e,t){e.dispatch(r=>Z(Q({},r),{registry:Z(Q({},r.registry),{pageLayouts:(0,ge.withoutKey)(r.registry.pageLayouts,t)})}))}var ir=J(ne("piral-core"));var rt=J(ne("react"));function le(e,t){return le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},le(e,t)}function B(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,le(e,t)}var O=J(ne("react"));function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},L.apply(this,arguments)}function Pe(e){return e.charAt(0)==="/"}function Ve(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}function gr(e,t){t===void 0&&(t="");var r=e&&e.split("/")||[],n=t&&t.split("/")||[],o=e&&Pe(e),i=t&&Pe(t),s=o||i;if(e&&Pe(e)?n=r:r.length&&(n.pop(),n=n.concat(r)),!n.length)return"/";var p;if(n.length){var u=n[n.length-1];p=u==="."||u===".."||u===""}else p=!1;for(var a=0,c=n.length;c>=0;c--){var f=n[c];f==="."?Ve(n,c):f===".."?(Ve(n,c),a++):a&&(Ve(n,c),a--)}if(!s)for(;a--;a)n.unshift("..");s&&n[0]!==""&&(!n[0]||!Pe(n[0]))&&n.unshift("");var l=n.join("/");return p&&l.substr(-1)!=="/"&&(l+="/"),l}var yt=gr;var Pr=!0,$e="Invariant failed";function X(e,t){if(!e){if(Pr)throw new Error($e);var r=typeof t=="function"?t():t,n=r?$e+": "+r:$e;throw new Error(n)}}function he(e){return e.charAt(0)==="/"?e:"/"+e}function gt(e){return e.charAt(0)==="/"?e.substr(1):e}function Er(e,t){return e.toLowerCase().indexOf(t.toLowerCase())===0&&"/?#".indexOf(e.charAt(t.length))!==-1}function Pt(e,t){return Er(e,t)?e.substr(t.length):e}function Et(e){return e.charAt(e.length-1)==="/"?e.slice(0,-1):e}function wr(e){var t=e||"/",r="",n="",o=t.indexOf("#");o!==-1&&(n=t.substr(o),t=t.substr(0,o));var i=t.indexOf("?");return i!==-1&&(r=t.substr(i),t=t.substr(0,i)),{pathname:t,search:r==="?"?"":r,hash:n==="#"?"":n}}function M(e){var t=e.pathname,r=e.search,n=e.hash,o=t||"/";return r&&r!=="?"&&(o+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(o+=n.charAt(0)==="#"?n:"#"+n),o}function j(e,t,r,n){var o;typeof e=="string"?(o=wr(e),o.state=t):(o=L({},e),o.pathname===void 0&&(o.pathname=""),o.search?o.search.charAt(0)!=="?"&&(o.search="?"+o.search):o.search="",o.hash?o.hash.charAt(0)!=="#"&&(o.hash="#"+o.hash):o.hash="",t!==void 0&&o.state===void 0&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(i){throw i instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):i}return r&&(o.key=r),n?o.pathname?o.pathname.charAt(0)!=="/"&&(o.pathname=yt(o.pathname,n.pathname)):o.pathname=n.pathname:o.pathname||(o.pathname="/"),o}function je(){var e=null;function t(s){return e=s,function(){e===s&&(e=null)}}function r(s,p,u,a){if(e!=null){var c=typeof e=="function"?e(s,p):e;typeof c=="string"?typeof u=="function"?u(c,a):a(!0):a(c!==!1)}else a(!0)}var n=[];function o(s){var p=!0;function u(){p&&s.apply(void 0,arguments)}return n.push(u),function(){p=!1,n=n.filter(function(a){return a!==u})}}function i(){for(var s=arguments.length,p=new Array(s),u=0;u<s;u++)p[u]=arguments[u];n.forEach(function(a){return a.apply(void 0,p)})}return{setPrompt:t,confirmTransitionTo:r,appendListener:o,notifyListeners:i}}var wt=!!(typeof window!="undefined"&&window.document&&window.document.createElement);function Tt(e,t){t(window.confirm(e))}function Tr(){var e=window.navigator.userAgent;return(e.indexOf("Android 2.")!==-1||e.indexOf("Android 4.0")!==-1)&&e.indexOf("Mobile Safari")!==-1&&e.indexOf("Chrome")===-1&&e.indexOf("Windows Phone")===-1?!1:window.history&&"pushState"in window.history}function br(){return window.navigator.userAgent.indexOf("Trident")===-1}function Nr(){return window.navigator.userAgent.indexOf("Firefox")===-1}function Rr(e){return e.state===void 0&&navigator.userAgent.indexOf("CriOS")===-1}var bt="popstate",Nt="hashchange";function Rt(){try{return window.history.state||{}}catch{return{}}}function xt(e){e===void 0&&(e={}),wt||X(!1);var t=window.history,r=Tr(),n=!br(),o=e,i=o.forceRefresh,s=i===void 0?!1:i,p=o.getUserConfirmation,u=p===void 0?Tt:p,a=o.keyLength,c=a===void 0?6:a,f=e.basename?Et(he(e.basename)):"";function l(g){var T=g||{},h=T.key,d=T.state,E=window.location,b=E.pathname,G=E.search,W=E.hash,I=b+G+W;return f&&(I=Pt(I,f)),j(I,d,h)}function v(){return Math.random().toString(36).substr(2,c)}var m=je();function R(g){L(F,g),F.length=t.length,m.notifyListeners(F.location,F.action)}function N(g){Rr(g)||H(l(g.state))}function C(){H(l(Rt()))}var D=!1;function H(g){if(D)D=!1,R();else{var T="POP";m.confirmTransitionTo(g,T,u,function(h){h?R({action:T,location:g}):k(g)})}}function k(g){var T=F.location,h=x.indexOf(T.key);h===-1&&(h=0);var d=x.indexOf(g.key);d===-1&&(d=0);var E=h-d;E&&(D=!0,_(E))}var V=l(Rt()),x=[V.key];function P(g){return f+M(g)}function y(g,T){var h="PUSH",d=j(g,T,v(),F.location);m.confirmTransitionTo(d,h,u,function(E){if(!!E){var b=P(d),G=d.key,W=d.state;if(r)if(t.pushState({key:G,state:W},null,b),s)window.location.href=b;else{var I=x.indexOf(F.location.key),se=x.slice(0,I+1);se.push(d.key),x=se,R({action:h,location:d})}else window.location.href=b}})}function A(g,T){var h="REPLACE",d=j(g,T,v(),F.location);m.confirmTransitionTo(d,h,u,function(E){if(!!E){var b=P(d),G=d.key,W=d.state;if(r)if(t.replaceState({key:G,state:W},null,b),s)window.location.replace(b);else{var I=x.indexOf(F.location.key);I!==-1&&(x[I]=d.key),R({action:h,location:d})}else window.location.replace(b)}})}function _(g){t.go(g)}function $(){_(-1)}function q(){_(1)}var re=0;function z(g){re+=g,re===1&&g===1?(window.addEventListener(bt,N),n&&window.addEventListener(Nt,C)):re===0&&(window.removeEventListener(bt,N),n&&window.removeEventListener(Nt,C))}var U=!1;function ie(g){g===void 0&&(g=!1);var T=m.setPrompt(g);return U||(z(1),U=!0),function(){return U&&(U=!1,z(-1)),T()}}function ae(g){var T=m.appendListener(g);return z(1),function(){z(-1),T()}}var F={length:t.length,action:"POP",location:V,createHref:P,push:y,replace:A,go:_,goBack:$,goForward:q,block:ie,listen:ae};return F}var Ot="hashchange",xr={hashbang:{encodePath:function(t){return t.charAt(0)==="!"?t:"!/"+gt(t)},decodePath:function(t){return t.charAt(0)==="!"?t.substr(1):t}},noslash:{encodePath:gt,decodePath:he},slash:{encodePath:he,decodePath:he}};function _t(e){var t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function de(){var e=window.location.href,t=e.indexOf("#");return t===-1?"":e.substring(t+1)}function Or(e){window.location.hash=e}function He(e){window.location.replace(_t(window.location.href)+"#"+e)}function Lt(e){e===void 0&&(e={}),wt||X(!1);var t=window.history,r=Nr(),n=e,o=n.getUserConfirmation,i=o===void 0?Tt:o,s=n.hashType,p=s===void 0?"slash":s,u=e.basename?Et(he(e.basename)):"",a=xr[p],c=a.encodePath,f=a.decodePath;function l(){var h=f(de());return u&&(h=Pt(h,u)),j(h)}var v=je();function m(h){L(T,h),T.length=t.length,v.notifyListeners(T.location,T.action)}var R=!1,N=null;function C(h,d){return h.pathname===d.pathname&&h.search===d.search&&h.hash===d.hash}function D(){var h=de(),d=c(h);if(h!==d)He(d);else{var E=l(),b=T.location;if(!R&&C(b,E)||N===M(E))return;N=null,H(E)}}function H(h){if(R)R=!1,m();else{var d="POP";v.confirmTransitionTo(h,d,i,function(E){E?m({action:d,location:h}):k(h)})}}function k(h){var d=T.location,E=y.lastIndexOf(M(d));E===-1&&(E=0);var b=y.lastIndexOf(M(h));b===-1&&(b=0);var G=E-b;G&&(R=!0,q(G))}var V=de(),x=c(V);V!==x&&He(x);var P=l(),y=[M(P)];function A(h){var d=document.querySelector("base"),E="";return d&&d.getAttribute("href")&&(E=_t(window.location.href)),E+"#"+c(u+M(h))}function _(h,d){var E="PUSH",b=j(h,void 0,void 0,T.location);v.confirmTransitionTo(b,E,i,function(G){if(!!G){var W=M(b),I=c(u+W),se=de()!==I;if(se){N=W,Or(I);var ye=y.lastIndexOf(M(T.location)),nt=y.slice(0,ye+1);nt.push(W),y=nt,m({action:E,location:b})}else m()}})}function $(h,d){var E="REPLACE",b=j(h,void 0,void 0,T.location);v.confirmTransitionTo(b,E,i,function(G){if(!!G){var W=M(b),I=c(u+W),se=de()!==I;se&&(N=W,He(I));var ye=y.indexOf(M(T.location));ye!==-1&&(y[ye]=W),m({action:E,location:b})}})}function q(h){t.go(h)}function re(){q(-1)}function z(){q(1)}var U=0;function ie(h){U+=h,U===1&&h===1?window.addEventListener(Ot,D):U===0&&window.removeEventListener(Ot,D)}var ae=!1;function F(h){h===void 0&&(h=!1);var d=v.setPrompt(h);return ae||(ie(1),ae=!0),function(){return ae&&(ae=!1,ie(-1)),d()}}function g(h){var d=v.appendListener(h);return ie(1),function(){ie(-1),d()}}var T={length:t.length,action:"POP",location:P,createHref:A,push:_,replace:$,go:q,goBack:re,goForward:z,block:F,listen:g};return T}function Ct(e,t,r){return Math.min(Math.max(e,t),r)}function St(e){e===void 0&&(e={});var t=e,r=t.getUserConfirmation,n=t.initialEntries,o=n===void 0?["/"]:n,i=t.initialIndex,s=i===void 0?0:i,p=t.keyLength,u=p===void 0?6:p,a=je();function c(y){L(P,y),P.length=P.entries.length,a.notifyListeners(P.location,P.action)}function f(){return Math.random().toString(36).substr(2,u)}var l=Ct(s,0,o.length-1),v=o.map(function(y){return typeof y=="string"?j(y,void 0,f()):j(y,void 0,y.key||f())}),m=M;function R(y,A){var _="PUSH",$=j(y,A,f(),P.location);a.confirmTransitionTo($,_,r,function(q){if(!!q){var re=P.index,z=re+1,U=P.entries.slice(0);U.length>z?U.splice(z,U.length-z,$):U.push($),c({action:_,location:$,index:z,entries:U})}})}function N(y,A){var _="REPLACE",$=j(y,A,f(),P.location);a.confirmTransitionTo($,_,r,function(q){!q||(P.entries[P.index]=$,c({action:_,location:$}))})}function C(y){var A=Ct(P.index+y,0,P.entries.length-1),_="POP",$=P.entries[A];a.confirmTransitionTo($,_,r,function(q){q?c({action:_,location:$,index:A}):c()})}function D(){C(-1)}function H(){C(1)}function k(y){var A=P.index+y;return A>=0&&A<P.entries.length}function V(y){return y===void 0&&(y=!1),a.setPrompt(y)}function x(y){return a.appendListener(y)}var P={length:v.length,action:"POP",location:v[l],index:l,entries:v,createHref:m,push:R,replace:N,go:C,goBack:D,goForward:H,canGo:k,block:V,listen:x};return P}var ve=J(ne("react"));var Ue=J(mt());var Ie=1073741823,Dt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:{};function _r(){var e="__global_unique_id__";return Dt[e]=(Dt[e]||0)+1}function Lr(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function Cr(e){var t=[];return{on:function(n){t.push(n)},off:function(n){t=t.filter(function(o){return o!==n})},get:function(){return e},set:function(n,o){e=n,t.forEach(function(i){return i(e,o)})}}}function Sr(e){return Array.isArray(e)?e[0]:e}function Dr(e,t){var r,n,o="__create-react-context-"+_r()+"__",i=function(p){B(u,p);function u(){var c;return c=p.apply(this,arguments)||this,c.emitter=Cr(c.props.value),c}var a=u.prototype;return a.getChildContext=function(){var f;return f={},f[o]=this.emitter,f},a.componentWillReceiveProps=function(f){if(this.props.value!==f.value){var l=this.props.value,v=f.value,m;Lr(l,v)?m=0:(m=typeof t=="function"?t(l,v):Ie,m|=0,m!==0&&this.emitter.set(f.value,m))}},a.render=function(){return this.props.children},u}(ve.Component);i.childContextTypes=(r={},r[o]=Ue.default.object.isRequired,r);var s=function(p){B(u,p);function u(){var c;return c=p.apply(this,arguments)||this,c.state={value:c.getValue()},c.onUpdate=function(f,l){var v=c.observedBits|0;(v&l)!=0&&c.setState({value:c.getValue()})},c}var a=u.prototype;return a.componentWillReceiveProps=function(f){var l=f.observedBits;this.observedBits=l??Ie},a.componentDidMount=function(){this.context[o]&&this.context[o].on(this.onUpdate);var f=this.props.observedBits;this.observedBits=f??Ie},a.componentWillUnmount=function(){this.context[o]&&this.context[o].off(this.onUpdate)},a.getValue=function(){return this.context[o]?this.context[o].get():e},a.render=function(){return Sr(this.props.children)(this.state.value)},u}(ve.Component);return s.contextTypes=(n={},n[o]=Ue.default.object,n),{Provider:i,Consumer:s}}var Ar=ve.default.createContext||Dr,At=Ar;var Jt=J(Ut()),to=J(Ge());function oe(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i<n.length;i++)o=n[i],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var en=J(zt()),Xt=function(t){var r=At();return r.displayName=t,r},tn=Xt("Router-History"),te=Xt("Router"),ue=function(e){B(t,e),t.computeRootMatch=function(o){return{path:"/",url:"/",params:{},isExact:o==="/"}};function t(n){var o;return o=e.call(this,n)||this,o.state={location:n.history.location},o._isMounted=!1,o._pendingLocation=null,n.staticContext||(o.unlisten=n.history.listen(function(i){o._pendingLocation=i})),o}var r=t.prototype;return r.componentDidMount=function(){var o=this;this._isMounted=!0,this.unlisten&&this.unlisten(),this.props.staticContext||(this.unlisten=this.props.history.listen(function(i){o._isMounted&&o.setState({location:i})})),this._pendingLocation&&this.setState({location:this._pendingLocation})},r.componentWillUnmount=function(){this.unlisten&&(this.unlisten(),this._isMounted=!1,this._pendingLocation=null)},r.render=function(){return O.default.createElement(te.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},O.default.createElement(tn.Provider,{children:this.props.children||null,value:this.props.history}))},t}(O.default.Component),rn=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.history=St(n.props),n}var r=t.prototype;return r.render=function(){return O.default.createElement(ue,{history:this.history,children:this.props.children})},t}(O.default.Component),oo=function(e){B(t,e);function t(){return e.apply(this,arguments)||this}var r=t.prototype;return r.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},r.componentDidUpdate=function(o){this.props.onUpdate&&this.props.onUpdate.call(this,this,o)},r.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},r.render=function(){return null},t}(O.default.Component);var Qt={},nn=1e4,Zt=0;function on(e,t){var r=""+t.end+t.strict+t.sensitive,n=Qt[r]||(Qt[r]={});if(n[e])return n[e];var o=[],i=(0,Jt.default)(e,o,t),s={regexp:i,keys:o};return Zt<nn&&(n[e]=s,Zt++),s}function me(e,t){t===void 0&&(t={}),(typeof t=="string"||Array.isArray(t))&&(t={path:t});var r=t,n=r.path,o=r.exact,i=o===void 0?!1:o,s=r.strict,p=s===void 0?!1:s,u=r.sensitive,a=u===void 0?!1:u,c=[].concat(n);return c.reduce(function(f,l){if(!l&&l!=="")return null;if(f)return f;var v=on(l,{end:i,strict:p,sensitive:a}),m=v.regexp,R=v.keys,N=m.exec(e);if(!N)return null;var C=N[0],D=N.slice(1),H=e===C;return i&&!H?null:{path:l,url:l==="/"&&C===""?"/":C,isExact:H,params:R.reduce(function(k,V,x){return k[V.name]=D[x],k},{})}},null)}function an(e){return O.default.Children.count(e)===0}var sn=function(e){B(t,e);function t(){return e.apply(this,arguments)||this}var r=t.prototype;return r.render=function(){var o=this;return O.default.createElement(te.Consumer,null,function(i){i||X(!1);var s=o.props.location||i.location,p=o.props.computedMatch?o.props.computedMatch:o.props.path?me(s.pathname,o.props):i.match,u=L({},i,{location:s,match:p}),a=o.props,c=a.children,f=a.component,l=a.render;return Array.isArray(c)&&an(c)&&(c=null),O.default.createElement(te.Provider,{value:u},u.match?c?typeof c=="function"?c(u):c:f?O.default.createElement(f,u):l?l(u):null:typeof c=="function"?c(u):null)})},t}(O.default.Component);function Je(e){return e.charAt(0)==="/"?e:"/"+e}function cn(e,t){return e?L({},t,{pathname:Je(e)+t.pathname}):t}function un(e,t){if(!e)return t;var r=Je(e);return t.pathname.indexOf(r)!==0?t:L({},t,{pathname:t.pathname.substr(r.length)})}function er(e){return typeof e=="string"?e:M(e)}function Xe(e){return function(){X(!1)}}function tr(){}var pn=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.handlePush=function(p){return n.navigateTo(p,"PUSH")},n.handleReplace=function(p){return n.navigateTo(p,"REPLACE")},n.handleListen=function(){return tr},n.handleBlock=function(){return tr},n}var r=t.prototype;return r.navigateTo=function(o,i){var s=this.props,p=s.basename,u=p===void 0?"":p,a=s.context,c=a===void 0?{}:a;c.action=i,c.location=cn(u,j(o)),c.url=er(c.location)},r.render=function(){var o=this.props,i=o.basename,s=i===void 0?"":i,p=o.context,u=p===void 0?{}:p,a=o.location,c=a===void 0?"/":a,f=oe(o,["basename","context","location"]),l={createHref:function(m){return Je(s+er(m))},action:"POP",location:un(s,j(c)),push:this.handlePush,replace:this.handleReplace,go:Xe("go"),goBack:Xe("goBack"),goForward:Xe("goForward"),listen:this.handleListen,block:this.handleBlock};return O.default.createElement(ue,L({},f,{history:l,staticContext:u}))},t}(O.default.Component),fn=function(e){B(t,e);function t(){return e.apply(this,arguments)||this}var r=t.prototype;return r.render=function(){var o=this;return O.default.createElement(te.Consumer,null,function(i){i||X(!1);var s=o.props.location||i.location,p,u;return O.default.Children.forEach(o.props.children,function(a){if(u==null&&O.default.isValidElement(a)){p=a;var c=a.props.path||a.props.from;u=c?me(s.pathname,L({},a.props,{path:c})):i.match}}),u?O.default.cloneElement(p,{location:s,computedMatch:u}):null})},t}(O.default.Component);var ln=O.default.useContext;function Qe(){return ln(te).location}var K=J(ne("react"));var Eo=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.history=xt(n.props),n}var r=t.prototype;return r.render=function(){return K.default.createElement(ue,{history:this.history,children:this.props.children})},t}(K.default.Component),wo=function(e){B(t,e);function t(){for(var n,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.history=Lt(n.props),n}var r=t.prototype;return r.render=function(){return K.default.createElement(ue,{history:this.history,children:this.props.children})},t}(K.default.Component),Ze=function(t,r){return typeof t=="function"?t(r):t},et=function(t,r){return typeof t=="string"?j(t,null,null,r):t},tt=function(t){return t},pe=K.default.forwardRef;typeof pe=="undefined"&&(pe=tt);function hn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var dn=pe(function(e,t){var r=e.innerRef,n=e.navigate,o=e.onClick,i=oe(e,["innerRef","navigate","onClick"]),s=i.target,p=L({},i,{onClick:function(a){try{o&&o(a)}catch(c){throw a.preventDefault(),c}!a.defaultPrevented&&a.button===0&&(!s||s==="_self")&&!hn(a)&&(a.preventDefault(),n())}});return tt!==pe?p.ref=t||r:p.ref=r,K.default.createElement("a",p)}),vn=pe(function(e,t){var r=e.component,n=r===void 0?dn:r,o=e.replace,i=e.to,s=e.innerRef,p=oe(e,["component","replace","to","innerRef"]);return K.default.createElement(te.Consumer,null,function(u){u||X(!1);var a=u.history,c=et(Ze(i,u.location),u.location),f=c?a.createHref(c):"",l=L({},p,{href:f,navigate:function(){var m=Ze(i,u.location),R=M(u.location)===M(et(m)),N=o||R?a.replace:a.push;N(m)}});return tt!==pe?l.ref=t||s:l.innerRef=s,K.default.createElement(n,l)})});var rr=function(t){return t},De=K.default.forwardRef;typeof De=="undefined"&&(De=rr);function mn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(function(n){return n}).join(" ")}var To=De(function(e,t){var r=e["aria-current"],n=r===void 0?"page":r,o=e.activeClassName,i=o===void 0?"active":o,s=e.activeStyle,p=e.className,u=e.exact,a=e.isActive,c=e.location,f=e.sensitive,l=e.strict,v=e.style,m=e.to,R=e.innerRef,N=oe(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.default.createElement(te.Consumer,null,function(C){C||X(!1);var D=c||C.location,H=et(Ze(m,D),D),k=H.pathname,V=k&&k.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),x=V?me(D.pathname,{path:V,exact:u,sensitive:f,strict:l}):null,P=!!(a?a(x,D):x),y=typeof p=="function"?p(P):p,A=typeof v=="function"?v(P):v;P&&(y=mn(y,i),A=L({},A,s));var _=L({"aria-current":P&&n||null,className:y,style:A,to:H},N);return rr!==De?_.ref=t||R:_.innerRef=R,K.default.createElement(vn,_)})});var Ae=J(ne("piral-core")),yn=e=>(0,Ae.defaultRender)(e.children);function gn(e,t="default"){return r=>{var u;let n=Qe(),o=r.paths.find(a=>a.matcher.test(n.pathname)),i=((u=o==null?void 0:o.meta)==null?void 0:u.layout)||t,s=(0,Ae.useGlobalState)(a=>a.registry.pageLayouts[i]||a.registry.pageLayouts[t]),p=(s==null?void 0:s.component)||yn;return(0,rt.createElement)(p,r,(0,rt.createElement)(e,r))}}function nr(e){let t={};return e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t[r]={pilet:void 0,component:e[r]}}),t}function or(e,t){return r=>Z(Q({},r),{components:Z(Q({},r.components),{RouteSwitch:gn(r.components.RouteSwitch,t)}),registry:Z(Q({},r.registry),{pageLayouts:e})})}function Pn(e={}){let{layouts:t={},fallback:r}=e;return n=>{let o=i=>n.readState(s=>s.registry.pageLayouts[i]);return n.defineActions(Me),n.dispatch(or(nr(t),r)),i=>{let s=i.meta.name;return{registerPageLayout(p,u){let a=o(p);if(!a||a.pilet===s){let c=(0,ir.withApi)(n,u,i,"pageLayout");n.registerPageLayout(p,{component:c,pilet:s})}return()=>i.unregisterPageLayout(p)},unregisterPageLayout(p){let u=o(p);(u==null?void 0:u.pilet)===s&&n.unregisterPageLayout(p)}}}}}return En;})();
|
|
2
2
|
/** @license React v16.13.1
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
package/src/create.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as actions from './actions';
|
|
2
|
-
import { ComponentType
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type { PiletPageLayoutsApi
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { PiralPlugin, PageComponentProps, withApi } from 'piral-core';
|
|
4
|
+
import { getPageLayouts, withPageLayouts } from './utils';
|
|
5
|
+
import type { PiletPageLayoutsApi } from './types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Available configuration options for the page layout plugin.
|
|
@@ -19,48 +19,6 @@ export interface PageLayoutsConfig {
|
|
|
19
19
|
layouts?: Record<string, ComponentType<PageComponentProps>>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
function getPageLayouts(items: Record<string, ComponentType<PageComponentProps>>) {
|
|
23
|
-
const layouts: Dict<PageLayoutRegistration> = {};
|
|
24
|
-
|
|
25
|
-
if (items && typeof items === 'object') {
|
|
26
|
-
Object.keys(items).forEach((name) => {
|
|
27
|
-
layouts[name] = {
|
|
28
|
-
pilet: undefined,
|
|
29
|
-
component: items[name],
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return layouts;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const DefaultLayout: React.FC<PropsWithChildren> = props => defaultRender(props.children);
|
|
38
|
-
|
|
39
|
-
function createPageWrapper(Routes: ComponentType<RouteSwitchProps>, fallback = 'default'): ComponentType<RouteSwitchProps> {
|
|
40
|
-
return (props) => {
|
|
41
|
-
const location = useLocation();
|
|
42
|
-
const data = props.paths.find(m => m.matcher.test(location.pathname));
|
|
43
|
-
const layout = data?.meta?.layout || fallback;
|
|
44
|
-
const registration = useGlobalState((s) => s.registry.pageLayouts[layout] || s.registry.pageLayouts[fallback]);
|
|
45
|
-
const Layout = registration?.component || DefaultLayout;
|
|
46
|
-
return createElement(Layout, props, createElement(Routes, props));
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function withPageLayouts(pageLayouts: Dict<PageLayoutRegistration>, fallback: string) {
|
|
51
|
-
return (state: GlobalState): GlobalState => ({
|
|
52
|
-
...state,
|
|
53
|
-
components: {
|
|
54
|
-
...state.components,
|
|
55
|
-
RouteSwitch: createPageWrapper(state.components.RouteSwitch, fallback),
|
|
56
|
-
},
|
|
57
|
-
registry: {
|
|
58
|
-
...state.registry,
|
|
59
|
-
pageLayouts,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
22
|
/**
|
|
65
23
|
* Creates new Pilet API extensions for dealing with page layouts.
|
|
66
24
|
*/
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComponentType, createElement, PropsWithChildren } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import { PageComponentProps, Dict, defaultRender, useGlobalState, RouteSwitchProps, GlobalState } from 'piral-core';
|
|
4
|
+
import type { PageLayoutRegistration } from './types';
|
|
5
|
+
|
|
6
|
+
const DefaultLayout: React.FC<PropsWithChildren> = (props) => defaultRender(props.children);
|
|
7
|
+
|
|
8
|
+
function createPageWrapper(
|
|
9
|
+
Routes: ComponentType<RouteSwitchProps>,
|
|
10
|
+
fallback = 'default',
|
|
11
|
+
): ComponentType<RouteSwitchProps> {
|
|
12
|
+
return (props) => {
|
|
13
|
+
const location = useLocation();
|
|
14
|
+
const data = props.paths.find((m) => m.matcher.test(location.pathname));
|
|
15
|
+
const layout = data?.meta?.layout || fallback;
|
|
16
|
+
const registration = useGlobalState((s) => s.registry.pageLayouts[layout] || s.registry.pageLayouts[fallback]);
|
|
17
|
+
const Layout = registration?.component || DefaultLayout;
|
|
18
|
+
return createElement(Layout, props, createElement(Routes, props));
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getPageLayouts(items: Record<string, ComponentType<PageComponentProps>>) {
|
|
23
|
+
const layouts: Dict<PageLayoutRegistration> = {};
|
|
24
|
+
|
|
25
|
+
if (items && typeof items === 'object') {
|
|
26
|
+
Object.keys(items).forEach((name) => {
|
|
27
|
+
layouts[name] = {
|
|
28
|
+
pilet: undefined,
|
|
29
|
+
component: items[name],
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return layouts;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function withPageLayouts(pageLayouts: Dict<PageLayoutRegistration>, fallback: string) {
|
|
38
|
+
return (state: GlobalState): GlobalState => ({
|
|
39
|
+
...state,
|
|
40
|
+
components: {
|
|
41
|
+
...state.components,
|
|
42
|
+
RouteSwitch: createPageWrapper(state.components.RouteSwitch, fallback),
|
|
43
|
+
},
|
|
44
|
+
registry: {
|
|
45
|
+
...state.registry,
|
|
46
|
+
pageLayouts,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|