@rpg-engine/long-bow 0.3.81 → 0.3.83

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 {};
@@ -32745,6 +32745,7 @@ var Chat = function Chat(_ref) {
32745
32745
  };
32746
32746
  var handleSubmit = function handleSubmit(event) {
32747
32747
  event.preventDefault();
32748
+ if (!message || message.trim() === '') return;
32748
32749
  onSendChatMessage(message);
32749
32750
  setMessage('');
32750
32751
  };
@@ -33219,6 +33220,8 @@ var DraggableContainer = function DraggableContainer(_ref) {
33219
33220
  imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
33220
33221
  cancelDrag = _ref.cancelDrag,
33221
33222
  onPositionChange = _ref.onPositionChange,
33223
+ onPositionChangeEnd = _ref.onPositionChangeEnd,
33224
+ onPositionChangeStart = _ref.onPositionChangeStart,
33222
33225
  onOutsideClick = _ref.onOutsideClick,
33223
33226
  _ref$initialPosition = _ref.initialPosition,
33224
33227
  initialPosition = _ref$initialPosition === void 0 ? {
@@ -33251,6 +33254,22 @@ var DraggableContainer = function DraggableContainer(_ref) {
33251
33254
  });
33252
33255
  }
33253
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
+ },
33254
33273
  defaultPosition: initialPosition,
33255
33274
  scale: scale
33256
33275
  }, React__default.createElement(Container$6, {
@@ -33383,7 +33402,8 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
33383
33402
  onSelected = _ref.onSelected,
33384
33403
  onOutsideClick = _ref.onOutsideClick,
33385
33404
  _ref$fontSize = _ref.fontSize,
33386
- fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize;
33405
+ fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
33406
+ pos = _ref.pos;
33387
33407
  var ref = React.useRef(null);
33388
33408
  useOutsideClick(ref, 'relative-context-menu');
33389
33409
  React.useEffect(function () {
@@ -33399,10 +33419,10 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
33399
33419
  document.removeEventListener('clickOutside', function (_e) {});
33400
33420
  };
33401
33421
  }, []);
33402
- return React__default.createElement(Container$9, {
33422
+ return React__default.createElement(ModalPortal, null, React__default.createElement(Container$9, Object.assign({
33403
33423
  fontSize: fontSize,
33404
33424
  ref: ref
33405
- }, React__default.createElement("ul", {
33425
+ }, pos), React__default.createElement("ul", {
33406
33426
  className: "rpgui-list-imp",
33407
33427
  style: {
33408
33428
  overflow: 'hidden'
@@ -33414,12 +33434,16 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
33414
33434
  onSelected(params == null ? void 0 : params.id);
33415
33435
  }
33416
33436
  }, (params == null ? void 0 : params.text) || 'No text');
33417
- })));
33437
+ }))));
33418
33438
  };
33419
33439
  var Container$9 = /*#__PURE__*/styled.div.withConfig({
33420
33440
  displayName: "RelativeListMenu__Container",
33421
33441
  componentId: "sc-7hohf-0"
33422
- })(["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) {
33423
33447
  return props.fontSize;
33424
33448
  });
33425
33449
  var ListElement = /*#__PURE__*/styled.li.withConfig({
@@ -33492,7 +33516,7 @@ var generateContextMenuListOptions = function generateContextMenuListOptions(act
33492
33516
  });
33493
33517
  return contextMenu;
33494
33518
  };
33495
- var generateContextMenu = function generateContextMenu(item, itemContainerType) {
33519
+ var generateContextMenu = function generateContextMenu(item, itemContainerType, isDepotSystem) {
33496
33520
  var contextActionMenu = [];
33497
33521
  if (itemContainerType === shared.ItemContainerType.Inventory) {
33498
33522
  switch (item.type) {
@@ -33518,6 +33542,12 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
33518
33542
  contextActionMenu = generateContextMenuListOptions(shared.ActionsForInventory.Other);
33519
33543
  break;
33520
33544
  }
33545
+ if (isDepotSystem) {
33546
+ contextActionMenu.push({
33547
+ id: shared.DepotSocketEvents.Deposit,
33548
+ text: 'Deposit'
33549
+ });
33550
+ }
33521
33551
  }
33522
33552
  if (itemContainerType === shared.ItemContainerType.Equipment) {
33523
33553
  switch (item.type) {
@@ -33580,6 +33610,12 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
33580
33610
  text: 'Use with...'
33581
33611
  });
33582
33612
  }
33613
+ if (isDepotSystem) {
33614
+ contextActionMenu.push({
33615
+ id: shared.DepotSocketEvents.Withdraw,
33616
+ text: 'Withdraw'
33617
+ });
33618
+ }
33583
33619
  }
