@asup/context-menu 2.0.0 → 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 CHANGED
@@ -84,7 +84,7 @@ import { AutoHeight } from "@asup/context-menu";
84
84
 
85
85
  ### ClickForMenu
86
86
 
87
- `ClickForMenu` attaches a click-based menu to any element (useful for toolbar buttons or inline actions).
87
+ `ClickForMenu` attaches a click-based menu to any element (useful for toolbar buttons or inline actions). Give each instance a stable `id` so the trigger element can be referenced and cleaned up correctly.
88
88
 
89
89
  ```tsx
90
90
  import { ClickForMenu, IMenuItem } from "@asup/context-menu";
@@ -94,7 +94,10 @@ const clickItems: IMenuItem[] = [
94
94
  { label: "Delete", action: () => console.log("Delete") },
95
95
  ];
96
96
 
97
- <ClickForMenu menuItems={clickItems}>
97
+ <ClickForMenu
98
+ id="actions-menu"
99
+ menuItems={clickItems}
100
+ >
98
101
  <button type="button">Actions</button>
99
102
  </ClickForMenu>;
100
103
  ```
package/dist/cjs/main.js CHANGED
@@ -56,7 +56,7 @@ $796f463330153c24$export$563bd8f955c52746 = `aiw-AutoHeight-module-pDlSVW-autoHe
56
56
 
57
57
 
58
58
  function $95149596d5a7ed2b$export$77bf000da9303d1(_param) {
59
- var { children: children, hide: hide, duration: duration = 300 } = _param, rest = (0, $gTuX4$swchelperscjs_object_without_propertiescjs._)(_param, [
59
+ var { children: children, hide: hide = false, duration: duration = 300 } = _param, rest = (0, $gTuX4$swchelperscjs_object_without_propertiescjs._)(_param, [
60
60
  "children",
61
61
  "hide",
62
62
  "duration"
@@ -64,29 +64,63 @@ function $95149596d5a7ed2b$export$77bf000da9303d1(_param) {
64
64
  const wrapperRef = (0, $gTuX4$react.useRef)(null);
65
65
  const innerRef = (0, $gTuX4$react.useRef)(null);
66
66
  const [height, setHeight] = (0, $gTuX4$react.useState)(null);
67
- const targetChildren = (0, $gTuX4$react.useMemo)(()=>hide || !children ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
68
- style: {
69
- height: "1px"
70
- }
71
- }) : children, [
72
- children,
73
- hide
74
- ]);
75
- const setTargetHeight = (0, $gTuX4$react.useCallback)(()=>{
76
- const inner = innerRef.current;
77
- var _inner_offsetHeight;
78
- // Initial draw to get the height of children and deployed children
79
- const deployedHeight = hide ? 1 : (_inner_offsetHeight = inner === null || inner === void 0 ? void 0 : inner.offsetHeight) !== null && _inner_offsetHeight !== void 0 ? _inner_offsetHeight : 0;
80
- setHeight(deployedHeight);
67
+ const [animationState, setAnimationState] = (0, $gTuX4$react.useState)(!hide ? "open" : "closed");
68
+ const rafRef = (0, $gTuX4$react.useRef)(null);
69
+ const timeoutRef = (0, $gTuX4$react.useRef)(null);
70
+ const targetChildren = animationState === "closed" || !children ? null : children;
71
+ const setTargetHeight = (0, $gTuX4$react.useEffectEvent)((newHeight)=>{
72
+ setHeight(newHeight);
73
+ });
74
+ const transitionToOpening = (0, $gTuX4$react.useEffectEvent)(()=>{
75
+ // Cancel any pending close timeout
76
+ if (timeoutRef.current !== null) {
77
+ clearTimeout(timeoutRef.current);
78
+ timeoutRef.current = null;
79
+ }
80
+ setAnimationState("opening");
81
+ const id = window.requestAnimationFrame(()=>{
82
+ rafRef.current = null;
83
+ setTargetHeight(1);
84
+ const frameId = window.requestAnimationFrame(()=>{
85
+ const inner = innerRef.current;
86
+ if (inner) {
87
+ setTargetHeight(inner.offsetHeight);
88
+ setAnimationState("open");
89
+ }
90
+ });
91
+ rafRef.current = frameId;
92
+ });
93
+ rafRef.current = id;
94
+ });
95
+ const transitionToClosing = (0, $gTuX4$react.useEffectEvent)(()=>{
96
+ // Cancel any pending RAF
97
+ if (rafRef.current !== null) {
98
+ cancelAnimationFrame(rafRef.current);
99
+ rafRef.current = null;
100
+ }
101
+ setAnimationState("closing");
102
+ setTargetHeight(1);
103
+ timeoutRef.current = window.setTimeout(()=>{
104
+ timeoutRef.current = null;
105
+ setAnimationState("closed");
106
+ }, duration);
107
+ });
108
+ (0, $gTuX4$react.useLayoutEffect)(()=>{
109
+ if (!hide) // Want to show: transition to open
110
+ {
111
+ if (animationState === "closed" || animationState === "closing") transitionToOpening();
112
+ } else // Want to hide: transition to closed
113
+ if (animationState === "open" || animationState === "opening") transitionToClosing();
81
114
  }, [
82
- hide
115
+ hide,
116
+ animationState
83
117
  ]);
84
- // Add ResizeObserver to update height on content resize, debounced
118
+ // Setup ResizeObserver to track content size changes
85
119
  (0, $gTuX4$react.useEffect)(()=>{
86
120
  const transition = innerRef.current;
87
121
  if (transition) {
88
122
  const observer = new ResizeObserver(()=>{
89
- setTargetHeight();
123
+ if (animationState === "open") setTargetHeight(transition.offsetHeight);
90
124
  });
91
125
  observer.observe(transition);
92
126
  return ()=>{
@@ -94,24 +128,26 @@ function $95149596d5a7ed2b$export$77bf000da9303d1(_param) {
94
128
  };
95
129
  }
96
130
  }, [
97
- setTargetHeight
131
+ animationState
98
132
  ]);
99
- // Trigger height change on children update
100
- const [, startTransition] = (0, $gTuX4$react.useTransition)();
133
+ // Cleanup on unmount
101
134
  (0, $gTuX4$react.useEffect)(()=>{
102
- // Mark this update as non-urgent to avoid cascading render warnings
103
- startTransition(()=>{
104
- setTargetHeight();
105
- });
106
- }, [
107
- setTargetHeight,
108
- children,
109
- startTransition
110
- ]);
135
+ return ()=>{
136
+ if (rafRef.current !== null) {
137
+ cancelAnimationFrame(rafRef.current);
138
+ rafRef.current = null;
139
+ }
140
+ if (timeoutRef.current !== null) {
141
+ clearTimeout(timeoutRef.current);
142
+ timeoutRef.current = null;
143
+ }
144
+ };
145
+ }, []);
111
146
  return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", (0, $gTuX4$swchelperscjs_object_spread_propscjs._)((0, $gTuX4$swchelperscjs_object_spreadcjs._)({}, rest), {
112
147
  className: (0, (/*@__PURE__*/$parcel$interopDefault($796f463330153c24$exports))).autoHeightWrapper,
113
148
  ref: wrapperRef,
114
149
  style: (0, $gTuX4$swchelperscjs_object_spread_propscjs._)((0, $gTuX4$swchelperscjs_object_spreadcjs._)({}, rest.style), {
150
+ display: animationState === "closed" ? "none" : undefined,
115
151
  height: height ? `${height}px` : "auto",
116
152
  transitionDuration: `${duration}ms`
117
153
  }),
@@ -310,9 +346,10 @@ const $a79b75d040e03c92$export$d4ebdd58e04c6ace = (_param)=>{
310
346
  // Set up outsideClick handler
311
347
  const menuRef = (0, $gTuX4$react.useRef)(null);
312
348
  // Handle click off the menu
313
- const handleClick = (0, $gTuX4$react.useCallback)((e)=>{
349
+ // eslint-disable-next-line react-hooks/exhaustive-deps
350
+ const handleClick = (e)=>{
314
351
  if (menuRef.current && (e.target instanceof Element && !menuRef.current.contains(e.target) || !(e.target instanceof Element))) setMenuInDom(false);
315
- }, []);
352
+ };
316
353
  const removeController = (0, $gTuX4$react.useRef)(null);
317
354
  const removeTimeoutRef = (0, $gTuX4$react.useRef)(null);
318
355
  (0, $gTuX4$react.useEffect)(()=>{
@@ -549,27 +586,24 @@ const $3c568ee547c732c3$export$ed4f9641643dc7e4 = (_param)=>{
549
586
  ]);
550
587
  // Check for higher content menu
551
588
  const higherContext = (0, $gTuX4$react.useContext)($3c568ee547c732c3$export$fc58dc71afe92de2);
552
- const thisMenuItems = (0, $gTuX4$react.useMemo)(()=>[
553
- ...higherContext !== null ? [
554
- ...higherContext.menuItems,
555
- ...[
556
- higherContext.menuItems.length > 0 && !$3c568ee547c732c3$var$isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) && menuItems.length > 0 && !$3c568ee547c732c3$var$isDivider(menuItems[0].label) ? {
557
- label: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("hr", {
558
- style: {
559
- flexGrow: 1,
560
- cursor: "none",
561
- margin: "0",
562
- padding: "0"
563
- }
564
- })
565
- } : null
566
- ].filter((item)=>item !== null)
567
- ] : [],
568
- ...menuItems
569
- ], [
570
- higherContext,
571
- menuItems
572
- ]);
589
+ const thisMenuItems = [
590
+ ...higherContext !== null ? [
591
+ ...higherContext.menuItems,
592
+ ...[
593
+ higherContext.menuItems.length > 0 && !$3c568ee547c732c3$var$isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) && menuItems.length > 0 && !$3c568ee547c732c3$var$isDivider(menuItems[0].label) ? {
594
+ label: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("hr", {
595
+ style: {
596
+ flexGrow: 1,
597
+ cursor: "none",
598
+ margin: "0",
599
+ padding: "0"
600
+ }
601
+ })
602
+ } : null
603
+ ].filter((item)=>item !== null)
604
+ ] : [],
605
+ ...menuItems
606
+ ];
573
607
  // Menu resources
574
608
  const divHandlderRef = (0, $gTuX4$react.useRef)(null);
575
609
  const menuRef = (0, $gTuX4$react.useRef)(null);
@@ -813,7 +847,7 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
813
847
  y: 0
814
848
  });
815
849
  const [moving, setMoving] = (0, $gTuX4$react.useState)(false);
816
- const move = (0, $gTuX4$react.useCallback)((x, y)=>{
850
+ const move = (x, y)=>{
817
851
  if (windowRef.current && windowPos.current) {
818
852
  const window1 = windowRef.current;
819
853
  const pos = windowPos.current;
@@ -821,24 +855,21 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
821
855
  pos.y += y;
822
856
  window1.style.transform = `translate(${pos.x}px, ${pos.y}px)`;
823
857
  }
824
- }, []);
825
- const checkPosition = (0, $gTuX4$react.useCallback)(()=>{
858
+ };
859
+ // eslint-disable-next-line react-hooks/exhaustive-deps
860
+ const checkPosition = ()=>{
826
861
  const chkPos = (0, $c986bcdcae4b83bd$export$d81cfea7c54be196)(windowRef);
827
862
  move(chkPos.translateX, chkPos.translateY);
828
- }, [
829
- move
830
- ]);
831
- const mouseMove = (0, $gTuX4$react.useCallback)((e)=>{
863
+ };
864
+ const mouseMove = (e)=>{
832
865
  e.preventDefault();
833
866
  e.stopPropagation();
834
867
  move(e.movementX, e.movementY);
835
- }, [
836
- move
837
- ]);
868
+ };
838
869
  // Store stable references to mouseMove and mouseUp for cleanup
839
870
  const mouseMoveRef = (0, $gTuX4$react.useRef)(mouseMove);
840
871
  const mouseUpRef = (0, $gTuX4$react.useRef)(()=>{});
841
- const mouseUp = (0, $gTuX4$react.useCallback)((e)=>{
872
+ const mouseUp = (e)=>{
842
873
  e.preventDefault();
843
874
  e.stopPropagation();
844
875
  setMoving(false);
@@ -850,24 +881,17 @@ const $46fb0088a1bbb6d8$export$1af8984c69ba1b24 = (_param)=>{
850
881
  resizeListenerRef.current = null;
851
882
  }
852
883
  if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "auto";
853
- }, [
854
- checkPosition
855
- ]);
884
+ };
856
885
  // Update refs when callbacks change
857
886
  (0, $gTuX4$react.useEffect)(()=>{
858
887
  mouseMoveRef.current = mouseMove;
859
888
  mouseUpRef.current = mouseUp;
860
- }, [
861
- mouseMove,
862
- mouseUp
863
- ]);
889
+ });
864
890
  // Helper function to push this window to the top
865
- const pushToTop = (0, $gTuX4$react.useCallback)(()=>{
891
+ const pushToTop = ()=>{
866
892
  const maxZIndex = $46fb0088a1bbb6d8$var$getMaxZIndex(minZIndex);
867
893
  setZIndex(maxZIndex + 1);
868
- }, [
869
- minZIndex
870
- ]);
894
+ };
871
895
  // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings
872
896
  // This effect derives state from props, which is acceptable when there's no synchronous setState
873
897
  (0, $gTuX4$react.useEffect)(()=>{
@@ -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,gEAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,mBAAK,E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AA,GAAA,gEAAK,EAAE,kBAAkB;wBAAE,SAAS,CAAA,GAAA,gEAAK,EAAE,MAAM,GAAG;qBAAG,CAChE,MAAM,CAAC,CAAC,IAAM,MAAM,IACpB,IAAI,CAAC;oBACR,aAAa,CAAC;wBACZ,IAAI,EAAE,MAAM,IAAK,CAAA,EAAE,MAAM,YAAY,eAAe,EAAE,MAAM,YAAY,UAAS,GAC/E,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG;wBAC9B,UAAU;wBACV;wBACA,SAAS,gBAAgB,CAAC,WAAW,WAAW,OAAO;wBACvD,SAAS,gBAAgB,CAAC,aAAa,aAAa,OAAO;wBAC3D,MAAM,iBAAiB,IAAM;wBAC7B,kBAAkB,OAAO,GAAG;wBAC5B,OAAO,gBAAgB,CAAC,UAAU;oBACpC;;sCAEA,gCAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,sBAAsB;4BACxC,OAAO;sCAEN,eAAe,eAAe;;sCAEjC,gCAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gCAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gCAAC;oCAAK,GAAE;;;;;;8BAId,gCAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gCAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAEA,0CAAc,WAAW,GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { 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"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAo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U;wBACV;wBACA,SAAS,gBAAgB,CAAC,WAAW,WAAW,OAAO;wBACvD,SAAS,gBAAgB,CAAC,aAAa,aAAa,OAAO;wBAC3D,MAAM,iBAAiB,IAAM;wBAC7B,kBAAkB,OAAO,GAAG;wBAC5B,OAAO,gBAAgB,CAAC,UAAU;oBACpC;;sCAEA,gCAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,sBAAsB;4BACxC,OAAO;sCAEN,eAAe,eAAe;;sCAEjC,gCAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gCAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gCAAC;oCAAK,GAAE;;;;;;8BAId,gCAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gCAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;AAEA,0CAAc,WAAW,GAAG;","sources":["src/main.ts","global.d.ts","src/components/index.ts","src/components/AutoHeight.tsx","src/components/AutoHeight.module.css","src/components/ClickForMenu.tsx","src/components/ContextMenu.tsx","src/components/ContextMenu.module.css","src/components/ContextMenuEntry.tsx","src/components/ContextSubMenu.tsx","src/components/ContextMenuHandler.tsx","src/components/LowMenu.tsx","src/components/LowMenu.module.css","src/components/LowMenuButton.tsx","src/components/LowSubMenu.tsx","src/components/ContextWindow.tsx","src/functions/chkPosition.ts","src/components/ContextWindow.module.css"],"sourcesContent":["import \"../global.d.ts\";\nexport * from \"./components\";\n","declare module \"*.module.css\" {\n const classes: { readonly [key: string]: string };\n export default classes;\n}\n\n// React 19 act() environment support\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n","import { AutoHeight } from \"./AutoHeight\";\nimport { ClickForMenu } from \"./ClickForMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { ContextMenuHandler } from \"./ContextMenuHandler\";\nimport { ContextWindow } from \"./ContextWindow\";\nimport { IMenuItem } from \"./interface\";\n\nexport { AutoHeight, ClickForMenu, ContextMenu, ContextMenuHandler, ContextWindow };\nexport type { IMenuItem };\n","import { useEffect, useEffectEvent, useLayoutEffect, useRef, useState } from \"react\";\nimport styles from \"./AutoHeight.module.css\";\n\ninterface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n hide?: boolean;\n duration?: number; // transition duration in ms\n}\n\ntype AnimationState = \"closed\" | \"opening\" | \"open\" | \"closing\";\n\nexport function AutoHeight({\n children,\n hide = false,\n duration = 300,\n ...rest\n}: AutoHeightProps): React.ReactElement {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | null>(null);\n const [animationState, setAnimationState] = useState<AnimationState>(!hide ? \"open\" : \"closed\");\n\n const rafRef = useRef<number | null>(null);\n const timeoutRef = useRef<number | null>(null);\n\n const targetChildren: React.ReactNode =\n animationState === \"closed\" || !children ? null : children;\n\n const setTargetHeight = useEffectEvent((newHeight: number) => {\n setHeight(newHeight);\n });\n\n const transitionToOpening = useEffectEvent((): void => {\n // Cancel any pending close timeout\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n setAnimationState(\"opening\");\n\n const id = window.requestAnimationFrame(() => {\n rafRef.current = null;\n setTargetHeight(1);\n\n const frameId = window.requestAnimationFrame(() => {\n const inner = innerRef.current;\n if (inner) {\n setTargetHeight(inner.offsetHeight);\n setAnimationState(\"open\");\n }\n });\n rafRef.current = frameId;\n });\n rafRef.current = id;\n });\n\n const transitionToClosing = useEffectEvent((): void => {\n // Cancel any pending RAF\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n\n setAnimationState(\"closing\");\n setTargetHeight(1);\n\n timeoutRef.current = window.setTimeout(() => {\n timeoutRef.current = null;\n setAnimationState(\"closed\");\n }, duration);\n });\n\n useLayoutEffect(() => {\n if (!hide) {\n // Want to show: transition to open\n if (animationState === \"closed\" || animationState === \"closing\") {\n transitionToOpening();\n }\n // If already opening or open, stay in that state\n } else {\n // Want to hide: transition to closed\n if (animationState === \"open\" || animationState === \"opening\") {\n transitionToClosing();\n }\n }\n }, [hide, animationState]);\n\n // Setup ResizeObserver to track content size changes\n useEffect(() => {\n const transition = innerRef.current;\n if (transition) {\n const observer = new ResizeObserver(() => {\n if (animationState === \"open\") {\n setTargetHeight(transition!.offsetHeight);\n }\n });\n\n observer.observe(transition!);\n\n return () => {\n observer.disconnect();\n };\n }\n }, [animationState]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n {...rest}\n className={styles.autoHeightWrapper}\n ref={wrapperRef}\n style={{\n ...rest.style,\n display: animationState === \"closed\" ? \"none\" : undefined,\n height: height ? `${height}px` : \"auto\",\n transitionDuration: `${duration}ms`,\n }}\n >\n <div\n className={styles.autoHeightInner}\n ref={innerRef}\n >\n {targetChildren}\n </div>\n </div>\n );\n}\n\nAutoHeight.displayName = \"AutoHeight\";\n",".autoHeightWrapper {\n overflow: hidden;\n transition-timing-function: height ease-in-out width ease-in-out background-color ease-in-out;\n box-sizing: border-box;\n position: relative;\n}\n\n.autoHeightInner {\n height: fit-content;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ClickForMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n menuItems?: IMenuItem[];\n children?: React.ReactNode;\n}\n\nexport const ClickForMenu = ({\n id,\n menuItems,\n children,\n ...rest\n}: ClickForMenuProps): React.ReactElement => {\n // Menu state\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n\n // Set up outsideClick handler\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n // Handle click off the menu\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const handleClick = (e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuInDom(false);\n }\n };\n\n const removeController = useRef<AbortController | null>(null);\n const removeTimeoutRef = useRef<NodeJS.Timeout | null>(null);\n useEffect(() => {\n if (!menuVisible && removeTimeoutRef.current === null) {\n // Only create a new controller when scheduling a new timeout\n if (removeController.current) {\n removeController.current.abort();\n }\n removeController.current = new AbortController();\n const controller = removeController.current;\n // Set up the timeout with a reference to the current controller\n removeTimeoutRef.current = setTimeout(() => {\n if (!controller.signal.aborted) setMenuInDom(false);\n removeTimeoutRef.current = null;\n }, 300);\n }\n return () => {\n // Clean up on unmount or when menuVisible changes\n if (removeTimeoutRef.current) {\n clearTimeout(removeTimeoutRef.current);\n removeTimeoutRef.current = null;\n }\n };\n }, [menuVisible]);\n\n // Update the document click handler\n useEffect(() => {\n if (menuInDom) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n if (removeController.current) {\n removeController.current.abort();\n }\n };\n }, [handleClick, menuInDom]);\n\n return (\n <>\n <div\n {...rest}\n id={id}\n onClick={(e) => {\n if (menuItems) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n if (removeController.current) {\n removeController.current.abort();\n }\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n } else {\n rest.onClick?.(e);\n }\n }}\n >\n {children}\n </div>\n {menuInDom &&\n menuItems &&\n createPortal(\n <div className={styles.anchor}>\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={menuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n }}\n />\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nClickForMenu.displayName = \"ClickForMenu\";\n","import React, { forwardRef, useLayoutEffect, useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextMenuEntry } from \"./ContextMenuEntry\";\nimport { IMenuItem } from \"./interface\";\n\n// Constants for menu size estimation when ref is not yet available\nconst ESTIMATED_MENU_ITEM_HEIGHT = 34;\nconst ESTIMATED_MENU_PADDING = 4;\nconst ESTIMATED_MENU_WIDTH = 200;\n\nexport interface ContextMenuProps {\n visible: boolean;\n entries: IMenuItem[];\n xPos: number;\n yPos: number;\n toClose: () => void;\n}\n\nexport const ContextMenu = forwardRef<HTMLDivElement, ContextMenuProps>(\n ({ visible, entries, xPos, yPos, toClose }, ref): React.ReactElement => {\n // Measure menu size after mount/render to avoid accessing refs during render\n const [menuHeight, setMenuHeight] = useState(\n entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING,\n );\n const [menuWidth, setMenuWidth] = useState(ESTIMATED_MENU_WIDTH);\n\n useLayoutEffect(() => {\n // Only measure when visible; ref access inside effect is allowed\n if (visible && ref && typeof ref !== \"function\" && ref.current instanceof HTMLDivElement) {\n setMenuHeight(ref.current.offsetHeight);\n setMenuWidth(ref.current.offsetWidth);\n }\n // When not visible, fall back to estimates\n if (!visible) {\n setMenuHeight(entries.length * ESTIMATED_MENU_ITEM_HEIGHT + ESTIMATED_MENU_PADDING);\n setMenuWidth(ESTIMATED_MENU_WIDTH);\n }\n }, [visible, entries, ref]);\n\n const adjustedYPos =\n yPos + menuHeight > window.innerHeight\n ? Math.max(window.innerHeight - menuHeight - ESTIMATED_MENU_PADDING, 0)\n : yPos;\n const adjustedXPos =\n xPos + menuWidth > window.innerWidth\n ? Math.max(window.innerWidth - menuWidth - ESTIMATED_MENU_PADDING, 0)\n : xPos;\n\n return (\n <div\n ref={ref}\n className={[styles.contextMenu, visible ? styles.visible : styles.hidden]\n .filter((c) => c !== \"\")\n .join(\" \")}\n style={{\n top: `${adjustedYPos}px`,\n left: `${adjustedXPos}px`,\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {entries.map((entry, i) => (\n <ContextMenuEntry\n key={i}\n entry={entry}\n toClose={toClose}\n />\n ))}\n </div>\n );\n },\n);\n\nContextMenu.displayName = \"ContextMenu\";\n",".anchor {\n position: absolute;\n top: 0;\n left: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n font-size: 9pt;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.contextMenuHandler {\n height: fit-content;\n width: fit-content;\n}\n\n.contextMenu {\n position: absolute;\n border: 1px solid;\n border-color: rgb(17, 20, 24);\n opacity: 1;\n background-color: rgb(251, 253, 246);\n z-index: 10000;\n box-shadow: 4px 4px 4px rgb(64, 64, 64, 0.75);\n transition: opacity 0.3s linear;\n}\n\n.contextMenu.hidden {\n opacity: 0;\n}\n\n.contextMenu.visible {\n opacity: 1;\n}\n\n.contextMenuItem {\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n min-width: 80px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.contextMenuItem.disabled {\n background-color: rgba(0, 0, 0, 0.2);\n cursor: not-allowed;\n}\n\n.contextMenuItem:first-child {\n padding-top: 4px;\n}\n\n.contextMenuItem:last-child {\n padding-bottom: 4px;\n}\n\n.contextMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.contextMenuItem .caretHolder {\n align-self: flex-end;\n}\n\n.contextMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n\n.contextMenuItemLabel {\n flex-grow: 1;\n height: 19px;\n}\n","import { useState } from \"react\";\nimport styles from \"./ContextMenu.module.css\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface ContextMenuEntryProps {\n entry: IMenuItem;\n toClose: () => void;\n}\n\nexport const ContextMenuEntry = ({ entry, toClose }: ContextMenuEntryProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.contextMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n >\n {typeof entry.label === \"string\" ? (\n <span\n aria-label={entry.label}\n aria-disabled={entry.disabled}\n className={styles.contextMenuItemLabel}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onMouseDownCapture={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) {\n if (entry.action) {\n entry.action(target, e);\n }\n toClose();\n }\n }}\n >\n {entry.label}\n </span>\n ) : (\n entry.label\n )}\n {entry.group && (\n <ContextSubMenu\n toClose={toClose}\n entries={entry.group}\n />\n )}\n </div>\n );\n};\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContextSubMenuProps {\n entries: IMenuItem[];\n toClose: () => void;\n lowMenu?: boolean;\n}\n\nexport const ContextSubMenu = ({ entries, toClose }: ContextSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n return (\n <span\n className={styles.caretHolder}\n onMouseEnter={() => setVisible(true)}\n onMouseLeave={() => setVisible(false)}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n {visible && (\n <div className={styles.subMenu}>\n <ContextMenu\n visible={true}\n entries={entries}\n xPos={14}\n yPos={-21}\n toClose={toClose}\n />\n </div>\n )}\n </span>\n );\n};\n\nContextSubMenu.displayName = \"ContextSubMenu\";\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./ContextMenu.module.css\";\nimport { LowMenu } from \"./LowMenu\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface ContentMenuHandlerContextProps {\n menuItems: IMenuItem[];\n}\nexport const ContentMenuHandlerContext = createContext<ContentMenuHandlerContextProps | null>(null);\n\nexport interface ContextMenuHandlerProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n menuItems: IMenuItem[];\n showLowMenu?: boolean;\n}\n\nfunction isDivider(label: string | React.ReactElement): boolean {\n return typeof label !== \"string\" && label.type === \"hr\";\n}\n\nexport const ContextMenuHandler = ({\n children,\n menuItems,\n showLowMenu = false,\n ...rest\n}: ContextMenuHandlerProps): React.ReactElement => {\n // Check for higher content menu\n const higherContext = useContext(ContentMenuHandlerContext);\n const thisMenuItems: IMenuItem[] = [\n ...(higherContext !== null\n ? [\n ...higherContext.menuItems,\n ...[\n higherContext.menuItems.length > 0 &&\n !isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) &&\n menuItems.length > 0 &&\n !isDivider(menuItems[0].label)\n ? {\n label: <hr style={{ flexGrow: 1, cursor: \"none\", margin: \"0\", padding: \"0\" }} />,\n }\n : null,\n ].filter((item) => item !== null),\n ]\n : []),\n ...menuItems,\n ];\n\n // Menu resources\n const divHandlderRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuInDom, setMenuInDom] = useState<boolean>(false);\n const [mouseOverHandlerDiv, setMouseOverHandlerDiv] = useState<boolean>(false);\n const [mouseOverMenu, setMouseOverMenu] = useState<boolean>(false);\n\n // Holder position - measured in an effect to avoid reading refs during render\n const [divHandlerPos, setDivHandlerPos] = useState<DOMRect | null>(null);\n\n useLayoutEffect(() => {\n function updatePos() {\n if (divHandlderRef.current) {\n setDivHandlerPos(divHandlderRef.current.getBoundingClientRect());\n }\n }\n\n // When the handler is hovered or the menu is mounted, ensure we have a fresh position\n if (mouseOverHandlerDiv || menuInDom) {\n updatePos();\n }\n\n // Attach listeners while the menu/low-menu may be visible so the position stays correct\n if (mouseOverHandlerDiv || menuInDom) {\n window.addEventListener(\"resize\", updatePos);\n // listen on capture to catch scrolls from ancestor elements as well\n window.addEventListener(\"scroll\", updatePos, true);\n\n let ro: ResizeObserver | null = null;\n if (typeof ResizeObserver !== \"undefined\" && divHandlderRef.current) {\n ro = new ResizeObserver(() => updatePos());\n ro.observe(divHandlderRef.current);\n }\n\n return () => {\n window.removeEventListener(\"resize\", updatePos);\n window.removeEventListener(\"scroll\", updatePos, true);\n if (ro) ro.disconnect();\n };\n }\n }, [mouseOverHandlerDiv, menuInDom]);\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener(\"mousedown\", handleClick);\n return () => {\n document.removeEventListener(\"mousedown\", handleClick);\n };\n }, [handleClick, menuVisible]);\n\n const removeController = useRef<AbortController>(new AbortController());\n useEffect(() => {\n if (!mouseOverMenu && !menuVisible && !mouseOverHandlerDiv) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setTimeout(() => {\n if (!removeController.current.signal.aborted) setMenuInDom(false);\n }, 300);\n }\n }, [mouseOverHandlerDiv, menuVisible, mouseOverMenu]);\n\n return (\n <ContentMenuHandlerContext.Provider\n value={{\n menuItems: thisMenuItems,\n }}\n >\n <div\n ref={divHandlderRef}\n {...rest}\n className={[styles.contextMenuHandler, rest.className].join(\" \")}\n onContextMenu={async (e) => {\n if (!showLowMenu) {\n setMenuInDom(true);\n e.preventDefault();\n e.stopPropagation();\n setTimeout(() => {\n removeController.current.abort();\n setMenuVisible(true);\n setMenuXPos(e.pageX);\n setMenuYPos(e.pageY);\n }, 1);\n }\n }}\n onMouseEnter={async (e) => {\n if (showLowMenu) {\n setMenuInDom(true);\n setMouseOverHandlerDiv(false);\n setTimeout(() => {\n removeController.current.abort();\n setMouseOverHandlerDiv(true);\n }, 1);\n }\n rest.onMouseEnter?.(e);\n }}\n onMouseLeave={async (e) => {\n if (showLowMenu) {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverHandlerDiv(false);\n }\n rest.onMouseLeave?.(e);\n }}\n >\n {children}\n </div>\n {menuInDom &&\n divHandlerPos &&\n createPortal(\n <div\n className={styles.anchor}\n onMouseEnter={() => {\n removeController.current.abort();\n setMouseOverMenu(true);\n }}\n onMouseLeave={() => {\n removeController.current.abort();\n removeController.current = new AbortController();\n setMouseOverMenu(false);\n }}\n >\n {showLowMenu ? (\n <LowMenu\n visible={mouseOverHandlerDiv}\n entries={menuItems}\n xPos={divHandlerPos.left}\n yPos={divHandlerPos.bottom}\n maxWidth={divHandlerPos.width}\n />\n ) : (\n <ContextMenu\n visible={menuVisible}\n ref={menuRef}\n entries={thisMenuItems}\n xPos={menuXPos}\n yPos={menuYPos}\n toClose={() => {\n setMenuVisible(false);\n setMouseOverMenu(false);\n }}\n />\n )}\n </div>,\n document.body,\n )}\n </ContentMenuHandlerContext.Provider>\n );\n};\n\nContextMenuHandler.displayName = \"ContextMenuHandler\";\n","import styles from \"./LowMenu.module.css\";\nimport { LowMenuButton } from \"./LowMenuButton\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuProps {\n entries: IMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n maxWidth: number;\n}\n\nexport const LowMenu = ({\n entries,\n visible,\n xPos,\n yPos,\n maxWidth,\n}: LowMenuProps): React.ReactElement => {\n // Only show the low menu if it is on the screen\n if (xPos >= window.innerWidth || yPos >= window.innerHeight) return <></>;\n // Show the menu\n return (\n <div\n className={[styles.lowMenu, visible ? styles.visible : styles.hidden].join(\" \")}\n aria-label=\"Low context menu\"\n style={{\n left: `${xPos}px`,\n top: `${yPos}px`,\n maxWidth: `calc(${maxWidth}px)`,\n width: `calc(${maxWidth}px - 4px)`,\n }}\n >\n <div className={styles.lowMenuButtonHolder}>\n {entries.map((e, i) => (\n <LowMenuButton\n key={i}\n entry={e}\n />\n ))}\n </div>\n </div>\n );\n};\n\nLowMenu.displayName = \"LowMenu\";\n",".lowMenu {\n z-index: 2;\n position: absolute;\n margin: 0px;\n transition: opacity 0.3s linear;\n}\n\n.lowMenuButtonHolder {\n border: 2px solid rgb(17, 20, 24);\n border-top-right-radius: 4px;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background-color: rgb(17, 20, 24);\n box-shadow: 2px 2px 2px rgb(64, 64, 64, 0.5);\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n gap: 2px;\n row-gap: 2px;\n width: fit-content;\n}\n\n.lowMenu.hidden {\n opacity: 0;\n}\n\n.lowMenu.visible,\n.lowMenu:hover {\n opacity: 1;\n}\n\n.lowMenuItem {\n background-color: rgb(251, 253, 246);\n border: 0;\n color: rgb(17, 20, 24);\n cursor: pointer;\n padding: 0 4px;\n position: relative;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n white-space: nowrap;\n}\n\n.lowMenuItem.disabled {\n background-color: rgba(200, 200, 200);\n cursor: not-allowed;\n}\n\n.lowMenuItem:not(.disabled):hover {\n background-color: rgb(251, 233, 230);\n}\n\n.lowMenu-item .caretHolder {\n align-self: flex-end;\n}\n\n.lowMenuItem .caretHolder .subMenu {\n z-index: 1;\n position: relative;\n}\n","import { useState } from \"react\";\nimport styles from \"./LowMenu.module.css\";\nimport { LowSubMenu } from \"./LowSubMenu\";\nimport { IMenuItem } from \"./interface\";\n\ninterface LowMenuButtonProps {\n entry: IMenuItem;\n}\nexport const LowMenuButton = ({ entry }: LowMenuButtonProps) => {\n const [target, setTarget] = useState<Range | null>(null);\n return (\n <div\n className={[styles.lowMenuItem, entry.disabled ? styles.disabled : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n aria-label={typeof entry.label === \"string\" ? entry.label : undefined}\n aria-disabled={entry.disabled}\n onMouseEnter={() => {\n const sel = window.getSelection();\n const target = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n setTarget(target);\n }}\n onMouseLeave={() => {\n setTarget(null);\n }}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n if (!entry.disabled) entry.action?.(target);\n }}\n >\n <span>{entry.label}</span>\n {entry.group && <LowSubMenu entry={entry} />}\n </div>\n );\n};\n\nLowMenuButton.displayName = \"LowMenuButton\";\n","import { useState } from \"react\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport styles from \"./LowMenu.module.css\";\nimport { IMenuItem } from \"./interface\";\n\nexport interface LowSubMenuProps {\n entry: IMenuItem;\n lowMenu?: boolean;\n}\n\nexport const LowSubMenu = ({ entry }: LowSubMenuProps): React.ReactElement => {\n const [visible, setVisible] = useState<boolean>(false);\n if (!entry.group || entry.group.length === 0) return <></>;\n return (\n <span\n aria-label={`Sub menu for ${entry.label}`}\n className={styles.caretHolder}\n onMouseEnter={() => {\n setVisible(true);\n }}\n onMouseLeave={() => {\n setVisible(false);\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z\" />\n </svg>\n <div className={styles.subMenu}>\n {visible && (\n <ContextMenu\n visible={visible}\n entries={entry.group}\n xPos={14}\n yPos={entry.group.length * -21 - 8}\n toClose={() => setVisible(false)}\n />\n )}\n </div>\n </span>\n );\n};\n\nLowSubMenu.displayName = \"LowSubMenu\";\n","import { ReactNode, useEffect, useRef, useState, useTransition } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { chkPosition } from \"../functions/chkPosition\";\nimport styles from \"./ContextWindow.module.css\";\n\nexport const MIN_Z_INDEX = 3000;\nconst CONTEXT_WINDOW_DATA_ATTR = \"data-context-window\";\n\nexport interface ContextWindowProps extends React.HTMLAttributes<HTMLDivElement> {\n id: string;\n visible: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n title: string;\n titleElement?: ReactNode;\n style?: React.CSSProperties;\n children: React.ReactNode;\n minZIndex?: number;\n}\n\n// Helper function to get the highest zIndex from all context windows in the DOM\nconst getMaxZIndex = (componentMinZIndex: number): number => {\n const windows = document.body.querySelectorAll(`[${CONTEXT_WINDOW_DATA_ATTR}]`);\n let maxZIndex = componentMinZIndex - 1;\n windows.forEach((win) => {\n const zIndexStr = (win as HTMLElement).style.zIndex;\n if (zIndexStr) {\n const zIndex = parseInt(zIndexStr, 10);\n if (!isNaN(zIndex) && zIndex > maxZIndex) {\n maxZIndex = zIndex;\n }\n }\n });\n return maxZIndex;\n};\n\nexport const ContextWindow = ({\n id,\n visible,\n title,\n titleElement,\n children,\n onOpen,\n onClose,\n minZIndex = MIN_Z_INDEX,\n ...rest\n}: ContextWindowProps): React.ReactElement => {\n const divRef = useRef<HTMLDivElement | null>(null);\n const windowRef = useRef<HTMLDivElement | null>(null);\n const [zIndex, setZIndex] = useState<number>(minZIndex);\n const resizeListenerRef = useRef<(() => void) | null>(null);\n\n // Track internal state: whether window is in DOM and whether it's been positioned\n const [windowInDOM, setWindowInDOM] = useState<boolean>(false);\n const [windowVisible, setWindowVisible] = useState<boolean>(false);\n const [, startTransition] = useTransition();\n\n // Position\n const windowPos = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const [moving, setMoving] = useState<boolean>(false);\n\n const move = (x: number, y: number) => {\n if (windowRef.current && windowPos.current) {\n const window = windowRef.current;\n const pos = windowPos.current;\n pos.x += x;\n pos.y += y;\n window.style.transform = `translate(${pos.x}px, ${pos.y}px)`;\n }\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const checkPosition = () => {\n const chkPos = chkPosition(windowRef);\n move(chkPos.translateX, chkPos.translateY);\n };\n\n const mouseMove = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n move(e.movementX, e.movementY);\n };\n\n // Store stable references to mouseMove and mouseUp for cleanup\n const mouseMoveRef = useRef(mouseMove);\n const mouseUpRef = useRef<(e: MouseEvent) => void>(() => {});\n\n const mouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setMoving(false);\n checkPosition();\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"auto\";\n };\n\n // Update refs when callbacks change\n useEffect(() => {\n mouseMoveRef.current = mouseMove;\n mouseUpRef.current = mouseUp;\n });\n\n // Helper function to push this window to the top\n const pushToTop = () => {\n const maxZIndex = getMaxZIndex(minZIndex);\n setZIndex(maxZIndex + 1);\n };\n\n // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings\n // This effect derives state from props, which is acceptable when there's no synchronous setState\n useEffect(() => {\n if (visible && !windowInDOM) {\n // Window should be in DOM when visible becomes true\n startTransition(() => {\n setWindowInDOM(true);\n });\n } else if (!visible && windowInDOM) {\n // Window should leave DOM when visible becomes false\n startTransition(() => {\n setWindowInDOM(false);\n setWindowVisible(false);\n });\n }\n }, [visible, windowInDOM, startTransition]);\n\n // Position and show window after it's added to DOM\n useEffect(() => {\n if (windowInDOM && !windowVisible && visible && divRef.current && windowRef.current) {\n // Position the window\n const parentPos = divRef.current.getBoundingClientRect();\n const pos = windowRef.current.getBoundingClientRect();\n const windowHeight = pos.bottom - pos.top;\n windowRef.current.style.left = `${parentPos.left}px`;\n windowRef.current.style.top = `${\n parentPos.bottom + windowHeight < window.innerHeight\n ? parentPos.bottom\n : Math.max(0, parentPos.top - windowHeight)\n }px`;\n windowRef.current.style.transform = \"\";\n windowPos.current = { x: 0, y: 0 };\n checkPosition();\n\n // Update z-index and make visible - use startTransition\n const maxZ = getMaxZIndex(minZIndex);\n onOpen?.();\n startTransition(() => {\n setZIndex(maxZ + 1);\n setWindowVisible(true);\n });\n }\n }, [windowInDOM, windowVisible, visible, checkPosition, minZIndex, onOpen, startTransition]);\n\n // Cleanup effect to remove event listeners on unmount\n useEffect(() => {\n return () => {\n // Clean up event listeners if component unmounts while dragging\n document.removeEventListener(\"mousemove\", mouseMoveRef.current);\n document.removeEventListener(\"mouseup\", mouseUpRef.current);\n if (resizeListenerRef.current) {\n window.removeEventListener(\"resize\", resizeListenerRef.current);\n resizeListenerRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n className={styles.contextWindowAnchor}\n ref={divRef}\n >\n {windowInDOM &&\n createPortal(\n <div\n {...rest}\n ref={windowRef}\n id={id}\n {...{ [CONTEXT_WINDOW_DATA_ATTR]: \"true\" }}\n className={[styles.contextWindow, rest.className].filter((c) => c).join(\" \")}\n style={{\n ...rest.style,\n opacity: moving ? 0.8 : windowVisible ? 1 : 0,\n visibility: windowVisible ? \"visible\" : \"hidden\",\n zIndex: zIndex,\n minHeight: rest.style?.minHeight ?? \"150px\",\n minWidth: rest.style?.minWidth ?? \"200px\",\n maxHeight: rest.style?.maxHeight ?? \"1000px\",\n maxWidth: rest.style?.maxWidth ?? \"1000px\",\n }}\n onClickCapture={(e) => {\n pushToTop();\n rest.onClickCapture?.(e);\n }}\n >\n <div\n className={[styles.contextWindowTitle, moving ? styles.moving : \"\"]\n .filter((c) => c !== \"\")\n .join(\" \")}\n onMouseDown={(e: React.MouseEvent) => {\n if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement))\n e.target.style.userSelect = \"none\";\n setMoving(true);\n pushToTop();\n document.addEventListener(\"mouseup\", mouseUpRef.current);\n document.addEventListener(\"mousemove\", mouseMoveRef.current);\n const resizeListener = () => checkPosition();\n resizeListenerRef.current = resizeListener;\n window.addEventListener(\"resize\", resizeListener);\n }}\n >\n <div\n className={styles.contextWindowTitleText}\n title={title}\n >\n {titleElement ? titleElement : title}\n </div>\n <div\n className={styles.contextWindowTitleClose}\n role=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n title={`Close ${title && title.trim() !== \"\" ? title : \"window\"}`}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n viewBox=\"0 0 16 16\"\n >\n <path d=\"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z\" />\n </svg>\n </div>\n </div>\n <div className={styles.contextWindowBody}>\n <div>{children}</div>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nContextWindow.displayName = \"ContextWindow\";\n","import { RefObject } from \"react\";\n\n/**\n * Check that an existing div is inside the viewport\n * @param divRef Check div is inside view port, and return n\n * @returns \\{ translateX, translateY \\} Amount to move on X and Y axis\n */\nexport const chkPosition = (\n divRef: RefObject<HTMLDivElement | null>,\n): { translateX: number; translateY: number } => {\n if (!divRef.current) {\n return { translateX: 0, translateY: 0 };\n } else {\n const innerBounce = 16;\n const posn = divRef.current.getBoundingClientRect();\n let translateX = 0;\n if (posn.left < innerBounce) {\n translateX = -posn.left + innerBounce;\n } else if (posn.right > window.innerWidth) {\n translateX = Math.max(-posn.left + innerBounce, window.innerWidth - posn.right - innerBounce);\n }\n let translateY = 0;\n if (posn.top < innerBounce) {\n translateY = -posn.top + innerBounce;\n } else if (posn.bottom > window.innerHeight) {\n translateY = Math.max(\n -posn.top + innerBounce,\n window.innerHeight - posn.bottom - innerBounce,\n );\n }\n return { translateX, translateY };\n }\n};\n",".contextWindowAnchor {\n position: relative;\n}\n\n.contextWindow {\n z-index: 2001;\n border: 1px black solid;\n margin: 0;\n padding: 4px;\n background-color: rgb(250, 250, 250);\n box-shadow: 6px 6px 6px rgb(64, 64, 64, 0.5);\n transition: opacity 0.25s linear;\n justify-content: flex-start;\n position: absolute;\n border-top-left-radius: 8px;\n border-top-right-radius: 8px;\n border-bottom-left-radius: 8px;\n resize: both;\n overflow: auto;\n max-height: 95vh;\n max-width: 95vw;\n}\n\n.contextWindowTitle {\n border-bottom: 1px black dashed;\n box-sizing: unset;\n padding-bottom: 4px;\n margin: 0 4px 3px 4px;\n height: 24px;\n line-height: 24px;\n max-height: 24px;\n cursor: grab;\n font-size: 18px;\n font-weight: 600;\n display: flex;\n flex-direction: row;\n align-items: center;\n width: calc(100% - 8px);\n}\n\n.contextWindowTitle.moving {\n cursor: grabbing;\n}\n\n.contextWindowTitleText {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: calc(100% - 16px);\n}\n\n.contextWindowTitleClose {\n display: flex;\n color: black;\n height: 16px;\n width: 16px;\n border-radius: 3px;\n margin-left: 2px;\n cursor: pointer;\n line-height: 16px;\n}\n\n.contextWindowTitleClose:hover {\n background-color: black;\n color: white;\n}\n\n.contextWindowBody {\n overflow: auto;\n padding-bottom: 8px;\n margin-right: 4px;\n height: calc(100% - 40px);\n}\n\n.contextWindowBody::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-track {\n background: white;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb {\n background: lightgrey;\n border: none;\n border-radius: 8px;\n}\n\n.contextWindowBody::-webkit-scrollbar-thumb:hover {\n background: grey;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";AAGA,yBAA0B,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACpE,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,2BAA2B,EACzB,QAAQ,EACR,IAAI,EACJ,QAAc,EACd,GAAG,IAAI,EACR,EAAE,eAAe,GAAG,MAAM,YAAY,CA8DtC;AAnED,MAAM,mBAAU,UAAU;;;ACT1B;IACE,KAAK,EAAE,MAAM,GAAG,MAAM,YAAY,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACxF,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB;AGKD;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,OAAO,MAAM,oGAuDZ,CAAC;ACnEF,2BAAmC,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;CAC5B;AAED,OAAO,MAAM;2CAKV,iBAAiB,GAAG,MAAM,YAAY;;CAqGxC,CAAC;AIjGF,iCAAyC,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACnF,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD,OAAO,MAAM;oDAKV,uBAAuB,GAAG,MAAM,YAAY;;CA4L9C,CAAC;AExNF,4BAAoC,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD,OAAO,MAAM;0FAUV,kBAAkB,GAAG,MAAM,YAAY;;CA8MzC,CAAC","sources":["src/src/components/AutoHeight.tsx","src/src/components/interface.ts","src/src/components/ContextSubMenu.tsx","src/src/components/ContextMenuEntry.tsx","src/src/components/ContextMenu.tsx","src/src/components/ClickForMenu.tsx","src/src/components/LowSubMenu.tsx","src/src/components/LowMenuButton.tsx","src/src/components/LowMenu.tsx","src/src/components/ContextMenuHandler.tsx","src/src/functions/chkPosition.ts","src/src/components/ContextWindow.tsx","src/src/components/index.ts","src/src/main.ts","src/main.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,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C;IAC1B,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD,OAAO,MAAM;oDAKV,uBAAuB,GAAG,MAAM,YAAY;;CAuL9C,CAAC;AElNF,4BAAoC,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD,OAAO,MAAM;0FAUV,kBAAkB,GAAG,MAAM,YAAY;;CAyMzC,CAAC","sources":["src/src/components/AutoHeight.tsx","src/src/components/interface.ts","src/src/components/ContextSubMenu.tsx","src/src/components/ContextMenuEntry.tsx","src/src/components/ContextMenu.tsx","src/src/components/ClickForMenu.tsx","src/src/components/LowSubMenu.tsx","src/src/components/LowMenuButton.tsx","src/src/components/LowMenu.tsx","src/src/components/ContextMenuHandler.tsx","src/src/functions/chkPosition.ts","src/src/components/ContextWindow.tsx","src/src/components/index.ts","src/src/main.ts","src/main.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import \"../global.d.ts\";\nexport * from \"./components\";\n"],"names":[],"version":3,"file":"context-menu.d.ts.map"}
package/dist/main.js CHANGED
@@ -3,7 +3,7 @@ import {_ as $duWW8$_} from "@swc/helpers/_/_object_spread";
3
3
  import {_ as $duWW8$_1} from "@swc/helpers/_/_object_spread_props";
