@builder.io/sdk-vue 2.0.8 → 2.0.14-1
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/lib/browser/block-styles-nWGppwAf.js +77 -0
- package/lib/browser/block-styles-rt4v7rBl.cjs +1 -0
- package/lib/browser/{block-wrapper-H_K5XgNp.js → block-wrapper-hPYvxseU.js} +3 -3
- package/lib/browser/{block-wrapper-vI9rE_qz.cjs → block-wrapper-l_mdj42t.cjs} +1 -1
- package/lib/browser/blocks/accordion/accordion.vue.d.ts +6 -6
- package/lib/browser/blocks/button/button.vue.d.ts +3 -3
- package/lib/browser/blocks/columns/columns.vue.d.ts +9 -9
- package/lib/browser/blocks/form/form/form.vue.d.ts +9 -9
- package/lib/browser/blocks/form/input/input.vue.d.ts +3 -3
- package/lib/browser/blocks/form/select/select.vue.d.ts +3 -3
- package/lib/browser/blocks/image/image.vue.d.ts +3 -3
- package/lib/browser/blocks/img/img.vue.d.ts +3 -3
- package/lib/browser/blocks/section/section.vue.d.ts +3 -3
- package/lib/browser/blocks/slot/slot.vue.d.ts +5 -2
- package/lib/browser/blocks/symbol/symbol.vue.d.ts +9 -9
- package/lib/browser/blocks/tabs/tabs.vue.d.ts +3 -3
- package/lib/browser/blocks/video/video.vue.d.ts +6 -6
- package/lib/browser/{component-ref-ULmI7Z-4.js → component-ref-JlpkOrad.js} +2 -2
- package/lib/browser/{component-ref-k4s0KRD5.cjs → component-ref-dPnPtrON.cjs} +1 -1
- package/lib/browser/components/block/block.helpers.d.ts +1 -2
- package/lib/browser/components/block/block.vue.d.ts +10 -5
- package/lib/browser/components/block/components/block-styles.vue.d.ts +1 -1
- package/lib/browser/components/block/components/component-ref/component-ref.vue.d.ts +6 -6
- package/lib/browser/components/block/components/repeated-block.vue.d.ts +3 -3
- package/lib/browser/components/blocks/blocks.vue.d.ts +3 -3
- package/lib/browser/components/content/components/enable-editor.vue.d.ts +12 -12
- package/lib/browser/components/content/content.vue.d.ts +18 -18
- package/lib/browser/components/content-variants/content-variants.vue.d.ts +12 -12
- package/lib/browser/components/inlined-styles.vue.d.ts +3 -3
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/functions/evaluate/node-runtime/init.d.ts +1 -0
- package/lib/browser/functions/get-processed-block.d.ts +1 -0
- package/lib/browser/functions/register-component.d.ts +1 -1
- package/lib/{node/get-block-properties-ctA1IgxF.js → browser/get-block-properties-HzVZCpxa.js} +20 -18
- package/lib/browser/get-block-properties-sInACBRh.cjs +1 -0
- package/lib/browser/index-MDNnQzZB.cjs +166 -0
- package/lib/browser/{index-wQ1FWMHJ.js → index-ZL8QUFiN.js} +1416 -1371
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/browser/init.cjs +8 -0
- package/lib/browser/init.mjs +65 -0
- package/lib/browser/logger-0-1mARBa.cjs +1 -0
- package/lib/browser/logger-Hm2e1Xk_.js +12 -0
- package/lib/browser/{repeated-block-Aa1yIQkp.js → repeated-block-8EN4xN25.js} +2 -2
- package/lib/browser/{repeated-block-UKWYkgKG.cjs → repeated-block-uV-zuqkw.cjs} +1 -1
- package/lib/browser/style.css +1 -1
- package/lib/edge/block-styles-Ta3OQAmE.cjs +1 -0
- package/lib/edge/block-styles-zRPUnWLf.js +76 -0
- package/lib/{node/block-wrapper-QqrLFWp0.cjs → edge/block-wrapper-9IWz2vxg.cjs} +1 -1
- package/lib/{node/block-wrapper-4h3CaVrk.js → edge/block-wrapper-x7ERONr-.js} +5 -5
- package/lib/edge/blocks/accordion/accordion.vue.d.ts +6 -6
- package/lib/edge/blocks/button/button.vue.d.ts +3 -3
- package/lib/edge/blocks/columns/columns.vue.d.ts +9 -9
- package/lib/edge/blocks/form/form/form.vue.d.ts +9 -9
- package/lib/edge/blocks/form/input/input.vue.d.ts +3 -3
- package/lib/edge/blocks/form/select/select.vue.d.ts +3 -3
- package/lib/edge/blocks/image/image.vue.d.ts +3 -3
- package/lib/edge/blocks/img/img.vue.d.ts +3 -3
- package/lib/edge/blocks/section/section.vue.d.ts +3 -3
- package/lib/edge/blocks/slot/slot.vue.d.ts +5 -2
- package/lib/edge/blocks/symbol/symbol.vue.d.ts +9 -9
- package/lib/edge/blocks/tabs/tabs.vue.d.ts +3 -3
- package/lib/edge/blocks/video/video.vue.d.ts +6 -6
- package/lib/{node/component-ref-hI62zIZA.js → edge/component-ref-JRfa9Vwo.js} +2 -2
- package/lib/{node/component-ref-NW-UB2pJ.cjs → edge/component-ref-eV0RBAzs.cjs} +1 -1
- package/lib/edge/components/block/block.helpers.d.ts +1 -2
- package/lib/edge/components/block/block.vue.d.ts +10 -5
- package/lib/edge/components/block/components/block-styles.vue.d.ts +1 -1
- package/lib/edge/components/block/components/component-ref/component-ref.vue.d.ts +6 -6
- package/lib/edge/components/block/components/repeated-block.vue.d.ts +3 -3
- package/lib/edge/components/blocks/blocks.vue.d.ts +3 -3
- package/lib/edge/components/content/components/enable-editor.vue.d.ts +12 -12
- package/lib/edge/components/content/content.vue.d.ts +18 -18
- package/lib/edge/components/content-variants/content-variants.vue.d.ts +12 -12
- package/lib/edge/components/inlined-styles.vue.d.ts +3 -3
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/functions/evaluate/node-runtime/init.d.ts +1 -0
- package/lib/edge/functions/get-processed-block.d.ts +1 -0
- package/lib/edge/functions/register-component.d.ts +1 -1
- package/lib/edge/get-block-properties-Dy3XF05J.cjs +1 -0
- package/lib/{browser/get-block-properties-IjhCV9z_.js → edge/get-block-properties-PLBPSz3W.js} +15 -15
- package/lib/edge/index-5-C3UhJz.cjs +186 -0
- package/lib/edge/{index-yARC0VI1.js → index-TGe9_80q.js} +1696 -1651
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +4 -4
- package/lib/edge/init.cjs +8 -0
- package/lib/edge/init.mjs +64 -0
- package/lib/edge/logger-I8FmJD_1.js +11 -0
- package/lib/edge/logger-U9-0vDJK.cjs +1 -0
- package/lib/edge/{repeated-block-q6gyu9cH.cjs → repeated-block-FB2jF4o_.cjs} +1 -1
- package/lib/edge/{repeated-block-IdOOvFG5.js → repeated-block-_9Gs2AOY.js} +13 -13
- package/lib/edge/style.css +1 -1
- package/lib/node/block-styles-gLB-jSXN.js +76 -0
- package/lib/node/block-styles-u7KGnyuc.cjs +1 -0
- package/lib/{edge/block-wrapper-P5w2jQ_u.cjs → node/block-wrapper-cCYzfiv5.cjs} +1 -1
- package/lib/{edge/block-wrapper-M3goYBkP.js → node/block-wrapper-frfIIST_.js} +3 -3
- package/lib/node/blocks/accordion/accordion.vue.d.ts +6 -6
- package/lib/node/blocks/button/button.vue.d.ts +3 -3
- package/lib/node/blocks/columns/columns.vue.d.ts +9 -9
- package/lib/node/blocks/form/form/form.vue.d.ts +9 -9
- package/lib/node/blocks/form/input/input.vue.d.ts +3 -3
- package/lib/node/blocks/form/select/select.vue.d.ts +3 -3
- package/lib/node/blocks/image/image.vue.d.ts +3 -3
- package/lib/node/blocks/img/img.vue.d.ts +3 -3
- package/lib/node/blocks/section/section.vue.d.ts +3 -3
- package/lib/node/blocks/slot/slot.vue.d.ts +5 -2
- package/lib/node/blocks/symbol/symbol.vue.d.ts +9 -9
- package/lib/node/blocks/tabs/tabs.vue.d.ts +3 -3
- package/lib/node/blocks/video/video.vue.d.ts +6 -6
- package/lib/{edge/component-ref-ZtKc8UMX.js → node/component-ref-IbarjSnq.js} +2 -2
- package/lib/{edge/component-ref-EPsyn_2c.cjs → node/component-ref-ZlBAzimq.cjs} +1 -1
- package/lib/node/components/block/block.helpers.d.ts +1 -2
- package/lib/node/components/block/block.vue.d.ts +10 -5
- package/lib/node/components/block/components/block-styles.vue.d.ts +1 -1
- package/lib/node/components/block/components/component-ref/component-ref.vue.d.ts +6 -6
- package/lib/node/components/block/components/repeated-block.vue.d.ts +3 -3
- package/lib/node/components/blocks/blocks.vue.d.ts +3 -3
- package/lib/node/components/content/components/enable-editor.vue.d.ts +12 -12
- package/lib/node/components/content/content.vue.d.ts +18 -18
- package/lib/node/components/content-variants/content-variants.vue.d.ts +12 -12
- package/lib/node/components/inlined-styles.vue.d.ts +3 -3
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/functions/evaluate/node-runtime/init.d.ts +1 -0
- package/lib/node/functions/get-processed-block.d.ts +1 -0
- package/lib/node/functions/register-component.d.ts +1 -1
- package/lib/node/get-block-properties-2Q2lr9bu.cjs +1 -0
- package/lib/{edge/get-block-properties-zzQ9xBK7.js → node/get-block-properties-QIsIgfnu.js} +17 -16
- package/lib/node/{index-xdY2kzl8.js → index-BugETl2c.js} +1537 -1702
- package/lib/node/index-s5vEnK-M.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.mjs +11 -0
- package/lib/node/node-runtime-0rF8vJwU.js +233 -0
- package/lib/node/node-runtime-Bqb5TnyM.cjs +48 -0
- package/lib/node/{repeated-block-ndxvinZD.js → repeated-block-Z-_chLeZ.js} +13 -13
- package/lib/node/{repeated-block-T2ld1sa9.cjs → repeated-block-ZpVu-xdw.cjs} +1 -1
- package/lib/node/style.css +1 -1
- package/package.json +7 -3
- package/lib/browser/block-styles-UWiLqSPk.js +0 -90
- package/lib/browser/block-styles-mtiWQW_J.cjs +0 -1
- package/lib/browser/get-block-properties-JqBN5X7_.cjs +0 -1
- package/lib/browser/index-TIoYRvmr.cjs +0 -166
- package/lib/edge/block-styles-4MJqQlwZ.cjs +0 -1
- package/lib/edge/block-styles-P44kj2Ws.js +0 -89
- package/lib/edge/get-block-properties-N40WxPwN.cjs +0 -1
- package/lib/edge/index-hw9mu6mD.cjs +0 -186
- package/lib/node/block-styles-HZaZpVMf.cjs +0 -1
- package/lib/node/block-styles-brJAybxf.js +0 -89
- package/lib/node/get-block-properties-W3cxXL5S.cjs +0 -1
- package/lib/node/index-HPinODNY.cjs +0 -213
|
@@ -0,0 +1,233 @@
|
|
|
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((r, n) => {
|
|
14
|
+
t[n] = r;
|
|
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
|
+
}, r = 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: r ? "tablet" : t.any() ? "mobile" : "desktop"
|
|
55
|
+
};
|
|
56
|
+
}, getFunctionArguments = ({
|
|
57
|
+
builder: e,
|
|
58
|
+
context: t,
|
|
59
|
+
event: r,
|
|
60
|
+
state: n
|
|
61
|
+
}) => Object.entries({
|
|
62
|
+
state: n,
|
|
63
|
+
Builder: e,
|
|
64
|
+
// legacy
|
|
65
|
+
builder: e,
|
|
66
|
+
context: t,
|
|
67
|
+
event: r
|
|
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, r) => {
|
|
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((o, s, i) => Object(o[s]) === o[s] ? o[s] : o[s] = Math.abs(Number(n[i + 1])) >> 0 === +n[i + 1] ? [] : {}, e)[n[n.length - 1]] = r, 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 r = t.map(([n]) => `var ${n} = refToProxy(${getSyncValName(n)}); `).join("");
|
|
131
|
+
return `
|
|
132
|
+
${REF_TO_PROXY_FN}
|
|
133
|
+
${r}
|
|
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", 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(), o = n.global;
|
|
174
|
+
return o.setSync("global", o.derefInto()), o.setSync("log", function(...s) {
|
|
175
|
+
console.log(...s);
|
|
176
|
+
}), o.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: r,
|
|
182
|
+
event: n,
|
|
183
|
+
localState: o,
|
|
184
|
+
rootSetState: s,
|
|
185
|
+
rootState: i
|
|
186
|
+
}) => {
|
|
187
|
+
const f = getIvm(), E = fastClone({
|
|
188
|
+
...i,
|
|
189
|
+
...o
|
|
190
|
+
}), u = getFunctionArguments({
|
|
191
|
+
builder: t,
|
|
192
|
+
context: r,
|
|
193
|
+
event: n,
|
|
194
|
+
state: E
|
|
195
|
+
}), l = getIsolateContext(), g = l.global;
|
|
196
|
+
g.setSync(BUILDER_SET_STATE_NAME, function(c, a) {
|
|
197
|
+
set(i, c, a), s == null || s(i);
|
|
198
|
+
}), u.forEach(([c, a]) => {
|
|
199
|
+
const y = 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
|
+
g.setSync(getSyncValName(c), y);
|
|
207
|
+
});
|
|
208
|
+
const m = processCode({
|
|
209
|
+
code: e,
|
|
210
|
+
args: u
|
|
211
|
+
}), d = l.evalClosureSync(m);
|
|
212
|
+
try {
|
|
213
|
+
return JSON.parse(d);
|
|
214
|
+
} catch {
|
|
215
|
+
return d;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
export {
|
|
219
|
+
TARGET as T,
|
|
220
|
+
getBuilderGlobals as a,
|
|
221
|
+
getSearchString as b,
|
|
222
|
+
isEditing as c,
|
|
223
|
+
getUserAttributes as d,
|
|
224
|
+
setIvm as e,
|
|
225
|
+
fastClone as f,
|
|
226
|
+
getFunctionArguments as g,
|
|
227
|
+
isBrowser as i,
|
|
228
|
+
logger as l,
|
|
229
|
+
normalizeSearchParams as n,
|
|
230
|
+
parseCode as p,
|
|
231
|
+
runInNode as r,
|
|
232
|
+
set as s
|
|
233
|
+
};
|
|
@@ -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((n,r)=>{t[r]=n}),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"}},n=e.match(/Tablet|iPad/i),r=getLocation();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},getFunctionArguments=({builder:e,context:t,event:n,state:r})=>Object.entries({state:r,Builder:e,builder:e,context:t,event:n}),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,n)=>{if(Object(e)!==e)return e;const r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return r.slice(0,-1).reduce((o,s,i)=>Object(o[s])===o[s]?o[s]:o[s]=Math.abs(Number(r[i+1]))>>0===+r[i+1]?[]:{},e)[r[r.length-1]]=n,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=node_module.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.src||new URL("node-runtime-Bqb5TnyM.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 n=t.map(([r])=>`var ${r} = refToProxy(${getSyncValName(r)}); `).join("");return`
|
|
28
|
+
${REF_TO_PROXY_FN}
|
|
29
|
+
${n}
|
|
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",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(),r=new t.Isolate(e).createContextSync(),o=r.global;return o.setSync("global",o.derefInto()),o.setSync("log",function(...s){console.log(...s)}),o.setSync(INJECTED_IVM_GLOBAL,t),IVM_CONTEXT=r,r}const getIsolateContext=()=>IVM_CONTEXT||setIsolateContext(),runInNode=({code:e,builder:t,context:n,event:r,localState:o,rootSetState:s,rootState:i})=>{const m=getIvm(),f=fastClone({...i,...o}),u=getFunctionArguments({builder:t,context:n,event:r,state:f}),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 m.Reference(c==="builder"?{...a,getUserAttributes:()=>a.getUserAttributes()}:a):null;d.setSync(getSyncValName(c),S)});const p=processCode({code:e,args:u}),g=l.evalClosureSync(p);try{return JSON.parse(g)}catch{return g}};exports.TARGET=TARGET;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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as t, defineAsyncComponent as n, resolveComponent as r, openBlock as c, createBlock as p } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
const i = () => import("./index-
|
|
2
|
+
import { j as s, e as l } from "./index-BugETl2c.js";
|
|
3
|
+
const i = () => import("./index-BugETl2c.js").then((e) => e.D).then((e) => e.default).catch((e) => {
|
|
4
4
|
throw console.error(
|
|
5
5
|
"Error while attempting to dynamically import component Block at ../block.vue",
|
|
6
|
-
|
|
7
|
-
),
|
|
6
|
+
e
|
|
7
|
+
), e;
|
|
8
8
|
}), m = t({
|
|
9
9
|
name: "repeated-block",
|
|
10
10
|
components: { Block: n(i) },
|
|
@@ -13,19 +13,19 @@ const i = () => import("./index-xdY2kzl8.js").then((o) => o.H).then((o) => o.def
|
|
|
13
13
|
return { store: this.repeatContext };
|
|
14
14
|
},
|
|
15
15
|
provide() {
|
|
16
|
-
const
|
|
16
|
+
const e = this;
|
|
17
17
|
return {
|
|
18
|
-
[s.key]:
|
|
18
|
+
[s.key]: e.store
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
function a(
|
|
23
|
-
const
|
|
24
|
-
return c(), p(
|
|
25
|
-
block:
|
|
26
|
-
context:
|
|
27
|
-
registeredComponents:
|
|
28
|
-
linkComponent:
|
|
22
|
+
function a(e, k, d, C, f, u) {
|
|
23
|
+
const o = r("Block");
|
|
24
|
+
return c(), p(o, {
|
|
25
|
+
block: e.block,
|
|
26
|
+
context: e.store,
|
|
27
|
+
registeredComponents: e.registeredComponents,
|
|
28
|
+
linkComponent: e.linkComponent
|
|
29
29
|
}, null, 8, ["block", "context", "registeredComponents", "linkComponent"]);
|
|
30
30
|
}
|
|
31
31
|
const _ = /* @__PURE__ */ l(m, [["render", a]]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),t=require("./index-s5vEnK-M.cjs"),r=()=>Promise.resolve().then(()=>require("./index-s5vEnK-M.cjs")).then(e=>e.block).then(e=>e.default).catch(e=>{throw console.error("Error while attempting to dynamically import component Block at ../block.vue",e),e}),c=o.defineComponent({name:"repeated-block",components:{Block:o.defineAsyncComponent(r)},props:["repeatContext","block","registeredComponents","linkComponent"],data(){return{store:this.repeatContext}},provide(){const e=this;return{[t.BuilderContext.key]:e.store}}});function s(e,i,p,a,m,d){const n=o.resolveComponent("Block");return o.openBlock(),o.createBlock(n,{block:e.block,context:e.store,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},null,8,["block","context","registeredComponents","linkComponent"])}const l=t._export_sfc(c,[["render",s]]);exports.default=l;
|
package/lib/node/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.component-178o76acnws[data-v-
|
|
1
|
+
.component-178o76acnws[data-v-824f09a8]{display:flex;flex-direction:column;align-items:stretch}.div-2brhoa1k8gd[data-v-52366f16]{display:flex;line-height:normal}.img-1pl23ac79ld[data-v-b1147753]{opacity:1;transition:opacity .2s ease-in-out}.div-1pl23ac79ld[data-v-b1147753]{width:100%;pointer-events:none;font-size:0}.div-1pl23ac79ld-2[data-v-b1147753]{display:flex;flex-direction:column;align-items:stretch;position:absolute;top:0;left:0;width:100%;height:100%}.pre-3i4ezorcfhi[data-v-489330f7]{padding:10px;color:red;text-align:center}
|
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.14-1",
|
|
5
5
|
"main": "./lib/node/index.cjs",
|
|
6
6
|
"module": "./lib/node/index.mjs",
|
|
7
7
|
"type": "module",
|
|
@@ -82,6 +82,10 @@
|
|
|
82
82
|
"import": "./lib/browser/index.mjs",
|
|
83
83
|
"require": "./lib/browser/index.cjs"
|
|
84
84
|
}
|
|
85
|
+
},
|
|
86
|
+
"./node/init": {
|
|
87
|
+
"import": "./lib/node/init.mjs",
|
|
88
|
+
"require": "./lib/node/init.cjs"
|
|
85
89
|
}
|
|
86
90
|
},
|
|
87
91
|
"scripts": {
|
|
@@ -108,8 +112,8 @@
|
|
|
108
112
|
"@vitejs/plugin-vue": "^5.0.3",
|
|
109
113
|
"@vue/tsconfig": "^0.1.3",
|
|
110
114
|
"npm-run-all": "^4.1.5",
|
|
111
|
-
"nx": "
|
|
112
|
-
"nx-cloud": "
|
|
115
|
+
"nx": "^19.6.5",
|
|
116
|
+
"nx-cloud": "^19.0.0",
|
|
113
117
|
"typescript": "^5.1.6",
|
|
114
118
|
"vite": "^5.0.12",
|
|
115
119
|
"vite-plugin-dts": "^3.5.2",
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import "./style.css";
|
|
2
|
-
import { defineComponent as g, resolveComponent as B, openBlock as v, createBlock as C, createCommentVNode as $ } from "vue";
|
|
3
|
-
import { _, T, g as p, c as y, a as w, b as c, d as k, e as E, f as I } from "./index-wQ1FWMHJ.js";
|
|
4
|
-
const N = g({
|
|
5
|
-
name: "block-styles",
|
|
6
|
-
components: { InlinedStyles: _ },
|
|
7
|
-
props: ["block", "context"],
|
|
8
|
-
data() {
|
|
9
|
-
return { TARGET: T };
|
|
10
|
-
},
|
|
11
|
-
computed: {
|
|
12
|
-
canShowBlock() {
|
|
13
|
-
const t = p({
|
|
14
|
-
block: this.block,
|
|
15
|
-
localState: this.context.localState,
|
|
16
|
-
rootState: this.context.rootState,
|
|
17
|
-
rootSetState: this.context.rootSetState,
|
|
18
|
-
context: this.context.context,
|
|
19
|
-
shouldEvaluateBindings: !0
|
|
20
|
-
});
|
|
21
|
-
return y(t.hide) ? !t.hide : y(t.show) ? t.show : !0;
|
|
22
|
-
},
|
|
23
|
-
css() {
|
|
24
|
-
var S, u, h;
|
|
25
|
-
const t = p({
|
|
26
|
-
block: this.block,
|
|
27
|
-
localState: this.context.localState,
|
|
28
|
-
rootState: this.context.rootState,
|
|
29
|
-
rootSetState: this.context.rootSetState,
|
|
30
|
-
context: this.context.context,
|
|
31
|
-
shouldEvaluateBindings: !0
|
|
32
|
-
}), e = t.responsiveStyles, n = this.context.content, l = w(
|
|
33
|
-
((S = n == null ? void 0 : n.meta) == null ? void 0 : S.breakpoints) || {}
|
|
34
|
-
), r = e == null ? void 0 : e.large, i = e == null ? void 0 : e.medium, a = e == null ? void 0 : e.small, o = t.id;
|
|
35
|
-
if (!o)
|
|
36
|
-
return "";
|
|
37
|
-
const f = r ? c({
|
|
38
|
-
className: o,
|
|
39
|
-
styles: r
|
|
40
|
-
}) : "", x = i ? c({
|
|
41
|
-
className: o,
|
|
42
|
-
styles: i,
|
|
43
|
-
mediaQuery: k(
|
|
44
|
-
"medium",
|
|
45
|
-
l
|
|
46
|
-
)
|
|
47
|
-
}) : "", b = a ? c({
|
|
48
|
-
className: o,
|
|
49
|
-
styles: a,
|
|
50
|
-
mediaQuery: k(
|
|
51
|
-
"small",
|
|
52
|
-
l
|
|
53
|
-
)
|
|
54
|
-
}) : "", s = t.animations && t.animations.find((d) => d.trigger === "hover");
|
|
55
|
-
let m = "";
|
|
56
|
-
if (s) {
|
|
57
|
-
const d = ((h = (u = s.steps) == null ? void 0 : u[1]) == null ? void 0 : h.styles) || {};
|
|
58
|
-
m = c({
|
|
59
|
-
className: `${o}:hover`,
|
|
60
|
-
styles: {
|
|
61
|
-
...d,
|
|
62
|
-
transition: `all ${s.duration}s ${E(
|
|
63
|
-
s.easing
|
|
64
|
-
)}`,
|
|
65
|
-
transitionDelay: s.delay ? `${s.delay}s` : "0s"
|
|
66
|
-
}
|
|
67
|
-
}) || "";
|
|
68
|
-
}
|
|
69
|
-
return [
|
|
70
|
-
f,
|
|
71
|
-
x,
|
|
72
|
-
b,
|
|
73
|
-
m
|
|
74
|
-
].join(" ");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
function z(t, e, n, l, r, i) {
|
|
79
|
-
const a = B("InlinedStyles");
|
|
80
|
-
return t.TARGET !== "reactNative" && t.css && t.canShowBlock ? (v(), C(a, {
|
|
81
|
-
key: 0,
|
|
82
|
-
id: "builderio-block",
|
|
83
|
-
styles: t.css,
|
|
84
|
-
nonce: t.context.nonce
|
|
85
|
-
}, null, 8, ["styles", "nonce"])) : $("", !0);
|
|
86
|
-
}
|
|
87
|
-
const F = /* @__PURE__ */ I(N, [["render", z]]);
|
|
88
|
-
export {
|
|
89
|
-
F as default
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var b=require("./style.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("vue"),t=require("./index-TIoYRvmr.cjs"),f=c.defineComponent({name:"block-styles",components:{InlinedStyles:t._sfc_main},props:["block","context"],data(){return{TARGET:t.TARGET}},computed:{canShowBlock(){const e=t.getProcessedBlock({block:this.block,localState:this.context.localState,rootState:this.context.rootState,rootSetState:this.context.rootSetState,context:this.context.context,shouldEvaluateBindings:!0});return t.checkIsDefined(e.hide)?!e.hide:t.checkIsDefined(e.show)?e.show:!0},css(){var m,h,y;const e=t.getProcessedBlock({block:this.block,localState:this.context.localState,rootState:this.context.rootState,rootSetState:this.context.rootSetState,context:this.context.context,shouldEvaluateBindings:!0}),s=e.responsiveStyles,a=this.context.content,r=t.getSizesForBreakpoints(((m=a==null?void 0:a.meta)==null?void 0:m.breakpoints)||{}),i=s==null?void 0:s.large,d=s==null?void 0:s.medium,l=s==null?void 0:s.small,n=e.id;if(!n)return"";const p=i?t.createCssClass({className:n,styles:i}):"",k=d?t.createCssClass({className:n,styles:d,mediaQuery:t.getMaxWidthQueryForSize("medium",r)}):"",C=l?t.createCssClass({className:n,styles:l,mediaQuery:t.getMaxWidthQueryForSize("small",r)}):"",o=e.animations&&e.animations.find(u=>u.trigger==="hover");let S="";if(o){const u=((y=(h=o.steps)==null?void 0:h[1])==null?void 0:y.styles)||{};S=t.createCssClass({className:`${n}:hover`,styles:{...u,transition:`all ${o.duration}s ${t.camelToKebabCase(o.easing)}`,transitionDelay:o.delay?`${o.delay}s`:"0s"}})||""}return[p,k,C,S].join(" ")}}});function g(e,s,a,r,i,d){const l=c.resolveComponent("InlinedStyles");return e.TARGET!=="reactNative"&&e.css&&e.canShowBlock?(c.openBlock(),c.createBlock(l,{key:0,id:"builderio-block",styles:e.css,nonce:e.context.nonce},null,8,["styles","nonce"])):c.createCommentVNode("",!0)}const x=t._export_sfc(f,[["render",g]]);exports.default=x;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var d=require("./style.css");const a=require("./index-TIoYRvmr.cjs"),c=e=>`v-on:${e.toLowerCase()}`,i=(e,t)=>r=>a.evaluate({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:r,isExpression:!1,enableCache:!0});function l(e){const t={},r=e.block.actions??{};for(const o in r){if(!r.hasOwnProperty(o))continue;const s=r[o];let n=c(o);if(e.stripPrefix)switch(a.TARGET){case"vue":n=n.replace("v-on:","");break;case"svelte":n=n.replace("on:","");break}t[n]=i(s,e)}return t}function u({properties:e}){return e}const p=e=>({href:e.href});function f({block:e,context:t}){var o;const r={...p(e),...e.properties,"builder-id":e.id,style:a.getStyle({block:e,context:t}),[a.getClassPropName()]:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return u({properties:r,context:t,block:e})}exports.getBlockActions=l;exports.getBlockProperties=f;
|