@builder.io/sdk-qwik 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/README.md +2 -65
- package/lib/index.97024df8.js +80165 -0
- package/lib/index.d8c1e37f.cjs +80165 -0
- package/lib/index.qwik.cjs +2424 -0
- package/lib/index.qwik.mjs +2424 -0
- package/package.json +3 -4
- package/tsconfig.json +1 -1
- package/types.d.ts +12 -7
- package/src/blocks/button/button.jsx +0 -211
- package/src/blocks/button/component-info.js +0 -41
- package/src/blocks/columns/columns.jsx +0 -267
- package/src/blocks/columns/component-info.js +0 -242
- package/src/blocks/custom-code/component-info.js +0 -31
- package/src/blocks/custom-code/custom-code.jsx +0 -130
- package/src/blocks/embed/component-info.js +0 -44
- package/src/blocks/embed/embed.jsx +0 -130
- package/src/blocks/embed/helpers.js +0 -9
- package/src/blocks/form/builder-blocks.jsx +0 -100
- package/src/blocks/form/component-info.js +0 -262
- package/src/blocks/form/form.jsx +0 -789
- package/src/blocks/fragment/component-info.js +0 -11
- package/src/blocks/fragment/fragment.jsx +0 -59
- package/src/blocks/image/component-info.js +0 -151
- package/src/blocks/image/image.helpers.js +0 -48
- package/src/blocks/image/image.jsx +0 -554
- package/src/blocks/img/component-info.js +0 -20
- package/src/blocks/img/img.jsx +0 -76
- package/src/blocks/input/component-info.js +0 -74
- package/src/blocks/input/input.jsx +0 -87
- package/src/blocks/raw-text/component-info.js +0 -16
- package/src/blocks/raw-text/raw-text.jsx +0 -53
- package/src/blocks/section/component-info.js +0 -49
- package/src/blocks/section/section.jsx +0 -97
- package/src/blocks/select/component-info.js +0 -59
- package/src/blocks/select/select.jsx +0 -149
- package/src/blocks/submit-button/component-info.js +0 -28
- package/src/blocks/submit-button/submit-button.jsx +0 -87
- package/src/blocks/symbol/component-info.js +0 -43
- package/src/blocks/symbol/symbol.jsx +0 -230
- package/src/blocks/text/component-info.js +0 -24
- package/src/blocks/text/text.jsx +0 -46
- package/src/blocks/textarea/component-info.js +0 -47
- package/src/blocks/textarea/textarea.jsx +0 -65
- package/src/blocks/util.js +0 -12
- package/src/blocks/video/component-info.js +0 -106
- package/src/blocks/video/video.jsx +0 -103
- package/src/components/render-block/block-styles.jsx +0 -186
- package/src/components/render-block/render-block.helpers.js +0 -23
- package/src/components/render-block/render-block.jsx +0 -749
- package/src/components/render-block/render-component.jsx +0 -257
- package/src/components/render-block/render-repeated-block.jsx +0 -119
- package/src/components/render-block/types.js +0 -0
- package/src/components/render-blocks.jsx +0 -387
- package/src/components/render-content/components/render-styles.jsx +0 -140
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/render-content.jsx +0 -636
- package/src/components/render-inlined-styles.jsx +0 -153
- package/src/constants/builder-registered-components.js +0 -48
- package/src/constants/device-sizes.js +0 -21
- package/src/constants/target.js +0 -4
- package/src/context/builder.context.js +0 -5
- package/src/functions/camel-to-kebab-case.js +0 -4
- package/src/functions/convert-style-object.js +0 -6
- package/src/functions/evaluate.js +0 -28
- package/src/functions/event-handler-name.js +0 -7
- package/src/functions/get-block-actions.js +0 -23
- package/src/functions/get-block-component-options.js +0 -28
- package/src/functions/get-block-properties.js +0 -29
- package/src/functions/get-block-styles.js +0 -34
- package/src/functions/get-block-tag.js +0 -6
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-builder-search-params/index.js +0 -33
- package/src/functions/get-content/ab-testing.js +0 -38
- package/src/functions/get-content/fn.test.js +0 -31
- package/src/functions/get-content/index.js +0 -99
- package/src/functions/get-content/types.js +0 -0
- package/src/functions/get-fetch.js +0 -33
- package/src/functions/get-global-this.js +0 -18
- package/src/functions/get-processed-block.js +0 -53
- package/src/functions/get-processed-block.test.js +0 -32
- package/src/functions/if-target.js +0 -15
- package/src/functions/is-browser.js +0 -6
- package/src/functions/is-editing.js +0 -7
- package/src/functions/is-iframe.js +0 -7
- package/src/functions/is-previewing.js +0 -14
- package/src/functions/on-change.js +0 -27
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/register-component.js +0 -72
- package/src/functions/register.js +0 -29
- package/src/functions/sanitize-styles.js +0 -5
- package/src/functions/set-editor-settings.js +0 -15
- package/src/functions/set.js +0 -11
- package/src/functions/set.test.js +0 -16
- package/src/functions/track.js +0 -22
- package/src/functions/transform-block.js +0 -6
- package/src/helpers/css.js +0 -12
- package/src/helpers/flatten.js +0 -34
- package/src/index-helpers/blocks-exports.js +0 -22
- package/src/index-helpers/top-of-file.js +0 -4
- package/src/index.js +0 -10
- package/src/scripts/init-editing.js +0 -79
- package/src/types/builder-block.js +0 -0
- package/src/types/builder-content.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { markSerializable } from "../util";
|
|
2
|
-
const componentInfo = {
|
|
3
|
-
name: "Columns",
|
|
4
|
-
builtIn: true,
|
|
5
|
-
inputs: [
|
|
6
|
-
{
|
|
7
|
-
name: "columns",
|
|
8
|
-
type: "array",
|
|
9
|
-
broadcast: true,
|
|
10
|
-
subFields: [
|
|
11
|
-
{
|
|
12
|
-
name: "blocks",
|
|
13
|
-
type: "array",
|
|
14
|
-
hideFromUI: true,
|
|
15
|
-
defaultValue: [
|
|
16
|
-
{
|
|
17
|
-
"@type": "@builder.io/sdk:Element",
|
|
18
|
-
responsiveStyles: {
|
|
19
|
-
large: {
|
|
20
|
-
display: "flex",
|
|
21
|
-
flexDirection: "column",
|
|
22
|
-
alignItems: "stretch",
|
|
23
|
-
flexShrink: "0",
|
|
24
|
-
position: "relative",
|
|
25
|
-
marginTop: "30px",
|
|
26
|
-
textAlign: "center",
|
|
27
|
-
lineHeight: "normal",
|
|
28
|
-
height: "auto",
|
|
29
|
-
minHeight: "20px",
|
|
30
|
-
minWidth: "20px",
|
|
31
|
-
overflow: "hidden"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
component: {
|
|
35
|
-
name: "Image",
|
|
36
|
-
options: {
|
|
37
|
-
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
38
|
-
backgroundPosition: "center",
|
|
39
|
-
backgroundSize: "cover",
|
|
40
|
-
aspectRatio: 0.7004048582995948
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"@type": "@builder.io/sdk:Element",
|
|
46
|
-
responsiveStyles: {
|
|
47
|
-
large: {
|
|
48
|
-
display: "flex",
|
|
49
|
-
flexDirection: "column",
|
|
50
|
-
alignItems: "stretch",
|
|
51
|
-
flexShrink: "0",
|
|
52
|
-
position: "relative",
|
|
53
|
-
marginTop: "30px",
|
|
54
|
-
textAlign: "center",
|
|
55
|
-
lineHeight: "normal",
|
|
56
|
-
height: "auto"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
component: {
|
|
60
|
-
name: "Text",
|
|
61
|
-
options: {
|
|
62
|
-
text: "<p>Enter some text...</p>"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "width",
|
|
70
|
-
type: "number",
|
|
71
|
-
hideFromUI: true,
|
|
72
|
-
helperText: "Width %, e.g. set to 50 to fill half of the space"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "link",
|
|
76
|
-
type: "url",
|
|
77
|
-
helperText: "Optionally set a url that clicking this column will link to"
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
defaultValue: [
|
|
81
|
-
{
|
|
82
|
-
blocks: [
|
|
83
|
-
{
|
|
84
|
-
"@type": "@builder.io/sdk:Element",
|
|
85
|
-
responsiveStyles: {
|
|
86
|
-
large: {
|
|
87
|
-
display: "flex",
|
|
88
|
-
flexDirection: "column",
|
|
89
|
-
alignItems: "stretch",
|
|
90
|
-
flexShrink: "0",
|
|
91
|
-
position: "relative",
|
|
92
|
-
marginTop: "30px",
|
|
93
|
-
textAlign: "center",
|
|
94
|
-
lineHeight: "normal",
|
|
95
|
-
height: "auto",
|
|
96
|
-
minHeight: "20px",
|
|
97
|
-
minWidth: "20px",
|
|
98
|
-
overflow: "hidden"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
component: {
|
|
102
|
-
name: "Image",
|
|
103
|
-
options: {
|
|
104
|
-
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
105
|
-
backgroundPosition: "center",
|
|
106
|
-
backgroundSize: "cover",
|
|
107
|
-
aspectRatio: 0.7004048582995948
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"@type": "@builder.io/sdk:Element",
|
|
113
|
-
responsiveStyles: {
|
|
114
|
-
large: {
|
|
115
|
-
display: "flex",
|
|
116
|
-
flexDirection: "column",
|
|
117
|
-
alignItems: "stretch",
|
|
118
|
-
flexShrink: "0",
|
|
119
|
-
position: "relative",
|
|
120
|
-
marginTop: "30px",
|
|
121
|
-
textAlign: "center",
|
|
122
|
-
lineHeight: "normal",
|
|
123
|
-
height: "auto"
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
component: {
|
|
127
|
-
name: "Text",
|
|
128
|
-
options: {
|
|
129
|
-
text: "<p>Enter some text...</p>"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
]
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
blocks: [
|
|
137
|
-
{
|
|
138
|
-
"@type": "@builder.io/sdk:Element",
|
|
139
|
-
responsiveStyles: {
|
|
140
|
-
large: {
|
|
141
|
-
display: "flex",
|
|
142
|
-
flexDirection: "column",
|
|
143
|
-
alignItems: "stretch",
|
|
144
|
-
flexShrink: "0",
|
|
145
|
-
position: "relative",
|
|
146
|
-
marginTop: "30px",
|
|
147
|
-
textAlign: "center",
|
|
148
|
-
lineHeight: "normal",
|
|
149
|
-
height: "auto",
|
|
150
|
-
minHeight: "20px",
|
|
151
|
-
minWidth: "20px",
|
|
152
|
-
overflow: "hidden"
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
component: {
|
|
156
|
-
name: "Image",
|
|
157
|
-
options: {
|
|
158
|
-
image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
159
|
-
backgroundPosition: "center",
|
|
160
|
-
backgroundSize: "cover",
|
|
161
|
-
aspectRatio: 0.7004048582995948
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"@type": "@builder.io/sdk:Element",
|
|
167
|
-
responsiveStyles: {
|
|
168
|
-
large: {
|
|
169
|
-
display: "flex",
|
|
170
|
-
flexDirection: "column",
|
|
171
|
-
alignItems: "stretch",
|
|
172
|
-
flexShrink: "0",
|
|
173
|
-
position: "relative",
|
|
174
|
-
marginTop: "30px",
|
|
175
|
-
textAlign: "center",
|
|
176
|
-
lineHeight: "normal",
|
|
177
|
-
height: "auto"
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
component: {
|
|
181
|
-
name: "Text",
|
|
182
|
-
options: {
|
|
183
|
-
text: "<p>Enter some text...</p>"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
],
|
|
190
|
-
onChange: markSerializable((options) => {
|
|
191
|
-
function clearWidths() {
|
|
192
|
-
columns.forEach((col) => {
|
|
193
|
-
col.delete("width");
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
const columns = options.get("columns");
|
|
197
|
-
if (Array.isArray(columns)) {
|
|
198
|
-
const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
|
|
199
|
-
if (containsColumnWithWidth) {
|
|
200
|
-
const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
|
|
201
|
-
if (containsColumnWithoutWidth) {
|
|
202
|
-
clearWidths();
|
|
203
|
-
} else {
|
|
204
|
-
const sumWidths = columns.reduce((memo, col) => {
|
|
205
|
-
return memo + col.get("width");
|
|
206
|
-
}, 0);
|
|
207
|
-
const widthsDontAddUp = sumWidths !== 100;
|
|
208
|
-
if (widthsDontAddUp) {
|
|
209
|
-
clearWidths();
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
})
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "space",
|
|
218
|
-
type: "number",
|
|
219
|
-
defaultValue: 20,
|
|
220
|
-
helperText: "Size of gap between columns",
|
|
221
|
-
advanced: true
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: "stackColumnsAt",
|
|
225
|
-
type: "string",
|
|
226
|
-
defaultValue: "tablet",
|
|
227
|
-
helperText: "Convert horizontal columns to vertical at what device size",
|
|
228
|
-
enum: ["tablet", "mobile", "never"],
|
|
229
|
-
advanced: true
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "reverseColumnsWhenStacked",
|
|
233
|
-
type: "boolean",
|
|
234
|
-
defaultValue: false,
|
|
235
|
-
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
236
|
-
advanced: true
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
};
|
|
240
|
-
export {
|
|
241
|
-
componentInfo
|
|
242
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Custom Code",
|
|
3
|
-
static: true,
|
|
4
|
-
builtIn: true,
|
|
5
|
-
requiredPermissions: ["editCode"],
|
|
6
|
-
inputs: [
|
|
7
|
-
{
|
|
8
|
-
name: "code",
|
|
9
|
-
type: "html",
|
|
10
|
-
required: true,
|
|
11
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
12
|
-
code: true
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: "replaceNodes",
|
|
16
|
-
type: "boolean",
|
|
17
|
-
helperText: "Preserve server rendered dom nodes",
|
|
18
|
-
advanced: true
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "scriptsClientOnly",
|
|
22
|
-
type: "boolean",
|
|
23
|
-
defaultValue: false,
|
|
24
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
25
|
-
advanced: true
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
componentInfo
|
|
31
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Fragment,
|
|
5
|
-
Host,
|
|
6
|
-
component$,
|
|
7
|
-
h,
|
|
8
|
-
useClientEffect$,
|
|
9
|
-
useRef,
|
|
10
|
-
useStore,
|
|
11
|
-
} from "@builder.io/qwik";
|
|
12
|
-
export const findAndRunScripts = function findAndRunScripts(
|
|
13
|
-
props,
|
|
14
|
-
state,
|
|
15
|
-
elem
|
|
16
|
-
) {
|
|
17
|
-
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
18
|
-
if (elem && typeof window !== "undefined") {
|
|
19
|
-
const scripts = elem.getElementsByTagName("script");
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
22
|
-
const script = scripts[i];
|
|
23
|
-
|
|
24
|
-
if (script.src) {
|
|
25
|
-
if (state.scriptsInserted.includes(script.src)) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
state.scriptsInserted.push(script.src);
|
|
30
|
-
const newScript = document.createElement("script");
|
|
31
|
-
newScript.async = true;
|
|
32
|
-
newScript.src = script.src;
|
|
33
|
-
document.head.appendChild(newScript);
|
|
34
|
-
} else if (
|
|
35
|
-
!script.type ||
|
|
36
|
-
[
|
|
37
|
-
"text/javascript",
|
|
38
|
-
"application/javascript",
|
|
39
|
-
"application/ecmascript",
|
|
40
|
-
].includes(script.type)
|
|
41
|
-
) {
|
|
42
|
-
if (state.scriptsRun.includes(script.innerText)) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
state.scriptsRun.push(script.innerText);
|
|
48
|
-
new Function(script.innerText)();
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
export const CustomCode = component$(
|
|
57
|
-
(props) => {
|
|
58
|
-
const elem = useRef();
|
|
59
|
-
const state = useStore({ scriptsInserted: [], scriptsRun: [] });
|
|
60
|
-
useClientEffect$(() => {
|
|
61
|
-
findAndRunScripts(props, state, elem);
|
|
62
|
-
});
|
|
63
|
-
return (
|
|
64
|
-
<Host
|
|
65
|
-
ref={elem}
|
|
66
|
-
class={
|
|
67
|
-
"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")
|
|
68
|
-
}
|
|
69
|
-
dangerouslySetInnerHTML={props.code}
|
|
70
|
-
></Host>
|
|
71
|
-
);
|
|
72
|
-
},
|
|
73
|
-
{ tagName: "div" }
|
|
74
|
-
);
|
|
75
|
-
export default CustomCode;
|
|
76
|
-
export const COMPONENT = {
|
|
77
|
-
"@type": "@builder.io/mitosis/component",
|
|
78
|
-
imports: [],
|
|
79
|
-
exports: {},
|
|
80
|
-
inputs: [],
|
|
81
|
-
meta: {},
|
|
82
|
-
refs: {
|
|
83
|
-
elem: {
|
|
84
|
-
argument: "",
|
|
85
|
-
typeParameter: "HTMLDivElement",
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
state: {
|
|
89
|
-
scriptsInserted: [],
|
|
90
|
-
scriptsRun: [],
|
|
91
|
-
findAndRunScripts:
|
|
92
|
-
"@builder.io/mitosis/method:findAndRunScripts() {\n // TODO: Move this function to standalone one in '@builder.io/utils'\n if (elem && typeof window !== 'undefined') {\n const scripts = elem.getElementsByTagName('script');\n\n for (let i = 0; i < scripts.length; i++) {\n const script = scripts[i];\n\n if (script.src) {\n if (state.scriptsInserted.includes(script.src)) {\n continue;\n }\n\n state.scriptsInserted.push(script.src);\n const newScript = document.createElement('script');\n newScript.async = true;\n newScript.src = script.src;\n document.head.appendChild(newScript);\n } else if (!script.type || ['text/javascript', 'application/javascript', 'application/ecmascript'].includes(script.type)) {\n if (state.scriptsRun.includes(script.innerText)) {\n continue;\n }\n\n try {\n state.scriptsRun.push(script.innerText);\n new Function(script.innerText)();\n } catch (error) {\n console.warn('`CustomCode`: Error running script:', error);\n }\n }\n }\n }\n}",
|
|
93
|
-
},
|
|
94
|
-
children: [
|
|
95
|
-
{
|
|
96
|
-
"@type": "@builder.io/mitosis/node",
|
|
97
|
-
name: "Host",
|
|
98
|
-
meta: {},
|
|
99
|
-
scope: {},
|
|
100
|
-
properties: {},
|
|
101
|
-
bindings: {
|
|
102
|
-
ref: {
|
|
103
|
-
code: "elem",
|
|
104
|
-
},
|
|
105
|
-
class: {
|
|
106
|
-
code: "'builder-custom-code' + (props.replaceNodes ? ' replace-nodes' : '')",
|
|
107
|
-
},
|
|
108
|
-
innerHTML: {
|
|
109
|
-
code: "props.code",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
children: [],
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
hooks: {
|
|
116
|
-
onMount: {
|
|
117
|
-
code: "\n findAndRunScripts(props,state,elem,);\n",
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
context: {
|
|
121
|
-
get: {},
|
|
122
|
-
set: {},
|
|
123
|
-
},
|
|
124
|
-
name: "CustomCode",
|
|
125
|
-
subComponents: [],
|
|
126
|
-
interfaces: [
|
|
127
|
-
"export interface CustomCodeProps {\n code: string;\n replaceNodes?: boolean;\n}",
|
|
128
|
-
],
|
|
129
|
-
propsTypeRef: "CustomCodeProps",
|
|
130
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { markSerializable } from "../util";
|
|
2
|
-
const componentInfo = {
|
|
3
|
-
name: "Embed",
|
|
4
|
-
static: true,
|
|
5
|
-
builtIn: true,
|
|
6
|
-
inputs: [
|
|
7
|
-
{
|
|
8
|
-
name: "url",
|
|
9
|
-
type: "url",
|
|
10
|
-
required: true,
|
|
11
|
-
defaultValue: "",
|
|
12
|
-
helperText: "e.g. enter a youtube url, google map, etc",
|
|
13
|
-
onChange: markSerializable((options) => {
|
|
14
|
-
const url = options.get("url");
|
|
15
|
-
if (url) {
|
|
16
|
-
options.set("content", "Loading...");
|
|
17
|
-
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
18
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
19
|
-
if (options.get("url") === url) {
|
|
20
|
-
if (data.html) {
|
|
21
|
-
options.set("content", data.html);
|
|
22
|
-
} else {
|
|
23
|
-
options.set("content", "Invalid url, please try another");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}).catch((_err) => {
|
|
27
|
-
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
options.delete("content");
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "content",
|
|
36
|
-
type: "html",
|
|
37
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
38
|
-
hideFromUI: true
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
componentInfo
|
|
44
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import { isJsScript } from "./helpers";
|
|
4
|
-
import {
|
|
5
|
-
Fragment,
|
|
6
|
-
Host,
|
|
7
|
-
component$,
|
|
8
|
-
h,
|
|
9
|
-
useRef,
|
|
10
|
-
useStore,
|
|
11
|
-
useWatch$,
|
|
12
|
-
} from "@builder.io/qwik";
|
|
13
|
-
export const findAndRunScripts = function findAndRunScripts(
|
|
14
|
-
props,
|
|
15
|
-
state,
|
|
16
|
-
elem
|
|
17
|
-
) {
|
|
18
|
-
const scripts = elem.getElementsByTagName("script");
|
|
19
|
-
|
|
20
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
21
|
-
const script = scripts[i];
|
|
22
|
-
|
|
23
|
-
if (script.src && !state.scriptsInserted.includes(script.src)) {
|
|
24
|
-
state.scriptsInserted.push(script.src);
|
|
25
|
-
const newScript = document.createElement("script");
|
|
26
|
-
newScript.async = true;
|
|
27
|
-
newScript.src = script.src;
|
|
28
|
-
document.head.appendChild(newScript);
|
|
29
|
-
} else if (
|
|
30
|
-
isJsScript(script) &&
|
|
31
|
-
!state.scriptsRun.includes(script.innerText)
|
|
32
|
-
) {
|
|
33
|
-
try {
|
|
34
|
-
state.scriptsRun.push(script.innerText);
|
|
35
|
-
new Function(script.innerText)();
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.warn("`Embed`: Error running script:", error);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
export const Embed = component$(
|
|
43
|
-
(props) => {
|
|
44
|
-
const elem = useRef();
|
|
45
|
-
const state = useStore({
|
|
46
|
-
scriptsInserted: [],
|
|
47
|
-
scriptsRun: [],
|
|
48
|
-
ranInitFn: false,
|
|
49
|
-
});
|
|
50
|
-
useWatch$(({ track }) => {
|
|
51
|
-
state && track(state, "ranInitFn");
|
|
52
|
-
if (elem && !state.ranInitFn) {
|
|
53
|
-
state.ranInitFn = true;
|
|
54
|
-
findAndRunScripts(props, state, elem);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return (
|
|
58
|
-
<Host
|
|
59
|
-
class="builder-embed"
|
|
60
|
-
ref={elem}
|
|
61
|
-
dangerouslySetInnerHTML={props.content}
|
|
62
|
-
></Host>
|
|
63
|
-
);
|
|
64
|
-
},
|
|
65
|
-
{ tagName: "div" }
|
|
66
|
-
);
|
|
67
|
-
export default Embed;
|
|
68
|
-
export const COMPONENT = {
|
|
69
|
-
"@type": "@builder.io/mitosis/component",
|
|
70
|
-
imports: [
|
|
71
|
-
{
|
|
72
|
-
imports: {
|
|
73
|
-
isJsScript: "isJsScript",
|
|
74
|
-
},
|
|
75
|
-
path: "./helpers",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
exports: {},
|
|
79
|
-
inputs: [],
|
|
80
|
-
meta: {},
|
|
81
|
-
refs: {
|
|
82
|
-
elem: {
|
|
83
|
-
argument: "",
|
|
84
|
-
typeParameter: "HTMLDivElement",
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
state: {
|
|
88
|
-
scriptsInserted: [],
|
|
89
|
-
scriptsRun: [],
|
|
90
|
-
ranInitFn: false,
|
|
91
|
-
findAndRunScripts:
|
|
92
|
-
"@builder.io/mitosis/method:findAndRunScripts() {\n const scripts = elem.getElementsByTagName('script');\n\n for (let i = 0; i < scripts.length; i++) {\n const script = scripts[i];\n\n if (script.src && !state.scriptsInserted.includes(script.src)) {\n state.scriptsInserted.push(script.src);\n const newScript = document.createElement('script');\n newScript.async = true;\n newScript.src = script.src;\n document.head.appendChild(newScript);\n } else if (isJsScript(script) && !state.scriptsRun.includes(script.innerText)) {\n try {\n state.scriptsRun.push(script.innerText);\n new Function(script.innerText)();\n } catch (error) {\n console.warn('`Embed`: Error running script:', error);\n }\n }\n }\n}",
|
|
93
|
-
},
|
|
94
|
-
children: [
|
|
95
|
-
{
|
|
96
|
-
"@type": "@builder.io/mitosis/node",
|
|
97
|
-
name: "Host",
|
|
98
|
-
meta: {},
|
|
99
|
-
scope: {},
|
|
100
|
-
properties: {
|
|
101
|
-
class: "builder-embed",
|
|
102
|
-
},
|
|
103
|
-
bindings: {
|
|
104
|
-
ref: {
|
|
105
|
-
code: "elem",
|
|
106
|
-
},
|
|
107
|
-
innerHTML: {
|
|
108
|
-
code: "props.content",
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
children: [],
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
hooks: {
|
|
115
|
-
onUpdate: [
|
|
116
|
-
{
|
|
117
|
-
code: "\n if (elem && !state.ranInitFn) {\n state.ranInitFn = true;\n findAndRunScripts(props,state,elem,);\n }\n",
|
|
118
|
-
deps: "[elem, state.ranInitFn]",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
context: {
|
|
123
|
-
get: {},
|
|
124
|
-
set: {},
|
|
125
|
-
},
|
|
126
|
-
name: "Embed",
|
|
127
|
-
subComponents: [],
|
|
128
|
-
interfaces: ["export interface EmbedProps {\n content: string;\n}"],
|
|
129
|
-
propsTypeRef: "EmbedProps",
|
|
130
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// GENERATED BY MITOSIS
|
|
2
|
-
|
|
3
|
-
import { Fragment, Host, component$, h } from "@builder.io/qwik";
|
|
4
|
-
export const BuilderBlocks = component$((props) => {
|
|
5
|
-
return (
|
|
6
|
-
<Host q:host-pseudo="">
|
|
7
|
-
<Fragment>
|
|
8
|
-
NOT YET IMPLEMENTED: <code>BuilderBlocks</code>
|
|
9
|
-
</Fragment>
|
|
10
|
-
</Host>
|
|
11
|
-
);
|
|
12
|
-
});
|
|
13
|
-
export default BuilderBlocks;
|
|
14
|
-
export const COMPONENT = {
|
|
15
|
-
"@type": "@builder.io/mitosis/component",
|
|
16
|
-
imports: [],
|
|
17
|
-
exports: {},
|
|
18
|
-
inputs: [],
|
|
19
|
-
meta: {},
|
|
20
|
-
refs: {},
|
|
21
|
-
state: {},
|
|
22
|
-
children: [
|
|
23
|
-
{
|
|
24
|
-
"@type": "@builder.io/mitosis/node",
|
|
25
|
-
name: "Host",
|
|
26
|
-
meta: {},
|
|
27
|
-
scope: {},
|
|
28
|
-
properties: {
|
|
29
|
-
"q:host-pseudo": "",
|
|
30
|
-
},
|
|
31
|
-
bindings: {},
|
|
32
|
-
children: [
|
|
33
|
-
{
|
|
34
|
-
"@type": "@builder.io/mitosis/node",
|
|
35
|
-
name: "Fragment",
|
|
36
|
-
meta: {},
|
|
37
|
-
scope: {},
|
|
38
|
-
properties: {},
|
|
39
|
-
bindings: {},
|
|
40
|
-
children: [
|
|
41
|
-
{
|
|
42
|
-
"@type": "@builder.io/mitosis/node",
|
|
43
|
-
name: "div",
|
|
44
|
-
meta: {},
|
|
45
|
-
scope: {},
|
|
46
|
-
properties: {
|
|
47
|
-
_text: "\n NOT YET IMPLEMENTED: ",
|
|
48
|
-
},
|
|
49
|
-
bindings: {},
|
|
50
|
-
children: [],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"@type": "@builder.io/mitosis/node",
|
|
54
|
-
name: "code",
|
|
55
|
-
meta: {},
|
|
56
|
-
scope: {},
|
|
57
|
-
properties: {},
|
|
58
|
-
bindings: {},
|
|
59
|
-
children: [
|
|
60
|
-
{
|
|
61
|
-
"@type": "@builder.io/mitosis/node",
|
|
62
|
-
name: "div",
|
|
63
|
-
meta: {},
|
|
64
|
-
scope: {},
|
|
65
|
-
properties: {
|
|
66
|
-
_text: "BuilderBlocks",
|
|
67
|
-
},
|
|
68
|
-
bindings: {},
|
|
69
|
-
children: [],
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"@type": "@builder.io/mitosis/node",
|
|
75
|
-
name: "div",
|
|
76
|
-
meta: {},
|
|
77
|
-
scope: {},
|
|
78
|
-
properties: {
|
|
79
|
-
_text: "\n ",
|
|
80
|
-
},
|
|
81
|
-
bindings: {},
|
|
82
|
-
children: [],
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
hooks: {},
|
|
90
|
-
context: {
|
|
91
|
-
get: {},
|
|
92
|
-
set: {},
|
|
93
|
-
},
|
|
94
|
-
name: "BuilderBlocks",
|
|
95
|
-
subComponents: [],
|
|
96
|
-
interfaces: [
|
|
97
|
-
"export interface BuilderBlocksProps {\n dataPath: string;\n blocks: any;\n}",
|
|
98
|
-
],
|
|
99
|
-
propsTypeRef: "BuilderBlocksProps",
|
|
100
|
-
};
|