@builder.io/sdk-solid 0.0.5 → 0.0.8
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 +59 -2
- package/src/blocks/button.jsx +8 -0
- package/src/blocks/button.lite.tsx +3 -1
- package/src/blocks/{columns.js → columns.jsx} +39 -81
- package/src/blocks/columns.lite.tsx +28 -23
- package/src/blocks/{custom-code.js → custom-code.jsx} +5 -25
- package/src/blocks/custom-code.lite.tsx +3 -1
- package/src/blocks/{embed.js → embed.jsx} +5 -15
- package/src/blocks/embed.lite.tsx +3 -1
- package/src/blocks/{form.js → form.jsx} +34 -136
- package/src/blocks/form.lite.tsx +7 -2
- package/src/blocks/fragment.jsx +6 -0
- package/src/blocks/fragment.lite.tsx +3 -1
- package/src/blocks/{image.js → image.jsx} +47 -138
- package/src/blocks/image.lite.tsx +3 -1
- package/src/blocks/img.jsx +11 -0
- package/src/blocks/img.lite.tsx +3 -1
- package/src/blocks/input.jsx +8 -0
- package/src/blocks/input.lite.tsx +3 -1
- package/src/blocks/raw-text.jsx +6 -0
- package/src/blocks/raw-text.lite.tsx +3 -1
- package/src/blocks/{section.js → section.jsx} +9 -23
- package/src/blocks/section.lite.tsx +3 -1
- package/src/blocks/select.jsx +17 -0
- package/src/blocks/select.lite.tsx +9 -4
- package/src/blocks/submit-button.jsx +8 -0
- package/src/blocks/submit-button.lite.tsx +3 -1
- package/src/blocks/symbol.jsx +25 -0
- package/src/blocks/symbol.lite.tsx +3 -1
- package/src/blocks/text.jsx +6 -0
- package/src/blocks/text.lite.tsx +3 -1
- package/src/blocks/textarea.jsx +6 -0
- package/src/blocks/textarea.lite.tsx +3 -1
- package/src/blocks/video.jsx +15 -0
- package/src/blocks/video.lite.tsx +3 -1
- package/src/components/block-styles.jsx +5 -0
- package/src/components/block-styles.lite.tsx +3 -1
- package/src/components/error-boundary.jsx +5 -0
- package/src/components/error-boundary.lite.tsx +3 -1
- package/src/components/{render-block.js → render-block.jsx} +30 -70
- package/src/components/render-block.lite.tsx +11 -3
- package/src/components/render-blocks.jsx +57 -0
- package/src/components/render-blocks.lite.tsx +7 -4
- package/src/components/render-content/components/{render-styles.js → render-styles.jsx} +5 -13
- package/src/components/render-content/components/render-styles.lite.tsx +3 -1
- package/src/components/render-content/{render-content.js → render-content.jsx} +25 -78
- package/src/components/render-content/render-content.lite.tsx +3 -1
- package/src/index.js +11 -11
- package/src/blocks/button.js +0 -32
- package/src/blocks/fragment.js +0 -15
- package/src/blocks/img.js +0 -39
- package/src/blocks/input.js +0 -45
- package/src/blocks/raw-text.js +0 -25
- package/src/blocks/select.js +0 -57
- package/src/blocks/submit-button.js +0 -18
- package/src/blocks/symbol.js +0 -69
- package/src/blocks/text.js +0 -15
- package/src/blocks/textarea.js +0 -34
- package/src/blocks/video.js +0 -54
- package/src/components/block-styles.js +0 -3
- package/src/components/error-boundary.js +0 -3
- package/src/components/render-blocks.js +0 -104
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
2
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
3
1
|
import { useContext, Show, For } from "solid-js";
|
|
4
2
|
import { Dynamic } from "solid-js/web";
|
|
5
3
|
import { createMutable } from "solid-js/store";
|
|
@@ -12,7 +10,8 @@ import BuilderContext from "../context/builder.context";
|
|
|
12
10
|
import { getBlockActions } from "../functions/get-block-actions";
|
|
13
11
|
import { getProcessedBlock } from "../functions/get-processed-block";
|
|
14
12
|
import BlockStyles from "./block-styles";
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
function RenderBlock(props) {
|
|
16
15
|
const state = createMutable({
|
|
17
16
|
get component() {
|
|
18
17
|
const componentName = state.useBlock.component?.name;
|
|
@@ -85,70 +84,31 @@ export default function RenderBlock(props) {
|
|
|
85
84
|
|
|
86
85
|
});
|
|
87
86
|
const builderContext = useContext(BuilderContext);
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
get builderBlock() {
|
|
117
|
-
return state.useBlock;
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
get component() {
|
|
121
|
-
return state.componentRef;
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
get children() {
|
|
125
|
-
return _$createComponent(For, {
|
|
126
|
-
get each() {
|
|
127
|
-
return state.children;
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
children: (child, index) => _$createComponent(RenderBlock, {
|
|
131
|
-
block: child
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
}));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
}), _$createComponent(For, {
|
|
140
|
-
get each() {
|
|
141
|
-
return state.noCompRefChildren;
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
children: (child, index) => _$createComponent(RenderBlock, {
|
|
145
|
-
block: child
|
|
146
|
-
})
|
|
147
|
-
})];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
}));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
}
|
|
87
|
+
return <>
|
|
88
|
+
<Show when={!state.componentInfo?.noWrap}>
|
|
89
|
+
<Dynamic {...state.propertiesAndActions} style={state.css} component={state.tagName}>
|
|
90
|
+
<BlockStyles block={state.useBlock}></BlockStyles>
|
|
91
|
+
<Show when={state.componentRef}>
|
|
92
|
+
<Dynamic {...state.componentOptions} builderBlock={state.useBlock} component={state.componentRef}>
|
|
93
|
+
<For each={state.children}>
|
|
94
|
+
{(child, _index) => {
|
|
95
|
+
const index = _index();
|
|
96
|
+
|
|
97
|
+
return <RenderBlock block={child}></RenderBlock>;
|
|
98
|
+
}}
|
|
99
|
+
</For>
|
|
100
|
+
</Dynamic>
|
|
101
|
+
</Show>
|
|
102
|
+
<For each={state.noCompRefChildren}>
|
|
103
|
+
{(child, _index) => {
|
|
104
|
+
const index = _index();
|
|
105
|
+
|
|
106
|
+
return <RenderBlock block={child}></RenderBlock>;
|
|
107
|
+
}}
|
|
108
|
+
</For>
|
|
109
|
+
</Dynamic>
|
|
110
|
+
</Show>
|
|
111
|
+
</>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export default RenderBlock;
|
|
@@ -12,7 +12,7 @@ import { getBlockActions } from "../functions/get-block-actions";
|
|
|
12
12
|
import { getProcessedBlock } from "../functions/get-processed-block";
|
|
13
13
|
import BlockStyles from "./block-styles.lite";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
function RenderBlock(props) {
|
|
16
16
|
const state = createMutable({
|
|
17
17
|
get component() {
|
|
18
18
|
const componentName = state.useBlock.component?.name;
|
|
@@ -94,15 +94,23 @@ export default function RenderBlock(props) {
|
|
|
94
94
|
component={state.componentRef}
|
|
95
95
|
>
|
|
96
96
|
<For each={state.children}>
|
|
97
|
-
{(child,
|
|
97
|
+
{(child, _index) => {
|
|
98
|
+
const index = _index();
|
|
99
|
+
return <RenderBlock block={child}></RenderBlock>;
|
|
100
|
+
}}
|
|
98
101
|
</For>
|
|
99
102
|
</Dynamic>
|
|
100
103
|
</Show>
|
|
101
104
|
<For each={state.noCompRefChildren}>
|
|
102
|
-
{(child,
|
|
105
|
+
{(child, _index) => {
|
|
106
|
+
const index = _index();
|
|
107
|
+
return <RenderBlock block={child}></RenderBlock>;
|
|
108
|
+
}}
|
|
103
109
|
</For>
|
|
104
110
|
</Dynamic>
|
|
105
111
|
</Show>
|
|
106
112
|
</>
|
|
107
113
|
);
|
|
108
114
|
}
|
|
115
|
+
|
|
116
|
+
export default RenderBlock;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Show, For } from "solid-js";
|
|
2
|
+
import { createMutable } from "solid-js/store";
|
|
3
|
+
import { css } from "solid-styled-components";
|
|
4
|
+
import { isEditing } from "../functions/is-editing";
|
|
5
|
+
import RenderBlock from "./render-block";
|
|
6
|
+
|
|
7
|
+
function RenderBlocks(props) {
|
|
8
|
+
const state = createMutable({
|
|
9
|
+
get className() {
|
|
10
|
+
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
onClick() {
|
|
14
|
+
if (isEditing() && !props.blocks?.length) {
|
|
15
|
+
window.parent?.postMessage({
|
|
16
|
+
type: "builder.clickEmptyBlocks",
|
|
17
|
+
data: {
|
|
18
|
+
parentElementId: props.parent,
|
|
19
|
+
dataPath: props.path
|
|
20
|
+
}
|
|
21
|
+
}, "*");
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
onMouseEnter() {
|
|
26
|
+
if (isEditing() && !props.blocks?.length) {
|
|
27
|
+
window.parent?.postMessage({
|
|
28
|
+
type: "builder.hoverEmptyBlocks",
|
|
29
|
+
data: {
|
|
30
|
+
parentElementId: props.parent,
|
|
31
|
+
dataPath: props.path
|
|
32
|
+
}
|
|
33
|
+
}, "*");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
});
|
|
38
|
+
return <div class={state.className + " " + css({
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexDirection: "column",
|
|
41
|
+
alignItems: "stretch"
|
|
42
|
+
})} builder-path={props.path} builder-parent-id={props.parent} dataSet={{
|
|
43
|
+
class: state.className
|
|
44
|
+
}} onClick={event => state.onClick()} onMouseEnter={event => state.onMouseEnter()}>
|
|
45
|
+
<Show when={props.blocks}>
|
|
46
|
+
<For each={props.blocks}>
|
|
47
|
+
{(block, _index) => {
|
|
48
|
+
const index = _index();
|
|
49
|
+
|
|
50
|
+
return <RenderBlock key={block.id} block={block}></RenderBlock>;
|
|
51
|
+
}}
|
|
52
|
+
</For>
|
|
53
|
+
</Show>
|
|
54
|
+
</div>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default RenderBlocks;
|
|
@@ -6,7 +6,7 @@ import { css } from "solid-styled-components";
|
|
|
6
6
|
import { isEditing } from "../functions/is-editing";
|
|
7
7
|
import RenderBlock from "./render-block.lite";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function RenderBlocks(props) {
|
|
10
10
|
const state = createMutable({
|
|
11
11
|
get className() {
|
|
12
12
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
@@ -62,11 +62,14 @@ export default function RenderBlocks(props) {
|
|
|
62
62
|
>
|
|
63
63
|
<Show when={props.blocks}>
|
|
64
64
|
<For each={props.blocks}>
|
|
65
|
-
{(block,
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
{(block, _index) => {
|
|
66
|
+
const index = _index();
|
|
67
|
+
return <RenderBlock key={block.id} block={block}></RenderBlock>;
|
|
68
|
+
}}
|
|
68
69
|
</For>
|
|
69
70
|
</Show>
|
|
70
71
|
</div>
|
|
71
72
|
);
|
|
72
73
|
}
|
|
74
|
+
|
|
75
|
+
export default RenderBlocks;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { insert as _$insert } from "solid-js/web";
|
|
3
|
-
|
|
4
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<style></style>`, 2);
|
|
5
|
-
|
|
6
1
|
import { createMutable } from "solid-js/store";
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
function RenderStyles(props) {
|
|
8
4
|
const state = createMutable({
|
|
9
5
|
getCssFromFont(font) {
|
|
10
6
|
// TODO: compute what font sizes are used and only load those.......
|
|
@@ -71,11 +67,7 @@ ${state.getFontCss({
|
|
|
71
67
|
}
|
|
72
68
|
|
|
73
69
|
});
|
|
74
|
-
return (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
_$insert(_el$, () => state.getInjectedStyles());
|
|
70
|
+
return <style>{state.getInjectedStyles()}</style>;
|
|
71
|
+
}
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
})();
|
|
81
|
-
}
|
|
73
|
+
export default RenderStyles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createMutable } from "solid-js/store";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function RenderStyles(props) {
|
|
4
4
|
const state = createMutable({
|
|
5
5
|
getCssFromFont(font: CustomFont) {
|
|
6
6
|
// TODO: compute what font sizes are used and only load those.......
|
|
@@ -68,3 +68,5 @@ ${state.getFontCss({
|
|
|
68
68
|
|
|
69
69
|
return <style>{state.getInjectedStyles()}</style>;
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
export default RenderStyles;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
3
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
4
|
-
import { effect as _$effect } from "solid-js/web";
|
|
5
|
-
import { insert as _$insert } from "solid-js/web";
|
|
6
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
7
|
-
import { memo as _$memo } from "solid-js/web";
|
|
8
|
-
|
|
9
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<div></div>`, 2);
|
|
10
|
-
|
|
11
1
|
import { Show, onMount } from "solid-js";
|
|
12
2
|
import { Dynamic } from "solid-js/web";
|
|
13
3
|
import { createMutable } from "solid-js/store";
|
|
@@ -24,7 +14,8 @@ import { evaluate } from "../../functions/evaluate";
|
|
|
24
14
|
import { getFetch } from "../../functions/get-fetch";
|
|
25
15
|
import { TARGET } from "../../constants/target";
|
|
26
16
|
import RenderStyles from "./components/render-styles";
|
|
27
|
-
|
|
17
|
+
|
|
18
|
+
function RenderContent(props) {
|
|
28
19
|
const state = createMutable({
|
|
29
20
|
get useContent() {
|
|
30
21
|
const mergedContent = { ...props.content,
|
|
@@ -185,79 +176,35 @@ export default function RenderContent(props) {
|
|
|
185
176
|
state.emitStateUpdate();
|
|
186
177
|
}
|
|
187
178
|
});
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return state.useContent;
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
get state() {
|
|
195
|
-
return state.state;
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
get context() {
|
|
199
|
-
return state.context;
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
get apiKey() {
|
|
203
|
-
return props.apiKey;
|
|
204
|
-
}
|
|
205
|
-
|
|
179
|
+
return <Dynamic value={{
|
|
180
|
+
get content() {
|
|
181
|
+
return state.useContent;
|
|
206
182
|
},
|
|
207
183
|
|
|
208
|
-
get
|
|
209
|
-
return
|
|
184
|
+
get state() {
|
|
185
|
+
return state.state;
|
|
210
186
|
},
|
|
211
187
|
|
|
212
|
-
get
|
|
213
|
-
return
|
|
214
|
-
|
|
215
|
-
return state.useContent;
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
get children() {
|
|
219
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
220
|
-
|
|
221
|
-
_el$.$$click = event => track("click", {
|
|
222
|
-
contentId: state.useContent.id
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
_$insert(_el$, _$createComponent(Show, {
|
|
226
|
-
get when() {
|
|
227
|
-
return (state.useContent?.data?.cssCode || state.useContent?.data?.customFonts?.length) && TARGET !== "reactNative";
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
get children() {
|
|
231
|
-
return _$createComponent(RenderStyles, {
|
|
232
|
-
get cssCode() {
|
|
233
|
-
return state.useContent.data.cssCode;
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
get customFonts() {
|
|
237
|
-
return state.useContent.data.customFonts;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
}), null);
|
|
244
|
-
|
|
245
|
-
_$insert(_el$, _$createComponent(RenderBlocks, {
|
|
246
|
-
get blocks() {
|
|
247
|
-
return state.useContent?.data?.blocks;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
}), null);
|
|
251
|
-
|
|
252
|
-
_$effect(() => _$setAttribute(_el$, "data-builder-content-id", state.useContent?.id));
|
|
253
|
-
|
|
254
|
-
return _el$;
|
|
255
|
-
}
|
|
188
|
+
get context() {
|
|
189
|
+
return state.context;
|
|
190
|
+
},
|
|
256
191
|
|
|
257
|
-
|
|
192
|
+
get apiKey() {
|
|
193
|
+
return props.apiKey;
|
|
258
194
|
}
|
|
259
195
|
|
|
260
|
-
}
|
|
196
|
+
}} component={BuilderContext.Provider}>
|
|
197
|
+
<Show when={state.useContent}>
|
|
198
|
+
<div onClick={event => track("click", {
|
|
199
|
+
contentId: state.useContent.id
|
|
200
|
+
})} data-builder-content-id={state.useContent?.id}>
|
|
201
|
+
<Show when={(state.useContent?.data?.cssCode || state.useContent?.data?.customFonts?.length) && TARGET !== "reactNative"}>
|
|
202
|
+
<RenderStyles cssCode={state.useContent.data.cssCode} customFonts={state.useContent.data.customFonts}></RenderStyles>
|
|
203
|
+
</Show>
|
|
204
|
+
<RenderBlocks blocks={state.useContent?.data?.blocks}></RenderBlocks>
|
|
205
|
+
</div>
|
|
206
|
+
</Show>
|
|
207
|
+
</Dynamic>;
|
|
261
208
|
}
|
|
262
209
|
|
|
263
|
-
|
|
210
|
+
export default RenderContent;
|
|
@@ -19,7 +19,7 @@ import { getFetch } from "../../functions/get-fetch";
|
|
|
19
19
|
import { TARGET } from "../../constants/target";
|
|
20
20
|
import RenderStyles from "./components/render-styles.lite";
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
function RenderContent(props) {
|
|
23
23
|
const state = createMutable({
|
|
24
24
|
get useContent() {
|
|
25
25
|
const mergedContent: BuilderContent = {
|
|
@@ -227,3 +227,5 @@ export default function RenderContent(props) {
|
|
|
227
227
|
</Dynamic>
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
|
+
|
|
231
|
+
export default RenderContent;
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import("./index-helpers/top-of-file");
|
|
2
|
-
import { isEditing } from "./functions/is-editing";
|
|
1
|
+
import("./index-helpers/top-of-file.js");
|
|
2
|
+
import { isEditing } from "./functions/is-editing.js";
|
|
3
3
|
if (isEditing()) {
|
|
4
|
-
import("./scripts/init-editing");
|
|
4
|
+
import("./scripts/init-editing.js");
|
|
5
5
|
}
|
|
6
|
-
export * from "./index-helpers/blocks-exports";
|
|
7
|
-
export * from "./functions/is-editing";
|
|
8
|
-
export * from "./functions/is-previewing";
|
|
9
|
-
export * from "./functions/register-component";
|
|
10
|
-
export * from "./functions/register";
|
|
11
|
-
export * from "./functions/set-editor-settings";
|
|
12
|
-
export * from "./functions/get-content";
|
|
13
|
-
export * from "./functions/get-builder-search-params";
|
|
6
|
+
export * from "./index-helpers/blocks-exports.js";
|
|
7
|
+
export * from "./functions/is-editing.js.js";
|
|
8
|
+
export * from "./functions/is-previewing.js";
|
|
9
|
+
export * from "./functions/register-component.js";
|
|
10
|
+
export * from "./functions/register.js";
|
|
11
|
+
export * from "./functions/set-editor-settings.js";
|
|
12
|
+
export * from "./functions/get-content.js";
|
|
13
|
+
export * from "./functions/get-builder-search-params.js";
|
package/src/blocks/button.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
-
import { effect as _$effect } from "solid-js/web";
|
|
4
|
-
import { insert as _$insert } from "solid-js/web";
|
|
5
|
-
import { spread as _$spread } from "solid-js/web";
|
|
6
|
-
|
|
7
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<a role="button"></a>`, 2);
|
|
8
|
-
|
|
9
|
-
export default function Button(props) {
|
|
10
|
-
return (() => {
|
|
11
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
-
|
|
13
|
-
_$spread(_el$, () => props.attributes, false, true);
|
|
14
|
-
|
|
15
|
-
_$insert(_el$, () => props.text);
|
|
16
|
-
|
|
17
|
-
_$effect(_p$ => {
|
|
18
|
-
const _v$ = props.link,
|
|
19
|
-
_v$2 = props.openLinkInNewTab ? "_blank" : undefined;
|
|
20
|
-
|
|
21
|
-
_v$ !== _p$._v$ && _$setAttribute(_el$, "href", _p$._v$ = _v$);
|
|
22
|
-
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "target", _p$._v$2 = _v$2);
|
|
23
|
-
return _p$;
|
|
24
|
-
}, {
|
|
25
|
-
_v$: undefined,
|
|
26
|
-
_v$2: undefined
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
return _el$;
|
|
30
|
-
})();
|
|
31
|
-
}import { registerComponent } from '../functions/register-component';
|
|
32
|
-
registerComponent(Button, {name:'Core:Button',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13',defaultStyles:{appearance:'none',paddingTop:'15px',paddingBottom:'15px',paddingLeft:'25px',paddingRight:'25px',backgroundColor:'#000000',color:'white',borderRadius:'4px',textAlign:'center',cursor:'pointer'},inputs:[{name:'text',type:'text',defaultValue:'Click me!',bubble:true},{name:'link',type:'url',bubble:true},{name:'openLinkInNewTab',type:'boolean',defaultValue:false,friendlyName:'Open link in new tab'}],static:true,noWrap:true});
|
package/src/blocks/fragment.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { insert as _$insert } from "solid-js/web";
|
|
3
|
-
|
|
4
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<span></span>`, 2);
|
|
5
|
-
|
|
6
|
-
export default function FragmentComponent(props) {
|
|
7
|
-
return (() => {
|
|
8
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
9
|
-
|
|
10
|
-
_$insert(_el$, () => props.children);
|
|
11
|
-
|
|
12
|
-
return _el$;
|
|
13
|
-
})();
|
|
14
|
-
}import { registerComponent } from '../functions/register-component';
|
|
15
|
-
registerComponent(FragmentComponent, {name:'Fragment',static:true,hidden:true,builtIn:true,canHaveChildren:true,noWrap:true});
|
package/src/blocks/img.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
-
import { effect as _$effect } from "solid-js/web";
|
|
4
|
-
import { spread as _$spread } from "solid-js/web";
|
|
5
|
-
|
|
6
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<img>`, 1);
|
|
7
|
-
|
|
8
|
-
import { isEditing } from "../functions/is-editing";
|
|
9
|
-
export default function ImgComponent(props) {
|
|
10
|
-
return (() => {
|
|
11
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
-
|
|
13
|
-
_$spread(_el$, () => props.attributes, false, false);
|
|
14
|
-
|
|
15
|
-
_$effect(_p$ => {
|
|
16
|
-
const _v$ = props.backgroundSize || "cover",
|
|
17
|
-
_v$2 = props.backgroundPosition || "center",
|
|
18
|
-
_v$3 = isEditing() && props.imgSrc || "default-key",
|
|
19
|
-
_v$4 = props.altText,
|
|
20
|
-
_v$5 = props.imgSrc;
|
|
21
|
-
|
|
22
|
-
_v$ !== _p$._v$ && _el$.style.setProperty("object-fit", _p$._v$ = _v$);
|
|
23
|
-
_v$2 !== _p$._v$2 && _el$.style.setProperty("object-position", _p$._v$2 = _v$2);
|
|
24
|
-
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "key", _p$._v$3 = _v$3);
|
|
25
|
-
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "alt", _p$._v$4 = _v$4);
|
|
26
|
-
_v$5 !== _p$._v$5 && _$setAttribute(_el$, "src", _p$._v$5 = _v$5);
|
|
27
|
-
return _p$;
|
|
28
|
-
}, {
|
|
29
|
-
_v$: undefined,
|
|
30
|
-
_v$2: undefined,
|
|
31
|
-
_v$3: undefined,
|
|
32
|
-
_v$4: undefined,
|
|
33
|
-
_v$5: undefined
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return _el$;
|
|
37
|
-
})();
|
|
38
|
-
}import { registerComponent } from '../functions/register-component';
|
|
39
|
-
registerComponent(ImgComponent, {name:'Raw:Img',hideFromInsertMenu:true,builtIn:true,image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',inputs:[{name:'image',bubble:true,type:'file',allowedFileTypes:['jpeg','jpg','png','svg'],required:true}],noWrap:true,static:true});
|
package/src/blocks/input.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
3
|
-
import { effect as _$effect } from "solid-js/web";
|
|
4
|
-
import { spread as _$spread } from "solid-js/web";
|
|
5
|
-
|
|
6
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<input>`, 1);
|
|
7
|
-
|
|
8
|
-
import { isEditing } from "../functions/is-editing";
|
|
9
|
-
export default function FormInputComponent(props) {
|
|
10
|
-
return (() => {
|
|
11
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
12
|
-
|
|
13
|
-
_$spread(_el$, () => props.attributes, false, false);
|
|
14
|
-
|
|
15
|
-
_$effect(_p$ => {
|
|
16
|
-
const _v$ = isEditing() && props.defaultValue ? props.defaultValue : "default-key",
|
|
17
|
-
_v$2 = props.placeholder,
|
|
18
|
-
_v$3 = props.type,
|
|
19
|
-
_v$4 = props.name,
|
|
20
|
-
_v$5 = props.value,
|
|
21
|
-
_v$6 = props.defaultValue,
|
|
22
|
-
_v$7 = props.required;
|
|
23
|
-
|
|
24
|
-
_v$ !== _p$._v$ && _$setAttribute(_el$, "key", _p$._v$ = _v$);
|
|
25
|
-
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "placeholder", _p$._v$2 = _v$2);
|
|
26
|
-
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "type", _p$._v$3 = _v$3);
|
|
27
|
-
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "name", _p$._v$4 = _v$4);
|
|
28
|
-
_v$5 !== _p$._v$5 && (_el$.value = _p$._v$5 = _v$5);
|
|
29
|
-
_v$6 !== _p$._v$6 && _$setAttribute(_el$, "defaultvalue", _p$._v$6 = _v$6);
|
|
30
|
-
_v$7 !== _p$._v$7 && (_el$.required = _p$._v$7 = _v$7);
|
|
31
|
-
return _p$;
|
|
32
|
-
}, {
|
|
33
|
-
_v$: undefined,
|
|
34
|
-
_v$2: undefined,
|
|
35
|
-
_v$3: undefined,
|
|
36
|
-
_v$4: undefined,
|
|
37
|
-
_v$5: undefined,
|
|
38
|
-
_v$6: undefined,
|
|
39
|
-
_v$7: undefined
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return _el$;
|
|
43
|
-
})();
|
|
44
|
-
}import { registerComponent } from '../functions/register-component';
|
|
45
|
-
registerComponent(FormInputComponent, {name:'Form:Input',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',inputs:[{name:'type',type:'text',enum:['text','number','email','url','checkbox','radio','range','date','datetime-local','search','tel','time','file','month','week','password','color','hidden'],defaultValue:'text'},{name:'name',type:'string',required:true,helperText:'Every input in a form needs a unique name describing what it takes, e.g. "email"'},{name:'placeholder',type:'string',defaultValue:'Hello there',helperText:'Text to display when there is no value'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',helperText:'Is this input required to be filled out to submit a form',defaultValue:false}],noWrap:true,static:true,defaultStyles:{paddingTop:'10px',paddingBottom:'10px',paddingLeft:'10px',paddingRight:'10px',borderRadius:'3px',borderWidth:'1px',borderStyle:'solid',borderColor:'#ccc'}});
|
package/src/blocks/raw-text.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { effect as _$effect } from "solid-js/web";
|
|
3
|
-
|
|
4
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<span></span>`, 2);
|
|
5
|
-
|
|
6
|
-
export default function RawText(props) {
|
|
7
|
-
return (() => {
|
|
8
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
9
|
-
|
|
10
|
-
_$effect(_p$ => {
|
|
11
|
-
const _v$ = props.attributes?.class || props.attributes?.className,
|
|
12
|
-
_v$2 = props.text || "";
|
|
13
|
-
|
|
14
|
-
_v$ !== _p$._v$ && (_el$.className = _p$._v$ = _v$);
|
|
15
|
-
_v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
|
|
16
|
-
return _p$;
|
|
17
|
-
}, {
|
|
18
|
-
_v$: undefined,
|
|
19
|
-
_v$2: undefined
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return _el$;
|
|
23
|
-
})();
|
|
24
|
-
}import { registerComponent } from '../functions/register-component';
|
|
25
|
-
registerComponent(RawText, {name:'Builder:RawText',hideFromInsertMenu:true,builtIn:true,inputs:[{name:'text',bubble:true,type:'longText',required:true}]});
|
package/src/blocks/select.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { template as _$template } from "solid-js/web";
|
|
2
|
-
import { memo as _$memo } from "solid-js/web";
|
|
3
|
-
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
4
|
-
import { effect as _$effect } from "solid-js/web";
|
|
5
|
-
import { insert as _$insert } from "solid-js/web";
|
|
6
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
7
|
-
import { spread as _$spread } from "solid-js/web";
|
|
8
|
-
|
|
9
|
-
const _tmpl$ = /*#__PURE__*/_$template(`<select></select>`, 2),
|
|
10
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<option></option>`, 2);
|
|
11
|
-
|
|
12
|
-
import { For } from "solid-js";
|
|
13
|
-
import { isEditing } from "../functions/is-editing";
|
|
14
|
-
export default function SelectComponent(props) {
|
|
15
|
-
return (() => {
|
|
16
|
-
const _el$ = _tmpl$.cloneNode(true);
|
|
17
|
-
|
|
18
|
-
_$spread(_el$, () => props.attributes, false, true);
|
|
19
|
-
|
|
20
|
-
_$insert(_el$, _$createComponent(For, {
|
|
21
|
-
get each() {
|
|
22
|
-
return props.options;
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
children: (option, index) => (() => {
|
|
26
|
-
const _el$2 = _tmpl$2.cloneNode(true);
|
|
27
|
-
|
|
28
|
-
_$insert(_el$2, () => option.name || option.value);
|
|
29
|
-
|
|
30
|
-
_$effect(() => _el$2.value = option.value);
|
|
31
|
-
|
|
32
|
-
return _el$2;
|
|
33
|
-
})()
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
_$effect(_p$ => {
|
|
37
|
-
const _v$ = props.value,
|
|
38
|
-
_v$2 = isEditing() && props.defaultValue ? props.defaultValue : "default-key",
|
|
39
|
-
_v$3 = props.defaultValue,
|
|
40
|
-
_v$4 = props.name;
|
|
41
|
-
|
|
42
|
-
_v$ !== _p$._v$ && (_el$.value = _p$._v$ = _v$);
|
|
43
|
-
_v$2 !== _p$._v$2 && _$setAttribute(_el$, "key", _p$._v$2 = _v$2);
|
|
44
|
-
_v$3 !== _p$._v$3 && _$setAttribute(_el$, "defaultvalue", _p$._v$3 = _v$3);
|
|
45
|
-
_v$4 !== _p$._v$4 && _$setAttribute(_el$, "name", _p$._v$4 = _v$4);
|
|
46
|
-
return _p$;
|
|
47
|
-
}, {
|
|
48
|
-
_v$: undefined,
|
|
49
|
-
_v$2: undefined,
|
|
50
|
-
_v$3: undefined,
|
|
51
|
-
_v$4: undefined
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return _el$;
|
|
55
|
-
})();
|
|
56
|
-
}import { registerComponent } from '../functions/register-component';
|
|
57
|
-
registerComponent(SelectComponent, {name:'Form:Select',builtIn:true,image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',defaultStyles:{alignSelf:'flex-start'},inputs:[{name:'options',type:'list',required:true,subFields:[{name:'value',type:'text',required:true},{name:'name',type:'text'}],defaultValue:[{value:'option 1'},{value:'option 2'}]},{name:'name',type:'string',required:true,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',defaultValue:false}],static:true,noWrap:true});
|