@builder.io/sdk-vue 2.0.16 → 2.0.20
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 +1 -1
- package/lib/browser/awaiter-A9QVJBD9.cjs +1 -0
- package/lib/browser/awaiter-jLgWnSTO.js +16 -0
- package/lib/browser/{block-styles-wdfZngGH.cjs → block-styles-FLI6qMZg.cjs} +1 -1
- package/lib/browser/{block-styles-J1Ycb5k6.js → block-styles-McsYN1Hd.js} +1 -1
- package/lib/browser/{block-wrapper-0yNnaWi7.cjs → block-wrapper-c1TRGGdm.cjs} +1 -1
- package/lib/browser/{block-wrapper-WNcg8adi.js → block-wrapper-kIbAHG8K.js} +3 -3
- package/lib/browser/component-ref-VsUS3j2W.js +135 -0
- package/lib/browser/component-ref-t_X6BYoD.cjs +1 -0
- package/lib/browser/components/awaiter.vue.d.ts +2 -0
- package/lib/browser/components/block/components/interactive-element.vue.d.ts +3 -3
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/context/component-reference-types.d.ts +4 -0
- package/lib/browser/context/types.d.ts +2 -1
- package/lib/browser/{get-block-properties-EYg8xaCR.cjs → get-block-properties-Ub4OGrZU.cjs} +1 -1
- package/lib/browser/{get-block-properties-9178299s.js → get-block-properties-pnQ6T89t.js} +1 -1
- package/lib/browser/{index-NFUE2Jgz.cjs → index-G94Y3yOE.cjs} +3 -3
- package/lib/browser/{index-LzjDY2XM.js → index-IkCq97zU.js} +15 -15
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{repeated-block-qTqSm8kM.js → repeated-block-9kzlJZ0z.js} +2 -2
- package/lib/browser/{repeated-block-BQJwYMB1.cjs → repeated-block-phJGhJDz.cjs} +1 -1
- package/lib/browser/style.css +1 -1
- package/lib/edge/awaiter-EaEHpSME.js +15 -0
- package/lib/edge/awaiter-qkwHnyG4.cjs +1 -0
- package/lib/edge/{block-styles-VxOvC1TW.cjs → block-styles-dBm-UB6s.cjs} +1 -1
- package/lib/{node/block-styles-1_5JG_2z.js → edge/block-styles-e5rHDnez.js} +1 -1
- package/lib/edge/{block-wrapper--PIvpZ-W.js → block-wrapper-IsmLQCso.js} +3 -3
- package/lib/{node/block-wrapper-ofVcndkY.cjs → edge/block-wrapper-XFAJUGmy.cjs} +1 -1
- package/lib/edge/component-ref-VkKlvDcE.cjs +1 -0
- package/lib/edge/component-ref-mDQskFmn.js +134 -0
- package/lib/edge/components/awaiter.vue.d.ts +2 -0
- package/lib/edge/components/block/components/interactive-element.vue.d.ts +3 -3
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/context/component-reference-types.d.ts +4 -0
- package/lib/edge/context/types.d.ts +2 -1
- package/lib/edge/{get-block-properties-YnnLDBjt.cjs → get-block-properties-FTpxQBNr.cjs} +1 -1
- package/lib/{node/get-block-properties-dtlboGe6.js → edge/get-block-properties-jWWYZFYS.js} +1 -1
- package/lib/edge/{index-_G5Jct0s.js → index-a1uEIlXu.js} +15 -15
- package/lib/edge/{index-sCP9BbUb.cjs → index-wbH9RC9d.cjs} +10 -10
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{repeated-block-BFv7xfur.cjs → repeated-block--9pU5oBU.cjs} +1 -1
- package/lib/edge/{repeated-block-xjv5lSgT.js → repeated-block-WbUp3X7n.js} +2 -2
- package/lib/edge/style.css +1 -1
- package/lib/node/awaiter-bSGzxUtO.js +15 -0
- package/lib/node/awaiter-nnMnOtUG.cjs +1 -0
- package/lib/node/block-styles-nafXA7XU.cjs +1 -0
- package/lib/{edge/block-styles-ZXgAEao4.js → node/block-styles-z1hRu_oN.js} +16 -15
- package/lib/{edge/block-wrapper-_Jqy6OhJ.cjs → node/block-wrapper-7Zyz-IHk.cjs} +1 -1
- package/lib/node/{block-wrapper-V_pureM-.js → block-wrapper-VbshFnwD.js} +3 -3
- package/lib/node/component-ref-0qWwbS8J.js +134 -0
- package/lib/node/component-ref-pMpl8Ppd.cjs +1 -0
- package/lib/node/components/awaiter.vue.d.ts +2 -0
- package/lib/node/components/block/components/interactive-element.vue.d.ts +3 -3
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/context/component-reference-types.d.ts +4 -0
- package/lib/node/context/types.d.ts +2 -1
- package/lib/node/get-block-properties-3bo9EXiT.cjs +1 -0
- package/lib/{edge/get-block-properties-1IIhEm1L.js → node/get-block-properties-7k5SVVoM.js} +17 -16
- package/lib/node/{index-trhIUBJe.js → index-arpbCDNz.js} +906 -1136
- package/lib/node/index-m2Te0zyE.cjs +166 -0
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +17 -16
- package/lib/node/init.cjs +1 -0
- package/lib/node/init.d.cts +14 -0
- package/lib/node/init.d.mts +14 -0
- package/lib/node/init.mjs +15 -0
- package/lib/node/{repeated-block-DGLvKNeT.js → repeated-block-7xPIdLvm.js} +13 -13
- package/lib/node/{repeated-block-3sS8LQKZ.cjs → repeated-block-opGUN59c.cjs} +1 -1
- package/lib/node/should-force-browser-runtime-in-node-Hy3G5eB4.js +248 -0
- package/lib/node/should-force-browser-runtime-in-node-cm1lg4FM.cjs +48 -0
- package/lib/node/style.css +1 -1
- package/nuxt-isolated-vm-plugin.js +14 -0
- package/nuxt.js +31 -2
- package/package.json +7 -2
- package/lib/browser/component-ref-ZQ1LWsdM.js +0 -114
- package/lib/browser/component-ref-vgKnLwfE.cjs +0 -1
- package/lib/edge/component-ref-Gmo3ST7V.cjs +0 -1
- package/lib/edge/component-ref-J3KW7NWq.js +0 -113
- package/lib/node/block-styles-_qZsI9c3.cjs +0 -1
- package/lib/node/component-ref--fBJ8B90.cjs +0 -1
- package/lib/node/component-ref-i-BTHCKC.js +0 -113
- package/lib/node/get-block-properties-WxCzIZPQ.cjs +0 -1
- package/lib/node/index-Yv0J5kjl.cjs +0 -213
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
const TARGET = "vue", MSG_PREFIX = "[Builder.io]: ", logger = {
|
|
3
|
+
log: (...e) => console.log(MSG_PREFIX, ...e),
|
|
4
|
+
error: (...e) => console.error(MSG_PREFIX, ...e),
|
|
5
|
+
warn: (...e) => console.warn(MSG_PREFIX, ...e),
|
|
6
|
+
debug: (...e) => console.debug(MSG_PREFIX, ...e)
|
|
7
|
+
};
|
|
8
|
+
function isBrowser() {
|
|
9
|
+
return typeof window < "u" && typeof document < "u";
|
|
10
|
+
}
|
|
11
|
+
const convertSearchParamsToQueryObject = (e) => {
|
|
12
|
+
const t = {};
|
|
13
|
+
return e.forEach((o, n) => {
|
|
14
|
+
t[n] = o;
|
|
15
|
+
}), t;
|
|
16
|
+
}, normalizeSearchParams = (e) => e instanceof URLSearchParams ? convertSearchParamsToQueryObject(e) : e, getSearchString = (e) => typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : new URLSearchParams(e).toString();
|
|
17
|
+
function isIframe() {
|
|
18
|
+
return isBrowser() && window.self !== window.top;
|
|
19
|
+
}
|
|
20
|
+
function isEditing(e) {
|
|
21
|
+
return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
22
|
+
getSearchString(e || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
23
|
+
}
|
|
24
|
+
const getLocation = () => {
|
|
25
|
+
if (isBrowser()) {
|
|
26
|
+
const e = new URL(location.href);
|
|
27
|
+
return e.pathname === "" && (e.pathname = "/"), e;
|
|
28
|
+
} else
|
|
29
|
+
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
30
|
+
}, getUserAgent = () => typeof navigator == "object" && navigator.userAgent || "", getUserAttributes = () => {
|
|
31
|
+
const e = getUserAgent(), t = {
|
|
32
|
+
Android() {
|
|
33
|
+
return e.match(/Android/i);
|
|
34
|
+
},
|
|
35
|
+
BlackBerry() {
|
|
36
|
+
return e.match(/BlackBerry/i);
|
|
37
|
+
},
|
|
38
|
+
iOS() {
|
|
39
|
+
return e.match(/iPhone|iPod/i);
|
|
40
|
+
},
|
|
41
|
+
Opera() {
|
|
42
|
+
return e.match(/Opera Mini/i);
|
|
43
|
+
},
|
|
44
|
+
Windows() {
|
|
45
|
+
return e.match(/IEMobile/i) || e.match(/WPDesktop/i);
|
|
46
|
+
},
|
|
47
|
+
any() {
|
|
48
|
+
return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || TARGET === "reactNative";
|
|
49
|
+
}
|
|
50
|
+
}, o = e.match(/Tablet|iPad/i), n = getLocation();
|
|
51
|
+
return {
|
|
52
|
+
urlPath: n == null ? void 0 : n.pathname,
|
|
53
|
+
host: (n == null ? void 0 : n.host) || (n == null ? void 0 : n.hostname),
|
|
54
|
+
device: o ? "tablet" : t.any() ? "mobile" : "desktop"
|
|
55
|
+
};
|
|
56
|
+
}, getFunctionArguments = ({
|
|
57
|
+
builder: e,
|
|
58
|
+
context: t,
|
|
59
|
+
event: o,
|
|
60
|
+
state: n
|
|
61
|
+
}) => Object.entries({
|
|
62
|
+
state: n,
|
|
63
|
+
Builder: e,
|
|
64
|
+
// legacy
|
|
65
|
+
builder: e,
|
|
66
|
+
context: t,
|
|
67
|
+
event: o
|
|
68
|
+
}), getBuilderGlobals = () => ({
|
|
69
|
+
isEditing: isEditing(),
|
|
70
|
+
isBrowser: isBrowser(),
|
|
71
|
+
isServer: !isBrowser(),
|
|
72
|
+
getUserAttributes: () => getUserAttributes()
|
|
73
|
+
}), parseCode = (e, {
|
|
74
|
+
isExpression: t = !0
|
|
75
|
+
}) => /* we disable this for cases where we definitely don't want a return */ t && !(e.includes(";") || e.includes(" return ") || e.trim().startsWith("return ")) ? `return (${e});` : e, SDK_NAME_FOR_TARGET = (() => {
|
|
76
|
+
switch (TARGET) {
|
|
77
|
+
case "rsc":
|
|
78
|
+
return "react-nextjs";
|
|
79
|
+
case "reactNative":
|
|
80
|
+
return "react-native";
|
|
81
|
+
default:
|
|
82
|
+
return TARGET;
|
|
83
|
+
}
|
|
84
|
+
})(), SDK_NAME = `@builder.io/sdk-${SDK_NAME_FOR_TARGET}`, fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t, o) => {
|
|
85
|
+
if (Object(e) !== e)
|
|
86
|
+
return e;
|
|
87
|
+
const n = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
88
|
+
return n.slice(0, -1).reduce((r, s, i) => Object(r[s]) === r[s] ? r[s] : r[s] = Math.abs(Number(n[i + 1])) >> 0 === +n[i + 1] ? [] : {}, e)[n[n.length - 1]] = o, e;
|
|
89
|
+
}, noop = () => {
|
|
90
|
+
};
|
|
91
|
+
let safeDynamicRequire = noop;
|
|
92
|
+
try {
|
|
93
|
+
safeDynamicRequire = createRequire(import.meta.url);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
try {
|
|
96
|
+
safeDynamicRequire = eval("require");
|
|
97
|
+
} catch (e) {
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const getSyncValName = (e) => `bldr_${e}_sync`, BUILDER_SET_STATE_NAME = "BUILDER_SET_STATE", INJECTED_IVM_GLOBAL = "BUILDER_IVM", REF_TO_PROXY_FN = `
|
|
101
|
+
var refToProxy = (obj) => {
|
|
102
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
103
|
+
return obj;
|
|
104
|
+
}
|
|
105
|
+
return new Proxy({}, {
|
|
106
|
+
get(target, key) {
|
|
107
|
+
if (key === 'copySync') {
|
|
108
|
+
return () => obj.copySync();
|
|
109
|
+
}
|
|
110
|
+
const val = obj.getSync(key);
|
|
111
|
+
if (typeof val?.getSync === 'function') {
|
|
112
|
+
return refToProxy(val);
|
|
113
|
+
}
|
|
114
|
+
return val;
|
|
115
|
+
},
|
|
116
|
+
set(target, key, value) {
|
|
117
|
+
const v = typeof value === 'object' ? new ${INJECTED_IVM_GLOBAL}.Reference(value) : value;
|
|
118
|
+
obj.setSync(key, v);
|
|
119
|
+
${BUILDER_SET_STATE_NAME}(key, value)
|
|
120
|
+
},
|
|
121
|
+
deleteProperty(target, key) {
|
|
122
|
+
obj.deleteSync(key);
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
`, processCode = ({
|
|
127
|
+
code: e,
|
|
128
|
+
args: t
|
|
129
|
+
}) => {
|
|
130
|
+
const o = t.map(([n]) => `var ${n} = refToProxy(${getSyncValName(n)}); `).join("");
|
|
131
|
+
return `
|
|
132
|
+
${REF_TO_PROXY_FN}
|
|
133
|
+
${o}
|
|
134
|
+
function theFunction() {
|
|
135
|
+
${e}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const output = theFunction()
|
|
139
|
+
|
|
140
|
+
if (typeof output === 'object' && output !== null) {
|
|
141
|
+
return JSON.stringify(output.copySync ? output.copySync() : output);
|
|
142
|
+
} else {
|
|
143
|
+
return output;
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
};
|
|
147
|
+
let IVM_INSTANCE = null, IVM_CONTEXT = null;
|
|
148
|
+
const setIvm = (e, t = {}) => {
|
|
149
|
+
IVM_INSTANCE = e, setIsolateContext(t);
|
|
150
|
+
}, SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik" || SDK_NAME === "@builder.io/sdk-vue", getIvm = () => {
|
|
151
|
+
try {
|
|
152
|
+
if (IVM_INSTANCE)
|
|
153
|
+
return IVM_INSTANCE;
|
|
154
|
+
const t = safeDynamicRequire("isolated-vm");
|
|
155
|
+
if (t)
|
|
156
|
+
return t;
|
|
157
|
+
} catch (t) {
|
|
158
|
+
logger.error("isolated-vm import error.", t);
|
|
159
|
+
}
|
|
160
|
+
const e = `${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
161
|
+
|
|
162
|
+
SOLUTION: In a server-only execution path within your application, do one of the following:
|
|
163
|
+
|
|
164
|
+
${SHOULD_MENTION_INITIALIZE_SCRIPT ? `- import and call \`initializeNodeRuntime()\` from "${SDK_NAME}/node/init".` : ""}
|
|
165
|
+
- add the following import: \`await import('isolated-vm')\`.
|
|
166
|
+
|
|
167
|
+
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;
|
|
168
|
+
throw new Error(e);
|
|
169
|
+
};
|
|
170
|
+
function setIsolateContext(e = {
|
|
171
|
+
memoryLimit: 128
|
|
172
|
+
}) {
|
|
173
|
+
const t = getIvm(), n = new t.Isolate(e).createContextSync(), r = n.global;
|
|
174
|
+
return r.setSync("global", r.derefInto()), r.setSync("log", function(...s) {
|
|
175
|
+
console.log(...s);
|
|
176
|
+
}), r.setSync(INJECTED_IVM_GLOBAL, t), IVM_CONTEXT = n, n;
|
|
177
|
+
}
|
|
178
|
+
const getIsolateContext = () => IVM_CONTEXT || setIsolateContext(), runInNode = ({
|
|
179
|
+
code: e,
|
|
180
|
+
builder: t,
|
|
181
|
+
context: o,
|
|
182
|
+
event: n,
|
|
183
|
+
localState: r,
|
|
184
|
+
rootSetState: s,
|
|
185
|
+
rootState: i
|
|
186
|
+
}) => {
|
|
187
|
+
const f = getIvm(), m = fastClone({
|
|
188
|
+
...i,
|
|
189
|
+
...r
|
|
190
|
+
}), u = getFunctionArguments({
|
|
191
|
+
builder: t,
|
|
192
|
+
context: o,
|
|
193
|
+
event: n,
|
|
194
|
+
state: m
|
|
195
|
+
}), l = getIsolateContext(), d = l.global;
|
|
196
|
+
d.setSync(BUILDER_SET_STATE_NAME, function(c, a) {
|
|
197
|
+
set(i, c, a), s == null || s(i);
|
|
198
|
+
}), u.forEach(([c, a]) => {
|
|
199
|
+
const E = typeof a == "object" ? new f.Reference(
|
|
200
|
+
// workaround: methods with default values for arguments is not being cloned over
|
|
201
|
+
c === "builder" ? {
|
|
202
|
+
...a,
|
|
203
|
+
getUserAttributes: () => a.getUserAttributes()
|
|
204
|
+
} : a
|
|
205
|
+
) : null;
|
|
206
|
+
d.setSync(getSyncValName(c), E);
|
|
207
|
+
});
|
|
208
|
+
const p = processCode({
|
|
209
|
+
code: e,
|
|
210
|
+
args: u
|
|
211
|
+
}), g = l.evalClosureSync(p);
|
|
212
|
+
try {
|
|
213
|
+
return JSON.parse(g);
|
|
214
|
+
} catch {
|
|
215
|
+
return g;
|
|
216
|
+
}
|
|
217
|
+
}, checkIsDefined = (e) => e != null;
|
|
218
|
+
function isNodeRuntime() {
|
|
219
|
+
var e;
|
|
220
|
+
return typeof process < "u" && checkIsDefined((e = process == null ? void 0 : process.versions) == null ? void 0 : e.node);
|
|
221
|
+
}
|
|
222
|
+
const shouldForceBrowserRuntimeInNode = ({
|
|
223
|
+
shouldLogWarning: e
|
|
224
|
+
}) => {
|
|
225
|
+
var r;
|
|
226
|
+
if (!isNodeRuntime())
|
|
227
|
+
return !1;
|
|
228
|
+
const t = process.arch === "arm64", o = process.version.startsWith("v20"), n = (r = process.env.NODE_OPTIONS) == null ? void 0 : r.includes("--no-node-snapshot");
|
|
229
|
+
return t && o && !n ? (e && logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "), !0) : !1;
|
|
230
|
+
};
|
|
231
|
+
export {
|
|
232
|
+
TARGET as T,
|
|
233
|
+
getBuilderGlobals as a,
|
|
234
|
+
set as b,
|
|
235
|
+
getSearchString as c,
|
|
236
|
+
checkIsDefined as d,
|
|
237
|
+
isEditing as e,
|
|
238
|
+
fastClone as f,
|
|
239
|
+
getFunctionArguments as g,
|
|
240
|
+
getUserAttributes as h,
|
|
241
|
+
isBrowser as i,
|
|
242
|
+
setIvm as j,
|
|
243
|
+
logger as l,
|
|
244
|
+
normalizeSearchParams as n,
|
|
245
|
+
parseCode as p,
|
|
246
|
+
runInNode as r,
|
|
247
|
+
shouldForceBrowserRuntimeInNode as s
|
|
248
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";const node_module=require("node:module");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;const TARGET="vue",MSG_PREFIX="[Builder.io]: ",logger={log:(...e)=>console.log(MSG_PREFIX,...e),error:(...e)=>console.error(MSG_PREFIX,...e),warn:(...e)=>console.warn(MSG_PREFIX,...e),debug:(...e)=>console.debug(MSG_PREFIX,...e)};function isBrowser(){return typeof window<"u"&&typeof document<"u"}const convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((o,n)=>{t[n]=o}),t},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,getSearchString=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(e){return isIframe()&&getSearchString(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const getLocation=()=>{if(isBrowser()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},getUserAgent=()=>typeof navigator=="object"&&navigator.userAgent||"",getUserAttributes=()=>{const e=getUserAgent(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||TARGET==="reactNative"}},o=e.match(/Tablet|iPad/i),n=getLocation();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:o?"tablet":t.any()?"mobile":"desktop"}},getFunctionArguments=({builder:e,context:t,event:o,state:n})=>Object.entries({state:n,Builder:e,builder:e,context:t,event:o}),getBuilderGlobals=()=>({isEditing:isEditing(),isBrowser:isBrowser(),isServer:!isBrowser(),getUserAttributes:()=>getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,SDK_NAME_FOR_TARGET=(()=>{switch(TARGET){case"rsc":return"react-nextjs";case"reactNative":return"react-native";default:return TARGET}})(),SDK_NAME=`@builder.io/sdk-${SDK_NAME_FOR_TARGET}`,fastClone=e=>JSON.parse(JSON.stringify(e)),set=(e,t,o)=>{if(Object(e)!==e)return e;const n=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return n.slice(0,-1).reduce((r,s,i)=>Object(r[s])===r[s]?r[s]:r[s]=Math.abs(Number(n[i+1]))>>0===+n[i+1]?[]:{},e)[n[n.length-1]]=o,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=node_module.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.src||new URL("should-force-browser-runtime-in-node-cm1lg4FM.cjs",document.baseURI).href)}catch(error){try{safeDynamicRequire=eval("require")}catch(e){}}const getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
|
|
2
|
+
var refToProxy = (obj) => {
|
|
3
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
4
|
+
return obj;
|
|
5
|
+
}
|
|
6
|
+
return new Proxy({}, {
|
|
7
|
+
get(target, key) {
|
|
8
|
+
if (key === 'copySync') {
|
|
9
|
+
return () => obj.copySync();
|
|
10
|
+
}
|
|
11
|
+
const val = obj.getSync(key);
|
|
12
|
+
if (typeof val?.getSync === 'function') {
|
|
13
|
+
return refToProxy(val);
|
|
14
|
+
}
|
|
15
|
+
return val;
|
|
16
|
+
},
|
|
17
|
+
set(target, key, value) {
|
|
18
|
+
const v = typeof value === 'object' ? new ${INJECTED_IVM_GLOBAL}.Reference(value) : value;
|
|
19
|
+
obj.setSync(key, v);
|
|
20
|
+
${BUILDER_SET_STATE_NAME}(key, value)
|
|
21
|
+
},
|
|
22
|
+
deleteProperty(target, key) {
|
|
23
|
+
obj.deleteSync(key);
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
`,processCode=({code:e,args:t})=>{const o=t.map(([n])=>`var ${n} = refToProxy(${getSyncValName(n)}); `).join("");return`
|
|
28
|
+
${REF_TO_PROXY_FN}
|
|
29
|
+
${o}
|
|
30
|
+
function theFunction() {
|
|
31
|
+
${e}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const output = theFunction()
|
|
35
|
+
|
|
36
|
+
if (typeof output === 'object' && output !== null) {
|
|
37
|
+
return JSON.stringify(output.copySync ? output.copySync() : output);
|
|
38
|
+
} else {
|
|
39
|
+
return output;
|
|
40
|
+
}
|
|
41
|
+
`};let IVM_INSTANCE=null,IVM_CONTEXT=null;const setIvm=(e,t={})=>{IVM_INSTANCE=e,setIsolateContext(t)},SHOULD_MENTION_INITIALIZE_SCRIPT=SDK_NAME==="@builder.io/sdk-react-nextjs"||SDK_NAME==="@builder.io/sdk-react"||SDK_NAME==="@builder.io/sdk-qwik"||SDK_NAME==="@builder.io/sdk-vue",getIvm=()=>{try{if(IVM_INSTANCE)return IVM_INSTANCE;const t=safeDynamicRequire("isolated-vm");if(t)return t}catch(t){logger.error("isolated-vm import error.",t)}const e=`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
42
|
+
|
|
43
|
+
SOLUTION: In a server-only execution path within your application, do one of the following:
|
|
44
|
+
|
|
45
|
+
${SHOULD_MENTION_INITIALIZE_SCRIPT?`- import and call \`initializeNodeRuntime()\` from "${SDK_NAME}/node/init".`:""}
|
|
46
|
+
- add the following import: \`await import('isolated-vm')\`.
|
|
47
|
+
|
|
48
|
+
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(e)};function setIsolateContext(e={memoryLimit:128}){const t=getIvm(),n=new t.Isolate(e).createContextSync(),r=n.global;return r.setSync("global",r.derefInto()),r.setSync("log",function(...s){console.log(...s)}),r.setSync(INJECTED_IVM_GLOBAL,t),IVM_CONTEXT=n,n}const getIsolateContext=()=>IVM_CONTEXT||setIsolateContext(),runInNode=({code:e,builder:t,context:o,event:n,localState:r,rootSetState:s,rootState:i})=>{const g=getIvm(),m=fastClone({...i,...r}),u=getFunctionArguments({builder:t,context:o,event:n,state:m}),l=getIsolateContext(),d=l.global;d.setSync(BUILDER_SET_STATE_NAME,function(c,a){set(i,c,a),s==null||s(i)}),u.forEach(([c,a])=>{const S=typeof a=="object"?new g.Reference(c==="builder"?{...a,getUserAttributes:()=>a.getUserAttributes()}:a):null;d.setSync(getSyncValName(c),S)});const f=processCode({code:e,args:u}),p=l.evalClosureSync(f);try{return JSON.parse(p)}catch{return p}},checkIsDefined=e=>e!=null;function isNodeRuntime(){var e;return typeof process<"u"&&checkIsDefined((e=process==null?void 0:process.versions)==null?void 0:e.node)}const shouldForceBrowserRuntimeInNode=({shouldLogWarning:e})=>{var r;if(!isNodeRuntime())return!1;const t=process.arch==="arm64",o=process.version.startsWith("v20"),n=(r=process.env.NODE_OPTIONS)==null?void 0:r.includes("--no-node-snapshot");return t&&o&&!n?(e&&logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "),!0):!1};exports.TARGET=TARGET;exports.checkIsDefined=checkIsDefined;exports.fastClone=fastClone;exports.getBuilderGlobals=getBuilderGlobals;exports.getFunctionArguments=getFunctionArguments;exports.getSearchString=getSearchString;exports.getUserAttributes=getUserAttributes;exports.isBrowser=isBrowser;exports.isEditing=isEditing;exports.logger=logger;exports.normalizeSearchParams=normalizeSearchParams;exports.parseCode=parseCode;exports.runInNode=runInNode;exports.set=set;exports.setIvm=setIvm;exports.shouldForceBrowserRuntimeInNode=shouldForceBrowserRuntimeInNode;
|
package/lib/node/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.component-
|
|
1
|
+
.component-1k2igrjdg3x[data-v-162df12b]{display:flex;flex-direction:column;align-items:stretch}.div-4wbls88y960[data-v-adc066fc]{display:flex;line-height:normal}.img-29wpyomtntv[data-v-77f8a6c4]{opacity:1;transition:opacity .2s ease-in-out}.div-29wpyomtntv[data-v-77f8a6c4]{width:100%;pointer-events:none;font-size:0}.div-29wpyomtntv-2[data-v-77f8a6c4]{display:flex;flex-direction:column;align-items:stretch;position:absolute;top:0;left:0;width:100%;height:100%}.pre-3q96myty4lk[data-v-6e18f21b]{padding:10px;color:red;text-align:center}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
|
|
3
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
4
|
+
// initialize Isolated VM on node runtime
|
|
5
|
+
if (process.server || import.meta.server) {
|
|
6
|
+
async function importIsolatedVM() {
|
|
7
|
+
const { initializeNodeRuntime } = await import(
|
|
8
|
+
'@builder.io/sdk-vue/node/init'
|
|
9
|
+
);
|
|
10
|
+
initializeNodeRuntime();
|
|
11
|
+
}
|
|
12
|
+
importIsolatedVM();
|
|
13
|
+
}
|
|
14
|
+
});
|
package/nuxt.js
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
import { defineNuxtModule } from '@nuxt/kit';
|
|
1
|
+
import { addPlugin, defineNuxtModule } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
export default defineNuxtModule({
|
|
4
4
|
setup(options, nuxt) {
|
|
5
|
+
const includeCompiledCss = options.includeCompiledCss ?? true;
|
|
6
|
+
const initializeNodeRuntime = options.initializeNodeRuntime ?? false;
|
|
5
7
|
/**
|
|
6
8
|
* Add the compiled Builder.io CSS to the Nuxt CSS array.
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
if (includeCompiledCss) {
|
|
11
|
+
nuxt.options.css.push('@builder.io/sdk-vue/css');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This is because Vite tries to optimize the isolated-vm dependency while
|
|
15
|
+
* running the dev server (first build), which is not needed and throws an error.
|
|
16
|
+
* `isolated-vm` is a Node.js native module which should only be imported and used in Node.js environments.
|
|
17
|
+
*/
|
|
18
|
+
if (initializeNodeRuntime) {
|
|
19
|
+
if (nuxt.options.vite?.optimizeDeps?.exclude) {
|
|
20
|
+
nuxt.options.vite.optimizeDeps.exclude.push(
|
|
21
|
+
'@builder.io/sdk-vue/node/init'
|
|
22
|
+
);
|
|
23
|
+
} else {
|
|
24
|
+
nuxt.options.vite = {
|
|
25
|
+
...nuxt.options.vite,
|
|
26
|
+
optimizeDeps: {
|
|
27
|
+
...nuxt.options.vite?.optimizeDeps,
|
|
28
|
+
exclude: ['@builder.io/sdk-vue/node/init'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
addPlugin({
|
|
34
|
+
src: './nuxt-isolated-vm-plugin.js',
|
|
35
|
+
mode: 'server',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
9
38
|
},
|
|
10
39
|
});
|
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": "2.0.
|
|
4
|
+
"version": "2.0.20",
|
|
5
5
|
"main": "./lib/node/index.cjs",
|
|
6
6
|
"module": "./lib/node/index.mjs",
|
|
7
7
|
"type": "module",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"lib",
|
|
16
|
-
"nuxt.js"
|
|
16
|
+
"nuxt.js",
|
|
17
|
+
"nuxt-isolated-vm-plugin.js"
|
|
17
18
|
],
|
|
18
19
|
"sideEffects": [
|
|
19
20
|
"./lib/browser/style.css",
|
|
@@ -82,6 +83,10 @@
|
|
|
82
83
|
"import": "./lib/browser/index.mjs",
|
|
83
84
|
"require": "./lib/browser/index.cjs"
|
|
84
85
|
}
|
|
86
|
+
},
|
|
87
|
+
"./node/init": {
|
|
88
|
+
"import": "./lib/node/init.mjs",
|
|
89
|
+
"require": "./lib/node/init.cjs"
|
|
85
90
|
}
|
|
86
91
|
},
|
|
87
92
|
"scripts": {
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import "./style.css";
|
|
2
|
-
import { defineComponent as m, openBlock as r, createBlock as a, resolveDynamicComponent as k, mergeProps as u, withCtx as d, renderSlot as h, resolveComponent as B, normalizeProps as P, createElementBlock as g, Fragment as $, renderList as v, createCommentVNode as S } from "vue";
|
|
3
|
-
import { e as f, B as W, w } from "./index-LzjDY2XM.js";
|
|
4
|
-
import { a as b, g as R } from "./get-block-properties-9178299s.js";
|
|
5
|
-
const x = m({
|
|
6
|
-
name: "interactive-element",
|
|
7
|
-
props: ["includeBlockProps", "block", "context", "wrapperProps", "Wrapper"],
|
|
8
|
-
computed: {
|
|
9
|
-
attributes() {
|
|
10
|
-
return this.includeBlockProps ? {
|
|
11
|
-
...b({
|
|
12
|
-
block: this.block,
|
|
13
|
-
context: this.context
|
|
14
|
-
}),
|
|
15
|
-
...R({
|
|
16
|
-
block: this.block,
|
|
17
|
-
rootState: this.context.rootState,
|
|
18
|
-
rootSetState: this.context.rootSetState,
|
|
19
|
-
localState: this.context.localState,
|
|
20
|
-
context: this.context.context
|
|
21
|
-
})
|
|
22
|
-
} : {};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
function I(e, t, p, s, o, c) {
|
|
27
|
-
return r(), a(k(e.Wrapper), u({ attributes: e.attributes }, e.wrapperProps), {
|
|
28
|
-
default: d(() => [
|
|
29
|
-
h(e.$slots, "default")
|
|
30
|
-
]),
|
|
31
|
-
_: 3
|
|
32
|
-
}, 16, ["attributes"]);
|
|
33
|
-
}
|
|
34
|
-
const l = /* @__PURE__ */ f(x, [["render", I]]), E = ({
|
|
35
|
-
componentOptions: e,
|
|
36
|
-
builderBlock: t,
|
|
37
|
-
context: p,
|
|
38
|
-
componentRef: s,
|
|
39
|
-
includeBlockProps: o,
|
|
40
|
-
isInteractive: c,
|
|
41
|
-
contextValue: i
|
|
42
|
-
}) => {
|
|
43
|
-
const n = {
|
|
44
|
-
...e,
|
|
45
|
-
/**
|
|
46
|
-
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
47
|
-
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
48
|
-
*/
|
|
49
|
-
...o ? {
|
|
50
|
-
attributes: b({
|
|
51
|
-
block: t,
|
|
52
|
-
context: i
|
|
53
|
-
})
|
|
54
|
-
} : {}
|
|
55
|
-
};
|
|
56
|
-
return c ? {
|
|
57
|
-
Wrapper: s,
|
|
58
|
-
block: t,
|
|
59
|
-
context: p,
|
|
60
|
-
wrapperProps: e,
|
|
61
|
-
includeBlockProps: o
|
|
62
|
-
} : n;
|
|
63
|
-
}, y = m({
|
|
64
|
-
name: "component-ref",
|
|
65
|
-
components: { Block: W, InteractiveElement: l },
|
|
66
|
-
props: [
|
|
67
|
-
"isInteractive",
|
|
68
|
-
"componentRef",
|
|
69
|
-
"componentOptions",
|
|
70
|
-
"builderBlock",
|
|
71
|
-
"context",
|
|
72
|
-
"linkComponent",
|
|
73
|
-
"includeBlockProps",
|
|
74
|
-
"blockChildren",
|
|
75
|
-
"registeredComponents"
|
|
76
|
-
],
|
|
77
|
-
data() {
|
|
78
|
-
return {
|
|
79
|
-
Wrapper: this.isInteractive ? w(l) : this.componentRef,
|
|
80
|
-
getWrapperProps: E
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
function A(e, t, p, s, o, c) {
|
|
85
|
-
const i = B("Block");
|
|
86
|
-
return e.componentRef ? (r(), a(k(e.Wrapper), P(u(
|
|
87
|
-
{ key: 0 },
|
|
88
|
-
e.getWrapperProps({
|
|
89
|
-
componentOptions: e.componentOptions,
|
|
90
|
-
builderBlock: e.builderBlock,
|
|
91
|
-
context: e.context,
|
|
92
|
-
componentRef: e.componentRef,
|
|
93
|
-
linkComponent: e.linkComponent,
|
|
94
|
-
includeBlockProps: e.includeBlockProps,
|
|
95
|
-
isInteractive: e.isInteractive,
|
|
96
|
-
contextValue: e.context
|
|
97
|
-
})
|
|
98
|
-
)), {
|
|
99
|
-
default: d(() => [
|
|
100
|
-
(r(!0), g($, null, v(e.blockChildren, (n, C) => (r(), a(i, {
|
|
101
|
-
key: n.id,
|
|
102
|
-
block: n,
|
|
103
|
-
context: e.context,
|
|
104
|
-
registeredComponents: e.registeredComponents,
|
|
105
|
-
linkComponent: e.linkComponent
|
|
106
|
-
}, null, 8, ["block", "context", "registeredComponents", "linkComponent"]))), 128))
|
|
107
|
-
]),
|
|
108
|
-
_: 1
|
|
109
|
-
}, 16)) : S("", !0);
|
|
110
|
-
}
|
|
111
|
-
const F = /* @__PURE__ */ f(y, [["render", A]]);
|
|
112
|
-
export {
|
|
113
|
-
F as default
|
|
114
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var P=require("./style.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),c=require("./index-NFUE2Jgz.cjs"),a=require("./get-block-properties-EYg8xaCR.cjs"),u=t.defineComponent({name:"interactive-element",props:["includeBlockProps","block","context","wrapperProps","Wrapper"],computed:{attributes(){return this.includeBlockProps?{...a.getBlockProperties({block:this.block,context:this.context}),...a.getBlockActions({block:this.block,rootState:this.context.rootState,rootSetState:this.context.rootSetState,localState:this.context.localState,context:this.context.context})}:{}}}});function d(e,o,p,s,n,i){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Wrapper),t.mergeProps({attributes:e.attributes},e.wrapperProps),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["attributes"])}const m=c._export_sfc(u,[["render",d]]),f=({componentOptions:e,builderBlock:o,context:p,componentRef:s,includeBlockProps:n,isInteractive:i,contextValue:l})=>{const r={...e,...n?{attributes:a.getBlockProperties({block:o,context:l})}:{}};return i?{Wrapper:s,block:o,context:p,wrapperProps:e,includeBlockProps:n}:r},B=t.defineComponent({name:"component-ref",components:{Block:c.Block,InteractiveElement:m},props:["isInteractive","componentRef","componentOptions","builderBlock","context","linkComponent","includeBlockProps","blockChildren","registeredComponents"],data(){return{Wrapper:this.isInteractive?c.wrapComponentRef(m):this.componentRef,getWrapperProps:f}}});function b(e,o,p,s,n,i){const l=t.resolveComponent("Block");return e.componentRef?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Wrapper),t.normalizeProps(t.mergeProps({key:0},e.getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}))),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.blockChildren,(r,k)=>(t.openBlock(),t.createBlock(l,{key:r.id,block:r,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},null,8,["block","context","registeredComponents","linkComponent"]))),128))]),_:1},16)):t.createCommentVNode("",!0)}const C=c._export_sfc(B,[["render",b]]);exports.default=C;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),c=require("./index-sCP9BbUb.cjs"),a=require("./get-block-properties-YnnLDBjt.cjs"),u=t.defineComponent({name:"interactive-element",props:["includeBlockProps","block","context","wrapperProps","Wrapper"],computed:{attributes(){return this.includeBlockProps?{...a.getBlockProperties({block:this.block,context:this.context}),...a.getBlockActions({block:this.block,rootState:this.context.rootState,rootSetState:this.context.rootSetState,localState:this.context.localState,context:this.context.context})}:{}}}});function d(e,o,p,s,n,i){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Wrapper),t.mergeProps({attributes:e.attributes},e.wrapperProps),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["attributes"])}const m=c._export_sfc(u,[["render",d]]),f=({componentOptions:e,builderBlock:o,context:p,componentRef:s,includeBlockProps:n,isInteractive:i,contextValue:l})=>{const r={...e,...n?{attributes:a.getBlockProperties({block:o,context:l})}:{}};return i?{Wrapper:s,block:o,context:p,wrapperProps:e,includeBlockProps:n}:r},B=t.defineComponent({name:"component-ref",components:{Block:c.Block,InteractiveElement:m},props:["isInteractive","componentRef","componentOptions","builderBlock","context","linkComponent","includeBlockProps","blockChildren","registeredComponents"],data(){return{Wrapper:this.isInteractive?c.wrapComponentRef(m):this.componentRef,getWrapperProps:f}}});function b(e,o,p,s,n,i){const l=t.resolveComponent("Block");return e.componentRef?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Wrapper),t.normalizeProps(t.mergeProps({key:0},e.getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}))),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.blockChildren,(r,k)=>(t.openBlock(),t.createBlock(l,{key:r.id,block:r,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},null,8,["block","context","registeredComponents","linkComponent"]))),128))]),_:1},16)):t.createCommentVNode("",!0)}const C=c._export_sfc(B,[["render",b]]);exports.default=C;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { defineComponent as m, openBlock as r, createBlock as a, resolveDynamicComponent as k, mergeProps as u, withCtx as d, renderSlot as h, resolveComponent as B, normalizeProps as P, createElementBlock as g, Fragment as $, renderList as v, createCommentVNode as S } from "vue";
|
|
2
|
-
import { e as f, B as W, w } from "./index-_G5Jct0s.js";
|
|
3
|
-
import { a as b, g as R } from "./get-block-properties-1IIhEm1L.js";
|
|
4
|
-
const x = m({
|
|
5
|
-
name: "interactive-element",
|
|
6
|
-
props: ["includeBlockProps", "block", "context", "wrapperProps", "Wrapper"],
|
|
7
|
-
computed: {
|
|
8
|
-
attributes() {
|
|
9
|
-
return this.includeBlockProps ? {
|
|
10
|
-
...b({
|
|
11
|
-
block: this.block,
|
|
12
|
-
context: this.context
|
|
13
|
-
}),
|
|
14
|
-
...R({
|
|
15
|
-
block: this.block,
|
|
16
|
-
rootState: this.context.rootState,
|
|
17
|
-
rootSetState: this.context.rootSetState,
|
|
18
|
-
localState: this.context.localState,
|
|
19
|
-
context: this.context.context
|
|
20
|
-
})
|
|
21
|
-
} : {};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
function I(e, t, p, s, o, c) {
|
|
26
|
-
return r(), a(k(e.Wrapper), u({ attributes: e.attributes }, e.wrapperProps), {
|
|
27
|
-
default: d(() => [
|
|
28
|
-
h(e.$slots, "default")
|
|
29
|
-
]),
|
|
30
|
-
_: 3
|
|
31
|
-
}, 16, ["attributes"]);
|
|
32
|
-
}
|
|
33
|
-
const l = /* @__PURE__ */ f(x, [["render", I]]), E = ({
|
|
34
|
-
componentOptions: e,
|
|
35
|
-
builderBlock: t,
|
|
36
|
-
context: p,
|
|
37
|
-
componentRef: s,
|
|
38
|
-
includeBlockProps: o,
|
|
39
|
-
isInteractive: c,
|
|
40
|
-
contextValue: i
|
|
41
|
-
}) => {
|
|
42
|
-
const n = {
|
|
43
|
-
...e,
|
|
44
|
-
/**
|
|
45
|
-
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
46
|
-
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
47
|
-
*/
|
|
48
|
-
...o ? {
|
|
49
|
-
attributes: b({
|
|
50
|
-
block: t,
|
|
51
|
-
context: i
|
|
52
|
-
})
|
|
53
|
-
} : {}
|
|
54
|
-
};
|
|
55
|
-
return c ? {
|
|
56
|
-
Wrapper: s,
|
|
57
|
-
block: t,
|
|
58
|
-
context: p,
|
|
59
|
-
wrapperProps: e,
|
|
60
|
-
includeBlockProps: o
|
|
61
|
-
} : n;
|
|
62
|
-
}, y = m({
|
|
63
|
-
name: "component-ref",
|
|
64
|
-
components: { Block: W, InteractiveElement: l },
|
|
65
|
-
props: [
|
|
66
|
-
"isInteractive",
|
|
67
|
-
"componentRef",
|
|
68
|
-
"componentOptions",
|
|
69
|
-
"builderBlock",
|
|
70
|
-
"context",
|
|
71
|
-
"linkComponent",
|
|
72
|
-
"includeBlockProps",
|
|
73
|
-
"blockChildren",
|
|
74
|
-
"registeredComponents"
|
|
75
|
-
],
|
|
76
|
-
data() {
|
|
77
|
-
return {
|
|
78
|
-
Wrapper: this.isInteractive ? w(l) : this.componentRef,
|
|
79
|
-
getWrapperProps: E
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
function A(e, t, p, s, o, c) {
|
|
84
|
-
const i = B("Block");
|
|
85
|
-
return e.componentRef ? (r(), a(k(e.Wrapper), P(u(
|
|
86
|
-
{ key: 0 },
|
|
87
|
-
e.getWrapperProps({
|
|
88
|
-
componentOptions: e.componentOptions,
|
|
89
|
-
builderBlock: e.builderBlock,
|
|
90
|
-
context: e.context,
|
|
91
|
-
componentRef: e.componentRef,
|
|
92
|
-
linkComponent: e.linkComponent,
|
|
93
|
-
includeBlockProps: e.includeBlockProps,
|
|
94
|
-
isInteractive: e.isInteractive,
|
|
95
|
-
contextValue: e.context
|
|
96
|
-
})
|
|
97
|
-
)), {
|
|
98
|
-
default: d(() => [
|
|
99
|
-
(r(!0), g($, null, v(e.blockChildren, (n, C) => (r(), a(i, {
|
|
100
|
-
key: n.id,
|
|
101
|
-
block: n,
|
|
102
|
-
context: e.context,
|
|
103
|
-
registeredComponents: e.registeredComponents,
|
|
104
|
-
linkComponent: e.linkComponent
|
|
105
|
-
}, null, 8, ["block", "context", "registeredComponents", "linkComponent"]))), 128))
|
|
106
|
-
]),
|
|
107
|
-
_: 1
|
|
108
|
-
}, 16)) : S("", !0);
|
|
109
|
-
}
|
|
110
|
-
const D = /* @__PURE__ */ f(y, [["render", A]]);
|
|
111
|
-
export {
|
|
112
|
-
D as default
|
|
113
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),s=require("./index-Yv0J5kjl.cjs"),f=l.defineComponent({name:"block-styles",components:{InlinedStyles:s._sfc_main},props:["block","context"],data(){return{TARGET:s.TARGET}},computed:{canShowBlock(){const e=this.block;return s.checkIsDefined(e.hide)?!e.hide:s.checkIsDefined(e.show)?e.show:!0},css(){var y,p,h;const e=this.block,t=e.responsiveStyles,c=this.context.content,a=s.getSizesForBreakpoints(((y=c==null?void 0:c.meta)==null?void 0:y.breakpoints)||{}),i=t==null?void 0:t.large,d=t==null?void 0:t.medium,r=t==null?void 0:t.small,n=e.id;if(!n)return"";const S=i?s.createCssClass({className:n,styles:i}):"",k=d?s.createCssClass({className:n,styles:d,mediaQuery:s.getMaxWidthQueryForSize("medium",a)}):"",C=r?s.createCssClass({className:n,styles:r,mediaQuery:s.getMaxWidthQueryForSize("small",a)}):"",o=e.animations&&e.animations.find(m=>m.trigger==="hover");let u="";if(o){const m=((h=(p=o.steps)==null?void 0:p[1])==null?void 0:h.styles)||{};u=s.createCssClass({className:`${n}:hover`,styles:{...m,transition:`all ${o.duration}s ${s.camelToKebabCase(o.easing)}`,transitionDelay:o.delay?`${o.delay}s`:"0s"}})||""}return[S,k,C,u].join(" ")}}});function b(e,t,c,a,i,d){const r=l.resolveComponent("InlinedStyles");return e.TARGET!=="reactNative"&&e.css&&e.canShowBlock?(l.openBlock(),l.createBlock(r,{key:0,id:"builderio-block",styles:e.css,nonce:e.context.nonce},null,8,["styles","nonce"])):l.createCommentVNode("",!0)}const g=s._export_sfc(f,[["render",b]]);exports.default=g;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),c=require("./index-Yv0J5kjl.cjs"),a=require("./get-block-properties-WxCzIZPQ.cjs"),u=t.defineComponent({name:"interactive-element",props:["includeBlockProps","block","context","wrapperProps","Wrapper"],computed:{attributes(){return this.includeBlockProps?{...a.getBlockProperties({block:this.block,context:this.context}),...a.getBlockActions({block:this.block,rootState:this.context.rootState,rootSetState:this.context.rootSetState,localState:this.context.localState,context:this.context.context})}:{}}}});function d(e,o,p,s,n,i){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Wrapper),t.mergeProps({attributes:e.attributes},e.wrapperProps),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"default")]),_:3},16,["attributes"])}const m=c._export_sfc(u,[["render",d]]),f=({componentOptions:e,builderBlock:o,context:p,componentRef:s,includeBlockProps:n,isInteractive:i,contextValue:l})=>{const r={...e,...n?{attributes:a.getBlockProperties({block:o,context:l})}:{}};return i?{Wrapper:s,block:o,context:p,wrapperProps:e,includeBlockProps:n}:r},B=t.defineComponent({name:"component-ref",components:{Block:c.Block,InteractiveElement:m},props:["isInteractive","componentRef","componentOptions","builderBlock","context","linkComponent","includeBlockProps","blockChildren","registeredComponents"],data(){return{Wrapper:this.isInteractive?c.wrapComponentRef(m):this.componentRef,getWrapperProps:f}}});function b(e,o,p,s,n,i){const l=t.resolveComponent("Block");return e.componentRef?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.Wrapper),t.normalizeProps(t.mergeProps({key:0},e.getWrapperProps({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}))),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.blockChildren,(r,k)=>(t.openBlock(),t.createBlock(l,{key:r.id,block:r,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},null,8,["block","context","registeredComponents","linkComponent"]))),128))]),_:1},16)):t.createCommentVNode("",!0)}const C=c._export_sfc(B,[["render",b]]);exports.default=C;
|