@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.
- package/lib/browser/blocks/button/index.d.ts +1 -0
- package/lib/browser/blocks/button/index.js +1 -0
- package/lib/browser/blocks/columns/index.d.ts +1 -0
- package/lib/browser/blocks/columns/index.js +1 -0
- package/lib/browser/blocks/custom-code/index.d.ts +1 -0
- package/lib/browser/blocks/custom-code/index.js +1 -0
- package/lib/browser/blocks/embed/index.d.ts +1 -0
- package/lib/browser/blocks/embed/index.js +1 -0
- package/lib/browser/blocks/form/form/index.d.ts +1 -0
- package/lib/browser/blocks/form/form/index.js +1 -0
- package/lib/browser/blocks/form/input/index.d.ts +1 -0
- package/lib/browser/blocks/form/input/index.js +1 -0
- package/lib/browser/blocks/form/select/index.d.ts +1 -0
- package/lib/browser/blocks/form/select/index.js +1 -0
- package/lib/browser/blocks/form/submit-button/index.d.ts +1 -0
- package/lib/browser/blocks/form/submit-button/index.js +1 -0
- package/lib/browser/blocks/fragment/index.d.ts +1 -0
- package/lib/browser/blocks/fragment/index.js +1 -0
- package/lib/browser/blocks/image/index.d.ts +1 -0
- package/lib/browser/blocks/image/index.js +1 -0
- package/lib/browser/blocks/img/index.d.ts +1 -0
- package/lib/browser/blocks/img/index.js +1 -0
- package/lib/browser/blocks/raw-text/index.d.ts +1 -0
- package/lib/browser/blocks/raw-text/index.js +1 -0
- package/lib/browser/blocks/section/index.d.ts +1 -0
- package/lib/browser/blocks/section/index.js +1 -0
- package/lib/browser/blocks/slot/index.d.ts +1 -0
- package/lib/browser/blocks/slot/index.js +1 -0
- package/lib/browser/blocks/symbol/index.d.ts +1 -0
- package/lib/browser/blocks/symbol/index.js +1 -0
- package/lib/browser/blocks/symbol/symbol.svelte +3 -1
- package/lib/browser/blocks/text/index.d.ts +1 -0
- package/lib/browser/blocks/text/index.js +1 -0
- package/lib/browser/blocks/textarea/index.d.ts +1 -0
- package/lib/browser/blocks/textarea/index.js +1 -0
- package/lib/browser/blocks/video/index.d.ts +1 -0
- package/lib/browser/blocks/video/index.js +1 -0
- package/lib/browser/components/blocks/index.d.ts +1 -0
- package/lib/browser/components/blocks/index.js +1 -0
- package/lib/browser/components/content-variants/index.d.ts +1 -0
- package/lib/browser/components/content-variants/index.js +1 -0
- package/lib/browser/components/error-boundary.svelte +5 -0
- package/lib/browser/constants/builder-registered-components.js +8 -8
- package/lib/browser/constants/extra-components.js +8 -8
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/get-builder-search-params/index.d.ts +1 -4
- package/lib/browser/functions/get-builder-search-params/index.js +1 -8
- package/lib/browser/functions/get-content/generate-content-url.js +2 -1
- package/lib/browser/functions/is-editing.d.ts +2 -1
- package/lib/browser/functions/is-editing.js +3 -2
- package/lib/browser/functions/is-previewing.d.ts +2 -1
- package/lib/browser/functions/is-previewing.js +5 -3
- package/lib/browser/helpers/search/search.d.ts +5 -0
- package/lib/browser/helpers/search/search.js +17 -0
- package/lib/browser/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/browser/index-helpers/blocks-exports.js +10 -11
- package/lib/browser/index.d.ts +5 -2
- package/lib/browser/index.js +5 -2
- package/lib/edge/blocks/button/index.d.ts +1 -0
- package/lib/edge/blocks/button/index.js +1 -0
- package/lib/edge/blocks/columns/index.d.ts +1 -0
- package/lib/edge/blocks/columns/index.js +1 -0
- package/lib/edge/blocks/custom-code/index.d.ts +1 -0
- package/lib/edge/blocks/custom-code/index.js +1 -0
- package/lib/edge/blocks/embed/index.d.ts +1 -0
- package/lib/edge/blocks/embed/index.js +1 -0
- package/lib/edge/blocks/form/form/index.d.ts +1 -0
- package/lib/edge/blocks/form/form/index.js +1 -0
- package/lib/edge/blocks/form/input/index.d.ts +1 -0
- package/lib/edge/blocks/form/input/index.js +1 -0
- package/lib/edge/blocks/form/select/index.d.ts +1 -0
- package/lib/edge/blocks/form/select/index.js +1 -0
- package/lib/edge/blocks/form/submit-button/index.d.ts +1 -0
- package/lib/edge/blocks/form/submit-button/index.js +1 -0
- package/lib/edge/blocks/fragment/index.d.ts +1 -0
- package/lib/edge/blocks/fragment/index.js +1 -0
- package/lib/edge/blocks/image/index.d.ts +1 -0
- package/lib/edge/blocks/image/index.js +1 -0
- package/lib/edge/blocks/img/index.d.ts +1 -0
- package/lib/edge/blocks/img/index.js +1 -0
- package/lib/edge/blocks/raw-text/index.d.ts +1 -0
- package/lib/edge/blocks/raw-text/index.js +1 -0
- package/lib/edge/blocks/section/index.d.ts +1 -0
- package/lib/edge/blocks/section/index.js +1 -0
- package/lib/edge/blocks/slot/index.d.ts +1 -0
- package/lib/edge/blocks/slot/index.js +1 -0
- package/lib/edge/blocks/symbol/index.d.ts +1 -0
- package/lib/edge/blocks/symbol/index.js +1 -0
- package/lib/edge/blocks/symbol/symbol.svelte +3 -1
- package/lib/edge/blocks/text/index.d.ts +1 -0
- package/lib/edge/blocks/text/index.js +1 -0
- package/lib/edge/blocks/textarea/index.d.ts +1 -0
- package/lib/edge/blocks/textarea/index.js +1 -0
- package/lib/edge/blocks/video/index.d.ts +1 -0
- package/lib/edge/blocks/video/index.js +1 -0
- package/lib/edge/components/blocks/index.d.ts +1 -0
- package/lib/edge/components/blocks/index.js +1 -0
- package/lib/edge/components/content-variants/index.d.ts +1 -0
- package/lib/edge/components/content-variants/index.js +1 -0
- package/lib/edge/components/error-boundary.svelte +5 -0
- package/lib/edge/constants/builder-registered-components.js +8 -8
- package/lib/edge/constants/extra-components.js +8 -8
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/get-builder-search-params/index.d.ts +1 -4
- package/lib/edge/functions/get-builder-search-params/index.js +1 -8
- package/lib/edge/functions/get-content/generate-content-url.js +2 -1
- package/lib/edge/functions/is-editing.d.ts +2 -1
- package/lib/edge/functions/is-editing.js +3 -2
- package/lib/edge/functions/is-previewing.d.ts +2 -1
- package/lib/edge/functions/is-previewing.js +5 -3
- package/lib/edge/helpers/search/search.d.ts +5 -0
- package/lib/edge/helpers/search/search.js +17 -0
- package/lib/edge/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/edge/index-helpers/blocks-exports.js +10 -11
- package/lib/edge/index.d.ts +5 -2
- package/lib/edge/index.js +5 -2
- package/lib/node/blocks/button/index.d.ts +1 -0
- package/lib/node/blocks/button/index.js +1 -0
- package/lib/node/blocks/columns/index.d.ts +1 -0
- package/lib/node/blocks/columns/index.js +1 -0
- package/lib/node/blocks/custom-code/index.d.ts +1 -0
- package/lib/node/blocks/custom-code/index.js +1 -0
- package/lib/node/blocks/embed/index.d.ts +1 -0
- package/lib/node/blocks/embed/index.js +1 -0
- package/lib/node/blocks/form/form/index.d.ts +1 -0
- package/lib/node/blocks/form/form/index.js +1 -0
- package/lib/node/blocks/form/input/index.d.ts +1 -0
- package/lib/node/blocks/form/input/index.js +1 -0
- package/lib/node/blocks/form/select/index.d.ts +1 -0
- package/lib/node/blocks/form/select/index.js +1 -0
- package/lib/node/blocks/form/submit-button/index.d.ts +1 -0
- package/lib/node/blocks/form/submit-button/index.js +1 -0
- package/lib/node/blocks/fragment/index.d.ts +1 -0
- package/lib/node/blocks/fragment/index.js +1 -0
- package/lib/node/blocks/image/index.d.ts +1 -0
- package/lib/node/blocks/image/index.js +1 -0
- package/lib/node/blocks/img/index.d.ts +1 -0
- package/lib/node/blocks/img/index.js +1 -0
- package/lib/node/blocks/raw-text/index.d.ts +1 -0
- package/lib/node/blocks/raw-text/index.js +1 -0
- package/lib/node/blocks/section/index.d.ts +1 -0
- package/lib/node/blocks/section/index.js +1 -0
- package/lib/node/blocks/slot/index.d.ts +1 -0
- package/lib/node/blocks/slot/index.js +1 -0
- package/lib/node/blocks/symbol/index.d.ts +1 -0
- package/lib/node/blocks/symbol/index.js +1 -0
- package/lib/node/blocks/symbol/symbol.svelte +3 -1
- package/lib/node/blocks/text/index.d.ts +1 -0
- package/lib/node/blocks/text/index.js +1 -0
- package/lib/node/blocks/textarea/index.d.ts +1 -0
- package/lib/node/blocks/textarea/index.js +1 -0
- package/lib/node/blocks/video/index.d.ts +1 -0
- package/lib/node/blocks/video/index.js +1 -0
- package/lib/node/components/blocks/index.d.ts +1 -0
- package/lib/node/components/blocks/index.js +1 -0
- package/lib/node/components/content-variants/index.d.ts +1 -0
- package/lib/node/components/content-variants/index.js +1 -0
- package/lib/node/components/error-boundary.svelte +5 -0
- package/lib/node/constants/builder-registered-components.js +8 -8
- package/lib/node/constants/extra-components.js +8 -8
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/get-builder-search-params/index.d.ts +1 -4
- package/lib/node/functions/get-builder-search-params/index.js +1 -8
- package/lib/node/functions/get-content/generate-content-url.js +2 -1
- package/lib/node/functions/is-editing.d.ts +2 -1
- package/lib/node/functions/is-editing.js +3 -2
- package/lib/node/functions/is-previewing.d.ts +2 -1
- package/lib/node/functions/is-previewing.js +5 -3
- package/lib/node/helpers/search/search.d.ts +5 -0
- package/lib/node/helpers/search/search.js +17 -0
- package/lib/node/index-helpers/blocks-exports.d.ts +10 -11
- package/lib/node/index-helpers/blocks-exports.js +10 -11
- package/lib/node/index.d.ts +5 -2
- package/lib/node/index.js +5 -2
- package/package.json +4 -4
- package/src/blocks/button/index.ts +1 -0
- package/src/blocks/columns/index.ts +1 -0
- package/src/blocks/custom-code/index.ts +1 -0
- package/src/blocks/embed/index.ts +1 -0
- package/src/blocks/form/form/index.ts +1 -0
- package/src/blocks/form/input/index.ts +1 -0
- package/src/blocks/form/select/index.ts +1 -0
- package/src/blocks/form/submit-button/index.ts +1 -0
- package/src/blocks/fragment/index.ts +1 -0
- package/src/blocks/image/index.ts +1 -0
- package/src/blocks/img/index.ts +1 -0
- package/src/blocks/raw-text/index.ts +1 -0
- package/src/blocks/section/index.ts +1 -0
- package/src/blocks/slot/index.ts +1 -0
- package/src/blocks/symbol/index.ts +1 -0
- package/src/blocks/symbol/symbol.svelte +3 -1
- package/src/blocks/text/index.ts +1 -0
- package/src/blocks/textarea/index.ts +1 -0
- package/src/blocks/video/index.ts +1 -0
- package/src/components/blocks/index.ts +1 -0
- package/src/components/content-variants/index.ts +1 -0
- package/src/components/error-boundary.svelte +10 -0
- package/src/constants/builder-registered-components.ts +8 -8
- package/src/constants/extra-components.ts +8 -8
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/get-builder-search-params/index.ts +3 -10
- package/src/functions/get-content/generate-content-url.ts +2 -1
- package/src/functions/is-editing.ts +3 -2
- package/src/functions/is-previewing.ts +6 -3
- package/src/helpers/search/search.ts +18 -0
- package/src/index-helpers/blocks-exports.ts +10 -11
- package/src/index.ts +6 -2
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { default as Button } from '../blocks/button/
|
|
2
|
-
export { default as Columns } from '../blocks/columns/
|
|
3
|
-
export { default as Fragment } from '../blocks/fragment/
|
|
4
|
-
export { default as Image } from '../blocks/image/
|
|
5
|
-
export { default as Section } from '../blocks/section/
|
|
6
|
-
export { default as Symbol } from '../blocks/symbol/
|
|
7
|
-
export { default as Text } from '../blocks/text/
|
|
8
|
-
export { default as Video } from '../blocks/video/
|
|
9
|
-
|
|
10
|
-
|
|
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/
|
|
2
|
-
export { default as Columns } from '../blocks/columns/
|
|
3
|
-
export { default as Fragment } from '../blocks/fragment/
|
|
4
|
-
export { default as Image } from '../blocks/image/
|
|
5
|
-
export { default as Section } from '../blocks/section/
|
|
6
|
-
export { default as Symbol } from '../blocks/symbol/
|
|
7
|
-
export { default as Text } from '../blocks/text/
|
|
8
|
-
export { default as Video } from '../blocks/video/
|
|
9
|
-
|
|
10
|
-
|
|
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/lib/node/index.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
8
|
-
*
|
|
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.
|
|
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/
|
|
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'
|
|
@@ -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
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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.
|
|
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
|
|
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()
|
|
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
|
-
|
|
9
|
+
const normalizedSearch = getSearchString(search || window.location.search);
|
|
10
|
+
if (isEditing(normalizedSearch)) {
|
|
8
11
|
return false;
|
|
9
12
|
}
|
|
10
|
-
return Boolean(
|
|
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/
|
|
2
|
-
export { default as Columns } from '../blocks/columns/
|
|
3
|
-
export { default as Fragment } from '../blocks/fragment/
|
|
4
|
-
export { default as Image } from '../blocks/image/
|
|
5
|
-
export { default as Section } from '../blocks/section/
|
|
6
|
-
export { default as Symbol } from '../blocks/symbol/
|
|
7
|
-
export { default as Text } from '../blocks/text/
|
|
8
|
-
export { default as Video } from '../blocks/video/
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
*
|
|
9
|
-
*
|
|
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'
|