piral-core 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/Piral.d.ts +2 -2
- package/esm/Piral.js +14 -12
- package/esm/Piral.js.map +1 -1
- package/esm/PiralContext.d.ts +21 -0
- package/esm/PiralContext.js +34 -0
- package/esm/PiralContext.js.map +1 -0
- package/esm/actions/app.d.ts +1 -2
- package/esm/actions/app.js +0 -3
- package/esm/actions/app.js.map +1 -1
- package/esm/actions/state.js +5 -1
- package/esm/actions/state.js.map +1 -1
- package/esm/components/ErrorBoundary.d.ts +4 -0
- package/esm/components/ErrorBoundary.js +3 -3
- package/esm/components/ErrorBoundary.js.map +1 -1
- package/esm/components/PiralGlobals.d.ts +6 -0
- package/esm/components/PiralGlobals.js +13 -0
- package/esm/components/PiralGlobals.js.map +1 -0
- package/esm/components/PiralSuspense.d.ts +5 -0
- package/esm/components/PiralSuspense.js +8 -0
- package/esm/components/PiralSuspense.js.map +1 -0
- package/esm/components/PiralView.d.ts +10 -1
- package/esm/components/PiralView.js +12 -24
- package/esm/components/PiralView.js.map +1 -1
- package/esm/components/ResponsiveLayout.d.ts +9 -1
- package/esm/components/ResponsiveLayout.js +5 -12
- package/esm/components/ResponsiveLayout.js.map +1 -1
- package/esm/components/components.d.ts +13 -6
- package/esm/components/components.js +13 -6
- package/esm/components/components.js.map +1 -1
- package/esm/components/index.d.ts +2 -12
- package/esm/components/index.js +2 -12
- package/esm/components/index.js.map +1 -1
- package/esm/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
- package/esm/{components → defaults}/DefaultErrorInfo.js +1 -2
- package/esm/defaults/DefaultErrorInfo.js.map +1 -0
- package/esm/{components → defaults}/DefaultLayout.d.ts +0 -0
- package/esm/{components → defaults}/DefaultLayout.js +0 -0
- package/esm/defaults/DefaultLayout.js.map +1 -0
- package/esm/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
- package/esm/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +1 -1
- package/esm/defaults/DefaultLoadingIndicator.js.map +1 -0
- package/esm/{components → defaults}/DefaultRouteSwitch.d.ts +0 -0
- package/esm/{components → defaults}/DefaultRouteSwitch.js +0 -0
- package/esm/defaults/DefaultRouteSwitch.js.map +1 -0
- package/esm/defaults/DefaultRouter.d.ts +3 -0
- package/esm/{components → defaults}/DefaultRouter.js +0 -0
- package/esm/defaults/DefaultRouter.js.map +1 -0
- package/esm/defaults/index.d.ts +5 -0
- package/esm/defaults/index.js +6 -0
- package/esm/defaults/index.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/{components → setters}/SetComponent.d.ts +0 -0
- package/esm/{components → setters}/SetComponent.js +0 -0
- package/esm/setters/SetComponent.js.map +1 -0
- package/esm/{components → setters}/SetError.d.ts +0 -0
- package/esm/{components → setters}/SetError.js +0 -0
- package/esm/setters/SetError.js.map +1 -0
- package/esm/{components → setters}/SetErrors.d.ts +0 -0
- package/esm/{components → setters}/SetErrors.js +0 -0
- package/esm/setters/SetErrors.js.map +1 -0
- package/esm/{components → setters}/SetLayout.d.ts +0 -0
- package/esm/{components → setters}/SetLayout.js +0 -0
- package/esm/setters/SetLayout.js.map +1 -0
- package/esm/{components → setters}/SetProvider.d.ts +0 -0
- package/esm/{components → setters}/SetProvider.js +0 -0
- package/esm/setters/SetProvider.js.map +1 -0
- package/esm/{components → setters}/SetRedirect.d.ts +0 -0
- package/esm/{components → setters}/SetRedirect.js +0 -0
- package/esm/setters/SetRedirect.js.map +1 -0
- package/esm/{components → setters}/SetRoute.d.ts +0 -0
- package/esm/{components → setters}/SetRoute.js +0 -0
- package/esm/setters/SetRoute.js.map +1 -0
- package/esm/setters/index.d.ts +7 -0
- package/esm/setters/index.js +8 -0
- package/esm/setters/index.js.map +1 -0
- package/esm/state/createGlobalState.js +1 -2
- package/esm/state/createGlobalState.js.map +1 -1
- package/esm/state/withApi.js.map +1 -1
- package/esm/types/components.d.ts +9 -1
- package/esm/types/instance.d.ts +10 -3
- package/esm/types/state.d.ts +2 -12
- package/esm/utils/compare.d.ts +1 -1
- package/esm/utils/compare.js +20 -3
- package/esm/utils/compare.js.map +1 -1
- package/esm/utils/media.js +1 -1
- package/esm/utils/media.js.map +1 -1
- package/lib/Piral.d.ts +2 -2
- package/lib/Piral.js +13 -11
- package/lib/Piral.js.map +1 -1
- package/lib/PiralContext.d.ts +21 -0
- package/lib/PiralContext.js +38 -0
- package/lib/PiralContext.js.map +1 -0
- package/lib/actions/app.d.ts +1 -2
- package/lib/actions/app.js +1 -5
- package/lib/actions/app.js.map +1 -1
- package/lib/actions/index.js +6 -6
- package/lib/actions/index.js.map +1 -1
- package/lib/actions/state.js +5 -1
- package/lib/actions/state.js.map +1 -1
- package/lib/components/ErrorBoundary.d.ts +4 -0
- package/lib/components/ErrorBoundary.js +3 -3
- package/lib/components/ErrorBoundary.js.map +1 -1
- package/lib/components/PiralGlobals.d.ts +6 -0
- package/lib/components/PiralGlobals.js +17 -0
- package/lib/components/PiralGlobals.js.map +1 -0
- package/lib/components/PiralRoutes.js +1 -1
- package/lib/components/PiralRoutes.js.map +1 -1
- package/lib/components/PiralSuspense.d.ts +5 -0
- package/lib/components/PiralSuspense.js +12 -0
- package/lib/components/PiralSuspense.js.map +1 -0
- package/lib/components/PiralView.d.ts +10 -1
- package/lib/components/PiralView.js +11 -23
- package/lib/components/PiralView.js.map +1 -1
- package/lib/components/ResponsiveLayout.d.ts +9 -1
- package/lib/components/ResponsiveLayout.js +3 -10
- package/lib/components/ResponsiveLayout.js.map +1 -1
- package/lib/components/components.d.ts +13 -6
- package/lib/components/components.js +14 -7
- package/lib/components/components.js.map +1 -1
- package/lib/components/index.d.ts +2 -12
- package/lib/components/index.js +12 -22
- package/lib/components/index.js.map +1 -1
- package/lib/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
- package/lib/{components → defaults}/DefaultErrorInfo.js +2 -3
- package/lib/defaults/DefaultErrorInfo.js.map +1 -0
- package/lib/{components → defaults}/DefaultLayout.d.ts +0 -0
- package/lib/{components → defaults}/DefaultLayout.js +0 -0
- package/lib/defaults/DefaultLayout.js.map +1 -0
- package/lib/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
- package/lib/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +1 -1
- package/lib/defaults/DefaultLoadingIndicator.js.map +1 -0
- package/lib/{components → defaults}/DefaultRouteSwitch.d.ts +0 -0
- package/lib/{components → defaults}/DefaultRouteSwitch.js +1 -1
- package/lib/defaults/DefaultRouteSwitch.js.map +1 -0
- package/lib/defaults/DefaultRouter.d.ts +3 -0
- package/lib/{components → defaults}/DefaultRouter.js +0 -0
- package/lib/defaults/DefaultRouter.js.map +1 -0
- package/lib/defaults/index.d.ts +5 -0
- package/lib/defaults/index.js +9 -0
- package/lib/defaults/index.js.map +1 -0
- 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.d.ts +1 -0
- package/lib/index.js +9 -8
- package/lib/index.js.map +1 -1
- package/lib/modules/index.js +3 -3
- package/lib/modules/index.js.map +1 -1
- package/lib/{components → setters}/SetComponent.d.ts +0 -0
- package/lib/{components → setters}/SetComponent.js +0 -0
- package/lib/setters/SetComponent.js.map +1 -0
- package/lib/{components → setters}/SetError.d.ts +0 -0
- package/lib/{components → setters}/SetError.js +0 -0
- package/lib/setters/SetError.js.map +1 -0
- package/lib/{components → setters}/SetErrors.d.ts +0 -0
- package/lib/{components → setters}/SetErrors.js +0 -0
- package/lib/setters/SetErrors.js.map +1 -0
- package/lib/{components → setters}/SetLayout.d.ts +0 -0
- package/lib/{components → setters}/SetLayout.js +0 -0
- package/lib/setters/SetLayout.js.map +1 -0
- package/lib/{components → setters}/SetProvider.d.ts +0 -0
- package/lib/{components → setters}/SetProvider.js +0 -0
- package/lib/setters/SetProvider.js.map +1 -0
- package/lib/{components → setters}/SetRedirect.d.ts +0 -0
- package/lib/{components → setters}/SetRedirect.js +0 -0
- package/lib/setters/SetRedirect.js.map +1 -0
- package/lib/{components → setters}/SetRoute.d.ts +0 -0
- package/lib/{components → setters}/SetRoute.js +0 -0
- package/lib/setters/SetRoute.js.map +1 -0
- package/lib/setters/index.d.ts +7 -0
- package/lib/setters/index.js +11 -0
- package/lib/setters/index.js.map +1 -0
- package/lib/state/createGlobalState.js +6 -7
- package/lib/state/createGlobalState.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/components.d.ts +9 -1
- package/lib/types/index.js +12 -12
- package/lib/types/index.js.map +1 -1
- package/lib/types/instance.d.ts +10 -3
- package/lib/types/state.d.ts +2 -12
- package/lib/utils/compare.d.ts +1 -1
- package/lib/utils/compare.js +22 -5
- package/lib/utils/compare.js.map +1 -1
- 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/lib/utils/media.js +1 -1
- package/lib/utils/media.js.map +1 -1
- package/package.json +20 -8
- package/src/Piral.test.tsx +3 -3
- package/src/Piral.tsx +18 -14
- package/src/PiralContext.tsx +43 -0
- package/src/actions/app.test.ts +0 -18
- package/src/actions/app.ts +0 -8
- package/src/actions/state.ts +6 -1
- package/src/components/ErrorBoundary.tsx +7 -3
- package/src/components/PiralGlobals.tsx +16 -0
- package/src/components/PiralRoutes.test.tsx +1 -1
- package/src/components/PiralSuspense.tsx +19 -0
- package/src/components/PiralView-server.test.tsx +1 -0
- package/src/components/PiralView.test.tsx +1 -0
- package/src/components/PiralView.tsx +28 -47
- package/src/components/ResponsiveLayout.test.tsx +14 -43
- package/src/components/ResponsiveLayout.tsx +18 -15
- package/src/components/components.tsx +13 -6
- package/src/components/index.ts +2 -12
- package/src/{components → defaults}/DefaultErrorInfo.test.tsx +0 -0
- package/src/{components → defaults}/DefaultErrorInfo.tsx +1 -2
- package/src/{components → defaults}/DefaultLayout.test.tsx +0 -0
- package/src/{components → defaults}/DefaultLayout.tsx +1 -1
- package/src/{components/DefaultLoader.test.tsx → defaults/DefaultLoadingIndicator.test.tsx} +2 -2
- package/src/{components/DefaultLoader.tsx → defaults/DefaultLoadingIndicator.tsx} +0 -0
- package/src/{components → defaults}/DefaultRouteSwitch.tsx +0 -0
- package/src/{components → defaults}/DefaultRouter.tsx +2 -1
- package/src/defaults/index.ts +5 -0
- package/src/index.tsx +1 -0
- package/src/{components → setters}/SetComponent.test.tsx +0 -0
- package/src/{components → setters}/SetComponent.tsx +0 -0
- package/src/{components → setters}/SetError.test.tsx +0 -0
- package/src/{components → setters}/SetError.tsx +0 -0
- package/src/{components → setters}/SetErrors.test.tsx +0 -0
- package/src/{components → setters}/SetErrors.tsx +0 -0
- package/src/{components → setters}/SetLayout.test.tsx +0 -0
- package/src/{components → setters}/SetLayout.tsx +0 -0
- package/src/{components → setters}/SetProvider.test.tsx +0 -0
- package/src/{components → setters}/SetProvider.tsx +0 -0
- package/src/{components → setters}/SetRedirect.test.tsx +0 -0
- package/src/{components → setters}/SetRedirect.tsx +0 -0
- package/src/{components → setters}/SetRoute.test.tsx +0 -0
- package/src/{components → setters}/SetRoute.tsx +0 -0
- package/src/setters/index.ts +7 -0
- package/src/state/createGlobalState.test.ts +1 -10
- package/src/state/createGlobalState.ts +2 -3
- package/src/state/withApi.tsx +2 -2
- package/src/types/components.ts +11 -2
- package/src/types/instance.ts +11 -3
- package/src/types/state.ts +2 -12
- package/src/utils/compare.test.ts +15 -15
- package/src/utils/compare.ts +23 -3
- package/src/utils/foreign.test.ts +1 -1
- package/src/utils/media.ts +1 -1
- package/esm/components/DefaultErrorInfo.js.map +0 -1
- package/esm/components/DefaultLayout.js.map +0 -1
- package/esm/components/DefaultLoader.js.map +0 -1
- package/esm/components/DefaultRouteSwitch.js.map +0 -1
- package/esm/components/DefaultRouter.d.ts +0 -2
- package/esm/components/DefaultRouter.js.map +0 -1
- package/esm/components/SetComponent.js.map +0 -1
- package/esm/components/SetError.js.map +0 -1
- package/esm/components/SetErrors.js.map +0 -1
- package/esm/components/SetLayout.js.map +0 -1
- package/esm/components/SetProvider.js.map +0 -1
- package/esm/components/SetRedirect.js.map +0 -1
- package/esm/components/SetRoute.js.map +0 -1
- package/lib/components/DefaultErrorInfo.js.map +0 -1
- package/lib/components/DefaultLayout.js.map +0 -1
- package/lib/components/DefaultLoader.js.map +0 -1
- package/lib/components/DefaultRouteSwitch.js.map +0 -1
- package/lib/components/DefaultRouter.d.ts +0 -2
- package/lib/components/DefaultRouter.js.map +0 -1
- package/lib/components/SetComponent.js.map +0 -1
- package/lib/components/SetError.js.map +0 -1
- package/lib/components/SetErrors.js.map +0 -1
- package/lib/components/SetLayout.js.map +0 -1
- package/lib/components/SetProvider.js.map +0 -1
- package/lib/components/SetRedirect.js.map +0 -1
- package/lib/components/SetRoute.js.map +0 -1
package/esm/Piral.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { PiralProps } from './types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents the Piral app shell frame. Use this component together
|
|
5
5
|
* with an existing instance to render the app shell.
|
|
6
|
-
* Includes layout and routing handling.
|
|
7
|
-
* to the generated views.
|
|
6
|
+
* Includes layout and routing handling. Connects the Piral context
|
|
7
|
+
* and the React router to the generated views.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
```jsx
|
package/esm/Piral.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StaticRouter } from 'react-router';
|
|
3
3
|
import { createInstance } from './createInstance';
|
|
4
|
-
import { PiralView,
|
|
5
|
-
import {
|
|
4
|
+
import { PiralView, RegisteredRouter } from './components';
|
|
5
|
+
import { useGlobalState } from './hooks';
|
|
6
|
+
import { PiralContext } from './PiralContext';
|
|
7
|
+
const FallbackRouter = (props) => {
|
|
8
|
+
const publicPath = useGlobalState((s) => s.app.publicPath);
|
|
9
|
+
return React.createElement(StaticRouter, Object.assign({ location: "/" }, props, { basename: publicPath }));
|
|
10
|
+
};
|
|
11
|
+
const Router = typeof window === 'undefined' ? FallbackRouter : RegisteredRouter;
|
|
6
12
|
/**
|
|
7
13
|
* Represents the Piral app shell frame. Use this component together
|
|
8
14
|
* with an existing instance to render the app shell.
|
|
9
|
-
* Includes layout and routing handling.
|
|
10
|
-
* to the generated views.
|
|
15
|
+
* Includes layout and routing handling. Connects the Piral context
|
|
16
|
+
* and the React router to the generated views.
|
|
11
17
|
*
|
|
12
18
|
* @example
|
|
13
19
|
```jsx
|
|
@@ -18,12 +24,8 @@ const app = (
|
|
|
18
24
|
);
|
|
19
25
|
```
|
|
20
26
|
*/
|
|
21
|
-
export const Piral = ({ instance = createInstance(), breakpoints, children }) => (React.createElement(
|
|
22
|
-
React.createElement(
|
|
23
|
-
|
|
24
|
-
React.createElement(RootListener, null),
|
|
25
|
-
React.createElement(PiralView, null,
|
|
26
|
-
React.createElement(PortalRenderer, { id: "root" }),
|
|
27
|
-
children)));
|
|
27
|
+
export const Piral = ({ instance = createInstance(), breakpoints, children }) => (React.createElement(PiralContext, { instance: instance },
|
|
28
|
+
React.createElement(Router, null,
|
|
29
|
+
React.createElement(PiralView, { breakpoints: breakpoints }, children))));
|
|
28
30
|
Piral.displayName = 'Piral';
|
|
29
31
|
//# sourceMappingURL=Piral.js.map
|
package/esm/Piral.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,cAAc,GAAa,CAAC,KAAK,EAAE,EAAE;IACzC,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,oBAAC,YAAY,kBAAC,QAAQ,EAAC,GAAG,IAAK,KAAK,IAAE,QAAQ,EAAE,UAAU,IAAI,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAyB,CAAC,EAAE,QAAQ,GAAG,cAAc,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACrG,oBAAC,YAAY,IAAC,QAAQ,EAAE,QAAQ;IAC9B,oBAAC,MAAM;QACL,oBAAC,SAAS,IAAC,WAAW,EAAE,WAAW,IAAG,QAAQ,CAAa,CACpD,CACI,CAChB,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PiralContextProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the Piral app shell frame. Use this component together
|
|
5
|
+
* with an existing instance to render components from micro frontends
|
|
6
|
+
* in your app.
|
|
7
|
+
* Wires the state container together with the global providers.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
```jsx
|
|
11
|
+
const app = (
|
|
12
|
+
<MyRouter>
|
|
13
|
+
<PiralContext instance={yourPiralInstance}>
|
|
14
|
+
<PiralGlobals />
|
|
15
|
+
<MyAppContent />
|
|
16
|
+
</PiralContext>
|
|
17
|
+
</MyRouter>
|
|
18
|
+
);
|
|
19
|
+
```
|
|
20
|
+
*/
|
|
21
|
+
export declare const PiralContext: React.FC<PiralContextProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StateContext } from './state';
|
|
3
|
+
import { createInstance } from './createInstance';
|
|
4
|
+
import { Mediator } from './components';
|
|
5
|
+
import { useGlobalState } from './hooks';
|
|
6
|
+
import { RootListener } from './RootListener';
|
|
7
|
+
const PiralProvider = ({ children }) => {
|
|
8
|
+
const Provider = useGlobalState((m) => m.provider || React.Fragment);
|
|
9
|
+
return React.createElement(Provider, null, children);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Represents the Piral app shell frame. Use this component together
|
|
13
|
+
* with an existing instance to render components from micro frontends
|
|
14
|
+
* in your app.
|
|
15
|
+
* Wires the state container together with the global providers.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
```jsx
|
|
19
|
+
const app = (
|
|
20
|
+
<MyRouter>
|
|
21
|
+
<PiralContext instance={yourPiralInstance}>
|
|
22
|
+
<PiralGlobals />
|
|
23
|
+
<MyAppContent />
|
|
24
|
+
</PiralContext>
|
|
25
|
+
</MyRouter>
|
|
26
|
+
);
|
|
27
|
+
```
|
|
28
|
+
*/
|
|
29
|
+
export const PiralContext = ({ instance = createInstance(), children }) => (React.createElement(StateContext.Provider, { value: instance.context },
|
|
30
|
+
React.createElement(Mediator, { options: instance.options, key: instance.id }),
|
|
31
|
+
React.createElement(RootListener, null),
|
|
32
|
+
React.createElement(PiralProvider, null, children)));
|
|
33
|
+
PiralContext.displayName = 'PiralContext';
|
|
34
|
+
//# sourceMappingURL=PiralContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralContext.js","sourceRoot":"","sources":["../src/PiralContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrE,OAAO,oBAAC,QAAQ,QAAE,QAAQ,CAAY,CAAC;AACzC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,QAAQ,GAAG,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACtG,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,OAAO;IAC5C,oBAAC,QAAQ,IAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAI;IACzD,oBAAC,YAAY,OAAG;IAChB,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACnB,CACzB,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
package/esm/actions/app.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { RouteComponentProps } from 'react-router';
|
|
3
|
-
import {
|
|
4
|
-
export declare function changeLayout(ctx: GlobalStateContext, current: LayoutType): void;
|
|
3
|
+
import { ComponentsState, ErrorComponentsState, GlobalStateContext, Pilet, PiletEntry } from '../types';
|
|
5
4
|
export declare function initialize(ctx: GlobalStateContext, loading: boolean, error: Error | undefined, modules: Array<Pilet>): void;
|
|
6
5
|
export declare function addPilet(ctx: GlobalStateContext, meta: PiletEntry): Promise<void>;
|
|
7
6
|
export declare function removePilet(ctx: GlobalStateContext, name: string): Promise<void>;
|
package/esm/actions/app.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { runPilet } from 'piral-base';
|
|
2
2
|
import { withKey, replaceOrAddItem, removeNested, withProvider, withRoute, noop } from '../utils';
|
|
3
|
-
export function changeLayout(ctx, current) {
|
|
4
|
-
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: withKey(state.app, 'layout', current) })));
|
|
5
|
-
}
|
|
6
3
|
export function initialize(ctx, loading, error, modules) {
|
|
7
4
|
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: Object.assign(Object.assign({}, state.app), { error,
|
|
8
5
|
loading }), modules })));
|
package/esm/actions/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAA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AAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
package/esm/actions/state.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { swap, deref } from '@dbeining/react-atom';
|
|
2
|
+
import { isSame } from '../utils';
|
|
3
|
+
function onlyChangedState(oldState, newState) {
|
|
4
|
+
return isSame(oldState, newState) ? oldState : newState;
|
|
5
|
+
}
|
|
2
6
|
export function dispatch(ctx, update) {
|
|
3
|
-
swap(ctx.state, update);
|
|
7
|
+
swap(ctx.state, oldState => onlyChangedState(oldState, update(oldState)));
|
|
4
8
|
}
|
|
5
9
|
export function readState(ctx, read) {
|
|
6
10
|
const state = deref(ctx.state);
|
package/esm/actions/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,SAAS,gBAAgB,CAAC,QAAqB,EAAE,QAAqB;IACpE,OAAO,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,GAAuB,EAAE,IAA+B;IACnF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -9,6 +9,10 @@ export interface ErrorBoundaryProps {
|
|
|
9
9
|
* The associated pilet api for the metadata.
|
|
10
10
|
*/
|
|
11
11
|
piral: PiletApi;
|
|
12
|
+
/**
|
|
13
|
+
* The content to render (i.e., where to apply the boundary to).
|
|
14
|
+
*/
|
|
15
|
+
children: React.ReactNode;
|
|
12
16
|
}
|
|
13
17
|
export interface ErrorBoundaryState {
|
|
14
18
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { RegisteredErrorInfo, RegisteredLoadingIndicator } from './components';
|
|
4
4
|
/**
|
|
5
5
|
* The component for catching errors and displaying error information.
|
|
6
6
|
*/
|
|
@@ -25,9 +25,9 @@ export class ErrorBoundary extends React.Component {
|
|
|
25
25
|
const rest = renderProps;
|
|
26
26
|
if (error) {
|
|
27
27
|
const pilet = piral.meta.name;
|
|
28
|
-
return React.createElement(
|
|
28
|
+
return React.createElement(RegisteredErrorInfo, Object.assign({ type: errorType, error: error, pilet: pilet }, rest));
|
|
29
29
|
}
|
|
30
|
-
return React.createElement(React.Suspense, { fallback: React.createElement(
|
|
30
|
+
return React.createElement(React.Suspense, { fallback: React.createElement(RegisteredLoadingIndicator, null) }, children);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","s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React from 'react';
|
|
2
|
+
import { PortalRenderer } from './PortalRenderer';
|
|
3
|
+
import { RegisteredDebug } from './components';
|
|
4
|
+
/**
|
|
5
|
+
* Integrates the global portal renderer and the debug utilities
|
|
6
|
+
* (if registered).
|
|
7
|
+
*/
|
|
8
|
+
export const PiralGlobals = () => {
|
|
9
|
+
return (React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement(PortalRenderer, { id: "root" }),
|
|
11
|
+
React.createElement(RegisteredDebug, null)));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=PiralGlobals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralGlobals.js","sourceRoot":"","sources":["../../src/components/PiralGlobals.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAa,GAAG,EAAE;IACzC,OAAO,CACL;QACE,oBAAC,cAAc,IAAC,EAAE,EAAC,MAAM,GAAG;QAC5B,oBAAC,eAAe,OAAG,CAClB,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RegisteredErrorInfo, RegisteredLoadingIndicator } from './components';
|
|
3
|
+
import { useGlobalState } from '../hooks';
|
|
4
|
+
export const PiralSuspense = ({ children }) => {
|
|
5
|
+
const { error, loading } = useGlobalState((m) => m.app);
|
|
6
|
+
return error ? (React.createElement(RegisteredErrorInfo, { type: "loading", error: error })) : loading ? (React.createElement(RegisteredLoadingIndicator, null)) : (React.createElement(React.Fragment, null, children));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=PiralSuspense.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralSuspense.js","sourceRoot":"","sources":["../../src/components/PiralSuspense.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM1C,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1E,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAExD,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,oBAAC,mBAAmB,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,GAAI,CACrD,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,oBAAC,0BAA0B,OAAG,CAC/B,CAAC,CAAC,CAAC,CACF,0CAAG,QAAQ,CAAI,CAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { LayoutBreakpoints } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* The props for the PiralView component.
|
|
4
5
|
*/
|
|
5
6
|
export interface PiralViewProps {
|
|
7
|
+
/**
|
|
8
|
+
* The custom breakpoints for the different layout modi.
|
|
9
|
+
*/
|
|
10
|
+
breakpoints?: LayoutBreakpoints;
|
|
11
|
+
/**
|
|
12
|
+
* The extra content.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
6
15
|
}
|
|
7
16
|
/**
|
|
8
17
|
* The component responsible for the generic view of the application.
|
|
9
|
-
* This includes the
|
|
18
|
+
* This includes the used the current content and some convenience.
|
|
10
19
|
*/
|
|
11
20
|
export declare const PiralView: React.FC<PiralViewProps>;
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PiralGlobals } from './PiralGlobals';
|
|
3
3
|
import { PiralRoutes } from './PiralRoutes';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const { error, loading, layout } = useGlobalState((m) => m.app);
|
|
9
|
-
return error ? (React.createElement(PiralError, { type: "loading", error: error })) : loading ? (React.createElement(PiralLoadingIndicator, null)) : (React.createElement(PiralLayout, { currentLayout: layout },
|
|
10
|
-
React.createElement(PiralRoutes, { NotFound: NotFound, RouteSwitch: PiralRouteSwitch })));
|
|
11
|
-
};
|
|
12
|
-
const FallbackRouter = (props) => {
|
|
13
|
-
const publicPath = useGlobalState((s) => s.app.publicPath);
|
|
14
|
-
return React.createElement(StaticRouter, Object.assign({ location: "/" }, props, { basename: publicPath }));
|
|
15
|
-
};
|
|
16
|
-
const Router = typeof window === 'undefined' ? FallbackRouter : PiralRouter;
|
|
17
|
-
const PiralProvider = ({ children }) => {
|
|
18
|
-
const provider = useGlobalState((m) => m.provider) || React.Fragment;
|
|
19
|
-
return React.createElement(provider, undefined, children);
|
|
20
|
-
};
|
|
4
|
+
import { PiralSuspense } from './PiralSuspense';
|
|
5
|
+
import { ResponsiveLayout } from './ResponsiveLayout';
|
|
6
|
+
import { RegisteredErrorInfo, RegisteredRouteSwitch, RegisteredLayout } from './components';
|
|
7
|
+
const NotFound = (props) => React.createElement(RegisteredErrorInfo, Object.assign({ type: "not_found" }, props));
|
|
21
8
|
/**
|
|
22
9
|
* The component responsible for the generic view of the application.
|
|
23
|
-
* This includes the
|
|
10
|
+
* This includes the used the current content and some convenience.
|
|
24
11
|
*/
|
|
25
|
-
export const PiralView = ({ children }) => (React.createElement(
|
|
26
|
-
React.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
export const PiralView = ({ breakpoints, children }) => (React.createElement(React.Fragment, null,
|
|
13
|
+
React.createElement(PiralGlobals, null),
|
|
14
|
+
React.createElement(PiralSuspense, null,
|
|
15
|
+
React.createElement(ResponsiveLayout, { breakpoints: breakpoints, Layout: RegisteredLayout },
|
|
16
|
+
React.createElement(PiralRoutes, { NotFound: NotFound, RouteSwitch: RegisteredRouteSwitch }))),
|
|
17
|
+
children));
|
|
30
18
|
PiralView.displayName = 'PiralView';
|
|
31
19
|
//# sourceMappingURL=PiralView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PiralView.js","sourceRoot":"","sources":["../../src/components/PiralView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PiralView.js","sourceRoot":"","sources":["../../src/components/PiralView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5F,MAAM,QAAQ,GAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,mBAAmB,kBAAC,IAAI,EAAC,WAAW,IAAK,KAAK,EAAI,CAAC;AAgB/G;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAChF;IACE,oBAAC,YAAY,OAAG;IAChB,oBAAC,aAAa;QACZ,oBAAC,gBAAgB,IAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB;YAClE,oBAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,GAAI,CACtD,CACL;IACf,QAAQ,CACR,CACJ,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { LayoutBreakpoints } from '../types';
|
|
2
|
+
import { LayoutBreakpoints, LayoutProps } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* The props for the ResponsiveLayout component.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,14 @@ export interface ResponsiveLayoutProps {
|
|
|
8
8
|
* The individual breakpoints to be used for the different layouts.
|
|
9
9
|
*/
|
|
10
10
|
breakpoints?: LayoutBreakpoints;
|
|
11
|
+
/**
|
|
12
|
+
* The actual layout component to render to transport.
|
|
13
|
+
*/
|
|
14
|
+
Layout: React.ComponentType<LayoutProps>;
|
|
15
|
+
/**
|
|
16
|
+
* The content to display.
|
|
17
|
+
*/
|
|
18
|
+
children: React.ReactNode;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
21
|
* The component capable of identifying and switching the currently used layout.
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useMedia
|
|
3
|
-
import { defaultLayouts,
|
|
2
|
+
import { useMedia } from '../hooks';
|
|
3
|
+
import { defaultLayouts, defaultBreakpoints } from '../utils';
|
|
4
4
|
/**
|
|
5
5
|
* The component capable of identifying and switching the currently used layout.
|
|
6
6
|
*/
|
|
7
|
-
export const ResponsiveLayout = ({ breakpoints = defaultBreakpoints, children }) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const selected = useMedia(breakpoints, defaultLayouts, current);
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
if (selected !== current) {
|
|
13
|
-
changeLayout(selected);
|
|
14
|
-
}
|
|
15
|
-
}, [selected]);
|
|
16
|
-
return defaultRender(children);
|
|
7
|
+
export const ResponsiveLayout = ({ breakpoints = defaultBreakpoints, Layout, children, }) => {
|
|
8
|
+
const selected = useMedia(breakpoints, defaultLayouts, 'desktop');
|
|
9
|
+
return React.createElement(Layout, { currentLayout: selected }, children);
|
|
17
10
|
};
|
|
18
11
|
ResponsiveLayout.displayName = 'ResponsiveLayout';
|
|
19
12
|
//# sourceMappingURL=ResponsiveLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAqB9D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAChE,WAAW,GAAG,kBAAkB,EAChC,MAAM,EACN,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAClE,OAAO,oBAAC,MAAM,IAAC,aAAa,EAAE,QAAQ,IAAG,QAAQ,CAAU,CAAC;AAC9D,CAAC,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentsState } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a registered layout component by its name.
|
|
5
|
+
* This will always return a valid component. If nothing is found
|
|
6
|
+
* then the returned component will just return null.
|
|
7
|
+
* @param name The name of the registered layout component.
|
|
8
|
+
* @returns The registered layout component or an empty stub component.
|
|
9
|
+
*/
|
|
3
10
|
export declare function getPiralComponent<TKey extends keyof ComponentsState>(name: TKey): ComponentsState[TKey];
|
|
4
11
|
/**
|
|
5
12
|
* Gets the currently registered ErrorInfo component.
|
|
6
13
|
* By default the DefaultErrorInfo component is used.
|
|
7
14
|
*/
|
|
8
|
-
export declare const
|
|
15
|
+
export declare const RegisteredErrorInfo: React.ComponentType<import("../types").ErrorInfoProps>;
|
|
9
16
|
/**
|
|
10
17
|
* Gets the currently registered LoadingIndicator component.
|
|
11
18
|
* By default only Loading is rendered.
|
|
12
19
|
*/
|
|
13
|
-
export declare const
|
|
20
|
+
export declare const RegisteredLoadingIndicator: React.ComponentType<import("../types").LoadingIndicatorProps>;
|
|
14
21
|
/**
|
|
15
22
|
* Gets the currently registered Router component.
|
|
16
23
|
* By default the BrowserRouter is used.
|
|
17
24
|
*/
|
|
18
|
-
export declare const
|
|
25
|
+
export declare const RegisteredRouter: React.ComponentType<import("../types").RouterProps>;
|
|
19
26
|
/**
|
|
20
27
|
* Gets the currently registered Route Switch component.
|
|
21
28
|
* By default the DefaultRouteSwitch component is used.
|
|
22
29
|
*/
|
|
23
|
-
export declare const
|
|
30
|
+
export declare const RegisteredRouteSwitch: React.ComponentType<import("../types").RouteSwitchProps>;
|
|
24
31
|
/**
|
|
25
32
|
* Gets the currently registered Layout component.
|
|
26
33
|
* By default the children are rendered.
|
|
27
34
|
*/
|
|
28
|
-
export declare const
|
|
35
|
+
export declare const RegisteredLayout: React.ComponentType<import("../types").LayoutProps>;
|
|
29
36
|
/**
|
|
30
37
|
* Gets the currently registered Debug component.
|
|
31
38
|
* By default nothing is used.
|
|
32
39
|
*/
|
|
33
|
-
export declare const
|
|
40
|
+
export declare const RegisteredDebug: React.ComponentType<{}>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGlobalState } from '../hooks';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a registered layout component by its name.
|
|
5
|
+
* This will always return a valid component. If nothing is found
|
|
6
|
+
* then the returned component will just return null.
|
|
7
|
+
* @param name The name of the registered layout component.
|
|
8
|
+
* @returns The registered layout component or an empty stub component.
|
|
9
|
+
*/
|
|
3
10
|
export function getPiralComponent(name) {
|
|
4
11
|
return (props) => {
|
|
5
12
|
const Component = useGlobalState((s) => s.components[name]);
|
|
@@ -11,30 +18,30 @@ export function getPiralComponent(name) {
|
|
|
11
18
|
* Gets the currently registered ErrorInfo component.
|
|
12
19
|
* By default the DefaultErrorInfo component is used.
|
|
13
20
|
*/
|
|
14
|
-
export const
|
|
21
|
+
export const RegisteredErrorInfo = getPiralComponent('ErrorInfo');
|
|
15
22
|
/**
|
|
16
23
|
* Gets the currently registered LoadingIndicator component.
|
|
17
24
|
* By default only Loading is rendered.
|
|
18
25
|
*/
|
|
19
|
-
export const
|
|
26
|
+
export const RegisteredLoadingIndicator = getPiralComponent('LoadingIndicator');
|
|
20
27
|
/**
|
|
21
28
|
* Gets the currently registered Router component.
|
|
22
29
|
* By default the BrowserRouter is used.
|
|
23
30
|
*/
|
|
24
|
-
export const
|
|
31
|
+
export const RegisteredRouter = getPiralComponent('Router');
|
|
25
32
|
/**
|
|
26
33
|
* Gets the currently registered Route Switch component.
|
|
27
34
|
* By default the DefaultRouteSwitch component is used.
|
|
28
35
|
*/
|
|
29
|
-
export const
|
|
36
|
+
export const RegisteredRouteSwitch = getPiralComponent('RouteSwitch');
|
|
30
37
|
/**
|
|
31
38
|
* Gets the currently registered Layout component.
|
|
32
39
|
* By default the children are rendered.
|
|
33
40
|
*/
|
|
34
|
-
export const
|
|
41
|
+
export const RegisteredLayout = getPiralComponent('Layout');
|
|
35
42
|
/**
|
|
36
43
|
* Gets the currently registered Debug component.
|
|
37
44
|
* By default nothing is used.
|
|
38
45
|
*/
|
|
39
|
-
export const
|
|
46
|
+
export const RegisteredDebug = getPiralComponent('Debug');
|
|
40
47
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,UAAU,iBAAiB,CAAqC,IAAU;IAC9E,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,2CAA2C;QAC3C,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAC,SAAS,oBAAK,KAAK,EAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAqC,IAAU;IAC9E,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,2CAA2C;QAC3C,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAC,SAAS,oBAAK,KAAK,EAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export * from './DefaultErrorInfo';
|
|
3
|
-
export * from './DefaultLayout';
|
|
4
|
-
export * from './DefaultLoader';
|
|
5
|
-
export * from './DefaultRouter';
|
|
6
|
-
export * from './DefaultRouteSwitch';
|
|
7
2
|
export * from './ErrorBoundary';
|
|
8
3
|
export * from './ExtensionSlot';
|
|
9
4
|
export * from './Mediator';
|
|
5
|
+
export * from './PiralGlobals';
|
|
10
6
|
export * from './PiralRoutes';
|
|
7
|
+
export * from './PiralSuspense';
|
|
11
8
|
export * from './PiralView';
|
|
12
9
|
export * from './PortalRenderer';
|
|
13
10
|
export * from './ResponsiveLayout';
|
|
14
|
-
export * from './SetComponent';
|
|
15
|
-
export * from './SetError';
|
|
16
|
-
export * from './SetErrors';
|
|
17
|
-
export * from './SetLayout';
|
|
18
|
-
export * from './SetProvider';
|
|
19
|
-
export * from './SetRedirect';
|
|
20
|
-
export * from './SetRoute';
|
|
21
11
|
export * from './SwitchErrorInfo';
|
|
22
12
|
export * from './wrapComponent';
|
package/esm/components/index.js
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export * from './DefaultErrorInfo';
|
|
3
|
-
export * from './DefaultLayout';
|
|
4
|
-
export * from './DefaultLoader';
|
|
5
|
-
export * from './DefaultRouter';
|
|
6
|
-
export * from './DefaultRouteSwitch';
|
|
7
2
|
export * from './ErrorBoundary';
|
|
8
3
|
export * from './ExtensionSlot';
|
|
9
4
|
export * from './Mediator';
|
|
5
|
+
export * from './PiralGlobals';
|
|
10
6
|
export * from './PiralRoutes';
|
|
7
|
+
export * from './PiralSuspense';
|
|
11
8
|
export * from './PiralView';
|
|
12
9
|
export * from './PortalRenderer';
|
|
13
10
|
export * from './ResponsiveLayout';
|
|
14
|
-
export * from './SetComponent';
|
|
15
|
-
export * from './SetError';
|
|
16
|
-
export * from './SetErrors';
|
|
17
|
-
export * from './SetLayout';
|
|
18
|
-
export * from './SetProvider';
|
|
19
|
-
export * from './SetRedirect';
|
|
20
|
-
export * from './SetRoute';
|
|
21
11
|
export * from './SwitchErrorInfo';
|
|
22
12
|
export * from './wrapComponent';
|
|
23
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
|
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ExtensionSlot } from '
|
|
3
|
-
import { SwitchErrorInfo } from './SwitchErrorInfo';
|
|
2
|
+
import { ExtensionSlot, SwitchErrorInfo } from '../components';
|
|
4
3
|
/**
|
|
5
4
|
* The default error info component. Just uses the "error" extension slot.
|
|
6
5
|
* Leverage the default one by registration of respective extensions using
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/defaults/DefaultErrorInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAG/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B,CAAC,KAAK,EAAE,EAAE,CAAC,CACnE,oBAAC,aAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,oBAAC,eAAe,kBAAC,GAAG,EAAC,eAAe,IAAK,KAAK,EAAI,GAAI,CAC/G,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/defaults/DefaultLayout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC9F,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
File without changes
|
|
@@ -4,4 +4,4 @@ import * as React from 'react';
|
|
|
4
4
|
*/
|
|
5
5
|
export const DefaultLoadingIndicator = () => React.createElement("div", null, "Loading");
|
|
6
6
|
DefaultLoadingIndicator.displayName = 'DefaultLoadingIndicator';
|
|
7
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=DefaultLoadingIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultLoadingIndicator.js","sourceRoot":"","sources":["../../src/defaults/DefaultLoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAoC,GAAG,EAAE,CAAC,2CAAkB,CAAC;AACjG,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
|
|
File without changes
|
|
File without changes
|