@builder.io/sdk-vue 0.0.1-9 → 0.0.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/package.json +42 -5
- package/src/blocks/button.js +0 -31
- package/src/blocks/button.original.vue +0 -48
- package/src/blocks/button_script.js +0 -21
- package/src/blocks/button_styles.js +0 -0
- package/src/blocks/columns.js +0 -31
- package/src/blocks/columns.original.vue +0 -59
- package/src/blocks/columns_script.js +0 -58
- package/src/blocks/columns_styles.js +0 -14
- package/src/blocks/custom-code.js +0 -31
- package/src/blocks/custom-code.original.vue +0 -72
- package/src/blocks/custom-code_script.js +0 -63
- package/src/blocks/custom-code_styles.js +0 -0
- package/src/blocks/embed.js +0 -31
- package/src/blocks/embed.original.vue +0 -64
- package/src/blocks/embed_script.js +0 -53
- package/src/blocks/embed_styles.js +0 -0
- package/src/blocks/form.js +0 -31
- package/src/blocks/form.original.vue +0 -289
- package/src/blocks/form_script.js +0 -231
- package/src/blocks/form_styles.js +0 -12
- package/src/blocks/fragment.js +0 -31
- package/src/blocks/fragment.original.vue +0 -28
- package/src/blocks/fragment_script.js +0 -40
- package/src/blocks/fragment_styles.js +0 -0
- package/src/blocks/image.js +0 -31
- package/src/blocks/image.original.vue +0 -52
- package/src/blocks/image_script.js +0 -32
- package/src/blocks/image_styles.js +0 -13
- package/src/blocks/img.js +0 -31
- package/src/blocks/img.original.vue +0 -31
- package/src/blocks/img_script.js +0 -42
- package/src/blocks/img_styles.js +0 -0
- package/src/blocks/input.js +0 -31
- package/src/blocks/input.original.vue +0 -28
- package/src/blocks/input_script.js +0 -39
- package/src/blocks/input_styles.js +0 -0
- package/src/blocks/raw-text.js +0 -31
- package/src/blocks/raw-text.original.vue +0 -35
- package/src/blocks/raw-text_script.js +0 -32
- package/src/blocks/raw-text_styles.js +0 -0
- package/src/blocks/section.js +0 -31
- package/src/blocks/section.original.vue +0 -29
- package/src/blocks/section_script.js +0 -23
- package/src/blocks/section_styles.js +0 -0
- package/src/blocks/select.js +0 -31
- package/src/blocks/select.original.vue +0 -32
- package/src/blocks/select_script.js +0 -41
- package/src/blocks/select_styles.js +0 -0
- package/src/blocks/submit-button.js +0 -31
- package/src/blocks/submit-button.original.vue +0 -27
- package/src/blocks/submit-button_script.js +0 -21
- package/src/blocks/submit-button_styles.js +0 -0
- package/src/blocks/symbol.js +0 -29
- package/src/blocks/symbol.original.vue +0 -33
- package/src/blocks/symbol_script.js +0 -44
- package/src/blocks/symbol_styles.js +0 -0
- package/src/blocks/text.js +0 -31
- package/src/blocks/text.original.vue +0 -25
- package/src/blocks/text_script.js +0 -21
- package/src/blocks/text_styles.js +0 -0
- package/src/blocks/textarea.js +0 -31
- package/src/blocks/textarea.original.vue +0 -25
- package/src/blocks/textarea_script.js +0 -21
- package/src/blocks/textarea_styles.js +0 -0
- package/src/blocks/video.js +0 -31
- package/src/blocks/video.original.vue +0 -34
- package/src/blocks/video_script.js +0 -28
- package/src/blocks/video_styles.js +0 -0
- package/src/components/block-styles.js +0 -29
- package/src/components/block-styles.original.vue +0 -25
- package/src/components/block-styles.vue +0 -34
- package/src/components/block-styles_script.js +0 -20
- package/src/components/block-styles_styles.js +0 -0
- package/src/components/error-boundary.js +0 -29
- package/src/components/error-boundary.original.vue +0 -25
- package/src/components/error-boundary.vue +0 -15
- package/src/components/error-boundary_script.js +0 -20
- package/src/components/error-boundary_styles.js +0 -0
- package/src/components/render-block.js +0 -29
- package/src/components/render-block.original.vue +0 -119
- package/src/components/render-block_script.js +0 -91
- package/src/components/render-block_styles.js +0 -0
- package/src/components/render-blocks.js +0 -29
- package/src/components/render-blocks.original.vue +0 -75
- package/src/components/render-blocks_script.js +0 -76
- package/src/components/render-blocks_styles.js +0 -12
- package/src/components/render-content.js +0 -29
- package/src/components/render-content.original.vue +0 -95
- package/src/components/render-content_script.js +0 -92
- package/src/components/render-content_styles.js +0 -0
- package/src/constants/device-sizes.js +0 -46
- package/src/context/builder.context.js +0 -11
- package/src/functions/evaluate.js +0 -42
- package/src/functions/get-block-actions.js +0 -45
- package/src/functions/get-block-component-options.js +0 -14
- package/src/functions/get-block-properties.js +0 -46
- package/src/functions/get-block-styles.js +0 -13
- package/src/functions/get-block-tag.js +0 -13
- package/src/functions/get-content.js +0 -123
- package/src/functions/get-processed-block.js +0 -65
- package/src/functions/get-processed-block.test.js +0 -44
- package/src/functions/get-target.js +0 -13
- package/src/functions/if-target.js +0 -13
- package/src/functions/is-browser.js +0 -30
- package/src/functions/is-editing.js +0 -30
- package/src/functions/is-iframe.js +0 -30
- package/src/functions/is-react-native.js +0 -13
- package/src/functions/macro-eval.js +0 -12
- package/src/functions/on-change.js +0 -34
- package/src/functions/on-change.test.js +0 -38
- package/src/functions/register-component.js +0 -73
- package/src/functions/register.js +0 -52
- package/src/functions/set-editor-settings.js +0 -38
- package/src/functions/set.js +0 -18
- package/src/functions/set.test.js +0 -35
- package/src/functions/track.js +0 -41
- package/src/index.js +0 -51
- package/src/scripts/init-editing.js +0 -78
- 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/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Builder.io Vue 2.0 SDK (BETA)
|
|
2
|
+
|
|
3
|
+
This is the 2.0 Vue SDK. It is currently in beta.
|
|
4
|
+
|
|
5
|
+
NOTE: If you are looking for the stable 1.0 Vue SDK, you can find it [here](/packages/vue)
|
|
6
|
+
|
|
7
|
+
## Mitosis
|
|
8
|
+
|
|
9
|
+
This SDK is generated by [Mitosis](https://github.com/BuilderIO/mitosis). To see the Mitosis source-code, go [here](../../).
|
|
10
|
+
|
|
11
|
+
## Feature Support
|
|
12
|
+
|
|
13
|
+
To check the status of the SDK, look at [these tables](../../README.md#feature-implementation).
|
|
14
|
+
|
|
15
|
+
## Version Support
|
|
16
|
+
|
|
17
|
+
Legend:
|
|
18
|
+
|
|
19
|
+
- ✅: implemented
|
|
20
|
+
- 🏗: currently in progress
|
|
21
|
+
- ⚠️: not-yet implemented
|
|
22
|
+
- N/A : does not apply
|
|
23
|
+
|
|
24
|
+
| Platform | Support |
|
|
25
|
+
| -------- | ------- |
|
|
26
|
+
| Vue 2 | 🏗 |
|
|
27
|
+
| Nuxt 2 | 🏗 |
|
|
28
|
+
| Vue 3 | 🏗 |
|
|
29
|
+
| Nuxt 3 | ✅ |
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
npm install @builder.io/sdk-vue@dev
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
You can see examples of using Builder.io:
|
|
40
|
+
|
|
41
|
+
- with Vue 2 [here](/examples/vue/vue-2/)
|
|
42
|
+
- with Nuxt 2 [here](/examples/vue/nuxt-2/)
|
|
43
|
+
- with Vue Storefront 2 [here](/examples/vue/vue-storefront-2)
|
|
44
|
+
- with Vue 3 [here](/examples/vue/vue-3/)
|
package/package.json
CHANGED
|
@@ -1,16 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-vue",
|
|
3
3
|
"description": "Builder.io SDK for Vue",
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
"workspaces": [
|
|
5
|
+
"packages/*"
|
|
6
|
+
],
|
|
7
|
+
"version": "0.0.2-0",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"node-fetch": "^2.6.1"
|
|
10
|
+
},
|
|
11
|
+
"main": "./packages/_vue2/dist/sdk.js",
|
|
12
|
+
"module": "./packages/_vue2/dist/sdk.js",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./packages/_vue2/dist/sdk.js",
|
|
20
|
+
"require": "./packages/_vue2/dist/sdk.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./vue2": {
|
|
23
|
+
"import": "./packages/_vue2/dist/sdk.js",
|
|
24
|
+
"require": "./packages/_vue2/dist/sdk.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./vue3": {
|
|
27
|
+
"import": "./packages/_vue3/dist/sdk.js",
|
|
28
|
+
"require": "./packages/_vue3/dist/sdk.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./nuxt": {
|
|
31
|
+
"import": "./nuxt.js",
|
|
32
|
+
"require": "./nuxt.js"
|
|
33
|
+
},
|
|
34
|
+
"./nuxt2": {
|
|
35
|
+
"import": "./nuxt.js",
|
|
36
|
+
"require": "./nuxt.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
7
39
|
"scripts": {
|
|
8
|
-
"
|
|
40
|
+
"clear-dist": "rm -rf dist && mkdir dist",
|
|
41
|
+
"add-debug": "bash ./scripts/add-debug.sh",
|
|
42
|
+
"remove-debug": "bash ./scripts/remove-debug.sh",
|
|
43
|
+
"build": "yarn run clear-dist && yarn workspaces foreach run build",
|
|
44
|
+
"release:patch": "yarn run build && npm version patch --no-git-tag-version && npm publish --access public",
|
|
45
|
+
"release:dev": "yarn run build && npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
9
46
|
},
|
|
10
47
|
"peerDependencies": {
|
|
11
48
|
"vue": ">= 2"
|
|
12
49
|
},
|
|
13
50
|
"devDependencies": {
|
|
14
|
-
"vue": "^2.
|
|
51
|
+
"vue": "^2.7"
|
|
15
52
|
}
|
|
16
53
|
}
|
package/src/blocks/button.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
26
|
-
});
|
|
27
|
-
var import_button_script = __toModule(require("./button_script"));
|
|
28
|
-
var import_button_styles = __toModule(require("./button_styles"));
|
|
29
|
-
var import_register_component = __toModule(require("../functions/register-component"));
|
|
30
|
-
(0, import_register_component.registerComponent)(import_button_script.default, { name: "Core:Button", image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13", defaultStyles: { appearance: "none", paddingTop: "15px", paddingBottom: "15px", paddingLeft: "25px", paddingRight: "25px", backgroundColor: "#3898EC", 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 });
|
|
31
|
-
var stdin_default = import_button_script.default;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<template v-if="link">
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<a v-bind="attributes" :href="link" :target="openLinkInNewTab ? '_blank' : undefined" >
|
|
8
|
-
{{text}}
|
|
9
|
-
</a>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<template v-if="!link">
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<button v-bind="attributes" type="button" >
|
|
19
|
-
{{text}}
|
|
20
|
-
</button>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</template>
|
|
27
|
-
<script>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
name: 'Button',
|
|
35
|
-
|
|
36
|
-
props: ["link","attributes","openLinkInNewTab","text"],
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
</script>
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
10
|
-
});
|
|
11
|
-
var stdin_default = {
|
|
12
|
-
render: function() {
|
|
13
|
-
var _vm = this;
|
|
14
|
-
var _h = _vm.$createElement;
|
|
15
|
-
var _c = _vm._self._c || _h;
|
|
16
|
-
return _vm.link ? [_c("a", _vm._b({ attrs: { "href": _vm.link, "target": _vm.openLinkInNewTab ? "_blank" : void 0 } }, "a", _vm.attributes, false), [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])] : _vm._e();
|
|
17
|
-
},
|
|
18
|
-
staticRenderFns: [],
|
|
19
|
-
name: "Button",
|
|
20
|
-
props: ["link", "attributes", "openLinkInNewTab", "text"]
|
|
21
|
-
};
|
|
File without changes
|
package/src/blocks/columns.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
26
|
-
});
|
|
27
|
-
var import_columns_script = __toModule(require("./columns_script"));
|
|
28
|
-
var import_columns_styles = __toModule(require("./columns_styles"));
|
|
29
|
-
var import_register_component = __toModule(require("../functions/register-component"));
|
|
30
|
-
(0, import_register_component.registerComponent)(import_columns_script.default, { name: "Columns", inputs: [{ name: "columns", type: "array", broadcast: true, subFields: [{ name: "blocks", type: "array", hideFromUI: true, defaultValue: [{ "@type": "@builder.io/sdk:Element", responsiveStyles: { large: { display: "flex", flexDirection: "column", alignItems: "stretch", flexShrink: "0", position: "relative", marginTop: "30px", textAlign: "center", lineHeight: "normal", height: "auto", minHeight: "20px", minWidth: "20px", overflow: "hidden" } }, component: { name: "Image", options: { image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d", backgroundPosition: "center", backgroundSize: "cover", aspectRatio: 0.7004048582995948 } } }, { "@type": "@builder.io/sdk:Element", responsiveStyles: { large: { display: "flex", flexDirection: "column", alignItems: "stretch", flexShrink: "0", position: "relative", marginTop: "30px", textAlign: "center", lineHeight: "normal", height: "auto" } }, component: { name: "Text", options: { text: "<p>Enter some text...</p>" } } }] }, { name: "width", type: "number", hideFromUI: true, helperText: "Width %, e.g. set to 50 to fill half of the space" }, { name: "link", type: "url", helperText: "Optionally set a url that clicking this column will link to" }], defaultValue: [{ blocks: [{ "@type": "@builder.io/sdk:Element", responsiveStyles: { large: { display: "flex", flexDirection: "column", alignItems: "stretch", flexShrink: "0", position: "relative", marginTop: "30px", textAlign: "center", lineHeight: "normal", height: "auto", minHeight: "20px", minWidth: "20px", overflow: "hidden" } }, component: { name: "Image", options: { image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d", backgroundPosition: "center", backgroundSize: "cover", aspectRatio: 0.7004048582995948 } } }, { "@type": "@builder.io/sdk:Element", responsiveStyles: { large: { display: "flex", flexDirection: "column", alignItems: "stretch", flexShrink: "0", position: "relative", marginTop: "30px", textAlign: "center", lineHeight: "normal", height: "auto" } }, component: { name: "Text", options: { text: "<p>Enter some text...</p>" } } }] }, { blocks: [{ "@type": "@builder.io/sdk:Element", responsiveStyles: { large: { display: "flex", flexDirection: "column", alignItems: "stretch", flexShrink: "0", position: "relative", marginTop: "30px", textAlign: "center", lineHeight: "normal", height: "auto", minHeight: "20px", minWidth: "20px", overflow: "hidden" } }, component: { name: "Image", options: { image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d", backgroundPosition: "center", backgroundSize: "cover", aspectRatio: 0.7004048582995948 } } }, { "@type": "@builder.io/sdk:Element", responsiveStyles: { large: { display: "flex", flexDirection: "column", alignItems: "stretch", flexShrink: "0", position: "relative", marginTop: "30px", textAlign: "center", lineHeight: "normal", height: "auto" } }, component: { name: "Text", options: { text: "<p>Enter some text...</p>" } } }] }], onChange: " function clearWidths() { columns.forEach(col => { col.delete('width'); }); } const columns = options.get('columns') as Array<Map<String, any>>; if (Array.isArray(columns)) { const containsColumnWithWidth = !!columns.find(col => col.get('width')); if (containsColumnWithWidth) { const containsColumnWithoutWidth = !!columns.find(col => !col.get('width')); if (containsColumnWithoutWidth) { clearWidths(); } else { const sumWidths = columns.reduce((memo, col) => { return memo + col.get('width'); }, 0); const widthsDontAddUp = sumWidths !== 100; if (widthsDontAddUp) { clearWidths(); } } } } " }, { name: "space", type: "number", defaultValue: 20, helperText: "Size of gap between columns", advanced: true }, { name: "stackColumnsAt", type: "string", defaultValue: "tablet", helperText: "Convert horizontal columns to vertical at what device size", enum: ["tablet", "mobile", "never"], advanced: true }, { name: "reverseColumnsWhenStacked", type: "boolean", defaultValue: false, helperText: "When stacking columns for mobile devices, reverse the ordering", advanced: true }] });
|
|
31
|
-
var stdin_default = import_columns_script.default;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="builder-columns div" >
|
|
3
|
-
<template :key="index" v-for="(column, index) in columns">
|
|
4
|
-
<div class="builder-column div-2" :style="{
|
|
5
|
-
width: getColumnCssWidth(index),
|
|
6
|
-
marginLeft: index === 0 ? 0 : getGutterSize()
|
|
7
|
-
}" >
|
|
8
|
-
<RenderBlocks :blocks="column.blocks" ></RenderBlocks>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<script>
|
|
14
|
-
|
|
15
|
-
import RenderBlocks, { } from '../components/render-blocks.lite';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
name: 'Columns',
|
|
22
|
-
components: { RenderBlocks },
|
|
23
|
-
props: ["space","columns"],
|
|
24
|
-
|
|
25
|
-
data: () => ({RenderBlocks}),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
methods: { getGutterSize() {
|
|
37
|
-
return typeof this.space === 'number' ? this.space || 0 : 20;
|
|
38
|
-
} , getColumns() {
|
|
39
|
-
return this.columns || [];
|
|
40
|
-
} , getWidth(index) {
|
|
41
|
-
const columns = this.getColumns();
|
|
42
|
-
return columns[index] && columns[index].width || 100 / columns.length;
|
|
43
|
-
} , getColumnCssWidth(index) {
|
|
44
|
-
const columns = this.getColumns();
|
|
45
|
-
const gutterSize = this.getGutterSize();
|
|
46
|
-
const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
|
|
47
|
-
return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
|
|
48
|
-
} ,},
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
</script>
|
|
52
|
-
<style>
|
|
53
|
-
.div {
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
align-items: stretch;
|
|
57
|
-
line-height: normal; }.div-2 {
|
|
58
|
-
flex-grow: 1; }
|
|
59
|
-
</style>
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
26
|
-
});
|
|
27
|
-
var import_render_blocks = __toModule(require("../components/render-blocks"));
|
|
28
|
-
var stdin_default = {
|
|
29
|
-
render: function() {
|
|
30
|
-
var _vm = this;
|
|
31
|
-
var _h = _vm.$createElement;
|
|
32
|
-
var _c = _vm._self._c || _h;
|
|
33
|
-
return _c("div", { staticClass: "builder-columns div" }, [_vm._l(_vm.columns, function(column, index) {
|
|
34
|
-
return [_c("div", { staticClass: "builder-column div-2", style: {
|
|
35
|
-
width: _vm.getColumnCssWidth(index),
|
|
36
|
-
marginLeft: index === 0 ? 0 : _vm.getGutterSize()
|
|
37
|
-
} }, [_c("renderblocks", { attrs: { "blocks": column.blocks } })], 1)];
|
|
38
|
-
})], 2);
|
|
39
|
-
},
|
|
40
|
-
staticRenderFns: [],
|
|
41
|
-
name: "Columns",
|
|
42
|
-
components: { RenderBlocks: import_render_blocks.default },
|
|
43
|
-
props: ["space", "columns"],
|
|
44
|
-
data: () => ({ RenderBlocks: import_render_blocks.default }),
|
|
45
|
-
methods: { getGutterSize() {
|
|
46
|
-
return typeof this.space === "number" ? this.space || 0 : 20;
|
|
47
|
-
}, getColumns() {
|
|
48
|
-
return this.columns || [];
|
|
49
|
-
}, getWidth(index) {
|
|
50
|
-
const columns = this.getColumns();
|
|
51
|
-
return columns[index] && columns[index].width || 100 / columns.length;
|
|
52
|
-
}, getColumnCssWidth(index) {
|
|
53
|
-
const columns = this.getColumns();
|
|
54
|
-
const gutterSize = this.getGutterSize();
|
|
55
|
-
const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
|
|
56
|
-
return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
|
|
57
|
-
} }
|
|
58
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const id = "98o8q0q8zt";
|
|
2
|
-
if (typeof document !== "undefined") {
|
|
3
|
-
if (!document.getElementById(id)) {
|
|
4
|
-
const style = document.createElement("style");
|
|
5
|
-
style.id = id;
|
|
6
|
-
style.innerHTML = `.div {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
align-items: stretch;
|
|
10
|
-
line-height: normal; }.div-2 {
|
|
11
|
-
flex-grow: 1; }`;
|
|
12
|
-
document.head.appendChild(style);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
26
|
-
});
|
|
27
|
-
var import_custom_code_script = __toModule(require("./custom-code_script"));
|
|
28
|
-
var import_custom_code_styles = __toModule(require("./custom-code_styles"));
|
|
29
|
-
var import_register_component = __toModule(require("../functions/register-component"));
|
|
30
|
-
(0, import_register_component.registerComponent)(import_custom_code_script.default, { name: "Custom Code", static: true, requiredPermissions: ["editCode"], inputs: [{ name: "code", type: "html", required: true, defaultValue: "<p>Hello there, I am custom HTML code!</p>", code: true }, { name: "replaceNodes", type: "boolean", helperText: "Preserve server rendered dom nodes", advanced: true }, { name: "scriptsClientOnly", type: "boolean", defaultValue: false, helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads", advanced: true }] });
|
|
31
|
-
var stdin_default = import_custom_code_script.default;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="elem" :class="_classStringToObject('builder-custom-code' + (props.replaceNodes ? ' replace-nodes' : ''))" v-html="code" ></div>
|
|
3
|
-
</template>
|
|
4
|
-
<script>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
name: 'CustomCode',
|
|
12
|
-
|
|
13
|
-
props: ["replaceNodes","code"],
|
|
14
|
-
|
|
15
|
-
data: () => ({ scriptsInserted: [], scriptsRun: [], }),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mounted() {
|
|
22
|
-
this.findAndRunScripts()
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
methods: { findAndRunScripts() {
|
|
29
|
-
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
30
|
-
if (this.$refs.elem && typeof window !== 'undefined') {
|
|
31
|
-
/** @type {HTMLScriptElement[]} */
|
|
32
|
-
const scripts = this.$refs.elem.getElementsByTagName('script');
|
|
33
|
-
|
|
34
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
35
|
-
const script = scripts[i];
|
|
36
|
-
|
|
37
|
-
if (script.src) {
|
|
38
|
-
if (this.scriptsInserted.includes(script.src)) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.scriptsInserted.push(script.src);
|
|
43
|
-
const newScript = document.createElement('script');
|
|
44
|
-
newScript.async = true;
|
|
45
|
-
newScript.src = script.src;
|
|
46
|
-
document.head.appendChild(newScript);
|
|
47
|
-
} else if (!script.type || ['text/javascript', 'application/javascript', 'application/ecmascript'].includes(script.type)) {
|
|
48
|
-
if (this.scriptsRun.includes(script.innerText)) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
this.scriptsRun.push(script.innerText);
|
|
54
|
-
new Function(script.innerText)();
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.warn('`CustomCode`: Error running script:', error);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} ,_classStringToObject(str) {
|
|
62
|
-
const obj = {};
|
|
63
|
-
if (typeof str !== 'string') { return obj }
|
|
64
|
-
const classNames = str.trim().split(/\s+/);
|
|
65
|
-
for (const name of classNames) {
|
|
66
|
-
obj[name] = true;
|
|
67
|
-
}
|
|
68
|
-
return obj;
|
|
69
|
-
} },
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
</script>
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
10
|
-
});
|
|
11
|
-
var stdin_default = {
|
|
12
|
-
render: function() {
|
|
13
|
-
var _vm = this;
|
|
14
|
-
var _h = _vm.$createElement;
|
|
15
|
-
var _c = _vm._self._c || _h;
|
|
16
|
-
return _c("div", { ref: "elem", class: _vm._classStringToObject("builder-custom-code" + (_vm.props.replaceNodes ? " replace-nodes" : "")), domProps: { "innerHTML": _vm._s(_vm.code) } });
|
|
17
|
-
},
|
|
18
|
-
staticRenderFns: [],
|
|
19
|
-
name: "CustomCode",
|
|
20
|
-
props: ["replaceNodes", "code"],
|
|
21
|
-
data: () => ({ scriptsInserted: [], scriptsRun: [] }),
|
|
22
|
-
mounted() {
|
|
23
|
-
this.findAndRunScripts();
|
|
24
|
-
},
|
|
25
|
-
methods: { findAndRunScripts() {
|
|
26
|
-
if (this.$refs.elem && typeof window !== "undefined") {
|
|
27
|
-
const scripts = this.$refs.elem.getElementsByTagName("script");
|
|
28
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
29
|
-
const script = scripts[i];
|
|
30
|
-
if (script.src) {
|
|
31
|
-
if (this.scriptsInserted.includes(script.src)) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
this.scriptsInserted.push(script.src);
|
|
35
|
-
const newScript = document.createElement("script");
|
|
36
|
-
newScript.async = true;
|
|
37
|
-
newScript.src = script.src;
|
|
38
|
-
document.head.appendChild(newScript);
|
|
39
|
-
} else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
|
|
40
|
-
if (this.scriptsRun.includes(script.innerText)) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
this.scriptsRun.push(script.innerText);
|
|
45
|
-
new Function(script.innerText)();
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.warn("`CustomCode`: Error running script:", error);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, _classStringToObject(str) {
|
|
53
|
-
const obj = {};
|
|
54
|
-
if (typeof str !== "string") {
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
const classNames = str.trim().split(/\s+/);
|
|
58
|
-
for (const name of classNames) {
|
|
59
|
-
obj[name] = true;
|
|
60
|
-
}
|
|
61
|
-
return obj;
|
|
62
|
-
} }
|
|
63
|
-
};
|
|
File without changes
|
package/src/blocks/embed.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
default: () => stdin_default
|
|
26
|
-
});
|
|
27
|
-
var import_embed_script = __toModule(require("./embed_script"));
|
|
28
|
-
var import_embed_styles = __toModule(require("./embed_styles"));
|
|
29
|
-
var import_register_component = __toModule(require("../functions/register-component"));
|
|
30
|
-
(0, import_register_component.registerComponent)(import_embed_script.default, { name: "Embed", static: true, inputs: [{ name: "url", type: "url", required: true, defaultValue: "", helperText: "e.g. enter a youtube url, google map, etc", onChange: " const url = options.get('url'); if (url) { options.set('content', 'Loading...'); // TODO: get this out of here! const apiKey = 'ae0e60e78201a3f2b0de4b'; return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`) .then(res => res.json()) .then(data => { if (options.get('url') === url) { if (data.html) { options.set('content', data.html); } else { options.set('content', 'Invalid url, please try another'); } } }) .catch(err => { options.set( 'content', 'There was an error embedding this URL, please try again or another URL' ); }); } else { options.delete('content'); } " }, { name: "content", type: "html", defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>', hideFromUI: true }] });
|
|
31
|
-
var stdin_default = import_embed_script.default;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="builder-embed" ref="elem" v-html="content" ></div>
|
|
3
|
-
</template>
|
|
4
|
-
<script>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
name: 'Embed',
|
|
12
|
-
|
|
13
|
-
props: ["content"],
|
|
14
|
-
|
|
15
|
-
data: () => ({ scriptsInserted: [], scriptsRun: [], }),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mounted() {
|
|
22
|
-
this.findAndRunScripts()
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
methods: { findAndRunScripts() {
|
|
29
|
-
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
30
|
-
if (this.$refs.elem && typeof window !== 'undefined') {
|
|
31
|
-
/** @type {HTMLScriptElement[]} */
|
|
32
|
-
const scripts = this.$refs.elem.getElementsByTagName('script');
|
|
33
|
-
|
|
34
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
35
|
-
const script = scripts[i];
|
|
36
|
-
|
|
37
|
-
if (script.src) {
|
|
38
|
-
if (this.scriptsInserted.includes(script.src)) {
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.scriptsInserted.push(script.src);
|
|
43
|
-
const newScript = document.createElement('script');
|
|
44
|
-
newScript.async = true;
|
|
45
|
-
newScript.src = script.src;
|
|
46
|
-
document.head.appendChild(newScript);
|
|
47
|
-
} else if (!script.type || ['text/javascript', 'application/javascript', 'application/ecmascript'].includes(script.type)) {
|
|
48
|
-
if (this.scriptsRun.includes(script.innerText)) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
this.scriptsRun.push(script.innerText);
|
|
54
|
-
new Function(script.innerText)();
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.warn('`Embed`: Error running script:', error);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
} ,},
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
</script>
|