@builder.io/sdk-solid 0.4.4 → 0.5.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 (145) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +1 -1
  3. package/src/blocks/BaseText.jsx +1 -1
  4. package/src/blocks/button/button.jsx +5 -3
  5. package/src/blocks/button/component-info.js +16 -22
  6. package/src/blocks/columns/columns.jsx +14 -23
  7. package/src/blocks/columns/component-info.js +203 -226
  8. package/src/blocks/custom-code/component-info.js +19 -25
  9. package/src/blocks/embed/component-info.js +31 -37
  10. package/src/blocks/embed/helpers.js +3 -9
  11. package/src/blocks/form/component-info.js +174 -212
  12. package/src/blocks/form/form.jsx +1 -268
  13. package/src/blocks/fragment/component-info.js +1 -3
  14. package/src/blocks/helpers.js +27 -0
  15. package/src/blocks/image/component-info.js +105 -133
  16. package/src/blocks/image/image.helpers.js +3 -5
  17. package/src/blocks/img/component-info.js +8 -12
  18. package/src/blocks/img/img.jsx +2 -0
  19. package/src/blocks/input/component-info.js +29 -57
  20. package/src/blocks/input/input.jsx +2 -0
  21. package/src/blocks/raw-text/component-info.js +7 -11
  22. package/src/blocks/raw-text/raw-text.jsx +2 -2
  23. package/src/blocks/section/component-info.js +24 -31
  24. package/src/blocks/section/section.jsx +3 -0
  25. package/src/blocks/select/component-info.js +34 -48
  26. package/src/blocks/select/select.jsx +2 -0
  27. package/src/blocks/submit-button/component-info.js +6 -10
  28. package/src/blocks/submit-button/submit-button.jsx +3 -1
  29. package/src/blocks/symbol/component-info.js +30 -37
  30. package/src/blocks/symbol/symbol.helpers.js +60 -0
  31. package/src/blocks/symbol/symbol.jsx +32 -66
  32. package/src/blocks/text/component-info.js +10 -13
  33. package/src/blocks/text/text.jsx +1 -1
  34. package/src/blocks/textarea/component-info.js +22 -30
  35. package/src/blocks/textarea/textarea.jsx +3 -0
  36. package/src/blocks/video/component-info.js +74 -96
  37. package/src/blocks/video/video.jsx +1 -0
  38. package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
  39. package/src/components/{render-block/render-block.jsx → block/block.jsx} +65 -80
  40. package/src/components/{render-block → block/components}/block-styles.jsx +17 -17
  41. package/src/components/block/components/block-wrapper.jsx +50 -0
  42. package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
  43. package/src/components/block/components/component-ref/component-ref.jsx +58 -0
  44. package/src/components/block/components/interactive-element.jsx +30 -0
  45. package/src/components/block/components/repeated-block.jsx +20 -0
  46. package/src/components/blocks/blocks-wrapper.jsx +66 -0
  47. package/src/components/blocks/blocks.jsx +48 -0
  48. package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +90 -177
  49. package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
  50. package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +6 -6
  51. package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
  52. package/src/components/content/content.jsx +129 -0
  53. package/src/components/content/content.types.js +0 -0
  54. package/src/components/content/index.js +2 -0
  55. package/src/components/content/wrap-component-ref.js +2 -0
  56. package/src/components/content-variants/content-variants.jsx +110 -0
  57. package/src/components/{render-content-variants → content-variants}/helpers.js +58 -41
  58. package/src/components/inlined-script.jsx +5 -0
  59. package/src/components/inlined-styles.jsx +5 -0
  60. package/src/constants/builder-registered-components.js +34 -25
  61. package/src/constants/device-sizes.js +6 -6
  62. package/src/constants/sdk-version.js +1 -1
  63. package/src/context/builder.context.js +1 -1
  64. package/src/functions/apply-patch-with-mutation.js +66 -0
  65. package/src/functions/camel-to-kebab-case.js +2 -4
  66. package/src/functions/evaluate/acorn.js +1595 -0
  67. package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
  68. package/src/functions/evaluate/index.js +2 -0
  69. package/src/functions/evaluate/interpreter.js +2801 -0
  70. package/src/functions/evaluate/non-node-runtime.js +92 -0
  71. package/src/functions/evaluate/types.js +0 -0
  72. package/src/functions/event-handler-name.js +2 -4
  73. package/src/functions/extract-text-styles.js +4 -12
  74. package/src/functions/fast-clone.js +2 -4
  75. package/src/functions/get-block-actions-handler.js +3 -5
  76. package/src/functions/get-block-actions.js +15 -4
  77. package/src/functions/get-block-component-options.js +11 -12
  78. package/src/functions/get-block-properties.js +29 -19
  79. package/src/functions/get-builder-search-params/index.js +5 -10
  80. package/src/functions/get-content/generate-content-url.js +17 -19
  81. package/src/functions/get-content/index.js +43 -29
  82. package/src/functions/get-fetch.js +1 -3
  83. package/src/functions/get-global-this.js +1 -3
  84. package/src/functions/get-processed-block.js +12 -13
  85. package/src/functions/get-react-native-block-styles.js +11 -12
  86. package/src/functions/if-target.js +1 -3
  87. package/src/functions/is-browser.js +1 -3
  88. package/src/functions/is-editing.js +1 -3
  89. package/src/functions/is-iframe.js +1 -3
  90. package/src/functions/is-non-node-server.js +9 -0
  91. package/src/functions/is-previewing.js +1 -3
  92. package/src/functions/on-change.js +1 -4
  93. package/src/functions/register-component.js +34 -42
  94. package/src/functions/register.js +1 -3
  95. package/src/functions/sanitize-react-native-block-styles.js +22 -17
  96. package/src/functions/set-editor-settings.js +1 -3
  97. package/src/functions/set.js +1 -3
  98. package/src/functions/track/helpers.js +3 -5
  99. package/src/functions/track/index.js +45 -43
  100. package/src/functions/track/interaction.js +11 -7
  101. package/src/functions/transform-block-properties.js +1 -3
  102. package/src/functions/transform-block.js +1 -3
  103. package/src/helpers/ab-tests.js +46 -26
  104. package/src/helpers/canTrack.js +3 -5
  105. package/src/helpers/cookie.js +15 -24
  106. package/src/helpers/css.js +3 -7
  107. package/src/helpers/flatten.js +15 -18
  108. package/src/helpers/localStorage.js +1 -4
  109. package/src/helpers/logger.js +1 -3
  110. package/src/helpers/nullable.js +2 -4
  111. package/src/helpers/preview-lru-cache/get.js +8 -0
  112. package/src/helpers/preview-lru-cache/helpers.js +10 -0
  113. package/src/helpers/preview-lru-cache/init.js +10 -0
  114. package/src/helpers/preview-lru-cache/set.js +35 -0
  115. package/src/helpers/preview-lru-cache/types.js +0 -0
  116. package/src/helpers/sessionId.js +14 -11
  117. package/src/helpers/time.js +1 -3
  118. package/src/helpers/url.js +2 -4
  119. package/src/helpers/uuid.js +4 -6
  120. package/src/helpers/visitorId.js +8 -7
  121. package/src/index-helpers/blocks-exports.js +3 -14
  122. package/src/index-helpers/top-of-file.js +1 -3
  123. package/src/index.js +2 -17
  124. package/src/scripts/init-editing.js +62 -48
  125. package/src/types/api-version.js +1 -3
  126. package/src/types/builder-props.js +0 -0
  127. package/src/types/enforced-partials.js +0 -0
  128. package/src/blocks/util.js +0 -8
  129. package/src/components/render-block/render-component.jsx +0 -40
  130. package/src/components/render-block/render-repeated-block.jsx +0 -16
  131. package/src/components/render-blocks.jsx +0 -100
  132. package/src/components/render-content/builder-editing.jsx +0 -5
  133. package/src/components/render-content/index.js +0 -4
  134. package/src/components/render-content/wrap-component-ref.js +0 -4
  135. package/src/components/render-content-variants/render-content-variants.jsx +0 -94
  136. package/src/components/render-inlined-styles.jsx +0 -5
  137. package/src/functions/evaluate.test.js +0 -17
  138. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  139. package/src/functions/get-content/generate-content-url.test.js +0 -97
  140. package/src/functions/get-processed-block.test.js +0 -34
  141. package/src/functions/on-change.test.js +0 -19
  142. package/src/functions/set.test.js +0 -16
  143. package/src/helpers/url.test.js +0 -21
  144. /package/src/components/{render-block → block}/types.js +0 -0
  145. /package/src/components/{render-content/render-content.types.js → content-variants/content-variants.types.js} +0 -0
