UNPKG

vuestic-ui

Version:
34 lines (33 loc) 1.14 kB
import { normalizeClass, normalizeStyle } from "vue"; const createAttrs = (instance, propsFromConfig) => { const instanceAttrs = instance.attrs; return new Proxy(instanceAttrs, { get: (target, key) => { var _a; if (typeof key !== "string") { return target[key]; } if (key === "class") { return normalizeClass([propsFromConfig.value.class, instanceAttrs.class]); } if (key === "style") { return normalizeStyle([propsFromConfig.value.style, instanceAttrs.style]); } const attrFromConfig = (_a = propsFromConfig.value) == null ? void 0 : _a[key]; if (attrFromConfig !== void 0) { return attrFromConfig; } return target[key]; }, ownKeys(target) { return [.../* @__PURE__ */ new Set([...Object.keys(instanceAttrs), ...Object.keys(propsFromConfig.value)])]; }, getOwnPropertyDescriptor(target, key) { return Reflect.getOwnPropertyDescriptor(propsFromConfig.value, key) ?? Reflect.getOwnPropertyDescriptor(instanceAttrs, key); } }); }; export { createAttrs as c }; //# sourceMappingURL=createAttrs.js.map