@builder.io/sdk-vue
Version:
Builder.io SDK for Vue
64 lines (63 loc) • 1.19 kB
JavaScript
import { e as n, T as c, g as i, a as l } from "./index-f5K55CbL.js";
const f = (e) => `v-on:${e.toLowerCase()}`, p = (e, t) => (r) => n({
code: e,
context: t.context,
localState: t.localState,
rootState: t.rootState,
rootSetState: t.rootSetState,
event: r,
isExpression: !1
});
function S(e) {
const t = {}, r = e.block.actions ?? {};
for (const a in r) {
if (!r.hasOwnProperty(a))
continue;
const s = r[a];
let o = f(a);
if (e.stripPrefix)
switch (c) {
case "vue":
o = o.replace("v-on:", "");
break;
case "svelte":
o = o.replace("on:", "");
break;
}
t[o] = p(s, e);
}
return t;
}
function u({
properties: e
}) {
return e;
}
const v = (e) => ({
href: e.href
});
function g({
block: e,
context: t
}) {
var a;
const r = {
...v(e),
...e.properties,
"builder-id": e.id,
style: i({
block: e,
context: t
}),
[l()]: [e.id, "builder-block", e.class, (a = e.properties) == null ? void 0 : a.class].filter(Boolean).join(" ")
};
return u({
properties: r,
context: t,
block: e
});
}
export {
g as a,
S as g
};