@builder.io/react 3.0.2-0 → 3.0.3-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 (139) hide show
  1. package/dist/builder-react-lite.cjs.js +1 -1
  2. package/dist/builder-react-lite.cjs.js.map +1 -1
  3. package/dist/builder-react-lite.esm.js +1 -1
  4. package/dist/builder-react-lite.esm.js.map +1 -1
  5. package/dist/builder-react.browser.js +2 -2
  6. package/dist/builder-react.browser.js.map +1 -1
  7. package/dist/builder-react.cjs.js +1 -1
  8. package/dist/builder-react.cjs.js.map +1 -1
  9. package/dist/builder-react.es5.js +2 -0
  10. package/dist/builder-react.es5.js.map +1 -0
  11. package/dist/builder-react.unpkg.js +2 -2
  12. package/dist/builder-react.unpkg.js.map +1 -1
  13. package/dist/lib/package.json +4 -4
  14. package/dist/lib/rollup.config.js +29 -23
  15. package/dist/lib/rollup.config.js.map +1 -1
  16. package/dist/lib/src/blocks/Button.js +13 -7
  17. package/dist/lib/src/blocks/Button.js.map +1 -1
  18. package/dist/lib/src/blocks/Columns.js +21 -15
  19. package/dist/lib/src/blocks/Columns.js.map +1 -1
  20. package/dist/lib/src/blocks/CustomCode.js +19 -13
  21. package/dist/lib/src/blocks/CustomCode.js.map +1 -1
  22. package/dist/lib/src/blocks/Embed.js +13 -7
  23. package/dist/lib/src/blocks/Embed.js.map +1 -1
  24. package/dist/lib/src/blocks/Fragment.js +12 -6
  25. package/dist/lib/src/blocks/Fragment.js.map +1 -1
  26. package/dist/lib/src/blocks/Image.js +39 -30
  27. package/dist/lib/src/blocks/Image.js.map +1 -1
  28. package/dist/lib/src/blocks/Mutation.js +17 -10
  29. package/dist/lib/src/blocks/Mutation.js.map +1 -1
  30. package/dist/lib/src/blocks/Router.js +24 -18
  31. package/dist/lib/src/blocks/Router.js.map +1 -1
  32. package/dist/lib/src/blocks/Section.js +15 -9
  33. package/dist/lib/src/blocks/Section.js.map +1 -1
  34. package/dist/lib/src/blocks/Slot.js +14 -10
  35. package/dist/lib/src/blocks/Slot.js.map +1 -1
  36. package/dist/lib/src/blocks/StateProvider.js +14 -8
  37. package/dist/lib/src/blocks/StateProvider.js.map +1 -1
  38. package/dist/lib/src/blocks/Symbol.js +27 -21
  39. package/dist/lib/src/blocks/Symbol.js.map +1 -1
  40. package/dist/lib/src/blocks/Text.js +20 -14
  41. package/dist/lib/src/blocks/Text.js.map +1 -1
  42. package/dist/lib/src/blocks/Video.js +21 -15
  43. package/dist/lib/src/blocks/Video.js.map +1 -1
  44. package/dist/lib/src/blocks/forms/Button.js +11 -5
  45. package/dist/lib/src/blocks/forms/Button.js.map +1 -1
  46. package/dist/lib/src/blocks/forms/Form.js +28 -22
  47. package/dist/lib/src/blocks/forms/Form.js.map +1 -1
  48. package/dist/lib/src/blocks/forms/Input.js +12 -6
  49. package/dist/lib/src/blocks/forms/Input.js.map +1 -1
  50. package/dist/lib/src/blocks/forms/Label.js +14 -8
  51. package/dist/lib/src/blocks/forms/Label.js.map +1 -1
  52. package/dist/lib/src/blocks/forms/Select.js +13 -7
  53. package/dist/lib/src/blocks/forms/Select.js.map +1 -1
  54. package/dist/lib/src/blocks/forms/TextArea.js +11 -5
  55. package/dist/lib/src/blocks/forms/TextArea.js.map +1 -1
  56. package/dist/lib/src/blocks/raw/Img.js +11 -5
  57. package/dist/lib/src/blocks/raw/Img.js.map +1 -1
  58. package/dist/lib/src/blocks/raw/RawText.js +31 -4
  59. package/dist/lib/src/blocks/raw/RawText.js.map +1 -1
  60. package/dist/lib/src/builder-react-lite.js +30 -17
  61. package/dist/lib/src/builder-react-lite.js.map +1 -1
  62. package/dist/lib/src/builder-react.js +98 -44
  63. package/dist/lib/src/builder-react.js.map +1 -1
  64. package/dist/lib/src/components/Link.js +11 -4
  65. package/dist/lib/src/components/Link.js.map +1 -1
  66. package/dist/lib/src/components/builder-block.component.js +52 -46
  67. package/dist/lib/src/components/builder-block.component.js.map +1 -1
  68. package/dist/lib/src/components/builder-blocks.component.js +22 -16
  69. package/dist/lib/src/components/builder-blocks.component.js.map +1 -1
  70. package/dist/lib/src/components/builder-component.component.js +109 -104
  71. package/dist/lib/src/components/builder-component.component.js.map +1 -1
  72. package/dist/lib/src/components/builder-content.component.js +38 -31
  73. package/dist/lib/src/components/builder-content.component.js.map +1 -1
  74. package/dist/lib/src/components/insert-spacer.component.js +17 -11
  75. package/dist/lib/src/components/insert-spacer.component.js.map +1 -1
  76. package/dist/lib/src/components/no-wrap.js +5 -1
  77. package/dist/lib/src/components/no-wrap.js.map +1 -1
  78. package/dist/lib/src/components/variants-provider.component.js +36 -9
  79. package/dist/lib/src/components/variants-provider.component.js.map +1 -1
  80. package/dist/lib/src/constants/device-sizes.constant.js +9 -5
  81. package/dist/lib/src/constants/device-sizes.constant.js.map +1 -1
  82. package/dist/lib/src/decorators/builder-block.decorator.js +7 -3
  83. package/dist/lib/src/decorators/builder-block.decorator.js.map +1 -1
  84. package/dist/lib/src/functions/apply-patch-with-mutation.js +5 -1
  85. package/dist/lib/src/functions/apply-patch-with-mutation.js.map +1 -1
  86. package/dist/lib/src/functions/apply-patch-with-mutation.test.js +6 -4
  87. package/dist/lib/src/functions/apply-patch-with-mutation.test.js.map +1 -1
  88. package/dist/lib/src/functions/block-to-html-string.js +10 -5
  89. package/dist/lib/src/functions/block-to-html-string.js.map +1 -1
  90. package/dist/lib/src/functions/debonce-next-tick.js +7 -3
  91. package/dist/lib/src/functions/debonce-next-tick.js.map +1 -1
  92. package/dist/lib/src/functions/get-builder-pixel.js +5 -1
  93. package/dist/lib/src/functions/get-builder-pixel.js.map +1 -1
  94. package/dist/lib/src/functions/get.js +5 -1
  95. package/dist/lib/src/functions/get.js.map +1 -1
  96. package/dist/lib/src/functions/no-wrap.js +11 -4
  97. package/dist/lib/src/functions/no-wrap.js.map +1 -1
  98. package/dist/lib/src/functions/safe-dynamic-require.js +8 -8
  99. package/dist/lib/src/functions/safe-dynamic-require.js.map +1 -1
  100. package/dist/lib/src/functions/set.js +5 -1
  101. package/dist/lib/src/functions/set.js.map +1 -1
  102. package/dist/lib/src/functions/string-to-function.js +17 -13
  103. package/dist/lib/src/functions/string-to-function.js.map +1 -1
  104. package/dist/lib/src/functions/throttle.js +5 -1
  105. package/dist/lib/src/functions/throttle.js.map +1 -1
  106. package/dist/lib/src/functions/try-eval.js +13 -10
  107. package/dist/lib/src/functions/try-eval.js.map +1 -1
  108. package/dist/lib/src/functions/update-metadata.js +9 -5
  109. package/dist/lib/src/functions/update-metadata.js.map +1 -1
  110. package/dist/lib/src/functions/utils.js +5 -1
  111. package/dist/lib/src/functions/utils.js.map +1 -1
  112. package/dist/lib/src/functions/with-builder.js +7 -3
  113. package/dist/lib/src/functions/with-builder.js.map +1 -1
  114. package/dist/lib/src/functions/with-children.js +13 -6
  115. package/dist/lib/src/functions/with-children.js.map +1 -1
  116. package/dist/lib/src/hooks/useIsPreviewing.js +10 -6
  117. package/dist/lib/src/hooks/useIsPreviewing.js.map +1 -1
  118. package/dist/lib/src/scripts/init-editing.js +4 -2
  119. package/dist/lib/src/scripts/init-editing.js.map +1 -1
  120. package/dist/lib/src/store/builder-async-requests.js +12 -4
  121. package/dist/lib/src/store/builder-async-requests.js.map +1 -1
  122. package/dist/lib/src/store/builder-meta.js +8 -2
  123. package/dist/lib/src/store/builder-meta.js.map +1 -1
  124. package/dist/lib/src/store/builder-store.js +8 -2
  125. package/dist/lib/src/store/builder-store.js.map +1 -1
  126. package/dist/lib/src/to-error.js +5 -1
  127. package/dist/lib/src/to-error.js.map +1 -1
  128. package/dist/lib/test/basic.test.js +74 -49
  129. package/dist/lib/test/basic.test.js.map +1 -1
  130. package/dist/lib/test/functions/render-block.js +8 -3
  131. package/dist/lib/test/functions/render-block.js.map +1 -1
  132. package/dist/lib/test/image.test.js +39 -14
  133. package/dist/lib/test/image.test.js.map +1 -1
  134. package/dist/types/src/components/builder-content.component.d.ts +67 -1
  135. package/package.json +6 -6
  136. package/rollup.config.ts +1 -0
  137. package/src/components/builder-component.component.tsx +2 -2
  138. package/src/functions/string-to-function.ts +2 -2
  139. package/src/functions/try-eval.tsx +1 -1
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  'use client';
2
3
  var __assign = (this && this.__assign) || function () {
3
4
  __assign = Object.assign || function(t) {
@@ -10,10 +11,11 @@ var __assign = (this && this.__assign) || function () {
10
11
  };
11
12
  return __assign.apply(this, arguments);
12
13
  };
13
- import { Builder } from '@builder.io/sdk';
14
- import { safeDynamicRequire } from './safe-dynamic-require';
15
- export var tryEval = function (str, data, errors) {
16
- var _a;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.tryEval = void 0;
16
+ var sdk_1 = require("@builder.io/sdk");
17
+ var safe_dynamic_require_1 = require("./safe-dynamic-require");
18
+ var tryEval = function (str, data, errors) {
17
19
  if (data === void 0) { data = {}; }
18
20
  var value = str;
19
21
  if (!(typeof value === 'string' && value.trim())) {
@@ -24,7 +26,7 @@ export var tryEval = function (str, data, errors) {
24
26
  /* Intentionally empty */
25
27
  };
26
28
  try {
27
- if (Builder.isBrowser) {
29
+ if (sdk_1.Builder.isBrowser) {
28
30
  // tslint:disable-next-line:no-function-constructor-with-string-args
29
31
  // TODO: VM in node......
30
32
  fn = new Function('state',
@@ -33,7 +35,7 @@ export var tryEval = function (str, data, errors) {
33
35
  }
34
36
  }
35
37
  catch (error) {
36
- if (Builder.isBrowser) {
38
+ if (sdk_1.Builder.isBrowser) {
37
39
  console.warn('Could not compile javascript', error);
38
40
  }
39
41
  else {
@@ -41,7 +43,7 @@ export var tryEval = function (str, data, errors) {
41
43
  }
42
44
  }
43
45
  try {
44
- if (Builder.isBrowser) {
46
+ if (sdk_1.Builder.isBrowser) {
45
47
  return fn(data || {});
46
48
  }
47
49
  else {
@@ -49,7 +51,7 @@ export var tryEval = function (str, data, errors) {
49
51
  // browser bundler's like rollup and webpack. Our rollup plugin strips these comments only
50
52
  // for the server build
51
53
  // tslint:disable:comment-format
52
- var VM = safeDynamicRequire('vm2').VM;
54
+ var VM = (0, safe_dynamic_require_1.safeDynamicRequire)('vm2').VM;
53
55
  return new VM({
54
56
  sandbox: __assign(__assign({}, data), { state: data }),
55
57
  // TODO: convert reutrn to module.exports on server
@@ -61,11 +63,11 @@ export var tryEval = function (str, data, errors) {
61
63
  if (errors) {
62
64
  errors.push(error);
63
65
  }
64
- if (Builder.isBrowser) {
66
+ if (sdk_1.Builder.isBrowser) {
65
67
  console.warn('Builder custom code error:', error.message, 'in', str, error.stack);
66
68
  }
67
69
  else {
68
- if ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.DEBUG) {
70
+ if (process && process.env && process.env.DEBUG) {
69
71
  console.debug('Builder custom code error:', error.message, 'in', str, error.stack);
70
72
  }
71
73
  // Add to req.options.errors to return to client
@@ -73,4 +75,5 @@ export var tryEval = function (str, data, errors) {
73
75
  }
74
76
  return;
75
77
  };
78
+ exports.tryEval = tryEval;
76
79
  //# sourceMappingURL=try-eval.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"try-eval.js","sourceRoot":"","sources":["../../../../src/functions/try-eval.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,CAAC,IAAM,OAAO,GAAG,UAAC,GAAY,EAAE,IAAc,EAAE,MAAgB;;IAAhC,qBAAA,EAAA,SAAc;IAClD,IAAM,KAAK,GAAG,GAAG,CAAC;IAClB,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE;QAChD,OAAO;KACR;IACD,IAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACvE,IAAI,EAAE,GAAa;QACjB,yBAAyB;IAC3B,CAAC,CAAC;IACF,IAAI;QACF,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,oEAAoE;YACpE,yBAAyB;YACzB,EAAE,GAAG,IAAI,QAAQ,CACf,OAAO;YACP,qEAAqE;YACrE,4bAeI,SAAS,CAAC,CAAC,CAAC,kBAAW,GAAG,OAAI,CAAC,CAAC,CAAC,GAAG,iBACtC,CACH,CAAC;SACH;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;SACrD;aAAM;YACL,gDAAgD;SACjD;KACF;IACD,IAAI;QACF,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,OAAO,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;SACvB;aAAM;YACL,4FAA4F;YAC5F,0FAA0F;YAC1F,uBAAuB;YACvB,gCAAgC;YACxB,IAAA,EAAE,GAAK,kBAAkB,CAAC,KAAK,CAAC,GAA9B,CAA+B;YACzC,OAAO,IAAI,EAAE,CAAC;gBACZ,OAAO,wBACF,IAAI,GACJ,EAAE,KAAK,EAAE,IAAI,EAAE,CACnB;gBACD,mDAAmD;aACpD,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;YAC5C,+BAA+B;SAChC;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACpB;QAED,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SACnF;aAAM;YACL,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,0CAAE,KAAK,EAAE;gBACvB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;aACpF;YACD,gDAAgD;SACjD;KACF;IAED,OAAO;AACT,CAAC,CAAC"}
1
+ {"version":3,"file":"try-eval.js","sourceRoot":"","sources":["../../../../src/functions/try-eval.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;AACb,uCAA0C;AAC1C,+DAA4D;AAErD,IAAM,OAAO,GAAG,UAAC,GAAY,EAAE,IAAc,EAAE,MAAgB;IAAhC,qBAAA,EAAA,SAAc;IAClD,IAAM,KAAK,GAAG,GAAG,CAAC;IAClB,IAAI,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE;QAChD,OAAO;KACR;IACD,IAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACvE,IAAI,EAAE,GAAa;QACjB,yBAAyB;IAC3B,CAAC,CAAC;IACF,IAAI;QACF,IAAI,aAAO,CAAC,SAAS,EAAE;YACrB,oEAAoE;YACpE,yBAAyB;YACzB,EAAE,GAAG,IAAI,QAAQ,CACf,OAAO;YACP,qEAAqE;YACrE,4bAeI,SAAS,CAAC,CAAC,CAAC,kBAAW,GAAG,OAAI,CAAC,CAAC,CAAC,GAAG,iBACtC,CACH,CAAC;SACH;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,IAAI,aAAO,CAAC,SAAS,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;SACrD;aAAM;YACL,gDAAgD;SACjD;KACF;IACD,IAAI;QACF,IAAI,aAAO,CAAC,SAAS,EAAE;YACrB,OAAO,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;SACvB;aAAM;YACL,4FAA4F;YAC5F,0FAA0F;YAC1F,uBAAuB;YACvB,gCAAgC;YACxB,IAAA,EAAE,GAAK,IAAA,yCAAkB,EAAC,KAAK,CAAC,GAA9B,CAA+B;YACzC,OAAO,IAAI,EAAE,CAAC;gBACZ,OAAO,wBACF,IAAI,GACJ,EAAE,KAAK,EAAE,IAAI,EAAE,CACnB;gBACD,mDAAmD;aACpD,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;YAC5C,+BAA+B;SAChC;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACpB;QAED,IAAI,aAAO,CAAC,SAAS,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;SACnF;aAAM;YACL,IAAI,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;gBAC/C,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;aACpF;YACD,gDAAgD;SACjD;KACF;IAED,OAAO;AACT,CAAC,CAAC;AA5EW,QAAA,OAAO,WA4ElB"}
@@ -1,4 +1,7 @@
1
- import { Builder } from '@builder.io/sdk';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateMetadata = void 0;
4
+ var sdk_1 = require("@builder.io/sdk");
2
5
  /**
3
6
  * Update metadata for a Builder component
4
7
  *
@@ -14,8 +17,8 @@ import { Builder } from '@builder.io/sdk';
14
17
  * ]
15
18
  * }))
16
19
  */
17
- export function updateMetadata(component, fn) {
18
- var match = Builder.components.find(function (item) {
20
+ function updateMetadata(component, fn) {
21
+ var match = sdk_1.Builder.components.find(function (item) {
19
22
  if (typeof component === 'string') {
20
23
  return item.name === component;
21
24
  }
@@ -26,13 +29,14 @@ export function updateMetadata(component, fn) {
26
29
  var updated = fn(match);
27
30
  if (match && updated) {
28
31
  // re-registering the same component will replace it
29
- Builder.registerComponent(updated.class || match.class, updated);
32
+ sdk_1.Builder.registerComponent(updated.class || match.class, updated);
30
33
  }
31
34
  else if (match && !updated) {
32
35
  // TODO: have a way to message to remove component
33
36
  }
34
37
  else if (!match && updated) {
35
- Builder.registerComponent(updated.class, updated);
38
+ sdk_1.Builder.registerComponent(updated.class, updated);
36
39
  }
37
40
  }
41
+ exports.updateMetadata = updateMetadata;
38
42
  //# sourceMappingURL=update-metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-metadata.js","sourceRoot":"","sources":["../../../../src/functions/update-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAC5B,SAA4B,EAC5B,EAA2D;IAE3D,IAAM,KAAK,GACT,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAA,IAAI;QAC1B,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;SAChC;aAAM;YACL,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC;SAC5B;IACH,CAAC,CAAC,IAAI,IAAI,CAAC;IAEb,IAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,KAAK,IAAI,OAAO,EAAE;QACpB,oDAAoD;QACpD,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAClE;SAAM,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE;QAC5B,kDAAkD;KACnD;SAAM,IAAI,CAAC,KAAK,IAAI,OAAO,EAAE;QAC5B,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACnD;AACH,CAAC"}
1
+ {"version":3,"file":"update-metadata.js","sourceRoot":"","sources":["../../../../src/functions/update-metadata.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,cAAc,CAC5B,SAA4B,EAC5B,EAA2D;IAE3D,IAAM,KAAK,GACT,aAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAA,IAAI;QAC1B,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;SAChC;aAAM;YACL,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC;SAC5B;IACH,CAAC,CAAC,IAAI,IAAI,CAAC;IAEb,IAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,KAAK,IAAI,OAAO,EAAE;QACpB,oDAAoD;QACpD,aAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAClE;SAAM,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE;QAC5B,kDAAkD;KACnD;SAAM,IAAI,CAAC,KAAK,IAAI,OAAO,EAAE;QAC5B,aAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACnD;AACH,CAAC;AAtBD,wCAsBC"}
@@ -1,3 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fastClone = void 0;
1
4
  // TODO: pull from builder internal utils
2
- export var fastClone = function (obj) { return JSON.parse(JSON.stringify(obj)); };
5
+ var fastClone = function (obj) { return JSON.parse(JSON.stringify(obj)); };
6
+ exports.fastClone = fastClone;
3
7
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/functions/utils.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,CAAC,IAAM,SAAS,GAAG,UAAmB,GAAM,IAAQ,OAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAA/B,CAA+B,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/functions/utils.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AAClC,IAAM,SAAS,GAAG,UAAmB,GAAM,IAAQ,OAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAA/B,CAA+B,CAAC;AAA7E,QAAA,SAAS,aAAoE"}
@@ -1,6 +1,10 @@
1
- import { BuilderBlock } from '../decorators/builder-block.decorator';
2
- export function withBuilder(component, options) {
3
- BuilderBlock(options)(component);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withBuilder = void 0;
4
+ var builder_block_decorator_1 = require("../decorators/builder-block.decorator");
5
+ function withBuilder(component, options) {
6
+ (0, builder_block_decorator_1.BuilderBlock)(options)(component);
4
7
  return component;
5
8
  }
9
+ exports.withBuilder = withBuilder;
6
10
  //# sourceMappingURL=with-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"with-builder.js","sourceRoot":"","sources":["../../../../src/functions/with-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,MAAM,UAAU,WAAW,CAAC,SAAmB,EAAE,OAAkB;IACjE,YAAY,CAAC,OAAO,CAAC,CAAC,SAAgB,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"with-builder.js","sourceRoot":"","sources":["../../../../src/functions/with-builder.ts"],"names":[],"mappings":";;;AACA,iFAAqE;AAErE,SAAgB,WAAW,CAAC,SAAmB,EAAE,OAAkB;IACjE,IAAA,sCAAY,EAAC,OAAO,CAAC,CAAC,SAAgB,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC;AACnB,CAAC;AAHD,kCAGC"}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  'use client';
2
3
  var __assign = (this && this.__assign) || function () {
3
4
  __assign = Object.assign || function(t) {
@@ -10,8 +11,13 @@ var __assign = (this && this.__assign) || function () {
10
11
  };
11
12
  return __assign.apply(this, arguments);
12
13
  };
13
- import React from 'react';
14
- import { BuilderBlock } from '../components/builder-block.component';
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.withChildren = void 0;
19
+ var react_1 = __importDefault(require("react"));
20
+ var builder_block_component_1 = require("../components/builder-block.component");
15
21
  /**
16
22
  * Higher order component for passing Builder.io children as React children
17
23
  *
@@ -34,20 +40,21 @@ import { BuilderBlock } from '../components/builder-block.component';
34
40
  * })
35
41
  * ```
36
42
  */
37
- export var withChildren = function (Component) {
38
- var HOC = React.forwardRef(function (props, ref) {
43
+ var withChildren = function (Component) {
44
+ var HOC = react_1.default.forwardRef(function (props, ref) {
39
45
  var children = props.children ||
40
46
  (props.builderBlock &&
41
47
  props.builderBlock.children &&
42
- props.builderBlock.children.map(function (child) { return React.createElement(BuilderBlock, { key: child.id, block: child }); }));
48
+ props.builderBlock.children.map(function (child) { return react_1.default.createElement(builder_block_component_1.BuilderBlock, { key: child.id, block: child }); }));
43
49
  return (
44
50
  // getting type errors due to `@types/react` version mismatches. Can safely ignore.
45
51
  // @ts-ignore
46
- React.createElement(Component, __assign({}, props, { ref: ref }), children));
52
+ react_1.default.createElement(Component, __assign({}, props, { ref: ref }), children));
47
53
  });
48
54
  HOC.builderOptions = {
49
55
  canHaveChildren: true,
50
56
  };
51
57
  return HOC;
52
58
  };
59
+ exports.withChildren = withChildren;
53
60
  //# sourceMappingURL=with-children.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"with-children.js","sourceRoot":"","sources":["../../../../src/functions/with-children.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAmB,SAAiC;IAC9E,IAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAC1B,UAAC,KAAK,EAAE,GAAG;QACT,IAAM,QAAQ,GACZ,KAAK,CAAC,QAAQ;YACd,CAAC,KAAK,CAAC,YAAY;gBACjB,KAAK,CAAC,YAAY,CAAC,QAAQ;gBAC3B,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,oBAAC,YAAY,IAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,GAAI,EAA7C,CAA6C,CAAC,CAAC,CAAC;QAE7F,OAAO;QACL,mFAAmF;QACnF,aAAa;QACb,oBAAC,SAAS,eAAK,KAAK,IAAE,GAAG,EAAE,GAAG,KAC3B,QAAQ,CACC,CACb,CAAC;IACJ,CAAC,CACF,CAAC;IAED,GAAW,CAAC,cAAc,GAAG;QAC5B,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
1
+ {"version":3,"file":"with-children.js","sourceRoot":"","sources":["../../../../src/functions/with-children.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;AACb,gDAA0B;AAE1B,iFAAqE;AAErE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,IAAM,YAAY,GAAG,UAAmB,SAAiC;IAC9E,IAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAC1B,UAAC,KAAK,EAAE,GAAG;QACT,IAAM,QAAQ,GACZ,KAAK,CAAC,QAAQ;YACd,CAAC,KAAK,CAAC,YAAY;gBACjB,KAAK,CAAC,YAAY,CAAC,QAAQ;gBAC3B,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,8BAAC,sCAAY,IAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,GAAI,EAA7C,CAA6C,CAAC,CAAC,CAAC;QAE7F,OAAO;QACL,mFAAmF;QACnF,aAAa;QACb,8BAAC,SAAS,eAAK,KAAK,IAAE,GAAG,EAAE,GAAG,KAC3B,QAAQ,CACC,CACb,CAAC;IACJ,CAAC,CACF,CAAC;IAED,GAAW,CAAC,cAAc,GAAG;QAC5B,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB"}
@@ -1,12 +1,16 @@
1
- import { useEffect, useState } from 'react';
2
- import { Builder } from '@builder.io/sdk';
3
- export function useIsPreviewing() {
4
- var _a = useState(false), isPreviewing = _a[0], setIsPreviewing = _a[1];
5
- useEffect(function () {
6
- if (Builder.isEditing || Builder.isPreviewing) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useIsPreviewing = void 0;
4
+ var react_1 = require("react");
5
+ var sdk_1 = require("@builder.io/sdk");
6
+ function useIsPreviewing() {
7
+ var _a = (0, react_1.useState)(false), isPreviewing = _a[0], setIsPreviewing = _a[1];
8
+ (0, react_1.useEffect)(function () {
9
+ if (sdk_1.Builder.isEditing || sdk_1.Builder.isPreviewing) {
7
10
  setIsPreviewing(true);
8
11
  }
9
12
  }, []);
10
13
  return isPreviewing;
11
14
  }
15
+ exports.useIsPreviewing = useIsPreviewing;
12
16
  //# sourceMappingURL=useIsPreviewing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsPreviewing.js","sourceRoot":"","sources":["../../../../src/hooks/useIsPreviewing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,UAAU,eAAe;IACvB,IAAA,KAAkC,QAAQ,CAAC,KAAK,CAAC,EAAhD,YAAY,QAAA,EAAE,eAAe,QAAmB,CAAC;IAExD,SAAS,CAAC;QACR,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE;YAC7C,eAAe,CAAC,IAAI,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,YAAY,CAAC;AACtB,CAAC"}
1
+ {"version":3,"file":"useIsPreviewing.js","sourceRoot":"","sources":["../../../../src/hooks/useIsPreviewing.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAC5C,uCAA0C;AAE1C,SAAgB,eAAe;IACvB,IAAA,KAAkC,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAhD,YAAY,QAAA,EAAE,eAAe,QAAmB,CAAC;IAExD,IAAA,iBAAS,EAAC;QACR,IAAI,aAAO,CAAC,SAAS,IAAI,aAAO,CAAC,YAAY,EAAE;YAC7C,eAAe,CAAC,IAAI,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,YAAY,CAAC;AACtB,CAAC;AAVD,0CAUC"}
@@ -1,5 +1,7 @@
1
+ "use strict";
1
2
  var _a;
2
- import { version } from '../../package.json';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var package_json_1 = require("../../package.json");
3
5
  if (typeof window !== 'undefined') {
4
6
  (_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
5
7
  type: 'builder.isReactSdk',
@@ -7,7 +9,7 @@ if (typeof window !== 'undefined') {
7
9
  value: true,
8
10
  supportsPatchUpdates: 'v4',
9
11
  supportsCustomBreakpoints: true,
10
- priorVersion: version,
12
+ priorVersion: package_json_1.version,
11
13
  },
12
14
  }, '*');
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"init-editing.js","sourceRoot":"","sources":["../../../../src/scripts/init-editing.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CACxB;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI;YACX,oBAAoB,EAAE,IAAI;YAC1B,yBAAyB,EAAE,IAAI;YAC/B,YAAY,EAAE,OAAO;SACtB;KACF,EACD,GAAG,CACJ,CAAC;CACH"}
1
+ {"version":3,"file":"init-editing.js","sourceRoot":"","sources":["../../../../src/scripts/init-editing.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAE7C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAA,MAAM,CAAC,MAAM,0CAAE,WAAW,CACxB;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI;YACX,oBAAoB,EAAE,IAAI;YAC1B,yBAAyB,EAAE,IAAI;YAC/B,YAAY,EAAE,sBAAO;SACtB;KACF,EACD,GAAG,CACJ,CAAC;CACH"}
@@ -1,9 +1,17 @@
1
- import React from 'react';
2
- export var isPromise = function (thing) {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BuilderAsyncRequestsContext = exports.isRequestInfo = exports.isPromise = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var isPromise = function (thing) {
3
9
  return typeof thing.then === 'function';
4
10
  };
5
- export var isRequestInfo = function (thing) { return !isPromise(thing); };
6
- export var BuilderAsyncRequestsContext = React.createContext({
11
+ exports.isPromise = isPromise;
12
+ var isRequestInfo = function (thing) { return !(0, exports.isPromise)(thing); };
13
+ exports.isRequestInfo = isRequestInfo;
14
+ exports.BuilderAsyncRequestsContext = react_1.default.createContext({
7
15
  requests: [],
8
16
  errors: [],
9
17
  logs: [],
@@ -1 +1 @@
1
- {"version":3,"file":"builder-async-requests.js","sourceRoot":"","sources":["../../../../src/store/builder-async-requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAAuB;IAC/C,OAAA,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU;AAAzC,CAAyC,CAAC;AAC5C,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,KAAuB,IAA2B,OAAA,CAAC,SAAS,CAAC,KAAK,CAAC,EAAjB,CAAiB,CAAC;AAElG,MAAM,CAAC,IAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAC;IAC7D,QAAQ,EAAE,EAAwB;IAClC,MAAM,EAAE,EAAa;IACrB,IAAI,EAAE,EAAc;CACrB,CAAC,CAAC"}
1
+ {"version":3,"file":"builder-async-requests.js","sourceRoot":"","sources":["../../../../src/store/builder-async-requests.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AASnB,IAAM,SAAS,GAAG,UAAC,KAAuB;IAC/C,OAAA,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU;AAAzC,CAAyC,CAAC;AAD/B,QAAA,SAAS,aACsB;AACrC,IAAM,aAAa,GAAG,UAAC,KAAuB,IAA2B,OAAA,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,EAAjB,CAAiB,CAAC;AAArF,QAAA,aAAa,iBAAwE;AAErF,QAAA,2BAA2B,GAAG,eAAK,CAAC,aAAa,CAAC;IAC7D,QAAQ,EAAE,EAAwB;IAClC,MAAM,EAAE,EAAa;IACrB,IAAI,EAAE,EAAc;CACrB,CAAC,CAAC"}
@@ -1,5 +1,11 @@
1
- import React from 'react';
2
- export var BuilderMetaContext = React.createContext({
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BuilderMetaContext = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ exports.BuilderMetaContext = react_1.default.createContext({
3
9
  emailMode: false,
4
10
  ampMode: false,
5
11
  isServer: false,
@@ -1 +1 @@
1
- {"version":3,"file":"builder-meta.js","sourceRoot":"","sources":["../../../../src/store/builder-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,IAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAC;IACpD,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"builder-meta.js","sourceRoot":"","sources":["../../../../src/store/builder-meta.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAEb,QAAA,kBAAkB,GAAG,eAAK,CAAC,aAAa,CAAC;IACpD,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;CAChB,CAAC,CAAC"}
@@ -1,5 +1,11 @@
1
- import React from 'react';
2
- export var BuilderStoreContext = React.createContext({
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BuilderStoreContext = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ exports.BuilderStoreContext = react_1.default.createContext({
3
9
  state: {},
4
10
  rootState: {},
5
11
  content: {},
@@ -1 +1 @@
1
- {"version":3,"file":"builder-store.js","sourceRoot":"","sources":["../../../../src/store/builder-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,IAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAe;IACnE,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,UAAC,OAA4B,IAAK,OAAA,IAAI,EAAJ,CAAI;CAC/C,CAAC,CAAC"}
1
+ {"version":3,"file":"builder-store.js","sourceRoot":"","sources":["../../../../src/store/builder-store.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAEb,QAAA,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAAe;IACnE,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,UAAC,OAA4B,IAAK,OAAA,IAAI,EAAJ,CAAI;CAC/C,CAAC,CAAC"}
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toError = void 0;
1
4
  /**
2
5
  * Safe conversion to error type. Intended to be used in catch blocks where the
3
6
  * value is not guaranteed to be an error.
@@ -10,9 +13,10 @@
10
13
  * const error: Error = toError(err)
11
14
  * }
12
15
  */
13
- export function toError(err) {
16
+ function toError(err) {
14
17
  if (err instanceof Error)
15
18
  return err;
16
19
  return new Error(String(err));
17
20
  }
21
+ exports.toError = toError;
18
22
  //# sourceMappingURL=to-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-error.js","sourceRoot":"","sources":["../../../src/to-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,OAAO,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC;IACrC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"to-error.js","sourceRoot":"","sources":["../../../src/to-error.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,SAAgB,OAAO,CAAC,GAAY;IAClC,IAAI,GAAG,YAAY,KAAK;QAAE,OAAO,GAAG,CAAC;IACrC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC;AAHD,0BAGC"}
@@ -1,69 +1,94 @@
1
+ "use strict";
1
2
  /**
2
3
  * @jest-environment jsdom
3
4
  */
4
- import * as React from 'react';
5
- import { renderToString } from 'react-dom/server';
6
- import { render } from '@testing-library/react';
7
- import { Builder, builder } from '@builder.io/sdk';
8
- import { BuilderPage } from '../src/builder-react';
9
- import { el, block } from './functions/render-block';
10
- import * as reactTestRenderer from 'react-test-renderer';
11
- import { getBuilderPixel } from '../src/functions/get-builder-pixel';
12
- builder.init('null');
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ var React = __importStar(require("react"));
30
+ var server_1 = require("react-dom/server");
31
+ var react_1 = require("@testing-library/react");
32
+ var sdk_1 = require("@builder.io/sdk");
33
+ var builder_react_1 = require("../src/builder-react");
34
+ var render_block_1 = require("./functions/render-block");
35
+ var reactTestRenderer = __importStar(require("react-test-renderer"));
36
+ var get_builder_pixel_1 = require("../src/functions/get-builder-pixel");
37
+ sdk_1.builder.init('null');
13
38
  describe('Dummy test', function () {
14
39
  it('tests run correctly', function () {
15
40
  expect(true).toBeTruthy();
16
41
  });
17
42
  });
18
43
  var server = function (cb) {
19
- Builder.isServer = true;
44
+ sdk_1.Builder.isServer = true;
20
45
  try {
21
46
  cb();
22
47
  }
23
48
  finally {
24
- Builder.isServer = false;
49
+ sdk_1.Builder.isServer = false;
25
50
  }
26
51
  };
27
52
  describe('Renders tons of components', function () {
28
53
  var blocks = [
29
- block('Columns', {
30
- columns: [{ blocks: [el()] }, { blocks: [el()] }],
54
+ (0, render_block_1.block)('Columns', {
55
+ columns: [{ blocks: [(0, render_block_1.el)()] }, { blocks: [(0, render_block_1.el)()] }],
31
56
  }),
32
- block('CustomCode', {
57
+ (0, render_block_1.block)('CustomCode', {
33
58
  code: '<!-- hello -->',
34
59
  }),
35
- block('Embed', {
60
+ (0, render_block_1.block)('Embed', {
36
61
  content: '<!-- hello -->',
37
62
  }),
38
- block('Symbol'),
39
- block('Router'),
40
- block('Image', { image: 'foobar' }),
41
- block('Form:Form'),
42
- block('Video', { video: 'foobar' }),
43
- block('Button', { text: 'foobar' }),
44
- block('Section', null, { children: [el()] }),
45
- block('Form:SubmitButton', { text: 'foobar' }),
46
- block('Form:Input', { type: 'text' }),
47
- block('Form:Label'),
48
- block('Form:Select'),
49
- block('Form:TextArea', { placeholder: 'foobar' }),
50
- block('Raw:Img', { image: 'foobar' }),
63
+ (0, render_block_1.block)('Symbol'),
64
+ (0, render_block_1.block)('Router'),
65
+ (0, render_block_1.block)('Image', { image: 'foobar' }),
66
+ (0, render_block_1.block)('Form:Form'),
67
+ (0, render_block_1.block)('Video', { video: 'foobar' }),
68
+ (0, render_block_1.block)('Button', { text: 'foobar' }),
69
+ (0, render_block_1.block)('Section', null, { children: [(0, render_block_1.el)()] }),
70
+ (0, render_block_1.block)('Form:SubmitButton', { text: 'foobar' }),
71
+ (0, render_block_1.block)('Form:Input', { type: 'text' }),
72
+ (0, render_block_1.block)('Form:Label'),
73
+ (0, render_block_1.block)('Form:Select'),
74
+ (0, render_block_1.block)('Form:TextArea', { placeholder: 'foobar' }),
75
+ (0, render_block_1.block)('Raw:Img', { image: 'foobar' }),
51
76
  ];
52
- var getRenderExampleElement = function () { return (React.createElement(BuilderPage, { model: "page", content: {
77
+ var getRenderExampleElement = function () { return (React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
53
78
  data: {
54
79
  blocks: blocks,
55
80
  },
56
81
  } })); };
57
82
  it('works with dom', function () {
58
- var testApi = render(getRenderExampleElement());
83
+ var testApi = (0, react_1.render)(getRenderExampleElement());
59
84
  });
60
85
  it('works with SSR', function () {
61
- renderToString(getRenderExampleElement());
86
+ (0, server_1.renderToString)(getRenderExampleElement());
62
87
  });
63
88
  });
64
89
  describe('Data rendering', function () {
65
90
  var TEXT_STRING = 'Hello 1234';
66
- var bindingBlock = el({
91
+ var bindingBlock = (0, render_block_1.el)({
67
92
  bindings: {
68
93
  'component.options.text': 'state.foo',
69
94
  },
@@ -71,18 +96,18 @@ describe('Data rendering', function () {
71
96
  name: 'Text',
72
97
  },
73
98
  });
74
- var getBindingExampleElement = function () { return (React.createElement(BuilderPage, { model: "page", data: { foo: TEXT_STRING }, content: {
99
+ var getBindingExampleElement = function () { return (React.createElement(builder_react_1.BuilderPage, { model: "page", data: { foo: TEXT_STRING }, content: {
75
100
  data: {
76
101
  blocks: [bindingBlock],
77
102
  },
78
103
  } })); };
79
104
  it('works with dom', function () {
80
- var testApi = render(getBindingExampleElement());
105
+ var testApi = (0, react_1.render)(getBindingExampleElement());
81
106
  expect(testApi.getByText(TEXT_STRING)).toBeInTheDocument();
82
107
  });
83
108
  it('works with SSR', function () {
84
109
  server(function () {
85
- var renderedString = renderToString(getBindingExampleElement());
110
+ var renderedString = (0, server_1.renderToString)(getBindingExampleElement());
86
111
  expect(renderedString).toContain(TEXT_STRING);
87
112
  });
88
113
  });
@@ -93,39 +118,39 @@ describe('Content changes when new content provided', function () {
93
118
  var idA = 'id-a';
94
119
  var idB = 'id-b';
95
120
  it('Handles content passed and changed correctly', function () {
96
- var testApi = render(React.createElement(BuilderPage, { model: "page", content: {
121
+ var testApi = (0, react_1.render)(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
97
122
  id: idA,
98
123
  data: {
99
- blocks: [block('Text', { text: textA })],
124
+ blocks: [(0, render_block_1.block)('Text', { text: textA })],
100
125
  },
101
126
  } }));
102
127
  expect(testApi.getByText(textA)).toBeInTheDocument();
103
- testApi.rerender(React.createElement(BuilderPage, { model: "page", content: {
128
+ testApi.rerender(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
104
129
  id: idB,
105
130
  data: {
106
- blocks: [block('Text', { text: textB })],
131
+ blocks: [(0, render_block_1.block)('Text', { text: textB })],
107
132
  },
108
133
  } }));
109
134
  expect(testApi.getByText(textB)).toBeInTheDocument();
110
135
  });
111
136
  it('Should be in controlled mode for null or underined content', function () {
112
- var testApi = render(React.createElement(BuilderPage, { model: "page", content: undefined }));
137
+ var testApi = (0, react_1.render)(React.createElement(builder_react_1.BuilderPage, { model: "page", content: undefined }));
113
138
  expect(testApi.queryByText(textB)).toBeNull();
114
- testApi.rerender(React.createElement(BuilderPage, { model: "page", content: {
139
+ testApi.rerender(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
115
140
  id: idB,
116
141
  data: {
117
- blocks: [block('Text', { text: textB })],
142
+ blocks: [(0, render_block_1.block)('Text', { text: textB })],
118
143
  },
119
144
  } }));
120
145
  expect(testApi.getByText(textB)).toBeInTheDocument();
121
146
  });
122
147
  it('Should be in controlled mode for null or underined content', function () {
123
- var testApi = render(React.createElement(BuilderPage, { model: "page" }));
148
+ var testApi = (0, react_1.render)(React.createElement(builder_react_1.BuilderPage, { model: "page" }));
124
149
  expect(testApi.queryByText(textB)).toBeNull();
125
- testApi.rerender(React.createElement(BuilderPage, { model: "page", content: {
150
+ testApi.rerender(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
126
151
  id: idB,
127
152
  data: {
128
- blocks: [block('Text', { text: textB })],
153
+ blocks: [(0, render_block_1.block)('Text', { text: textB })],
129
154
  },
130
155
  } }));
131
156
  expect(testApi.getByText(textB)).toBeInTheDocument();
@@ -133,7 +158,7 @@ describe('Content changes when new content provided', function () {
133
158
  });
134
159
  describe('Builder Pixel', function () {
135
160
  it('Should NOT be added if blocks array is empty', function () {
136
- var renderedBlock = reactTestRenderer.create(React.createElement(BuilderPage, { model: "page", content: {
161
+ var renderedBlock = reactTestRenderer.create(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
137
162
  id: 'id',
138
163
  data: {
139
164
  blocks: [],
@@ -142,16 +167,16 @@ describe('Builder Pixel', function () {
142
167
  expect(renderedBlock).toMatchSnapshot();
143
168
  });
144
169
  it('Should NOT be added again if already present in blocks array', function () {
145
- var renderedBlock = reactTestRenderer.create(React.createElement(BuilderPage, { model: "page", content: {
170
+ var renderedBlock = reactTestRenderer.create(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
146
171
  id: 'id',
147
172
  data: {
148
- blocks: [getBuilderPixel('null')],
173
+ blocks: [(0, get_builder_pixel_1.getBuilderPixel)('null')],
149
174
  },
150
175
  } }));
151
176
  expect(renderedBlock).toMatchSnapshot();
152
177
  });
153
178
  it('Should be added if pixel is missing and blocks array has other block(s)', function () {
154
- var renderedBlock = reactTestRenderer.create(React.createElement(BuilderPage, { model: "page", content: {
179
+ var renderedBlock = reactTestRenderer.create(React.createElement(builder_react_1.BuilderPage, { model: "page", content: {
155
180
  id: 'id',
156
181
  data: {
157
182
  blocks: [