147 lines
3.5 KiB
JavaScript
147 lines
3.5 KiB
JavaScript
import {
|
|
consoleWarn,
|
|
defineComponent,
|
|
genericComponent,
|
|
propsFactory
|
|
} from "./chunk-LZ5T2ERG.js";
|
|
import {
|
|
computed,
|
|
createBaseVNode,
|
|
createVNode,
|
|
inject,
|
|
mergeProps,
|
|
normalizeClass,
|
|
toValue
|
|
} from "./chunk-2MKFL3BX.js";
|
|
|
|
// node_modules/vuetify/lib/composables/icons.js
|
|
var IconValue = [String, Function, Object, Array];
|
|
var IconSymbol = /* @__PURE__ */ Symbol.for("vuetify:icons");
|
|
var makeIconProps = propsFactory({
|
|
icon: {
|
|
type: IconValue
|
|
},
|
|
// Could not remove this and use makeTagProps, types complained because it is not required
|
|
tag: {
|
|
type: [String, Object, Function],
|
|
required: true
|
|
}
|
|
}, "icon");
|
|
var VComponentIcon = genericComponent()({
|
|
name: "VComponentIcon",
|
|
props: makeIconProps(),
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
return () => {
|
|
const Icon = props.icon;
|
|
return createVNode(props.tag, null, {
|
|
default: () => [props.icon ? createVNode(Icon, null, null) : slots.default?.()]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var VSvgIcon = defineComponent({
|
|
name: "VSvgIcon",
|
|
inheritAttrs: false,
|
|
props: makeIconProps(),
|
|
setup(props, _ref2) {
|
|
let {
|
|
attrs
|
|
} = _ref2;
|
|
return () => {
|
|
return createVNode(props.tag, mergeProps(attrs, {
|
|
"style": null
|
|
}), {
|
|
default: () => [createBaseVNode("svg", {
|
|
"class": "v-icon__svg",
|
|
"xmlns": "http://www.w3.org/2000/svg",
|
|
"viewBox": "0 0 24 24",
|
|
"role": "img",
|
|
"aria-hidden": "true"
|
|
}, [Array.isArray(props.icon) ? props.icon.map((path) => Array.isArray(path) ? createBaseVNode("path", {
|
|
"d": path[0],
|
|
"fill-opacity": path[1]
|
|
}, null) : createBaseVNode("path", {
|
|
"d": path
|
|
}, null)) : createBaseVNode("path", {
|
|
"d": props.icon
|
|
}, null)])]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var VLigatureIcon = defineComponent({
|
|
name: "VLigatureIcon",
|
|
props: makeIconProps(),
|
|
setup(props) {
|
|
return () => {
|
|
return createVNode(props.tag, null, {
|
|
default: () => [props.icon]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var VClassIcon = defineComponent({
|
|
name: "VClassIcon",
|
|
props: makeIconProps(),
|
|
setup(props) {
|
|
return () => {
|
|
return createVNode(props.tag, {
|
|
"class": normalizeClass(props.icon)
|
|
}, null);
|
|
};
|
|
}
|
|
});
|
|
var useIcon = (props) => {
|
|
const icons = inject(IconSymbol);
|
|
if (!icons) throw new Error("Missing Vuetify Icons provide!");
|
|
const iconData = computed(() => {
|
|
const iconAlias = toValue(props);
|
|
if (!iconAlias) return {
|
|
component: VComponentIcon
|
|
};
|
|
let icon = iconAlias;
|
|
if (typeof icon === "string") {
|
|
icon = icon.trim();
|
|
if (icon.startsWith("$")) {
|
|
icon = icons.aliases?.[icon.slice(1)];
|
|
}
|
|
}
|
|
if (!icon) consoleWarn(`Could not find aliased icon "${iconAlias}"`);
|
|
if (Array.isArray(icon)) {
|
|
return {
|
|
component: VSvgIcon,
|
|
icon
|
|
};
|
|
} else if (typeof icon !== "string") {
|
|
return {
|
|
component: VComponentIcon,
|
|
icon
|
|
};
|
|
}
|
|
const iconSetName = Object.keys(icons.sets).find((setName) => typeof icon === "string" && icon.startsWith(`${setName}:`));
|
|
const iconName = iconSetName ? icon.slice(iconSetName.length + 1) : icon;
|
|
const iconSet = icons.sets[iconSetName ?? icons.defaultSet];
|
|
return {
|
|
component: iconSet.component,
|
|
icon: iconName
|
|
};
|
|
});
|
|
return {
|
|
iconData
|
|
};
|
|
};
|
|
|
|
export {
|
|
IconValue,
|
|
IconSymbol,
|
|
VComponentIcon,
|
|
VSvgIcon,
|
|
VLigatureIcon,
|
|
VClassIcon,
|
|
useIcon
|
|
};
|
|
//# sourceMappingURL=chunk-OJDZBU5D.js.map
|