@wordpress/element 6.45.1-next.v.202605131032.0 → 7.0.0
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 +14 -0
- package/README.md +146 -26
- package/build/find-dom-node.cjs +99 -0
- package/build/find-dom-node.cjs.map +7 -0
- package/build/index.cjs +3 -0
- package/build/index.cjs.map +2 -2
- package/build/react-platform.cjs +14 -8
- package/build/react-platform.cjs.map +2 -2
- package/build/react.cjs +10 -0
- package/build/react.cjs.map +2 -2
- package/build/serialize.cjs +3 -1
- package/build/serialize.cjs.map +2 -2
- package/build-module/find-dom-node.mjs +68 -0
- package/build-module/find-dom-node.mjs.map +7 -0
- package/build-module/index.mjs +2 -0
- package/build-module/index.mjs.map +2 -2
- package/build-module/react-platform.mjs +14 -8
- package/build-module/react-platform.mjs.map +2 -2
- package/build-module/react.mjs +10 -0
- package/build-module/react.mjs.map +2 -2
- package/build-module/serialize.mjs +3 -1
- package/build-module/serialize.mjs.map +2 -2
- package/build-types/find-dom-node.d.ts +10 -0
- package/build-types/find-dom-node.d.ts.map +1 -0
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/raw-html.d.ts +25 -11
- package/build-types/raw-html.d.ts.map +1 -1
- package/build-types/react-platform.d.ts +44 -22
- package/build-types/react-platform.d.ts.map +1 -1
- package/build-types/react.d.ts +36 -1
- package/build-types/react.d.ts.map +1 -1
- package/build-types/serialize.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/find-dom-node.ts +92 -0
- package/src/index.ts +1 -0
- package/src/react-platform.ts +54 -28
- package/src/react.ts +48 -1
- package/src/serialize.ts +3 -1
- package/src/test/find-dom-node.js +109 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the DOM node of a React component instance.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated since WordPress 7.1.0. Use DOM refs instead.
|
|
5
|
+
* @see https://react.dev/reference/react-dom/findDOMNode
|
|
6
|
+
*
|
|
7
|
+
* @param instance Component's instance.
|
|
8
|
+
*/
|
|
9
|
+
export default function findDOMNode(instance: any): Element | Text | null;
|
|
10
|
+
//# sourceMappingURL=find-dom-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-dom-node.d.ts","sourceRoot":"","sources":["../src/find-dom-node.ts"],"names":[],"mappings":"AAuDA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,QAAQ,EAAE,GAAG,GAAI,OAAO,GAAG,IAAI,GAAG,IAAI,CA4B1E"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export * from './utils';
|
|
|
5
5
|
export { default as Platform } from './platform';
|
|
6
6
|
export { default as renderToString } from './serialize';
|
|
7
7
|
export { default as RawHTML } from './raw-html';
|
|
8
|
+
export { default as findDOMNode } from './find-dom-node';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACnF,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACnF,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -43,18 +43,18 @@ export default function RawHTML({ children, ...props }: RawHTMLProps): import("r
|
|
|
43
43
|
onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
44
44
|
onBlur?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
45
45
|
onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement>;
|
|
46
|
-
onChange?: import("react").
|
|
47
|
-
onChangeCapture?: import("react").
|
|
46
|
+
onChange?: import("react").ChangeEventHandler<HTMLDivElement, Element>;
|
|
47
|
+
onChangeCapture?: import("react").ChangeEventHandler<HTMLDivElement, Element>;
|
|
48
48
|
onBeforeInput?: import("react").InputEventHandler<HTMLDivElement>;
|
|
49
|
-
onBeforeInputCapture?: import("react").
|
|
50
|
-
onInput?: import("react").
|
|
51
|
-
onInputCapture?: import("react").
|
|
52
|
-
onReset?: import("react").
|
|
53
|
-
onResetCapture?: import("react").
|
|
54
|
-
onSubmit?: import("react").
|
|
55
|
-
onSubmitCapture?: import("react").
|
|
56
|
-
onInvalid?: import("react").
|
|
57
|
-
onInvalidCapture?: import("react").
|
|
49
|
+
onBeforeInputCapture?: import("react").InputEventHandler<HTMLDivElement>;
|
|
50
|
+
onInput?: import("react").InputEventHandler<HTMLDivElement>;
|
|
51
|
+
onInputCapture?: import("react").InputEventHandler<HTMLDivElement>;
|
|
52
|
+
onReset?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
53
|
+
onResetCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
54
|
+
onSubmit?: import("react").SubmitEventHandler<HTMLDivElement>;
|
|
55
|
+
onSubmitCapture?: import("react").SubmitEventHandler<HTMLDivElement>;
|
|
56
|
+
onInvalid?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
57
|
+
onInvalidCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
58
58
|
onLoad?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
59
59
|
onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
60
60
|
onError?: import("react").ReactEventHandler<HTMLDivElement>;
|
|
@@ -175,6 +175,8 @@ export default function RawHTML({ children, ...props }: RawHTMLProps): import("r
|
|
|
175
175
|
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement>;
|
|
176
176
|
onScroll?: import("react").UIEventHandler<HTMLDivElement>;
|
|
177
177
|
onScrollCapture?: import("react").UIEventHandler<HTMLDivElement>;
|
|
178
|
+
onScrollEnd?: import("react").UIEventHandler<HTMLDivElement>;
|
|
179
|
+
onScrollEndCapture?: import("react").UIEventHandler<HTMLDivElement>;
|
|
178
180
|
onWheel?: import("react").WheelEventHandler<HTMLDivElement>;
|
|
179
181
|
onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement>;
|
|
180
182
|
onAnimationStart?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
@@ -183,8 +185,16 @@ export default function RawHTML({ children, ...props }: RawHTMLProps): import("r
|
|
|
183
185
|
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
184
186
|
onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
185
187
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement>;
|
|
188
|
+
onToggle?: import("react").ToggleEventHandler<HTMLDivElement>;
|
|
189
|
+
onBeforeToggle?: import("react").ToggleEventHandler<HTMLDivElement>;
|
|
190
|
+
onTransitionCancel?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
191
|
+
onTransitionCancelCapture?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
186
192
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
187
193
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
194
|
+
onTransitionRun?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
195
|
+
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
196
|
+
onTransitionStart?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
197
|
+
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLDivElement>;
|
|
188
198
|
"aria-activedescendant"?: string | undefined;
|
|
189
199
|
"aria-atomic"?: ("false" | "true" | boolean) | undefined;
|
|
190
200
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -285,6 +295,10 @@ export default function RawHTML({ children, ...props }: RawHTMLProps): import("r
|
|
|
285
295
|
results?: number | undefined;
|
|
286
296
|
security?: string | undefined;
|
|
287
297
|
unselectable?: "on" | "off" | undefined;
|
|
298
|
+
popover?: "" | "auto" | "manual" | "hint" | undefined;
|
|
299
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
|
|
300
|
+
popoverTarget?: string | undefined;
|
|
301
|
+
inert?: boolean | undefined;
|
|
288
302
|
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
|
|
289
303
|
is?: string | undefined;
|
|
290
304
|
exportparts?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw-html.d.ts","sourceRoot":"","sources":["../src/raw-html.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,GAAG,KAAK,CAAC,wBAAwB,CAAE,KAAK,CAAE,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY
|
|
1
|
+
{"version":3,"file":"raw-html.d.ts","sourceRoot":"","sources":["../src/raw-html.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B,GAAG,KAAK,CAAC,wBAAwB,CAAE,KAAK,CAAE,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAgBpE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { createPortal,
|
|
4
|
+
import { createPortal, flushSync, preconnect, prefetchDNS, preinit, preinitModule, preload, preloadModule, useFormStatus } from 'react-dom';
|
|
5
5
|
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
6
6
|
/**
|
|
7
7
|
* Creates a portal into which a component can be rendered.
|
|
@@ -13,12 +13,6 @@ import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
|
13
13
|
* @param {HTMLElement} container DOM node into which element should be rendered.
|
|
14
14
|
*/
|
|
15
15
|
export { createPortal };
|
|
16
|
-
/**
|
|
17
|
-
* Finds the dom node of a React component.
|
|
18
|
-
*
|
|
19
|
-
* @param {React.ComponentType} component Component's instance.
|
|
20
|
-
*/
|
|
21
|
-
export { findDOMNode };
|
|
22
16
|
/**
|
|
23
17
|
* Forces React to flush any updates inside the provided callback synchronously.
|
|
24
18
|
*
|
|
@@ -26,19 +20,54 @@ export { findDOMNode };
|
|
|
26
20
|
*/
|
|
27
21
|
export { flushSync };
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
23
|
+
* Eagerly connect to a server that you expect to load resources from.
|
|
24
|
+
*
|
|
25
|
+
* @since 7.1.0
|
|
26
|
+
* @see https://react.dev/reference/react-dom/preconnect
|
|
27
|
+
*/
|
|
28
|
+
export { preconnect };
|
|
29
|
+
/**
|
|
30
|
+
* Eagerly look up the IP of a server that you expect to load resources from.
|
|
30
31
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @see https://react.dev/reference/react-dom/
|
|
32
|
+
* @since 7.1.0
|
|
33
|
+
* @see https://react.dev/reference/react-dom/prefetchDNS
|
|
33
34
|
*/
|
|
34
|
-
export {
|
|
35
|
+
export { prefetchDNS };
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* Eagerly fetch and evaluate a stylesheet or external script.
|
|
37
38
|
*
|
|
38
|
-
* @
|
|
39
|
-
* @see https://react.dev/reference/react-dom/
|
|
39
|
+
* @since 7.1.0
|
|
40
|
+
* @see https://react.dev/reference/react-dom/preinit
|
|
40
41
|
*/
|
|
41
|
-
export {
|
|
42
|
+
export { preinit };
|
|
43
|
+
/**
|
|
44
|
+
* Eagerly fetch and evaluate an ESM module.
|
|
45
|
+
*
|
|
46
|
+
* @since 7.1.0
|
|
47
|
+
* @see https://react.dev/reference/react-dom/preinitModule
|
|
48
|
+
*/
|
|
49
|
+
export { preinitModule };
|
|
50
|
+
/**
|
|
51
|
+
* Eagerly fetch a resource such as a stylesheet, font, or external script.
|
|
52
|
+
*
|
|
53
|
+
* @since 7.1.0
|
|
54
|
+
* @see https://react.dev/reference/react-dom/preload
|
|
55
|
+
*/
|
|
56
|
+
export { preload };
|
|
57
|
+
/**
|
|
58
|
+
* Eagerly fetch an ESM module that you expect to use.
|
|
59
|
+
*
|
|
60
|
+
* @since 7.1.0
|
|
61
|
+
* @see https://react.dev/reference/react-dom/preloadModule
|
|
62
|
+
*/
|
|
63
|
+
export { preloadModule };
|
|
64
|
+
/**
|
|
65
|
+
* Read the status information of the parent form.
|
|
66
|
+
*
|
|
67
|
+
* @since 7.1.0
|
|
68
|
+
* @see https://react.dev/reference/react-dom/hooks/useFormStatus
|
|
69
|
+
*/
|
|
70
|
+
export { useFormStatus };
|
|
42
71
|
/**
|
|
43
72
|
* Creates a new React root for the target DOM node.
|
|
44
73
|
*
|
|
@@ -53,11 +82,4 @@ export { createRoot };
|
|
|
53
82
|
* @see https://react.dev/reference/react-dom/client/hydrateRoot
|
|
54
83
|
*/
|
|
55
84
|
export { hydrateRoot };
|
|
56
|
-
/**
|
|
57
|
-
* Removes any mounted element from the target DOM node.
|
|
58
|
-
*
|
|
59
|
-
* @deprecated since WordPress 6.2.0. Use `root.unmount()` instead.
|
|
60
|
-
* @see https://react.dev/reference/react-dom/unmountComponentAtNode
|
|
61
|
-
*/
|
|
62
|
-
export { unmountComponentAtNode };
|
|
63
85
|
//# sourceMappingURL=react-platform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-platform.d.ts","sourceRoot":"","sources":["../src/react-platform.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACN,YAAY,EACZ,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"react-platform.d.ts","sourceRoot":"","sources":["../src/react-platform.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACN,YAAY,EACZ,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/build-types/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Children, cloneElement, Component, createContext, createElement, createRef, forwardRef, Fragment, isValidElement, memo, PureComponent, StrictMode, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useMemo, useImperativeHandle, useInsertionEffect, useLayoutEffect, useReducer, useRef, useState, useSyncExternalStore, useTransition, startTransition, lazy, Suspense } from 'react';
|
|
4
|
+
import { Activity, Children, cloneElement, Component, createContext, createElement, createRef, forwardRef, Fragment, isValidElement, memo, PureComponent, StrictMode, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useEffectEvent, useId, useMemo, useImperativeHandle, useInsertionEffect, useLayoutEffect, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, startTransition, lazy, Suspense } from 'react';
|
|
5
5
|
import type { ReactNode } from 'react';
|
|
6
6
|
/**
|
|
7
7
|
* Object containing a React element.
|
|
@@ -27,6 +27,13 @@ export type RefCallback<T> = React.RefCallback<T>;
|
|
|
27
27
|
* Object containing a React ref.
|
|
28
28
|
*/
|
|
29
29
|
export type Ref<T> = React.Ref<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Hide and show parts of the UI while preserving state.
|
|
32
|
+
*
|
|
33
|
+
* @since 7.1.0
|
|
34
|
+
* @see https://react.dev/reference/react/Activity
|
|
35
|
+
*/
|
|
36
|
+
export { Activity };
|
|
30
37
|
/**
|
|
31
38
|
* Object that provides utilities for dealing with React children.
|
|
32
39
|
*/
|
|
@@ -105,6 +112,20 @@ export { memo };
|
|
|
105
112
|
* Component that activates additional checks and warnings for its descendants.
|
|
106
113
|
*/
|
|
107
114
|
export { StrictMode };
|
|
115
|
+
/**
|
|
116
|
+
* Read the value of a resource like a Promise or context.
|
|
117
|
+
*
|
|
118
|
+
* @since 7.1.0
|
|
119
|
+
* @see https://react.dev/reference/react/use
|
|
120
|
+
*/
|
|
121
|
+
export { use };
|
|
122
|
+
/**
|
|
123
|
+
* Manage state based on the result of a form action.
|
|
124
|
+
*
|
|
125
|
+
* @since 7.1.0
|
|
126
|
+
* @see https://react.dev/reference/react/useActionState
|
|
127
|
+
*/
|
|
128
|
+
export { useActionState };
|
|
108
129
|
/**
|
|
109
130
|
* @see https://react.dev/reference/react/useCallback
|
|
110
131
|
*/
|
|
@@ -125,6 +146,13 @@ export { useDeferredValue };
|
|
|
125
146
|
* @see https://react.dev/reference/react/useEffect
|
|
126
147
|
*/
|
|
127
148
|
export { useEffect };
|
|
149
|
+
/**
|
|
150
|
+
* Extract non-reactive logic from an Effect into an Effect Event.
|
|
151
|
+
*
|
|
152
|
+
* @since 7.1.0
|
|
153
|
+
* @see https://react.dev/reference/react/useEffectEvent
|
|
154
|
+
*/
|
|
155
|
+
export { useEffectEvent };
|
|
128
156
|
/**
|
|
129
157
|
* @see https://react.dev/reference/react/useId
|
|
130
158
|
*/
|
|
@@ -145,6 +173,13 @@ export { useLayoutEffect };
|
|
|
145
173
|
* @see https://react.dev/reference/react/useMemo
|
|
146
174
|
*/
|
|
147
175
|
export { useMemo };
|
|
176
|
+
/**
|
|
177
|
+
* Show a different state while an async action is underway.
|
|
178
|
+
*
|
|
179
|
+
* @since 7.1.0
|
|
180
|
+
* @see https://react.dev/reference/react/useOptimistic
|
|
181
|
+
*/
|
|
182
|
+
export { useOptimistic };
|
|
148
183
|
/**
|
|
149
184
|
* @see https://react.dev/reference/react/useReducer
|
|
150
185
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,SAAS,EACT,UAAU,EACV,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,aAAa,EACb,UAAU,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,OAAO,EACP,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,MAAM,EACN,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,aAAa,CAAE,CAAC,GAAG,GAAG,IAAK,KAAK,CAAC,aAAa,CAAE,CAAC,CAAE,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,cAAc,CAAE,CAAC,GAAG,OAAO,IAAK,KAAK,CAAC,cAAc,CAAE,CAAC,CAAE,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,SAAS,CAAE,CAAC,IAAK,KAAK,CAAC,SAAS,CAAE,CAAC,CAAE,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,WAAW,CA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jC,SAAS,EAAE,CAiBb;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,MAAM,GACd,SAAS,CAqBX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAsCH,UAAU,WAAW;IACpB,CAAE,QAAQ,EAAE,MAAM,GAAI,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACzD;AAED,UAAU,SAAS;IAClB,uBAAuB,CAAC,EAAE;QACzB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAE,GAAG,EAAE,MAAM,GAAI,GAAG,CAAC;CACrB;AAmLD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAI,OAAO,CAEvE;AAgSD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,OAAO,CAAC,EAAE,GAAG,EACb,aAAa,GAAE,MAAM,CAAE,MAAM,EAAE,GAAG,CAAO,GACvC,MAAM,
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAsCH,UAAU,WAAW;IACpB,CAAE,QAAQ,EAAE,MAAM,GAAI,MAAM,GAAG,MAAM,GAAG,IAAI,G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BAAgB,WAAW,CAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAI,MAAM,GAAG,SAAS,CA2B7E;eAEc,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/element",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Element React module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -45,16 +45,17 @@
|
|
|
45
45
|
"types": "build-types",
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@types/react": "^
|
|
49
|
-
"@types/react-dom": "^
|
|
50
|
-
"@wordpress/
|
|
48
|
+
"@types/react": "^19.2.13",
|
|
49
|
+
"@types/react-dom": "^19.2.3",
|
|
50
|
+
"@wordpress/deprecated": "^4.47.0",
|
|
51
|
+
"@wordpress/escape-html": "^3.47.0",
|
|
51
52
|
"change-case": "^4.1.2",
|
|
52
53
|
"is-plain-object": "^5.0.0",
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
54
|
+
"react": "^19.2.4",
|
|
55
|
+
"react-dom": "^19.2.4"
|
|
55
56
|
},
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "d653c5fd6161571a0c2ebde28553d6e25624eacc"
|
|
60
61
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import deprecated from '@wordpress/deprecated';
|
|
2
|
+
|
|
3
|
+
const internalsKey = '_reactInternals';
|
|
4
|
+
|
|
5
|
+
// HostComponent fiber tag, represents a DOM element like <div>.
|
|
6
|
+
const HostComponent = 5;
|
|
7
|
+
const HostText = 6;
|
|
8
|
+
|
|
9
|
+
function findCurrentFiber( fiber: any ): any {
|
|
10
|
+
if ( ! fiber.alternate ) {
|
|
11
|
+
// First mount — only one version exists, and it's current.
|
|
12
|
+
return fiber;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Walk up to the HostRoot to figure out which tree this fiber is on.
|
|
16
|
+
let node = fiber;
|
|
17
|
+
while ( node.return ) {
|
|
18
|
+
node = node.return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// The root's stateNode.current points to the current tree's root fiber.
|
|
22
|
+
if ( node.stateNode.current === node ) {
|
|
23
|
+
// We walked up the current tree, so `fiber` is already current.
|
|
24
|
+
return fiber;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// We walked up the alternate tree — switch to the current version.
|
|
28
|
+
return fiber.alternate;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function findHostFiber( fiber: any ): any {
|
|
32
|
+
const current = findCurrentFiber( fiber );
|
|
33
|
+
if ( ! current ) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return findHostFiberImpl( current );
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function findHostFiberImpl( fiber: any ): any {
|
|
40
|
+
if ( fiber.tag === HostComponent || fiber.tag === HostText ) {
|
|
41
|
+
return fiber;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let child = fiber.child;
|
|
45
|
+
while ( child ) {
|
|
46
|
+
const hostFiber = findHostFiberImpl( child );
|
|
47
|
+
if ( hostFiber ) {
|
|
48
|
+
return hostFiber;
|
|
49
|
+
}
|
|
50
|
+
child = child.sibling;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Finds the DOM node of a React component instance.
|
|
58
|
+
*
|
|
59
|
+
* @deprecated since WordPress 7.1.0. Use DOM refs instead.
|
|
60
|
+
* @see https://react.dev/reference/react-dom/findDOMNode
|
|
61
|
+
*
|
|
62
|
+
* @param instance Component's instance.
|
|
63
|
+
*/
|
|
64
|
+
export default function findDOMNode( instance: any ): Element | Text | null {
|
|
65
|
+
deprecated( 'wp.element.findDOMNode', {
|
|
66
|
+
since: '7.1',
|
|
67
|
+
alternative: 'DOM refs',
|
|
68
|
+
link: 'https://react.dev/reference/react-dom/findDOMNode',
|
|
69
|
+
} );
|
|
70
|
+
|
|
71
|
+
if ( instance === null || instance === undefined ) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if ( instance.nodeType !== undefined ) {
|
|
76
|
+
return instance as Element | Text;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const fiber = instance[ internalsKey ];
|
|
80
|
+
if ( fiber === undefined ) {
|
|
81
|
+
if ( typeof instance.render === 'function' ) {
|
|
82
|
+
throw new Error( 'Unable to find node on an unmounted component.' );
|
|
83
|
+
}
|
|
84
|
+
const keys = Object.keys( instance ).join( ',' );
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Argument appears to not be a ReactComponent. Keys: ${ keys }`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const hostFiber = findHostFiber( fiber );
|
|
91
|
+
return hostFiber?.stateNode ?? null;
|
|
92
|
+
}
|
package/src/index.ts
CHANGED
package/src/react-platform.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
createPortal,
|
|
6
|
-
findDOMNode,
|
|
7
6
|
flushSync,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
preconnect,
|
|
8
|
+
prefetchDNS,
|
|
9
|
+
preinit,
|
|
10
|
+
preinitModule,
|
|
11
|
+
preload,
|
|
12
|
+
preloadModule,
|
|
13
|
+
useFormStatus,
|
|
13
14
|
} from 'react-dom';
|
|
14
15
|
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
15
16
|
|
|
@@ -25,34 +26,67 @@ import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
|
25
26
|
export { createPortal };
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Forces React to flush any updates inside the provided callback synchronously.
|
|
29
30
|
*
|
|
30
|
-
* @param {
|
|
31
|
+
* @param {Function} callback Callback to run synchronously.
|
|
31
32
|
*/
|
|
32
|
-
export {
|
|
33
|
+
export { flushSync };
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* Eagerly connect to a server that you expect to load resources from.
|
|
36
37
|
*
|
|
37
|
-
* @
|
|
38
|
+
* @since 7.1.0
|
|
39
|
+
* @see https://react.dev/reference/react-dom/preconnect
|
|
38
40
|
*/
|
|
39
|
-
export {
|
|
41
|
+
export { preconnect };
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Eagerly look up the IP of a server that you expect to load resources from.
|
|
45
|
+
*
|
|
46
|
+
* @since 7.1.0
|
|
47
|
+
* @see https://react.dev/reference/react-dom/prefetchDNS
|
|
48
|
+
*/
|
|
49
|
+
export { prefetchDNS };
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Eagerly fetch and evaluate a stylesheet or external script.
|
|
53
|
+
*
|
|
54
|
+
* @since 7.1.0
|
|
55
|
+
* @see https://react.dev/reference/react-dom/preinit
|
|
56
|
+
*/
|
|
57
|
+
export { preinit };
|
|
40
58
|
|
|
41
59
|
/**
|
|
42
|
-
*
|
|
60
|
+
* Eagerly fetch and evaluate an ESM module.
|
|
43
61
|
*
|
|
44
|
-
* @
|
|
45
|
-
* @see https://react.dev/reference/react-dom/
|
|
62
|
+
* @since 7.1.0
|
|
63
|
+
* @see https://react.dev/reference/react-dom/preinitModule
|
|
46
64
|
*/
|
|
47
|
-
export {
|
|
65
|
+
export { preinitModule };
|
|
48
66
|
|
|
49
67
|
/**
|
|
50
|
-
*
|
|
68
|
+
* Eagerly fetch a resource such as a stylesheet, font, or external script.
|
|
51
69
|
*
|
|
52
|
-
* @
|
|
53
|
-
* @see https://react.dev/reference/react-dom/
|
|
70
|
+
* @since 7.1.0
|
|
71
|
+
* @see https://react.dev/reference/react-dom/preload
|
|
54
72
|
*/
|
|
55
|
-
export {
|
|
73
|
+
export { preload };
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Eagerly fetch an ESM module that you expect to use.
|
|
77
|
+
*
|
|
78
|
+
* @since 7.1.0
|
|
79
|
+
* @see https://react.dev/reference/react-dom/preloadModule
|
|
80
|
+
*/
|
|
81
|
+
export { preloadModule };
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Read the status information of the parent form.
|
|
85
|
+
*
|
|
86
|
+
* @since 7.1.0
|
|
87
|
+
* @see https://react.dev/reference/react-dom/hooks/useFormStatus
|
|
88
|
+
*/
|
|
89
|
+
export { useFormStatus };
|
|
56
90
|
|
|
57
91
|
/**
|
|
58
92
|
* Creates a new React root for the target DOM node.
|
|
@@ -69,11 +103,3 @@ export { createRoot };
|
|
|
69
103
|
* @see https://react.dev/reference/react-dom/client/hydrateRoot
|
|
70
104
|
*/
|
|
71
105
|
export { hydrateRoot };
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Removes any mounted element from the target DOM node.
|
|
75
|
-
*
|
|
76
|
-
* @deprecated since WordPress 6.2.0. Use `root.unmount()` instead.
|
|
77
|
-
* @see https://react.dev/reference/react-dom/unmountComponentAtNode
|
|
78
|
-
*/
|
|
79
|
-
export { unmountComponentAtNode };
|
package/src/react.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
5
5
|
import {
|
|
6
|
+
Activity,
|
|
6
7
|
Children,
|
|
7
8
|
cloneElement,
|
|
8
9
|
Component,
|
|
@@ -15,16 +16,20 @@ import {
|
|
|
15
16
|
memo,
|
|
16
17
|
PureComponent,
|
|
17
18
|
StrictMode,
|
|
19
|
+
use,
|
|
20
|
+
useActionState,
|
|
18
21
|
useCallback,
|
|
19
22
|
useContext,
|
|
20
23
|
useDebugValue,
|
|
21
24
|
useDeferredValue,
|
|
22
25
|
useEffect,
|
|
26
|
+
useEffectEvent,
|
|
23
27
|
useId,
|
|
24
28
|
useMemo,
|
|
25
29
|
useImperativeHandle,
|
|
26
30
|
useInsertionEffect,
|
|
27
31
|
useLayoutEffect,
|
|
32
|
+
useOptimistic,
|
|
28
33
|
useReducer,
|
|
29
34
|
useRef,
|
|
30
35
|
useState,
|
|
@@ -66,6 +71,14 @@ export type RefCallback< T > = React.RefCallback< T >;
|
|
|
66
71
|
*/
|
|
67
72
|
export type Ref< T > = React.Ref< T >;
|
|
68
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Hide and show parts of the UI while preserving state.
|
|
76
|
+
*
|
|
77
|
+
* @since 7.1.0
|
|
78
|
+
* @see https://react.dev/reference/react/Activity
|
|
79
|
+
*/
|
|
80
|
+
export { Activity };
|
|
81
|
+
|
|
69
82
|
/**
|
|
70
83
|
* Object that provides utilities for dealing with React children.
|
|
71
84
|
*/
|
|
@@ -155,6 +168,22 @@ export { memo };
|
|
|
155
168
|
*/
|
|
156
169
|
export { StrictMode };
|
|
157
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Read the value of a resource like a Promise or context.
|
|
173
|
+
*
|
|
174
|
+
* @since 7.1.0
|
|
175
|
+
* @see https://react.dev/reference/react/use
|
|
176
|
+
*/
|
|
177
|
+
export { use };
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Manage state based on the result of a form action.
|
|
181
|
+
*
|
|
182
|
+
* @since 7.1.0
|
|
183
|
+
* @see https://react.dev/reference/react/useActionState
|
|
184
|
+
*/
|
|
185
|
+
export { useActionState };
|
|
186
|
+
|
|
158
187
|
/**
|
|
159
188
|
* @see https://react.dev/reference/react/useCallback
|
|
160
189
|
*/
|
|
@@ -180,6 +209,14 @@ export { useDeferredValue };
|
|
|
180
209
|
*/
|
|
181
210
|
export { useEffect };
|
|
182
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Extract non-reactive logic from an Effect into an Effect Event.
|
|
214
|
+
*
|
|
215
|
+
* @since 7.1.0
|
|
216
|
+
* @see https://react.dev/reference/react/useEffectEvent
|
|
217
|
+
*/
|
|
218
|
+
export { useEffectEvent };
|
|
219
|
+
|
|
183
220
|
/**
|
|
184
221
|
* @see https://react.dev/reference/react/useId
|
|
185
222
|
*/
|
|
@@ -205,6 +242,14 @@ export { useLayoutEffect };
|
|
|
205
242
|
*/
|
|
206
243
|
export { useMemo };
|
|
207
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Show a different state while an async action is underway.
|
|
247
|
+
*
|
|
248
|
+
* @since 7.1.0
|
|
249
|
+
* @see https://react.dev/reference/react/useOptimistic
|
|
250
|
+
*/
|
|
251
|
+
export { useOptimistic };
|
|
252
|
+
|
|
208
253
|
/**
|
|
209
254
|
* @see https://react.dev/reference/react/useReducer
|
|
210
255
|
*/
|
|
@@ -299,7 +344,9 @@ export function switchChildrenNodeName(
|
|
|
299
344
|
return elt;
|
|
300
345
|
}
|
|
301
346
|
|
|
302
|
-
const { children: childrenProp, ...props } =
|
|
347
|
+
const { children: childrenProp, ...props } = (
|
|
348
|
+
elt as React.ReactElement< React.PropsWithChildren< unknown > >
|
|
349
|
+
).props;
|
|
303
350
|
return createElement(
|
|
304
351
|
nodeName,
|
|
305
352
|
{ key: index, ...props },
|
package/src/serialize.ts
CHANGED
|
@@ -626,7 +626,9 @@ export function renderElement(
|
|
|
626
626
|
|
|
627
627
|
case Consumer.$$typeof:
|
|
628
628
|
return renderElement(
|
|
629
|
-
props.children(
|
|
629
|
+
props.children(
|
|
630
|
+
context || type._currentValue || type._context._currentValue
|
|
631
|
+
),
|
|
630
632
|
context,
|
|
631
633
|
legacyContext
|
|
632
634
|
);
|