@builder.io/sdk-svelte 1.0.3 → 1.0.6

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 (210) hide show
  1. package/lib/browser/blocks/button/index.d.ts +1 -0
  2. package/lib/browser/blocks/button/index.js +1 -0
  3. package/lib/browser/blocks/columns/index.d.ts +1 -0
  4. package/lib/browser/blocks/columns/index.js +1 -0
  5. package/lib/browser/blocks/custom-code/index.d.ts +1 -0
  6. package/lib/browser/blocks/custom-code/index.js +1 -0
  7. package/lib/browser/blocks/embed/index.d.ts +1 -0
  8. package/lib/browser/blocks/embed/index.js +1 -0
  9. package/lib/browser/blocks/form/form/index.d.ts +1 -0
  10. package/lib/browser/blocks/form/form/index.js +1 -0
  11. package/lib/browser/blocks/form/input/index.d.ts +1 -0
  12. package/lib/browser/blocks/form/input/index.js +1 -0
  13. package/lib/browser/blocks/form/select/index.d.ts +1 -0
  14. package/lib/browser/blocks/form/select/index.js +1 -0
  15. package/lib/browser/blocks/form/submit-button/index.d.ts +1 -0
  16. package/lib/browser/blocks/form/submit-button/index.js +1 -0
  17. package/lib/browser/blocks/fragment/index.d.ts +1 -0
  18. package/lib/browser/blocks/fragment/index.js +1 -0
  19. package/lib/browser/blocks/image/index.d.ts +1 -0
  20. package/lib/browser/blocks/image/index.js +1 -0
  21. package/lib/browser/blocks/img/index.d.ts +1 -0
  22. package/lib/browser/blocks/img/index.js +1 -0
  23. package/lib/browser/blocks/raw-text/index.d.ts +1 -0
  24. package/lib/browser/blocks/raw-text/index.js +1 -0
  25. package/lib/browser/blocks/section/index.d.ts +1 -0
  26. package/lib/browser/blocks/section/index.js +1 -0
  27. package/lib/browser/blocks/slot/index.d.ts +1 -0
  28. package/lib/browser/blocks/slot/index.js +1 -0
  29. package/lib/browser/blocks/symbol/index.d.ts +1 -0
  30. package/lib/browser/blocks/symbol/index.js +1 -0
  31. package/lib/browser/blocks/symbol/symbol.svelte +3 -1
  32. package/lib/browser/blocks/text/index.d.ts +1 -0
  33. package/lib/browser/blocks/text/index.js +1 -0
  34. package/lib/browser/blocks/textarea/index.d.ts +1 -0
  35. package/lib/browser/blocks/textarea/index.js +1 -0
  36. package/lib/browser/blocks/video/index.d.ts +1 -0
  37. package/lib/browser/blocks/video/index.js +1 -0
  38. package/lib/browser/components/blocks/index.d.ts +1 -0
  39. package/lib/browser/components/blocks/index.js +1 -0
  40. package/lib/browser/components/content-variants/index.d.ts +1 -0
  41. package/lib/browser/components/content-variants/index.js +1 -0
  42. package/lib/browser/components/error-boundary.svelte +5 -0
  43. package/lib/browser/constants/builder-registered-components.js +8 -8
  44. package/lib/browser/constants/extra-components.js +8 -8
  45. package/lib/browser/constants/sdk-version.d.ts +1 -1
  46. package/lib/browser/constants/sdk-version.js +1 -1
  47. package/lib/browser/functions/get-builder-search-params/index.d.ts +1 -4
  48. package/lib/browser/functions/get-builder-search-params/index.js +1 -8
  49. package/lib/browser/functions/get-content/generate-content-url.js +2 -1
  50. package/lib/browser/functions/is-editing.d.ts +2 -1
  51. package/lib/browser/functions/is-editing.js +3 -2
  52. package/lib/browser/functions/is-previewing.d.ts +2 -1
  53. package/lib/browser/functions/is-previewing.js +5 -3
  54. package/lib/browser/helpers/search/search.d.ts +5 -0
  55. package/lib/browser/helpers/search/search.js +17 -0
  56. package/lib/browser/index-helpers/blocks-exports.d.ts +10 -11
  57. package/lib/browser/index-helpers/blocks-exports.js +10 -11
  58. package/lib/browser/index.d.ts +5 -2
  59. package/lib/browser/index.js +5 -2
  60. package/lib/edge/blocks/button/index.d.ts +1 -0
  61. package/lib/edge/blocks/button/index.js +1 -0
  62. package/lib/edge/blocks/columns/index.d.ts +1 -0
  63. package/lib/edge/blocks/columns/index.js +1 -0
  64. package/lib/edge/blocks/custom-code/index.d.ts +1 -0
  65. package/lib/edge/blocks/custom-code/index.js +1 -0
  66. package/lib/edge/blocks/embed/index.d.ts +1 -0
  67. package/lib/edge/blocks/embed/index.js +1 -0
  68. package/lib/edge/blocks/form/form/index.d.ts +1 -0
  69. package/lib/edge/blocks/form/form/index.js +1 -0
  70. package/lib/edge/blocks/form/input/index.d.ts +1 -0
  71. package/lib/edge/blocks/form/input/index.js +1 -0
  72. package/lib/edge/blocks/form/select/index.d.ts +1 -0
  73. package/lib/edge/blocks/form/select/index.js +1 -0
  74. package/lib/edge/blocks/form/submit-button/index.d.ts +1 -0
  75. package/lib/edge/blocks/form/submit-button/index.js +1 -0
  76. package/lib/edge/blocks/fragment/index.d.ts +1 -0
  77. package/lib/edge/blocks/fragment/index.js +1 -0
  78. package/lib/edge/blocks/image/index.d.ts +1 -0
  79. package/lib/edge/blocks/image/index.js +1 -0
  80. package/lib/edge/blocks/img/index.d.ts +1 -0
  81. package/lib/edge/blocks/img/index.js +1 -0
  82. package/lib/edge/blocks/raw-text/index.d.ts +1 -0
  83. package/lib/edge/blocks/raw-text/index.js +1 -0
  84. package/lib/edge/blocks/section/index.d.ts +1 -0
  85. package/lib/edge/blocks/section/index.js +1 -0
  86. package/lib/edge/blocks/slot/index.d.ts +1 -0
  87. package/lib/edge/blocks/slot/index.js +1 -0
  88. package/lib/edge/blocks/symbol/index.d.ts +1 -0
  89. package/lib/edge/blocks/symbol/index.js +1 -0
  90. package/lib/edge/blocks/symbol/symbol.svelte +3 -1
  91. package/lib/edge/blocks/text/index.d.ts +1 -0
  92. package/lib/edge/blocks/text/index.js +1 -0
  93. package/lib/edge/blocks/textarea/index.d.ts +1 -0
  94. package/lib/edge/blocks/textarea/index.js +1 -0
  95. package/lib/edge/blocks/video/index.d.ts +1 -0
  96. package/lib/edge/blocks/video/index.js +1 -0
  97. package/lib/edge/components/blocks/index.d.ts +1 -0
  98. package/lib/edge/components/blocks/index.js +1 -0
  99. package/lib/edge/components/content-variants/index.d.ts +1 -0
  100. package/lib/edge/components/content-variants/index.js +1 -0
  101. package/lib/edge/components/error-boundary.svelte +5 -0
  102. package/lib/edge/constants/builder-registered-components.js +8 -8
  103. package/lib/edge/constants/extra-components.js +8 -8
  104. package/lib/edge/constants/sdk-version.d.ts +1 -1
  105. package/lib/edge/constants/sdk-version.js +1 -1
  106. package/lib/edge/functions/get-builder-search-params/index.d.ts +1 -4
  107. package/lib/edge/functions/get-builder-search-params/index.js +1 -8
  108. package/lib/edge/functions/get-content/generate-content-url.js +2 -1
  109. package/lib/edge/functions/is-editing.d.ts +2 -1
  110. package/lib/edge/functions/is-editing.js +3 -2
  111. package/lib/edge/functions/is-previewing.d.ts +2 -1
  112. package/lib/edge/functions/is-previewing.js +5 -3
  113. package/lib/edge/helpers/search/search.d.ts +5 -0
  114. package/lib/edge/helpers/search/search.js +17 -0
  115. package/lib/edge/index-helpers/blocks-exports.d.ts +10 -11
  116. package/lib/edge/index-helpers/blocks-exports.js +10 -11
  117. package/lib/edge/index.d.ts +5 -2
  118. package/lib/edge/index.js +5 -2
  119. package/lib/node/blocks/button/index.d.ts +1 -0
  120. package/lib/node/blocks/button/index.js +1 -0
  121. package/lib/node/blocks/columns/index.d.ts +1 -0
  122. package/lib/node/blocks/columns/index.js +1 -0
  123. package/lib/node/blocks/custom-code/index.d.ts +1 -0
  124. package/lib/node/blocks/custom-code/index.js +1 -0
  125. package/lib/node/blocks/embed/index.d.ts +1 -0
  126. package/lib/node/blocks/embed/index.js +1 -0
  127. package/lib/node/blocks/form/form/index.d.ts +1 -0
  128. package/lib/node/blocks/form/form/index.js +1 -0
  129. package/lib/node/blocks/form/input/index.d.ts +1 -0
  130. package/lib/node/blocks/form/input/index.js +1 -0
  131. package/lib/node/blocks/form/select/index.d.ts +1 -0
  132. package/lib/node/blocks/form/select/index.js +1 -0
  133. package/lib/node/blocks/form/submit-button/index.d.ts +1 -0
  134. package/lib/node/blocks/form/submit-button/index.js +1 -0
  135. package/lib/node/blocks/fragment/index.d.ts +1 -0
  136. package/lib/node/blocks/fragment/index.js +1 -0
  137. package/lib/node/blocks/image/index.d.ts +1 -0
  138. package/lib/node/blocks/image/index.js +1 -0
  139. package/lib/node/blocks/img/index.d.ts +1 -0
  140. package/lib/node/blocks/img/index.js +1 -0
  141. package/lib/node/blocks/raw-text/index.d.ts +1 -0
  142. package/lib/node/blocks/raw-text/index.js +1 -0
  143. package/lib/node/blocks/section/index.d.ts +1 -0
  144. package/lib/node/blocks/section/index.js +1 -0
  145. package/lib/node/blocks/slot/index.d.ts +1 -0
  146. package/lib/node/blocks/slot/index.js +1 -0
  147. package/lib/node/blocks/symbol/index.d.ts +1 -0
  148. package/lib/node/blocks/symbol/index.js +1 -0
  149. package/lib/node/blocks/symbol/symbol.svelte +3 -1
  150. package/lib/node/blocks/text/index.d.ts +1 -0
  151. package/lib/node/blocks/text/index.js +1 -0
  152. package/lib/node/blocks/textarea/index.d.ts +1 -0
  153. package/lib/node/blocks/textarea/index.js +1 -0
  154. package/lib/node/blocks/video/index.d.ts +1 -0
  155. package/lib/node/blocks/video/index.js +1 -0
  156. package/lib/node/components/blocks/index.d.ts +1 -0
  157. package/lib/node/components/blocks/index.js +1 -0
  158. package/lib/node/components/content-variants/index.d.ts +1 -0
  159. package/lib/node/components/content-variants/index.js +1 -0
  160. package/lib/node/components/error-boundary.svelte +5 -0
  161. package/lib/node/constants/builder-registered-components.js +8 -8
  162. package/lib/node/constants/extra-components.js +8 -8
  163. package/lib/node/constants/sdk-version.d.ts +1 -1
  164. package/lib/node/constants/sdk-version.js +1 -1
  165. package/lib/node/functions/get-builder-search-params/index.d.ts +1 -4
  166. package/lib/node/functions/get-builder-search-params/index.js +1 -8
  167. package/lib/node/functions/get-content/generate-content-url.js +2 -1
  168. package/lib/node/functions/is-editing.d.ts +2 -1
  169. package/lib/node/functions/is-editing.js +3 -2
  170. package/lib/node/functions/is-previewing.d.ts +2 -1
  171. package/lib/node/functions/is-previewing.js +5 -3
  172. package/lib/node/helpers/search/search.d.ts +5 -0
  173. package/lib/node/helpers/search/search.js +17 -0
  174. package/lib/node/index-helpers/blocks-exports.d.ts +10 -11
  175. package/lib/node/index-helpers/blocks-exports.js +10 -11
  176. package/lib/node/index.d.ts +5 -2
  177. package/lib/node/index.js +5 -2
  178. package/package.json +4 -4
  179. package/src/blocks/button/index.ts +1 -0
  180. package/src/blocks/columns/index.ts +1 -0
  181. package/src/blocks/custom-code/index.ts +1 -0
  182. package/src/blocks/embed/index.ts +1 -0
  183. package/src/blocks/form/form/index.ts +1 -0
  184. package/src/blocks/form/input/index.ts +1 -0
  185. package/src/blocks/form/select/index.ts +1 -0
  186. package/src/blocks/form/submit-button/index.ts +1 -0
  187. package/src/blocks/fragment/index.ts +1 -0
  188. package/src/blocks/image/index.ts +1 -0
  189. package/src/blocks/img/index.ts +1 -0
  190. package/src/blocks/raw-text/index.ts +1 -0
  191. package/src/blocks/section/index.ts +1 -0
  192. package/src/blocks/slot/index.ts +1 -0
  193. package/src/blocks/symbol/index.ts +1 -0
  194. package/src/blocks/symbol/symbol.svelte +3 -1
  195. package/src/blocks/text/index.ts +1 -0
  196. package/src/blocks/textarea/index.ts +1 -0
  197. package/src/blocks/video/index.ts +1 -0
  198. package/src/components/blocks/index.ts +1 -0
  199. package/src/components/content-variants/index.ts +1 -0
  200. package/src/components/error-boundary.svelte +10 -0
  201. package/src/constants/builder-registered-components.ts +8 -8
  202. package/src/constants/extra-components.ts +8 -8
  203. package/src/constants/sdk-version.ts +1 -1
  204. package/src/functions/get-builder-search-params/index.ts +3 -10
  205. package/src/functions/get-content/generate-content-url.ts +2 -1
  206. package/src/functions/is-editing.ts +3 -2
  207. package/src/functions/is-previewing.ts +6 -3
  208. package/src/helpers/search/search.ts +18 -0
  209. package/src/index-helpers/blocks-exports.ts +10 -11
  210. package/src/index.ts +6 -2
