@wordpress/element 6.32.0 → 6.32.1-next.47f435fc9.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.
Files changed (45) hide show
  1. package/build/create-interpolate-element.js +79 -183
  2. package/build/create-interpolate-element.js.map +7 -1
  3. package/build/index.js +52 -74
  4. package/build/index.js.map +7 -1
  5. package/build/platform.android.js +29 -16
  6. package/build/platform.android.js.map +7 -1
  7. package/build/platform.ios.js +29 -16
  8. package/build/platform.ios.js.map +7 -1
  9. package/build/platform.js +25 -40
  10. package/build/platform.js.map +7 -1
  11. package/build/raw-html.js +28 -47
  12. package/build/raw-html.js.map +7 -1
  13. package/build/react-platform.js +43 -55
  14. package/build/react-platform.js.map +7 -1
  15. package/build/react.js +114 -411
  16. package/build/react.js.map +7 -1
  17. package/build/serialize.js +418 -325
  18. package/build/serialize.js.map +7 -1
  19. package/build/utils.js +29 -15
  20. package/build/utils.js.map +7 -1
  21. package/build-module/create-interpolate-element.js +63 -175
  22. package/build-module/create-interpolate-element.js.map +7 -1
  23. package/build-module/index.js +14 -8
  24. package/build-module/index.js.map +7 -1
  25. package/build-module/platform.android.js +10 -10
  26. package/build-module/platform.android.js.map +7 -1
  27. package/build-module/platform.ios.js +10 -10
  28. package/build-module/platform.ios.js.map +7 -1
  29. package/build-module/platform.js +7 -36
  30. package/build-module/platform.js.map +7 -1
  31. package/build-module/raw-html.js +11 -44
  32. package/build-module/raw-html.js.map +7 -1
  33. package/build-module/react-platform.js +20 -71
  34. package/build-module/react-platform.js.map +7 -1
  35. package/build-module/react.js +91 -255
  36. package/build-module/react.js.map +7 -1
  37. package/build-module/serialize.js +382 -311
  38. package/build-module/serialize.js.map +7 -1
  39. package/build-module/utils.js +7 -10
  40. package/build-module/utils.js.map +7 -1
  41. package/package.json +11 -4
  42. package/build/react-platform.native.js +0 -22
  43. package/build/react-platform.native.js.map +0 -1
  44. package/build-module/react-platform.native.js +0 -15
  45. package/build-module/react-platform.native.js.map +0 -1
