@wordpress/element 6.32.0 → 6.32.1-next.b8c8708f3.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
package/build/react.js CHANGED
@@ -1,420 +1,123 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Children", {
7
- enumerable: true,
8
- get: function () {
9
- return _react.Children;
10
- }
11
- });
12
- Object.defineProperty(exports, "Component", {
13
- enumerable: true,
14
- get: function () {
15
- return _react.Component;
16
- }
17
- });
18
- Object.defineProperty(exports, "Fragment", {
19
- enumerable: true,
20
- get: function () {
21
- return _react.Fragment;
22
- }
23
- });
24
- Object.defineProperty(exports, "PureComponent", {
25
- enumerable: true,
26
- get: function () {
27
- return _react.PureComponent;
28
- }
29
- });
30
- Object.defineProperty(exports, "StrictMode", {
31
- enumerable: true,
32
- get: function () {
33
- return _react.StrictMode;
34
- }
35
- });
36
- Object.defineProperty(exports, "Suspense", {
37
- enumerable: true,
38
- get: function () {
39
- return _react.Suspense;
40
- }
41
- });
42
- Object.defineProperty(exports, "cloneElement", {
43
- enumerable: true,
44
- get: function () {
45
- return _react.cloneElement;
46
- }
47
- });
48
- exports.concatChildren = concatChildren;
49
- Object.defineProperty(exports, "createContext", {
50
- enumerable: true,
51
- get: function () {
52
- return _react.createContext;
53
- }
54
- });
55
- Object.defineProperty(exports, "createElement", {
56
- enumerable: true,
57
- get: function () {
58
- return _react.createElement;
59
- }
60
- });
61
- Object.defineProperty(exports, "createRef", {
62
- enumerable: true,
63
- get: function () {
64
- return _react.createRef;
65
- }
66
- });
67
- Object.defineProperty(exports, "forwardRef", {
68
- enumerable: true,
69
- get: function () {
70
- return _react.forwardRef;
71
- }
72
- });
73
- Object.defineProperty(exports, "isValidElement", {
74
- enumerable: true,
75
- get: function () {
76
- return _react.isValidElement;
77
- }
78
- });
79
- Object.defineProperty(exports, "lazy", {
80
- enumerable: true,
81
- get: function () {
82
- return _react.lazy;
83
- }
84
- });
85
- Object.defineProperty(exports, "memo", {
86
- enumerable: true,
87
- get: function () {
88
- return _react.memo;
89
- }
90
- });
91
- Object.defineProperty(exports, "startTransition", {
92
- enumerable: true,
93
- get: function () {
94
- return _react.startTransition;
95
- }
96
- });
97
- exports.switchChildrenNodeName = switchChildrenNodeName;
98
- Object.defineProperty(exports, "useCallback", {
99
- enumerable: true,
100
- get: function () {
101
- return _react.useCallback;
102
- }
103
- });
104
- Object.defineProperty(exports, "useContext", {
105
- enumerable: true,
106
- get: function () {
107
- return _react.useContext;
108
- }
109
- });
110
- Object.defineProperty(exports, "useDebugValue", {
111
- enumerable: true,
112
- get: function () {
113
- return _react.useDebugValue;
114
- }
115
- });
116
- Object.defineProperty(exports, "useDeferredValue", {
117
- enumerable: true,
118
- get: function () {
119
- return _react.useDeferredValue;
120
- }
121
- });
122
- Object.defineProperty(exports, "useEffect", {
123
- enumerable: true,
124
- get: function () {
125
- return _react.useEffect;
126
- }
127
- });
128
- Object.defineProperty(exports, "useId", {
129
- enumerable: true,
130
- get: function () {
131
- return _react.useId;
132
- }
133
- });
134
- Object.defineProperty(exports, "useImperativeHandle", {
135
- enumerable: true,
136
- get: function () {
137
- return _react.useImperativeHandle;
138
- }
139
- });
140
- Object.defineProperty(exports, "useInsertionEffect", {
141
- enumerable: true,
142
- get: function () {
143
- return _react.useInsertionEffect;
144
- }
145
- });
146
- Object.defineProperty(exports, "useLayoutEffect", {
147
- enumerable: true,
148
- get: function () {
149
- return _react.useLayoutEffect;
150
- }
151
- });
152
- Object.defineProperty(exports, "useMemo", {
153
- enumerable: true,
154
- get: function () {
155
- return _react.useMemo;
156
- }
157
- });
158
- Object.defineProperty(exports, "useReducer", {
159
- enumerable: true,
160
- get: function () {
161
- return _react.useReducer;
162
- }
163
- });
164
- Object.defineProperty(exports, "useRef", {
165
- enumerable: true,
166
- get: function () {
167
- return _react.useRef;
168
- }
169
- });
170
- Object.defineProperty(exports, "useState", {
171
- enumerable: true,
172
- get: function () {
173
- return _react.useState;
174
- }
175
- });
176
- Object.defineProperty(exports, "useSyncExternalStore", {
177
- enumerable: true,
178
- get: function () {
179
- return _react.useSyncExternalStore;
180
- }
181
- });
182
- Object.defineProperty(exports, "useTransition", {
183
- enumerable: true,
184
- get: function () {
185
- return _react.useTransition;
186
- }
187
- });
188
- var _react = require("react");
189
- /**
190
- * External dependencies
191
- */
192
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
193
-
194
- /**
195
- * Object containing a React element.
196
- */
197
-
198
- /**
199
- * Object containing a React component.
200
- */
201
-
202
- /**
203
- * Object containing a React synthetic event.
204
- */
205
-
206
- /**
207
- * Object containing a React ref object.
208
- */
209
-
210
- /**
211
- * Object containing a React ref callback.
212
- */
213
-
214
- /**
215
- * Object containing a React ref.
216
- */
217
-
218
- /**
219
- * Object that provides utilities for dealing with React children.
220
- */
221
-
222
- /**
223
- * Creates a copy of an element with extended props.
224
- *
225
- * @param {Element} element Element
226
- * @param {?Object} props Props to apply to cloned element
227
- *
228
- * @return {Element} Cloned element.
229
- */
230
-
231
- /**
232
- * A base class to create WordPress Components (Refs, state and lifecycle hooks)
233
- */
234
-
235
- /**
236
- * Creates a context object containing two components: a provider and consumer.
237
- *
238
- * @param {Object} defaultValue A default data stored in the context.
239
- *
240
- * @return {Object} Context object.
241
- */
242
-
243
- /**
244
- * Returns a new element of given type. Type can be either a string tag name or
245
- * another function which itself returns an element.
246
- *
247
- * @param {?(string|Function)} type Tag name or element creator
248
- * @param {Object} props Element properties, either attribute
249
- * set to apply to DOM node or values to
250
- * pass through to element creator
251
- * @param {...Element} children Descendant elements
252
- *
253
- * @return {Element} Element.
254
- */
255
-
256
- /**
257
- * Returns an object tracking a reference to a rendered element via its
258
- * `current` property as either a DOMElement or Element, dependent upon the
259
- * type of element rendered with the ref attribute.
260
- *
261
- * @return {Object} Ref object.
262
- */
263
-
264
- /**
265
- * Component enhancer used to enable passing a ref to its wrapped component.
266
- * Pass a function argument which receives `props` and `ref` as its arguments,
267
- * returning an element using the forwarded ref. The return value is a new
268
- * component which forwards its ref.
269
- *
270
- * @param {Function} forwarder Function passed `props` and `ref`, expected to
271
- * return an element.
272
- *
273
- * @return {Component} Enhanced component.
274
- */
275
-
276
- /**
277
- * A component which renders its children without any wrapping element.
278
- */
279
-
280
- /**
281
- * Checks if an object is a valid React Element.
282
- *
283
- * @param {Object} objectToCheck The object to be checked.
284
- *
285
- * @return {boolean} true if objectToTest is a valid React Element and false otherwise.
286
- */
287
-
288
- /**
289
- * @see https://react.dev/reference/react/memo
290
- */
291
-
292
- /**
293
- * Component that activates additional checks and warnings for its descendants.
294
- */
295
-
296
- /**
297
- * @see https://react.dev/reference/react/useCallback
298
- */
299
-
300
- /**
301
- * @see https://react.dev/reference/react/useContext
302
- */
303
-
304
- /**
305
- * @see https://react.dev/reference/react/useDebugValue
306
- */
307
-
308
- /**
309
- * @see https://react.dev/reference/react/useDeferredValue
310
- */
311
-
312
- /**
313
- * @see https://react.dev/reference/react/useEffect
314
- */
315
-
316
- /**
317
- * @see https://react.dev/reference/react/useId
318
- */
319
-
320
- /**
321
- * @see https://react.dev/reference/react/useImperativeHandle
322
- */
323
-
324
- /**
325
- * @see https://react.dev/reference/react/useInsertionEffect
326
- */
327
-
328
- /**
329
- * @see https://react.dev/reference/react/useLayoutEffect
330
- */
331
-
332
- /**
333
- * @see https://react.dev/reference/react/useMemo
334
- */
335
-
336
- /**
337
- * @see https://react.dev/reference/react/useReducer
338
- */
339
-
340
- /**
341
- * @see https://react.dev/reference/react/useRef
342
- */
343
-
344
- /**
345
- * @see https://react.dev/reference/react/useState
346
- */
347
-
348
- /**
349
- * @see https://react.dev/reference/react/useSyncExternalStore
350
- */
351
-
352
- /**
353
- * @see https://react.dev/reference/react/useTransition
354
- */
355
-
356
- /**
357
- * @see https://react.dev/reference/react/startTransition
358
- */
359
-
360
- /**
361
- * @see https://react.dev/reference/react/lazy
362
- */
363
-
364
- /**
365
- * @see https://react.dev/reference/react/Suspense
366
- */
367
-
368
- /**
369
- * @see https://react.dev/reference/react/PureComponent
370
- */
371
-
372
- /**
373
- * Concatenate two or more React children objects.
374
- *
375
- * @param childrenArguments - Array of children arguments (array of arrays/strings/objects) to concatenate.
376
- * @return The concatenated value.
377
- */
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var react_exports = {};
20
+ __export(react_exports, {
21
+ Children: () => import_react.Children,
22
+ Component: () => import_react.Component,
23
+ Fragment: () => import_react.Fragment,
24
+ PureComponent: () => import_react.PureComponent,
25
+ StrictMode: () => import_react.StrictMode,
26
+ Suspense: () => import_react.Suspense,
27
+ cloneElement: () => import_react.cloneElement,
28
+ concatChildren: () => concatChildren,
29
+ createContext: () => import_react.createContext,
30
+ createElement: () => import_react.createElement,
31
+ createRef: () => import_react.createRef,
32
+ forwardRef: () => import_react.forwardRef,
33
+ isValidElement: () => import_react.isValidElement,
34
+ lazy: () => import_react.lazy,
35
+ memo: () => import_react.memo,
36
+ startTransition: () => import_react.startTransition,
37
+ switchChildrenNodeName: () => switchChildrenNodeName,
38
+ useCallback: () => import_react.useCallback,
39
+ useContext: () => import_react.useContext,
40
+ useDebugValue: () => import_react.useDebugValue,
41
+ useDeferredValue: () => import_react.useDeferredValue,
42
+ useEffect: () => import_react.useEffect,
43
+ useId: () => import_react.useId,
44
+ useImperativeHandle: () => import_react.useImperativeHandle,
45
+ useInsertionEffect: () => import_react.useInsertionEffect,
46
+ useLayoutEffect: () => import_react.useLayoutEffect,
47
+ useMemo: () => import_react.useMemo,
48
+ useReducer: () => import_react.useReducer,
49
+ useRef: () => import_react.useRef,
50
+ useState: () => import_react.useState,
51
+ useSyncExternalStore: () => import_react.useSyncExternalStore,
52
+ useTransition: () => import_react.useTransition
53
+ });
54
+ module.exports = __toCommonJS(react_exports);
55
+ var import_react = require("react");
378
56
  function concatChildren(...childrenArguments) {
379
- return childrenArguments.reduce((accumulator, children, i) => {
380
- _react.Children.forEach(children, (child, j) => {
381
- if ((0, _react.isValidElement)(child) && typeof child !== 'string') {
382
- child = (0, _react.cloneElement)(child, {
383
- key: [i, j].join()
384
- });
385
- }
386
- accumulator.push(child);
387
- });
388
- return accumulator;
389
- }, []);
57
+ return childrenArguments.reduce(
58
+ (accumulator, children, i) => {
59
+ import_react.Children.forEach(children, (child, j) => {
60
+ if ((0, import_react.isValidElement)(child) && typeof child !== "string") {
61
+ child = (0, import_react.cloneElement)(child, {
62
+ key: [i, j].join()
63
+ });
64
+ }
65
+ accumulator.push(child);
66
+ });
67
+ return accumulator;
68
+ },
69
+ []
70
+ );
390
71
  }
