piral-core 1.8.0-beta.7544 → 1.8.0-beta.7655

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 (52) hide show
  1. package/app.codegen +2 -0
  2. package/app.codegen.d.ts +2 -0
  3. package/lib/RootListener.js.map +1 -1
  4. package/lib/actions/data.js.map +1 -1
  5. package/lib/actions/define.js.map +1 -1
  6. package/lib/actions/state.js.map +1 -1
  7. package/lib/codegen.js +2635 -1231
  8. package/lib/components/ErrorBoundary.js.map +1 -1
  9. package/lib/components/ExtensionSlot.js.map +1 -1
  10. package/lib/components/ForeignComponentContainer.js.map +1 -1
  11. package/lib/components/Mediator.js.map +1 -1
  12. package/lib/components/SwitchErrorInfo.js.map +1 -1
  13. package/lib/components/wrapComponent.js.map +1 -1
  14. package/lib/createInstance.js.map +1 -1
  15. package/lib/defaults/DefaultRouteSwitch_v7.d.ts +3 -0
  16. package/lib/defaults/DefaultRouteSwitch_v7.js +13 -0
  17. package/lib/defaults/DefaultRouteSwitch_v7.js.map +1 -0
  18. package/lib/defaults/DefaultRouter_v7.d.ts +3 -0
  19. package/lib/defaults/DefaultRouter_v7.js +8 -0
  20. package/lib/defaults/DefaultRouter_v7.js.map +1 -0
  21. package/lib/defaults/navigator_v5.js.map +1 -1
  22. package/lib/defaults/navigator_v6.js.map +1 -1
  23. package/lib/defaults/navigator_v7.d.ts +6 -0
  24. package/lib/defaults/navigator_v7.js +84 -0
  25. package/lib/defaults/navigator_v7.js.map +1 -0
  26. package/lib/hooks/media.js.map +1 -1
  27. package/lib/modules/api.js.map +1 -1
  28. package/lib/modules/dependencies.js.map +1 -1
  29. package/lib/modules/element.js +6 -6
  30. package/lib/modules/element.js.map +1 -1
  31. package/lib/state/createActions.js.map +1 -1
  32. package/lib/state/createGlobalState.js.map +1 -1
  33. package/lib/state/withApi.js.map +1 -1
  34. package/lib/tools/codegen.d.ts +2 -0
  35. package/lib/tools/codegen.js +27 -1
  36. package/lib/tools/codegen.js.map +1 -1
  37. package/lib/tools/debugger.js.map +1 -1
  38. package/lib/utils/compare.js.map +1 -1
  39. package/lib/utils/data.js.map +1 -1
  40. package/lib/utils/extension.js.map +1 -1
  41. package/lib/utils/foreign.js.map +1 -1
  42. package/lib/utils/helpers.js.map +1 -1
  43. package/lib/utils/routes.js.map +1 -1
  44. package/lib/utils/state.js.map +1 -1
  45. package/package.json +6 -5
  46. package/src/defaults/DefaultRouteSwitch_v7.tsx +20 -0
  47. package/src/defaults/DefaultRouter_v7.tsx +9 -0
  48. package/src/defaults/navigator_v7.tsx +97 -0
  49. package/src/modules/element.test.ts +3 -0
  50. package/src/modules/element.ts +6 -7
  51. package/src/tools/codegen.ts +32 -2
  52. package/style.css +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGvE;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAG,WAAuD;IAChF,OAAO,CAAC,KAAkB,EAAe,EAAE;QACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACpC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;SAC3B;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAuB;IAC5D,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,CAAC;QAC3C,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EA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;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-core",
3
- "version": "1.8.0-beta.7544",
3
+ "version": "1.8.0-beta.7655",
4
4
  "description": "The core library for creating a Piral instance.",
5
5
  "keywords": [
6
6
  "portal",
@@ -39,7 +39,8 @@
39
39
  "lib",
40
40
  "src",
41
41
  "app.codegen",
42
- "app.codegen.d.ts"
42
+ "app.codegen.d.ts",
43
+ "style.css"
43
44
  ],
44
45
  "funding": {
45
46
  "type": "github",
@@ -61,8 +62,8 @@
61
62
  "test": "echo \"Error: run tests from root\" && exit 1"
62
63
  },
63
64
  "dependencies": {
64
- "piral-base": "1.8.0-beta.7544",
65
- "piral-debug-utils": "1.8.0-beta.7544",
65
+ "piral-base": "1.8.0-beta.7655",
66
+ "piral-debug-utils": "1.8.0-beta.7655",
66
67
  "zustand": "^3.0.0"
67
68
  },
68
69
  "devDependencies": {
@@ -82,5 +83,5 @@
82
83
  "react-router-dom",
83
84
  "tslib"
84
85
  ],
