piral-core 0.15.0-alpha.4036 → 0.15.0-alpha.4122
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/ForeignComponentContainer.d.ts +1 -1
- package/esm/components/ForeignComponentContainer.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/wrapComponent.d.ts +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/ForeignComponentContainer.d.ts +1 -1
- package/lib/components/ForeignComponentContainer.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/wrapComponent.d.ts +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 +33 -8
- package/src/Piral.test.tsx +3 -3
- package/src/Piral.tsx +18 -14
- package/src/PiralContext.tsx +43 -0
- package/src/RootListener.test.tsx +7 -5
- package/src/actions/app.test.ts +1 -19
- package/src/actions/app.ts +0 -8
- package/src/actions/state.ts +6 -1
- package/src/components/ErrorBoundary.tsx +7 -3
- package/src/components/ForeignComponentContainer.test.tsx +25 -16
- package/src/components/ForeignComponentContainer.tsx +1 -2
- 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 +27 -26
- 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/wrapComponent.tsx +1 -1
- 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/hooks/setter.test.ts +3 -2
- 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 -3
- 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
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultRouteSwitch.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouteSwitch.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,CAAC,MAAM,kBAAkB,GAA+B,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IACxF,OAAO,CACL,oBAAC,MAAM,oBAAK,KAAK;QACd,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAClC,oBAAC,KAAK,IAAC,KAAK,QAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,GAAI,CAC7D,CAAC;QACF,oBAAC,KAAK,IAAC,SAAS,EAAE,QAAQ,GAAI,CACvB,CACV,CAAC;AACJ,CAAC,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultRouter.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,oBAAC,aAAa,IAAC,QAAQ,EAAE,UAAU,IAAG,QAAQ,CAAiB,CAAC;AACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/defaults/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetComponent.js","sourceRoot":"","sources":["../../src/setters/SetComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiB5D;;GAEG;AACH,MAAM,UAAU,YAAY,CAAqC,EAC/D,IAAI,EACJ,SAAS,GACe;IACxB,MAAM,EAAE,YAAY,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACjD,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetError.js","sourceRoot":"","sources":["../../src/setters/SetError.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiB5D;;GAEG;AACH,MAAM,UAAU,QAAQ,CAA0C,EAChE,IAAI,EACJ,SAAS,GACW;IACpB,MAAM,EAAE,iBAAiB,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACtD,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACjE,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetErrors.js","sourceRoot":"","sources":["../../src/setters/SetErrors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE,EAAkB;IACvD,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CACrC,oBAAC,QAAQ,IAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAC1D,CAAC,CACD,CACJ,CAAC;AACJ,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetLayout.js","sourceRoot":"","sources":["../../src/setters/SetLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa9C;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE,EAAkB;IACvD,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CACrC,oBAAC,YAAY,IAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAC9D,CAAC,CACD,CACJ,CAAC;AACJ,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetProvider.js","sourceRoot":"","sources":["../../src/setters/SetProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAY5D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IACxD,MAAM,EAAC,eAAe,EAAC,GAAG,qBAAqB,EAAE,CAAC;IAClD,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetRedirect.js","sourceRoot":"","sources":["../../src/setters/SetRedirect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgB5D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,EAAoB;IACxD,MAAM,EAAE,QAAQ,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,oBAAC,QAAQ,IAAC,EAAE,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/setters/SetRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgB5D;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAS,EAAE,IAAI,EAAE,SAAS,EAAoB;IACpE,MAAM,EAAE,QAAQ,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/setters/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Atom } from '@dbeining/react-atom';
|
|
2
|
-
import { DefaultErrorInfo, DefaultLoadingIndicator, DefaultLayout, DefaultRouter, DefaultRouteSwitch, } from '../
|
|
2
|
+
import { DefaultErrorInfo, DefaultLoadingIndicator, DefaultLayout, DefaultRouter, DefaultRouteSwitch, } from '../defaults';
|
|
3
3
|
function extend(defaultState, customState) {
|
|
4
4
|
for (const key of Object.keys(customState)) {
|
|
5
5
|
if (key === '__proto__' || key === 'constructor') {
|
|
@@ -17,7 +17,6 @@ export function createGlobalState(customState = {}) {
|
|
|
17
17
|
app: {
|
|
18
18
|
error: undefined,
|
|
19
19
|
loading: typeof window !== 'undefined',
|
|
20
|
-
layout: 'desktop',
|
|
21
20
|
publicPath: process.env.PIRAL_PUBLIC_PATH || '/',
|
|
22
21
|
},
|
|
23
22
|
components: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGlobalState.js","sourceRoot":"","sources":["../../src/state/createGlobalState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"createGlobalState.js","sourceRoot":"","sources":["../../src/state/createGlobalState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,SAAS,MAAM,CAAI,YAAe,EAAE,WAA6B;IAC/D,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QAC1C,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,aAAa,EAAE;YAChD,SAAS;SACV;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;QACzE,YAAY,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KAC9D;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,cAA0C,EAAE;IAC5E,MAAM,YAAY,GAAgB;QAChC,GAAG,EAAE;YACH,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,OAAO,MAAM,KAAK,WAAW;YACtC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,GAAG;SACjD;QACD,UAAU,EAAE;YACV,SAAS,EAAE,gBAAgB;YAC3B,gBAAgB,EAAE,uBAAuB;YACzC,MAAM,EAAE,aAAa;YACrB,WAAW,EAAE,kBAAkB;YAC/B,MAAM,EAAE,aAAa;SACtB;QACD,eAAe,EAAE,EAAE;QACnB,QAAQ,EAAE;YACR,UAAU,EAAE,EAAE;YACd,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,EAAE;SACb;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
package/esm/state/withApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withApi.js","sourceRoot":"","sources":["../../src/state/withApi.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"withApi.js","sourceRoot":"","sources":["../../src/state/withApi.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,cAAc,GAA0C,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,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,aAAa,oBAAK,UAAU,EAAM,KAAK,IAAE,SAAS,EAAE,SAAS,KAC3D,KAAK,CAAC,QAAQ,CACD,CACH,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,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,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -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/esm/types/instance.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
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
|
-
* The props of the Piral
|
|
7
|
+
* The props of the Piral context.
|
|
7
8
|
*/
|
|
8
|
-
export interface
|
|
9
|
+
export interface PiralContextProps {
|
|
9
10
|
/**
|
|
10
11
|
* The specific Piral instance to be used.
|
|
11
12
|
*/
|
|
12
13
|
instance?: PiralInstance;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The props of the Piral component.
|
|
18
|
+
*/
|
|
19
|
+
export interface PiralProps extends PiralContextProps {
|
|
13
20
|
/**
|
|
14
21
|
* The custom breakpoints for the different layout modi.
|
|
15
22
|
*/
|
package/esm/types/state.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
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';
|
|
5
5
|
import type { Dict, Without } from './common';
|
|
6
|
-
import type { LayoutType } from './layout';
|
|
7
6
|
import type { SharedDataItem, DataStoreTarget } from './data';
|
|
8
7
|
import type { PiralCustomActions, PiralCustomState, PiralCustomRegistryState, PiralCustomComponentsState } from './custom';
|
|
9
8
|
import type { EventEmitter, Pilet, BaseComponentProps, PageComponentProps, ExtensionComponentProps, PiletsBag, PiralPageMeta, PiletEntry } from './api';
|
|
@@ -17,7 +16,7 @@ declare module './components' {
|
|
|
17
16
|
readState: PiralActions['readState'];
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
export declare type WrappedComponent<TProps> = ComponentType<Without<TProps, keyof BaseComponentProps
|
|
19
|
+
export declare type WrappedComponent<TProps> = ComponentType<PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
|
|
21
20
|
/**
|
|
22
21
|
* The base type for pilet component registration in the global state context.
|
|
23
22
|
*/
|
|
@@ -72,10 +71,6 @@ export interface ComponentsState extends PiralCustomComponentsState {
|
|
|
72
71
|
* The Piral global app sub-state container for app information.
|
|
73
72
|
*/
|
|
74
73
|
export interface AppState {
|
|
75
|
-
/**
|
|
76
|
-
* Information for the layout computation.
|
|
77
|
-
*/
|
|
78
|
-
layout: LayoutType;
|
|
79
74
|
/**
|
|
80
75
|
* Gets if the application is currently performing a background loading
|
|
81
76
|
* activity, e.g., for loading modules asynchronously or fetching
|
|
@@ -220,11 +215,6 @@ export interface PiralActions extends PiralCustomActions {
|
|
|
220
215
|
* @param expiration The time for when to dispose the shared item.
|
|
221
216
|
*/
|
|
222
217
|
tryWriteDataItem(name: string, value: any, owner: string, target: DataStoreTarget, expiration: number): boolean;
|
|
223
|
-
/**
|
|
224
|
-
* Performs a layout change.
|
|
225
|
-
* @param current The layout to take.
|
|
226
|
-
*/
|
|
227
|
-
changeLayout(current: LayoutType): void;
|
|
228
218
|
/**
|
|
229
219
|
* Registers a new route to be resolved.
|
|
230
220
|
* @param route The route to register.
|
package/esm/utils/compare.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function isSame<T>(a: T, b: T): boolean;
|
package/esm/utils/compare.js
CHANGED
|
@@ -5,18 +5,35 @@ function compareObjects(a, b) {
|
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
for (const i in b) {
|
|
8
|
-
if (!
|
|
8
|
+
if (!isSame(a[i], b[i])) {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
function compareArrays(a, b) {
|
|
15
|
+
const l = a.length;
|
|
16
|
+
if (l === b.length) {
|
|
17
|
+
for (let i = 0; i < l; i++) {
|
|
18
|
+
if (!isSame(a[i], b[i])) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
export function isSame(a, b) {
|
|
15
27
|
if (a !== b) {
|
|
16
28
|
const ta = typeof a;
|
|
17
29
|
const tb = typeof b;
|
|
18
30
|
if (ta === tb && ta === 'object' && a && b) {
|
|
19
|
-
|
|
31
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
32
|
+
return compareArrays(a, b);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return compareObjects(a, b);
|
|
36
|
+
}
|
|
20
37
|
}
|
|
21
38
|
return false;
|
|
22
39
|
}
|
package/esm/utils/compare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/utils/compare.ts"],"names":[],"mappings":"AAAA,SAAS,cAAc,CAAC,CAAM,EAAE,CAAM;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;YACb,OAAO,KAAK,CAAC;SACd;KACF;IAED,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../src/utils/compare.ts"],"names":[],"mappings":"AAAA,SAAS,cAAc,CAAC,CAAM,EAAE,CAAM;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;YACb,OAAO,KAAK,CAAC;SACd;KACF;IAED,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACvB,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,CAAa,EAAE,CAAa;IACjD,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAEnB,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACvB,OAAO,KAAK,CAAC;aACd;SACF;QAED,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,MAAM,CAAI,CAAI,EAAE,CAAI;IAClC,IAAI,CAAC,KAAK,CAAC,EAAE;QACX,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QACpB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;QAEpB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,EAAE;YAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACxC,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAC5B;iBAAM;gBACL,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aAC7B;SACF;QAED,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/esm/utils/media.js
CHANGED
|
@@ -4,7 +4,7 @@ export const defaultBreakpoints = ['(min-width: 991px)', '(min-width: 481px)', '
|
|
|
4
4
|
const mm = typeof window === 'undefined' || !isfunc(window.matchMedia)
|
|
5
5
|
? () => ({ matches: undefined })
|
|
6
6
|
: (q) => window.matchMedia(q);
|
|
7
|
-
export function getCurrentLayout(breakpoints, layouts, defaultLayout) {
|
|
7
|
+
export function getCurrentLayout(breakpoints = defaultBreakpoints, layouts, defaultLayout) {
|
|
8
8
|
const query = breakpoints.findIndex((q) => mm(q).matches);
|
|
9
9
|
const layout = layouts[query];
|
|
10
10
|
return layout !== undefined ? layout : defaultLayout;
|
package/esm/utils/media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,cAAc,GAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAExH,MAAM,EAAE,GACN,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IACzD,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,UAAU,gBAAgB,CAAI,
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,cAAc,GAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAExH,MAAM,EAAE,GACN,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IACzD,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,UAAU,gBAAgB,CAAI,cAA6B,kBAAkB,EAAE,OAAiB,EAAE,aAAgB;IACtH,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC;AACvD,CAAC"}
|
package/lib/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/lib/Piral.js
CHANGED
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Piral = void 0;
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
6
|
const createInstance_1 = require("./createInstance");
|
|
7
7
|
const components_1 = require("./components");
|
|
8
|
-
const
|
|
8
|
+
const hooks_1 = require("./hooks");
|
|
9
|
+
const PiralContext_1 = require("./PiralContext");
|
|
10
|
+
const FallbackRouter = (props) => {
|
|
11
|
+
const publicPath = (0, hooks_1.useGlobalState)((s) => s.app.publicPath);
|
|
12
|
+
return React.createElement(react_router_1.StaticRouter, Object.assign({ location: "/" }, props, { basename: publicPath }));
|
|
13
|
+
};
|
|
14
|
+
const Router = typeof window === 'undefined' ? FallbackRouter : components_1.RegisteredRouter;
|
|
9
15
|
/**
|
|
10
16
|
* Represents the Piral app shell frame. Use this component together
|
|
11
17
|
* with an existing instance to render the app shell.
|
|
12
|
-
* Includes layout and routing handling.
|
|
13
|
-
* to the generated views.
|
|
18
|
+
* Includes layout and routing handling. Connects the Piral context
|
|
19
|
+
* and the React router to the generated views.
|
|
14
20
|
*
|
|
15
21
|
* @example
|
|
16
22
|
```jsx
|
|
@@ -21,13 +27,9 @@ const app = (
|
|
|
21
27
|
);
|
|
22
28
|
```
|
|
23
29
|
*/
|
|
24
|
-
const Piral = ({ instance = (0, createInstance_1.createInstance)(), breakpoints, children }) => (React.createElement(
|
|
25
|
-
React.createElement(
|
|
26
|
-
|
|
27
|
-
React.createElement(RootListener_1.RootListener, null),
|
|
28
|
-
React.createElement(components_1.PiralView, null,
|
|
29
|
-
React.createElement(components_1.PortalRenderer, { id: "root" }),
|
|
30
|
-
children)));
|
|
30
|
+
const Piral = ({ instance = (0, createInstance_1.createInstance)(), breakpoints, children }) => (React.createElement(PiralContext_1.PiralContext, { instance: instance },
|
|
31
|
+
React.createElement(Router, null,
|
|
32
|
+
React.createElement(components_1.PiralView, { breakpoints: breakpoints }, children))));
|
|
31
33
|
exports.Piral = Piral;
|
|
32
34
|
exports.Piral.displayName = 'Piral';
|
|
33
35
|
//# sourceMappingURL=Piral.js.map
|
package/lib/Piral.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B
|
|
1
|
+
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+CAA4C;AAC5C,qDAAkD;AAClD,6CAA2D;AAC3D,mCAAyC;AACzC,iDAA8C;AAG9C,MAAM,cAAc,GAAa,CAAC,KAAK,EAAE,EAAE;IACzC,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,oBAAC,2BAAY,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,6BAAgB,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACI,MAAM,KAAK,GAAyB,CAAC,EAAE,QAAQ,GAAG,IAAA,+BAAc,GAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACrG,oBAAC,2BAAY,IAAC,QAAQ,EAAE,QAAQ;IAC9B,oBAAC,MAAM;QACL,oBAAC,sBAAS,IAAC,WAAW,EAAE,WAAW,IAAG,QAAQ,CAAa,CACpD,CACI,CAChB,CAAC;AANW,QAAA,KAAK,SAMhB;AACF,aAAK,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,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PiralContext = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const state_1 = require("./state");
|
|
6
|
+
const createInstance_1 = require("./createInstance");
|
|
7
|
+
const components_1 = require("./components");
|
|
8
|
+
const hooks_1 = require("./hooks");
|
|
9
|
+
const RootListener_1 = require("./RootListener");
|
|
10
|
+
const PiralProvider = ({ children }) => {
|
|
11
|
+
const Provider = (0, hooks_1.useGlobalState)((m) => m.provider || React.Fragment);
|
|
12
|
+
return React.createElement(Provider, null, children);
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Represents the Piral app shell frame. Use this component together
|
|
16
|
+
* with an existing instance to render components from micro frontends
|
|
17
|
+
* in your app.
|
|
18
|
+
* Wires the state container together with the global providers.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
```jsx
|
|
22
|
+
const app = (
|
|
23
|
+
<MyRouter>
|
|
24
|
+
<PiralContext instance={yourPiralInstance}>
|
|
25
|
+
<PiralGlobals />
|
|
26
|
+
<MyAppContent />
|
|
27
|
+
</PiralContext>
|
|
28
|
+
</MyRouter>
|
|
29
|
+
);
|
|
30
|
+
```
|
|
31
|
+
*/
|
|
32
|
+
const PiralContext = ({ instance = (0, createInstance_1.createInstance)(), children }) => (React.createElement(state_1.StateContext.Provider, { value: instance.context },
|
|
33
|
+
React.createElement(components_1.Mediator, { options: instance.options, key: instance.id }),
|
|
34
|
+
React.createElement(RootListener_1.RootListener, null),
|
|
35
|
+
React.createElement(PiralProvider, null, children)));
|
|
36
|
+
exports.PiralContext = PiralContext;
|
|
37
|
+
exports.PiralContext.displayName = 'PiralContext';
|
|
38
|
+
//# sourceMappingURL=PiralContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralContext.js","sourceRoot":"","sources":["../src/PiralContext.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,mCAAuC;AACvC,qDAAkD;AAClD,6CAAwC;AACxC,mCAAyC;AACzC,iDAA8C;AAO9C,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,MAAM,QAAQ,GAAG,IAAA,sBAAc,EAAC,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;AACI,MAAM,YAAY,GAAgC,CAAC,EAAE,QAAQ,GAAG,IAAA,+BAAc,GAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACtG,oBAAC,oBAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,OAAO;IAC5C,oBAAC,qBAAQ,IAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAI;IACzD,oBAAC,2BAAY,OAAG;IAChB,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACnB,CACzB,CAAC;AANW,QAAA,YAAY,gBAMvB;AACF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
package/lib/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/lib/actions/app.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.includeProvider = exports.setRoute = exports.setErrorComponent = exports.setComponent = exports.injectPilet = exports.removePilet = exports.addPilet = exports.initialize =
|
|
3
|
+
exports.includeProvider = exports.setRoute = exports.setErrorComponent = exports.setComponent = exports.injectPilet = exports.removePilet = exports.addPilet = exports.initialize = void 0;
|
|
4
4
|
const piral_base_1 = require("piral-base");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
-
function changeLayout(ctx, current) {
|
|
7
|
-
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: (0, utils_1.withKey)(state.app, 'layout', current) })));
|
|
8
|
-
}
|
|
9
|
-
exports.changeLayout = changeLayout;
|
|
10
6
|
function initialize(ctx, loading, error, modules) {
|
|
11
7
|
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: Object.assign(Object.assign({}, state.app), { error,
|
|
12
8
|
loading }), modules })));
|
package/lib/actions/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":";;;AAEA,2CAAsC;AACtC,oCAAkG;
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"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"}
|
package/lib/actions/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("./app"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./components"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./data"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./define"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./portal"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./state"), exports);
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/lib/actions/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,iDAAuB;AACvB,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB"}
|
package/lib/actions/state.js
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readState = exports.dispatch = void 0;
|
|
4
4
|
const react_atom_1 = require("@dbeining/react-atom");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function onlyChangedState(oldState, newState) {
|
|
7
|
+
return (0, utils_1.isSame)(oldState, newState) ? oldState : newState;
|
|
8
|
+
}
|
|
5
9
|
function dispatch(ctx, update) {
|
|
6
|
-
(0, react_atom_1.swap)(ctx.state, update);
|
|
10
|
+
(0, react_atom_1.swap)(ctx.state, oldState => onlyChangedState(oldState, update(oldState)));
|
|
7
11
|
}
|
|
8
12
|
exports.dispatch = dispatch;
|
|
9
13
|
function readState(ctx, read) {
|
package/lib/actions/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AACnD,oCAAkC;AAGlC,SAAS,gBAAgB,CAAC,QAAqB,EAAE,QAAqB;IACpE,OAAO,IAAA,cAAM,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC1D,CAAC;AAED,SAAgB,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAA,iBAAI,EAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAFD,4BAEC;AAED,SAAgB,SAAS,CAAI,GAAuB,EAAE,IAA+B;IACnF,MAAM,KAAK,GAAG,IAAA,kBAAK,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAHD,8BAGC"}
|
|
@@ -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
|
/**
|