@@ -1,11 +1,10 @@
1
- export { default as Button } from '../blocks/button/button.svelte';
2
- export { default as Columns } from '../blocks/columns/columns.svelte';
3
- export { default as Fragment } from '../blocks/fragment/fragment.svelte';
4
- export { default as Image } from '../blocks/image/image.svelte';
5
- export { default as Section } from '../blocks/section/section.svelte';
6
- export { default as Symbol } from '../blocks/symbol/symbol.svelte';
7
- export { default as Text } from '../blocks/text/text.svelte';
8
- export { default as Video } from '../blocks/video/video.svelte';
9
- import { default as Blocks } from '../components/blocks/blocks.svelte';
10
- import { default as Content } from '../components/content-variants/content-variants.svelte';
11
- export { Blocks, Content };
1
+ export { default as Button } from '../blocks/button/index.js';
2
+ export { default as Columns } from '../blocks/columns/index.js';
3
+ export { default as Fragment } from '../blocks/fragment/index.js';
4
+ export { default as Image } from '../blocks/image/index.js';
5
+ export { default as Section } from '../blocks/section/index.js';
6
+ export { default as Symbol } from '../blocks/symbol/index.js';
7
+ export { default as Text } from '../blocks/text/index.js';
8
+ export { default as Video } from '../blocks/video/index.js';
9
+ export { default as Blocks } from '../components/blocks/index.js';
10
+ export { default as Content } from '../components/content-variants/index.js';
@@ -1,11 +1,10 @@
1
- export { default as Button } from '../blocks/button/button.svelte';
2
- export { default as Columns } from '../blocks/columns/columns.svelte';
3
- export { default as Fragment } from '../blocks/fragment/fragment.svelte';
4
- export { default as Image } from '../blocks/image/image.svelte';
5
- export { default as Section } from '../blocks/section/section.svelte';
6
- export { default as Symbol } from '../blocks/symbol/symbol.svelte';
7
- export { default as Text } from '../blocks/text/text.svelte';
8
- export { default as Video } from '../blocks/video/video.svelte';
9
- import { default as Blocks } from '../components/blocks/blocks.svelte';
10
- import { default as Content } from '../components/content-variants/content-variants.svelte';
11
- export { Blocks, Content };
1
+ export { default as Button } from '../blocks/button/index.js';
2
+ export { default as Columns } from '../blocks/columns/index.js';
3
+ export { default as Fragment } from '../blocks/fragment/index.js';
4
+ export { default as Image } from '../blocks/image/index.js';
5
+ export { default as Section } from '../blocks/section/index.js';
6
+ export { default as Symbol } from '../blocks/symbol/index.js';
7
+ export { default as Text } from '../blocks/text/index.js';
8
+ export { default as Video } from '../blocks/video/index.js';
9
+ export { default as Blocks } from '../components/blocks/index.js';
10
+ export { default as Content } from '../components/content-variants/index.js';
@@ -1,7 +1,10 @@
1
1
  export * from './index-helpers/top-of-file.js';