85
- "gitHead": "007e0558e140cf11ba91b5f30d991ed593c18b60"
86
+ "gitHead": "68e1232fe36c56cf7edaa546389bc635693907bf"
86
87
  }
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ //@ts-ignore
3
+ import { Routes, Route } from 'react-router';
4
+ import { RouteSwitchProps } from '../types';
5
+
6
+ export const DefaultRouteSwitch: React.FC<RouteSwitchProps> = ({ paths, NotFound, ...props }) => {
7
+ return (
8
+ <Routes {...props}>
9
+ {paths.map(({ path, Component }) => (
10
+ //@ts-ignore
11
+ <Route key={path} path={path} element={<Component />} />
12
+ ))}
13
+ {
14
+ //@ts-ignore
15
+ <Route path="*" element={<NotFound />} />
16
+ }
17
+ </Routes>
18
+ );
19
+ };
20
+ DefaultRouteSwitch.displayName = 'DefaultRouteSwitch';
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ //@ts-ignore
3
+ import { BrowserRouter } from 'react-router';
4
+ import { RouterProps } from '../types';
5
+
6
+ export const DefaultRouter: React.FC<RouterProps> = ({ children, publicPath }) => {
7
+ return <BrowserRouter basename={publicPath}>{children}</BrowserRouter>;
8
+ };
9
+ DefaultRouter.displayName = 'DefaultRouter';
@@ -0,0 +1,97 @@
1
+ import * as React from 'react';
2
+ //@ts-ignore
3
+ import { UNSAFE_NavigationContext as RouterContext, Navigate, useLocation } from 'react-router';
4
+ import { NavigationApi } from '../types';
5
+
6
+ let _nav: any;
7
+ const _noop = () => {};
8
+
9
+ export function useRouterContext() {
10
+ return React.useContext(RouterContext);
11
+ }
12
+
13
+ export function useCurrentNavigation() {
14
+ const ctx: any = useRouterContext();
15
+ const location = useLocation();
16
+
17
+ React.useEffect(() => {
18
+ if (_nav) {
19
+ window.dispatchEvent(
20
+ new CustomEvent('piral-navigate', {
21
+ detail: {
22
+ location,
23
+ },
24
+ }),
25
+ );
26
+ }
27
+ }, [location]);
28
+
29
+ React.useEffect(() => {
30
+ _nav = ctx.navigator;
31
+
32
+ return () => {
33
+ _nav = undefined;
34
+ };
35
+ }, []);
36
+ }
37
+
38
+ export function createRedirect(to: string) {
39
+ return () => <Navigate to={to} />;
40
+ }
41
+
42
+ export function createNavigation(publicPath: string): NavigationApi {
43
+ const enhance = (info) => ({
44
+ ...info,
45
+ location: {
46
+ get href() {
47
+ return _nav.createHref(info.location);
48
+ },
49
+ ...info.location,
50
+ },
51
+ });
52
+
53
+ return {
54
+ get path() {
55
+ const loc = _nav ? _nav.location : location;
56
+ return loc.pathname;
57
+ },
58
+ get url() {
59
+ const loc = _nav ? _nav.location : location;
60
+ return `${loc.pathname}${loc.search}${loc.hash}`;
61
+ },
62
+ push(target, state) {
63
+ if (_nav) {
64
+ _nav.push(target, state);
65
+ }
66
+ },
67
+ replace(target, state) {
68
+ if (_nav) {
69
+ _nav.replace(target, state);
70
+ }
71
+ },
72
+ go(n) {
73
+ if (_nav) {
74
+ _nav.go(n);
75
+ }
76
+ },
77
+ block(blocker) {
78
+ if (!_nav) {
79
+ return _noop;
80
+ }
81
+ return _nav.block((transition) => blocker(enhance(transition)));
82
+ },
83
+ listen(listener) {
84
+ const handler = (e: CustomEvent) => listener(enhance(e.detail));
85
+
86
+ window.addEventListener('piral-navigate', handler);
87
+
88
+ return () => {
89
+ window.removeEventListener('piral-navigate', handler);
90
+ };
91
+ },
92
+ get router() {
93
+ return _nav;
94
+ },
95
+ publicPath,
96
+ };
97
+ }
@@ -8,6 +8,9 @@ import { createActions } from '../state';
8
8
  import { renderElement } from './element';
9
9
 
