@rpg-engine/long-bow 0.7.68 → 0.7.70

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.
@@ -27377,6 +27377,57 @@ var Container$8 = /*#__PURE__*/styled__default.div.withConfig({
27377
27377
  componentId: "sc-dgmp04-0"
27378
27378
  })(["position:static !important;"]);
27379
27379
 
27380
+ var useCursorPosition = function useCursorPosition(_ref) {
27381
+ var _ref$scale = _ref.scale,
27382
+ scale = _ref$scale === void 0 ? 1 : _ref$scale;
27383
+ var _useState = React.useState({
27384
+ x: 0,
27385
+ y: 0
27386
+ }),
27387
+ position = _useState[0],
27388
+ setPosition = _useState[1];
27389
+ var scalePosition = React.useCallback(function (x, y) {
27390
+ return {
27391
+ x: (x - shared.GRID_WIDTH / 2) / scale + shared.GRID_WIDTH / 2,
27392
+ y: (y - shared.GRID_HEIGHT / 2) / scale + shared.GRID_HEIGHT / 2
27393
+ };
27394
+ }, [scale]);
27395
+ var setFromEvent = React.useCallback(function (e) {
27396
+ var x, y;
27397
+ if ('touches' in e) {
27398
+ x = e.touches[0].clientX;
27399
+ y = e.touches[0].clientY;
27400
+ } else {
27401
+ x = e.clientX;
27402
+ y = e.clientY;
27403
+ }
27404
+ var scaledPosition = scalePosition(x, y);
27405
+ setPosition(scaledPosition);
27406
+ }, [scale, scalePosition]);
27407
+ var cleanup = React.useCallback(function () {
27408
+ setPosition({
27409
+ x: 0,
27410
+ y: 0
27411
+ });
27412
+ }, []);
27413
+ React.useEffect(function () {
27414
+ var handleEvent = function handleEvent(e) {
27415
+ return setFromEvent(e);
27416
+ };
27417
+ window.addEventListener('mousemove', handleEvent);
27418
+ window.addEventListener('touchmove', handleEvent);
27419
+ window.addEventListener('mouseup', cleanup);
27420
+ window.addEventListener('touchend', cleanup);
27421
+ return function () {
27422
+ window.removeEventListener('mousemove', handleEvent);
27423
+ window.removeEventListener('touchmove', handleEvent);
27424
+ window.removeEventListener('mouseup', cleanup);
27425
+ window.removeEventListener('touchend', cleanup);
27426
+ };
27427
+ }, [setFromEvent, cleanup]);
27428
+ return position;
27429
+ };
27430
+
27380
27431
  var rarityColor = function rarityColor(item) {
27381
27432
  switch (item == null ? void 0 : item.rarity) {
27382
27433
  case shared.ItemRarities.Uncommon:
@@ -27545,183 +27596,67 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
27545
27596
  return React__default.createElement(React__default.Fragment, null, onRenderSlot(item));
27546
27597
  };
27547
27598
 
27548
- var RelativeListMenu = function RelativeListMenu(_ref) {
27549
- var options = _ref.options,
27550
- onSelected = _ref.onSelected,
27551
- onOutsideClick = _ref.onOutsideClick,
27552
- _ref$fontSize = _ref.fontSize,
27553
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
27554
- pos = _ref.pos;
27555
- var ref = React.useRef(null);
27556
- useOutsideClick(ref, 'relative-context-menu');
27599
+ // Set default state with clearly defined initial values
27600
+ var defaultItemDetails = {
27601
+ item: null,
27602
+ tooltip: {
27603
+ visible: false,
27604
+ mobileVisible: false
27605
+ },
27606
+ contextMenu: {
27607
+ visible: false,
27608
+ position: {
27609
+ x: 0,
27610
+ y: 0
27611
+ },
27612
+ actions: []
27613
+ }
27614
+ };
27615
+ // Create context with default values
27616
+ var ItemSlotTooltipContext = /*#__PURE__*/React.createContext({
27617
+ itemDetails: defaultItemDetails,
27618
+ updateItemDetails: function updateItemDetails() {},
27619
+ clearItemDetails: function clearItemDetails() {}
27620
+ });
27621
+ // Provider component
27622
+ var ItemSlotTooltipProvider = function ItemSlotTooltipProvider(_ref) {
27623
+ var children = _ref.children;
27624
+ var _useState = React.useState(defaultItemDetails),
27625
+ itemDetails = _useState[0],
27626
+ setItemDetails = _useState[1];
27557
27627
  React.useEffect(function () {
27558
- document.addEventListener('clickOutside', function (event) {
27559
- var e = event;
27560
- if (e.detail.id === 'relative-context-menu') {
27561
- if (onOutsideClick) {
27562
- onOutsideClick();
27563
- }
27564
- }
27628
+ console.log('itemDetails', itemDetails);
27629
+ }, [itemDetails]);
27630
+ // Memoize the update function to optimize performance
27631
+ var updateItemDetails = React.useCallback(function (updates) {
27632
+ setItemDetails(function (prev) {
27633
+ var _updates$contextMenu$, _updates$contextMenu, _prev$contextMenu;
27634
+ return _extends({}, prev, updates, {
27635
+ tooltip: _extends({}, prev.tooltip, updates.tooltip),
27636
+ contextMenu: _extends({}, prev.contextMenu, updates.contextMenu, {
27637
+ // Ensure actions are properly merged or overridden
27638
+ actions: (_updates$contextMenu$ = (_updates$contextMenu = updates.contextMenu) == null ? void 0 : _updates$contextMenu.actions) != null ? _updates$contextMenu$ : (_prev$contextMenu = prev.contextMenu) == null ? void 0 : _prev$contextMenu.actions
27639
+ })
27640
+ });
27565
27641
  });
27566
- return function () {
27567
- document.removeEventListener('clickOutside', function (_e) {});
27568
- };
27569
27642
  }, []);
27570
- return React__default.createElement(ModalPortal, null, React__default.createElement(Container$9, Object.assign({
27571
- fontSize: fontSize,
27572
- ref: ref
27573
- }, pos), React__default.createElement("ul", {
27574
- className: "rpgui-list-imp",
27575
- style: {
27576
- overflow: 'hidden'
27643
+ var clearItemDetails = React.useCallback(function () {
27644
+ setItemDetails(defaultItemDetails);
27645
+ }, []);
27646
+ return React__default.createElement(ItemSlotTooltipContext.Provider, {
27647
+ value: {
27648
+ itemDetails: itemDetails,
27649
+ updateItemDetails: updateItemDetails,
27650
+ clearItemDetails: clearItemDetails
27577
27651
  }
27578
- }, options.map(function (params, index) {
27579
- return React__default.createElement(ListElement$2, {
27580
- key: (params == null ? void 0 : params.id) || index,
27581
- onPointerDown: function onPointerDown() {
27582
- onSelected(params == null ? void 0 : params.id);
27583
- }
27584
- }, (params == null ? void 0 : params.text) || 'No text');
27585
- }))));
27586
- };
27587
- var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
27588
- displayName: "RelativeListMenu__Container",
27589
- componentId: "sc-7hohf-0"
27590
- })(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
27591
- return props.y;
27592
- }, function (props) {
27593
- return props.x;
27594
- }, function (props) {
27595
- return props.fontSize;
27596
- });
27597
- var ListElement$2 = /*#__PURE__*/styled__default.li.withConfig({
27598
- displayName: "RelativeListMenu__ListElement",
27599
- componentId: "sc-7hohf-1"
27600
- })(["margin-right:0.5rem;"]);
27601
-
27602
- var MobileItemTooltip = function MobileItemTooltip(_ref) {
27603
- var item = _ref.item,
27604
- atlasIMG = _ref.atlasIMG,
27605
- atlasJSON = _ref.atlasJSON,
27606
- closeTooltip = _ref.closeTooltip,
27607
- equipmentSet = _ref.equipmentSet,
27608
- _ref$scale = _ref.scale,
27609
- scale = _ref$scale === void 0 ? 1 : _ref$scale,
27610
- options = _ref.options,
27611
- onSelected = _ref.onSelected;
27612
- var ref = React.useRef(null);
27613
- var handleFadeOut = function handleFadeOut() {
27614
- var _ref$current;
27615
- (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
27616
- };
27617
- return React__default.createElement(ModalPortal, null, React__default.createElement(Container$a, {
27618
- ref: ref,
27619
- onTouchEnd: function onTouchEnd() {
27620
- handleFadeOut();
27621
- setTimeout(function () {
27622
- closeTooltip();
27623
- }, 100);
27624
- },
27625
- scale: scale
27626
- }, React__default.createElement(ItemInfoDisplay, {
27627
- item: item,
27628
- atlasIMG: atlasIMG,
27629
- atlasJSON: atlasJSON,
27630
- equipmentSet: equipmentSet,
27631
- isMobile: true
27632
- }), React__default.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
27633
- return React__default.createElement(Option, {
27634
- key: option.id,
27635
- onTouchEnd: function onTouchEnd() {
27636
- handleFadeOut();
27637
- setTimeout(function () {
27638
- onSelected == null ? void 0 : onSelected(option.id);
27639
- closeTooltip();
27640
- }, 100);
27641
- }
27642
- }, option.text);
27643
- }))));
27652
+ }, children);
27644
27653
  };