@@ -0,0 +1,110 @@
1
+ import { Show, For, onMount, createSignal } from "solid-js";
2
+
3
+ import {
4
+ checkShouldRunVariants,
5
+ getScriptString,
6
+ getVariants,
7
+ getVariantsScriptString,
8
+ } from "./helpers.js";
9
+ import ContentComponent from "../content/content.jsx";
10
+ import { getDefaultCanTrack } from "../../helpers/canTrack.js";
11
+ import InlinedStyles from "../inlined-styles.jsx";
12
+ import { handleABTestingSync } from "../../helpers/ab-tests.js";
13
+ import InlinedScript from "../inlined-script.jsx";
14
+ import { TARGET } from "../../constants/target.js";
15
+
16
+ function ContentVariants(props) {
17
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
18
+ checkShouldRunVariants({
19
+ canTrack: getDefaultCanTrack(props.canTrack),
20
+ content: props.content,
21
+ })
22
+ );
23
+
24
+ function variantScriptStr() {
25
+ return getVariantsScriptString(
26
+ getVariants(props.content).map((value) => ({
27
+ id: value.testVariationId,
28
+ testRatio: value.testRatio,
29
+ })),
30
+ props.content?.id || ""
31
+ );
32
+ }
33
+
34
+ function hideVariantsStyleString() {
35
+ return getVariants(props.content)
36
+ .map((value) => `.variant-${value.testVariationId} { display: none; } `)
37
+ .join("");
38
+ }
39
+
40
+ onMount(() => {
41
+ /**
42
+ * We unmount the non-winning variants post-hydration in Vue.
43
+ */
44
+ });
45
+
46
+ return (
47
+ <>
48
+ <Show when={!props.__isNestedRender && TARGET !== "reactNative"}>
49
+ <InlinedScript scriptStr={getScriptString()}></InlinedScript>
50
+ </Show>
51
+ <Show when={shouldRenderVariants()}>
52
+ <InlinedStyles
53
+ id={`variants-styles-${props.content?.id}`}
54
+ styles={hideVariantsStyleString()}
55
+ ></InlinedStyles>
56
+ <InlinedScript scriptStr={variantScriptStr()}></InlinedScript>
57
+ <For each={getVariants(props.content)}>
58
+ {(variant, _index) => {
59
+ const index = _index();
60
+ return (
61
+ <ContentComponent
62
+ key={variant.testVariationId}
63
+ content={variant}
64
+ showContent={false}
65
+ classNameProp={undefined}
66
+ model={props.model}
67
+ data={props.data}
68
+ context={props.context}
69
+ apiKey={props.apiKey}
70
+ apiVersion={props.apiVersion}
71
+ customComponents={props.customComponents}
72
+ canTrack={props.canTrack}
73
+ locale={props.locale}
74
+ includeRefs={props.includeRefs}
75
+ enrich={props.enrich}
76
+ isSsrAbTest={shouldRenderVariants()}
77
+ ></ContentComponent>
78
+ );
79
+ }}
80
+ </For>
81
+ </Show>
82
+ <ContentComponent
83
+ {...{}}
84
+ content={
85
+ shouldRenderVariants()
86
+ ? props.content
87
+ : handleABTestingSync({
88
+ item: props.content,
89
+ canTrack: getDefaultCanTrack(props.canTrack),
90
+ })
91
+ }
92
+ classNameProp={`variant-${props.content?.id}`}
93
+ showContent={true}
94
+ model={props.model}
95
+ data={props.data}
96
+ context={props.context}
97
+ apiKey={props.apiKey}
98
+ apiVersion={props.apiVersion}
99
+ customComponents={props.customComponents}
100
+ canTrack={props.canTrack}
101
+ locale={props.locale}
102
+ includeRefs={props.includeRefs}
103
+ enrich={props.enrich}
104
+ isSsrAbTest={shouldRenderVariants()}
105
+ ></ContentComponent>
106
+ </>
107
+ );
108
+ }
109
+
110
+ export default ContentVariants;
@@ -1,23 +1,43 @@
1
- import { TARGET } from "../../constants/target";
2
- import { isBrowser } from "../../functions/is-browser";
3
- const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {});
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value
12
+ }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ import { TARGET } from "../../constants/target.js";
22
+ import { isBrowser } from "../../functions/is-browser.js";
23
+ const getVariants = content => Object.values((content == null ? void 0 : content.variations) || {}).map(variant => __spreadProps(__spreadValues({}, variant), {
24
+ testVariationId: variant.id,
25
+ id: content == null ? void 0 : content.id
26
+ }));
4
27
  const checkShouldRunVariants = ({
5
28
  canTrack,
6
29
  content
7
30
  }) => {
8
31
  const hasVariants = getVariants(content).length > 0;
9
- if (!hasVariants) {
10
- return false;
11
- }
12
- if (!canTrack) {
13
- return false;
14
- }
15
- if (isBrowser()) {
16
- return false;
17
- }
32
+ if (TARGET === "reactNative") return false;
33
+ if (!hasVariants) return false;
34
+ if (!canTrack) return false;
35
+ if (TARGET === "vue2" || TARGET === "vue3") return true;
36
+ if (isBrowser()) return false;
18
37
  return true;
19
38
  };