10
10
  vitest.mock('../../app.codegen', () => ({
11
+ applyStyle: vitest.fn(element => {
12
+ element.style.display = 'contents';
13
+ }),
11
14
  createNavigation: vitest.fn(publicPath => ({
12
15
  publicPath,
13
16
  })),
@@ -1,4 +1,5 @@
1
1
  import { ExtensionSlot } from '../components';
2
+ import { applyStyle } from '../../app.codegen';
2
3
  import { Disposable, GlobalStateContext, BaseExtensionSlotProps } from '../types';
3
4
  import {
4
5
  tryParseJson,
@@ -20,8 +21,6 @@ export interface Updatable {
20
21
  }
21
22
 
22
23
  if (typeof window !== 'undefined' && 'customElements' in window) {
23
- const contents = 'contents';
24
-
25
24
  /**
26
25
  * This is a nice abstraction allowing anyone to actually use the extension system
27
26
  * brought by Piral. Not all props of the extension system are actually exposed.
@@ -113,7 +112,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
113
112
  }
114
113
 
115
114
  connectedCallback() {
116
- this.style.display = contents;
115
+ applyStyle(this);
117
116
 
118
117
  if (this.isConnected) {
119
118
  this.dispatchEvent(
@@ -168,7 +167,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
168
167
  */
169
168
  class PiralPortal extends HTMLElement {
170
169
  connectedCallback() {
171
- this.style.display = contents;
170
+ applyStyle(this);
172
171
  }
173
172
  }
174
173
 
@@ -187,7 +186,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
187
186
  */
188
187
  class PiralSlot extends HTMLElement {
189
188
  connectedCallback() {
190
- this.style.display = contents;
189
+ applyStyle(this);
191
190
  }
192
191
  }
193
192
 
@@ -220,7 +219,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
220
219
  static contentAssignments = {};
221
220
 
222
221
  connectedCallback() {
223
- this.style.display = contents;
222
+ applyStyle(this);
224
223
  const cid = this.getAttribute('cid');
225
224
  const content = PiralContent.contentAssignments[cid];
226
225
  const portal = this.closest('piral-portal');
@@ -264,7 +263,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
264
263
  }
265
264
 
266
265
  connectedCallback() {
267
- this.style.display = contents;
266
+ applyStyle(this);
268
267
  this.deferEvent('add-component');
269
268
  }
270
269
 
@@ -86,6 +86,7 @@ interface CodegenOptions {
86
86
  externals: Array<string>;
87
87
  publicPath: string;
88
88
  isolation: 'classic' | 'modern';
89
+ internalStyles: 'inline' | 'sheet' | 'none';
89
90
  debug?: {
90
91
  viewState?: boolean;
91
92
  loadPilets?: boolean;
@@ -97,6 +98,27 @@ interface CodegenOptions {
97
98
  emulator: boolean;
98
99
  }
99
100
 
101
+ export function createBasicAppFunc(imports: Array<string>, exports: Array<string>, opts: CodegenOptions) {
102
+ switch (opts.internalStyles) {
103
+ case 'sheet':
104
+ imports.push(`import 'piral-core/style.css';`);
105
+ // no return - we fall through and also include the dummy applyStyle for "none"
106
+ case 'none':
107
+ exports.push(`
108
+ export function applyStyle(element) {}
109
+ `);
110
+ return;
111
+ case 'inline':
112
+ default:
113
+ exports.push(`
114
+ export function applyStyle(element) {
115
+ element.style.display = 'contents';
116
+ }
117
+ `);
118
+ return;
119
+ }
120
+ }
121
+
100
122
  export function createDependencies(imports: Array<string>, exports: Array<string>, opts: CodegenOptions) {
101
123
  const { root, appName, externals, shared, origin } = opts;
102
124
  const assignments: Array<string> = [];
@@ -142,7 +164,6 @@ export function createDependencies(imports: Array<string>, exports: Array<string
142
164
  if (asyncAssignments.length) {
143
165
  imports.push(`import { registerModule } from 'piral-base'`);
144
166
  assignments.push(...asyncAssignments);
145
-
146
167
  }
147
168
 
148
169
  exports.push(`
@@ -164,17 +185,26 @@ export function createDefaultState(imports: Array<string>, exports: Array<string
164
185
  );
165
186
 
166
187
  if (routerVersion < 6) {
188
+ // React Router v5
167
189
  imports.push(
168
190
  `import { DefaultRouter } from 'piral-core/${cat}/defaults/DefaultRouter_v5.js';`,
169
191
  `import { DefaultRouteSwitch } from 'piral-core/${cat}/defaults/DefaultRouteSwitch_v5.js';`,
170
192
  `import { createRedirect, createNavigation, useCurrentNavigation, useRouterContext } from 'piral-core/${cat}/defaults/navigator_v5.js'`,
171
193
  );
172
- } else {
194
+ } else if (routerVersion === 6) {
195
+ // React Router v6
173
196
  imports.push(
174
197
  `import { DefaultRouter } from 'piral-core/${cat}/defaults/DefaultRouter_v6.js';`,
175
198
  `import { DefaultRouteSwitch } from 'piral-core/${cat}/defaults/DefaultRouteSwitch_v6.js';`,
176
199
  `import { createRedirect, createNavigation, useCurrentNavigation, useRouterContext } from 'piral-core/${cat}/defaults/navigator_v6.js'`,
177
200
  );
201
+ } else {
202
+ // React Router v7
203
+ imports.push(
204
+ `import { DefaultRouter } from 'piral-core/${cat}/defaults/DefaultRouter_v7.js';`,
205
+ `import { DefaultRouteSwitch } from 'piral-core/${cat}/defaults/DefaultRouteSwitch_v7.js';`,
206
+ `import { createRedirect, createNavigation, useCurrentNavigation, useRouterContext } from 'piral-core/${cat}/defaults/navigator_v7.js'`,
207
+ );
178
208
  }
179
209
 
180
210
  exports.push(`
package/style.css ADDED
@@ -0,0 +1,3 @@
1
+ piral-extension, piral-component, piral-content, piral-portal, piral-slot {
2
+ display: contents;
3
+ }