@builder.io/sdk-svelte 0.0.1-0 → 0.0.1-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 (106) hide show
  1. package/package.json +15 -4
  2. package/src/blocks/{button.svelte → button/button.svelte} +29 -18
  3. package/src/blocks/button/component-info.js +41 -0
  4. package/src/blocks/button/index.js +7 -0
  5. package/src/blocks/{columns.svelte → columns/columns.svelte} +21 -13
  6. package/src/blocks/columns/component-info.js +217 -0
  7. package/src/blocks/columns/index.js +7 -0
  8. package/src/blocks/custom-code/component-info.js +31 -0
  9. package/src/blocks/custom-code/custom-code.svelte +64 -0
  10. package/src/blocks/custom-code/index.js +7 -0
  11. package/src/blocks/embed/component-info.js +24 -0
  12. package/src/blocks/embed/embed.svelte +63 -0
  13. package/src/blocks/embed/index.js +7 -0
  14. package/src/blocks/form/component-info.js +262 -0
  15. package/src/blocks/{form.svelte → form/form.svelte} +49 -16
  16. package/src/blocks/form/index.js +7 -0
  17. package/src/blocks/fragment/component-info.js +11 -0
  18. package/src/blocks/{fragment.svelte → fragment/fragment.svelte} +5 -2
  19. package/src/blocks/fragment/index.js +7 -0
  20. package/src/blocks/image/component-info.js +104 -0
  21. package/src/blocks/{image.svelte → image/image.svelte} +27 -9
  22. package/src/blocks/image/index.js +7 -0
  23. package/src/blocks/img/component-info.js +20 -0
  24. package/src/blocks/{img.svelte → img/img.svelte} +5 -2
  25. package/src/blocks/img/index.js +7 -0
  26. package/src/blocks/input/component-info.js +74 -0
  27. package/src/blocks/input/index.js +7 -0
  28. package/src/blocks/{input.svelte → input/input.svelte} +5 -2
  29. package/src/blocks/raw-text/component-info.js +16 -0
  30. package/src/blocks/raw-text/index.js +7 -0
  31. package/src/blocks/{raw-text.svelte → raw-text/raw-text.svelte} +4 -1
  32. package/src/blocks/section/component-info.js +49 -0
  33. package/src/blocks/section/index.js +7 -0
  34. package/src/blocks/{section.svelte → section/section.svelte} +4 -1
  35. package/src/blocks/select/component-info.js +59 -0
  36. package/src/blocks/select/index.js +7 -0
  37. package/src/blocks/{select.svelte → select/select.svelte} +10 -3
  38. package/src/blocks/submit-button/component-info.js +28 -0
  39. package/src/blocks/submit-button/index.js +7 -0
  40. package/src/blocks/{submit-button.svelte → submit-button/submit-button.svelte} +4 -1
  41. package/src/blocks/symbol/component-info.js +42 -0
  42. package/src/blocks/symbol/index.js +7 -0
  43. package/src/blocks/symbol/symbol.svelte +54 -0
  44. package/src/blocks/text/component-info.js +24 -0
  45. package/src/blocks/text/index.js +7 -0
  46. package/src/blocks/{text.svelte → text/text.svelte} +4 -1
  47. package/src/blocks/textarea/component-info.js +47 -0
  48. package/src/blocks/textarea/index.js +7 -0
  49. package/src/blocks/{textarea.svelte → textarea/textarea.svelte} +4 -1
  50. package/src/blocks/video/component-info.js +106 -0
  51. package/src/blocks/video/index.js +7 -0
  52. package/src/blocks/{video.svelte → video/video.svelte} +4 -1
  53. package/src/components/error-boundary.svelte +4 -1
  54. package/src/components/render-block/block-styles.svelte +51 -0
  55. package/src/components/{render-block.svelte → render-block/render-block.svelte} +60 -18
  56. package/src/components/render-blocks.svelte +18 -6
  57. package/src/components/render-content/components/render-styles.svelte +8 -13
  58. package/src/components/render-content/render-content.svelte +186 -174
  59. package/src/components/render-inlined-styles.svelte +49 -0
  60. package/src/constants/device-sizes.js +4 -11
  61. package/src/constants/target.js +3 -10
  62. package/src/context/builder.context.js +6 -31
  63. package/src/functions/evaluate.js +8 -31
  64. package/src/functions/event-handler-name.js +3 -10
  65. package/src/functions/get-block-actions.js +6 -29
  66. package/src/functions/get-block-component-options.js +3 -9
  67. package/src/functions/get-block-properties.js +3 -9
  68. package/src/functions/get-block-styles.js +6 -27
  69. package/src/functions/get-block-tag.js +3 -10
  70. package/src/functions/get-builder-search-params/fn.test.js +3 -21
  71. package/src/functions/get-builder-search-params/index.js +4 -11
  72. package/src/functions/get-content/fn.test.js +3 -21
  73. package/src/functions/get-content/index.js +8 -28
  74. package/src/functions/get-fetch.js +31 -32
  75. package/src/functions/get-global-this.js +3 -10
  76. package/src/functions/get-processed-block.js +9 -30
  77. package/src/functions/get-processed-block.test.js +2 -20
  78. package/src/functions/if-target.js +5 -28
  79. package/src/functions/is-browser.js +3 -10
  80. package/src/functions/is-editing.js +5 -28
  81. package/src/functions/is-iframe.js +5 -28
  82. package/src/functions/is-previewing.js +7 -30
  83. package/src/functions/macro-eval.js +3 -10
  84. package/src/functions/on-change.js +4 -11
  85. package/src/functions/on-change.test.js +4 -22
  86. package/src/functions/previewing-model-name.js +5 -28
  87. package/src/functions/register-component.js +6 -27
  88. package/src/functions/register.js +5 -28
  89. package/src/functions/set-editor-settings.js +5 -28
  90. package/src/functions/set.js +3 -10
  91. package/src/functions/set.test.js +4 -22
  92. package/src/functions/track.js +8 -31
  93. package/src/functions/transform-block.js +3 -10
  94. package/src/index-helpers/blocks-exports.js +19 -42
  95. package/src/index-helpers/top-of-file.js +3 -10
  96. package/src/index.js +10 -32
  97. package/src/scripts/init-editing.js +72 -81
  98. package/src/types/builder-block.js +0 -3
  99. package/src/types/builder-content.js +0 -3
  100. package/src/types/deep-partial.js +0 -3
  101. package/src/types/targets.js +0 -3
  102. package/src/types/typescript.js +0 -3
  103. package/src/blocks/custom-code.svelte +0 -63
  104. package/src/blocks/embed.svelte +0 -62
  105. package/src/blocks/symbol.svelte +0 -55
  106. package/src/components/block-styles.svelte +0 -23
