@builder.io/sdk-vue
Version:
Builder.io SDK for Vue
64 lines (63 loc) • 1.19 kB
JavaScript
import { f as n, T as c, h as i, i as l } from "./index-8E5G8ahg.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 o in r) {
if (!r.hasOwnProperty(o))
continue;
const s = r[o];
let a = f(o);
if (e.stripPrefix)
switch (c) {
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,
S as g
};