piral-core 0.15.0-alpha.4029 → 0.15.0-alpha.4041

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.
Files changed (245) hide show
  1. package/esm/Piral.d.ts +2 -2
  2. package/esm/Piral.js +14 -12
  3. package/esm/Piral.js.map +1 -1
  4. package/esm/PiralContext.d.ts +21 -0
  5. package/esm/PiralContext.js +34 -0
  6. package/esm/PiralContext.js.map +1 -0
  7. package/esm/actions/app.d.ts +1 -2
  8. package/esm/actions/app.js +0 -3
  9. package/esm/actions/app.js.map +1 -1
  10. package/esm/actions/state.js +5 -1
  11. package/esm/actions/state.js.map +1 -1
  12. package/esm/components/ErrorBoundary.js +3 -3
  13. package/esm/components/ErrorBoundary.js.map +1 -1
  14. package/esm/components/PiralGlobals.d.ts +6 -0
  15. package/esm/components/PiralGlobals.js +13 -0
  16. package/esm/components/PiralGlobals.js.map +1 -0
  17. package/esm/components/PiralSuspense.d.ts +2 -0
  18. package/esm/components/PiralSuspense.js +8 -0
  19. package/esm/components/PiralSuspense.js.map +1 -0
  20. package/esm/components/PiralView.d.ts +6 -1
  21. package/esm/components/PiralView.js +12 -24
  22. package/esm/components/PiralView.js.map +1 -1
  23. package/esm/components/ResponsiveLayout.d.ts +2 -1
  24. package/esm/components/ResponsiveLayout.js +5 -12
  25. package/esm/components/ResponsiveLayout.js.map +1 -1
  26. package/esm/components/components.d.ts +13 -6
  27. package/esm/components/components.js +13 -6
  28. package/esm/components/components.js.map +1 -1
  29. package/esm/components/index.d.ts +2 -12
  30. package/esm/components/index.js +2 -12
  31. package/esm/components/index.js.map +1 -1
  32. package/esm/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
  33. package/esm/{components → defaults}/DefaultErrorInfo.js +1 -2
  34. package/esm/defaults/DefaultErrorInfo.js.map +1 -0
  35. package/esm/{components → defaults}/DefaultLayout.d.ts +0 -0
  36. package/esm/{components → defaults}/DefaultLayout.js +0 -0
  37. package/esm/defaults/DefaultLayout.js.map +1 -0
  38. package/esm/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
  39. package/esm/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +1 -1
  40. package/esm/defaults/DefaultLoadingIndicator.js.map +1 -0
  41. package/esm/{components → defaults}/DefaultRouteSwitch.d.ts +0 -0
  42. package/esm/{components → defaults}/DefaultRouteSwitch.js +0 -0
  43. package/esm/defaults/DefaultRouteSwitch.js.map +1 -0
  44. package/esm/{components → defaults}/DefaultRouter.d.ts +0 -0
  45. package/esm/{components → defaults}/DefaultRouter.js +0 -0
  46. package/esm/defaults/DefaultRouter.js.map +1 -0
  47. package/esm/defaults/index.d.ts +5 -0
  48. package/esm/defaults/index.js +6 -0
  49. package/esm/defaults/index.js.map +1 -0
  50. package/esm/index.d.ts +1 -0
  51. package/esm/index.js +1 -0
  52. package/esm/index.js.map +1 -1
  53. package/esm/{components → setters}/SetComponent.d.ts +0 -0
  54. package/esm/{components → setters}/SetComponent.js +0 -0
  55. package/esm/setters/SetComponent.js.map +1 -0
  56. package/esm/{components → setters}/SetError.d.ts +0 -0
  57. package/esm/{components → setters}/SetError.js +0 -0
  58. package/esm/setters/SetError.js.map +1 -0
  59. package/esm/{components → setters}/SetErrors.d.ts +0 -0
  60. package/esm/{components → setters}/SetErrors.js +0 -0
  61. package/esm/setters/SetErrors.js.map +1 -0
  62. package/esm/{components → setters}/SetLayout.d.ts +0 -0
  63. package/esm/{components → setters}/SetLayout.js +0 -0
  64. package/esm/setters/SetLayout.js.map +1 -0
  65. package/esm/{components → setters}/SetProvider.d.ts +0 -0
  66. package/esm/{components → setters}/SetProvider.js +0 -0
  67. package/esm/setters/SetProvider.js.map +1 -0
  68. package/esm/{components → setters}/SetRedirect.d.ts +0 -0
  69. package/esm/{components → setters}/SetRedirect.js +0 -0
  70. package/esm/setters/SetRedirect.js.map +1 -0
  71. package/esm/{components → setters}/SetRoute.d.ts +0 -0
  72. package/esm/{components → setters}/SetRoute.js +0 -0
  73. package/esm/setters/SetRoute.js.map +1 -0
  74. package/esm/setters/index.d.ts +7 -0
  75. package/esm/setters/index.js +8 -0
  76. package/esm/setters/index.js.map +1 -0
  77. package/esm/state/createGlobalState.js +1 -2
  78. package/esm/state/createGlobalState.js.map +1 -1
  79. package/esm/types/instance.d.ts +7 -2
  80. package/esm/types/state.d.ts +0 -10
  81. package/esm/utils/compare.d.ts +1 -1
  82. package/esm/utils/compare.js +20 -3
  83. package/esm/utils/compare.js.map +1 -1
  84. package/esm/utils/media.js +1 -1
  85. package/esm/utils/media.js.map +1 -1
  86. package/lib/Piral.d.ts +2 -2
  87. package/lib/Piral.js +13 -11
  88. package/lib/Piral.js.map +1 -1
  89. package/lib/PiralContext.d.ts +21 -0
  90. package/lib/PiralContext.js +38 -0
  91. package/lib/PiralContext.js.map +1 -0
  92. package/lib/actions/app.d.ts +1 -2
  93. package/lib/actions/app.js +1 -5
  94. package/lib/actions/app.js.map +1 -1
  95. package/lib/actions/state.js +5 -1
  96. package/lib/actions/state.js.map +1 -1
  97. package/lib/components/ErrorBoundary.js +2 -2
  98. package/lib/components/ErrorBoundary.js.map +1 -1
  99. package/lib/components/PiralGlobals.d.ts +6 -0
  100. package/lib/components/PiralGlobals.js +17 -0
  101. package/lib/components/PiralGlobals.js.map +1 -0
  102. package/lib/components/PiralSuspense.d.ts +2 -0
  103. package/lib/components/PiralSuspense.js +12 -0
  104. package/lib/components/PiralSuspense.js.map +1 -0
  105. package/lib/components/PiralView.d.ts +6 -1
  106. package/lib/components/PiralView.js +11 -23
  107. package/lib/components/PiralView.js.map +1 -1
  108. package/lib/components/ResponsiveLayout.d.ts +2 -1
  109. package/lib/components/ResponsiveLayout.js +3 -10
  110. package/lib/components/ResponsiveLayout.js.map +1 -1
  111. package/lib/components/components.d.ts +13 -6
  112. package/lib/components/components.js +14 -7
  113. package/lib/components/components.js.map +1 -1
  114. package/lib/components/index.d.ts +2 -12
  115. package/lib/components/index.js +2 -12
  116. package/lib/components/index.js.map +1 -1
  117. package/lib/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
  118. package/lib/{components → defaults}/DefaultErrorInfo.js +2 -3
  119. package/lib/defaults/DefaultErrorInfo.js.map +1 -0
  120. package/lib/{components → defaults}/DefaultLayout.d.ts +0 -0
  121. package/lib/{components → defaults}/DefaultLayout.js +0 -0
  122. package/lib/defaults/DefaultLayout.js.map +1 -0
  123. package/lib/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
  124. package/lib/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +1 -1
  125. package/lib/defaults/DefaultLoadingIndicator.js.map +1 -0
  126. package/lib/{components → defaults}/DefaultRouteSwitch.d.ts +0 -0
  127. package/lib/{components → defaults}/DefaultRouteSwitch.js +0 -0
  128. package/lib/defaults/DefaultRouteSwitch.js.map +1 -0
  129. package/lib/{components → defaults}/DefaultRouter.d.ts +0 -0
  130. package/lib/{components → defaults}/DefaultRouter.js +0 -0
  131. package/lib/defaults/DefaultRouter.js.map +1 -0
  132. package/lib/defaults/index.d.ts +5 -0
  133. package/lib/defaults/index.js +9 -0
  134. package/lib/defaults/index.js.map +1 -0
  135. package/lib/index.d.ts +1 -0
  136. package/lib/index.js +1 -0
  137. package/lib/index.js.map +1 -1
  138. package/lib/{components → setters}/SetComponent.d.ts +0 -0
  139. package/lib/{components → setters}/SetComponent.js +0 -0
  140. package/lib/setters/SetComponent.js.map +1 -0
  141. package/lib/{components → setters}/SetError.d.ts +0 -0
  142. package/lib/{components → setters}/SetError.js +0 -0
  143. package/lib/setters/SetError.js.map +1 -0
  144. package/lib/{components → setters}/SetErrors.d.ts +0 -0
  145. package/lib/{components → setters}/SetErrors.js +0 -0
  146. package/lib/setters/SetErrors.js.map +1 -0
  147. package/lib/{components → setters}/SetLayout.d.ts +0 -0
  148. package/lib/{components → setters}/SetLayout.js +0 -0
  149. package/lib/setters/SetLayout.js.map +1 -0
  150. package/lib/{components → setters}/SetProvider.d.ts +0 -0
  151. package/lib/{components → setters}/SetProvider.js +0 -0
  152. package/lib/setters/SetProvider.js.map +1 -0
  153. package/lib/{components → setters}/SetRedirect.d.ts +0 -0
  154. package/lib/{components → setters}/SetRedirect.js +0 -0
  155. package/lib/setters/SetRedirect.js.map +1 -0
  156. package/lib/{components → setters}/SetRoute.d.ts +0 -0
  157. package/lib/{components → setters}/SetRoute.js +0 -0
  158. package/lib/setters/SetRoute.js.map +1 -0
  159. package/lib/setters/index.d.ts +7 -0
  160. package/lib/setters/index.js +11 -0
  161. package/lib/setters/index.js.map +1 -0
  162. package/lib/state/createGlobalState.js +6 -7
  163. package/lib/state/createGlobalState.js.map +1 -1
  164. package/lib/types/instance.d.ts +7 -2
  165. package/lib/types/state.d.ts +0 -10
  166. package/lib/utils/compare.d.ts +1 -1
  167. package/lib/utils/compare.js +22 -5
  168. package/lib/utils/compare.js.map +1 -1
  169. package/lib/utils/media.js +1 -1
  170. package/lib/utils/media.js.map +1 -1
  171. package/package.json +16 -4
  172. package/src/Piral.test.tsx +3 -3
  173. package/src/Piral.tsx +18 -14
  174. package/src/PiralContext.tsx +39 -0
  175. package/src/actions/app.test.ts +0 -18
  176. package/src/actions/app.ts +0 -8
  177. package/src/actions/state.ts +6 -1
  178. package/src/components/ErrorBoundary.tsx +3 -3
  179. package/src/components/PiralGlobals.tsx +16 -0
  180. package/src/components/PiralRoutes.test.tsx +1 -1
  181. package/src/components/PiralSuspense.tsx +15 -0
  182. package/src/components/PiralView-server.test.tsx +1 -0
  183. package/src/components/PiralView.test.tsx +1 -0
  184. package/src/components/PiralView.tsx +24 -47
  185. package/src/components/ResponsiveLayout.test.tsx +14 -43
  186. package/src/components/ResponsiveLayout.tsx +11 -15
  187. package/src/components/components.tsx +13 -6
  188. package/src/components/index.ts +2 -12
  189. package/src/{components → defaults}/DefaultErrorInfo.test.tsx +0 -0
  190. package/src/{components → defaults}/DefaultErrorInfo.tsx +1 -2
  191. package/src/{components → defaults}/DefaultLayout.test.tsx +0 -0
  192. package/src/{components → defaults}/DefaultLayout.tsx +1 -1
  193. package/src/{components/DefaultLoader.test.tsx → defaults/DefaultLoadingIndicator.test.tsx} +2 -2
  194. package/src/{components/DefaultLoader.tsx → defaults/DefaultLoadingIndicator.tsx} +0 -0
  195. package/src/{components → defaults}/DefaultRouteSwitch.tsx +0 -0
  196. package/src/{components → defaults}/DefaultRouter.tsx +0 -0
  197. package/src/defaults/index.ts +5 -0
  198. package/src/index.tsx +1 -0
  199. package/src/{components → setters}/SetComponent.test.tsx +0 -0
  200. package/src/{components → setters}/SetComponent.tsx +0 -0
  201. package/src/{components → setters}/SetError.test.tsx +0 -0
  202. package/src/{components → setters}/SetError.tsx +0 -0
  203. package/src/{components → setters}/SetErrors.test.tsx +0 -0
  204. package/src/{components → setters}/SetErrors.tsx +0 -0
  205. package/src/{components → setters}/SetLayout.test.tsx +0 -0
  206. package/src/{components → setters}/SetLayout.tsx +0 -0
  207. package/src/{components → setters}/SetProvider.test.tsx +0 -0
  208. package/src/{components → setters}/SetProvider.tsx +0 -0
  209. package/src/{components → setters}/SetRedirect.test.tsx +0 -0
  210. package/src/{components → setters}/SetRedirect.tsx +0 -0
  211. package/src/{components → setters}/SetRoute.test.tsx +0 -0
  212. package/src/{components → setters}/SetRoute.tsx +0 -0
  213. package/src/setters/index.ts +7 -0
  214. package/src/state/createGlobalState.test.ts +1 -10
  215. package/src/state/createGlobalState.ts +2 -3
  216. package/src/types/instance.ts +8 -2
  217. package/src/types/state.ts +0 -10
  218. package/src/utils/compare.test.ts +15 -15
  219. package/src/utils/compare.ts +23 -3
  220. package/src/utils/foreign.test.ts +1 -1
  221. package/src/utils/media.ts +1 -1
  222. package/esm/components/DefaultErrorInfo.js.map +0 -1
  223. package/esm/components/DefaultLayout.js.map +0 -1
  224. package/esm/components/DefaultLoader.js.map +0 -1
  225. package/esm/components/DefaultRouteSwitch.js.map +0 -1
  226. package/esm/components/DefaultRouter.js.map +0 -1
  227. package/esm/components/SetComponent.js.map +0 -1
  228. package/esm/components/SetError.js.map +0 -1
  229. package/esm/components/SetErrors.js.map +0 -1
  230. package/esm/components/SetLayout.js.map +0 -1
  231. package/esm/components/SetProvider.js.map +0 -1
  232. package/esm/components/SetRedirect.js.map +0 -1
  233. package/esm/components/SetRoute.js.map +0 -1
  234. package/lib/components/DefaultErrorInfo.js.map +0 -1
  235. package/lib/components/DefaultLayout.js.map +0 -1
  236. package/lib/components/DefaultLoader.js.map +0 -1
  237. package/lib/components/DefaultRouteSwitch.js.map +0 -1
  238. package/lib/components/DefaultRouter.js.map +0 -1
  239. package/lib/components/SetComponent.js.map +0 -1
  240. package/lib/components/SetError.js.map +0 -1
  241. package/lib/components/SetErrors.js.map +0 -1
  242. package/lib/components/SetLayout.js.map +0 -1
  243. package/lib/components/SetProvider.js.map +0 -1
  244. package/lib/components/SetRedirect.js.map +0 -1
  245. package/lib/components/SetRoute.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ export * from './DefaultErrorInfo';
