@rpg-engine/long-bow 0.3.82 → 0.3.84

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.
@@ -5,6 +5,8 @@ interface IProps {
5
5
  title: string;
6
6
  onClose?: () => void;
7
7
  onPositionChange?: (position: IPosition) => void;
8
+ onPositionChangeEnd?: (position: IPosition) => void;
9
+ onPositionChangeStart?: (position: IPosition) => void;
8
10
  onOutsideClick?: () => void;
9
11
  initialPosition?: IPosition;
10
12
  scale?: number;
@@ -13,6 +13,8 @@ export interface IDraggableContainerProps {
13
13
  onCloseButton?: () => void;
14
14
  cancelDrag?: string;
15
15
  onPositionChange?: (position: IPosition) => void;
16
+ onPositionChangeEnd?: (position: IPosition) => void;
17
+ onPositionChangeStart?: (position: IPosition) => void;
16
18
  onOutsideClick?: () => void;
17
19
  initialPosition?: IPosition;
18
20
  scale?: number;
@@ -21,5 +21,7 @@ export interface IEquipmentSetProps {
21
21
  type: ItemContainerType | null;
22
22
  atlasIMG: any;
23
23
  atlasJSON: any;
24
+ onPositionChangeEnd?: (position: IPosition) => void;
25
+ onPositionChangeStart?: (position: IPosition) => void;
24
26
  }
25
27
  export declare const EquipmentSet: React.FC<IEquipmentSetProps>;
@@ -26,5 +26,8 @@ export interface IItemContainerProps {
26
26
  setItemShortcut?: (key: string, index: number) => void;
27
27
  removeShortcut?: (index: number) => void;
28
28
  equipmentSet?: IEquipmentSet | null;
29
+ isDepotSystem?: boolean;
30
+ onPositionChangeEnd?: (position: IPosition) => void;
31
+ onPositionChangeStart?: (position: IPosition) => void;
29
32
  }
30
33
  export declare const ItemContainer: React.FC<IItemContainerProps>;
@@ -25,6 +25,7 @@ interface IProps {
25
25
  isContextMenuDisabled?: boolean;
26
26
  isSelectingShortcut?: boolean;
27
27
  equipmentSet?: IEquipmentSet | null;
28
+ isDepotSystem?: boolean;
28
29
  }
29
30
  export declare const ItemSlot: React.FC<IProps>;
30
31
  export declare const rarityColor: (item: IItem | null) => "rgba(13, 193, 13, 0.6)" | "rgba(8, 104, 187, 0.6)" | "rgba(191, 0, 255, 0.6)" | "rgba(255, 191, 0,0.6)" | null;
@@ -3,4 +3,4 @@ export interface IContextMenuItem {
3
3
  id: string;
4
4
  text: string;
5
5
  }
6
- export declare const generateContextMenu: (item: IItem, itemContainerType: ItemContainerType | null) => IContextMenuItem[];
6
+ export declare const generateContextMenu: (item: IItem, itemContainerType: ItemContainerType | null, isDepotSystem?: boolean | undefined) => IContextMenuItem[];
@@ -8,6 +8,10 @@ export interface IRelativeMenuProps {
8
8
  onSelected: (selectedOptionId: string) => void;
9
9
  fontSize?: number;
10
10
  onOutsideClick?: () => void;
11
+ pos: {
12
+ x: number;
13
+ y: number;
14
+ };
11
15
  }
12
16
  export declare const RelativeListMenu: React.FC<IRelativeMenuProps>;
13
17
  export {};
@@ -33220,6 +33220,8 @@ var DraggableContainer = function DraggableContainer(_ref) {
33220
33220
  imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
33221
33221
  cancelDrag = _ref.cancelDrag,
33222
33222
  onPositionChange = _ref.onPositionChange,
33223
+ onPositionChangeEnd = _ref.onPositionChangeEnd,
33224
+ onPositionChangeStart = _ref.onPositionChangeStart,
33223
33225
  onOutsideClick = _ref.onOutsideClick,
33224
33226
  _ref$initialPosition = _ref.initialPosition,
33225
33227
  initialPosition = _ref$initialPosition === void 0 ? {
@@ -33252,6 +33254,22 @@ var DraggableContainer = function DraggableContainer(_ref) {
33252
33254
  });
33253
33255
  }
33254
33256
  },
33257
+ onStop: function onStop(_e, data) {
33258
+ if (onPositionChangeEnd) {
33259
+ onPositionChangeEnd({
33260
+ x: data.x,
33261
+ y: data.y
33262
+ });
33263
+ }
33264
+ },
33265
+ onStart: function onStart(_e, data) {
33266
+ if (onPositionChangeStart) {
33267
+ onPositionChangeStart({
33268
+ x: data.x,
33269
+ y: data.y
33270
+ });
33271
+ }
33272
+ },
33255
33273
  defaultPosition: initialPosition,
33256
33274
  scale: scale
33257
33275
  }, React__default.createElement(Container$6, {
@@ -33384,7 +33402,8 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
33384
33402
  onSelected = _ref.onSelected,
33385
33403
  onOutsideClick = _ref.onOutsideClick,
33386
33404
  _ref$fontSize = _ref.fontSize,
33387
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
33405
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
33406
+ pos = _ref.pos;
33388
33407
  var ref = React.useRef(null);
33389
33408
  useOutsideClick(ref, 'relative-context-menu');
33390
33409
  React.useEffect(function () {
@@ -33400,10 +33419,10 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
33400
33419
  document.removeEventListener('clickOutside', function (_e) {});
33401
33420
  };
33402
33421
  }, []);
33403
- return React__default.createElement(Container$9, {
33422
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$9, Object.assign({
33404
33423
  fontSize: fontSize,
33405
33424
  ref: ref
33406
- }, React__default.createElement("ul", {
33425
+ }, pos), React__default.createElement("ul", {
33407
33426
  className: "rpgui-list-imp",
33408
33427
  style: {
33409
33428
  overflow: 'hidden'
@@ -33415,12 +33434,16 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
33415
33434
  onSelected(params == null ? void 0 : params.id);
33416
33435
  }
33417
33436
  }, (params == null ? void 0 : params.text) || 'No text');
33418
- })));
33437
+ }))));
33419
33438
  };
