@asup/context-menu 2.2.2 → 2.2.3

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 CHANGED
@@ -831,12 +831,14 @@ const $847f433873d20215$export$f93615b9594453fc = ({ onMouseDown: onMouseDownCal
831
831
  if (e.type === "pointerdown") {
832
832
  activeInputRef.current = "pointer";
833
833
  document.addEventListener("pointermove", onMouseMove);
834
- document.addEventListener("pointerup", onMouseUp);
835
834
  } else {
836
835
  activeInputRef.current = "mouse";
837
836
  document.addEventListener("mousemove", onMouseMove);
838
- document.addEventListener("mouseup", onMouseUp);
839
837
  }
838
+ // Release events can arrive on either stream depending on the browser
839
+ // and the element the interaction finishes over.
840
+ document.addEventListener("mouseup", onMouseUp);
841
+ document.addEventListener("pointerup", onMouseUp);
840
842
  onMouseDownCallback?.(e);
841
843
  }, [
842
844
  onMouseDownCallback,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KACX,GAAG,MACa;IAChB,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,CAA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,SAAS,SAAS,MAAM,gBAAgB,IAAI;gBAC5C,YAAY,gBAAgB,YAAY;gBACxC,QAAQ;gBACR,WAAW,KAAK,KAAK,EAAE,aAAa;gBACpC,UAAU,KAAK,KAAK,EAAE,YAAY;gBAClC,WAAW,KAAK,KAAK,EAAE,aAAa;gBACpC,UAAU,KAAK,KAAK,EAAE,YAAY;YACpC;YACA,gBAAgB,CAAC;gBACf;gBACA,KAAK,cAAc,GAAG;YACxB;;8BAEA,iCAAC;oBACC,WAAW;wBAAC,CAAA,GAAA,gEAAK,EAAE,kBAAkB;wBAAE,SAAS,CAAA,GAAA,gEAAK,EAAE,MAAM,GAAG;qBAAG,CAChE,MAAM,CAAC,CAAC,IAAM,MAAM,IACpB,IAAI,CAAC;oBACR,aAAa;;sCAEb,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;;;;YAGV,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/functions/useMouseMove.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\nexport { useMouseMove } from \"./functions/useMouseMove\";\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 const [subMenuVisible, setSubMenuVisible] = useState<boolean>(false);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseEnter={\n entry.group\n ? () => {\n setSubMenuVisible(true);\n }\n : undefined\n }\n onMouseLeave={\n entry.group\n ? () => {\n setSubMenuVisible(false);\n }\n : undefined\n }\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 visible={subMenuVisible}\n />\n )}\n </div>\n );\n};\n","import { 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 visible: boolean;\n}\n\nexport const ContextSubMenu = ({\n entries,\n toClose,\n visible,\n}: ContextSubMenuProps): React.ReactElement => {\n return (\n <span className={styles.caretHolder}>\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 { useMouseMove } from \"../functions/useMouseMove\";\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\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) {\n windowPos.current.x += x;\n windowPos.current.y += y;\n windowRef.current.style.transform = `translate(${windowPos.current.x}px, ${windowPos.current.y}px)`;\n }\n }, []);\n\n const fitToViewport = useCallback(() => {\n if (!windowRef.current) {\n return;\n }\n\n const viewportPadding = 32;\n const availableWidth = Math.max(0, window.innerWidth - viewportPadding);\n const availableHeight = Math.max(0, window.innerHeight - viewportPadding);\n const rect = windowRef.current.getBoundingClientRect();\n const horizontalChrome = rect.width - windowRef.current.clientWidth;\n const verticalChrome = rect.height - windowRef.current.clientHeight;\n\n if (rect.width > availableWidth) {\n windowRef.current.style.width = `${Math.max(0, availableWidth - horizontalChrome)}px`;\n }\n\n if (rect.height > availableHeight) {\n windowRef.current.style.height = `${Math.max(0, availableHeight - verticalChrome)}px`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n fitToViewport();\n }, [fitToViewport, move]);\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 const parseTranslate = (transform?: string): { x: number; y: number } => {\n const match = transform?.match(/translate\\((-?\\d+(?:\\.\\d+)?)px,\\s*(-?\\d+(?:\\.\\d+)?)px\\)/);\n if (match) {\n return {\n x: Number.parseFloat(match[1]),\n y: Number.parseFloat(match[2]),\n };\n }\n /* v8 ignore next */\n return { x: 0, y: 0 };\n };\n\n const { onMouseDown, armInteractionEnd } = useMouseMove({\n onMouseDown: () => {\n windowPos.current = parseTranslate(windowRef.current?.style.transform);\n setMoving(true);\n pushToTop();\n },\n onMouseMove: (e: MouseEvent) => {\n move(e.movementX, e.movementY);\n },\n onMouseUp: () => {\n checkPosition();\n setMoving(false);\n },\n onInteractionEnd: () => {\n checkPosition();\n },\n interactionEndEnabled: windowVisible,\n onViewportResize: () => {\n checkPosition();\n },\n viewportResizeEnabled: windowVisible,\n });\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 const checkedPosition = chkPosition(windowRef);\n windowRef.current.style.transform = `translate(${checkedPosition.translateX}px, ${checkedPosition.translateY}px)`;\n if (windowPos && windowPos.current) {\n windowPos.current = {\n x: checkedPosition.translateX,\n y: checkedPosition.translateY,\n };\n }\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, minZIndex, onOpen, startTransition]);\n\n // When CSS resize handle is used, defer checkPosition until resize interaction ends.\n useEffect(() => {\n if (!windowVisible || !windowRef.current || typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const observer = new ResizeObserver(() => {\n armInteractionEnd();\n });\n\n observer.observe(windowRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [armInteractionEnd, windowVisible]);\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={onMouseDown}\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","import { type MouseEvent as ReactMouseEvent, useCallback, useEffect, useRef } from \"react\";\n\ninterface UseMouseMoveProps {\n onMouseDown?: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove?: (e: MouseEvent) => void;\n onMouseUp?: (e: MouseEvent) => void;\n onInteractionEnd?: (e: MouseEvent | PointerEvent) => void;\n interactionEndEnabled?: boolean;\n onViewportResize?: (e: UIEvent) => void;\n viewportResizeEnabled?: boolean;\n}\n\ninterface UseMouseMoveResult {\n onMouseDown: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove: (e: MouseEvent) => void;\n onMouseUp: (e: MouseEvent) => void;\n armInteractionEnd: () => void;\n}\n\nexport const useMouseMove = ({\n onMouseDown: onMouseDownCallback,\n onMouseMove: onMouseMoveCallback,\n onMouseUp: onMouseUpCallback,\n onInteractionEnd: onInteractionEndCallback,\n interactionEndEnabled = true,\n onViewportResize: onViewportResizeCallback,\n viewportResizeEnabled = true,\n}: UseMouseMoveProps): UseMouseMoveResult => {\n const mouseMoveRef = useRef<((e: MouseEvent) => void) | null>(null);\n const mouseUpRef = useRef<((e: MouseEvent) => void) | null>(null);\n const activeInputRef = useRef<\"mouse\" | \"pointer\" | null>(null);\n const mouseDownElementRef = useRef<HTMLElement | SVGElement | null>(null);\n const mouseDownUserSelectRef = useRef<string | null>(null);\n const interactionEndRef = useRef<((e: MouseEvent | PointerEvent) => void) | null>(null);\n const interactionEndCallbackRef = useRef(onInteractionEndCallback);\n const viewportResizeCallbackRef = useRef(onViewportResizeCallback);\n\n useEffect(() => {\n interactionEndCallbackRef.current = onInteractionEndCallback;\n }, [onInteractionEndCallback]);\n\n useEffect(() => {\n viewportResizeCallbackRef.current = onViewportResizeCallback;\n }, [onViewportResizeCallback]);\n\n const removeMouseListeners = useCallback(() => {\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"pointermove\", mouseMoveRef.current as EventListener);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n document.removeEventListener(\"pointerup\", mouseUpRef.current as EventListener);\n }\n activeInputRef.current = null;\n }, []);\n\n const restoreMouseDownUserSelect = useCallback(() => {\n if (mouseDownElementRef.current) {\n /* v8 ignore next */\n mouseDownElementRef.current.style.userSelect = mouseDownUserSelectRef.current ?? \"\";\n mouseDownElementRef.current = null;\n mouseDownUserSelectRef.current = null;\n }\n }, []);\n\n const removeInteractionEndListeners = useCallback(() => {\n if (interactionEndRef.current) {\n document.removeEventListener(\"mouseup\", interactionEndRef.current as EventListener, true);\n document.removeEventListener(\"pointerup\", interactionEndRef.current as EventListener, true);\n interactionEndRef.current = null;\n }\n }, []);\n\n const onMouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onMouseMoveCallback?.(e);\n },\n [onMouseMoveCallback],\n );\n\n const onMouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n removeMouseListeners();\n restoreMouseDownUserSelect();\n onMouseUpCallback?.(e);\n },\n [onMouseUpCallback, removeMouseListeners, restoreMouseDownUserSelect],\n );\n\n const onMouseDown = useCallback(\n (e: ReactMouseEvent<HTMLElement | SVGElement>) => {\n restoreMouseDownUserSelect();\n mouseDownElementRef.current = e.currentTarget;\n mouseDownUserSelectRef.current = e.currentTarget.style.userSelect;\n e.currentTarget.style.userSelect = \"none\";\n mouseMoveRef.current = onMouseMove;\n mouseUpRef.current = onMouseUp;\n\n // React can emit both pointer and mouse streams for one interaction.\n // Subscribe to only one stream to avoid applying movement deltas twice.\n if (e.type === \"pointerdown\") {\n activeInputRef.current = \"pointer\";\n document.addEventListener(\"pointermove\", onMouseMove as EventListener);\n document.addEventListener(\"pointerup\", onMouseUp as EventListener);\n } else {\n activeInputRef.current = \"mouse\";\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n }\n onMouseDownCallback?.(e);\n },\n [onMouseDownCallback, onMouseMove, onMouseUp, restoreMouseDownUserSelect],\n );\n\n const armInteractionEnd = useCallback(() => {\n if (!interactionEndEnabled || interactionEndRef.current) {\n return;\n }\n\n const onInteractionEnd = (e: MouseEvent | PointerEvent) => {\n removeInteractionEndListeners();\n interactionEndCallbackRef.current?.(e);\n };\n\n interactionEndRef.current = onInteractionEnd;\n document.addEventListener(\"mouseup\", onInteractionEnd as EventListener, true);\n document.addEventListener(\"pointerup\", onInteractionEnd as EventListener, true);\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!interactionEndEnabled) {\n removeInteractionEndListeners();\n }\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!viewportResizeEnabled || !viewportResizeCallbackRef.current || !onViewportResizeCallback) {\n return;\n }\n\n const onViewportResize = (e: UIEvent) => {\n viewportResizeCallbackRef.current?.(e);\n };\n\n window.addEventListener(\"resize\", onViewportResize);\n\n return () => {\n window.removeEventListener(\"resize\", onViewportResize);\n };\n }, [onViewportResizeCallback, viewportResizeEnabled]);\n\n useEffect(() => {\n return () => {\n removeMouseListeners();\n removeInteractionEndListeners();\n restoreMouseDownUserSelect();\n };\n }, [removeInteractionEndListeners, removeMouseListeners, restoreMouseDownUserSelect]);\n\n return {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n armInteractionEnd,\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,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KACX,GAAG,MACa;IAChB,MAAM,aAAa,CAAA,GAAA,mBAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,mBAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ,UAAU,GAAG,CAAA,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;8BACtC,cAAA,gCAAC;kCAAK;;;;YAGV,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/functions/useMouseMove.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\nexport { useMouseMove } from \"./functions/useMouseMove\";\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 const [subMenuVisible, setSubMenuVisible] = useState<boolean>(false);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseEnter={\n entry.group\n ? () => {\n setSubMenuVisible(true);\n }\n : undefined\n }\n onMouseLeave={\n entry.group\n ? () => {\n setSubMenuVisible(false);\n }\n : undefined\n }\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 visible={subMenuVisible}\n />\n )}\n </div>\n );\n};\n","import { 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 visible: boolean;\n}\n\nexport const ContextSubMenu = ({\n entries,\n toClose,\n visible,\n}: ContextSubMenuProps): React.ReactElement => {\n return (\n <span className={styles.caretHolder}>\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 { useMouseMove } from \"../functions/useMouseMove\";\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\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) {\n windowPos.current.x += x;\n windowPos.current.y += y;\n windowRef.current.style.transform = `translate(${windowPos.current.x}px, ${windowPos.current.y}px)`;\n }\n }, []);\n\n const fitToViewport = useCallback(() => {\n if (!windowRef.current) {\n return;\n }\n\n const viewportPadding = 32;\n const availableWidth = Math.max(0, window.innerWidth - viewportPadding);\n const availableHeight = Math.max(0, window.innerHeight - viewportPadding);\n const rect = windowRef.current.getBoundingClientRect();\n const horizontalChrome = rect.width - windowRef.current.clientWidth;\n const verticalChrome = rect.height - windowRef.current.clientHeight;\n\n if (rect.width > availableWidth) {\n windowRef.current.style.width = `${Math.max(0, availableWidth - horizontalChrome)}px`;\n }\n\n if (rect.height > availableHeight) {\n windowRef.current.style.height = `${Math.max(0, availableHeight - verticalChrome)}px`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n fitToViewport();\n }, [fitToViewport, move]);\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 const parseTranslate = (transform?: string): { x: number; y: number } => {\n const match = transform?.match(/translate\\((-?\\d+(?:\\.\\d+)?)px,\\s*(-?\\d+(?:\\.\\d+)?)px\\)/);\n if (match) {\n return {\n x: Number.parseFloat(match[1]),\n y: Number.parseFloat(match[2]),\n };\n }\n /* v8 ignore next */\n return { x: 0, y: 0 };\n };\n\n const { onMouseDown, armInteractionEnd } = useMouseMove({\n onMouseDown: () => {\n windowPos.current = parseTranslate(windowRef.current?.style.transform);\n setMoving(true);\n pushToTop();\n },\n onMouseMove: (e: MouseEvent) => {\n move(e.movementX, e.movementY);\n },\n onMouseUp: () => {\n checkPosition();\n setMoving(false);\n },\n onInteractionEnd: () => {\n checkPosition();\n },\n interactionEndEnabled: windowVisible,\n onViewportResize: () => {\n checkPosition();\n },\n viewportResizeEnabled: windowVisible,\n });\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 const checkedPosition = chkPosition(windowRef);\n windowRef.current.style.transform = `translate(${checkedPosition.translateX}px, ${checkedPosition.translateY}px)`;\n if (windowPos && windowPos.current) {\n windowPos.current = {\n x: checkedPosition.translateX,\n y: checkedPosition.translateY,\n };\n }\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, minZIndex, onOpen, startTransition]);\n\n // When CSS resize handle is used, defer checkPosition until resize interaction ends.\n useEffect(() => {\n if (!windowVisible || !windowRef.current || typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const observer = new ResizeObserver(() => {\n armInteractionEnd();\n });\n\n observer.observe(windowRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [armInteractionEnd, windowVisible]);\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={onMouseDown}\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","import { type MouseEvent as ReactMouseEvent, useCallback, useEffect, useRef } from \"react\";\n\ninterface UseMouseMoveProps {\n onMouseDown?: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove?: (e: MouseEvent) => void;\n onMouseUp?: (e: MouseEvent) => void;\n onInteractionEnd?: (e: MouseEvent | PointerEvent) => void;\n interactionEndEnabled?: boolean;\n onViewportResize?: (e: UIEvent) => void;\n viewportResizeEnabled?: boolean;\n}\n\ninterface UseMouseMoveResult {\n onMouseDown: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove: (e: MouseEvent) => void;\n onMouseUp: (e: MouseEvent) => void;\n armInteractionEnd: () => void;\n}\n\nexport const useMouseMove = ({\n onMouseDown: onMouseDownCallback,\n onMouseMove: onMouseMoveCallback,\n onMouseUp: onMouseUpCallback,\n onInteractionEnd: onInteractionEndCallback,\n interactionEndEnabled = true,\n onViewportResize: onViewportResizeCallback,\n viewportResizeEnabled = true,\n}: UseMouseMoveProps): UseMouseMoveResult => {\n const mouseMoveRef = useRef<((e: MouseEvent) => void) | null>(null);\n const mouseUpRef = useRef<((e: MouseEvent) => void) | null>(null);\n const activeInputRef = useRef<\"mouse\" | \"pointer\" | null>(null);\n const mouseDownElementRef = useRef<HTMLElement | SVGElement | null>(null);\n const mouseDownUserSelectRef = useRef<string | null>(null);\n const interactionEndRef = useRef<((e: MouseEvent | PointerEvent) => void) | null>(null);\n const interactionEndCallbackRef = useRef(onInteractionEndCallback);\n const viewportResizeCallbackRef = useRef(onViewportResizeCallback);\n\n useEffect(() => {\n interactionEndCallbackRef.current = onInteractionEndCallback;\n }, [onInteractionEndCallback]);\n\n useEffect(() => {\n viewportResizeCallbackRef.current = onViewportResizeCallback;\n }, [onViewportResizeCallback]);\n\n const removeMouseListeners = useCallback(() => {\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"pointermove\", mouseMoveRef.current as EventListener);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n document.removeEventListener(\"pointerup\", mouseUpRef.current as EventListener);\n }\n activeInputRef.current = null;\n }, []);\n\n const restoreMouseDownUserSelect = useCallback(() => {\n if (mouseDownElementRef.current) {\n /* v8 ignore next */\n mouseDownElementRef.current.style.userSelect = mouseDownUserSelectRef.current ?? \"\";\n mouseDownElementRef.current = null;\n mouseDownUserSelectRef.current = null;\n }\n }, []);\n\n const removeInteractionEndListeners = useCallback(() => {\n if (interactionEndRef.current) {\n document.removeEventListener(\"mouseup\", interactionEndRef.current as EventListener, true);\n document.removeEventListener(\"pointerup\", interactionEndRef.current as EventListener, true);\n interactionEndRef.current = null;\n }\n }, []);\n\n const onMouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onMouseMoveCallback?.(e);\n },\n [onMouseMoveCallback],\n );\n\n const onMouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n removeMouseListeners();\n restoreMouseDownUserSelect();\n onMouseUpCallback?.(e);\n },\n [onMouseUpCallback, removeMouseListeners, restoreMouseDownUserSelect],\n );\n\n const onMouseDown = useCallback(\n (e: ReactMouseEvent<HTMLElement | SVGElement>) => {\n restoreMouseDownUserSelect();\n mouseDownElementRef.current = e.currentTarget;\n mouseDownUserSelectRef.current = e.currentTarget.style.userSelect;\n e.currentTarget.style.userSelect = \"none\";\n mouseMoveRef.current = onMouseMove;\n mouseUpRef.current = onMouseUp;\n\n // React can emit both pointer and mouse streams for one interaction.\n // Subscribe to only one stream to avoid applying movement deltas twice.\n if (e.type === \"pointerdown\") {\n activeInputRef.current = \"pointer\";\n document.addEventListener(\"pointermove\", onMouseMove as EventListener);\n } else {\n activeInputRef.current = \"mouse\";\n document.addEventListener(\"mousemove\", onMouseMove);\n }\n\n // Release events can arrive on either stream depending on the browser\n // and the element the interaction finishes over.\n document.addEventListener(\"mouseup\", onMouseUp);\n document.addEventListener(\"pointerup\", onMouseUp as EventListener);\n onMouseDownCallback?.(e);\n },\n [onMouseDownCallback, onMouseMove, onMouseUp, restoreMouseDownUserSelect],\n );\n\n const armInteractionEnd = useCallback(() => {\n if (!interactionEndEnabled || interactionEndRef.current) {\n return;\n }\n\n const onInteractionEnd = (e: MouseEvent | PointerEvent) => {\n removeInteractionEndListeners();\n interactionEndCallbackRef.current?.(e);\n };\n\n interactionEndRef.current = onInteractionEnd;\n document.addEventListener(\"mouseup\", onInteractionEnd as EventListener, true);\n document.addEventListener(\"pointerup\", onInteractionEnd as EventListener, true);\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!interactionEndEnabled) {\n removeInteractionEndListeners();\n }\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!viewportResizeEnabled || !viewportResizeCallbackRef.current || !onViewportResizeCallback) {\n return;\n }\n\n const onViewportResize = (e: UIEvent) => {\n viewportResizeCallbackRef.current?.(e);\n };\n\n window.addEventListener(\"resize\", onViewportResize);\n\n return () => {\n window.removeEventListener(\"resize\", onViewportResize);\n };\n }, [onViewportResizeCallback, viewportResizeEnabled]);\n\n useEffect(() => {\n return () => {\n removeMouseListeners();\n removeInteractionEndListeners();\n restoreMouseDownUserSelect();\n };\n }, [removeInteractionEndListeners, removeMouseListeners, restoreMouseDownUserSelect]);\n\n return {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n armInteractionEnd,\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 +1 @@
1
-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,CAAC;CACpB;AAED;IACE,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAkBD,OAAO,MAAM,iGAuPZ,CAAC","sources":["src/src/components/AutoHeight.tsx","src/src/components/interface.ts","src/src/components/ContextSubMenu.tsx","src/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/functions/useMouseMove.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,null,"import \"../global.d.ts\";\nexport * from \"./components\";\nexport { useMouseMove } from \"./functions/useMouseMove\";\n"],"names":[],"version":3,"file":"context-menu.d.ts.map"}
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,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACxF,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB;AGKD;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,SAAS,EAAE,C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,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACnC,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,OAAO,MAAM,eAAgB,6OAQ1B,iBAAiB,KAAG,kBAkJtB,CAAC;AC3JF,4BAAoC,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;IACE,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAkBD,OAAO,MAAM,iGAuPZ,CAAC","sources":["src/src/components/AutoHeight.tsx","src/src/components/interface.ts","src/src/components/ContextSubMenu.tsx","src/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/functions/useMouseMove.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,null,"import \"../global.d.ts\";\nexport * from \"./components\";\nexport { useMouseMove } from \"./functions/useMouseMove\";\n"],"names":[],"version":3,"file":"context-menu.d.ts.map"}
package/dist/main.js CHANGED
@@ -812,12 +812,14 @@ const $a7d2a7efe39e6c95$export$f93615b9594453fc = ({ onMouseDown: onMouseDownCal
812
812
  if (e.type === "pointerdown") {
813
813
  activeInputRef.current = "pointer";
814
814
  document.addEventListener("pointermove", onMouseMove);
815
- document.addEventListener("pointerup", onMouseUp);
816
815
  } else {
817
816
  activeInputRef.current = "mouse";
818
817
  document.addEventListener("mousemove", onMouseMove);
819
- document.addEventListener("mouseup", onMouseUp);
820
818
  }
819
+ // Release events can arrive on either stream depending on the browser
820
+ // and the element the interaction finishes over.
821
+ document.addEventListener("mouseup", onMouseUp);
822
+ document.addEventListener("pointerup", onMouseUp);
821
823
  onMouseDownCallback?.(e);
822
824
  }, [
823
825
  onMouseDownCallback,
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,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KACX,GAAG,MACa;IAChB,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,IAAI,WAAW,OAAO,KAAK,MAAM;YAC/B,aAAa,WAAW,OAAO;YAC/B,WAAW,OAAO,GAAG;QACvB;QAEA,kBAAkB;QAElB,MAAM,KAAK,OAAO,qBAAqB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AEA,iBAAC;oBACC,WAAW;wBAAC,CAAA,GAAA,gEAAK,EAAE,kBAAkB;wBAAE,SAAS,CAAA,GAAA,gEAAK,EAAE,MAAM,GAAG;qBAAG,CAChE,MAAM,CAAC,CAAC,IAAM,MAAM,IACpB,IAAI,CAAC;oBACR,aAAa;;sCAEb,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;;;;YAGV,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/functions/useMouseMove.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\nexport { useMouseMove } from \"./functions/useMouseMove\";\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 const [subMenuVisible, setSubMenuVisible] = useState<boolean>(false);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseEnter={\n entry.group\n ? () => {\n setSubMenuVisible(true);\n }\n : undefined\n }\n onMouseLeave={\n entry.group\n ? () => {\n setSubMenuVisible(false);\n }\n : undefined\n }\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 visible={subMenuVisible}\n />\n )}\n </div>\n );\n};\n","import { 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 visible: boolean;\n}\n\nexport const ContextSubMenu = ({\n entries,\n toClose,\n visible,\n}: ContextSubMenuProps): React.ReactElement => {\n return (\n <span className={styles.caretHolder}>\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 { useMouseMove } from \"../functions/useMouseMove\";\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\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) {\n windowPos.current.x += x;\n windowPos.current.y += y;\n windowRef.current.style.transform = `translate(${windowPos.current.x}px, ${windowPos.current.y}px)`;\n }\n }, []);\n\n const fitToViewport = useCallback(() => {\n if (!windowRef.current) {\n return;\n }\n\n const viewportPadding = 32;\n const availableWidth = Math.max(0, window.innerWidth - viewportPadding);\n const availableHeight = Math.max(0, window.innerHeight - viewportPadding);\n const rect = windowRef.current.getBoundingClientRect();\n const horizontalChrome = rect.width - windowRef.current.clientWidth;\n const verticalChrome = rect.height - windowRef.current.clientHeight;\n\n if (rect.width > availableWidth) {\n windowRef.current.style.width = `${Math.max(0, availableWidth - horizontalChrome)}px`;\n }\n\n if (rect.height > availableHeight) {\n windowRef.current.style.height = `${Math.max(0, availableHeight - verticalChrome)}px`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n fitToViewport();\n }, [fitToViewport, move]);\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 const parseTranslate = (transform?: string): { x: number; y: number } => {\n const match = transform?.match(/translate\\((-?\\d+(?:\\.\\d+)?)px,\\s*(-?\\d+(?:\\.\\d+)?)px\\)/);\n if (match) {\n return {\n x: Number.parseFloat(match[1]),\n y: Number.parseFloat(match[2]),\n };\n }\n /* v8 ignore next */\n return { x: 0, y: 0 };\n };\n\n const { onMouseDown, armInteractionEnd } = useMouseMove({\n onMouseDown: () => {\n windowPos.current = parseTranslate(windowRef.current?.style.transform);\n setMoving(true);\n pushToTop();\n },\n onMouseMove: (e: MouseEvent) => {\n move(e.movementX, e.movementY);\n },\n onMouseUp: () => {\n checkPosition();\n setMoving(false);\n },\n onInteractionEnd: () => {\n checkPosition();\n },\n interactionEndEnabled: windowVisible,\n onViewportResize: () => {\n checkPosition();\n },\n viewportResizeEnabled: windowVisible,\n });\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 const checkedPosition = chkPosition(windowRef);\n windowRef.current.style.transform = `translate(${checkedPosition.translateX}px, ${checkedPosition.translateY}px)`;\n if (windowPos && windowPos.current) {\n windowPos.current = {\n x: checkedPosition.translateX,\n y: checkedPosition.translateY,\n };\n }\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, minZIndex, onOpen, startTransition]);\n\n // When CSS resize handle is used, defer checkPosition until resize interaction ends.\n useEffect(() => {\n if (!windowVisible || !windowRef.current || typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const observer = new ResizeObserver(() => {\n armInteractionEnd();\n });\n\n observer.observe(windowRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [armInteractionEnd, windowVisible]);\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={onMouseDown}\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","import { type MouseEvent as ReactMouseEvent, useCallback, useEffect, useRef } from \"react\";\n\ninterface UseMouseMoveProps {\n onMouseDown?: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove?: (e: MouseEvent) => void;\n onMouseUp?: (e: MouseEvent) => void;\n onInteractionEnd?: (e: MouseEvent | PointerEvent) => void;\n interactionEndEnabled?: boolean;\n onViewportResize?: (e: UIEvent) => void;\n viewportResizeEnabled?: boolean;\n}\n\ninterface UseMouseMoveResult {\n onMouseDown: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove: (e: MouseEvent) => void;\n onMouseUp: (e: MouseEvent) => void;\n armInteractionEnd: () => void;\n}\n\nexport const useMouseMove = ({\n onMouseDown: onMouseDownCallback,\n onMouseMove: onMouseMoveCallback,\n onMouseUp: onMouseUpCallback,\n onInteractionEnd: onInteractionEndCallback,\n interactionEndEnabled = true,\n onViewportResize: onViewportResizeCallback,\n viewportResizeEnabled = true,\n}: UseMouseMoveProps): UseMouseMoveResult => {\n const mouseMoveRef = useRef<((e: MouseEvent) => void) | null>(null);\n const mouseUpRef = useRef<((e: MouseEvent) => void) | null>(null);\n const activeInputRef = useRef<\"mouse\" | \"pointer\" | null>(null);\n const mouseDownElementRef = useRef<HTMLElement | SVGElement | null>(null);\n const mouseDownUserSelectRef = useRef<string | null>(null);\n const interactionEndRef = useRef<((e: MouseEvent | PointerEvent) => void) | null>(null);\n const interactionEndCallbackRef = useRef(onInteractionEndCallback);\n const viewportResizeCallbackRef = useRef(onViewportResizeCallback);\n\n useEffect(() => {\n interactionEndCallbackRef.current = onInteractionEndCallback;\n }, [onInteractionEndCallback]);\n\n useEffect(() => {\n viewportResizeCallbackRef.current = onViewportResizeCallback;\n }, [onViewportResizeCallback]);\n\n const removeMouseListeners = useCallback(() => {\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"pointermove\", mouseMoveRef.current as EventListener);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n document.removeEventListener(\"pointerup\", mouseUpRef.current as EventListener);\n }\n activeInputRef.current = null;\n }, []);\n\n const restoreMouseDownUserSelect = useCallback(() => {\n if (mouseDownElementRef.current) {\n /* v8 ignore next */\n mouseDownElementRef.current.style.userSelect = mouseDownUserSelectRef.current ?? \"\";\n mouseDownElementRef.current = null;\n mouseDownUserSelectRef.current = null;\n }\n }, []);\n\n const removeInteractionEndListeners = useCallback(() => {\n if (interactionEndRef.current) {\n document.removeEventListener(\"mouseup\", interactionEndRef.current as EventListener, true);\n document.removeEventListener(\"pointerup\", interactionEndRef.current as EventListener, true);\n interactionEndRef.current = null;\n }\n }, []);\n\n const onMouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onMouseMoveCallback?.(e);\n },\n [onMouseMoveCallback],\n );\n\n const onMouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n removeMouseListeners();\n restoreMouseDownUserSelect();\n onMouseUpCallback?.(e);\n },\n [onMouseUpCallback, removeMouseListeners, restoreMouseDownUserSelect],\n );\n\n const onMouseDown = useCallback(\n (e: ReactMouseEvent<HTMLElement | SVGElement>) => {\n restoreMouseDownUserSelect();\n mouseDownElementRef.current = e.currentTarget;\n mouseDownUserSelectRef.current = e.currentTarget.style.userSelect;\n e.currentTarget.style.userSelect = \"none\";\n mouseMoveRef.current = onMouseMove;\n mouseUpRef.current = onMouseUp;\n\n // React can emit both pointer and mouse streams for one interaction.\n // Subscribe to only one stream to avoid applying movement deltas twice.\n if (e.type === \"pointerdown\") {\n activeInputRef.current = \"pointer\";\n document.addEventListener(\"pointermove\", onMouseMove as EventListener);\n document.addEventListener(\"pointerup\", onMouseUp as EventListener);\n } else {\n activeInputRef.current = \"mouse\";\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n }\n onMouseDownCallback?.(e);\n },\n [onMouseDownCallback, onMouseMove, onMouseUp, restoreMouseDownUserSelect],\n );\n\n const armInteractionEnd = useCallback(() => {\n if (!interactionEndEnabled || interactionEndRef.current) {\n return;\n }\n\n const onInteractionEnd = (e: MouseEvent | PointerEvent) => {\n removeInteractionEndListeners();\n interactionEndCallbackRef.current?.(e);\n };\n\n interactionEndRef.current = onInteractionEnd;\n document.addEventListener(\"mouseup\", onInteractionEnd as EventListener, true);\n document.addEventListener(\"pointerup\", onInteractionEnd as EventListener, true);\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!interactionEndEnabled) {\n removeInteractionEndListeners();\n }\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!viewportResizeEnabled || !viewportResizeCallbackRef.current || !onViewportResizeCallback) {\n return;\n }\n\n const onViewportResize = (e: UIEvent) => {\n viewportResizeCallbackRef.current?.(e);\n };\n\n window.addEventListener(\"resize\", onViewportResize);\n\n return () => {\n window.removeEventListener(\"resize\", onViewportResize);\n };\n }, [onViewportResizeCallback, viewportResizeEnabled]);\n\n useEffect(() => {\n return () => {\n removeMouseListeners();\n removeInteractionEndListeners();\n restoreMouseDownUserSelect();\n };\n }, [removeInteractionEndListeners, removeMouseListeners, restoreMouseDownUserSelect]);\n\n return {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n armInteractionEnd,\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,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KACX,GAAG,MACa;IAChB,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;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Y;gBACxC,QAAQ;gBACR,WAAW,KAAK,KAAK,EAAE,aAAa;gBACpC,UAAU,KAAK,KAAK,EAAE,YAAY;gBAClC,WAAW,KAAK,KAAK,EAAE,aAAa;gBACpC,UAAU,KAAK,KAAK,EAAE,YAAY;YACpC;YACA,gBAAgB,CAAC;gBACf;gBACA,KAAK,cAAc,GAAG;YACxB;;8BAEA,iBAAC;oBACC,WAAW;wBAAC,CAAA,GAAA,gEAAK,EAAE,kBAAkB;wBAAE,SAAS,CAAA,GAAA,gEAAK,EAAE,MAAM,GAAG;qBAAG,CAChE,MAAM,CAAC,CAAC,IAAM,MAAM,IACpB,IAAI,CAAC;oBACR,aAAa;;sCAEb,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;;;;YAGV,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/functions/useMouseMove.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\nexport { useMouseMove } from \"./functions/useMouseMove\";\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 const [subMenuVisible, setSubMenuVisible] = useState<boolean>(false);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseEnter={\n entry.group\n ? () => {\n setSubMenuVisible(true);\n }\n : undefined\n }\n onMouseLeave={\n entry.group\n ? () => {\n setSubMenuVisible(false);\n }\n : undefined\n }\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 visible={subMenuVisible}\n />\n )}\n </div>\n );\n};\n","import { 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 visible: boolean;\n}\n\nexport const ContextSubMenu = ({\n entries,\n toClose,\n visible,\n}: ContextSubMenuProps): React.ReactElement => {\n return (\n <span className={styles.caretHolder}>\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 { useMouseMove } from \"../functions/useMouseMove\";\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\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) {\n windowPos.current.x += x;\n windowPos.current.y += y;\n windowRef.current.style.transform = `translate(${windowPos.current.x}px, ${windowPos.current.y}px)`;\n }\n }, []);\n\n const fitToViewport = useCallback(() => {\n if (!windowRef.current) {\n return;\n }\n\n const viewportPadding = 32;\n const availableWidth = Math.max(0, window.innerWidth - viewportPadding);\n const availableHeight = Math.max(0, window.innerHeight - viewportPadding);\n const rect = windowRef.current.getBoundingClientRect();\n const horizontalChrome = rect.width - windowRef.current.clientWidth;\n const verticalChrome = rect.height - windowRef.current.clientHeight;\n\n if (rect.width > availableWidth) {\n windowRef.current.style.width = `${Math.max(0, availableWidth - horizontalChrome)}px`;\n }\n\n if (rect.height > availableHeight) {\n windowRef.current.style.height = `${Math.max(0, availableHeight - verticalChrome)}px`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n fitToViewport();\n }, [fitToViewport, move]);\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 const parseTranslate = (transform?: string): { x: number; y: number } => {\n const match = transform?.match(/translate\\((-?\\d+(?:\\.\\d+)?)px,\\s*(-?\\d+(?:\\.\\d+)?)px\\)/);\n if (match) {\n return {\n x: Number.parseFloat(match[1]),\n y: Number.parseFloat(match[2]),\n };\n }\n /* v8 ignore next */\n return { x: 0, y: 0 };\n };\n\n const { onMouseDown, armInteractionEnd } = useMouseMove({\n onMouseDown: () => {\n windowPos.current = parseTranslate(windowRef.current?.style.transform);\n setMoving(true);\n pushToTop();\n },\n onMouseMove: (e: MouseEvent) => {\n move(e.movementX, e.movementY);\n },\n onMouseUp: () => {\n checkPosition();\n setMoving(false);\n },\n onInteractionEnd: () => {\n checkPosition();\n },\n interactionEndEnabled: windowVisible,\n onViewportResize: () => {\n checkPosition();\n },\n viewportResizeEnabled: windowVisible,\n });\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 const checkedPosition = chkPosition(windowRef);\n windowRef.current.style.transform = `translate(${checkedPosition.translateX}px, ${checkedPosition.translateY}px)`;\n if (windowPos && windowPos.current) {\n windowPos.current = {\n x: checkedPosition.translateX,\n y: checkedPosition.translateY,\n };\n }\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, minZIndex, onOpen, startTransition]);\n\n // When CSS resize handle is used, defer checkPosition until resize interaction ends.\n useEffect(() => {\n if (!windowVisible || !windowRef.current || typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const observer = new ResizeObserver(() => {\n armInteractionEnd();\n });\n\n observer.observe(windowRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [armInteractionEnd, windowVisible]);\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={onMouseDown}\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","import { type MouseEvent as ReactMouseEvent, useCallback, useEffect, useRef } from \"react\";\n\ninterface UseMouseMoveProps {\n onMouseDown?: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove?: (e: MouseEvent) => void;\n onMouseUp?: (e: MouseEvent) => void;\n onInteractionEnd?: (e: MouseEvent | PointerEvent) => void;\n interactionEndEnabled?: boolean;\n onViewportResize?: (e: UIEvent) => void;\n viewportResizeEnabled?: boolean;\n}\n\ninterface UseMouseMoveResult {\n onMouseDown: (e: ReactMouseEvent<HTMLElement | SVGElement>) => void;\n onMouseMove: (e: MouseEvent) => void;\n onMouseUp: (e: MouseEvent) => void;\n armInteractionEnd: () => void;\n}\n\nexport const useMouseMove = ({\n onMouseDown: onMouseDownCallback,\n onMouseMove: onMouseMoveCallback,\n onMouseUp: onMouseUpCallback,\n onInteractionEnd: onInteractionEndCallback,\n interactionEndEnabled = true,\n onViewportResize: onViewportResizeCallback,\n viewportResizeEnabled = true,\n}: UseMouseMoveProps): UseMouseMoveResult => {\n const mouseMoveRef = useRef<((e: MouseEvent) => void) | null>(null);\n const mouseUpRef = useRef<((e: MouseEvent) => void) | null>(null);\n const activeInputRef = useRef<\"mouse\" | \"pointer\" | null>(null);\n const mouseDownElementRef = useRef<HTMLElement | SVGElement | null>(null);\n const mouseDownUserSelectRef = useRef<string | null>(null);\n const interactionEndRef = useRef<((e: MouseEvent | PointerEvent) => void) | null>(null);\n const interactionEndCallbackRef = useRef(onInteractionEndCallback);\n const viewportResizeCallbackRef = useRef(onViewportResizeCallback);\n\n useEffect(() => {\n interactionEndCallbackRef.current = onInteractionEndCallback;\n }, [onInteractionEndCallback]);\n\n useEffect(() => {\n viewportResizeCallbackRef.current = onViewportResizeCallback;\n }, [onViewportResizeCallback]);\n\n const removeMouseListeners = useCallback(() => {\n if (mouseMoveRef.current) {\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"pointermove\", mouseMoveRef.current as EventListener);\n }\n if (mouseUpRef.current) {\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n document.removeEventListener(\"pointerup\", mouseUpRef.current as EventListener);\n }\n activeInputRef.current = null;\n }, []);\n\n const restoreMouseDownUserSelect = useCallback(() => {\n if (mouseDownElementRef.current) {\n /* v8 ignore next */\n mouseDownElementRef.current.style.userSelect = mouseDownUserSelectRef.current ?? \"\";\n mouseDownElementRef.current = null;\n mouseDownUserSelectRef.current = null;\n }\n }, []);\n\n const removeInteractionEndListeners = useCallback(() => {\n if (interactionEndRef.current) {\n document.removeEventListener(\"mouseup\", interactionEndRef.current as EventListener, true);\n document.removeEventListener(\"pointerup\", interactionEndRef.current as EventListener, true);\n interactionEndRef.current = null;\n }\n }, []);\n\n const onMouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onMouseMoveCallback?.(e);\n },\n [onMouseMoveCallback],\n );\n\n const onMouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n removeMouseListeners();\n restoreMouseDownUserSelect();\n onMouseUpCallback?.(e);\n },\n [onMouseUpCallback, removeMouseListeners, restoreMouseDownUserSelect],\n );\n\n const onMouseDown = useCallback(\n (e: ReactMouseEvent<HTMLElement | SVGElement>) => {\n restoreMouseDownUserSelect();\n mouseDownElementRef.current = e.currentTarget;\n mouseDownUserSelectRef.current = e.currentTarget.style.userSelect;\n e.currentTarget.style.userSelect = \"none\";\n mouseMoveRef.current = onMouseMove;\n mouseUpRef.current = onMouseUp;\n\n // React can emit both pointer and mouse streams for one interaction.\n // Subscribe to only one stream to avoid applying movement deltas twice.\n if (e.type === \"pointerdown\") {\n activeInputRef.current = \"pointer\";\n document.addEventListener(\"pointermove\", onMouseMove as EventListener);\n } else {\n activeInputRef.current = \"mouse\";\n document.addEventListener(\"mousemove\", onMouseMove);\n }\n\n // Release events can arrive on either stream depending on the browser\n // and the element the interaction finishes over.\n document.addEventListener(\"mouseup\", onMouseUp);\n document.addEventListener(\"pointerup\", onMouseUp as EventListener);\n onMouseDownCallback?.(e);\n },\n [onMouseDownCallback, onMouseMove, onMouseUp, restoreMouseDownUserSelect],\n );\n\n const armInteractionEnd = useCallback(() => {\n if (!interactionEndEnabled || interactionEndRef.current) {\n return;\n }\n\n const onInteractionEnd = (e: MouseEvent | PointerEvent) => {\n removeInteractionEndListeners();\n interactionEndCallbackRef.current?.(e);\n };\n\n interactionEndRef.current = onInteractionEnd;\n document.addEventListener(\"mouseup\", onInteractionEnd as EventListener, true);\n document.addEventListener(\"pointerup\", onInteractionEnd as EventListener, true);\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!interactionEndEnabled) {\n removeInteractionEndListeners();\n }\n }, [interactionEndEnabled, removeInteractionEndListeners]);\n\n useEffect(() => {\n if (!viewportResizeEnabled || !viewportResizeCallbackRef.current || !onViewportResizeCallback) {\n return;\n }\n\n const onViewportResize = (e: UIEvent) => {\n viewportResizeCallbackRef.current?.(e);\n };\n\n window.addEventListener(\"resize\", onViewportResize);\n\n return () => {\n window.removeEventListener(\"resize\", onViewportResize);\n };\n }, [onViewportResizeCallback, viewportResizeEnabled]);\n\n useEffect(() => {\n return () => {\n removeMouseListeners();\n removeInteractionEndListeners();\n restoreMouseDownUserSelect();\n };\n }, [removeInteractionEndListeners, removeMouseListeners, restoreMouseDownUserSelect]);\n\n return {\n onMouseDown,\n onMouseMove,\n onMouseUp,\n armInteractionEnd,\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asup/context-menu",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "REACT Typescript Context menu component",
5
5
  "author": "Paul Thomas <@PaulDThomas>",
6
6
  "private": false,