@wordpress/element 6.30.0 → 6.30.1-next.6870dfe5b.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/README.md +10 -14
- package/build/create-interpolate-element.js +28 -53
- package/build/create-interpolate-element.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/platform.js +21 -5
- package/build/platform.js.map +1 -1
- package/build/raw-html.js +4 -2
- package/build/raw-html.js.map +1 -1
- package/build/react-platform.js.map +1 -1
- package/build/react.js +9 -22
- package/build/react.js.map +1 -1
- package/build/serialize.js +36 -89
- package/build/serialize.js.map +1 -1
- package/build/utils.js +2 -2
- package/build/utils.js.map +1 -1
- package/build-module/create-interpolate-element.js +28 -54
- package/build-module/create-interpolate-element.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/platform.js +21 -5
- package/build-module/platform.js.map +1 -1
- package/build-module/raw-html.js +4 -2
- package/build-module/raw-html.js.map +1 -1
- package/build-module/react-platform.js.map +1 -1
- package/build-module/react.js +9 -22
- package/build-module/react.js.map +1 -1
- package/build-module/serialize.js +36 -89
- package/build-module/serialize.js.map +1 -1
- package/build-module/utils.js +2 -2
- package/build-module/utils.js.map +1 -1
- package/build-types/create-interpolate-element.d.ts +8 -42
- package/build-types/create-interpolate-element.d.ts.map +1 -1
- package/build-types/index.d.ts +7 -7
- package/build-types/index.d.ts.map +1 -1
- package/build-types/platform.d.ts +48 -5
- package/build-types/platform.d.ts.map +1 -1
- package/build-types/raw-html.d.ts +7 -5
- package/build-types/raw-html.d.ts.map +1 -1
- package/build-types/react-platform.d.ts +62 -9
- package/build-types/react-platform.d.ts.map +1 -1
- package/build-types/react.d.ts +185 -58
- package/build-types/react.d.ts.map +1 -1
- package/build-types/serialize.d.ts +61 -43
- package/build-types/serialize.d.ts.map +1 -1
- package/build-types/utils.d.ts +7 -1
- package/build-types/utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/{create-interpolate-element.js → create-interpolate-element.ts} +95 -64
- package/src/{platform.js → platform.ts} +27 -4
- package/src/{raw-html.js → raw-html.ts} +11 -3
- package/src/{react.js → react.ts} +40 -37
- package/src/{serialize.js → serialize.ts} +131 -144
- package/src/{utils.js → utils.ts} +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/{index.js → index.ts} +0 -0
- /package/src/{react-platform.js → react-platform.ts} +0 -0
package/build-types/react.d.ts
CHANGED
|
@@ -1,73 +1,200 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* External dependencies
|
|
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';
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Object containing a React element.
|
|
8
|
+
*/
|
|
9
|
+
export type Element = React.ReactElement;
|
|
10
|
+
/**
|
|
11
|
+
* Object containing a React component.
|
|
12
|
+
*/
|
|
13
|
+
export type ComponentType<T = any> = React.ComponentType<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Object containing a React synthetic event.
|
|
16
|
+
*/
|
|
17
|
+
export type SyntheticEvent<T = Element> = React.SyntheticEvent<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Object containing a React ref object.
|
|
20
|
+
*/
|
|
21
|
+
export type RefObject<T> = React.RefObject<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Object containing a React ref callback.
|
|
24
|
+
*/
|
|
25
|
+
export type RefCallback<T> = React.RefCallback<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Object containing a React ref.
|
|
28
|
+
*/
|
|
29
|
+
export type Ref<T> = React.Ref<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Object that provides utilities for dealing with React children.
|
|
32
|
+
*/
|
|
33
|
+
export { Children };
|
|
34
|
+
/**
|
|
35
|
+
* Creates a copy of an element with extended props.
|
|
3
36
|
*
|
|
4
|
-
* @param {
|
|
37
|
+
* @param {Element} element Element
|
|
38
|
+
* @param {?Object} props Props to apply to cloned element
|
|
5
39
|
*
|
|
6
|
-
* @return {
|
|
40
|
+
* @return {Element} Cloned element.
|
|
7
41
|
*/
|
|
8
|
-
export
|
|
42
|
+
export { cloneElement };
|
|
9
43
|
/**
|
|
10
|
-
*
|
|
44
|
+
* A base class to create WordPress Components (Refs, state and lifecycle hooks)
|
|
45
|
+
*/
|
|
46
|
+
export { Component };
|
|
47
|
+
/**
|
|
48
|
+
* Creates a context object containing two components: a provider and consumer.
|
|
11
49
|
*
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {string} nodeName Node name.
|
|
50
|
+
* @param {Object} defaultValue A default data stored in the context.
|
|
14
51
|
*
|
|
15
|
-
* @return {
|
|
52
|
+
* @return {Object} Context object.
|
|
16
53
|
*/
|
|
17
|
-
export
|
|
54
|
+
export { createContext };
|
|
18
55
|
/**
|
|
19
|
-
*
|
|
56
|
+
* Returns a new element of given type. Type can be either a string tag name or
|
|
57
|
+
* another function which itself returns an element.
|
|
58
|
+
*
|
|
59
|
+
* @param {?(string|Function)} type Tag name or element creator
|
|
60
|
+
* @param {Object} props Element properties, either attribute
|
|
61
|
+
* set to apply to DOM node or values to
|
|
62
|
+
* pass through to element creator
|
|
63
|
+
* @param {...Element} children Descendant elements
|
|
64
|
+
*
|
|
65
|
+
* @return {Element} Element.
|
|
20
66
|
*/
|
|
21
|
-
export
|
|
67
|
+
export { createElement };
|
|
22
68
|
/**
|
|
23
|
-
*
|
|
69
|
+
* Returns an object tracking a reference to a rendered element via its
|
|
70
|
+
* `current` property as either a DOMElement or Element, dependent upon the
|
|
71
|
+
* type of element rendered with the ref attribute.
|
|
72
|
+
*
|
|
73
|
+
* @return {Object} Ref object.
|
|
24
74
|
*/
|
|
25
|
-
export
|
|
75
|
+
export { createRef };
|
|
26
76
|
/**
|
|
27
|
-
*
|
|
77
|
+
* Component enhancer used to enable passing a ref to its wrapped component.
|
|
78
|
+
* Pass a function argument which receives `props` and `ref` as its arguments,
|
|
79
|
+
* returning an element using the forwarded ref. The return value is a new
|
|
80
|
+
* component which forwards its ref.
|
|
81
|
+
*
|
|
82
|
+
* @param {Function} forwarder Function passed `props` and `ref`, expected to
|
|
83
|
+
* return an element.
|
|
84
|
+
*
|
|
85
|
+
* @return {Component} Enhanced component.
|
|
86
|
+
*/
|
|
87
|
+
export { forwardRef };
|
|
88
|
+
/**
|
|
89
|
+
* A component which renders its children without any wrapping element.
|
|
90
|
+
*/
|
|
91
|
+
export { Fragment };
|
|
92
|
+
/**
|
|
93
|
+
* Checks if an object is a valid React Element.
|
|
94
|
+
*
|
|
95
|
+
* @param {Object} objectToCheck The object to be checked.
|
|
96
|
+
*
|
|
97
|
+
* @return {boolean} true if objectToTest is a valid React Element and false otherwise.
|
|
98
|
+
*/
|
|
99
|
+
export { isValidElement };
|
|
100
|
+
/**
|
|
101
|
+
* @see https://react.dev/reference/react/memo
|
|
102
|
+
*/
|
|
103
|
+
export { memo };
|
|
104
|
+
/**
|
|
105
|
+
* Component that activates additional checks and warnings for its descendants.
|
|
106
|
+
*/
|
|
107
|
+
export { StrictMode };
|
|
108
|
+
/**
|
|
109
|
+
* @see https://react.dev/reference/react/useCallback
|
|
110
|
+
*/
|
|
111
|
+
export { useCallback };
|
|
112
|
+
/**
|
|
113
|
+
* @see https://react.dev/reference/react/useContext
|
|
114
|
+
*/
|
|
115
|
+
export { useContext };
|
|
116
|
+
/**
|
|
117
|
+
* @see https://react.dev/reference/react/useDebugValue
|
|
118
|
+
*/
|
|
119
|
+
export { useDebugValue };
|
|
120
|
+
/**
|
|
121
|
+
* @see https://react.dev/reference/react/useDeferredValue
|
|
122
|
+
*/
|
|
123
|
+
export { useDeferredValue };
|
|
124
|
+
/**
|
|
125
|
+
* @see https://react.dev/reference/react/useEffect
|
|
126
|
+
*/
|
|
127
|
+
export { useEffect };
|
|
128
|
+
/**
|
|
129
|
+
* @see https://react.dev/reference/react/useId
|
|
130
|
+
*/
|
|
131
|
+
export { useId };
|
|
132
|
+
/**
|
|
133
|
+
* @see https://react.dev/reference/react/useImperativeHandle
|
|
134
|
+
*/
|
|
135
|
+
export { useImperativeHandle };
|
|
136
|
+
/**
|
|
137
|
+
* @see https://react.dev/reference/react/useInsertionEffect
|
|
138
|
+
*/
|
|
139
|
+
export { useInsertionEffect };
|
|
140
|
+
/**
|
|
141
|
+
* @see https://react.dev/reference/react/useLayoutEffect
|
|
142
|
+
*/
|
|
143
|
+
export { useLayoutEffect };
|
|
144
|
+
/**
|
|
145
|
+
* @see https://react.dev/reference/react/useMemo
|
|
146
|
+
*/
|
|
147
|
+
export { useMemo };
|
|
148
|
+
/**
|
|
149
|
+
* @see https://react.dev/reference/react/useReducer
|
|
150
|
+
*/
|
|
151
|
+
export { useReducer };
|
|
152
|
+
/**
|
|
153
|
+
* @see https://react.dev/reference/react/useRef
|
|
154
|
+
*/
|
|
155
|
+
export { useRef };
|
|
156
|
+
/**
|
|
157
|
+
* @see https://react.dev/reference/react/useState
|
|
158
|
+
*/
|
|
159
|
+
export { useState };
|
|
160
|
+
/**
|
|
161
|
+
* @see https://react.dev/reference/react/useSyncExternalStore
|
|
162
|
+
*/
|
|
163
|
+
export { useSyncExternalStore };
|
|
164
|
+
/**
|
|
165
|
+
* @see https://react.dev/reference/react/useTransition
|
|
166
|
+
*/
|
|
167
|
+
export { useTransition };
|
|
168
|
+
/**
|
|
169
|
+
* @see https://react.dev/reference/react/startTransition
|
|
170
|
+
*/
|
|
171
|
+
export { startTransition };
|
|
172
|
+
/**
|
|
173
|
+
* @see https://react.dev/reference/react/lazy
|
|
174
|
+
*/
|
|
175
|
+
export { lazy };
|
|
176
|
+
/**
|
|
177
|
+
* @see https://react.dev/reference/react/Suspense
|
|
178
|
+
*/
|
|
179
|
+
export { Suspense };
|
|
180
|
+
/**
|
|
181
|
+
* @see https://react.dev/reference/react/PureComponent
|
|
182
|
+
*/
|
|
183
|
+
export { PureComponent };
|
|
184
|
+
/**
|
|
185
|
+
* Concatenate two or more React children objects.
|
|
186
|
+
*
|
|
187
|
+
* @param childrenArguments - Array of children arguments (array of arrays/strings/objects) to concatenate.
|
|
188
|
+
* @return The concatenated value.
|
|
189
|
+
*/
|
|
190
|
+
export declare function concatChildren(...childrenArguments: ReactNode[][]): ReactNode[];
|
|
191
|
+
/**
|
|
192
|
+
* Switches the nodeName of all the elements in the children object.
|
|
193
|
+
*
|
|
194
|
+
* @param children Children object.
|
|
195
|
+
* @param nodeName Node name.
|
|
196
|
+
*
|
|
197
|
+
* @return The updated children object.
|
|
28
198
|
*/
|
|
29
|
-
export
|
|
30
|
-
/**
|
|
31
|
-
* <T>
|
|
32
|
-
*/
|
|
33
|
-
export type RefObject<T> = import("react").RefObject<T>;
|
|
34
|
-
/**
|
|
35
|
-
* <T>
|
|
36
|
-
*/
|
|
37
|
-
export type RefCallback<T> = import("react").RefCallback<T>;
|
|
38
|
-
/**
|
|
39
|
-
* <T>
|
|
40
|
-
*/
|
|
41
|
-
export type Ref<T> = import("react").Ref<T>;
|
|
42
|
-
import { Children } from 'react';
|
|
43
|
-
import { cloneElement } from 'react';
|
|
44
|
-
import { Component } from 'react';
|
|
45
|
-
import { createContext } from 'react';
|
|
46
|
-
import { createElement } from 'react';
|
|
47
|
-
import { createRef } from 'react';
|
|
48
|
-
import { forwardRef } from 'react';
|
|
49
|
-
import { Fragment } from 'react';
|
|
50
|
-
import { isValidElement } from 'react';
|
|
51
|
-
import { memo } from 'react';
|
|
52
|
-
import { StrictMode } from 'react';
|
|
53
|
-
import { useCallback } from 'react';
|
|
54
|
-
import { useContext } from 'react';
|
|
55
|
-
import { useDebugValue } from 'react';
|
|
56
|
-
import { useDeferredValue } from 'react';
|
|
57
|
-
import { useEffect } from 'react';
|
|
58
|
-
import { useId } from 'react';
|
|
59
|
-
import { useImperativeHandle } from 'react';
|
|
60
|
-
import { useInsertionEffect } from 'react';
|
|
61
|
-
import { useLayoutEffect } from 'react';
|
|
62
|
-
import { useMemo } from 'react';
|
|
63
|
-
import { useReducer } from 'react';
|
|
64
|
-
import { useRef } from 'react';
|
|
65
|
-
import { useState } from 'react';
|
|
66
|
-
import { useSyncExternalStore } from 'react';
|
|
67
|
-
import { useTransition } from 'react';
|
|
68
|
-
import { startTransition } from 'react';
|
|
69
|
-
import { lazy } from 'react';
|
|
70
|
-
import { Suspense } from 'react';
|
|
71
|
-
import { PureComponent } from 'react';
|
|
72
|
-
export { Children, cloneElement, Component, createContext, createElement, createRef, forwardRef, Fragment, isValidElement, memo, StrictMode, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, startTransition, lazy, Suspense, PureComponent };
|
|
199
|
+
export declare function switchChildrenNodeName(children: ReactNode, nodeName: string): ReactNode;
|
|
73
200
|
//# sourceMappingURL=react.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.
|
|
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,E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
|
+
* released under the MIT license.
|
|
4
|
+
*
|
|
5
|
+
* https://github.com/alt-j/fast-react-render
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2016 Andrey Morozov
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
4
15
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in
|
|
17
|
+
* all copies or substantial portions of the Software.
|
|
7
18
|
*
|
|
8
|
-
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
* THE SOFTWARE.
|
|
9
26
|
*/
|
|
10
|
-
|
|
27
|
+
interface StyleObject {
|
|
28
|
+
[property: string]: string | number | null | undefined;
|
|
29
|
+
}
|
|
30
|
+
interface HTMLProps {
|
|
31
|
+
dangerouslySetInnerHTML?: {
|
|
32
|
+
__html: string;
|
|
33
|
+
};
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
value?: React.ReactNode;
|
|
36
|
+
style?: StyleObject | string;
|
|
37
|
+
className?: string;
|
|
38
|
+
htmlFor?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if the specified string is prefixed by one of an array of
|
|
43
|
+
* possible prefixes.
|
|
44
|
+
* @param string
|
|
45
|
+
* @param prefixes
|
|
46
|
+
*/
|
|
47
|
+
export declare function hasPrefix(string: string, prefixes: string[]): boolean;
|
|
11
48
|
/**
|
|
12
49
|
* Serializes a React element to string.
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param {Object} [legacyContext] Legacy context object.
|
|
17
|
-
*
|
|
18
|
-
* @return {string} Serialized element.
|
|
50
|
+
* @param element
|
|
51
|
+
* @param context
|
|
52
|
+
* @param legacyContext
|
|
19
53
|
*/
|
|
20
|
-
export function renderElement(element:
|
|
54
|
+
export declare function renderElement(element: React.ReactNode, context?: any, legacyContext?: Record<string, any>): string;
|
|
21
55
|
/**
|
|
22
56
|
* Serializes a native component type to string.
|
|
23
|
-
*
|
|
24
|
-
* @param
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param {Object} [context] Context object.
|
|
28
|
-
* @param {Object} [legacyContext] Legacy context object.
|
|
29
|
-
*
|
|
30
|
-
* @return {string} Serialized element.
|
|
57
|
+
* @param type
|
|
58
|
+
* @param props
|
|
59
|
+
* @param context
|
|
60
|
+
* @param legacyContext
|
|
31
61
|
*/
|
|
32
|
-
export function renderNativeComponent(type: string | null, props:
|
|
33
|
-
/** @typedef {import('react').ComponentType} ComponentType */
|
|
62
|
+
export declare function renderNativeComponent(type: string | null, props: HTMLProps, context?: any, legacyContext?: Record<string, any>): string;
|
|
34
63
|
/**
|
|
35
64
|
* Serializes a non-native component type to string.
|
|
36
|
-
*
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param {Object} [legacyContext] Legacy context object.
|
|
41
|
-
*
|
|
42
|
-
* @return {string} Serialized element
|
|
65
|
+
* @param Component
|
|
66
|
+
* @param props
|
|
67
|
+
* @param context
|
|
68
|
+
* @param legacyContext
|
|
43
69
|
*/
|
|
44
|
-
export function renderComponent(Component:
|
|
70
|
+
export declare function renderComponent(Component: React.ComponentClass, props: Record<string, any>, context?: any, legacyContext?: Record<string, any>): string;
|
|
45
71
|
/**
|
|
46
72
|
* Renders a props object as a string of HTML attributes.
|
|
47
|
-
*
|
|
48
|
-
* @param {Object} props Props object.
|
|
49
|
-
*
|
|
50
|
-
* @return {string} Attributes string.
|
|
73
|
+
* @param props
|
|
51
74
|
*/
|
|
52
|
-
export function renderAttributes(props: any): string;
|
|
75
|
+
export declare function renderAttributes(props: Record<string, any>): string;
|
|
53
76
|
/**
|
|
54
77
|
* Renders a style object as a string attribute value.
|
|
55
|
-
*
|
|
56
|
-
* @param {Object} style Style object.
|
|
57
|
-
*
|
|
58
|
-
* @return {string} Style attribute value.
|
|
78
|
+
* @param style
|
|
59
79
|
*/
|
|
60
|
-
export function renderStyle(style:
|
|
80
|
+
export declare function renderStyle(style: StyleObject | string): string | undefined;
|
|
61
81
|
export default renderElement;
|
|
62
|
-
export type ComponentType = import("react").ComponentType;
|
|
63
|
-
export type ReactElement = import("react").ReactElement;
|
|
64
82
|
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.
|
|
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;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|
package/build-types/utils.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided WP element is empty.
|
|
3
|
+
*
|
|
4
|
+
* @param element WP element to check.
|
|
5
|
+
* @return True when an element is considered empty.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isEmptyElement: (element: unknown) => boolean;
|
|
2
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YAAc,OAAO,KAAI,OAUnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/element",
|
|
3
|
-
"version": "6.30.0",
|
|
3
|
+
"version": "6.30.1-next.6870dfe5b.0",
|
|
4
4
|
"description": "Element React module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@babel/runtime": "7.25.7",
|
|
34
34
|
"@types/react": "^18.2.79",
|
|
35
35
|
"@types/react-dom": "^18.2.25",
|
|
36
|
-
"@wordpress/escape-html": "^3.30.0",
|
|
36
|
+
"@wordpress/escape-html": "^3.30.1-next.6870dfe5b.0",
|
|
37
37
|
"change-case": "^4.1.2",
|
|
38
38
|
"is-plain-object": "^5.0.0",
|
|
39
39
|
"react": "^18.3.0",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "c8637da9df499cd7b6b07c9fad918f6d45f4de3d"
|
|
46
46
|
}
|