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