@lynx-js/react 0.123.2 → 0.123.3
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/runtime/lib/snapshot/lynx/portals.d.ts +25 -3
- package/runtime/lib/snapshot/lynx/portals.js +24 -1
- package/runtime/lib/snapshot/lynx/portals.js.map +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -1
- package/testing-library/dist/env/index.js +32 -19
- package/testing-library/dist/pure.js +1 -1
- package/testing-library/dist/rstest-config.js +1 -1
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +20 -24
- /package/testing-library/dist/{0-@rstest/adapter-rsbuild.js → @rstest/adapter-rsbuild~0.js} +0 -0
- /package/testing-library/dist/{0-rslib-runtime.js → rslib-runtime-0.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lynx-js/react
|
|
2
2
|
|
|
3
|
+
## 0.123.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Type `createPortal` as returning `ReactNode` instead of Preact's `VNode<any> | null`, matching the rest of the public surface, and document its behavioral contract. ([#3348](https://github.com/lynx-family/lynx-stack/pull/3348))
|
|
8
|
+
|
|
3
9
|
## 0.123.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
import type { ComponentChild
|
|
1
|
+
import type { ComponentChild } from 'preact';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
2
3
|
import type { NodesRef } from '@lynx-js/types';
|
|
3
4
|
export { clearPendingPortalInsertBefore } from './portalsPending.js';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Renders `vnode` into `container` instead of the current component's position
|
|
7
|
+
* in the element tree, while keeping it in the React tree.
|
|
8
|
+
*
|
|
9
|
+
* `container` is a `NodesRef`, obtained either from a callback `ref` or from
|
|
10
|
+
* `lynx.createSelectorQuery().select(...)`.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Context still flows across the portal boundary, and state updates inside the
|
|
14
|
+
* portal behave like they do in any other component. A few behaviors differ
|
|
15
|
+
* from `react-dom`:
|
|
16
|
+
*
|
|
17
|
+
* - Events do not bubble along the React tree. ReactLynx follows Preact's
|
|
18
|
+
* approach, which has no synthetic event system, so events follow the actual
|
|
19
|
+
* element structure of the page.
|
|
20
|
+
* - The portaled subtree renders on the background thread only, and does not
|
|
21
|
+
* participate in main-thread first-screen rendering.
|
|
22
|
+
* - Mounting across pages or across native containers is not supported.
|
|
23
|
+
*
|
|
24
|
+
* @param vnode - The React node to render into `container`.
|
|
25
|
+
* @param container - The `NodesRef` target to render into.
|
|
26
|
+
* @returns A `ReactNode` placeholder to include in the JSX at the call site;
|
|
27
|
+
* the rendered output goes into `container`.
|
|
6
28
|
*
|
|
7
29
|
* @public
|
|
8
30
|
*/
|
|
9
|
-
export declare function createPortal(vnode: ComponentChild, container: NodesRef):
|
|
31
|
+
export declare function createPortal(vnode: ComponentChild, container: NodesRef): ReactNode;
|
|
@@ -99,7 +99,28 @@ function Portal(props) {
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Renders `vnode` into `container` instead of the current component's position
|
|
103
|
+
* in the element tree, while keeping it in the React tree.
|
|
104
|
+
*
|
|
105
|
+
* `container` is a `NodesRef`, obtained either from a callback `ref` or from
|
|
106
|
+
* `lynx.createSelectorQuery().select(...)`.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* Context still flows across the portal boundary, and state updates inside the
|
|
110
|
+
* portal behave like they do in any other component. A few behaviors differ
|
|
111
|
+
* from `react-dom`:
|
|
112
|
+
*
|
|
113
|
+
* - Events do not bubble along the React tree. ReactLynx follows Preact's
|
|
114
|
+
* approach, which has no synthetic event system, so events follow the actual
|
|
115
|
+
* element structure of the page.
|
|
116
|
+
* - The portaled subtree renders on the background thread only, and does not
|
|
117
|
+
* participate in main-thread first-screen rendering.
|
|
118
|
+
* - Mounting across pages or across native containers is not supported.
|
|
119
|
+
*
|
|
120
|
+
* @param vnode - The React node to render into `container`.
|
|
121
|
+
* @param container - The `NodesRef` target to render into.
|
|
122
|
+
* @returns A `ReactNode` placeholder to include in the JSX at the call site;
|
|
123
|
+
* the rendered output goes into `container`.
|
|
103
124
|
*
|
|
104
125
|
* @public
|
|
105
126
|
*/
|
|
@@ -115,6 +136,8 @@ export function createPortal(vnode, container) {
|
|
|
115
136
|
_container: container,
|
|
116
137
|
});
|
|
117
138
|
el.containerInfo = container;
|
|
139
|
+
// preact's `VNode` and React's `ReactNode` describe the same runtime value
|
|
140
|
+
// here; the public signature speaks React types like the rest of the surface.
|
|
118
141
|
return el;
|
|
119
142
|
}
|
|
120
143
|
//# sourceMappingURL=portals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portals.js","sourceRoot":"","sources":["../../../src/snapshot/lynx/portals.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"portals.js","sourceRoot":"","sources":["../../../src/snapshot/lynx/portals.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yEAAyE;AACzE,0DAA0D;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAM/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,EAAE,yCAAyC,EAAE,MAAM,mCAA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