2
+ /**
3
+ * In the React SDK, this file is marked with `use client`.
4
+ */
2
5
  export * from './index-helpers/blocks-exports.js';
3
6
  /**
4
- * We have a separate entry point to the SDKs that guarantees no components are being imported. This is useful
5
- * for React SDK, which would break in the NextJS App directory because the component imports have `use client` in them.
7
+ * In the React SDK, this file is not marked with `use client`, to allow
8
+ * NextJS App Directory to use the SDK helper functions without issues.
6
9
  */
7
10
  export * from './server-index.js';
package/lib/node/index.js CHANGED
@@ -1,10 +1,13 @@
1
1
  // ignore prettier formatting for this file because the order of exports is meaningful
2
2
  // prettier-ignore
3
3
  export * from './index-helpers/top-of-file.js';
4
+ /**
5
+ * In the React SDK, this file is marked with `use client`.
6
+ */
4
7
  // prettier-ignore
5
8
  export * from './index-helpers/blocks-exports.js';
6
9
  /**
7
- * We have a separate entry point to the SDKs that guarantees no components are being imported. This is useful
8
- * for React SDK, which would break in the NextJS App directory because the component imports have `use client` in them.
10
+ * In the React SDK, this file is not marked with `use client`, to allow
11
+ * NextJS App Directory to use the SDK helper functions without issues.
9
12
  */