2
+ export * from './DefaultLayout';
3
+ export * from './DefaultLoadingIndicator';
4
+ export * from './DefaultRouter';
5
+ export * from './DefaultRouteSwitch';
6
+ //# sourceMappingURL=index.js.map
@@ -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
@@ -3,6 +3,7 @@ export * from './Piral';
3
3
  export * from './helpers';
4
4
  export * from './components';
5
5
  export * from './hooks';
6
+ export * from './setters';
6
7
  export * from './state';
7
8
  export * from './utils';
8
9
  export * from './types';
package/esm/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './Piral';
3
3
  export * from './helpers';
4
4
  export * from './components';
5
5
  export * from './hooks';
6
+ export * from './setters';
6
7
  export * from './state';
7
8
  export * from './utils';
8
9
  export * from './types';
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,7 @@
1
+ export * from './SetComponent';
2
+ export * from './SetError';
3
+ export * from './SetErrors';
4
+ export * from './SetLayout';
5
+ export * from './SetProvider';
6
+ export * from './SetRedirect';
7
+ export * from './SetRoute';
@@ -0,0 +1,8 @@
1
+ export * from './SetComponent';
2
+ export * from './SetError';
3
+ export * from './SetErrors';
4
+ export * from './SetLayout';
5
+ export * from './SetProvider';
6
+ export * from './SetRedirect';
7
+ export * from './SetRoute';
8
+ //# sourceMappingURL=index.js.map
@@ -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 '../components';
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;AAC5C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAGvB,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,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,GAAG;SACjD;Q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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"}
@@ -3,13 +3,18 @@ import type { GlobalStateContext } from './state';
3
3
  import type { LayoutBreakpoints } from './layout';
