@zhsz/cool-design-dv
Version:
180 lines (179 loc) • 7.29 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$2 = require("../dv-content/index.js");
const index = require("../../symbols/index.js");
const resizeEvent = require("../../utils/resize-event.js");
const useBorder = require("../../hooks/useBorder.js");
const useConfig = require("../../hooks/useConfig.js");
const _hoisted_1 = ["width", "height"];
const _hoisted_2 = ["fill", "points"];
const _hoisted_3 = ["fill"];
const _hoisted_4 = ["fill", "cx"];
const _hoisted_5 = ["fill", "cx", "cy"];
const _hoisted_6 = ["fill", "cy"];
const _hoisted_7 = ["stroke", "points"];
const _hoisted_8 = ["stroke", "points"];
const _hoisted_9 = ["stroke", "points"];
const _hoisted_10 = ["stroke", "points"];
const _hoisted_11 = ["stroke"];
const _hoisted_12 = ["stroke"];
const _hoisted_13 = ["stroke", "points"];
const _hoisted_14 = ["stroke", "points"];
const _hoisted_15 = ["stroke", "points"];
const _hoisted_16 = ["stroke", "points"];
const _hoisted_17 = ["stroke", "points"];
const _hoisted_18 = ["stroke", "points"];
const __default__ = vue.defineComponent({
name: "DvBorder5"
});
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...__default__,
props: {
fill: {
type: String,
default() {
return "transparent";
}
},
reverse: Boolean,
opacity: {
type: Number,
default: 1
}
},
emits: ["resize"],
setup(__props, { emit: __emit }) {
var _a, _b, _c;
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
const emits = __emit;
const $attrs = vue.useAttrs();
const props = __props;
const page = vue.inject(index.dvPageSymbols, null);
const fill = vue.computed(() => {
var _a2, _b2;
return props.fill || ((_b2 = (_a2 = page == null ? void 0 : page.settings) == null ? void 0 : _a2.value) == null ? void 0 : _b2.fill);
});
const { resize, classes, styles, width, height, dark, light } = useBorder.useBorder(
emits,
((_c = (_b = page == null ? void 0 : page.settings) == null ? void 0 : _b.value) == null ? void 0 : _c.color) ?? useConfig.baseConfig.color,
props,
page
);
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-border-5", vue.unref(classes)],
"default-width": "400px",
"default-height": "300px",
padding: "0"
}, { ...vue.unref($attrs), ...props }), {
default: vue.withCtx(() => [
(vue.openBlock(), vue.createElementBlock("svg", {
class: "my-dv-border__svg",
width: vue.unref(width),
height: vue.unref(height),
style: vue.normalizeStyle(vue.unref(styles))
}, [
vue.createElementVNode("polygon", {
fill: fill.value,
points: `
9, 7 ${vue.unref(width) - 9}, 7 ${vue.unref(width) - 9}, ${vue.unref(height) - 7} 9, ${vue.unref(height) - 7}
`
}, null, 8, _hoisted_2),
vue.createElementVNode("circle", {
fill: vue.unref(light),
cx: "5",
cy: "5",
r: "2"
}, null, 8, _hoisted_3),
vue.createElementVNode("circle", {
fill: vue.unref(light),
cx: vue.unref(width) - 5,
cy: "5",
r: "2"
}, null, 8, _hoisted_4),
vue.createElementVNode("circle", {
fill: vue.unref(light),
cx: vue.unref(width) - 5,
cy: vue.unref(height) - 5,
r: "2"
}, null, 8, _hoisted_5),
vue.createElementVNode("circle", {
fill: vue.unref(light),
cx: "5",
cy: vue.unref(height) - 5,
r: "2"
}, null, 8, _hoisted_6),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `10, 4 ${vue.unref(width) - 10}, 4`
}, null, 8, _hoisted_7),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `10, ${vue.unref(height) - 4} ${vue.unref(width) - 10}, ${vue.unref(height) - 4}`
}, null, 8, _hoisted_8),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `5, 70 5, ${vue.unref(height) - 70}`
}, null, 8, _hoisted_9),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `${vue.unref(width) - 5}, 70 ${vue.unref(width) - 5}, ${vue.unref(height) - 70}`
}, null, 8, _hoisted_10),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `3, 10, 3, 50`
}, null, 8, _hoisted_11),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `7, 30 7, 80`
}, null, 8, _hoisted_12),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `${vue.unref(width) - 3}, 10 ${vue.unref(width) - 3}, 50`
}, null, 8, _hoisted_13),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `${vue.unref(width) - 7}, 30 ${vue.unref(width) - 7}, 80`
}, null, 8, _hoisted_14),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `3, ${vue.unref(height) - 10} 3, ${vue.unref(height) - 50}`
}, null, 8, _hoisted_15),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `7, ${vue.unref(height) - 30} 7, ${vue.unref(height) - 80}`
}, null, 8, _hoisted_16),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `${vue.unref(width) - 3}, ${vue.unref(height) - 10} ${vue.unref(width) - 3}, ${vue.unref(height) - 50}`
}, null, 8, _hoisted_17),
vue.createElementVNode("polyline", {
stroke: vue.unref(dark),
points: `${vue.unref(width) - 7}, ${vue.unref(height) - 30} ${vue.unref(width) - 7}, ${vue.unref(height) - 80}`
}, null, 8, _hoisted_18)
], 12, _hoisted_1)),
vue.createVNode(vue.unref(index$2.default), {
padding: vue.unref($attrs).padding
}, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 8, ["padding"])
]),
_: 3
}, 16, ["class"]);
};
}
});
exports.default = _sfc_main;