@@ -1,216 +1,228 @@
1
1
  <script>
2
- import { onMount } from 'svelte'
3
- import { afterUpdate } from 'svelte'
4
- import { onDestroy } from 'svelte'
5
-
6
- import { isBrowser } from '../../functions/is-browser';
7
- import BuilderContext, { } from '../../context/builder.context.lite';
8
- import { track } from '../../functions/track';
9
- import { isEditing } from '../../functions/is-editing';
10
- import { isPreviewing } from '../../functions/is-previewing';
11
- import { previewingModelName } from '../../functions/previewing-model-name';
12
- import { getContent } from '../../functions/get-content';
13
- import { convertSearchParamsToQueryObject , getBuilderSearchParams } from '../../functions/get-builder-search-params';
14
- import RenderBlocks, { } from '../render-blocks.lite';
15
- import { evaluate } from '../../functions/evaluate';
16
- import { getFetch } from '../../functions/get-fetch';
17
- import { TARGET } from '../../constants/target';
18
- import RenderStyles, { } from './components/render-styles.lite';
19
-
20
-
21
-
22
-
23
-
24
- export let content;
2
+ import { onMount } from 'svelte'
3
+ import { afterUpdate } from 'svelte'
4
+ import { onDestroy } from 'svelte'
5
+
6
+ import { TARGET } from '../../constants/target.js';
7
+ import BuilderContext, { } from '../../context/builder.context';
8
+ import { evaluate } from '../../functions/evaluate.js';
9
+ import { convertSearchParamsToQueryObject , getBuilderSearchParams } from '../../functions/get-builder-search-params/index.js';
10
+ import { getContent } from '../../functions/get-content/index.js';
11
+ import { getFetch } from '../../functions/get-fetch.js';
12
+ import { isBrowser } from '../../functions/is-browser.js';
13
+ import { isEditing } from '../../functions/is-editing.js';
14
+ import { isPreviewing } from '../../functions/is-previewing.js';
15
+ import { previewingModelName } from '../../functions/previewing-model-name.js';
16
+ import { track } from '../../functions/track.js';
17
+ import RenderBlocks, { } from '../render-blocks.svelte';
18
+ import RenderContentStyles, { } from './components/render-styles.svelte';
19
+
20
+
21
+
22
+ import { getContext, setContext } from "svelte";
23
+
24
+
25
+ export let content;
25
26
  export let data;