4
4
  import { PiralConfiguration } from './config';
5
5
  /**
6
- * The props of the Piral component.
6
+ * The props of the Piral context.
7
7
  */
8
- export interface PiralProps {
8
+ export interface PiralContextProps {
9
9
  /**
10
10
  * The specific Piral instance to be used.
11
11
  */
12
12
  instance?: PiralInstance;
13
+ }
14
+ /**
15
+ * The props of the Piral component.
16
+ */
17
+ export interface PiralProps extends PiralContextProps {
13
18
  /**
14
19
  * The custom breakpoints for the different layout modi.
15
20
  */
@@ -3,7 +3,6 @@ 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';
@@ -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.
@@ -1 +1 @@
1
- export declare function compare<T>(a: T, b: T): boolean;
1
+ export declare function isSame<T>(a: T, b: T): boolean;
@@ -5,18 +5,35 @@ function compareObjects(a, b) {
5
5
  }
6
6
  }
7
7
  for (const i in b) {
8
- if (!compare(a[i], b[i])) {
8
+ if (!isSame(a[i], b[i])) {
9
9
  return false;
10
10
  }
11
11
  }
12
12
  return true;
13
13
  }
14
- export function compare(a, b) {
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
- return compareObjects(a, b);
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
  }
@@ -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,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC;SACd;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,CAAI,EAAE,CAAI;IACnC,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,OAAO,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,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"}
@@ -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;
@@ -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,WAA0B,EAAE,OAAiB,EAAE,aAAgB;IACjG,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"}
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. Wires the state container
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 state_1 = require("./state");
5
+ const react_router_1 = require("react-router");
6
6
  const createInstance_1 = require("./createInstance");
7
7
  const components_1 = require("./components");
8
- const RootListener_1 = require("./RootListener");
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. Wires the state container
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(state_1.StateContext.Provider, { value: instance.context },
25
- React.createElement(components_1.ResponsiveLayout, { breakpoints: breakpoints }),
26
- React.createElement(components_1.Mediator, { options: instance.options, key: instance.id }),
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,mCAAuC;AACvC,qDAAkD;AAClD,6CAAqF;AACrF,iD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AE,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;AAG9C,MAAM,aAAa,GAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/C,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"}
@@ -1,7 +1,6 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { RouteComponentProps } from 'react-router';
3
- import { LayoutType, ComponentsState, ErrorComponentsState, GlobalStateContext, Pilet, PiletEntry } from '../types';
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>;
@@ -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 = exports.changeLayout = void 0;
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 })));
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":";;;AAEA,2CAAsC;AACtC,oCAAkG;AAYlG,SAAgB,YAAY,CAAC,GAAuB,EAAE,OAAmB;IACvE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,GAAG,EAAE,IAAA,eAAO,EAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,IAC1C,CAAC,CAAC;AAC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AAK,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,IAChE,CAAC,CAAC;AACN,CAAC;AATD,8CASC;AAED,SAAgB,QAAQ,CACtB,GAAuB,EACvB,IAAY,EACZ,SAAgD;IAEhD,GAAG,CAAC,QAAQ,CAAC,IAAA,iBAAS,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AAC3C,CAAC;AAND,4BAMC;AAED,SAAgB,eAAe,CAAC,GAAuB,EAAE,QAAqB;IAC5E,GAAG,CAAC,QAAQ,CAAC,IAAA,oBAAY,EAAC,QAAQ,CAAC,CAAC,CAAC;AACvC,CAAC;AAFD,0CAEC"}
@@ -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) {
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAGnD,SAAgB,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAA,iBAAI,EAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC1B,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"}
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"}
@@ -28,9 +28,9 @@ class ErrorBoundary extends React.Component {
28
28
  const rest = renderProps;
29
29
  if (error) {
30
30
  const pilet = piral.meta.name;
31
- return React.createElement(components_1.PiralError, Object.assign({ type: errorType, error: error, pilet: pilet }, rest));
31
+ return React.createElement(components_1.RegisteredErrorInfo, Object.assign({ type: errorType, error: error, pilet: pilet }, rest));
32
32
  }
33
- return React.createElement(React.Suspense, { fallback: React.createElement(components_1.PiralLoadingIndicator, null) }, children);
33
+ return React.createElement(React.Suspense, { fallback: React.createElement(components_1.RegisteredLoadingIndicator, null) }, children);
34
34
  }
35
35
  }
