@asup/context-menu 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/main.js +37 -22
- package/dist/cjs/main.js.map +1 -1
- package/dist/context-menu.d.ts +5 -5
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/main.js +38 -23
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/main.js
CHANGED
|
@@ -415,6 +415,7 @@ const $a79b75d040e03c92$export$d4ebdd58e04c6ace = (_param)=>{
|
|
|
415
415
|
yPos: menuYPos,
|
|
416
416
|
toClose: ()=>{
|
|
417
417
|
setMenuVisible(false);
|
|
418
|
+
setMenuInDom(false);
|
|
418
419
|
}
|
|
419
420
|
})
|
|
420
421
|
}), document.body)
|
|
@@ -821,7 +822,7 @@ const $46fb0088a1bbb6d8$var$getMaxZIndex = (componentMinZIndex)=>{
|
|
|
821
822
|
});
|
|
822
823
|
return maxZIndex;
|
|
823
824
|
};
|
|
824
|
-
const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
|
|
825
|
+
const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = /*#__PURE__*/ (0, $gTuX4$react.forwardRef)((_param, ref)=>{
|
|
825
826
|
var { id: id, visible: visible, title: title, titleElement: titleElement, children: children, onOpen: onOpen, onClose: onClose, minZIndex: minZIndex = $46fb0088a1bbb6d8$export$4f9fb66ac71c7da5 } = _param, rest = (0, $gTuX4$swchelperscjs_object_without_propertiescjs._)(_param, [
|
|
826
827
|
"id",
|
|
827
828
|
"visible",
|
|
@@ -847,7 +848,7 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
847
848
|
y: 0
|
|
848
849
|
});
|
|
849
850
|
const [moving, setMoving] = (0, $gTuX4$react.useState)(false);
|
|
850
|
-
const move = (x, y)=>{
|
|
851
|
+
const move = (0, $gTuX4$react.useCallback)((x, y)=>{
|
|
851
852
|
if (windowRef.current && windowPos.current) {
|
|
852
853
|
const window1 = windowRef.current;
|
|
853
854
|
const pos = windowPos.current;
|
|
@@ -855,43 +856,57 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
855
856
|
pos.y += y;
|
|
856
857
|
window1.style.transform = `translate(${pos.x}px, ${pos.y}px)`;
|
|
857
858
|
}
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
const checkPosition = ()=>{
|
|
859
|
+
}, []);
|
|
860
|
+
const checkPosition = (0, $gTuX4$react.useCallback)(()=>{
|
|
861
861
|
const chkPos = (0, $c986bcdcae4b83bd$export$d81cfea7c54be196)(windowRef);
|
|
862
862
|
move(chkPos.translateX, chkPos.translateY);
|
|
863
|
-
}
|
|
864
|
-
|
|
863
|
+
}, [
|
|
864
|
+
move
|
|
865
|
+
]);
|
|
866
|
+
const mouseMove = (0, $gTuX4$react.useCallback)((e)=>{
|
|
865
867
|
e.preventDefault();
|
|
866
868
|
e.stopPropagation();
|
|
867
869
|
move(e.movementX, e.movementY);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
+
}, [
|
|
871
|
+
move
|
|
872
|
+
]);
|
|
870
873
|
const mouseMoveRef = (0, $gTuX4$react.useRef)(mouseMove);
|
|
871
874
|
const mouseUpRef = (0, $gTuX4$react.useRef)(()=>{});
|
|
872
|
-
const mouseUp = (e)=>{
|
|
875
|
+
const mouseUp = (0, $gTuX4$react.useCallback)((e)=>{
|
|
873
876
|
e.preventDefault();
|
|
874
877
|
e.stopPropagation();
|
|
875
878
|
setMoving(false);
|
|
876
879
|
checkPosition();
|
|
877
|
-
document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
878
|
-
document.removeEventListener("mouseup", mouseUpRef.current);
|
|
880
|
+
if (mouseMoveRef.current) document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
881
|
+
if (mouseUpRef.current) document.removeEventListener("mouseup", mouseUpRef.current);
|
|
879
882
|
if (resizeListenerRef.current) {
|
|
880
883
|
window.removeEventListener("resize", resizeListenerRef.current);
|
|
881
884
|
resizeListenerRef.current = null;
|
|
882
885
|
}
|
|
883
886
|
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "auto";
|
|
884
|
-
}
|
|
885
|
-
|
|
887
|
+
}, [
|
|
888
|
+
checkPosition
|
|
889
|
+
]);
|
|
886
890
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
887
891
|
mouseMoveRef.current = mouseMove;
|
|
888
892
|
mouseUpRef.current = mouseUp;
|
|
889
|
-
}
|
|
893
|
+
}, [
|
|
894
|
+
mouseMove,
|
|
895
|
+
mouseUp
|
|
896
|
+
]);
|
|
890
897
|
// Helper function to push this window to the top
|
|
891
|
-
const pushToTop = ()=>{
|
|
898
|
+
const pushToTop = (0, $gTuX4$react.useCallback)(()=>{
|
|
892
899
|
const maxZIndex = $46fb0088a1bbb6d8$var$getMaxZIndex(minZIndex);
|
|
893
900
|
setZIndex(maxZIndex + 1);
|
|
894
|
-
}
|
|
901
|
+
}, [
|
|
902
|
+
minZIndex
|
|
903
|
+
]);
|
|
904
|
+
// Expose pushToTop method via ref
|
|
905
|
+
(0, $gTuX4$react.useImperativeHandle)(ref, ()=>({
|
|
906
|
+
pushToTop: pushToTop
|
|
907
|
+
}), [
|
|
908
|
+
pushToTop
|
|
909
|
+
]);
|
|
895
910
|
// Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings
|
|
896
911
|
// This effect derives state from props, which is acceptable when there's no synchronous setState
|
|
897
912
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
@@ -945,8 +960,8 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
945
960
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
946
961
|
return ()=>{
|
|
947
962
|
// Clean up event listeners if component unmounts while dragging
|
|
948
|
-
document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
949
|
-
document.removeEventListener("mouseup", mouseUpRef.current);
|
|
963
|
+
if (mouseMoveRef.current) document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
964
|
+
if (mouseUpRef.current) document.removeEventListener("mouseup", mouseUpRef.current);
|
|
950
965
|
if (resizeListenerRef.current) {
|
|
951
966
|
window.removeEventListener("resize", resizeListenerRef.current);
|
|
952
967
|
resizeListenerRef.current = null;
|
|
@@ -989,8 +1004,8 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
989
1004
|
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "none";
|
|
990
1005
|
setMoving(true);
|
|
991
1006
|
pushToTop();
|
|
992
|
-
document.addEventListener("mouseup",
|
|
993
|
-
document.addEventListener("mousemove",
|
|
1007
|
+
document.addEventListener("mouseup", mouseUp);
|
|
1008
|
+
document.addEventListener("mousemove", mouseMove);
|
|
994
1009
|
const resizeListener = ()=>checkPosition();
|
|
995
1010
|
resizeListenerRef.current = resizeListener;
|
|
996
1011
|
window.addEventListener("resize", resizeListener);
|
|
@@ -1029,7 +1044,7 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
1029
1044
|
]
|
|
1030
1045
|
})), document.body)
|
|
1031
1046
|
});
|
|
1032
|
-
};
|
|
1047
|
+
});
|
|
1033
1048
|
$46fb0088a1bbb6d8$export$1af8984c69ba1b24.displayName = "ContextWindow";
|
|
1034
1049
|
|
|
1035
1050
|
|
package/dist/cjs/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KAEK,GALS,QAItB,gEAJsB;QACzB;Q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;wBAC5B,OAAO,gBAAgB,CAAC,UAAU;oBACpC;;sCAEA,gCAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,sBAAsB;4BACxC,OAAO;sCAEN,eAAe,eAAe;;sCAEjC,gCAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gCAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gCAAC;oCAAK,GAAE;;;;;;8BAId,gCAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gCAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAEA,0CAAc,WAAW,GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport styles from \"./AutoHeight.module.css\";\n\ninterface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n hide?: boolean;\n duration?: number; // transition duration in ms\n}\n\ntype AnimationState = \"closed\" | \"opening\" | \"open\" | \"closing\";\n\nexport function AutoHeight({\n children,\n hide = false,\n duration = 300,\n ...rest\n}: AutoHeightProps): React.ReactElement {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const [animationState, setAnimationState] = useState<AnimationState>(!hide ? \"open\" : \"closed\");\n\n const rafRef = useRef<number | null>(null);\n const timeoutRef = useRef<number | null>(null);\n\n const targetChildren: React.ReactNode =\n animationState === \"closed\" || !children ? null : children;\n\n const setTargetHeight = useEffectEvent((newHeight: number) => {\n setHeight(newHeight);\n });\n\n const transitionToOpening = useEffectEvent((): void => {\n // Cancel any pending close timeout\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n setAnimationState(\"opening\");\n\n const id = window.requestAnimationFrame(() => {\n rafRef.current = null;\n setTargetHeight(1);\n\n const frameId = window.requestAnimationFrame(() => {\n const inner = innerRef.current;\n if (inner) {\n setTargetHeight(inner.offsetHeight);\n setAnimationState(\"open\");\n }\n });\n rafRef.current = frameId;\n });\n rafRef.current = id;\n });\n\n const transitionToClosing = useEffectEvent((): void => {\n // Cancel any pending RAF\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n setAnimationState(\"closing\");\n setTargetHeight(1);\n\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = null;\n setAnimationState(\"closed\");\n }, duration);\n });\n\n useLayoutEffect(() => {\n if (!hide) {\n // Want to show: transition to open\n if (animationState === \"closed\" || animationState === \"closing\") {\n transitionToOpening();\n }\n // If already opening or open, stay in that state\n } else {\n // Want to hide: transition to closed\n if (animationState === \"open\" || animationState === \"opening\") {\n transitionToClosing();\n }\n }\n }, [hide, animationState]);\n\n // Setup ResizeObserver to track content size changes\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n if (animationState === \"open\") {\n setTargetHeight(transition!.offsetHeight);\n }\n });\n\n observer.observe(transition!);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [animationState]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\n display: animationState === \"closed\" ? \"none\" : undefined,\n height: height ? `${height}px` : \"auto\",\n transitionDuration: `${duration}ms`,\n }}\n >\n <div\n className={styles.autoHeightInner}\n ref={innerRef}\n >\n {targetChildren}\n </div>\n </div>\n );\n}\n\nAutoHeight.displayName = \"AutoHeight\";\n",".autoHeightWrapper {\n overflow: hidden;\n transition-timing-function: height ease-in-out width ease-in-out background-color ease-in-out;\n box-sizing: border-box;\n position: relative;\n}\n\n.autoHeightInner {\n height: fit-content;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: IMenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): React.ReactElement => {\n // Menu state\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n\n // Set up outsideClick handler\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n // Handle click off the menu\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const handleClick = (e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuInDom(false);\n }\n };\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import React, { forwardRef, useLayoutEffect, useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { IMenuItem } from \"./interface\";\n\n// Constants for menu size estimation when ref is not yet available\nconst ESTIMATED_MENU_ITEM_HEIGHT = 34;\nconst ESTIMATED_MENU_PADDING = 4;\nconst ESTIMATED_MENU_WIDTH = 200;\n\nexport interface ContextMenuProps {\n visible: boolean;\n entries: IMenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): React.ReactElement => {\n // Measure menu size after mount/render to avoid accessing refs during render\n const [menuHeight, setMenuHeight] = useState(\n entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING,\n );\n const [menuWidth, setMenuWidth] = useState(ESTIMATED_MENU_WIDTH);\n\n useLayoutEffect(() => {\n // Only measure when visible; ref access inside effect is allowed\n if (visible && ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n setMenuHeight(ref.current.offsetHeight);\n setMenuWidth(ref.current.offsetWidth);\n }\n // When not visible, fall back to estimates\n if (!visible) {\n setMenuHeight(entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING);\n setMenuWidth(ESTIMATED_MENU_WIDTH);\n }\n }, [visible, entries, ref]);\n\n const adjustedYPos =\n yPos + menuHeight > window.innerHeight\n ? Math.max(window.innerHeight - menuHeight - ESTIMATED_MENU_PADDING, 0)\n : yPos;\n const adjustedXPos =\n xPos + menuWidth > window.innerWidth\n ? Math.max(window.innerWidth - menuWidth - ESTIMATED_MENU_PADDING, 0)\n : xPos;\n\n return (\n <div\n ref={ref}\n className={[styles.contextMenu, visible ? styles.visible : styles.hidden]\n .filter((c) => c !== \"\")\n .join(\" \")}\n style={{\n top: `${adjustedYPos}px`,\n left: `${adjustedXPos}px`,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {entries.map((entry, i) => (\n <ContextMenuEntry\n key={i}\n entry={entry}\n toClose={toClose}\n />\n ))}\n </div>\n );\n },\n);\n\nContextMenu.displayName = \"ContextMenu\";\n",".anchor {\n position: absolute;\n top: 0;\n left: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n font-size: 9pt;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.contextMenuHandler {\n height: fit-content;\n width: fit-content;\n}\n\n.contextMenu {\n position: absolute;\n border: 1px solid;\n border-color: rgb(17, 20, 24);\n opacity: 1;\n background-color: rgb(251, 253, 246);\n z-index: 10000;\n box-shadow: 4px 4px 4px rgb(64, 64, 64, 0.75);\n transition: opacity 0.3s linear;\n}\n\n.contextMenu.hidden {\n opacity: 0;\n}\n\n.contextMenu.visible {\n opacity: 1;\n}\n\n.contextMenuItem {\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n min-width: 80px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.contextMenuItem.disabled {\n background-color: rgba(0, 0, 0, 0.2);\n cursor: not-allowed;\n}\n\n.contextMenuItem:first-child {\n padding-top: 4px;\n}\n\n.contextMenuItem:last-child {\n padding-bottom: 4px;\n}\n\n.contextMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.contextMenuItem .caretHolder {\n align-self: flex-end;\n}\n\n.contextMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n\n.contextMenuItemLabel {\n flex-grow: 1;\n height: 19px;\n}\n","import { useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: IMenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: IMenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { LowMenu } from \"./LowMenu\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: IMenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: IMenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | React.ReactElement): boolean {\n return typeof label !== \"string\" && label.type === \"hr\";\n}\n\nexport const ContextMenuHandler = ({\n children,\n menuItems,\n showLowMenu = false,\n ...rest\n}: ContextMenuHandlerProps): React.ReactElement => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems: IMenuItem[] = [\n ...(higherContext !== null\n ? [\n ...higherContext.menuItems,\n ...[\n higherContext.menuItems.length > 0 &&\n !isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) &&\n menuItems.length > 0 &&\n !isDivider(menuItems[0].label)\n ? {\n label: <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />,\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ];\n\n // Menu resources\n const divHandlderRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = useState<boolean>(false);\n const [mouseOverMenu, setMouseOverMenu] = useState<boolean>(false);\n\n // Holder position - measured in an effect to avoid reading refs during render\n const [divHandlerPos, setDivHandlerPos] = useState<DOMRect | null>(null);\n\n useLayoutEffect(() => {\n function updatePos() {\n if (divHandlderRef.current) {\n setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());\n }\n }\n\n // When the handler is hovered or the menu is mounted, ensure we have a fresh position\n if (mouseOverHandlerDiv || menuInDom) {\n updatePos();\n }\n\n // Attach listeners while the menu/low-menu may be visible so the position stays correct\n if (mouseOverHandlerDiv || menuInDom) {\n window.addEventListener(\"resize\", updatePos);\n // listen on capture to catch scrolls from ancestor elements as well\n window.addEventListener(\"scroll\", updatePos, true);\n\n let ro: ResizeObserver | null = null;\n if (typeof ResizeObserver !== \"undefined\" && divHandlderRef.current) {\n ro = new ResizeObserver(() => updatePos());\n ro.observe(divHandlderRef.current);\n }\n\n return () => {\n window.removeEventListener(\"resize\", updatePos);\n window.removeEventListener(\"scroll\", updatePos, true);\n if (ro) ro.disconnect();\n };\n }\n }, [mouseOverHandlerDiv, menuInDom]);\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n };\n }, [handleClick, menuVisible]);\n\n const removeController = useRef<AbortController>(new AbortController());\n useEffect(() => {\n if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setTimeout(() => {\n if (!removeController.current.signal.aborted) setMenuInDom(false);\n }, 300);\n }\n }, [mouseOverHandlerDiv, menuVisible, mouseOverMenu]);\n\n return (\n <ContentMenuHandlerContext.Provider\n value={{\n menuItems: thisMenuItems,\n }}\n >\n <div\n ref={divHandlderRef}\n {...rest}\n className={[styles.contextMenuHandler, rest.className].join(\" \")}\n onContextMenu={async (e) => {\n if (!showLowMenu) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n removeController.current.abort();\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n }\n }}\n onMouseEnter={async (e) => {\n if (showLowMenu) {\n setMenuInDom(true);\n setMouseOverHandlerDiv(false);\n setTimeout(() => {\n removeController.current.abort();\n setMouseOverHandlerDiv(true);\n }, 1);\n }\n rest.onMouseEnter?.(e);\n }}\n onMouseLeave={async (e) => {\n if (showLowMenu) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverHandlerDiv(false);\n }\n rest.onMouseLeave?.(e);\n }}\n >\n {children}\n </div>\n {menuInDom &&\n divHandlerPos &&\n createPortal(\n <div\n className={styles.anchor}\n onMouseEnter={() => {\n removeController.current.abort();\n setMouseOverMenu(true);\n }}\n onMouseLeave={() => {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverMenu(false);\n }}\n >\n {showLowMenu ? (\n <LowMenu\n visible={mouseOverHandlerDiv}\n entries={menuItems}\n xPos={divHandlerPos.left}\n yPos={divHandlerPos.bottom}\n maxWidth={divHandlerPos.width}\n />\n ) : (\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={thisMenuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMouseOverMenu(false);\n }}\n />\n )}\n </div>,\n document.body,\n )}\n </ContentMenuHandlerContext.Provider>\n );\n};\n\nContextMenuHandler.displayName = \"ContextMenuHandler\";\n","import styles from \"./LowMenu.module.css\";\nimport { LowMenuButton } from \"./LowMenuButton\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: IMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({\n entries,\n visible,\n xPos,\n yPos,\n maxWidth,\n}: LowMenuProps): React.ReactElement => {\n // Only show the low menu if it is on the screen\n if (xPos >= window.innerWidth || yPos >= window.innerHeight) return <></>;\n // Show the menu\n return (\n <div\n className={[styles.lowMenu, visible ? styles.visible : styles.hidden].join(\" \")}\n aria-label=\"Low context menu\"\n style={{\n left: `${xPos}px`,\n top: `${yPos}px`,\n maxWidth: `calc(${maxWidth}px)`,\n width: `calc(${maxWidth}px - 4px)`,\n }}\n >\n <div className={styles.lowMenuButtonHolder}>\n {entries.map((e, i) => (\n <LowMenuButton\n key={i}\n entry={e}\n />\n ))}\n </div>\n </div>\n );\n};\n\nLowMenu.displayName = \"LowMenu\";\n",".lowMenu {\n z-index: 2;\n position: absolute;\n margin: 0px;\n transition: opacity 0.3s linear;\n}\n\n.lowMenuButtonHolder {\n border: 2px solid rgb(17, 20, 24);\n border-top-right-radius: 4px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background-color: rgb(17, 20, 24);\n box-shadow: 2px 2px 2px rgb(64, 64, 64, 0.5);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n gap: 2px;\n row-gap: 2px;\n width: fit-content;\n}\n\n.lowMenu.hidden {\n opacity: 0;\n}\n\n.lowMenu.visible,\n.lowMenu:hover {\n opacity: 1;\n}\n\n.lowMenuItem {\n background-color: rgb(251, 253, 246);\n border: 0;\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.lowMenuItem.disabled {\n background-color: rgba(200, 200, 200);\n cursor: not-allowed;\n}\n\n.lowMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.lowMenu-item .caretHolder {\n align-self: flex-end;\n}\n\n.lowMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n","import { useState } from \"react\";\nimport styles from \"./LowMenu.module.css\";\nimport { LowSubMenu } from \"./LowSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: IMenuItem;\n}\nexport const LowMenuButton = ({ entry }: LowMenuButtonProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.lowMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n aria-label={typeof entry.label === \"string\" ? entry.label : undefined}\n aria-disabled={entry.disabled}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) entry.action?.(target);\n }}\n >\n <span>{entry.label}</span>\n {entry.group && <LowSubMenu entry={entry} />}\n </div>\n );\n};\n\nLowMenuButton.displayName = \"LowMenuButton\";\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./LowMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: IMenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import { ReactNode, useEffect, useRef, useState, useTransition } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\nexport interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = ({\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n}: ContextWindowProps): React.ReactElement => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Track internal state: whether window is in DOM and whether it's been positioned\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [, startTransition] = useTransition();\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = (x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const checkPosition = () => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n };\n\n const mouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n };\n\n // Store stable references to mouseMove and mouseUp for cleanup\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n };\n\n // Update refs when callbacks change\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n });\n\n // Helper function to push this window to the top\n const pushToTop = () => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n };\n\n // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings\n // This effect derives state from props, which is acceptable when there's no synchronous setState\n useEffect(() => {\n if (visible && !windowInDOM) {\n // Window should be in DOM when visible becomes true\n startTransition(() => {\n setWindowInDOM(true);\n });\n } else if (!visible && windowInDOM) {\n // Window should leave DOM when visible becomes false\n startTransition(() => {\n setWindowInDOM(false);\n setWindowVisible(false);\n });\n }\n }, [visible, windowInDOM, startTransition]);\n\n // Position and show window after it's added to DOM\n useEffect(() => {\n if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {\n // Position the window\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n checkPosition();\n\n // Update z-index and make visible - use startTransition\n const maxZ = getMaxZIndex(minZIndex);\n onOpen?.();\n startTransition(() => {\n setZIndex(maxZ + 1);\n setWindowVisible(true);\n });\n }\n }, [windowInDOM, windowVisible, visible, checkPosition, minZIndex, onOpen, startTransition]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUpRef.current);\n document.addEventListener(\"mousemove\", mouseMoveRef.current);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement | null>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KAEK,GALS,QAItB,gEAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,mBAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,mBAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,qBAAO,EAAiB;IACpD,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,CAAA,GAAA,qBAAO,EAAkB,CAAC,OAAO,SAAS;IAEtF,MAAM,SAAS,CAAA,GAAA,mBAAK,EAAiB;IACrC,MAAM,aAAa,CAAA,GAAA,mBAAK,EAAiB;IAEzC,MAAM,iBACJ,mBAAmB,YAAY,CAAC,WAAW,OAAO;IAEpD,MAAM,kBAAkB,CAAA,GAAA,2BAAa,EAAE,CAAC;QACtC,UAAU;IACZ;IAEA,MAAM,sBAAsB,CAAA,GAAA,2BAAa,EAAE;QACzC,mCAAmC;QACnC,IAAI,WAAW,OAAO,KAAK,MAAM;YAC/B,aAAa,WAAW,OAAO;YAC/B,WAAW,OAAO,GAAG;QACvB;QAEA,kBAAkB;QAElB,MAAM,KAAK,OAAO,qBAAqB,CAAC;YACtC,OAAO,OAAO,GAAG;YACjB,gBAAgB;YAEhB,MAAM,UAAU,OAAO,qBAAqB,CAAC;gBAC3C,MAAM,QA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;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gCAAC;oCAAK,GAAE;;;;;;8BAId,gCAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gCAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAGF,0CAAc,WAAW,GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport styles from \"./AutoHeight.module.css\";\n\ninterface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n hide?: boolean;\n duration?: number; // transition duration in ms\n}\n\ntype AnimationState = \"closed\" | \"opening\" | \"open\" | \"closing\";\n\nexport function AutoHeight({\n children,\n hide = false,\n duration = 300,\n ...rest\n}: AutoHeightProps): React.ReactElement {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const [animationState, setAnimationState] = useState<AnimationState>(!hide ? \"open\" : \"closed\");\n\n const rafRef = useRef<number | null>(null);\n const timeoutRef = useRef<number | null>(null);\n\n const targetChildren: React.ReactNode =\n animationState === \"closed\" || !children ? null : children;\n\n const setTargetHeight = useEffectEvent((newHeight: number) => {\n setHeight(newHeight);\n });\n\n const transitionToOpening = useEffectEvent((): void => {\n // Cancel any pending close timeout\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n setAnimationState(\"opening\");\n\n const id = window.requestAnimationFrame(() => {\n rafRef.current = null;\n setTargetHeight(1);\n\n const frameId = window.requestAnimationFrame(() => {\n const inner = innerRef.current;\n if (inner) {\n setTargetHeight(inner.offsetHeight);\n setAnimationState(\"open\");\n }\n });\n rafRef.current = frameId;\n });\n rafRef.current = id;\n });\n\n const transitionToClosing = useEffectEvent((): void => {\n // Cancel any pending RAF\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n setAnimationState(\"closing\");\n setTargetHeight(1);\n\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = null;\n setAnimationState(\"closed\");\n }, duration);\n });\n\n useLayoutEffect(() => {\n if (!hide) {\n // Want to show: transition to open\n if (animationState === \"closed\" || animationState === \"closing\") {\n transitionToOpening();\n }\n // If already opening or open, stay in that state\n } else {\n // Want to hide: transition to closed\n if (animationState === \"open\" || animationState === \"opening\") {\n transitionToClosing();\n }\n }\n }, [hide, animationState]);\n\n // Setup ResizeObserver to track content size changes\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n if (animationState === \"open\") {\n setTargetHeight(transition!.offsetHeight);\n }\n });\n\n observer.observe(transition!);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [animationState]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\n display: animationState === \"closed\" ? \"none\" : undefined,\n height: height ? `${height}px` : \"auto\",\n transitionDuration: `${duration}ms`,\n }}\n >\n <div\n className={styles.autoHeightInner}\n ref={innerRef}\n >\n {targetChildren}\n </div>\n </div>\n );\n}\n\nAutoHeight.displayName = \"AutoHeight\";\n",".autoHeightWrapper {\n overflow: hidden;\n transition-timing-function: height ease-in-out width ease-in-out background-color ease-in-out;\n box-sizing: border-box;\n position: relative;\n}\n\n.autoHeightInner {\n height: fit-content;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: IMenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): React.ReactElement => {\n // Menu state\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n\n // Set up outsideClick handler\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n // Handle click off the menu\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const handleClick = (e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuInDom(false);\n }\n };\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMenuInDom(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import React, { forwardRef, useLayoutEffect, useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { IMenuItem } from \"./interface\";\n\n// Constants for menu size estimation when ref is not yet available\nconst ESTIMATED_MENU_ITEM_HEIGHT = 34;\nconst ESTIMATED_MENU_PADDING = 4;\nconst ESTIMATED_MENU_WIDTH = 200;\n\nexport interface ContextMenuProps {\n visible: boolean;\n entries: IMenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): React.ReactElement => {\n // Measure menu size after mount/render to avoid accessing refs during render\n const [menuHeight, setMenuHeight] = useState(\n entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING,\n );\n const [menuWidth, setMenuWidth] = useState(ESTIMATED_MENU_WIDTH);\n\n useLayoutEffect(() => {\n // Only measure when visible; ref access inside effect is allowed\n if (visible && ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n setMenuHeight(ref.current.offsetHeight);\n setMenuWidth(ref.current.offsetWidth);\n }\n // When not visible, fall back to estimates\n if (!visible) {\n setMenuHeight(entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING);\n setMenuWidth(ESTIMATED_MENU_WIDTH);\n }\n }, [visible, entries, ref]);\n\n const adjustedYPos =\n yPos + menuHeight > window.innerHeight\n ? Math.max(window.innerHeight - menuHeight - ESTIMATED_MENU_PADDING, 0)\n : yPos;\n const adjustedXPos =\n xPos + menuWidth > window.innerWidth\n ? Math.max(window.innerWidth - menuWidth - ESTIMATED_MENU_PADDING, 0)\n : xPos;\n\n return (\n <div\n ref={ref}\n className={[styles.contextMenu, visible ? styles.visible : styles.hidden]\n .filter((c) => c !== \"\")\n .join(\" \")}\n style={{\n top: `${adjustedYPos}px`,\n left: `${adjustedXPos}px`,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {entries.map((entry, i) => (\n <ContextMenuEntry\n key={i}\n entry={entry}\n toClose={toClose}\n />\n ))}\n </div>\n );\n },\n);\n\nContextMenu.displayName = \"ContextMenu\";\n",".anchor {\n position: absolute;\n top: 0;\n left: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n font-size: 9pt;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.contextMenuHandler {\n height: fit-content;\n width: fit-content;\n}\n\n.contextMenu {\n position: absolute;\n border: 1px solid;\n border-color: rgb(17, 20, 24);\n opacity: 1;\n background-color: rgb(251, 253, 246);\n z-index: 10000;\n box-shadow: 4px 4px 4px rgb(64, 64, 64, 0.75);\n transition: opacity 0.3s linear;\n}\n\n.contextMenu.hidden {\n opacity: 0;\n}\n\n.contextMenu.visible {\n opacity: 1;\n}\n\n.contextMenuItem {\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n min-width: 80px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.contextMenuItem.disabled {\n background-color: rgba(0, 0, 0, 0.2);\n cursor: not-allowed;\n}\n\n.contextMenuItem:first-child {\n padding-top: 4px;\n}\n\n.contextMenuItem:last-child {\n padding-bottom: 4px;\n}\n\n.contextMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.contextMenuItem .caretHolder {\n align-self: flex-end;\n}\n\n.contextMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n\n.contextMenuItemLabel {\n flex-grow: 1;\n height: 19px;\n}\n","import { useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: IMenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: IMenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { LowMenu } from \"./LowMenu\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: IMenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: IMenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | React.ReactElement): boolean {\n return typeof label !== \"string\" && label.type === \"hr\";\n}\n\nexport const ContextMenuHandler = ({\n children,\n menuItems,\n showLowMenu = false,\n ...rest\n}: ContextMenuHandlerProps): React.ReactElement => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems: IMenuItem[] = [\n ...(higherContext !== null\n ? [\n ...higherContext.menuItems,\n ...[\n higherContext.menuItems.length > 0 &&\n !isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) &&\n menuItems.length > 0 &&\n !isDivider(menuItems[0].label)\n ? {\n label: <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />,\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ];\n\n // Menu resources\n const divHandlderRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = useState<boolean>(false);\n const [mouseOverMenu, setMouseOverMenu] = useState<boolean>(false);\n\n // Holder position - measured in an effect to avoid reading refs during render\n const [divHandlerPos, setDivHandlerPos] = useState<DOMRect | null>(null);\n\n useLayoutEffect(() => {\n function updatePos() {\n if (divHandlderRef.current) {\n setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());\n }\n }\n\n // When the handler is hovered or the menu is mounted, ensure we have a fresh position\n if (mouseOverHandlerDiv || menuInDom) {\n updatePos();\n }\n\n // Attach listeners while the menu/low-menu may be visible so the position stays correct\n if (mouseOverHandlerDiv || menuInDom) {\n window.addEventListener(\"resize\", updatePos);\n // listen on capture to catch scrolls from ancestor elements as well\n window.addEventListener(\"scroll\", updatePos, true);\n\n let ro: ResizeObserver | null = null;\n if (typeof ResizeObserver !== \"undefined\" && divHandlderRef.current) {\n ro = new ResizeObserver(() => updatePos());\n ro.observe(divHandlderRef.current);\n }\n\n return () => {\n window.removeEventListener(\"resize\", updatePos);\n window.removeEventListener(\"scroll\", updatePos, true);\n if (ro) ro.disconnect();\n };\n }\n }, [mouseOverHandlerDiv, menuInDom]);\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n };\n }, [handleClick, menuVisible]);\n\n const removeController = useRef<AbortController>(new AbortController());\n useEffect(() => {\n if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setTimeout(() => {\n if (!removeController.current.signal.aborted) setMenuInDom(false);\n }, 300);\n }\n }, [mouseOverHandlerDiv, menuVisible, mouseOverMenu]);\n\n return (\n <ContentMenuHandlerContext.Provider\n value={{\n menuItems: thisMenuItems,\n }}\n >\n <div\n ref={divHandlderRef}\n {...rest}\n className={[styles.contextMenuHandler, rest.className].join(\" \")}\n onContextMenu={async (e) => {\n if (!showLowMenu) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n removeController.current.abort();\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n }\n }}\n onMouseEnter={async (e) => {\n if (showLowMenu) {\n setMenuInDom(true);\n setMouseOverHandlerDiv(false);\n setTimeout(() => {\n removeController.current.abort();\n setMouseOverHandlerDiv(true);\n }, 1);\n }\n rest.onMouseEnter?.(e);\n }}\n onMouseLeave={async (e) => {\n if (showLowMenu) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverHandlerDiv(false);\n }\n rest.onMouseLeave?.(e);\n }}\n >\n {children}\n </div>\n {menuInDom &&\n divHandlerPos &&\n createPortal(\n <div\n className={styles.anchor}\n onMouseEnter={() => {\n removeController.current.abort();\n setMouseOverMenu(true);\n }}\n onMouseLeave={() => {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverMenu(false);\n }}\n >\n {showLowMenu ? (\n <LowMenu\n visible={mouseOverHandlerDiv}\n entries={menuItems}\n xPos={divHandlerPos.left}\n yPos={divHandlerPos.bottom}\n maxWidth={divHandlerPos.width}\n />\n ) : (\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={thisMenuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMouseOverMenu(false);\n }}\n />\n )}\n </div>,\n document.body,\n )}\n </ContentMenuHandlerContext.Provider>\n );\n};\n\nContextMenuHandler.displayName = \"ContextMenuHandler\";\n","import styles from \"./LowMenu.module.css\";\nimport { LowMenuButton } from \"./LowMenuButton\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: IMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({\n entries,\n visible,\n xPos,\n yPos,\n maxWidth,\n}: LowMenuProps): React.ReactElement => {\n // Only show the low menu if it is on the screen\n if (xPos >= window.innerWidth || yPos >= window.innerHeight) return <></>;\n // Show the menu\n return (\n <div\n className={[styles.lowMenu, visible ? styles.visible : styles.hidden].join(\" \")}\n aria-label=\"Low context menu\"\n style={{\n left: `${xPos}px`,\n top: `${yPos}px`,\n maxWidth: `calc(${maxWidth}px)`,\n width: `calc(${maxWidth}px - 4px)`,\n }}\n >\n <div className={styles.lowMenuButtonHolder}>\n {entries.map((e, i) => (\n <LowMenuButton\n key={i}\n entry={e}\n />\n ))}\n </div>\n </div>\n );\n};\n\nLowMenu.displayName = \"LowMenu\";\n",".lowMenu {\n z-index: 2;\n position: absolute;\n margin: 0px;\n transition: opacity 0.3s linear;\n}\n\n.lowMenuButtonHolder {\n border: 2px solid rgb(17, 20, 24);\n border-top-right-radius: 4px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background-color: rgb(17, 20, 24);\n box-shadow: 2px 2px 2px rgb(64, 64, 64, 0.5);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n gap: 2px;\n row-gap: 2px;\n width: fit-content;\n}\n\n.lowMenu.hidden {\n opacity: 0;\n}\n\n.lowMenu.visible,\n.lowMenu:hover {\n opacity: 1;\n}\n\n.lowMenuItem {\n background-color: rgb(251, 253, 246);\n border: 0;\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.lowMenuItem.disabled {\n background-color: rgba(200, 200, 200);\n cursor: not-allowed;\n}\n\n.lowMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.lowMenu-item .caretHolder {\n align-self: flex-end;\n}\n\n.lowMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n","import { useState } from \"react\";\nimport styles from \"./LowMenu.module.css\";\nimport { LowSubMenu } from \"./LowSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: IMenuItem;\n}\nexport const LowMenuButton = ({ entry }: LowMenuButtonProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.lowMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n aria-label={typeof entry.label === \"string\" ? entry.label : undefined}\n aria-disabled={entry.disabled}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) entry.action?.(target);\n }}\n >\n <span>{entry.label}</span>\n {entry.group && <LowSubMenu entry={entry} />}\n </div>\n );\n};\n\nLowMenuButton.displayName = \"LowMenuButton\";\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./LowMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: IMenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import {\n forwardRef,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n useTransition,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\nexport interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\nexport interface ContextWindowHandle {\n pushToTop: () => void;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = forwardRef<ContextWindowHandle, ContextWindowProps>(\n (\n {\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n },\n ref,\n ): React.ReactElement => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Track internal state: whether window is in DOM and whether it's been positioned\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [, startTransition] = useTransition();\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = useCallback((x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n }, [move]);\n\n const mouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n },\n [move],\n );\n\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n }\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n },\n [checkPosition],\n );\n\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n }, [mouseMove, mouseUp]);\n\n // Helper function to push this window to the top\n const pushToTop = useCallback(() => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n }, [minZIndex]);\n\n // Expose pushToTop method via ref\n useImperativeHandle(\n ref,\n () => ({\n pushToTop,\n }),\n [pushToTop],\n );\n\n // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings\n // This effect derives state from props, which is acceptable when there's no synchronous setState\n useEffect(() => {\n if (visible && !windowInDOM) {\n // Window should be in DOM when visible becomes true\n startTransition(() => {\n setWindowInDOM(true);\n });\n } else if (!visible && windowInDOM) {\n // Window should leave DOM when visible becomes false\n startTransition(() => {\n setWindowInDOM(false);\n setWindowVisible(false);\n });\n }\n }, [visible, windowInDOM, startTransition]);\n\n // Position and show window after it's added to DOM\n useEffect(() => {\n if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {\n // Position the window\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n checkPosition();\n\n // Update z-index and make visible - use startTransition\n const maxZ = getMaxZIndex(minZIndex);\n onOpen?.();\n startTransition(() => {\n setZIndex(maxZ + 1);\n setWindowVisible(true);\n });\n }\n }, [windowInDOM, windowVisible, visible, checkPosition, minZIndex, onOpen, startTransition]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n }\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (\n e.target &&\n (e.target instanceof HTMLElement || e.target instanceof SVGElement)\n )\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUp);\n document.addEventListener(\"mousemove\", mouseMove);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n },\n);\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement | null>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/context-menu.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
1
|
+
import React, { ReactNode, RefAttributes, ForwardRefExoticComponent } from "react";
|
|
2
2
|
interface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
hide?: boolean;
|
|
@@ -51,9 +51,9 @@ interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
51
51
|
children: React.ReactNode;
|
|
52
52
|
minZIndex?: number;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
interface ContextWindowHandle {
|
|
55
|
+
pushToTop: () => void;
|
|
56
|
+
}
|
|
57
|
+
export const ContextWindow: ForwardRefExoticComponent<ContextWindowProps & RefAttributes<ContextWindowHandle>>;
|
|
58
58
|
|
|
59
59
|
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AAGA,yBAA0B,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACpE,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,2BAA2B,EACzB,QAAQ,EACR,IAAY,EACZ,QAAc,EACd,GAAG,IAAI,EACR,EAAE,eAAe,GAAG,MAAM,YAAY,CA4HtC;AAjID,MAAM,mBAAU,UAAU;;;ACX1B;IACE,KAAK,EAAE,MAAM,GAAG,MAAM,YAAY,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,C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/src/components/ContextMenuEntry.tsx","src/src/components/ContextMenu.tsx","src/src/components/ClickForMenu.tsx","src/src/components/LowSubMenu.tsx","src/src/components/LowMenuButton.tsx","src/src/components/LowMenu.tsx","src/src/components/ContextMenuHandler.tsx","src/src/functions/chkPosition.ts","src/src/components/ContextWindow.tsx","src/src/components/index.ts","src/src/main.ts","src/main.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import \"../global.d.ts\";\nexport * from \"./components\";\n"],"names":[],"version":3,"file":"context-menu.d.ts.map"}
|
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import {_ as $duWW8$_} from "@swc/helpers/_/_object_spread";
|
|
|
3
3
|
import {_ as $duWW8$_1} from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import {_ as $duWW8$_2} from "@swc/helpers/_/_object_without_properties";
|
|
5
5
|
import {jsx as $duWW8$jsx, jsxs as $duWW8$jsxs, Fragment as $duWW8$Fragment} from "react/jsx-runtime";
|
|
6
|
-
import {useRef as $duWW8$useRef, useState as $duWW8$useState, useEffectEvent as $duWW8$useEffectEvent, useLayoutEffect as $duWW8$useLayoutEffect, useEffect as $duWW8$useEffect, forwardRef as $duWW8$forwardRef, createContext as $duWW8$createContext, useContext as $duWW8$useContext, useCallback as $duWW8$useCallback, useTransition as $duWW8$useTransition} from "react";
|
|
6
|
+
import {useRef as $duWW8$useRef, useState as $duWW8$useState, useEffectEvent as $duWW8$useEffectEvent, useLayoutEffect as $duWW8$useLayoutEffect, useEffect as $duWW8$useEffect, forwardRef as $duWW8$forwardRef, createContext as $duWW8$createContext, useContext as $duWW8$useContext, useCallback as $duWW8$useCallback, useTransition as $duWW8$useTransition, useImperativeHandle as $duWW8$useImperativeHandle} from "react";
|
|
7
7
|
import {createPortal as $duWW8$createPortal} from "react-dom";
|
|
8
8
|
|
|
9
9
|
|
|
@@ -398,6 +398,7 @@ const $c3e82278b501f10c$export$d4ebdd58e04c6ace = (_param)=>{
|
|
|
398
398
|
yPos: menuYPos,
|
|
399
399
|
toClose: ()=>{
|
|
400
400
|
setMenuVisible(false);
|
|
401
|
+
setMenuInDom(false);
|
|
401
402
|
}
|
|
402
403
|
})
|
|
403
404
|
}), document.body)
|
|
@@ -804,7 +805,7 @@ const $b5e8657823def5be$var$getMaxZIndex = (componentMinZIndex)=>{
|
|
|
804
805
|
});
|
|
805
806
|
return maxZIndex;
|
|
806
807
|
};
|
|
807
|
-
const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
|
|
808
|
+
const $b5e8657823def5be$export$1af8984c69ba1b24 = /*#__PURE__*/ (0, $duWW8$forwardRef)((_param, ref)=>{
|
|
808
809
|
var { id: id, visible: visible, title: title, titleElement: titleElement, children: children, onOpen: onOpen, onClose: onClose, minZIndex: minZIndex = $b5e8657823def5be$export$4f9fb66ac71c7da5 } = _param, rest = (0, $duWW8$_2)(_param, [
|
|
809
810
|
"id",
|
|
810
811
|
"visible",
|
|
@@ -830,7 +831,7 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
830
831
|
y: 0
|
|
831
832
|
});
|
|
832
833
|
const [moving, setMoving] = (0, $duWW8$useState)(false);
|
|
833
|
-
const move = (x, y)=>{
|
|
834
|
+
const move = (0, $duWW8$useCallback)((x, y)=>{
|
|
834
835
|
if (windowRef.current && windowPos.current) {
|
|
835
836
|
const window1 = windowRef.current;
|
|
836
837
|
const pos = windowPos.current;
|
|
@@ -838,43 +839,57 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
838
839
|
pos.y += y;
|
|
839
840
|
window1.style.transform = `translate(${pos.x}px, ${pos.y}px)`;
|
|
840
841
|
}
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
const checkPosition = ()=>{
|
|
842
|
+
}, []);
|
|
843
|
+
const checkPosition = (0, $duWW8$useCallback)(()=>{
|
|
844
844
|
const chkPos = (0, $ab4d5d6bf03370d0$export$d81cfea7c54be196)(windowRef);
|
|
845
845
|
move(chkPos.translateX, chkPos.translateY);
|
|
846
|
-
}
|
|
847
|
-
|
|
846
|
+
}, [
|
|
847
|
+
move
|
|
848
|
+
]);
|
|
849
|
+
const mouseMove = (0, $duWW8$useCallback)((e)=>{
|
|
848
850
|
e.preventDefault();
|
|
849
851
|
e.stopPropagation();
|
|
850
852
|
move(e.movementX, e.movementY);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
+
}, [
|
|
854
|
+
move
|
|
855
|
+
]);
|
|
853
856
|
const mouseMoveRef = (0, $duWW8$useRef)(mouseMove);
|
|
854
857
|
const mouseUpRef = (0, $duWW8$useRef)(()=>{});
|
|
855
|
-
const mouseUp = (e)=>{
|
|
858
|
+
const mouseUp = (0, $duWW8$useCallback)((e)=>{
|
|
856
859
|
e.preventDefault();
|
|
857
860
|
e.stopPropagation();
|
|
858
861
|
setMoving(false);
|
|
859
862
|
checkPosition();
|
|
860
|
-
document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
861
|
-
document.removeEventListener("mouseup", mouseUpRef.current);
|
|
863
|
+
if (mouseMoveRef.current) document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
864
|
+
if (mouseUpRef.current) document.removeEventListener("mouseup", mouseUpRef.current);
|
|
862
865
|
if (resizeListenerRef.current) {
|
|
863
866
|
window.removeEventListener("resize", resizeListenerRef.current);
|
|
864
867
|
resizeListenerRef.current = null;
|
|
865
868
|
}
|
|
866
869
|
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "auto";
|
|
867
|
-
}
|
|
868
|
-
|
|
870
|
+
}, [
|
|
871
|
+
checkPosition
|
|
872
|
+
]);
|
|
869
873
|
(0, $duWW8$useEffect)(()=>{
|
|
870
874
|
mouseMoveRef.current = mouseMove;
|
|
871
875
|
mouseUpRef.current = mouseUp;
|
|
872
|
-
}
|
|
876
|
+
}, [
|
|
877
|
+
mouseMove,
|
|
878
|
+
mouseUp
|
|
879
|
+
]);
|
|
873
880
|
// Helper function to push this window to the top
|
|
874
|
-
const pushToTop = ()=>{
|
|
881
|
+
const pushToTop = (0, $duWW8$useCallback)(()=>{
|
|
875
882
|
const maxZIndex = $b5e8657823def5be$var$getMaxZIndex(minZIndex);
|
|
876
883
|
setZIndex(maxZIndex + 1);
|
|
877
|
-
}
|
|
884
|
+
}, [
|
|
885
|
+
minZIndex
|
|
886
|
+
]);
|
|
887
|
+
// Expose pushToTop method via ref
|
|
888
|
+
(0, $duWW8$useImperativeHandle)(ref, ()=>({
|
|
889
|
+
pushToTop: pushToTop
|
|
890
|
+
}), [
|
|
891
|
+
pushToTop
|
|
892
|
+
]);
|
|
878
893
|
// Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings
|
|
879
894
|
// This effect derives state from props, which is acceptable when there's no synchronous setState
|
|
880
895
|
(0, $duWW8$useEffect)(()=>{
|
|
@@ -928,8 +943,8 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
928
943
|
(0, $duWW8$useEffect)(()=>{
|
|
929
944
|
return ()=>{
|
|
930
945
|
// Clean up event listeners if component unmounts while dragging
|
|
931
|
-
document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
932
|
-
document.removeEventListener("mouseup", mouseUpRef.current);
|
|
946
|
+
if (mouseMoveRef.current) document.removeEventListener("mousemove", mouseMoveRef.current);
|
|
947
|
+
if (mouseUpRef.current) document.removeEventListener("mouseup", mouseUpRef.current);
|
|
933
948
|
if (resizeListenerRef.current) {
|
|
934
949
|
window.removeEventListener("resize", resizeListenerRef.current);
|
|
935
950
|
resizeListenerRef.current = null;
|
|
@@ -972,8 +987,8 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
972
987
|
if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "none";
|
|
973
988
|
setMoving(true);
|
|
974
989
|
pushToTop();
|
|
975
|
-
document.addEventListener("mouseup",
|
|
976
|
-
document.addEventListener("mousemove",
|
|
990
|
+
document.addEventListener("mouseup", mouseUp);
|
|
991
|
+
document.addEventListener("mousemove", mouseMove);
|
|
977
992
|
const resizeListener = ()=>checkPosition();
|
|
978
993
|
resizeListenerRef.current = resizeListener;
|
|
979
994
|
window.addEventListener("resize", resizeListener);
|
|
@@ -1012,7 +1027,7 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
|
|
|
1012
1027
|
]
|
|
1013
1028
|
})), document.body)
|
|
1014
1029
|
});
|
|
1015
|
-
};
|
|
1030
|
+
});
|
|
1016
1031
|
$b5e8657823def5be$export$1af8984c69ba1b24.displayName = "ContextWindow";
|
|
1017
1032
|
|
|
1018
1033
|
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KAEK,GALS,QAItB,sBAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,aAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,aAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,eAAO,EAAiB;IACpD,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,CAAA,GAAA,eAAO,EAAkB,CAAC,OAAO,SAAS;IAEtF,MAAM,SAAS,CAAA,GAAA,aAAK,EAAiB;IACrC,MAAM,aAAa,CAAA,GAAA,aAAK,EAAiB;IAEzC,MAAM,iBACJ,mBAAmB,YAAY,CAAC,WAAW,OAAO;IAEpD,MAAM,kBAAkB,CAAA,GAAA,qBAAa,EAAE,CAAC;QACtC,UAAU;IACZ;IAEA,MAAM,sBAAsB,CAAA,GAAA,qBAAa,EAAE;QACzC,mCAAmC;QACnC,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GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport styles from \"./AutoHeight.module.css\";\n\ninterface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n hide?: boolean;\n duration?: number; // transition duration in ms\n}\n\ntype AnimationState = \"closed\" | \"opening\" | \"open\" | \"closing\";\n\nexport function AutoHeight({\n children,\n hide = false,\n duration = 300,\n ...rest\n}: AutoHeightProps): React.ReactElement {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const [animationState, setAnimationState] = useState<AnimationState>(!hide ? \"open\" : \"closed\");\n\n const rafRef = useRef<number | null>(null);\n const timeoutRef = useRef<number | null>(null);\n\n const targetChildren: React.ReactNode =\n animationState === \"closed\" || !children ? null : children;\n\n const setTargetHeight = useEffectEvent((newHeight: number) => {\n setHeight(newHeight);\n });\n\n const transitionToOpening = useEffectEvent((): void => {\n // Cancel any pending close timeout\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n setAnimationState(\"opening\");\n\n const id = window.requestAnimationFrame(() => {\n rafRef.current = null;\n setTargetHeight(1);\n\n const frameId = window.requestAnimationFrame(() => {\n const inner = innerRef.current;\n if (inner) {\n setTargetHeight(inner.offsetHeight);\n setAnimationState(\"open\");\n }\n });\n rafRef.current = frameId;\n });\n rafRef.current = id;\n });\n\n const transitionToClosing = useEffectEvent((): void => {\n // Cancel any pending RAF\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n setAnimationState(\"closing\");\n setTargetHeight(1);\n\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = null;\n setAnimationState(\"closed\");\n }, duration);\n });\n\n useLayoutEffect(() => {\n if (!hide) {\n // Want to show: transition to open\n if (animationState === \"closed\" || animationState === \"closing\") {\n transitionToOpening();\n }\n // If already opening or open, stay in that state\n } else {\n // Want to hide: transition to closed\n if (animationState === \"open\" || animationState === \"opening\") {\n transitionToClosing();\n }\n }\n }, [hide, animationState]);\n\n // Setup ResizeObserver to track content size changes\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n if (animationState === \"open\") {\n setTargetHeight(transition!.offsetHeight);\n }\n });\n\n observer.observe(transition!);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [animationState]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\n display: animationState === \"closed\" ? \"none\" : undefined,\n height: height ? `${height}px` : \"auto\",\n transitionDuration: `${duration}ms`,\n }}\n >\n <div\n className={styles.autoHeightInner}\n ref={innerRef}\n >\n {targetChildren}\n </div>\n </div>\n );\n}\n\nAutoHeight.displayName = \"AutoHeight\";\n",".autoHeightWrapper {\n overflow: hidden;\n transition-timing-function: height ease-in-out width ease-in-out background-color ease-in-out;\n box-sizing: border-box;\n position: relative;\n}\n\n.autoHeightInner {\n height: fit-content;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: IMenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): React.ReactElement => {\n // Menu state\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n\n // Set up outsideClick handler\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n // Handle click off the menu\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const handleClick = (e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuInDom(false);\n }\n };\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import React, { forwardRef, useLayoutEffect, useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { IMenuItem } from \"./interface\";\n\n// Constants for menu size estimation when ref is not yet available\nconst ESTIMATED_MENU_ITEM_HEIGHT = 34;\nconst ESTIMATED_MENU_PADDING = 4;\nconst ESTIMATED_MENU_WIDTH = 200;\n\nexport interface ContextMenuProps {\n visible: boolean;\n entries: IMenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): React.ReactElement => {\n // Measure menu size after mount/render to avoid accessing refs during render\n const [menuHeight, setMenuHeight] = useState(\n entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING,\n );\n const [menuWidth, setMenuWidth] = useState(ESTIMATED_MENU_WIDTH);\n\n useLayoutEffect(() => {\n // Only measure when visible; ref access inside effect is allowed\n if (visible && ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n setMenuHeight(ref.current.offsetHeight);\n setMenuWidth(ref.current.offsetWidth);\n }\n // When not visible, fall back to estimates\n if (!visible) {\n setMenuHeight(entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING);\n setMenuWidth(ESTIMATED_MENU_WIDTH);\n }\n }, [visible, entries, ref]);\n\n const adjustedYPos =\n yPos + menuHeight > window.innerHeight\n ? Math.max(window.innerHeight - menuHeight - ESTIMATED_MENU_PADDING, 0)\n : yPos;\n const adjustedXPos =\n xPos + menuWidth > window.innerWidth\n ? Math.max(window.innerWidth - menuWidth - ESTIMATED_MENU_PADDING, 0)\n : xPos;\n\n return (\n <div\n ref={ref}\n className={[styles.contextMenu, visible ? styles.visible : styles.hidden]\n .filter((c) => c !== \"\")\n .join(\" \")}\n style={{\n top: `${adjustedYPos}px`,\n left: `${adjustedXPos}px`,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {entries.map((entry, i) => (\n <ContextMenuEntry\n key={i}\n entry={entry}\n toClose={toClose}\n />\n ))}\n </div>\n );\n },\n);\n\nContextMenu.displayName = \"ContextMenu\";\n",".anchor {\n position: absolute;\n top: 0;\n left: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n font-size: 9pt;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.contextMenuHandler {\n height: fit-content;\n width: fit-content;\n}\n\n.contextMenu {\n position: absolute;\n border: 1px solid;\n border-color: rgb(17, 20, 24);\n opacity: 1;\n background-color: rgb(251, 253, 246);\n z-index: 10000;\n box-shadow: 4px 4px 4px rgb(64, 64, 64, 0.75);\n transition: opacity 0.3s linear;\n}\n\n.contextMenu.hidden {\n opacity: 0;\n}\n\n.contextMenu.visible {\n opacity: 1;\n}\n\n.contextMenuItem {\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n min-width: 80px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.contextMenuItem.disabled {\n background-color: rgba(0, 0, 0, 0.2);\n cursor: not-allowed;\n}\n\n.contextMenuItem:first-child {\n padding-top: 4px;\n}\n\n.contextMenuItem:last-child {\n padding-bottom: 4px;\n}\n\n.contextMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.contextMenuItem .caretHolder {\n align-self: flex-end;\n}\n\n.contextMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n\n.contextMenuItemLabel {\n flex-grow: 1;\n height: 19px;\n}\n","import { useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: IMenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: IMenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { LowMenu } from \"./LowMenu\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: IMenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: IMenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | React.ReactElement): boolean {\n return typeof label !== \"string\" && label.type === \"hr\";\n}\n\nexport const ContextMenuHandler = ({\n children,\n menuItems,\n showLowMenu = false,\n ...rest\n}: ContextMenuHandlerProps): React.ReactElement => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems: IMenuItem[] = [\n ...(higherContext !== null\n ? [\n ...higherContext.menuItems,\n ...[\n higherContext.menuItems.length > 0 &&\n !isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) &&\n menuItems.length > 0 &&\n !isDivider(menuItems[0].label)\n ? {\n label: <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />,\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ];\n\n // Menu resources\n const divHandlderRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = useState<boolean>(false);\n const [mouseOverMenu, setMouseOverMenu] = useState<boolean>(false);\n\n // Holder position - measured in an effect to avoid reading refs during render\n const [divHandlerPos, setDivHandlerPos] = useState<DOMRect | null>(null);\n\n useLayoutEffect(() => {\n function updatePos() {\n if (divHandlderRef.current) {\n setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());\n }\n }\n\n // When the handler is hovered or the menu is mounted, ensure we have a fresh position\n if (mouseOverHandlerDiv || menuInDom) {\n updatePos();\n }\n\n // Attach listeners while the menu/low-menu may be visible so the position stays correct\n if (mouseOverHandlerDiv || menuInDom) {\n window.addEventListener(\"resize\", updatePos);\n // listen on capture to catch scrolls from ancestor elements as well\n window.addEventListener(\"scroll\", updatePos, true);\n\n let ro: ResizeObserver | null = null;\n if (typeof ResizeObserver !== \"undefined\" && divHandlderRef.current) {\n ro = new ResizeObserver(() => updatePos());\n ro.observe(divHandlderRef.current);\n }\n\n return () => {\n window.removeEventListener(\"resize\", updatePos);\n window.removeEventListener(\"scroll\", updatePos, true);\n if (ro) ro.disconnect();\n };\n }\n }, [mouseOverHandlerDiv, menuInDom]);\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n };\n }, [handleClick, menuVisible]);\n\n const removeController = useRef<AbortController>(new AbortController());\n useEffect(() => {\n if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setTimeout(() => {\n if (!removeController.current.signal.aborted) setMenuInDom(false);\n }, 300);\n }\n }, [mouseOverHandlerDiv, menuVisible, mouseOverMenu]);\n\n return (\n <ContentMenuHandlerContext.Provider\n value={{\n menuItems: thisMenuItems,\n }}\n >\n <div\n ref={divHandlderRef}\n {...rest}\n className={[styles.contextMenuHandler, rest.className].join(\" \")}\n onContextMenu={async (e) => {\n if (!showLowMenu) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n removeController.current.abort();\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n }\n }}\n onMouseEnter={async (e) => {\n if (showLowMenu) {\n setMenuInDom(true);\n setMouseOverHandlerDiv(false);\n setTimeout(() => {\n removeController.current.abort();\n setMouseOverHandlerDiv(true);\n }, 1);\n }\n rest.onMouseEnter?.(e);\n }}\n onMouseLeave={async (e) => {\n if (showLowMenu) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverHandlerDiv(false);\n }\n rest.onMouseLeave?.(e);\n }}\n >\n {children}\n </div>\n {menuInDom &&\n divHandlerPos &&\n createPortal(\n <div\n className={styles.anchor}\n onMouseEnter={() => {\n removeController.current.abort();\n setMouseOverMenu(true);\n }}\n onMouseLeave={() => {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverMenu(false);\n }}\n >\n {showLowMenu ? (\n <LowMenu\n visible={mouseOverHandlerDiv}\n entries={menuItems}\n xPos={divHandlerPos.left}\n yPos={divHandlerPos.bottom}\n maxWidth={divHandlerPos.width}\n />\n ) : (\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={thisMenuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMouseOverMenu(false);\n }}\n />\n )}\n </div>,\n document.body,\n )}\n </ContentMenuHandlerContext.Provider>\n );\n};\n\nContextMenuHandler.displayName = \"ContextMenuHandler\";\n","import styles from \"./LowMenu.module.css\";\nimport { LowMenuButton } from \"./LowMenuButton\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: IMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({\n entries,\n visible,\n xPos,\n yPos,\n maxWidth,\n}: LowMenuProps): React.ReactElement => {\n // Only show the low menu if it is on the screen\n if (xPos >= window.innerWidth || yPos >= window.innerHeight) return <></>;\n // Show the menu\n return (\n <div\n className={[styles.lowMenu, visible ? styles.visible : styles.hidden].join(\" \")}\n aria-label=\"Low context menu\"\n style={{\n left: `${xPos}px`,\n top: `${yPos}px`,\n maxWidth: `calc(${maxWidth}px)`,\n width: `calc(${maxWidth}px - 4px)`,\n }}\n >\n <div className={styles.lowMenuButtonHolder}>\n {entries.map((e, i) => (\n <LowMenuButton\n key={i}\n entry={e}\n />\n ))}\n </div>\n </div>\n );\n};\n\nLowMenu.displayName = \"LowMenu\";\n",".lowMenu {\n z-index: 2;\n position: absolute;\n margin: 0px;\n transition: opacity 0.3s linear;\n}\n\n.lowMenuButtonHolder {\n border: 2px solid rgb(17, 20, 24);\n border-top-right-radius: 4px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background-color: rgb(17, 20, 24);\n box-shadow: 2px 2px 2px rgb(64, 64, 64, 0.5);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n gap: 2px;\n row-gap: 2px;\n width: fit-content;\n}\n\n.lowMenu.hidden {\n opacity: 0;\n}\n\n.lowMenu.visible,\n.lowMenu:hover {\n opacity: 1;\n}\n\n.lowMenuItem {\n background-color: rgb(251, 253, 246);\n border: 0;\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.lowMenuItem.disabled {\n background-color: rgba(200, 200, 200);\n cursor: not-allowed;\n}\n\n.lowMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.lowMenu-item .caretHolder {\n align-self: flex-end;\n}\n\n.lowMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n","import { useState } from \"react\";\nimport styles from \"./LowMenu.module.css\";\nimport { LowSubMenu } from \"./LowSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: IMenuItem;\n}\nexport const LowMenuButton = ({ entry }: LowMenuButtonProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.lowMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n aria-label={typeof entry.label === \"string\" ? entry.label : undefined}\n aria-disabled={entry.disabled}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) entry.action?.(target);\n }}\n >\n <span>{entry.label}</span>\n {entry.group && <LowSubMenu entry={entry} />}\n </div>\n );\n};\n\nLowMenuButton.displayName = \"LowMenuButton\";\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./LowMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: IMenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import { ReactNode, useEffect, useRef, useState, useTransition } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\nexport interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = ({\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n}: ContextWindowProps): React.ReactElement => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Track internal state: whether window is in DOM and whether it's been positioned\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [, startTransition] = useTransition();\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = (x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const checkPosition = () => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n };\n\n const mouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n };\n\n // Store stable references to mouseMove and mouseUp for cleanup\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n };\n\n // Update refs when callbacks change\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n });\n\n // Helper function to push this window to the top\n const pushToTop = () => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n };\n\n // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings\n // This effect derives state from props, which is acceptable when there's no synchronous setState\n useEffect(() => {\n if (visible && !windowInDOM) {\n // Window should be in DOM when visible becomes true\n startTransition(() => {\n setWindowInDOM(true);\n });\n } else if (!visible && windowInDOM) {\n // Window should leave DOM when visible becomes false\n startTransition(() => {\n setWindowInDOM(false);\n setWindowVisible(false);\n });\n }\n }, [visible, windowInDOM, startTransition]);\n\n // Position and show window after it's added to DOM\n useEffect(() => {\n if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {\n // Position the window\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n checkPosition();\n\n // Update z-index and make visible - use startTransition\n const maxZ = getMaxZIndex(minZIndex);\n onOpen?.();\n startTransition(() => {\n setZIndex(maxZ + 1);\n setWindowVisible(true);\n });\n }\n }, [windowInDOM, windowVisible, visible, checkPosition, minZIndex, onOpen, startTransition]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUpRef.current);\n document.addEventListener(\"mousemove\", mouseMoveRef.current);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement | null>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KAEK,GALS,QAItB,sBAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,aAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,aAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ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,YAAY,eAAe,EAAE,MAAM,YAAY,UAAS,GAEjE,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG;wBAC9B,UAAU;wBACV;wBACA,SAAS,gBAAgB,CAAC,WAAW;wBACrC,SAAS,gBAAgB,CAAC,aAAa;wBACvC,MAAM,iBAAiB,IAAM;wBAC7B,kBAAkB,OAAO,GAAG;wBAC5B,OAAO,gBAAgB,CAAC,UAAU;oBACpC;;sCAEA,gBAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,sBAAsB;4BACxC,OAAO;sCAEN,eAAe,eAAe;;sCAEjC,gBAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gBAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gBAAC;oCAAK,GAAE;;;;;;8BAId,gBAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gBAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAGF,0CAAc,WAAW,GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport styles from \"./AutoHeight.module.css\";\n\ninterface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n hide?: boolean;\n duration?: number; // transition duration in ms\n}\n\ntype AnimationState = \"closed\" | \"opening\" | \"open\" | \"closing\";\n\nexport function AutoHeight({\n children,\n hide = false,\n duration = 300,\n ...rest\n}: AutoHeightProps): React.ReactElement {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const [animationState, setAnimationState] = useState<AnimationState>(!hide ? \"open\" : \"closed\");\n\n const rafRef = useRef<number | null>(null);\n const timeoutRef = useRef<number | null>(null);\n\n const targetChildren: React.ReactNode =\n animationState === \"closed\" || !children ? null : children;\n\n const setTargetHeight = useEffectEvent((newHeight: number) => {\n setHeight(newHeight);\n });\n\n const transitionToOpening = useEffectEvent((): void => {\n // Cancel any pending close timeout\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n setAnimationState(\"opening\");\n\n const id = window.requestAnimationFrame(() => {\n rafRef.current = null;\n setTargetHeight(1);\n\n const frameId = window.requestAnimationFrame(() => {\n const inner = innerRef.current;\n if (inner) {\n setTargetHeight(inner.offsetHeight);\n setAnimationState(\"open\");\n }\n });\n rafRef.current = frameId;\n });\n rafRef.current = id;\n });\n\n const transitionToClosing = useEffectEvent((): void => {\n // Cancel any pending RAF\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n setAnimationState(\"closing\");\n setTargetHeight(1);\n\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = null;\n setAnimationState(\"closed\");\n }, duration);\n });\n\n useLayoutEffect(() => {\n if (!hide) {\n // Want to show: transition to open\n if (animationState === \"closed\" || animationState === \"closing\") {\n transitionToOpening();\n }\n // If already opening or open, stay in that state\n } else {\n // Want to hide: transition to closed\n if (animationState === \"open\" || animationState === \"opening\") {\n transitionToClosing();\n }\n }\n }, [hide, animationState]);\n\n // Setup ResizeObserver to track content size changes\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n if (animationState === \"open\") {\n setTargetHeight(transition!.offsetHeight);\n }\n });\n\n observer.observe(transition!);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [animationState]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\n display: animationState === \"closed\" ? \"none\" : undefined,\n height: height ? `${height}px` : \"auto\",\n transitionDuration: `${duration}ms`,\n }}\n >\n <div\n className={styles.autoHeightInner}\n ref={innerRef}\n >\n {targetChildren}\n </div>\n </div>\n );\n}\n\nAutoHeight.displayName = \"AutoHeight\";\n",".autoHeightWrapper {\n overflow: hidden;\n transition-timing-function: height ease-in-out width ease-in-out background-color ease-in-out;\n box-sizing: border-box;\n position: relative;\n}\n\n.autoHeightInner {\n height: fit-content;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: IMenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): React.ReactElement => {\n // Menu state\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n\n // Set up outsideClick handler\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n // Handle click off the menu\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const handleClick = (e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuInDom(false);\n }\n };\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMenuInDom(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import React, { forwardRef, useLayoutEffect, useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { IMenuItem } from \"./interface\";\n\n// Constants for menu size estimation when ref is not yet available\nconst ESTIMATED_MENU_ITEM_HEIGHT = 34;\nconst ESTIMATED_MENU_PADDING = 4;\nconst ESTIMATED_MENU_WIDTH = 200;\n\nexport interface ContextMenuProps {\n visible: boolean;\n entries: IMenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): React.ReactElement => {\n // Measure menu size after mount/render to avoid accessing refs during render\n const [menuHeight, setMenuHeight] = useState(\n entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING,\n );\n const [menuWidth, setMenuWidth] = useState(ESTIMATED_MENU_WIDTH);\n\n useLayoutEffect(() => {\n // Only measure when visible; ref access inside effect is allowed\n if (visible && ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n setMenuHeight(ref.current.offsetHeight);\n setMenuWidth(ref.current.offsetWidth);\n }\n // When not visible, fall back to estimates\n if (!visible) {\n setMenuHeight(entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING);\n setMenuWidth(ESTIMATED_MENU_WIDTH);\n }\n }, [visible, entries, ref]);\n\n const adjustedYPos =\n yPos + menuHeight > window.innerHeight\n ? Math.max(window.innerHeight - menuHeight - ESTIMATED_MENU_PADDING, 0)\n : yPos;\n const adjustedXPos =\n xPos + menuWidth > window.innerWidth\n ? Math.max(window.innerWidth - menuWidth - ESTIMATED_MENU_PADDING, 0)\n : xPos;\n\n return (\n <div\n ref={ref}\n className={[styles.contextMenu, visible ? styles.visible : styles.hidden]\n .filter((c) => c !== \"\")\n .join(\" \")}\n style={{\n top: `${adjustedYPos}px`,\n left: `${adjustedXPos}px`,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {entries.map((entry, i) => (\n <ContextMenuEntry\n key={i}\n entry={entry}\n toClose={toClose}\n />\n ))}\n </div>\n );\n },\n);\n\nContextMenu.displayName = \"ContextMenu\";\n",".anchor {\n position: absolute;\n top: 0;\n left: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n font-size: 9pt;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.contextMenuHandler {\n height: fit-content;\n width: fit-content;\n}\n\n.contextMenu {\n position: absolute;\n border: 1px solid;\n border-color: rgb(17, 20, 24);\n opacity: 1;\n background-color: rgb(251, 253, 246);\n z-index: 10000;\n box-shadow: 4px 4px 4px rgb(64, 64, 64, 0.75);\n transition: opacity 0.3s linear;\n}\n\n.contextMenu.hidden {\n opacity: 0;\n}\n\n.contextMenu.visible {\n opacity: 1;\n}\n\n.contextMenuItem {\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n min-width: 80px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.contextMenuItem.disabled {\n background-color: rgba(0, 0, 0, 0.2);\n cursor: not-allowed;\n}\n\n.contextMenuItem:first-child {\n padding-top: 4px;\n}\n\n.contextMenuItem:last-child {\n padding-bottom: 4px;\n}\n\n.contextMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.contextMenuItem .caretHolder {\n align-self: flex-end;\n}\n\n.contextMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n\n.contextMenuItemLabel {\n flex-grow: 1;\n height: 19px;\n}\n","import { useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: IMenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: IMenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { LowMenu } from \"./LowMenu\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: IMenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: IMenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | React.ReactElement): boolean {\n return typeof label !== \"string\" && label.type === \"hr\";\n}\n\nexport const ContextMenuHandler = ({\n children,\n menuItems,\n showLowMenu = false,\n ...rest\n}: ContextMenuHandlerProps): React.ReactElement => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems: IMenuItem[] = [\n ...(higherContext !== null\n ? [\n ...higherContext.menuItems,\n ...[\n higherContext.menuItems.length > 0 &&\n !isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) &&\n menuItems.length > 0 &&\n !isDivider(menuItems[0].label)\n ? {\n label: <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />,\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ];\n\n // Menu resources\n const divHandlderRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = useState<boolean>(false);\n const [mouseOverMenu, setMouseOverMenu] = useState<boolean>(false);\n\n // Holder position - measured in an effect to avoid reading refs during render\n const [divHandlerPos, setDivHandlerPos] = useState<DOMRect | null>(null);\n\n useLayoutEffect(() => {\n function updatePos() {\n if (divHandlderRef.current) {\n setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());\n }\n }\n\n // When the handler is hovered or the menu is mounted, ensure we have a fresh position\n if (mouseOverHandlerDiv || menuInDom) {\n updatePos();\n }\n\n // Attach listeners while the menu/low-menu may be visible so the position stays correct\n if (mouseOverHandlerDiv || menuInDom) {\n window.addEventListener(\"resize\", updatePos);\n // listen on capture to catch scrolls from ancestor elements as well\n window.addEventListener(\"scroll\", updatePos, true);\n\n let ro: ResizeObserver | null = null;\n if (typeof ResizeObserver !== \"undefined\" && divHandlderRef.current) {\n ro = new ResizeObserver(() => updatePos());\n ro.observe(divHandlderRef.current);\n }\n\n return () => {\n window.removeEventListener(\"resize\", updatePos);\n window.removeEventListener(\"scroll\", updatePos, true);\n if (ro) ro.disconnect();\n };\n }\n }, [mouseOverHandlerDiv, menuInDom]);\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n };\n }, [handleClick, menuVisible]);\n\n const removeController = useRef<AbortController>(new AbortController());\n useEffect(() => {\n if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setTimeout(() => {\n if (!removeController.current.signal.aborted) setMenuInDom(false);\n }, 300);\n }\n }, [mouseOverHandlerDiv, menuVisible, mouseOverMenu]);\n\n return (\n <ContentMenuHandlerContext.Provider\n value={{\n menuItems: thisMenuItems,\n }}\n >\n <div\n ref={divHandlderRef}\n {...rest}\n className={[styles.contextMenuHandler, rest.className].join(\" \")}\n onContextMenu={async (e) => {\n if (!showLowMenu) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n removeController.current.abort();\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n }\n }}\n onMouseEnter={async (e) => {\n if (showLowMenu) {\n setMenuInDom(true);\n setMouseOverHandlerDiv(false);\n setTimeout(() => {\n removeController.current.abort();\n setMouseOverHandlerDiv(true);\n }, 1);\n }\n rest.onMouseEnter?.(e);\n }}\n onMouseLeave={async (e) => {\n if (showLowMenu) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverHandlerDiv(false);\n }\n rest.onMouseLeave?.(e);\n }}\n >\n {children}\n </div>\n {menuInDom &&\n divHandlerPos &&\n createPortal(\n <div\n className={styles.anchor}\n onMouseEnter={() => {\n removeController.current.abort();\n setMouseOverMenu(true);\n }}\n onMouseLeave={() => {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverMenu(false);\n }}\n >\n {showLowMenu ? (\n <LowMenu\n visible={mouseOverHandlerDiv}\n entries={menuItems}\n xPos={divHandlerPos.left}\n yPos={divHandlerPos.bottom}\n maxWidth={divHandlerPos.width}\n />\n ) : (\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={thisMenuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMouseOverMenu(false);\n }}\n />\n )}\n </div>,\n document.body,\n )}\n </ContentMenuHandlerContext.Provider>\n );\n};\n\nContextMenuHandler.displayName = \"ContextMenuHandler\";\n","import styles from \"./LowMenu.module.css\";\nimport { LowMenuButton } from \"./LowMenuButton\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: IMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({\n entries,\n visible,\n xPos,\n yPos,\n maxWidth,\n}: LowMenuProps): React.ReactElement => {\n // Only show the low menu if it is on the screen\n if (xPos >= window.innerWidth || yPos >= window.innerHeight) return <></>;\n // Show the menu\n return (\n <div\n className={[styles.lowMenu, visible ? styles.visible : styles.hidden].join(\" \")}\n aria-label=\"Low context menu\"\n style={{\n left: `${xPos}px`,\n top: `${yPos}px`,\n maxWidth: `calc(${maxWidth}px)`,\n width: `calc(${maxWidth}px - 4px)`,\n }}\n >\n <div className={styles.lowMenuButtonHolder}>\n {entries.map((e, i) => (\n <LowMenuButton\n key={i}\n entry={e}\n />\n ))}\n </div>\n </div>\n );\n};\n\nLowMenu.displayName = \"LowMenu\";\n",".lowMenu {\n z-index: 2;\n position: absolute;\n margin: 0px;\n transition: opacity 0.3s linear;\n}\n\n.lowMenuButtonHolder {\n border: 2px solid rgb(17, 20, 24);\n border-top-right-radius: 4px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background-color: rgb(17, 20, 24);\n box-shadow: 2px 2px 2px rgb(64, 64, 64, 0.5);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n gap: 2px;\n row-gap: 2px;\n width: fit-content;\n}\n\n.lowMenu.hidden {\n opacity: 0;\n}\n\n.lowMenu.visible,\n.lowMenu:hover {\n opacity: 1;\n}\n\n.lowMenuItem {\n background-color: rgb(251, 253, 246);\n border: 0;\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.lowMenuItem.disabled {\n background-color: rgba(200, 200, 200);\n cursor: not-allowed;\n}\n\n.lowMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.lowMenu-item .caretHolder {\n align-self: flex-end;\n}\n\n.lowMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n","import { useState } from \"react\";\nimport styles from \"./LowMenu.module.css\";\nimport { LowSubMenu } from \"./LowSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: IMenuItem;\n}\nexport const LowMenuButton = ({ entry }: LowMenuButtonProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.lowMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n aria-label={typeof entry.label === \"string\" ? entry.label : undefined}\n aria-disabled={entry.disabled}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) entry.action?.(target);\n }}\n >\n <span>{entry.label}</span>\n {entry.group && <LowSubMenu entry={entry} />}\n </div>\n );\n};\n\nLowMenuButton.displayName = \"LowMenuButton\";\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./LowMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: IMenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import {\n forwardRef,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n useTransition,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\nexport interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\nexport interface ContextWindowHandle {\n pushToTop: () => void;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = forwardRef<ContextWindowHandle, ContextWindowProps>(\n (\n {\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n },\n ref,\n ): React.ReactElement => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Track internal state: whether window is in DOM and whether it's been positioned\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [, startTransition] = useTransition();\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = useCallback((x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n }, [move]);\n\n const mouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n },\n [move],\n );\n\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n }\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n },\n [checkPosition],\n );\n\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n }, [mouseMove, mouseUp]);\n\n // Helper function to push this window to the top\n const pushToTop = useCallback(() => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n }, [minZIndex]);\n\n // Expose pushToTop method via ref\n useImperativeHandle(\n ref,\n () => ({\n pushToTop,\n }),\n [pushToTop],\n );\n\n // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings\n // This effect derives state from props, which is acceptable when there's no synchronous setState\n useEffect(() => {\n if (visible && !windowInDOM) {\n // Window should be in DOM when visible becomes true\n startTransition(() => {\n setWindowInDOM(true);\n });\n } else if (!visible && windowInDOM) {\n // Window should leave DOM when visible becomes false\n startTransition(() => {\n setWindowInDOM(false);\n setWindowVisible(false);\n });\n }\n }, [visible, windowInDOM, startTransition]);\n\n // Position and show window after it's added to DOM\n useEffect(() => {\n if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {\n // Position the window\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n checkPosition();\n\n // Update z-index and make visible - use startTransition\n const maxZ = getMaxZIndex(minZIndex);\n onOpen?.();\n startTransition(() => {\n setZIndex(maxZ + 1);\n setWindowVisible(true);\n });\n }\n }, [windowInDOM, windowVisible, visible, checkPosition, minZIndex, onOpen, startTransition]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n }\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (\n e.target &&\n (e.target instanceof HTMLElement || e.target instanceof SVGElement)\n )\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUp);\n document.addEventListener(\"mousemove\", mouseMove);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n },\n);\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement | null>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|