27645
- var Container$a = /*#__PURE__*/styled__default.div.withConfig({
27646
- displayName: "MobileItemTooltip__Container",
27647
- componentId: "sc-ku4p1j-0"
27648
- })(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
27649
- var OptionsContainer = /*#__PURE__*/styled__default.div.withConfig({
27650
- displayName: "MobileItemTooltip__OptionsContainer",
27651
- componentId: "sc-ku4p1j-1"
27652
- })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
27653
- var Option = /*#__PURE__*/styled__default.button.withConfig({
27654
- displayName: "MobileItemTooltip__Option",
27655
- componentId: "sc-ku4p1j-2"
27656
- })(["padding:1rem;background-color:#333;color:white;border:none;border-radius:3px;width:8rem;transition:background-color 0.1s;&:hover{background-color:#555;}@media (max-width:640px){padding:1rem 0.5rem;}"]);
27657
-
27658
- var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27659
- var tooltipState = _ref.tooltipState,
27660
- setTooltipState = _ref.setTooltipState,
27661
- contextMenuState = _ref.contextMenuState,
27662
- setContextMenuState = _ref.setContextMenuState,
27663
- isFocused = _ref.isFocused,
27664
- isContextMenuDisabled = _ref.isContextMenuDisabled,
27665
- item = _ref.item,
27666
- contextActions = _ref.contextActions,
27667
- dragScale = _ref.dragScale,
27668
- _onSelected = _ref.onSelected,
27669
- atlasIMG = _ref.atlasIMG,
27670
- atlasJSON = _ref.atlasJSON,
27671
- equipmentSet = _ref.equipmentSet;
27672
- return React__default.createElement(React__default.Fragment, null, tooltipState.visible && item && !isFocused && React__default.createElement(ItemTooltip, {
27673
- item: item,
27674
- atlasIMG: atlasIMG,
27675
- atlasJSON: atlasJSON,
27676
- equipmentSet: equipmentSet
27677
- }), tooltipState.mobileVisible && item && React__default.createElement(MobileItemTooltip, {
27678
- item: item,
27679
- atlasIMG: atlasIMG,
27680
- atlasJSON: atlasJSON,
27681
- equipmentSet: equipmentSet,
27682
- closeTooltip: function closeTooltip() {
27683
- setTooltipState(function (prev) {
27684
- return _extends({}, prev, {
27685
- mobileVisible: false
27686
- });
27687
- });
27688
- },
27689
- scale: dragScale,
27690
- options: contextActions,
27691
- onSelected: function onSelected(optionId) {
27692
- setContextMenuState(function (prev) {
27693
- return _extends({}, prev, {
27694
- visible: false
27695
- });
27696
- });
27697
- if (item) {
27698
- _onSelected == null ? void 0 : _onSelected(optionId, item);
27699
- }
27700
- }
27701
- }), !isContextMenuDisabled && contextMenuState.visible && contextActions && React__default.createElement(RelativeListMenu, {
27702
- options: contextActions,
27703
- onSelected: function onSelected(optionId) {
27704
- setContextMenuState(function (prev) {
27705
- return _extends({}, prev, {
27706
- visible: false
27707
- });
27708
- });
27709
- if (item) {
27710
- _onSelected == null ? void 0 : _onSelected(optionId, item);
27711
- }
27712
- },
27713
- onOutsideClick: function onOutsideClick() {
27714
- setContextMenuState(function (prev) {
27715
- return _extends({}, prev, {
27716
- visible: false
27717
- });
27718
- });
27719
- },
27720
- pos: contextMenuState.position
27721
- }));
27654
+ // Custom hook for consuming the context
27655
+ var useItemSlotTooltip = function useItemSlotTooltip() {
27656
+ return React.useContext(ItemSlotTooltipContext);
27722
27657
  };
27723
27658
 
27724
- var DraggingContext = /*#__PURE__*/React.createContext({
27659
+ var ItemSlotDraggingContext = /*#__PURE__*/React.createContext({
27725
27660
  item: null,
27726
27661
  setDraggingItem: function setDraggingItem() {},
27727
27662
  dragState: {
@@ -27735,7 +27670,7 @@ var DraggingContext = /*#__PURE__*/React.createContext({
27735
27670
  },
27736
27671
  setDragState: function setDragState() {}
27737
27672
  });
27738
- var DraggingProvider = function DraggingProvider(_ref) {
27673
+ var ItemSlotDraggingProvider = function ItemSlotDraggingProvider(_ref) {
27739
27674
  var children = _ref.children;
27740
27675
  var _useState = React.useState(null),
27741
27676
  item = _useState[0],
@@ -27751,7 +27686,7 @@ var DraggingProvider = function DraggingProvider(_ref) {
27751
27686
  }),
27752
27687
  dragState = _useState2[0],
27753
27688
  setDragState = _useState2[1];
27754
- return React__default.createElement(DraggingContext.Provider, {
27689
+ return React__default.createElement(ItemSlotDraggingContext.Provider, {
27755
27690
  value: {
27756
27691
  item: item,
27757
27692
  setDraggingItem: setDraggingItem,
@@ -27760,8 +27695,8 @@ var DraggingProvider = function DraggingProvider(_ref) {
27760
27695
  }
27761
27696
  }, children);
27762
27697
  };
27763
- var useDragging = function useDragging() {
27764
- return React.useContext(DraggingContext);
27698
+ var useItemSlotDragging = function useItemSlotDragging() {
27699
+ return React.useContext(ItemSlotDraggingContext);
27765
27700
  };
27766
27701
 
27767
27702
  var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
@@ -27778,15 +27713,16 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27778
27713
  containerType = _ref.containerType,
27779
27714
  slotIndex = _ref.slotIndex,
27780
27715
  openQuantitySelector = _ref.openQuantitySelector,
27781
- isContextMenuDisabled = _ref.isContextMenuDisabled,
27782
- setTooltipState = _ref.setTooltipState,
27783
- setContextMenuState = _ref.setContextMenuState;
27716
+ isContextMenuDisabled = _ref.isContextMenuDisabled;
27784
27717
  var dragContainer = React.useRef(null);
27785
- var _useDragging = useDragging(),
27786
- draggingItem = _useDragging.item,
27787
- setDraggingItem = _useDragging.setDraggingItem,
27788
- dragState = _useDragging.dragState,
27789
- setDragState = _useDragging.setDragState;
27718
+ var _useItemSlotDragging = useItemSlotDragging(),
27719
+ draggingItem = _useItemSlotDragging.item,
27720
+ setDraggingItem = _useItemSlotDragging.setDraggingItem,
27721
+ dragState = _useItemSlotDragging.dragState,
27722
+ setDragState = _useItemSlotDragging.setDragState;
27723
+ var _useItemSlotTooltip = useItemSlotTooltip(),
27724
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails,
27725
+ itemDetails = _useItemSlotTooltip.itemDetails;
27790
27726
  React.useEffect(function () {
27791
27727
  setDragState(function (prev) {
27792
27728
  return _extends({}, prev, {
@@ -27825,6 +27761,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27825
27761
  };
27826
27762
  }, []);
27827
27763
  var resetDragState = React.useCallback(function () {
27764
+ console.log('RESET_DRAG_STATE!');
27828
27765
  setDragState(function (prev) {
27829
27766
  return _extends({}, prev, {
27830
27767
  wasDragged: false,
@@ -27835,20 +27772,35 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27835
27772
  }
27836
27773
  });
27837
27774
  });
27838
- }, [setTooltipState, setDragState]);
27775
+ setDraggingItem(null);
27776
+ // Reset tooltip visibility
27777
+ updateItemDetails({
27778
+ tooltip: {
27779
+ visible: false,
27780
+ mobileVisible: false
27781
+ }
27782
+ });
27783
+ }, [updateItemDetails, setDragState]);
27839
27784
  var handleSuccessfulDrag = React.useCallback(function (quantity) {
27785
+ console.log('HANDLE_SUCCESSFUL_DRAG!');
27840
27786
  resetDragState();
27841
27787
  if (quantity !== -1 && item) {
27842
27788
  onDragEnd == null ? void 0 : onDragEnd(quantity);
27843
27789
  }
27844
27790
  }, [item, onDragEnd, resetDragState]);
27845
27791
  var onDraggableStart = React.useCallback(function () {
27792
+ console.log('ON_DRAGGABLE_START!');
27846
27793
  if (!item || isSelectingShortcut) return;
27847
27794
  if (onDragStart && containerType) {
27848
27795
  onDragStart(item, slotIndex, containerType);
27849
27796
  }
27797
+ if (!draggingItem && item) {
27798
+ console.log('!!! SETTING DRAGGING ITEM ', item._id);
27799
+ setDraggingItem(item);
27800
+ }
27850
27801
  }, [item, isSelectingShortcut, onDragStart, containerType, slotIndex]);
27851
27802
  var onDraggableProgress = React.useCallback(function (_e, data) {
27803
+ console.log('ON_DRAGGABLE_PROGRESS!');
27852
27804
  var _dragState$position = dragState.position,
27853
27805
  x = _dragState$position.x,
27854
27806
  y = _dragState$position.y;
@@ -27860,14 +27812,9 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27860
27812
  });
27861
27813
  });
27862
27814
  }
27863
- if (!draggingItem) {
27864
- setDraggingItem(item);
27865
- }
27866
27815
  }, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
27867
27816
  var onDraggableStop = React.useCallback(function (e, data) {
27868
- setTimeout(function () {
27869
- setDraggingItem(null);
27870
- }, 50);
27817
+ console.log('ON_DRAGGABLE_STOP!');
27871
27818
  var target = e.target;
27872
27819
  if (!target) return;
27873
27820
  target.classList.remove('react-draggable-dragging');
@@ -27910,27 +27857,33 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27910
27857
  }, 50);
27911
27858
  } else if (item) {
27912
27859
  var isTouch = e.type === 'touchend';
27913
- if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem) {
27914
- setTooltipState(function (prev) {
27915
- return _extends({}, prev, {
27860
+ console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragginState: " + JSON.stringify(dragState) + "\n ");
27861
+ if (!isContextMenuDisabled && isTouch && !isSelectingShortcut) {
27862
+ updateItemDetails({
27863
+ item: item,
27864
+ tooltip: {
27916
27865
  mobileVisible: true
27917
- });
27866
+ }
27918
27867
  });
27919
27868
  } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
27869
+ var _itemDetails$contextM;
27920
27870
  var event = e;
27921
- setContextMenuState(function (prev) {
27922
- return {
27923
- visible: !prev.visible,
27871
+ updateItemDetails({
27872
+ item: item,
27873
+ contextMenu: {
27874
+ visible: !(itemDetails != null && (_itemDetails$contextM = itemDetails.contextMenu) != null && _itemDetails$contextM.visible),
27924
27875
  position: {
27925
27876
  x: event.clientX - 10,
27926
27877
  y: event.clientY - 5
27927
27878
  }
27928
- };
27879
+ }
27929
27880
  });
27930
27881
  }
27931
27882
  onPointerDown == null ? void 0 : onPointerDown(item.type, containerType != null ? containerType : null, item);
27932
27883
  }
27933
- }, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, setTooltipState, setContextMenuState, onPointerDown, containerType, setItemShortcut]);
27884
+ console.log('setting draggingItem to null');
27885
+ setDraggingItem(null);
27886
+ }, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, onPointerDown, containerType, setItemShortcut]);
27934
27887
  return {
27935
27888
  dragContainer: dragContainer,
27936
27889
  dragState: dragState,
@@ -28089,7 +28042,6 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28089
28042
  _onMouseOver = _ref.onMouseOver,
28090
28043
  onMouseOut = _ref.onMouseOut,
28091
28044
  onPointerDown = _ref.onPointerDown,
28092
- _onSelected = _ref.onSelected,
28093
28045
  atlasJSON = _ref.atlasJSON,
28094
28046
  atlasIMG = _ref.atlasIMG,
28095
28047
  _ref$isContextMenuDis = _ref.isContextMenuDisabled,
@@ -28102,27 +28054,8 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28102
28054
  openQuantitySelector = _ref.openQuantitySelector,
28103
28055
  dragScale = _ref.dragScale,
28104
28056
  isSelectingShortcut = _ref.isSelectingShortcut,
28105
- equipmentSet = _ref.equipmentSet,
28106
28057
  setItemShortcut = _ref.setItemShortcut,
28107
28058
  isDepotSystem = _ref.isDepotSystem;
28108
- var _useState = React.useState({
28109
- visible: false,
28110
- mobileVisible: false
28111
- }),
28112
- tooltipState = _useState[0],
28113
- setTooltipState = _useState[1];
28114
- var _useState2 = React.useState({
28115
- visible: false,
28116
- position: {
28117
- x: 0,
28118
- y: 0
28119
- }
28120
- }),
28121
- contextMenuState = _useState2[0],
28122
- setContextMenuState = _useState2[1];
28123
- var _useState3 = React.useState([]),
28124
- contextActions = _useState3[0],
28125
- setContextActions = _useState3[1];
28126
28059
  var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
28127
28060
  isDepotSystem: !!isDepotSystem,
28128
28061
  item: item,
@@ -28136,10 +28069,7 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28136
28069
  containerType: containerType,
28137
28070
  slotIndex: slotIndex,
28138
28071
  openQuantitySelector: openQuantitySelector != null ? openQuantitySelector : function () {},
28139
- isContextMenuDisabled: isContextMenuDisabled,
28140
- setTooltipState: setTooltipState,
28141
- contextMenuState: contextMenuState,
28142
- setContextMenuState: setContextMenuState
28072
+ isContextMenuDisabled: isContextMenuDisabled
28143
28073
  }),