36
36
  exports.ErrorBoundary = ErrorBoundary;
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,6CAAiE;AAqBjE;;GAEG;AACH,MAAa,aAAc,SAA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,SAAS;SACjB,CAAC;IAwBJ,CAAC;IAtBC,iBAAiB,CAAC,KAAY;QAC5B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,qCAAqC,SAAS,IAAI,EAAE,KAAK,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC;YACZ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,MAAM,KAAiD,IAAI,CAAC,KAAK,EAA3D,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,OAA+B,EAA1B,WAAW,2BAA5C,kCAA8C,CAAa,CAAC;QAClE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,MAAM,IAAI,GAAQ,WAAW,CAAC;QAE9B,IAAI,KAAK,EAAE;YACT,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9B,OAAO,oBAAC,gCAAmB,kBAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,IAAM,IAAI,EAAI,CAAC;SACvF;QAED,OAAO,oBAAC,KAAK,CAAC,QAAQ,IAAC,QAAQ,EAAE,oBAAC,uCAA0B,OAAG,IAAG,QAAQ,CAAkB,CAAC;IAC/F,CAAC;CACF;AA3BD,sCA2BC"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Integrates the global portal renderer and the debug utilities
4
+ * (if registered).
5
+ */
6
+ export declare const PiralGlobals: React.FC;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PiralGlobals = void 0;
4
+ const React = require("react");
5
+ const PortalRenderer_1 = require("./PortalRenderer");
6
+ const components_1 = require("./components");
7
+ /**
8
+ * Integrates the global portal renderer and the debug utilities
9
+ * (if registered).
10
+ */
11
+ const PiralGlobals = () => {
12
+ return (React.createElement(React.Fragment, null,
13
+ React.createElement(PortalRenderer_1.PortalRenderer, { id: "root" }),
14
+ React.createElement(components_1.RegisteredDebug, null)));
15
+ };
16
+ exports.PiralGlobals = PiralGlobals;
17
+ //# sourceMappingURL=PiralGlobals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PiralGlobals.js","sourceRoot":"","sources":["../../src/components/PiralGlobals.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,qDAAkD;AAClD,6CAA+C;AAE/C;;;GAGG;AACI,MAAM,YAAY,GAAa,GAAG,EAAE;IACzC,OAAO,CACL;QACE,oBAAC,+BAAc,IAAC,EAAE,EAAC,MAAM,GAAG;QAC5B,oBAAC,4BAAe,OAAG,CAClB,CACJ,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,YAAY,gBAOvB"}
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const PiralSuspense: React.FC;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PiralSuspense = void 0;
4
+ const React = require("react");
5
+ const components_1 = require("./components");
6
+ const hooks_1 = require("../hooks");
7
+ const PiralSuspense = ({ children }) => {
8
+ const { error, loading } = (0, hooks_1.useGlobalState)((m) => m.app);
9
+ return error ? (React.createElement(components_1.RegisteredErrorInfo, { type: "loading", error: error })) : loading ? (React.createElement(components_1.RegisteredLoadingIndicator, null)) : (React.createElement(React.Fragment, null, children));
10
+ };
11
+ exports.PiralSuspense = PiralSuspense;
12
+ //# sourceMappingURL=PiralSuspense.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PiralSuspense.js","sourceRoot":"","sources":["../../src/components/PiralSuspense.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,6CAA+E;AAC/E,oCAA0C;AAEnC,MAAM,aAAa,GAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAExD,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,oBAAC,gCAAmB,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,GAAI,CACrD,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,oBAAC,uCAA0B,OAAG,CAC/B,CAAC,CAAC,CAAC,CACF,0CAAG,QAAQ,CAAI,CAChB,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
@@ -1,11 +1,16 @@
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;
6
11
  }
