piral-core 0.14.0-pre.3018 → 0.14.0-pre.3085

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 (300) hide show
  1. package/debug-pilet.d.ts +3 -0
  2. package/debug-pilet.js +12 -0
  3. package/debug-pilet.ts +11 -0
  4. package/debug-piral.d.ts +4 -0
  5. package/debug-piral.js +59 -0
  6. package/debug-piral.ts +74 -0
  7. package/esm/Piral.js +6 -8
  8. package/esm/Piral.js.map +1 -1
  9. package/esm/actions/app.js +9 -10
  10. package/esm/actions/app.js.map +1 -1
  11. package/esm/actions/components.js +4 -5
  12. package/esm/actions/components.js.map +1 -1
  13. package/esm/actions/data.js +16 -17
  14. package/esm/actions/data.js.map +1 -1
  15. package/esm/actions/define.js +2 -3
  16. package/esm/actions/define.js.map +1 -1
  17. package/esm/actions/portal.d.ts +2 -0
  18. package/esm/actions/portal.js +9 -4
  19. package/esm/actions/portal.js.map +1 -1
  20. package/esm/actions/state.js +1 -1
  21. package/esm/actions/state.js.map +1 -1
  22. package/esm/components/DefaultErrorInfo.js +1 -2
  23. package/esm/components/DefaultErrorInfo.js.map +1 -1
  24. package/esm/components/DefaultLayout.js +1 -4
  25. package/esm/components/DefaultLayout.js.map +1 -1
  26. package/esm/components/DefaultLoader.js +1 -1
  27. package/esm/components/DefaultLoader.js.map +1 -1
  28. package/esm/components/ErrorBoundary.js +13 -18
  29. package/esm/components/ErrorBoundary.js.map +1 -1
  30. package/esm/components/ExtensionSlot.js +5 -9
  31. package/esm/components/ExtensionSlot.js.map +1 -1
  32. package/esm/components/Mediator.js +8 -8
  33. package/esm/components/Mediator.js.map +1 -1
  34. package/esm/components/PiralRoutes.js +8 -8
  35. package/esm/components/PiralRoutes.js.map +1 -1
  36. package/esm/components/PiralView.js +11 -16
  37. package/esm/components/PiralView.js.map +1 -1
  38. package/esm/components/PortalRenderer.d.ts +5 -0
  39. package/esm/components/PortalRenderer.js +7 -0
  40. package/esm/components/PortalRenderer.js.map +1 -0
  41. package/esm/components/ResponsiveLayout.js +5 -6
  42. package/esm/components/ResponsiveLayout.js.map +1 -1
  43. package/esm/components/SetComponent.js +3 -4
  44. package/esm/components/SetComponent.js.map +1 -1
  45. package/esm/components/SetError.js +3 -4
  46. package/esm/components/SetError.js.map +1 -1
  47. package/esm/components/SetErrors.js +2 -3
  48. package/esm/components/SetErrors.js.map +1 -1
  49. package/esm/components/SetLayout.js +2 -3
  50. package/esm/components/SetLayout.js.map +1 -1
  51. package/esm/components/SetProvider.js +3 -4
  52. package/esm/components/SetProvider.js.map +1 -1
  53. package/esm/components/SetRedirect.js +3 -4
  54. package/esm/components/SetRedirect.js.map +1 -1
  55. package/esm/components/SetRoute.js +3 -4
  56. package/esm/components/SetRoute.js.map +1 -1
  57. package/esm/components/SwitchErrorInfo.js +12 -10
  58. package/esm/components/SwitchErrorInfo.js.map +1 -1
  59. package/esm/components/components.js +8 -9
  60. package/esm/components/components.js.map +1 -1
  61. package/esm/components/index.d.ts +1 -0
  62. package/esm/components/index.js +1 -0
  63. package/esm/components/index.js.map +1 -1
  64. package/esm/createInstance.js +24 -25
  65. package/esm/createInstance.js.map +1 -1
  66. package/esm/helpers.d.ts +11 -26
  67. package/esm/helpers.js +18 -56
  68. package/esm/helpers.js.map +1 -1
  69. package/esm/hooks/action.js +1 -1
  70. package/esm/hooks/action.js.map +1 -1
  71. package/esm/hooks/actions.js +1 -1
  72. package/esm/hooks/actions.js.map +1 -1
  73. package/esm/hooks/globalState.js +5 -5
  74. package/esm/hooks/globalState.js.map +1 -1
  75. package/esm/hooks/index.d.ts +0 -5
  76. package/esm/hooks/index.js +0 -5
  77. package/esm/hooks/index.js.map +1 -1
  78. package/esm/hooks/media.js +8 -7
  79. package/esm/hooks/media.js.map +1 -1
  80. package/esm/hooks/setter.js +3 -2
  81. package/esm/hooks/setter.js.map +1 -1
  82. package/esm/hooks/sharedData.js +2 -2
  83. package/esm/hooks/sharedData.js.map +1 -1
  84. package/esm/modules/api.js +79 -28
  85. package/esm/modules/api.js.map +1 -1
  86. package/esm/modules/dependencies.d.ts +3 -4
  87. package/esm/modules/dependencies.js +11 -14
  88. package/esm/modules/dependencies.js.map +1 -1
  89. package/esm/state/createActions.js +7 -12
  90. package/esm/state/createActions.js.map +1 -1
  91. package/esm/state/createGlobalState.js +6 -8
  92. package/esm/state/createGlobalState.js.map +1 -1
  93. package/esm/state/stateContext.js +1 -1
  94. package/esm/state/stateContext.js.map +1 -1
  95. package/esm/state/withApi.js +59 -62
  96. package/esm/state/withApi.js.map +1 -1
  97. package/esm/types/config.d.ts +23 -16
  98. package/esm/types/state.d.ts +13 -0
  99. package/esm/utils/compare.js +4 -4
  100. package/esm/utils/compare.js.map +1 -1
  101. package/esm/utils/data.js +6 -7
  102. package/esm/utils/data.js.map +1 -1
  103. package/esm/utils/foreign.d.ts +4 -2
  104. package/esm/utils/foreign.js +16 -8
  105. package/esm/utils/foreign.js.map +1 -1
  106. package/esm/utils/guid.js +3 -3
  107. package/esm/utils/guid.js.map +1 -1
  108. package/esm/utils/helpers.d.ts +11 -8
  109. package/esm/utils/helpers.js +28 -17
  110. package/esm/utils/helpers.js.map +1 -1
  111. package/esm/utils/media.js +8 -7
  112. package/esm/utils/media.js.map +1 -1
  113. package/esm/utils/storage.js +13 -14
  114. package/esm/utils/storage.js.map +1 -1
  115. package/lib/Piral.js +9 -11
  116. package/lib/Piral.js.map +1 -1
  117. package/lib/actions/app.js +11 -12
  118. package/lib/actions/app.js.map +1 -1
  119. package/lib/actions/components.js +5 -6
  120. package/lib/actions/components.js.map +1 -1
  121. package/lib/actions/data.js +17 -18
  122. package/lib/actions/data.js.map +1 -1
  123. package/lib/actions/define.js +2 -3
  124. package/lib/actions/define.js.map +1 -1
  125. package/lib/actions/index.js +7 -7
  126. package/lib/actions/index.js.map +1 -1
  127. package/lib/actions/portal.d.ts +2 -0
  128. package/lib/actions/portal.js +12 -5
  129. package/lib/actions/portal.js.map +1 -1
  130. package/lib/actions/state.js +3 -3
  131. package/lib/actions/state.js.map +1 -1
  132. package/lib/components/DefaultErrorInfo.js +4 -5
  133. package/lib/components/DefaultErrorInfo.js.map +1 -1
  134. package/lib/components/DefaultLayout.js +2 -5
  135. package/lib/components/DefaultLayout.js.map +1 -1
  136. package/lib/components/DefaultLoader.js +2 -2
  137. package/lib/components/DefaultLoader.js.map +1 -1
  138. package/lib/components/ErrorBoundary.js +18 -22
  139. package/lib/components/ErrorBoundary.js.map +1 -1
  140. package/lib/components/ExtensionSlot.js +10 -14
  141. package/lib/components/ExtensionSlot.js.map +1 -1
  142. package/lib/components/Mediator.js +11 -11
  143. package/lib/components/Mediator.js.map +1 -1
  144. package/lib/components/PiralRoutes.js +11 -11
  145. package/lib/components/PiralRoutes.js.map +1 -1
  146. package/lib/components/PiralView.js +16 -21
  147. package/lib/components/PiralView.js.map +1 -1
  148. package/lib/components/PortalRenderer.d.ts +5 -0
  149. package/lib/components/PortalRenderer.js +11 -0
  150. package/lib/components/PortalRenderer.js.map +1 -0
  151. package/lib/components/ResponsiveLayout.js +9 -10
  152. package/lib/components/ResponsiveLayout.js.map +1 -1
  153. package/lib/components/SetComponent.js +4 -5
  154. package/lib/components/SetComponent.js.map +1 -1
  155. package/lib/components/SetError.js +4 -5
  156. package/lib/components/SetError.js.map +1 -1
  157. package/lib/components/SetErrors.js +4 -5
  158. package/lib/components/SetErrors.js.map +1 -1
  159. package/lib/components/SetLayout.js +4 -5
  160. package/lib/components/SetLayout.js.map +1 -1
  161. package/lib/components/SetProvider.js +4 -5
  162. package/lib/components/SetProvider.js.map +1 -1
  163. package/lib/components/SetRedirect.js +6 -7
  164. package/lib/components/SetRedirect.js.map +1 -1
  165. package/lib/components/SetRoute.js +4 -5
  166. package/lib/components/SetRoute.js.map +1 -1
  167. package/lib/components/SwitchErrorInfo.js +14 -12
  168. package/lib/components/SwitchErrorInfo.js.map +1 -1
  169. package/lib/components/components.js +5 -6
  170. package/lib/components/components.js.map +1 -1
  171. package/lib/components/index.d.ts +1 -0
  172. package/lib/components/index.js +20 -19
  173. package/lib/components/index.js.map +1 -1
  174. package/lib/createInstance.js +31 -32
  175. package/lib/createInstance.js.map +1 -1
  176. package/lib/helpers.d.ts +11 -26
  177. package/lib/helpers.js +19 -59
  178. package/lib/helpers.js.map +1 -1
  179. package/lib/hooks/action.js +3 -3
  180. package/lib/hooks/action.js.map +1 -1
  181. package/lib/hooks/actions.js +4 -4
  182. package/lib/hooks/actions.js.map +1 -1
  183. package/lib/hooks/globalState.js +8 -8
  184. package/lib/hooks/globalState.js.map +1 -1
  185. package/lib/hooks/index.d.ts +0 -5
  186. package/lib/hooks/index.js +7 -12
  187. package/lib/hooks/index.js.map +1 -1
  188. package/lib/hooks/media.js +10 -9
  189. package/lib/hooks/media.js.map +1 -1
  190. package/lib/hooks/setter.js +4 -3
  191. package/lib/hooks/setter.js.map +1 -1
  192. package/lib/hooks/sharedData.js +3 -3
  193. package/lib/hooks/sharedData.js.map +1 -1
  194. package/lib/index.js +9 -9
  195. package/lib/index.js.map +1 -1
  196. package/lib/modules/api.js +86 -35
  197. package/lib/modules/api.js.map +1 -1
  198. package/lib/modules/dependencies.d.ts +3 -4
  199. package/lib/modules/dependencies.js +13 -16
  200. package/lib/modules/dependencies.js.map +1 -1
  201. package/lib/modules/index.js +3 -3
  202. package/lib/modules/index.js.map +1 -1
  203. package/lib/state/createActions.js +8 -13
  204. package/lib/state/createActions.js.map +1 -1
  205. package/lib/state/createGlobalState.js +9 -11
  206. package/lib/state/createGlobalState.js.map +1 -1
  207. package/lib/state/index.js +5 -5
  208. package/lib/state/index.js.map +1 -1
  209. package/lib/state/stateContext.js +1 -1
  210. package/lib/state/stateContext.js.map +1 -1
  211. package/lib/state/withApi.js +67 -70
  212. package/lib/state/withApi.js.map +1 -1
  213. package/lib/types/config.d.ts +23 -16
  214. package/lib/types/index.js +13 -13
  215. package/lib/types/index.js.map +1 -1
  216. package/lib/types/state.d.ts +13 -0
  217. package/lib/utils/compare.js +4 -4
  218. package/lib/utils/compare.js.map +1 -1
  219. package/lib/utils/data.js +6 -7
  220. package/lib/utils/data.js.map +1 -1
  221. package/lib/utils/foreign.d.ts +4 -2
  222. package/lib/utils/foreign.js +21 -11
  223. package/lib/utils/foreign.js.map +1 -1
  224. package/lib/utils/guid.js +3 -3
  225. package/lib/utils/guid.js.map +1 -1
  226. package/lib/utils/helpers.d.ts +11 -8
  227. package/lib/utils/helpers.js +30 -17
  228. package/lib/utils/helpers.js.map +1 -1
  229. package/lib/utils/index.js +9 -9
  230. package/lib/utils/index.js.map +1 -1
  231. package/lib/utils/media.js +7 -6
  232. package/lib/utils/media.js.map +1 -1
  233. package/lib/utils/react.js +1 -1
  234. package/lib/utils/react.js.map +1 -1
  235. package/lib/utils/storage.js +11 -12
  236. package/lib/utils/storage.js.map +1 -1
  237. package/package.json +12 -5
  238. package/src/Piral.tsx +2 -1
  239. package/src/actions/portal.ts +19 -1
  240. package/src/components/ExtensionSlot.tsx +2 -2
  241. package/src/components/Mediator.tsx +2 -1
  242. package/src/components/PortalRenderer.tsx +12 -0
  243. package/src/components/SwitchErrorInfo.tsx +5 -1
  244. package/src/components/index.ts +1 -0
  245. package/src/createInstance.tsx +6 -7
  246. package/src/helpers.test.tsx +7 -39
  247. package/src/helpers.tsx +32 -85
  248. package/src/hooks/index.ts +0 -5
  249. package/src/hooks/media.ts +2 -1
  250. package/src/hooks/setter.ts +2 -1
  251. package/src/modules/api.ts +72 -4
  252. package/src/modules/dependencies.test.ts +18 -5
  253. package/src/modules/dependencies.ts +12 -18
  254. package/src/state/withApi.tsx +12 -14
  255. package/src/types/config.ts +23 -17
  256. package/src/types/state.ts +13 -0
  257. package/src/utils/foreign.test.ts +4 -4
  258. package/src/utils/foreign.ts +28 -5
  259. package/src/utils/helpers.ts +21 -7
  260. package/src/utils/media.ts +2 -1
  261. package/esm/hooks/debounce.d.ts +0 -8
  262. package/esm/hooks/debounce.js +0 -18
  263. package/esm/hooks/debounce.js.map +0 -1
  264. package/esm/hooks/lockBodyScroll.d.ts +0 -6
  265. package/esm/hooks/lockBodyScroll.js +0 -15
  266. package/esm/hooks/lockBodyScroll.js.map +0 -1
  267. package/esm/hooks/onClickOutside.d.ts +0 -8
  268. package/esm/hooks/onClickOutside.js +0 -23
  269. package/esm/hooks/onClickOutside.js.map +0 -1
  270. package/esm/hooks/onScreenVisible.d.ts +0 -11
  271. package/esm/hooks/onScreenVisible.js +0 -28
  272. package/esm/hooks/onScreenVisible.js.map +0 -1
  273. package/esm/hooks/promise.d.ts +0 -13
  274. package/esm/hooks/promise.js +0 -21
  275. package/esm/hooks/promise.js.map +0 -1
  276. package/lib/hooks/debounce.d.ts +0 -8
  277. package/lib/hooks/debounce.js +0 -22
  278. package/lib/hooks/debounce.js.map +0 -1
  279. package/lib/hooks/lockBodyScroll.d.ts +0 -6
  280. package/lib/hooks/lockBodyScroll.js +0 -19
  281. package/lib/hooks/lockBodyScroll.js.map +0 -1
  282. package/lib/hooks/onClickOutside.d.ts +0 -8
  283. package/lib/hooks/onClickOutside.js +0 -27
  284. package/lib/hooks/onClickOutside.js.map +0 -1
  285. package/lib/hooks/onScreenVisible.d.ts +0 -11
  286. package/lib/hooks/onScreenVisible.js +0 -32
  287. package/lib/hooks/onScreenVisible.js.map +0 -1
  288. package/lib/hooks/promise.d.ts +0 -13
  289. package/lib/hooks/promise.js +0 -25
  290. package/lib/hooks/promise.js.map +0 -1
  291. package/src/hooks/debounce.test.ts +0 -67
  292. package/src/hooks/debounce.ts +0 -19
  293. package/src/hooks/lockBodyScroll.test.ts +0 -24
  294. package/src/hooks/lockBodyScroll.ts +0 -15
  295. package/src/hooks/onClickOutside.test.ts +0 -113
  296. package/src/hooks/onClickOutside.ts +0 -25
  297. package/src/hooks/onScreenVisible.test.ts +0 -68
  298. package/src/hooks/onScreenVisible.ts +0 -28
  299. package/src/hooks/promise.test.ts +0 -76
  300. package/src/hooks/promise.ts +0 -35
