@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.
- package/package.json +15 -4
- package/src/blocks/{button.svelte → button/button.svelte} +29 -18
- package/src/blocks/button/component-info.js +41 -0
- package/src/blocks/button/index.js +7 -0
- package/src/blocks/{columns.svelte → columns/columns.svelte} +21 -13
- package/src/blocks/columns/component-info.js +217 -0
- package/src/blocks/columns/index.js +7 -0
- package/src/blocks/custom-code/component-info.js +31 -0
- package/src/blocks/custom-code/custom-code.svelte +64 -0
- package/src/blocks/custom-code/index.js +7 -0
- package/src/blocks/embed/component-info.js +24 -0
- package/src/blocks/embed/embed.svelte +63 -0
- package/src/blocks/embed/index.js +7 -0
- package/src/blocks/form/component-info.js +262 -0
- package/src/blocks/{form.svelte → form/form.svelte} +49 -16
- package/src/blocks/form/index.js +7 -0
- package/src/blocks/fragment/component-info.js +11 -0
- package/src/blocks/{fragment.svelte → fragment/fragment.svelte} +5 -2
- package/src/blocks/fragment/index.js +7 -0
- package/src/blocks/image/component-info.js +104 -0
- package/src/blocks/{image.svelte → image/image.svelte} +27 -9
- package/src/blocks/image/index.js +7 -0
- package/src/blocks/img/component-info.js +20 -0
- package/src/blocks/{img.svelte → img/img.svelte} +5 -2
- package/src/blocks/img/index.js +7 -0
- package/src/blocks/input/component-info.js +74 -0
- package/src/blocks/input/index.js +7 -0
- package/src/blocks/{input.svelte → input/input.svelte} +5 -2
- package/src/blocks/raw-text/component-info.js +16 -0
- package/src/blocks/raw-text/index.js +7 -0
- package/src/blocks/{raw-text.svelte → raw-text/raw-text.svelte} +4 -1
- package/src/blocks/section/component-info.js +49 -0
- package/src/blocks/section/index.js +7 -0
- package/src/blocks/{section.svelte → section/section.svelte} +4 -1
- package/src/blocks/select/component-info.js +59 -0
- package/src/blocks/select/index.js +7 -0
- package/src/blocks/{select.svelte → select/select.svelte} +10 -3
- package/src/blocks/submit-button/component-info.js +28 -0
- package/src/blocks/submit-button/index.js +7 -0
- package/src/blocks/{submit-button.svelte → submit-button/submit-button.svelte} +4 -1
- package/src/blocks/symbol/component-info.js +42 -0
- package/src/blocks/symbol/index.js +7 -0
- package/src/blocks/symbol/symbol.svelte +54 -0
- package/src/blocks/text/component-info.js +24 -0
- package/src/blocks/text/index.js +7 -0
- package/src/blocks/{text.svelte → text/text.svelte} +4 -1
- package/src/blocks/textarea/component-info.js +47 -0
- package/src/blocks/textarea/index.js +7 -0
- package/src/blocks/{textarea.svelte → textarea/textarea.svelte} +4 -1
- package/src/blocks/video/component-info.js +106 -0
- package/src/blocks/video/index.js +7 -0
- package/src/blocks/{video.svelte → video/video.svelte} +4 -1
- package/src/components/error-boundary.svelte +4 -1
- package/src/components/render-block/block-styles.svelte +51 -0
- package/src/components/{render-block.svelte → render-block/render-block.svelte} +60 -18
- package/src/components/render-blocks.svelte +18 -6
- package/src/components/render-content/components/render-styles.svelte +8 -13
- package/src/components/render-content/render-content.svelte +186 -174
- package/src/components/render-inlined-styles.svelte +49 -0
- package/src/constants/device-sizes.js +4 -11
- package/src/constants/target.js +3 -10
- package/src/context/builder.context.js +6 -31
- package/src/functions/evaluate.js +8 -31
- package/src/functions/event-handler-name.js +3 -10
- package/src/functions/get-block-actions.js +6 -29
- package/src/functions/get-block-component-options.js +3 -9
- package/src/functions/get-block-properties.js +3 -9
- package/src/functions/get-block-styles.js +6 -27
- package/src/functions/get-block-tag.js +3 -10
- package/src/functions/get-builder-search-params/fn.test.js +3 -21
- package/src/functions/get-builder-search-params/index.js +4 -11
- package/src/functions/get-content/fn.test.js +3 -21
- package/src/functions/get-content/index.js +8 -28
- package/src/functions/get-fetch.js +31 -32
- package/src/functions/get-global-this.js +3 -10
- package/src/functions/get-processed-block.js +9 -30
- package/src/functions/get-processed-block.test.js +2 -20
- package/src/functions/if-target.js +5 -28
- package/src/functions/is-browser.js +3 -10
- package/src/functions/is-editing.js +5 -28
- package/src/functions/is-iframe.js +5 -28
- package/src/functions/is-previewing.js +7 -30
- package/src/functions/macro-eval.js +3 -10
- package/src/functions/on-change.js +4 -11
- package/src/functions/on-change.test.js +4 -22
- package/src/functions/previewing-model-name.js +5 -28
- package/src/functions/register-component.js +6 -27
- package/src/functions/register.js +5 -28
- package/src/functions/set-editor-settings.js +5 -28
- package/src/functions/set.js +3 -10
- package/src/functions/set.test.js +4 -22
- package/src/functions/track.js +8 -31
- package/src/functions/transform-block.js +3 -10
- package/src/index-helpers/blocks-exports.js +19 -42
- package/src/index-helpers/top-of-file.js +3 -10
- package/src/index.js +10 -32
- package/src/scripts/init-editing.js +72 -81
- package/src/types/builder-block.js +0 -3
- package/src/types/builder-content.js +0 -3
- package/src/types/deep-partial.js +0 -3
- package/src/types/targets.js +0 -3
- package/src/types/typescript.js +0 -3
- package/src/blocks/custom-code.svelte +0 -63
- package/src/blocks/embed.svelte +0 -62
- package/src/blocks/symbol.svelte +0 -55
- package/src/components/block-styles.svelte +0 -23
|
@@ -1,216 +1,228 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import BuilderContext, { } from '../../context/builder.context
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
81
|
-
|
|
81
|
+
url,
|
|
82
|
+
key
|
|
82
83
|
}) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
$:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
$: contentState = () => {
|
|
132
|
+
return { ...content?.data?.state,
|
|
133
|
+
...data,
|
|
134
|
+
...overrideState
|
|
135
|
+
};
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
$: context = () => {
|
|
137
|
-
|
|
139
|
+
return {};
|
|
138
140
|
};
|
|
139
141
|
|
|
140
142
|
$: httpReqsData = () => {
|
|
141
|
-
|
|
143
|
+
return {};
|
|
142
144
|
};
|
|
143
145
|
|
|
144
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
204
|
-
|
|
208
|
+
|
|
205
209
|
<div on:click="{event => track('click', {
|
|
206
|
-
|
|
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
|
-
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
215
227
|
|
|
216
|
-
|
|
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
|
+
};
|
package/src/constants/target.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
14
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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:
|
|
41
|
-
isBrowser:
|
|
42
|
-
isServer: !
|
|
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
|
-
|
|
2
|
-
|
|
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[
|
|
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
|
+
};
|