Files
2026-01-09 19:24:41 +00:00

322 lines
10 KiB
JavaScript

import {
useIntersectionObserver
} from "./chunk-AJ7MUB7M.js";
import {
makeLocationProps,
useLocation
} from "./chunk-KTTVT6V2.js";
import {
makeRoundedProps,
useRounded
} from "./chunk-AQK3CYVW.js";
import {
makeTagProps
} from "./chunk-2HZIACSB.js";
import {
useBackgroundColor,
useTextColor
} from "./chunk-BHV5Z34M.js";
import {
useResizeObserver
} from "./chunk-XDSAO7OT.js";
import {
useRtl
} from "./chunk-ENTLCOCZ.js";
import {
useProxiedModel,
useToggleScope
} from "./chunk-KA77II4V.js";
import {
makeThemeProps,
provideTheme
} from "./chunk-3DSR7NCB.js";
import {
clamp,
convertToUnit,
genericComponent,
makeComponentProps,
propsFactory,
useRender
} from "./chunk-LZ5T2ERG.js";
import {
Transition,
computed,
createBaseVNode,
createVNode,
normalizeClass,
normalizeStyle,
ref,
shallowRef,
toRef,
toValue,
watchEffect
} from "./chunk-2MKFL3BX.js";
// node_modules/vuetify/lib/components/VProgressLinear/VProgressLinear.js
import "/home/david/gitea_repo/personal_development/ServerManagerWebApp/frontend/node_modules/vuetify/lib/components/VProgressLinear/VProgressLinear.css";
// node_modules/vuetify/lib/components/VProgressLinear/chunks.js
var makeChunksProps = propsFactory({
chunkCount: {
type: [Number, String],
default: null
},
chunkWidth: {
type: [Number, String],
default: null
},
chunkGap: {
type: [Number, String],
default: 4
}
}, "chunks");
function useChunks(props, containerWidth) {
const hasChunks = toRef(() => !!props.chunkCount || !!props.chunkWidth);
const chunkWidth = computed(() => {
const containerSize = toValue(containerWidth);
if (!containerSize) {
return 0;
}
if (!props.chunkCount) {
return Number(props.chunkWidth);
}
const count = Number(props.chunkCount);
const availableWidth = containerSize - Number(props.chunkGap) * (count - 1);
return availableWidth / count;
});
const chunkGap = toRef(() => Number(props.chunkGap));
const chunksMaskStyles = computed(() => {
if (!hasChunks.value) {
return {};
}
const chunkGapPx = convertToUnit(chunkGap.value);
const chunkWidthPx = convertToUnit(chunkWidth.value);
return {
maskRepeat: "repeat-x",
maskImage: `linear-gradient(90deg, #000, #000 ${chunkWidthPx}, transparent ${chunkWidthPx}, transparent)`,
maskSize: `calc(${chunkWidthPx} + ${chunkGapPx}) 100%`
};
});
function snapValueToChunk(val) {
const containerSize = toValue(containerWidth);
if (!containerSize) {
return val;
}
const gapRelativeSize = 100 * chunkGap.value / containerSize;
const chunkRelativeSize = 100 * (chunkWidth.value + chunkGap.value) / containerSize;
const filledChunks = Math.floor((val + gapRelativeSize) / chunkRelativeSize);
return clamp(0, filledChunks * chunkRelativeSize - gapRelativeSize / 2, 100);
}
return {
hasChunks,
chunksMaskStyles,
snapValueToChunk
};
}
// node_modules/vuetify/lib/components/VProgressLinear/VProgressLinear.js
var makeVProgressLinearProps = propsFactory({
absolute: Boolean,
active: {
type: Boolean,
default: true
},
bgColor: String,
bgOpacity: [Number, String],
bufferValue: {
type: [Number, String],
default: 0
},
bufferColor: String,
bufferOpacity: [Number, String],
clickable: Boolean,
color: String,
height: {
type: [Number, String],
default: 4
},
indeterminate: Boolean,
max: {
type: [Number, String],
default: 100
},
modelValue: {
type: [Number, String],
default: 0
},
opacity: [Number, String],
reverse: Boolean,
stream: Boolean,
striped: Boolean,
roundedBar: Boolean,
...makeChunksProps(),
...makeComponentProps(),
...makeLocationProps({
location: "top"
}),
...makeRoundedProps(),
...makeTagProps(),
...makeThemeProps()
}, "VProgressLinear");
var VProgressLinear = genericComponent()({
name: "VProgressLinear",
props: makeVProgressLinearProps(),
emits: {
"update:modelValue": (value) => true
},
setup(props, _ref) {
let {
slots
} = _ref;
const root = ref();
const progress = useProxiedModel(props, "modelValue");
const {
isRtl,
rtlClasses
} = useRtl();
const {
themeClasses
} = provideTheme(props);
const {
locationStyles
} = useLocation(props);
const {
textColorClasses,
textColorStyles
} = useTextColor(() => props.color);
const {
backgroundColorClasses,
backgroundColorStyles
} = useBackgroundColor(() => props.bgColor || props.color);
const {
backgroundColorClasses: bufferColorClasses,
backgroundColorStyles: bufferColorStyles
} = useBackgroundColor(() => props.bufferColor || props.bgColor || props.color);
const {
backgroundColorClasses: barColorClasses,
backgroundColorStyles: barColorStyles
} = useBackgroundColor(() => props.color);
const {
roundedClasses
} = useRounded(props);
const {
intersectionRef,
isIntersecting
} = useIntersectionObserver();
const max = computed(() => parseFloat(props.max));
const height = computed(() => parseFloat(props.height));
const normalizedBuffer = computed(() => clamp(parseFloat(props.bufferValue) / max.value * 100, 0, 100));
const normalizedValue = computed(() => clamp(parseFloat(progress.value) / max.value * 100, 0, 100));
const isReversed = computed(() => isRtl.value !== props.reverse);
const transition = computed(() => props.indeterminate ? "fade-transition" : "slide-x-transition");
const containerWidth = shallowRef(0);
const {
hasChunks,
chunksMaskStyles,
snapValueToChunk
} = useChunks(props, containerWidth);
useToggleScope(hasChunks, () => {
const {
resizeRef
} = useResizeObserver((entries) => containerWidth.value = entries[0].contentRect.width);
watchEffect(() => resizeRef.value = root.value);
});
const bufferWidth = computed(() => {
return hasChunks.value ? snapValueToChunk(normalizedBuffer.value) : normalizedBuffer.value;
});
const barWidth = computed(() => {
return hasChunks.value ? snapValueToChunk(normalizedValue.value) : normalizedValue.value;
});
function handleClick(e) {
if (!intersectionRef.value) return;
const {
left,
right,
width
} = intersectionRef.value.getBoundingClientRect();
const value = isReversed.value ? width - e.clientX + (right - width) : e.clientX - left;
progress.value = Math.round(value / width * max.value);
}
watchEffect(() => {
intersectionRef.value = root.value;
});
useRender(() => createVNode(props.tag, {
"ref": root,
"class": normalizeClass(["v-progress-linear", {
"v-progress-linear--absolute": props.absolute,
"v-progress-linear--active": props.active && isIntersecting.value,
"v-progress-linear--reverse": isReversed.value,
"v-progress-linear--rounded": props.rounded,
"v-progress-linear--rounded-bar": props.roundedBar,
"v-progress-linear--striped": props.striped,
"v-progress-linear--clickable": props.clickable
}, roundedClasses.value, themeClasses.value, rtlClasses.value, props.class]),
"style": normalizeStyle([{
bottom: props.location === "bottom" ? 0 : void 0,
top: props.location === "top" ? 0 : void 0,
height: props.active ? convertToUnit(height.value) : 0,
"--v-progress-linear-height": convertToUnit(height.value),
...props.absolute ? locationStyles.value : {}
}, chunksMaskStyles.value, props.style]),
"role": "progressbar",
"aria-hidden": props.active ? "false" : "true",
"aria-valuemin": "0",
"aria-valuemax": props.max,
"aria-valuenow": props.indeterminate ? void 0 : Math.min(parseFloat(progress.value), max.value),
"onClick": props.clickable && handleClick
}, {
default: () => [props.stream && createBaseVNode("div", {
"key": "stream",
"class": normalizeClass(["v-progress-linear__stream", textColorClasses.value]),
"style": {
...textColorStyles.value,
[isReversed.value ? "left" : "right"]: convertToUnit(-height.value),
borderTop: `${convertToUnit(height.value / 2)} dotted`,
opacity: parseFloat(props.bufferOpacity),
top: `calc(50% - ${convertToUnit(height.value / 4)})`,
width: convertToUnit(100 - normalizedBuffer.value, "%"),
"--v-progress-linear-stream-to": convertToUnit(height.value * (isReversed.value ? 1 : -1))
}
}, null), createBaseVNode("div", {
"class": normalizeClass(["v-progress-linear__background", backgroundColorClasses.value]),
"style": normalizeStyle([backgroundColorStyles.value, {
opacity: parseFloat(props.bgOpacity),
width: props.stream ? 0 : void 0
}])
}, null), createBaseVNode("div", {
"class": normalizeClass(["v-progress-linear__buffer", bufferColorClasses.value]),
"style": normalizeStyle([bufferColorStyles.value, {
opacity: parseFloat(props.bufferOpacity),
width: convertToUnit(bufferWidth.value, "%")
}])
}, null), createVNode(Transition, {
"name": transition.value
}, {
default: () => [!props.indeterminate ? createBaseVNode("div", {
"class": normalizeClass(["v-progress-linear__determinate", barColorClasses.value]),
"style": normalizeStyle([barColorStyles.value, {
width: convertToUnit(barWidth.value, "%")
}])
}, null) : createBaseVNode("div", {
"class": "v-progress-linear__indeterminate"
}, [["long", "short"].map((bar) => createBaseVNode("div", {
"key": bar,
"class": normalizeClass(["v-progress-linear__indeterminate", bar, barColorClasses.value]),
"style": normalizeStyle(barColorStyles.value)
}, null))])]
}), slots.default && createBaseVNode("div", {
"class": "v-progress-linear__content"
}, [slots.default({
value: normalizedValue.value,
buffer: normalizedBuffer.value
})])]
}));
return {};
}
});
export {
VProgressLinear
};
//# sourceMappingURL=chunk-6RFSM2OD.js.map