@builder.io/sdk-svelte 0.6.2 → 0.6.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.
Files changed (31) hide show
  1. package/lib/browser/blocks/raw-text/raw-text.svelte +1 -1
  2. package/lib/browser/blocks/text/text.svelte +5 -3
  3. package/lib/browser/components/block/components/block-styles.svelte +16 -8
  4. package/lib/browser/constants/sdk-version.d.ts +1 -1
  5. package/lib/browser/constants/sdk-version.js +1 -1
  6. package/lib/browser/functions/fetch-builder-props.d.ts +13 -0
  7. package/lib/browser/functions/fetch-builder-props.js +13 -0
  8. package/lib/browser/types/components.d.ts +0 -1
  9. package/lib/edge/blocks/raw-text/raw-text.svelte +1 -1
  10. package/lib/edge/blocks/text/text.svelte +5 -3
  11. package/lib/edge/components/block/components/block-styles.svelte +16 -8
  12. package/lib/edge/constants/sdk-version.d.ts +1 -1
  13. package/lib/edge/constants/sdk-version.js +1 -1
  14. package/lib/edge/functions/fetch-builder-props.d.ts +13 -0
  15. package/lib/edge/functions/fetch-builder-props.js +13 -0
  16. package/lib/edge/types/components.d.ts +0 -1
  17. package/lib/node/blocks/raw-text/raw-text.svelte +1 -1
  18. package/lib/node/blocks/text/text.svelte +5 -3
  19. package/lib/node/components/block/components/block-styles.svelte +16 -8
  20. package/lib/node/constants/sdk-version.d.ts +1 -1
  21. package/lib/node/constants/sdk-version.js +1 -1
  22. package/lib/node/functions/fetch-builder-props.d.ts +13 -0
  23. package/lib/node/functions/fetch-builder-props.js +13 -0
  24. package/lib/node/types/components.d.ts +0 -1
  25. package/package.json +1 -1
  26. package/src/blocks/raw-text/raw-text.svelte +1 -1
  27. package/src/blocks/text/text.svelte +5 -3
  28. package/src/components/block/components/block-styles.svelte +16 -9
  29. package/src/constants/sdk-version.ts +1 -1
  30. package/src/functions/fetch-builder-props.ts +13 -0
  31. package/src/types/components.ts +0 -2
@@ -4,4 +4,4 @@
4
4
  export let attributes = undefined;
5
5
  </script>
6
6
 
7
- <span class={attributes.class}>{@html text?.toString() || ""}</span>
7
+ <div class={attributes.class}>{@html text?.toString() || ""}</div>
@@ -13,9 +13,11 @@ function mitosis_styling(node, vars) {
13
13
  }
14
14
  </script>
15
15
 
16
- <span
16
+ <div
17
17
  use:mitosis_styling={{
18
18
  outline: "none",
19
19
  }}
20
- class="builder-text">{@html text?.toString() || ""}</span
21
- >
20
+ class="builder-text"
21
+ >
22
+ {@html text?.toString() || ""}
23
+ </div>
@@ -9,6 +9,14 @@ import InlinedStyles from "../../inlined-styles.svelte";
9
9
  export let block;
10
10
  export let context;