@@ -0,0 +1,3 @@
1
+ import { LoadPiletsOptions } from 'piral-base';
2
+ import { GlobalStateContext } from './lib/types';
3
+ export declare function integrate(context: GlobalStateContext, options: LoadPiletsOptions): void;
package/debug-pilet.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.integrate = void 0;
4
+ var piral_debug_utils_1 = require("piral-debug-utils");
5
+ function integrate(context, options) {
6
+ options.fetchPilets = (0, piral_debug_utils_1.withEmulatorPilets)(options.fetchPilets, {
7
+ injectPilet: context.injectPilet,
8
+ createApi: options.createApi,
9
+ loadPilet: options.loadPilet
10
+ });
11
+ }
12
+ exports.integrate = integrate;
package/debug-pilet.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { LoadPiletsOptions } from 'piral-base';
2
+ import { withEmulatorPilets } from 'piral-debug-utils';
3
+ import { GlobalStateContext } from './lib/types';
4
+
5
+ export function integrate(context: GlobalStateContext, options: LoadPiletsOptions) {
6
+ options.fetchPilets = withEmulatorPilets(options.fetchPilets, {
7
+ injectPilet: context.injectPilet,
8
+ createApi: options.createApi,
9
+ loadPilet: options.loadPilet,
10
+ });
11
+ }
@@ -0,0 +1,4 @@
1
+ import { LoadPiletsOptions } from 'piral-base';
2
+ import { DebuggerExtensionOptions } from 'piral-debug-utils';
3
+ import { GlobalStateContext } from './lib/types';
4
+ export declare function integrate(context: GlobalStateContext, options: LoadPiletsOptions, debug?: DebuggerExtensionOptions): void;
package/debug-piral.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ exports.__esModule = true;
23
+ exports.integrate = void 0;
24
+ var react_atom_1 = require("@dbeining/react-atom");
25
+ var piral_debug_utils_1 = require("piral-debug-utils");
26
+ function integrate(context, options, debug) {
27
+ if (debug === void 0) { debug = {}; }
28
+ (0, piral_debug_utils_1.installPiralDebug)(__assign(__assign({}, debug), { createApi: options.createApi, loadPilet: options.loadPilet, injectPilet: context.injectPilet, fireEvent: context.emit, getDependencies: function () {
29
+ return Object.keys(options.dependencies);
30
+ }, getExtensions: function () {
31
+ return context.readState(function (s) { return Object.keys(s.registry.extensions); });
32
+ }, getRoutes: function () {
33
+ var registeredRoutes = context.readState(function (state) { return Object.keys(state.registry.pages); });
34
+ var componentRoutes = context.readState(function (state) { return Object.keys(state.routes); });
35
+ return __spreadArray(__spreadArray([], componentRoutes, true), registeredRoutes, true);
36
+ }, getGlobalState: function () {
37
+ return context.readState(function (s) { return s; });
38
+ }, getPilets: function () {
39
+ return context.readState(function (s) { return s.modules; });
40
+ }, setPilets: function (modules) {
41
+ context.dispatch(function (state) { return (__assign(__assign({}, state), { modules: modules })); });
42
+ }, integrate: function (dbg) {
43
+ context.dispatch(function (s) { return (__assign(__assign({}, s), { components: __assign(__assign({}, s.components), dbg.components), routes: __assign(__assign({}, s.routes), dbg.routes), registry: __assign(__assign({}, s.registry), { wrappers: __assign(__assign({}, s.registry.wrappers), dbg.wrappers) }) })); });
44
+ (0, react_atom_1.addChangeHandler)(context.state, 'debugging', function (_a) {
45
+ var previous = _a.previous, current = _a.current;
46
+ var pilets = current.modules !== previous.modules;
47
+ var pages = current.registry.pages !== previous.registry.pages || current.routes !== previous.routes;
48
+ var extensions = current.registry.extensions !== previous.registry.extensions;
49
+ var state = current !== previous;
50
+ dbg.onChange(previous, current, {
51
+ pilets: pilets,
52
+ pages: pages,
53
+ extensions: extensions,
54
+ state: state
55
+ });
56
+ });
57
+ } }));
58
+ }
59
+ exports.integrate = integrate;
package/debug-piral.ts ADDED
@@ -0,0 +1,74 @@
1
+ import { addChangeHandler } from '@dbeining/react-atom';
2
+ import { LoadPiletsOptions } from 'piral-base';
3
+ import { installPiralDebug, DebuggerExtensionOptions } from 'piral-debug-utils';
4
+ import { GlobalStateContext } from './lib/types';
5
+
6
+ export function integrate(
7
+ context: GlobalStateContext,
8
+ options: LoadPiletsOptions,
9
+ debug: DebuggerExtensionOptions = {},
10
+ ) {
11
+ installPiralDebug({
12
+ ...debug,
13
+ createApi: options.createApi,
14
+ loadPilet: options.loadPilet,
15
+ injectPilet: context.injectPilet,
16
+ fireEvent: context.emit,
17
+ getDependencies() {
18
+ return Object.keys(options.dependencies);
19
+ },
20
+ getExtensions() {
21
+ return context.readState((s) => Object.keys(s.registry.extensions));
22
+ },
23
+ getRoutes() {
24
+ const registeredRoutes = context.readState((state) => Object.keys(state.registry.pages));
25
+ const componentRoutes = context.readState((state) => Object.keys(state.routes));
26
+ return [...componentRoutes, ...registeredRoutes];
27
+ },
28
+ getGlobalState() {
29
+ return context.readState((s) => s);
30
+ },
31
+ getPilets() {
32
+ return context.readState((s) => s.modules);
33
+ },
34
+ setPilets(modules) {
35
+ context.dispatch((state) => ({
36
+ ...state,
37
+ modules,
38
+ }));
39
+ },
40
+ integrate(dbg) {
41
+ context.dispatch((s) => ({
42
+ ...s,
43
+ components: {
44
+ ...s.components,
45
+ ...dbg.components,
46
+ },
47
+ routes: {
48
+ ...s.routes,
49
+ ...dbg.routes,
50
+ },
51
+ registry: {
52
+ ...s.registry,
53
+ wrappers: {
54
+ ...s.registry.wrappers,
55
+ ...dbg.wrappers,
56
+ },
57
+ },
58
+ }));
59
+
60
+ addChangeHandler(context.state, 'debugging', ({ previous, current }) => {
61
+ const pilets = current.modules !== previous.modules;
62
+ const pages = current.registry.pages !== previous.registry.pages || current.routes !== previous.routes;
63
+ const extensions = current.registry.extensions !== previous.registry.extensions;
64
+ const state = current !== previous;
65
+ dbg.onChange(previous, current, {
66
+ pilets,
67
+ pages,
68
+ extensions,
69
+ state,
70
+ });
71
+ });
72
+ },
73
+ });
74
+ }
package/esm/Piral.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { StateContext } from './state';
3
3
  import { createInstance } from './createInstance';