33584
33620
  return contextActionMenu;
33585
33621
  };
@@ -33618,7 +33654,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33618
33654
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
33619
33655
  dragScale = _ref.dragScale,
33620
33656
  isSelectingShortcut = _ref.isSelectingShortcut,
33621
- equipmentSet = _ref.equipmentSet;
33657
+ equipmentSet = _ref.equipmentSet,
33658
+ isDepotSystem = _ref.isDepotSystem;
33622
33659
  var _useState = React.useState(false),
33623
33660
  isTooltipVisible = _useState[0],
33624
33661
  setTooltipVisible = _useState[1];
@@ -33628,25 +33665,31 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33628
33665
  var _useState3 = React.useState(false),
33629
33666
  isContextMenuVisible = _useState3[0],
33630
33667
  setIsContextMenuVisible = _useState3[1];
33631
- var _useState4 = React.useState(false),
33632
- isFocused = _useState4[0],
33633
- setIsFocused = _useState4[1];
33668
+ var _useState4 = React.useState({
33669
+ x: 0,
33670
+ y: 0
33671
+ }),
33672
+ contextMenuPosition = _useState4[0],
33673
+ setContextMenuPosition = _useState4[1];
33634
33674
  var _useState5 = React.useState(false),
33635
- wasDragged = _useState5[0],
33636
- setWasDragged = _useState5[1];
33637
- var _useState6 = React.useState({
33675
+ isFocused = _useState5[0],
33676
+ setIsFocused = _useState5[1];
33677
+ var _useState6 = React.useState(false),
33678
+ wasDragged = _useState6[0],
33679
+ setWasDragged = _useState6[1];
33680
+ var _useState7 = React.useState({
33638
33681
  x: 0,
33639
33682
  y: 0
33640
33683
  }),
33641
- dragPosition = _useState6[0],
33642
- setDragPosition = _useState6[1];
33643
- var _useState7 = React.useState(null),
33644
- dropPosition = _useState7[0],
33645
- setDropPosition = _useState7[1];
33684
+ dragPosition = _useState7[0],
33685
+ setDragPosition = _useState7[1];
33686
+ var _useState8 = React.useState(null),
33687
+ dropPosition = _useState8[0],
33688
+ setDropPosition = _useState8[1];
33646
33689
  var dragContainer = React.useRef(null);
33647
- var _useState8 = React.useState([]),
33648
- contextActions = _useState8[0],
33649
- setContextActions = _useState8[1];
33690
+ var _useState9 = React.useState([]),
33691
+ contextActions = _useState9[0],
33692
+ setContextActions = _useState9[1];
33650
33693
  React.useEffect(function () {
33651
33694
  setDragPosition({
33652
33695
  x: 0,
@@ -33654,9 +33697,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33654
33697
  });
33655
33698
  setIsFocused(false);
33656
33699
  if (item) {
33657
- setContextActions(generateContextMenu(item, containerType));
33700
+ setContextActions(generateContextMenu(item, containerType, isDepotSystem));
33658
33701
  }
33659
- }, [item]);
33702
+ }, [item, isDepotSystem]);
33660
33703
  React.useEffect(function () {
33661
33704
  if (onDrop && item && dropPosition) {
33662
33705
  onDrop(item, dropPosition);
@@ -33838,7 +33881,16 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33838
33881
  isTouch = true;
33839
33882
  setIsTooltipMobileVisible(true);
33840
33883
  }
33841
- if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) setIsContextMenuVisible(!isContextMenuVisible);
33884
+ if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
33885
+ setIsContextMenuVisible(!isContextMenuVisible);
33886
+ var event = e;
33887
+ if (event.clientX && event.clientY) {
33888
+ setContextMenuPosition({
33889
+ x: event.clientX - 10,
33890
+ y: event.clientY - 5
33891
+ });
33892
+ }
33893
+ }
33842
33894
  onPointerDown(item.type, containerType, item);
33843
33895
  }
33844
33896
  },
@@ -33904,7 +33956,8 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33904
33956
  },
33905
33957
  onOutsideClick: function onOutsideClick() {
33906
33958
  setIsContextMenuVisible(false);
33907
- }
33959
+ },
33960
+ pos: contextMenuPosition
33908
33961
  }));
33909
33962
  });