391
-
392
- /**
393
- * Switches the nodeName of all the elements in the children object.
394
- *
395
- * @param children Children object.
396
- * @param nodeName Node name.
397
- *
398
- * @return The updated children object.
399
- */
400
72
  function switchChildrenNodeName(children, nodeName) {
401
- return children && _react.Children.map(children, (elt, index) => {
402
- if (typeof elt?.valueOf() === 'string') {
403
- return (0, _react.createElement)(nodeName, {
404
- key: index
405
- }, elt);
73
+ return children && import_react.Children.map(children, (elt, index) => {
74
+ if (typeof elt?.valueOf() === "string") {
75
+ return (0, import_react.createElement)(nodeName, { key: index }, elt);
406
76
  }
407
- if (!(0, _react.isValidElement)(elt)) {
77
+ if (!(0, import_react.isValidElement)(elt)) {
408
78
  return elt;
409
79
  }
410
- const {
411
- children: childrenProp,
412
- ...props
413
- } = elt.props;
414
- return (0, _react.createElement)(nodeName, {
415
- key: index,
416
- ...props
417
- }, childrenProp);
80
+ const { children: childrenProp, ...props } = elt.props;
81
+ return (0, import_react.createElement)(
82
+ nodeName,
83
+ { key: index, ...props },
84
+ childrenProp
85
+ );
418
86
  });
419
87
  }
420
- //# sourceMappingURL=react.js.map
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ Children,
91
+ Component,
92
+ Fragment,
93
+ PureComponent,
94
+ StrictMode,
95
+ Suspense,
96
+ cloneElement,
97
+ concatChildren,
98
+ createContext,
99
+ createElement,
100
+ createRef,
101
+ forwardRef,
102
+ isValidElement,
103
+ lazy,
104
+ memo,
105
+ startTransition,
106
+ switchChildrenNodeName,
107
+ useCallback,
108
+ useContext,
109
+ useDebugValue,
110
+ useDeferredValue,
111
+ useEffect,
112
+ useId,
113
+ useImperativeHandle,
114
+ useInsertionEffect,
115
+ useLayoutEffect,
116
+ useMemo,
117
+ useReducer,
118
+ useRef,
119
+ useState,
120
+ useSyncExternalStore,
121
+ useTransition
122
+ });
123
+ //# sourceMappingURL=react.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_react","require","concatChildren","childrenArguments","reduce","accumulator","children","i","Children","forEach","child","j","isValidElement","cloneElement","key","join","push","switchChildrenNodeName","nodeName","map","elt","index","valueOf","createElement","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAJA;AACA;AACA;AACA;;AAmCA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAC7B,GAAGC,iBAAgC,EACrB;EACd,OAAOA,iBAAiB,CAACC,MAAM,CAC9B,CAAEC,WAAW,EAAEC,QAAQ,EAAEC,CAAC,KAAM;IAC/BC,eAAQ,CAACC,OAAO,CAAEH,QAAQ,EAAE,CAAEI,KAAK,EAAEC,CAAC,KAAM;MAC3C,IAAK,IAAAC,qBAAc,EAAEF,KAAM,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAG;QAC3DA,KAAK,GAAG,IAAAG,mBAAY,EAAEH,KAAK,EAAE;UAC5BI,GAAG,EAAE,CAAEP,CAAC,EAAEI,CAAC,CAAE,CAACI,IAAI,CAAC;QACpB,CAAE,CAAC;MACJ;MAEAV,WAAW,CAACW,IAAI,CAAEN,KAAM,CAAC;IAC1B,CAAE,CAAC;IAEH,OAAOL,WAAW;EACnB,CAAC,EACD,EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASY,sBAAsBA,CACrCX,QAAmB,EACnBY,QAAgB,EACJ;EACZ,OACCZ,QAAQ,IACRE,eAAQ,CAACW,GAAG,CAAEb,QAAQ,EAAE,CAAEc,GAAG,EAAEC,KAAK,KAAM;IACzC,IAAK,OAAOD,GAAG,EAAEE,OAAO,CAAC,CAAC,KAAK,QAAQ,EAAG;MACzC,OAAO,IAAAC,oBAAa,EAAEL,QAAQ,EAAE;QAAEJ,GAAG,EAAEO;MAAM,CAAC,EAAED,GAAI,CAAC;IACtD;IACA,IAAK,CAAE,IAAAR,qBAAc,EAAEQ,GAAI,CAAC,EAAG;MAC9B,OAAOA,GAAG;IACX;IAEA,MAAM;MAAEd,QAAQ,EAAEkB,YAAY;MAAE,GAAGC;IAAM,CAAC,GAAGL,GAAG,CAACK,KAAK;IACtD,OAAO,IAAAF,oBAAa,EACnBL,QAAQ,EACR;MAAEJ,GAAG,EAAEO,KAAK;MAAE,GAAGI;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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBA+BO;AA+NA,SAAS,kBACZ,mBACW;AACd,SAAO,kBAAkB;AAAA,IACxB,CAAE,aAAa,UAAU,MAAO;AAC/B,4BAAS,QAAS,UAAU,CAAE,OAAO,MAAO;AAC3C,gBAAK,6BAAgB,KAAM,KAAK,OAAO,UAAU,UAAW;AAC3D,sBAAQ,2BAAc,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,sBAAS,IAAK,UAAU,CAAE,KAAK,UAAW;AACzC,QAAK,OAAO,KAAK,QAAQ,MAAM,UAAW;AACzC,iBAAO,4BAAe,UAAU,EAAE,KAAK,MAAM,GAAG,GAAI;AAAA,IACrD;AACA,QAAK,KAAE,6BAAgB,GAAI,GAAI;AAC9B,aAAO;AAAA,IACR;AAEA,UAAM,EAAE,UAAU,cAAc,GAAG,MAAM,IAAI,IAAI;AACjD,eAAO;AAAA,MACN;AAAA,MACA,EAAE,KAAK,OAAO,GAAG,MAAM;AAAA,MACvB;AAAA,IACD;AAAA,EACD,CAAE;AAEJ;",
6
+ "names": []
7
+ }