4
- import { PiralView, Mediator, ResponsiveLayout } from './components';
4
+ import { PiralView, Mediator, ResponsiveLayout, PortalRenderer } from './components';
5
5
  /**
6
6
  * Represents the Piral app shell frame. Use this component together
7
7
  * with an existing instance to render the app shell.
@@ -17,12 +17,10 @@ const app = (
17
17
  );
18
18
  ```
19
19
  */
20
- export var Piral = function (_a) {
21
- var _b = _a.instance, instance = _b === void 0 ? createInstance() : _b, breakpoints = _a.breakpoints, children = _a.children;
22
- return (React.createElement(StateContext.Provider, { value: instance.context },
23
- React.createElement(ResponsiveLayout, { breakpoints: breakpoints }),
24
- React.createElement(Mediator, { options: instance.options }),
25
- React.createElement(PiralView, null, children)));
26
- };
20
+ export const Piral = ({ instance = createInstance(), breakpoints, children }) => (React.createElement(StateContext.Provider, { value: instance.context },
21
+ React.createElement(PortalRenderer, { id: "root" }),
22
+ React.createElement(ResponsiveLayout, { breakpoints: breakpoints }),
23
+ React.createElement(Mediator, { options: instance.options }),
24
+ React.createElement(PiralView, null, children)));
27
25
  Piral.displayName = 'Piral';
