@wordpress/element 5.16.0 → 5.17.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 (51) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/create-interpolate-element.js +19 -49
  3. package/build/create-interpolate-element.js.map +1 -1
  4. package/build/index.js +0 -11
  5. package/build/index.js.map +1 -1
  6. package/build/platform.android.js +3 -4
  7. package/build/platform.android.js.map +1 -1
  8. package/build/platform.ios.js +3 -4
  9. package/build/platform.ios.js.map +1 -1
  10. package/build/platform.js +0 -2
  11. package/build/platform.js.map +1 -1
  12. package/build/raw-html.js +5 -6
  13. package/build/raw-html.js.map +1 -1
  14. package/build/react-platform.js +0 -2
  15. package/build/react-platform.js.map +1 -1
  16. package/build/react-platform.native.js +0 -3
  17. package/build/react-platform.native.js.map +1 -1
  18. package/build/react.js +1 -7
  19. package/build/react.js.map +1 -1
  20. package/build/serialize.js +37 -100
  21. package/build/serialize.js.map +1 -1
  22. package/build/utils.js +0 -4
  23. package/build/utils.js.map +1 -1
  24. package/build-module/create-interpolate-element.js +19 -47
  25. package/build-module/create-interpolate-element.js.map +1 -1
  26. package/build-module/index.js.map +1 -1
  27. package/build-module/platform.android.js +2 -2
  28. package/build-module/platform.android.js.map +1 -1
  29. package/build-module/platform.ios.js +2 -2
  30. package/build-module/platform.ios.js.map +1 -1
  31. package/build-module/platform.js +0 -1
  32. package/build-module/platform.js.map +1 -1
  33. package/build-module/raw-html.js +6 -4
  34. package/build-module/raw-html.js.map +1 -1
  35. package/build-module/react-platform.js +8 -8
  36. package/build-module/react-platform.js.map +1 -1
  37. package/build-module/react-platform.native.js +1 -1
  38. package/build-module/react-platform.native.js.map +1 -1
  39. package/build-module/react.js +31 -33
  40. package/build-module/react.js.map +1 -1
  41. package/build-module/serialize.js +39 -89
  42. package/build-module/serialize.js.map +1 -1
  43. package/build-module/utils.js +0 -2
  44. package/build-module/utils.js.map +1 -1
  45. package/build-types/platform.d.ts +2 -2
  46. package/build-types/react-platform.d.ts +8 -8
  47. package/build-types/react-platform.d.ts.map +1 -1
  48. package/build-types/react.d.ts +29 -29
  49. package/build-types/react.d.ts.map +1 -1
  50. package/package.json +3 -3
  51. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.17.0 (2023-08-16)
6
+
5
7
  ## 5.16.0 (2023-08-10)
6
8
 
7
9
  ## 5.15.0 (2023-07-20)
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = require("./react");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
13
11
 
14
12
  /** @typedef {import('./react').WPElement} WPElement */
13
+
15
14
  let indoc, offset, output, stack;
15
+
16
16
  /**
17
17
  * Matches tags in the localized string
18
18
  *
@@ -28,8 +28,8 @@ let indoc, offset, output, stack;
28
28
  *
29
29
  * @type {RegExp}
30
30
  */
31
-
32
31
  const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
32
+
33
33
  /**
34
34
  * The stack frame tracking parse progress.
35
35
  *
@@ -69,7 +69,6 @@ const tokenizer = /<(\/)?(\w+)\s*(\/)?>/g;
69
69
  *
70
70
  * @return {Frame} The stack frame tracking parse progress.
71
71
  */
72
-
73
72
  function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextStart) {
74
73
  return {
75
74
  element,
@@ -80,6 +79,7 @@ function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextSt
80
79
  children: []
81
80
  };
82
81
  }
82
+
83
83
  /**
84
84
  * This function creates an interpolated element from a passed in string with
85
85
  * specific tags matching how the string should be converted to an element via
@@ -107,24 +107,21 @@ function createFrame(element, tokenStart, tokenLength, prevOffset, leadingTextSt
107
107
  * @throws {TypeError}
108
108
  * @return {WPElement} A wp element.
109
109
  */
110
-
111
-
112
110
  const createInterpolateElement = (interpolatedString, conversionMap) => {
113
111
  indoc = interpolatedString;
114
112
  offset = 0;
115
113
  output = [];
116
114
  stack = [];
117
115
  tokenizer.lastIndex = 0;
118
-
119
116
  if (!isValidConversionMap(conversionMap)) {
120
117
  throw new TypeError('The conversionMap provided is not valid. It must be an object with values that are WPElements');
121
118
  }
122
-
123
- do {// twiddle our thumbs
119
+ do {
120
+ // twiddle our thumbs
124
121
  } while (proceed(conversionMap));
125
-
126
122
  return (0, _react.createElement)(_react.Fragment, null, ...output);
127
123
  };
124
+
128
125
  /**
129
126
  * Validate conversion map.
130
127
  *
@@ -137,13 +134,12 @@ const createInterpolateElement = (interpolatedString, conversionMap) => {
137
134
  *
138
135
  * @return {boolean} True means the map is valid.
139
136
  */
140
-
141
-
142
137
  const isValidConversionMap = conversionMap => {
143
138
  const isObject = typeof conversionMap === 'object';
144
139
  const values = isObject && Object.values(conversionMap);
145
140
  return isObject && values.length && values.every(element => (0, _react.isValidElement)(element));
146
141
  };
142
+
147
143
  /**
148
144
  * This is the iterator over the matches in the string.
149
145
  *
@@ -153,19 +149,15 @@ const isValidConversionMap = conversionMap => {
153
149
  *
154
150
  * @return {boolean} true for continuing to iterate, false for finished.
155
151
  */
156
-
157
-
158
152
  function proceed(conversionMap) {
159
153
  const next = nextToken();
160
154
  const [tokenType, name, startOffset, tokenLength] = next;
161
155
  const stackDepth = stack.length;
162
156
  const leadingTextStart = startOffset > offset ? offset : null;
163
-
164
157
  if (!conversionMap[name]) {
165
158
  addText();
166
159
  return false;
167
160
  }
168
-
169
161
  switch (tokenType) {
170
162
  case 'no-more-tokens':
171
163
  if (stackDepth !== 0) {
@@ -175,41 +167,36 @@ function proceed(conversionMap) {
175
167
  } = stack.pop();
176
168
  output.push(indoc.substr(stackLeadingText, tokenStart));
177
169
  }
178
-
179
170
  addText();
180
171
  return false;
181
-
182
172
  case 'self-closed':
183
173
  if (0 === stackDepth) {
184
174
  if (null !== leadingTextStart) {
185
175
  output.push(indoc.substr(leadingTextStart, startOffset - leadingTextStart));
186
176
  }
187
-
188
177
  output.push(conversionMap[name]);
189
178
  offset = startOffset + tokenLength;
190
179
  return true;
191
- } // Otherwise we found an inner element.
192
-
180
+ }
193
181
 
182
+ // Otherwise we found an inner element.
194
183
  addChild(createFrame(conversionMap[name], startOffset, tokenLength));
195
184
  offset = startOffset + tokenLength;
196
185
  return true;
197
-
198
186
  case 'opener':
199
187
  stack.push(createFrame(conversionMap[name], startOffset, tokenLength, startOffset + tokenLength, leadingTextStart));
200
188
  offset = startOffset + tokenLength;
201
189
  return true;
202
-
203
190
  case 'closer':
204
191
  // If we're not nesting then this is easy - close the block.
205
192
  if (1 === stackDepth) {
206
193
  closeOuterElement(startOffset);
207
194
  offset = startOffset + tokenLength;
208
195
  return true;
209
- } // Otherwise we're nested and we have to close out the current
210
- // block and add it as a innerBlock to the parent.
211
-
196
+ }
212
197
 
198
+ // Otherwise we're nested and we have to close out the current
199
+ // block and add it as a innerBlock to the parent.
213
200
  const stackTop = stack.pop();
214
201
  const text = indoc.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset);
