60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
import { P as includes } from "./defineComponent-DB6xIcDy.js";
|
|
//#region node_modules/vuetify/lib/util/anchor.js
|
|
var block = ["top", "bottom"];
|
|
var inline = [
|
|
"start",
|
|
"end",
|
|
"left",
|
|
"right"
|
|
];
|
|
/** Parse a raw anchor string into an object */
|
|
function parseAnchor(anchor, isRtl) {
|
|
let [side, align] = anchor.split(" ");
|
|
if (!align) align = includes(block, side) ? "start" : includes(inline, side) ? "top" : "center";
|
|
return {
|
|
side: toPhysical(side, isRtl),
|
|
align: toPhysical(align, isRtl)
|
|
};
|
|
}
|
|
function toPhysical(str, isRtl) {
|
|
if (str === "start") return isRtl ? "right" : "left";
|
|
if (str === "end") return isRtl ? "left" : "right";
|
|
return str;
|
|
}
|
|
function flipSide(anchor) {
|
|
return {
|
|
side: {
|
|
center: "center",
|
|
top: "bottom",
|
|
bottom: "top",
|
|
left: "right",
|
|
right: "left"
|
|
}[anchor.side],
|
|
align: anchor.align
|
|
};
|
|
}
|
|
function flipAlign(anchor) {
|
|
return {
|
|
side: anchor.side,
|
|
align: {
|
|
center: "center",
|
|
top: "bottom",
|
|
bottom: "top",
|
|
left: "right",
|
|
right: "left"
|
|
}[anchor.align]
|
|
};
|
|
}
|
|
function flipCorner(anchor) {
|
|
return {
|
|
side: anchor.align,
|
|
align: anchor.side
|
|
};
|
|
}
|
|
function getAxis(anchor) {
|
|
return includes(block, anchor.side) ? "y" : "x";
|
|
}
|
|
//#endregion
|
|
export { parseAnchor as a, getAxis as i, flipCorner as n, toPhysical as o, flipSide as r, flipAlign as t };
|
|
|
|
//# sourceMappingURL=anchor-DB_quObT.js.map
|