28
26
  //# sourceMappingURL=Piral.js.map
package/esm/Piral.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,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ACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
@@ -1,30 +1,29 @@
1
- import { __assign } from "tslib";
2
1
  import { cloneElement, createElement } from 'react';
3
2
  import { withKey, replaceOrAddItem, removeNested } from '../utils';
4
3
  export function changeLayout(ctx, current) {
5
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { app: withKey(state.app, 'layout', current) })); });
4
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: withKey(state.app, 'layout', current) })));
6
5
  }
7
6
  export function initialize(ctx, loading, error, modules) {
8
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { app: __assign(__assign({}, state.app), { error: error,
9
- loading: loading }), modules: modules })); });
7
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: Object.assign(Object.assign({}, state.app), { error,
8
+ loading }), modules })));
10
9
  }
11
10
  export function injectPilet(ctx, pilet) {
12
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { modules: replaceOrAddItem(state.modules, pilet, function (m) { return m.name === pilet.name; }), registry: removeNested(state.registry, function (m) { return m.pilet === pilet.name; }) })); });
11
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { modules: replaceOrAddItem(state.modules, pilet, (m) => m.name === pilet.name), registry: removeNested(state.registry, (m) => m.pilet === pilet.name) })));
13
12
  ctx.emit('unload-pilet', {
14
13
  name: pilet.name,
15
14
  });