215
202
  stackTop.children.push(text);
@@ -219,12 +206,12 @@ function proceed(conversionMap) {
219
206
  addChild(frame);
220
207
  offset = startOffset + tokenLength;
221
208
  return true;
222
-
223
209
  default:
224
210
  addText();
225
211
  return false;
226
212
  }
227
213
  }
214
+
228
215
  /**
229
216
  * Grabs the next token match in the string and returns it's details.
230
217
  *
@@ -232,29 +219,24 @@ function proceed(conversionMap) {
232
219
  *
233
220
  * @return {Array} An array of details for the token matched.
234
221
  */
235
-
236
-
237
222
  function nextToken() {
238
- const matches = tokenizer.exec(indoc); // We have no more tokens.
239
-
223
+ const matches = tokenizer.exec(indoc);
224
+ // We have no more tokens.
240
225
  if (null === matches) {
241
226
  return ['no-more-tokens'];
242
227
  }
243
-
244
228
  const startedAt = matches.index;
245
229
  const [match, isClosing, name, isSelfClosed] = matches;
246
230
  const length = match.length;
247
-
248
231
  if (isSelfClosed) {
249
232
  return ['self-closed', name, startedAt, length];
250
233
  }
251
-
252
234
  if (isClosing) {
253
235
  return ['closer', name, startedAt, length];
254
236
  }
255
-
256
237
  return ['opener', name, startedAt, length];
257
238
  }
239
+
258
240
  /**
259
241
  * Pushes text extracted from the indoc string to the output stack given the
260
242
  * current rawLength value and offset (if rawLength is provided ) or the
@@ -262,17 +244,14 @@ function nextToken() {
262
244
  *
263
245
  * @private
264
246
  */
265
-
266
-
267
247
  function addText() {
268
248
  const length = indoc.length - offset;
269
-
270
249
  if (0 === length) {
271
250
  return;
272
251
  }
273
-
274
252
  output.push(indoc.substr(offset, length));
275
253
  }
254
+
276
255
  /**
277
256
  * Pushes a child element to the associated parent element's children for the
278
257
  * parent currently active in the stack.
@@ -282,8 +261,6 @@ function addText() {
282
261
  * @param {Frame} frame The Frame containing the child element and it's
283
262
  * token information.
284
263
  */