28144
28074
  dragContainer = _useItemSlotDragAndDr.dragContainer,
28145
28075
  dragState = _useItemSlotDragAndDr.dragState,
@@ -28148,17 +28078,28 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28148
28078
  onDraggableStart = _useItemSlotDragAndDr.onDraggableStart,
28149
28079
  onDraggableProgress = _useItemSlotDragAndDr.onDraggableProgress,
28150
28080
  onDraggableStop = _useItemSlotDragAndDr.onDraggableStop;
28081
+ var _useItemSlotTooltip = useItemSlotTooltip(),
28082
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails,
28083
+ itemDetails = _useItemSlotTooltip.itemDetails;
28084
+ var _useCursorPosition = useCursorPosition({
28085
+ scale: dragScale
28086
+ }),
28087
+ cursorX = _useCursorPosition.x,
28088
+ cursorY = _useCursorPosition.y;
28151
28089
  React.useEffect(function () {
28152
28090
  if (item && containerType) {
28153
- setContextActions(generateContextMenu(item, containerType, isDepotSystem));
28091
+ updateItemDetails({
28092
+ item: item,
28093
+ contextMenu: {
28094
+ actions: generateContextMenu(item, containerType, isDepotSystem)
28095
+ }
28096
+ });
28154
28097
  }
28155
28098
  }, [item, isDepotSystem]);
