@atooyu/uxto-ui 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -3
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +6 -6
- package/package.json +1 -1
- package/src/components/u-icon/u-icon.vue +38 -5
package/dist/index.mjs
CHANGED
|
@@ -653,7 +653,24 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
653
653
|
return !!getIcon(props.name);
|
|
654
654
|
});
|
|
655
655
|
const iconSrc = computed(() => {
|
|
656
|
-
|
|
656
|
+
const svgData = getIcon(props.name);
|
|
657
|
+
if (!svgData) return "";
|
|
658
|
+
if (props.color && svgData.startsWith("data:image/svg+xml")) {
|
|
659
|
+
try {
|
|
660
|
+
let svgContent = decodeURIComponent(svgData.replace("data:image/svg+xml,", ""));
|
|
661
|
+
if (svgContent.includes('fill="currentColor"')) {
|
|
662
|
+
svgContent = svgContent.replace(/fill="currentColor"/g, `fill="${props.color}"`);
|
|
663
|
+
} else if (!svgContent.includes("fill=")) {
|
|
664
|
+
svgContent = svgContent.replace("<svg", `<svg fill="${props.color}"`);
|
|
665
|
+
} else {
|
|
666
|
+
svgContent = svgContent.replace(/fill="[^"]*"/g, `fill="${props.color}"`);
|
|
667
|
+
}
|
|
668
|
+
return "data:image/svg+xml," + encodeURIComponent(svgContent);
|
|
669
|
+
} catch (e) {
|
|
670
|
+
return svgData;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return svgData;
|
|
657
674
|
});
|
|
658
675
|
const sizePx = computed(() => {
|
|
659
676
|
const size = typeof props.size === "number" ? props.size : parseInt(props.size);
|
|
@@ -671,6 +688,12 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
671
688
|
}
|
|
672
689
|
return style;
|
|
673
690
|
});
|
|
691
|
+
const svgStyle = computed(() => {
|
|
692
|
+
return {
|
|
693
|
+
width: sizePx.value,
|
|
694
|
+
height: sizePx.value
|
|
695
|
+
};
|
|
696
|
+
});
|
|
674
697
|
return (_ctx, _cache) => {
|
|
675
698
|
return openBlock(), createElementBlock("view", {
|
|
676
699
|
class: normalizeClass(["u-icon", { "u-icon--spin": __props.spin }]),
|
|
@@ -681,14 +704,14 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
681
704
|
key: 0,
|
|
682
705
|
class: "u-icon__svg",
|
|
683
706
|
src: iconSrc.value,
|
|
684
|
-
style: normalizeStyle(
|
|
707
|
+
style: normalizeStyle(svgStyle.value),
|
|
685
708
|
mode: "aspectFit"
|
|
686
709
|
}, null, 12, _hoisted_1$A)) : (openBlock(), createElementBlock("text", _hoisted_2$q, toDisplayString(__props.name), 1))
|
|
687
710
|
], 6);
|
|
688
711
|
};
|
|
689
712
|
}
|
|
690
713
|
});
|
|
691
|
-
const UIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-
|
|
714
|
+
const UIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-632e7780"]]);
|
|
692
715
|
const __default__$F = {
|
|
693
716
|
options: {
|
|
694
717
|
virtualHost: true,
|