piral-core 0.15.0-beta.4574 → 0.15.0-beta.4630
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.codegen +4 -0
- package/esm/components/wrapComponent.js +3 -2
- package/esm/components/wrapComponent.js.map +1 -1
- package/esm/types/navigation.d.ts +4 -0
- package/lib/components/wrapComponent.js +2 -1
- package/lib/components/wrapComponent.js.map +1 -1
- package/lib/types/navigation.d.ts +4 -0
- package/package.json +4 -4
- package/src/components/ExtensionSlot.test.tsx +3 -0
- package/src/components/wrapComponent.tsx +3 -2
- package/src/state/withApi.test.tsx +3 -0
- package/src/types/navigation.ts +4 -0
package/app.codegen
CHANGED
|
@@ -120,6 +120,9 @@ function createDefaultState(imports, exports) {
|
|
|
120
120
|
}
|
|
121
121
|
return _nav.listen((location, action) => listener(enhance({ location, action })));
|
|
122
122
|
},
|
|
123
|
+
router: {
|
|
124
|
+
history: _nav,
|
|
125
|
+
},
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
128
|
`);
|
|
@@ -182,6 +185,7 @@ function createDefaultState(imports, exports) {
|
|
|
182
185
|
}
|
|
183
186
|
return _nav.listen(update => listener(enhance(update)));
|
|
184
187
|
},
|
|
188
|
+
router: _nav,
|
|
185
189
|
};
|
|
186
190
|
}
|
|
187
191
|
`);
|
|
@@ -3,7 +3,7 @@ import { PortalRenderer } from './PortalRenderer';
|
|
|
3
3
|
import { ForeignComponentContainer } from './ForeignComponentContainer';
|
|
4
4
|
import { useGlobalStateContext } from '../hooks';
|
|
5
5
|
import { convertComponent, none } from '../utils';
|
|
6
|
-
import { publicPath } from '../../app.codegen';
|
|
6
|
+
import { publicPath, } from '../../app.codegen';
|
|
7
7
|
// this is an arbitrary start number to have 6 digits
|
|
8
8
|
let portalIdBase = 123456;
|
|
9
9
|
function wrapReactComponent(Component, captured, Wrapper) {
|
|
@@ -14,7 +14,8 @@ function wrapForeignComponent(component, captured, Wrapper) {
|
|
|
14
14
|
return React.memo((props) => {
|
|
15
15
|
const { destroyPortal, navigation } = useGlobalStateContext();
|
|
16
16
|
const id = React.useMemo(() => (portalIdBase++).toString(26), none);
|
|
17
|
-
|
|
17
|
+
// router added for backwards compatibility
|
|
18
|
+
const context = React.useMemo(() => ({ publicPath, navigation, router: navigation.router }), []);
|
|
18
19
|
const innerProps = React.useMemo(() => (Object.assign(Object.assign({}, props), captured)), [props]);
|
|
19
20
|
React.useEffect(() => () => destroyPortal(id), none);
|
|
20
21
|
return (React.createElement(Wrapper, Object.assign({}, props),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapComponent.js","sourceRoot":"","sources":["../../src/components/wrapComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"wrapComponent.js","sourceRoot":"","sources":["../../src/components/wrapComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,GAAG,MAAM,mBAAmB,CAAC;AAGhD,qDAAqD;AACrD,IAAI,YAAY,GAAG,MAAM,CAAC;AAM1B,SAAS,kBAAkB,CACzB,SAAsD,EACtD,QAAuB,E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,CAAC,QAAQ,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,UAAuD,EACvD,SAA+C,EAC/C,QAAuB,EACvB,OAAoB;IAEpB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,6CAA6C,CAAC,CAAC;QACtE,2CAA2C;QAC3C,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;KACxB;IAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE;QAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,oBAAoB,CAAI,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;KAC3D;IAED,OAAO,kBAAkB,CAAI,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -17,7 +17,8 @@ function wrapForeignComponent(component, captured, Wrapper) {
|
|
|
17
17
|
return React.memo((props) => {
|
|
18
18
|
const { destroyPortal, navigation } = (0, hooks_1.useGlobalStateContext)();
|
|
19
19
|
const id = React.useMemo(() => (portalIdBase++).toString(26), utils_1.none);
|
|
20
|
-
|
|
20
|
+
// router added for backwards compatibility
|
|
21
|
+
const context = React.useMemo(() => ({ publicPath: app_codegen_1.publicPath, navigation, router: navigation.router }), []);
|
|
21
22
|
const innerProps = React.useMemo(() => (Object.assign(Object.assign({}, props), captured)), [props]);
|
|
22
23
|
React.useEffect(() => () => destroyPortal(id), utils_1.none);
|
|
23
24
|
return (React.createElement(Wrapper, Object.assign({}, props),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapComponent.js","sourceRoot":"","sources":["../../src/components/wrapComponent.tsx"],"names":[],"mappings":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description": "The core library for creating a Piral instance.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"piral-base": "0.15.0-beta.
|
|
74
|
-
"piral-debug-utils": "0.15.0-beta.
|
|
73
|
+
"piral-base": "0.15.0-beta.4630",
|
|
74
|
+
"piral-debug-utils": "0.15.0-beta.4630",
|
|
75
75
|
"zustand": "^3.0.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"react-router-dom",
|
|
98
98
|
"tslib"
|
|
99
99
|
],
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "08aea96af9587e73b1a6c4eb108f94f285186b10"
|
|
101
101
|
}
|
|
@@ -3,7 +3,7 @@ import { PortalRenderer } from './PortalRenderer';
|
|
|
3
3
|
import { ForeignComponentContainer } from './ForeignComponentContainer';
|
|
4
4
|
import { useGlobalStateContext } from '../hooks';
|
|
5
5
|
import { convertComponent, none } from '../utils';
|
|
6
|
-
import { publicPath } from '../../app.codegen';
|
|
6
|
+
import { publicPath, } from '../../app.codegen';
|
|
7
7
|
import type { AnyComponent, ComponentConverters, ForeignComponent, PiletApi, BaseComponentProps } from '../types';
|
|
8
8
|
|
|
9
9
|
// this is an arbitrary start number to have 6 digits
|
|
@@ -33,7 +33,8 @@ function wrapForeignComponent<T>(
|
|
|
33
33
|
return React.memo((props: T) => {
|
|
34
34
|
const { destroyPortal, navigation } = useGlobalStateContext();
|
|
35
35
|
const id = React.useMemo(() => (portalIdBase++).toString(26), none);
|
|
36
|
-
|
|
36
|
+
// router added for backwards compatibility
|
|
37
|
+
const context = React.useMemo(() => ({ publicPath, navigation, router: navigation.router }), []);
|
|
37
38
|
const innerProps = React.useMemo(() => ({ ...props, ...captured }), [props]);
|
|
38
39
|
|
|
39
40
|
React.useEffect(() => () => destroyPortal(id), none);
|
package/src/types/navigation.ts
CHANGED