@zhsz/cool-design-dv
Version:
234 lines (233 loc) • 10.3 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
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 util = require("../../utils/util.js");
const _hoisted_1 = ["width", "height"];
const _hoisted_2 = ["id"];
const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("animate", {
attributeName: "x1",
values: "0%;100%;0%",
dur: "10s",
begin: "0s",
repeatCount: "indefinite"
}, null, -1);
const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("animate", {
attributeName: "x2",
values: "100%;0%;100%",
dur: "10s",
begin: "0s",
repeatCount: "indefinite"
}, null, -1);
const _hoisted_5 = ["stop-color"];
const _hoisted_6 = ["values"];
const _hoisted_7 = ["stop-color"];
const _hoisted_8 = ["values"];
const _hoisted_9 = ["id"];
const _hoisted_10 = ["points"];
const _hoisted_11 = ["points"];
const _hoisted_12 = ["points"];
const _hoisted_13 = ["points"];
const _hoisted_14 = ["points"];
const _hoisted_15 = ["points"];
const _hoisted_16 = ["points"];
const _hoisted_17 = ["points"];
const _hoisted_18 = ["points"];
const _hoisted_19 = ["fill", "points"];
const _hoisted_20 = ["width", "height", "fill", "mask"];
const __default__ = vue.defineComponent({
name: "DvBorder8"
});
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 _uid = util.uid();
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-8", 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("defs", null, [
vue.createElementVNode("linearGradient", {
id: `gradient-${vue.unref(_uid)}`,
x1: "0%",
y1: "0%",
x2: "100%",
y2: "100%"
}, [
_hoisted_3,
_hoisted_4,
vue.createElementVNode("stop", {
offset: "0%",
"stop-color": vue.unref(light)
}, [
vue.createElementVNode("animate", {
attributeName: "stop-color",
values: `${vue.unref(light)};${vue.unref(dark)};${vue.unref(light)}`,
dur: "10s",
begin: "0s",
repeatCount: "indefinite"
}, null, 8, _hoisted_6)
], 8, _hoisted_5),
vue.createElementVNode("stop", {
offset: "100%",
"stop-color": vue.unref(dark)
}, [
vue.createElementVNode("animate", {
attributeName: "stop-color",
values: `${vue.unref(dark)};${vue.unref(light)};${vue.unref(dark)}`,
dur: "10s",
begin: "0s",
repeatCount: "indefinite"
}, null, 8, _hoisted_8)
], 8, _hoisted_7)
], 8, _hoisted_2),
vue.createElementVNode("mask", {
id: `mask-${vue.unref(_uid)}`
}, [
vue.createElementVNode("polyline", {
stroke: "#fff",
"stroke-width": "3",
fill: "transparent",
points: `8, ${vue.unref(height) * 0.4} 8, 3, ${vue.unref(width) * 0.4 + 7}, 3`
}, null, 8, _hoisted_10),
vue.createElementVNode("polyline", {
fill: "#fff",
points: `8, ${vue.unref(height) * 0.15} 8, 3, ${vue.unref(width) * 0.1 + 7}, 3
${vue.unref(width) * 0.1}, 8 14, 8 14, ${vue.unref(height) * 0.15 - 7}
`
}, null, 8, _hoisted_11),
vue.createElementVNode("polyline", {
stroke: "#fff",
"stroke-width": "3",
fill: "transparent",
points: `${vue.unref(width) * 0.5}, 3 ${vue.unref(width) - 3}, 3, ${vue.unref(width) - 3}, ${vue.unref(height) * 0.25}`
}, null, 8, _hoisted_12),
vue.createElementVNode("polyline", {
fill: "#fff",
points: `
${vue.unref(width) * 0.52}, 3 ${vue.unref(width) * 0.58}, 3
${vue.unref(width) * 0.58 - 7}, 9 ${vue.unref(width) * 0.52 + 7}, 9
`
}, null, 8, _hoisted_13),
vue.createElementVNode("polyline", {
fill: "#fff",
points: `
${vue.unref(width) * 0.9}, 3 ${vue.unref(width) - 3}, 3 ${vue.unref(width) - 3}, ${vue.unref(height) * 0.1}
${vue.unref(width) - 9}, ${vue.unref(height) * 0.1 - 7} ${vue.unref(width) - 9}, 9 ${vue.unref(width) * 0.9 + 7}, 9
`
}, null, 8, _hoisted_14),
vue.createElementVNode("polyline", {
stroke: "#fff",
"stroke-width": "3",
fill: "transparent",
points: `8, ${vue.unref(height) * 0.5} 8, ${vue.unref(height) - 3} ${vue.unref(width) * 0.3 + 7}, ${vue.unref(height) - 3}`
}, null, 8, _hoisted_15),
vue.createElementVNode("polyline", {
fill: "#fff",
points: `
8, ${vue.unref(height) * 0.55} 8, ${vue.unref(height) * 0.7}
2, ${vue.unref(height) * 0.7 - 7} 2, ${vue.unref(height) * 0.55 + 7}
`
}, null, 8, _hoisted_16),
vue.createElementVNode("polyline", {
stroke: "#fff",
"stroke-width": "3",
fill: "transparent",
points: `${vue.unref(width) * 0.35}, ${vue.unref(height) - 3} ${vue.unref(width) - 3}, ${vue.unref(height) - 3} ${vue.unref(width) - 3}, ${vue.unref(height) * 0.35}`
}, null, 8, _hoisted_17),
vue.createElementVNode("polyline", {
fill: "#fff",
points: `
${vue.unref(width) * 0.92}, ${vue.unref(height) - 3} ${vue.unref(width) - 3}, ${vue.unref(height) - 3} ${vue.unref(width) - 3}, ${vue.unref(height) * 0.8}
${vue.unref(width) - 9}, ${vue.unref(height) * 0.8 + 7} ${vue.unref(width) - 9}, ${vue.unref(height) - 9} ${vue.unref(width) * 0.92 + 7}, ${vue.unref(height) - 9}
`
}, null, 8, _hoisted_18)
], 8, _hoisted_9)
]),
vue.createElementVNode("polygon", {
fill: fill.value,
points: `
15, 9 ${vue.unref(width) * 0.1 + 1}, 9 ${vue.unref(width) * 0.1 + 4}, 6 ${vue.unref(width) * 0.52 + 2}, 6
${vue.unref(width) * 0.52 + 6}, 10 ${vue.unref(width) * 0.58 - 7}, 10 ${vue.unref(width) * 0.58 - 2}, 6
${vue.unref(width) * 0.9 + 2}, 6 ${vue.unref(width) * 0.9 + 6}, 10 ${vue.unref(width) - 10}, 10 ${vue.unref(width) - 10}, ${vue.unref(height) * 0.1 - 6}
${vue.unref(width) - 6}, ${vue.unref(height) * 0.1 - 1} ${vue.unref(width) - 6}, ${vue.unref(height) * 0.8 + 1} ${vue.unref(width) - 10}, ${vue.unref(height) * 0.8 + 6}
${vue.unref(width) - 10}, ${vue.unref(height) - 10} ${vue.unref(width) * 0.92 + 7}, ${vue.unref(height) - 10} ${vue.unref(width) * 0.92 + 2}, ${vue.unref(height) - 6}
11, ${vue.unref(height) - 6} 11, ${vue.unref(height) * 0.15 - 2} 15, ${vue.unref(height) * 0.15 - 7}
`
}, null, 8, _hoisted_19),
vue.createElementVNode("rect", {
x: "0",
y: "0",
width: vue.unref(width),
height: vue.unref(height),
fill: `url(#gradient-${vue.unref(_uid)})`,
mask: `url(#mask-${vue.unref(_uid)})`
}, null, 8, _hoisted_20)
], 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;