piral-core 0.15.0-alpha.4041 → 0.15.0-alpha.4231
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/PiralContext.js.map +1 -1
- package/esm/components/ErrorBoundary.d.ts +4 -0
- package/esm/components/ErrorBoundary.js.map +1 -1
- package/esm/components/ExtensionSlot.js +12 -4
- package/esm/components/ExtensionSlot.js.map +1 -1
- package/esm/components/ForeignComponentContainer.d.ts +1 -1
- package/esm/components/ForeignComponentContainer.js.map +1 -1
- package/esm/components/PiralSuspense.d.ts +4 -1
- package/esm/components/PiralSuspense.js.map +1 -1
- package/esm/components/PiralView.d.ts +4 -0
- package/esm/components/PiralView.js.map +1 -1
- package/esm/components/ResponsiveLayout.d.ts +7 -0
- package/esm/components/ResponsiveLayout.js.map +1 -1
- package/esm/components/wrapComponent.d.ts +1 -1
- package/esm/defaults/DefaultRouter.d.ts +2 -1
- package/esm/defaults/DefaultRouter.js.map +1 -1
- package/esm/state/withApi.js.map +1 -1
- package/esm/types/api.d.ts +16 -3
- package/esm/types/components.d.ts +9 -1
- package/esm/types/extension.d.ts +19 -0
- package/esm/types/instance.d.ts +3 -1
- package/esm/types/state.d.ts +20 -2
- package/lib/PiralContext.js.map +1 -1
- package/lib/actions/index.js +6 -6
- package/lib/actions/index.js.map +1 -1
- package/lib/components/ErrorBoundary.d.ts +4 -0
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/ErrorBoundary.js.map +1 -1
- package/lib/components/ExtensionSlot.js +12 -4
- package/lib/components/ExtensionSlot.js.map +1 -1
- package/lib/components/ForeignComponentContainer.d.ts +1 -1
- package/lib/components/ForeignComponentContainer.js.map +1 -1
- package/lib/components/PiralRoutes.js +1 -1
- package/lib/components/PiralRoutes.js.map +1 -1
- package/lib/components/PiralSuspense.d.ts +4 -1
- package/lib/components/PiralSuspense.js.map +1 -1
- package/lib/components/PiralView.d.ts +4 -0
- package/lib/components/PiralView.js.map +1 -1
- package/lib/components/ResponsiveLayout.d.ts +7 -0
- package/lib/components/ResponsiveLayout.js.map +1 -1
- package/lib/components/index.js +12 -12
- package/lib/components/index.js.map +1 -1
- package/lib/components/wrapComponent.d.ts +1 -1
- package/lib/defaults/DefaultRouteSwitch.js +1 -1
- package/lib/defaults/DefaultRouteSwitch.js.map +1 -1
- package/lib/defaults/DefaultRouter.d.ts +2 -1
- package/lib/defaults/DefaultRouter.js.map +1 -1
- package/lib/defaults/index.js +5 -5
- package/lib/defaults/index.js.map +1 -1
- package/lib/hooks/actions.js +1 -1
- package/lib/hooks/actions.js.map +1 -1
- package/lib/hooks/index.js +6 -6
- package/lib/hooks/index.js.map +1 -1
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/modules/index.js +3 -3
- package/lib/modules/index.js.map +1 -1
- package/lib/setters/index.js +7 -7
- package/lib/setters/index.js.map +1 -1
- package/lib/state/index.js +4 -4
- package/lib/state/index.js.map +1 -1
- package/lib/state/withApi.js.map +1 -1
- package/lib/types/api.d.ts +16 -3
- package/lib/types/components.d.ts +9 -1
- package/lib/types/extension.d.ts +19 -0
- package/lib/types/index.js +12 -12
- package/lib/types/index.js.map +1 -1
- package/lib/types/instance.d.ts +3 -1
- package/lib/types/state.d.ts +20 -2
- package/lib/utils/helpers.js +1 -1
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/index.js +10 -10
- package/lib/utils/index.js.map +1 -1
- package/package.json +21 -8
- package/src/PiralContext.tsx +5 -1
- package/src/RootListener.test.tsx +7 -5
- package/src/actions/app.test.ts +1 -1
- package/src/components/ErrorBoundary.tsx +4 -0
- package/src/components/ExtensionSlot.test.tsx +32 -1
- package/src/components/ExtensionSlot.tsx +33 -16
- package/src/components/ForeignComponentContainer.test.tsx +25 -16
- package/src/components/ForeignComponentContainer.tsx +1 -2
- package/src/components/PiralSuspense.tsx +5 -1
- package/src/components/PiralView-server.test.tsx +27 -27
- package/src/components/PiralView.tsx +4 -0
- package/src/components/ResponsiveLayout.tsx +7 -0
- package/src/components/wrapComponent.tsx +1 -1
- package/src/defaults/DefaultRouter.tsx +2 -1
- package/src/hooks/setter.test.ts +3 -2
- package/src/state/withApi.tsx +2 -3
- package/src/types/api.ts +21 -3
- package/src/types/components.ts +11 -2
- package/src/types/extension.ts +19 -0
- package/src/types/instance.ts +3 -1
- package/src/types/state.ts +20 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { AnyComponent, ComponentConverters, PiletApi, BaseComponentProps } from '../types';
|
|
2
|
+
import type { AnyComponent, ComponentConverters, PiletApi, BaseComponentProps } from '../types';
|
|
3
3
|
interface CapturedProps {
|
|
4
4
|
piral: PiletApi;
|
|
5
5
|
}
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const react_router_1 = require("react-router");
|
|
7
7
|
const DefaultRouteSwitch = (_a) => {
|
|
8
|
-
var { paths, NotFound } = _a, props =
|
|
8
|
+
var { paths, NotFound } = _a, props = tslib_1.__rest(_a, ["paths", "NotFound"]);
|
|
9
9
|
return (React.createElement(react_router_1.Switch, Object.assign({}, props),
|
|
10
10
|
paths.map(({ path, Component }) => (React.createElement(react_router_1.Route, { exact: true, key: path, path: path, component: Component }))),
|
|
11
11
|
React.createElement(react_router_1.Route, { component: NotFound })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRouteSwitch.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouteSwitch.tsx"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,+CAA6C;AAGtC,MAAM,kBAAkB,GAA+B,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,
|
|
1
|
+
{"version":3,"file":"DefaultRouteSwitch.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouteSwitch.tsx"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,+CAA6C;AAGtC,MAAM,kBAAkB,GAA+B,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,sBAA3B,qBAA6B,CAAF;IACxF,OAAO,CACL,oBAAC,qBAAM,oBAAK,KAAK;QACd,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAClC,oBAAC,oBAAK,IAAC,KAAK,QAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,GAAI,CAC7D,CAAC;QACF,oBAAC,oBAAK,IAAC,SAAS,EAAE,QAAQ,GAAI,CACvB,CACV,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRouter.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouter.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uDAAiD;AACjD,oCAA0C;
|
|
1
|
+
{"version":3,"file":"DefaultRouter.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouter.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uDAAiD;AACjD,oCAA0C;AAGnC,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,oBAAC,gCAAa,IAAC,QAAQ,EAAE,UAAU,IAAG,QAAQ,CAAiB,CAAC;AACzE,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB"}
|
package/lib/defaults/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./DefaultErrorInfo"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./DefaultLayout"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./DefaultLoadingIndicator"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./DefaultRouter"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./DefaultRouteSwitch"), exports);
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/defaults/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/defaults/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,0DAAgC;AAChC,oEAA0C;AAC1C,0DAAgC;AAChC,+DAAqC"}
|
package/lib/hooks/actions.js
CHANGED
|
@@ -8,7 +8,7 @@ const stateContext_1 = require("../state/stateContext");
|
|
|
8
8
|
* Hook that gets the actions for manipulating the global state.
|
|
9
9
|
*/
|
|
10
10
|
function useActions() {
|
|
11
|
-
const _a = (0, react_1.useContext)(stateContext_1.StateContext), { state } = _a, actions =
|
|
11
|
+
const _a = (0, react_1.useContext)(stateContext_1.StateContext), { state } = _a, actions = tslib_1.__rest(_a, ["state"]);
|
|
12
12
|
return actions;
|
|
13
13
|
}
|
|
14
14
|
exports.useActions = useActions;
|
package/lib/hooks/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/hooks/actions.ts"],"names":[],"mappings":";;;;AAAA,iCAAmC;AACnC,wDAAqD;AAGrD;;GAEG;AACH,SAAgB,UAAU;IACxB,MAAM,KAAwB,IAAA,kBAAU,EAAqB,2BAAY,CAAC,EAApE,EAAE,KAAK,OAA6D,EAAxD,OAAO,
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/hooks/actions.ts"],"names":[],"mappings":";;;;AAAA,iCAAmC;AACnC,wDAAqD;AAGrD;;GAEG;AACH,SAAgB,UAAU;IACxB,MAAM,KAAwB,IAAA,kBAAU,EAAqB,2BAAY,CAAC,EAApE,EAAE,KAAK,OAA6D,EAAxD,OAAO,sBAAnB,SAAqB,CAA+C,CAAC;IAC3E,OAAO,OAAuB,CAAC;AACjC,CAAC;AAHD,gCAGC"}
|
package/lib/hooks/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./action"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./actions"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./globalState"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./media"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./setter"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./sharedData"), exports);
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,oDAA0B;AAC1B,wDAA8B;AAC9B,kDAAwB;AACxB,mDAAyB;AACzB,uDAA6B"}
|
package/lib/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./createInstance"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./Piral"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./helpers"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./components"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./hooks"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./setters"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./state"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,kDAAwB;AACxB,oDAA0B;AAC1B,uDAA6B;AAC7B,kDAAwB;AACxB,oDAA0B;AAC1B,kDAAwB;AACxB,kDAAwB;AACxB,kDAAwB"}
|
package/lib/modules/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./api"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./dependencies"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./element"), exports);
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/lib/modules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,yDAA+B;AAC/B,oDAA0B"}
|
package/lib/setters/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./SetComponent"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./SetError"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./SetErrors"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./SetLayout"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./SetProvider"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./SetRedirect"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./SetRoute"), exports);
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/lib/setters/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/setters/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/setters/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,qDAA2B;AAC3B,sDAA4B;AAC5B,sDAA4B;AAC5B,wDAA8B;AAC9B,wDAA8B;AAC9B,qDAA2B"}
|
package/lib/state/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./createActions"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./createGlobalState"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./stateContext"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./withApi"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/lib/state/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,8DAAoC;AACpC,yDAA+B;AAC/B,oDAA0B"}
|
package/lib/state/withApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withApi.js","sourceRoot":"","sources":["../../src/state/withApi.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;
|
|
1
|
+
{"version":3,"file":"withApi.js","sourceRoot":"","sources":["../../src/state/withApi.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,8CAA6D;AAC7D,oCAAyC;AAGzC,MAAM,cAAc,GAA0C,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEvG,SAAS,UAAU,CAAC,QAAkD,EAAE,WAAmB;IACzF,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEvC,IAAI,OAAO,IAAI,QAAQ,EAAE;QACvB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAChB,oBAAC,OAAO,oBAAK,KAAK;YAChB,oBAAC,QAAQ,oBAAK,KAAK,EAAI,CACf,CACX,CAAC;KACH;IAED,OAAO,QAAQ,IAAI,OAAO,IAAI,cAAc,CAAC;AAC/C,CAAC;AAED,SAAS,WAAW,CAClB,OAA2B,EAC3B,UAAe,EACf,WAAmB,EACnB,SAAuB;IAEvB,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAE5F,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAChB,oBAAC,YAAY,oBAAK,UAAU,EAAM,KAAK;QACrC,oBAAC,0BAAa,oBAAK,UAAU,EAAM,KAAK,IAAE,SAAS,EAAE,SAAS,KAC3D,KAAK,CAAC,QAAQ,CACD,CACH,CAChB,CAAC;AACJ,CAAC;AAED,SAAgB,OAAO,CACrB,OAA2B,EAC3B,SAAoD,EACpD,KAAe,EACf,SAAuB,EACvB,cAAsB,SAAS,EAC/B,QAAQ,GAAG,EAAE;IAEb,MAAM,UAAU,mCAAQ,QAAQ,KAAE,KAAK,GAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,MAAM,OAAO,GAAG,WAAW,CAAS,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACjF,OAAO,IAAA,0BAAa,EAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AAZD,0BAYC"}
|
package/lib/types/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactElement } from 'react';
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { RouteComponentProps } from 'react-router';
|
|
3
3
|
import type { PiletApi, Pilet, PiletEntry, PiletEntries, PiletMetadata, EventEmitter, PiletLoader, PiletLoadingStrategy } from 'piral-base';
|
|
4
4
|
import type { PiletCustomApi, PiralCustomPageMeta } from './custom';
|
|
@@ -33,6 +33,10 @@ export interface ExtensionComponentProps<T> extends BaseComponentProps {
|
|
|
33
33
|
* The provided parameters for showing the extension.
|
|
34
34
|
*/
|
|
35
35
|
params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
|
|
36
|
+
/**
|
|
37
|
+
* The optional children to receive, if any.
|
|
38
|
+
*/
|
|
39
|
+
children?: ReactNode;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* The meta data registered for a page.
|
|
@@ -53,6 +57,15 @@ export interface PageComponentProps<T = any, S = any> extends RouteBaseProps<T,
|
|
|
53
57
|
*/
|
|
54
58
|
meta: PiralPageMeta;
|
|
55
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* The meta data registered for a page.
|
|
62
|
+
*/
|
|
63
|
+
export interface PiralPageMeta extends PiralCustomPageMeta {
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Shorthand for the definition of an extension component.
|
|
67
|
+
*/
|
|
68
|
+
export declare type AnyExtensionComponent<TName> = TName extends keyof PiralExtensionSlotMap ? AnyComponent<ExtensionComponentProps<TName>> : TName extends string ? AnyComponent<ExtensionComponentProps<any>> : AnyComponent<ExtensionComponentProps<TName>>;
|
|
56
69
|
/**
|
|
57
70
|
* Defines the Pilet API from piral-core.
|
|
58
71
|
* This interface will be consumed by pilet developers so that their pilet can interact with the piral instance.
|
|
@@ -93,14 +106,14 @@ export interface PiletCoreApi {
|
|
|
93
106
|
* @param Component The component to be rendered.
|
|
94
107
|
* @param defaults Optionally, sets the default values for the expected data.
|
|
95
108
|
*/
|
|
96
|
-
registerExtension<TName>(name: TName extends string ? TName : string, Component:
|
|
109
|
+
registerExtension<TName>(name: TName extends string ? TName : string, Component: AnyExtensionComponent<TName>, defaults?: Partial<ExtensionParams<TName>>): RegistrationDisposer;
|
|
97
110
|
/**
|
|
98
111
|
* Unregisters a global extension component.
|
|
99
112
|
* Only previously registered extension components can be unregistered.
|
|
100
113
|
* @param name The name of the extension slot to unregister from.
|
|
101
114
|
* @param Component The registered extension component to unregister.
|
|
102
115
|
*/
|
|
103
|
-
unregisterExtension<TName>(name: TName extends string ? TName : string, Component:
|
|
116
|
+
unregisterExtension<TName>(name: TName extends string ? TName : string, Component: AnyExtensionComponent<TName>): void;
|
|
104
117
|
/**
|
|
105
118
|
* React component for displaying extensions for a given name.
|
|
106
119
|
* @param props The extension's rendering props.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import type { RouteComponentProps, SwitchProps } from 'react-router';
|
|
3
3
|
import type { FirstParametersOf, UnionOf } from './common';
|
|
4
4
|
import type { PiralCustomErrors, PiralCustomComponentConverters } from './custom';
|
|
@@ -178,11 +178,19 @@ export interface LayoutProps {
|
|
|
178
178
|
* The currently selected layout type.
|
|
179
179
|
*/
|
|
180
180
|
currentLayout: LayoutType;
|
|
181
|
+
/**
|
|
182
|
+
* The page's content.
|
|
183
|
+
*/
|
|
184
|
+
children: ReactNode;
|
|
181
185
|
}
|
|
182
186
|
/**
|
|
183
187
|
* The props of a Router component.
|
|
184
188
|
*/
|
|
185
189
|
export interface RouterProps {
|
|
190
|
+
/**
|
|
191
|
+
* The content to be rendered inside the router.
|
|
192
|
+
*/
|
|
193
|
+
children?: ReactNode;
|
|
186
194
|
}
|
|
187
195
|
/**
|
|
188
196
|
* The props of the RouteSwitch component.
|
package/lib/types/extension.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import type { PiralCustomExtensionSlotMap } from './custom';
|
|
3
|
+
import type { ExtensionRegistration } from './state';
|
|
3
4
|
/**
|
|
4
5
|
* The mapping of the existing (known) extension slots.
|
|
5
6
|
*/
|
|
@@ -18,9 +19,27 @@ export interface BaseExtensionSlotProps<TName, TParams> {
|
|
|
18
19
|
* for the specified extension.
|
|
19
20
|
*/
|
|
20
21
|
empty?(): ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Determines if the `render` function should be called in case no
|
|
24
|
+
* components are available for the specified extension.
|
|
25
|
+
*
|
|
26
|
+
* If true, `empty` will be called and returned from the slot.
|
|
27
|
+
* If false, `render` will be called with the result of calling `empty`.
|
|
28
|
+
* The result of calling `render` will then be returned from the slot.
|
|
29
|
+
*/
|
|
30
|
+
emptySkipsRender?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Defines the order of the components to render.
|
|
33
|
+
* May be more convient than using `render` w.r.t. ordering extensions
|
|
34
|
+
* by their supplied metadata.
|
|
35
|
+
* @param extensions The registered extensions.
|
|
36
|
+
* @returns The ordered extensions.
|
|
37
|
+
*/
|
|
38
|
+
order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
|
|
21
39
|
/**
|
|
22
40
|
* Defines how the provided nodes should be rendered.
|
|
23
41
|
* @param nodes The rendered extension nodes.
|
|
42
|
+
* @returns The rendered nodes, i.e., an ReactElement.
|
|
24
43
|
*/
|
|
25
44
|
render?(nodes: Array<ReactNode>): ReactElement<any, any> | null;
|
|
26
45
|
/**
|
package/lib/types/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./api"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./common"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./components"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./config"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./custom"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./data"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./extension"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./instance"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./layout"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./plugin"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./state"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
package/lib/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,mDAAyB;AACzB,uDAA6B;AAC7B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,sDAA4B;AAC5B,qDAA2B;AAC3B,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,kDAAwB"}
|
package/lib/types/instance.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import type { PiletApi, PiletApiCreator, LoadPiletsOptions, EventEmitter } from 'piral-base';
|
|
2
3
|
import type { GlobalStateContext } from './state';
|
|
3
4
|
import type { LayoutBreakpoints } from './layout';
|
|
4
|
-
import { PiralConfiguration } from './config';
|
|
5
|
+
import type { PiralConfiguration } from './config';
|
|
5
6
|
/**
|
|
6
7
|
* The props of the Piral context.
|
|
7
8
|
*/
|
|
@@ -10,6 +11,7 @@ export interface PiralContextProps {
|
|
|
10
11
|
* The specific Piral instance to be used.
|
|
11
12
|
*/
|
|
12
13
|
instance?: PiralInstance;
|
|
14
|
+
children?: ReactNode;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* The props of the Piral component.
|
package/lib/types/state.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType, ReactPortal } from 'react';
|
|
1
|
+
import type { ComponentType, ReactPortal, PropsWithChildren } from 'react';
|
|
2
2
|
import type { RouteComponentProps } from 'react-router';
|
|
3
3
|
import type { Atom } from '@dbeining/react-atom';
|
|
4
4
|
import type { LoadPiletsOptions } from 'piral-base';
|
|
@@ -16,26 +16,44 @@ declare module './components' {
|
|
|
16
16
|
readState: PiralActions['readState'];
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
export declare type WrappedComponent<TProps> = ComponentType<Without<TProps, keyof BaseComponentProps
|
|
19
|
+
export declare type WrappedComponent<TProps> = ComponentType<PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
|
|
20
20
|
/**
|
|
21
21
|
* The base type for pilet component registration in the global state context.
|
|
22
22
|
*/
|
|
23
23
|
export interface BaseRegistration {
|
|
24
|
+
/**
|
|
25
|
+
* The pilet registering the component.
|
|
26
|
+
*/
|
|
24
27
|
pilet: string;
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* The interface modeling the registration of a pilet page component.
|
|
28
31
|
*/
|
|
29
32
|
export interface PageRegistration extends BaseRegistration {
|
|
33
|
+
/**
|
|
34
|
+
* The registered page component.
|
|
35
|
+
*/
|
|
30
36
|
component: WrappedComponent<PageComponentProps>;
|
|
37
|
+
/**
|
|
38
|
+
* The page's associated metadata.
|
|
39
|
+
*/
|
|
31
40
|
meta: PiralPageMeta;
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
34
43
|
* The interface modeling the registration of a pilet extension component.
|
|
35
44
|
*/
|
|
36
45
|
export interface ExtensionRegistration extends BaseRegistration {
|
|
46
|
+
/**
|
|
47
|
+
* The wrapped registered extension component.
|
|
48
|
+
*/
|
|
37
49
|
component: WrappedComponent<ExtensionComponentProps<string>>;
|
|
50
|
+
/**
|
|
51
|
+
* The original extension component that has been registered.
|
|
52
|
+
*/
|
|
38
53
|
reference: any;
|
|
54
|
+
/**
|
|
55
|
+
* The default params (i.e., meta) of the extension.
|
|
56
|
+
*/
|
|
39
57
|
defaults: any;
|
|
40
58
|
}
|
|
41
59
|
/**
|
package/lib/utils/helpers.js
CHANGED
|
@@ -75,7 +75,7 @@ function withKey(obj, key, value) {
|
|
|
75
75
|
}
|
|
76
76
|
exports.withKey = withKey;
|
|
77
77
|
function withoutKey(obj, key) {
|
|
78
|
-
const _a = obj || {}, _b = key, _ = _a[_b], newObj =
|
|
78
|
+
const _a = obj || {}, _b = key, _ = _a[_b], newObj = tslib_1.__rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
79
79
|
return newObj;
|
|
80
80
|
}
|
|
81
81
|
exports.withoutKey = withoutKey;
|
package/lib/utils/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":";;;;AAAA,2BAA2B;AACd,QAAA,eAAe,GAAG,IAAI,CAAC;AAEpC,6CAA6C;AAChC,QAAA,IAAI,GAAG,EAAE,CAAC;AAEvB,gDAAgD;AACzC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAAhB,QAAA,IAAI,QAAY;AAE7B,SAAgB,WAAW,CAAI,KAAe,EAAE,IAAO;IACrD,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,IAAI,YAAI,CAAC,CAAC,CAAC;AACpC,CAAC;AAFD,kCAEC;AAED,SAAgB,UAAU,CAAI,KAAe,EAAE,IAAO;IACpD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,YAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAAI,KAAe,EAAE,QAAkB;IACjE,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,CAAC,KAAK,IAAI,YAAI,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,oCAEC;AAED,SAAgB,WAAW,CAAI,KAAe,EAAE,QAAkB;IAChE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,YAAI,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E,OAAO,CAAC,KAAK,IAAI,YAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,8BAEC;AAED,SAAgB,SAAS,CAA0B,GAAM,EAAE,GAAS,EAAE,KAAc;IAClF,OAAO,KAAK,KAAK,uBAAe,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACrF,CAAC;AAFD,8BAEC;AAED,SAAgB,OAAO,CAA0B,GAAM,EAAE,GAAS,EAAE,KAAc;IAChF,uCACK,GAAG,KACN,CAAC,GAAG,CAAC,EAAE,KAAK,IACZ;AACJ,CAAC;AALD,0BAKC;AAED,SAAgB,UAAU,CAA0B,GAAM,EAAE,GAAS;IACnE,MAAgC,KAAA,GAAG,IAAI,EAAE,EAAjC,KAAC,GAAI,EAAE,CAAC,SAAA,EAAK,MAAM,sBAArB,uCAAuB,CAAY,CAAC;IAC1C,OAAO,MAAa,CAAC;AACvB,CAAC;AAHD,gCAGC;AAED,SAAgB,YAAY,CAAC,OAAe;IAC1C,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC5B;IAAC,WAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAND,oCAMC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -5,14 +5,14 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
var piral_base_1 = require("piral-base");
|
|
6
6
|
Object.defineProperty(exports, "isfunc", { enumerable: true, get: function () { return piral_base_1.isfunc; } });
|
|
7
7
|
Object.defineProperty(exports, "requireModule", { enumerable: true, get: function () { return piral_base_1.requireModule; } });
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
tslib_1.__exportStar(require("./compare"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./data"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./extension"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./foreign"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./guid"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./helpers"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./media"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./react"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./state"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./storage"), exports);
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAmD;AAA1C,oGAAA,MAAM,OAAA;AAAE,2GAAA,aAAa,OAAA;AAE9B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAmD;AAA1C,oGAAA,MAAM,OAAA;AAAE,2GAAA,aAAa,OAAA;AAE9B,oDAA0B;AAC1B,iDAAuB;AACvB,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,oDAA0B;AAC1B,kDAAwB;AACxB,kDAAwB;AACxB,kDAAwB;AACxB,oDAA0B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-core",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4231",
|
|
4
4
|
"description": "The core library for creating a Piral instance.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -29,6 +29,19 @@
|
|
|
29
29
|
"module": "esm/index.js",
|
|
30
30
|
"main": "lib/index.js",
|
|
31
31
|
"typings": "lib/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"import": "./esm/index.js",
|
|
35
|
+
"require": "./lib/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./esm/*": {
|
|
38
|
+
"import": "./esm/*"
|
|
39
|
+
},
|
|
40
|
+
"./lib/*": {
|
|
41
|
+
"require": "./lib/*"
|
|
42
|
+
},
|
|
43
|
+
"./package.json": "./package.json"
|
|
44
|
+
},
|
|
32
45
|
"sideEffects": false,
|
|
33
46
|
"files": [
|
|
34
47
|
"esm",
|
|
@@ -60,8 +73,8 @@
|
|
|
60
73
|
},
|
|
61
74
|
"dependencies": {
|
|
62
75
|
"@dbeining/react-atom": "^4.0.0",
|
|
63
|
-
"piral-base": "0.15.0-alpha.
|
|
64
|
-
"piral-debug-utils": "0.15.0-alpha.
|
|
76
|
+
"piral-base": "0.15.0-alpha.4231",
|
|
77
|
+
"piral-debug-utils": "0.15.0-alpha.4231"
|
|
65
78
|
},
|
|
66
79
|
"peerDependencies": {
|
|
67
80
|
"react": ">=16.8.0",
|
|
@@ -71,12 +84,12 @@
|
|
|
71
84
|
},
|
|
72
85
|
"devDependencies": {
|
|
73
86
|
"@types/history": "^4.7.8",
|
|
74
|
-
"@types/react": "^
|
|
75
|
-
"@types/react-dom": "^
|
|
87
|
+
"@types/react": "^18.0.0",
|
|
88
|
+
"@types/react-dom": "^18.0.0",
|
|
76
89
|
"@types/react-router": "^5.1.8",
|
|
77
90
|
"@types/react-router-dom": "^5.1.6",
|
|
78
|
-
"react": "^
|
|
79
|
-
"react-dom": "^
|
|
91
|
+
"react": "^18.0.0",
|
|
92
|
+
"react-dom": "^18.0.0",
|
|
80
93
|
"react-router": "^5.2.0",
|
|
81
94
|
"react-router-dom": "^5.2.0"
|
|
82
95
|
},
|
|
@@ -91,5 +104,5 @@
|
|
|
91
104
|
"@libre/atom",
|
|
92
105
|
"@dbeining/react-atom"
|
|
93
106
|
],
|
|
94
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "4e7f158bd276d82c5bf2c19d47ccfb3604f38e38"
|
|
95
108
|
}
|
package/src/PiralContext.tsx
CHANGED
|
@@ -6,7 +6,11 @@ import { useGlobalState } from './hooks';
|
|
|
6
6
|
import { RootListener } from './RootListener';
|
|
7
7
|
import type { PiralContextProps } from './types';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
interface PiralProviderProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const PiralProvider: React.FC<PiralProviderProps> = ({ children }) => {
|
|
10
14
|
const Provider = useGlobalState((m) => m.provider || React.Fragment);
|
|
11
15
|
return <Provider>{children}</Provider>;
|
|
12
16
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import { act } from 'react-dom/test-utils';
|
|
4
4
|
import { RootListener } from './RootListener';
|
|
5
5
|
|
|
@@ -15,7 +15,8 @@ describe('RootListener Component', () => {
|
|
|
15
15
|
const removed = jest.fn();
|
|
16
16
|
document.body.appendChild(element);
|
|
17
17
|
const container = document.body.appendChild(document.createElement('div'));
|
|
18
|
-
|
|
18
|
+
const root = createRoot(container);
|
|
19
|
+
root.render(<RootListener />);
|
|
19
20
|
document.body.removeEventListener = removed;
|
|
20
21
|
await act(() => {
|
|
21
22
|
const event = new CustomEvent('render-html', {
|
|
@@ -23,7 +24,7 @@ describe('RootListener Component', () => {
|
|
|
23
24
|
detail: {
|
|
24
25
|
target: element,
|
|
25
26
|
props: {},
|
|
26
|
-
}
|
|
27
|
+
},
|
|
27
28
|
});
|
|
28
29
|
element.dispatchEvent(event);
|
|
29
30
|
return Promise.resolve();
|
|
@@ -35,10 +36,11 @@ describe('RootListener Component', () => {
|
|
|
35
36
|
it('removes the RootListener successfully', async () => {
|
|
36
37
|
const container = document.body.appendChild(document.createElement('div'));
|
|
37
38
|
const removed = jest.fn();
|
|
38
|
-
|
|
39
|
+
const root = createRoot(container);
|
|
40
|
+
root.render(<RootListener />);
|
|
39
41
|
document.body.removeEventListener = removed;
|
|
40
42
|
await act(() => Promise.resolve());
|
|
41
|
-
|
|
43
|
+
root.unmount();
|
|
42
44
|
await act(() => Promise.resolve());
|
|
43
45
|
expect(removed).toHaveBeenCalled();
|
|
44
46
|
});
|
package/src/actions/app.test.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mount } from 'enzyme';
|
|
1
2
|
import { createElement } from 'react';
|
|
2
3
|
import { Atom, deref } from '@dbeining/react-atom';
|
|
3
4
|
import { createListener, Pilet } from 'piral-base';
|
|
@@ -11,7 +12,6 @@ import {
|
|
|
11
12
|
setRoute,
|
|
12
13
|
} from './app';
|
|
13
14
|
import { createActions } from '../state';
|
|
14
|
-
import { mount } from 'enzyme';
|
|
15
15
|
import { RootListener } from '../RootListener';
|
|
16
16
|
|
|
17
17
|
const pilet: Pilet = {
|
|
@@ -11,6 +11,10 @@ export interface ErrorBoundaryProps {
|
|
|
11
11
|
* The associated pilet api for the metadata.
|
|
12
12
|
*/
|
|
13
13
|
piral: PiletApi;
|
|
14
|
+
/**
|
|
15
|
+
* The content to render (i.e., where to apply the boundary to).
|
|
16
|
+
*/
|
|
17
|
+
children: React.ReactNode;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export interface ErrorBoundaryState {
|