@wix/zero-config-implementation 1.51.0 → 1.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11119,7 +11119,7 @@ function Dh(t) {
11119
11119
  r.shift();
11120
11120
  return r.join(" ").slice(0, Wg);
11121
11121
  }
11122
- const { DATA_TYPE: Rt } = zn;
11122
+ const { DATA_TYPE: It } = zn;
11123
11123
  function _8(t, e) {
11124
11124
  const r = t.get(e);
11125
11125
  if (!r) return [];
@@ -11163,18 +11163,18 @@ function _1(t, e, r, n, i) {
11163
11163
  case "semantic":
11164
11164
  return K8({ dataItem: t, resolvedType: e, propUsages: n, propPath: i }), Mr(void 0);
11165
11165
  default:
11166
- return t.dataType = Rt.text, t.text = {}, Mr(void 0);
11166
+ return t.dataType = It.text, t.text = {}, Mr(void 0);
11167
11167
  }
11168
11168
  }
11169
11169
  function H8(t, e, r, n) {
11170
11170
  const i = e.value?.toLowerCase() || r.type.toLowerCase();
11171
- i.includes("string") ? n?.some((s) => s.attribute === "dir") ? t.dataType = Rt.direction : n?.some((s) => s.attribute === "href" && s.element === "a" && !s.concatenated) ? t.dataType = Rt.webUrl : n?.some((s) => s.attribute === "id") ? t.dataType = Rt.guid : n?.some((s) => s.attribute === "pattern") ? t.dataType = Rt.regex : (t.dataType = Rt.text, t.text = {}) : i.includes("number") ? (t.dataType = Rt.number, t.number = {}) : i.includes("boolean") ? t.dataType = Rt.booleanValue : (t.dataType = Rt.text, t.text = {});
11171
+ i.includes("string") ? n?.some((s) => s.attribute === "dir") ? t.dataType = It.direction : n?.some((s) => s.attribute === "href" && s.element === "a" && !s.concatenated) ? t.dataType = It.webUrl : n?.some((s) => s.attribute === "id") ? t.dataType = It.guid : n?.some((s) => s.attribute === "pattern") ? t.dataType = It.regex : (t.dataType = It.text, t.text = {}) : i.includes("number") ? (t.dataType = It.number, t.number = {}) : i.includes("boolean") ? t.dataType = It.booleanValue : (t.dataType = It.text, t.text = {});
11172
11172
  }
11173
11173
  function G8(t) {
11174
- t.dataType = Rt.text, t.text = {};
11174
+ t.dataType = It.text, t.text = {};
11175
11175
  }
11176
11176
  function V8(t) {
11177
- t.dataType = Rt.textEnum, t.textEnum = {
11177
+ t.dataType = It.textEnum, t.textEnum = {
11178
11178
  options: []
11179
11179
  };
11180
11180
  }
@@ -11185,7 +11185,7 @@ function U8(t, e, r, n) {
11185
11185
  props: { phase: "conversion", isDefect: !0 }
11186
11186
  })
11187
11187
  );
11188
- t.dataType = Rt.arrayItems;
11188
+ t.dataType = It.arrayItems;
11189
11189
  const i = {}, s = _1(
11190
11190
  i,
11191
11191
  e.elementType,
@@ -11197,12 +11197,10 @@ function U8(t, e, r, n) {
11197
11197
  r,
11198
11198
  n
11199
11199
  );
11200
- return s.isErr() ? s : (t.arrayItems = {
11201
- dataItem: i
11202
- }, Mr(void 0));
11200
+ return s.isErr() ? s : (t.arrayItems = i.dataType === It.data && i.data ? { data: i.data } : { dataItem: i }, Mr(void 0));
11203
11201
  }