33420
33439
  var Container$9 = /*#__PURE__*/styled.div.withConfig({
33421
33440
  displayName: "RelativeListMenu__Container",
33422
33441
  componentId: "sc-7hohf-0"
33423
- })(["position:absolute;top:1rem;left:4rem;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
33442
+ })(["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) {
33443
+ return props.y;
33444
+ }, function (props) {
33445
+ return props.x;
33446
+ }, function (props) {
33424
33447
  return props.fontSize;
33425
33448
  });
33426
33449
  var ListElement = /*#__PURE__*/styled.li.withConfig({
@@ -33493,7 +33516,7 @@ var generateContextMenuListOptions = function generateContextMenuListOptions(act
33493
33516
  });
33494
33517
  return contextMenu;
33495
33518
  };
33496
- var generateContextMenu = function generateContextMenu(item, itemContainerType) {
33519
+ var generateContextMenu = function generateContextMenu(item, itemContainerType, isDepotSystem) {
33497
33520
  var contextActionMenu = [];
33498
33521
  if (itemContainerType === shared.ItemContainerType.Inventory) {
33499
33522
  switch (item.type) {
@@ -33519,6 +33542,12 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
33519
33542
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Other);
33520
33543
  break;
33521
33544
  }
33545
+ if (isDepotSystem) {
33546
+ contextActionMenu.push({
33547
+ id: shared.DepotSocketEvents.Deposit,
33548
+ text: 'Deposit'
33549
+ });
33550
+ }
33522
33551
  }
33523
33552
  if (itemContainerType === shared.ItemContainerType.Equipment) {
33524
33553
  switch (item.type) {
@@ -33582,6 +33611,15 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
33582
33611
  });
33583
33612
  }
33584
33613
  }
33614
+ if (itemContainerType === shared.ItemContainerType.Depot) {
33615
+ contextActionMenu = [{
33616
+ id: shared.ItemSocketEvents.GetItemInfo,
33617
+ text: shared.ItemSocketEventsDisplayLabels.GetItemInfo
33618
+ }, {
33619
+ id: shared.DepotSocketEvents.Withdraw,
33620
+ text: 'Withdraw'
33621
+ }];
33622
+ }
33585
33623
  return contextActionMenu;
33586
33624
  };
33587
33625
 
@@ -33619,7 +33657,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33619
33657
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
33620
33658
  dragScale = _ref.dragScale,
33621
33659
  isSelectingShortcut = _ref.isSelectingShortcut,
