@asup/context-menu 1.5.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -3,7 +3,7 @@ import {_ as $duWW8$_} from "@swc/helpers/_/_object_spread";
3
3
  import {_ as $duWW8$_1} from "@swc/helpers/_/_object_spread_props";
4
4
  import {_ as $duWW8$_2} from "@swc/helpers/_/_object_without_properties";
5
5
  import {jsx as $duWW8$jsx, jsxs as $duWW8$jsxs, Fragment as $duWW8$Fragment} from "react/jsx-runtime";
6
- import {useRef as $duWW8$useRef, useState as $duWW8$useState, useMemo as $duWW8$useMemo, useCallback as $duWW8$useCallback, useEffect as $duWW8$useEffect, useLayoutEffect as $duWW8$useLayoutEffect, forwardRef as $duWW8$forwardRef, createContext as $duWW8$createContext, useContext as $duWW8$useContext} from "react";
6
+ import {useRef as $duWW8$useRef, useState as $duWW8$useState, useMemo as $duWW8$useMemo, useCallback as $duWW8$useCallback, useEffect as $duWW8$useEffect, useTransition as $duWW8$useTransition, forwardRef as $duWW8$forwardRef, useLayoutEffect as $duWW8$useLayoutEffect, createContext as $duWW8$createContext, useContext as $duWW8$useContext} from "react";
7
7
  import {createPortal as $duWW8$createPortal} from "react-dom";
8
8
 
9
9
 
