@atooyu/uxto-ui 1.1.1 → 1.1.3
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 +33 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -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 +51 -5
package/dist/index.js
CHANGED
|
@@ -655,12 +655,33 @@ 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
|
+
return getIcon(props.name) || "";
|
|
659
659
|
});
|
|
660
660
|
const sizePx = vue.computed(() => {
|
|
661
661
|
const size = typeof props.size === "number" ? props.size : parseInt(props.size);
|
|
662
662
|
return size + "px";
|
|
663
663
|
});
|
|
664
|
+
const colorToFilter = (color) => {
|
|
665
|
+
const colorMap = {
|
|
666
|
+
"#ff9500": "invert(58%) sepia(97%) saturate(1833%) hue-rotate(351deg) brightness(101%) contrast(101%)",
|
|
667
|
+
"#12b6af": "invert(47%) sepia(85%) saturate(475%) hue-rotate(131deg) brightness(92%) contrast(92%)",
|
|
668
|
+
"#333333": "invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%)",
|
|
669
|
+
"#666666": "invert(45%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%)",
|
|
670
|
+
"#999999": "invert(70%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%)",
|
|
671
|
+
"#ffffff": "invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%)",
|
|
672
|
+
"#ff4d4f": "invert(46%) sepia(98%) saturate(1925%) hue-rotate(335deg) brightness(101%) contrast(101%)"
|
|
673
|
+
};
|
|
674
|
+
const lowerColor = color.toLowerCase();
|
|
675
|
+
if (colorMap[lowerColor]) {
|
|
676
|
+
return colorMap[lowerColor];
|
|
677
|
+
}
|
|
678
|
+
const hex = color.replace("#", "");
|
|
679
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
680
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
681
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
682
|
+
const hue = Math.atan2(Math.sqrt(3) * (g - b), 2 * r - g - b) * 180 / Math.PI;
|
|
683
|
+
return `invert(1) sepia(1) saturate(10000%) hue-rotate(${hue}deg)`;
|
|
684
|
+
};
|
|
664
685
|
const iconStyle = vue.computed(() => {
|
|
665
686
|
const size = typeof props.size === "number" ? props.size : parseInt(props.size);
|
|
666
687
|
const style = {
|
|
@@ -668,11 +689,20 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
|
668
689
|
width: size + "px",
|
|
669
690
|
height: size + "px"
|
|
670
691
|
};
|
|
692
|
+
if (props.color && isSvgIcon.value) {
|
|
693
|
+
style.filter = colorToFilter(props.color);
|
|
694
|
+
}
|
|
671
695
|
if (props.color && !isSvgIcon.value) {
|
|
672
696
|
style.color = props.color;
|
|
673
697
|
}
|
|
674
698
|
return style;
|
|
675
699
|
});
|
|
700
|
+
const svgStyle = vue.computed(() => {
|
|
701
|
+
return {
|
|
702
|
+
width: sizePx.value,
|
|
703
|
+
height: sizePx.value
|
|
704
|
+
};
|
|
705
|
+
});
|
|
676
706
|
return (_ctx, _cache) => {
|
|
677
707
|
return vue.openBlock(), vue.createElementBlock("view", {
|
|
678
708
|
class: vue.normalizeClass(["u-icon", { "u-icon--spin": __props.spin }]),
|
|
@@ -683,14 +713,14 @@ const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
|
|
|
683
713
|
key: 0,
|
|
684
714
|
class: "u-icon__svg",
|
|
685
715
|
src: iconSrc.value,
|
|
686
|
-
style: vue.normalizeStyle(
|
|
716
|
+
style: vue.normalizeStyle(svgStyle.value),
|
|
687
717
|
mode: "aspectFit"
|
|
688
718
|
}, null, 12, _hoisted_1$A)) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_2$q, vue.toDisplayString(__props.name), 1))
|
|
689
719
|
], 6);
|
|
690
720
|
};
|
|
691
721
|
}
|
|
692
722
|
});
|
|
693
|
-
const UIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-
|
|
723
|
+
const UIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-535b2661"]]);
|
|
694
724
|
const __default__$F = {
|
|
695
725
|
options: {
|
|
696
726
|
virtualHost: true,
|