@builder.io/sdk-svelte 0.1.1 → 0.1.3-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/package/--package.json +3 -3
  2. package/package/CHANGELOG.md +9 -0
  3. package/package/blocks/BaseText.svelte +1 -1
  4. package/package/blocks/button/button.svelte +1 -1
  5. package/package/blocks/columns/columns.svelte +3 -3
  6. package/package/blocks/custom-code/custom-code.svelte +1 -1
  7. package/package/blocks/embed/embed.svelte +2 -3
  8. package/package/blocks/form/form.svelte +1 -1
  9. package/package/blocks/fragment/fragment.svelte +1 -1
  10. package/package/blocks/image/image.svelte +1 -2
  11. package/package/blocks/img/img.svelte +1 -1
  12. package/package/blocks/input/input.svelte +1 -1
  13. package/package/blocks/raw-text/raw-text.svelte +1 -1
  14. package/package/blocks/section/section.svelte +1 -1
  15. package/package/blocks/select/select.svelte +1 -1
  16. package/package/blocks/submit-button/submit-button.svelte +1 -1
  17. package/package/blocks/symbol/symbol.svelte +4 -2
  18. package/package/blocks/text/text.svelte +1 -1
  19. package/package/blocks/textarea/textarea.svelte +1 -1
  20. package/package/blocks/video/video.svelte +1 -1
  21. package/package/components/render-block/block-styles.svelte +1 -1
  22. package/package/components/render-block/render-block.helpers.d.ts +11 -0
  23. package/package/components/render-block/render-block.helpers.js +58 -0
  24. package/package/components/render-block/render-block.svelte +33 -109
  25. package/package/components/render-block/render-component.svelte +1 -1
  26. package/package/components/render-block/render-repeated-block.svelte +7 -19
  27. package/package/components/render-blocks.svelte +1 -1
  28. package/package/components/render-content/builder-editing.svelte +1 -1
  29. package/package/components/render-content/components/render-styles.svelte +3 -3
  30. package/package/components/render-content/render-content.svelte +53 -53
  31. package/package/components/render-inlined-styles.svelte +1 -1
  32. package/package/functions/track/helpers.d.ts +5 -0
  33. package/package/functions/track/helpers.js +56 -0
  34. package/package/functions/{track.d.ts → track/index.d.ts} +5 -10
  35. package/package/functions/{track.js → track/index.js} +11 -6
  36. package/package/helpers/ab-tests.d.ts +1 -1
  37. package/package/helpers/cookie.d.ts +1 -1
  38. package/package/helpers/cookie.js +7 -2
  39. package/package/helpers/localStorage.d.ts +2 -1
  40. package/package/helpers/localStorage.js +1 -0
  41. package/package/helpers/sessionId.d.ts +2 -2
  42. package/package/helpers/sessionId.js +2 -1
  43. package/package/helpers/url.js +3 -0
  44. package/package/helpers/url.test.js +6 -0
  45. package/package/helpers/visitorId.js +1 -0
  46. package/package/index.d.ts +1 -1
  47. package/package/index.js +1 -1
  48. package/package.json +1 -1
  49. package/src/blocks/BaseText.svelte +2 -2
  50. package/src/blocks/button/button.svelte +1 -6
  51. package/src/blocks/columns/columns.svelte +3 -3
  52. package/src/blocks/custom-code/custom-code.svelte +1 -1
  53. package/src/blocks/embed/component-info.ts +29 -27
  54. package/src/blocks/embed/embed.svelte +1 -3
  55. package/src/blocks/form/form.svelte +2 -7
  56. package/src/blocks/fragment/fragment.svelte +1 -1
  57. package/src/blocks/image/component-info.ts +57 -55
  58. package/src/blocks/image/image.svelte +1 -2
  59. package/src/blocks/img/img.svelte +1 -6
  60. package/src/blocks/input/input.svelte +1 -6
  61. package/src/blocks/raw-text/raw-text.svelte +1 -1
  62. package/src/blocks/section/section.svelte +1 -6
  63. package/src/blocks/select/select.svelte +1 -6
  64. package/src/blocks/submit-button/submit-button.svelte +1 -6
  65. package/src/blocks/symbol/symbol.svelte +5 -8
  66. package/src/blocks/text/text.svelte +1 -1
  67. package/src/blocks/textarea/textarea.svelte +1 -6
  68. package/src/blocks/video/video.svelte +1 -6
  69. package/src/components/render-block/block-styles.svelte +1 -1
  70. package/src/components/render-block/render-block.helpers.ts +85 -0
  71. package/src/components/render-block/render-block.svelte +41 -118
  72. package/src/components/render-block/render-component.svelte +1 -1
  73. package/src/components/render-block/render-repeated-block.svelte +8 -20
  74. package/src/components/render-blocks.svelte +2 -2
  75. package/src/components/render-content/builder-editing.svelte +1 -1
  76. package/src/components/render-content/components/render-styles.svelte +5 -3
  77. package/src/components/render-content/render-content.svelte +59 -64
  78. package/src/components/render-inlined-styles.svelte +1 -1
  79. package/src/functions/track/helpers.ts +67 -0
  80. package/src/functions/{track.ts → track/index.ts} +16 -17
  81. package/src/helpers/cookie.ts +9 -4
  82. package/src/helpers/localStorage.ts +3 -1
  83. package/src/helpers/sessionId.ts +5 -1
  84. package/src/helpers/url.test.ts +7 -0
  85. package/src/helpers/url.ts +4 -0
  86. package/src/helpers/visitorId.ts +3 -1
  87. package/src/index.ts +1 -1
  88. package/package/components/render-block/render-component-with-context.svelte +0 -32
  89. package/package/components/render-block/render-component-with-context.svelte.d.ts +0 -19
  90. package/src/components/render-block/render-component-with-context.svelte +0 -38
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "package",
@@ -67,7 +67,6 @@
67
67
  "./components/render-block/block-styles.svelte": "./components/render-block/block-styles.svelte",