16
15
  }
17
16
  export function setComponent(ctx, name, component) {
18
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { components: withKey(state.components, name, component) })); });
17
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { components: withKey(state.components, name, component) })));
19
18
  }
20
19
  export function setErrorComponent(ctx, type, component) {
21
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { errorComponents: withKey(state.errorComponents, type, component) })); });
20
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { errorComponents: withKey(state.errorComponents, type, component) })));
22
21
  }
23
22
  export function setRoute(ctx, path, component) {
24
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { routes: withKey(state.routes, path, component) })); });
23
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { routes: withKey(state.routes, path, component) })));
25
24
  }
26
25
  export function includeProvider(ctx, provider) {
27
- var wrapper = function (props) { return cloneElement(provider, props); };
28
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { provider: !state.provider ? wrapper : function (props) { return createElement(state.provider, undefined, wrapper(props)); } })); });
26
+ const wrapper = (props) => cloneElement(provider, props);
27
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { provider: !state.provider ? wrapper : (props) => createElement(state.provider, undefined, wrapper(props)) })));
29
28
  }
30
29
  //# sourceMappingURL=app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":";AAAA,OAAO,EAAiB,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAWnE,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,OAAmB;IACvE,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,IAC1C,EAHsB,CAGtB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAuB,EAAE,OAAgB,EAAE,KAAwB,EAAE,OAAqB;IACnH,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,GAAG,wBACE,KAAK,CAAC,GAAG,KACZ,KAAK,OAAA;YACL,OAAO,SAAA,KAET,OAAO,SAAA,IACP,EARsB,CAQtB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAuB,EAAE,KAAY;IAC/D,GAA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,eAAe,CAAC,GAAuB,EAAE,QAAqB;IAC5E,MAAM,OAAO,GAAa,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEnE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,IACzG,CAAC,CAAC;AACN,CAAC"}
@@ -1,15 +1,14 @@
1
- import { __assign } from "tslib";
2
1
  import { appendItem, excludeOn, withKey, withoutKey } from '../utils';