28156
28099
  var bounds = getContainerBounds();
28157
28100
  var handleInteraction = React.useCallback(function (event) {
28158
28101
  event.stopPropagation();
28159
- var _ref2 = 'touches' in event ? event.touches[0] : event,
28160
- clientX = _ref2.clientX,
28161
- clientY = _ref2.clientY;
28102
+ console.log('handleInteraction');
28162
28103
  if (item && containerType) {
28163
28104
  if (onPlaceDrop && draggingItem) {
28164
28105
  onPlaceDrop(item, slotIndex, containerType);
@@ -28167,36 +28108,31 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28167
28108
  onPointerDown(item.type, containerType, item);
28168
28109
  }
28169
28110
  }
28170
- setTooltipState(function (prev) {
28171
- return _extends({}, prev, {
28172
- visible: true
28173
- });
28174
- });
28175
- _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, clientX, clientY);
28176
- }, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd]);
28111
+ _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, cursorX, cursorY);
28112
+ }, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd, cursorX, cursorY]);
28177
28113
  var handleInteractionEnd = React.useCallback(function (event) {
28178
28114
  event.preventDefault();
28179
28115
  event.stopPropagation();
28180
- setTooltipState(function (prev) {
28181
- return _extends({}, prev, {
28182
- visible: false
28183
- });
28184
- });
28116
+ console.log('handleInteractionEnd');
28117
+ console.log('itemDetails', itemDetails);
28185
28118
  onMouseOut == null ? void 0 : onMouseOut();
28186
- if (event.type === 'touchend' && 'changedTouches' in event) {
28119
+ if (event.type === 'touchend') {
28187
28120
  var _document$elementFrom;
28188
- var _event$changedTouches = event.changedTouches[0],
28189
- clientX = _event$changedTouches.clientX,
28190
- clientY = _event$changedTouches.clientY;
28191
28121
  var simulatedEvent = new MouseEvent('mouseup', {
28192
- clientX: clientX,
28193
- clientY: clientY,
28122
+ clientX: cursorX,
28123
+ clientY: cursorY,
28194
28124
  bubbles: true
28195
28125
  });
28196
- (_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28126
+ (_document$elementFrom = document.elementFromPoint(cursorX, cursorY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28127
+ updateItemDetails({
28128
+ item: item,
28129
+ tooltip: {
28130
+ visible: false
28131
+ }
28132
+ });
28197
28133
  }
28198
- }, [onMouseOut]);
28199
- return React__default.createElement(Container$b, {
28134
+ }, [onMouseOut, cursorX, cursorY]);
28135
+ return React__default.createElement(Container$9, {
28200
28136
  isDraggingItem: !!draggingItem,
28201
28137
  item: item,
28202
28138
  className: "rpgui-icon empty-slot",
@@ -28240,22 +28176,24 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28240
28176
  }, React__default.createElement(ItemContainer, {
28241
28177
  ref: dragContainer,
28242
28178
  isFocused: dragState.isFocused,
28243
- onMouseOver: function onMouseOver(event) {
28244
- _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, event.clientX, event.clientY);
28179
+ onMouseOver: function onMouseOver() {
28180
+ _onMouseOver == null ? void 0 : _onMouseOver({}, slotIndex, item, cursorX, cursorY);
28245
28181
  },
28246
28182
  onMouseOut: onMouseOut,
28247
28183
  onMouseEnter: function onMouseEnter() {
28248
- setTooltipState(function (prev) {
28249
- return _extends({}, prev, {
28184
+ updateItemDetails({
28185
+ item: item,
28186
+ tooltip: {
28250
28187
  visible: true
28251
- });
28188
+ }
28252
28189
  });
28253
28190
  },
28254
28191
  onMouseLeave: function onMouseLeave() {
28255
- setTooltipState(function (prev) {
28256
- return _extends({}, prev, {
28192
+ updateItemDetails({
28193
+ item: item,
28194
+ tooltip: {
28257
28195
  visible: false
28258
- });
28196
+ }
28259
28197
  });
28260
28198
  }
28261
28199
  }, React__default.createElement(ItemSlotRenderer, {
@@ -28264,46 +28202,25 @@ var ItemSlot = /*#__PURE__*/React__default.memo( /*#__PURE__*/mobxReactLite.obse
28264
28202
  atlasIMG: atlasIMG,
28265
28203
  atlasJSON: atlasJSON,
28266
28204
  containerType: containerType
28267
- }))), React__default.createElement(ItemSlotToolTips, {
28268
- tooltipState: tooltipState,
28269
- setTooltipState: setTooltipState,
28270
- contextMenuState: contextMenuState,
28271
- setContextMenuState: setContextMenuState,
28272
- isFocused: dragState.isFocused,
28273
- isContextMenuDisabled: isContextMenuDisabled,
28274
- item: item,
28275
- contextActions: contextActions,
28276
- dragScale: dragScale,
28277
- onSelected: function onSelected(optionId, item) {
28278
- setContextMenuState(function (prev) {
28279
- return _extends({}, prev, {
28280
- visible: false
28281
- });
28282
- });
28283
- if (_onSelected) _onSelected(optionId, item);
28284
- },
28285
- atlasIMG: atlasIMG,
28286
- atlasJSON: atlasJSON,
28287
- equipmentSet: equipmentSet
28288
- }));
28205
+ }))));
28289
28206
  }));
