"use strict";
const common_vendor = require("../../../../common/vendor.js");
const __default__ = {
name: "wd-loading",
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: "shared"
}
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
...__default__,
props: common_vendor.loadingProps,
setup(__props) {
const svgDefineId = common_vendor.context.id++;
const svgDefineId1 = common_vendor.context.id++;
const svgDefineId2 = common_vendor.context.id++;
const icon = {
outline(color = "#4D80F0") {
return ``;
},
ring(color = "#4D80F0", intermediateColor2 = "#a6bff7") {
return ``;
}
};
const props = __props;
const svg = common_vendor.ref("");
const intermediateColor = common_vendor.ref("");
const iconSize = common_vendor.ref(null);
common_vendor.watch(
() => props.size,
(newVal) => {
iconSize.value = common_vendor.addUnit(newVal);
},
{
deep: true,
immediate: true
}
);
common_vendor.watch(
() => props.type,
() => {
buildSvg();
},
{
deep: true,
immediate: true
}
);
const rootStyle = common_vendor.computed(() => {
const style = {};
if (common_vendor.isDef(iconSize.value)) {
style.height = common_vendor.addUnit(iconSize.value);
style.width = common_vendor.addUnit(iconSize.value);
}
return `${common_vendor.objToStyle(style)} ${props.customStyle}`;
});
common_vendor.onBeforeMount(() => {
intermediateColor.value = common_vendor.gradient(props.color, "#ffffff", 2)[1];
buildSvg();
});
function buildSvg() {
const { type, color } = props;
let ringType = common_vendor.isDef(type) ? type : "ring";
const svgStr = `"data:image/svg+xml;base64,${common_vendor.encode(ringType === "ring" ? icon[ringType](color, intermediateColor.value) : icon[ringType](color))}"`;
svg.value = svgStr;
}
return (_ctx, _cache) => {
return {
a: common_vendor.s(`background-image: url(${svg.value});`),
b: common_vendor.n(`wd-loading ${props.customClass}`),
c: common_vendor.s(rootStyle.value)
};
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-eccc123e"]]);
wx.createComponent(Component);