11
11
  $: canShowBlock = () => {
12
+ const processedBlock = getProcessedBlock({
13
+ block: block,
14
+ localState: context.localState,
15
+ rootState: context.rootState,
16
+ rootSetState: context.rootSetState,
17
+ context: context.context,
18
+ shouldEvaluateBindings: true,
19
+ });
12
20
  // only render styles for blocks that are visible
13
21
  if (checkIsDefined(processedBlock.hide)) {
14
22
  return !processedBlock.hide;
@@ -19,6 +27,14 @@ $: canShowBlock = () => {
19
27
  return true;
20
28
  };
21
29
  $: css = () => {
30
+ const processedBlock = getProcessedBlock({
31
+ block: block,
32
+ localState: context.localState,
33
+ rootState: context.rootState,
34
+ rootSetState: context.rootSetState,
35
+ context: context.context,
36
+ shouldEvaluateBindings: true,
37
+ });
22
38
  const styles = processedBlock.responsiveStyles;
23
39
  const content = context.content;
24
40
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
@@ -51,14 +67,6 @@ $: css = () => {
51
67
  : "";
52
68
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
53
69
  };
54
- let processedBlock = getProcessedBlock({
55
- block: block,
56
- localState: context.localState,
57
- rootState: context.rootState,
58
- rootSetState: context.rootSetState,
59
- context: context.context,
60
- shouldEvaluateBindings: true,
61
- });
62
70
  </script>
63
71
 
64
72
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.6.2";
1
+ export declare const SDK_VERSION = "0.6.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.6.2";
1
+ export const SDK_VERSION = "0.6.3";
@@ -35,6 +35,19 @@ type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
35
35
  /**
36
36
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
37
37
  *
38
+ * @example
39
+ * ```jsx
40
+ * const builderProps = await fetchBuilderProps({
41
+ * apiKey: 'API_KEY',
42
+ * // provide `url`
43
+ * url: yourPageUrl,
44
+ * // OR provide `path` + `searchParams`
45
+ * path: yourPath,
46
+ * searchParams: yourSearchParams,
47
+ * });
48
+ *
49
+ * return <Content {...builderProps} />;
50
+ * ```
38
51
  */
39
52
  export declare const fetchBuilderProps: (_args: GetBuilderPropsOptions) => Promise<ContentVariantsPrps>;
40
53
  export {};
@@ -3,6 +3,19 @@ import { fetchOneEntry } from './get-content/index.js';
3
3
  /**
4
4
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
5
5
  *
6
+ * @example
7
+ * ```jsx
8
+ * const builderProps = await fetchBuilderProps({
9
+ * apiKey: 'API_KEY',
10
+ * // provide `url`
11
+ * url: yourPageUrl,
12
+ * // OR provide `path` + `searchParams`
13
+ * path: yourPath,
14
+ * searchParams: yourSearchParams,
15
+ * });
16
+ *
17
+ * return <Content {...builderProps} />;
18
+ * ```
6
19
  */
7
20
  export const fetchBuilderProps = async (_args) => {
8
21
  const urlPath = _args.path || _args.url?.pathname || _args.userAttributes?.urlPath;
@@ -97,7 +97,6 @@ export interface ComponentInfo {
97
97
  */
98
98
  query?: any;
99
99
  };
100
- /** not yet implemented */
101
100
  friendlyName?: string;
102
101
  /**
103
102
  * Use to restrict access to your component based on a the current user permissions
@@ -4,4 +4,4 @@
4
4
  export let attributes = undefined;
5
5
  </script>
6
6
 
7
- <span class={attributes.class}>{@html text?.toString() || ""}</span>
7
+ <div class={attributes.class}>{@html text?.toString() || ""}</div>
@@ -13,9 +13,11 @@ function mitosis_styling(node, vars) {
13
13
  }
14
14
  </script>
15
15
 
16
- <span
16
+ <div
17
17
  use:mitosis_styling={{
18
18
  outline: "none",
19
19
  }}
20
- class="builder-text">{@html text?.toString() || ""}</span
21
- >
20
+ class="builder-text"
21
+ >
22
+ {@html text?.toString() || ""}
23
+ </div>
@@ -9,6 +9,14 @@ import InlinedStyles from "../../inlined-styles.svelte";
9
9
  export let block;
10
10
  export let context;
11
11
  $: canShowBlock = () => {
12
+ const processedBlock = getProcessedBlock({
13
+ block: block,
14
+ localState: context.localState,
15
+ rootState: context.rootState,
16
+ rootSetState: context.rootSetState,
17
+ context: context.context,
18
+ shouldEvaluateBindings: true,
19
+ });
12
20
  // only render styles for blocks that are visible
13
21
  if (checkIsDefined(processedBlock.hide)) {
14
22
  return !processedBlock.hide;
@@ -19,6 +27,14 @@ $: canShowBlock = () => {
19
27
  return true;
20
28
  };
21
29
  $: css = () => {
30
+ const processedBlock = getProcessedBlock({
31
+ block: block,
32
+ localState: context.localState,
33
+ rootState: context.rootState,
34
+ rootSetState: context.rootSetState,
35
+ context: context.context,
36
+ shouldEvaluateBindings: true,
37
+ });
22
38
  const styles = processedBlock.responsiveStyles;
23
39
  const content = context.content;
24
40
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
@@ -51,14 +67,6 @@ $: css = () => {
51
67
  : "";
52
68
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
53
69
  };
54
- let processedBlock = getProcessedBlock({
55
- block: block,
56
- localState: context.localState,
57
- rootState: context.rootState,
58
- rootSetState: context.rootSetState,
59
- context: context.context,
60
- shouldEvaluateBindings: true,
61
- });
62
70
  </script>
63
71
 
64
72
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.6.2";
1
+ export declare const SDK_VERSION = "0.6.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.6.2";
1
+ export const SDK_VERSION = "0.6.3";
@@ -35,6 +35,19 @@ type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
35
35
  /**
36
36
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
37
37
  *
38
+ * @example
39
+ * ```jsx
40
+ * const builderProps = await fetchBuilderProps({
41
+ * apiKey: 'API_KEY',
42
+ * // provide `url`
43
+ * url: yourPageUrl,
44
+ * // OR provide `path` + `searchParams`
45
+ * path: yourPath,
46
+ * searchParams: yourSearchParams,
47
+ * });
48
+ *
49
+ * return <Content {...builderProps} />;
50
+ * ```
38
51
  */
39
52
  export declare const fetchBuilderProps: (_args: GetBuilderPropsOptions) => Promise<ContentVariantsPrps>;
40
53
  export {};
@@ -3,6 +3,19 @@ import { fetchOneEntry } from './get-content/index.js';
3
3
  /**
4
4
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
5
5
  *
6
+ * @example
7
+ * ```jsx
8
+ * const builderProps = await fetchBuilderProps({
9
+ * apiKey: 'API_KEY',
10
+ * // provide `url`
11
+ * url: yourPageUrl,
12
+ * // OR provide `path` + `searchParams`
13
+ * path: yourPath,
14
+ * searchParams: yourSearchParams,
15
+ * });
16
+ *
17
+ * return <Content {...builderProps} />;
18
+ * ```
6
19
  */
7
20
  export const fetchBuilderProps = async (_args) => {
8
21
  const urlPath = _args.path || _args.url?.pathname || _args.userAttributes?.urlPath;
@@ -97,7 +97,6 @@ export interface ComponentInfo {
97
97
  */
98
98
  query?: any;
99
99
  };
100
- /** not yet implemented */
101
100
  friendlyName?: string;
102
101
  /**
103
102
  * Use to restrict access to your component based on a the current user permissions
@@ -4,4 +4,4 @@
4
4
  export let attributes = undefined;
5
5
  </script>
6
6
 
7
- <span class={attributes.class}>{@html text?.toString() || ""}</span>
7
+ <div class={attributes.class}>{@html text?.toString() || ""}</div>
@@ -13,9 +13,11 @@ function mitosis_styling(node, vars) {
13
13
  }
14
14
  </script>
15
15
 
16
- <span
16
+ <div
17
17
  use:mitosis_styling={{
18
18
  outline: "none",
19
19
  }}
20
- class="builder-text">{@html text?.toString() || ""}</span
21
- >
20
+ class="builder-text"
21
+ >
22
+ {@html text?.toString() || ""}
23
+ </div>
@@ -9,6 +9,14 @@ import InlinedStyles from "../../inlined-styles.svelte";
9
9
  export let block;
10
10
  export let context;
11
11
  $: canShowBlock = () => {
12
+ const processedBlock = getProcessedBlock({
13
+ block: block,
14
+ localState: context.localState,
15
+ rootState: context.rootState,
16
+ rootSetState: context.rootSetState,
17
+ context: context.context,
18
+ shouldEvaluateBindings: true,
19
+ });
12
20
  // only render styles for blocks that are visible
13
21
  if (checkIsDefined(processedBlock.hide)) {
14
22
  return !processedBlock.hide;
@@ -19,6 +27,14 @@ $: canShowBlock = () => {
19
27
  return true;
20
28
  };
21
29
  $: css = () => {
30
+ const processedBlock = getProcessedBlock({
31
+ block: block,
32
+ localState: context.localState,
33
+ rootState: context.rootState,
34
+ rootSetState: context.rootSetState,
35
+ context: context.context,
36
+ shouldEvaluateBindings: true,
37
+ });
22
38
  const styles = processedBlock.responsiveStyles;
23
39
  const content = context.content;
24
40
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
@@ -51,14 +67,6 @@ $: css = () => {
51
67
  : "";
52
68
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
53
69
  };
54
- let processedBlock = getProcessedBlock({
55
- block: block,
56
- localState: context.localState,
57
- rootState: context.rootState,
58
- rootSetState: context.rootSetState,
59
- context: context.context,
60
- shouldEvaluateBindings: true,
61
- });
62
70
  </script>
63
71
 
64
72
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.6.2";
1
+ export declare const SDK_VERSION = "0.6.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.6.2";
1
+ export const SDK_VERSION = "0.6.3";
@@ -35,6 +35,19 @@ type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
35
35
  /**
36
36
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
37
37
  *
38
+ * @example
39
+ * ```jsx
40
+ * const builderProps = await fetchBuilderProps({
41
+ * apiKey: 'API_KEY',
42
+ * // provide `url`
43
+ * url: yourPageUrl,
44
+ * // OR provide `path` + `searchParams`
45
+ * path: yourPath,
46
+ * searchParams: yourSearchParams,
47
+ * });
48
+ *
49
+ * return <Content {...builderProps} />;
50
+ * ```
38
51
  */
39
52
  export declare const fetchBuilderProps: (_args: GetBuilderPropsOptions) => Promise<ContentVariantsPrps>;
40
53
  export {};
@@ -3,6 +3,19 @@ import { fetchOneEntry } from './get-content/index.js';
3
3
  /**
4
4
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
5
5
  *
6
+ * @example
7
+ * ```jsx
8
+ * const builderProps = await fetchBuilderProps({
9
+ * apiKey: 'API_KEY',
10
+ * // provide `url`
11
+ * url: yourPageUrl,
12
+ * // OR provide `path` + `searchParams`
13
+ * path: yourPath,
14
+ * searchParams: yourSearchParams,
15
+ * });
16
+ *
17
+ * return <Content {...builderProps} />;
18
+ * ```
6
19
  */
7
20
  export const fetchBuilderProps = async (_args) => {
8
21
  const urlPath = _args.path || _args.url?.pathname || _args.userAttributes?.urlPath;
@@ -97,7 +97,6 @@ export interface ComponentInfo {
97
97
  */
98
98
  query?: any;
99
99
  };
100
- /** not yet implemented */
101
100
  friendlyName?: string;
102
101
  /**
103
102
  * Use to restrict access to your component based on a the current user permissions
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": "0.6.2",
4
+ "version": "0.6.3",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -10,4 +10,4 @@
10
10
  export let attributes: RawTextProps["attributes"] = undefined;
11
11
  </script>
12
12
 
13
- <span class={attributes.class}>{@html text?.toString() || ""}</span>
13
+ <div class={attributes.class}>{@html text?.toString() || ""}</div>
@@ -18,9 +18,11 @@
18
18
  }
19
19
  </script>
20
20
 
21
- <span
21
+ <div
22
22
  use:mitosis_styling={{
23
23
  outline: "none",
24
24
  }}
25
- class="builder-text">{@html text?.toString() || ""}</span
26
- >
25
+ class="builder-text"
26
+ >
27
+ {@html text?.toString() || ""}
28
+ </div>
@@ -22,6 +22,14 @@
22
22
  export let context: BlockStylesProps["context"];
23
23
 
24
24
  $: canShowBlock = () => {
25
+ const processedBlock = getProcessedBlock({
26
+ block: block,
27
+ localState: context.localState,
28
+ rootState: context.rootState,
29
+ rootSetState: context.rootSetState,
30
+ context: context.context,
31
+ shouldEvaluateBindings: true,
32
+ });
25
33
  // only render styles for blocks that are visible
26
34
  if (checkIsDefined(processedBlock.hide)) {
27
35
  return !processedBlock.hide;
@@ -32,6 +40,14 @@
32
40
  return true;
33
41
  };
34
42
  $: css = () => {
43
+ const processedBlock = getProcessedBlock({
44
+ block: block,
45
+ localState: context.localState,
46
+ rootState: context.rootState,
47
+ rootSetState: context.rootSetState,
48
+ context: context.context,
49
+ shouldEvaluateBindings: true,
50
+ });
35
51
  const styles = processedBlock.responsiveStyles;
36
52
  const content = context.content;
37
53
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
@@ -72,15 +88,6 @@
72
88
  : "";
73
89
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
74
90
  };
75
-
76
- let processedBlock = getProcessedBlock({
77
- block: block,
78
- localState: context.localState,
79
- rootState: context.rootState,
80
- rootSetState: context.rootSetState,
81
- context: context.context,
82
- shouldEvaluateBindings: true,
83
- });
84
91
  </script>
85
92
 
86
93
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.6.2"
1
+ export const SDK_VERSION = "0.6.3"
@@ -39,6 +39,19 @@ type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
39
39
  /**
40
40
  * Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
41
41
  *
42
+ * @example
43
+ * ```jsx
44
+ * const builderProps = await fetchBuilderProps({
45
+ * apiKey: 'API_KEY',
46
+ * // provide `url`
47
+ * url: yourPageUrl,
48
+ * // OR provide `path` + `searchParams`
49
+ * path: yourPath,
50
+ * searchParams: yourSearchParams,
51
+ * });
52
+ *
53
+ * return <Content {...builderProps} />;
54
+ * ```
42
55
  */
43
56
  export const fetchBuilderProps = async (_args: GetBuilderPropsOptions): Promise<ContentVariantsPrps> => {
44
57
  const urlPath = _args.path || _args.url?.pathname || _args.userAttributes?.urlPath;
@@ -104,8 +104,6 @@ export interface ComponentInfo {
104
104
  */
105
105
  query?: any;
106
106
  };
107
-
108
- /** not yet implemented */
109
107
  friendlyName?: string;
110
108
 
111
109
  /**