@asup/context-menu 1.5.2 → 2.0.2
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/README.md +117 -65
- package/dist/cjs/main.js +192 -142
- package/dist/cjs/main.js.map +1 -1
- package/dist/context-menu.d.ts +12 -33
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/main.js +194 -144
- package/dist/main.js.map +1 -1
- package/package.json +31 -23
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADQ/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,IAAI,YACJ,WAAW,KAEK,GALS,QAItB,sBAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,aAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,aAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,eAAO,EAAiB;IACpD,MAAM,iBAAiB,CAAA,GAAA,cAAM,EAC3B,IAAO,QAAQ,CAAC,yBAAW,gBAAC;YAAI,OAAO;gBAAE,QAAQ;YAAM;aAAQ,UAC/D;QAAC;QAAU;KAAK;IAGlB,MAAM,kBAAkB,CAAA,GAAA,kBAAU,EAAE;QAClC,MAAM,QAAQ,SAAS,OAAO;YAGK;QADnC,mEAAmE;QACnE,MAAM,iBAAiB,OAAO,IAAK,CAAA,sBAAA,kBAAA,4BAAA,MAAO,YAAY,cAAnB,iCAAA,sBAAuB;QAC1D,UAAU;IACZ,GAAG;QAAC;KAAK;IAET,mEAAmE;IACnE,CAAA,GAAA,gBAAQ,EAAE;QACR,MAAM,aAAa,SAAS,OAAO;QACnC,IAAI,YAAY;YACd,MAAM,WAAW,IAAI,eAAe;gBACl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E,sBAAsB;4BACxC,OAAO;sCAEN,eAAe,eAAe;;sCAEjC,gBAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gBAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gBAAC;oCAAK,GAAE;;;;;;8BAId,gBAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gBAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAEA,0CAAc,WAAW,GAAG;;;;;AGhO5B,MAAM,oCAAc;AAUb,MAAM,4CAAqB,CAAC,YAAE,QAAQ,EAA2B;IACtE,CAAA,GAAA,gBAAQ,EAAE;QACR,MAAM,SAAS,IACb,QAAQ,IAAI,CACV;QAGJ,IAAI;YACF,sEAAsE;YACtE,IAAI,OAAO,WAAW,eAAe,OAAO,cAAc,EAAE;gBAC1D,MAAM,UAAU,OAAO,cAAc,CAAC,OAAO,CAAC;gBAC9C,IAAI,CAAC,SAAS;oBACZ,OAAO,cAAc,CAAC,OAAO,CAAC,mCAAa;oBAC3C;gBACF;gBACA;YACF;QACF,EAAE,UAAM;QACN,qFAAqF;QACvF;QAEA,qFAAqF;QACrF,MAAM,IAAI;QACV,IAAI,CAAC,EAAE,4BAA4B,EAAE;YACnC,EAAE,4BAA4B,GAAG;YACjC;QACF;IACF,GAAG,EAAE;IAEL,qBAAO;kBAAG;;AACZ;AAEA,0CAAmB,WAAW,GAAG;;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css","src/components/ContextWindowStack.tsx"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { ContextWindowStack } from \"./ContextWindowStack\";\nimport { MenuItem } from \"./interface\";\n\nexport {\n AutoHeight,\n ClickForMenu,\n ContextMenu,\n ContextMenuHandler,\n ContextWindow,\n ContextWindowStack,\n};\nexport type { MenuItem as iMenuItem };\n","import { useCallback, useEffect, useLayoutEffect, useMemo, 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\nexport function AutoHeight({\n children,\n hide,\n duration = 300,\n ...rest\n}: AutoHeightProps): JSX.Element {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const targetChildren = useMemo<React.ReactNode>(\n () => (hide || !children ? <div style={{ height: \"1px\" }} /> : children),\n [children, hide],\n );\n\n const setTargetHeight = useCallback(() => {\n const inner = innerRef.current;\n\n // Initial draw to get the height of children and deployed children\n const deployedHeight = hide ? 1 : (inner?.offsetHeight ?? 0);\n setHeight(deployedHeight);\n }, [hide]);\n\n // Add ResizeObserver to update height on content resize, debounced\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n setTargetHeight();\n });\n\n observer.observe(transition);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [setTargetHeight]);\n\n // Trigger height change on children update\n useLayoutEffect(() => {\n setTargetHeight();\n }, [setTargetHeight, children]);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\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, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { MenuItem } from \"./interface\";\n\ninterface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: MenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): JSX.Element => {\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 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 setMenuInDom(false);\n }\n }, []);\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import { forwardRef } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { MenuItem } 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: MenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): JSX.Element => {\n // Check that menu can fit inside the window\n let menuHeight = entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING;\n let menuWidth = ESTIMATED_MENU_WIDTH;\n if (ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n menuHeight = ref.current.offsetHeight;\n menuWidth = ref.current.offsetWidth;\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 { MenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: MenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { MenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: MenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): JSX.Element => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\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 { MenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: MenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: MenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | JSX.Element): 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): JSX.Element => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems = useMemo(\n () => [\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: (\n <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />\n ),\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ],\n [higherContext, 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 // Get holder position\n const divHandlerPos = divHandlderRef.current?.getBoundingClientRect() ?? null;\n\n // Handle click off the menu\n const handleClick = useCallback((e: globalThis.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 { MenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: MenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({ entries, visible, xPos, yPos, maxWidth }: LowMenuProps): JSX.Element => {\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 { MenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: MenuItem;\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 { MenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: MenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): JSX.Element => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import { ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\ninterface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = ({\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n}: ContextWindowProps): JSX.Element => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = useCallback((x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n }, []);\n\n const checkPosition = useCallback(() => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n }, [move]);\n\n const mouseMove = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n },\n [move],\n );\n\n // Store stable references to mouseMove and mouseUp for cleanup\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = useCallback(\n (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n },\n [checkPosition],\n );\n\n // Update refs when callbacks change\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n }, [mouseMove, mouseUp]);\n\n // Helper function to push this window to the top\n const pushToTop = useCallback(() => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n }, [minZIndex]);\n\n // Update visibility\n useEffect(() => {\n // Visible set, but not in DOM\n if (visible && !windowInDOM) {\n setWindowInDOM(true);\n } else if (visible && windowInDOM && !windowVisible) {\n pushToTop();\n setWindowVisible(visible);\n onOpen?.();\n // Get starting position\n if (divRef.current && windowRef.current) {\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n }\n checkPosition();\n } else if (!visible && windowVisible) {\n setWindowVisible(false);\n } else if (!visible && windowInDOM) {\n setWindowInDOM(false);\n }\n }, [checkPosition, onOpen, pushToTop, visible, windowInDOM, windowVisible]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUpRef.current);\n document.addEventListener(\"mousemove\", mouseMoveRef.current);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n","import { ReactNode, useEffect } from \"react\";\n\ninterface ContextWindowStackProps {\n id?: string;\n minZIndex?: number;\n children?: JSX.Element[] | JSX.Element | ReactNode;\n}\n\ndeclare global {\n interface GlobalThis {\n __ContextWindowStackRendered?: boolean;\n }\n}\n\nconst SESSION_KEY = \"context-menu.ContextWindowStack.rendered\";\n\n/**\n * @deprecated ContextWindowStack is no longer required. ContextWindow now manages z-index automatically.\n * This component is kept for backwards compatibility and will be removed in a future version.\n * It will render its children only once per browser session and then return `null` on subsequent mounts.\n *\n * Note: The `id` and `minZIndex` props are ignored and have no effect. They remain in the interface for backward compatibility only.\n */\n\nexport const ContextWindowStack = ({ children }: ContextWindowStackProps): JSX.Element => {\n useEffect(() => {\n const doWarn = () =>\n console.warn(\n \"ContextWindowStack is deprecated and no longer required. ContextWindow now manages z-index automatically. Please remove the ContextWindowStack wrapper from your code.\",\n );\n\n try {\n // Prefer sessionStorage so the warning lasts for the browser session.\n if (typeof window !== \"undefined\" && window.sessionStorage) {\n const already = window.sessionStorage.getItem(SESSION_KEY);\n if (!already) {\n window.sessionStorage.setItem(SESSION_KEY, \"1\");\n doWarn();\n }\n return;\n }\n } catch {\n // sessionStorage may be unavailable (privacy mode). Fall through to global fallback.\n }\n\n // Fallback: use a global flag for environments where sessionStorage isn't available.\n const g = globalThis as unknown as { __ContextWindowStackRendered?: boolean };\n if (!g.__ContextWindowStackRendered) {\n g.__ContextWindowStackRendered = true;\n doWarn();\n }\n }, []);\n\n return <>{children}</>;\n};\n\nContextWindowStack.displayName = \"ContextWindowStack\";\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KAEK,GALS,QAItB,sBAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,aAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,aAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ,U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,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gBAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gBAAC;oCAAK,GAAE;;;;;;8BAId,gBAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gBAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAEA,0CAAc,WAAW,GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport styles from \"./AutoHeight.module.css\";\n\ninterface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n hide?: boolean;\n duration?: number; // transition duration in ms\n}\n\ntype AnimationState = \"closed\" | \"opening\" | \"open\" | \"closing\";\n\nexport function AutoHeight({\n children,\n hide = false,\n duration = 300,\n ...rest\n}: AutoHeightProps): React.ReactElement {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const [animationState, setAnimationState] = useState<AnimationState>(!hide ? \"open\" : \"closed\");\n\n const rafRef = useRef<number | null>(null);\n const timeoutRef = useRef<number | null>(null);\n\n const targetChildren: React.ReactNode =\n animationState === \"closed\" || !children ? null : children;\n\n const setTargetHeight = useEffectEvent((newHeight: number) => {\n setHeight(newHeight);\n });\n\n const transitionToOpening = useEffectEvent((): void => {\n // Cancel any pending close timeout\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n setAnimationState(\"opening\");\n\n const id = window.requestAnimationFrame(() => {\n rafRef.current = null;\n setTargetHeight(1);\n\n const frameId = window.requestAnimationFrame(() => {\n const inner = innerRef.current;\n if (inner) {\n setTargetHeight(inner.offsetHeight);\n setAnimationState(\"open\");\n }\n });\n rafRef.current = frameId;\n });\n rafRef.current = id;\n });\n\n const transitionToClosing = useEffectEvent((): void => {\n // Cancel any pending RAF\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n setAnimationState(\"closing\");\n setTargetHeight(1);\n\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = null;\n setAnimationState(\"closed\");\n }, duration);\n });\n\n useLayoutEffect(() => {\n if (!hide) {\n // Want to show: transition to open\n if (animationState === \"closed\" || animationState === \"closing\") {\n transitionToOpening();\n }\n // If already opening or open, stay in that state\n } else {\n // Want to hide: transition to closed\n if (animationState === \"open\" || animationState === \"opening\") {\n transitionToClosing();\n }\n }\n }, [hide, animationState]);\n\n // Setup ResizeObserver to track content size changes\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n if (animationState === \"open\") {\n setTargetHeight(transition!.offsetHeight);\n }\n });\n\n observer.observe(transition!);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [animationState]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\n display: animationState === \"closed\" ? \"none\" : undefined,\n height: height ? `${height}px` : \"auto\",\n transitionDuration: `${duration}ms`,\n }}\n >\n <div\n className={styles.autoHeightInner}\n ref={innerRef}\n >\n {targetChildren}\n </div>\n </div>\n );\n}\n\nAutoHeight.displayName = \"AutoHeight\";\n",".autoHeightWrapper {\n overflow: hidden;\n transition-timing-function: height ease-in-out width ease-in-out background-color ease-in-out;\n box-sizing: border-box;\n position: relative;\n}\n\n.autoHeightInner {\n height: fit-content;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: IMenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): React.ReactElement => {\n // Menu state\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n\n // Set up outsideClick handler\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n // Handle click off the menu\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const handleClick = (e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuInDom(false);\n }\n };\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import React, { forwardRef, useLayoutEffect, useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { IMenuItem } from \"./interface\";\n\n// Constants for menu size estimation when ref is not yet available\nconst ESTIMATED_MENU_ITEM_HEIGHT = 34;\nconst ESTIMATED_MENU_PADDING = 4;\nconst ESTIMATED_MENU_WIDTH = 200;\n\nexport interface ContextMenuProps {\n visible: boolean;\n entries: IMenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): React.ReactElement => {\n // Measure menu size after mount/render to avoid accessing refs during render\n const [menuHeight, setMenuHeight] = useState(\n entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING,\n );\n const [menuWidth, setMenuWidth] = useState(ESTIMATED_MENU_WIDTH);\n\n useLayoutEffect(() => {\n // Only measure when visible; ref access inside effect is allowed\n if (visible && ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n setMenuHeight(ref.current.offsetHeight);\n setMenuWidth(ref.current.offsetWidth);\n }\n // When not visible, fall back to estimates\n if (!visible) {\n setMenuHeight(entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING);\n setMenuWidth(ESTIMATED_MENU_WIDTH);\n }\n }, [visible, entries, ref]);\n\n const adjustedYPos =\n yPos + menuHeight > window.innerHeight\n ? Math.max(window.innerHeight - menuHeight - ESTIMATED_MENU_PADDING, 0)\n : yPos;\n const adjustedXPos =\n xPos + menuWidth > window.innerWidth\n ? Math.max(window.innerWidth - menuWidth - ESTIMATED_MENU_PADDING, 0)\n : xPos;\n\n return (\n <div\n ref={ref}\n className={[styles.contextMenu, visible ? styles.visible : styles.hidden]\n .filter((c) => c !== \"\")\n .join(\" \")}\n style={{\n top: `${adjustedYPos}px`,\n left: `${adjustedXPos}px`,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {entries.map((entry, i) => (\n <ContextMenuEntry\n key={i}\n entry={entry}\n toClose={toClose}\n />\n ))}\n </div>\n );\n },\n);\n\nContextMenu.displayName = \"ContextMenu\";\n",".anchor {\n position: absolute;\n top: 0;\n left: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n font-size: 9pt;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.contextMenuHandler {\n height: fit-content;\n width: fit-content;\n}\n\n.contextMenu {\n position: absolute;\n border: 1px solid;\n border-color: rgb(17, 20, 24);\n opacity: 1;\n background-color: rgb(251, 253, 246);\n z-index: 10000;\n box-shadow: 4px 4px 4px rgb(64, 64, 64, 0.75);\n transition: opacity 0.3s linear;\n}\n\n.contextMenu.hidden {\n opacity: 0;\n}\n\n.contextMenu.visible {\n opacity: 1;\n}\n\n.contextMenuItem {\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n min-width: 80px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.contextMenuItem.disabled {\n background-color: rgba(0, 0, 0, 0.2);\n cursor: not-allowed;\n}\n\n.contextMenuItem:first-child {\n padding-top: 4px;\n}\n\n.contextMenuItem:last-child {\n padding-bottom: 4px;\n}\n\n.contextMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.contextMenuItem .caretHolder {\n align-self: flex-end;\n}\n\n.contextMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n\n.contextMenuItemLabel {\n flex-grow: 1;\n height: 19px;\n}\n","import { useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: IMenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: IMenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { LowMenu } from \"./LowMenu\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: IMenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: IMenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | React.ReactElement): boolean {\n return typeof label !== \"string\" && label.type === \"hr\";\n}\n\nexport const ContextMenuHandler = ({\n children,\n menuItems,\n showLowMenu = false,\n ...rest\n}: ContextMenuHandlerProps): React.ReactElement => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems: IMenuItem[] = [\n ...(higherContext !== null\n ? [\n ...higherContext.menuItems,\n ...[\n higherContext.menuItems.length > 0 &&\n !isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) &&\n menuItems.length > 0 &&\n !isDivider(menuItems[0].label)\n ? {\n label: <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />,\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ];\n\n // Menu resources\n const divHandlderRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = useState<boolean>(false);\n const [mouseOverMenu, setMouseOverMenu] = useState<boolean>(false);\n\n // Holder position - measured in an effect to avoid reading refs during render\n const [divHandlerPos, setDivHandlerPos] = useState<DOMRect | null>(null);\n\n useLayoutEffect(() => {\n function updatePos() {\n if (divHandlderRef.current) {\n setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());\n }\n }\n\n // When the handler is hovered or the menu is mounted, ensure we have a fresh position\n if (mouseOverHandlerDiv || menuInDom) {\n updatePos();\n }\n\n // Attach listeners while the menu/low-menu may be visible so the position stays correct\n if (mouseOverHandlerDiv || menuInDom) {\n window.addEventListener(\"resize\", updatePos);\n // listen on capture to catch scrolls from ancestor elements as well\n window.addEventListener(\"scroll\", updatePos, true);\n\n let ro: ResizeObserver | null = null;\n if (typeof ResizeObserver !== \"undefined\" && divHandlderRef.current) {\n ro = new ResizeObserver(() => updatePos());\n ro.observe(divHandlderRef.current);\n }\n\n return () => {\n window.removeEventListener(\"resize\", updatePos);\n window.removeEventListener(\"scroll\", updatePos, true);\n if (ro) ro.disconnect();\n };\n }\n }, [mouseOverHandlerDiv, menuInDom]);\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n };\n }, [handleClick, menuVisible]);\n\n const removeController = useRef<AbortController>(new AbortController());\n useEffect(() => {\n if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setTimeout(() => {\n if (!removeController.current.signal.aborted) setMenuInDom(false);\n }, 300);\n }\n }, [mouseOverHandlerDiv, menuVisible, mouseOverMenu]);\n\n return (\n <ContentMenuHandlerContext.Provider\n value={{\n menuItems: thisMenuItems,\n }}\n >\n <div\n ref={divHandlderRef}\n {...rest}\n className={[styles.contextMenuHandler, rest.className].join(\" \")}\n onContextMenu={async (e) => {\n if (!showLowMenu) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n removeController.current.abort();\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n }\n }}\n onMouseEnter={async (e) => {\n if (showLowMenu) {\n setMenuInDom(true);\n setMouseOverHandlerDiv(false);\n setTimeout(() => {\n removeController.current.abort();\n setMouseOverHandlerDiv(true);\n }, 1);\n }\n rest.onMouseEnter?.(e);\n }}\n onMouseLeave={async (e) => {\n if (showLowMenu) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverHandlerDiv(false);\n }\n rest.onMouseLeave?.(e);\n }}\n >\n {children}\n </div>\n {menuInDom &&\n divHandlerPos &&\n createPortal(\n <div\n className={styles.anchor}\n onMouseEnter={() => {\n removeController.current.abort();\n setMouseOverMenu(true);\n }}\n onMouseLeave={() => {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverMenu(false);\n }}\n >\n {showLowMenu ? (\n <LowMenu\n visible={mouseOverHandlerDiv}\n entries={menuItems}\n xPos={divHandlerPos.left}\n yPos={divHandlerPos.bottom}\n maxWidth={divHandlerPos.width}\n />\n ) : (\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={thisMenuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMouseOverMenu(false);\n }}\n />\n )}\n </div>,\n document.body,\n )}\n </ContentMenuHandlerContext.Provider>\n );\n};\n\nContextMenuHandler.displayName = \"ContextMenuHandler\";\n","import styles from \"./LowMenu.module.css\";\nimport { LowMenuButton } from \"./LowMenuButton\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: IMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({\n entries,\n visible,\n xPos,\n yPos,\n maxWidth,\n}: LowMenuProps): React.ReactElement => {\n // Only show the low menu if it is on the screen\n if (xPos >= window.innerWidth || yPos >= window.innerHeight) return <></>;\n // Show the menu\n return (\n <div\n className={[styles.lowMenu, visible ? styles.visible : styles.hidden].join(\" \")}\n aria-label=\"Low context menu\"\n style={{\n left: `${xPos}px`,\n top: `${yPos}px`,\n maxWidth: `calc(${maxWidth}px)`,\n width: `calc(${maxWidth}px - 4px)`,\n }}\n >\n <div className={styles.lowMenuButtonHolder}>\n {entries.map((e, i) => (\n <LowMenuButton\n key={i}\n entry={e}\n />\n ))}\n </div>\n </div>\n );\n};\n\nLowMenu.displayName = \"LowMenu\";\n",".lowMenu {\n z-index: 2;\n position: absolute;\n margin: 0px;\n transition: opacity 0.3s linear;\n}\n\n.lowMenuButtonHolder {\n border: 2px solid rgb(17, 20, 24);\n border-top-right-radius: 4px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background-color: rgb(17, 20, 24);\n box-shadow: 2px 2px 2px rgb(64, 64, 64, 0.5);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n gap: 2px;\n row-gap: 2px;\n width: fit-content;\n}\n\n.lowMenu.hidden {\n opacity: 0;\n}\n\n.lowMenu.visible,\n.lowMenu:hover {\n opacity: 1;\n}\n\n.lowMenuItem {\n background-color: rgb(251, 253, 246);\n border: 0;\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.lowMenuItem.disabled {\n background-color: rgba(200, 200, 200);\n cursor: not-allowed;\n}\n\n.lowMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.lowMenu-item .caretHolder {\n align-self: flex-end;\n}\n\n.lowMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n","import { useState } from \"react\";\nimport styles from \"./LowMenu.module.css\";\nimport { LowSubMenu } from \"./LowSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: IMenuItem;\n}\nexport const LowMenuButton = ({ entry }: LowMenuButtonProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.lowMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n aria-label={typeof entry.label === \"string\" ? entry.label : undefined}\n aria-disabled={entry.disabled}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) entry.action?.(target);\n }}\n >\n <span>{entry.label}</span>\n {entry.group && <LowSubMenu entry={entry} />}\n </div>\n );\n};\n\nLowMenuButton.displayName = \"LowMenuButton\";\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./LowMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: IMenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import { ReactNode, useEffect, useRef, useState, useTransition } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\nexport interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = ({\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n}: ContextWindowProps): React.ReactElement => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Track internal state: whether window is in DOM and whether it's been positioned\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [, startTransition] = useTransition();\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = (x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const checkPosition = () => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n };\n\n const mouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n };\n\n // Store stable references to mouseMove and mouseUp for cleanup\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n };\n\n // Update refs when callbacks change\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n });\n\n // Helper function to push this window to the top\n const pushToTop = () => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n };\n\n // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings\n // This effect derives state from props, which is acceptable when there's no synchronous setState\n useEffect(() => {\n if (visible && !windowInDOM) {\n // Window should be in DOM when visible becomes true\n startTransition(() => {\n setWindowInDOM(true);\n });\n } else if (!visible && windowInDOM) {\n // Window should leave DOM when visible becomes false\n startTransition(() => {\n setWindowInDOM(false);\n setWindowVisible(false);\n });\n }\n }, [visible, windowInDOM, startTransition]);\n\n // Position and show window after it's added to DOM\n useEffect(() => {\n if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {\n // Position the window\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n checkPosition();\n\n // Update z-index and make visible - use startTransition\n const maxZ = getMaxZIndex(minZIndex);\n onOpen?.();\n startTransition(() => {\n setZIndex(maxZ + 1);\n setWindowVisible(true);\n });\n }\n }, [windowInDOM, windowVisible, visible, checkPosition, minZIndex, onOpen, startTransition]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUpRef.current);\n document.addEventListener(\"mousemove\", mouseMoveRef.current);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement | null>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asup/context-menu",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "REACT Typescript Context menu component",
|
|
5
5
|
"author": "Paul Thomas <@PaulDThomas>",
|
|
6
6
|
"private": false,
|
|
@@ -38,65 +38,73 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"prepare": "husky",
|
|
41
|
-
"start": "rmdir /q/s .\\.parcel-cache && parcel demo/index.html --dist-dir demo/dist",
|
|
42
41
|
"test": "jest --collectCoverage=true",
|
|
43
42
|
"test-watch": "jest --watch --collectCoverage=true --maxWorkers=4",
|
|
44
|
-
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"
|
|
45
|
-
"build": "rmdir /q/s .\\.parcel-cache && parcel build src/main.ts"
|
|
43
|
+
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
44
|
+
"build": "rmdir /q/s .\\.parcel-cache && parcel build src/main.ts",
|
|
45
|
+
"storybook": "storybook dev -p 6006",
|
|
46
|
+
"build-storybook": "storybook build"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@swc/helpers": "^0.5.
|
|
49
|
-
"react": "^
|
|
50
|
-
"react-dom": "^
|
|
49
|
+
"@swc/helpers": "^0.5.18",
|
|
50
|
+
"react": "^19.0.0",
|
|
51
|
+
"react-dom": "^19.0.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
54
|
+
"react": "^19.0.0",
|
|
55
|
+
"react-dom": "^19.0.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@eslint/
|
|
58
|
+
"@chromatic-com/storybook": "^5.0.0",
|
|
59
|
+
"@eslint/compat": "^2.0.0",
|
|
60
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
59
61
|
"@eslint/js": "^9.28.0",
|
|
60
62
|
"@parcel/packager-raw-url": "^2.7.0",
|
|
61
63
|
"@parcel/packager-ts": "^2.8.3",
|
|
62
64
|
"@parcel/transformer-typescript-types": "^2.8.0",
|
|
63
65
|
"@parcel/transformer-webmanifest": "^2.7.0",
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
66
|
+
"@storybook/addon-a11y": "^10.1.11",
|
|
67
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
68
|
+
"@storybook/addon-onboarding": "^10.1.11",
|
|
69
|
+
"@storybook/addon-vitest": "^10.1.11",
|
|
70
|
+
"@storybook/react-vite": "^10.1.11",
|
|
68
71
|
"@testing-library/jest-dom": "^6.4.2",
|
|
69
72
|
"@testing-library/react": "^16.0.0",
|
|
70
73
|
"@testing-library/user-event": "^14.4.3",
|
|
71
74
|
"@types/jest": "^30.0.0",
|
|
72
|
-
"@types/node": "^
|
|
73
|
-
"@types/react": "^
|
|
74
|
-
"@types/react-dom": "^
|
|
75
|
+
"@types/node": "^24.10.1",
|
|
76
|
+
"@types/react": "^19.0.0",
|
|
77
|
+
"@types/react-dom": "^19.0.0",
|
|
75
78
|
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
76
79
|
"@typescript-eslint/parser": "^8.34.0",
|
|
80
|
+
"@vitest/browser-playwright": "^4.0.14",
|
|
81
|
+
"@vitest/coverage-v8": "^4.0.14",
|
|
77
82
|
"eslint": "^9.28.0",
|
|
78
83
|
"eslint-config-prettier": "^10.1.5",
|
|
79
|
-
"eslint-plugin-jest": "^
|
|
84
|
+
"eslint-plugin-jest": "^29.1.0",
|
|
80
85
|
"eslint-plugin-prettier": "^5.1.3",
|
|
81
86
|
"eslint-plugin-react": "^7.31.10",
|
|
82
|
-
"eslint-plugin-react-hooks": "^
|
|
87
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
88
|
+
"eslint-plugin-storybook": "10.1.11",
|
|
83
89
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
84
90
|
"husky": "^9.0.11",
|
|
85
91
|
"jest": "^30.2.0",
|
|
86
92
|
"jest-environment-jsdom": "^30.2.0",
|
|
87
93
|
"jest-watch-typeahead": "^3.0.1",
|
|
88
|
-
"lint-staged": "^16.
|
|
94
|
+
"lint-staged": "^16.2.7",
|
|
89
95
|
"parcel": "^2.7.0",
|
|
96
|
+
"playwright": "^1.57.0",
|
|
90
97
|
"prettier": "^3.2.5",
|
|
91
98
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
92
99
|
"process": "^0.11.10",
|
|
93
|
-
"
|
|
100
|
+
"storybook": "^10.1.11",
|
|
94
101
|
"ts-jest": "^29.4.5",
|
|
95
102
|
"ts-jest-mock-import-meta": "^1.2.0",
|
|
96
103
|
"ts-node": "^10.9.1",
|
|
97
104
|
"typescript": "^5.0.4",
|
|
98
105
|
"typescript-eslint": "^8.34.0",
|
|
99
|
-
"typescript-plugin-css-modules": "^5.1.0"
|
|
106
|
+
"typescript-plugin-css-modules": "^5.1.0",
|
|
107
|
+
"vitest": "^4.0.14"
|
|
100
108
|
},
|
|
101
109
|
"@parcel/transformer-css": {
|
|
102
110
|
"cssModules": {
|