7
12
  /**
8
13
  * The component responsible for the generic view of the application.
9
- * This includes the global providers, the used Router, the current content and some convenience.
14
+ * This includes the used the current content and some convenience.
10
15
  */
11
16
  export declare const PiralView: React.FC<PiralViewProps>;
@@ -2,34 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PiralView = void 0;
4
4
  const React = require("react");
5
- const react_router_1 = require("react-router");
5
+ const PiralGlobals_1 = require("./PiralGlobals");
6
6
  const PiralRoutes_1 = require("./PiralRoutes");
7
+ const PiralSuspense_1 = require("./PiralSuspense");
8
+ const ResponsiveLayout_1 = require("./ResponsiveLayout");
7
9
  const components_1 = require("./components");
8
- const hooks_1 = require("../hooks");
9
- const NotFound = (props) => React.createElement(components_1.PiralError, Object.assign({ type: "not_found" }, props));
10
- const PiralContent = () => {
11
- const { error, loading, layout } = (0, hooks_1.useGlobalState)((m) => m.app);
12
- return error ? (React.createElement(components_1.PiralError, { type: "loading", error: error })) : loading ? (React.createElement(components_1.PiralLoadingIndicator, null)) : (React.createElement(components_1.PiralLayout, { currentLayout: layout },
13
- React.createElement(PiralRoutes_1.PiralRoutes, { NotFound: NotFound, RouteSwitch: components_1.PiralRouteSwitch })));
14
- };
15
- const FallbackRouter = (props) => {
16
- const publicPath = (0, hooks_1.useGlobalState)((s) => s.app.publicPath);
17
- return React.createElement(react_router_1.StaticRouter, Object.assign({ location: "/" }, props, { basename: publicPath }));
18
- };
19
- const Router = typeof window === 'undefined' ? FallbackRouter : components_1.PiralRouter;
20
- const PiralProvider = ({ children }) => {
21
- const provider = (0, hooks_1.useGlobalState)((m) => m.provider) || React.Fragment;
22
- return React.createElement(provider, undefined, children);
23
- };
10
+ const NotFound = (props) => React.createElement(components_1.RegisteredErrorInfo, Object.assign({ type: "not_found" }, props));
24
11
  /**
25
12
  * The component responsible for the generic view of the application.
26
- * This includes the global providers, the used Router, the current content and some convenience.
13
+ * This includes the used the current content and some convenience.
27
14
  */
28
- const PiralView = ({ children }) => (React.createElement(PiralProvider, null,
29
- React.createElement(Router, null,
30
- React.createElement(PiralContent, null),
31
- children,
32
- React.createElement(components_1.PiralDebug, null))));
15
+ const PiralView = ({ breakpoints, children }) => (React.createElement(React.Fragment, null,
16
+ React.createElement(PiralGlobals_1.PiralGlobals, null),
17
+ React.createElement(PiralSuspense_1.PiralSuspense, null,
18
+ React.createElement(ResponsiveLayout_1.ResponsiveLayout, { breakpoints: breakpoints, Layout: components_1.RegisteredLayout },
19
+ React.createElement(PiralRoutes_1.PiralRoutes, { NotFound: NotFound, RouteSwitch: components_1.RegisteredRouteSwitch }))),
20
+ children));
33
21
  exports.PiralView = PiralView;
34
22
  exports.PiralView.displayName = 'PiralView';
35
23
  //# sourceMappingURL=PiralView.js.map