3
2
  export function registerPage(ctx, name, value) {
4
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { registry: __assign(__assign({}, state.registry), { pages: withKey(state.registry.pages, name, value) }) })); });
3
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { pages: withKey(state.registry.pages, name, value) }) })));
5
4
  }
6
5
  export function unregisterPage(ctx, name) {
7
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { registry: __assign(__assign({}, state.registry), { pages: withoutKey(state.registry.pages, name) }) })); });
6
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { pages: withoutKey(state.registry.pages, name) }) })));
8
7
  }
9
8
  export function registerExtension(ctx, name, value) {
10
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { registry: __assign(__assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, appendItem(state.registry.extensions[name], value)) }) })); });
9
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, appendItem(state.registry.extensions[name], value)) }) })));
11
10
  }
12
11
  export function unregisterExtension(ctx, name, reference) {
13
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { registry: __assign(__assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, excludeOn(state.registry.extensions[name], function (m) { return m.reference === reference; })) }) })); });
12
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, excludeOn(state.registry.extensions[name], (m) => m.reference === reference)) }) })));
14
13
  }
15
14
  //# sourceMappingURL=components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/actions/components.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtE,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,IAAY,EAAE,KAAuB;IACzF,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,QAAQ,wBACH,KAAK,CAAC,QAAQ,KACjB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,OAEnD,EANsB,CAMtB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAuB,EAAE,IAAY;IAClE,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,QAAQ,wBACH,KAAK,CAAC,QAAQ,KACjB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,OAE/C,EANsB,CAMtB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA4B;IACnG,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,QAAQ,wBACH,KAAK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AK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,OAE/C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA4B;IACnG,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,OAE1G,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAuB,EAAE,IAAY,EAAE,SAAc;IACvF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,UAAU,EAAE,OAAO,CACjB,KAAK,CAAC,QAAQ,CAAC,UAAU,EACzB,IAAI,EACJ,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAC7E,OAEH,CAAC,CAAC;AACN,CAAC"}
@@ -1,38 +1,37 @@
1
- import { __assign } from "tslib";
2
1
  import { updateKey } from '../utils';
3
2
  export function resetData(ctx) {
4
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { data: {} })); });
3
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { data: {} })));
5
4
  }
6
5
  export function readDataItem(ctx, key) {
7
- return ctx.readState(function (state) { return state.data[key]; });
6
+ return ctx.readState((state) => state.data[key]);
8
7
  }
9
8
  export function readDataValue(ctx, key) {
10
- var item = readDataItem(ctx, key);
9
+ const item = readDataItem(ctx, key);
11
10
  return item && item.value;
12
11
  }
13
12
  export function writeDataItem(ctx, key, value, owner, target, expires) {
14
- var isNull = !value && typeof value === 'object';
15
- var data = isNull
13
+ const isNull = !value && typeof value === 'object';
14
+ const data = isNull
16
15
  ? value
17
16
  : {
18
- value: value,
19
- owner: owner,
20
- target: target,
21
- expires: expires,
17
+ value,
18
+ owner,
19
+ target,
20
+ expires,
22
21
  };
23
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { data: updateKey(state.data, key, data) })); });
22
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { data: updateKey(state.data, key, data) })));
24
23
  ctx.emit('store-data', {
25
24
  name: key,
26
- target: target,
27
- value: value,
28
- owner: owner,
29
- expires: expires,
25
+ target,
26
+ value,
27
+ owner,
28
+ expires,
30
29
  });
31
30
  }
32
31
  export function tryWriteDataItem(ctx, key, value, owner, target, expires) {
33
- var item = readDataItem(ctx, key);
32
+ const item = readDataItem(ctx, key);
34
33
  if (item && item.owner !== owner) {
35
- console.error("Invalid data write to '" + key + "'. This item currently belongs to '" + item.owner + "' (write attempted from '" + owner + "'). The action has been ignored.");
34
+ console.error(`Invalid data write to '${key}'. This item currently belongs to '${item.owner}' (write attempted from '${owner}'). The action has been ignored.`);
36
35
  return false;
37
36
  }
38
37
  writeDataItem(ctx, key, value, owner, target, expires);
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/actions/data.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,UAAU,SAAS,CAAC,GAAuB;IAC/C,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,IAAI,EAAE,EAAE,IACR,EAHsB,CAGtB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,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,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,IACtC,CAAC,CAAC;IAEJ,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE;QACrB,IAAI,EAAE,GAAG;QACT,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,GAAuB,EACvB,GAAW,EACX,KAAU,EACV,KAAa,EACb,MAAuB,EACvB,OAAe;IAEf,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEpC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;QAChC,OAAO,CAAC,KAAK,CACX,0BAA0B,GAAG,sCAAsC,IAAI,CAAC,KAAK,4BAA4B,KAAK,kCAAkC,CACjJ,CAAC;QACF,OAAO,KAAK,CAAC;KACd;IAED,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -2,9 +2,8 @@ export function defineAction(ctx, actionName, action) {
2
2
  ctx[actionName] = action.bind(ctx, ctx);
3
3
  }
4
4
  export function defineActions(ctx, actions) {
5
- for (var _i = 0, _a = Object.keys(actions); _i < _a.length; _i++) {
6
- var actionName = _a[_i];
7
- var action = actions[actionName];
5
+ for (const actionName of Object.keys(actions)) {
6
+ const action = actions[actionName];
8
7
  defineAction(ctx, actionName, action);
9
8
  }
10
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/actions/define.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,UAAkB,EAAE,MAAW;IACnF,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,OAAY;IACjE,KAAyB,UAAoB,EAApB,KAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAApB,cAAoB,EAApB,IAAoB,EAAE;QAA1C,IAAM,UAAU,SAAA;QACnB,IAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACnC,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;KACvC;AACH,CAAC"}
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/actions/define.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,UAAkB,EAAE,MAAW;IACnF,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,OAAY;IACjE,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACnC,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;KACvC;AACH,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { ReactPortal } from 'react';
2
2
  import { GlobalStateContext } from '../types';
3
3
  export declare function destroyPortal(ctx: GlobalStateContext, id: string): void;
4
+ export declare function hidePortal(ctx: GlobalStateContext, id: string, entry: ReactPortal): void;
5
+ export declare function updatePortal(ctx: GlobalStateContext, id: string, current: ReactPortal, next: ReactPortal): void;
4
6
  export declare function showPortal(ctx: GlobalStateContext, id: string, entry: ReactPortal): void;
@@ -1,9 +1,14 @@
1
- import { __assign } from "tslib";
2
- import { withoutKey, includeItem, withKey } from '../utils';
1
+ import { withoutKey, withKey, includeItem, excludeItem, replaceOrAddItem } from '../utils';
3
2
  export function destroyPortal(ctx, id) {
4
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { portals: withoutKey(state.portals, id) })); });
3
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withoutKey(state.portals, id) })));
4
+ }
5
+ export function hidePortal(ctx, id, entry) {
6
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withKey(state.portals, id, excludeItem(state.portals[id], entry)) })));
7
+ }
8
+ export function updatePortal(ctx, id, current, next) {
9
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withKey(state.portals, id, replaceOrAddItem(state.portals[id], next, (m) => m === current)) })));
5
10
  }
