major server manager overhaul
This commit is contained in:
+278
@@ -0,0 +1,278 @@
|
||||
import {
|
||||
VOverlay,
|
||||
makeVOverlayProps
|
||||
} from "./chunk-CL6G3ICF.js";
|
||||
import {
|
||||
useScopeId
|
||||
} from "./chunk-BVUPSGRF.js";
|
||||
import {
|
||||
forwardRefs
|
||||
} from "./chunk-GUNW7S2L.js";
|
||||
import {
|
||||
VuetifyLayoutKey,
|
||||
useLayout
|
||||
} from "./chunk-KQXZAEJP.js";
|
||||
import {
|
||||
makePositionProps,
|
||||
usePosition
|
||||
} from "./chunk-HOEZWRBG.js";
|
||||
import {
|
||||
genOverlays,
|
||||
makeVariantProps,
|
||||
useVariant
|
||||
} from "./chunk-ADXDXPPR.js";
|
||||
import {
|
||||
VProgressLinear
|
||||
} from "./chunk-6RFSM2OD.js";
|
||||
import {
|
||||
makeLocationProps
|
||||
} from "./chunk-KTTVT6V2.js";
|
||||
import {
|
||||
makeRoundedProps,
|
||||
useRounded
|
||||
} from "./chunk-AQK3CYVW.js";
|
||||
import {
|
||||
VDefaultsProvider
|
||||
} from "./chunk-PAT7NP2Z.js";
|
||||
import {
|
||||
useProxiedModel,
|
||||
useToggleScope
|
||||
} from "./chunk-KA77II4V.js";
|
||||
import {
|
||||
makeThemeProps,
|
||||
provideTheme
|
||||
} from "./chunk-3DSR7NCB.js";
|
||||
import {
|
||||
genericComponent,
|
||||
omit,
|
||||
propsFactory,
|
||||
refElement,
|
||||
useRender
|
||||
} from "./chunk-LZ5T2ERG.js";
|
||||
import {
|
||||
computed,
|
||||
createBaseVNode,
|
||||
createVNode,
|
||||
inject,
|
||||
mergeProps,
|
||||
nextTick,
|
||||
onMounted,
|
||||
onScopeDispose,
|
||||
ref,
|
||||
shallowRef,
|
||||
watch,
|
||||
watchEffect
|
||||
} from "./chunk-2MKFL3BX.js";
|
||||
|
||||
// node_modules/vuetify/lib/components/VSnackbar/VSnackbar.js
|
||||
import "/home/david/gitea_repo/personal_development/ServerManagerWebApp/frontend/node_modules/vuetify/lib/components/VSnackbar/VSnackbar.css";
|
||||
function useCountdown(milliseconds) {
|
||||
const time = shallowRef(milliseconds());
|
||||
let timer = -1;
|
||||
function clear() {
|
||||
clearInterval(timer);
|
||||
}
|
||||
function reset() {
|
||||
clear();
|
||||
nextTick(() => time.value = milliseconds());
|
||||
}
|
||||
function start(el) {
|
||||
const style = el ? getComputedStyle(el) : {
|
||||
transitionDuration: 0.2
|
||||
};
|
||||
const interval = parseFloat(style.transitionDuration) * 1e3 || 200;
|
||||
clear();
|
||||
if (time.value <= 0) return;
|
||||
const startTime = performance.now();
|
||||
timer = window.setInterval(() => {
|
||||
const elapsed = performance.now() - startTime + interval;
|
||||
time.value = Math.max(milliseconds() - elapsed, 0);
|
||||
if (time.value <= 0) clear();
|
||||
}, interval);
|
||||
}
|
||||
onScopeDispose(clear);
|
||||
return {
|
||||
clear,
|
||||
time,
|
||||
start,
|
||||
reset
|
||||
};
|
||||
}
|
||||
var makeVSnackbarProps = propsFactory({
|
||||
/* @deprecated */
|
||||
multiLine: Boolean,
|
||||
text: String,
|
||||
timer: [Boolean, String],
|
||||
timeout: {
|
||||
type: [Number, String],
|
||||
default: 5e3
|
||||
},
|
||||
vertical: Boolean,
|
||||
...makeLocationProps({
|
||||
location: "bottom"
|
||||
}),
|
||||
...makePositionProps(),
|
||||
...makeRoundedProps(),
|
||||
...makeVariantProps(),
|
||||
...makeThemeProps(),
|
||||
...omit(makeVOverlayProps({
|
||||
transition: "v-snackbar-transition"
|
||||
}), ["persistent", "noClickAnimation", "retainFocus", "captureFocus", "disableInitialFocus", "scrim", "scrollStrategy", "stickToTarget", "viewportMargin"])
|
||||
}, "VSnackbar");
|
||||
var VSnackbar = genericComponent()({
|
||||
name: "VSnackbar",
|
||||
props: makeVSnackbarProps(),
|
||||
emits: {
|
||||
"update:modelValue": (v) => true
|
||||
},
|
||||
setup(props, _ref) {
|
||||
let {
|
||||
slots
|
||||
} = _ref;
|
||||
const isActive = useProxiedModel(props, "modelValue");
|
||||
const {
|
||||
positionClasses
|
||||
} = usePosition(props);
|
||||
const {
|
||||
scopeId
|
||||
} = useScopeId();
|
||||
const {
|
||||
themeClasses
|
||||
} = provideTheme(props);
|
||||
const {
|
||||
colorClasses,
|
||||
colorStyles,
|
||||
variantClasses
|
||||
} = useVariant(props);
|
||||
const {
|
||||
roundedClasses
|
||||
} = useRounded(props);
|
||||
const countdown = useCountdown(() => Number(props.timeout));
|
||||
const overlay = ref();
|
||||
const timerRef = ref();
|
||||
const isHovering = shallowRef(false);
|
||||
const startY = shallowRef(0);
|
||||
const mainStyles = ref();
|
||||
const hasLayout = inject(VuetifyLayoutKey, void 0);
|
||||
useToggleScope(() => !!hasLayout, () => {
|
||||
const layout = useLayout();
|
||||
watchEffect(() => {
|
||||
mainStyles.value = layout.mainStyles.value;
|
||||
});
|
||||
});
|
||||
watch(isActive, startTimeout);
|
||||
watch(() => props.timeout, startTimeout);
|
||||
onMounted(() => {
|
||||
if (isActive.value) startTimeout();
|
||||
});
|
||||
let activeTimeout = -1;
|
||||
function startTimeout() {
|
||||
countdown.reset();
|
||||
window.clearTimeout(activeTimeout);
|
||||
const timeout = Number(props.timeout);
|
||||
if (!isActive.value || timeout === -1) return;
|
||||
const element = refElement(timerRef.value);
|
||||
countdown.start(element);
|
||||
activeTimeout = window.setTimeout(() => {
|
||||
isActive.value = false;
|
||||
}, timeout);
|
||||
}
|
||||
function clearTimeout() {
|
||||
countdown.reset();
|
||||
window.clearTimeout(activeTimeout);
|
||||
}
|
||||
function onPointerenter() {
|
||||
isHovering.value = true;
|
||||
clearTimeout();
|
||||
}
|
||||
function onPointerleave() {
|
||||
isHovering.value = false;
|
||||
startTimeout();
|
||||
}
|
||||
function onTouchstart(event) {
|
||||
startY.value = event.touches[0].clientY;
|
||||
}
|
||||
function onTouchend(event) {
|
||||
if (Math.abs(startY.value - event.changedTouches[0].clientY) > 50) {
|
||||
isActive.value = false;
|
||||
}
|
||||
}
|
||||
function onAfterLeave() {
|
||||
if (isHovering.value) onPointerleave();
|
||||
}
|
||||
const locationClasses = computed(() => {
|
||||
return props.location.split(" ").reduce((acc, loc) => {
|
||||
acc[`v-snackbar--${loc}`] = true;
|
||||
return acc;
|
||||
}, {});
|
||||
});
|
||||
useRender(() => {
|
||||
const overlayProps = VOverlay.filterProps(props);
|
||||
const hasContent = !!(slots.default || slots.text || props.text);
|
||||
return createVNode(VOverlay, mergeProps({
|
||||
"ref": overlay,
|
||||
"class": ["v-snackbar", {
|
||||
"v-snackbar--active": isActive.value,
|
||||
"v-snackbar--multi-line": props.multiLine && !props.vertical,
|
||||
"v-snackbar--timer": !!props.timer,
|
||||
"v-snackbar--vertical": props.vertical
|
||||
}, locationClasses.value, positionClasses.value, props.class],
|
||||
"style": [mainStyles.value, props.style]
|
||||
}, overlayProps, {
|
||||
"modelValue": isActive.value,
|
||||
"onUpdate:modelValue": ($event) => isActive.value = $event,
|
||||
"contentProps": mergeProps({
|
||||
class: ["v-snackbar__wrapper", themeClasses.value, colorClasses.value, roundedClasses.value, variantClasses.value],
|
||||
style: [colorStyles.value],
|
||||
onPointerenter,
|
||||
onPointerleave
|
||||
}, overlayProps.contentProps),
|
||||
"persistent": true,
|
||||
"noClickAnimation": true,
|
||||
"scrim": false,
|
||||
"scrollStrategy": "none",
|
||||
"_disableGlobalStack": true,
|
||||
"onTouchstartPassive": onTouchstart,
|
||||
"onTouchend": onTouchend,
|
||||
"onAfterLeave": onAfterLeave
|
||||
}, scopeId), {
|
||||
default: () => [genOverlays(false, "v-snackbar"), props.timer && !isHovering.value && createBaseVNode("div", {
|
||||
"key": "timer",
|
||||
"class": "v-snackbar__timer"
|
||||
}, [createVNode(VProgressLinear, {
|
||||
"ref": timerRef,
|
||||
"color": typeof props.timer === "string" ? props.timer : "info",
|
||||
"max": props.timeout,
|
||||
"modelValue": countdown.time.value
|
||||
}, null)]), hasContent && createBaseVNode("div", {
|
||||
"key": "content",
|
||||
"class": "v-snackbar__content",
|
||||
"role": "status",
|
||||
"aria-live": "polite"
|
||||
}, [slots.text?.() ?? props.text, slots.default?.()]), slots.actions && createVNode(VDefaultsProvider, {
|
||||
"defaults": {
|
||||
VBtn: {
|
||||
variant: "text",
|
||||
ripple: false,
|
||||
slim: true
|
||||
}
|
||||
}
|
||||
}, {
|
||||
default: () => [createBaseVNode("div", {
|
||||
"class": "v-snackbar__actions"
|
||||
}, [slots.actions({
|
||||
isActive
|
||||
})])]
|
||||
})],
|
||||
activator: slots.activator
|
||||
});
|
||||
});
|
||||
return forwardRefs({}, overlay);
|
||||
}
|
||||
});
|
||||
|
||||
export {
|
||||
makeVSnackbarProps,
|
||||
VSnackbar
|
||||
};
|
||||
//# sourceMappingURL=chunk-CCNWGDBL.js.map
|
||||
Reference in New Issue
Block a user