@builder.io/sdk-qwik 0.0.19 → 0.0.20

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.
@@ -272,7 +272,7 @@ const css = function css2(props, state) {
272
272
  };
273
273
  const BlockStyles = (props) => {
274
274
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
275
- children: TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" ? /* @__PURE__ */ jsxRuntime.jsx(RenderInlinedStyles$1, {
275
+ children: TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" || TARGET === "qwik" ? /* @__PURE__ */ jsxRuntime.jsx(RenderInlinedStyles$1, {
276
276
  styles: css(props)
277
277
  }) : null
278
278
  });
@@ -317,22 +317,8 @@ function getBlockProperties(block) {
317
317
  ].filter(Boolean).join(" ")
318
318
  };
319
319
  }
320
- const convertStyleObject = (obj) => {
321
- return obj;
322
- };
323
- const sanitizeBlockStyles = (_styles) => {
324
- };
325
320
  function getBlockStyles(block) {
326
- const styles = {
327
- ...convertStyleObject(block.responsiveStyles?.large),
328
- ...block.styles
329
- };
330
- if (block.responsiveStyles?.medium)
331
- styles[getMaxWidthQueryForSize("medium")] = convertStyleObject(block.responsiveStyles?.medium);
332
- if (block.responsiveStyles?.small)
333
- styles[getMaxWidthQueryForSize("small")] = convertStyleObject(block.responsiveStyles?.small);
334
- sanitizeBlockStyles();
335
- return styles;
321
+ return null;
336
322
  }
337
323
  function getBlockTag(block) {
338
324
  return block.tagName || "div";
@@ -430,7 +416,7 @@ const component = function component2(props, state) {
430
416
  } else
431
417
  return ref;
432
418
  };