6
11
  export function showPortal(ctx, id, entry) {
7
- ctx.dispatch(function (state) { return (__assign(__assign({}, state), { portals: withKey(state.portals, id, includeItem(state.portals[id], entry)) })); });
12
+ ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { portals: withKey(state.portals, id, includeItem(state.portals[id], entry)) })));
8
13
  }
9
14
  //# sourceMappingURL=portal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"portal.js","sourceRoot":"","sources":["../../src/actions/portal.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG5D,MAAM,UAAU,aAAa,CAAC,GAAuB,EAAE,EAAU;IAC/D,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,IACtC,EAHsB,CAGtB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAuB,EAAE,EAAU,EAAE,KAAkB;IAChF,GAAG,CAAC,QAAQ,CAAC,UAAC,KAAK,IAAK,OAAA,uBACnB,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,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KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,IAC1E,CAAC,CAAC;AACN,CAAC"}
@@ -3,7 +3,7 @@ export function dispatch(ctx, update) {
3
3
  swap(ctx.state, update);
4
4
  }
5
5
  export function readState(ctx, read) {
6
- var state = deref(ctx.state);
6
+ const state = deref(ctx.state);
7
7
  return read(state);
8
8
  }
9
9
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,GAAuB,EAAE,IAA+B;IACnF,IAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/actions/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,QAAQ,CAAC,GAAuB,EAAE,MAA2C;IAC3F,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,GAAuB,EAAE,IAA+B;IACnF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC"}
@@ -1,4 +1,3 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { ExtensionSlot } from './ExtensionSlot';
4
3
  import { SwitchErrorInfo } from './SwitchErrorInfo';
@@ -7,6 +6,6 @@ import { SwitchErrorInfo } from './SwitchErrorInfo';
7
6
  * Leverage the default one by registration of respective extensions using
8
7
  * the "error" name.
9
8
  */
10
- export var DefaultErrorInfo = function (props) { return (React.createElement(ExtensionSlot, { name: "error", params: props, empty: function () { return React.createElement(SwitchErrorInfo, __assign({ key: "default_error" }, props)); } })); };
9
+ export const DefaultErrorInfo = (props) => (React.createElement(ExtensionSlot, { name: "error", params: props, empty: () => React.createElement(SwitchErrorInfo, Object.assign({ key: "default_error" }, props)) }));
11
10
  DefaultErrorInfo.displayName = 'DefaultErrorInfo';
12
11
  //# sourceMappingURL=DefaultErrorInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/components/DefaultErrorInfo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;;GAIG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAA6B,UAAC,KAAK,IAAK,OAAA,CACnE,oBAAC,aAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,cAAM,OAAA,oBAAC,eAAe,aAAC,GAAG,EAAC,eAAe,IAAK,KAAK,EAAI,EAAlD,CAAkD,GAAI,CAC/G,EAFoE,CAEpE,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