@@ -23,7 +23,6 @@ $parcel$export($b65191f6d0a0a991$exports, "ClickForMenu", function () { return $
23
23
  $parcel$export($b65191f6d0a0a991$exports, "ContextMenu", function () { return $567ed433af94513f$export$8dc6765e8be191c7; });
24
24
  $parcel$export($b65191f6d0a0a991$exports, "ContextMenuHandler", function () { return $1e1c1e9e0b943830$export$ed4f9641643dc7e4; });
25
25
  $parcel$export($b65191f6d0a0a991$exports, "ContextWindow", function () { return $b5e8657823def5be$export$1af8984c69ba1b24; });
26
- $parcel$export($b65191f6d0a0a991$exports, "ContextWindowStack", function () { return $17c46b9e6a2eb66e$export$9f37482ccd50dad2; });
27
26
 
28
27
 
29
28
 
@@ -81,11 +80,16 @@ function $62873e7e5aeec7f1$export$77bf000da9303d1(_param) {
81
80
  setTargetHeight
82
81
  ]);
83
82
  // Trigger height change on children update
84
- (0, $duWW8$useLayoutEffect)(()=>{
85
- setTargetHeight();
83
+ const [, startTransition] = (0, $duWW8$useTransition)();
84
+ (0, $duWW8$useEffect)(()=>{
85
+ // Mark this update as non-urgent to avoid cascading render warnings
86
+ startTransition(()=>{
87
+ setTargetHeight();
88
+ });
86
89
  }, [
87
90
  setTargetHeight,
88
- children
91
+ children,
92
+ startTransition
89
93
  ]);
90
94
  return /*#__PURE__*/ (0, $duWW8$jsx)("div", (0, $duWW8$_1)((0, $duWW8$_)({}, rest), {
91
95
  className: (0, (/*@__PURE__*/$parcel$interopDefault($181673e3e0e596f3$exports))).autoHeightWrapper,
@@ -230,13 +234,25 @@ const $567ed433af94513f$var$ESTIMATED_MENU_ITEM_HEIGHT = 34;
230
234
  const $567ed433af94513f$var$ESTIMATED_MENU_PADDING = 4;
231
235
  const $567ed433af94513f$var$ESTIMATED_MENU_WIDTH = 200;
232
236
  const $567ed433af94513f$export$8dc6765e8be191c7 = /*#__PURE__*/ (0, $duWW8$forwardRef)(({ visible: visible, entries: entries, xPos: xPos, yPos: yPos, toClose: toClose }, ref)=>{
233
- // Check that menu can fit inside the window
234
- let menuHeight = entries.length * $567ed433af94513f$var$ESTIMATED_MENU_ITEM_HEIGHT + $567ed433af94513f$var$ESTIMATED_MENU_PADDING;
235
- let menuWidth = $567ed433af94513f$var$ESTIMATED_MENU_WIDTH;
236
- if (ref && typeof ref !== "function" && ref.current instanceof HTMLDivElement) {
237
- menuHeight = ref.current.offsetHeight;
238
- menuWidth = ref.current.offsetWidth;
239
- }
237
+ // Measure menu size after mount/render to avoid accessing refs during render
238
+ const [menuHeight, setMenuHeight] = (0, $duWW8$useState)(entries.length * $567ed433af94513f$var$ESTIMATED_MENU_ITEM_HEIGHT + $567ed433af94513f$var$ESTIMATED_MENU_PADDING);
239
+ const [menuWidth, setMenuWidth] = (0, $duWW8$useState)($567ed433af94513f$var$ESTIMATED_MENU_WIDTH);
240
+ (0, $duWW8$useLayoutEffect)(()=>{
241
+ // Only measure when visible; ref access inside effect is allowed
242
+ if (visible && ref && typeof ref !== "function" && ref.current instanceof HTMLDivElement) {
243
+ setMenuHeight(ref.current.offsetHeight);
244
+ setMenuWidth(ref.current.offsetWidth);
245
+ }
246
+ // When not visible, fall back to estimates
247
+ if (!visible) {
248
+ setMenuHeight(entries.length * $567ed433af94513f$var$ESTIMATED_MENU_ITEM_HEIGHT + $567ed433af94513f$var$ESTIMATED_MENU_PADDING);
249
+ setMenuWidth($567ed433af94513f$var$ESTIMATED_MENU_WIDTH);
250
+ }
251
+ }, [
252
+ visible,
253
+ entries,
254
+ ref
255
+ ]);
240
256
  const adjustedYPos = yPos + menuHeight > window.innerHeight ? Math.max(window.innerHeight - menuHeight - $567ed433af94513f$var$ESTIMATED_MENU_PADDING, 0) : yPos;
241
257
  const adjustedXPos = xPos + menuWidth > window.innerWidth ? Math.max(window.innerWidth - menuWidth - $567ed433af94513f$var$ESTIMATED_MENU_PADDING, 0) : xPos;
242
258
  return /*#__PURE__*/ (0, $duWW8$jsx)("div", {
@@ -514,7 +530,6 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = (_param)=>{
514
530
  "menuItems",
515
531
  "showLowMenu"
516
532
  ]);
517
- var _divHandlderRef_current;
518
533
  // Check for higher content menu
519
534
  const higherContext = (0, $duWW8$useContext)($1e1c1e9e0b943830$export$fc58dc71afe92de2);
520
535
  const thisMenuItems = (0, $duWW8$useMemo)(()=>[
@@ -547,9 +562,34 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = (_param)=>{
547
562
  const [menuInDom, setMenuInDom] = (0, $duWW8$useState)(false);
548
563
  const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = (0, $duWW8$useState)(false);
549
564
  const [mouseOverMenu, setMouseOverMenu] = (0, $duWW8$useState)(false);
550
- var _divHandlderRef_current_getBoundingClientRect;
551
- // Get holder position
552
- const divHandlerPos = (_divHandlderRef_current_getBoundingClientRect = (_divHandlderRef_current = divHandlderRef.current) === null || _divHandlderRef_current === void 0 ? void 0 : _divHandlderRef_current.getBoundingClientRect()) !== null && _divHandlderRef_current_getBoundingClientRect !== void 0 ? _divHandlderRef_current_getBoundingClientRect : null;
565
+ // Holder position - measured in an effect to avoid reading refs during render
566
+ const [divHandlerPos, setDivHandlerPos] = (0, $duWW8$useState)(null);
567
+ (0, $duWW8$useLayoutEffect)(()=>{
568
+ function updatePos() {
569
+ if (divHandlderRef.current) setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());
570
+ }
571
+ // When the handler is hovered or the menu is mounted, ensure we have a fresh position
572
+ if (mouseOverHandlerDiv || menuInDom) updatePos();
573
+ // Attach listeners while the menu/low-menu may be visible so the position stays correct
574
+ if (mouseOverHandlerDiv || menuInDom) {
575
+ window.addEventListener("resize", updatePos);
576
+ // listen on capture to catch scrolls from ancestor elements as well
577
+ window.addEventListener("scroll", updatePos, true);
578
+ let ro = null;
579
+ if (typeof ResizeObserver !== "undefined" && divHandlderRef.current) {
580
+ ro = new ResizeObserver(()=>updatePos());
581
+ ro.observe(divHandlderRef.current);
582
+ }
583
+ return ()=>{
584
+ window.removeEventListener("resize", updatePos);
585
+ window.removeEventListener("scroll", updatePos, true);
586
+ if (ro) ro.disconnect();
587
+ };
588
+ }
589
+ }, [
590
+ mouseOverHandlerDiv,
591
+ menuInDom
592
+ ]);
553
593
  // Handle click off the menu
554
594
  const handleClick = (0, $duWW8$useCallback)((e)=>{
555
595
  var _menuRef_current;
@@ -744,10 +784,12 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
744
784
  var _rest_style, _rest_style1, _rest_style2, _rest_style3;
745
785
  const divRef = (0, $duWW8$useRef)(null);
746
786
  const windowRef = (0, $duWW8$useRef)(null);
747
- const [windowInDOM, setWindowInDOM] = (0, $duWW8$useState)(false);
748
- const [windowVisible, setWindowVisible] = (0, $duWW8$useState)(false);
749
787
  const [zIndex, setZIndex] = (0, $duWW8$useState)(minZIndex);
750
788
  const resizeListenerRef = (0, $duWW8$useRef)(null);
789
+ // Track internal state: whether window is in DOM and whether it's been positioned
790
+ const [windowInDOM, setWindowInDOM] = (0, $duWW8$useState)(false);
791
+ const [windowVisible, setWindowVisible] = (0, $duWW8$useState)(false);
792
+ const [, startTransition] = (0, $duWW8$useTransition)();
751
793
  // Position
752
794
  const windowPos = (0, $duWW8$useRef)({
753
795
  x: 0,
@@ -809,37 +851,54 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
809
851
  }, [
810
852
  minZIndex
811
853
  ]);
812
- // Update visibility
854
+ // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings
855
+ // This effect derives state from props, which is acceptable when there's no synchronous setState
813
856
  (0, $duWW8$useEffect)(()=>{
814
- // Visible set, but not in DOM
815
- if (visible && !windowInDOM) setWindowInDOM(true);
816
- else if (visible && windowInDOM && !windowVisible) {
817
- pushToTop();
818
- setWindowVisible(visible);
819
- onOpen === null || onOpen === void 0 ? void 0 : onOpen();
820
- // Get starting position
821
- if (divRef.current && windowRef.current) {
822
- const parentPos = divRef.current.getBoundingClientRect();
823
- const pos = windowRef.current.getBoundingClientRect();
824
- const windowHeight = pos.bottom - pos.top;
825
- windowRef.current.style.left = `${parentPos.left}px`;
826
- windowRef.current.style.top = `${parentPos.bottom + windowHeight < window.innerHeight ? parentPos.bottom : Math.max(0, parentPos.top - windowHeight)}px`;
827
- windowRef.current.style.transform = "";
828
- windowPos.current = {
829
- x: 0,
830
- y: 0
831
- };
832
- }
857
+ if (visible && !windowInDOM) // Window should be in DOM when visible becomes true
858
+ startTransition(()=>{
859
+ setWindowInDOM(true);
860
+ });
861
+ else if (!visible && windowInDOM) // Window should leave DOM when visible becomes false
862
+ startTransition(()=>{
863
+ setWindowInDOM(false);
864
+ setWindowVisible(false);
865
+ });
866
+ }, [
867
+ visible,
868
+ windowInDOM,
869
+ startTransition
870
+ ]);
871
+ // Position and show window after it's added to DOM
872
+ (0, $duWW8$useEffect)(()=>{
873
+ if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {
874
+ // Position the window
875
+ const parentPos = divRef.current.getBoundingClientRect();
876
+ const pos = windowRef.current.getBoundingClientRect();
877
+ const windowHeight = pos.bottom - pos.top;
878
+ windowRef.current.style.left = `${parentPos.left}px`;
879
+ windowRef.current.style.top = `${parentPos.bottom + windowHeight < window.innerHeight ? parentPos.bottom : Math.max(0, parentPos.top - windowHeight)}px`;
880
+ windowRef.current.style.transform = "";
881
+ windowPos.current = {
882
+ x: 0,
883
+ y: 0
884
+ };
833
885
  checkPosition();
834
- } else if (!visible && windowVisible) setWindowVisible(false);
835
- else if (!visible && windowInDOM) setWindowInDOM(false);
886
+ // Update z-index and make visible - use startTransition
887
+ const maxZ = $b5e8657823def5be$var$getMaxZIndex(minZIndex);
888
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
889
+ startTransition(()=>{
890
+ setZIndex(maxZ + 1);
891
+ setWindowVisible(true);
892
+ });
893
+ }
836
894
  }, [
895
+ windowInDOM,
896
+ windowVisible,
897
+ visible,
837
898
  checkPosition,
899
+ minZIndex,
838
900
  onOpen,
839
- pushToTop,
840
- visible,
841
- windowInDOM,
842
- windowVisible
901
+ startTransition
843
902
  ]);
844
903
  // Cleanup effect to remove event listeners on unmount
845
904
  (0, $duWW8$useEffect)(()=>{
@@ -935,40 +994,7 @@ $b5e8657823def5be$export$1af8984c69ba1b24.displayName = "ContextWindow";
935
994
 
936
995
 
937
996
 
938
- const $17c46b9e6a2eb66e$var$SESSION_KEY = "context-menu.ContextWindowStack.rendered";
939
- const $17c46b9e6a2eb66e$export$9f37482ccd50dad2 = ({ children: children })=>{
940
- (0, $duWW8$useEffect)(()=>{
941
- const doWarn = ()=>console.warn("ContextWindowStack is deprecated and no longer required. ContextWindow now manages z-index automatically. Please remove the ContextWindowStack wrapper from your code.");
942
- try {
943
- // Prefer sessionStorage so the warning lasts for the browser session.
944
- if (typeof window !== "undefined" && window.sessionStorage) {
945
- const already = window.sessionStorage.getItem($17c46b9e6a2eb66e$var$SESSION_KEY);
946
- if (!already) {
947
- window.sessionStorage.setItem($17c46b9e6a2eb66e$var$SESSION_KEY, "1");
948
- doWarn();
949
- }
950
- return;
951
- }
952
- } catch (e) {
953
- // sessionStorage may be unavailable (privacy mode). Fall through to global fallback.
954
- }
955
- // Fallback: use a global flag for environments where sessionStorage isn't available.
956
- const g = globalThis;
957
- if (!g.__ContextWindowStackRendered) {
958
- g.__ContextWindowStackRendered = true;
959
- doWarn();
960
- }
961
- }, []);
962
- return /*#__PURE__*/ (0, $duWW8$jsx)((0, $duWW8$Fragment), {
963
- children: children
964
- });
965
- };
966
- $17c46b9e6a2eb66e$export$9f37482ccd50dad2.displayName = "ContextWindowStack";
967
-
968
-
969
-
970
-
971
997
 
972
998
 
973
- export {$62873e7e5aeec7f1$export$77bf000da9303d1 as AutoHeight, $c3e82278b501f10c$export$d4ebdd58e04c6ace as ClickForMenu, $567ed433af94513f$export$8dc6765e8be191c7 as ContextMenu, $1e1c1e9e0b943830$export$ed4f9641643dc7e4 as ContextMenuHandler, $b5e8657823def5be$export$1af8984c69ba1b24 as ContextWindow, $17c46b9e6a2eb66e$export$9f37482ccd50dad2 as ContextWindowStack};
999
+ export {$62873e7e5aeec7f1$export$77bf000da9303d1 as AutoHeight, $c3e82278b501f10c$export$d4ebdd58e04c6ace as ClickForMenu, $567ed433af94513f$export$8dc6765e8be191c7 as ContextMenu, $1e1c1e9e0b943830$export$ed4f9641643dc7e4 as ContextMenuHandler, $b5e8657823def5be$export$1af8984c69ba1b24 as ContextWindow};
974
1000
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC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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;;;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,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AEN,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;","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 { useCallback, useEffect, useMemo, useRef, useState, useTransition } 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): React.ReactElement {\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 const [, startTransition] = useTransition();\n\n useEffect(() => {\n // Mark this update as non-urgent to avoid cascading render warnings\n startTransition(() => {\n setTargetHeight();\n });\n }, [setTargetHeight, children, startTransition]);\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 { 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 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 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 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 { 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 = 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 // 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: 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 { 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, useCallback, 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 = 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 // 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"}