@rpg-engine/long-bow 0.7.71 → 0.7.73

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.
@@ -27545,188 +27545,6 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
27545
27545
  return React__default.createElement(React__default.Fragment, null, onRenderSlot(item));
27546
27546
  };
27547
27547
 
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');
27557
- 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
- }
27565
- });
27566
- return function () {
27567
- document.removeEventListener('clickOutside', function (_e) {});
27568
- };
27569
- }, []);
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'
27577
- }
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
- }))));
27644
- };
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 isTooltipVisible = _ref.isTooltipVisible,
27660
- isFocused = _ref.isFocused,
27661
- isContextMenuVisible = _ref.isContextMenuVisible,
27662
- isContextMenuDisabled = _ref.isContextMenuDisabled,
27663
- item = _ref.item,
27664
- contextActions = _ref.contextActions,
27665
- contextMenuPosition = _ref.contextMenuPosition,
27666
- dragScale = _ref.dragScale,
27667
- setIsContextMenuVisible = _ref.setIsContextMenuVisible,
27668
- setIsTooltipMobileVisible = _ref.setIsTooltipMobileVisible,
27669
- isTooltipMobileVisible = _ref.isTooltipMobileVisible,
27670
- _onSelected = _ref.onSelected,
27671
- atlasIMG = _ref.atlasIMG,
27672
- atlasJSON = _ref.atlasJSON,
27673
- equipmentSet = _ref.equipmentSet;
27674
- return React__default.createElement(React__default.Fragment, null, isTooltipVisible && item && !isFocused && React__default.createElement(ItemTooltip, {
27675
- item: item,
27676
- atlasIMG: atlasIMG,
27677
- atlasJSON: atlasJSON,
27678
- equipmentSet: equipmentSet
27679
- }), isTooltipMobileVisible && item && React__default.createElement(MobileItemTooltip, {
27680
- item: item,
27681
- atlasIMG: atlasIMG,
27682
- atlasJSON: atlasJSON,
27683
- equipmentSet: equipmentSet,
27684
- closeTooltip: function closeTooltip() {
27685
- setIsTooltipMobileVisible(false);
27686
- },
27687
- scale: dragScale,
27688
- options: contextActions,
27689
- onSelected: function onSelected(optionId) {
27690
- setIsContextMenuVisible(false);
27691
- if (item) {
27692
- _onSelected == null ? void 0 : _onSelected(optionId, item);
27693
- }
27694
- }
27695
- }), !isContextMenuDisabled && isContextMenuVisible && contextActions && React__default.createElement(RelativeListMenu, {
27696
- options: contextActions,
27697
- onSelected: function onSelected(optionId) {
27698
- setIsContextMenuVisible(false);
27699
- if (item) {
27700
- _onSelected == null ? void 0 : _onSelected(optionId, item);
27701
- }
27702
- },
27703
- onOutsideClick: function onOutsideClick() {
27704
- setIsContextMenuVisible(false);
27705
- },
27706
- pos: contextMenuPosition
27707
- }));
27708
- };
27709
-
27710
- var DraggingContext = /*#__PURE__*/React.createContext({
27711
- item: null,
27712
- setDraggingItem: function setDraggingItem() {}
27713
- });
27714
- var useDragging = function useDragging() {
27715
- return React.useContext(DraggingContext);
27716
- };
27717
- var DraggingProvider = function DraggingProvider(_ref) {
27718
- var children = _ref.children;
27719
- var _useState = React.useState(null),
27720
- item = _useState[0],
27721
- setDraggingItem = _useState[1];
27722
- return React__default.createElement(DraggingContext.Provider, {
27723
- value: {
27724
- item: item,
27725
- setDraggingItem: setDraggingItem
27726
- }
27727
- }, children);
27728
- };
27729
-
27730
27548
  var generateContextMenuListOptions = function generateContextMenuListOptions(actionsByTypeList) {
27731
27549
  var contextMenu = actionsByTypeList.map(function (action) {
27732
27550
  return {
@@ -27852,6 +27670,117 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType,
27852
27670
  return contextActionMenu;
27853
27671
  };
27854
27672
 
27673
+ var initialDetailsState = {
27674
+ item: null,
27675
+ isTooltipVisible: false,
27676
+ isTooltipMobileVisible: false,
27677
+ isContextMenuVisible: false,
27678
+ contextMenuPosition: {
27679
+ x: 0,
27680
+ y: 0
27681
+ },
27682
+ contextActions: [],
27683
+ clearContextActions: function clearContextActions() {},
27684
+ clearDetailsState: function clearDetailsState() {}
27685
+ };
27686
+ var ItemSlotDetailsContext = /*#__PURE__*/React.createContext({
27687
+ detailsState: initialDetailsState,
27688
+ updateDetailsState: function updateDetailsState() {},
27689
+ clearDetailsState: function clearDetailsState() {},
27690
+ setContextActions: function setContextActions() {},
27691
+ clearContextActions: function clearContextActions() {}
27692
+ });
27693
+ var useItemSlotDetails = function useItemSlotDetails() {
27694
+ return React.useContext(ItemSlotDetailsContext);
27695
+ };
27696
+ var ItemSlotDetailsProvider = function ItemSlotDetailsProvider(_ref) {
27697
+ var children = _ref.children;
27698
+ var _useState = React.useState(initialDetailsState),
27699
+ detailsState = _useState[0],
27700
+ setDetailsState = _useState[1];
27701
+ var updateDetailsState = React.useCallback(function (newState) {
27702
+ setDetailsState(function (prevState) {
27703
+ return _extends({}, prevState, newState);
27704
+ });
27705
+ }, []);
27706
+ var clearDetailsState = React.useCallback(function () {
27707
+ setDetailsState(initialDetailsState);
27708
+ }, [setDetailsState]);
27709
+ var setContextActions = React.useCallback(function (item, containerType, isDepotSystem) {
27710
+ if (item && containerType) {
27711
+ var newContextActions = generateContextMenu(item, containerType, isDepotSystem);
27712
+ updateDetailsState({
27713
+ contextActions: newContextActions
27714
+ });
27715
+ } else {
27716
+ updateDetailsState({
27717
+ contextActions: []
27718
+ });
27719
+ }
27720
+ }, []);
27721
+ var clearContextActions = React.useCallback(function () {
27722
+ updateDetailsState({
27723
+ contextActions: []
27724
+ });
27725
+ }, [updateDetailsState]);
27726
+ var contextValue = React.useMemo(function () {
27727
+ return {
27728
+ detailsState: detailsState,
27729
+ updateDetailsState: updateDetailsState,
27730
+ clearDetailsState: clearDetailsState,
27731
+ setContextActions: setContextActions,
27732
+ clearContextActions: clearContextActions
27733
+ };
27734
+ }, [detailsState, updateDetailsState, clearDetailsState, setContextActions, clearContextActions]);
27735
+ return React__default.createElement(ItemSlotDetailsContext.Provider, {
27736
+ value: contextValue
27737
+ }, children);
27738
+ };
27739
+
27740
+ var initialDraggingState = {
27741
+ item: null,
27742
+ isDragging: false,
27743
+ position: {
27744
+ x: 0,
27745
+ y: 0
27746
+ },
27747
+ dropPosition: null,
27748
+ isFocused: false,
27749
+ draggingDistance: 0
27750
+ };
27751
+ var ItemSlotDraggingContext = /*#__PURE__*/React.createContext({
27752
+ draggingState: initialDraggingState,
27753
+ updateDraggingState: function updateDraggingState() {},
27754
+ clearDraggingState: function clearDraggingState() {}
27755
+ });
27756
+ var useItemSlotDragging = function useItemSlotDragging() {
27757
+ return React.useContext(ItemSlotDraggingContext);
27758
+ };
27759
+ var ItemSlotDraggingProvider = function ItemSlotDraggingProvider(_ref) {
27760
+ var children = _ref.children;
27761
+ var _useState = React.useState(initialDraggingState),
27762
+ draggingState = _useState[0],
27763
+ setDraggingState = _useState[1];
27764
+ var updateDraggingState = React.useCallback(function (newState) {
27765
+ setDraggingState(function (prevState) {
27766
+ return _extends({}, prevState, newState);
27767
+ });
27768
+ }, []);
27769
+ var clearDraggingState = React.useCallback(function () {
27770
+ setDraggingState(initialDraggingState);
27771
+ }, []);
27772
+ var contextValue = React.useMemo(function () {
27773
+ return {
27774
+ draggingState: draggingState,
27775
+ updateDraggingState: updateDraggingState,
27776
+ clearDraggingState: clearDraggingState
27777
+ };
27778
+ }, [draggingState, updateDraggingState, clearDraggingState]);
27779
+ return React__default.createElement(ItemSlotDraggingContext.Provider, {
27780
+ value: contextValue
27781
+ }, children);
27782
+ };
27783
+
27855
27784
  var EquipmentSlotSpriteByType = {
27856
27785
  Neck: 'accessories/corruption-necklace.png',
27857
27786
  LeftHand: 'swords/broad-sword.png',
@@ -27872,7 +27801,6 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27872
27801
  _onMouseOver = _ref.onMouseOver,
27873
27802
  _onMouseOut = _ref.onMouseOut,
27874
27803
  onPointerDown = _ref.onPointerDown,
27875
- _onSelected = _ref.onSelected,
27876
27804
  atlasJSON = _ref.atlasJSON,
27877
27805
  atlasIMG = _ref.atlasIMG,
27878
27806
  _ref$isContextMenuDis = _ref.isContextMenuDisabled,
@@ -27886,69 +27814,39 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27886
27814
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
27887
27815
  dragScale = _ref.dragScale,
27888
27816
  isSelectingShortcut = _ref.isSelectingShortcut,
27889
- equipmentSet = _ref.equipmentSet,
27890
27817
  setItemShortcut = _ref.setItemShortcut,
27891
27818
  isDepotSystem = _ref.isDepotSystem;
27892
- // Centralized state using a single useState hook
27893
- var _useState = React.useState({
27894
- isTooltipVisible: false,
27895
- isTooltipMobileVisible: false,
27896
- isContextMenuVisible: false,
27897
- contextMenuPosition: {
27898
- x: 0,
27899
- y: 0
27900
- },
27901
- isFocused: false,
27902
- wasDragged: false,
27903
- dragPosition: {
27904
- x: 0,
27905
- y: 0
27906
- },
27907
- dropPosition: null,
27908
- contextActions: [],
27909
- draggingDistance: 0
27910
- }),
27911
- state = _useState[0],
27912
- setState = _useState[1];
27913
- var isTooltipVisible = state.isTooltipVisible,
27914
- isTooltipMobileVisible = state.isTooltipMobileVisible,
27915
- isContextMenuVisible = state.isContextMenuVisible,
27916
- contextMenuPosition = state.contextMenuPosition,
27917
- isFocused = state.isFocused,
27918
- wasDragged = state.wasDragged,
27919
- dragPosition = state.dragPosition,
27920
- dropPosition = state.dropPosition,
27921
- contextActions = state.contextActions;
27819
+ var _useItemSlotDetails = useItemSlotDetails(),
27820
+ detailsState = _useItemSlotDetails.detailsState,
27821
+ updateDetailsState = _useItemSlotDetails.updateDetailsState,
27822
+ setContextActions = _useItemSlotDetails.setContextActions;
27823
+ var isContextMenuVisible = detailsState.isContextMenuVisible,
27824
+ clearContextActions = detailsState.clearContextActions;
27922
27825
  var dragContainer = React.useRef(null);
27923
- var _useDragging = useDragging(),
27924
- draggingItem = _useDragging.item,
27925
- setDraggingItem = _useDragging.setDraggingItem;
27826
+ var _useItemSlotDragging = useItemSlotDragging(),
27827
+ draggingState = _useItemSlotDragging.draggingState,
27828
+ updateDraggingState = _useItemSlotDragging.updateDraggingState,
27829
+ clearDraggingState = _useItemSlotDragging.clearDraggingState;
27830
+ var isFocused = draggingState.isFocused,
27831
+ dropPosition = draggingState.dropPosition,
27832
+ isDragging = draggingState.isDragging,
27833
+ draggingDistance = draggingState.draggingDistance;
27926
27834
  React.useEffect(function () {
27927
27835
  // Reset drag position and focus when item changes
27928
- setState(function (prevState) {
27929
- return _extends({}, prevState, {
27930
- dragPosition: {
27931
- x: 0,
27932
- y: 0
27933
- },
27934
- isFocused: false
27935
- });
27836
+ updateDraggingState({
27837
+ position: {
27838
+ x: 0,
27839
+ y: 0
27840
+ },
27841
+ isFocused: false
27936
27842
  });
27937
27843
  // Update context actions when item or depot system changes
27938
- if (item && containerType) {
27939
- setState(function (prevState) {
27940
- return _extends({}, prevState, {
27941
- contextActions: generateContextMenu(item, containerType, isDepotSystem)
27942
- });
27943
- });
27844
+ if (item && containerType && !isContextMenuDisabled) {
27845
+ setContextActions(item, containerType, isDepotSystem != null ? isDepotSystem : false);
27944
27846
  } else {
27945
- setState(function (prevState) {
27946
- return _extends({}, prevState, {
27947
- contextActions: []
27948
- });
27949
- });
27847
+ clearContextActions();
27950
27848
  }
27951
- }, [item, isDepotSystem]);
27849
+ }, [item, containerType, isDepotSystem, setContextActions, clearContextActions]);
27952
27850
  React.useEffect(function () {
27953
27851
  // Handle outside drop
27954
27852
  if (onDrop && item && dropPosition) {
@@ -27956,47 +27854,41 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
27956
27854
  }
27957
27855
  }, [dropPosition]);
27958
27856
  var resetItem = function resetItem() {
27959
- setState(function (prevState) {
27960
- return _extends({}, prevState, {
27961
- isTooltipVisible: false,
27962
- wasDragged: false
27963
- });
27857
+ clearDraggingState();
27858
+ updateDetailsState({
27859
+ item: item,
27860
+ isTooltipVisible: false
27964
27861
  });
27965
27862
  };
27966
27863
  var onSuccessfulDrag = function onSuccessfulDrag(quantity) {
27967
27864
  resetItem();
27968
27865
  if (quantity === -1) {
27969
- setState(function (prevState) {
27970
- return _extends({}, prevState, {
27971
- dragPosition: {
27972
- x: 0,
27973
- y: 0
27974
- },
27975
- isFocused: false
27976
- });
27866
+ updateDraggingState({
27867
+ position: {
27868
+ x: 0,
27869
+ y: 0
27870
+ },
27871
+ isFocused: false
27977
27872
  });
27978
27873
  } else if (item) {
27979
27874
  onDragEnd == null ? void 0 : onDragEnd(quantity);
27980
27875
  }
27981
27876
  };
27982
27877
  var onDraggableStop = function onDraggableStop(e, data) {
27983
- console.log('>>> ON_DRAGGABLE_STOP');
27984
- // Stop the dragging state
27985
- console.log('setDraggingItem(null)');
27986
- setDraggingItem(null);
27987
- var target = e.target;
27988
- console.log('handleShortcutSetter(target)');
27989
- handleShortcutSetter(target);
27990
- console.log('removeDraggingClass(target)');
27991
- removeDraggingClass(target);
27992
- console.log('shouldHandleDraggedItem()');
27993
- if (shouldHandleDraggedItem()) {
27994
- console.log('handleDraggedItem(e, data)');
27995
- handleDraggedItem(e, data);
27996
- } else if (item && !wasDragged) {
27997
- console.log('handleContextMenuOrTooltip(e)');
27998
- handleContextMenuOrTooltip(e);
27999
- }
27878
+ requestAnimationFrame(function () {
27879
+ updateDraggingState({
27880
+ item: null
27881
+ });
27882
+ var target = e.target;
27883
+ handleShortcutSetter(target);
27884
+ removeDraggingClass(target);
27885
+ var shouldHandleDraggedItemResult = shouldHandleDraggedItem();
27886
+ if (shouldHandleDraggedItemResult) {
27887
+ handleDraggedItem(e, data);
27888
+ } else if (item && !isDragging) {
27889
+ handleContextMenuOrTooltip(e);
27890
+ }
27891
+ });
28000
27892
  };
28001
27893
  /**
28002
27894
  * Handles the shortcut setter logic if the target element is a shortcut setter.
@@ -28019,49 +27911,41 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28019
27911
  * Determines whether the dragged item should be processed.
28020
27912
  */
28021
27913
  var shouldHandleDraggedItem = function shouldHandleDraggedItem() {
28022
- console.log("Debug: shouldHandleDraggedItem()", "wasDragged: " + wasDragged, "item: " + item, "isSelectingShortcut: " + isSelectingShortcut);
28023
- return !!(wasDragged && item && !isSelectingShortcut);
27914
+ return !!(isDragging && draggingState.item && !isSelectingShortcut);
28024
27915
  };
28025
27916
  /**
28026
27917
  * Handles the logic when an item has been dragged.
28027
27918
  */
28028
27919
  var handleDraggedItem = function handleDraggedItem(e, data) {
28029
- var targetClasses = Array.from(e.target.classList);
28030
- var isOutsideDrop = targetClasses.some(function (elm) {
28031
- return elm.includes('rpgui-content');
28032
- }) || targetClasses.length === 0;
28033
- if (isOutsideDrop) {
28034
- setState(function (prevState) {
28035
- return _extends({}, prevState, {
27920
+ requestAnimationFrame(function () {
27921
+ var targetClasses = Array.from(e.target.classList);
27922
+ var isOutsideDrop = targetClasses.some(function (elm) {
27923
+ return elm.includes('rpgui-content');
27924
+ }) || targetClasses.length === 0;
27925
+ if (isOutsideDrop) {
27926
+ updateDraggingState({
28036
27927
  dropPosition: {
28037
27928
  x: data.x,
28038
27929
  y: data.y
28039
27930
  }
28040
27931
  });
27932
+ }
27933
+ updateDraggingState({
27934
+ isDragging: false
28041
27935
  });
28042
- }
28043
- setState(function (prevState) {
28044
- return _extends({}, prevState, {
28045
- wasDragged: false
28046
- });
28047
- });
28048
- var targetElement = dragContainer.current;
28049
- if (!targetElement) return;
28050
- var _getElementTransform = getElementTransform(targetElement),
28051
- x = _getElementTransform.x,
28052
- y = _getElementTransform.y;
28053
- setState(function (prevState) {
28054
- return _extends({}, prevState, {
28055
- dragPosition: {
27936
+ var targetElement = dragContainer.current;
27937
+ if (!targetElement) return;
27938
+ var _getElementTransform = getElementTransform(targetElement),
27939
+ x = _getElementTransform.x,
27940
+ y = _getElementTransform.y;
27941
+ updateDraggingState({
27942
+ position: {
28056
27943
  x: x,
28057
27944
  y: y
28058
27945
  }
28059
27946
  });
28060
- });
28061
- // Delay to ensure state updates before proceeding
28062
- setTimeout(function () {
28063
27947
  processDragEnd(item);
28064
- }, 50);
27948
+ });
28065
27949
  };
28066
27950
  /**
28067
27951
  * Retrieves the current transform position of the dragged element.
@@ -28078,29 +27962,21 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28078
27962
  * Processes the end of a drag event, handling quantity selection or resetting state.
28079
27963
  */
28080
27964
  var processDragEnd = function processDragEnd(item) {
28081
- console.log("Debug: processDragEnd(item)", "item: " + item);
28082
27965
  if (checkIfItemCanBeMoved != null && checkIfItemCanBeMoved()) {
28083
- console.log("Debug: checkIfItemCanBeMoved()", "result: " + checkIfItemCanBeMoved());
28084
27966
  if (checkIfItemShouldDragEnd && !checkIfItemShouldDragEnd()) return;
28085
- console.log("Debug: checkIfItemShouldDragEnd()", "result: " + (checkIfItemShouldDragEnd == null ? void 0 : checkIfItemShouldDragEnd()));
28086
27967
  if (item.stackQty && item.stackQty !== 1 && openQuantitySelector) {
28087
- console.log("Debug: openQuantitySelector(item.stackQty, onSuccessfulDrag)");
28088
27968
  openQuantitySelector(item.stackQty, onSuccessfulDrag);
28089
27969
  } else {
28090
- console.log("Debug: onSuccessfulDrag(item.stackQty)");
28091
27970
  onSuccessfulDrag(item.stackQty);
28092
27971
  }
28093
27972
  } else {
28094
- console.log("Debug: resetItem()");
28095
27973
  resetItem();
28096
- setState(function (prevState) {
28097
- return _extends({}, prevState, {
28098
- isFocused: false,
28099
- dragPosition: {
28100
- x: 0,
28101
- y: 0
28102
- }
28103
- });
27974
+ updateDraggingState({
27975
+ isFocused: false,
27976
+ position: {
27977
+ x: 0,
27978
+ y: 0
27979
+ }
28104
27980
  });
28105
27981
  }
28106
27982
  };
@@ -28108,24 +27984,25 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28108
27984
  * Handles the context menu or tooltip display after dragging stops without a drop.
28109
27985
  */
28110
27986
  var handleContextMenuOrTooltip = function handleContextMenuOrTooltip(e) {
28111
- var isTouchEvent = false;
28112
- if (!isContextMenuDisabled && e.type === 'touchend' && !isSelectingShortcut) {
28113
- isTouchEvent = true;
28114
- setState(function (prevState) {
28115
- return _extends({}, prevState, {
28116
- isTooltipMobileVisible: true
28117
- });
27987
+ var isTouchEvent = e.type === 'touchend';
27988
+ var shouldShowMobileTooltip = !isContextMenuDisabled && isTouchEvent && !isSelectingShortcut;
27989
+ var shouldToggleContextMenu = !isContextMenuDisabled && !isSelectingShortcut && !isTouchEvent;
27990
+ if (shouldShowMobileTooltip) {
27991
+ updateDetailsState({
27992
+ item: item,
27993
+ isTooltipMobileVisible: true,
27994
+ isContextMenuVisible: false
28118
27995
  });
28119
- }
28120
- if (!isContextMenuDisabled && !isSelectingShortcut && !isTouchEvent) {
28121
- setState(function (prevState) {
28122
- return _extends({}, prevState, {
28123
- isContextMenuVisible: !prevState.isContextMenuVisible,
28124
- contextMenuPosition: {
28125
- x: e.clientX - 10,
28126
- y: e.clientY - 5
28127
- }
28128
- });
27996
+ } else if (shouldToggleContextMenu) {
27997
+ var mouseEvent = e;
27998
+ updateDetailsState({
27999
+ item: item,
28000
+ isContextMenuVisible: !isContextMenuVisible && !shared.isMobile(),
28001
+ isTooltipMobileVisible: false,
28002
+ contextMenuPosition: {
28003
+ x: mouseEvent.clientX - 10,
28004
+ y: mouseEvent.clientY - 5
28005
+ }
28129
28006
  });
28130
28007
  }
28131
28008
  if (item) {
@@ -28142,25 +28019,23 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28142
28019
  };
28143
28020
  var onDraggableProgress = function onDraggableProgress(_e, _data) {
28144
28021
  // increment draggingDistance by 1
28145
- setState(function (prevState) {
28146
- return _extends({}, prevState, {
28147
- draggingDistance: prevState.draggingDistance + 1
28148
- });
28022
+ updateDraggingState({
28023
+ draggingDistance: draggingState.draggingDistance + 1
28149
28024
  });
28150
- if (state.draggingDistance > 10) {
28151
- setState(function (prevState) {
28152
- return _extends({}, prevState, {
28153
- wasDragged: true,
28154
- isFocused: true
28155
- });
28025
+ if (draggingDistance > 10) {
28026
+ updateDraggingState({
28027
+ isDragging: true,
28028
+ isFocused: true
28156
28029
  });
28157
28030
  }
28158
- if (!draggingItem) {
28159
- setDraggingItem(item);
28031
+ if (!draggingState.item) {
28032
+ updateDraggingState({
28033
+ item: item
28034
+ });
28160
28035
  }
28161
28036
  };
28162
- return React__default.createElement(Container$b, {
28163
- isDraggingItem: !!draggingItem,
28037
+ return React__default.createElement(Container$9, {
28038
+ isDraggingItem: !!draggingState.item,
28164
28039
  item: item,
28165
28040
  className: "rpgui-icon empty-slot",
28166
28041
  onMouseUp: function onMouseUp() {
@@ -28191,7 +28066,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28191
28066
  onStop: onDraggableStop,
28192
28067
  onStart: onDraggableStart,
28193
28068
  onDrag: onDraggableProgress,
28194
- position: dragPosition,
28069
+ position: draggingState.position,
28195
28070
  cancel: ".empty-slot",
28196
28071
  bounds: ".item-container-body, .equipment-container-body"
28197
28072
  }, React__default.createElement(ItemContainer, {
@@ -28204,17 +28079,15 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28204
28079
  if (_onMouseOut) _onMouseOut();
28205
28080
  },
28206
28081
  onMouseEnter: function onMouseEnter() {
28207
- setState(function (prevState) {
28208
- return _extends({}, prevState, {
28209
- isTooltipVisible: true
28210
- });
28082
+ updateDetailsState({
28083
+ item: item,
28084
+ isTooltipVisible: true
28211
28085
  });
28212
28086
  },
28213
28087
  onMouseLeave: function onMouseLeave() {
28214
- setState(function (prevState) {
28215
- return _extends({}, prevState, {
28216
- isTooltipVisible: false
28217
- });
28088
+ updateDetailsState({
28089
+ item: item,
28090
+ isTooltipVisible: false
28218
28091
  });
28219
28092
  }
28220
28093
  }, React__default.createElement(ItemSlotRenderer, {
@@ -28223,54 +28096,12 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
28223
28096
  atlasIMG: atlasIMG,
28224
28097
  atlasJSON: atlasJSON,
28225
28098
  containerType: containerType
28226
- }))), React__default.createElement(ItemSlotToolTips, {
28227
- isTooltipVisible: isTooltipVisible,
28228
- isTooltipMobileVisible: isTooltipMobileVisible,
28229
- setIsTooltipMobileVisible: function setIsTooltipMobileVisible(value) {
28230
- return setState(function (prevState) {
28231
- return _extends({}, prevState, {
28232
- isTooltipMobileVisible: value
28233
- });
28234
- });
28235
- },
28236
- isFocused: isFocused,
28237
- isContextMenuVisible: isContextMenuVisible,
28238
- isContextMenuDisabled: isContextMenuDisabled,
28239
- item: item,
28240
- contextActions: contextActions,
28241
- contextMenuPosition: contextMenuPosition,
28242
- dragScale: dragScale,
28243
- setIsContextMenuVisible: function setIsContextMenuVisible(value) {
28244
- return setState(function (prevState) {
28245
- return _extends({}, prevState, {
28246
- isContextMenuVisible: value
28247
- });
28248
- });
28249
- },
28250
- onSelected: function onSelected(optionId, item) {
28251
- setState(function (prevState) {
28252
- return _extends({}, prevState, {
28253
- isContextMenuVisible: false
28254
- });
28255
- });
28256
- if (_onSelected) _onSelected(optionId, item);
28257
- },
28258
- atlasIMG: atlasIMG,
28259
- atlasJSON: atlasJSON,
28260
- equipmentSet: equipmentSet,
28261
- setIsTooltipVisible: function setIsTooltipVisible(value) {
28262
- return setState(function (prevState) {
28263
- return _extends({}, prevState, {
28264
- isTooltipVisible: value
28265
- });
28266
- });
28267
- }
28268
- }));
28099
+ }))));
28269
28100
  });
28270
- var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28101
+ var Container$9 = /*#__PURE__*/styled__default.div.withConfig({
28271
28102
  displayName: "ItemSlot__Container",
28272
28103
  componentId: "sc-l2j5ef-0"
28273
- })(["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) {
28104
+ })(["margin:0.1rem;*{border:1px solid yellow;}.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) {
28274
28105
  var isDraggingItem = _ref2.isDraggingItem;
28275
28106
  return isDraggingItem ? 0 : 1;
28276
28107
  }, function (_ref3) {
@@ -28383,7 +28214,7 @@ var ItemInfo = function ItemInfo(_ref) {
28383
28214
  });
28384
28215
  };
28385
28216
  var skillName = (_item$minRequirements = item.minRequirements) == null ? void 0 : (_item$minRequirements2 = _item$minRequirements.skill) == null ? void 0 : _item$minRequirements2.name;
28386
- return React__default.createElement(Container$c, {
28217
+ return React__default.createElement(Container$a, {
28387
28218
  item: item
28388
28219
  }, 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, {
28389
28220
  item: item
@@ -28397,7 +28228,7 @@ var ItemInfo = function ItemInfo(_ref) {
28397
28228
  "$isSpecial": true
28398
28229
  }, "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()));
28399
28230
  };
28400
- var Container$c = /*#__PURE__*/styled__default.div.withConfig({
28231
+ var Container$a = /*#__PURE__*/styled__default.div.withConfig({
28401
28232
  displayName: "ItemInfo__Container",
28402
28233
  componentId: "sc-1xm4q8k-0"
28403
28234
  })(["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) {
@@ -28543,7 +28374,7 @@ var ItemTooltip = function ItemTooltip(_ref) {
28543
28374
  }
28544
28375
  return;
28545
28376
  }, []);
28546
- return React__default.createElement(ModalPortal, null, React__default.createElement(Container$d, {
28377
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$b, {
28547
28378
  ref: ref
28548
28379
  }, React__default.createElement(ItemInfoDisplay, {
28549
28380
  item: item,
@@ -28552,11 +28383,67 @@ var ItemTooltip = function ItemTooltip(_ref) {
28552
28383
  equipmentSet: equipmentSet
28553
28384
  })));
28554
28385
  };
28555
- var Container$d = /*#__PURE__*/styled__default.div.withConfig({
28386
+ var Container$b = /*#__PURE__*/styled__default.div.withConfig({
28556
28387
  displayName: "ItemTooltip__Container",
28557
28388
  componentId: "sc-11d9r7x-0"
28558
28389
  })(["position:absolute;z-index:100;pointer-events:none;left:0;top:0;opacity:0;transition:opacity 0.08s;"]);
28559
28390
 
28391
+ var MobileItemTooltip = function MobileItemTooltip(_ref) {
28392
+ var item = _ref.item,
28393
+ atlasIMG = _ref.atlasIMG,
28394
+ atlasJSON = _ref.atlasJSON,
28395
+ closeTooltip = _ref.closeTooltip,
28396
+ equipmentSet = _ref.equipmentSet,
28397
+ _ref$scale = _ref.scale,
28398
+ scale = _ref$scale === void 0 ? 1 : _ref$scale,
28399
+ options = _ref.options,
28400
+ onSelected = _ref.onSelected;
28401
+ var ref = React.useRef(null);
28402
+ var handleFadeOut = function handleFadeOut() {
28403
+ var _ref$current;
28404
+ (_ref$current = ref.current) == null ? void 0 : _ref$current.classList.add('fadeOut');
28405
+ };
28406
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$c, {
28407
+ ref: ref,
28408
+ onTouchEnd: function onTouchEnd() {
28409
+ handleFadeOut();
28410
+ setTimeout(function () {
28411
+ closeTooltip();
28412
+ }, 100);
28413
+ },
28414
+ scale: scale
28415
+ }, React__default.createElement(ItemInfoDisplay, {
28416
+ item: item,
28417
+ atlasIMG: atlasIMG,
28418
+ atlasJSON: atlasJSON,
28419
+ equipmentSet: equipmentSet,
28420
+ isMobile: true
28421
+ }), React__default.createElement(OptionsContainer, null, options == null ? void 0 : options.map(function (option) {
28422
+ return React__default.createElement(Option, {
28423
+ key: option.id,
28424
+ onTouchEnd: function onTouchEnd() {
28425
+ handleFadeOut();
28426
+ setTimeout(function () {
28427
+ onSelected == null ? void 0 : onSelected(option.id);
28428
+ closeTooltip();
28429
+ }, 100);
28430
+ }
28431
+ }, option.text);
28432
+ }))));
28433
+ };
28434
+ var Container$c = /*#__PURE__*/styled__default.div.withConfig({
28435
+ displayName: "MobileItemTooltip__Container",
28436
+ componentId: "sc-ku4p1j-0"
28437
+ })(["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;}"]);
28438
+ var OptionsContainer = /*#__PURE__*/styled__default.div.withConfig({
28439
+ displayName: "MobileItemTooltip__OptionsContainer",
28440
+ componentId: "sc-ku4p1j-1"
28441
+ })(["display:flex;flex-direction:column;gap:0.5rem;flex-wrap:wrap;@media (max-width:640px){flex-direction:row;justify-content:center;}"]);
28442
+ var Option = /*#__PURE__*/styled__default.button.withConfig({
28443
+ displayName: "MobileItemTooltip__Option",
28444
+ componentId: "sc-ku4p1j-2"
28445
+ })(["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;}"]);
28446
+
28560
28447
  var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28561
28448
  var children = _ref.children,
28562
28449
  atlasIMG = _ref.atlasIMG,
@@ -28911,7 +28798,7 @@ var Dropdown = function Dropdown(_ref) {
28911
28798
  onChange(selectedValue);
28912
28799
  }
28913
28800
  }, [selectedValue]);
28914
- return React__default.createElement(Container$e, {
28801
+ return React__default.createElement(Container$d, {
28915
28802
  onMouseLeave: function onMouseLeave() {
28916
28803
  return setOpened(false);
28917
28804
  },
@@ -28939,7 +28826,7 @@ var Dropdown = function Dropdown(_ref) {
28939
28826
  }, option.option);
28940
28827
  })));
28941
28828
  };
28942
- var Container$e = /*#__PURE__*/styled__default.div.withConfig({
28829
+ var Container$d = /*#__PURE__*/styled__default.div.withConfig({
28943
28830
  displayName: "Dropdown__Container",
28944
28831
  componentId: "sc-8arn65-0"
28945
28832
  })(["position:relative;width:", ";"], function (props) {
@@ -29039,8 +28926,9 @@ var DraggedItem = function DraggedItem(_ref) {
29039
28926
  var atlasJSON = _ref.atlasJSON,
29040
28927
  atlasIMG = _ref.atlasIMG,
29041
28928
  scale = _ref.scale;
29042
- var _useDragging = useDragging(),
29043
- item = _useDragging.item;
28929
+ var _useItemSlotDragging = useItemSlotDragging(),
28930
+ draggingState = _useItemSlotDragging.draggingState;
28931
+ var item = draggingState.item;
29044
28932
  var _useCursorPosition = useCursorPosition({
29045
28933
  scale: scale
29046
28934
  }),
@@ -29055,7 +28943,7 @@ var DraggedItem = function DraggedItem(_ref) {
29055
28943
  var centeredX = x - OFFSET;
29056
28944
  var centeredY = y - OFFSET;
29057
28945
  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);
29058
- return React__default.createElement(Container$f, null, React__default.createElement(SpriteContainer, {
28946
+ return React__default.createElement(Container$e, null, React__default.createElement(SpriteContainer, {
29059
28947
  x: centeredX,
29060
28948
  y: centeredY
29061
28949
  }, React__default.createElement(SpriteFromAtlas, {
@@ -29073,7 +28961,7 @@ var DraggedItem = function DraggedItem(_ref) {
29073
28961
  }), stackInfo));
29074
28962
  };
29075
28963
  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";
29076
- var Container$f = /*#__PURE__*/styled__default.div.withConfig({
28964
+ var Container$e = /*#__PURE__*/styled__default.div.withConfig({
29077
28965
  displayName: "DraggedItem__Container",
29078
28966
  componentId: "sc-mlzzcp-0"
29079
28967
  })(["position:relative;"]);
@@ -29089,11 +28977,128 @@ var SpriteContainer = /*#__PURE__*/styled__default.div.attrs(function (props) {
29089
28977
  componentId: "sc-mlzzcp-1"
29090
28978
  })(["", " 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);
29091
28979
 
28980
+ var RelativeListMenu = function RelativeListMenu(_ref) {
28981
+ var options = _ref.options,
28982
+ onSelected = _ref.onSelected,
28983
+ onOutsideClick = _ref.onOutsideClick,
28984
+ _ref$fontSize = _ref.fontSize,
28985
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
28986
+ pos = _ref.pos;
28987
+ var ref = React.useRef(null);
28988
+ useOutsideClick(ref, 'relative-context-menu');
28989
+ React.useEffect(function () {
28990
+ document.addEventListener('clickOutside', function (event) {
28991
+ var e = event;
28992
+ if (e.detail.id === 'relative-context-menu') {
28993
+ if (onOutsideClick) {
28994
+ onOutsideClick();
28995
+ }
28996
+ }
28997
+ });
28998
+ return function () {
28999
+ document.removeEventListener('clickOutside', function (_e) {});
29000
+ };
29001
+ }, []);
29002
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$f, Object.assign({
29003
+ fontSize: fontSize,
29004
+ ref: ref
29005
+ }, pos), React__default.createElement("ul", {
29006
+ className: "rpgui-list-imp",
29007
+ style: {
29008
+ overflow: 'hidden'
29009
+ }
29010
+ }, options.map(function (params, index) {
29011
+ return React__default.createElement(ListElement$2, {
29012
+ key: (params == null ? void 0 : params.id) || index,
29013
+ onPointerDown: function onPointerDown() {
29014
+ onSelected(params == null ? void 0 : params.id);
29015
+ }
29016
+ }, (params == null ? void 0 : params.text) || 'No text');
29017
+ }))));
29018
+ };
29019
+ var Container$f = /*#__PURE__*/styled__default.div.withConfig({
29020
+ displayName: "RelativeListMenu__Container",
29021
+ componentId: "sc-7hohf-0"
29022
+ })(["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) {
29023
+ return props.y;
29024
+ }, function (props) {
29025
+ return props.x;
29026
+ }, function (props) {
29027
+ return props.fontSize;
29028
+ });
29029
+ var ListElement$2 = /*#__PURE__*/styled__default.li.withConfig({
29030
+ displayName: "RelativeListMenu__ListElement",
29031
+ componentId: "sc-7hohf-1"
29032
+ })(["margin-right:0.5rem;"]);
29033
+
29034
+ var ItemSlotToolTips = function ItemSlotToolTips(_ref) {
29035
+ var dragScale = _ref.dragScale,
29036
+ _onSelected = _ref.onSelected,
29037
+ atlasIMG = _ref.atlasIMG,
29038
+ atlasJSON = _ref.atlasJSON,
29039
+ equipmentSet = _ref.equipmentSet,
29040
+ isContextMenuDisabled = _ref.isContextMenuDisabled;
29041
+ var _useItemSlotDetails = useItemSlotDetails(),
29042
+ detailsState = _useItemSlotDetails.detailsState,
29043
+ updateDetailsState = _useItemSlotDetails.updateDetailsState;
29044
+ var isTooltipVisible = detailsState.isTooltipVisible,
29045
+ isTooltipMobileVisible = detailsState.isTooltipMobileVisible,
29046
+ isContextMenuVisible = detailsState.isContextMenuVisible,
29047
+ contextMenuPosition = detailsState.contextMenuPosition,
29048
+ contextActions = detailsState.contextActions,
29049
+ item = detailsState.item;
29050
+ var _useItemSlotDragging = useItemSlotDragging(),
29051
+ draggingState = _useItemSlotDragging.draggingState;
29052
+ var isFocused = draggingState.isFocused;
29053
+ return React__default.createElement(React__default.Fragment, null, isTooltipVisible && item && !isFocused && React__default.createElement(ItemTooltip, {
29054
+ item: item,
29055
+ atlasIMG: atlasIMG,
29056
+ atlasJSON: atlasJSON,
29057
+ equipmentSet: equipmentSet
29058
+ }), isTooltipMobileVisible && item && React__default.createElement(MobileItemTooltip, {
29059
+ item: item,
29060
+ atlasIMG: atlasIMG,
29061
+ atlasJSON: atlasJSON,
29062
+ equipmentSet: equipmentSet,
29063
+ closeTooltip: function closeTooltip() {
29064
+ updateDetailsState({
29065
+ isTooltipMobileVisible: false
29066
+ });
29067
+ },
29068
+ scale: dragScale,
29069
+ options: contextActions,
29070
+ onSelected: function onSelected(optionId) {
29071
+ updateDetailsState({
29072
+ isContextMenuVisible: false
29073
+ });
29074
+ if (item) {
29075
+ _onSelected == null ? void 0 : _onSelected(optionId, item);
29076
+ }
29077
+ }
29078
+ }), !isContextMenuDisabled && isContextMenuVisible && contextActions && contextActions.length > 0 && React__default.createElement(RelativeListMenu, {
29079
+ options: contextActions,
29080
+ onSelected: function onSelected(optionId) {
29081
+ updateDetailsState({
29082
+ isContextMenuVisible: false
29083
+ });
29084
+ if (item) {
29085
+ _onSelected == null ? void 0 : _onSelected(optionId, item);
29086
+ }
29087
+ },
29088
+ onOutsideClick: function onOutsideClick() {
29089
+ updateDetailsState({
29090
+ isContextMenuVisible: false
29091
+ });
29092
+ },
29093
+ pos: contextMenuPosition
29094
+ }));
29095
+ };
29096
+
29092
29097
  var EquipmentSet = function EquipmentSet(_ref) {
29093
29098
  var equipmentSet = _ref.equipmentSet,
29094
29099
  onClose = _ref.onClose,
29095
29100
  _onMouseOver = _ref.onMouseOver,
29096
- _onSelected = _ref.onSelected,
29101
+ onSelected = _ref.onSelected,
29097
29102
  onItemClick = _ref.onItemClick,
29098
29103
  atlasIMG = _ref.atlasIMG,
29099
29104
  atlasJSON = _ref.atlasJSON,
@@ -29139,9 +29144,6 @@ var EquipmentSet = function EquipmentSet(_ref) {
29139
29144
  onPointerDown: function onPointerDown(itemType, ContainerType) {
29140
29145
  if (onItemClick) onItemClick(itemType, item, ContainerType);
29141
29146
  },
29142
- onSelected: function onSelected(optionId) {
29143
- if (_onSelected) _onSelected(optionId);
29144
- },
29145
29147
  onDragStart: function onDragStart(item, slotIndex, itemContainerType) {
29146
29148
  if (!item) {
29147
29149
  return;
@@ -29165,7 +29167,7 @@ var EquipmentSet = function EquipmentSet(_ref) {
29165
29167
  });
29166
29168
  });
29167
29169
  };
29168
- return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
29170
+ return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotDetailsProvider, null, React__default.createElement(DraggedItem, {
29169
29171
  atlasIMG: atlasIMG,
29170
29172
  atlasJSON: atlasJSON,
29171
29173
  scale: scale
@@ -29183,7 +29185,14 @@ var EquipmentSet = function EquipmentSet(_ref) {
29183
29185
  onPositionChangeStart: onPositionChangeStart
29184
29186
  }, React__default.createElement(EquipmentSetContainer, {
29185
29187
  className: "equipment-container-body"
29186
- }, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10)))));
29188
+ }, 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, {
29189
+ dragScale: scale,
29190
+ atlasIMG: atlasIMG,
29191
+ atlasJSON: atlasJSON,
29192
+ equipmentSet: equipmentSet,
29193
+ onSelected: onSelected,
29194
+ isContextMenuDisabled: shared.isMobile()
29195
+ })));
29187
29196
  };
29188
29197
  var EquipmentSetContainer = /*#__PURE__*/styled__default.div.withConfig({
29189
29198
  displayName: "EquipmentSet__EquipmentSetContainer",
@@ -30596,11 +30605,11 @@ var QuantitySelectorContainer = /*#__PURE__*/styled__default.div.withConfig({
30596
30605
  })(["position:absolute;top:0;left:0;width:100vw;height:100vh;z-index:100;display:flex;justify-content:center;align-items:center;background-color:rgba(0,0,0,0.5);"]);
30597
30606
 
30598
30607
  var MIN_SLOTS_FOR_SCROLL = 20;
30599
- var ItemContainer$1 = function ItemContainer(_ref) {
30608
+ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
30600
30609
  var itemContainer = _ref.itemContainer,
30601
30610
  onClose = _ref.onClose,
30602
- _onMouseOver = _ref.onMouseOver,
30603
- _onSelected = _ref.onSelected,
30611
+ onMouseOver = _ref.onMouseOver,
30612
+ onSelected = _ref.onSelected,
30604
30613
  onItemClick = _ref.onItemClick,
30605
30614
  type = _ref.type,
30606
30615
  atlasJSON = _ref.atlasJSON,
@@ -30642,11 +30651,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30642
30651
  }),
30643
30652
  startScrolling = _useScrollOnDrag.startScrolling,
30644
30653
  stopScrolling = _useScrollOnDrag.stopScrolling;
30645
- var handleSetShortcut = function handleSetShortcut(item, index) {
30654
+ var handleSetShortcut = React.useCallback(function (item, index) {
30646
30655
  if (item.type === shared.ItemType.Consumable || item.type === shared.ItemType.Tool || item.subType === shared.ItemSubType.Seed) {
30647
30656
  setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
30648
30657
  }
30649
- };
30658
+ }, [setItemShortcut]);
30650
30659
  var handleMouseMove = React.useCallback(function (e) {
30651
30660
  startScrolling(e.clientY);
30652
30661
  }, [startScrolling]);
@@ -30655,50 +30664,55 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30655
30664
  document.addEventListener('pointerup', function () {
30656
30665
  stopScrolling();
30657
30666
  document.removeEventListener('pointermove', handleMouseMove);
30667
+ }, {
30668
+ once: true
30658
30669
  });
30659
- }, [handleMouseMove, onItemDragStart, stopScrolling]);
30670
+ }, [handleMouseMove, stopScrolling]);
30660
30671
  var onDragEndScrollingEvents = React.useCallback(function () {
30661
30672
  stopScrolling();
30662
30673
  document.removeEventListener('pointermove', handleMouseMove);
30663
- }, [handleMouseMove, onItemDragStart, stopScrolling]);
30664
- var onDragStart = function onDragStart(item, slotIndex, itemContainerType) {
30674
+ }, [handleMouseMove, stopScrolling]);
30675
+ var onDragStartHandler = React.useCallback(function (item, slotIndex, itemContainerType) {
30665
30676
  if (onItemDragStart) {
30666
30677
  onItemDragStart(item, slotIndex, itemContainerType);
30667
30678
  }
30668
30679
  onDragStartScrollingEvents();
30669
- };
30670
- var onDragEnd = function onDragEnd(quantity) {
30680
+ }, [onItemDragStart, onDragStartScrollingEvents]);
30681
+ var onDragEndHandler = React.useCallback(function (quantity) {
30671
30682
  if (onItemDragEnd) {
30672
30683
  onItemDragEnd(quantity);
30673
30684
  }
30674
30685
  onDragEndScrollingEvents();
30675
- };
30676
- var onRenderSlots = function onRenderSlots() {
30686
+ }, [onItemDragEnd, onDragEndScrollingEvents]);
30687
+ // Memoize handleSetShortcut to prevent unnecessary re-renders
30688
+ var memoizedHandleSetShortcut = React.useCallback(function (item, index) {
30689
+ handleSetShortcut(item, index);
30690
+ }, [handleSetShortcut]);
30691
+ // Memoize onRenderSlots to prevent re-creating the slots array on every render
30692
+ var onRenderSlots = React.useMemo(function () {
30677
30693
  var slots = [];
30678
30694
  for (var i = 0; i < itemContainer.slotQty; i++) {
30679
30695
  var _itemContainer$slots;
30696
+ var currentItem = ((_itemContainer$slots = itemContainer.slots) == null ? void 0 : _itemContainer$slots[i]) || null;
30680
30697
  slots.push(React__default.createElement(ItemSlot, {
30681
- isContextMenuDisabled: disableContextMenu,
30682
30698
  key: i,
30683
30699
  slotIndex: i,
30684
- item: ((_itemContainer$slots = itemContainer.slots) == null ? void 0 : _itemContainer$slots[i]) || null,
30700
+ item: currentItem,
30685
30701
  itemContainerType: type,
30686
- onMouseOver: function onMouseOver(event, slotIndex, item) {
30687
- if (_onMouseOver) _onMouseOver(event, slotIndex, item);
30688
- },
30702
+ onMouseOver: onMouseOver ? function (event, slotIndex, item) {
30703
+ return onMouseOver(event, slotIndex, item);
30704
+ } : undefined,
30705
+ onMouseOut: undefined,
30689
30706
  onPointerDown: function onPointerDown(itemType, containerType, item) {
30690
30707
  if (settingShortcutIndex !== -1) {
30691
30708
  setSettingShortcutIndex(-1);
30692
- handleSetShortcut(item, settingShortcutIndex);
30709
+ memoizedHandleSetShortcut(item, settingShortcutIndex);
30693
30710
  } else if (onItemClick) {
30694
30711
  onItemClick(item, itemType, containerType);
30695
30712
  }
30696
30713
  },
30697
- onSelected: function onSelected(optionId, item) {
30698
- if (_onSelected) _onSelected(optionId, item);
30699
- },
30700
- onDragStart: onDragStart,
30701
- onDragEnd: onDragEnd,
30714
+ onDragStart: onDragStartHandler,
30715
+ onDragEnd: onDragEndHandler,
30702
30716
  dragScale: scale,
30703
30717
  checkIfItemCanBeMoved: checkIfItemCanBeMoved,
30704
30718
  checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
@@ -30727,13 +30741,13 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30727
30741
  atlasJSON: atlasJSON,
30728
30742
  isSelectingShortcut: settingShortcutIndex !== -1,
30729
30743
  equipmentSet: equipmentSet,
30730
- setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
30744
+ setItemShortcut: type === shared.ItemContainerType.Inventory ? memoizedHandleSetShortcut : undefined,
30731
30745
  isDepotSystem: isDepotSystem
30732
30746
  }));
30733
30747
  }
30734
30748
  return slots;
30735
- };
30736
- return React__default.createElement(DraggingProvider, null, React__default.createElement(DraggedItem, {
30749
+ }, [itemContainer.slotQty, itemContainer.slots, type, onMouseOver, settingShortcutIndex, memoizedHandleSetShortcut, onItemClick, onDragStartHandler, onDragEndHandler, scale, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, onItemPlaceDrop, _onOutsideDrop, atlasIMG, atlasJSON, equipmentSet, isDepotSystem, onDragEndScrollingEvents]);
30750
+ return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotDetailsProvider, null, React__default.createElement(DraggedItem, {
30737
30751
  atlasIMG: atlasIMG,
30738
30752
  atlasJSON: atlasJSON,
30739
30753
  scale: scale
@@ -30758,11 +30772,18 @@ var ItemContainer$1 = function ItemContainer(_ref) {
30758
30772
  ref: containerRef,
30759
30773
  isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
30760
30774
  isFullScreen: isFullScreen
30761
- }, onRenderSlots())), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
30775
+ }, onRenderSlots)), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
30762
30776
  quantitySelect: quantitySelect,
30763
30777
  setQuantitySelect: setQuantitySelect
30764
- }));
30765
- };
30778
+ }), React__default.createElement(ItemSlotToolTips, {
30779
+ dragScale: scale,
30780
+ atlasIMG: atlasIMG,
30781
+ atlasJSON: atlasJSON,
30782
+ equipmentSet: equipmentSet,
30783
+ isContextMenuDisabled: disableContextMenu,
30784
+ onSelected: onSelected
30785
+ })));
30786
+ });
30766
30787
  var ItemsContainer = /*#__PURE__*/styled__default.div.withConfig({
30767
30788
  displayName: "ItemContainer__ItemsContainer",
30768
30789
  componentId: "sc-15y5p9l-0"