33622
- equipmentSet = _ref.equipmentSet;
33660
+ equipmentSet = _ref.equipmentSet,
33661
+ isDepotSystem = _ref.isDepotSystem;
33623
33662
  var _useState = React.useState(false),
33624
33663
  isTooltipVisible = _useState[0],
33625
33664
  setTooltipVisible = _useState[1];
@@ -33629,25 +33668,31 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33629
33668
  var _useState3 = React.useState(false),
33630
33669
  isContextMenuVisible = _useState3[0],
33631
33670
  setIsContextMenuVisible = _useState3[1];
33632
- var _useState4 = React.useState(false),
33633
- isFocused = _useState4[0],
33634
- setIsFocused = _useState4[1];
33671
+ var _useState4 = React.useState({
33672
+ x: 0,
33673
+ y: 0
33674
+ }),
33675
+ contextMenuPosition = _useState4[0],
33676
+ setContextMenuPosition = _useState4[1];
33635
33677
  var _useState5 = React.useState(false),
33636
- wasDragged = _useState5[0],
33637
- setWasDragged = _useState5[1];
33638
- var _useState6 = React.useState({
33678
+ isFocused = _useState5[0],
33679
+ setIsFocused = _useState5[1];
33680
+ var _useState6 = React.useState(false),
33681
+ wasDragged = _useState6[0],
33682
+ setWasDragged = _useState6[1];
33683
+ var _useState7 = React.useState({
33639
33684
  x: 0,
33640
33685
  y: 0
33641
33686
  }),
33642
- dragPosition = _useState6[0],
33643
- setDragPosition = _useState6[1];
33644
- var _useState7 = React.useState(null),
33645
- dropPosition = _useState7[0],
33646
- setDropPosition = _useState7[1];
33687
+ dragPosition = _useState7[0],
33688
+ setDragPosition = _useState7[1];
33689
+ var _useState8 = React.useState(null),
33690
+ dropPosition = _useState8[0],
33691
+ setDropPosition = _useState8[1];
33647
33692
  var dragContainer = React.useRef(null);
33648
- var _useState8 = React.useState([]),
33649
- contextActions = _useState8[0],
33650
- setContextActions = _useState8[1];
33693
+ var _useState9 = React.useState([]),
33694
+ contextActions = _useState9[0],
33695
+ setContextActions = _useState9[1];
33651
33696
  React.useEffect(function () {
33652
33697
  setDragPosition({
33653
33698
  x: 0,
@@ -33655,9 +33700,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33655
33700
  });
33656
33701
  setIsFocused(false);
33657
33702
  if (item) {
33658
- setContextActions(generateContextMenu(item, containerType));
33703
+ setContextActions(generateContextMenu(item, containerType, isDepotSystem));
33659
33704
  }
33660
- }, [item]);
33705
+ }, [item, isDepotSystem]);
33661
33706
  React.useEffect(function () {
33662
33707
  if (onDrop && item && dropPosition) {
33663
33708
  onDrop(item, dropPosition);
@@ -33839,7 +33884,16 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33839
33884
  isTouch = true;
33840
33885
  setIsTooltipMobileVisible(true);
33841
33886
  }
33842
- if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) setIsContextMenuVisible(!isContextMenuVisible);
33887
+ if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
33888
+ setIsContextMenuVisible(!isContextMenuVisible);
33889
+ var event = e;
33890
+ if (event.clientX && event.clientY) {
33891
+ setContextMenuPosition({
33892
+ x: event.clientX - 10,
33893
+ y: event.clientY - 5
33894
+ });
33895
+ }
33896
+ }
33843
33897
  onPointerDown(item.type, containerType, item);
33844
33898
  }
33845
33899
  },
@@ -33905,7 +33959,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33905
33959
  },
33906
33960
  onOutsideClick: function onOutsideClick() {
33907
33961
  setIsContextMenuVisible(false);
33908
- }
33962
+ },
33963
+ pos: contextMenuPosition
33909
33964
  }));
33910
33965
  });