28290
- var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28207
+ var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
28291
28208
  displayName: "ItemSlot__Container",
28292
28209
  componentId: "sc-l2j5ef-0"
28293
- })(["margin:0.1rem;.react-draggable-dragging{opacity:", ";}position:relative;.sprite-from-atlas-img--item{position:relative;top:1.5rem;left:1.5rem;border-color:", ";box-shadow:", " inset,", ";}&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;border-radius:12px;pointer-events:none;animation:", ";@keyframes bg-color-change{0%{background-color:rgba(255 255 255 / 0.5);}50%{background-color:transparent;}100%{background-color:rgba(255 255 255 / 0.5);}}}"], function (_ref3) {
28294
- var isDraggingItem = _ref3.isDraggingItem;
28210
+ })(["margin:0.1rem;.react-draggable-dragging{opacity:", ";}position:relative;.sprite-from-atlas-img--item{position:relative;top:1.5rem;left:1.5rem;border-color:", ";box-shadow:", " inset,", ";}&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;border-radius:12px;pointer-events:none;animation:", ";@keyframes bg-color-change{0%{background-color:rgba(255 255 255 / 0.5);}50%{background-color:transparent;}100%{background-color:rgba(255 255 255 / 0.5);}}}"], function (_ref2) {
28211
+ var isDraggingItem = _ref2.isDraggingItem;
28295
28212
  return isDraggingItem ? 0 : 1;
28213
+ }, function (_ref3) {
28214
+ var item = _ref3.item;
28215
+ return rarityColor(item);
28296
28216
  }, function (_ref4) {
28297
28217
  var item = _ref4.item;
28298
- return rarityColor(item);
28218
+ return "0 0 5px 2px " + rarityColor(item);
28299
28219
  }, function (_ref5) {
28300
28220
  var item = _ref5.item;
28301
- return "0 0 5px 2px " + rarityColor(item);
28302
- }, function (_ref6) {
28303
- var item = _ref6.item;
28304
28221
  return "0 0 4px 3px " + rarityColor(item);
28305
- }, function (_ref7) {
28306
- var isSelectingShortcut = _ref7.isSelectingShortcut;
28222
+ }, function (_ref6) {
28223
+ var isSelectingShortcut = _ref6.isSelectingShortcut;
28307
28224
  return isSelectingShortcut ? 'bg-color-change 1s infinite' : 'none';
28308
28225
  });
28309
28226
  var ItemContainer = /*#__PURE__*/styled__default.div.withConfig({
@@ -28403,7 +28320,7 @@ var ItemInfo = function ItemInfo(_ref) {
28403
28320
  });
28404
28321
  };
28405
28322
  var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
28406
- return React__default.createElement(Container$c, {
28323
+ return React__default.createElement(Container$a, {
28407
28324
  item: item
28408
28325
  }, React__default.createElement(Header, null, React__default.createElement("div", null, React__default.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React__default.createElement(Rarity, {
28409
28326
  item: item
@@ -28417,7 +28334,7 @@ var ItemInfo = function ItemInfo(_ref) {
28417
28334
  "$isSpecial": true
28418
28335
  }, "Two handed"), React__default.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React__default.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React__default.createElement(MissingStatistics, null, React__default.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
28419
28336
  };
28420
- var Container$c = /*#__PURE__*/styled__default.div.withConfig({
28337
+ var Container$a = /*#__PURE__*/styled__default.div.withConfig({
28421
28338
  displayName: "ItemInfo__Container",
28422
28339
  componentId: "sc-1xm4q8k-0"
28423
28340
  })(["color:white;background-color:#222;border-radius:5px;padding:0.5rem;font-size:", ";border:3px solid ", ";height:max-content;width:18rem;@media (max-width:640px){width:80vw;}"], uiFonts.size.small, function (_ref2) {
@@ -28563,7 +28480,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28563
28480
  }
28564
28481
  return;
28565
28482
  }, []);
28566
- return React__default.createElement(ModalPortal, null, React__default.createElement(Container$d, {
28483
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$b, {
28567
28484
  ref: ref
28568
28485
  }, React__default.createElement(ItemInfoDisplay, {
28569
28486
  item: item,
@@ -28572,11 +28489,67 @@ var ItemTooltip = function ItemTooltip(_ref) {
28572
28489
  equipmentSet: equipmentSet
28573
28490
  })));
28574
28491
  };
28575
- var Container$d = /*#__PURE__*/styled__default.div.withConfig({
28492
+ var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28576
28493
  displayName: "ItemTooltip__Container",
28577
28494
  componentId: "sc-11d9r7x-0"
28578
28495
  })(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
28579
28496
 
28497
+ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28498
+ var item = _ref.item,
28499
+ atlasIMG = _ref.atlasIMG,
28500
+ atlasJSON = _ref.atlasJSON,
28501
+ closeTooltip = _ref.closeTooltip,
28502
+ equipmentSet = _ref.equipmentSet,
28503
+ _ref$scale = _ref.scale,
28504
+ scale = _ref$scale === void 0 ? 1 : _ref$scale,
28505
+ options = _ref.options,
28506
+ onSelected = _ref.onSelected;
28507
+ var ref = React.useRef(null);
28508
+ var handleFadeOut = function handleFadeOut() {
28509
+ var _ref$current;
28510
+ (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
28511
+ };
28512
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$c, {
28513
+ ref: ref,
28514
+ onTouchEnd: function onTouchEnd() {
28515
+ handleFadeOut();
28516
+ setTimeout(function () {
28517
+ closeTooltip();
28518
+ }, 100);
28519
+ },
28520
+ scale: scale
28521
+ }, React__default.createElement(ItemInfoDisplay, {
28522
+ item: item,
28523
+ atlasIMG: atlasIMG,
28524
+ atlasJSON: atlasJSON,
28525
+ equipmentSet: equipmentSet,
28526
+ isMobile: true
28527
+ }), React__default.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
28528
+ return React__default.createElement(Option, {
28529
+ key: option.id,
28530
+ onTouchEnd: function onTouchEnd() {
28531
+ handleFadeOut();
28532
+ setTimeout(function () {
28533
+ onSelected == null ? void 0 : onSelected(option.id);
28534
+ closeTooltip();
28535
+ }, 100);
28536
+ }
28537
+ }, option.text);
28538
+ }))));
28539
+ };
28540
+ var Container$c = /*#__PURE__*/styled__default.div.withConfig({
28541
+ displayName: "MobileItemTooltip__Container",
28542
+ componentId: "sc-ku4p1j-0"
28543
+ })(["position:absolute;z-index:100;left:0;top:0;width:100vw;height:100vh;background-color:rgba(0 0 0 / 0.5);display:flex;justify-content:center;align-items:center;gap:0.5rem;transition:opacity 0.08s;animation:fadeIn 0.1s forwards;@keyframes fadeIn{0%{opacity:0;}100%{opacity:0.92;}}@keyframes fadeOut{0%{opacity:0.92;}100%{opacity:0;}}&.fadeOut{animation:fadeOut 0.1s forwards;}@media (max-width:640px){flex-direction:column;}"]);
28544
+ var OptionsContainer = /*#__PURE__*/styled__default.div.withConfig({
28545
+ displayName: "MobileItemTooltip__OptionsContainer",
28546
+ componentId: "sc-ku4p1j-1"
28547
+ })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
28548
+ var Option = /*#__PURE__*/styled__default.button.withConfig({
28549
+ displayName: "MobileItemTooltip__Option",
28550
+ componentId: "sc-ku4p1j-2"
28551
+ })(["padding:1rem;background-color:#333;color:white;border:none;border-radius:3px;width:8rem;transition:background-color 0.1s;&:hover{background-color:#555;}@media (max-width:640px){padding:1rem 0.5rem;}"]);
28552
+
28580
28553
  var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28581
28554
  var children = _ref.children,
28582
28555
  atlasIMG = _ref.atlasIMG,
@@ -28931,7 +28904,7 @@ var Dropdown = function Dropdown(_ref) {
28931
28904
  onChange(selectedValue);
28932
28905
  }
28933
28906
  }, [selectedValue]);
28934
- return React__default.createElement(Container$e, {
28907
+ return React__default.createElement(Container$d, {
28935
28908
  onMouseLeave: function onMouseLeave() {
28936
28909
  return setOpened(false);
28937
28910
  },
@@ -28959,7 +28932,7 @@ var Dropdown = function Dropdown(_ref) {
28959
28932
  }, option.option);
28960
28933
  })));
28961
28934
  };
