@builder.io/sdk-vue
Version:
Builder.io SDK for Vue
65 lines (64 loc) • 1.26 kB
JavaScript
import { T as n } from "./should-force-browser-runtime-in-node-ikxWrCvn.js";
import { e as c, f as i, h as l } from "./index-dZfvXbI_.js";
const f = (e) => `v-on:${e.toLowerCase()}`, p = (e, t) => (r) => c({
code: e,
context: t.context,
localState: t.localState,
rootState: t.rootState,
rootSetState: t.rootSetState,
event: r,
isExpression: !1
});
function m(e) {
const t = {}, r = e.block.actions ?? {};
for (const o in r) {
if (!r.hasOwnProperty(o))
continue;
const s = r[o];
let a = f(o);
if (e.stripPrefix)
switch (n) {
case "vue":
a = a.replace("v-on:", "");
break;
case "svelte":
a = a.replace("on:", "");
break;
}
t[a] = p(s, e);
}
return t;
}
function u({
properties: e
}) {
return e;
}
const v = (e) => ({
href: e.href
});
function g({
block: e,
context: t
}) {
var o;
const r = {
...v(e),
...e.properties,
"builder-id": e.id,
style: i({
block: e,
context: t
}),
[l()]: [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
});
}
export {
g as a,
m as g
};