@builder.io/sdk-vue 0.0.1-65 → 0.0.1-68

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-vue",
3
3
  "description": "Builder.io SDK for Vue",
4
- "version": "0.0.1-65",
4
+ "version": "0.0.1-68",
5
5
  "dependencies": {
6
6
  "node-fetch": "^2.6.1"
7
7
  },
@@ -8,7 +8,9 @@
8
8
  >
9
9
  {{ text }}
10
10
  </a>
11
- <span v-bind="attributes" v-else>{{ text }}</span>
11
+ <button v-bind="attributes" class="button-16nol0lwi20" v-else>
12
+ {{ text }}
13
+ </button>
12
14
  </template>
13
15
  <script>
14
16
  export default {
@@ -17,3 +19,8 @@ export default {
17
19
  props: ["attributes", "text", "link", "openLinkInNewTab"],
18
20
  };
19
21
  </script>
22
+ <style scoped>
23
+ .button-16nol0lwi20 {
24
+ all: unset;
25
+ }
26
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="builder-columns div-20351ewpue7" :style="columnsCssVars">
2
+ <div class="builder-columns div-2fnk003dqad" :style="columnsCssVars">
3
3
  <div
4
- class="builder-column div-20351ewpue7-2"
4
+ class="builder-column div-2fnk003dqad-2"
5
5
  v-for="(column, index) in columns"
6
6
  :style="{
7
7
  width: getColumnCssWidth(index),
@@ -10,7 +10,11 @@
10
10
  }"
11
11
  :key="index"
12
12
  >
13
- <render-blocks :blocks="column.blocks"></render-blocks>
13
+ <render-blocks
14
+ :blocks="column.blocks"
15
+ :path="`component.options.columns.${index}.blocks`"
16
+ :parent="builderBlock.id"
17
+ ></render-blocks>
14
18
  </div>
15
19
  </div>
16
20
  </template>
