@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 CHANGED
@@ -655,7 +655,24 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
655
655
  return !!getIcon(props.name);
656
656
  });
657
657
  const iconSrc = vue.computed(() => {
658
- return getIcon(props.name);
658
+ const svgData = getIcon(props.name);
659
+ if (!svgData) return "";
660
+ if (props.color && svgData.startsWith("data:image/svg+xml")) {
661
+ try {
662
+ let svgContent = decodeURIComponent(svgData.replace("data:image/svg+xml,", ""));
663
+ if (svgContent.includes('fill="currentColor"')) {
664
+ svgContent = svgContent.replace(/fill="currentColor"/g, `fill="${props.color}"`);
665
+ } else if (!svgContent.includes("fill=")) {
666
+ svgContent = svgContent.replace("<svg", `<svg fill="${props.color}"`);
667
+ } else {
668
+ svgContent = svgContent.replace(/fill="[^"]*"/g, `fill="${props.color}"`);
669
+ }
670
+ return "data:image/svg+xml," + encodeURIComponent(svgContent);
671
+ } catch (e) {
672
+ return svgData;
673
+ }
674
+ }
675
+ return svgData;
659
676
  });
660
677
  const sizePx = vue.computed(() => {
661
678
  const size = typeof props.size === "number" ? props.size : parseInt(props.size);
@@ -673,6 +690,12 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
673
690
  }
674
691
  return style;
675
692
  });
693
+ const svgStyle = vue.computed(() => {
694
+ return {
695
+ width: sizePx.value,
696
+ height: sizePx.value
697
+ };
698
+ });
676
699
  return (_ctx, _cache) => {
677
700
  return vue.openBlock(), vue.createElementBlock("view", {
678
701
  class: vue.normalizeClass(["u-icon", { "u-icon--spin": __props.spin }]),
@@ -683,14 +706,14 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
683
706
  key: 0,
684
707
  class: "u-icon__svg",
685
708
  src: iconSrc.value,
686
- style: vue.normalizeStyle({ width: sizePx.value, height: sizePx.value }),
709
+ style: vue.normalizeStyle(svgStyle.value),
687
710
  mode: "aspectFit"
688
711
  }, null, 12, _hoisted_1$A)) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_2$q, vue.toDisplayString(__props.name), 1))
689
712
  ], 6);
690
713
  };
691
714
  }
692
715
  });
693
- const UIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-5d845d48"]]);
716
+ const UIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-632e7780"]]);
694
717
  const __default__$F = {
695
718
  options: {
696
719
  virtualHost: true,