28962
- var Container$e = /*#__PURE__*/styled__default.div.withConfig({
28935
+ var Container$d = /*#__PURE__*/styled__default.div.withConfig({
28963
28936
  displayName: "Dropdown__Container",
28964
28937
  componentId: "sc-8arn65-0"
28965
28938
  })(["position:relative;width:", ";"], function (props) {
@@ -29001,57 +28974,6 @@ var Details = /*#__PURE__*/styled__default.p.withConfig({
29001
28974
  componentId: "sc-kaa0h9-0"
29002
28975
  })(["font-size:", " !important;"], uiFonts.size.xsmall);
29003
28976
 
29004
- var useCursorPosition = function useCursorPosition(_ref) {
29005
- var _ref$scale = _ref.scale,
29006
- scale = _ref$scale === void 0 ? 1 : _ref$scale;
29007
- var _useState = React.useState({
29008
- x: 0,
29009
- y: 0
29010
- }),
29011
- position = _useState[0],
29012
- setPosition = _useState[1];
29013
- var scalePosition = React.useCallback(function (x, y) {
29014
- return {
29015
- x: (x - shared.GRID_WIDTH / 2) / scale + shared.GRID_WIDTH / 2,
29016
- y: (y - shared.GRID_HEIGHT / 2) / scale + shared.GRID_HEIGHT / 2
29017
- };
29018
- }, [scale]);
29019
- var setFromEvent = React.useCallback(function (e) {
29020
- var x, y;
29021
- if ('touches' in e) {
29022
- x = e.touches[0].clientX;
29023
- y = e.touches[0].clientY;
29024
- } else {
29025
- x = e.clientX;
29026
- y = e.clientY;
29027
- }
29028
- var scaledPosition = scalePosition(x, y);
29029
- setPosition(scaledPosition);
29030
- }, [scale, scalePosition]);
29031
- var cleanup = React.useCallback(function () {
29032
- setPosition({
29033
- x: 0,
29034
- y: 0
29035
- });
29036
- }, []);
29037
- React.useEffect(function () {
29038
- var handleEvent = function handleEvent(e) {
29039
- return setFromEvent(e);
29040
- };
29041
- window.addEventListener('mousemove', handleEvent);
29042
- window.addEventListener('touchmove', handleEvent);
29043
- window.addEventListener('mouseup', cleanup);
29044
- window.addEventListener('touchend', cleanup);
29045
- return function () {
29046
- window.removeEventListener('mousemove', handleEvent);
29047
- window.removeEventListener('touchmove', handleEvent);
29048
- window.removeEventListener('mouseup', cleanup);
29049
- window.removeEventListener('touchend', cleanup);
29050
- };
29051
- }, [setFromEvent, cleanup]);
29052
- return position;
29053
- };
29054
-
29055
28977
  var CONTAINER_SIZE = 32;
29056
28978
  var OFFSET = CONTAINER_SIZE / 2;
29057
28979
  var DraggedItem = function DraggedItem(_ref) {
@@ -29059,8 +28981,8 @@ var DraggedItem = function DraggedItem(_ref) {
29059
28981
  var atlasJSON = _ref.atlasJSON,
29060
28982
  atlasIMG = _ref.atlasIMG,
29061
28983
  scale = _ref.scale;
29062
- var _useDragging = useDragging(),
29063
- item = _useDragging.item;
28984
+ var _useItemSlotDragging = useItemSlotDragging(),
28985
+ item = _useItemSlotDragging.item;
29064
28986
  var _useCursorPosition = useCursorPosition({
29065
28987
  scale: scale
29066
28988
  }),
@@ -29075,7 +28997,7 @@ var DraggedItem = function DraggedItem(_ref) {
29075
28997
  var centeredX = x - OFFSET;
29076
28998
  var centeredY = y - OFFSET;
29077
28999
  var stackInfo = onRenderStackInfo((_item$_id = item == null ? void 0 : item._id) != null ? _item$_id : '', (_item$stackQty = item == null ? void 0 : item.stackQty) != null ? _item$stackQty : 0);
29078
- return React__default.createElement(Container$f, null, React__default.createElement(SpriteContainer, {
29000
+ return React__default.createElement(Container$e, null, React__default.createElement(SpriteContainer, {
29079
29001
  x: centeredX,
29080
29002
  y: centeredY
29081
29003
  }, React__default.createElement(SpriteFromAtlas, {
@@ -29093,7 +29015,7 @@ var DraggedItem = function DraggedItem(_ref) {
29093
29015
  }), stackInfo));
29094
29016
  };
29095
29017
  var pulse = "\n @keyframes pulse {\n 0%, 100% {\n transform: scale(1) rotate(-3deg);\n }\n 50% {\n transform: scale(0.95) rotate(-3deg);\n }\n }\n";
29096
- var Container$f = /*#__PURE__*/styled__default.div.withConfig({
29018
+ var Container$e = /*#__PURE__*/styled__default.div.withConfig({
29097
29019
  displayName: "DraggedItem__Container",
29098
29020
  componentId: "sc-mlzzcp-0"
29099
29021
  })(["position:relative;"]);
@@ -29109,11 +29031,127 @@ var SpriteContainer = /*#__PURE__*/styled__default.div.attrs(function (props) {
29109
29031
  componentId: "sc-mlzzcp-1"
29110
29032
  })(["", " position:absolute;z-index:100;pointer-events:none;width:", "px;height:", "px;transform:rotate(-3deg);filter:grayscale(100%);opacity:0.35;animation:pulse 2s infinite;.item-slot-qty{position:absolute;bottom:0;margin-left:0.8rem;}"], pulse, CONTAINER_SIZE, CONTAINER_SIZE);
29111
29033
 
29034
+ var RelativeListMenu = function RelativeListMenu(_ref) {
29035
+ var options = _ref.options,
29036
+ onSelected = _ref.onSelected,
29037
+ onOutsideClick = _ref.onOutsideClick,
29038
+ _ref$fontSize = _ref.fontSize,
29039
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
29040
+ pos = _ref.pos;
29041
+ var ref = React.useRef(null);
29042
+ useOutsideClick(ref, 'relative-context-menu');
29043
+ React.useEffect(function () {
29044
+ document.addEventListener('clickOutside', function (event) {
29045
+ var e = event;
29046
+ if (e.detail.id === 'relative-context-menu') {
29047
+ if (onOutsideClick) {
29048
+ onOutsideClick();
29049
+ }
29050
+ }
29051
+ });
29052
+ return function () {
29053
+ document.removeEventListener('clickOutside', function (_e) {});
29054
+ };
29055
+ }, []);
29056
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$f, Object.assign({
29057
+ fontSize: fontSize,
29058
+ ref: ref
29059
+ }, pos), React__default.createElement("ul", {
29060
+ className: "rpgui-list-imp",
29061
+ style: {
29062
+ overflow: 'hidden'
29063
+ }
29064
+ }, options.map(function (params, index) {
29065
+ return React__default.createElement(ListElement$2, {
29066
+ key: (params == null ? void 0 : params.id) || index,
29067
+ onPointerDown: function onPointerDown() {
29068
+ onSelected(params == null ? void 0 : params.id);
29069
+ }
29070
+ }, (params == null ? void 0 : params.text) || 'No text');
29071
+ }))));
29072
+ };
29073
+ var Container$f = /*#__PURE__*/styled__default.div.withConfig({
29074
+ displayName: "RelativeListMenu__Container",
29075
+ componentId: "sc-7hohf-0"
29076
+ })(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
29077
+ return props.y;
29078
+ }, function (props) {
29079
+ return props.x;
29080
+ }, function (props) {
29081
+ return props.fontSize;
29082
+ });
29083
+ var ListElement$2 = /*#__PURE__*/styled__default.li.withConfig({
29084
+ displayName: "RelativeListMenu__ListElement",
29085
+ componentId: "sc-7hohf-1"
29086
+ })(["margin-right:0.5rem;"]);
29087
+
29088
+ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
29089
+ var _itemDetails$tooltip, _itemDetails$tooltip2, _itemDetails$contextM, _itemDetails$contextM2;
29090
+ var isFocused = _ref.isFocused,
29091
+ isContextMenuDisabled = _ref.isContextMenuDisabled,
29092
+ dragScale = _ref.dragScale,
29093
+ onSelected = _ref.onSelected,
29094
+ atlasIMG = _ref.atlasIMG,
29095
+ atlasJSON = _ref.atlasJSON,
29096
+ equipmentSet = _ref.equipmentSet;
29097
+ var _useItemSlotTooltip = useItemSlotTooltip(),
29098
+ itemDetails = _useItemSlotTooltip.itemDetails,
29099
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails;
29100
+ var item = itemDetails.item;
29101
+ var handleCloseTooltip = function handleCloseTooltip() {
29102
+ updateItemDetails({
29103
+ item: item,
29104
+ tooltip: {
29105
+ mobileVisible: false
29106
+ }
29107
+ });
29108
+ };
29109
+ var handleContextMenuSelect = function handleContextMenuSelect(optionId) {
29110
+ updateItemDetails({
29111
+ item: item,
29112
+ contextMenu: {
29113
+ visible: false
29114
+ }
29115
+ });
29116
+ if (item) {
29117
+ onSelected == null ? void 0 : onSelected(optionId, item);
29118
+ }
29119
+ };
29120
+ var handleOutsideClick = function handleOutsideClick() {
29121
+ updateItemDetails({
29122
+ item: item,
29123
+ contextMenu: {
29124
+ visible: false
29125
+ }
29126
+ });
29127
+ };
29128
+ // monitor why mobileVisible is not working
29129
+ return React__default.createElement(React__default.Fragment, null, ((_itemDetails$tooltip = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip.visible) && item && !isFocused && React__default.createElement(ItemTooltip, {
29130
+ item: item,
29131
+ atlasIMG: atlasIMG,
29132
+ atlasJSON: atlasJSON,
29133
+ equipmentSet: equipmentSet
29134
+ }), ((_itemDetails$tooltip2 = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip2.mobileVisible) && item && React__default.createElement(MobileItemTooltip, {
29135
+ item: item,
29136
+ atlasIMG: atlasIMG,
29137
+ atlasJSON: atlasJSON,
29138
+ equipmentSet: equipmentSet,
29139
+ closeTooltip: handleCloseTooltip,
29140
+ scale: dragScale,
29141
+ options: ((_itemDetails$contextM = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM.actions) || [],
29142
+ onSelected: handleContextMenuSelect
29143
+ }), !isContextMenuDisabled && ((_itemDetails$contextM2 = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM2.visible) && itemDetails.contextMenu.actions && React__default.createElement(RelativeListMenu, {
29144
+ options: itemDetails.contextMenu.actions,
29145
+ onSelected: handleContextMenuSelect,
29146
+ onOutsideClick: handleOutsideClick,
29147
+ pos: itemDetails.contextMenu.position
29148
+ }));
29149
+ };
29150
+
29112
29151
  var EquipmentSet = function EquipmentSet(_ref) {
29113
29152
  var equipmentSet = _ref.equipmentSet,
29114
29153
  onClose = _ref.onClose,
29115
29154
  _onMouseOver = _ref.onMouseOver,
29116
- _onSelected = _ref.onSelected,
29117
29155
  onItemClick = _ref.onItemClick,
29118
29156
  atlasIMG = _ref.atlasIMG,
29119
29157
  atlasJSON = _ref.atlasJSON,
@@ -29122,11 +29160,11 @@ var EquipmentSet = function EquipmentSet(_ref) {
29122
29160
  onItemPlaceDrop = _ref.onItemPlaceDrop,
29123
29161
  onItemOutsideDrop = _ref.onItemOutsideDrop,
29124
29162
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
29125
- checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
29126
29163
  scale = _ref.scale,
29127
29164
  initialPosition = _ref.initialPosition,
29128
29165
  onPositionChangeEnd = _ref.onPositionChangeEnd,
29129
- onPositionChangeStart = _ref.onPositionChangeStart;
29166
+ onPositionChangeStart = _ref.onPositionChangeStart,
29167
+ _onSelected = _ref.onSelected;
29130
29168
  var neck = equipmentSet.neck,
29131
29169
  leftHand = equipmentSet.leftHand,
29132
29170
  ring = equipmentSet.ring,
@@ -29139,6 +29177,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
29139
29177
  accessory = equipmentSet.accessory;
29140
29178
  var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
29141
29179
  var equipmentMaskSlots = [shared.ItemSlotType.Neck, shared.ItemSlotType.LeftHand, shared.ItemSlotType.Ring, shared.ItemSlotType.Head, shared.ItemSlotType.Torso, shared.ItemSlotType.Legs, shared.ItemSlotType.Feet, shared.ItemSlotType.Inventory, shared.ItemSlotType.RightHand, shared.ItemSlotType.Accessory];
29180
+ var _useItemSlotDragging = useItemSlotDragging(),
29181
+ dragState = _useItemSlotDragging.dragState;
29182
+ var _useItemSlotTooltip = useItemSlotTooltip(),
29183
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails;
29142
29184
  var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
29143
29185
  var equipmentRange = equipmentData.slice(start, end);
29144
29186
  var slotMaksRange = equipmentMaskSlots.slice(start, end);
@@ -29159,9 +29201,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
29159
29201
  onPointerDown: function onPointerDown(itemType, ContainerType) {
29160
29202
  if (onItemClick) onItemClick(itemType, item, ContainerType);
29161
29203
  },
29162
- onSelected: function onSelected(optionId) {
29163
- if (_onSelected) _onSelected(optionId);
29164
- },
29165
29204
  onDragStart: function onDragStart(item, slotIndex, itemContainerType) {
29166
29205
  if (!item) {
29167
29206
  return;
@@ -29173,7 +29212,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
29173
29212
  },
29174
29213
  dragScale: scale,
29175
29214
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
29176
- checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
29177
29215
  onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
29178
29216
  if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
29179
29217
  },
@@ -29185,7 +29223,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
29185
29223
  });
29186
29224
  });
29187
29225
  };
29188
- return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
29226
+ return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotTooltipProvider, null, React__default.createElement(DraggedItem, {
29189
29227
  atlasIMG: atlasIMG,
29190
29228
  atlasJSON: atlasJSON,
29191
29229
  scale: scale
@@ -29203,7 +29241,23 @@ var EquipmentSet = function EquipmentSet(_ref) {
29203
29241
  onPositionChangeStart: onPositionChangeStart
29204
29242
  }, React__default.createElement(EquipmentSetContainer, {
29205
29243
  className: "equipment-container-body"
29206
- }, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))));
29244
+ }, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))), React__default.createElement(ItemSlotToolTips, {
29245
+ isFocused: dragState.isFocused,
29246
+ isContextMenuDisabled: shared.isMobile(),
29247
+ dragScale: scale,
29248
+ onSelected: function onSelected(optionId, item) {
29249
+ updateItemDetails({
29250
+ item: item,
29251
+ contextMenu: {
29252
+ visible: false
29253
+ }
29254
+ });
29255
+ if (_onSelected) _onSelected(optionId);
29256
+ },
29257
+ atlasIMG: atlasIMG,
29258
+ atlasJSON: atlasJSON,
29259
+ equipmentSet: equipmentSet
29260
+ })));
29207
29261
  };
29208
29262
  var EquipmentSetContainer = /*#__PURE__*/styled__default.div.withConfig({
29209
29263
  displayName: "EquipmentSet__EquipmentSetContainer",
@@ -30681,14 +30735,12 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30681
30735
  document.removeEventListener('pointermove', handleMouseMove);
30682
30736
  }, [handleMouseMove, onItemDragStart, stopScrolling]);
30683
30737
  var onDragStart = function onDragStart(item, slotIndex, itemContainerType) {
30684
- console.log('DRAG START');
30685
30738
  if (onItemDragStart) {
30686
30739
  onItemDragStart(item, slotIndex, itemContainerType);
30687
30740
  }
30688
30741
  onDragStartScrollingEvents();
30689
30742
  };
30690
30743
  var onDragEnd = function onDragEnd(quantity) {
30691
- console.log('DRAG END');
30692
30744
  if (onItemDragEnd) {
30693
30745
  onItemDragEnd(quantity);
30694
30746
  }
@@ -30715,9 +30767,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30715
30767
  onItemClick(item, itemType, containerType);
30716
30768
  }
30717
30769
  },
