@rpg-engine/long-bow 0.5.22 → 0.5.24

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface IQuantitySelect {
3
+ isOpen: boolean;
4
+ maxQuantity: number;
5
+ callback: (_quantity: number) => void;
6
+ }
7
+ interface IProps {
8
+ quantitySelect: IQuantitySelect;
9
+ setQuantitySelect: React.Dispatch<React.SetStateAction<IQuantitySelect>>;
10
+ }
11
+ export declare const ItemQuantitySelectorModal: ({ quantitySelect, setQuantitySelect, }: IProps) => JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ declare type CursorPosition = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ export declare const useCursorPosition: () => CursorPosition;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import { IItem, IShortcut } from '@rpg-engine/shared';
2
+ interface IUseShortcuts {
3
+ itemContainer: {
4
+ slots: Record<number, IItem | null | undefined>;
5
+ };
6
+ }
7
+ export declare const useShortcuts: ({ itemContainer }: IUseShortcuts) => {
8
+ shortcuts: IShortcut[];
9
+ setItemShortcut: (key: string, index: number) => void;
10
+ removeShortcut: (index: number) => void;
11
+ };
12
+ export {};
@@ -13479,6 +13479,8 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
13479
13479
  return renderEquipment(itemToRender);
13480
13480
  case shared.ItemContainerType.Inventory:
13481
13481
  return renderItem(itemToRender);
13482
+ case shared.ItemContainerType.Depot:
13483
+ return renderItem(itemToRender);
13482
13484
  default:
13483
13485
  return null;
13484
13486
  }
@@ -14760,44 +14762,30 @@ var useCursorPosition = function useCursorPosition() {
14760
14762
  x: 0,
14761
14763
  y: 0
14762
14764
  }),
