piral-page-layouts 0.15.0-alpha.4034 → 0.15.0-alpha.4098
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/esm/create.js.map +1 -1
- package/esm/types.d.ts +2 -1
- package/lib/create.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +2 -1
- package/package.json +4 -4
- package/piral-page-layouts.min.js +1 -1
- package/src/create.ts +2 -2
- package/src/types.ts +2 -1
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;AACrC,OAAO,EAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAiB,aAAa,EAAqB,MAAM,OAAO,CAAC;AACxE,OAAO,EAAsD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAkBxH,SAAS,cAAc,CAAC,KAAwD;IAC9E,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,cAAc,GAAyD,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE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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/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
1
2
|
import type { RouteComponentProps } from 'react-router';
|
|
2
3
|
import type { AnyComponent, BaseRegistration, Dict, PageComponentProps, PiralPageMeta, RegistrationDisposer, WrappedComponent } from 'piral-core';
|
|
3
4
|
declare module 'piral-core/lib/types/custom' {
|
|
@@ -62,7 +63,7 @@ export interface PiletPageLayoutsApi {
|
|
|
62
63
|
* @param name The name of the layout.
|
|
63
64
|
* @param layout The component responsible for the layout.
|
|
64
65
|
*/
|
|
65
|
-
registerPageLayout(name: string, layout: AnyComponent<PageComponentProps
|
|
66
|
+
registerPageLayout(name: string, layout: AnyComponent<PropsWithChildren<PageComponentProps>>): RegistrationDisposer;
|
|
66
67
|
/**
|
|
67
68
|
* Unregisters a page layout.
|
|
68
69
|
* @param name The name of the layout.
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,iCAAwE;AACxE,2CAAwH;AAkBxH,SAAS,cAAc,CAAC,KAAwD;IAC9E,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,cAAc,GAAyD,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEtH,SAAS,iBAAiB,CAAC,OAAO,GAAG,cAAc,EAAE,QAAQ,GAAG,SAAS;IACvE,OAAO,CAAC,KAAK,EAAE,EAAE;;QACf,MAAM,MAAM,GAAG,CAAA,MAAA,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,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,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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./create"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,kDAAwB"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
1
2
|
import type { RouteComponentProps } from 'react-router';
|
|
2
3
|
import type { AnyComponent, BaseRegistration, Dict, PageComponentProps, PiralPageMeta, RegistrationDisposer, WrappedComponent } from 'piral-core';
|
|
3
4
|
declare module 'piral-core/lib/types/custom' {
|
|
@@ -62,7 +63,7 @@ export interface PiletPageLayoutsApi {
|
|
|
62
63
|
* @param name The name of the layout.
|
|
63
64
|
* @param layout The component responsible for the layout.
|
|
64
65
|
*/
|
|
65
|
-
registerPageLayout(name: string, layout: AnyComponent<PageComponentProps
|
|
66
|
+
registerPageLayout(name: string, layout: AnyComponent<PropsWithChildren<PageComponentProps>>): RegistrationDisposer;
|
|
66
67
|
/**
|
|
67
68
|
* Unregisters a page layout.
|
|
68
69
|
* @param name The name of the layout.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-page-layouts",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4098",
|
|
4
4
|
"description": "Plugin for providing different page layouts in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"piral-core": "0.15.0-alpha.
|
|
47
|
+
"piral-core": "0.15.0-alpha.4098"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"piral-core": "0.14.x",
|
|
50
|
+
"piral-core": "0.14.x || 0.15.x",
|
|
51
51
|
"react": ">=16.8.0",
|
|
52
52
|
"react-router": "5.x"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "02ef35574b29cc5dd93c515bfdf27dd523893b28"
|
|
55
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var piralPageLayouts=(()=>{var A=Object.create;var
|
|
1
|
+
var piralPageLayouts=(()=>{var A=Object.create;var l=Object.defineProperty,T=Object.defineProperties,x=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,j=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var b=(t,e,o)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,i=(t,e)=>{for(var o in e||(e={}))h.call(e,o)&&b(t,o,e[o]);if(d)for(var o of d(e))k.call(e,o)&&b(t,o,e[o]);return t},n=(t,e)=>T(t,D(e)),R=t=>l(t,"__esModule",{value:!0});var P=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,o)=>(typeof require!="undefined"?require:e)[o]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var S=(t,e)=>{R(t);for(var o in e)l(t,o,{get:e[o],enumerable:!0})},E=(t,e,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of W(e))!h.call(t,r)&&r!=="default"&&l(t,r,{get:()=>e[r],enumerable:!(o=x(e,r))||o.enumerable});return t},f=t=>E(R(l(t!=null?A(j(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var F={};S(F,{createPageLayoutsApi:()=>B});var L={};S(L,{registerPageLayout:()=>K,unregisterPageLayout:()=>O});var c=f(P("piral-core"));function K(t,e,o){t.dispatch(r=>n(i({},r),{registry:n(i({},r.registry),{pageLayouts:(0,c.withKey)(r.registry.pageLayouts,e,o)})}))}function O(t,e){t.dispatch(o=>n(i({},o),{registry:n(i({},o.registry),{pageLayouts:(0,c.withoutKey)(o.registry.pageLayouts,e)})}))}var m=f(P("react")),y=f(P("piral-core"));function q(t){let e={};return t&&typeof t=="object"&&Object.keys(t).forEach(o=>{e[o]={pilet:void 0,component:t[o]}}),e}var w=t=>(0,y.defaultRender)(t.children);function v(t=w,e="default"){return o=>{var g;let r=((g=o.meta)==null?void 0:g.layout)||e,s=(0,y.useGlobalState)(a=>a.registry.pageLayouts[r]||a.registry.pageLayouts[e]),p=(s==null?void 0:s.component)||w;return(0,m.createElement)(t,o,(0,m.createElement)(p,o))}}function z(t,e){return o=>n(i({},o),{registry:n(i({},o.registry),{wrappers:n(i({},o.registry.wrappers),{page:v(o.registry.wrappers.page,e)}),pageLayouts:t})})}function B(t={}){let{layouts:e={},fallback:o}=t;return r=>{let s=p=>r.readState(g=>g.registry.pageLayouts[p]);return r.defineActions(L),r.dispatch(z(q(e),o)),p=>{let g=p.meta.name;return{registerPageLayout(a,u){let C=s(a);if(!C||C.pilet===g){let G=(0,y.withApi)(r,u,p,"pageLayout");r.registerPageLayout(a,{component:G,pilet:g})}return()=>p.unregisterPageLayout(a)},unregisterPageLayout(a){let u=s(a);(u==null?void 0:u.pilet)===g&&r.unregisterPageLayout(a)}}}}}return F;})();
|
package/src/create.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as actions from './actions';
|
|
2
|
-
import { ComponentType, createElement } from 'react';
|
|
2
|
+
import { ComponentType, createElement, PropsWithChildren } from 'react';
|
|
3
3
|
import { PiralPlugin, PageComponentProps, Dict, GlobalState, withApi, defaultRender, useGlobalState } from 'piral-core';
|
|
4
4
|
import type { PiletPageLayoutsApi, PageLayoutRegistration } from './types';
|
|
5
5
|
|
|
@@ -33,7 +33,7 @@ function getPageLayouts(items: Record<string, ComponentType<PageComponentProps>>
|
|
|
33
33
|
return layouts;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const DefaultWrapper: ComponentType<PageComponentProps
|
|
36
|
+
const DefaultWrapper: ComponentType<PropsWithChildren<PageComponentProps>> = (props) => defaultRender(props.children);
|
|
37
37
|
|
|
38
38
|
function createPageWrapper(Wrapper = DefaultWrapper, fallback = 'default'): ComponentType<PageComponentProps> {
|
|
39
39
|
return (props) => {
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
1
2
|
import type { RouteComponentProps } from 'react-router';
|
|
2
3
|
import type {
|
|
3
4
|
AnyComponent,
|
|
@@ -77,7 +78,7 @@ export interface PiletPageLayoutsApi {
|
|
|
77
78
|
* @param name The name of the layout.
|
|
78
79
|
* @param layout The component responsible for the layout.
|
|
79
80
|
*/
|
|
80
|
-
registerPageLayout(name: string, layout: AnyComponent<PageComponentProps
|
|
81
|
+
registerPageLayout(name: string, layout: AnyComponent<PropsWithChildren<PageComponentProps>>): RegistrationDisposer;
|
|
81
82
|
/**
|
|
82
83
|
* Unregisters a page layout.
|
|
83
84
|
* @param name The name of the layout.
|