Files
NapCatQQ/.pnpm-store/v3/files/5d/335b2927f26ebdbd669a2d63a1365e8dbef22b72a0a91f3afc3a4c43fec8d1c45945727a2a28c9296d7ca2d948f6f6a01619736e0b77e6c57092988459dba9
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

104 lines
2.0 KiB
Plaintext

"use client";
// src/overlays/utils.ts
var getTransformOrigins = (placement) => {
const origins = {
top: {
originY: 1
},
bottom: {
originY: 0
},
left: {
originX: 1
},
right: {
originX: 0
},
"top-start": {
originX: 0,
originY: 1
},
"top-end": {
originX: 1,
originY: 1
},
"bottom-start": {
originX: 0,
originY: 0
},
"bottom-end": {
originX: 1,
originY: 0
},
"right-start": {
originX: 0,
originY: 0
},
"right-end": {
originX: 0,
originY: 1
},
"left-start": {
originX: 1,
originY: 0
},
"left-end": {
originX: 1,
originY: 1
}
};
return (origins == null ? void 0 : origins[placement]) || {};
};
var toReactAriaPlacement = (placement) => {
const mapPositions = {
top: "top",
bottom: "bottom",
left: "left",
right: "right",
"top-start": "top start",
"top-end": "top end",
"bottom-start": "bottom start",
"bottom-end": "bottom end",
"left-start": "left top",
"left-end": "left bottom",
"right-start": "right top",
"right-end": "right bottom"
};
return mapPositions[placement];
};
var toOverlayPlacement = (placement) => {
const mapPositions = {
top: "top",
bottom: "bottom",
left: "left",
right: "right",
center: "top"
};
return mapPositions[placement];
};
var getShouldUseAxisPlacement = (axisPlacement, overlayPlacement) => {
if (overlayPlacement.includes("-")) {
const [position] = overlayPlacement.split("-");
if (position.includes(axisPlacement)) {
return false;
}
}
return true;
};
var getArrowPlacement = (dynamicPlacement, placement) => {
if (placement.includes("-")) {
const [, position] = placement.split("-");
return `${dynamicPlacement}-${position}`;
}
return dynamicPlacement;
};
export {
getTransformOrigins,
toReactAriaPlacement,
toOverlayPlacement,
getShouldUseAxisPlacement,
getArrowPlacement
};