10
13
  export * from './server-index.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "1.0.3",
4
+ "version": "1.0.6",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -31,9 +31,9 @@
31
31
  "electron": "./lib/node/index.js",
32
32
  "default": "./lib/browser/index.js"
33
33
  },
34
- "./edge": "./lib/edge/index.js",
35
- "./node": "./lib/node/index.js",
36
- "./browser": "./lib/browser/index.js"
34
+ "./bundle/edge": "./lib/edge/index.js",
35
+ "./bundle/node": "./lib/node/index.js",
36
+ "./bundle/browser": "./lib/browser/index.js"
37
37
  },
38
38
  "types": "./lib/browser/index.d.ts",
39
39
  "scripts": {
@@ -0,0 +1 @@
1
+ export { default } from './button.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './columns.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './custom-code.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './embed.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './form.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './input.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './select.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './submit-button.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './fragment.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './image.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './img.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './raw-text.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './section.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './slot.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './symbol.svelte'
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from "svelte";
3
3
 
4
- import ContentVariants from "../../components/content-variants/content-variants.svelte";
4
+ import ContentVariants from "../../components/content-variants/index.js";
5
5
  import type { BuilderContent } from "../../types/builder-content.js";
6
6
  import { filterAttrs } from "../helpers.js";
7
7
  import { getClassPropName } from "../../functions/get-class-prop-name.js";
@@ -77,5 +77,7 @@
77
77
  model={symbol?.model}
78
78
  content={contentToUse}
79
79
  linkComponent={builderLinkComponent}
80
+ blocksWrapper={"div"}
81
+ contentWrapper={"div"}
80
82
  />
81
83
  </div>
@@ -0,0 +1 @@
1
+ export { default } from './text.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './textarea.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './video.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './blocks.svelte'
@@ -0,0 +1 @@
1
+ export { default } from './content-variants.svelte'
@@ -0,0 +1,10 @@
1
+ <script context="module" lang="ts">
2
+ export interface ErrorBoundaryProps {
3
+ children: any;
4
+ }
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ </script>
9
+
10
+ <slot />
@@ -1,19 +1,19 @@
1
- import { default as Button } from '../blocks/button/button.svelte';
2
1
  import { componentInfo as buttonComponentInfo } from '../blocks/button/component-info.js';
3
- import { default as Columns } from '../blocks/columns/columns.svelte';
2
+ import { default as Button } from '../blocks/button/index.js';
4
3
  import { componentInfo as columnsComponentInfo } from '../blocks/columns/component-info.js';
4
+ import { default as Columns } from '../blocks/columns/index.js';
5
5
  import { componentInfo as fragmentComponentInfo } from '../blocks/fragment/component-info.js';
6
- import { default as Fragment } from '../blocks/fragment/fragment.svelte';
6
+ import { default as Fragment } from '../blocks/fragment/index.js';
7
7
  import { componentInfo as imageComponentInfo } from '../blocks/image/component-info.js';
8
- import { default as Image } from '../blocks/image/image.svelte';
8
+ import { default as Image } from '../blocks/image/index.js';
9
9
  import { componentInfo as sectionComponentInfo } from '../blocks/section/component-info.js';
10
- import { default as Section } from '../blocks/section/section.svelte';
10
+ import { default as Section } from '../blocks/section/index.js';
11
11
  import { componentInfo as slotComponentInfo } from '../blocks/slot/component-info.js';
12
- import { default as Slot } from '../blocks/slot/slot.svelte';
12
+ import { default as Slot } from '../blocks/slot/index.js';
13
13
  import { componentInfo as symbolComponentInfo } from '../blocks/symbol/component-info.js';
14
- import { default as Symbol } from '../blocks/symbol/symbol.svelte';
14
+ import { default as Symbol } from '../blocks/symbol/index.js';
15
15
  import { componentInfo as textComponentInfo } from '../blocks/text/component-info.js';
16
- import { default as Text } from '../blocks/text/text.svelte';
16
+ import { default as Text } from '../blocks/text/index.js';
17
17
  import type { RegisteredComponent } from '../context/types.js';
18
18
  import { getExtraComponents } from './extra-components.js';
19
19
 
@@ -5,21 +5,21 @@
5
5
  */
6
6
 
7
7
  import { componentInfo as customCodeInfo } from '../blocks/custom-code/component-info.js';
8
- import { default as customCode } from '../blocks/custom-code/custom-code.svelte';
8
+ import { default as customCode } from '../blocks/custom-code/index.js';
9
9
  import { componentInfo as embedComponentInfo } from '../blocks/embed/component-info.js';
10
- import { default as embed } from '../blocks/embed/embed.svelte';
10
+ import { default as embed } from '../blocks/embed/index.js';
11
11
  import { componentInfo as formComponentInfo } from '../blocks/form/form/component-info.js';
12
- import { default as Form } from '../blocks/form/form/form.svelte';
12
+ import { default as Form } from '../blocks/form/form/index.js';
13
13
  import { componentInfo as formInputComponentInfo } from '../blocks/form/input/component-info.js';
14
- import { default as FormInput } from '../blocks/form/input/input.svelte';
14
+ import { default as FormInput } from '../blocks/form/input/index.js';
15
15
  import { componentInfo as formSelectComponentInfo } from '../blocks/form/select/component-info.js';
16
- import { default as FormSelect } from '../blocks/form/select/select.svelte';
16
+ import { default as FormSelect } from '../blocks/form/select/index.js';
17
17
  import { componentInfo as formSubmitButtonComponentInfo } from '../blocks/form/submit-button/component-info.js';
18
- import { default as FormSubmitButton } from '../blocks/form/submit-button/submit-button.svelte';
18
+ import { default as FormSubmitButton } from '../blocks/form/submit-button/index.js';
19
19
  import { componentInfo as imgComponentInfo } from '../blocks/img/component-info.js';
20
- import { default as Img } from '../blocks/img/img.svelte';
20
+ import { default as Img } from '../blocks/img/index.js';
21
21
  import { componentInfo as videoComponentInfo } from '../blocks/video/component-info.js';
22
- import { default as Video } from '../blocks/video/video.svelte';
22
+ import { default as Video } from '../blocks/video/index.js';
23
23
  import type { RegisteredComponent } from '../context/types.js';
24
24
  import { TARGET } from './target.js';
25
25
  export const getExtraComponents: () => RegisteredComponent[] = () => [{
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.3"
1
+ export const SDK_VERSION = "1.0.6"
@@ -1,14 +1,8 @@
1
+ import type { QueryObject } from '../../helpers/search/search.js';
2
+ import { normalizeSearchParams } from '../../helpers/search/search.js';
1
3
  import { isBrowser } from '../is-browser.js';
2
4
  const BUILDER_SEARCHPARAMS_PREFIX = 'builder.';
3
5
  const BUILDER_OPTIONS_PREFIX = 'options.';
4
- type QueryObject = Record<string, string | string[]>;
5
- export const convertSearchParamsToQueryObject = (searchParams: URLSearchParams): QueryObject => {
6
- const options: Record<string, string> = {};
7
- searchParams.forEach((value, key) => {
8
- options[key] = value;
9
- });
10
- return options;
11
- };
12
6
 
13
7
  /**
14
8
  * Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
@@ -36,5 +30,4 @@ export const getBuilderSearchParamsFromWindow = () => {
36
30
  }
37
31
  const searchParams = new URLSearchParams(window.location.search);
38
32
  return getBuilderSearchParams(searchParams);
39
- };
40
- export const normalizeSearchParams = (searchParams: QueryObject | URLSearchParams): QueryObject => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams
33
+ }
@@ -1,6 +1,7 @@
1
1
  import { flatten } from '../../helpers/flatten.js';
2
+ import { normalizeSearchParams } from '../../helpers/search/search.js';
2
3
  import { DEFAULT_API_VERSION } from '../../types/api-version.js';
3
- import { getBuilderSearchParamsFromWindow, normalizeSearchParams } from '../get-builder-search-params/index.js';
4
+ import { getBuilderSearchParamsFromWindow } from '../get-builder-search-params/index.js';
4
5
  import type { GetContentOptions } from './types.js';
5
6
  const isPositiveNumber = (thing: unknown) => typeof thing === 'number' && !isNaN(thing) && thing >= 0;
6
7
  export const generateContentUrl = (options: GetContentOptions): URL => {
@@ -1,5 +1,6 @@
1
1
  import { TARGET } from '../constants/target.js';
2
+ import { getSearchString, type Search } from '../helpers/search/search.js';
2
3
  import { isIframe } from './is-iframe.js';
3
- export function isEditing(): boolean {
4
- return isIframe() && (TARGET === 'reactNative' || window.location.search.indexOf('builder.frameEditing=') !== -1);
4
+ export function isEditing(search?: Search) {
5
+ return isIframe() && (TARGET === 'reactNative' || getSearchString(search || window.location.search).indexOf('builder.frameEditing=') !== -1);
5
6
  }
@@ -1,11 +1,14 @@
1
+ import type { Search } from '../helpers/search/search.js';
2
+ import { getSearchString } from '../helpers/search/search.js';
1
3
  import { isBrowser } from './is-browser.js';
2
4
  import { isEditing } from './is-editing.js';
3
- export function isPreviewing() {
5
+ export function isPreviewing(search?: Search) {
4
6
  if (!isBrowser()) {
5
7
  return false;
6
8
  }
7
- if (isEditing()) {
9
+ const normalizedSearch = getSearchString(search || window.location.search);
10
+ if (isEditing(normalizedSearch)) {
8
11
  return false;
9
12
  }
10
- return Boolean(location.search.indexOf('builder.preview=') !== -1);
13
+ return Boolean(normalizedSearch.indexOf('builder.preview=') !== -1);
11
14
  }
@@ -0,0 +1,18 @@
1
+ export type QueryObject = Record<string, string | string[]>;
2
+ export const convertSearchParamsToQueryObject = (searchParams: URLSearchParams): QueryObject => {
3
+ const options: Record<string, string> = {};
4
+ searchParams.forEach((value, key) => {
5
+ options[key] = value;
6
+ });
7
+ return options;
8
+ };
9
+ export const normalizeSearchParams = (searchParams: QueryObject | URLSearchParams): QueryObject => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
10
+ export type Search = URLSearchParams | string | QueryObject;
11
+ export const getSearchString = (search: Search): string => {
12
+ if (typeof search === 'string') {
13
+ return search;
14
+ } else if (search instanceof URLSearchParams) {
15
+ return search.toString();
16
+ }
17
+ return new URLSearchParams((search as any)).toString();
18
+ }
@@ -1,11 +1,10 @@
1
- export { default as Button } from '../blocks/button/button.svelte';
2
- export { default as Columns } from '../blocks/columns/columns.svelte';
3
- export { default as Fragment } from '../blocks/fragment/fragment.svelte';
4
- export { default as Image } from '../blocks/image/image.svelte';
5
- export { default as Section } from '../blocks/section/section.svelte';
6
- export { default as Symbol } from '../blocks/symbol/symbol.svelte';
7
- export { default as Text } from '../blocks/text/text.svelte';
8
- export { default as Video } from '../blocks/video/video.svelte';
9
- import { default as Blocks } from '../components/blocks/blocks.svelte';
10
- import { default as Content } from '../components/content-variants/content-variants.svelte';
11
- export { Blocks, Content }
1
+ export { default as Button } from '../blocks/button/index.js';
2
+ export { default as Columns } from '../blocks/columns/index.js';
3
+ export { default as Fragment } from '../blocks/fragment/index.js';
4
+ export { default as Image } from '../blocks/image/index.js';
5
+ export { default as Section } from '../blocks/section/index.js';
6
+ export { default as Symbol } from '../blocks/symbol/index.js';
7
+ export { default as Text } from '../blocks/text/index.js';
8
+ export { default as Video } from '../blocks/video/index.js';
9
+ export { default as Blocks } from '../components/blocks/index.js';
10
+ export { default as Content } from '../components/content-variants/index.js'
package/src/index.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  // ignore prettier formatting for this file because the order of exports is meaningful
2
2
  // prettier-ignore
3
3
  export * from './index-helpers/top-of-file.js';
4
+
5
+ /**
6
+ * In the React SDK, this file is marked with `use client`.
7
+ */
4
8
  // prettier-ignore
5
9
  export * from './index-helpers/blocks-exports.js';
6
10
 
7
11
  /**
8
- * We have a separate entry point to the SDKs that guarantees no components are being imported. This is useful
9
- * for React SDK, which would break in the NextJS App directory because the component imports have `use client` in them.
12
+ * In the React SDK, this file is not marked with `use client`, to allow
13
+ * NextJS App Directory to use the SDK helper functions without issues.
10
14
  */
11
15
  export * from './server-index.js'