@@ -1,263 +1,99 @@
1
- /**
2
- * External dependencies
3
- */
4
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
5
- 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';
6
-
7
- /**
8
- * Object containing a React element.
9
- */
10
-
11
- /**
12
- * Object containing a React component.
13
- */
14
-
15
- /**
16
- * Object containing a React synthetic event.
17
- */
18
-
19
- /**
20
- * Object containing a React ref object.
21
- */
22
-
23
- /**
24
- * Object containing a React ref callback.
25
- */
26
-
27
- /**
28
- * Object containing a React ref.
29
- */
30
-
31
- /**
32
- * Object that provides utilities for dealing with React children.
33
- */
34
- export { Children };
35
-
36
- /**
37
- * Creates a copy of an element with extended props.
38
- *
39
- * @param {Element} element Element
40
- * @param {?Object} props Props to apply to cloned element
41
- *
42
- * @return {Element} Cloned element.
43
- */
44
- export { cloneElement };
45
-
46
- /**
47
- * A base class to create WordPress Components (Refs, state and lifecycle hooks)
48
- */
49
- export { Component };
50
-
51
- /**
52
- * Creates a context object containing two components: a provider and consumer.
53
- *
54
- * @param {Object} defaultValue A default data stored in the context.
55
- *
56
- * @return {Object} Context object.
57
- */
58
- export { createContext };
59
-
60
- /**
61
- * Returns a new element of given type. Type can be either a string tag name or
62
- * another function which itself returns an element.
63
- *
64
- * @param {?(string|Function)} type Tag name or element creator
65
- * @param {Object} props Element properties, either attribute
66
- * set to apply to DOM node or values to
67
- * pass through to element creator
68
- * @param {...Element} children Descendant elements
69
- *
70
- * @return {Element} Element.
71
- */
72
- export { createElement };
73
-
74
- /**
75
- * Returns an object tracking a reference to a rendered element via its
76
- * `current` property as either a DOMElement or Element, dependent upon the
77
- * type of element rendered with the ref attribute.
78
- *
79
- * @return {Object} Ref object.
80
- */
81
- export { createRef };
82
-
83
- /**
84
- * Component enhancer used to enable passing a ref to its wrapped component.
85
- * Pass a function argument which receives `props` and `ref` as its arguments,
86
- * returning an element using the forwarded ref. The return value is a new
87
- * component which forwards its ref.
88
- *
89
- * @param {Function} forwarder Function passed `props` and `ref`, expected to
90
- * return an element.
91
- *
92
- * @return {Component} Enhanced component.
93
- */
94
- export { forwardRef };
95
-
96
- /**
97
- * A component which renders its children without any wrapping element.
98
- */
99
- export { Fragment };
100
-
101
- /**
102
- * Checks if an object is a valid React Element.
103
- *
104
- * @param {Object} objectToCheck The object to be checked.
105
- *
106
- * @return {boolean} true if objectToTest is a valid React Element and false otherwise.
107
- */
108
- export { isValidElement };
109
-
110
- /**
111
- * @see https://react.dev/reference/react/memo
112
- */
113
- export { memo };
114
-
115
- /**
116
- * Component that activates additional checks and warnings for its descendants.
117
- */
118
- export { StrictMode };
119
-
120
- /**
121
- * @see https://react.dev/reference/react/useCallback
122
- */
123
- export { useCallback };
124
-
125
- /**
126
- * @see https://react.dev/reference/react/useContext
127
- */
128
- export { useContext };
129
-
130
- /**
131
- * @see https://react.dev/reference/react/useDebugValue
132
- */
133
- export { useDebugValue };
134
-
135
- /**
136
- * @see https://react.dev/reference/react/useDeferredValue
137
- */
138
- export { useDeferredValue };
139
-
140
- /**
141
- * @see https://react.dev/reference/react/useEffect
142
- */
143
- export { useEffect };
144
-
145
- /**
146
- * @see https://react.dev/reference/react/useId
147
- */
148
- export { useId };
149
-
150
- /**
151
- * @see https://react.dev/reference/react/useImperativeHandle
152
- */
153
- export { useImperativeHandle };
154
-
155
- /**
156
- * @see https://react.dev/reference/react/useInsertionEffect
157
- */
158
- export { useInsertionEffect };
159
-
160
- /**
161
- * @see https://react.dev/reference/react/useLayoutEffect
162
- */
163
- export { useLayoutEffect };
164
-
165
- /**
166
- * @see https://react.dev/reference/react/useMemo
167
- */
168
- export { useMemo };
169
-
170
- /**
171
- * @see https://react.dev/reference/react/useReducer
172
- */
173
- export { useReducer };
174
-
175
- /**
176
- * @see https://react.dev/reference/react/useRef
177
- */
178
- export { useRef };
179
-
180
- /**
181
- * @see https://react.dev/reference/react/useState
182
- */
183
- export { useState };
184
-
185
- /**
186
- * @see https://react.dev/reference/react/useSyncExternalStore
187
- */
188
- export { useSyncExternalStore };
189
-
190
- /**
191
- * @see https://react.dev/reference/react/useTransition
192
- */
193
- export { useTransition };
194
-
195
- /**
196
- * @see https://react.dev/reference/react/startTransition
197
- */
198
- export { startTransition };
199
-
200
- /**
201
- * @see https://react.dev/reference/react/lazy
202
- */
203
- export { lazy };
204
-
205
- /**
206
- * @see https://react.dev/reference/react/Suspense
207
- */
208
- export { Suspense };
209
-
210
- /**
211
- * @see https://react.dev/reference/react/PureComponent
212
- */
213
- export { PureComponent };
214
-
215
- /**
216
- * Concatenate two or more React children objects.
217
- *
218
- * @param childrenArguments - Array of children arguments (array of arrays/strings/objects) to concatenate.
219
- * @return The concatenated value.
220
- */
221
- export function concatChildren(...childrenArguments) {
222
- return childrenArguments.reduce((accumulator, children, i) => {
223
- Children.forEach(children, (child, j) => {
224
- if (isValidElement(child) && typeof child !== 'string') {
225
- child = cloneElement(child, {
226
- key: [i, j].join()
227
- });
228
- }
229
- accumulator.push(child);
230
- });
231
- return accumulator;
232
- }, []);
1
+ import {
2
+ Children,
3
+ cloneElement,
4
+ Component,
5
+ createContext,
6
+ createElement,
7
+ createRef,
8
+ forwardRef,
9
+ Fragment,
10
+ isValidElement,
11
+ memo,
12
+ PureComponent,
13
+ StrictMode,
14
+ useCallback,
15
+ useContext,
16
+ useDebugValue,
17
+ useDeferredValue,
18
+ useEffect,
19
+ useId,
20
+ useMemo,
21
+ useImperativeHandle,
22
+ useInsertionEffect,
23
+ useLayoutEffect,
24
+ useReducer,
25
+ useRef,
26
+ useState,
27
+ useSyncExternalStore,
28
+ useTransition,
29
+ startTransition,
30
+ lazy,
31
+ Suspense
32
+ } from "react";
33
+ function concatChildren(...childrenArguments) {
34
+ return childrenArguments.reduce(
35
+ (accumulator, children, i) => {
36
+ Children.forEach(children, (child, j) => {
37
+ if (isValidElement(child) && typeof child !== "string") {
38
+ child = cloneElement(child, {
39
+ key: [i, j].join()
40
+ });
41
+ }
42
+ accumulator.push(child);
43
+ });
44
+ return accumulator;
45
+ },
46
+ []
47
+ );
233
48
  }
234
-
235
- /**
236
- * Switches the nodeName of all the elements in the children object.
237
- *
238
- * @param children Children object.
239
- * @param nodeName Node name.
240
- *
241
- * @return The updated children object.
242
- */
243
- export function switchChildrenNodeName(children, nodeName) {
49
+ function switchChildrenNodeName(children, nodeName) {
244
50
  return children && Children.map(children, (elt, index) => {
245
- if (typeof elt?.valueOf() === 'string') {
246
- return createElement(nodeName, {
247
- key: index
248
- }, elt);
51
+ if (typeof elt?.valueOf() === "string") {
52
+ return createElement(nodeName, { key: index }, elt);
249
53
  }
250
54
  if (!isValidElement(elt)) {
251
55
  return elt;
252
56
  }
253
- const {
254
- children: childrenProp,
255
- ...props
256
- } = elt.props;
257
- return createElement(nodeName, {
258
- key: index,
259
- ...props
260
- }, childrenProp);
57
+ const { children: childrenProp, ...props } = elt.props;
58
+ return createElement(
59
+ nodeName,
60
+ { key: index, ...props },
61
+ childrenProp
62
+ );
261
63
  });
262
64
  }
263
- //# sourceMappingURL=react.js.map
65
+ export {
66
+ Children,
67
+ Component,
68
+ Fragment,
69
+ PureComponent,
70
+ StrictMode,
71
+ Suspense,
72
+ cloneElement,
73
+ concatChildren,
74
+ createContext,
75
+ createElement,
76
+ createRef,
77
+ forwardRef,
78
+ isValidElement,
79
+ lazy,
80
+ memo,
81
+ startTransition,
82
+ switchChildrenNodeName,
83
+ useCallback,
84
+ useContext,
85
+ useDebugValue,
86
+ useDeferredValue,
87
+ useEffect,
88
+ useId,
89
+ useImperativeHandle,
90
+ useInsertionEffect,
91
+ useLayoutEffect,
92
+ useMemo,
93
+ useReducer,
94
+ useRef,
95
+ useState,
96
+ useSyncExternalStore,
97
+ useTransition
98
+ };
99
+ //# sourceMappingURL=react.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["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","concatChildren","childrenArguments","reduce","accumulator","children","i","forEach","child","j","key","join","push","switchChildrenNodeName","nodeName","map","elt","index","valueOf","childrenProp","props"],"sources":["@wordpress/element/src/react.ts"],"sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport {\n\tChildren,\n\tcloneElement,\n\tComponent,\n\tcreateContext,\n\tcreateElement,\n\tcreateRef,\n\tforwardRef,\n\tFragment,\n\tisValidElement,\n\tmemo,\n\tPureComponent,\n\tStrictMode,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tuseDeferredValue,\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\tuseImperativeHandle,\n\tuseInsertionEffect,\n\tuseLayoutEffect,\n\tuseReducer,\n\tuseRef,\n\tuseState,\n\tuseSyncExternalStore,\n\tuseTransition,\n\tstartTransition,\n\tlazy,\n\tSuspense,\n} from 'react';\nimport type { ReactNode } from 'react';\n\n/**\n * Object containing a React element.\n */\nexport type Element = React.ReactElement;\n\n/**\n * Object containing a React component.\n */\nexport type ComponentType< T = any > = React.ComponentType< T >;\n\n/**\n * Object containing a React synthetic event.\n */\nexport type SyntheticEvent< T = Element > = React.SyntheticEvent< T >;\n\n/**\n * Object containing a React ref object.\n */\nexport type RefObject< T > = React.RefObject< T >;\n\n/**\n * Object containing a React ref callback.\n */\nexport type RefCallback< T > = React.RefCallback< T >;\n\n/**\n * Object containing a React ref.\n */\nexport type Ref< T > = React.Ref< T >;\n\n/**\n * Object that provides utilities for dealing with React children.\n */\nexport { Children };\n\n/**\n * Creates a copy of an element with extended props.\n *\n * @param {Element} element Element\n * @param {?Object} props Props to apply to cloned element\n *\n * @return {Element} Cloned element.\n */\nexport { cloneElement };\n\n/**\n * A base class to create WordPress Components (Refs, state and lifecycle hooks)\n */\nexport { Component };\n\n/**\n * Creates a context object containing two components: a provider and consumer.\n *\n * @param {Object} defaultValue A default data stored in the context.\n *\n * @return {Object} Context object.\n */\nexport { createContext };\n\n/**\n * Returns a new element of given type. Type can be either a string tag name or\n * another function which itself returns an element.\n *\n * @param {?(string|Function)} type Tag name or element creator\n * @param {Object} props Element properties, either attribute\n * set to apply to DOM node or values to\n * pass through to element creator\n * @param {...Element} children Descendant elements\n *\n * @return {Element} Element.\n */\nexport { createElement };\n\n/**\n * Returns an object tracking a reference to a rendered element via its\n * `current` property as either a DOMElement or Element, dependent upon the\n * type of element rendered with the ref attribute.\n *\n * @return {Object} Ref object.\n */\nexport { createRef };\n\n/**\n * Component enhancer used to enable passing a ref to its wrapped component.\n * Pass a function argument which receives `props` and `ref` as its arguments,\n * returning an element using the forwarded ref. The return value is a new\n * component which forwards its ref.\n *\n * @param {Function} forwarder Function passed `props` and `ref`, expected to\n * return an element.\n *\n * @return {Component} Enhanced component.\n */\nexport { forwardRef };\n\n/**\n * A component which renders its children without any wrapping element.\n */\nexport { Fragment };\n\n/**\n * Checks if an object is a valid React Element.\n *\n * @param {Object} objectToCheck The object to be checked.\n *\n * @return {boolean} true if objectToTest is a valid React Element and false otherwise.\n */\nexport { isValidElement };\n\n/**\n * @see https://react.dev/reference/react/memo\n */\nexport { memo };\n\n/**\n * Component that activates additional checks and warnings for its descendants.\n */\nexport { StrictMode };\n\n/**\n * @see https://react.dev/reference/react/useCallback\n */\nexport { useCallback };\n\n/**\n * @see https://react.dev/reference/react/useContext\n */\nexport { useContext };\n\n/**\n * @see https://react.dev/reference/react/useDebugValue\n */\nexport { useDebugValue };\n\n/**\n * @see https://react.dev/reference/react/useDeferredValue\n */\nexport { useDeferredValue };\n\n/**\n * @see https://react.dev/reference/react/useEffect\n */\nexport { useEffect };\n\n/**\n * @see https://react.dev/reference/react/useId\n */\nexport { useId };\n\n/**\n * @see https://react.dev/reference/react/useImperativeHandle\n */\nexport { useImperativeHandle };\n\n/**\n * @see https://react.dev/reference/react/useInsertionEffect\n */\nexport { useInsertionEffect };\n\n/**\n * @see https://react.dev/reference/react/useLayoutEffect\n */\nexport { useLayoutEffect };\n\n/**\n * @see https://react.dev/reference/react/useMemo\n */\nexport { useMemo };\n\n/**\n * @see https://react.dev/reference/react/useReducer\n */\nexport { useReducer };\n\n/**\n * @see https://react.dev/reference/react/useRef\n */\nexport { useRef };\n\n/**\n * @see https://react.dev/reference/react/useState\n */\nexport { useState };\n\n/**\n * @see https://react.dev/reference/react/useSyncExternalStore\n */\nexport { useSyncExternalStore };\n\n/**\n * @see https://react.dev/reference/react/useTransition\n */\nexport { useTransition };\n\n/**\n * @see https://react.dev/reference/react/startTransition\n */\nexport { startTransition };\n\n/**\n * @see https://react.dev/reference/react/lazy\n */\nexport { lazy };\n\n/**\n * @see https://react.dev/reference/react/Suspense\n */\nexport { Suspense };\n\n/**\n * @see https://react.dev/reference/react/PureComponent\n */\nexport { PureComponent };\n\n/**\n * Concatenate two or more React children objects.\n *\n * @param childrenArguments - Array of children arguments (array of arrays/strings/objects) to concatenate.\n * @return The concatenated value.\n */\nexport function concatChildren(\n\t...childrenArguments: ReactNode[][]\n): ReactNode[] {\n\treturn childrenArguments.reduce< ReactNode[] >(\n\t\t( accumulator, children, i ) => {\n\t\t\tChildren.forEach( children, ( child, j ) => {\n\t\t\t\tif ( isValidElement( child ) && typeof child !== 'string' ) {\n\t\t\t\t\tchild = cloneElement( child, {\n\t\t\t\t\t\tkey: [ i, j ].join(),\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\taccumulator.push( child );\n\t\t\t} );\n\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Switches the nodeName of all the elements in the children object.\n *\n * @param children Children object.\n * @param nodeName Node name.\n *\n * @return The updated children object.\n */\nexport function switchChildrenNodeName(\n\tchildren: ReactNode,\n\tnodeName: string\n): ReactNode {\n\treturn (\n\t\tchildren &&\n\t\tChildren.map( children, ( elt, index ) => {\n\t\t\tif ( typeof elt?.valueOf() === 'string' ) {\n\t\t\t\treturn createElement( nodeName, { key: index }, elt );\n\t\t\t}\n\t\t\tif ( ! isValidElement( elt ) ) {\n\t\t\t\treturn elt;\n\t\t\t}\n\n\t\t\tconst { children: childrenProp, ...props } = elt.props;\n\t\t\treturn createElement(\n\t\t\t\tnodeName,\n\t\t\t\t{ key: index, ...props },\n\t\t\t\tchildrenProp\n\t\t\t);\n\t\t} )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,aAAa,EACbC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,gBAAgB,EAChBC,SAAS,EACTC,KAAK,EACLC,OAAO,EACPC,mBAAmB,EACnBC,kBAAkB,EAClBC,eAAe,EACfC,UAAU,EACVC,MAAM,EACNC,QAAQ,EACRC,oBAAoB,EACpBC,aAAa,EACbC,eAAe,EACfC,IAAI,EACJC,QAAQ,QACF,OAAO;;AAGd;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAAS7B,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,YAAY;;AAErB;AACA;AACA;AACA,SAASC,SAAS;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAAS;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAU;;AAEnB;AACA;AACA;AACA,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAc;;AAEvB;AACA;AACA;AACA,SAASC,IAAI;;AAEb;AACA;AACA;AACA,SAASE,UAAU;;AAEnB;AACA;AACA;AACA,SAASC,WAAW;;AAEpB;AACA;AACA;AACA,SAASC,UAAU;;AAEnB;AACA;AACA;AACA,SAASC,aAAa;;AAEtB;AACA;AACA;AACA,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA,SAASC,SAAS;;AAElB;AACA;AACA;AACA,SAASC,KAAK;;AAEd;AACA;AACA;AACA,SAASE,mBAAmB;;AAE5B;AACA;AACA;AACA,SAASC,kBAAkB;;AAE3B;AACA;AACA;AACA,SAASC,eAAe;;AAExB;AACA;AACA;AACA,SAASH,OAAO;;AAEhB;AACA;AACA;AACA,SAASI,UAAU;;AAEnB;AACA;AACA;AACA,SAASC,MAAM;;AAEf;AACA;AACA;AACA,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA,SAASC,oBAAoB;;AAE7B;AACA;AACA;AACA,SAASC,aAAa;;AAEtB;AACA;AACA;AACA,SAASC,eAAe;;AAExB;AACA;AACA;AACA,SAASC,IAAI;;AAEb;AACA;AACA;AACA,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA,SAASnB,aAAa;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASoB,cAAcA,CAC7B,GAAGC,iBAAgC,EACrB;EACd,OAAOA,iBAAiB,CAACC,MAAM,CAC9B,CAAEC,WAAW,EAAEC,QAAQ,EAAEC,CAAC,KAAM;IAC/BnC,QAAQ,CAACoC,OAAO,CAAEF,QAAQ,EAAE,CAAEG,KAAK,EAAEC,CAAC,KAAM;MAC3C,IAAK9B,cAAc,CAAE6B,KAAM,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAG;QAC3DA,KAAK,GAAGpC,YAAY,CAAEoC,KAAK,EAAE;UAC5BE,GAAG,EAAE,CAAEJ,CAAC,EAAEG,CAAC,CAAE,CAACE,IAAI,CAAC;QACpB,CAAE,CAAC;MACJ;MAEAP,WAAW,CAACQ,IAAI,CAAEJ,KAAM,CAAC;IAC1B,CAAE,CAAC;IAEH,OAAOJ,WAAW;EACnB,CAAC,EACD,EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,sBAAsBA,CACrCR,QAAmB,EACnBS,QAAgB,EACJ;EACZ,OACCT,QAAQ,IACRlC,QAAQ,CAAC4C,GAAG,CAAEV,QAAQ,EAAE,CAAEW,GAAG,EAAEC,KAAK,KAAM;IACzC,IAAK,OAAOD,GAAG,EAAEE,OAAO,CAAC,CAAC,KAAK,QAAQ,EAAG;MACzC,OAAO3C,aAAa,CAAEuC,QAAQ,EAAE;QAAEJ,GAAG,EAAEO;MAAM,CAAC,EAAED,GAAI,CAAC;IACtD;IACA,IAAK,CAAErC,cAAc,CAAEqC,GAAI,CAAC,EAAG;MAC9B,OAAOA,GAAG;IACX;IAEA,MAAM;MAAEX,QAAQ,EAAEc,YAAY;MAAE,GAAGC;IAAM,CAAC,GAAGJ,GAAG,CAACI,KAAK;IACtD,OAAO7C,aAAa,CACnBuC,QAAQ,EACR;MAAEJ,GAAG,EAAEO,KAAK;MAAE,GAAGG;IAAM,CAAC,EACxBD,YACD,CAAC;EACF,CAAE,CAAC;AAEL","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/react.ts"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport {\n\tChildren,\n\tcloneElement,\n\tComponent,\n\tcreateContext,\n\tcreateElement,\n\tcreateRef,\n\tforwardRef,\n\tFragment,\n\tisValidElement,\n\tmemo,\n\tPureComponent,\n\tStrictMode,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tuseDeferredValue,\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\tuseImperativeHandle,\n\tuseInsertionEffect,\n\tuseLayoutEffect,\n\tuseReducer,\n\tuseRef,\n\tuseState,\n\tuseSyncExternalStore,\n\tuseTransition,\n\tstartTransition,\n\tlazy,\n\tSuspense,\n} from 'react';\nimport type { ReactNode } from 'react';\n\n/**\n * Object containing a React element.\n */\nexport type Element = React.ReactElement;\n\n/**\n * Object containing a React component.\n */\nexport type ComponentType< T = any > = React.ComponentType< T >;\n\n/**\n * Object containing a React synthetic event.\n */\nexport type SyntheticEvent< T = Element > = React.SyntheticEvent< T >;\n\n/**\n * Object containing a React ref object.\n */\nexport type RefObject< T > = React.RefObject< T >;\n\n/**\n * Object containing a React ref callback.\n */\nexport type RefCallback< T > = React.RefCallback< T >;\n\n/**\n * Object containing a React ref.\n */\nexport type Ref< T > = React.Ref< T >;\n\n/**\n * Object that provides utilities for dealing with React children.\n */\nexport { Children };\n\n/**\n * Creates a copy of an element with extended props.\n *\n * @param {Element} element Element\n * @param {?Object} props Props to apply to cloned element\n *\n * @return {Element} Cloned element.\n */\nexport { cloneElement };\n\n/**\n * A base class to create WordPress Components (Refs, state and lifecycle hooks)\n */\nexport { Component };\n\n/**\n * Creates a context object containing two components: a provider and consumer.\n *\n * @param {Object} defaultValue A default data stored in the context.\n *\n * @return {Object} Context object.\n */\nexport { createContext };\n\n/**\n * Returns a new element of given type. Type can be either a string tag name or\n * another function which itself returns an element.\n *\n * @param {?(string|Function)} type Tag name or element creator\n * @param {Object} props Element properties, either attribute\n * set to apply to DOM node or values to\n * pass through to element creator\n * @param {...Element} children Descendant elements\n *\n * @return {Element} Element.\n */\nexport { createElement };\n\n/**\n * Returns an object tracking a reference to a rendered element via its\n * `current` property as either a DOMElement or Element, dependent upon the\n * type of element rendered with the ref attribute.\n *\n * @return {Object} Ref object.\n */\nexport { createRef };\n\n/**\n * Component enhancer used to enable passing a ref to its wrapped component.\n * Pass a function argument which receives `props` and `ref` as its arguments,\n * returning an element using the forwarded ref. The return value is a new\n * component which forwards its ref.\n *\n * @param {Function} forwarder Function passed `props` and `ref`, expected to\n * return an element.\n *\n * @return {Component} Enhanced component.\n */\nexport { forwardRef };\n\n/**\n * A component which renders its children without any wrapping element.\n */\nexport { Fragment };\n\n/**\n * Checks if an object is a valid React Element.\n *\n * @param {Object} objectToCheck The object to be checked.\n *\n * @return {boolean} true if objectToTest is a valid React Element and false otherwise.\n */\nexport { isValidElement };\n\n/**\n * @see https://react.dev/reference/react/memo\n */\nexport { memo };\n\n/**\n * Component that activates additional checks and warnings for its descendants.\n */\nexport { StrictMode };\n\n/**\n * @see https://react.dev/reference/react/useCallback\n */\nexport { useCallback };\n\n/**\n * @see https://react.dev/reference/react/useContext\n */\nexport { useContext };\n\n/**\n * @see https://react.dev/reference/react/useDebugValue\n */\nexport { useDebugValue };\n\n/**\n * @see https://react.dev/reference/react/useDeferredValue\n */\nexport { useDeferredValue };\n\n/**\n * @see https://react.dev/reference/react/useEffect\n */\nexport { useEffect };\n\n/**\n * @see https://react.dev/reference/react/useId\n */\nexport { useId };\n\n/**\n * @see https://react.dev/reference/react/useImperativeHandle\n */\nexport { useImperativeHandle };\n\n/**\n * @see https://react.dev/reference/react/useInsertionEffect\n */\nexport { useInsertionEffect };\n\n/**\n * @see https://react.dev/reference/react/useLayoutEffect\n */\nexport { useLayoutEffect };\n\n/**\n * @see https://react.dev/reference/react/useMemo\n */\nexport { useMemo };\n\n/**\n * @see https://react.dev/reference/react/useReducer\n */\nexport { useReducer };\n\n/**\n * @see https://react.dev/reference/react/useRef\n */\nexport { useRef };\n\n/**\n * @see https://react.dev/reference/react/useState\n */\nexport { useState };\n\n/**\n * @see https://react.dev/reference/react/useSyncExternalStore\n */\nexport { useSyncExternalStore };\n\n/**\n * @see https://react.dev/reference/react/useTransition\n */\nexport { useTransition };\n\n/**\n * @see https://react.dev/reference/react/startTransition\n */\nexport { startTransition };\n\n/**\n * @see https://react.dev/reference/react/lazy\n */\nexport { lazy };\n\n/**\n * @see https://react.dev/reference/react/Suspense\n */\nexport { Suspense };\n\n/**\n * @see https://react.dev/reference/react/PureComponent\n */\nexport { PureComponent };\n\n/**\n * Concatenate two or more React children objects.\n *\n * @param childrenArguments - Array of children arguments (array of arrays/strings/objects) to concatenate.\n * @return The concatenated value.\n */\nexport function concatChildren(\n\t...childrenArguments: ReactNode[][]\n): ReactNode[] {\n\treturn childrenArguments.reduce< ReactNode[] >(\n\t\t( accumulator, children, i ) => {\n\t\t\tChildren.forEach( children, ( child, j ) => {\n\t\t\t\tif ( isValidElement( child ) && typeof child !== 'string' ) {\n\t\t\t\t\tchild = cloneElement( child, {\n\t\t\t\t\t\tkey: [ i, j ].join(),\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\taccumulator.push( child );\n\t\t\t} );\n\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Switches the nodeName of all the elements in the children object.\n *\n * @param children Children object.\n * @param nodeName Node name.\n *\n * @return The updated children object.\n */\nexport function switchChildrenNodeName(\n\tchildren: ReactNode,\n\tnodeName: string\n): ReactNode {\n\treturn (\n\t\tchildren &&\n\t\tChildren.map( children, ( elt, index ) => {\n\t\t\tif ( typeof elt?.valueOf() === 'string' ) {\n\t\t\t\treturn createElement( nodeName, { key: index }, elt );\n\t\t\t}\n\t\t\tif ( ! isValidElement( elt ) ) {\n\t\t\t\treturn elt;\n\t\t\t}\n\n\t\t\tconst { children: childrenProp, ...props } = elt.props;\n\t\t\treturn createElement(\n\t\t\t\tnodeName,\n\t\t\t\t{ key: index, ...props },\n\t\t\t\tchildrenProp\n\t\t\t);\n\t\t} )\n\t);\n}\n"],
5
+ "mappings": "AAIA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA+NA,SAAS,kBACZ,mBACW;AACd,SAAO,kBAAkB;AAAA,IACxB,CAAE,aAAa,UAAU,MAAO;AAC/B,eAAS,QAAS,UAAU,CAAE,OAAO,MAAO;AAC3C,YAAK,eAAgB,KAAM,KAAK,OAAO,UAAU,UAAW;AAC3D,kBAAQ,aAAc,OAAO;AAAA,YAC5B,KAAK,CAAE,GAAG,CAAE,EAAE,KAAK;AAAA,UACpB,CAAE;AAAA,QACH;AAEA,oBAAY,KAAM,KAAM;AAAA,MACzB,CAAE;AAEF,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AACD;AAUO,SAAS,uBACf,UACA,UACY;AACZ,SACC,YACA,SAAS,IAAK,UAAU,CAAE,KAAK,UAAW;AACzC,QAAK,OAAO,KAAK,QAAQ,MAAM,UAAW;AACzC,aAAO,cAAe,UAAU,EAAE,KAAK,MAAM,GAAG,GAAI;AAAA,IACrD;AACA,QAAK,CAAE,eAAgB,GAAI,GAAI;AAC9B,aAAO;AAAA,IACR;AAEA,UAAM,EAAE,UAAU,cAAc,GAAG,MAAM,IAAI,IAAI;AACjD,WAAO;AAAA,MACN;AAAA,MACA,EAAE,KAAK,OAAO,GAAG,MAAM;AAAA,MACvB;AAAA,IACD;AAAA,EACD,CAAE;AAEJ;",
6
+ "names": []
7
+ }