@builder.io/sdk-svelte 0.11.2 → 0.11.3
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/button.svelte +0 -5
- package/lib/browser/blocks/button/button.svelte.d.ts +20 -0
- package/lib/browser/blocks/button/button.types.d.ts +6 -0
- package/lib/browser/blocks/button/button.types.js +1 -0
- package/lib/browser/blocks/columns/columns.svelte.d.ts +2 -14
- package/lib/browser/blocks/columns/columns.types.d.ts +15 -0
- package/lib/browser/blocks/columns/columns.types.js +1 -0
- package/lib/browser/blocks/fragment/fragment.svelte +0 -2
- package/lib/browser/blocks/fragment/fragment.svelte.d.ts +17 -0
- package/lib/browser/blocks/fragment/fragment.types.d.ts +5 -0
- package/lib/browser/blocks/fragment/fragment.types.js +1 -0
- package/lib/browser/blocks/image/image.svelte +0 -2
- package/lib/browser/blocks/image/image.svelte.d.ts +30 -0
- package/lib/browser/blocks/image/image.types.d.ts +19 -0
- package/lib/browser/blocks/image/image.types.js +1 -0
- package/lib/browser/blocks/section/section.svelte +0 -5
- package/lib/browser/blocks/section/section.svelte.d.ts +20 -0
- package/lib/browser/blocks/section/section.types.d.ts +6 -0
- package/lib/browser/blocks/section/section.types.js +1 -0
- package/lib/browser/blocks/symbol/symbol.svelte +0 -5
- package/lib/browser/blocks/symbol/symbol.svelte.d.ts +23 -0
- package/lib/browser/blocks/symbol/symbol.types.d.ts +18 -0
- package/lib/browser/blocks/symbol/symbol.types.js +1 -0
- package/lib/browser/blocks/text/text.svelte +0 -2
- package/lib/browser/blocks/text/text.svelte.d.ts +17 -0
- package/lib/browser/blocks/text/text.types.d.ts +3 -0
- package/lib/browser/blocks/text/text.types.js +1 -0
- package/lib/browser/blocks/video/video.svelte +0 -2
- package/lib/browser/blocks/video/video.svelte.d.ts +33 -0
- package/lib/browser/blocks/video/video.types.d.ts +21 -0
- package/lib/browser/blocks/video/video.types.js +1 -0
- package/lib/browser/components/block/block.svelte +3 -5
- package/lib/browser/components/block/components/component-ref/component-ref.svelte +1 -6
- package/lib/browser/components/blocks/blocks.svelte +1 -10
- package/lib/browser/components/blocks/blocks.svelte.d.ts +22 -0
- package/lib/browser/components/blocks/blocks.types.d.ts +8 -0
- package/lib/browser/components/blocks/blocks.types.js +1 -0
- package/lib/browser/components/content-variants/content-variants.types.d.ts +30 -1
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/get-content/index.d.ts +1 -1
- package/lib/browser/functions/get-content/index.js +1 -1
- package/lib/browser/functions/get-content/types.d.ts +2 -2
- package/lib/browser/server-index.d.ts +10 -1
- package/lib/edge/blocks/button/button.svelte +0 -5
- package/lib/edge/blocks/button/button.svelte.d.ts +20 -0
- package/lib/edge/blocks/button/button.types.d.ts +6 -0
- package/lib/edge/blocks/button/button.types.js +1 -0
- package/lib/edge/blocks/columns/columns.svelte.d.ts +2 -14
- package/lib/edge/blocks/columns/columns.types.d.ts +15 -0
- package/lib/edge/blocks/columns/columns.types.js +1 -0
- package/lib/edge/blocks/fragment/fragment.svelte +0 -2
- package/lib/edge/blocks/fragment/fragment.svelte.d.ts +17 -0
- package/lib/edge/blocks/fragment/fragment.types.d.ts +5 -0
- package/lib/edge/blocks/fragment/fragment.types.js +1 -0
- package/lib/edge/blocks/image/image.svelte +0 -2
- package/lib/edge/blocks/image/image.svelte.d.ts +30 -0
- package/lib/edge/blocks/image/image.types.d.ts +19 -0
- package/lib/edge/blocks/image/image.types.js +1 -0
- package/lib/edge/blocks/section/section.svelte +0 -5
- package/lib/edge/blocks/section/section.svelte.d.ts +20 -0
- package/lib/edge/blocks/section/section.types.d.ts +6 -0
- package/lib/edge/blocks/section/section.types.js +1 -0
- package/lib/edge/blocks/symbol/symbol.svelte +0 -5
- package/lib/edge/blocks/symbol/symbol.svelte.d.ts +23 -0
- package/lib/edge/blocks/symbol/symbol.types.d.ts +18 -0
- package/lib/edge/blocks/symbol/symbol.types.js +1 -0
- package/lib/edge/blocks/text/text.svelte +0 -2
- package/lib/edge/blocks/text/text.svelte.d.ts +17 -0
- package/lib/edge/blocks/text/text.types.d.ts +3 -0
- package/lib/edge/blocks/text/text.types.js +1 -0
- package/lib/edge/blocks/video/video.svelte +0 -2
- package/lib/edge/blocks/video/video.svelte.d.ts +33 -0
- package/lib/edge/blocks/video/video.types.d.ts +21 -0
- package/lib/edge/blocks/video/video.types.js +1 -0
- package/lib/edge/components/block/block.svelte +3 -5
- package/lib/edge/components/block/components/component-ref/component-ref.svelte +1 -6
- package/lib/edge/components/blocks/blocks.svelte +1 -10
- package/lib/edge/components/blocks/blocks.svelte.d.ts +22 -0
- package/lib/edge/components/blocks/blocks.types.d.ts +8 -0
- package/lib/edge/components/blocks/blocks.types.js +1 -0
- package/lib/edge/components/content-variants/content-variants.types.d.ts +30 -1
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/get-content/index.d.ts +1 -1
- package/lib/edge/functions/get-content/index.js +1 -1
- package/lib/edge/functions/get-content/types.d.ts +2 -2
- package/lib/edge/server-index.d.ts +10 -1
- package/lib/node/blocks/button/button.svelte +0 -5
- package/lib/node/blocks/button/button.svelte.d.ts +20 -0
- package/lib/node/blocks/button/button.types.d.ts +6 -0
- package/lib/node/blocks/button/button.types.js +1 -0
- package/lib/node/blocks/columns/columns.svelte.d.ts +2 -14
- package/lib/node/blocks/columns/columns.types.d.ts +15 -0
- package/lib/node/blocks/columns/columns.types.js +1 -0
- package/lib/node/blocks/fragment/fragment.svelte +0 -2
- package/lib/node/blocks/fragment/fragment.svelte.d.ts +17 -0
- package/lib/node/blocks/fragment/fragment.types.d.ts +5 -0
- package/lib/node/blocks/fragment/fragment.types.js +1 -0
- package/lib/node/blocks/image/image.svelte +0 -2
- package/lib/node/blocks/image/image.svelte.d.ts +30 -0
- package/lib/node/blocks/image/image.types.d.ts +19 -0
- package/lib/node/blocks/image/image.types.js +1 -0
- package/lib/node/blocks/section/section.svelte +0 -5
- package/lib/node/blocks/section/section.svelte.d.ts +20 -0
- package/lib/node/blocks/section/section.types.d.ts +6 -0
- package/lib/node/blocks/section/section.types.js +1 -0
- package/lib/node/blocks/symbol/symbol.svelte +0 -5
- package/lib/node/blocks/symbol/symbol.svelte.d.ts +23 -0
- package/lib/node/blocks/symbol/symbol.types.d.ts +18 -0
- package/lib/node/blocks/symbol/symbol.types.js +1 -0
- package/lib/node/blocks/text/text.svelte +0 -2
- package/lib/node/blocks/text/text.svelte.d.ts +17 -0
- package/lib/node/blocks/text/text.types.d.ts +3 -0
- package/lib/node/blocks/text/text.types.js +1 -0
- package/lib/node/blocks/video/video.svelte +0 -2
- package/lib/node/blocks/video/video.svelte.d.ts +33 -0
- package/lib/node/blocks/video/video.types.d.ts +21 -0
- package/lib/node/blocks/video/video.types.js +1 -0
- package/lib/node/components/block/block.svelte +3 -5
- package/lib/node/components/block/components/component-ref/component-ref.svelte +1 -6
- package/lib/node/components/blocks/blocks.svelte +1 -10
- package/lib/node/components/blocks/blocks.svelte.d.ts +22 -0
- package/lib/node/components/blocks/blocks.types.d.ts +8 -0
- package/lib/node/components/blocks/blocks.types.js +1 -0
- package/lib/node/components/content-variants/content-variants.types.d.ts +30 -1
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/get-content/index.d.ts +1 -1
- package/lib/node/functions/get-content/index.js +1 -1
- package/lib/node/functions/get-content/types.d.ts +2 -2
- package/lib/node/server-index.d.ts +10 -1
- package/package.json +1 -1
- package/src/blocks/button/button.svelte +1 -13
- package/src/blocks/button/button.types.ts +6 -0
- package/src/blocks/columns/columns.svelte +2 -20
- package/src/blocks/columns/columns.types.ts +14 -0
- package/src/blocks/fragment/fragment.svelte +1 -8
- package/src/blocks/fragment/fragment.types.ts +5 -0
- package/src/blocks/image/image.svelte +1 -22
- package/src/blocks/image/image.types.ts +19 -0
- package/src/blocks/section/section.svelte +1 -13
- package/src/blocks/section/section.types.ts +6 -0
- package/src/blocks/symbol/symbol.svelte +2 -31
- package/src/blocks/symbol/symbol.types.ts +17 -0
- package/src/blocks/text/text.svelte +2 -6
- package/src/blocks/text/text.types.ts +3 -0
- package/src/blocks/video/video.svelte +1 -33
- package/src/blocks/video/video.types.ts +21 -0
- package/src/components/block/block.svelte +3 -5
- package/src/components/block/components/component-ref/component-ref.svelte +1 -6
- package/src/components/blocks/blocks.svelte +2 -23
- package/src/components/blocks/blocks.types.ts +7 -0
- package/src/components/content-variants/content-variants.types.ts +43 -1
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/get-content/index.ts +1 -1
- package/src/functions/get-content/types.ts +2 -2
- package/src/server-index.ts +10 -1
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
export interface FragmentProps {
|
|
3
|
-
maxWidth?: number;
|
|
4
|
-
attributes?: any;
|
|
5
|
-
children?: any;
|
|
6
|
-
}
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
1
|
<script lang="ts">
|
|
2
|
+
import type { FragmentProps } from "./fragment.types.js";
|
|
10
3
|
</script>
|
|
11
4
|
|
|
12
5
|
<span><slot /></span>
|
|
@@ -1,27 +1,6 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
export interface ImageProps {
|
|
3
|
-
className?: string;
|
|
4
|
-
image: string;
|
|
5
|
-
sizes?: string;
|
|
6
|
-
lazy?: boolean;
|
|
7
|
-
height?: number;
|
|
8
|
-
width?: number;
|
|
9
|
-
altText?: string;
|
|
10
|
-
backgroundSize?: "cover" | "contain";
|
|
11
|
-
backgroundPosition?: string;
|
|
12
|
-
srcset?: string;
|
|
13
|
-
aspectRatio?: number;
|
|
14
|
-
children?: any;
|
|
15
|
-
fitContent?: boolean;
|
|
16
|
-
builderBlock?: BuilderBlock;
|
|
17
|
-
noWebp?: boolean;
|
|
18
|
-
src?: string;
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
1
|
<script lang="ts">
|
|
23
|
-
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
24
2
|
import { getSrcSet } from "./image.helpers.js";
|
|
3
|
+
import type { ImageProps } from "./image.types.js";
|
|
25
4
|
|
|
26
5
|
export let image: ImageProps["image"];
|
|
27
6
|
export let src: ImageProps["src"] = undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BuilderBlock } from '../../types/builder-block.js';
|
|
2
|
+
export interface ImageProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
image: string;
|
|
5
|
+
sizes?: string;
|
|
6
|
+
lazy?: boolean;
|
|
7
|
+
height?: number;
|
|
8
|
+
width?: number;
|
|
9
|
+
altText?: string;
|
|
10
|
+
backgroundSize?: 'cover' | 'contain';
|
|
11
|
+
backgroundPosition?: string;
|
|
12
|
+
srcset?: string;
|
|
13
|
+
aspectRatio?: number;
|
|
14
|
+
children?: any;
|
|
15
|
+
fitContent?: boolean;
|
|
16
|
+
builderBlock?: BuilderBlock;
|
|
17
|
+
noWebp?: boolean;
|
|
18
|
+
src?: string;
|
|
19
|
+
}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface SectionProps {
|
|
7
|
-
maxWidth?: number;
|
|
8
|
-
attributes?: any;
|
|
9
|
-
children?: any;
|
|
10
|
-
builderBlock?: any;
|
|
11
|
-
}
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
1
|
<script lang="ts">
|
|
15
2
|
import { filterAttrs } from "../helpers.js";
|
|
3
|
+
import type { SectionProps } from "./section.types.js";
|
|
16
4
|
import { setAttrs } from "../helpers.js";
|
|
17
5
|
|
|
18
6
|
export let attributes: SectionProps["attributes"] = undefined;
|
|
@@ -1,43 +1,14 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface SymbolInfo {
|
|
7
|
-
model?: string;
|
|
8
|
-
entry?: string;
|
|
9
|
-
data?: any;
|
|
10
|
-
content?: BuilderContent;
|
|
11
|
-
inline?: boolean;
|
|
12
|
-
dynamic?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This import is used by the Svelte SDK. Do not remove.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export interface SymbolProps extends BuilderComponentsProp {
|
|
20
|
-
symbol?: SymbolInfo;
|
|
21
|
-
dataOnly?: boolean;
|
|
22
|
-
dynamic?: boolean;
|
|
23
|
-
attributes?: any;
|
|
24
|
-
inheritState?: boolean;
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
1
|
<script lang="ts">
|
|
29
2
|
import { onMount } from "svelte";
|
|
30
3
|
|
|
31
4
|
import ContentVariants from "../../components/content-variants/content-variants.svelte";
|
|
32
5
|
import type { BuilderContent } from "../../types/builder-content.js";
|
|
33
|
-
import type {
|
|
34
|
-
BuilderComponentsProp,
|
|
35
|
-
PropsWithBuilderData,
|
|
36
|
-
} from "../../types/builder-props.js";
|
|
6
|
+
import type { PropsWithBuilderData } from "../../types/builder-props.js";
|
|
37
7
|
import { filterAttrs } from "../helpers.js";
|
|
38
8
|
import type { Nullable } from "../../types/typescript.js";
|
|
39
9
|
import { setAttrs } from "../helpers.js";
|
|
40
10
|
import { fetchSymbolContent } from "./symbol.helpers.js";
|
|
11
|
+
import type { SymbolProps } from "./symbol.types.js";
|
|
41
12
|
|
|
42
13
|
export let js: PropsWithBuilderData<SymbolProps>["js"];
|
|
43
14
|
export let attributes: PropsWithBuilderData<SymbolProps>["attributes"] =
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BuilderContent } from '../../types/builder-content.js';
|
|
2
|
+
import type { BuilderComponentsProp } from '../../types/builder-props.js';
|
|
3
|
+
interface SymbolInfo {
|
|
4
|
+
model?: string;
|
|
5
|
+
entry?: string;
|
|
6
|
+
data?: any;
|
|
7
|
+
content?: BuilderContent;
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
dynamic?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SymbolProps extends BuilderComponentsProp {
|
|
12
|
+
symbol?: SymbolInfo;
|
|
13
|
+
dataOnly?: boolean;
|
|
14
|
+
dynamic?: boolean;
|
|
15
|
+
attributes?: any;
|
|
16
|
+
inheritState?: boolean;
|
|
17
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
export interface TextProps {
|
|
3
|
-
text?: string;
|
|
4
|
-
}
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
1
|
<script lang="ts">
|
|
2
|
+
import type { TextProps } from "./text.types.js";
|
|
3
|
+
|
|
8
4
|
export let text: TextProps["text"] = undefined;
|
|
9
5
|
|
|
10
6
|
function mitosis_styling(node, vars) {
|
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
export interface VideoProps {
|
|
3
|
-
attributes?: any;
|
|
4
|
-
video?: string;
|
|
5
|
-
autoPlay?: boolean;
|
|
6
|
-
controls?: boolean;
|
|
7
|
-
muted?: boolean;
|
|
8
|
-
loop?: boolean;
|
|
9
|
-
playsInline?: boolean;
|
|
10
|
-
aspectRatio?: number;
|
|
11
|
-
width?: number;
|
|
12
|
-
height?: number;
|
|
13
|
-
fit?: "contain" | "cover" | "fill";
|
|
14
|
-
preload?: "auto" | "metadata" | "none";
|
|
15
|
-
position?:
|
|
16
|
-
| "center"
|
|
17
|
-
| "top"
|
|
18
|
-
| "left"
|
|
19
|
-
| "right"
|
|
20
|
-
| "bottom"
|
|
21
|
-
| "top left"
|
|
22
|
-
| "top right"
|
|
23
|
-
| "bottom left"
|
|
24
|
-
| "bottom right";
|
|
25
|
-
posterImage?: string;
|
|
26
|
-
lazyLoad?: boolean;
|
|
27
|
-
children?: any;
|
|
28
|
-
fitContent?: boolean;
|
|
29
|
-
builderBlock?: BuilderBlock;
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
1
|
<script lang="ts">
|
|
34
|
-
import type {
|
|
2
|
+
import type { VideoProps } from "./video.types.js";
|
|
35
3
|
|
|
36
4
|
export let autoPlay: VideoProps["autoPlay"] = undefined;
|
|
37
5
|
export let muted: VideoProps["muted"] = undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BuilderBlock } from '../../types/builder-block.js';
|
|
2
|
+
export interface VideoProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
video?: string;
|
|
5
|
+
autoPlay?: boolean;
|
|
6
|
+
controls?: boolean;
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
loop?: boolean;
|
|
9
|
+
playsInline?: boolean;
|
|
10
|
+
aspectRatio?: number;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
fit?: 'contain' | 'cover' | 'fill';
|
|
14
|
+
preload?: 'auto' | 'metadata' | 'none';
|
|
15
|
+
position?: 'center' | 'top' | 'left' | 'right' | 'bottom' | 'top left' | 'top right' | 'bottom left' | 'bottom right';
|
|
16
|
+
posterImage?: string;
|
|
17
|
+
lazyLoad?: boolean;
|
|
18
|
+
children?: any;
|
|
19
|
+
fitContent?: boolean;
|
|
20
|
+
builderBlock?: BuilderBlock;
|
|
21
|
+
}
|
|
@@ -112,6 +112,8 @@
|
|
|
112
112
|
</script>
|
|
113
113
|
|
|
114
114
|
{#if canShowBlock()}
|
|
115
|
+
<BlockStyles {block} context={$context} />
|
|
116
|
+
|
|
115
117
|
{#if !blockComponent?.()?.noWrap}
|
|
116
118
|
{#if isEmptyHtmlElement(Tag())}
|
|
117
119
|
<BlockWrapper
|
|
@@ -150,17 +152,13 @@
|
|
|
150
152
|
isInteractive={componentRefProps().isInteractive}
|
|
151
153
|
/>
|
|
152
154
|
|
|
153
|
-
{#each childrenWithoutParentComponent() as child (
|
|
155
|
+
{#each childrenWithoutParentComponent() as child (child.id)}
|
|
154
156
|
<svelte:self
|
|
155
157
|
block={child}
|
|
156
158
|
context={childrenContext}
|
|
157
159
|
{registeredComponents}
|
|
158
160
|
/>
|
|
159
161
|
{/each}
|
|
160
|
-
|
|
161
|
-
{#each childrenWithoutParentComponent() as child ("block-style-" + child.id)}
|
|
162
|
-
<BlockStyles block={child} context={$childrenContext} />
|
|
163
|
-
{/each}
|
|
164
162
|
</BlockWrapper>
|
|
165
163
|
{/if}
|
|
166
164
|
{:else}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { wrapComponentRef } from "../../../content/wrap-component-ref.js";
|
|
3
3
|
import Block from "../../block.svelte";
|
|
4
|
-
import BlockStyles from "../block-styles.svelte";
|
|
5
4
|
import InteractiveElement from "../interactive-element.svelte";
|
|
6
5
|
import type { ComponentProps } from "./component-ref.helpers.js";
|
|
7
6
|
import { getWrapperProps } from "./component-ref.helpers.js";
|
|
@@ -31,12 +30,8 @@
|
|
|
31
30
|
contextValue: $context,
|
|
32
31
|
})}
|
|
33
32
|
>
|
|
34
|
-
{#each blockChildren as child (
|
|
33
|
+
{#each blockChildren as child (child.id)}
|
|
35
34
|
<Block block={child} {context} {registeredComponents} />
|
|
36
35
|
{/each}
|
|
37
|
-
|
|
38
|
-
{#each blockChildren as child ("block-style-" + child.id)}
|
|
39
|
-
<BlockStyles block={child} context={$context} />
|
|
40
|
-
{/each}
|
|
41
36
|
</svelte:component>
|
|
42
37
|
{/if}
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
<script context="module" lang="ts">
|
|
2
|
-
export type BlocksProps = Partial<
|
|
3
|
-
Omit<BlocksWrapperProps, "BlocksWrapper" | "BlocksWrapperProps">
|
|
4
|
-
> & {
|
|
5
|
-
context?: Writable<BuilderContextInterface>;
|
|
6
|
-
registeredComponents?: RegisteredComponents;
|
|
7
|
-
};
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
1
|
<script lang="ts">
|
|
11
2
|
import { getContext } from "svelte";
|
|
12
3
|
|
|
13
4
|
import BuilderContext from "../../context/builder.context.js";
|
|
14
5
|
import ComponentsContext from "../../context/components.context.js";
|
|
15
|
-
import type {
|
|
16
|
-
BuilderContextInterface,
|
|
17
|
-
RegisteredComponents,
|
|
18
|
-
} from "../../context/types.js";
|
|
19
6
|
import Block from "../block/block.svelte";
|
|
20
|
-
import BlockStyles from "../block/components/block-styles.svelte";
|
|
21
|
-
import type { BlocksWrapperProps } from "./blocks-wrapper.svelte";
|
|
22
7
|
import BlocksWrapper from "./blocks-wrapper.svelte";
|
|
23
|
-
import type {
|
|
8
|
+
import type { BlocksProps } from "./blocks.types.js";
|
|
24
9
|
|
|
25
10
|
export let blocks: BlocksProps["blocks"];
|
|
26
11
|
export let parent: BlocksProps["parent"];
|
|
@@ -43,7 +28,7 @@
|
|
|
43
28
|
BlocksWrapperProps={$context?.BlocksWrapperProps}
|
|
44
29
|
>
|
|
45
30
|
{#if blocks}
|
|
46
|
-
{#each blocks as block (
|
|
31
|
+
{#each blocks as block (block.id)}
|
|
47
32
|
<Block
|
|
48
33
|
{block}
|
|
49
34
|
context={context || builderContext}
|
|
@@ -52,10 +37,4 @@
|
|
|
52
37
|
/>
|
|
53
38
|
{/each}
|
|
54
39
|
{/if}
|
|
55
|
-
|
|
56
|
-
{#if blocks}
|
|
57
|
-
{#each blocks as block ("block-style-" + block.id)}
|
|
58
|
-
<BlockStyles {block} context={$context || $builderContext} />
|
|
59
|
-
{/each}
|
|
60
|
-
{/if}
|
|
61
40
|
</BlocksWrapper>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Writable } from "svelte/store";
|
|
2
|
+
import type { BuilderContextInterface, RegisteredComponents } from '../../context/types.js';
|
|
3
|
+
import type { BlocksWrapperProps } from './blocks-wrapper.svelte';
|
|
4
|
+
export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>> & {
|
|
5
|
+
context?: Writable<BuilderContextInterface>;
|
|
6
|
+
registeredComponents?: RegisteredComponents;
|
|
7
|
+
}
|
|
@@ -3,32 +3,74 @@ import type { ApiVersion } from '../../types/api-version.js';
|
|
|
3
3
|
import type { BuilderContent } from '../../types/builder-content.js';
|
|
4
4
|
import type { Nullable } from '../../types/typescript.js';
|
|
5
5
|
export interface ContentVariantsPrps {
|
|
6
|
+
/**
|
|
7
|
+
* The Builder content JSON to render (required).
|
|
8
|
+
*/
|
|
6
9
|
content?: Nullable<BuilderContent>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The Builder content `model` to render (required).
|
|
13
|
+
*/
|
|
7
14
|
model?: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Additional data to inject into your Builder content (optional).
|
|
18
|
+
*/
|
|
8
19
|
data?: {
|
|
9
20
|
[key: string]: any;
|
|
10
21
|
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
11
26
|
context?: BuilderRenderContext;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Your API Key: needed to dynamically fetch symbols (required).
|
|
30
|
+
*/
|
|
12
31
|
apiKey: string;
|
|
13
32
|
apiVersion?: ApiVersion;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* An array of custom components to register (optional).
|
|
36
|
+
*/
|
|
14
37
|
customComponents?: RegisteredComponent[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A boolean to enable or disable tracking (optional). Defaults to `true`.
|
|
41
|
+
*/
|
|
15
42
|
canTrack?: boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* If provided, the API will auto-resolve localized objects to the value of this `locale` key (optional).
|
|
46
|
+
*/
|
|
16
47
|
locale?: string;
|
|
17
|
-
|
|
48
|
+
|
|
49
|
+
/** @deprecated use `enrich` instead */
|
|
18
50
|
includeRefs?: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A boolean to enable or disable enriching API content (optional).
|
|
54
|
+
*
|
|
55
|
+
* Enriching will Include multilevel references in the response. Defaults to `false`.
|
|
56
|
+
*/
|
|
19
57
|
enrich?: boolean;
|
|
58
|
+
|
|
20
59
|
/**
|
|
21
60
|
* The element that wraps your content. Defaults to `div` ('ScrollView' in React Native).
|
|
22
61
|
*/
|
|
23
62
|
contentWrapper?: any;
|
|
63
|
+
|
|
24
64
|
/**
|
|
25
65
|
* Additonal props to pass to `contentWrapper`. Defaults to `{}`.
|
|
26
66
|
*/
|
|
27
67
|
contentWrapperProps?: any;
|
|
68
|
+
|
|
28
69
|
/**
|
|
29
70
|
* The element that wraps your blocks. Defaults to `div` ('ScrollView' in React Native).
|
|
30
71
|
*/
|
|
31
72
|
blocksWrapper?: any;
|
|
73
|
+
|
|
32
74
|
/**
|
|
33
75
|
* Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
|
|
34
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.11.
|
|
1
|
+
export const SDK_VERSION = "0.11.3"
|
|
@@ -11,7 +11,7 @@ import type { GetContentOptions } from './types.js';
|
|
|
11
11
|
const checkContentHasResults = (content: ContentResponse): content is ContentResults => 'results' in content;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Returns
|
|
14
|
+
* Returns the first content entry that matches the given options.
|
|
15
15
|
*/
|
|
16
16
|
export async function fetchOneEntry(options: GetContentOptions): Promise<BuilderContent | null> {
|
|
17
17
|
const allContent = await fetchEntries({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface GetContentOptions {
|
|
2
|
-
/** The model to get content for */
|
|
2
|
+
/** The model to get content for (required) */
|
|
3
3
|
model: string;
|
|
4
4
|
|
|
5
|
-
/** Your public API key */
|
|
5
|
+
/** Your public API key (required) */
|
|
6
6
|
apiKey: string;
|
|
7
7
|
|
|
8
8
|
/** Number of items to fetch. Default is 1 */
|
package/src/server-index.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export * from './index-helpers/top-of-file.js';
|
|
2
|
+
export type { ButtonProps } from './blocks/button/button.types.js';
|
|
3
|
+
export type { ColumnProps } from './blocks/columns/columns.types.js';
|
|
4
|
+
export type { FragmentProps } from './blocks/fragment/fragment.types.js';
|
|
5
|
+
export type { ImageProps } from './blocks/image/image.types.js';
|
|
6
|
+
export type { SectionProps } from './blocks/section/section.types.js';
|
|
7
|
+
export type { SymbolProps } from './blocks/symbol/symbol.types.js';
|
|
8
|
+
export type { TextProps } from './blocks/text/text.types.js';
|
|
9
|
+
export type { VideoProps } from './blocks/video/video.types.js';
|
|
10
|
+
export type { BlocksProps } from './components/blocks/blocks.types.js';
|
|
11
|
+
export type { ContentVariantsPrps as ContentProps } from './components/content-variants/content-variants.types.js';
|
|
2
12
|
export { isEditing } from './functions/is-editing.js';
|
|
3
13
|
export { isPreviewing } from './functions/is-previewing.js';
|
|
4
14
|
export { createRegisterComponentMessage } from './functions/register-component.js';
|
|
@@ -9,7 +19,6 @@ export type { Settings } from './functions/set-editor-settings.js';
|
|
|
9
19
|
export { _processContentResult, fetchEntries, fetchOneEntry, getAllContent, getContent } from './functions/get-content/index.js';
|
|
10
20
|
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
11
21
|
export { track } from './functions/track/index.js';
|
|
12
|
-
export type { ContentProps } from './components/content/content.types.js';
|
|
13
22
|
export type { RegisteredComponent } from './context/types.js';
|
|
14
23
|
export type { ComponentInfo } from './types/components.js';
|
|
15
24
|
export { fetchBuilderProps } from './functions/fetch-builder-props.js'
|