30718
- onSelected: function onSelected(optionId, item) {
30719
- if (_onSelected) _onSelected(optionId, item);
30720
- },
30721
30770
  onDragStart: onDragStart,
30722
30771
  onDragEnd: onDragEnd,
30723
30772
  dragScale: scale,
@@ -30746,14 +30795,17 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30746
30795
  atlasIMG: atlasIMG,
30747
30796
  atlasJSON: atlasJSON,
30748
30797
  isSelectingShortcut: settingShortcutIndex !== -1,
30749
- equipmentSet: equipmentSet,
30750
30798
  setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
30751
30799
  isDepotSystem: isDepotSystem
30752
30800
  }));
30753
30801
  }
30754
30802
  return slots;
30755
30803
  };
30756
- return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
30804
+ var _useItemSlotTooltip = useItemSlotTooltip(),
30805
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails;
30806
+ var _useItemSlotDragging = useItemSlotDragging(),
30807
+ dragState = _useItemSlotDragging.dragState;
30808
+ return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotTooltipProvider, null, React__default.createElement(DraggedItem, {
30757
30809
  atlasIMG: atlasIMG,
30758
30810
  atlasJSON: atlasJSON,
30759
30811
  scale: scale
@@ -30778,10 +30830,26 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30778
30830
  ref: containerRef,
30779
30831
  isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
30780
30832
  isFullScreen: isFullScreen
30781
- }, onRenderSlots())), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
30833
+ }, onRenderSlots())), React__default.createElement(ItemSlotToolTips, {
30834
+ isFocused: dragState.isFocused,
30835
+ isContextMenuDisabled: disableContextMenu,
30836
+ dragScale: scale,
30837
+ onSelected: function onSelected(optionId, item) {
30838
+ updateItemDetails({
30839
+ item: item,
30840
+ contextMenu: {
30841
+ visible: false
30842
+ }
30843
+ });
30844
+ if (_onSelected) _onSelected(optionId, item);
30845
+ },
30846
+ atlasIMG: atlasIMG,
30847
+ atlasJSON: atlasJSON,
30848
+ equipmentSet: equipmentSet
30849
+ }), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
30782
30850
  quantitySelect: quantitySelect,
30783
30851
  setQuantitySelect: setQuantitySelect
30784
- }));
30852
+ })));
30785
30853
  };
30786
30854
  var ItemsContainer = /*#__PURE__*/styled__default.div.withConfig({
30787
30855
  displayName: "ItemContainer__ItemsContainer",