@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.
@@ -1,8 +1,8 @@
1
- import React, { useState, useEffect, Component, useRef, useContext, createContext, useCallback, useMemo, Fragment } from 'react';
1
+ import React, { useState, useEffect, Component, useRef, useCallback, useContext, createContext, useMemo, Fragment } from 'react';
2
2
  import styled, { css, keyframes } from 'styled-components';
3
3
  import { BeatLoader } from 'react-spinners';
4
4
  import { v4 } from 'uuid';
5
- import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
5
+ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarities, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSubType, isMobile, ItemSlotType, isMobileOrTablet, CharacterClass, QuestStatus, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
6
6
  import dayjs from 'dayjs';
7
7
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
8
8
  import { FaTimes } from 'react-icons/fa';
@@ -27371,6 +27371,57 @@ var Container$8 = /*#__PURE__*/styled.div.withConfig({
27371
27371
  componentId: "sc-dgmp04-0"
27372
27372
  })(["position:static !important;"]);
27373
27373
 
27374
+ var useCursorPosition = function useCursorPosition(_ref) {
27375
+ var _ref$scale = _ref.scale,
27376
+ scale = _ref$scale === void 0 ? 1 : _ref$scale;
27377
+ var _useState = useState({
27378
+ x: 0,
27379
+ y: 0
27380
+ }),
27381
+ position = _useState[0],
27382
+ setPosition = _useState[1];
27383
+ var scalePosition = useCallback(function (x, y) {
27384
+ return {
27385
+ x: (x - GRID_WIDTH / 2) / scale + GRID_WIDTH / 2,
27386
+ y: (y - GRID_HEIGHT / 2) / scale + GRID_HEIGHT / 2
27387
+ };
27388
+ }, [scale]);
27389
+ var setFromEvent = useCallback(function (e) {
27390
+ var x, y;
27391
+ if ('touches' in e) {
27392
+ x = e.touches[0].clientX;
27393
+ y = e.touches[0].clientY;
27394
+ } else {
27395
+ x = e.clientX;
27396
+ y = e.clientY;
27397
+ }
27398
+ var scaledPosition = scalePosition(x, y);
27399
+ setPosition(scaledPosition);
27400
+ }, [scale, scalePosition]);
27401
+ var cleanup = useCallback(function () {
27402
+ setPosition({
27403
+ x: 0,
27404
+ y: 0
27405
+ });
27406
+ }, []);
27407
+ useEffect(function () {
27408
+ var handleEvent = function handleEvent(e) {
27409
+ return setFromEvent(e);
27410
+ };
27411
+ window.addEventListener('mousemove', handleEvent);
27412
+ window.addEventListener('touchmove', handleEvent);
27413
+ window.addEventListener('mouseup', cleanup);
27414
+ window.addEventListener('touchend', cleanup);
27415
+ return function () {
27416
+ window.removeEventListener('mousemove', handleEvent);
27417
+ window.removeEventListener('touchmove', handleEvent);
27418
+ window.removeEventListener('mouseup', cleanup);
27419
+ window.removeEventListener('touchend', cleanup);
27420
+ };
27421
+ }, [setFromEvent, cleanup]);
27422
+ return position;
27423
+ };
27424
+
27374
27425
  var rarityColor = function rarityColor(item) {
27375
27426
  switch (item == null ? void 0 : item.rarity) {
27376
27427
  case ItemRarities.Uncommon:
@@ -27539,183 +27590,67 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
27539
27590
  return React.createElement(React.Fragment, null, onRenderSlot(item));
27540
27591
  };
27541
27592
 
27542
- var RelativeListMenu = function RelativeListMenu(_ref) {
27543
- var options = _ref.options,
27544
- onSelected = _ref.onSelected,
27545
- onOutsideClick = _ref.onOutsideClick,
27546
- _ref$fontSize = _ref.fontSize,
27547
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
27548
- pos = _ref.pos;
27549
- var ref = useRef(null);
27550
- useOutsideClick(ref, 'relative-context-menu');
27593
+ // Set default state with clearly defined initial values
27594
+ var defaultItemDetails = {
27595
+ item: null,
27596
+ tooltip: {
27597
+ visible: false,
27598
+ mobileVisible: false
27599
+ },
27600
+ contextMenu: {
27601
+ visible: false,
27602
+ position: {
27603
+ x: 0,
27604
+ y: 0
27605
+ },
27606
+ actions: []
27607
+ }
27608
+ };
27609
+ // Create context with default values
27610
+ var ItemSlotTooltipContext = /*#__PURE__*/createContext({
27611
+ itemDetails: defaultItemDetails,
27612
+ updateItemDetails: function updateItemDetails() {},
27613
+ clearItemDetails: function clearItemDetails() {}
27614
+ });
27615
+ // Provider component
27616
+ var ItemSlotTooltipProvider = function ItemSlotTooltipProvider(_ref) {
27617
+ var children = _ref.children;
27618
+ var _useState = useState(defaultItemDetails),
27619
+ itemDetails = _useState[0],
27620
+ setItemDetails = _useState[1];
27551
27621
  useEffect(function () {
27552
- document.addEventListener('clickOutside', function (event) {
27553
- var e = event;
27554
- if (e.detail.id === 'relative-context-menu') {
27555
- if (onOutsideClick) {
27556
- onOutsideClick();
27557
- }
27558
- }
27622
+ console.log('itemDetails', itemDetails);
27623
+ }, [itemDetails]);
27624
+ // Memoize the update function to optimize performance
27625
+ var updateItemDetails = useCallback(function (updates) {
27626
+ setItemDetails(function (prev) {
27627
+ var _updates$contextMenu$, _updates$contextMenu, _prev$contextMenu;
27628
+ return _extends({}, prev, updates, {
27629
+ tooltip: _extends({}, prev.tooltip, updates.tooltip),
27630
+ contextMenu: _extends({}, prev.contextMenu, updates.contextMenu, {
27631
+ // Ensure actions are properly merged or overridden
27632
+ 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
27633
+ })
27634
+ });
27559
27635
  });
27560
- return function () {
27561
- document.removeEventListener('clickOutside', function (_e) {});
27562
- };
27563
27636
  }, []);
27564
- return React.createElement(ModalPortal, null, React.createElement(Container$9, Object.assign({
27565
- fontSize: fontSize,
27566
- ref: ref
27567
- }, pos), React.createElement("ul", {
27568
- className: "rpgui-list-imp",
27569
- style: {
27570
- overflow: 'hidden'
27637
+ var clearItemDetails = useCallback(function () {
27638
+ setItemDetails(defaultItemDetails);
27639
+ }, []);
27640
+ return React.createElement(ItemSlotTooltipContext.Provider, {
27641
+ value: {
27642
+ itemDetails: itemDetails,
27643
+ updateItemDetails: updateItemDetails,
27644
+ clearItemDetails: clearItemDetails
27571
27645
  }
27572
- }, options.map(function (params, index) {
27573
- return React.createElement(ListElement$2, {
27574
- key: (params == null ? void 0 : params.id) || index,
27575
- onPointerDown: function onPointerDown() {
27576
- onSelected(params == null ? void 0 : params.id);
27577
- }
27578
- }, (params == null ? void 0 : params.text) || 'No text');
27579
- }))));
27580
- };
27581
- var Container$9 = /*#__PURE__*/styled.div.withConfig({
27582
- displayName: "RelativeListMenu__Container",
27583
- componentId: "sc-7hohf-0"
27584
- })(["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) {
27585
- return props.y;
27586
- }, function (props) {
27587
- return props.x;
27588
- }, function (props) {
27589
- return props.fontSize;
27590
- });
27591
- var ListElement$2 = /*#__PURE__*/styled.li.withConfig({
27592
- displayName: "RelativeListMenu__ListElement",
27593
- componentId: "sc-7hohf-1"
27594
- })(["margin-right:0.5rem;"]);
27595
-
27596
- var MobileItemTooltip = function MobileItemTooltip(_ref) {
27597
- var item = _ref.item,
27598
- atlasIMG = _ref.atlasIMG,
27599
- atlasJSON = _ref.atlasJSON,
27600
- closeTooltip = _ref.closeTooltip,
27601
- equipmentSet = _ref.equipmentSet,
27602
- _ref$scale = _ref.scale,
27603
- scale = _ref$scale === void 0 ? 1 : _ref$scale,
27604
- options = _ref.options,
27605
- onSelected = _ref.onSelected;
27606
- var ref = useRef(null);
27607
- var handleFadeOut = function handleFadeOut() {
27608
- var _ref$current;
27609
- (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
27610
- };
27611
- return React.createElement(ModalPortal, null, React.createElement(Container$a, {
27612
- ref: ref,
27613
- onTouchEnd: function onTouchEnd() {
27614
- handleFadeOut();
27615
- setTimeout(function () {
27616
- closeTooltip();
27617
- }, 100);
27618
- },
27619
- scale: scale
27620
- }, React.createElement(ItemInfoDisplay, {
27621
- item: item,
27622
- atlasIMG: atlasIMG,
27623
- atlasJSON: atlasJSON,
27624
- equipmentSet: equipmentSet,
27625
- isMobile: true
27626
- }), React.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
27627
- return React.createElement(Option, {
27628
- key: option.id,
27629
- onTouchEnd: function onTouchEnd() {
27630
- handleFadeOut();
27631
- setTimeout(function () {
27632
- onSelected == null ? void 0 : onSelected(option.id);
27633
- closeTooltip();
27634
- }, 100);
27635
- }
27636
- }, option.text);
27637
- }))));
27646
+ }, children);
27638
27647
  };
27639
- var Container$a = /*#__PURE__*/styled.div.withConfig({
27640
- displayName: "MobileItemTooltip__Container",
27641
- componentId: "sc-ku4p1j-0"
27642
- })(["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;}"]);
27643
- var OptionsContainer = /*#__PURE__*/styled.div.withConfig({
27644
- displayName: "MobileItemTooltip__OptionsContainer",
27645
- componentId: "sc-ku4p1j-1"
27646
- })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
27647
- var Option = /*#__PURE__*/styled.button.withConfig({
27648
- displayName: "MobileItemTooltip__Option",
27649
- componentId: "sc-ku4p1j-2"
27650
- })(["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;}"]);
27651
-
27652
- var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
27653
- var tooltipState = _ref.tooltipState,
27654
- setTooltipState = _ref.setTooltipState,
27655
- contextMenuState = _ref.contextMenuState,
27656
- setContextMenuState = _ref.setContextMenuState,
27657
- isFocused = _ref.isFocused,
27658
- isContextMenuDisabled = _ref.isContextMenuDisabled,
27659
- item = _ref.item,
27660
- contextActions = _ref.contextActions,
27661
- dragScale = _ref.dragScale,
27662
- _onSelected = _ref.onSelected,
27663
- atlasIMG = _ref.atlasIMG,
27664
- atlasJSON = _ref.atlasJSON,
27665
- equipmentSet = _ref.equipmentSet;
27666
- return React.createElement(React.Fragment, null, tooltipState.visible && item && !isFocused && React.createElement(ItemTooltip, {
27667
- item: item,
27668
- atlasIMG: atlasIMG,
27669
- atlasJSON: atlasJSON,
27670
- equipmentSet: equipmentSet
27671
- }), tooltipState.mobileVisible && item && React.createElement(MobileItemTooltip, {
27672
- item: item,
27673
- atlasIMG: atlasIMG,
27674
- atlasJSON: atlasJSON,
27675
- equipmentSet: equipmentSet,
27676
- closeTooltip: function closeTooltip() {
27677
- setTooltipState(function (prev) {
27678
- return _extends({}, prev, {
27679
- mobileVisible: false
27680
- });
27681
- });
27682
- },
27683
- scale: dragScale,
27684
- options: contextActions,
27685
- onSelected: function onSelected(optionId) {
27686
- setContextMenuState(function (prev) {
27687
- return _extends({}, prev, {
27688
- visible: false
27689
- });
27690
- });
27691
- if (item) {
27692
- _onSelected == null ? void 0 : _onSelected(optionId, item);
27693
- }
27694
- }
27695
- }), !isContextMenuDisabled && contextMenuState.visible && contextActions && React.createElement(RelativeListMenu, {
27696
- options: contextActions,
27697
- onSelected: function onSelected(optionId) {
27698
- setContextMenuState(function (prev) {
27699
- return _extends({}, prev, {
27700
- visible: false
27701
- });
27702
- });
27703
- if (item) {
27704
- _onSelected == null ? void 0 : _onSelected(optionId, item);
27705
- }
27706
- },
27707
- onOutsideClick: function onOutsideClick() {
27708
- setContextMenuState(function (prev) {
27709
- return _extends({}, prev, {
27710
- visible: false
27711
- });
27712
- });
27713
- },
27714
- pos: contextMenuState.position
27715
- }));
27648
+ // Custom hook for consuming the context
27649
+ var useItemSlotTooltip = function useItemSlotTooltip() {
27650
+ return useContext(ItemSlotTooltipContext);
27716
27651
  };
27717
27652
 
27718
- var DraggingContext = /*#__PURE__*/createContext({
27653
+ var ItemSlotDraggingContext = /*#__PURE__*/createContext({
27719
27654
  item: null,
27720
27655
  setDraggingItem: function setDraggingItem() {},
27721
27656
  dragState: {
@@ -27729,7 +27664,7 @@ var DraggingContext = /*#__PURE__*/createContext({
27729
27664
  },
27730
27665
  setDragState: function setDragState() {}
27731
27666
  });
27732
- var DraggingProvider = function DraggingProvider(_ref) {
27667
+ var ItemSlotDraggingProvider = function ItemSlotDraggingProvider(_ref) {
27733
27668
  var children = _ref.children;
27734
27669
  var _useState = useState(null),
27735
27670
  item = _useState[0],
@@ -27745,7 +27680,7 @@ var DraggingProvider = function DraggingProvider(_ref) {
27745
27680
  }),
27746
27681
  dragState = _useState2[0],
27747
27682
  setDragState = _useState2[1];
27748
- return React.createElement(DraggingContext.Provider, {
27683
+ return React.createElement(ItemSlotDraggingContext.Provider, {
27749
27684
  value: {
27750
27685
  item: item,
27751
27686
  setDraggingItem: setDraggingItem,
@@ -27754,8 +27689,8 @@ var DraggingProvider = function DraggingProvider(_ref) {
27754
27689
  }
27755
27690
  }, children);
27756
27691
  };
27757
- var useDragging = function useDragging() {
27758
- return useContext(DraggingContext);
27692
+ var useItemSlotDragging = function useItemSlotDragging() {
27693
+ return useContext(ItemSlotDraggingContext);
27759
27694
  };
27760
27695
 
27761
27696
  var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
@@ -27772,15 +27707,16 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27772
27707
  containerType = _ref.containerType,
27773
27708
  slotIndex = _ref.slotIndex,
27774
27709
  openQuantitySelector = _ref.openQuantitySelector,
27775
- isContextMenuDisabled = _ref.isContextMenuDisabled,
27776
- setTooltipState = _ref.setTooltipState,
27777
- setContextMenuState = _ref.setContextMenuState;
27710
+ isContextMenuDisabled = _ref.isContextMenuDisabled;
27778
27711
  var dragContainer = useRef(null);
27779
- var _useDragging = useDragging(),
27780
- draggingItem = _useDragging.item,
27781
- setDraggingItem = _useDragging.setDraggingItem,
27782
- dragState = _useDragging.dragState,
27783
- setDragState = _useDragging.setDragState;
27712
+ var _useItemSlotDragging = useItemSlotDragging(),
27713
+ draggingItem = _useItemSlotDragging.item,
27714
+ setDraggingItem = _useItemSlotDragging.setDraggingItem,
27715
+ dragState = _useItemSlotDragging.dragState,
27716
+ setDragState = _useItemSlotDragging.setDragState;
27717
+ var _useItemSlotTooltip = useItemSlotTooltip(),
27718
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails,
27719
+ itemDetails = _useItemSlotTooltip.itemDetails;
27784
27720
  useEffect(function () {
27785
27721
  setDragState(function (prev) {
27786
27722
  return _extends({}, prev, {
@@ -27819,6 +27755,7 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27819
27755
  };
27820
27756
  }, []);
27821
27757
  var resetDragState = useCallback(function () {
27758
+ console.log('RESET_DRAG_STATE!');
27822
27759
  setDragState(function (prev) {
27823
27760
  return _extends({}, prev, {
27824
27761
  wasDragged: false,
@@ -27829,20 +27766,35 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27829
27766
  }
27830
27767
  });
27831
27768
  });
27832
- }, [setTooltipState, setDragState]);
27769
+ setDraggingItem(null);
27770
+ // Reset tooltip visibility
27771
+ updateItemDetails({
27772
+ tooltip: {
27773
+ visible: false,
27774
+ mobileVisible: false
27775
+ }
27776
+ });
27777
+ }, [updateItemDetails, setDragState]);
27833
27778
  var handleSuccessfulDrag = useCallback(function (quantity) {
27779
+ console.log('HANDLE_SUCCESSFUL_DRAG!');
27834
27780
  resetDragState();
27835
27781
  if (quantity !== -1 && item) {
27836
27782
  onDragEnd == null ? void 0 : onDragEnd(quantity);
27837
27783
  }
27838
27784
  }, [item, onDragEnd, resetDragState]);
27839
27785
  var onDraggableStart = useCallback(function () {
27786
+ console.log('ON_DRAGGABLE_START!');
27840
27787
  if (!item || isSelectingShortcut) return;
27841
27788
  if (onDragStart && containerType) {
27842
27789
  onDragStart(item, slotIndex, containerType);
27843
27790
  }
27791
+ if (!draggingItem && item) {
27792
+ console.log('!!! SETTING DRAGGING ITEM ', item._id);
27793
+ setDraggingItem(item);
27794
+ }
27844
27795
  }, [item, isSelectingShortcut, onDragStart, containerType, slotIndex]);
27845
27796
  var onDraggableProgress = useCallback(function (_e, data) {
27797
+ console.log('ON_DRAGGABLE_PROGRESS!');
27846
27798
  var _dragState$position = dragState.position,
27847
27799
  x = _dragState$position.x,
27848
27800
  y = _dragState$position.y;
@@ -27854,14 +27806,9 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27854
27806
  });
27855
27807
  });
27856
27808
  }
27857
- if (!draggingItem) {
27858
- setDraggingItem(item);
27859
- }
27860
27809
  }, [dragState.position, draggingItem, item, setDraggingItem, setDragState]);
27861
27810
  var onDraggableStop = useCallback(function (e, data) {
27862
- setTimeout(function () {
27863
- setDraggingItem(null);
27864
- }, 50);
27811
+ console.log('ON_DRAGGABLE_STOP!');
27865
27812
  var target = e.target;
27866
27813
  if (!target) return;
27867
27814
  target.classList.remove('react-draggable-dragging');
@@ -27904,27 +27851,33 @@ var useItemSlotDragAndDrop = function useItemSlotDragAndDrop(_ref) {
27904
27851
  }, 50);
27905
27852
  } else if (item) {
27906
27853
  var isTouch = e.type === 'touchend';
27907
- if (!isContextMenuDisabled && isTouch && !isSelectingShortcut && !draggingItem) {
27908
- setTooltipState(function (prev) {
27909
- return _extends({}, prev, {
27854
+ console.log("Debug: \n isTouch: " + isTouch + ",\n isSelectingShortcut: " + isSelectingShortcut + ",\n draggingItem: " + draggingItem + ",\n dragginState: " + JSON.stringify(dragState) + "\n ");
27855
+ if (!isContextMenuDisabled && isTouch && !isSelectingShortcut) {
27856
+ updateItemDetails({
27857
+ item: item,
27858
+ tooltip: {
27910
27859
  mobileVisible: true
27911
- });
27860
+ }
27912
27861
  });
27913
27862
  } else if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
27863
+ var _itemDetails$contextM;
27914
27864
  var event = e;
27915
- setContextMenuState(function (prev) {
27916
- return {
27917
- visible: !prev.visible,
27865
+ updateItemDetails({
27866
+ item: item,
27867
+ contextMenu: {
27868
+ visible: !(itemDetails != null && (_itemDetails$contextM = itemDetails.contextMenu) != null && _itemDetails$contextM.visible),
27918
27869
  position: {
27919
27870
  x: event.clientX - 10,
27920
27871
  y: event.clientY - 5
27921
27872
  }
27922
- };
27873
+ }
27923
27874
  });
27924
27875
  }
27925
27876
  onPointerDown == null ? void 0 : onPointerDown(item.type, containerType != null ? containerType : null, item);
27926
27877
  }
27927
- }, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, setTooltipState, setContextMenuState, onPointerDown, containerType, setItemShortcut]);
27878
+ console.log('setting draggingItem to null');
27879
+ setDraggingItem(null);
27880
+ }, [dragState.wasDragged, item, isSelectingShortcut, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, openQuantitySelector, handleSuccessfulDrag, resetDragState, isContextMenuDisabled, onPointerDown, containerType, setItemShortcut]);
27928
27881
  return {
27929
27882
  dragContainer: dragContainer,
27930
27883
  dragState: dragState,
@@ -28083,7 +28036,6 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28083
28036
  _onMouseOver = _ref.onMouseOver,
28084
28037
  onMouseOut = _ref.onMouseOut,
28085
28038
  onPointerDown = _ref.onPointerDown,
28086
- _onSelected = _ref.onSelected,
28087
28039
  atlasJSON = _ref.atlasJSON,
28088
28040
  atlasIMG = _ref.atlasIMG,
28089
28041
  _ref$isContextMenuDis = _ref.isContextMenuDisabled,
@@ -28096,27 +28048,8 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28096
28048
  openQuantitySelector = _ref.openQuantitySelector,
28097
28049
  dragScale = _ref.dragScale,
28098
28050
  isSelectingShortcut = _ref.isSelectingShortcut,
28099
- equipmentSet = _ref.equipmentSet,
28100
28051
  setItemShortcut = _ref.setItemShortcut,
28101
28052
  isDepotSystem = _ref.isDepotSystem;
28102
- var _useState = useState({
28103
- visible: false,
28104
- mobileVisible: false
28105
- }),
28106
- tooltipState = _useState[0],
28107
- setTooltipState = _useState[1];
28108
- var _useState2 = useState({
28109
- visible: false,
28110
- position: {
28111
- x: 0,
28112
- y: 0
28113
- }
28114
- }),
28115
- contextMenuState = _useState2[0],
28116
- setContextMenuState = _useState2[1];
28117
- var _useState3 = useState([]),
28118
- contextActions = _useState3[0],
28119
- setContextActions = _useState3[1];
28120
28053
  var _useItemSlotDragAndDr = useItemSlotDragAndDrop({
28121
28054
  isDepotSystem: !!isDepotSystem,
28122
28055
  item: item,
@@ -28130,10 +28063,7 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28130
28063
  containerType: containerType,
28131
28064
  slotIndex: slotIndex,
28132
28065
  openQuantitySelector: openQuantitySelector != null ? openQuantitySelector : function () {},
28133
- isContextMenuDisabled: isContextMenuDisabled,
28134
- setTooltipState: setTooltipState,
28135
- contextMenuState: contextMenuState,
28136
- setContextMenuState: setContextMenuState
28066
+ isContextMenuDisabled: isContextMenuDisabled
28137
28067
  }),
28138
28068
  dragContainer = _useItemSlotDragAndDr.dragContainer,
28139
28069
  dragState = _useItemSlotDragAndDr.dragState,
@@ -28142,17 +28072,28 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28142
28072
  onDraggableStart = _useItemSlotDragAndDr.onDraggableStart,
28143
28073
  onDraggableProgress = _useItemSlotDragAndDr.onDraggableProgress,
28144
28074
  onDraggableStop = _useItemSlotDragAndDr.onDraggableStop;
28075
+ var _useItemSlotTooltip = useItemSlotTooltip(),
28076
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails,
28077
+ itemDetails = _useItemSlotTooltip.itemDetails;
28078
+ var _useCursorPosition = useCursorPosition({
28079
+ scale: dragScale
28080
+ }),
28081
+ cursorX = _useCursorPosition.x,
28082
+ cursorY = _useCursorPosition.y;
28145
28083
  useEffect(function () {
28146
28084
  if (item && containerType) {
28147
- setContextActions(generateContextMenu(item, containerType, isDepotSystem));
28085
+ updateItemDetails({
28086
+ item: item,
28087
+ contextMenu: {
28088
+ actions: generateContextMenu(item, containerType, isDepotSystem)
28089
+ }
28090
+ });
28148
28091
  }
28149
28092
  }, [item, isDepotSystem]);
28150
28093
  var bounds = getContainerBounds();
28151
28094
  var handleInteraction = useCallback(function (event) {
28152
28095
  event.stopPropagation();
28153
- var _ref2 = 'touches' in event ? event.touches[0] : event,
28154
- clientX = _ref2.clientX,
28155
- clientY = _ref2.clientY;
28096
+ console.log('handleInteraction');
28156
28097
  if (item && containerType) {
28157
28098
  if (onPlaceDrop && draggingItem) {
28158
28099
  onPlaceDrop(item, slotIndex, containerType);
@@ -28161,36 +28102,31 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28161
28102
  onPointerDown(item.type, containerType, item);
28162
28103
  }
28163
28104
  }
28164
- setTooltipState(function (prev) {
28165
- return _extends({}, prev, {
28166
- visible: true
28167
- });
28168
- });
28169
- _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, clientX, clientY);
28170
- }, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd]);
28105
+ _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, cursorX, cursorY);
28106
+ }, [item, containerType, slotIndex, onPlaceDrop, onPointerDown, _onMouseOver, onDragStart, onDragEnd, cursorX, cursorY]);
28171
28107
  var handleInteractionEnd = useCallback(function (event) {
28172
28108
  event.preventDefault();
28173
28109
  event.stopPropagation();
28174
- setTooltipState(function (prev) {
28175
- return _extends({}, prev, {
28176
- visible: false
28177
- });
28178
- });
28110
+ console.log('handleInteractionEnd');
28111
+ console.log('itemDetails', itemDetails);
28179
28112
  onMouseOut == null ? void 0 : onMouseOut();
28180
- if (event.type === 'touchend' && 'changedTouches' in event) {
28113
+ if (event.type === 'touchend') {
28181
28114
  var _document$elementFrom;
28182
- var _event$changedTouches = event.changedTouches[0],
28183
- clientX = _event$changedTouches.clientX,
28184
- clientY = _event$changedTouches.clientY;
28185
28115
  var simulatedEvent = new MouseEvent('mouseup', {
28186
- clientX: clientX,
28187
- clientY: clientY,
28116
+ clientX: cursorX,
28117
+ clientY: cursorY,
28188
28118
  bubbles: true
28189
28119
  });
28190
- (_document$elementFrom = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28120
+ (_document$elementFrom = document.elementFromPoint(cursorX, cursorY)) == null ? void 0 : _document$elementFrom.dispatchEvent(simulatedEvent);
28121
+ updateItemDetails({
28122
+ item: item,
28123
+ tooltip: {
28124
+ visible: false
28125
+ }
28126
+ });
28191
28127
  }
28192
- }, [onMouseOut]);
28193
- return React.createElement(Container$b, {
28128
+ }, [onMouseOut, cursorX, cursorY]);
28129
+ return React.createElement(Container$9, {
28194
28130
  isDraggingItem: !!draggingItem,
28195
28131
  item: item,
28196
28132
  className: "rpgui-icon empty-slot",
@@ -28234,22 +28170,24 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28234
28170
  }, React.createElement(ItemContainer, {
28235
28171
  ref: dragContainer,
28236
28172
  isFocused: dragState.isFocused,
28237
- onMouseOver: function onMouseOver(event) {
28238
- _onMouseOver == null ? void 0 : _onMouseOver(event, slotIndex, item, event.clientX, event.clientY);
28173
+ onMouseOver: function onMouseOver() {
28174
+ _onMouseOver == null ? void 0 : _onMouseOver({}, slotIndex, item, cursorX, cursorY);
28239
28175
  },
28240
28176
  onMouseOut: onMouseOut,
28241
28177
  onMouseEnter: function onMouseEnter() {
28242
- setTooltipState(function (prev) {
28243
- return _extends({}, prev, {
28178
+ updateItemDetails({
28179
+ item: item,
28180
+ tooltip: {
28244
28181
  visible: true
28245
- });
28182
+ }
28246
28183
  });
28247
28184
  },
28248
28185
  onMouseLeave: function onMouseLeave() {
28249
- setTooltipState(function (prev) {
28250
- return _extends({}, prev, {
28186
+ updateItemDetails({
28187
+ item: item,
28188
+ tooltip: {
28251
28189
  visible: false
28252
- });
28190
+ }
28253
28191
  });
28254
28192
  }
28255
28193
  }, React.createElement(ItemSlotRenderer, {
@@ -28258,46 +28196,25 @@ var ItemSlot = /*#__PURE__*/React.memo( /*#__PURE__*/observer(function (_ref) {
28258
28196
  atlasIMG: atlasIMG,
28259
28197
  atlasJSON: atlasJSON,
28260
28198
  containerType: containerType
28261
- }))), React.createElement(ItemSlotToolTips, {
28262
- tooltipState: tooltipState,
28263
- setTooltipState: setTooltipState,
28264
- contextMenuState: contextMenuState,
28265
- setContextMenuState: setContextMenuState,
28266
- isFocused: dragState.isFocused,
28267
- isContextMenuDisabled: isContextMenuDisabled,
28268
- item: item,
28269
- contextActions: contextActions,
28270
- dragScale: dragScale,
28271
- onSelected: function onSelected(optionId, item) {
28272
- setContextMenuState(function (prev) {
28273
- return _extends({}, prev, {
28274
- visible: false
28275
- });
28276
- });
28277
- if (_onSelected) _onSelected(optionId, item);
28278
- },
28279
- atlasIMG: atlasIMG,
28280
- atlasJSON: atlasJSON,
28281
- equipmentSet: equipmentSet
28282
- }));
28199
+ }))));
28283
28200
  }));
28284
- var Container$b = /*#__PURE__*/styled.div.withConfig({
28201
+ var Container$9 = /*#__PURE__*/styled.div.withConfig({
28285
28202
  displayName: "ItemSlot__Container",
28286
28203
  componentId: "sc-l2j5ef-0"
28287
- })(["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) {
28288
- var isDraggingItem = _ref3.isDraggingItem;
28204
+ })(["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) {
28205
+ var isDraggingItem = _ref2.isDraggingItem;
28289
28206
  return isDraggingItem ? 0 : 1;
28207
+ }, function (_ref3) {
28208
+ var item = _ref3.item;
28209
+ return rarityColor(item);
28290
28210
  }, function (_ref4) {
28291
28211
  var item = _ref4.item;
28292
- return rarityColor(item);
28212
+ return "0 0 5px 2px " + rarityColor(item);
28293
28213
  }, function (_ref5) {
28294
28214
  var item = _ref5.item;
28295
- return "0 0 5px 2px " + rarityColor(item);
28296
- }, function (_ref6) {
28297
- var item = _ref6.item;
28298
28215
  return "0 0 4px 3px " + rarityColor(item);
28299
- }, function (_ref7) {
28300
- var isSelectingShortcut = _ref7.isSelectingShortcut;
28216
+ }, function (_ref6) {
28217
+ var isSelectingShortcut = _ref6.isSelectingShortcut;
28301
28218
  return isSelectingShortcut ? 'bg-color-change 1s infinite' : 'none';
28302
28219
  });
28303
28220
  var ItemContainer = /*#__PURE__*/styled.div.withConfig({
@@ -28397,7 +28314,7 @@ var ItemInfo = function ItemInfo(_ref) {
28397
28314
  });
28398
28315
  };
28399
28316
  var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
28400
- return React.createElement(Container$c, {
28317
+ return React.createElement(Container$a, {
28401
28318
  item: item
28402
28319
  }, React.createElement(Header, null, React.createElement("div", null, React.createElement(Title$1, null, item.name), item.rarity !== 'Common' && React.createElement(Rarity, {
28403
28320
  item: item
@@ -28411,7 +28328,7 @@ var ItemInfo = function ItemInfo(_ref) {
28411
28328
  "$isSpecial": true
28412
28329
  }, "Two handed"), React.createElement(Description, null, item.description), item.maxStackSize && item.maxStackSize !== 1 && React.createElement(StackInfo, null, "x", Math.round(((_item$stackQty = item.stackQty) != null ? _item$stackQty : 1) * 100) / 100, "(", item.maxStackSize, ")"), renderMissingStatistic().length > 0 && React.createElement(MissingStatistics, null, React.createElement(Statistic, null, "Equipped Diff"), itemToCompare && renderMissingStatistic()));
28413
28330
  };
28414
- var Container$c = /*#__PURE__*/styled.div.withConfig({
28331
+ var Container$a = /*#__PURE__*/styled.div.withConfig({
28415
28332
  displayName: "ItemInfo__Container",
28416
28333
  componentId: "sc-1xm4q8k-0"
28417
28334
  })(["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) {
@@ -28557,7 +28474,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28557
28474
  }
28558
28475
  return;
28559
28476
  }, []);
28560
- return React.createElement(ModalPortal, null, React.createElement(Container$d, {
28477
+ return React.createElement(ModalPortal, null, React.createElement(Container$b, {
28561
28478
  ref: ref
28562
28479
  }, React.createElement(ItemInfoDisplay, {
28563
28480
  item: item,
@@ -28566,11 +28483,67 @@ var ItemTooltip = function ItemTooltip(_ref) {
28566
28483
  equipmentSet: equipmentSet
28567
28484
  })));
28568
28485
  };
28569
- var Container$d = /*#__PURE__*/styled.div.withConfig({
28486
+ var Container$b = /*#__PURE__*/styled.div.withConfig({
28570
28487
  displayName: "ItemTooltip__Container",
28571
28488
  componentId: "sc-11d9r7x-0"
28572
28489
  })(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
28573
28490
 
28491
+ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28492
+ var item = _ref.item,
28493
+ atlasIMG = _ref.atlasIMG,
28494
+ atlasJSON = _ref.atlasJSON,
28495
+ closeTooltip = _ref.closeTooltip,
28496
+ equipmentSet = _ref.equipmentSet,
28497
+ _ref$scale = _ref.scale,
28498
+ scale = _ref$scale === void 0 ? 1 : _ref$scale,
28499
+ options = _ref.options,
28500
+ onSelected = _ref.onSelected;
28501
+ var ref = useRef(null);
28502
+ var handleFadeOut = function handleFadeOut() {
28503
+ var _ref$current;
28504
+ (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
28505
+ };
28506
+ return React.createElement(ModalPortal, null, React.createElement(Container$c, {
28507
+ ref: ref,
28508
+ onTouchEnd: function onTouchEnd() {
28509
+ handleFadeOut();
28510
+ setTimeout(function () {
28511
+ closeTooltip();
28512
+ }, 100);
28513
+ },
28514
+ scale: scale
28515
+ }, React.createElement(ItemInfoDisplay, {
28516
+ item: item,
28517
+ atlasIMG: atlasIMG,
28518
+ atlasJSON: atlasJSON,
28519
+ equipmentSet: equipmentSet,
28520
+ isMobile: true
28521
+ }), React.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
28522
+ return React.createElement(Option, {
28523
+ key: option.id,
28524
+ onTouchEnd: function onTouchEnd() {
28525
+ handleFadeOut();
28526
+ setTimeout(function () {
28527
+ onSelected == null ? void 0 : onSelected(option.id);
28528
+ closeTooltip();
28529
+ }, 100);
28530
+ }
28531
+ }, option.text);
28532
+ }))));
28533
+ };
28534
+ var Container$c = /*#__PURE__*/styled.div.withConfig({
28535
+ displayName: "MobileItemTooltip__Container",
28536
+ componentId: "sc-ku4p1j-0"
28537
+ })(["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;}"]);
28538
+ var OptionsContainer = /*#__PURE__*/styled.div.withConfig({
28539
+ displayName: "MobileItemTooltip__OptionsContainer",
28540
+ componentId: "sc-ku4p1j-1"
28541
+ })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
28542
+ var Option = /*#__PURE__*/styled.button.withConfig({
28543
+ displayName: "MobileItemTooltip__Option",
28544
+ componentId: "sc-ku4p1j-2"
28545
+ })(["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;}"]);
28546
+
28574
28547
  var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28575
28548
  var children = _ref.children,
28576
28549
  atlasIMG = _ref.atlasIMG,
@@ -28925,7 +28898,7 @@ var Dropdown = function Dropdown(_ref) {
28925
28898
  onChange(selectedValue);
28926
28899
  }
28927
28900
  }, [selectedValue]);
28928
- return React.createElement(Container$e, {
28901
+ return React.createElement(Container$d, {
28929
28902
  onMouseLeave: function onMouseLeave() {
28930
28903
  return setOpened(false);
28931
28904
  },
@@ -28953,7 +28926,7 @@ var Dropdown = function Dropdown(_ref) {
28953
28926
  }, option.option);
28954
28927
  })));
28955
28928
  };
28956
- var Container$e = /*#__PURE__*/styled.div.withConfig({
28929
+ var Container$d = /*#__PURE__*/styled.div.withConfig({
28957
28930
  displayName: "Dropdown__Container",
28958
28931
  componentId: "sc-8arn65-0"
28959
28932
  })(["position:relative;width:", ";"], function (props) {
@@ -28995,57 +28968,6 @@ var Details = /*#__PURE__*/styled.p.withConfig({
28995
28968
  componentId: "sc-kaa0h9-0"
28996
28969
  })(["font-size:", " !important;"], uiFonts.size.xsmall);
28997
28970
 
28998
- var useCursorPosition = function useCursorPosition(_ref) {
28999
- var _ref$scale = _ref.scale,
29000
- scale = _ref$scale === void 0 ? 1 : _ref$scale;
29001
- var _useState = useState({
29002
- x: 0,
29003
- y: 0
29004
- }),
29005
- position = _useState[0],
29006
- setPosition = _useState[1];
29007
- var scalePosition = useCallback(function (x, y) {
29008
- return {
29009
- x: (x - GRID_WIDTH / 2) / scale + GRID_WIDTH / 2,
29010
- y: (y - GRID_HEIGHT / 2) / scale + GRID_HEIGHT / 2
29011
- };
29012
- }, [scale]);
29013
- var setFromEvent = useCallback(function (e) {
29014
- var x, y;
29015
- if ('touches' in e) {
29016
- x = e.touches[0].clientX;
29017
- y = e.touches[0].clientY;
29018
- } else {
29019
- x = e.clientX;
29020
- y = e.clientY;
29021
- }
29022
- var scaledPosition = scalePosition(x, y);
29023
- setPosition(scaledPosition);
29024
- }, [scale, scalePosition]);
29025
- var cleanup = useCallback(function () {
29026
- setPosition({
29027
- x: 0,
29028
- y: 0
29029
- });
29030
- }, []);
29031
- useEffect(function () {
29032
- var handleEvent = function handleEvent(e) {
29033
- return setFromEvent(e);
29034
- };
29035
- window.addEventListener('mousemove', handleEvent);
29036
- window.addEventListener('touchmove', handleEvent);
29037
- window.addEventListener('mouseup', cleanup);
29038
- window.addEventListener('touchend', cleanup);
29039
- return function () {
29040
- window.removeEventListener('mousemove', handleEvent);
29041
- window.removeEventListener('touchmove', handleEvent);
29042
- window.removeEventListener('mouseup', cleanup);
29043
- window.removeEventListener('touchend', cleanup);
29044
- };
29045
- }, [setFromEvent, cleanup]);
29046
- return position;
29047
- };
29048
-
29049
28971
  var CONTAINER_SIZE = 32;
29050
28972
  var OFFSET = CONTAINER_SIZE / 2;
29051
28973
  var DraggedItem = function DraggedItem(_ref) {
@@ -29053,8 +28975,8 @@ var DraggedItem = function DraggedItem(_ref) {
29053
28975
  var atlasJSON = _ref.atlasJSON,
29054
28976
  atlasIMG = _ref.atlasIMG,
29055
28977
  scale = _ref.scale;
29056
- var _useDragging = useDragging(),
29057
- item = _useDragging.item;
28978
+ var _useItemSlotDragging = useItemSlotDragging(),
28979
+ item = _useItemSlotDragging.item;
29058
28980
  var _useCursorPosition = useCursorPosition({
29059
28981
  scale: scale
29060
28982
  }),
@@ -29069,7 +28991,7 @@ var DraggedItem = function DraggedItem(_ref) {
29069
28991
  var centeredX = x - OFFSET;
29070
28992
  var centeredY = y - OFFSET;
29071
28993
  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);
29072
- return React.createElement(Container$f, null, React.createElement(SpriteContainer, {
28994
+ return React.createElement(Container$e, null, React.createElement(SpriteContainer, {
29073
28995
  x: centeredX,
29074
28996
  y: centeredY
29075
28997
  }, React.createElement(SpriteFromAtlas, {
@@ -29087,7 +29009,7 @@ var DraggedItem = function DraggedItem(_ref) {
29087
29009
  }), stackInfo));
29088
29010
  };
29089
29011
  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";
29090
- var Container$f = /*#__PURE__*/styled.div.withConfig({
29012
+ var Container$e = /*#__PURE__*/styled.div.withConfig({
29091
29013
  displayName: "DraggedItem__Container",
29092
29014
  componentId: "sc-mlzzcp-0"
29093
29015
  })(["position:relative;"]);
@@ -29103,11 +29025,127 @@ var SpriteContainer = /*#__PURE__*/styled.div.attrs(function (props) {
29103
29025
  componentId: "sc-mlzzcp-1"
29104
29026
  })(["", " 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);
29105
29027
 
29028
+ var RelativeListMenu = function RelativeListMenu(_ref) {
29029
+ var options = _ref.options,
29030
+ onSelected = _ref.onSelected,
29031
+ onOutsideClick = _ref.onOutsideClick,
29032
+ _ref$fontSize = _ref.fontSize,
29033
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
29034
+ pos = _ref.pos;
29035
+ var ref = useRef(null);
29036
+ useOutsideClick(ref, 'relative-context-menu');
29037
+ useEffect(function () {
29038
+ document.addEventListener('clickOutside', function (event) {
29039
+ var e = event;
29040
+ if (e.detail.id === 'relative-context-menu') {
29041
+ if (onOutsideClick) {
29042
+ onOutsideClick();
29043
+ }
29044
+ }
29045
+ });
29046
+ return function () {
29047
+ document.removeEventListener('clickOutside', function (_e) {});
29048
+ };
29049
+ }, []);
29050
+ return React.createElement(ModalPortal, null, React.createElement(Container$f, Object.assign({
29051
+ fontSize: fontSize,
29052
+ ref: ref
29053
+ }, pos), React.createElement("ul", {
29054
+ className: "rpgui-list-imp",
29055
+ style: {
29056
+ overflow: 'hidden'
29057
+ }
29058
+ }, options.map(function (params, index) {
29059
+ return React.createElement(ListElement$2, {
29060
+ key: (params == null ? void 0 : params.id) || index,
29061
+ onPointerDown: function onPointerDown() {
29062
+ onSelected(params == null ? void 0 : params.id);
29063
+ }
29064
+ }, (params == null ? void 0 : params.text) || 'No text');
29065
+ }))));
29066
+ };
29067
+ var Container$f = /*#__PURE__*/styled.div.withConfig({
29068
+ displayName: "RelativeListMenu__Container",
29069
+ componentId: "sc-7hohf-0"
29070
+ })(["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) {
29071
+ return props.y;
29072
+ }, function (props) {
29073
+ return props.x;
29074
+ }, function (props) {
29075
+ return props.fontSize;
29076
+ });
29077
+ var ListElement$2 = /*#__PURE__*/styled.li.withConfig({
29078
+ displayName: "RelativeListMenu__ListElement",
29079
+ componentId: "sc-7hohf-1"
29080
+ })(["margin-right:0.5rem;"]);
29081
+
29082
+ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
29083
+ var _itemDetails$tooltip, _itemDetails$tooltip2, _itemDetails$contextM, _itemDetails$contextM2;
29084
+ var isFocused = _ref.isFocused,
29085
+ isContextMenuDisabled = _ref.isContextMenuDisabled,
29086
+ dragScale = _ref.dragScale,
29087
+ onSelected = _ref.onSelected,
29088
+ atlasIMG = _ref.atlasIMG,
29089
+ atlasJSON = _ref.atlasJSON,
29090
+ equipmentSet = _ref.equipmentSet;
29091
+ var _useItemSlotTooltip = useItemSlotTooltip(),
29092
+ itemDetails = _useItemSlotTooltip.itemDetails,
29093
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails;
29094
+ var item = itemDetails.item;
29095
+ var handleCloseTooltip = function handleCloseTooltip() {
29096
+ updateItemDetails({
29097
+ item: item,
29098
+ tooltip: {
29099
+ mobileVisible: false
29100
+ }
29101
+ });
29102
+ };
29103
+ var handleContextMenuSelect = function handleContextMenuSelect(optionId) {
29104
+ updateItemDetails({
29105
+ item: item,
29106
+ contextMenu: {
29107
+ visible: false
29108
+ }
29109
+ });
29110
+ if (item) {
29111
+ onSelected == null ? void 0 : onSelected(optionId, item);
29112
+ }
29113
+ };
29114
+ var handleOutsideClick = function handleOutsideClick() {
29115
+ updateItemDetails({
29116
+ item: item,
29117
+ contextMenu: {
29118
+ visible: false
29119
+ }
29120
+ });
29121
+ };
29122
+ // monitor why mobileVisible is not working
29123
+ return React.createElement(React.Fragment, null, ((_itemDetails$tooltip = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip.visible) && item && !isFocused && React.createElement(ItemTooltip, {
29124
+ item: item,
29125
+ atlasIMG: atlasIMG,
29126
+ atlasJSON: atlasJSON,
29127
+ equipmentSet: equipmentSet
29128
+ }), ((_itemDetails$tooltip2 = itemDetails.tooltip) == null ? void 0 : _itemDetails$tooltip2.mobileVisible) && item && React.createElement(MobileItemTooltip, {
29129
+ item: item,
29130
+ atlasIMG: atlasIMG,
29131
+ atlasJSON: atlasJSON,
29132
+ equipmentSet: equipmentSet,
29133
+ closeTooltip: handleCloseTooltip,
29134
+ scale: dragScale,
29135
+ options: ((_itemDetails$contextM = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM.actions) || [],
29136
+ onSelected: handleContextMenuSelect
29137
+ }), !isContextMenuDisabled && ((_itemDetails$contextM2 = itemDetails.contextMenu) == null ? void 0 : _itemDetails$contextM2.visible) && itemDetails.contextMenu.actions && React.createElement(RelativeListMenu, {
29138
+ options: itemDetails.contextMenu.actions,
29139
+ onSelected: handleContextMenuSelect,
29140
+ onOutsideClick: handleOutsideClick,
29141
+ pos: itemDetails.contextMenu.position
29142
+ }));
29143
+ };
29144
+
29106
29145
  var EquipmentSet = function EquipmentSet(_ref) {
29107
29146
  var equipmentSet = _ref.equipmentSet,
29108
29147
  onClose = _ref.onClose,
29109
29148
  _onMouseOver = _ref.onMouseOver,
29110
- _onSelected = _ref.onSelected,
29111
29149
  onItemClick = _ref.onItemClick,
29112
29150
  atlasIMG = _ref.atlasIMG,
29113
29151
  atlasJSON = _ref.atlasJSON,
@@ -29116,11 +29154,11 @@ var EquipmentSet = function EquipmentSet(_ref) {
29116
29154
  onItemPlaceDrop = _ref.onItemPlaceDrop,
29117
29155
  onItemOutsideDrop = _ref.onItemOutsideDrop,
29118
29156
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
29119
- checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
29120
29157
  scale = _ref.scale,
29121
29158
  initialPosition = _ref.initialPosition,
29122
29159
  onPositionChangeEnd = _ref.onPositionChangeEnd,
29123
- onPositionChangeStart = _ref.onPositionChangeStart;
29160
+ onPositionChangeStart = _ref.onPositionChangeStart,
29161
+ _onSelected = _ref.onSelected;
29124
29162
  var neck = equipmentSet.neck,
29125
29163
  leftHand = equipmentSet.leftHand,
29126
29164
  ring = equipmentSet.ring,
@@ -29133,6 +29171,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
29133
29171
  accessory = equipmentSet.accessory;
29134
29172
  var equipmentData = [neck, leftHand, ring, head, armor, legs, boot, inventory, rightHand, accessory];
29135
29173
  var equipmentMaskSlots = [ItemSlotType.Neck, ItemSlotType.LeftHand, ItemSlotType.Ring, ItemSlotType.Head, ItemSlotType.Torso, ItemSlotType.Legs, ItemSlotType.Feet, ItemSlotType.Inventory, ItemSlotType.RightHand, ItemSlotType.Accessory];
29174
+ var _useItemSlotDragging = useItemSlotDragging(),
29175
+ dragState = _useItemSlotDragging.dragState;
29176
+ var _useItemSlotTooltip = useItemSlotTooltip(),
29177
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails;
29136
29178
  var onRenderEquipmentSlotRange = function onRenderEquipmentSlotRange(start, end) {
29137
29179
  var equipmentRange = equipmentData.slice(start, end);
29138
29180
  var slotMaksRange = equipmentMaskSlots.slice(start, end);
@@ -29153,9 +29195,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
29153
29195
  onPointerDown: function onPointerDown(itemType, ContainerType) {
29154
29196
  if (onItemClick) onItemClick(itemType, item, ContainerType);
29155
29197
  },
29156
- onSelected: function onSelected(optionId) {
29157
- if (_onSelected) _onSelected(optionId);
29158
- },
29159
29198
  onDragStart: function onDragStart(item, slotIndex, itemContainerType) {
29160
29199
  if (!item) {
29161
29200
  return;
@@ -29167,7 +29206,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
29167
29206
  },
29168
29207
  dragScale: scale,
29169
29208
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
29170
- checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
29171
29209
  onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
29172
29210
  if (onItemPlaceDrop) onItemPlaceDrop(item, slotIndex, itemContainerType);
29173
29211
  },
@@ -29179,7 +29217,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
29179
29217
  });
29180
29218
  });
29181
29219
  };
29182
- return React.createElement(DraggingProvider, null, React.createElement(DraggedItem, {
29220
+ return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotTooltipProvider, null, React.createElement(DraggedItem, {
29183
29221
  atlasIMG: atlasIMG,
29184
29222
  atlasJSON: atlasJSON,
29185
29223
  scale: scale
@@ -29197,7 +29235,23 @@ var EquipmentSet = function EquipmentSet(_ref) {
29197
29235
  onPositionChangeStart: onPositionChangeStart
29198
29236
  }, React.createElement(EquipmentSetContainer, {
29199
29237
  className: "equipment-container-body"
29200
- }, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))));
29238
+ }, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))), React.createElement(ItemSlotToolTips, {
29239
+ isFocused: dragState.isFocused,
29240
+ isContextMenuDisabled: isMobile(),
29241
+ dragScale: scale,
29242
+ onSelected: function onSelected(optionId, item) {
29243
+ updateItemDetails({
29244
+ item: item,
29245
+ contextMenu: {
29246
+ visible: false
29247
+ }
29248
+ });
29249
+ if (_onSelected) _onSelected(optionId);
29250
+ },
29251
+ atlasIMG: atlasIMG,
29252
+ atlasJSON: atlasJSON,
29253
+ equipmentSet: equipmentSet
29254
+ })));
29201
29255
  };
29202
29256
  var EquipmentSetContainer = /*#__PURE__*/styled.div.withConfig({
29203
29257
  displayName: "EquipmentSet__EquipmentSetContainer",
@@ -30678,14 +30732,12 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30678
30732
  document.removeEventListener('pointermove', handleMouseMove);
30679
30733
  }, [handleMouseMove, onItemDragStart, stopScrolling]);
30680
30734
  var onDragStart = function onDragStart(item, slotIndex, itemContainerType) {
30681
- console.log('DRAG START');
30682
30735
  if (onItemDragStart) {
30683
30736
  onItemDragStart(item, slotIndex, itemContainerType);
30684
30737
  }
30685
30738
  onDragStartScrollingEvents();
30686
30739
  };
30687
30740
  var onDragEnd = function onDragEnd(quantity) {
30688
- console.log('DRAG END');
30689
30741
  if (onItemDragEnd) {
30690
30742
  onItemDragEnd(quantity);
30691
30743
  }
@@ -30712,9 +30764,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30712
30764
  onItemClick(item, itemType, containerType);
30713
30765
  }
30714
30766
  },
30715
- onSelected: function onSelected(optionId, item) {
30716
- if (_onSelected) _onSelected(optionId, item);
30717
- },
30718
30767
  onDragStart: onDragStart,
30719
30768
  onDragEnd: onDragEnd,
30720
30769
  dragScale: scale,
@@ -30743,14 +30792,17 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30743
30792
  atlasIMG: atlasIMG,
30744
30793
  atlasJSON: atlasJSON,
30745
30794
  isSelectingShortcut: settingShortcutIndex !== -1,
30746
- equipmentSet: equipmentSet,
30747
30795
  setItemShortcut: type === ItemContainerType.Inventory ? handleSetShortcut : undefined,
30748
30796
  isDepotSystem: isDepotSystem
30749
30797
  }));
30750
30798
  }
30751
30799
  return slots;
30752
30800
  };
30753
- return React.createElement(DraggingProvider, null, React.createElement(DraggedItem, {
30801
+ var _useItemSlotTooltip = useItemSlotTooltip(),
30802
+ updateItemDetails = _useItemSlotTooltip.updateItemDetails;
30803
+ var _useItemSlotDragging = useItemSlotDragging(),
30804
+ dragState = _useItemSlotDragging.dragState;
30805
+ return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotTooltipProvider, null, React.createElement(DraggedItem, {
30754
30806
  atlasIMG: atlasIMG,
30755
30807
  atlasJSON: atlasJSON,
30756
30808
  scale: scale
@@ -30775,10 +30827,26 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30775
30827
  ref: containerRef,
30776
30828
  isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
30777
30829
  isFullScreen: isFullScreen
30778
- }, onRenderSlots())), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
30830
+ }, onRenderSlots())), React.createElement(ItemSlotToolTips, {
30831
+ isFocused: dragState.isFocused,
30832
+ isContextMenuDisabled: disableContextMenu,
30833
+ dragScale: scale,
30834
+ onSelected: function onSelected(optionId, item) {
30835
+ updateItemDetails({
30836
+ item: item,
30837
+ contextMenu: {
30838
+ visible: false
30839
+ }
30840
+ });
30841
+ if (_onSelected) _onSelected(optionId, item);
30842
+ },
30843
+ atlasIMG: atlasIMG,
30844
+ atlasJSON: atlasJSON,
30845
+ equipmentSet: equipmentSet
30846
+ }), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
30779
30847
  quantitySelect: quantitySelect,
30780
30848
  setQuantitySelect: setQuantitySelect
30781
- }));
30849
+ })));
30782
30850
  };
30783
30851
  var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
30784
30852
  displayName: "ItemContainer__ItemsContainer",