1
+ {"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/components/DefaultErrorInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B,CAAC,KAAK,EAAE,EAAE,CAAC,CACnE,oBAAC,aAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,oBAAC,eAAe,kBAAC,GAAG,EAAC,eAAe,IAAK,KAAK,EAAI,GAAI,CAC/G,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
@@ -2,9 +2,6 @@ import { defaultRender } from '../utils';
2
2
  /**
3
3
  * The default layout only rendering the provided children.
4
4
  */
5
- export var DefaultLayout = function (_a) {
6
- var children = _a.children;
7
- return defaultRender(children);
8
- };
5
+ export const DefaultLayout = ({ children }) => defaultRender(children);
9
6
  DefaultLayout.displayName = 'DefaultLayout';
10
7
  //# sourceMappingURL=DefaultLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/components/DefaultLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,IAAM,aAAa,GAA0B,UAAC,EAAY;QAAV,QAAQ,cAAA;IAAO,OAAA,aAAa,CAAC,QAAQ,CAAC;AAAvB,CAAuB,CAAC;AAC9F,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
1
+ {"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/components/DefaultLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;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"}
@@ -2,6 +2,6 @@ import * as React from 'react';
2
2
  /**
3
3
  * The default loading indicator only displaying "Loading".
4
4
  */
5
- export var DefaultLoadingIndicator = function () { return React.createElement("div", null, "Loading"); };
5
+ export const DefaultLoadingIndicator = () => React.createElement("div", null, "Loading");
6
6
  DefaultLoadingIndicator.displayName = 'DefaultLoadingIndicator';
7
7
  //# sourceMappingURL=DefaultLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultLoader.js","sourceRoot":"","sources":["../../src/components/DefaultLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;GAEG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAoC,cAAM,OAAA,2CAAkB,EAAlB,CAAkB,CAAC;AACjG,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
1
+ {"version":3,"file":"DefaultLoader.js","sourceRoot":"","sources":["../../src/components/DefaultLoader.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"}
@@ -1,30 +1,27 @@
1
- import { __extends } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { isfunc } from 'piral-base';
4
3
  /**
5
4
  * The React component for catching errors and displaying error information.
6
5
  */
7
- var ErrorBoundary = /** @class */ (function (_super) {
8
- __extends(ErrorBoundary, _super);
9
- function ErrorBoundary(props) {
10
- var _this = _super.call(this, props) || this;
11
- _this.state = {
6
+ export class ErrorBoundary extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.state = {
12
10
  error: undefined,
13
11
  };
14
- return _this;
15
12
  }
16
- ErrorBoundary.prototype.componentDidCatch = function (error) {
17
- var onError = this.props.onError;
13
+ componentDidCatch(error) {
14
+ const { onError } = this.props;
18
15
  if (isfunc(onError)) {
19
16
  onError(error);
20
17
  }
21
18
  this.setState({
22
- error: error,
19
+ error,
23
20
  });
24
- };
25
- ErrorBoundary.prototype.render = function () {
26
- var _a = this.props, children = _a.children, renderError = _a.renderError, renderChild = _a.renderChild, renderProps = _a.renderProps;
27
- var error = this.state.error;
21
+ }
22
+ render() {
23
+ const { children, renderError, renderChild, renderProps } = this.props;
24
+ const { error } = this.state;
28
25
  if (error) {
29
26
  if (isfunc(renderError)) {
30
27
  return renderError(error, renderProps);
@@ -32,8 +29,6 @@ var ErrorBoundary = /** @class */ (function (_super) {
32
29
  return React.createElement("div", { style: { whiteSpace: 'pre-wrap' } }, error && error.message);
33
30
  }
34
31
  return isfunc(renderChild) ? renderChild(children, renderProps) : children;
35
- };
36
- return ErrorBoundary;
37
- }(React.Component));
38
- export { ErrorBoundary };
32
+ }
33
+ }
39
34
  //# sourceMappingURL=ErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA6CpC;;GAEG;AACH;IAAsC,iCAA0D;IAC9F,uBAAY,KAA4B;QAAxC,YACE,kBAAM,KAAK,CAAC,SAIb;QAHC,KAAI,CAAC,KAAK,GAAG;YACX,KAAK,EAAE,SAAS;SACjB,CAAC;;IACJ,CAAC;IAED,yCAAiB,GAAjB,UAAkB,KAAY;QACpB,IAAA,OAAO,GAAK,IAAI,CAAC,KAAK,QAAf,CAAgB;QAE/B,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,CAAC;SAChB;QAED,IAAI,CAAC,QAAQ,CAAC;YACZ,KAAK,OAAA;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AAQ,CAAC;YACZ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACvE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE7B,IAAI,KAAK,EAAE;YACT,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;gBACvB,OAAO,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;aACxC;YAED,OAAO,6BAAK,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,IAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAO,CAAC;SAC/E;QAED,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7E,CAAC;CACF"}
@@ -1,22 +1,18 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { isfunc } from 'piral-base';
4
3
  import { useGlobalState } from '../hooks';
5
- import { defaultRender } from '../utils';
4
+ import { defaultRender, none } from '../utils';
6
5
  /**
7
6
  * The extension slot component to be used when the available
8
7
  * extensions of a given name should be rendered at a specific
9
8
  * location.
10
9
  */
11
10
  export function ExtensionSlot(props) {
12
- var name = props.name, _a = props.render, render = _a === void 0 ? defaultRender : _a, empty = props.empty, params = props.params;
13
- var extensions = useGlobalState(function (s) { return s.registry.extensions[name] || []; });
11
+ const { name, render = defaultRender, empty, params } = props;
12
+ const extensions = useGlobalState((s) => s.registry.extensions[name] || none);
14
13
  return render(extensions.length === 0 && isfunc(empty)
15
14
  ? [defaultRender(empty(), 'empty')]
16
- : extensions.map(function (_a, i) {
17
- var Component = _a.component, reference = _a.reference, _b = _a.defaults, defaults = _b === void 0 ? {} : _b;
18
- return (React.createElement(Component, { key: "" + ((reference === null || reference === void 0 ? void 0 : reference.displayName) || '_') + i, params: __assign(__assign({}, defaults), (params || {})) }));
19
- }));
15
+ : extensions.map(({ component: Component, reference, defaults = {} }, i) => (React.createElement(Component, { key: `${(reference === null || reference === void 0 ? void 0 : reference.displayName) || '_'}${i}`, params: Object.assign(Object.assign({}, defaults), (params || {})) }))));
20
16
  }
21
- ExtensionSlot.displayName = "ExtensionSlot";
17
+ ExtensionSlot.displayName = `ExtensionSlot`;
22
18
  //# sourceMappingURL=ExtensionSlot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExtensionSlot.js","sourceRoot":"","sources":["../../src/components/ExtensionSlot.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAmB,KAA4B;IAClE,IAAA,IAAI,GAA4C,KAAK,KAAjD,EAAE,KAA0C,KAAK,OAAzB,EAAtB,MAAM,mBAAG,aAAa,KAAA,EAAE,KAAK,GAAa,KAAK,MAAlB,EAAE,MAAM,GAAK,KAAK,OAAV,CAAW;IAC9D,IAAM,UAAU,GAAG,cAAc,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAjC,CAAiC,CAAC,CAAC;IAC5E,OAAO,MAAM,CACX,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,UAAC,EAAkD,EAAE,CAAC;gBAAxC,SAAS,eAAA,EAAE,SAAS,eAAA,EAAE,gB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