20
39
  function bldrAbTest(contentId, variants, isHydrationTarget2) {
40
+ var _a;
21
41
  function getAndSetVariantId() {
22
42
  function setCookie(name, value, days) {
23
43
  let expires = "";
@@ -33,16 +53,14 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
33
53
  const ca = document.cookie.split(";");
34
54
  for (let i = 0; i < ca.length; i++) {
35
55
  let c = ca[i];
36
- while (c.charAt(0) === " ")
37
- c = c.substring(1, c.length);
38
- if (c.indexOf(nameEQ) === 0)
39
- return c.substring(nameEQ.length, c.length);
56
+ while (c.charAt(0) === " ") c = c.substring(1, c.length);
57
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
40
58
  }
41
59
  return null;
42
60
  }
43
61
  const cookieName = `builder.tests.${contentId}`;
44
62
  const variantInCookie = getCookie(cookieName);
45
- const availableIDs = variants.map((vr) => vr.id).concat(contentId);
63
+ const availableIDs = variants.map(vr => vr.id).concat(contentId);
46
64
  if (variantInCookie && availableIDs.includes(variantInCookie)) {
47
65
  return variantInCookie;
48
66
  }
@@ -61,13 +79,15 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
61
79
  return contentId;
62
80
  }
63
81
  const winningVariantId = getAndSetVariantId();
64
- const styleEl = document.getElementById(`variants-styles-${contentId}`);
82
+ const styleEl = (_a = document.currentScript) == null ? void 0 : _a.previousElementSibling;
65
83
  if (isHydrationTarget2) {
66
84
  styleEl.remove();
67
- const thisScriptEl = document.getElementById(`variants-script-${contentId}`);
85
+ const thisScriptEl = document.currentScript;
68
86
  thisScriptEl == null ? void 0 : thisScriptEl.remove();
69
87
  } else {
70
- const newStyleStr = variants.concat({ id: contentId }).filter((variant) => variant.id !== winningVariantId).map((value) => {
88
+ const newStyleStr = variants.concat({
89
+ id: contentId
90
+ }).filter(variant => variant.id !== winningVariantId).map(value => {
71
91
  return `.variant-${value.id} { display: none; }
72
92
  `;
73
93
  }).join("");
@@ -75,6 +95,7 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
75
95
  }
76
96
  }
77
97
  function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
98
+ var _a;
78
99
  if (!navigator.cookieEnabled) {
79
100
  return;
80
101
  }
@@ -83,16 +104,14 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
83
104
  const ca = document.cookie.split(";");
84
105
  for (let i = 0; i < ca.length; i++) {
85
106
  let c = ca[i];
86
- while (c.charAt(0) === " ")
87
- c = c.substring(1, c.length);
88
- if (c.indexOf(nameEQ) === 0)
89
- return c.substring(nameEQ.length, c.length);
107
+ while (c.charAt(0) === " ") c = c.substring(1, c.length);
108
+ if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
90
109
  }
91
110
  return null;
92
111
  }
93
112
  const cookieName = `builder.tests.${defaultContentId}`;
94
113
  const variantId = getCookie(cookieName);
95
- const parentDiv = document.querySelector(`[builder-content-id="${variantContentId}"]`);
114
+ const parentDiv = (_a = document.currentScript) == null ? void 0 : _a.parentElement;
96
115
  const variantIsDefaultContent = variantContentId === defaultContentId;
97
116
  if (variantId === variantContentId) {
98
117
  if (variantIsDefaultContent) {
@@ -113,29 +132,27 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
113
132
  }
114
133
  return;
115
134
  }
116
- const getIsHydrationTarget = (target) => target === "react" || target === "reactNative" || target === "vue3" || target === "vue2";
135
+ const getIsHydrationTarget = target => target === "react" || target === "reactNative";
117
136
  const isHydrationTarget = getIsHydrationTarget(TARGET);
118
- const AB_TEST_FN_NAME = "bldrAbTest";
119
- const CONTENT_FN_NAME = "bldrCntntScrpt";
120
- const getVariantsScriptString = (variants, contentId) => {
137
+ const AB_TEST_FN_NAME = "builderIoAbTest";
138
+ const CONTENT_FN_NAME = "builderIoRenderContent";
139
+ const getScriptString = () => {
121
140
  const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
122
141
  const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
123
142
  return `
124
- const ${AB_TEST_FN_NAME} = ${fnStr}
125
- const ${CONTENT_FN_NAME} = ${fnStr2}
126
- ${AB_TEST_FN_NAME}("${contentId}", ${JSON.stringify(variants)}, ${isHydrationTarget})
143
+ window.${AB_TEST_FN_NAME} = ${fnStr}
144
+ window.${CONTENT_FN_NAME} = ${fnStr2}
127
145
  `;
128
146
  };
147
+ const getVariantsScriptString = (variants, contentId) => {
148
+ return `
149
+ window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
150
+ };
129
151
  const getRenderContentScriptString = ({
130
- parentContentId,
131
- contentId
152
+ contentId,
153
+ variationId
132
154
  }) => {
133
155
  return `
134
- ${CONTENT_FN_NAME}("${contentId}", "${parentContentId}", ${isHydrationTarget})`;
135
- };
136
- export {
137
- checkShouldRunVariants,
138
- getRenderContentScriptString,
139
- getVariants,
140
- getVariantsScriptString
156
+ window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
141
157
  };
158
+ export { checkShouldRunVariants, getRenderContentScriptString, getScriptString, getVariants, getVariantsScriptString }
@@ -0,0 +1,5 @@
1
+ function InlinedScript(props) {
2
+ return <script innerHTML={props.scriptStr} id={props.id}></script>;
3
+ }
4
+
5
+ export default InlinedScript;
@@ -0,0 +1,5 @@
1
+ function InlinedStyles(props) {
2
+ return <style innerHTML={props.styles} id={props.id}></style>;
3
+ }
4
+
5
+ export default InlinedStyles;
@@ -2,16 +2,17 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value
10
+ }) : obj[key] = value;
6
11
  var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
12
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
+ }
15
16
  return a;
16
17
  };
17
18
  import { default as Button } from "../blocks/button/button";
@@ -36,19 +37,27 @@ import { default as Img } from "../blocks/img/img";
36
37
  import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.js";
37
38
  import { default as customCode } from "../blocks/custom-code/custom-code";
38
39
  import { componentInfo as customCodeInfo } from "../blocks/custom-code/component-info.js";
39
- const getDefaultRegisteredComponents = () => [
40
- __spreadValues({ component: Button }, buttonComponentInfo),
41
- __spreadValues({ component: Columns }, columnsComponentInfo),
42
- __spreadValues({ component: customCode }, customCodeInfo),
43
- __spreadValues({ component: embed }, embedComponentInfo),
44
- __spreadValues({ component: Fragment }, fragmentComponentInfo),
45
- __spreadValues({ component: Image }, imageComponentInfo),
46
- __spreadValues({ component: Img }, imgComponentInfo),
47
- __spreadValues({ component: Section }, sectionComponentInfo),
48
- __spreadValues({ component: Symbol }, symbolComponentInfo),
49
- __spreadValues({ component: Text }, textComponentInfo),
50
- __spreadValues({ component: Video }, videoComponentInfo)
51
- ];
52
- export {
53
- getDefaultRegisteredComponents
54
- };
40
+ const getDefaultRegisteredComponents = () => [__spreadValues({
41
+ component: Button
42
+ }, buttonComponentInfo), __spreadValues({
43
+ component: Columns
44
+ }, columnsComponentInfo), __spreadValues({
45
+ component: customCode
46
+ }, customCodeInfo), __spreadValues({
47
+ component: embed
48
+ }, embedComponentInfo), __spreadValues({
49
+ component: Fragment
50
+ }, fragmentComponentInfo), __spreadValues({
51
+ component: Image
52
+ }, imageComponentInfo), __spreadValues({
53
+ component: Img
54
+ }, imgComponentInfo), __spreadValues({
55
+ component: Section
56
+ }, sectionComponentInfo), __spreadValues({
57
+ component: Symbol
58
+ }, symbolComponentInfo), __spreadValues({
59
+ component: Text
60
+ }, textComponentInfo), __spreadValues({
61
+ component: Video
62
+ }, videoComponentInfo)];
63
+ export { getDefaultRegisteredComponents }
@@ -1,4 +1,4 @@
1
- import { fastClone } from "../functions/fast-clone";
1
+ import { fastClone } from "../functions/fast-clone.js";
2
2
  const SIZES = {
3
3
  small: {
4
4
  min: 320,
@@ -17,7 +17,10 @@ const SIZES = {
17
17
  }
18
18
  };
19
19
  const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
20
- const getSizesForBreakpoints = ({ small, medium }) => {
20
+ const getSizesForBreakpoints = ({
21
+ small,
22
+ medium
23
+ }) => {
21
24
  const newSizes = fastClone(SIZES);
22
25
  if (!small || !medium) {
23
26
  return newSizes;
@@ -42,7 +45,4 @@ const getSizesForBreakpoints = ({ small, medium }) => {
42
45
  };
43
46
  return newSizes;
44
47
  };
45
- export {
46
- getMaxWidthQueryForSize,
47
- getSizesForBreakpoints
48
- };
48
+ export { getMaxWidthQueryForSize, getSizesForBreakpoints }
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.4.4"
1
+ export const SDK_VERSION = "0.5.0"
@@ -8,7 +8,7 @@ var stdin_default = createContext({
8
8
  rootState: {},
9
9
  apiKey: null,
10
10
  apiVersion: void 0,
11
- registeredComponents: {},
11
+ componentInfos: {},
12
12
  inheritedStyles: {}
13
13
  });
14
14
  export {
@@ -0,0 +1,66 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value
10
+ }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ const applyPatchWithMinimalMutationChain = (obj, patch, preserveRoot = false) => {
19
+ if (Object(obj) !== obj) {
20
+ return obj;
21
+ }
22
+ const {
23
+ path,
24
+ op,
25
+ value
26
+ } = patch;
27
+ const pathArr = path.split(/\//);
28
+ if (pathArr[0] === "") {
29
+ pathArr.shift();
30
+ }
31
+ const newObj = preserveRoot ? obj : __spreadValues({}, obj);
32
+ let objPart = newObj;
33
+ for (let i = 0; i < pathArr.length; i++) {
34
+ const isLast = i === pathArr.length - 1;
35
+ const property = pathArr[i];
36
+ if (isLast) {
37
+ if (op === "replace") {
38
+ objPart[property] = value;
39
+ } else if (op === "add") {
40
+ const index = Number(property);
41
+ if (Array.isArray(objPart)) {
42
+ if (property === "-") {
43
+ objPart.push(value);
44
+ } else {
45
+ objPart.splice(index, 0, value);
46
+ }
47
+ } else {
48
+ objPart[property] = value;
49
+ }
50
+ } else if (op === "remove") {
51
+ const index = Number(property);
52
+ if (Array.isArray(objPart)) {
53
+ objPart.splice(index, 1);
54
+ } else {
55
+ delete objPart[property];
56
+ }
57
+ }
58
+ } else {
59
+ const nextProperty = pathArr[i + 1];
60
+ const newPart = Object(objPart[property]) === objPart[property] ? objPart[property] : String(Number(nextProperty)) === nextProperty ? [] : {};
61
+ objPart = objPart[property] = Array.isArray(newPart) ? [...newPart] : __spreadValues({}, newPart);
62
+ }
63
+ }
64
+ return newObj;
65
+ };
66
+ export { applyPatchWithMinimalMutationChain }
@@ -1,4 +1,2 @@
1
- const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
2
- export {
3
- camelToKebabCase
4
- };
1
+ const camelToKebabCase = string => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
2
+ export { camelToKebabCase }