@zhsz/cool-design-dv
Version:
117 lines (116 loc) • 4.28 kB
JavaScript
"use strict";
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 useConfig = require("../../hooks/useConfig.js");
const _hoisted_1 = ["width", "height"];
const _hoisted_2 = ["d", "stroke"];
const _hoisted_3 = ["cy", "fill"];
const _hoisted_4 = ["dur"];
const _hoisted_5 = ["cy", "stroke"];
const _hoisted_6 = ["dur"];
const __default__ = vue.defineComponent({
name: "DvAdorn13"
});
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
);
const path = vue.computed(() => {
const r = height.value / 2;
return `M0 1 L${width.value - r} 1 A ${r} ${r} 0 0 1 ${width.value - r} ${height.value - 1} L0 ${height.value - 1}`;
});
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-13", vue.unref(classes)],
style: vue.unref(styles),
"default-width": "200px",
"default-height": "40px"
}, vue.unref($attrs)), {
default: vue.withCtx(() => [
(vue.openBlock(), vue.createElementBlock("svg", {
width: `${vue.unref(width)}px`,
height: `${vue.unref(height)}px`
}, [
vue.createElementVNode("path", {
d: path.value,
fill: "transparent",
"stroke-width": "1",
stroke: vue.unref(dark)
}, null, 8, _hoisted_2),
vue.createElementVNode("circle", {
cx: "16",
cy: `${vue.unref(height) / 2}`,
r: "4",
fill: vue.unref(light)
}, [
vue.createElementVNode("animate", {
attributeName: "opacity",
values: "1;0;1",
dur: `${__props.duration}s`,
repeatCount: "indefinite"
}, null, 8, _hoisted_4)
], 8, _hoisted_3),
vue.createElementVNode("circle", {
cx: "16",
cy: `${vue.unref(height) / 2}`,
r: "7",
fill: "transparent",
"stroke-width": "2",
stroke: vue.unref(light)
}, [
vue.createElementVNode("animate", {
attributeName: "opacity",
values: "0;1;0",
dur: `${__props.duration}s`,
repeatCount: "indefinite"
}, null, 8, _hoisted_6)
], 8, _hoisted_5)
], 8, _hoisted_1)),
vue.createElementVNode("div", {
class: "my-dv-adorn-13__content",
style: vue.normalizeStyle({ lineHeight: `${vue.unref(height)}px`, color: vue.unref(light) })
}, [
vue.renderSlot(_ctx.$slots, "default")
], 4)
]),
_: 3
}, 16, ["class", "style"]);
};
}
});
exports.default = _sfc_main;