433
- const componentInfo$a = function componentInfo(props, state) {
419
+ const componentInfo$b = function componentInfo(props, state) {
434
420
  if (component(props)) {
435
421
  const { component: _, ...info } = component(props);
436
422
  return info;
@@ -463,7 +449,7 @@ const attributes = function attributes2(props, state) {
463
449
  };
464
450
  };
465
451
  const shouldWrap = function shouldWrap2(props, state) {
466
- return !componentInfo$a(props)?.noWrap;
452
+ return !componentInfo$b(props)?.noWrap;
467
453
  };
468
454
  const componentOptions = function componentOptions2(props, state) {
469
455
  return {
@@ -522,8 +508,7 @@ const RenderBlock = (props) => {
522
508
  };
523
509
  state.tagName = tagName2(props);
524
510
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
525
- children: shouldWrap(props) ? !isEmptyHtmlElement(tagName2(props)) ? /* @__PURE__ */ jsxRuntime.jsxs(state.tagName, {
526
- ...attributes(props),
511
+ children: shouldWrap(props) ? !isEmptyHtmlElement(tagName2(props)) ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
527
512
  children: [
528
513
  repeatItemData(props) ? (repeatItemData(props) || []).map(function(data, index) {
529
514
  return /* @__PURE__ */ jsxRuntime.jsx(RenderRepeatedBlock$1, {
@@ -531,21 +516,26 @@ const RenderBlock = (props) => {
531
516
  block: data.block
532
517
  }, index);
533
518
  }) : null,
534
- !repeatItemData(props) ? /* @__PURE__ */ jsxRuntime.jsx(RenderComponent$1, {
535
- ...renderComponentProps(props)
536
- }) : null,
537
- (childrenWithoutParentComponent(props) || []).map(function(child) {
538
- return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock, {
539
- block: child,
540
- context: props.context
541
- }, "render-block-" + child.id);
542
- }),
543
- (childrenWithoutParentComponent(props) || []).map(function(child) {
544
- return /* @__PURE__ */ jsxRuntime.jsx(BlockStyles$1, {
545
- block: child,
546
- context: props.context
547
- }, "block-style-" + child.id);
548
- })
519
+ !repeatItemData(props) ? /* @__PURE__ */ jsxRuntime.jsxs(state.tagName, {
520
+ ...attributes(props),
521
+ children: [
522
+ /* @__PURE__ */ jsxRuntime.jsx(RenderComponent$1, {
523
+ ...renderComponentProps(props)
524
+ }),
525
+ (childrenWithoutParentComponent(props) || []).map(function(child) {
526
+ return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock, {
527
+ block: child,
528
+ context: props.context
529
+ }, "render-block-" + child.id);
530
+ }),
531
+ (childrenWithoutParentComponent(props) || []).map(function(child) {
532
+ return /* @__PURE__ */ jsxRuntime.jsx(BlockStyles$1, {
533
+ block: child,
534
+ context: props.context
535
+ }, "block-style-" + child.id);
536
+ })
537
+ ]
538
+ }) : null
549
539
  ]
550
540
  }) : /* @__PURE__ */ jsxRuntime.jsx(state.tagName, {
551
541
  ...attributes(props)
@@ -882,7 +872,7 @@ const Video = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
882
872
  const Video$1 = Video;
883
873
  const Button = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
884
874
  qwik.useStylesScopedQrl(qwik.inlinedQrl(STYLES, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
885
- return /* @__PURE__ */ jsxRuntime.jsx(qwik.Fragment, {
875
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
886
876
  children: props.link ? /* @__PURE__ */ jsxRuntime.jsx("a", {
887
877
  role: "button",
888
878
  ...props.attributes,
@@ -899,7 +889,7 @@ const Button = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
899
889
  const Button$1 = Button;
900
890
  const STYLES = `.button-Button {
901
891
  all: unset; }`;
902
- const componentInfo$9 = {
892
+ const componentInfo$a = {
903
893
  name: "Core:Button",
904
894
  builtIn: true,
905
895
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
@@ -941,7 +931,7 @@ function markSerializable(fn) {
941
931
  fn.__qwik_serializable__ = true;
942
932
  return fn;
943
933
  }
944
- const componentInfo$8 = {
934
+ const componentInfo$9 = {
945
935
  name: "Columns",
946
936
  builtIn: true,
947
937
  inputs: [
@@ -1182,7 +1172,7 @@ const componentInfo$8 = {
1182
1172
  }
1183
1173
  ]
1184
1174
  };
1185
- const componentInfo$7 = {
1175
+ const componentInfo$8 = {
1186
1176
  name: "Fragment",
1187
1177
  static: true,
1188
1178
  hidden: true,
@@ -1196,7 +1186,7 @@ const FragmentComponent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((pro
1196
1186
  });
1197
1187
  }, "FragmentComponent_component_T0AypnadAK0"));
1198
1188
  const Fragment = FragmentComponent;
1199
- const componentInfo$6 = {
1189
+ const componentInfo$7 = {
1200
1190
  name: "Image",
1201
1191
  static: true,
1202
1192
  builtIn: true,
@@ -1345,7 +1335,7 @@ const componentInfo$6 = {
1345
1335
  }
1346
1336
  ]
1347
1337
  };
1348
- const componentInfo$5 = {
1338
+ const componentInfo$6 = {
1349
1339
  name: "Core:Section",
1350
1340
  static: true,
1351
1341
  builtIn: true,
@@ -1401,7 +1391,7 @@ const SectionComponent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((prop
1401
1391
  });
1402
1392
  }, "SectionComponent_component_ZWF9iD5WeLg"));
1403
1393
  const Section = SectionComponent;
1404
- const componentInfo$4 = {
1394
+ const componentInfo$5 = {
1405
1395
  name: "Symbol",
1406
1396
  noWrap: true,
1407
1397
  static: true,
@@ -1441,7 +1431,7 @@ const componentInfo$4 = {
1441
1431
  }
1442
1432
  ]
1443
1433
  };
1444
- const componentInfo$3 = {
1434
+ const componentInfo$4 = {
1445
1435
  name: "Text",
1446
1436
  static: true,
1447
1437
  builtIn: true,
@@ -1462,7 +1452,7 @@ const componentInfo$3 = {
1462
1452
  textAlign: "center"
1463
1453
  }
1464
1454
  };
1465
- const componentInfo$2 = {
1455
+ const componentInfo$3 = {
1466
1456
  name: "Video",
1467
1457
  canHaveChildren: true,
1468
1458
  builtIn: true,
@@ -1575,7 +1565,7 @@ const componentInfo$2 = {
1575
1565
  }
1576
1566
  ]
1577
1567
  };
1578
- const componentInfo$1 = {
1568
+ const componentInfo$2 = {
1579
1569
  name: "Embed",
1580
1570
  static: true,
1581
1571
  builtIn: true,
@@ -1619,7 +1609,9 @@ const SCRIPT_MIME_TYPES = [
1619
1609
  "application/ecmascript"
1620
1610
  ];
1621
1611
  const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
1622
- const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
1612
+ const findAndRunScripts$1 = function findAndRunScripts(props, state, elem) {
1613
+ if (!elem)
1614
+ return;
1623
1615
  const scripts = elem.getElementsByTagName("script");
1624
1616
  for (let i = 0; i < scripts.length; i++) {
1625
1617
  const script = scripts[i];
@@ -1650,7 +1642,7 @@ const Embed = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
1650
1642
  state2 && track2(state2, "ranInitFn");
1651
1643
  if (elem2 && !state2.ranInitFn) {
1652
1644
  state2.ranInitFn = true;
1653
- findAndRunScripts(props2, state2, elem2);
1645
+ findAndRunScripts$1(props2, state2, elem2);
1654
1646
  }
1655
1647
  }, "Embed_component_useWatch_AxgWjrHdlAI", [
1656
1648
  elem,
@@ -1676,7 +1668,7 @@ const ImgComponent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
1676
1668
  }, isEditing() && props.imgSrc || "default-key");
1677
1669
  }, "ImgComponent_component_FXvIDBSffO8"));
1678
1670
  const Img = ImgComponent;
1679
- const componentInfo2 = {
1671
+ const componentInfo$1 = {
1680
1672
  name: "Raw:Img",
1681
1673
  hideFromInsertMenu: true,
1682
1674
  builtIn: true,
@@ -1698,46 +1690,131 @@ const componentInfo2 = {
1698
1690
  noWrap: true,
1699
1691
  static: true
1700
1692
  };
1693
+ const findAndRunScripts2 = function findAndRunScripts3(props, state, elem) {
1694
+ if (elem && typeof window !== "undefined") {
1695
+ const scripts = elem.getElementsByTagName("script");
1696
+ for (let i = 0; i < scripts.length; i++) {
1697
+ const script = scripts[i];
1698
+ if (script.src) {
1699
+ if (state.scriptsInserted.includes(script.src))
1700
+ continue;
1701
+ state.scriptsInserted.push(script.src);
1702
+ const newScript = document.createElement("script");
1703
+ newScript.async = true;
1704
+ newScript.src = script.src;
1705
+ document.head.appendChild(newScript);
1706
+ } else if (!script.type || [
1707
+ "text/javascript",
1708
+ "application/javascript",
1709
+ "application/ecmascript"
1710
+ ].includes(script.type)) {
1711
+ if (state.scriptsRun.includes(script.innerText))
1712
+ continue;
1713
+ try {
1714
+ state.scriptsRun.push(script.innerText);
1715
+ new Function(script.innerText)();
1716
+ } catch (error) {
1717
+ console.warn("`CustomCode`: Error running script:", error);
1718
+ }
1719
+ }
1720
+ }
1721
+ }
1722
+ };
1723
+ const CustomCode = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
1724
+ const elem = qwik.useRef();
1725
+ const state = qwik.useStore({
1726
+ scriptsInserted: [],
1727
+ scriptsRun: []
1728
+ });
1729
+ qwik.useClientEffectQrl(qwik.inlinedQrl(() => {
1730
+ const [elem2, props2, state2] = qwik.useLexicalScope();
1731
+ findAndRunScripts2(props2, state2, elem2);
1732
+ }, "CustomCode_component_useClientEffect_4w4c951ufB4", [
1733
+ elem,
1734
+ props,
1735
+ state
1736
+ ]));
1737
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
1738
+ ref: elem,
1739
+ class: "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""),
1740
+ dangerouslySetInnerHTML: props.code
1741
+ });
1742
+ }, "CustomCode_component_uYOSy7w7Zqw"));
1743
+ const customCode = CustomCode;
1744
+ const componentInfo2 = {
1745
+ name: "Custom Code",
1746
+ static: true,
1747
+ builtIn: true,
1748
+ requiredPermissions: [
1749
+ "editCode"
1750
+ ],
1751
+ inputs: [
1752
+ {
1753
+ name: "code",
1754
+ type: "html",
1755
+ required: true,
1756
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
1757
+ code: true
1758
+ },
1759
+ {
1760
+ name: "replaceNodes",
1761
+ type: "boolean",
1762
+ helperText: "Preserve server rendered dom nodes",
1763
+ advanced: true
1764
+ },
1765
+ {
1766
+ name: "scriptsClientOnly",
1767
+ type: "boolean",
1768
+ defaultValue: false,
1769
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
1770
+ advanced: true
1771
+ }
1772
+ ]
1773
+ };
1701
1774
  const getDefaultRegisteredComponents = () => [
1702
1775
  {
1703
1776
  component: Columns$1,
1704
- ...componentInfo$8
1777
+ ...componentInfo$9
1705
1778
  },
1706
1779
  {
1707
1780
  component: Image$1,
1708
- ...componentInfo$6
1781
+ ...componentInfo$7
1709
1782
  },
1710
1783
  {
1711
1784
  component: Img,
1712
- ...componentInfo2
1785
+ ...componentInfo$1
1713
1786
  },
1714
1787
  {
1715
1788
  component: Text$1,
1716
- ...componentInfo$3
1789
+ ...componentInfo$4
1717
1790
  },
1718
1791
  {
1719
1792
  component: Video$1,
1720
- ...componentInfo$2
1793
+ ...componentInfo$3
1721
1794
  },
1722
1795
  {
1723
1796
  component: Symbol$2,
1724
- ...componentInfo$4
1797
+ ...componentInfo$5
1725
1798
  },
1726
1799
  {
1727
1800
  component: Button$1,
1728
- ...componentInfo$9
1801
+ ...componentInfo$a
1729
1802
  },
1730
1803
  {
1731
1804
  component: Section,
1732
- ...componentInfo$5
1805
+ ...componentInfo$6
1733
1806
  },
1734
1807
  {
1735
1808
  component: Fragment,
1736
- ...componentInfo$7
1809
+ ...componentInfo$8
1737
1810
  },
1738
1811
  {
1739
1812
  component: embed,
1740
- ...componentInfo$1
1813
+ ...componentInfo$2
1814
+ },
1815
+ {
1816
+ component: customCode,
1817
+ ...componentInfo2
1741
1818
  }
1742
1819
  ];
1743
1820
  function flatten(object, path = null, separator = ".") {
@@ -1797,17 +1874,13 @@ function getGlobalThis() {
1797
1874
  return self;
1798
1875
  return null;
1799
1876
  }
1800
- const NODE_FETCH_URL = () => "node-fetch";
1801
- let fetch$1 = void 0;
1802
1877
  async function getFetch() {
1803
- if (fetch$1)
1804
- return fetch$1;
1805
1878
  const globalFetch = getGlobalThis().fetch;
1806
1879
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1807
- const nodeFetch = Promise.resolve().then(() => /* @__PURE__ */ _interopNamespace(require(NODE_FETCH_URL()))).then((d) => d.default);
1808
- return fetch$1 = nodeFetch.default || nodeFetch;
1880
+ const nodeFetch = Promise.resolve().then(() => /* @__PURE__ */ _interopNamespace(require("node-fetch"))).then((d) => d.default);
1881
+ return nodeFetch.default || nodeFetch;
1809
1882
  }
1810
- return fetch$1 = globalFetch.default || globalFetch;
1883
+ return globalFetch.default || globalFetch;
1811
1884
  }
1812
1885
  const handleABTesting = (item, testGroups) => {
1813
1886
  if (item.variations && Object.keys(item.variations).length) {
@@ -2393,6 +2466,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
2393
2466
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
2394
2467
  children: useContent(props, state) ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
2395
2468
  ref: elementRef,
2469
+ "builder-content-id": useContent(props, state)?.id,
2396
2470
  onClick$: qwik.inlinedQrl((event) => {
2397
2471
  const [elementRef2, props2, state2] = qwik.useLexicalScope();
2398
2472
  return onClick2(props2, state2);
@@ -2401,7 +2475,6 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
2401
2475
  props,
2402
2476
  state
2403
2477
  ]),
2404
- "builder-content-id": useContent(props, state)?.id,
2405
2478
  children: [
2406
2479
  shouldRenderContentStyles(props, state) ? /* @__PURE__ */ jsxRuntime.jsx(RenderContentStyles$1, {
2407
2480
  cssCode: useContent(props, state)?.data?.cssCode,
@@ -1,4 +1,4 @@
1
- import { createContext, mutable, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
1
+ import { createContext, mutable, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
2
2
  import { jsx, Fragment as Fragment$1, jsxs } from "@builder.io/qwik/jsx-runtime";
3
3
  const TARGET = "qwik";
4
4
  function isBrowser() {
@@ -252,7 +252,7 @@ const css = function css2(props, state) {
252
252
  };
253
253
  const BlockStyles = (props) => {
254
254
  return /* @__PURE__ */ jsx(Fragment$1, {
255
- children: TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" ? /* @__PURE__ */ jsx(RenderInlinedStyles$1, {
255
+ children: TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" || TARGET === "qwik" ? /* @__PURE__ */ jsx(RenderInlinedStyles$1, {
256
256
  styles: css(props)
257
257
  }) : null
258
258
  });
@@ -297,22 +297,8 @@ function getBlockProperties(block) {
297
297
  ].filter(Boolean).join(" ")
298
298
  };
299
299
  }
300
- const convertStyleObject = (obj) => {
301
- return obj;
302
- };
303
- const sanitizeBlockStyles = (_styles) => {
304
- };
305
300
  function getBlockStyles(block) {
306
- const styles = {
307
- ...convertStyleObject(block.responsiveStyles?.large),
308
- ...block.styles
309
- };
310
- if (block.responsiveStyles?.medium)
311
- styles[getMaxWidthQueryForSize("medium")] = convertStyleObject(block.responsiveStyles?.medium);
312
- if (block.responsiveStyles?.small)
313
- styles[getMaxWidthQueryForSize("small")] = convertStyleObject(block.responsiveStyles?.small);
314
- sanitizeBlockStyles();
315
- return styles;
301
+ return null;
316
302
  }
317
303
  function getBlockTag(block) {
318
304
  return block.tagName || "div";
@@ -410,7 +396,7 @@ const component = function component2(props, state) {
410
396
  } else
411
397
  return ref;
412
398
  };
413
- const componentInfo$a = function componentInfo(props, state) {
399
+ const componentInfo$b = function componentInfo(props, state) {
414
400
  if (component(props)) {
415
401
  const { component: _, ...info } = component(props);
416
402
  return info;
@@ -443,7 +429,7 @@ const attributes = function attributes2(props, state) {
443
429
  };
444
430
  };
445
431
  const shouldWrap = function shouldWrap2(props, state) {
446
- return !componentInfo$a(props)?.noWrap;
432
+ return !componentInfo$b(props)?.noWrap;
447
433
  };
448
434
  const componentOptions = function componentOptions2(props, state) {
449
435
  return {
@@ -502,8 +488,7 @@ const RenderBlock = (props) => {
502
488
  };
503
489
  state.tagName = tagName2(props);
504
490
  return /* @__PURE__ */ jsx(Fragment$1, {
505
- children: shouldWrap(props) ? !isEmptyHtmlElement(tagName2(props)) ? /* @__PURE__ */ jsxs(state.tagName, {
506
- ...attributes(props),
491
+ children: shouldWrap(props) ? !isEmptyHtmlElement(tagName2(props)) ? /* @__PURE__ */ jsxs(Fragment$1, {
507
492
  children: [
508
493
  repeatItemData(props) ? (repeatItemData(props) || []).map(function(data, index) {
509
494
  return /* @__PURE__ */ jsx(RenderRepeatedBlock$1, {
@@ -511,21 +496,26 @@ const RenderBlock = (props) => {
511
496
  block: data.block
512
497
  }, index);
513
498
  }) : null,
514
- !repeatItemData(props) ? /* @__PURE__ */ jsx(RenderComponent$1, {
515
- ...renderComponentProps(props)
516
- }) : null,
517
- (childrenWithoutParentComponent(props) || []).map(function(child) {
518
- return /* @__PURE__ */ jsx(RenderBlock, {
519
- block: child,
520
- context: props.context
521
- }, "render-block-" + child.id);
522
- }),
523
- (childrenWithoutParentComponent(props) || []).map(function(child) {
524
- return /* @__PURE__ */ jsx(BlockStyles$1, {
525
- block: child,
526
- context: props.context
527
- }, "block-style-" + child.id);
528
- })
499
+ !repeatItemData(props) ? /* @__PURE__ */ jsxs(state.tagName, {
500
+ ...attributes(props),
501
+ children: [
502
+ /* @__PURE__ */ jsx(RenderComponent$1, {
503
+ ...renderComponentProps(props)
504
+ }),
505
+ (childrenWithoutParentComponent(props) || []).map(function(child) {
506
+ return /* @__PURE__ */ jsx(RenderBlock, {
507
+ block: child,
508
+ context: props.context
509
+ }, "render-block-" + child.id);
510
+ }),
511
+ (childrenWithoutParentComponent(props) || []).map(function(child) {
512
+ return /* @__PURE__ */ jsx(BlockStyles$1, {
513
+ block: child,
514
+ context: props.context
515
+ }, "block-style-" + child.id);
516
+ })
517
+ ]
518
+ }) : null
529
519
  ]
530
520
  }) : /* @__PURE__ */ jsx(state.tagName, {
531
521
  ...attributes(props)
@@ -862,7 +852,7 @@ const Video = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
862
852
  const Video$1 = Video;
863
853
  const Button = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
864
854
  useStylesScopedQrl(inlinedQrl(STYLES, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
865
- return /* @__PURE__ */ jsx(Fragment$2, {
855
+ return /* @__PURE__ */ jsx(Fragment$1, {
866
856
  children: props.link ? /* @__PURE__ */ jsx("a", {
867
857
  role: "button",
868
858
  ...props.attributes,
@@ -879,7 +869,7 @@ const Button = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
879
869
  const Button$1 = Button;
880
870
  const STYLES = `.button-Button {
881
871
  all: unset; }`;
882
- const componentInfo$9 = {
872
+ const componentInfo$a = {
883
873
  name: "Core:Button",
884
874
  builtIn: true,
885
875
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
@@ -921,7 +911,7 @@ function markSerializable(fn) {
921
911
  fn.__qwik_serializable__ = true;
922
912
  return fn;
923
913
  }
924
- const componentInfo$8 = {
914
+ const componentInfo$9 = {
925
915
  name: "Columns",
926
916
  builtIn: true,
927
917
  inputs: [
@@ -1162,7 +1152,7 @@ const componentInfo$8 = {
1162
1152
  }
1163
1153
  ]
1164
1154
  };
1165
- const componentInfo$7 = {
1155
+ const componentInfo$8 = {
1166
1156
  name: "Fragment",
1167
1157
  static: true,
1168
1158
  hidden: true,
@@ -1176,7 +1166,7 @@ const FragmentComponent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1176
1166
  });
1177
1167
  }, "FragmentComponent_component_T0AypnadAK0"));
1178
1168
  const Fragment = FragmentComponent;
1179
- const componentInfo$6 = {
1169
+ const componentInfo$7 = {
1180
1170
  name: "Image",
1181
1171
  static: true,
1182
1172
  builtIn: true,
@@ -1325,7 +1315,7 @@ const componentInfo$6 = {
1325
1315
  }
1326
1316
  ]
1327
1317
  };
1328
- const componentInfo$5 = {
1318
+ const componentInfo$6 = {
1329
1319
  name: "Core:Section",
1330
1320
  static: true,
1331
1321
  builtIn: true,
@@ -1381,7 +1371,7 @@ const SectionComponent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1381
1371
  });
1382
1372
  }, "SectionComponent_component_ZWF9iD5WeLg"));
1383
1373
  const Section = SectionComponent;
1384
- const componentInfo$4 = {
1374
+ const componentInfo$5 = {
1385
1375
  name: "Symbol",
1386
1376
  noWrap: true,
1387
1377
  static: true,
@@ -1421,7 +1411,7 @@ const componentInfo$4 = {
1421
1411
  }
1422
1412
  ]
1423
1413
  };
1424
- const componentInfo$3 = {
1414
+ const componentInfo$4 = {
1425
1415
  name: "Text",
1426
1416
  static: true,
1427
1417
  builtIn: true,
@@ -1442,7 +1432,7 @@ const componentInfo$3 = {
1442
1432
  textAlign: "center"
1443
1433
  }
1444
1434
  };
1445
- const componentInfo$2 = {
1435
+ const componentInfo$3 = {
1446
1436
  name: "Video",
1447
1437
  canHaveChildren: true,
1448
1438
  builtIn: true,
@@ -1555,7 +1545,7 @@ const componentInfo$2 = {
1555
1545
  }
1556
1546
  ]
1557
1547
  };
1558
- const componentInfo$1 = {
1548
+ const componentInfo$2 = {
1559
1549
  name: "Embed",
1560
1550
  static: true,
1561
1551
  builtIn: true,
@@ -1599,7 +1589,9 @@ const SCRIPT_MIME_TYPES = [
1599
1589
  "application/ecmascript"
1600
1590
  ];
1601
1591
  const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
1602
- const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
1592
+ const findAndRunScripts$1 = function findAndRunScripts(props, state, elem) {
1593
+ if (!elem)
1594
+ return;
1603
1595
  const scripts = elem.getElementsByTagName("script");
1604
1596
  for (let i = 0; i < scripts.length; i++) {
1605
1597
  const script = scripts[i];
@@ -1630,7 +1622,7 @@ const Embed = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1630
1622
  state2 && track2(state2, "ranInitFn");
1631
1623
  if (elem2 && !state2.ranInitFn) {
1632
1624
  state2.ranInitFn = true;
1633
- findAndRunScripts(props2, state2, elem2);
1625
+ findAndRunScripts$1(props2, state2, elem2);
1634
1626
  }
1635
1627
  }, "Embed_component_useWatch_AxgWjrHdlAI", [
1636
1628
  elem,
@@ -1656,7 +1648,7 @@ const ImgComponent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1656
1648
  }, isEditing() && props.imgSrc || "default-key");
1657
1649
  }, "ImgComponent_component_FXvIDBSffO8"));
1658
1650
  const Img = ImgComponent;
1659
- const componentInfo2 = {
1651
+ const componentInfo$1 = {
1660
1652
  name: "Raw:Img",
1661
1653
  hideFromInsertMenu: true,
1662
1654
  builtIn: true,
@@ -1678,46 +1670,131 @@ const componentInfo2 = {
1678
1670
  noWrap: true,
1679
1671
  static: true
1680
1672
  };
1673
+ const findAndRunScripts2 = function findAndRunScripts3(props, state, elem) {
1674
+ if (elem && typeof window !== "undefined") {
1675
+ const scripts = elem.getElementsByTagName("script");
1676
+ for (let i = 0; i < scripts.length; i++) {
1677
+ const script = scripts[i];
1678
+ if (script.src) {
1679
+ if (state.scriptsInserted.includes(script.src))
1680
+ continue;
1681
+ state.scriptsInserted.push(script.src);
1682
+ const newScript = document.createElement("script");
1683
+ newScript.async = true;
1684
+ newScript.src = script.src;
1685
+ document.head.appendChild(newScript);
1686
+ } else if (!script.type || [
1687
+ "text/javascript",
1688
+ "application/javascript",
1689
+ "application/ecmascript"
1690
+ ].includes(script.type)) {
1691
+ if (state.scriptsRun.includes(script.innerText))
1692
+ continue;
1693
+ try {
1694
+ state.scriptsRun.push(script.innerText);
1695
+ new Function(script.innerText)();
1696
+ } catch (error) {
1697
+ console.warn("`CustomCode`: Error running script:", error);
1698
+ }
1699
+ }
1700
+ }
1701
+ }
1702
+ };
1703
+ const CustomCode = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1704
+ const elem = useRef();
1705
+ const state = useStore({
1706
+ scriptsInserted: [],
1707
+ scriptsRun: []
1708
+ });
1709
+ useClientEffectQrl(inlinedQrl(() => {
1710
+ const [elem2, props2, state2] = useLexicalScope();
1711
+ findAndRunScripts2(props2, state2, elem2);
1712
+ }, "CustomCode_component_useClientEffect_4w4c951ufB4", [
1713
+ elem,
1714
+ props,
1715
+ state
1716
+ ]));
1717
+ return /* @__PURE__ */ jsx("div", {
1718
+ ref: elem,
1719
+ class: "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""),
1720
+ dangerouslySetInnerHTML: props.code
1721
+ });
1722
+ }, "CustomCode_component_uYOSy7w7Zqw"));
1723
+ const customCode = CustomCode;
1724
+ const componentInfo2 = {
1725
+ name: "Custom Code",
1726
+ static: true,
1727
+ builtIn: true,
1728
+ requiredPermissions: [
1729
+ "editCode"
1730
+ ],
1731
+ inputs: [
1732
+ {
1733
+ name: "code",
1734
+ type: "html",
1735
+ required: true,
1736
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
1737
+ code: true
1738
+ },
1739
+ {
1740
+ name: "replaceNodes",
1741
+ type: "boolean",
1742
+ helperText: "Preserve server rendered dom nodes",
1743
+ advanced: true
1744
+ },
1745
+ {
1746
+ name: "scriptsClientOnly",
1747
+ type: "boolean",
1748
+ defaultValue: false,
1749
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
1750
+ advanced: true
1751
+ }
1752
+ ]
1753
+ };
1681
1754
  const getDefaultRegisteredComponents = () => [
1682
1755
  {
1683
1756
  component: Columns$1,
1684
- ...componentInfo$8
1757
+ ...componentInfo$9
1685
1758
  },
1686
1759
  {
1687
1760
  component: Image$1,
1688
- ...componentInfo$6
1761
+ ...componentInfo$7
1689
1762
  },
1690
1763
  {
1691
1764
  component: Img,
1692
- ...componentInfo2
1765
+ ...componentInfo$1
1693
1766
  },
1694
1767
  {
1695
1768
  component: Text$1,
1696
- ...componentInfo$3
1769
+ ...componentInfo$4
1697
1770
  },
1698
1771
  {
1699
1772
  component: Video$1,
1700
- ...componentInfo$2
1773
+ ...componentInfo$3
1701
1774
  },
1702
1775
  {
1703
1776
  component: Symbol$2,
1704
- ...componentInfo$4
1777
+ ...componentInfo$5
1705
1778
  },
1706
1779
  {
1707
1780
  component: Button$1,
1708
- ...componentInfo$9
1781
+ ...componentInfo$a
1709
1782
  },
1710
1783
  {
1711
1784
  component: Section,
1712
- ...componentInfo$5
1785
+ ...componentInfo$6
1713
1786
  },
1714
1787
  {
1715
1788
  component: Fragment,
1716
- ...componentInfo$7
1789
+ ...componentInfo$8
1717
1790
  },
1718
1791
  {
1719
1792
  component: embed,
1720
- ...componentInfo$1
1793
+ ...componentInfo$2
1794
+ },
1795
+ {
1796
+ component: customCode,
1797
+ ...componentInfo2
1721
1798
  }
1722
1799
  ];
1723
1800
  function flatten(object, path = null, separator = ".") {
@@ -1777,17 +1854,13 @@ function getGlobalThis() {
1777
1854
  return self;
1778
1855
  return null;
1779
1856
  }
1780
- const NODE_FETCH_URL = () => "node-fetch";
1781
- let fetch$1 = void 0;
1782
1857
  async function getFetch() {
1783
- if (fetch$1)
1784
- return fetch$1;
1785
1858
  const globalFetch = getGlobalThis().fetch;
1786
1859
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1787
- const nodeFetch = import(NODE_FETCH_URL()).then((d) => d.default);
1788
- return fetch$1 = nodeFetch.default || nodeFetch;
1860
+ const nodeFetch = import("node-fetch").then((d) => d.default);
1861
+ return nodeFetch.default || nodeFetch;
1789
1862
  }
1790
- return fetch$1 = globalFetch.default || globalFetch;
1863
+ return globalFetch.default || globalFetch;
1791
1864
  }
1792
1865
  const handleABTesting = (item, testGroups) => {
1793
1866
  if (item.variations && Object.keys(item.variations).length) {
@@ -2373,6 +2446,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2373
2446
  return /* @__PURE__ */ jsx(Fragment$1, {
2374
2447
  children: useContent(props, state) ? /* @__PURE__ */ jsxs("div", {
2375
2448
  ref: elementRef,
2449
+ "builder-content-id": useContent(props, state)?.id,
2376
2450
  onClick$: inlinedQrl((event) => {
2377
2451
  const [elementRef2, props2, state2] = useLexicalScope();
2378
2452
  return onClick2(props2, state2);
@@ -2381,7 +2455,6 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2381
2455
  props,
2382
2456
  state
2383
2457
  ]),
2384
- "builder-content-id": useContent(props, state)?.id,
2385
2458
  children: [
2386
2459
  shouldRenderContentStyles(props, state) ? /* @__PURE__ */ jsx(RenderContentStyles$1, {
2387
2460
  cssCode: useContent(props, state)?.data?.cssCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -15,16 +15,17 @@
15
15
  },
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
- "build.lib": "tsc && vite build --mode lib",
19
- "release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag latest --access public"
18
+ "build": "tsc && vite build --mode lib",
19
+ "release:patch": "yarn run build && npm version patch --no-git-tag-version && npm publish --access public",
20
+ "release:dev": "yarn run build && npm version prerelease --no-git-tag-version && npm publish --tag latest --access public"
20
21
  },
21
22
  "devDependencies": {
22
- "@builder.io/qwik": "BuilderIO/qwik-build#commit=08a6883d163f8eea8dc1710357b63b7ac01b2bef",
23
+ "@builder.io/qwik": "0.0.108-dev20220913220811",
23
24
  "@types/node": "latest",
24
- "typescript": "4.7.4",
25
- "vite": "3.0.2"
25
+ "typescript": "^4",
26
+ "vite": "^3.0.4"
26
27
  },
27
28
  "peerDependencies": {
28
- "@builder.io/qwik": "0.0.108"
29
+ "@builder.io/qwik": "0.0.108-dev20220913220811"
29
30
  }
30
31
  }
@@ -8,7 +8,7 @@ export declare type RenderBlockProps = {
8
8
  export declare const component: (props: any, state: any) => any;
9
9
  export declare const componentInfo: (props: any, state: any) => any;
10
10
  export declare const componentRef: (props: any, state: any) => any;
11
- export declare const tagName: (props: any, state: any) => import("../../functions/get-block-tag.js").TagName;
11
+ export declare const tagName: (props: any, state: any) => string;
12
12
  export declare const useBlock: (props: any, state: any) => any;
13
13
  export declare const attributes: (props: any, state: any) => {
14
14
  style: any;
@@ -1,6 +1,6 @@
1
1
  import { BuilderRenderContext, RegisteredComponent } from "../../context/types.js";
2
2
  import { BuilderContent } from "../../types/builder-content.js";
3
- import { Nullable } from "../../types/typescript.js";
3
+ import type { Nullable } from "../../types/typescript.js";
4
4
  export declare type RenderContentProps = {
5
5
  content?: Nullable<BuilderContent>;
6
6
  model?: string;
@@ -1,10 +1,3 @@
1
- import { JSX } from '@builder.io/mitosis/jsx-runtime';
2
1
  import { BuilderBlock } from '../types/builder-block.js';
3
- declare type JSXElementConstructor<P> = (props: P) => JSX.Element | null;
4
- export declare type TagName = string | JSXElementConstructor<any>;
5
- /**
6
- * The `JSXElementConstructor` type is here to account for a react-native override, where we have a
7
- * `View` tag wrapping every component.
8
- */
2
+ export declare type TagName = string;
9
3
  export declare function getBlockTag(block: BuilderBlock): TagName;
10
- export {};
@@ -8,7 +8,7 @@ export declare const components: RegisteredComponent[];
8
8
  * @deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.
9
9
  */
10
10
  export declare function registerComponent(component: any, info: ComponentInfo): void;
11
- export declare const createRegisterComponentMessage: ({ component: _, ...info }: RegisteredComponent) => {
11
+ export declare const createRegisterComponentMessage: ({ component, ...info }: RegisteredComponent) => {
12
12
  type: string;
13
13
  data: ComponentInfo;
14
14
  };