33911
33966
  var rarityColor = function rarityColor(item) {
@@ -34447,7 +34502,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
34447
34502
  onItemOutsideDrop = _ref.onItemOutsideDrop,
34448
34503
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
34449
34504
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
34450
- scale = _ref.scale;
34505
+ scale = _ref.scale,
34506
+ initialPosition = _ref.initialPosition,
34507
+ onPositionChangeEnd = _ref.onPositionChangeEnd,
34508
+ onPositionChangeStart = _ref.onPositionChangeStart;
34451
34509
  var neck = equipmentSet.neck,
34452
34510
  leftHand = equipmentSet.leftHand,
34453
34511
  ring = equipmentSet.ring,
@@ -34514,7 +34572,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
34514
34572
  },
34515
34573
  width: "330px",
34516
34574
  cancelDrag: ".equipment-container-body",
34517
- scale: scale
34575
+ scale: scale,
34576
+ initialPosition: initialPosition,
34577
+ onPositionChangeEnd: onPositionChangeEnd,
34578
+ onPositionChangeStart: onPositionChangeStart
34518
34579
  }, React__default.createElement(EquipmentSetContainer, {
34519
34580
  className: "equipment-container-body"
34520
34581
  }, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10))));
@@ -35071,6 +35132,8 @@ var SlotsContainer = function SlotsContainer(_ref) {
35071
35132
  title = _ref.title,
35072
35133
  onClose = _ref.onClose,
35073
35134
  _onPositionChange = _ref.onPositionChange,
35135
+ _onPositionChangeEnd = _ref.onPositionChangeEnd,
35136
+ _onPositionChangeStart = _ref.onPositionChangeStart,
35074
35137
  onOutsideClick = _ref.onOutsideClick,
35075
35138
  initialPosition = _ref.initialPosition,
35076
35139
  scale = _ref.scale;
@@ -35094,6 +35157,26 @@ var SlotsContainer = function SlotsContainer(_ref) {
35094
35157
  });
35095
35158
  }
35096
35159
  },
35160
+ onPositionChangeEnd: function onPositionChangeEnd(_ref3) {
35161
+ var x = _ref3.x,
35162
+ y = _ref3.y;
35163
+ if (_onPositionChangeEnd) {
35164
+ _onPositionChangeEnd({
35165
+ x: x,
35166
+ y: y
35167
+ });
35168
+ }
35169
+ },
35170
+ onPositionChangeStart: function onPositionChangeStart(_ref4) {
35171
+ var x = _ref4.x,
35172
+ y = _ref4.y;
35173
+ if (_onPositionChangeStart) {
35174
+ _onPositionChangeStart({
35175
+ x: x,
35176
+ y: y
35177
+ });
35178
+ }
35179
+ },
35097
35180
  onOutsideClick: onOutsideClick,
35098
35181
  initialPosition: initialPosition,
35099
35182
  scale: scale
@@ -35342,7 +35425,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35342
35425
  shortcuts = _ref.shortcuts,
35343
35426
  setItemShortcut = _ref.setItemShortcut,
35344
35427
  removeShortcut = _ref.removeShortcut,
35345
- equipmentSet = _ref.equipmentSet;
35428
+ equipmentSet = _ref.equipmentSet,
35429
+ isDepotSystem = _ref.isDepotSystem,
35430
+ onPositionChangeEnd = _ref.onPositionChangeEnd,
35431
+ onPositionChangeStart = _ref.onPositionChangeStart;
35346
35432
  var _useState = React.useState({
35347
35433
  isOpen: false,
35348
35434
  maxQuantity: 1,
@@ -35402,7 +35488,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35402
35488
  atlasIMG: atlasIMG,
35403
35489
  atlasJSON: atlasJSON,
35404
35490
  isSelectingShortcut: settingShortcutIndex !== -1,
35405
- equipmentSet: equipmentSet
35491
+ equipmentSet: equipmentSet,
35492
+ isDepotSystem: isDepotSystem
35406
35493
  }));
35407
35494
  }
35408
35495
  return slots;
@@ -35411,7 +35498,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35411
35498
  title: itemContainer.name || 'Container',
35412
35499
  onClose: onClose,
35413
35500
  initialPosition: initialPosition,
35414
- scale: scale
35501
+ scale: scale,
35502
+ onPositionChangeEnd: onPositionChangeEnd,
35503
+ onPositionChangeStart: onPositionChangeStart
35415
35504
  }, type === shared.ItemContainerType.Inventory && shortcuts && removeShortcut && React__default.createElement(ShortcutsSetter, {
35416
35505
  setSettingShortcutIndex: setSettingShortcutIndex,
35417
35506
  settingShortcutIndex: settingShortcutIndex,