26
27
  export let model;
27
28
  export let apiKey;
28
-
29
- function processMessage(event) {
30
- const {
31
- data
32
- } = event;
33
-
34
- if (data) {
35
- switch (data.type) {
36
- case 'builder.contentUpdate':
37
- {
38
- const messageContent = data.data;
39
- const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
40
- const contentData = messageContent.data;
41
-
42
- if (key === model) {
43
- overrideContent = contentData;
44
- }
45
-
46
- break;
47
- }
48
-
49
- case 'builder.patchUpdates':
50
- {
51
- // TODO
52
- break;
53
- }
54
- }
55
- }
29
+
30
+ function processMessage(event) {
31
+ const {
32
+ data
33
+ } = event;
34
+
35
+ if (data) {
36
+ switch (data.type) {
37
+ case 'builder.contentUpdate':
38
+ {
39
+ const messageContent = data.data;
40
+ const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
41
+ const contentData = messageContent.data;
42
+
43
+ if (key === model) {
44
+ overrideContent = contentData;
45
+ }
46
+
47
+ break;
48
+ }
49
+
50
+ case 'builder.patchUpdates':
51
+ {
52
+ // TODO
53
+ break;
54
+ }
55
+ }
56
+ }
56
57
  }
57
58
 
58
59
  function evaluateJsCode() {
59
- // run any dynamic JS code attached to content
60
- const jsCode = useContent?.()?.data?.jsCode;
61
-
62
- if (jsCode) {
63
- evaluate({
64
- code: jsCode,
65
- context: context(),
66
- state: state()
67
- });
68
- }
60
+ // run any dynamic JS code attached to content
61
+ const jsCode = useContent?.()?.data?.jsCode;
62
+
63
+ if (jsCode) {
64
+ evaluate({
65
+ code: jsCode,
66
+ context: context(),
67
+ state: contentState()
68
+ });
69
+ }
69
70
  }
70
71
 
71
72
  function evalExpression(expression) {
72
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
73
- code: group,
74
- context: context(),
75
- state: state()
76
- }));
73
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
74
+ code: group,
75
+ context: context(),
76
+ state: contentState()
77
+ }));
77
78
  }
78
79
 
79
80
  function handleRequest({
80
- url,
81
- key
81
+ url,
82
+ key
82
83
  }) {
83
- const fetchAndSetState = async () => {
84
- const response = await getFetch()(url);
85
- const json = await response.json();
86
- const newOverrideState = { ...overrideState,
87
- [key]: json
88
- };
89
- overrideState = newOverrideState;
90
- };
91
-
92
- fetchAndSetState();
84
+ const fetchAndSetState = async () => {
85
+ const fetch = await getFetch();
86
+ const response = await fetch(url);
87
+ const json = await response.json();
88
+ const newOverrideState = { ...overrideState,
89
+ [key]: json
90
+ };
91
+ overrideState = newOverrideState;
92
+ };
93
+
94
+ fetchAndSetState();
93
95
  }
94
96
 
95
97
  function runHttpRequests() {
96
- const requests = useContent?.()?.data?.httpRequests ?? {};
97
- Object.entries(requests).forEach(([key, url]) => {
98
- if (url && (!httpReqsData()[key] || isEditing())) {
99
- const evaluatedUrl = evalExpression(url);
100
- handleRequest({
101
- url: evaluatedUrl,
102
- key
103
- });
104
- }
105
- });
98
+ const requests = useContent?.()?.data?.httpRequests ?? {};
99
+ Object.entries(requests).forEach(([key, url]) => {
100
+ if (url && (!httpReqsData()[key] || isEditing())) {
101
+ const evaluatedUrl = evalExpression(url);
102
+ handleRequest({
103
+ url: evaluatedUrl,
104
+ key
105
+ });
106
+ }
107
+ });
106
108
  }
107
109
 
108
110
  function emitStateUpdate() {
109
- window.dispatchEvent(new CustomEvent('builder:component:stateChange', {
110
- detail: {
111
- state: state(),
112
- ref: {
113
- name: model
114
- }
115
- }
116
- }));
111
+ window.dispatchEvent(new CustomEvent('builder:component:stateChange', {
112
+ detail: {
113
+ state: contentState(),
114
+ ref: {
115
+ name: model
116
+ }
117
+ }
118
+ }));
117
119
  }