@@ -20,7 +24,13 @@ const RenderBlocks = () => import("../../components/render-blocks.vue");
20
24
  export default {
21
25
  name: "builder-columns",
22
26
  components: { "render-blocks": RenderBlocks },
23
- props: ["space", "columns", "stackColumnsAt", "reverseColumnsWhenStacked"],
27
+ props: [
28
+ "space",
29
+ "columns",
30
+ "stackColumnsAt",
31
+ "reverseColumnsWhenStacked",
32
+ "builderBlock",
33
+ ],
24
34
 
25
35
  computed: {
26
36
  columnsCssVars() {
@@ -74,32 +84,32 @@ export default {
74
84
  };
75
85
  </script>
76
86
  <style scoped>
77
- .div-20351ewpue7 {
87
+ .div-2fnk003dqad {
78
88
  display: flex;
79
89
  align-items: stretch;
80
90
  line-height: normal;
81
91
  }
82
- @media (max-width: 999px) {
83
- .div-20351ewpue7 {
92
+ @media (max-width: 991px) {
93
+ .div-2fnk003dqad {
84
94
  flex-direction: var(--flex-dir-tablet);
85
95
  }
86
96
  }
87
97
  @media (max-width: 639px) {
88
- .div-20351ewpue7 {
98
+ .div-2fnk003dqad {
89
99
  flex-direction: var(--flex-dir);
90
100
  }
91
101
  }
92
- .div-20351ewpue7-2 {
102
+ .div-2fnk003dqad-2 {
93
103
  flex-grow: 1;
94
104
  }
95
- @media (max-width: 999px) {
96
- .div-20351ewpue7-2 {
105
+ @media (max-width: 991px) {
106
+ .div-2fnk003dqad-2 {
97
107
  width: var(--column-width-tablet) !important;
98
108
  margin-left: var(--column-margin-left-tablet) !important;
99
109
  }
100
110
  }
101
111
  @media (max-width: 639px) {
102
- .div-20351ewpue7-2 {
112
+ .div-2fnk003dqad-2 {
103
113
  width: var(--column-width) !important;
104
114
  margin-left: var(--column-margin-left) !important;
105
115
  }
@@ -23,7 +23,7 @@ export default {
23
23
  computed: {
24
24
  onUpdateHook0() {
25
25
  return {
26
- 0: elem,
26
+ 0: this.$refs.elem,
27
27
  1: this.ranInitFn,
28
28
  };
29
29
  },
@@ -28,7 +28,7 @@
28
28
  ></builder-blocks>
29
29
 
30
30
  <pre
31
- class="builder-form-error-text pre-1ifnufbde19"
31
+ class="builder-form-error-text pre-2brhoa1k8gd"
32
32
  v-if="submissionState === 'error' && responseData"
33
33
  >
34
34
  {{ JSON.stringify(responseData, null, 2) }}
@@ -301,7 +301,7 @@ export default {
301
301
  };
302
302
  </script>
303
303
  <style scoped>
304
- .pre-1ifnufbde19 {
304
+ .pre-2brhoa1k8gd {
305
305
  padding: 10px;
306
306
  color: red;
307
307
  text-align: center;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="div-cvp1sc2nsao">
2
+ <div class="div-20351ewpue7">
3
3
  <picture>
4
4
  <source type="image/webp" v-if="webpSrcSet" :srcset="webpSrcSet" />
5
5
 
@@ -15,7 +15,7 @@
15
15
  _classStringToObject(
16
16
  'builder-image' +
17
17
  (this.className ? ' ' + this.className : '') +
18
- ' img-cvp1sc2nsao'
18
+ ' img-20351ewpue7'
19
19
  )
20
20
  "
21
21
  :src="image"
@@ -26,7 +26,7 @@
26
26
  </picture>
27
27
 
28
28
  <div
29
- class="builder-image-sizer div-cvp1sc2nsao-2"
29
+ class="builder-image-sizer div-20351ewpue7-2"
30
30
  v-if="aspectRatio && !(fitContent && ((builderBlock && builderBlock.children) && (builderBlock && builderBlock.children).length))"
31
31
  :style="{
32
32
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -36,7 +36,7 @@
36
36
 
37
37
  <slot></slot>
38
38
 
39
- <div class="div-cvp1sc2nsao-3" v-if="!fitContent">
39
+ <div class="div-20351ewpue7-3" v-if="!fitContent">
40
40
  <slot></slot>
41
41
  </div>
42
42
  </div>
@@ -110,10 +110,10 @@ export default {
110
110
  };
111
111
  </script>
112
112
  <style scoped>
113
- .div-cvp1sc2nsao {
113
+ .div-20351ewpue7 {
114
114
  position: relative;
115
115
  }
116
- .img-cvp1sc2nsao {
116
+ .img-20351ewpue7 {
117
117
  opacity: 1;
118
118
  transition: opacity 0.2s ease-in-out;
119
119
  position: absolute;
@@ -122,12 +122,12 @@ export default {
122
122
  top: 0px;
123
123
  left: 0px;
124
124
  }
125
- .div-cvp1sc2nsao-2 {
125
+ .div-20351ewpue7-2 {
126
126
  width: 100%;
127
127
  pointer-events: none;
128
128
  font-size: 0;
129
129
  }
130
- .div-cvp1sc2nsao-3 {
130
+ .div-20351ewpue7-3 {
131
131
  display: flex;
132
132
  flex-direction: column;
133
133
  align-items: stretch;
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <video
3
- v-bind="attributes"
4
- preload="none"
3
+ v-bind="videoProps"
5
4
  :style="{
6
5
  width: '100%',
7
6
  height: '100%',
@@ -14,10 +13,6 @@
14
13
  }"
15
14
  :src="video || 'no-src'"
16
15
  :poster="posterImage"
17
- :autoPlay="autoPlay"
18
- :muted="muted"
19
- :controls="controls"
20
- :loop="loop"
21
16
  ></video>
22
17
  </template>
23
18
  <script>
@@ -25,15 +20,48 @@ export default {
25
20
  name: "builder-video",
26
21
 
27
22
  props: [
23
+ "autoPlay",
24
+ "muted",
25
+ "controls",
26
+ "loop",
27
+ "playsInline",
28
28
  "attributes",
29
29
  "fit",
30
30
  "position",
31
31
  "video",
32
32
  "posterImage",
33
- "autoPlay",
34
- "muted",
35
- "controls",
36
- "loop",
37
33
  ],
34
+
35
+ computed: {
36
+ videoProps() {
37
+ return {
38
+ ...(this.autoPlay === true
39
+ ? {
40
+ autoPlay: true,
41
+ }
42
+ : {}),
43
+ ...(this.muted === true
44
+ ? {
45
+ muted: true,
46
+ }
47
+ : {}),
48
+ ...(this.controls === true
49
+ ? {
50
+ controls: true,
51
+ }
52
+ : {}),
53
+ ...(this.loop === true
54
+ ? {
55
+ loop: true,
56
+ }
57
+ : {}),
58
+ ...(this.playsInline === true
59
+ ? {
60
+ playsInline: true,
61
+ }
62
+ : {}),
63
+ };
64
+ },
65
+ },
38
66
  };
39
67
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- :class="_classStringToObject(this.className + ' div-23e8fqt91nf')"
3
+ :class="_classStringToObject(this.className + ' div-21azgz5avex')"
4
4
  :builder-path="path"
5
5
  :builder-parent-id="parent"
6
6
  :dataSet="{
@@ -84,7 +84,7 @@ export default {
84
84
  };
85
85
  </script>
86
86
  <style scoped>
87
- .div-23e8fqt91nf {
87
+ .div-21azgz5avex {
88
88
  display: flex;
89
89
  flex-direction: column;
90
90
  align-items: stretch;
@@ -1,11 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="useContent"
4
- @click="
5
- track('click', {
6
- contentId: useContent.id,
7
- })
8
- "
4
+ @click="onClick($event)"
9
5
  :builder-content-id="(useContent && useContent.id)"
10
6
  >
11
7
  <render-content-styles
@@ -41,9 +37,17 @@ export default {
41
37
  "render-content-styles": RenderContentStyles,
42
38
  "render-blocks": RenderBlocks,
43
39
  },
44
- props: ["content", "data", "context", "customComponents", "model", "apiKey"],
40
+ props: [
41
+ "content",
42
+ "data",
43
+ "context",
44
+ "customComponents",
45
+ "model",
46
+ "canTrack",
47
+ "apiKey",
48
+ ],
45
49
 
46
- data: () => ({ overrideContent: null, update: 0, overrideState: {}, track }),
50
+ data: () => ({ overrideContent: null, update: 0, overrideState: {} }),
47
51
 
48
52
  provide() {
49
53
  const _this = this;
@@ -84,7 +88,7 @@ export default {
84
88
  );
85
89
  }
86
90
 
87
- if (this.useContent) {
91
+ if (this.useContent && this.canTrack !== false) {
88
92
  track("impression", {
89
93
  contentId: this.useContent.id,
90
94
  });
@@ -244,6 +248,13 @@ export default {
244
248
  });
245
249
  }
246
250
  },
251
+ onClick(_event) {
252
+ if (this.useContent && this.canTrack !== false) {
253
+ track("click", {
254
+ contentId: this.useContent.id,
255
+ });
256
+ }
257
+ },
247
258
  evalExpression(expression) {
248
259
  return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
249
260
  evaluate({
@@ -11,7 +11,9 @@
11
11
  </template>
12
12
 
13
13
  <template v-else>
14
- <span v-bind="attributes">{{ text }}</span>
14
+ <button v-bind="attributes" class="button-1hjwvu3r5mj">
15
+ {{ text }}
16
+ </button>
15
17
  </template>
16
18
  </template>
17
19
  <script>
@@ -23,3 +25,8 @@ export default {
23
25
  props: ["attributes", "text", "link", "openLinkInNewTab"],
24
26
  };
25
27
  </script>
28
+ <style scoped>
29
+ .button-1hjwvu3r5mj {
30
+ all: unset;
31
+ }
32
+ </style>
@@ -1,15 +1,19 @@
1
1
  <template>
2
- <div class="builder-columns div-2btisl9m7v3" :style="columnsCssVars">
2
+ <div class="builder-columns div-2oa2wtipkzk" :style="columnsCssVars">
3
3
  <template :key="index" v-for="(column, index) in columns">
4
4
  <div
5
- class="builder-column div-2btisl9m7v3-2"
5
+ class="builder-column div-2oa2wtipkzk-2"
6
6
  :style="{
7
7
  width: getColumnCssWidth(index),
8
8
  marginLeft: `${index === 0 ? 0 : getGutterSize()}px`,
9
9
  ...columnCssVars,
10
10
  }"
11
11
  >
12
- <render-blocks :blocks="column.blocks"></render-blocks>
12
+ <render-blocks
13
+ :blocks="column.blocks"
14
+ :path="`component.options.columns.${index}.blocks`"
15
+ :parent="builderBlock.id"
16
+ ></render-blocks>
13
17
  </div>
14
18
  </template>
15
19
  </div>
@@ -22,7 +26,13 @@ const RenderBlocks = () => import("../../components/render-blocks.vue");
22
26
  export default {
23
27
  name: "builder-columns",
24
28
  components: { "render-blocks": defineAsyncComponent(RenderBlocks) },
25
- props: ["space", "columns", "stackColumnsAt", "reverseColumnsWhenStacked"],
29
+ props: [
30
+ "space",
31
+ "columns",
32
+ "stackColumnsAt",
33
+ "reverseColumnsWhenStacked",
34
+ "builderBlock",
35
+ ],
26
36
 
27
37
  computed: {
28
38
  columnsCssVars() {
@@ -76,32 +86,32 @@ export default {
76
86
  };
77
87
  </script>
78
88
  <style scoped>
79
- .div-2btisl9m7v3 {
89
+ .div-2oa2wtipkzk {
80
90
  display: flex;
81
91
  align-items: stretch;
82
92
  line-height: normal;
83
93
  }
84
- @media (max-width: 999px) {
85
- .div-2btisl9m7v3 {
94
+ @media (max-width: 991px) {
95
+ .div-2oa2wtipkzk {
86
96
  flex-direction: var(--flex-dir-tablet);
87
97
  }
88
98
  }
89
99
  @media (max-width: 639px) {
90
- .div-2btisl9m7v3 {
100
+ .div-2oa2wtipkzk {
91
101
  flex-direction: var(--flex-dir);
92
102
  }
93
103
  }
94
- .div-2btisl9m7v3-2 {
104
+ .div-2oa2wtipkzk-2 {
95
105
  flex-grow: 1;
96
106
  }
97
- @media (max-width: 999px) {
98
- .div-2btisl9m7v3-2 {
107
+ @media (max-width: 991px) {
108
+ .div-2oa2wtipkzk-2 {
99
109
  width: var(--column-width-tablet) !important;
100
110
  margin-left: var(--column-margin-left-tablet) !important;
101
111
  }
102
112
  }
103
113
  @media (max-width: 639px) {
104
- .div-2btisl9m7v3-2 {
114
+ .div-2oa2wtipkzk-2 {
105
115
  width: var(--column-width) !important;
106
116
  margin-left: var(--column-margin-left) !important;
107
117
  }
@@ -25,7 +25,7 @@ export default {
25
25
  computed: {
26
26
  onUpdateHook0() {
27
27
  return {
28
- 0: elem,
28
+ 0: this.$refs.elem,
29
29
  1: this.ranInitFn,
30
30
  };
31
31
  },
@@ -29,7 +29,7 @@
29
29
  </template>
30
30
 
31
31
  <template v-if="submissionState === 'error' && responseData">
32
- <pre class="builder-form-error-text pre-256wrwn33ry">
32
+ <pre class="builder-form-error-text pre-4o9pb21oca6">
33
33
  {{ JSON.stringify(responseData, null, 2) }}
34
34
  </pre>
35
35
  </template>
@@ -306,7 +306,7 @@ export default {
306
306
  };
307
307
  </script>
308
308
  <style scoped>
309
- .pre-256wrwn33ry {
309
+ .pre-4o9pb21oca6 {
310
310
  padding: 10px;
311
311
  color: red;
312
312
  text-align: center;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="div-1fogms4bee0">
2
+ <div class="div-1eih9th5ow6">
3
3
  <picture>
4
4
  <template v-if="webpSrcSet">
5
5
  <source type="image/webp" :srcset="webpSrcSet" />
@@ -17,7 +17,7 @@
17
17
  _classStringToObject(
18
18
  'builder-image' +
19
19
  (this.className ? ' ' + this.className : '') +
20
- ' img-1fogms4bee0'
20
+ ' img-1eih9th5ow6'
21
21
  )
22
22
  "
23
23
  :src="image"
@@ -31,7 +31,7 @@
31
31
  v-if="aspectRatio && !(fitContent && ((builderBlock && builderBlock.children) && (builderBlock && builderBlock.children).length))"
32
32
  >
33
33
  <div
34
- class="builder-image-sizer div-1fogms4bee0-2"
34
+ class="builder-image-sizer div-1eih9th5ow6-2"
35
35
  :style="{
36
36
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
37
  paddingTop: aspectRatio * 100 + '%',
@@ -44,7 +44,7 @@
44
44
  </template>
45
45
 
46
46
  <template v-if="!fitContent">
47
- <div class="div-1fogms4bee0-3">
47
+ <div class="div-1eih9th5ow6-3">
48
48
  <slot></slot>
49
49
  </div>
50
50
  </template>
@@ -121,10 +121,10 @@ export default {
121
121
  };
122
122
  </script>
123
123
  <style scoped>
124
- .div-1fogms4bee0 {
124
+ .div-1eih9th5ow6 {
125
125
  position: relative;
126
126
  }
127
- .img-1fogms4bee0 {
127
+ .img-1eih9th5ow6 {
128
128
  opacity: 1;
129
129
  transition: opacity 0.2s ease-in-out;
130
130
  position: absolute;
@@ -133,12 +133,12 @@ export default {
133
133
  top: 0px;
134
134
  left: 0px;
135
135
  }
136
- .div-1fogms4bee0-2 {
136
+ .div-1eih9th5ow6-2 {
137
137
  width: 100%;
138
138
  pointer-events: none;
139
139
  font-size: 0;
140
140
  }
141
- .div-1fogms4bee0-3 {
141
+ .div-1eih9th5ow6-3 {
142
142
  display: flex;
143
143
  flex-direction: column;
144
144
  align-items: stretch;
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <video
3
- v-bind="attributes"
4
- preload="none"
3
+ v-bind="videoProps"
5
4
  :style="{
6
5
  width: '100%',
7
6
  height: '100%',
@@ -14,10 +13,6 @@
14
13
  }"
15
14
  :src="video || 'no-src'"
16
15
  :poster="posterImage"
17
- :autoPlay="autoPlay"
18
- :muted="muted"
19
- :controls="controls"
20
- :loop="loop"
21
16
  ></video>
22
17
  </template>
23
18
  <script>
@@ -27,15 +22,48 @@ export default {
27
22
  name: "builder-video",
28
23
 
29
24
  props: [
25
+ "autoPlay",
26
+ "muted",
27
+ "controls",
28
+ "loop",
29
+ "playsInline",
30
30
  "attributes",
31
31
  "fit",
32
32
  "position",
33
33
  "video",
34
34
  "posterImage",
35
- "autoPlay",
36
- "muted",
37
- "controls",
38
- "loop",
39
35
  ],
36
+
37
+ computed: {
38
+ videoProps() {
39
+ return {
40
+ ...(this.autoPlay === true
41
+ ? {
42
+ autoPlay: true,
43
+ }
44
+ : {}),
45
+ ...(this.muted === true
46
+ ? {
47
+ muted: true,
48
+ }
49
+ : {}),
50
+ ...(this.controls === true
51
+ ? {
52
+ controls: true,
53
+ }
54
+ : {}),
55
+ ...(this.loop === true
56
+ ? {
57
+ loop: true,
58
+ }
59
+ : {}),
60
+ ...(this.playsInline === true
61
+ ? {
62
+ playsInline: true,
63
+ }
64
+ : {}),
65
+ };
66
+ },
67
+ },
40
68
  };
41
69
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- :class="_classStringToObject(this.className + ' div-3q96myty4lk')"
3
+ :class="_classStringToObject(this.className + ' div-1yj9n7yt24z')"
4
4
  :builder-path="path"
5
5
  :builder-parent-id="parent"
6
6
  :dataSet="{
@@ -93,7 +93,7 @@ export default {
93
93
  };
94
94
  </script>
95
95
  <style scoped>
96
- .div-3q96myty4lk {
96
+ .div-1yj9n7yt24z {
97
97
  display: flex;
98
98
  flex-direction: column;
99
99
  align-items: stretch;
@@ -1,13 +1,6 @@
1
1
  <template>
2
2
  <template v-if="useContent">
3
- <div
4
- @click="
5
- track('click', {
6
- contentId: useContent.id,
7
- })
8
- "
9
- :builder-content-id="(useContent && useContent.id)"
10
- >
3
+ <div @click="onClick($event)" :builder-content-id="(useContent && useContent.id)">
11
4
  <template v-if="shouldRenderContentStyles">
12
5
  <render-content-styles
13
6
  :cssCode="((useContent && useContent.data) && (useContent && useContent.data).cssCode)"
@@ -45,9 +38,17 @@ export default {
45
38
  "render-content-styles": defineAsyncComponent(RenderContentStyles),
46
39
  "render-blocks": defineAsyncComponent(RenderBlocks),
47
40
  },
48
- props: ["content", "data", "context", "customComponents", "model", "apiKey"],
41
+ props: [
42
+ "content",
43
+ "data",
44
+ "context",
45
+ "customComponents",
46
+ "model",
47
+ "canTrack",
48
+ "apiKey",
49
+ ],
49
50
 
50
- data: () => ({ overrideContent: null, update: 0, overrideState: {}, track }),
51
+ data: () => ({ overrideContent: null, update: 0, overrideState: {} }),
51
52
 
52
53
  provide() {
53
54
  const _this = this;
@@ -88,7 +89,7 @@ export default {
88
89
  );
89
90
  }
90
91
 
91
- if (this.useContent) {
92
+ if (this.useContent && this.canTrack !== false) {
92
93
  track("impression", {
93
94
  contentId: this.useContent.id,
94
95
  });
@@ -248,6 +249,13 @@ export default {
248
249
  });
249
250
  }
250
251
  },
252
+ onClick(_event) {
253
+ if (this.useContent && this.canTrack !== false) {
254
+ track("click", {
255
+ contentId: this.useContent.id,
256
+ });
257
+ }
258
+ },
251
259
  evalExpression(expression) {
252
260
  return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
253
261
  evaluate({