11204
11202
  function W8(t, e, r, n) {
11205
- if (t.dataType = Rt.data, e.properties) {
11203
+ if (t.dataType = It.data, e.properties) {
11206
11204
  const i = {};
11207
11205
  for (const [s, a] of Object.entries(e.properties)) {
11208
11206
  const o = n ? `${n}.${s}` : s, u = M2(a, void 0, r, o);
@@ -11221,25 +11219,25 @@ function W8(t, e, r, n) {
11221
11219
  }
11222
11220
  function $8(t, e, r) {
11223
11221
  if (!e.types || e.types.length === 0)
11224
- return t.dataType = Rt.text, t.text = {}, Mr(void 0);
11222
+ return t.dataType = It.text, t.text = {}, Mr(void 0);
11225
11223
  const n = e.types.filter((o) => o.value !== "undefined" && o.value !== "null");
11226
11224
  if (n.length === 0)
11227
- return t.dataType = Rt.text, t.text = {}, Mr(void 0);
11225
+ return t.dataType = It.text, t.text = {}, Mr(void 0);
11228
11226
  if (n.length <= 2 && n.every(
11229
11227
  (o) => o.kind === "literal" && (o.value === !0 || o.value === !1)
11230
11228
  ))
11231
- return t.dataType = Rt.booleanValue, Mr(void 0);
11229
+ return t.dataType = It.booleanValue, Mr(void 0);
11232
11230
  if (n.every(
11233
11231
  (o) => o.kind === "literal" && typeof o.value == "string"
11234
11232
  ))
11235
- return t.dataType = Rt.textEnum, t.textEnum = {
11233
+ return t.dataType = It.textEnum, t.textEnum = {
11236
11234
  options: n.map((o) => ({
11237
11235
  value: String(o.value || ""),
11238
11236
  displayName: Dh(String(o.value || ""))
11239
11237
  })).filter((o) => o.value)
11240
11238
  }, Mr(void 0);
11241
11239
  const a = n[0];
11242
- return a ? _1(t, a, r) : (t.dataType = Rt.text, t.text = {}, Mr(void 0));
11240
+ return a ? _1(t, a, r) : (t.dataType = It.text, t.text = {}, Mr(void 0));
11243
11241
  }
11244
11242
  function K8({
11245
11243
  dataItem: t,
@@ -11249,22 +11247,22 @@ function K8({
11249
11247
  }) {
11250
11248
  const i = e.value, s = e.source;
11251
11249
  if (s === "@types/react" || s === "react") {
11252
- i === "ReactNode" || i === "ReactElement" ? t.dataType = Rt.container : (t.dataType = Rt.text, t.text = {});
11250
+ i === "ReactNode" || i === "ReactElement" ? t.dataType = It.container : (t.dataType = It.text, t.text = {});
11253
11251
  return;
11254
11252
  }
11255
11253
  if (s === "@wix/public-schemas" || s === "@wix/editor-react-types") {
11256
11254
  const a = L2[i];
11257
- a ? (t.dataType = Rt[a], j8({ dataItem: t, builderType: a, propUsages: r, propPath: n })) : (t.dataType = Rt.text, t.text = {});
11255
+ a ? (t.dataType = It[a], j8({ dataItem: t, builderType: a, propUsages: r, propPath: n })) : (t.dataType = It.text, t.text = {});
11258
11256
  return;
11259
11257
  }
11260
- t.dataType = Rt.text, t.text = {};
11258
+ t.dataType = It.text, t.text = {};
11261
11259
  }
11262
11260
  const hE = {
11263
- onclick: Rt.onClick,
11264
- onchange: Rt.onChange,
11265
- onkeypress: Rt.onKeyPress,
11266
- onkeyup: Rt.onKeyUp,
11267
- onsubmit: Rt.onSubmit
11261
+ onclick: It.onClick,
11262
+ onchange: It.onChange,
11263
+ onkeypress: It.onKeyPress,
11264
+ onkeyup: It.onKeyUp,
11265
+ onsubmit: It.onSubmit
11268
11266
  };
11269
11267
  function z8(t, e, r) {
11270
11268
  if (r)
@@ -11280,7 +11278,7 @@ function z8(t, e, r) {
11280
11278
  t.dataType = n;
11281
11279
  return;
11282
11280
  }
11283
- t.dataType = Rt.function, t.function = {};
11281
+ t.dataType = It.function, t.function = {};
11284
11282
  }
11285
11283
  function j8({
11286
11284
  dataItem: t,
@@ -11290,7 +11288,7 @@ function j8({
11290
11288
  }) {
11291
11289
  switch (e) {
11292
11290
  case "link":
11293
- t.dataType = Rt.link, t.link = {
11291
+ t.dataType = It.link, t.link = {
11294
11292
  linkTypes: [
11295
11293
  zn.LINK_TYPE.externalLink,
11296
11294
  zn.LINK_TYPE.anchorLink,
@@ -11308,12 +11306,12 @@ function j8({
11308
11306
  };
11309
11307
  break;
11310
11308
  case "image":
11311
- t.dataType = Rt.image, t.image = {
11309
+ t.dataType = It.image, t.image = {
11312
11310
  category: r3.IMAGE_CATEGORY.IMAGE
11313
11311
  };
11314
11312
  break;
11315
11313
  case "a11y":
11316
- t.dataType = Rt.a11y, t.a11y = {
11314
+ t.dataType = It.a11y, t.a11y = {
11317
11315
  attributes: O8(r, n)
11318
11316
  };
11319
11317
  break;
@@ -36541,7 +36539,7 @@ class Bv extends Ag {
36541
36539
  `, `@${this[Qi]}supports ${this.conditionText} {${e}}`;
36542
36540
  }
36543
36541
  }
36544
- const It = {
36542
+ const Rt = {
36545
36543
  html: "http://www.w3.org/1999/xhtml",
36546
36544
  svg: "http://www.w3.org/2000/svg",
36547
36545
  mathML: "http://www.w3.org/1998/Math/MathML",
@@ -36635,7 +36633,7 @@ class PS {
36635
36633
  if (this[oc].has(r))
36636
36634
  throw new this.#e.DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
36637
36635
  const i = ps.asciiUpperCase(e);
36638
- r.prototype[h] = this.#e, r.prototype[q] = this.#e.document, r.prototype[Ne] = i, r.prototype[Xe] = e, r.prototype[we] = It.html;
36636
+ r.prototype[h] = this.#e, r.prototype[q] = this.#e.document, r.prototype[Ne] = i, r.prototype[Xe] = e, r.prototype[we] = Rt.html;
36639
36637
  const s = /* @__PURE__ */ new Set(), a = r.observedAttributes;
36640
36638
  if (Array.isArray(a))
36641
36639
  for (const u of a)
@@ -43790,15 +43788,15 @@ We should not end up here and it is therefore a bug in Happy DOM. Please report
43790
43788
  for (; u = o.exec(e); )
43791
43789
  if (u[1] && u[2] || u[3] && u[5] === '"' || u[6] && u[8] === "'" || u[9]) {
43792
43790
  const l = u[1] || u[3] || u[6] || u[9] || "", c = u[2] || u[4] || u[7] || "", d = c ? Qr.decodeHTMLAttributeValue(c) : "", m = this.nextElement[Ke];
43793
- if (this.nextElement[we] === It.svg) {
43791
+ if (this.nextElement[we] === Rt.svg) {
43794
43792
  const g = l.split(":");
43795
43793
  let y = null;
43796
43794
  switch (g[0]) {
43797
43795
  case "xmlns":
43798
- y = !g[1] || g[1] === "xlink" ? It.xmlns : null;
43796
+ y = !g[1] || g[1] === "xlink" ? Rt.xmlns : null;
43799
43797
  break;
43800
43798
  case "xlink":
43801
- y = It.xlink;
43799
+ y = Rt.xlink;
43802
43800
  break;
43803
43801
  }
43804
43802
  if (!m.getNamedItemNS(y, g[1] ?? l)) {
@@ -43851,7 +43849,7 @@ We should not end up here and it is therefore a bug in Happy DOM. Please report
43851
43849
  (!s || s.contentModel !== ne.rawText) && this.nextElement !== o && this.nextElement !== u && this.nextElement !== l && (o && (this.currentNode === this.rootNode || this.currentNode === o || this.currentNode === u && c >= tr.body) ? (c < tr.body && (this.documentStructure.level = tr.afterBody), l[lt](this.nextElement, !0)) : this.currentNode[lt](this.nextElement, !0));
43852
43850
  } else
43853
43851
  this.currentNode[lt](this.nextElement, !0);
43854
- !this.documentStructure || this.nextElement !== this.documentStructure.nodes.body || this.documentStructure.level <= tr.body ? (this.currentNode = this.nextElement, this.nodeStack.push(this.currentNode), this.tagNameStack.push(n), this.documentStructure && this.nextElement === this.documentStructure.nodes.body && (this.documentStructure.level = tr.afterBody), s?.contentModel === ne.noDescendants || r && this.currentNode[we] === It.svg ? (this.nodeStack.pop(), this.tagNameStack.pop(), this.currentNode = this.nodeStack[this.nodeStack.length - 1] || this.rootNode, this.readState = pr.any) : this.readState = s?.contentModel === ne.rawText ? pr.rawTextElement : pr.any) : this.readState = pr.any, this.startTagIndex = this.markupRegExp.lastIndex;
43852
+ !this.documentStructure || this.nextElement !== this.documentStructure.nodes.body || this.documentStructure.level <= tr.body ? (this.currentNode = this.nextElement, this.nodeStack.push(this.currentNode), this.tagNameStack.push(n), this.documentStructure && this.nextElement === this.documentStructure.nodes.body && (this.documentStructure.level = tr.afterBody), s?.contentModel === ne.noDescendants || r && this.currentNode[we] === Rt.svg ? (this.nodeStack.pop(), this.tagNameStack.pop(), this.currentNode = this.nodeStack[this.nodeStack.length - 1] || this.rootNode, this.readState = pr.any) : this.readState = s?.contentModel === ne.rawText ? pr.rawTextElement : pr.any) : this.readState = pr.any, this.startTagIndex = this.markupRegExp.lastIndex;
43855
43853
  }
43856
43854
  /**
43857
43855
  * Parses end tag.
@@ -43859,7 +43857,7 @@ We should not end up here and it is therefore a bug in Happy DOM. Please report
43859
43857
  * @param tagName Tag name.
43860
43858
  */
43861
43859
  parseEndTag(e) {
43862
- const r = this.currentNode[we] === It.html ? ps.asciiUpperCase(e) : Xb[ps.asciiLowerCase(e)]?.localName || e, n = this.tagNameStack.lastIndexOf(r);
43860
+ const r = this.currentNode[we] === Rt.html ? ps.asciiUpperCase(e) : Xb[ps.asciiLowerCase(e)]?.localName || e, n = this.tagNameStack.lastIndexOf(r);
43863
43861
  n !== -1 && (this.nodeStack.splice(n, this.nodeStack.length - n), this.tagNameStack.splice(n, this.tagNameStack.length - n), this.currentNode = this.nodeStack[this.nodeStack.length - 1] || this.rootNode);
43864
43862
  }
43865
43863
  /**
@@ -43918,9 +43916,9 @@ We should not end up here and it is therefore a bug in Happy DOM. Please report
43918
43916
  getStartTagElement(e) {
43919
43917
  const r = ps.asciiLowerCase(e), n = this.currentNode[we];
43920
43918
  if (r === "svg")
43921
- return this.rootDocument.createElementNS(It.svg, "svg");
43922
- if (n === It.svg)
43923
- return this.rootDocument.createElementNS(It.svg, Xb[r]?.localName || e);
43919
+ return this.rootDocument.createElementNS(Rt.svg, "svg");
43920
+ if (n === Rt.svg)
43921
+ return this.rootDocument.createElementNS(Rt.svg, Xb[r]?.localName || e);
43924
43922
  switch (r) {
43925
43923
  case "html":
43926
43924
  return this.documentStructure ? (this.documentStructure.level < tr.documentElement && (this.documentStructure.level = tr.documentElement), this.documentStructure.nodes.documentElement ?? null) : null;
@@ -43929,7 +43927,7 @@ We should not end up here and it is therefore a bug in Happy DOM. Please report
43929
43927
  case "body":
43930
43928
  return this.documentStructure ? (this.documentStructure.level < tr.body && (this.documentStructure.level = tr.body), this.documentStructure.nodes.body ?? null) : null;
43931
43929
  default:
43932
- return this.rootDocument.createElementNS(It.html, r);
43930
+ return this.rootDocument.createElementNS(Rt.html, r);
43933
43931
  }
43934
43932
  }
43935
43933
  /**
@@ -45148,7 +45146,7 @@ let _l = class extends _e {
45148
45146
  * @returns Element.
45149
45147
  */
45150
45148
  createElement(e, r) {
45151
- return this.createElementNS(It.html, ps.asciiLowerCase(String(e)), r);
45149
+ return this.createElementNS(Rt.html, ps.asciiLowerCase(String(e)), r);
45152
45150
  }
45153
45151
  /**
45154
45152
  * Creates an element with the specified namespace URI and qualified name.
@@ -45165,10 +45163,10 @@ let _l = class extends _e {
45165
45163
  throw new i.DOMException("Failed to execute 'createElementNS' on 'Document': The qualified name provided is empty.");
45166
45164
  const s = r.split(":"), a = s[1] ?? s[0], o = s[1] ? s[0] : null;
45167
45165
  switch (e) {
45168
- case It.svg:
45166
+ case Rt.svg:
45169
45167
  const u = Xb[r.toLowerCase()], l = u && u.localName === r ? i[u.className] : i.SVGElement, c = vn.createNode(this, l);
45170
45168
  return c[Ne] = r, c[Xe] = a, c[Dt] = o, c[we] = e, c[ms] = n && n.is ? String(n.is) : null, c;
45171
- case It.html:
45169
+ case Rt.html:
45172
45170
  const d = i.customElements[Pa]?.get(n && n.is ? String(n.is) : r);
45173
45171
  if (d) {
45174
45172
  const x = new d.elementClass();
@@ -45443,7 +45441,7 @@ class zt {
45443
45441
  * @returns Matching element.
45444
45442
  */
45445
45443
  static getElementsByTagNameNS(e, r, n) {
45446
- const i = r === It.html && e[q][fn] === "text/html" ? n.toUpperCase() : n, s = n === "*", a = (u, l) => {
45444
+ const i = r === Rt.html && e[q][fn] === "text/html" ? n.toUpperCase() : n, s = n === "*", a = (u, l) => {
45447
45445
  const c = [];
45448
45446
  for (const d of u[Qe]) {
45449
45447
  (s || d[Ne] === i) && d[we] === r && c.push(d), d[qr].push(l);
@@ -45603,7 +45601,7 @@ class Um {
45603
45601
  * @returns Item.
45604
45602
  */
45605
45603
  getNamedItem(e) {
45606
- return e = String(e), this[ft][we] === It.html && this[ft][q][fn] === "text/html" ? this[Ri].get(ps.asciiLowerCase(e))?.[0] || null : this[Ri].get(e)?.[0] || null;
45604
+ return e = String(e), this[ft][we] === Rt.html && this[ft][q][fn] === "text/html" ? this[Ri].get(ps.asciiLowerCase(e))?.[0] || null : this[Ri].get(e)?.[0] || null;
45607
45605
  }
45608
45606
  /**
45609
45607
  * Returns item by name and namespace.
@@ -46421,7 +46419,7 @@ class Do extends _e {
46421
46419
  * @param value Value.
46422
46420
  */
46423
46421
  setAttribute(e, r) {
46424
- if (qQ.validateAttributeName(e, this[q][fn], { method: "setAttribute", instance: "Element" }), e = String(e), this[we] === It.html) {
46422
+ if (qQ.validateAttributeName(e, this[q][fn], { method: "setAttribute", instance: "Element" }), e = String(e), this[we] === Rt.html) {
46425
46423
  const i = this[q].createAttribute(e);
46426
46424
  i[Se] = String(r), this[Ke][To](i);
46427
46425
  } else {
@@ -46429,10 +46427,10 @@ class Do extends _e {
46429
46427
  let s = null;
46430
46428
  switch (i[0]) {
46431
46429
  case "xmlns":
46432
- s = !i[1] || i[1] === "xlink" ? It.xmlns : null;
46430
+ s = !i[1] || i[1] === "xlink" ? Rt.xmlns : null;
46433
46431
  break;
46434
46432
  case "xlink":
46435
- s = It.xlink;
46433
+ s = Rt.xlink;
46436
46434
  break;
46437
46435
  }
46438
46436
  const a = vn.createNode(this[q], this[h].Attr);
@@ -60032,10 +60030,10 @@ class FZ {
60032
60030
  case j.elementNode:
60033
60031
  const i = e, s = i[Xe];
60034
60032
  let a = "";
60035
- const o = this.#t(i, n), u = i[we] === It.html ? i[Dt] : this.#r(i, o), l = `${u ? u + ":" : ""}${s}`, c = u ? r : i[we] || r, d = this.#n(i, u, r, n), m = c === It.html && s === "template" ? e.content[pe] : e[pe];
60033
+ const o = this.#t(i, n), u = i[we] === Rt.html ? i[Dt] : this.#r(i, o), l = `${u ? u + ":" : ""}${s}`, c = u ? r : i[we] || r, d = this.#n(i, u, r, n), m = c === Rt.html && s === "template" ? e.content[pe] : e[pe];
60036
60034
  for (const z of m)
60037
60035
  a += this.#e(z, c, o);
60038
- return !a && c === It.html && un[s.toLowerCase()]?.contentModel === ne.noDescendants ? `<${l}${d} />` : !a && c !== It.html ? `<${l}${d}/>` : `<${l}${d}>${a}</${l}>`;
60036
+ return !a && c === Rt.html && un[s.toLowerCase()]?.contentModel === ne.noDescendants ? `<${l}${d} />` : !a && c !== Rt.html ? `<${l}${d}/>` : `<${l}${d}>${a}</${l}>`;
60039
60037
  case _e.DOCUMENT_FRAGMENT_NODE:
60040
60038
  case _e.DOCUMENT_NODE:
60041
60039
  let g = "";
@@ -60066,7 +60064,7 @@ class FZ {
60066
60064
  #t(e, r) {
60067
60065
  const n = new Map(r);
60068
60066
  for (const i of e[Ke][Ee].values())
60069
- i[we] === It.xmlns && i[Dt] && n.set(i[Se], i[Xe]);
60067
+ i[we] === Rt.xmlns && i[Dt] && n.set(i[Se], i[Xe]);
60070
60068
  return n;
60071
60069
  }
60072
60070
  /**
@@ -60106,7 +60104,7 @@ class FZ {
60106
60104
  let s = "", a = "";
60107
60105
  const o = /* @__PURE__ */ new Set();
60108
60106
  for (const u of e[Ke][Ee].values())
60109
- u[we] === It.xmlns ? r && u[Xe] === r && e[we] ? (a += ` xmlns:${r}="${Qr.encodeXMLAttributeValue(e[we])}"`, o.add(e[we])) : !r && u[Be] === "xmlns" && e[we] ? (a += ` xmlns="${Qr.encodeXMLAttributeValue(e[we])}"`, o.add(e[we])) : (a += ` ${u[Be]}="${Qr.encodeXMLAttributeValue(u[Se])}"`, o.add(u[Se])) : s += ` ${u[Be]}="${Qr.encodeXMLAttributeValue(u[Se])}"`;
60107
+ u[we] === Rt.xmlns ? r && u[Xe] === r && e[we] ? (a += ` xmlns:${r}="${Qr.encodeXMLAttributeValue(e[we])}"`, o.add(e[we])) : !r && u[Be] === "xmlns" && e[we] ? (a += ` xmlns="${Qr.encodeXMLAttributeValue(e[we])}"`, o.add(e[we])) : (a += ` ${u[Be]}="${Qr.encodeXMLAttributeValue(u[Se])}"`, o.add(u[Se])) : s += ` ${u[Be]}="${Qr.encodeXMLAttributeValue(u[Se])}"`;
60110
60108
  return e[we] && n !== e[we] && !o.has(e[we]) && (r && !i?.has(e[we]) ? a += ` xmlns:${r}="${Qr.encodeXMLAttributeValue(e[we])}"` : !r && n !== e[we] && (a += ` xmlns="${Qr.encodeXMLAttributeValue(e[we])}"`)), a + s;
60111
60109
  }
60112
60110
  }
@@ -60388,7 +60386,7 @@ let TZ = class extends _l {
60388
60386
  }, xZ = class extends ax {
60389
60387
  [Ne] = "IMG";
60390
60388
  [Xe] = "img";
60391
- [we] = It.html;
60389
+ [we] = Rt.html;
60392
60390
  /**
60393
60391
  * Constructor.
60394
60392
  *
@@ -60401,7 +60399,7 @@ let TZ = class extends _l {
60401
60399
  }, DZ = class extends Qv {
60402
60400
  [Ne] = "AUDIO";
60403
60401
  [Xe] = "audio";
60404
- [we] = It.html;
60402
+ [we] = Rt.html;
60405
60403
  /**
60406
60404
  * Constructor.
60407
60405
  *
@@ -61334,7 +61332,7 @@ var ct;
61334
61332
  (function(t) {
61335
61333
  t.any = "any", t.startTag = "startTag", t.comment = "comment", t.documentType = "documentType", t.processingInstruction = "processingInstruction", t.error = "error";
61336
61334
  })(ct || (ct = {}));
61337
- const KZ = Object.values(It);
61335
+ const KZ = Object.values(Rt);
61338
61336
  class zZ {
61339
61337
  window;
61340
61338
  rootNode = null;
@@ -61508,10 +61506,10 @@ class zZ {
61508
61506
  let y = null;
61509
61507
  switch (g[0]) {
61510
61508
  case "xmlns":
61511
- y = It.xmlns;
61509
+ y = Rt.xmlns;
61512
61510
  break;
61513
61511
  case "xlink":
61514
- y = It.xlink;
61512
+ y = Rt.xlink;
61515
61513
  break;
61516
61514
  }
61517
61515
  if (m.getNamedItemNS(y, g[1] ?? l))
@@ -61573,11 +61571,11 @@ class zZ {
61573
61571
  parseError(e, r) {
61574
61572
  let n = this.rootNode.documentElement;
61575
61573
  if (!n) {
61576
- const u = this.rootNode.createElementNS(It.html, "html"), l = this.rootNode.createElementNS(It.html, "body");
61574
+ const u = this.rootNode.createElementNS(Rt.html, "html"), l = this.rootNode.createElementNS(Rt.html, "body");
61577
61575
  u.appendChild(l), n = l, this.rootNode[lt](u, !0);
61578
61576
  }
61579
61577
  const i = e.split(`
61580
- `), s = i[i.length - 1].length + 1, a = `error on line ${i.length} at column ${s}: ${r || "Unknown error"}`, o = this.rootNode.createElementNS(It.html, "parsererror");
61578
+ `), s = i[i.length - 1].length + 1, a = `error on line ${i.length} at column ${s}: ${r || "Unknown error"}`, o = this.rootNode.createElementNS(Rt.html, "parsererror");
61581
61579
  o.setAttribute("style", "display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black"), o.innerHTML = `<h3>This page contains the following errors:</h3><div style="font-family:monospace;font-size:12px">${a}</div><h3>Below is a rendering of the page up to the first error.</h3>`, n.insertBefore(o, n.firstChild);
61582
61580
  }
61583
61581
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.51.0",
7
+ "version": "1.53.0",
8
8
  "description": "Core library for extracting component manifests from JS and CSS files",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  }
45
45
  },
46
46
  "dependencies": {
47
- "@wix/react-component-schema": "1.0.0"
47
+ "@wix/react-component-schema": "1.1.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@faker-js/faker": "^10.2.0",
@@ -85,5 +85,5 @@
85
85
  ]
86
86
  }
87
87
  },
88
- "falconPackageHash": "6edc92f94dbf49a5e330f797ead6810967079bb8cb877c73d59d3ad6"
88
+ "falconPackageHash": "dc55e27b43cce0c8386888b415f3d239dccada6a30b0feaf3e8db7cd"
89
89
  }
@@ -0,0 +1,80 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import type { PropInfo, ResolvedType } from '../information-extractors/ts/types'
3
+ import { buildDataItem } from './data-item-builder'
4
+
5
+ const stringType: ResolvedType = { kind: 'primitive', value: 'string' }
6
+ const numberType: ResolvedType = { kind: 'primitive', value: 'number' }
7
+
8
+ const objectElementType: ResolvedType = {
9
+ kind: 'object',
10
+ properties: {
11
+ name: { name: 'name', type: 'string', required: false, resolvedType: stringType },
12
+ age: { name: 'age', type: 'number', required: false, resolvedType: numberType },
13
+ },
14
+ }
15
+
16
+ const buildArrayProp = (elementType: ResolvedType): PropInfo => ({
17
+ name: 'items',
18
+ type: 'Array',
19
+ required: false,
20
+ resolvedType: { kind: 'array', elementType },
21
+ })
22
+
23
+ describe('buildDataItem — arrayItems oneof branching', () => {
24
+ it('uses the `data` branch when the array element is a multi-field object', () => {
25
+ const result = buildDataItem(buildArrayProp(objectElementType))
26
+ expect(result.isOk()).toBe(true)
27
+ const dataItem = result._unsafeUnwrap()
28
+
29
+ expect(dataItem.dataType).toBe('arrayItems')
30
+ expect(dataItem.arrayItems?.dataItem).toBeUndefined()
31
+ expect(dataItem.arrayItems?.data).toBeDefined()
32
+ expect(Object.keys(dataItem.arrayItems?.data?.items ?? {})).toEqual(['name', 'age'])
33
+ expect(dataItem.arrayItems?.data?.items?.name?.dataType).toBe('text')
34
+ expect(dataItem.arrayItems?.data?.items?.age?.dataType).toBe('number')
35
+ })
36
+
37
+ it('uses the `dataItem` branch for a primitive element type', () => {
38
+ const result = buildDataItem(buildArrayProp(stringType))
39
+ expect(result.isOk()).toBe(true)
40
+ const dataItem = result._unsafeUnwrap()
41
+
42
+ expect(dataItem.dataType).toBe('arrayItems')
43
+ expect(dataItem.arrayItems?.data).toBeUndefined()
44
+ expect(dataItem.arrayItems?.dataItem).toBeDefined()
45
+ expect(dataItem.arrayItems?.dataItem?.dataType).toBe('text')
46
+ })
47
+
48
+ it('uses the `dataItem` branch for a semantic element type (e.g. Image)', () => {
49
+ const semanticImage: ResolvedType = {
50
+ kind: 'semantic',
51
+ value: 'Image',
52
+ source: '@wix/public-schemas',
53
+ }
54
+ const result = buildDataItem(buildArrayProp(semanticImage))
55
+ expect(result.isOk()).toBe(true)
56
+ const dataItem = result._unsafeUnwrap()
57
+
58
+ expect(dataItem.arrayItems?.data).toBeUndefined()
59
+ expect(dataItem.arrayItems?.dataItem?.dataType).toBe('image')
60
+ })
61
+
62
+ it('uses the `dataItem` branch for a nested array element (string[][])', () => {
63
+ const innerArray: ResolvedType = { kind: 'array', elementType: stringType }
64
+ const result = buildDataItem(buildArrayProp(innerArray))
65
+ expect(result.isOk()).toBe(true)
66
+ const dataItem = result._unsafeUnwrap()
67
+
68
+ expect(dataItem.arrayItems?.data).toBeUndefined()
69
+ expect(dataItem.arrayItems?.dataItem?.dataType).toBe('arrayItems')
70
+ expect(dataItem.arrayItems?.dataItem?.arrayItems?.dataItem?.dataType).toBe('text')
71
+ })
72
+
73
+ it('does not double-wrap object elements (no `dataItem.dataType: data` artefact)', () => {
74
+ const result = buildDataItem(buildArrayProp(objectElementType))
75
+ const arrayItems = result._unsafeUnwrap().arrayItems
76
+ // Regression: previously we emitted arrayItems.dataItem.dataType === 'data',
77
+ // adding an extra wrapping layer. The schema oneof requires `data` directly.
78
+ expect(arrayItems?.dataItem).toBeUndefined()
79
+ })
80
+ })
@@ -233,9 +233,12 @@ function handleArrayType(
233
233
  return result
234
234
  }
235
235
 
236
- dataItem.arrayItems = {
237
- dataItem: elementDataItem,
238
- }
236
+ // ArrayItems is a oneof: use `data` when each element is a multi-field object,
237
+ // and `dataItem` when each element is a single typed value (primitive, semantic, nested array).
238
+ dataItem.arrayItems =
239
+ elementDataItem.dataType === DATA_TYPE.data && elementDataItem.data
240
+ ? { data: elementDataItem.data }
241
+ : { dataItem: elementDataItem }
239
242
 
240
243
  return ok(undefined)
241
244
  }