285
-
286
-
287
264
  function addChild(frame) {
288
265
  const {
289
266
  element,
@@ -294,14 +271,13 @@ function addChild(frame) {
294
271
  } = frame;
295
272
  const parent = stack[stack.length - 1];
296
273
  const text = indoc.substr(parent.prevOffset, tokenStart - parent.prevOffset);
297
-
298
274
  if (text) {
299
275
  parent.children.push(text);
300
276
  }
301
-
302
277
  parent.children.push((0, _react.cloneElement)(element, null, ...children));
303
278
  parent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;
304
279
  }
280
+
305
281
  /**
306
282
  * This is called for closing tags. It creates the element currently active in
307
283
  * the stack.
@@ -314,8 +290,6 @@ function addChild(frame) {
314
290
  * helps capture any remaining nested text nodes in
315
291
  * the element.
316
292
  */
317
-
318
-
319
293
  function closeOuterElement(endOffset) {
320
294
  const {
321
295
  element,
@@ -325,18 +299,14 @@ function closeOuterElement(endOffset) {
325
299
  children
326
300
  } = stack.pop();
327
301
  const text = endOffset ? indoc.substr(prevOffset, endOffset - prevOffset) : indoc.substr(prevOffset);
328
-
329
302
  if (text) {
330
303
  children.push(text);
331
304
  }
332
-
333
305
  if (null !== leadingTextStart) {
334
306
  output.push(indoc.substr(leadingTextStart, tokenStart - leadingTextStart));
335
307
  }
336
-
337
308
  output.push((0, _react.cloneElement)(element, null, ...children));
338
309
  }
339
-
340
310
  var _default = createInterpolateElement;
341
311
  exports.default = _default;
342
312
  //# sourceMappingURL=create-interpolate-element.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/create-interpolate-element.js"],"names":["indoc","offset","output","stack","tokenizer","createFrame","element","tokenStart","tokenLength","prevOffset","leadingTextStart","children","createInterpolateElement","interpolatedString","conversionMap","lastIndex","isValidConversionMap","TypeError","proceed","Fragment","isObject","values","Object","length","every","next","nextToken","tokenType","name","startOffset","stackDepth","addText","stackLeadingText","pop","push","substr","addChild","closeOuterElement","stackTop","text","frame","matches","exec","startedAt","index","match","isClosing","isSelfClosed","parent","endOffset"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AAEA,IAAIA,KAAJ,EAAWC,MAAX,EAAmBC,MAAnB,EAA2BC,KAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,SAAS,GAAG,uBAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,CACCC,OADD,EAECC,UAFD,EAGCC,WAHD,EAICC,UAJD,EAKCC,gBALD,EAME;AACD,SAAO;AACNJ,IAAAA,OADM;AAENC,IAAAA,UAFM;AAGNC,IAAAA,WAHM;AAINC,IAAAA,UAJM;AAKNC,IAAAA,gBALM;AAMNC,IAAAA,QAAQ,EAAE;AANJ,GAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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;AACAqC,EAAAA,MAAM,CAACvC,UAAP,GAAoBA,UAAU,GAAGA,UAAH,GAAgBF,UAAU,GAAGC,WAA3D;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS6B,iBAAT,CAA4BY,SAA5B,EAAwC;AACvC,QAAM;AAAE3C,IAAAA,OAAF;AAAWI,IAAAA,gBAAX;AAA6BD,IAAAA,UAA7B;AAAyCF,IAAAA,UAAzC;AAAqDI,IAAAA;AAArD,MACLR,KAAK,CAAC8B,GAAN,EADD;AAGA,QAAMM,IAAI,GAAGU,SAAS,GACnBjD,KAAK,CAACmC,MAAN,CAAc1B,UAAd,EAA0BwC,SAAS,GAAGxC,UAAtC,CADmB,GAEnBT,KAAK,CAACmC,MAAN,CAAc1B,UAAd,CAFH;;AAIA,MAAK8B,IAAL,EAAY;AACX5B,IAAAA,QAAQ,CAACuB,IAAT,CAAeK,IAAf;AACA;;AAED,MAAK,SAAS7B,gBAAd,EAAiC;AAChCR,IAAAA,MAAM,CAACgC,IAAP,CACClC,KAAK,CAACmC,MAAN,CAAczB,gBAAd,EAAgCH,UAAU,GAAGG,gBAA7C,CADD;AAGA;;AAEDR,EAAAA,MAAM,CAACgC,IAAP,CAAa,yBAAc5B,OAAd,EAAuB,IAAvB,EAA6B,GAAGK,QAAhC,CAAb;AACA;;eAEcC,wB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { createElement, cloneElement, Fragment, isValidElement } from './react';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nlet indoc, offset, output, stack;\n\n/**\n * Matches tags in the localized string\n *\n * This is used for extracting the tag pattern groups for parsing the localized\n * string and along with the map converting it to a react element.\n *\n * There are four references extracted using this tokenizer:\n *\n * match: Full match of the tag (i.e. <strong>, </strong>, <br/>)\n * isClosing: The closing slash, if it exists.\n * name: The name portion of the tag (strong, br) (if )\n * isSelfClosed: The slash on a self closing tag, if it exists.\n *\n * @type {RegExp}\n */\nconst tokenizer = /<(\\/)?(\\w+)\\s*(\\/)?>/g;\n\n/**\n * The stack frame tracking parse progress.\n *\n * @typedef Frame\n *\n * @property {WPElement} element A parent element which may still have\n * @property {number} tokenStart Offset at which parent element first\n * appears.\n * @property {number} tokenLength Length of string marking start of parent\n * element.\n * @property {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @property {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n * @property {WPElement[]} children Children.\n */\n\n/**\n * Tracks recursive-descent parse state.\n *\n * This is a Stack frame holding parent elements until all children have been\n * parsed.\n *\n * @private\n * @param {WPElement} element A parent element which may still have\n * nested children not yet parsed.\n * @param {number} tokenStart Offset at which parent element first\n * appears.\n * @param {number} tokenLength Length of string marking start of parent\n * element.\n * @param {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @param {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n *\n * @return {Frame} The stack frame tracking parse progress.\n */\nfunction createFrame(\n\telement,\n\ttokenStart,\n\ttokenLength,\n\tprevOffset,\n\tleadingTextStart\n) {\n\treturn {\n\t\telement,\n\t\ttokenStart,\n\t\ttokenLength,\n\t\tprevOffset,\n\t\tleadingTextStart,\n\t\tchildren: [],\n\t};\n}\n\n/**\n * This function creates an interpolated element from a passed in string with\n * specific tags matching how the string should be converted to an element via\n * the conversion map value.\n *\n * @example\n * For example, for the given string:\n *\n * \"This is a <span>string</span> with <a>a link</a> and a self-closing\n * <CustomComponentB/> tag\"\n *\n * You would have something like this as the conversionMap value:\n *\n * ```js\n * {\n * span: <span />,\n * a: <a href={ 'https://github.com' } />,\n * CustomComponentB: <CustomComponent />,\n * }\n * ```\n *\n * @param {string} interpolatedString The interpolation string to be parsed.\n * @param {Record<string, WPElement>} conversionMap The map used to convert the string to\n * a react element.\n * @throws {TypeError}\n * @return {WPElement} A wp element.\n */\nconst createInterpolateElement = ( interpolatedString, conversionMap ) => {\n\tindoc = interpolatedString;\n\toffset = 0;\n\toutput = [];\n\tstack = [];\n\ttokenizer.lastIndex = 0;\n\n\tif ( ! isValidConversionMap( conversionMap ) ) {\n\t\tthrow new TypeError(\n\t\t\t'The conversionMap provided is not valid. It must be an object with values that are WPElements'\n\t\t);\n\t}\n\n\tdo {\n\t\t// twiddle our thumbs\n\t} while ( proceed( conversionMap ) );\n\treturn createElement( Fragment, null, ...output );\n};\n\n/**\n * Validate conversion map.\n *\n * A map is considered valid if it's an object and every value in the object\n * is a WPElement\n *\n * @private\n *\n * @param {Object} conversionMap The map being validated.\n *\n * @return {boolean} True means the map is valid.\n */\nconst isValidConversionMap = ( conversionMap ) => {\n\tconst isObject = typeof conversionMap === 'object';\n\tconst values = isObject && Object.values( conversionMap );\n\treturn (\n\t\tisObject &&\n\t\tvalues.length &&\n\t\tvalues.every( ( element ) => isValidElement( element ) )\n\t);\n};\n\n/**\n * This is the iterator over the matches in the string.\n *\n * @private\n *\n * @param {Object} conversionMap The conversion map for the string.\n *\n * @return {boolean} true for continuing to iterate, false for finished.\n */\nfunction proceed( conversionMap ) {\n\tconst next = nextToken();\n\tconst [ tokenType, name, startOffset, tokenLength ] = next;\n\tconst stackDepth = stack.length;\n\tconst leadingTextStart = startOffset > offset ? offset : null;\n\tif ( ! conversionMap[ name ] ) {\n\t\taddText();\n\t\treturn false;\n\t}\n\tswitch ( tokenType ) {\n\t\tcase 'no-more-tokens':\n\t\t\tif ( stackDepth !== 0 ) {\n\t\t\t\tconst { leadingTextStart: stackLeadingText, tokenStart } =\n\t\t\t\t\tstack.pop();\n\t\t\t\toutput.push( indoc.substr( stackLeadingText, tokenStart ) );\n\t\t\t}\n\t\t\taddText();\n\t\t\treturn false;\n\n\t\tcase 'self-closed':\n\t\t\tif ( 0 === stackDepth ) {\n\t\t\t\tif ( null !== leadingTextStart ) {\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tindoc.substr(\n\t\t\t\t\t\t\tleadingTextStart,\n\t\t\t\t\t\t\tstartOffset - leadingTextStart\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\toutput.push( conversionMap[ name ] );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we found an inner element.\n\t\t\taddChild(\n\t\t\t\tcreateFrame( conversionMap[ name ], startOffset, tokenLength )\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'opener':\n\t\t\tstack.push(\n\t\t\t\tcreateFrame(\n\t\t\t\t\tconversionMap[ name ],\n\t\t\t\t\tstartOffset,\n\t\t\t\t\ttokenLength,\n\t\t\t\t\tstartOffset + tokenLength,\n\t\t\t\t\tleadingTextStart\n\t\t\t\t)\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'closer':\n\t\t\t// If we're not nesting then this is easy - close the block.\n\t\t\tif ( 1 === stackDepth ) {\n\t\t\t\tcloseOuterElement( startOffset );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we're nested and we have to close out the current\n\t\t\t// block and add it as a innerBlock to the parent.\n\t\t\tconst stackTop = stack.pop();\n\t\t\tconst text = indoc.substr(\n\t\t\t\tstackTop.prevOffset,\n\t\t\t\tstartOffset - stackTop.prevOffset\n\t\t\t);\n\t\t\tstackTop.children.push( text );\n\t\t\tstackTop.prevOffset = startOffset + tokenLength;\n\t\t\tconst frame = createFrame(\n\t\t\t\tstackTop.element,\n\t\t\t\tstackTop.tokenStart,\n\t\t\t\tstackTop.tokenLength,\n\t\t\t\tstartOffset + tokenLength\n\t\t\t);\n\t\t\tframe.children = stackTop.children;\n\t\t\taddChild( frame );\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tdefault:\n\t\t\taddText();\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Grabs the next token match in the string and returns it's details.\n *\n * @private\n *\n * @return {Array} An array of details for the token matched.\n */\nfunction nextToken() {\n\tconst matches = tokenizer.exec( indoc );\n\t// We have no more tokens.\n\tif ( null === matches ) {\n\t\treturn [ 'no-more-tokens' ];\n\t}\n\tconst startedAt = matches.index;\n\tconst [ match, isClosing, name, isSelfClosed ] = matches;\n\tconst length = match.length;\n\tif ( isSelfClosed ) {\n\t\treturn [ 'self-closed', name, startedAt, length ];\n\t}\n\tif ( isClosing ) {\n\t\treturn [ 'closer', name, startedAt, length ];\n\t}\n\treturn [ 'opener', name, startedAt, length ];\n}\n\n/**\n * Pushes text extracted from the indoc string to the output stack given the\n * current rawLength value and offset (if rawLength is provided ) or the\n * indoc.length and offset.\n *\n * @private\n */\nfunction addText() {\n\tconst length = indoc.length - offset;\n\tif ( 0 === length ) {\n\t\treturn;\n\t}\n\toutput.push( indoc.substr( offset, length ) );\n}\n\n/**\n * Pushes a child element to the associated parent element's children for the\n * parent currently active in the stack.\n *\n * @private\n *\n * @param {Frame} frame The Frame containing the child element and it's\n * token information.\n */\nfunction addChild( frame ) {\n\tconst { element, tokenStart, tokenLength, prevOffset, children } = frame;\n\tconst parent = stack[ stack.length - 1 ];\n\tconst text = indoc.substr(\n\t\tparent.prevOffset,\n\t\ttokenStart - parent.prevOffset\n\t);\n\n\tif ( text ) {\n\t\tparent.children.push( text );\n\t}\n\n\tparent.children.push( cloneElement( element, null, ...children ) );\n\tparent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;\n}\n\n/**\n * This is called for closing tags. It creates the element currently active in\n * the stack.\n *\n * @private\n *\n * @param {number} endOffset Offset at which the closing tag for the element\n * begins in the string. If this is greater than the\n * prevOffset attached to the element, then this\n * helps capture any remaining nested text nodes in\n * the element.\n */\nfunction closeOuterElement( endOffset ) {\n\tconst { element, leadingTextStart, prevOffset, tokenStart, children } =\n\t\tstack.pop();\n\n\tconst text = endOffset\n\t\t? indoc.substr( prevOffset, endOffset - prevOffset )\n\t\t: indoc.substr( prevOffset );\n\n\tif ( text ) {\n\t\tchildren.push( text );\n\t}\n\n\tif ( null !== leadingTextStart ) {\n\t\toutput.push(\n\t\t\tindoc.substr( leadingTextStart, tokenStart - leadingTextStart )\n\t\t);\n\t}\n\n\toutput.push( cloneElement( element, null, ...children ) );\n}\n\nexport default createInterpolateElement;\n"]}
1
+ {"version":3,"names":["_react","require","indoc","offset","output","stack","tokenizer","createFrame","element","tokenStart","tokenLength","prevOffset","leadingTextStart","children","createInterpolateElement","interpolatedString","conversionMap","lastIndex","isValidConversionMap","TypeError","proceed","createElement","Fragment","isObject","values","Object","length","every","isValidElement","next","nextToken","tokenType","name","startOffset","stackDepth","addText","stackLeadingText","pop","push","substr","addChild","closeOuterElement","stackTop","text","frame","matches","exec","startedAt","index","match","isClosing","isSelfClosed","parent","cloneElement","endOffset","_default","exports","default"],"sources":["@wordpress/element/src/create-interpolate-element.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { createElement, cloneElement, Fragment, isValidElement } from './react';\n\n/** @typedef {import('./react').WPElement} WPElement */\n\nlet indoc, offset, output, stack;\n\n/**\n * Matches tags in the localized string\n *\n * This is used for extracting the tag pattern groups for parsing the localized\n * string and along with the map converting it to a react element.\n *\n * There are four references extracted using this tokenizer:\n *\n * match: Full match of the tag (i.e. <strong>, </strong>, <br/>)\n * isClosing: The closing slash, if it exists.\n * name: The name portion of the tag (strong, br) (if )\n * isSelfClosed: The slash on a self closing tag, if it exists.\n *\n * @type {RegExp}\n */\nconst tokenizer = /<(\\/)?(\\w+)\\s*(\\/)?>/g;\n\n/**\n * The stack frame tracking parse progress.\n *\n * @typedef Frame\n *\n * @property {WPElement} element A parent element which may still have\n * @property {number} tokenStart Offset at which parent element first\n * appears.\n * @property {number} tokenLength Length of string marking start of parent\n * element.\n * @property {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @property {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n * @property {WPElement[]} children Children.\n */\n\n/**\n * Tracks recursive-descent parse state.\n *\n * This is a Stack frame holding parent elements until all children have been\n * parsed.\n *\n * @private\n * @param {WPElement} element A parent element which may still have\n * nested children not yet parsed.\n * @param {number} tokenStart Offset at which parent element first\n * appears.\n * @param {number} tokenLength Length of string marking start of parent\n * element.\n * @param {number} [prevOffset] Running offset at which parsing should\n * continue.\n * @param {number} [leadingTextStart] Offset at which last closing element\n * finished, used for finding text between\n * elements.\n *\n * @return {Frame} The stack frame tracking parse progress.\n */\nfunction createFrame(\n\telement,\n\ttokenStart,\n\ttokenLength,\n\tprevOffset,\n\tleadingTextStart\n) {\n\treturn {\n\t\telement,\n\t\ttokenStart,\n\t\ttokenLength,\n\t\tprevOffset,\n\t\tleadingTextStart,\n\t\tchildren: [],\n\t};\n}\n\n/**\n * This function creates an interpolated element from a passed in string with\n * specific tags matching how the string should be converted to an element via\n * the conversion map value.\n *\n * @example\n * For example, for the given string:\n *\n * \"This is a <span>string</span> with <a>a link</a> and a self-closing\n * <CustomComponentB/> tag\"\n *\n * You would have something like this as the conversionMap value:\n *\n * ```js\n * {\n * span: <span />,\n * a: <a href={ 'https://github.com' } />,\n * CustomComponentB: <CustomComponent />,\n * }\n * ```\n *\n * @param {string} interpolatedString The interpolation string to be parsed.\n * @param {Record<string, WPElement>} conversionMap The map used to convert the string to\n * a react element.\n * @throws {TypeError}\n * @return {WPElement} A wp element.\n */\nconst createInterpolateElement = ( interpolatedString, conversionMap ) => {\n\tindoc = interpolatedString;\n\toffset = 0;\n\toutput = [];\n\tstack = [];\n\ttokenizer.lastIndex = 0;\n\n\tif ( ! isValidConversionMap( conversionMap ) ) {\n\t\tthrow new TypeError(\n\t\t\t'The conversionMap provided is not valid. It must be an object with values that are WPElements'\n\t\t);\n\t}\n\n\tdo {\n\t\t// twiddle our thumbs\n\t} while ( proceed( conversionMap ) );\n\treturn createElement( Fragment, null, ...output );\n};\n\n/**\n * Validate conversion map.\n *\n * A map is considered valid if it's an object and every value in the object\n * is a WPElement\n *\n * @private\n *\n * @param {Object} conversionMap The map being validated.\n *\n * @return {boolean} True means the map is valid.\n */\nconst isValidConversionMap = ( conversionMap ) => {\n\tconst isObject = typeof conversionMap === 'object';\n\tconst values = isObject && Object.values( conversionMap );\n\treturn (\n\t\tisObject &&\n\t\tvalues.length &&\n\t\tvalues.every( ( element ) => isValidElement( element ) )\n\t);\n};\n\n/**\n * This is the iterator over the matches in the string.\n *\n * @private\n *\n * @param {Object} conversionMap The conversion map for the string.\n *\n * @return {boolean} true for continuing to iterate, false for finished.\n */\nfunction proceed( conversionMap ) {\n\tconst next = nextToken();\n\tconst [ tokenType, name, startOffset, tokenLength ] = next;\n\tconst stackDepth = stack.length;\n\tconst leadingTextStart = startOffset > offset ? offset : null;\n\tif ( ! conversionMap[ name ] ) {\n\t\taddText();\n\t\treturn false;\n\t}\n\tswitch ( tokenType ) {\n\t\tcase 'no-more-tokens':\n\t\t\tif ( stackDepth !== 0 ) {\n\t\t\t\tconst { leadingTextStart: stackLeadingText, tokenStart } =\n\t\t\t\t\tstack.pop();\n\t\t\t\toutput.push( indoc.substr( stackLeadingText, tokenStart ) );\n\t\t\t}\n\t\t\taddText();\n\t\t\treturn false;\n\n\t\tcase 'self-closed':\n\t\t\tif ( 0 === stackDepth ) {\n\t\t\t\tif ( null !== leadingTextStart ) {\n\t\t\t\t\toutput.push(\n\t\t\t\t\t\tindoc.substr(\n\t\t\t\t\t\t\tleadingTextStart,\n\t\t\t\t\t\t\tstartOffset - leadingTextStart\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\toutput.push( conversionMap[ name ] );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we found an inner element.\n\t\t\taddChild(\n\t\t\t\tcreateFrame( conversionMap[ name ], startOffset, tokenLength )\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'opener':\n\t\t\tstack.push(\n\t\t\t\tcreateFrame(\n\t\t\t\t\tconversionMap[ name ],\n\t\t\t\t\tstartOffset,\n\t\t\t\t\ttokenLength,\n\t\t\t\t\tstartOffset + tokenLength,\n\t\t\t\t\tleadingTextStart\n\t\t\t\t)\n\t\t\t);\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tcase 'closer':\n\t\t\t// If we're not nesting then this is easy - close the block.\n\t\t\tif ( 1 === stackDepth ) {\n\t\t\t\tcloseOuterElement( startOffset );\n\t\t\t\toffset = startOffset + tokenLength;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise we're nested and we have to close out the current\n\t\t\t// block and add it as a innerBlock to the parent.\n\t\t\tconst stackTop = stack.pop();\n\t\t\tconst text = indoc.substr(\n\t\t\t\tstackTop.prevOffset,\n\t\t\t\tstartOffset - stackTop.prevOffset\n\t\t\t);\n\t\t\tstackTop.children.push( text );\n\t\t\tstackTop.prevOffset = startOffset + tokenLength;\n\t\t\tconst frame = createFrame(\n\t\t\t\tstackTop.element,\n\t\t\t\tstackTop.tokenStart,\n\t\t\t\tstackTop.tokenLength,\n\t\t\t\tstartOffset + tokenLength\n\t\t\t);\n\t\t\tframe.children = stackTop.children;\n\t\t\taddChild( frame );\n\t\t\toffset = startOffset + tokenLength;\n\t\t\treturn true;\n\n\t\tdefault:\n\t\t\taddText();\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Grabs the next token match in the string and returns it's details.\n *\n * @private\n *\n * @return {Array} An array of details for the token matched.\n */\nfunction nextToken() {\n\tconst matches = tokenizer.exec( indoc );\n\t// We have no more tokens.\n\tif ( null === matches ) {\n\t\treturn [ 'no-more-tokens' ];\n\t}\n\tconst startedAt = matches.index;\n\tconst [ match, isClosing, name, isSelfClosed ] = matches;\n\tconst length = match.length;\n\tif ( isSelfClosed ) {\n\t\treturn [ 'self-closed', name, startedAt, length ];\n\t}\n\tif ( isClosing ) {\n\t\treturn [ 'closer', name, startedAt, length ];\n\t}\n\treturn [ 'opener', name, startedAt, length ];\n}\n\n/**\n * Pushes text extracted from the indoc string to the output stack given the\n * current rawLength value and offset (if rawLength is provided ) or the\n * indoc.length and offset.\n *\n * @private\n */\nfunction addText() {\n\tconst length = indoc.length - offset;\n\tif ( 0 === length ) {\n\t\treturn;\n\t}\n\toutput.push( indoc.substr( offset, length ) );\n}\n\n/**\n * Pushes a child element to the associated parent element's children for the\n * parent currently active in the stack.\n *\n * @private\n *\n * @param {Frame} frame The Frame containing the child element and it's\n * token information.\n */\nfunction addChild( frame ) {\n\tconst { element, tokenStart, tokenLength, prevOffset, children } = frame;\n\tconst parent = stack[ stack.length - 1 ];\n\tconst text = indoc.substr(\n\t\tparent.prevOffset,\n\t\ttokenStart - parent.prevOffset\n\t);\n\n\tif ( text ) {\n\t\tparent.children.push( text );\n\t}\n\n\tparent.children.push( cloneElement( element, null, ...children ) );\n\tparent.prevOffset = prevOffset ? prevOffset : tokenStart + tokenLength;\n}\n\n/**\n * This is called for closing tags. It creates the element currently active in\n * the stack.\n *\n * @private\n *\n * @param {number} endOffset Offset at which the closing tag for the element\n * begins in the string. If this is greater than the\n * prevOffset attached to the element, then this\n * helps capture any remaining nested text nodes in\n * the element.\n */\nfunction closeOuterElement( endOffset ) {\n\tconst { element, leadingTextStart, prevOffset, tokenStart, children } =\n\t\tstack.pop();\n\n\tconst text = endOffset\n\t\t? indoc.substr( prevOffset, endOffset - prevOffset )\n\t\t: indoc.substr( prevOffset );\n\n\tif ( text ) {\n\t\tchildren.push( text );\n\t}\n\n\tif ( null !== leadingTextStart ) {\n\t\toutput.push(\n\t\t\tindoc.substr( leadingTextStart, tokenStart - leadingTextStart )\n\t\t);\n\t}\n\n\toutput.push( cloneElement( element, null, ...children ) );\n}\n\nexport default createInterpolateElement;\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;;AAEA,IAAIC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAS,GAAG,uBAAuB;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CACnBC,OAAO,EACPC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EACf;EACD,OAAO;IACNJ,OAAO;IACPC,UAAU;IACVC,WAAW;IACXC,UAAU;IACVC,gBAAgB;IAChBC,QAAQ,EAAE;EACX,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,GAAGA,CAAEC,kBAAkB,EAAEC,aAAa,KAAM;EACzEd,KAAK,GAAGa,kBAAkB;EAC1BZ,MAAM,GAAG,CAAC;EACVC,MAAM,GAAG,EAAE;EACXC,KAAK,GAAG,EAAE;EACVC,SAAS,CAACW,SAAS,GAAG,CAAC;EAEvB,IAAK,CAAEC,oBAAoB,CAAEF,aAAc,CAAC,EAAG;IAC9C,MAAM,IAAIG,SAAS,CAClB,+FACD,CAAC;EACF;EAEA,GAAG;IACF;EAAA,CACA,QAASC,OAAO,CAAEJ,aAAc,CAAC;EAClC,OAAO,IAAAK,oBAAa,EAAEC,eAAQ,EAAE,IAAI,EAAE,GAAGlB,MAAO,CAAC;AAClD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMc,oBAAoB,GAAKF,aAAa,IAAM;EACjD,MAAMO,QAAQ,GAAG,OAAOP,aAAa,KAAK,QAAQ;EAClD,MAAMQ,MAAM,GAAGD,QAAQ,IAAIE,MAAM,CAACD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czC,wBAAwB;AAAA0C,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/build/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -35,11 +34,8 @@ Object.defineProperty(exports, "renderToString", {
35
34
  return _serialize.default;
36
35
  }
37
36
  });
38
-
39
37
  var _createInterpolateElement = _interopRequireDefault(require("./create-interpolate-element"));
40
-
41
38
  var _react = require("./react");
42
-
43
39
  Object.keys(_react).forEach(function (key) {
44
40
  if (key === "default" || key === "__esModule") return;
45
41
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -51,9 +47,7 @@ Object.keys(_react).forEach(function (key) {
51
47
  }
52
48
  });
53
49
  });
