mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-03 14:20:50 +08:00
112 lines
3.2 KiB
JavaScript
112 lines
3.2 KiB
JavaScript
import { p as cB, W as cM, m as c, q as useTheme, d as defineComponent, x as useConfig, bv as iconLight, G as computed, ap as useThemeClass, bd as warn, l as h, ax as mergeProps } from "./index-DKaFsuse.js";
|
|
import { f as formatLength } from "./Image-DXClIklC.js";
|
|
const style = cB("icon", `
|
|
height: 1em;
|
|
width: 1em;
|
|
line-height: 1em;
|
|
text-align: center;
|
|
display: inline-block;
|
|
position: relative;
|
|
fill: currentColor;
|
|
transform: translateZ(0);
|
|
`, [cM("color-transition", {
|
|
transition: "color .3s var(--n-bezier)"
|
|
}), cM("depth", {
|
|
color: "var(--n-color)"
|
|
}, [c("svg", {
|
|
opacity: "var(--n-opacity)",
|
|
transition: "opacity .3s var(--n-bezier)"
|
|
})]), c("svg", {
|
|
height: "1em",
|
|
width: "1em"
|
|
})]);
|
|
const iconProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
depth: [String, Number],
|
|
size: [Number, String],
|
|
color: String,
|
|
component: [Object, Function]
|
|
});
|
|
const NIcon = defineComponent({
|
|
_n_icon__: true,
|
|
name: "Icon",
|
|
inheritAttrs: false,
|
|
props: iconProps,
|
|
setup(props) {
|
|
const {
|
|
mergedClsPrefixRef,
|
|
inlineThemeDisabled
|
|
} = useConfig(props);
|
|
const themeRef = useTheme("Icon", "-icon", style, iconLight, props, mergedClsPrefixRef);
|
|
const cssVarsRef = computed(() => {
|
|
const {
|
|
depth
|
|
} = props;
|
|
const {
|
|
common: {
|
|
cubicBezierEaseInOut
|
|
},
|
|
self
|
|
} = themeRef.value;
|
|
if (depth !== void 0) {
|
|
const {
|
|
color,
|
|
[`opacity${depth}Depth`]: opacity
|
|
} = self;
|
|
return {
|
|
"--n-bezier": cubicBezierEaseInOut,
|
|
"--n-color": color,
|
|
"--n-opacity": opacity
|
|
};
|
|
}
|
|
return {
|
|
"--n-bezier": cubicBezierEaseInOut,
|
|
"--n-color": "",
|
|
"--n-opacity": ""
|
|
};
|
|
});
|
|
const themeClassHandle = inlineThemeDisabled ? useThemeClass("icon", computed(() => `${props.depth || "d"}`), cssVarsRef, props) : void 0;
|
|
return {
|
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
mergedStyle: computed(() => {
|
|
const {
|
|
size,
|
|
color
|
|
} = props;
|
|
return {
|
|
fontSize: formatLength(size),
|
|
color
|
|
};
|
|
}),
|
|
cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
|
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
};
|
|
},
|
|
render() {
|
|
var _a;
|
|
const {
|
|
$parent,
|
|
depth,
|
|
mergedClsPrefix,
|
|
component,
|
|
onRender,
|
|
themeClass
|
|
} = this;
|
|
if ((_a = $parent === null || $parent === void 0 ? void 0 : $parent.$options) === null || _a === void 0 ? void 0 : _a._n_icon__) {
|
|
warn("icon", "don't wrap `n-icon` inside `n-icon`");
|
|
}
|
|
onRender === null || onRender === void 0 ? void 0 : onRender();
|
|
return h("i", mergeProps(this.$attrs, {
|
|
role: "img",
|
|
class: [`${mergedClsPrefix}-icon`, themeClass, {
|
|
[`${mergedClsPrefix}-icon--depth`]: depth,
|
|
[`${mergedClsPrefix}-icon--color-transition`]: depth !== void 0
|
|
}],
|
|
style: [this.cssVars, this.mergedStyle]
|
|
}), component ? h(component) : this.$slots);
|
|
}
|
|
});
|
|
export {
|
|
NIcon as N
|
|
};
|