68
68
  "./components/render-block/render-block.helpers": "./components/render-block/render-block.helpers.js",
69
69
  "./components/render-block/render-block.svelte": "./components/render-block/render-block.svelte",
70
- "./components/render-block/render-component-with-context.svelte": "./components/render-block/render-component-with-context.svelte",
71
70
  "./components/render-block/render-component.svelte": "./components/render-block/render-component.svelte",
72
71
  "./components/render-block/render-repeated-block.svelte": "./components/render-block/render-repeated-block.svelte",
73
72
  "./components/render-block/types": "./components/render-block/types.js",
@@ -117,7 +116,8 @@
117
116
  "./functions/set-editor-settings": "./functions/set-editor-settings.js",
118
117
  "./functions/set.test": "./functions/set.test.js",
119
118
  "./functions/set": "./functions/set.js",
120
- "./functions/track": "./functions/track.js",
119
+ "./functions/track/helpers": "./functions/track/helpers.js",
120
+ "./functions/track": "./functions/track/index.js",
121
121
  "./functions/transform-block-properties": "./functions/transform-block-properties.js",
122
122
  "./functions/transform-block": "./functions/transform-block.js",
123
123
  "./helpers/ab-tests": "./helpers/ab-tests.js",
@@ -1,3 +1,12 @@
1
+ ### 0.1.1
2
+
3
+ - Fix: respect when `canTrack` is set to `false`
4
+ - Fix: issues sending session and visitor IDs with tracking events
5
+
6
+ ### 0.1.0
7
+
8
+ 🧨 Breaking change: we no longer provide a `node-fetch` polyfill. See [the docs](./README.md#fetch) for more information.
9
+
1
10
  ### 0.0.1-9
2
11
 
3
12
  🐛 Fix: custom components were not rendering correctly
@@ -16,4 +16,4 @@ function mitosis_styling(node, vars) {
16
16
  let builderContext = getContext(BuilderContext.key);
17
17
  </script>
18
18
 
19
- <span use:mitosis_styling={builderContext.inheritedStyles}>{text}</span>
19
+ <span use:mitosis_styling={builderContext.inheritedStyles}>{text}</span>
@@ -57,4 +57,4 @@ export let openLinkInNewTab;
57
57
  .button {
58
58
  all: unset;
59
59
  }
60
- </style>
60
+ </style>
@@ -114,10 +114,10 @@ $: columnsStyles = () => {
114
114
  `;
115
115
  };
116
116
  $: reactNativeColumnsStyles = () => {
117
- return columnStyleObjects.columns.small;
117
+ return this.columnStyleObjects.columns.small;
118
118
  };
119
119
  $: reactNativeColumnStyles = () => {
120
- return columnStyleObjects.column.small;
120
+ return this.columnStyleObjects.column.small;
121
121
  };
122
122
  </script>
123
123
 
@@ -164,4 +164,4 @@ $: reactNativeColumnStyles = () => {
164
164
  flex-direction: column;
165
165
  align-items: stretch;
166
166
  }
167
- </style>
167
+ </style>
@@ -52,4 +52,4 @@ onMount(() => {
52
52
  class={"builder-custom-code" + (replaceNodes ? " replace-nodes" : "")}
53
53
  >
54
54
  {@html code}
55
- </div>
55
+ </div>
@@ -1,7 +1,6 @@
1
1
  <script context="module"></script>
2
2
 
3
- <script>import "svelte";
4
- import { isJsScript } from "./helpers.js";
3
+ <script>import { isJsScript } from "./helpers.js";
5
4
  export let content;
6
5
  function findAndRunScripts() {
7
6
  if (!elem || !elem.getElementsByTagName)
@@ -40,4 +39,4 @@ function onUpdateFn_0() {
40
39
  $: onUpdateFn_0(...[elem, ranInitFn]);
41
40
  </script>
42
41
 
43
- <div class="builder-embed" bind:this={elem}>{@html content}</div>
42
+ <div class="builder-embed" bind:this={elem}>{@html content}</div>
@@ -286,4 +286,4 @@ let formErrorMessage = "";
286
286
  color: red;
287
287
  text-align: center;
288
288
  }
289
- </style>
289
+ </style>
@@ -2,4 +2,4 @@
2
2
 
3
3
  <script></script>
4
4
 
5
- <span><slot /></span>
5
+ <span><slot /></span>
@@ -82,7 +82,6 @@ $: aspectRatioCss = () => {
82
82
  srcset={srcSetToUse()}
83
83
  {sizes}
84
84
  />
85
- <source srcset={srcSetToUse()} />
86
85
  </picture>
87
86
 
88
87
  {#if aspectRatio && !(builderBlock?.children?.length && fitContent)}
@@ -126,4 +125,4 @@ $: aspectRatioCss = () => {
126
125
  width: 100%;
127
126
  height: 100%;
128
127
  }
129
- </style>
128
+ </style>
@@ -56,4 +56,4 @@ function mitosis_styling(node, vars) {
56
56
  src={imgSrc || image}
57
57
  {...filterAttrs(attributes, isNonEvent)}
58
58
  use:setAttrs={filterAttrs(attributes, isEvent)}
59
- />
59
+ />
@@ -47,4 +47,4 @@ export let required;
47
47
  {defaultValue}
48
48
  {required}
49
49
  use:setAttrs={filterAttrs(attributes, isEvent)}
50
- />
50
+ />
@@ -6,4 +6,4 @@ export let text;
6
6
 
7
7
  <span class={attributes?.class || attributes?.className}
8
8
  >{@html text || ""}</span
9
- >
9
+ >
@@ -58,4 +58,4 @@ function mitosis_styling(node, vars) {
58
58
  use:setAttrs={filterAttrs(attributes, isEvent)}
59
59
  >
60
60
  <slot />
61
- </section>
61
+ </section>
@@ -46,4 +46,4 @@ export let options;
46
46
  {#each options as option}
47
47
  <option value={option.value}>{option.name || option.value}</option>
48
48
  {/each}
49
- </select>
49
+ </select>
@@ -37,4 +37,4 @@ export let text;
37
37
  use:setAttrs={filterAttrs(attributes, isEvent)}
38
38
  >
39
39
  {text}
40
- </button>
40
+ </button>
@@ -66,7 +66,9 @@ function onUpdateFn_0() {
66
66
  if (symbolToUse &&
67
67
  !symbolToUse.content &&
68
68
  !fetchedContent &&
69
- symbolToUse.model) {
69
+ symbolToUse.model &&
70
+ // This is a hack, we should not need to check for this, but it is needed for Svelte.
71
+ builderContext?.apiKey) {
70
72
  getContent({
71
73
  model: symbolToUse.model,
72
74
  apiKey: builderContext.apiKey,
@@ -101,4 +103,4 @@ $: onUpdateFn_0(...[symbol, fetchedContent]);
101
103
  model={symbol?.model}
102
104
  content={contentToUse()}
103
105
  />
104
- </div>
106
+ </div>
@@ -3,4 +3,4 @@
3
3
  <script>export let text;
4
4
  </script>
5
5
 
6
- <span class="builder-text">{@html text}</span>
6
+ <span class="builder-text">{@html text}</span>
@@ -41,4 +41,4 @@ export let defaultValue;
41
41
  {value}
42
42
  {defaultValue}
43
43
  use:setAttrs={filterAttrs(attributes, isEvent)}
44
- />
44
+ />
@@ -99,4 +99,4 @@ $: spreadProps = () => {
99
99
  src={video || "no-src"}
100
100
  poster={posterImage}
101
101
  use:setAttrs={filterAttrs(spreadProps(), isEvent)}
102
- />
102
+ />
@@ -49,4 +49,4 @@ $: css = () => {
49
49
 
50
50
  {#if TARGET !== "reactNative" && css()}
51
51
  <RenderInlinedStyles styles={css()} />
52
- {/if}
52
+ {/if}
@@ -1 +1,12 @@
1
+ import type { BuilderContextInterface } from '../../context/types';
2
+ import type { BuilderBlock } from '../../types/builder-block';
3
+ import type { RepeatData } from './types';
1
4
  export declare const isEmptyHtmlElement: (tagName: unknown) => boolean;
5
+ export declare const getComponent: ({ block, context, }: {
6
+ block: BuilderBlock;
7
+ context: BuilderContextInterface;
8
+ }) => import("../../context/types").RegisteredComponent | null | undefined;
9
+ export declare const getRepeatItemData: ({ block, context, }: {
10
+ block: BuilderBlock;
11
+ context: BuilderContextInterface;
12
+ }) => RepeatData[] | undefined;
@@ -1,3 +1,5 @@
1
+ import { evaluate } from '../../functions/evaluate';
2
+ import { getProcessedBlock } from '../../functions/get-processed-block';
1
3
  /**
2
4
  * https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
3
5
  */
@@ -22,3 +24,59 @@ export const isEmptyHtmlElement = (tagName) => {
22
24
  return (typeof tagName === 'string' &&
23
25
  EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase()));
24
26
  };
27
+ export const getComponent = ({ block, context, }) => {
28
+ const componentName = getProcessedBlock({
29
+ block: block,
30
+ state: context.state,
31
+ context: context.context,
32
+ shouldEvaluateBindings: false,
33
+ }).component?.name;
34
+ if (!componentName) {
35
+ return null;
36
+ }
37
+ const ref = context.registeredComponents[componentName];
38
+ if (!ref) {
39
+ // TODO: Public doc page with more info about this message
40
+ console.warn(`
41
+ Could not find a registered component named "${componentName}".
42
+ If you registered it, is the file that registered it imported by the file that needs to render it?`);
43
+ return undefined;
44
+ }
45
+ else {
46
+ return ref;
47
+ }
48
+ };
49
+ export const getRepeatItemData = ({ block, context, }) => {
50
+ /**
51
+ * we don't use `state.useBlock` here because the processing done within its logic includes evaluating the block's bindings,
52
+ * which will not work if there is a repeat.
53
+ */
54
+ const { repeat, ...blockWithoutRepeat } = block;
55
+ if (!repeat?.collection) {
56
+ return undefined;
57
+ }
58
+ const itemsArray = evaluate({
59
+ code: repeat.collection,
60
+ state: context.state,
61
+ context: context.context,
62
+ });
63
+ if (!Array.isArray(itemsArray)) {
64
+ return undefined;
65
+ }
66
+ const collectionName = repeat.collection.split('.').pop();
67
+ const itemNameToUse = repeat.itemName || (collectionName ? collectionName + 'Item' : 'item');
68
+ const repeatArray = itemsArray.map((item, index) => ({
69
+ context: {
70
+ ...context,
71
+ state: {
72
+ ...context.state,
73
+ $index: index,
74
+ $item: item,
75
+ [itemNameToUse]: item,
76
+ [`$${itemNameToUse}Index`]: index,
77
+ },
78
+ },
79
+ block: blockWithoutRepeat,
80
+ }));
81
+ return repeatArray;
82
+ };
@@ -5,13 +5,11 @@ import { getBlockComponentOptions } from "../../functions/get-block-component-op
5
5
  import { getBlockProperties } from "../../functions/get-block-properties.js";
6
6
  import { getBlockTag } from "../../functions/get-block-tag.js";
7
7
  import { getProcessedBlock } from "../../functions/get-processed-block.js";
8
- import { evaluate } from "../../functions/evaluate.js";
9
8
  import BlockStyles from "./block-styles.svelte";
10
- import { isEmptyHtmlElement } from "./render-block.helpers.js";
9
+ import { getComponent, getRepeatItemData, isEmptyHtmlElement, } from "./render-block.helpers.js";
11
10
  import RenderRepeatedBlock from "./render-repeated-block.svelte";
12
11
  import { TARGET } from "../../constants/target.js";
13
12
  import { extractTextStyles } from "../../functions/extract-text-styles.js";
14
- import RenderComponentWithContext from "./render-component-with-context.svelte";
15
13
  import RenderComponent from "./render-component.svelte";
16
14
  import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
17
15
  const setAttrs = (node, attrs) => {
@@ -32,33 +30,11 @@ const setAttrs = (node, attrs) => {
32
30
  };
33
31
  export let block;
34
32
  export let context;
35
- $: component = () => {
36
- const componentName = getProcessedBlock({
37
- block: block,
38
- state: context.state,
39
- context: context.context,
40
- shouldEvaluateBindings: false,
41
- }).component?.name;
42
- if (!componentName) {
43
- return null;
44
- }
45
- const ref = context.registeredComponents[componentName];
46
- if (!ref) {
47
- // TODO: Public doc page with more info about this message
48
- console.warn(`
49
- Could not find a registered component named "${componentName}".
50
- If you registered it, is the file that registered it imported by the file that needs to render it?`);
51
- return undefined;
52
- }
53
- else {
54
- return ref;
55
- }
56
- };
57
33
  $: tag = () => {
58
34
  return getBlockTag(useBlock());
59
35
  };
60
36
  $: useBlock = () => {
61
- return repeatItemData()
37
+ return repeatItemData
62
38
  ? block
63
39
  : getProcessedBlock({
64
40
  block: block,
@@ -89,20 +65,17 @@ $: attributes = () => {
89
65
  : {}),
90
66
  };
91
67
  };
92
- $: shouldWrap = () => {
93
- return !component?.()?.noWrap;
94
- };
95
68
  $: renderComponentProps = () => {
96
69
  return {
97
- blockChildren: useChildren(),
98
- componentRef: component?.()?.component,
70
+ blockChildren: useBlock().children ?? [],
71
+ componentRef: component?.component,
99
72
  componentOptions: {
100
73
  ...getBlockComponentOptions(useBlock()),
101
74
  /**
102
75
  * These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
103
76
  * they are provided to the component itself directly.
104
77
  */
105
- ...(shouldWrap()
78
+ ...(!component?.noWrap
106
79
  ? {}
107
80
  : {
108
81
  attributes: {
@@ -115,13 +88,6 @@ $: renderComponentProps = () => {
115
88
  context: childrenContext(),
116
89
  };
117
90
  };
118
- $: useChildren = () => {
119
- // TO-DO: When should `canHaveChildren` dictate rendering?
120
- // This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,
121
- // but still receive and need to render children.
122
- // return componentInfo?.canHaveChildren ? useBlock().children : [];
123
- return useBlock().children ?? [];
124
- };
125
91
  $: childrenWithoutParentComponent = () => {
126
92
  /**
127
93
  * When there is no `componentRef`, there might still be children that need to be rendered. In this case,
@@ -129,95 +95,53 @@ $: childrenWithoutParentComponent = () => {
129
95
  * NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
130
96
  * blocks, and the children will be repeated within those blocks.
131
97
  */
132
- const shouldRenderChildrenOutsideRef = !component?.()?.component && !repeatItemData();
133
- return shouldRenderChildrenOutsideRef ? useChildren() : [];
134
- };
135
- $: repeatItemData = () => {
136
- /**
137
- * we don't use `useBlock()` here because the processing done within its logic includes evaluating the block's bindings,
138
- * which will not work if there is a repeat.
139
- */
140
- const { repeat, ...blockWithoutRepeat } = block;
141
- if (!repeat?.collection) {
142
- return undefined;
143
- }
144
- const itemsArray = evaluate({
145
- code: repeat.collection,
146
- state: context.state,
147
- context: context.context,
148
- });
149
- if (!Array.isArray(itemsArray)) {
150
- return undefined;
151
- }
152
- const collectionName = repeat.collection.split(".").pop();
153
- const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
154
- const repeatArray = itemsArray.map((item, index) => ({
155
- context: {
156
- ...context,
157
- state: {
158
- ...context.state,
159
- $index: index,
160
- $item: item,
161
- [itemNameToUse]: item,
162
- [`$${itemNameToUse}Index`]: index,
163
- },
164
- },
165
- block: blockWithoutRepeat,
166
- }));
167
- return repeatArray;
168
- };
169
- $: inheritedTextStyles = () => {
170
- if (TARGET !== "reactNative") {
171
- return {};
172
- }
173
- const styles = getReactNativeBlockStyles({
174
- block: useBlock(),
175
- context: context,
176
- blockStyles: attributes().style,
177
- });
178
- return extractTextStyles(styles);
98
+ const shouldRenderChildrenOutsideRef = !component?.component && !repeatItemData;
99
+ return shouldRenderChildrenOutsideRef ? useBlock().children ?? [] : [];
179
100
  };
180
101
  $: childrenContext = () => {
102
+ const getInheritedTextStyles = () => {
103
+ if (TARGET !== "reactNative") {
104
+ return {};
105
+ }
106
+ return extractTextStyles(getReactNativeBlockStyles({
107
+ block: useBlock(),
108
+ context: context,
109
+ blockStyles: attributes().style,
110
+ }));
111
+ };
181
112
  return {
182
113
  apiKey: context.apiKey,
183
114
  state: context.state,
184
115
  content: context.content,
185
116
  context: context.context,
186
117
  registeredComponents: context.registeredComponents,
187
- inheritedStyles: inheritedTextStyles(),
118
+ inheritedStyles: getInheritedTextStyles(),
188
119
  };
189
120
  };
190
- $: renderComponentTag = () => {
191
- if (TARGET === "reactNative") {
192
- return RenderComponentWithContext;
193
- }
194
- else if (TARGET === "vue3") {
195
- // vue3 expects a string for the component tag
196
- return "RenderComponent";
197
- }
198
- else {
199
- return RenderComponent;
200
- }
201
- };
121
+ let component = getComponent({
122
+ block: block,
123
+ context: context,
124
+ });
125
+ let repeatItemData = getRepeatItemData({
126
+ block: block,
127
+ context: context,
128
+ });
202
129
  </script>
203
130
 
204
- {#if shouldWrap()}
131
+ {#if !component?.noWrap}
205
132
  {#if isEmptyHtmlElement(tag())}
206
133
  <svelte:element this={tag()} {...attributes()} use:setAttrs={actions()} />
207
134
  {/if}
208
135
 
209
- {#if !isEmptyHtmlElement(tag()) && repeatItemData()}
210
- {#each repeatItemData() as data, index (index)}
136
+ {#if !isEmptyHtmlElement(tag()) && repeatItemData}
137
+ {#each repeatItemData as data, index (index)}
211
138
  <RenderRepeatedBlock repeatContext={data.context} block={data.block} />
212
139
  {/each}
213
140
  {/if}
214
141
 
215
- {#if !isEmptyHtmlElement(tag()) && !repeatItemData()}
142
+ {#if !isEmptyHtmlElement(tag()) && !repeatItemData}
216
143
  <svelte:element this={tag()} {...attributes()} use:setAttrs={actions()}>
217
- <svelte:component
218
- this={renderComponentTag()}
219
- {...renderComponentProps()}
220
- />
144
+ <RenderComponent {...renderComponentProps()} />
221
145
 
222
146
  {#each childrenWithoutParentComponent() as child ("render-block-" + child.id)}
223
147
  <svelte:self block={child} context={childrenContext()} />
@@ -229,5 +153,5 @@ $: renderComponentTag = () => {
229
153
  </svelte:element>
230
154
  {/if}
231
155
  {:else}
232
- <svelte:component this={renderComponentTag()} {...renderComponentProps()} />
233
- {/if}
156
+ <RenderComponent {...renderComponentProps()} />
157
+ {/if}
@@ -18,4 +18,4 @@ export let context;
18
18
  <BlockStyles block={child} {context} />
19
19
  {/each}
20
20
  </svelte:component>
21
- {/if}
21
+ {/if}
@@ -15,25 +15,13 @@ import RenderBlock from "./render-block.svelte";
15
15
  export let block;
16
16
  export let repeatContext;
17
17
  setContext(BuilderContext.key, {
18
- get content() {
19
- return repeatContext.content;
20
- },
21
- get state() {
22
- return repeatContext.state;
23
- },
24
- get context() {
25
- return repeatContext.context;
26
- },
27
- get apiKey() {
28
- return repeatContext.apiKey;
29
- },
30
- get registeredComponents() {
31
- return repeatContext.registeredComponents;
32
- },
33
- get inheritedStyles() {
34
- return repeatContext.inheritedStyles;
35
- },
18
+ content: repeatContext.content,
19
+ state: repeatContext.state,
20
+ context: repeatContext.context,
21
+ apiKey: repeatContext.apiKey,
22
+ registeredComponents: repeatContext.registeredComponents,
23
+ inheritedStyles: repeatContext.inheritedStyles,
36
24
  });
37
25
  </script>
38
26
 
39
- <RenderBlock {block} context={repeatContext} />
27
+ <RenderBlock {block} context={repeatContext} />
@@ -81,4 +81,4 @@ $: className = () => {
81
81
  flex-direction: column;
82
82
  align-items: stretch;
83
83
  }
84
- </style>
84
+ </style>
@@ -1,4 +1,4 @@
1
1
  <script>"use strict";
2
2
  </script>
3
3
 
4
- <div />
4
+ <div />
@@ -44,11 +44,11 @@ function getCssFromFont(font) {
44
44
  }
45
45
  function getFontCss({ customFonts }) {
46
46
  // TODO: flag for this
47
- // if (!builder.allowCustomFonts) {
47
+ // if (!this.builder.allowCustomFonts) {
48
48
  // return '';
49
49
  // }
50
50
  // TODO: separate internal data from external
51
- return customFonts?.map((font) => getCssFromFont(font))?.join(" ") || "";
51
+ return (customFonts?.map((font) => this.getCssFromFont(font))?.join(" ") || "");
52
52
  }
53
53
  $: injectedStyles = () => {
54
54
  return `
@@ -59,4 +59,4 @@ ${getFontCss({
59
59
  };
60
60
  </script>
61
61
 
62
- <RenderInlinedStyles styles={injectedStyles()} />
62
+ <RenderInlinedStyles styles={injectedStyles()} />