@builder.io/sdk-vue 0.0.1-44 → 0.0.1-48
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 +13 -16
- package/nuxt2/src/blocks/columns.vue +58 -6
- package/nuxt2/src/blocks/form.vue +2 -2
- package/nuxt2/src/blocks/image.vue +8 -8
- package/nuxt2/src/components/render-block.vue +25 -14
- package/nuxt2/src/components/render-blocks.vue +2 -2
- package/nuxt2/src/components/render-content.vue +4 -12
- package/nuxt2/src/functions/get-block-actions.js +2 -1
- package/nuxt2/src/functions/get-content.js +11 -9
- package/nuxt2/src/functions/get-processed-block.js +3 -1
- package/nuxt2/src/functions/is-browser.js +1 -40
- package/nuxt2/src/functions/is-react-native.js +1 -1
- package/nuxt2/src/functions/track.js +4 -2
- package/nuxt2/src/functions/{name-event-handlers.js → transform-block.js} +3 -4
- package/package.json +5 -4
- package/vue2/src/functions/get-block-actions.js +2 -1
- package/vue2/src/functions/get-content.js +11 -9
- package/vue2/src/functions/get-processed-block.js +3 -1
- package/vue2/src/functions/is-browser.js +1 -40
- package/vue2/src/functions/is-react-native.js +1 -1
- package/vue2/src/functions/track.js +4 -2
- package/vue2/src/functions/{name-event-handlers.js → transform-block.js} +3 -4
- package/vue3/src/functions/get-block-actions.js +2 -1
- package/vue3/src/functions/get-content.js +11 -9
- package/vue3/src/functions/get-processed-block.js +3 -1
- package/vue3/src/functions/is-browser.js +1 -40
- package/vue3/src/functions/is-react-native.js +1 -1
- package/vue3/src/functions/track.js +4 -2
- package/vue3/src/functions/{name-event-handlers.js → transform-block.js} +3 -4
package/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
# Builder.io Vue SDK
|
|
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](https://github.com/BuilderIO/builder/tree/main/packages/vue)
|
|
6
|
+
|
|
7
|
+
## Feature Support
|
|
8
|
+
|
|
9
|
+
To check the status of the SDK, look at [these tables](../../README.md#feature-implementation).
|
|
2
10
|
|
|
3
11
|
## Getting Started
|
|
4
12
|
|
|
5
13
|
```
|
|
6
|
-
npm install @builder.io/sdk-vue
|
|
14
|
+
npm install @builder.io/sdk-vue@dev
|
|
7
15
|
```
|
|
8
16
|
|
|
9
17
|
## Usage with Nuxt
|
|
@@ -18,18 +26,7 @@ buildModules: ['@builder.io/sdk-vue/nuxt'];
|
|
|
18
26
|
|
|
19
27
|
Then register built in and custom components as seen [here](/examples/vue-nuxt/scripts/register-builder-components.js)
|
|
20
28
|
|
|
21
|
-
You can see
|
|
22
|
-
|
|
23
|
-
## Status
|
|
24
|
-
|
|
25
|
-
This SDK is currently in beta
|
|
26
|
-
|
|
27
|
-
Left to implement:
|
|
29
|
+
You can see examples of using Builder.io:
|
|
28
30
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- "View current draft" logic
|
|
32
|
-
- "+ add block" button when starting a page (for now just drag your first block to the "layers" tab)
|
|
33
|
-
- Symbols
|
|
34
|
-
- Server side a/b testing
|
|
35
|
-
- "animations" tab and "data" tab
|
|
31
|
+
- with Nuxt [here](/examples/vue-nuxt)
|
|
32
|
+
- with Vue Storefront [here](/examples/vue/vue-storefront/)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="builder-columns div-
|
|
2
|
+
<div class="builder-columns div-23e8fqt91nf" :style="columnsCssVars">
|
|
3
3
|
<div
|
|
4
|
-
class="builder-column div-
|
|
4
|
+
class="builder-column div-23e8fqt91nf-2"
|
|
5
5
|
v-for="(column, index) in columns"
|
|
6
6
|
:style="{
|
|
7
7
|
width: getColumnCssWidth(index),
|
|
8
8
|
marginLeft: `${index === 0 ? 0 : getGutterSize()}px`,
|
|
9
|
+
...columnCssVars,
|
|
9
10
|
}"
|
|
10
11
|
:key="index"
|
|
11
12
|
>
|
|
@@ -22,7 +23,32 @@ export default registerComponent(
|
|
|
22
23
|
{
|
|
23
24
|
name: 'builder-columns',
|
|
24
25
|
components: { 'render-blocks': async () => RenderBlocks },
|
|
25
|
-
props: ['space', 'columns'],
|
|
26
|
+
props: ['space', 'columns', 'stackColumnsAt', 'reverseColumnsWhenStacked'],
|
|
27
|
+
|
|
28
|
+
computed: {
|
|
29
|
+
columnsCssVars() {
|
|
30
|
+
const flexDir =
|
|
31
|
+
this.stackColumnsAt === 'never'
|
|
32
|
+
? 'inherit'
|
|
33
|
+
: this.reverseColumnsWhenStacked
|
|
34
|
+
? 'column-reverse'
|
|
35
|
+
: 'column';
|
|
36
|
+
return {
|
|
37
|
+
'--flex-dir': flexDir,
|
|
38
|
+
'--flex-dir-tablet': this.maybeApplyForTablet(flexDir),
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
columnCssVars() {
|
|
42
|
+
const width = '100%';
|
|
43
|
+
const marginLeft = '0';
|
|
44
|
+
return {
|
|
45
|
+
'--column-width': width,
|
|
46
|
+
'--column-margin-left': marginLeft,
|
|
47
|
+
'--column-width-tablet': this.maybeApplyForTablet(width),
|
|
48
|
+
'--column-margin-left-tablet': this.maybeApplyForTablet(marginLeft),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
26
52
|
|
|
27
53
|
methods: {
|
|
28
54
|
getGutterSize() {
|
|
@@ -33,7 +59,7 @@ export default registerComponent(
|
|
|
33
59
|
},
|
|
34
60
|
getWidth(index) {
|
|
35
61
|
const columns = this.getColumns();
|
|
36
|
-
return
|
|
62
|
+
return columns[index]?.width || 100 / columns.length;
|
|
37
63
|
},
|
|
38
64
|
getColumnCssWidth(index) {
|
|
39
65
|
const columns = this.getColumns();
|
|
@@ -42,6 +68,10 @@ export default registerComponent(
|
|
|
42
68
|
(gutterSize * (columns.length - 1)) / columns.length;
|
|
43
69
|
return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
|
|
44
70
|
},
|
|
71
|
+
maybeApplyForTablet(prop) {
|
|
72
|
+
const stackColumnsAt = this.stackColumnsAt || 'tablet';
|
|
73
|
+
return stackColumnsAt === 'tablet' ? prop : 'inherit';
|
|
74
|
+
},
|
|
45
75
|
},
|
|
46
76
|
},
|
|
47
77
|
{
|
|
@@ -262,12 +292,34 @@ export default registerComponent(
|
|
|
262
292
|
);
|
|
263
293
|
</script>
|
|
264
294
|
<style scoped>
|
|
265
|
-
.div-
|
|
295
|
+
.div-23e8fqt91nf {
|
|
266
296
|
display: flex;
|
|
267
297
|
align-items: stretch;
|
|
268
298
|
line-height: normal;
|
|
269
299
|
}
|
|
270
|
-
|
|
300
|
+
@media (max-width: 999px) {
|
|
301
|
+
.div-23e8fqt91nf {
|
|
302
|
+
flex-direction: var(--flex-dir-tablet);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
@media (max-width: 639px) {
|
|
306
|
+
.div-23e8fqt91nf {
|
|
307
|
+
flex-direction: var(--flex-dir);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
.div-23e8fqt91nf-2 {
|
|
271
311
|
flex-grow: 1;
|
|
272
312
|
}
|
|
313
|
+
@media (max-width: 999px) {
|
|
314
|
+
.div-23e8fqt91nf-2 {
|
|
315
|
+
width: var(--column-width-tablet) !important;
|
|
316
|
+
margin-left: var(--column-margin-left-tablet) !important;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
@media (max-width: 639px) {
|
|
320
|
+
.div-23e8fqt91nf-2 {
|
|
321
|
+
width: var(--column-width) !important;
|
|
322
|
+
margin-left: var(--column-margin-left) !important;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
273
325
|
</style>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
></builder-blocks>
|
|
28
28
|
|
|
29
29
|
<pre
|
|
30
|
-
class="builder-form-error-text pre-
|
|
30
|
+
class="builder-form-error-text pre-t9spj7joih"
|
|
31
31
|
v-if="submissionState === 'error' && responseData"
|
|
32
32
|
>
|
|
33
33
|
{{ JSON.stringify(responseData, null, 2) }}
|
|
@@ -515,7 +515,7 @@ export default registerComponent(
|
|
|
515
515
|
);
|
|
516
516
|
</script>
|
|
517
517
|
<style scoped>
|
|
518
|
-
.pre-
|
|
518
|
+
.pre-t9spj7joih {
|
|
519
519
|
padding: 10px;
|
|
520
520
|
color: red;
|
|
521
521
|
text-align: center;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="div-
|
|
2
|
+
<div class="div-4wbls88y960">
|
|
3
3
|
<picture>
|
|
4
4
|
<img
|
|
5
5
|
loading="lazy"
|
|
6
|
-
class="img-
|
|
6
|
+
class="img-4wbls88y960"
|
|
7
7
|
:alt="altText"
|
|
8
8
|
:aria-role="altText ? 'presentation' : undefined"
|
|
9
9
|
:style="{
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</picture>
|
|
24
24
|
|
|
25
25
|
<div
|
|
26
|
-
class="builder-image-sizer div-
|
|
26
|
+
class="builder-image-sizer div-4wbls88y960-2"
|
|
27
27
|
v-if="
|
|
28
28
|
aspectRatio &&
|
|
29
29
|
!(
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
<slot></slot>
|
|
44
44
|
|
|
45
|
-
<div class="div-
|
|
45
|
+
<div class="div-4wbls88y960-3" v-if="!fitContent">
|
|
46
46
|
<slot></slot>
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
@@ -167,10 +167,10 @@ export default registerComponent(
|
|
|
167
167
|
);
|
|
168
168
|
</script>
|
|
169
169
|
<style scoped>
|
|
170
|
-
.div-
|
|
170
|
+
.div-4wbls88y960 {
|
|
171
171
|
position: relative;
|
|
172
172
|
}
|
|
173
|
-
.img-
|
|
173
|
+
.img-4wbls88y960 {
|
|
174
174
|
opacity: 1;
|
|
175
175
|
transition: opacity 0.2s ease-in-out;
|
|
176
176
|
position: absolute;
|
|
@@ -179,12 +179,12 @@ export default registerComponent(
|
|
|
179
179
|
top: 0px;
|
|
180
180
|
left: 0px;
|
|
181
181
|
}
|
|
182
|
-
.div-
|
|
182
|
+
.div-4wbls88y960-2 {
|
|
183
183
|
width: 100%;
|
|
184
184
|
pointer-events: none;
|
|
185
185
|
font-size: 0;
|
|
186
186
|
}
|
|
187
|
-
.div-
|
|
187
|
+
.div-4wbls88y960-3 {
|
|
188
188
|
display: flex;
|
|
189
189
|
flex-direction: column;
|
|
190
190
|
align-items: stretch;
|
|
@@ -13,28 +13,33 @@
|
|
|
13
13
|
:builderBlock="useBlock"
|
|
14
14
|
:is="componentRef"
|
|
15
15
|
>
|
|
16
|
-
<render-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:
|
|
20
|
-
></render-
|
|
16
|
+
<render-block
|
|
17
|
+
v-for="(child, index) in children"
|
|
18
|
+
:block="child"
|
|
19
|
+
:key="index"
|
|
20
|
+
></render-block>
|
|
21
21
|
</component>
|
|
22
22
|
|
|
23
23
|
<render-block
|
|
24
|
-
v-for="(child, index) in
|
|
24
|
+
v-for="(child, index) in noCompRefChildren"
|
|
25
25
|
:block="child"
|
|
26
26
|
:key="index"
|
|
27
27
|
></render-block>
|
|
28
28
|
</component>
|
|
29
29
|
<component
|
|
30
|
-
v-bind="
|
|
30
|
+
v-bind="componentOptions"
|
|
31
31
|
v-else=""
|
|
32
32
|
:attributes="propertiesAndActions"
|
|
33
33
|
:builderBlock="useBlock"
|
|
34
34
|
:style="css"
|
|
35
|
-
:children="useBlock.children"
|
|
36
35
|
:is="componentRef"
|
|
37
|
-
|
|
36
|
+
>
|
|
37
|
+
<render-block
|
|
38
|
+
v-for="(child, index) in children"
|
|
39
|
+
:block="child"
|
|
40
|
+
:key="index"
|
|
41
|
+
></render-block>
|
|
42
|
+
</component>
|
|
38
43
|
</template>
|
|
39
44
|
<script>
|
|
40
45
|
import { getBlockComponentOptions } from '../functions/get-block-component-options';
|
|
@@ -46,14 +51,10 @@ import BuilderContext from '../context/builder.context';
|
|
|
46
51
|
import { getBlockActions } from '../functions/get-block-actions';
|
|
47
52
|
import { getProcessedBlock } from '../functions/get-processed-block';
|
|
48
53
|
import BlockStyles from './block-styles';
|
|
49
|
-
import RenderBlocks from './render-blocks';
|
|
50
54
|
|
|
51
55
|
export default {
|
|
52
56
|
name: 'render-block',
|
|
53
|
-
components: {
|
|
54
|
-
'block-styles': async () => BlockStyles,
|
|
55
|
-
'render-blocks': async () => RenderBlocks,
|
|
56
|
-
},
|
|
57
|
+
components: { 'block-styles': async () => BlockStyles },
|
|
57
58
|
props: ['block'],
|
|
58
59
|
|
|
59
60
|
inject: {
|
|
@@ -114,6 +115,16 @@ export default {
|
|
|
114
115
|
componentOptions() {
|
|
115
116
|
return getBlockComponentOptions(this.useBlock);
|
|
116
117
|
},
|
|
118
|
+
children() {
|
|
119
|
+
// TO-DO: When should `canHaveChildren` dictate rendering?
|
|
120
|
+
// This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,
|
|
121
|
+
// but still receive and need to render children.
|
|
122
|
+
// return this.componentInfo?.canHaveChildren ? this.useBlock.children : [];
|
|
123
|
+
return this.useBlock.children ?? [];
|
|
124
|
+
},
|
|
125
|
+
noCompRefChildren() {
|
|
126
|
+
return this.componentRef ? [] : this.children;
|
|
127
|
+
},
|
|
117
128
|
},
|
|
118
129
|
};
|
|
119
130
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="div-
|
|
3
|
+
class="div-2flfunvabst"
|
|
4
4
|
:builder-path="path"
|
|
5
5
|
:builder-parent-id="parent"
|
|
6
6
|
@click="onClick"
|
|
@@ -72,7 +72,7 @@ export default {
|
|
|
72
72
|
};
|
|
73
73
|
</script>
|
|
74
74
|
<style scoped>
|
|
75
|
-
.div-
|
|
75
|
+
.div-2flfunvabst {
|
|
76
76
|
display: flex;
|
|
77
77
|
flex-direction: column;
|
|
78
78
|
align-items: stretch;
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
useContent.data &&
|
|
17
17
|
(useContent && useContent.data).cssCode) ||
|
|
18
18
|
(useContent &&
|
|
19
|
-
useContent.data &&
|
|
20
|
-
(useContent && useContent.data).customFonts &&
|
|
21
|
-
useContent &&
|
|
22
19
|
useContent.data &&
|
|
23
20
|
(useContent && useContent.data).customFonts &&
|
|
24
21
|
(
|
|
@@ -142,9 +139,7 @@ export default {
|
|
|
142
139
|
font.family +
|
|
143
140
|
(font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
|
|
144
141
|
const name = family.split(',')[0];
|
|
145
|
-
const url = font.fileUrl
|
|
146
|
-
? font.fileUrl
|
|
147
|
-
: font.files && font.files.regular;
|
|
142
|
+
const url = font.fileUrl ?? font?.files?.regular;
|
|
148
143
|
let str = '';
|
|
149
144
|
|
|
150
145
|
if (url && family && name) {
|
|
@@ -190,12 +185,9 @@ export default {
|
|
|
190
185
|
// }
|
|
191
186
|
// TODO: separate internal data from external
|
|
192
187
|
return (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
.map((font) => this.getCssFromFont(font, data))
|
|
197
|
-
.join(' ')) ||
|
|
198
|
-
''
|
|
188
|
+
data?.customFonts
|
|
189
|
+
?.map((font) => this.getCssFromFont(font, data))
|
|
190
|
+
?.join(' ') || ''
|
|
199
191
|
);
|
|
200
192
|
},
|
|
201
193
|
processMessage(event) {
|
|
@@ -44,6 +44,7 @@ __export(exports, {
|
|
|
44
44
|
getBlockActions: () => getBlockActions,
|
|
45
45
|
});
|
|
46
46
|
var import_evaluate = __toModule(require('./evaluate'));
|
|
47
|
+
var import_event_handler_name = __toModule(require('./event-handler-name'));
|
|
47
48
|
function getBlockActions(options) {
|
|
48
49
|
const obj = {};
|
|
49
50
|
if (options.block.actions) {
|
|
@@ -52,7 +53,7 @@ function getBlockActions(options) {
|
|
|
52
53
|
continue;
|
|
53
54
|
}
|
|
54
55
|
const value = options.block.actions[key];
|
|
55
|
-
obj[
|
|
56
|
+
obj[(0, import_event_handler_name.getEventHandlerName)(key)] = (event) =>
|
|
56
57
|
(0, import_evaluate.evaluate)({
|
|
57
58
|
code: value,
|
|
58
59
|
context: options.context,
|
|
@@ -121,16 +121,18 @@ function getContent(options) {
|
|
|
121
121
|
function getAllContent(options) {
|
|
122
122
|
return __async(this, null, function* () {
|
|
123
123
|
const { model, apiKey } = options;
|
|
124
|
-
const { limit, testGroups, userAttributes, query } =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const { limit, testGroups, userAttributes, query, noTraverse } =
|
|
125
|
+
__spreadValues(
|
|
126
|
+
{
|
|
127
|
+
limit: 1,
|
|
128
|
+
userAttributes: null,
|
|
129
|
+
testGroups: null,
|
|
130
|
+
noTraverse: false,
|
|
131
|
+
},
|
|
132
|
+
options
|
|
133
|
+
);
|
|
132
134
|
const url = new URL(
|
|
133
|
-
`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}`
|
|
135
|
+
`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`
|
|
134
136
|
);
|
|
135
137
|
if (options.options) {
|
|
136
138
|
const flattened = flatten(options.options);
|
|
@@ -68,8 +68,10 @@ __export(exports, {
|
|
|
68
68
|
});
|
|
69
69
|
var import_evaluate = __toModule(require('./evaluate'));
|
|
70
70
|
var import_set = __toModule(require('./set'));
|
|
71
|
+
var import_transform_block = __toModule(require('./transform-block'));
|
|
71
72
|
function getProcessedBlock(options) {
|
|
72
|
-
const {
|
|
73
|
+
const { state, context } = options;
|
|
74
|
+
const block = (0, import_transform_block.transformBlock)(options.block);
|
|
73
75
|
if (!block.bindings) {
|
|
74
76
|
return block;
|
|
75
77
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
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
2
|
var __markAsModule = (target) =>
|
|
8
3
|
__defProp(target, '__esModule', { value: true });
|
|
9
4
|
var __export = (target, all) => {
|
|
@@ -11,43 +6,9 @@ var __export = (target, all) => {
|
|
|
11
6
|
for (var name in all)
|
|
12
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
8
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
15
|
-
if (
|
|
16
|
-
(module2 && typeof module2 === 'object') ||
|
|
17
|
-
typeof module2 === 'function'
|
|
18
|
-
) {
|
|
19
|
-
for (let key of __getOwnPropNames(module2))
|
|
20
|
-
if (!__hasOwnProp.call(target, key) && key !== 'default')
|
|
21
|
-
__defProp(target, key, {
|
|
22
|
-
get: () => module2[key],
|
|
23
|
-
enumerable:
|
|
24
|
-
!(desc = __getOwnPropDesc(module2, key)) || desc.enumerable,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
var __toModule = (module2) => {
|
|
30
|
-
return __reExport(
|
|
31
|
-
__markAsModule(
|
|
32
|
-
__defProp(
|
|
33
|
-
module2 != null ? __create(__getProtoOf(module2)) : {},
|
|
34
|
-
'default',
|
|
35
|
-
module2 && module2.__esModule && 'default' in module2
|
|
36
|
-
? { get: () => module2.default, enumerable: true }
|
|
37
|
-
: { value: module2, enumerable: true }
|
|
38
|
-
)
|
|
39
|
-
),
|
|
40
|
-
module2
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
9
|
__export(exports, {
|
|
44
10
|
isBrowser: () => isBrowser,
|
|
45
11
|
});
|
|
46
|
-
var import_is_react_native = __toModule(require('./is-react-native'));
|
|
47
12
|
function isBrowser() {
|
|
48
|
-
return
|
|
49
|
-
typeof window !== 'undefined' &&
|
|
50
|
-
typeof document !== 'undefined' &&
|
|
51
|
-
!(0, import_is_react_native.isReactNative)()
|
|
52
|
-
);
|
|
13
|
+
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
53
14
|
}
|
|
@@ -47,8 +47,10 @@ var import_is_browser = __toModule(require('./is-browser'));
|
|
|
47
47
|
var import_is_react_native = __toModule(require('./is-react-native'));
|
|
48
48
|
function track(event, properties) {
|
|
49
49
|
if (
|
|
50
|
-
!(
|
|
51
|
-
|
|
50
|
+
!(
|
|
51
|
+
(0, import_is_browser.isBrowser)() ||
|
|
52
|
+
(0, import_is_react_native.isReactNative)()
|
|
53
|
+
)
|
|
52
54
|
) {
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
@@ -7,9 +7,8 @@ var __export = (target, all) => {
|
|
|
7
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
8
|
};
|
|
9
9
|
__export(exports, {
|
|
10
|
-
|
|
10
|
+
transformBlock: () => transformBlock,
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function transformBlock(block) {
|
|
13
|
+
return block;
|
|
14
14
|
}
|
|
15
|
-
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-vue",
|
|
3
3
|
"description": "Builder.io SDK for Vue",
|
|
4
|
-
"version": "0.0.1-
|
|
4
|
+
"version": "0.0.1-48",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"node-fetch": "^2.6.1"
|
|
7
7
|
},
|
|
8
8
|
"main": "./nuxt2/src/index.js",
|
|
9
9
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"./nuxt": "./nuxt.js",
|
|
11
|
+
"./vue2": "./vue2/src/index.js",
|
|
12
|
+
"./nuxt2": "./nuxt2/src/index.js",
|
|
13
|
+
"./vue3": "./vue3/src/index.js"
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
16
|
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
@@ -44,6 +44,7 @@ __export(exports, {
|
|
|
44
44
|
getBlockActions: () => getBlockActions,
|
|
45
45
|
});
|
|
46
46
|
var import_evaluate = __toModule(require('./evaluate'));
|
|
47
|
+
var import_event_handler_name = __toModule(require('./event-handler-name'));
|
|
47
48
|
function getBlockActions(options) {
|
|
48
49
|
const obj = {};
|
|
49
50
|
if (options.block.actions) {
|
|
@@ -52,7 +53,7 @@ function getBlockActions(options) {
|
|
|
52
53
|
continue;
|
|
53
54
|
}
|
|
54
55
|
const value = options.block.actions[key];
|
|
55
|
-
obj[
|
|
56
|
+
obj[(0, import_event_handler_name.getEventHandlerName)(key)] = (event) =>
|
|
56
57
|
(0, import_evaluate.evaluate)({
|
|
57
58
|
code: value,
|
|
58
59
|
context: options.context,
|
|
@@ -121,16 +121,18 @@ function getContent(options) {
|
|
|
121
121
|
function getAllContent(options) {
|
|
122
122
|
return __async(this, null, function* () {
|
|
123
123
|
const { model, apiKey } = options;
|
|
124
|
-
const { limit, testGroups, userAttributes, query } =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const { limit, testGroups, userAttributes, query, noTraverse } =
|
|
125
|
+
__spreadValues(
|
|
126
|
+
{
|
|
127
|
+
limit: 1,
|
|
128
|
+
userAttributes: null,
|
|
129
|
+
testGroups: null,
|
|
130
|
+
noTraverse: false,
|
|
131
|
+
},
|
|
132
|
+
options
|
|
133
|
+
);
|
|
132
134
|
const url = new URL(
|
|
133
|
-
`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}`
|
|
135
|
+
`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`
|
|
134
136
|
);
|
|
135
137
|
if (options.options) {
|
|
136
138
|
const flattened = flatten(options.options);
|
|
@@ -68,8 +68,10 @@ __export(exports, {
|
|
|
68
68
|
});
|
|
69
69
|
var import_evaluate = __toModule(require('./evaluate'));
|
|
70
70
|
var import_set = __toModule(require('./set'));
|
|
71
|
+
var import_transform_block = __toModule(require('./transform-block'));
|
|
71
72
|
function getProcessedBlock(options) {
|
|
72
|
-
const {
|
|
73
|
+
const { state, context } = options;
|
|
74
|
+
const block = (0, import_transform_block.transformBlock)(options.block);
|
|
73
75
|
if (!block.bindings) {
|
|
74
76
|
return block;
|
|
75
77
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
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
2
|
var __markAsModule = (target) =>
|
|
8
3
|
__defProp(target, '__esModule', { value: true });
|
|
9
4
|
var __export = (target, all) => {
|
|
@@ -11,43 +6,9 @@ var __export = (target, all) => {
|
|
|
11
6
|
for (var name in all)
|
|
12
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
8
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
15
|
-
if (
|
|
16
|
-
(module2 && typeof module2 === 'object') ||
|
|
17
|
-
typeof module2 === 'function'
|
|
18
|
-
) {
|
|
19
|
-
for (let key of __getOwnPropNames(module2))
|
|
20
|
-
if (!__hasOwnProp.call(target, key) && key !== 'default')
|
|
21
|
-
__defProp(target, key, {
|
|
22
|
-
get: () => module2[key],
|
|
23
|
-
enumerable:
|
|
24
|
-
!(desc = __getOwnPropDesc(module2, key)) || desc.enumerable,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
var __toModule = (module2) => {
|
|
30
|
-
return __reExport(
|
|
31
|
-
__markAsModule(
|
|
32
|
-
__defProp(
|
|
33
|
-
module2 != null ? __create(__getProtoOf(module2)) : {},
|
|
34
|
-
'default',
|
|
35
|
-
module2 && module2.__esModule && 'default' in module2
|
|
36
|
-
? { get: () => module2.default, enumerable: true }
|
|
37
|
-
: { value: module2, enumerable: true }
|
|
38
|
-
)
|
|
39
|
-
),
|
|
40
|
-
module2
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
9
|
__export(exports, {
|
|
44
10
|
isBrowser: () => isBrowser,
|
|
45
11
|
});
|
|
46
|
-
var import_is_react_native = __toModule(require('./is-react-native'));
|
|
47
12
|
function isBrowser() {
|
|
48
|
-
return
|
|
49
|
-
typeof window !== 'undefined' &&
|
|
50
|
-
typeof document !== 'undefined' &&
|
|
51
|
-
!(0, import_is_react_native.isReactNative)()
|
|
52
|
-
);
|
|
13
|
+
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
53
14
|
}
|
|
@@ -47,8 +47,10 @@ var import_is_browser = __toModule(require('./is-browser'));
|
|
|
47
47
|
var import_is_react_native = __toModule(require('./is-react-native'));
|
|
48
48
|
function track(event, properties) {
|
|
49
49
|
if (
|
|
50
|
-
!(
|
|
51
|
-
|
|
50
|
+
!(
|
|
51
|
+
(0, import_is_browser.isBrowser)() ||
|
|
52
|
+
(0, import_is_react_native.isReactNative)()
|
|
53
|
+
)
|
|
52
54
|
) {
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
@@ -7,9 +7,8 @@ var __export = (target, all) => {
|
|
|
7
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
8
|
};
|
|
9
9
|
__export(exports, {
|
|
10
|
-
|
|
10
|
+
transformBlock: () => transformBlock,
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function transformBlock(block) {
|
|
13
|
+
return block;
|
|
14
14
|
}
|
|
15
|
-
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
|
|
@@ -44,6 +44,7 @@ __export(exports, {
|
|
|
44
44
|
getBlockActions: () => getBlockActions,
|
|
45
45
|
});
|
|
46
46
|
var import_evaluate = __toModule(require('./evaluate'));
|
|
47
|
+
var import_event_handler_name = __toModule(require('./event-handler-name'));
|
|
47
48
|
function getBlockActions(options) {
|
|
48
49
|
const obj = {};
|
|
49
50
|
if (options.block.actions) {
|
|
@@ -52,7 +53,7 @@ function getBlockActions(options) {
|
|
|
52
53
|
continue;
|
|
53
54
|
}
|
|
54
55
|
const value = options.block.actions[key];
|
|
55
|
-
obj[
|
|
56
|
+
obj[(0, import_event_handler_name.getEventHandlerName)(key)] = (event) =>
|
|
56
57
|
(0, import_evaluate.evaluate)({
|
|
57
58
|
code: value,
|
|
58
59
|
context: options.context,
|
|
@@ -121,16 +121,18 @@ function getContent(options) {
|
|
|
121
121
|
function getAllContent(options) {
|
|
122
122
|
return __async(this, null, function* () {
|
|
123
123
|
const { model, apiKey } = options;
|
|
124
|
-
const { limit, testGroups, userAttributes, query } =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const { limit, testGroups, userAttributes, query, noTraverse } =
|
|
125
|
+
__spreadValues(
|
|
126
|
+
{
|
|
127
|
+
limit: 1,
|
|
128
|
+
userAttributes: null,
|
|
129
|
+
testGroups: null,
|
|
130
|
+
noTraverse: false,
|
|
131
|
+
},
|
|
132
|
+
options
|
|
133
|
+
);
|
|
132
134
|
const url = new URL(
|
|
133
|
-
`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}`
|
|
135
|
+
`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`
|
|
134
136
|
);
|
|
135
137
|
if (options.options) {
|
|
136
138
|
const flattened = flatten(options.options);
|
|
@@ -68,8 +68,10 @@ __export(exports, {
|
|
|
68
68
|
});
|
|
69
69
|
var import_evaluate = __toModule(require('./evaluate'));
|
|
70
70
|
var import_set = __toModule(require('./set'));
|
|
71
|
+
var import_transform_block = __toModule(require('./transform-block'));
|
|
71
72
|
function getProcessedBlock(options) {
|
|
72
|
-
const {
|
|
73
|
+
const { state, context } = options;
|
|
74
|
+
const block = (0, import_transform_block.transformBlock)(options.block);
|
|
73
75
|
if (!block.bindings) {
|
|
74
76
|
return block;
|
|
75
77
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
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
2
|
var __markAsModule = (target) =>
|
|
8
3
|
__defProp(target, '__esModule', { value: true });
|
|
9
4
|
var __export = (target, all) => {
|
|
@@ -11,43 +6,9 @@ var __export = (target, all) => {
|
|
|
11
6
|
for (var name in all)
|
|
12
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
8
|
};
|
|
14
|
-
var __reExport = (target, module2, desc) => {
|
|
15
|
-
if (
|
|
16
|
-
(module2 && typeof module2 === 'object') ||
|
|
17
|
-
typeof module2 === 'function'
|
|
18
|
-
) {
|
|
19
|
-
for (let key of __getOwnPropNames(module2))
|
|
20
|
-
if (!__hasOwnProp.call(target, key) && key !== 'default')
|
|
21
|
-
__defProp(target, key, {
|
|
22
|
-
get: () => module2[key],
|
|
23
|
-
enumerable:
|
|
24
|
-
!(desc = __getOwnPropDesc(module2, key)) || desc.enumerable,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
var __toModule = (module2) => {
|
|
30
|
-
return __reExport(
|
|
31
|
-
__markAsModule(
|
|
32
|
-
__defProp(
|
|
33
|
-
module2 != null ? __create(__getProtoOf(module2)) : {},
|
|
34
|
-
'default',
|
|
35
|
-
module2 && module2.__esModule && 'default' in module2
|
|
36
|
-
? { get: () => module2.default, enumerable: true }
|
|
37
|
-
: { value: module2, enumerable: true }
|
|
38
|
-
)
|
|
39
|
-
),
|
|
40
|
-
module2
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
9
|
__export(exports, {
|
|
44
10
|
isBrowser: () => isBrowser,
|
|
45
11
|
});
|
|
46
|
-
var import_is_react_native = __toModule(require('./is-react-native'));
|
|
47
12
|
function isBrowser() {
|
|
48
|
-
return
|
|
49
|
-
typeof window !== 'undefined' &&
|
|
50
|
-
typeof document !== 'undefined' &&
|
|
51
|
-
!(0, import_is_react_native.isReactNative)()
|
|
52
|
-
);
|
|
13
|
+
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
53
14
|
}
|
|
@@ -47,8 +47,10 @@ var import_is_browser = __toModule(require('./is-browser'));
|
|
|
47
47
|
var import_is_react_native = __toModule(require('./is-react-native'));
|
|
48
48
|
function track(event, properties) {
|
|
49
49
|
if (
|
|
50
|
-
!(
|
|
51
|
-
|
|
50
|
+
!(
|
|
51
|
+
(0, import_is_browser.isBrowser)() ||
|
|
52
|
+
(0, import_is_react_native.isReactNative)()
|
|
53
|
+
)
|
|
52
54
|
) {
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
@@ -7,9 +7,8 @@ var __export = (target, all) => {
|
|
|
7
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
8
|
};
|
|
9
9
|
__export(exports, {
|
|
10
|
-
|
|
10
|
+
transformBlock: () => transformBlock,
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function transformBlock(block) {
|
|
13
|
+
return block;
|
|
14
14
|
}
|
|
15
|
-
const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
|