118
- $: useContent = () => {
119
- const mergedContent = { ...content,
120
- ...overrideContent,
121
- data: { ...content?.data,
122
- ...data,
123
- ...overrideContent?.data
124
- }
125
- };
126
- return mergedContent;
120
+ $: useContent = () => {
121
+ const mergedContent = { ...content,
122
+ ...overrideContent,
123
+ data: { ...content?.data,
124
+ ...data,
125
+ ...overrideContent?.data
126
+ }
127
+ };
128
+ return mergedContent;
127
129
  };
128
130
 
129
- $: state = () => {
130
- return { ...content?.data?.state,
131
- ...data,
132
- ...overrideState
133
- };
131
+ $: contentState = () => {
132
+ return { ...content?.data?.state,
133
+ ...data,
134
+ ...overrideState
135
+ };
134
136
  };
135
137
 
136
138
  $: context = () => {
137
- return {};
139
+ return {};
138
140
  };
139
141
 
140
142
  $: httpReqsData = () => {
141
- return {};
143
+ return {};
142
144
  };
143
145
 
144
- let overrideContent = null;
146
+
147
+ setContext(BuilderContext.key, { get content() {
148
+ return useContent();
149
+ }, get state() {
150
+ return contentState();
151
+ }, get context() {
152
+ return context();
153
+ }, get apiKey() {
154
+ return apiKey;
155
+ },});
156
+ let overrideContent = null;
145
157
  let update = 0;
146
158
  let overrideState = {};
147
159
 
148
- onMount(() => {
149
- if (isBrowser()) {
150
- if (isEditing()) {
151
- window.addEventListener('message', processMessage);
152
- window.addEventListener('builder:component:stateChangeListenerActivated', emitStateUpdate);
153
- }
154
-
155
- if (useContent()) {
156
- track('impression', {
157
- contentId: useContent().id
158
- });
159
- } // override normal content in preview mode
160
-
161
-
162
- if (isPreviewing()) {
163
- if (model && previewingModelName() === model) {
164
- const currentUrl = new URL(location.href);
165
- const previewApiKey = currentUrl.searchParams.get('apiKey');
166
-
167
- if (previewApiKey) {
168
- getContent({
169
- model: model,
170
- apiKey: previewApiKey,
171
- options: getBuilderSearchParams(convertSearchParamsToQueryObject(currentUrl.searchParams))
172
- }).then(content => {
173
- if (content) {
174
- overrideContent = content;
175
- }
176
- });
177
- }
178
- }
179
- }
180
-
181
- evaluateJsCode();
182
- runHttpRequests();
183
- emitStateUpdate();
184
- }
185
- });
160
+ onMount(() => { if (isBrowser()) {
161
+ if (isEditing()) {
162
+ window.addEventListener('message', processMessage);
163
+ window.addEventListener('builder:component:stateChangeListenerActivated', emitStateUpdate);
164
+ }
186
165
 
187
- afterUpdate(() => {
188
- evaluateJsCode();
189
- });afterUpdate(() => {
190
- runHttpRequests();
191
- });afterUpdate(() => {
192
- emitStateUpdate();
193
- })
194
-
195
- onDestroy(() => {
196
- if (isBrowser()) {
197
- window.removeEventListener('message', processMessage);
198
- window.removeEventListener('builder:component:stateChangeListenerActivated', emitStateUpdate);
199
- }
200
- });
201
- </script>
166
+ if (useContent()) {
167
+ track('impression', {
168
+ contentId: useContent().id
169
+ });
170
+ } // override normal content in preview mode
171
+
172
+
173
+ if (isPreviewing()) {
174
+ if (model && previewingModelName() === model) {
175
+ const currentUrl = new URL(location.href);
176
+ const previewApiKey = currentUrl.searchParams.get('apiKey');
177
+
178
+ if (previewApiKey) {
179
+ getContent({
180
+ model: model,
181
+ apiKey: previewApiKey,
182
+ options: getBuilderSearchParams(convertSearchParamsToQueryObject(currentUrl.searchParams))
183
+ }).then(content => {
184
+ if (content) {
185
+ overrideContent = content;
186
+ }
187
+ });
188
+ }
189
+ }
190
+ }
191
+
192
+ evaluateJsCode();
193
+ runHttpRequests();
194
+ emitStateUpdate();
195
+ } });
196
+
197
+ afterUpdate(() => { evaluateJsCode(); });afterUpdate(() => { runHttpRequests(); });afterUpdate(() => { emitStateUpdate(); })
198
+
199
+ onDestroy(() => { if (isBrowser()) {
200
+ window.removeEventListener('message', processMessage);
201
+ window.removeEventListener('builder:component:stateChangeListenerActivated', emitStateUpdate);
202
+ } });
203
+ </script>
204
+
205
+
206
+ {#if useContent() }
202
207
 
203
- {#if useContent() }
204
-
208
+
205
209
  <div on:click="{event => track('click', {
206
- contentId: useContent().id
210
+ contentId: useContent().id
207
211
  })}" data-builder-content-id={useContent?.()?.id} >
208
-
209
- {#if (useContent?.()?.data?.cssCode || useContent?.()?.data?.customFonts?.length) && TARGET !== 'reactNative' }<RenderStyles cssCode={useContent().data.cssCode} customFonts={useContent().data.customFonts} ></RenderStyles>{/if}
212
+
210
213
 
211
-
214
+ {#if (useContent?.()?.data?.cssCode || useContent?.()?.data?.customFonts?.length) && TARGET !== 'reactNative' }
215
+ <RenderContentStyles cssCode={useContent().data.cssCode} customFonts={useContent().data.customFonts} ></RenderContentStyles>
216
+
217
+
218
+ {/if}
219
+
220
+
212
221
  <RenderBlocks blocks={useContent?.()?.data?.blocks} ></RenderBlocks>
213
222
 
214
- </div>
223
+ </div>
224
+
225
+
226
+
215
227
 
216
- {/if}
228
+ {/if}
@@ -0,0 +1,49 @@
1
+ <script>
2
+
3
+
4
+
5
+
6
+ import { TARGET } from '../constants/target.js';
7
+
8
+
9
+
10
+
11
+
12
+
13
+ export let styles;
14
+
15
+
16
+ $: injectedStyleScript = () => {
17
+ return `<${tagName()}>${styles}</${tagName()}>`;
18
+ };
19
+
20
+ $: tagName = () => {
21
+ // NOTE: we have to obfusctate the name of the tag due to a limitation in the svelte-preprocessor plugin.
22
+ // https://github.com/sveltejs/vite-plugin-svelte/issues/315#issuecomment-1109000027
23
+ return 'sty' + 'le';
24
+ };
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ </script>
36
+
37
+
38
+ {#if TARGET === 'svelte' }
39
+
40
+
41
+ {@html injectedStyleScript()}
42
+
43
+
44
+
45
+
46
+ {:else}
47
+ <svelte:component this={tagName()} >{styles}</svelte:component>
48
+
49
+ {/if}
@@ -1,14 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
- var __export = (target, all) => {
4
- __markAsModule(target);
5
- for (var name in all)
6
- __defProp(target, name, { get: all[name], enumerable: true });
7
- };
8
- __export(exports, {
9
- sizeNames: () => sizeNames,
10
- sizes: () => sizes
11
- });
12
1
  const sizeNames = ["xsmall", "small", "medium", "large"];
13
2
  const sizes = {
14
3
  xsmall: {
@@ -44,3 +33,7 @@ const sizes = {
44
33
  return "large";
45
34
  }
46
35
  };
36
+ export {
37
+ sizeNames,
38
+ sizes
39
+ };
@@ -1,11 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
- var __export = (target, all) => {
4
- __markAsModule(target);
5
- for (var name in all)
6
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ const TARGET = "svelte";
2
+ export {
3
+ TARGET
7
4
  };
8
- __export(exports, {
9
- TARGET: () => TARGET
10
- });
11
- const TARGET = "reactNative";
@@ -1,33 +1,8 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- __markAsModule(target);
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ const key = Symbol();
2
+ var stdin_default = {
3
+ Builder: { content: null, context: {}, state: {}, apiKey: null },
4
+ key
12
5
  };
13
- var __reExport = (target, module2, desc) => {
14
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
- for (let key of __getOwnPropNames(module2))
16
- if (!__hasOwnProp.call(target, key) && key !== "default")
17
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
- }
19
- return target;
6
+ export {
7
+ stdin_default as default
20
8
  };
21
- var __toModule = (module2) => {
22
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
- };
24
- __export(exports, {
25
- default: () => stdin_default
26
- });
27
- var import_react = __toModule(require("react"));
28
- var stdin_default = (0, import_react.createContext)({
29
- content: null,
30
- context: {},
31
- state: {},
32
- apiKey: null
33
- });
@@ -1,31 +1,5 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- __markAsModule(target);
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __reExport = (target, module2, desc) => {
14
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
- for (let key of __getOwnPropNames(module2))
16
- if (!__hasOwnProp.call(target, key) && key !== "default")
17
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
- }
19
- return target;
20
- };
21
- var __toModule = (module2) => {
22
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
- };
24
- __export(exports, {
25
- evaluate: () => evaluate
26
- });
27
- var import_is_browser = __toModule(require("./is-browser"));
28
- var import_is_editing = __toModule(require("./is-editing"));
1
+ import { isBrowser } from "./is-browser.js";
2
+ import { isEditing } from "./is-editing.js";
29
3
  function evaluate({
30
4
  code,
31
5
  context,
@@ -37,9 +11,9 @@ function evaluate({
37
11
  return;
38
12
  }
39
13
  const builder = {
40
- isEditing: (0, import_is_editing.isEditing)(),
41
- isBrowser: (0, import_is_browser.isBrowser)(),
42
- isServer: !(0, import_is_browser.isBrowser)()
14
+ isEditing: isEditing(),
15
+ isBrowser: isBrowser(),
16
+ isServer: !isBrowser()
43
17
  };
44
18
  const useReturn = !(code.includes(";") || code.includes(" return ") || code.trim().startsWith("return "));
45
19
  const useCode = useReturn ? `return (${code});` : code;
@@ -49,3 +23,6 @@ function evaluate({
49
23
  console.warn("Builder custom code error: ", e);
50
24
  }
51
25
  }
26
+ export {
27
+ evaluate
28
+ };
@@ -1,14 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
- var __export = (target, all) => {
4
- __markAsModule(target);
5
- for (var name in all)
6
- __defProp(target, name, { get: all[name], enumerable: true });
7
- };
8
- __export(exports, {
9
- getEventHandlerName: () => getEventHandlerName
10
- });
11
1
  function capitalizeFirstLetter(string) {
12
2
  return string.charAt(0).toUpperCase() + string.slice(1);
13
3
  }
14
4
  const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
5
+ export {
6
+ getEventHandlerName
7
+ };
@@ -1,31 +1,5 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- __markAsModule(target);
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __reExport = (target, module2, desc) => {
14
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
- for (let key of __getOwnPropNames(module2))
16
- if (!__hasOwnProp.call(target, key) && key !== "default")
17
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
- }
19
- return target;
20
- };
21
- var __toModule = (module2) => {
22
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
- };
24
- __export(exports, {
25
- getBlockActions: () => getBlockActions
26
- });
27
- var import_evaluate = __toModule(require("./evaluate"));
28
- var import_event_handler_name = __toModule(require("./event-handler-name"));
1
+ import { evaluate } from "./evaluate.js";
2
+ import { getEventHandlerName } from "./event-handler-name.js";
29
3
  function getBlockActions(options) {
30
4
  var _a;
31
5
  const obj = {};
@@ -35,7 +9,7 @@ function getBlockActions(options) {
35
9
  continue;
36
10
  }
37
11
  const value = optionActions[key];
38
- obj[(0, import_event_handler_name.getEventHandlerName)(key)] = (event) => (0, import_evaluate.evaluate)({
12
+ obj[getEventHandlerName(key)] = (event) => evaluate({
39
13
  code: value,
40
14
  context: options.context,
41
15
  state: options.state,
@@ -44,3 +18,6 @@ function getBlockActions(options) {
44
18
  }
45
19
  return obj;
46
20
  }
21
+ export {
22
+ getBlockActions
23
+ };
@@ -14,16 +14,10 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
18
- var __export = (target, all) => {
19
- __markAsModule(target);
20
- for (var name in all)
21
- __defProp(target, name, { get: all[name], enumerable: true });
22
- };
23
- __export(exports, {
24
- getBlockComponentOptions: () => getBlockComponentOptions
25
- });
26
17
  function getBlockComponentOptions(block) {
27
18
  var _a;
28
19
  return __spreadValues(__spreadValues({}, (_a = block.component) == null ? void 0 : _a.options), block.options);
29
20
  }
21
+ export {
22
+ getBlockComponentOptions
23
+ };