14763
- cursorPosition = _useState[0],
14764
- setCursorPosition = _useState[1];
14765
- React.useEffect(function () {
14766
- var animationFrameId;
14767
- var updateCursorPosition = function updateCursorPosition(x, y) {
14768
- // Cancel the previous frame request
14769
- cancelAnimationFrame(animationFrameId);
14770
- // Request a new frame
14771
- animationFrameId = requestAnimationFrame(function () {
14772
- setCursorPosition({
14773
- x: x,
14774
- y: y
14775
- });
14765
+ position = _useState[0],
14766
+ setPosition = _useState[1];
14767
+ var setFromEvent = function setFromEvent(e) {
14768
+ if ('touches' in e) {
14769
+ setPosition({
14770
+ x: e.touches[0].clientX,
14771
+ y: e.touches[0].clientY
14776
14772
  });
14777
- };
14778
- var handleMouseMove = function handleMouseMove(event) {
14779
- updateCursorPosition(event.clientX, event.clientY);
14780
- };
14781
- var handleTouchMove = function handleTouchMove(event) {
14782
- // Prevent default touch behavior (like scrolling)
14783
- event.preventDefault();
14784
- if (event.touches.length > 0) {
14785
- var touch = event.touches[0];
14786
- updateCursorPosition(touch.clientX, touch.clientY);
14787
- }
14788
- };
14789
- window.addEventListener('mousemove', handleMouseMove);
14790
- window.addEventListener('touchmove', handleTouchMove, {
14791
- passive: false
14792
- });
14793
- // Cleanup function
14773
+ } else {
14774
+ setPosition({
14775
+ x: e.clientX,
14776
+ y: e.clientY
14777
+ });
14778
+ }
14779
+ };
14780
+ React.useEffect(function () {
14781
+ window.addEventListener('mousemove', setFromEvent);
14782
+ window.addEventListener('touchmove', setFromEvent);
14794
14783
  return function () {
14795
- window.removeEventListener('mousemove', handleMouseMove);
14796
- window.removeEventListener('touchmove', handleTouchMove);
14797
- cancelAnimationFrame(animationFrameId);
14784
+ window.removeEventListener('mousemove', setFromEvent);
14785
+ window.removeEventListener('touchmove', setFromEvent);
14798
14786
  };
14799
14787
  }, []);
14800
- return cursorPosition;
14788
+ return position;
14801
14789
  };
14802
14790
 
14803
14791
  var CONTAINER_SIZE = 32;
@@ -15644,6 +15632,89 @@ var SlotsContainer = function SlotsContainer(_ref) {
15644
15632
  }, children);
15645
15633
  };
15646
15634
 
15635
+ var ShortcutsSetter = function ShortcutsSetter(_ref) {
15636
+ var setSettingShortcutIndex = _ref.setSettingShortcutIndex,
15637
+ settingShortcutIndex = _ref.settingShortcutIndex,
15638
+ shortcuts = _ref.shortcuts,
15639
+ removeShortcut = _ref.removeShortcut,
15640
+ atlasJSON = _ref.atlasJSON,
15641
+ atlasIMG = _ref.atlasIMG;
15642
+ var getContent = function getContent(index) {
15643
+ var _shortcuts$index;
15644
+ if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === shared.ShortcutType.Item) {
15645
+ var _shortcuts$index2;
15646
+ var payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15647
+ if (!payload) return null;
15648
+ return React__default.createElement(SpriteFromAtlas, {
15649
+ atlasIMG: atlasIMG,
15650
+ atlasJSON: atlasJSON,
15651
+ spriteKey: shared.getItemTextureKeyPath({
15652
+ key: payload.texturePath,
15653
+ texturePath: payload.texturePath,
15654
+ stackQty: payload.stackQty || 1,
15655
+ isStackable: payload.isStackable
15656
+ }, atlasJSON),
15657
+ width: 32,
15658
+ height: 32,
15659
+ imgScale: 1.2,
15660
+ imgStyle: {
15661
+ left: '3px'
15662
+ }
15663
+ });
15664
+ }
15665
+ var IMAGE_SIZE = 32;
15666
+ var IMAGE_SCALE = 1;
15667
+ var shortcut = shortcuts[index];
15668
+ if ((shortcut == null ? void 0 : shortcut.type) === shared.ShortcutType.Spell && shortcut.payload) {
15669
+ var _payload$texturePath;
15670
+ var _payload = shortcut.payload; // TypeScript type assertion
15671
+ return React__default.createElement(SpriteFromAtlas, {
15672
+ atlasIMG: _payload.atlasIMG,
15673
+ atlasJSON: _payload.atlasJSON,
15674
+ spriteKey: (_payload$texturePath = _payload.texturePath) != null ? _payload$texturePath : '',
15675
+ width: IMAGE_SIZE,
15676
+ height: IMAGE_SIZE,
15677
+ imgScale: IMAGE_SCALE,
15678
+ centered: true,
15679
+ borderRadius: "50%"
15680
+ });
15681
+ }
15682
+ return null;
15683
+ };
15684
+ return React__default.createElement(Container$j, null, React__default.createElement("p", null, "Shortcuts:"), React__default.createElement(List, {
15685
+ id: "shortcuts_list"
15686
+ }, Array.from({
15687
+ length: 12
15688
+ }).map(function (_, i) {
15689
+ return React__default.createElement(Shortcut, {
15690
+ key: i,
15691
+ onPointerDown: function onPointerDown() {
15692
+ if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
15693
+ removeShortcut(i);
15694
+ if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None)) setSettingShortcutIndex(i);
15695
+ },
15696
+ disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
15697
+ isBeingSet: settingShortcutIndex === i,
15698
+ id: "shortcutSetter_" + i
15699
+ }, getContent(i));
15700
+ })));
15701
+ };
15702
+ var Container$j = /*#__PURE__*/styled.div.withConfig({
15703
+ displayName: "ShortcutsSetter__Container",
15704
+ componentId: "sc-xuouuf-0"
15705
+ })(["p{margin:0;margin-left:0.5rem;font-size:10px;}width:100%;"]);
15706
+ var Shortcut = /*#__PURE__*/styled.button.withConfig({
15707
+ displayName: "ShortcutsSetter__Shortcut",
15708
+ componentId: "sc-xuouuf-1"
15709
+ })(["width:2.4rem;height:2.4rem;background-color:", ";border:2px solid ", ";border-radius:50%;text-transform:uppercase;font-size:0.7rem;font-weight:bold;display:flex;align-items:center;justify-content:center;span{margin-top:4px;}&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}&:disabled{opacity:0.5;}"], uiColors.lightGray, function (_ref2) {
15710
+ var isBeingSet = _ref2.isBeingSet;
15711
+ return isBeingSet ? uiColors.yellow : uiColors.darkGray;
15712
+ }, uiColors.darkGray, uiColors.gray);
15713
+ var List = /*#__PURE__*/styled.div.withConfig({
15714
+ displayName: "ShortcutsSetter__List",
15715
+ componentId: "sc-xuouuf-2"
15716
+ })(["width:100%;display:flex;align-items:center;gap:0.4rem;box-sizing:border-box;margin:0 !important;flex-wrap:wrap;padding:0.3rem;padding-bottom:1rem;"]);
15717
+
15647
15718
  (function (RangeSliderType) {
15648
15719
  RangeSliderType["Slider"] = "rpgui-slider";
15649
15720
  RangeSliderType["GoldSlider"] = "rpgui-slider golden";
@@ -15798,88 +15869,33 @@ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
15798
15869
  componentId: "sc-yfdtpn-3"
15799
15870
  })(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:0.8rem;"]);
15800
15871
 
15801
- var ShortcutsSetter = function ShortcutsSetter(_ref) {
15802
- var setSettingShortcutIndex = _ref.setSettingShortcutIndex,
15803
- settingShortcutIndex = _ref.settingShortcutIndex,
15804
- shortcuts = _ref.shortcuts,
15805
- removeShortcut = _ref.removeShortcut,
15806
- atlasJSON = _ref.atlasJSON,
15807
- atlasIMG = _ref.atlasIMG;
15808
- var getContent = function getContent(index) {
15809
- var _shortcuts$index;
15810
- if (((_shortcuts$index = shortcuts[index]) == null ? void 0 : _shortcuts$index.type) === shared.ShortcutType.Item) {
15811
- var _shortcuts$index2;
15812
- var payload = (_shortcuts$index2 = shortcuts[index]) == null ? void 0 : _shortcuts$index2.payload;
15813
- if (!payload) return null;
15814
- return React__default.createElement(SpriteFromAtlas, {
15815
- atlasIMG: atlasIMG,
15816
- atlasJSON: atlasJSON,
15817
- spriteKey: shared.getItemTextureKeyPath({
15818
- key: payload.texturePath,
15819
- texturePath: payload.texturePath,
15820
- stackQty: payload.stackQty || 1,
15821
- isStackable: payload.isStackable
15822
- }, atlasJSON),
15823
- width: 32,
15824
- height: 32,
15825
- imgScale: 1.2,
15826
- imgStyle: {
15827
- left: '3px'
15828
- }
15872
+ var ItemQuantitySelectorModal = function ItemQuantitySelectorModal(_ref) {
15873
+ var quantitySelect = _ref.quantitySelect,
15874
+ setQuantitySelect = _ref.setQuantitySelect;
15875
+ return React__default.createElement(ModalPortal, null, React__default.createElement(QuantitySelectorContainer, null, React__default.createElement(ItemQuantitySelector, {
15876
+ quantity: quantitySelect.maxQuantity,
15877
+ onConfirm: function onConfirm(quantity) {
15878
+ quantitySelect.callback(quantity);
15879
+ setQuantitySelect({
15880
+ isOpen: false,
15881
+ maxQuantity: 1,
15882
+ callback: function callback() {}
15829
15883
  });
15830
- }
15831
- var IMAGE_SIZE = 32;
15832
- var IMAGE_SCALE = 1;
15833
- var shortcut = shortcuts[index];
15834
- if ((shortcut == null ? void 0 : shortcut.type) === shared.ShortcutType.Spell && shortcut.payload) {
15835
- var _payload$texturePath;
15836
- var _payload = shortcut.payload; // TypeScript type assertion
15837
- return React__default.createElement(SpriteFromAtlas, {
15838
- atlasIMG: _payload.atlasIMG,
15839
- atlasJSON: _payload.atlasJSON,
15840
- spriteKey: (_payload$texturePath = _payload.texturePath) != null ? _payload$texturePath : '',
15841
- width: IMAGE_SIZE,
15842
- height: IMAGE_SIZE,
15843
- imgScale: IMAGE_SCALE,
15844
- centered: true,
15845
- borderRadius: "50%"
15884
+ },
15885
+ onClose: function onClose() {
15886
+ quantitySelect.callback(-1);
15887
+ setQuantitySelect({
15888
+ isOpen: false,
15889
+ maxQuantity: 1,
15890
+ callback: function callback() {}
15846
15891
  });
15847
15892
  }
15848
- return null;
15849
- };
15850
- return React__default.createElement(Container$j, null, React__default.createElement("p", null, "Shortcuts:"), React__default.createElement(List, {
15851
- id: "shortcuts_list"
15852
- }, Array.from({
15853
- length: 12
15854
- }).map(function (_, i) {
15855
- return React__default.createElement(Shortcut, {
15856
- key: i,
15857
- onPointerDown: function onPointerDown() {
15858
- if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
15859
- removeShortcut(i);
15860
- if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None)) setSettingShortcutIndex(i);
15861
- },
15862
- disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
15863
- isBeingSet: settingShortcutIndex === i,
15864
- id: "shortcutSetter_" + i
15865
- }, getContent(i));
15866
15893
  })));
15867
15894
  };
15868
- var Container$j = /*#__PURE__*/styled.div.withConfig({
15869
- displayName: "ShortcutsSetter__Container",
15870
- componentId: "sc-xuouuf-0"
15871
- })(["p{margin:0;margin-left:0.5rem;font-size:10px;}width:100%;"]);
15872
- var Shortcut = /*#__PURE__*/styled.button.withConfig({
15873
- displayName: "ShortcutsSetter__Shortcut",
15874
- componentId: "sc-xuouuf-1"
15875
- })(["width:2.4rem;height:2.4rem;background-color:", ";border:2px solid ", ";border-radius:50%;text-transform:uppercase;font-size:0.7rem;font-weight:bold;display:flex;align-items:center;justify-content:center;span{margin-top:4px;}&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}&:disabled{opacity:0.5;}"], uiColors.lightGray, function (_ref2) {
15876
- var isBeingSet = _ref2.isBeingSet;
15877
- return isBeingSet ? uiColors.yellow : uiColors.darkGray;
15878
- }, uiColors.darkGray, uiColors.gray);
15879
- var List = /*#__PURE__*/styled.div.withConfig({
15880
- displayName: "ShortcutsSetter__List",
15881
- componentId: "sc-xuouuf-2"
15882
- })(["width:100%;display:flex;align-items:center;gap:0.4rem;box-sizing:border-box;margin:0 !important;flex-wrap:wrap;padding:0.3rem;padding-bottom:1rem;"]);
15895
+ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
15896
+ displayName: "ItemQuantitySelectorModal__QuantitySelectorContainer",
15897
+ componentId: "sc-1b8cosc-0"
15898
+ })(["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);"]);
15883
15899
 
15884
15900
  var ItemContainer$1 = function ItemContainer(_ref) {
15885
15901
  var itemContainer = _ref.itemContainer,
@@ -15995,34 +16011,15 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15995
16011
  atlasJSON: atlasJSON
15996
16012
  }), React__default.createElement(ItemsContainer, {
15997
16013
  className: "item-container-body"
15998
- }, onRenderSlots())), quantitySelect.isOpen && React__default.createElement(ModalPortal, null, React__default.createElement(QuantitySelectorContainer, null, React__default.createElement(ItemQuantitySelector, {
15999
- quantity: quantitySelect.maxQuantity,
16000
- onConfirm: function onConfirm(quantity) {
16001
- quantitySelect.callback(quantity);
16002
- setQuantitySelect({
16003
- isOpen: false,
16004
- maxQuantity: 1,
16005
- callback: function callback() {}
16006
- });
16007
- },
16008
- onClose: function onClose() {
16009
- quantitySelect.callback(-1);
16010
- setQuantitySelect({
16011
- isOpen: false,
16012
- maxQuantity: 1,
16013
- callback: function callback() {}
16014
- });
16015
- }
16016
- }))));
16014
+ }, onRenderSlots())), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
16015
+ quantitySelect: quantitySelect,
16016
+ setQuantitySelect: setQuantitySelect
16017
+ }));
16017
16018
  };
16018
16019
  var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
16019
16020
  displayName: "ItemContainer__ItemsContainer",
16020
16021
  componentId: "sc-15y5p9l-0"
16021
16022
  })(["display:flex;justify-content:center;flex-wrap:wrap;max-height:270px;overflow-y:auto;overflow-x:hidden;width:415px;"]);
16022
- var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
16023
- displayName: "ItemContainer__QuantitySelectorContainer",
16024
- componentId: "sc-15y5p9l-1"
16025
- })(["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);"]);
16026
16023
 
16027
16024
  var LeaderboardTable = function LeaderboardTable(props) {
16028
16025
  var items = props.items,