33910
33963
  var rarityColor = function rarityColor(item) {
@@ -34446,7 +34499,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
34446
34499
  onItemOutsideDrop = _ref.onItemOutsideDrop,
34447
34500
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
34448
34501
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
34449
- scale = _ref.scale;
34502
+ scale = _ref.scale,
34503
+ initialPosition = _ref.initialPosition,
34504
+ onPositionChangeEnd = _ref.onPositionChangeEnd,
34505
+ onPositionChangeStart = _ref.onPositionChangeStart;
34450
34506
  var neck = equipmentSet.neck,
34451
34507
  leftHand = equipmentSet.leftHand,
34452
34508
  ring = equipmentSet.ring,
@@ -34513,7 +34569,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
34513
34569
  },
34514
34570
  width: "330px",
34515
34571
  cancelDrag: ".equipment-container-body",
34516
- scale: scale
34572
+ scale: scale,
34573
+ initialPosition: initialPosition,
34574
+ onPositionChangeEnd: onPositionChangeEnd,
34575
+ onPositionChangeStart: onPositionChangeStart
34517
34576
  }, React__default.createElement(EquipmentSetContainer, {
34518
34577
  className: "equipment-container-body"
34519
34578
  }, React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React__default.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10))));
@@ -34532,6 +34591,8 @@ var SlotsContainer = function SlotsContainer(_ref) {
34532
34591
  title = _ref.title,
34533
34592
  onClose = _ref.onClose,
34534
34593
  _onPositionChange = _ref.onPositionChange,
34594
+ _onPositionChangeEnd = _ref.onPositionChangeEnd,
34595
+ _onPositionChangeStart = _ref.onPositionChangeStart,
34535
34596
  onOutsideClick = _ref.onOutsideClick,
34536
34597
  initialPosition = _ref.initialPosition,
34537
34598
  scale = _ref.scale;
@@ -34555,6 +34616,26 @@ var SlotsContainer = function SlotsContainer(_ref) {
34555
34616
  });
34556
34617
  }
34557
34618
  },
34619
+ onPositionChangeEnd: function onPositionChangeEnd(_ref3) {
34620
+ var x = _ref3.x,
34621
+ y = _ref3.y;
34622
+ if (_onPositionChangeEnd) {
34623
+ _onPositionChangeEnd({
34624
+ x: x,
34625
+ y: y
34626
+ });
34627
+ }
34628
+ },
34629
+ onPositionChangeStart: function onPositionChangeStart(_ref4) {
34630
+ var x = _ref4.x,
34631
+ y = _ref4.y;
34632
+ if (_onPositionChangeStart) {
34633
+ _onPositionChangeStart({
34634
+ x: x,
34635
+ y: y
34636
+ });
34637
+ }
34638
+ },
34558
34639
  onOutsideClick: onOutsideClick,
34559
34640
  initialPosition: initialPosition,
34560
34641
  scale: scale
@@ -34803,7 +34884,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34803
34884
  shortcuts = _ref.shortcuts,
34804
34885
  setItemShortcut = _ref.setItemShortcut,
34805
34886
  removeShortcut = _ref.removeShortcut,
34806
- equipmentSet = _ref.equipmentSet;
34887
+ equipmentSet = _ref.equipmentSet,
34888
+ isDepotSystem = _ref.isDepotSystem,
34889
+ onPositionChangeEnd = _ref.onPositionChangeEnd,
34890
+ onPositionChangeStart = _ref.onPositionChangeStart;
34807
34891
  var _useState = React.useState({
34808
34892
  isOpen: false,
34809
34893
  maxQuantity: 1,
@@ -34863,7 +34947,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34863
34947
  atlasIMG: atlasIMG,
34864
34948
  atlasJSON: atlasJSON,
34865
34949
  isSelectingShortcut: settingShortcutIndex !== -1,
34866
- equipmentSet: equipmentSet
34950
+ equipmentSet: equipmentSet,
34951
+ isDepotSystem: isDepotSystem
34867
34952
  }));
34868
34953
  }
34869
34954
  return slots;
@@ -34872,7 +34957,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
34872
34957
  title: itemContainer.name || 'Container',
34873
34958
  onClose: onClose,
34874
34959
  initialPosition: initialPosition,
34875
- scale: scale
34960
+ scale: scale,
34961
+ onPositionChangeEnd: onPositionChangeEnd,
34962
+ onPositionChangeStart: onPositionChangeStart
34876
34963
  }, type === shared.ItemContainerType.Inventory && shortcuts && removeShortcut && React__default.createElement(ShortcutsSetter, {
34877
34964
  setSettingShortcutIndex: setSettingShortcutIndex,
34878
34965
  settingShortcutIndex: settingShortcutIndex,