"use strict";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
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(__spreadProps(__spreadValues({}, __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("32px");
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 = {
width: iconSize.value,
height: iconSize.value
};
return `${common_vendor.objToStyle(style)}; ${props.customStyle}`;
});
const rootClass = common_vendor.computed(() => {
return `wd-loading ${props.customClass}`;
});
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(rootClass.value),
c: common_vendor.s(rootStyle.value)
};
};
}
}));
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-eccc123e"]]);
wx.createComponent(Component);
//# sourceMappingURL=wd-loading.js.map