76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
import {
|
|
useRtl
|
|
} from "./chunk-ENTLCOCZ.js";
|
|
import {
|
|
parseAnchor,
|
|
propsFactory
|
|
} from "./chunk-LZ5T2ERG.js";
|
|
import {
|
|
computed
|
|
} from "./chunk-2MKFL3BX.js";
|
|
|
|
// node_modules/vuetify/lib/composables/location.js
|
|
var oppositeMap = {
|
|
center: "center",
|
|
top: "bottom",
|
|
bottom: "top",
|
|
left: "right",
|
|
right: "left"
|
|
};
|
|
var makeLocationProps = propsFactory({
|
|
location: String
|
|
}, "location");
|
|
function useLocation(props) {
|
|
let opposite = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
let offset = arguments.length > 2 ? arguments[2] : void 0;
|
|
const {
|
|
isRtl
|
|
} = useRtl();
|
|
const locationStyles = computed(() => {
|
|
if (!props.location) return {};
|
|
const {
|
|
side,
|
|
align
|
|
} = parseAnchor(props.location.split(" ").length > 1 ? props.location : `${props.location} center`, isRtl.value);
|
|
function getOffset(side2) {
|
|
return offset ? offset(side2) : 0;
|
|
}
|
|
const styles = {};
|
|
if (side !== "center") {
|
|
if (opposite) styles[oppositeMap[side]] = `calc(100% - ${getOffset(side)}px)`;
|
|
else styles[side] = 0;
|
|
}
|
|
if (align !== "center") {
|
|
if (opposite) styles[oppositeMap[align]] = `calc(100% - ${getOffset(align)}px)`;
|
|
else styles[align] = 0;
|
|
} else {
|
|
if (side === "center") styles.top = styles.left = "50%";
|
|
else {
|
|
styles[{
|
|
top: "left",
|
|
bottom: "left",
|
|
left: "top",
|
|
right: "top"
|
|
}[side]] = "50%";
|
|
}
|
|
styles.transform = {
|
|
top: "translateX(-50%)",
|
|
bottom: "translateX(-50%)",
|
|
left: "translateY(-50%)",
|
|
right: "translateY(-50%)",
|
|
center: "translate(-50%, -50%)"
|
|
}[side];
|
|
}
|
|
return styles;
|
|
});
|
|
return {
|
|
locationStyles
|
|
};
|
|
}
|
|
|
|
export {
|
|
makeLocationProps,
|
|
useLocation
|
|
};
|
|
//# sourceMappingURL=chunk-KTTVT6V2.js.map
|