172 lines
5.3 KiB
JavaScript
172 lines
5.3 KiB
JavaScript
import {
|
|
useIntersectionObserver
|
|
} from "./chunk-AJ7MUB7M.js";
|
|
import {
|
|
makeSizeProps,
|
|
useSize
|
|
} from "./chunk-PIT7IT55.js";
|
|
import {
|
|
makeTagProps
|
|
} from "./chunk-2HZIACSB.js";
|
|
import {
|
|
useTextColor
|
|
} from "./chunk-BHV5Z34M.js";
|
|
import {
|
|
useResizeObserver
|
|
} from "./chunk-XDSAO7OT.js";
|
|
import {
|
|
makeThemeProps,
|
|
provideTheme
|
|
} from "./chunk-3DSR7NCB.js";
|
|
import {
|
|
PREFERS_REDUCED_MOTION,
|
|
clamp,
|
|
convertToUnit,
|
|
genericComponent,
|
|
makeComponentProps,
|
|
propsFactory,
|
|
useRender
|
|
} from "./chunk-LZ5T2ERG.js";
|
|
import {
|
|
computed,
|
|
createBaseVNode,
|
|
createVNode,
|
|
normalizeClass,
|
|
normalizeStyle,
|
|
ref,
|
|
toRef,
|
|
watchEffect
|
|
} from "./chunk-2MKFL3BX.js";
|
|
|
|
// node_modules/vuetify/lib/components/VProgressCircular/VProgressCircular.js
|
|
import "/home/david/gitea_repo/personal_development/ServerManagerWebApp/frontend/node_modules/vuetify/lib/components/VProgressCircular/VProgressCircular.css";
|
|
var makeVProgressCircularProps = propsFactory({
|
|
bgColor: String,
|
|
color: String,
|
|
indeterminate: [Boolean, String],
|
|
rounded: Boolean,
|
|
modelValue: {
|
|
type: [Number, String],
|
|
default: 0
|
|
},
|
|
rotate: {
|
|
type: [Number, String],
|
|
default: 0
|
|
},
|
|
width: {
|
|
type: [Number, String],
|
|
default: 4
|
|
},
|
|
...makeComponentProps(),
|
|
...makeSizeProps(),
|
|
...makeTagProps({
|
|
tag: "div"
|
|
}),
|
|
...makeThemeProps()
|
|
}, "VProgressCircular");
|
|
var VProgressCircular = genericComponent()({
|
|
name: "VProgressCircular",
|
|
props: makeVProgressCircularProps(),
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const MAGIC_RADIUS_CONSTANT = 20;
|
|
const CIRCUMFERENCE = 2 * Math.PI * MAGIC_RADIUS_CONSTANT;
|
|
const root = ref();
|
|
const {
|
|
themeClasses
|
|
} = provideTheme(props);
|
|
const {
|
|
sizeClasses,
|
|
sizeStyles
|
|
} = useSize(props);
|
|
const {
|
|
textColorClasses,
|
|
textColorStyles
|
|
} = useTextColor(() => props.color);
|
|
const {
|
|
textColorClasses: underlayColorClasses,
|
|
textColorStyles: underlayColorStyles
|
|
} = useTextColor(() => props.bgColor);
|
|
const {
|
|
intersectionRef,
|
|
isIntersecting
|
|
} = useIntersectionObserver();
|
|
const {
|
|
resizeRef,
|
|
contentRect
|
|
} = useResizeObserver();
|
|
const normalizedValue = toRef(() => clamp(parseFloat(props.modelValue), 0, 100));
|
|
const width = toRef(() => Number(props.width));
|
|
const size = toRef(() => {
|
|
return sizeStyles.value ? Number(props.size) : contentRect.value ? contentRect.value.width : Math.max(width.value, 32);
|
|
});
|
|
const diameter = toRef(() => MAGIC_RADIUS_CONSTANT / (1 - width.value / size.value) * 2);
|
|
const strokeWidth = toRef(() => width.value / size.value * diameter.value);
|
|
const strokeDashOffset = toRef(() => {
|
|
const baseLength = (100 - normalizedValue.value) / 100 * CIRCUMFERENCE;
|
|
return props.rounded && normalizedValue.value > 0 && normalizedValue.value < 100 ? convertToUnit(Math.min(CIRCUMFERENCE - 0.01, baseLength + strokeWidth.value)) : convertToUnit(baseLength);
|
|
});
|
|
const startAngle = computed(() => {
|
|
const baseAngle = Number(props.rotate);
|
|
return props.rounded ? baseAngle + strokeWidth.value / 2 / CIRCUMFERENCE * 360 : baseAngle;
|
|
});
|
|
watchEffect(() => {
|
|
intersectionRef.value = root.value;
|
|
resizeRef.value = root.value;
|
|
});
|
|
useRender(() => createVNode(props.tag, {
|
|
"ref": root,
|
|
"class": normalizeClass(["v-progress-circular", {
|
|
"v-progress-circular--indeterminate": !!props.indeterminate,
|
|
"v-progress-circular--visible": isIntersecting.value,
|
|
"v-progress-circular--disable-shrink": props.indeterminate && (props.indeterminate === "disable-shrink" || PREFERS_REDUCED_MOTION())
|
|
}, themeClasses.value, sizeClasses.value, textColorClasses.value, props.class]),
|
|
"style": normalizeStyle([sizeStyles.value, textColorStyles.value, props.style]),
|
|
"role": "progressbar",
|
|
"aria-valuemin": "0",
|
|
"aria-valuemax": "100",
|
|
"aria-valuenow": props.indeterminate ? void 0 : normalizedValue.value
|
|
}, {
|
|
default: () => [createBaseVNode("svg", {
|
|
"style": {
|
|
transform: `rotate(calc(-90deg + ${startAngle.value}deg))`
|
|
},
|
|
"xmlns": "http://www.w3.org/2000/svg",
|
|
"viewBox": `0 0 ${diameter.value} ${diameter.value}`
|
|
}, [createBaseVNode("circle", {
|
|
"class": normalizeClass(["v-progress-circular__underlay", underlayColorClasses.value]),
|
|
"style": normalizeStyle(underlayColorStyles.value),
|
|
"fill": "transparent",
|
|
"cx": "50%",
|
|
"cy": "50%",
|
|
"r": MAGIC_RADIUS_CONSTANT,
|
|
"stroke-width": strokeWidth.value,
|
|
"stroke-dasharray": CIRCUMFERENCE,
|
|
"stroke-dashoffset": 0
|
|
}, null), createBaseVNode("circle", {
|
|
"class": "v-progress-circular__overlay",
|
|
"fill": "transparent",
|
|
"cx": "50%",
|
|
"cy": "50%",
|
|
"r": MAGIC_RADIUS_CONSTANT,
|
|
"stroke-width": strokeWidth.value,
|
|
"stroke-dasharray": CIRCUMFERENCE,
|
|
"stroke-dashoffset": strokeDashOffset.value,
|
|
"stroke-linecap": props.rounded ? "round" : void 0
|
|
}, null)]), slots.default && createBaseVNode("div", {
|
|
"class": "v-progress-circular__content"
|
|
}, [slots.default({
|
|
value: normalizedValue.value
|
|
})])]
|
|
}));
|
|
return {};
|
|
}
|
|
});
|
|
|
|
export {
|
|
VProgressCircular
|
|
};
|
|
//# sourceMappingURL=chunk-MH76ZJYE.js.map
|