54
-
55
50
  var _reactPlatform = require("./react-platform");
56
-
57
51
  Object.keys(_reactPlatform).forEach(function (key) {
58
52
  if (key === "default" || key === "__esModule") return;
59
53
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -65,9 +59,7 @@ Object.keys(_reactPlatform).forEach(function (key) {
65
59
  }
66
60
  });
67
61
  });
68
-
69
62
  var _utils = require("./utils");
70
-
71
63
  Object.keys(_utils).forEach(function (key) {
72
64
  if (key === "default" || key === "__esModule") return;
73
65
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -79,10 +71,7 @@ Object.keys(_utils).forEach(function (key) {
79
71
  }
80
72
  });
81
73
  });
82
-
83
74
  var _platform = _interopRequireDefault(require("./platform"));
84
-
85
75
  var _serialize = _interopRequireDefault(require("./serialize"));
86
-
87
76
  var _rawHtml = _interopRequireDefault(require("./raw-html"));
88
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AACA","sourcesContent":["export { default as createInterpolateElement } from './create-interpolate-element';\nexport * from './react';\nexport * from './react-platform';\nexport * from './utils';\nexport { default as Platform } from './platform';\nexport { default as renderToString } from './serialize';\nexport { default as RawHTML } from './raw-html';\n"]}
1
+ {"version":3,"names":["_createInterpolateElement","_interopRequireDefault","require","_react","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_reactPlatform","_utils","_platform","_serialize","_rawHtml"],"sources":["@wordpress/element/src/index.js"],"sourcesContent":["export { default as createInterpolateElement } from './create-interpolate-element';\nexport * from './react';\nexport * from './react-platform';\nexport * from './utils';\nexport { default as Platform } from './platform';\nexport { default as renderToString } from './serialize';\nexport { default as RawHTML } from './raw-html';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,cAAA,GAAAd,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAW,cAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,cAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,MAAA,GAAAf,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAY,MAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,MAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,MAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,SAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,UAAA,GAAAlB,sBAAA,CAAAC,OAAA;AACA,IAAAkB,QAAA,GAAAnB,sBAAA,CAAAC,OAAA"}
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _reactNative = require("react-native");
9
-
10
8
  /**
11
9
  * External dependencies
12
10
  */
13
- const Platform = { ..._reactNative.Platform,
11
+
12
+ const Platform = {
13
+ ..._reactNative.Platform,
14
14
  OS: 'native',
15
15
  select: spec => {
16
16
  if ('android' in spec) {
@@ -18,7 +18,6 @@ const Platform = { ..._reactNative.Platform,
18
18
  } else if ('native' in spec) {
19
19
  return spec.native;
20
20
  }
21
-
22
21
  return spec.default;
23
22
  },
24
23
  isNative: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/platform.android.js"],"names":["Platform","OriginalPlatform","OS","select","spec","android","native","default","isNative","isAndroid"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,EAChB,GAAGC,qBADa;AAEhBC,EAAAA,EAAE,EAAE,QAFY;AAGhBC,EAAAA,MAAM,EAAIC,IAAF,IAAY;AACnB,QAAK,aAAaA,IAAlB,EAAyB;AACxB,aAAOA,IAAI,CAACC,OAAZ;AACA,KAFD,MAEO,IAAK,YAAYD,IAAjB,EAAwB;AAC9B,aAAOA,IAAI,CAACE,MAAZ;AACA;;AACD,WAAOF,IAAI,CAACG,OAAZ;AACA,GAVe;AAWhBC,EAAAA,QAAQ,EAAE,IAXM;AAYhBC,EAAAA,SAAS,EAAE;AAZK,CAAjB;eAeeT,Q","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'android' in spec ) {\n\t\t\treturn spec.android;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisAndroid: true,\n};\n\nexport default Platform;\n"]}
1
+ {"version":3,"names":["_reactNative","require","Platform","OriginalPlatform","OS","select","spec","android","native","default","isNative","isAndroid","_default","exports"],"sources":["@wordpress/element/src/platform.android.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'android' in spec ) {\n\t\t\treturn spec.android;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisAndroid: true,\n};\n\nexport default Platform;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,QAAQ,GAAG;EAChB,GAAGC,qBAAgB;EACnBC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAIC,IAAI,IAAM;IACnB,IAAK,SAAS,IAAIA,IAAI,EAAG;MACxB,OAAOA,IAAI,CAACC,OAAO;IACpB,CAAC,MAAM,IAAK,QAAQ,IAAID,IAAI,EAAG;MAC9B,OAAOA,IAAI,CAACE,MAAM;IACnB;IACA,OAAOF,IAAI,CAACG,OAAO;EACpB,CAAC;EACDC,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAE;AACZ,CAAC;AAAC,IAAAC,QAAA,GAEaV,QAAQ;AAAAW,OAAA,CAAAJ,OAAA,GAAAG,QAAA"}
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _reactNative = require("react-native");
9
-
10
8
  /**
11
9
  * External dependencies
12
10
  */
13
- const Platform = { ..._reactNative.Platform,
11
+
12
+ const Platform = {
13
+ ..._reactNative.Platform,
14
14
  OS: 'native',
15
15
  select: spec => {
16
16
  if ('ios' in spec) {
@@ -18,7 +18,6 @@ const Platform = { ..._reactNative.Platform,
18
18
  } else if ('native' in spec) {
19
19
  return spec.native;
20
20
  }
21
-
22
21
  return spec.default;
23
22
  },
24
23
  isNative: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/platform.ios.js"],"names":["Platform","OriginalPlatform","OS","select","spec","ios","native","default","isNative","isIOS"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,QAAQ,GAAG,EAChB,GAAGC,qBADa;AAEhBC,EAAAA,EAAE,EAAE,QAFY;AAGhBC,EAAAA,MAAM,EAAIC,IAAF,IAAY;AACnB,QAAK,SAASA,IAAd,EAAqB;AACpB,aAAOA,IAAI,CAACC,GAAZ;AACA,KAFD,MAEO,IAAK,YAAYD,IAAjB,EAAwB;AAC9B,aAAOA,IAAI,CAACE,MAAZ;AACA;;AACD,WAAOF,IAAI,CAACG,OAAZ;AACA,GAVe;AAWhBC,EAAAA,QAAQ,EAAE,IAXM;AAYhBC,EAAAA,KAAK,EAAE;AAZS,CAAjB;eAeeT,Q","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'ios' in spec ) {\n\t\t\treturn spec.ios;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisIOS: true,\n};\n\nexport default Platform;\n"]}
1
+ {"version":3,"names":["_reactNative","require","Platform","OriginalPlatform","OS","select","spec","ios","native","default","isNative","isIOS","_default","exports"],"sources":["@wordpress/element/src/platform.ios.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Platform as OriginalPlatform } from 'react-native';\n\nconst Platform = {\n\t...OriginalPlatform,\n\tOS: 'native',\n\tselect: ( spec ) => {\n\t\tif ( 'ios' in spec ) {\n\t\t\treturn spec.ios;\n\t\t} else if ( 'native' in spec ) {\n\t\t\treturn spec.native;\n\t\t}\n\t\treturn spec.default;\n\t},\n\tisNative: true,\n\tisIOS: true,\n};\n\nexport default Platform;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,QAAQ,GAAG;EAChB,GAAGC,qBAAgB;EACnBC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAIC,IAAI,IAAM;IACnB,IAAK,KAAK,IAAIA,IAAI,EAAG;MACpB,OAAOA,IAAI,CAACC,GAAG;IAChB,CAAC,MAAM,IAAK,QAAQ,IAAID,IAAI,EAAG;MAC9B,OAAOA,IAAI,CAACE,MAAM;IACnB;IACA,OAAOF,IAAI,CAACG,OAAO;EACpB,CAAC;EACDC,QAAQ,EAAE,IAAI;EACdC,KAAK,EAAE;AACR,CAAC;AAAC,IAAAC,QAAA,GAEaV,QAAQ;AAAAW,OAAA,CAAAJ,OAAA,GAAAG,QAAA"}
package/build/platform.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /**
9
8
  * Parts of this source were derived and modified from react-native-web,
10
9
  * released under the MIT license.
@@ -37,7 +36,6 @@ const Platform = {
37
36
  * } );
38
37
  * ```
39
38
  */
40
-
41
39
  var _default = Platform;
42
40
  exports.default = _default;
43
41
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/platform.js"],"names":["Platform","OS","select","spec","web","default","isWeb"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG;AAChBC,EAAAA,EAAE,EAAE,KADY;AAEhBC,EAAAA,MAAM,EAAIC,IAAF,IAAc,SAASA,IAAT,GAAgBA,IAAI,CAACC,GAArB,GAA2BD,IAAI,CAACE,OAFtC;AAGhBC,EAAAA,KAAK,EAAE;AAHS,CAAjB;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;eACeN,Q","sourcesContent":["/**\n * Parts of this source were derived and modified from react-native-web,\n * released under the MIT license.\n *\n * Copyright (c) 2016-present, Nicolas Gallagher.\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n */\nconst Platform = {\n\tOS: 'web',\n\tselect: ( spec ) => ( 'web' in spec ? spec.web : spec.default ),\n\tisWeb: true,\n};\n/**\n * Component used to detect the current Platform being used.\n * Use Platform.OS === 'web' to detect if running on web enviroment.\n *\n * This is the same concept as the React Native implementation.\n *\n * @see https://facebook.github.io/react-native/docs/platform-specific-code#platform-module\n *\n * Here is an example of how to use the select method:\n * @example\n * ```js\n * import { Platform } from '@wordpress/element';\n *\n * const placeholderLabel = Platform.select( {\n * native: __( 'Add media' ),\n * web: __( 'Drag images, upload new ones or select files from your library.' ),\n * } );\n * ```\n */\nexport default Platform;\n"]}
1
+ {"version":3,"names":["Platform","OS","select","spec","web","default","isWeb","_default","exports"],"sources":["@wordpress/element/src/platform.js"],"sourcesContent":["/**\n * Parts of this source were derived and modified from react-native-web,\n * released under the MIT license.\n *\n * Copyright (c) 2016-present, Nicolas Gallagher.\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n */\nconst Platform = {\n\tOS: 'web',\n\tselect: ( spec ) => ( 'web' in spec ? spec.web : spec.default ),\n\tisWeb: true,\n};\n/**\n * Component used to detect the current Platform being used.\n * Use Platform.OS === 'web' to detect if running on web enviroment.\n *\n * This is the same concept as the React Native implementation.\n *\n * @see https://facebook.github.io/react-native/docs/platform-specific-code#platform-module\n *\n * Here is an example of how to use the select method:\n * @example\n * ```js\n * import { Platform } from '@wordpress/element';\n *\n * const placeholderLabel = Platform.select( {\n * native: __( 'Add media' ),\n * web: __( 'Drag images, upload new ones or select files from your library.' ),\n * } );\n * ```\n */\nexport default Platform;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG;EAChBC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAIC,IAAI,IAAQ,KAAK,IAAIA,IAAI,GAAGA,IAAI,CAACC,GAAG,GAAGD,IAAI,CAACE,OAAS;EAC/DC,KAAK,EAAE;AACR,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlBA,IAAAC,QAAA,GAmBeP,QAAQ;AAAAQ,OAAA,CAAAH,OAAA,GAAAE,QAAA"}
package/build/raw-html.js CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = RawHTML;
7
-
8
7
  var _react = require("./react");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
@@ -29,16 +27,17 @@ function RawHTML({
29
27
  children,
30
28
  ...props
31
29
  }) {
32
- let rawHtml = ''; // Cast children as an array, and concatenate each element if it is a string.
30
+ let rawHtml = '';
33
31
 
32
+ // Cast children as an array, and concatenate each element if it is a string.
34
33
  _react.Children.toArray(children).forEach(child => {
35
34
  if (typeof child === 'string' && child.trim() !== '') {
36
35
  rawHtml += child;
37
36
  }
38
- }); // The `div` wrapper will be stripped by the `renderElement` serializer in
39
- // `./serialize.js` unless there are non-children props present.
40
-
37
+ });
41
38
 
39
+ // The `div` wrapper will be stripped by the `renderElement` serializer in
40
+ // `./serialize.js` unless there are non-children props present.
42
41
  return (0, _react.createElement)('div', {
43
42
  dangerouslySetInnerHTML: {
44
43
  __html: rawHtml
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/raw-html.js"],"names":["RawHTML","children","props","rawHtml","Children","toArray","forEach","child","trim","dangerouslySetInnerHTML","__html"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAT,CAAkB;AAAEC,EAAAA,QAAF;AAAY,KAAGC;AAAf,CAAlB,EAA2C;AACzD,MAAIC,OAAO,GAAG,EAAd,CADyD,CAGzD;;AACAC,kBAASC,OAAT,CAAkBJ,QAAlB,EAA6BK,OAA7B,CAAwCC,KAAF,IAAa;AAClD,QAAK,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACC,IAAN,OAAiB,EAAnD,EAAwD;AACvDL,MAAAA,OAAO,IAAII,KAAX;AACA;AACD,GAJD,EAJyD,CAUzD;AACA;;;AACA,SAAO,0BAAe,KAAf,EAAsB;AAC5BE,IAAAA,uBAAuB,EAAE;AAAEC,MAAAA,MAAM,EAAEP;AAAV,KADG;AAE5B,OAAGD;AAFyB,GAAtB,CAAP;AAIA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { Children, createElement } from './react';\n\n/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */\n\n/**\n * Component used as equivalent of Fragment with unescaped HTML, in cases where\n * it is desirable to render dangerous HTML without needing a wrapper element.\n * To preserve additional props, a `div` wrapper _will_ be created if any props\n * aside from `children` are passed.\n *\n * @param {RawHTMLProps} props Children should be a string of HTML or an array\n * of strings. Other props will be passed through\n * to the div wrapper.\n *\n * @return {JSX.Element} Dangerously-rendering component.\n */\nexport default function RawHTML( { children, ...props } ) {\n\tlet rawHtml = '';\n\n\t// Cast children as an array, and concatenate each element if it is a string.\n\tChildren.toArray( children ).forEach( ( child ) => {\n\t\tif ( typeof child === 'string' && child.trim() !== '' ) {\n\t\t\trawHtml += child;\n\t\t}\n\t} );\n\n\t// The `div` wrapper will be stripped by the `renderElement` serializer in\n\t// `./serialize.js` unless there are non-children props present.\n\treturn createElement( 'div', {\n\t\tdangerouslySetInnerHTML: { __html: rawHtml },\n\t\t...props,\n\t} );\n}\n"]}
1
+ {"version":3,"names":["_react","require","RawHTML","children","props","rawHtml","Children","toArray","forEach","child","trim","createElement","dangerouslySetInnerHTML","__html"],"sources":["@wordpress/element/src/raw-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { Children, createElement } from './react';\n\n/** @typedef {{children: string} & import('react').ComponentPropsWithoutRef<'div'>} RawHTMLProps */\n\n/**\n * Component used as equivalent of Fragment with unescaped HTML, in cases where\n * it is desirable to render dangerous HTML without needing a wrapper element.\n * To preserve additional props, a `div` wrapper _will_ be created if any props\n * aside from `children` are passed.\n *\n * @param {RawHTMLProps} props Children should be a string of HTML or an array\n * of strings. Other props will be passed through\n * to the div wrapper.\n *\n * @return {JSX.Element} Dangerously-rendering component.\n */\nexport default function RawHTML( { children, ...props } ) {\n\tlet rawHtml = '';\n\n\t// Cast children as an array, and concatenate each element if it is a string.\n\tChildren.toArray( children ).forEach( ( child ) => {\n\t\tif ( typeof child === 'string' && child.trim() !== '' ) {\n\t\t\trawHtml += child;\n\t\t}\n\t} );\n\n\t// The `div` wrapper will be stripped by the `renderElement` serializer in\n\t// `./serialize.js` unless there are non-children props present.\n\treturn createElement( 'div', {\n\t\tdangerouslySetInnerHTML: { __html: rawHtml },\n\t\t...props,\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,OAAOA,CAAE;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAG;EACzD,IAAIC,OAAO,GAAG,EAAE;;EAEhB;EACAC,eAAQ,CAACC,OAAO,CAAEJ,QAAS,CAAC,CAACK,OAAO,CAAIC,KAAK,IAAM;IAClD,IAAK,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAG;MACvDL,OAAO,IAAII,KAAK;IACjB;EACD,CAAE,CAAC;;EAEH;EACA;EACA,OAAO,IAAAE,oBAAa,EAAE,KAAK,EAAE;IAC5BC,uBAAuB,EAAE;MAAEC,MAAM,EAAER;IAAQ,CAAC;IAC5C,GAAGD;EACJ,CAAE,CAAC;AACJ"}
@@ -51,8 +51,6 @@ Object.defineProperty(exports, "unmountComponentAtNode", {
51
51
  return _reactDom.unmountComponentAtNode;
52
52
  }
53
53
  });
54
-
55
54
  var _reactDom = require("react-dom");
56
-
57
55
  var _client = require("react-dom/client");
58
56
  //# sourceMappingURL=react-platform.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/react-platform.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAQA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tcreatePortal,\n\tfindDOMNode,\n\tflushSync,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n} from 'react-dom';\nimport { createRoot, hydrateRoot } from 'react-dom/client';\n\n/**\n * Creates a portal into which a component can be rendered.\n *\n * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235\n *\n * @param {import('./react').WPElement} child Any renderable child, such as an element,\n * string, or fragment.\n * @param {HTMLElement} container DOM node into which element should be rendered.\n */\nexport { createPortal };\n\n/**\n * Finds the dom node of a React component.\n *\n * @param {import('./react').WPComponent} component Component's instance.\n */\nexport { findDOMNode };\n\n/**\n * Forces React to flush any updates inside the provided callback synchronously.\n *\n * @param {Function} callback Callback to run synchronously.\n */\nexport { flushSync };\n\n/**\n * Renders a given element into the target DOM node.\n *\n * @deprecated since WordPress 6.2.0. Use `createRoot` instead.\n * @see https://react.dev/reference/react-dom/render\n */\nexport { render };\n\n/**\n * Hydrates a given element into the target DOM node.\n *\n * @deprecated since WordPress 6.2.0. Use `hydrateRoot` instead.\n * @see https://react.dev/reference/react-dom/hydrate\n */\nexport { hydrate };\n\n/**\n * Creates a new React root for the target DOM node.\n *\n * @since 6.2.0 Introduced in WordPress core.\n * @see https://react.dev/reference/react-dom/client/createRoot\n */\nexport { createRoot };\n\n/**\n * Creates a new React root for the target DOM node and hydrates it with a pre-generated markup.\n *\n * @since 6.2.0 Introduced in WordPress core.\n * @see https://react.dev/reference/react-dom/client/hydrateRoot\n */\nexport { hydrateRoot };\n\n/**\n * Removes any mounted element from the target DOM node.\n *\n * @deprecated since WordPress 6.2.0. Use `root.unmount()` instead.\n * @see https://react.dev/reference/react-dom/unmountComponentAtNode\n */\nexport { unmountComponentAtNode };\n"]}
1
+ {"version":3,"names":["_reactDom","require","_client"],"sources":["@wordpress/element/src/react-platform.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tcreatePortal,\n\tfindDOMNode,\n\tflushSync,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n} from 'react-dom';\nimport { createRoot, hydrateRoot } from 'react-dom/client';\n\n/**\n * Creates a portal into which a component can be rendered.\n *\n * @see https://github.com/facebook/react/issues/10309#issuecomment-318433235\n *\n * @param {import('./react').WPElement} child Any renderable child, such as an element,\n * string, or fragment.\n * @param {HTMLElement} container DOM node into which element should be rendered.\n */\nexport { createPortal };\n\n/**\n * Finds the dom node of a React component.\n *\n * @param {import('./react').WPComponent} component Component's instance.\n */\nexport { findDOMNode };\n\n/**\n * Forces React to flush any updates inside the provided callback synchronously.\n *\n * @param {Function} callback Callback to run synchronously.\n */\nexport { flushSync };\n\n/**\n * Renders a given element into the target DOM node.\n *\n * @deprecated since WordPress 6.2.0. Use `createRoot` instead.\n * @see https://react.dev/reference/react-dom/render\n */\nexport { render };\n\n/**\n * Hydrates a given element into the target DOM node.\n *\n * @deprecated since WordPress 6.2.0. Use `hydrateRoot` instead.\n * @see https://react.dev/reference/react-dom/hydrate\n */\nexport { hydrate };\n\n/**\n * Creates a new React root for the target DOM node.\n *\n * @since 6.2.0 Introduced in WordPress core.\n * @see https://react.dev/reference/react-dom/client/createRoot\n */\nexport { createRoot };\n\n/**\n * Creates a new React root for the target DOM node and hydrates it with a pre-generated markup.\n *\n * @since 6.2.0 Introduced in WordPress core.\n * @see https://react.dev/reference/react-dom/client/hydrateRoot\n */\nexport { hydrateRoot };\n\n/**\n * Removes any mounted element from the target DOM node.\n *\n * @deprecated since WordPress 6.2.0. Use `root.unmount()` instead.\n * @see https://react.dev/reference/react-dom/unmountComponentAtNode\n */\nexport { unmountComponentAtNode };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.registerComponent = void 0;
7
-
8
7
  var _reactNative = require("react-native");
9
-
10
8
  /**
11
9
  * External dependencies
12
10
  */
@@ -20,6 +18,5 @@ var _reactNative = require("react-native");
20
18
  const registerComponent = (appKey, componentProvider) => {
21
19
  _reactNative.AppRegistry.registerComponent(appKey, componentProvider);
22
20
  };
23
-
24
21
  exports.registerComponent = registerComponent;
25
22
  //# sourceMappingURL=react-platform.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/element/src/react-platform.native.js"],"names":["registerComponent","appKey","componentProvider","AppRegistry"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAG,CAAEC,MAAF,EAAUC,iBAAV,KAAiC;AACjEC,2BAAYH,iBAAZ,CAA+BC,MAA/B,EAAuCC,iBAAvC;AACA,CAFM","sourcesContent":["/**\n * External dependencies\n */\nimport { AppRegistry } from 'react-native';\n\n/**\n * Registers an app root component allowing the native system to run the app.\n *\n * @param {string} appKey Unique app name identifier.\n * @param {Function} componentProvider Function returning the app root React component.\n */\nexport const registerComponent = ( appKey, componentProvider ) => {\n\tAppRegistry.registerComponent( appKey, componentProvider );\n};\n"]}
1
+ {"version":3,"names":["_reactNative","require","registerComponent","appKey","componentProvider","AppRegistry","exports"],"sources":["@wordpress/element/src/react-platform.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { AppRegistry } from 'react-native';\n\n/**\n * Registers an app root component allowing the native system to run the app.\n *\n * @param {string} appKey Unique app name identifier.\n * @param {Function} componentProvider Function returning the app root React component.\n */\nexport const registerComponent = ( appKey, componentProvider ) => {\n\tAppRegistry.registerComponent( appKey, componentProvider );\n};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAGA,CAAEC,MAAM,EAAEC,iBAAiB,KAAM;EACjEC,wBAAW,CAACH,iBAAiB,CAAEC,MAAM,EAAEC,iBAAkB,CAAC;AAC3D,CAAC;AAACE,OAAA,CAAAJ,iBAAA,GAAAA,iBAAA"}
package/build/react.js CHANGED
@@ -179,9 +179,7 @@ Object.defineProperty(exports, "useTransition", {
179
179
  return _react.useTransition;
180
180
  }
181
181
  });
182
-
183
182
  var _react = require("react");
184
-
185
183
  /**
186
184
  * External dependencies
187
185
  */
@@ -377,13 +375,12 @@ function concatChildren(...childrenArguments) {
377
375
  key: [i, j].join()
378
376
  });
379
377
  }
380
-
381
378
  accumulator.push(child);
382
379
  });
383
-
384
380
  return accumulator;
385
381
  }, []);
386
382
  }
383
+
387
384
  /**
388
385
  * Switches the nodeName of all the elements in the children object.
389
386
  *
@@ -392,8 +389,6 @@ function concatChildren(...childrenArguments) {
392
389
  *
393
390
  * @return {?Object} The updated children object.
394
391
  */
395
-
396
-
397
392
  function switchChildrenNodeName(children, nodeName) {
398
393
  return children && _react.Children.map(children, (elt, index) => {
399
394
  if (typeof elt?.valueOf() === 'string') {
@@ -401,7 +396,6 @@ function switchChildrenNodeName(children, nodeName) {
401
396
  key: index
402
397
  }, elt);
403
398
  }
404
-
405
399
  const {
406
400
  children: childrenProp,
407
401
  ...props