@zhsz/cool-design-dv
Version:
126 lines (125 loc) • 5.37 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
require("./style.css");
const index$1 = require("../dv-box/index.js");
const index = require("../../symbols/index.js");
const resizeEvent = require("../../utils/resize-event.js");
const useAdorn = require("../../hooks/useAdorn.js");
const color = require("../../utils/color.js");
const useConfig = require("../../hooks/useConfig.js");
const _hoisted_1 = ["width", "height"];
const _hoisted_2 = ["fill", "stroke"];
const _hoisted_3 = ["fill", "stroke", "points"];
const _hoisted_4 = ["fill", "stroke", "points"];
const _hoisted_5 = ["fill", "stroke", "points"];
const _hoisted_6 = ["fill", "stroke", "points"];
const _hoisted_7 = ["stroke", "points"];
const _hoisted_8 = ["stroke", "points"];
const _hoisted_9 = { class: "my-dv-adorn-11__content" };
const __default__ = vue.defineComponent({
name: "DvAdorn11"
});
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: {
duration: {
type: Number,
default: 3
},
reverse: Boolean,
opacity: {
type: Number,
default: 1
}
},
emits: ["resize"],
setup(__props, { emit: __emit }) {
var _a, _b, _c;
const props = __props;
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
const emits = __emit;
const $attrs = vue.useAttrs();
const page = vue.inject(index.dvPageSymbols, null);
const { resize, classes, styles, width, height, dark, light } = useAdorn.useAdorn(
emits,
((_c = (_b = page == null ? void 0 : page.settings) == null ? void 0 : _b.value) == null ? void 0 : _c.color) ?? useConfig.baseConfig.color,
props,
page
);
function fade(color$1, percent = 100) {
const r = color.fade(color$1, percent);
if (r === false) {
return void 0;
} else {
return r;
}
}
vue.onMounted(() => {
resize(instance == null ? void 0 : instance.$el);
resizeEvent.addResizeListener(instance == null ? void 0 : instance.$el, () => resize(instance == null ? void 0 : instance.$el));
});
vue.onBeforeUnmount(() => {
resizeEvent.removeResizeListener(instance == null ? void 0 : instance.$el, () => resize(instance == null ? void 0 : instance.$el));
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(index$1.default), vue.mergeProps({
class: ["my-dv-adorn-11", vue.unref(classes)],
style: vue.unref(styles),
"default-width": "300px",
"default-height": "60px"
}, vue.unref($attrs)), {
default: vue.withCtx(() => [
(vue.openBlock(), vue.createElementBlock("svg", {
width: `${vue.unref(width)}px`,
height: `${vue.unref(height)}px`
}, [
vue.createElementVNode("polygon", {
fill: fade(vue.unref(dark), 10),
stroke: vue.unref(dark),
points: `20 10, 25 4, 55 4 60 10`
}, null, 8, _hoisted_2),
vue.createElementVNode("polygon", {
fill: fade(vue.unref(dark), 10),
stroke: vue.unref(dark),
points: `20 ${vue.unref(height) - 10}, 25 ${vue.unref(height) - 4}, 55 ${vue.unref(height) - 4} 60 ${vue.unref(height) - 10}`
}, null, 8, _hoisted_3),
vue.createElementVNode("polygon", {
fill: fade(vue.unref(dark), 10),
stroke: vue.unref(dark),
points: `${vue.unref(width) - 20} 10, ${vue.unref(width) - 25} 4, ${vue.unref(width) - 55} 4 ${vue.unref(width) - 60} 10`
}, null, 8, _hoisted_4),
vue.createElementVNode("polygon", {
fill: fade(vue.unref(dark), 10),
stroke: vue.unref(dark),
points: `${vue.unref(width) - 20} ${vue.unref(height) - 10}, ${vue.unref(width) - 25} ${vue.unref(height) - 4}, ${vue.unref(width) - 55} ${vue.unref(height) - 4} ${vue.unref(width) - 60} ${vue.unref(height) - 10}`
}, null, 8, _hoisted_5),
vue.createElementVNode("polygon", {
fill: fade(vue.unref(light), 20),
stroke: vue.unref(light),
points: `
20 10, 5 ${vue.unref(height) / 2} 20 ${vue.unref(height) - 10}
${vue.unref(width) - 20} ${vue.unref(height) - 10} ${vue.unref(width) - 5} ${vue.unref(height) / 2} ${vue.unref(width) - 20} 10
`
}, null, 8, _hoisted_6),
vue.createElementVNode("polyline", {
fill: "transparent",
stroke: fade(vue.unref(light), 70),
points: `25 18, 15 ${vue.unref(height) / 2} 25 ${vue.unref(height) - 18}`
}, null, 8, _hoisted_7),
vue.createElementVNode("polyline", {
fill: "transparent",
stroke: fade(vue.unref(light), 70),
points: `${vue.unref(width) - 25} 18, ${vue.unref(width) - 15} ${vue.unref(height) / 2} ${vue.unref(width) - 25} ${vue.unref(height) - 18}`
}, null, 8, _hoisted_8)
], 8, _hoisted_1)),
vue.createElementVNode("div", _hoisted_9, [
vue.renderSlot(_ctx.$slots, "default")
])
]),
_: 3
}, 16, ["class", "style"]);
};
}
});
exports.default = _sfc_main;