4
4
  import {_ as $duWW8$_2} from "@swc/helpers/_/_object_without_properties";
5
5
  import {jsx as $duWW8$jsx, jsxs as $duWW8$jsxs, Fragment as $duWW8$Fragment} from "react/jsx-runtime";
6
- import {useRef as $duWW8$useRef, useState as $duWW8$useState, 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";
6
+ import {useRef as $duWW8$useRef, useState as $duWW8$useState, useEffectEvent as $duWW8$useEffectEvent, useLayoutEffect as $duWW8$useLayoutEffect, useEffect as $duWW8$useEffect, forwardRef as $duWW8$forwardRef, createContext as $duWW8$createContext, useContext as $duWW8$useContext, useCallback as $duWW8$useCallback, useTransition as $duWW8$useTransition} from "react";
7
7
  import {createPortal as $duWW8$createPortal} from "react-dom";
8
8
 
9
9
 
@@ -39,7 +39,7 @@ $181673e3e0e596f3$export$563bd8f955c52746 = `aiw-AutoHeight-module-pDlSVW-autoHe
39
39
 
40
40
 
41
41
  function $62873e7e5aeec7f1$export$77bf000da9303d1(_param) {
42
- var { children: children, hide: hide, duration: duration = 300 } = _param, rest = (0, $duWW8$_2)(_param, [
42
+ var { children: children, hide: hide = false, duration: duration = 300 } = _param, rest = (0, $duWW8$_2)(_param, [
43
43
  "children",
44
44
  "hide",
45
45
  "duration"
@@ -47,29 +47,63 @@ function $62873e7e5aeec7f1$export$77bf000da9303d1(_param) {
47
47
  const wrapperRef = (0, $duWW8$useRef)(null);
48
48
  const innerRef = (0, $duWW8$useRef)(null);
49
49
  const [height, setHeight] = (0, $duWW8$useState)(null);
50
- const targetChildren = (0, $duWW8$useMemo)(()=>hide || !children ? /*#__PURE__*/ (0, $duWW8$jsx)("div", {
51
- style: {
52
- height: "1px"
53
- }
54
- }) : children, [
55
- children,
56
- hide
57
- ]);
58
- const setTargetHeight = (0, $duWW8$useCallback)(()=>{
59
- const inner = innerRef.current;
60
- var _inner_offsetHeight;
61
- // Initial draw to get the height of children and deployed children
62
- const deployedHeight = hide ? 1 : (_inner_offsetHeight = inner === null || inner === void 0 ? void 0 : inner.offsetHeight) !== null && _inner_offsetHeight !== void 0 ? _inner_offsetHeight : 0;
63
- setHeight(deployedHeight);
50
+ const [animationState, setAnimationState] = (0, $duWW8$useState)(!hide ? "open" : "closed");
51
+ const rafRef = (0, $duWW8$useRef)(null);
52
+ const timeoutRef = (0, $duWW8$useRef)(null);
53
+ const targetChildren = animationState === "closed" || !children ? null : children;
54
+ const setTargetHeight = (0, $duWW8$useEffectEvent)((newHeight)=>{
55
+ setHeight(newHeight);
56
+ });
57
+ const transitionToOpening = (0, $duWW8$useEffectEvent)(()=>{
58
+ // Cancel any pending close timeout
59
+ if (timeoutRef.current !== null) {
60
+ clearTimeout(timeoutRef.current);
61
+ timeoutRef.current = null;
62
+ }
63
+ setAnimationState("opening");
64
+ const id = window.requestAnimationFrame(()=>{
65
+ rafRef.current = null;
66
+ setTargetHeight(1);
67
+ const frameId = window.requestAnimationFrame(()=>{
68
+ const inner = innerRef.current;
69
+ if (inner) {
70
+ setTargetHeight(inner.offsetHeight);
71
+ setAnimationState("open");
72
+ }
73
+ });
74
+ rafRef.current = frameId;
75
+ });
76
+ rafRef.current = id;
77
+ });
78
+ const transitionToClosing = (0, $duWW8$useEffectEvent)(()=>{
79
+ // Cancel any pending RAF
80
+ if (rafRef.current !== null) {
81
+ cancelAnimationFrame(rafRef.current);
82
+ rafRef.current = null;
83
+ }
84
+ setAnimationState("closing");
85
+ setTargetHeight(1);
86
+ timeoutRef.current = window.setTimeout(()=>{
87
+ timeoutRef.current = null;
88
+ setAnimationState("closed");
89
+ }, duration);
90
+ });
91
+ (0, $duWW8$useLayoutEffect)(()=>{
92
+ if (!hide) // Want to show: transition to open
93
+ {
94
+ if (animationState === "closed" || animationState === "closing") transitionToOpening();
95
+ } else // Want to hide: transition to closed
96
+ if (animationState === "open" || animationState === "opening") transitionToClosing();
64
97
  }, [
65
- hide
98
+ hide,
99
+ animationState
66
100
  ]);
67
- // Add ResizeObserver to update height on content resize, debounced
101
+ // Setup ResizeObserver to track content size changes
68
102
  (0, $duWW8$useEffect)(()=>{
69
103
  const transition = innerRef.current;
70
104
  if (transition) {
71
105
  const observer = new ResizeObserver(()=>{
72
- setTargetHeight();
106
+ if (animationState === "open") setTargetHeight(transition.offsetHeight);
73
107
  });
74
108
  observer.observe(transition);
75
109
  return ()=>{
@@ -77,24 +111,26 @@ function $62873e7e5aeec7f1$export$77bf000da9303d1(_param) {
77
111
  };
78
112
  }
79
113
  }, [
80
- setTargetHeight
114
+ animationState
81
115
  ]);
82
- // Trigger height change on children update
83
- const [, startTransition] = (0, $duWW8$useTransition)();
116
+ // Cleanup on unmount
84
117
  (0, $duWW8$useEffect)(()=>{
85
- // Mark this update as non-urgent to avoid cascading render warnings
86
- startTransition(()=>{
87
- setTargetHeight();
88
- });
89
- }, [
90
- setTargetHeight,
91
- children,
92
- startTransition
93
- ]);
118
+ return ()=>{
119
+ if (rafRef.current !== null) {
120
+ cancelAnimationFrame(rafRef.current);
121
+ rafRef.current = null;
122
+ }
123
+ if (timeoutRef.current !== null) {
124
+ clearTimeout(timeoutRef.current);
125
+ timeoutRef.current = null;
126
+ }
127
+ };
128
+ }, []);
94
129
  return /*#__PURE__*/ (0, $duWW8$jsx)("div", (0, $duWW8$_1)((0, $duWW8$_)({}, rest), {
95
130
  className: (0, (/*@__PURE__*/$parcel$interopDefault($181673e3e0e596f3$exports))).autoHeightWrapper,
96
131
  ref: wrapperRef,
97
132
  style: (0, $duWW8$_1)((0, $duWW8$_)({}, rest.style), {
133
+ display: animationState === "closed" ? "none" : undefined,
98
134
  height: height ? `${height}px` : "auto",
99
135
  transitionDuration: `${duration}ms`
100
136
  }),
@@ -293,9 +329,10 @@ const $c3e82278b501f10c$export$d4ebdd58e04c6ace = (_param)=>{
293
329
  // Set up outsideClick handler
294
330
  const menuRef = (0, $duWW8$useRef)(null);
295
331
  // Handle click off the menu
296
- const handleClick = (0, $duWW8$useCallback)((e)=>{
332
+ // eslint-disable-next-line react-hooks/exhaustive-deps
333
+ const handleClick = (e)=>{
297
334
  if (menuRef.current && (e.target instanceof Element && !menuRef.current.contains(e.target) || !(e.target instanceof Element))) setMenuInDom(false);
298
- }, []);
335
+ };
299
336
  const removeController = (0, $duWW8$useRef)(null);
300
337
  const removeTimeoutRef = (0, $duWW8$useRef)(null);
301
338
  (0, $duWW8$useEffect)(()=>{
@@ -532,27 +569,24 @@ const $1e1c1e9e0b943830$export$ed4f9641643dc7e4 = (_param)=>{
532
569
  ]);
533
570
  // Check for higher content menu
534
571
  const higherContext = (0, $duWW8$useContext)($1e1c1e9e0b943830$export$fc58dc71afe92de2);
535
- const thisMenuItems = (0, $duWW8$useMemo)(()=>[
536
- ...higherContext !== null ? [
537
- ...higherContext.menuItems,
538
- ...[
539
- higherContext.menuItems.length > 0 && !$1e1c1e9e0b943830$var$isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) && menuItems.length > 0 && !$1e1c1e9e0b943830$var$isDivider(menuItems[0].label) ? {
540
- label: /*#__PURE__*/ (0, $duWW8$jsx)("hr", {
541
- style: {
542
- flexGrow: 1,
543
- cursor: "none",
544
- margin: "0",
545
- padding: "0"
546
- }
547
- })
548
- } : null
549
- ].filter((item)=>item !== null)
550
- ] : [],
551
- ...menuItems
552
- ], [
553
- higherContext,
554
- menuItems
555
- ]);
572
+ const thisMenuItems = [
573
+ ...higherContext !== null ? [
574
+ ...higherContext.menuItems,
575
+ ...[
576
+ higherContext.menuItems.length > 0 && !$1e1c1e9e0b943830$var$isDivider(higherContext.menuItems[higherContext.menuItems.length - 1].label) && menuItems.length > 0 && !$1e1c1e9e0b943830$var$isDivider(menuItems[0].label) ? {
577
+ label: /*#__PURE__*/ (0, $duWW8$jsx)("hr", {
578
+ style: {
579
+ flexGrow: 1,
580
+ cursor: "none",
581
+ margin: "0",
582
+ padding: "0"
583
+ }
584
+ })
585
+ } : null
586
+ ].filter((item)=>item !== null)
587
+ ] : [],
588
+ ...menuItems
589
+ ];
556
590
  // Menu resources
557
591
  const divHandlderRef = (0, $duWW8$useRef)(null);
558
592
  const menuRef = (0, $duWW8$useRef)(null);
@@ -796,7 +830,7 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
796
830
  y: 0
797
831
  });
798
832
  const [moving, setMoving] = (0, $duWW8$useState)(false);
799
- const move = (0, $duWW8$useCallback)((x, y)=>{
833
+ const move = (x, y)=>{
800
834
  if (windowRef.current && windowPos.current) {
801
835
  const window1 = windowRef.current;
802
836
  const pos = windowPos.current;
@@ -804,24 +838,21 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
804
838
  pos.y += y;
805
839
  window1.style.transform = `translate(${pos.x}px, ${pos.y}px)`;
806
840
  }
807
- }, []);
808
- const checkPosition = (0, $duWW8$useCallback)(()=>{
841
+ };
842
+ // eslint-disable-next-line react-hooks/exhaustive-deps
843
+ const checkPosition = ()=>{
809
844
  const chkPos = (0, $ab4d5d6bf03370d0$export$d81cfea7c54be196)(windowRef);
810
845
  move(chkPos.translateX, chkPos.translateY);
811
- }, [
812
- move
813
- ]);
814
- const mouseMove = (0, $duWW8$useCallback)((e)=>{
846
+ };
847
+ const mouseMove = (e)=>{
815
848
  e.preventDefault();
816
849
  e.stopPropagation();
817
850
  move(e.movementX, e.movementY);
818
- }, [
819
- move
820
- ]);
851
+ };
821
852
  // Store stable references to mouseMove and mouseUp for cleanup
822
853
  const mouseMoveRef = (0, $duWW8$useRef)(mouseMove);
823
854
  const mouseUpRef = (0, $duWW8$useRef)(()=>{});
824
- const mouseUp = (0, $duWW8$useCallback)((e)=>{
855
+ const mouseUp = (e)=>{
825
856
  e.preventDefault();
826
857
  e.stopPropagation();
827
858
  setMoving(false);
@@ -833,24 +864,17 @@ const $b5e8657823def5be$export$1af8984c69ba1b24 = (_param)=>{
833
864
  resizeListenerRef.current = null;
834
865
  }
835
866
  if (e.target && (e.target instanceof HTMLElement || e.target instanceof SVGElement)) e.target.style.userSelect = "auto";
836
- }, [
837
- checkPosition
838
- ]);
867
+ };
839
868
  // Update refs when callbacks change
840
869
  (0, $duWW8$useEffect)(()=>{
841
870
  mouseMoveRef.current = mouseMove;
842
871
  mouseUpRef.current = mouseUp;
843
- }, [
844
- mouseMove,
845
- mouseUp
846
- ]);
872
+ });
847
873
  // Helper function to push this window to the top
848
- const pushToTop = (0, $duWW8$useCallback)(()=>{
874
+ const pushToTop = ()=>{
849
875
  const maxZIndex = $b5e8657823def5be$var$getMaxZIndex(minZIndex);
850
876
  setZIndex(maxZIndex + 1);
851
- }, [
852
- minZIndex
853
- ]);
877
+ };
854
878
  // Sync windowInDOM with visible prop using a layout effect to avoid ESLint warnings
855
879
  // This effect derives state from props, which is acceptable when there's no synchronous setState
856
880
  (0, $duWW8$useEffect)(()=>{
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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,CAAC,UAAU;oBACpC;;sCAEA,gBAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,sBAAsB;4BACxC,OAAO;sCAEN,eAAe,eAAe;;sCAEjC,gBAAC;4BACC,WAAW,CAAA,GAAA,gEAAK,EAAE,uBAAuB;4BACzC,MAAK;4BACL,cAAW;4BACX,SAAS;4BACT,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,IAAI,OAAO,KAAK,QAAQ,UAAU;sCAEjE,cAAA,gBAAC;gCACC,OAAM;gCACN,OAAM;gCACN,QAAO;gCACP,MAAK;gCACL,SAAQ;0CAER,cAAA,gBAAC;oCAAK,GAAE;;;;;;8BAId,gBAAC;oBAAI,WAAW,CAAA,GAAA,gEAAK,EAAE,iBAAiB;8BACtC,cAAA,gBAAC;kCAAK;;;;aAGV,SAAS,IAAI;;AAIvB;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"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIAA,IAAA;AACA,IAAA;AADA,4CAAoC,CAAC,4CAA4C,CAAC;AAClF,4CAAsC,CAAC,8CAA8C,CAAC;;;ADU/E,SAAS,yCAAW;QAAA,YACzB,QAAQ,QACR,OAAO,iBACP,WAAW,KAEK,GALS,QAItB,sBAJsB;QACzB;QACA;QACA;;IAGA,MAAM,aAAa,CAAA,GAAA,aAAK,EAAkB;IAC1C,MAAM,WAAW,CAAA,GAAA,aAAK,EAAkB;IACxC,MAAM,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,eAAO,EAAiB;IACpD,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,CAAA,GAAA,eAAO,EAAkB,CAAC,OAAO,SAAS;IAEtF,MAAM,SAAS,CAAA,GAAA,aAAK,EAAiB;IACrC,MAAM,aAAa,CAAA,GAAA,aAAK,EAAiB;IAEzC,MAAM,iBACJ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,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": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "REACT Typescript Context menu component",
5
5
  "author": "Paul Thomas <@PaulDThomas>",
6
6
  "private": false,
@@ -46,7 +46,7 @@
46
46
  "build-storybook": "storybook build"
47
47
  },
48
48
  "dependencies": {
49
- "@swc/helpers": "^0.5.17",
49
+ "@swc/helpers": "^0.5.18",
50
50
  "react": "^19.0.0",
51
51
  "react-dom": "^19.0.0"
52
52
  },
@@ -55,6 +55,7 @@
55
55
  "react-dom": "^19.0.0"
56
56
  },
57
57
  "devDependencies": {
58
+ "@chromatic-com/storybook": "^5.0.0",
58
59
  "@eslint/compat": "^2.0.0",
59
60
  "@eslint/eslintrc": "^3.3.3",
60
61
  "@eslint/js": "^9.28.0",
@@ -62,6 +63,11 @@
62
63
  "@parcel/packager-ts": "^2.8.3",
63
64
  "@parcel/transformer-typescript-types": "^2.8.0",
64
65
  "@parcel/transformer-webmanifest": "^2.7.0",
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",
65
71
  "@testing-library/jest-dom": "^6.4.2",
66
72
  "@testing-library/react": "^16.0.0",
67
73
  "@testing-library/user-event": "^14.4.3",
@@ -71,12 +77,15 @@
71
77
  "@types/react-dom": "^19.0.0",
72
78
  "@typescript-eslint/eslint-plugin": "^8.34.0",
73
79
  "@typescript-eslint/parser": "^8.34.0",
80
+ "@vitest/browser-playwright": "^4.0.14",
81
+ "@vitest/coverage-v8": "^4.0.14",
74
82
  "eslint": "^9.28.0",
75
83
  "eslint-config-prettier": "^10.1.5",
76
84
  "eslint-plugin-jest": "^29.1.0",
77
85
  "eslint-plugin-prettier": "^5.1.3",
78
86
  "eslint-plugin-react": "^7.31.10",
79
87
  "eslint-plugin-react-hooks": "^7.0.1",
88
+ "eslint-plugin-storybook": "10.1.11",
80
89
  "eslint-plugin-unused-imports": "^4.1.4",
81
90
  "husky": "^9.0.11",
82
91
  "jest": "^30.2.0",
@@ -84,26 +93,18 @@
84
93
  "jest-watch-typeahead": "^3.0.1",
85
94
  "lint-staged": "^16.2.7",
86
95
  "parcel": "^2.7.0",
96
+ "playwright": "^1.57.0",
87
97
  "prettier": "^3.2.5",
88
98
  "prettier-plugin-organize-imports": "^4.1.0",
89
99
  "process": "^0.11.10",
100
+ "storybook": "^10.1.11",
90
101
  "ts-jest": "^29.4.5",
91
102
  "ts-jest-mock-import-meta": "^1.2.0",
92
103
  "ts-node": "^10.9.1",
93
104
  "typescript": "^5.0.4",
94
105
  "typescript-eslint": "^8.34.0",
95
106
  "typescript-plugin-css-modules": "^5.1.0",
96
- "storybook": "^10.1.2",
97
- "@storybook/react-vite": "^10.1.2",
98
- "@chromatic-com/storybook": "^4.1.3",
99
- "@storybook/addon-vitest": "^10.1.2",
100
- "@storybook/addon-a11y": "^10.1.2",
101
- "@storybook/addon-docs": "^10.1.2",
102
- "@storybook/addon-onboarding": "^10.1.2",
103
- "vitest": "^4.0.14",
104
- "playwright": "^1.57.0",
105
- "@vitest/browser-playwright": "^4.0.14",
106
- "@vitest/coverage-v8": "^4.0.14"
107
+ "vitest": "^4.0.14"
107
108
  },
108
109
  "@parcel/transformer-css": {
109
110
  "cssModules": {