@rpg-engine/long-bow 0.3.38 → 0.3.40

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.
@@ -33054,6 +33054,123 @@ var CheckButton = function CheckButton(_ref) {
33054
33054
  }));
33055
33055
  };
33056
33056
 
33057
+ var QuickSpells = function QuickSpells(_ref) {
33058
+ var quickSpells = _ref.quickSpells,
33059
+ onSpellCast = _ref.onSpellCast,
33060
+ mana = _ref.mana,
33061
+ _ref$isBlockedCasting = _ref.isBlockedCastingByKeyboard,
33062
+ isBlockedCastingByKeyboard = _ref$isBlockedCasting === void 0 ? false : _ref$isBlockedCasting;
33063
+ useEffect(function () {
33064
+ var handleKeyDown = function handleKeyDown(e) {
33065
+ if (isBlockedCastingByKeyboard) return;
33066
+ var shortcutIndex = Number(e.key) - 1;
33067
+ if (shortcutIndex >= 0 && shortcutIndex <= 3) {
33068
+ var shortcut = quickSpells[shortcutIndex];
33069
+ if (shortcut != null && shortcut.key && mana >= (shortcut == null ? void 0 : shortcut.manaCost)) {
33070
+ onSpellCast(shortcut.key);
33071
+ }
33072
+ }
33073
+ };
33074
+ window.addEventListener('keydown', handleKeyDown);
33075
+ return function () {
33076
+ window.removeEventListener('keydown', handleKeyDown);
33077
+ };
33078
+ }, [quickSpells, isBlockedCastingByKeyboard]);
33079
+ return React.createElement(List, null, Array.from({
33080
+ length: 4
33081
+ }).map(function (_, i) {
33082
+ var _quickSpells$i, _quickSpells$i2, _quickSpells$i3, _quickSpells$i4, _quickSpells$i5;
33083
+ return React.createElement(SpellShortcut, {
33084
+ key: i,
33085
+ onClick: onSpellCast.bind(null, (_quickSpells$i = quickSpells[i]) == null ? void 0 : _quickSpells$i.key),
33086
+ disabled: mana < ((_quickSpells$i2 = quickSpells[i]) == null ? void 0 : _quickSpells$i2.manaCost)
33087
+ }, React.createElement("span", {
33088
+ className: "mana"
33089
+ }, ((_quickSpells$i3 = quickSpells[i]) == null ? void 0 : _quickSpells$i3.key) && ((_quickSpells$i4 = quickSpells[i]) == null ? void 0 : _quickSpells$i4.manaCost)), React.createElement("span", {
33090
+ className: "magicWords"
33091
+ }, (_quickSpells$i5 = quickSpells[i]) == null ? void 0 : _quickSpells$i5.magicWords.split(' ').map(function (word) {
33092
+ return word[0];
33093
+ })), React.createElement("span", {
33094
+ className: "keyboard"
33095
+ }, i + 1));
33096
+ }));
33097
+ };
33098
+ var SpellShortcut = /*#__PURE__*/styled.button.withConfig({
33099
+ displayName: "QuickSpells__SpellShortcut",
33100
+ componentId: "sc-41yq7s-0"
33101
+ })(["width:3rem;height:3rem;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;position:relative;span{pointer-events:none;}.mana{position:absolute;top:-5px;right:0;font-size:0.65rem;color:", ";}.magicWords{margin-top:4px;}.keyboard{position:absolute;bottom:-5px;left:0;font-size:0.65rem;color:", ";}&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}&:disabled{opacity:0.5;}"], uiColors.lightGray, uiColors.darkGray, uiColors.blue, uiColors.yellow, uiColors.darkGray, uiColors.gray);
33102
+ var List = /*#__PURE__*/styled.p.withConfig({
33103
+ displayName: "QuickSpells__List",
33104
+ componentId: "sc-41yq7s-1"
33105
+ })(["width:100%;display:flex;align-items:center;justify-content:center;gap:0.5rem;box-sizing:border-box;margin:0 !important;"]);
33106
+
33107
+ var CircularController = function CircularController(_ref) {
33108
+ var onActionClick = _ref.onActionClick,
33109
+ onCancelClick = _ref.onCancelClick,
33110
+ onSpellClick = _ref.onSpellClick,
33111
+ mana = _ref.mana,
33112
+ spells = _ref.spells;
33113
+ var onTouchStart = function onTouchStart(e) {
33114
+ var target = e.target;
33115
+ target == null ? void 0 : target.classList.add('active');
33116
+ };
33117
+ var onTouchEnd = function onTouchEnd(action, e) {
33118
+ var target = e.target;
33119
+ setTimeout(function () {
33120
+ target == null ? void 0 : target.classList.remove('active');
33121
+ }, 100);
33122
+ action();
33123
+ };
33124
+ return React.createElement(ButtonsContainer, null, React.createElement(SpellsContainer, null, Array.from({
33125
+ length: 4
33126
+ }).map(function (_, i) {
33127
+ var variant = i === 0 ? 'top' : i === 3 ? 'bottom' : '';
33128
+ var spell = spells[i];
33129
+ var onSpellClickBinded = spell ? onSpellClick.bind(null, spell.key) : function () {};
33130
+ return React.createElement(StyledShortcut, {
33131
+ key: i,
33132
+ disabled: mana < (spell == null ? void 0 : spell.manaCost),
33133
+ onTouchStart: onTouchStart,
33134
+ onTouchEnd: onTouchEnd.bind(null, onSpellClickBinded),
33135
+ className: variant
33136
+ }, React.createElement("span", {
33137
+ className: "mana"
33138
+ }, (spell == null ? void 0 : spell.key) && (spell == null ? void 0 : spell.manaCost)), React.createElement("span", {
33139
+ className: "magicWords"
33140
+ }, spell == null ? void 0 : spell.magicWords.split(' ').map(function (word) {
33141
+ return word[0];
33142
+ })));
33143
+ })), React.createElement(Button$2, {
33144
+ onTouchStart: onTouchStart,
33145
+ onTouchEnd: onTouchEnd.bind(null, onActionClick)
33146
+ }, React.createElement("div", {
33147
+ className: "rpgui-icon sword"
33148
+ })), React.createElement(CancelButton, {
33149
+ onTouchStart: onTouchStart,
33150
+ onTouchEnd: onTouchEnd.bind(null, onCancelClick)
33151
+ }, React.createElement("span", null, "X")));
33152
+ };
33153
+ var Button$2 = /*#__PURE__*/styled.button.withConfig({
33154
+ displayName: "CircularController__Button",
33155
+ componentId: "sc-1fewf3h-0"
33156
+ })(["width:4.3rem;height:4.3rem;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;position:relative;transition:background-color 0.1s;&.active{background-color:", ";}.sword{transform:rotate(-45deg);height:2.5rem;width:1.9rem;pointer-events:none;}"], uiColors.lightGray, uiColors.darkGray, uiColors.gray);
33157
+ var CancelButton = /*#__PURE__*/styled(Button$2).withConfig({
33158
+ displayName: "CircularController__CancelButton",
33159
+ componentId: "sc-1fewf3h-1"
33160
+ })(["width:3rem;height:3rem;font-size:0.8rem;span{margin-top:4px;margin-left:2px;pointer-events:none;}"]);
33161
+ var ButtonsContainer = /*#__PURE__*/styled.div.withConfig({
33162
+ displayName: "CircularController__ButtonsContainer",
33163
+ componentId: "sc-1fewf3h-2"
33164
+ })(["display:flex;align-items:center;justify-content:center;gap:0.5rem;"]);
33165
+ var SpellsContainer = /*#__PURE__*/styled.div.withConfig({
33166
+ displayName: "CircularController__SpellsContainer",
33167
+ componentId: "sc-1fewf3h-3"
33168
+ })(["display:flex;align-items:center;justify-content:center;gap:0.4rem;flex-direction:column;.top{transform:translate(93%,25%);}.bottom{transform:translate(93%,-25%);}"]);
33169
+ var StyledShortcut = /*#__PURE__*/styled(SpellShortcut).withConfig({
33170
+ displayName: "CircularController__StyledShortcut",
33171
+ componentId: "sc-1fewf3h-4"
33172
+ })(["width:2.5rem;height:2.5rem;transition:background-color 0.1s;.mana{font-size:0.5rem;}&:hover,&:focus,&:active{background-color:", ";}&.active{background-color:", ";}"], uiColors.lightGray, uiColors.gray);
33173
+
33057
33174
  function useOutsideClick(ref, id) {
33058
33175
  useEffect(function () {
33059
33176
  /**
@@ -35451,56 +35568,6 @@ var CloseButton$3 = /*#__PURE__*/styled.div.withConfig({
35451
35568
  componentId: "sc-1g0c67q-2"
35452
35569
  })(["position:absolute;top:2px;right:2px;color:white;z-index:22;font-size:1.1rem;"]);
35453
35570
 
35454
- var QuickSpells = function QuickSpells(_ref) {
35455
- var quickSpells = _ref.quickSpells,
35456
- onSpellCast = _ref.onSpellCast,
35457
- mana = _ref.mana,
35458
- _ref$isBlockedCasting = _ref.isBlockedCastingByKeyboard,
35459
- isBlockedCastingByKeyboard = _ref$isBlockedCasting === void 0 ? false : _ref$isBlockedCasting;
35460
- useEffect(function () {
35461
- var handleKeyDown = function handleKeyDown(e) {
35462
- if (isBlockedCastingByKeyboard) return;
35463
- var shortcutIndex = Number(e.key) - 1;
35464
- if (shortcutIndex >= 0 && shortcutIndex <= 3) {
35465
- var shortcut = quickSpells[shortcutIndex];
35466
- if (shortcut != null && shortcut.key && mana >= (shortcut == null ? void 0 : shortcut.manaCost)) {
35467
- onSpellCast(shortcut.key);
35468
- }
35469
- }
35470
- };
35471
- window.addEventListener('keydown', handleKeyDown);
35472
- return function () {
35473
- window.removeEventListener('keydown', handleKeyDown);
35474
- };
35475
- }, [quickSpells, isBlockedCastingByKeyboard]);
35476
- return React.createElement(List, null, Array.from({
35477
- length: 4
35478
- }).map(function (_, i) {
35479
- var _quickSpells$i, _quickSpells$i2, _quickSpells$i3, _quickSpells$i4, _quickSpells$i5;
35480
- return React.createElement(SpellShortcut, {
35481
- key: i,
35482
- onClick: onSpellCast.bind(null, (_quickSpells$i = quickSpells[i]) == null ? void 0 : _quickSpells$i.key),
35483
- disabled: mana < ((_quickSpells$i2 = quickSpells[i]) == null ? void 0 : _quickSpells$i2.manaCost)
35484
- }, React.createElement("span", {
35485
- className: "mana"
35486
- }, ((_quickSpells$i3 = quickSpells[i]) == null ? void 0 : _quickSpells$i3.key) && ((_quickSpells$i4 = quickSpells[i]) == null ? void 0 : _quickSpells$i4.manaCost)), React.createElement("span", {
35487
- className: "magicWords"
35488
- }, (_quickSpells$i5 = quickSpells[i]) == null ? void 0 : _quickSpells$i5.magicWords.split(' ').map(function (word) {
35489
- return word[0];
35490
- })), React.createElement("span", {
35491
- className: "keyboard"
35492
- }, i + 1));
35493
- }));
35494
- };
35495
- var SpellShortcut = /*#__PURE__*/styled.button.withConfig({
35496
- displayName: "QuickSpells__SpellShortcut",
35497
- componentId: "sc-41yq7s-0"
35498
- })(["width:3rem;height:3rem;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;position:relative;.mana{position:absolute;top:-5px;right:0;font-size:0.65rem;color:", ";}.magicWords{margin-top:4px;}.keyboard{position:absolute;bottom:-5px;left:0;font-size:0.65rem;color:", ";}&:hover,&:focus{background-color:", ";}&:active{background-color:", ";}&:disabled{opacity:0.5;}"], uiColors.lightGray, uiColors.darkGray, uiColors.blue, uiColors.yellow, uiColors.darkGray, uiColors.gray);
35499
- var List = /*#__PURE__*/styled.p.withConfig({
35500
- displayName: "QuickSpells__List",
35501
- componentId: "sc-41yq7s-1"
35502
- })(["width:100%;display:flex;align-items:center;justify-content:center;gap:0.5rem;box-sizing:border-box;margin:0 !important;"]);
35503
-
35504
35571
  var Spell = function Spell(_ref) {
35505
35572
  var spellKey = _ref.spellKey,
35506
35573
  name = _ref.name,
@@ -35757,6 +35824,19 @@ var TradingItemRow = function TradingItemRow(_ref) {
35757
35824
  onQuantityChange(traderItem, newQuantity);
35758
35825
  }
35759
35826
  };
35827
+ var onLeftOutClick = function onLeftOutClick() {
35828
+ if (selectedQty >= 10) {
35829
+ var newQuantity = selectedQty - 10;
35830
+ onQuantityChange(traderItem, newQuantity);
35831
+ }
35832
+ };
35833
+ var onRightOutClick = function onRightOutClick() {
35834
+ var _traderItem$qty2;
35835
+ if (selectedQty < ((_traderItem$qty2 = traderItem.qty) != null ? _traderItem$qty2 : 999)) {
35836
+ var newQuantity = selectedQty + 10;
35837
+ onQuantityChange(traderItem, newQuantity);
35838
+ }
35839
+ };
35760
35840
  return React.createElement(ItemWrapper, null, React.createElement(ItemIconContainer, null, React.createElement(SpriteContainer$1, null, React.createElement(SpriteFromAtlas, {
35761
35841
  atlasIMG: atlasIMG,
35762
35842
  atlasJSON: atlasJSON,
@@ -35770,54 +35850,70 @@ var TradingItemRow = function TradingItemRow(_ref) {
35770
35850
  maxLines: 1,
35771
35851
  maxWidth: "250px"
35772
35852
  }, capitalize(traderItem.name))), React.createElement("p", null, "$", traderItem.price))), React.createElement(QuantityContainer, null, React.createElement(SelectArrow, {
35853
+ size: 32,
35854
+ className: "arrow-selector",
35855
+ direction: "left",
35856
+ onClick: onLeftOutClick,
35857
+ onTouchStart: onLeftOutClick
35858
+ }), React.createElement(StyledArrow, {
35773
35859
  size: 32,
35774
35860
  className: "arrow-selector",
35775
35861
  direction: "left",
35776
35862
  onClick: onLeftClick,
35777
35863
  onTouchStart: onLeftClick
35778
- }), React.createElement(QuantityDisplay, null, React.createElement(TextOverlay$2, null, React.createElement(Item$1, null, selectedQty))), React.createElement(SelectArrow, {
35864
+ }), React.createElement(QuantityDisplay, null, React.createElement(TextOverlay$2, null, React.createElement(Item$1, null, selectedQty))), React.createElement(StyledArrow, {
35779
35865
  size: 32,
35780
35866
  className: "arrow-selector",
35781
35867
  direction: "right",
35782
35868
  onClick: onRightClick,
35783
35869
  onTouchStart: onRightClick
35870
+ }), React.createElement(SelectArrow, {
35871
+ size: 32,
35872
+ className: "arrow-selector",
35873
+ direction: "right",
35874
+ onClick: onRightOutClick,
35875
+ onTouchStart: onRightOutClick
35784
35876
  })));
35785
35877
  };
35878
+ var StyledArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
35879
+ displayName: "TradingItemRow__StyledArrow",
35880
+ componentId: "sc-mja0b5-0"
35881
+ })(["margin:40px;"]);
35786
35882
  var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
35787
35883
  displayName: "TradingItemRow__ItemWrapper",
35788
- componentId: "sc-mja0b5-0"
35884
+ componentId: "sc-mja0b5-1"
35789
35885
  })(["width:100%;margin:auto;display:flex;justify-content:space-between;margin-bottom:1rem;&:hover{background-color:", ";}padding:0.5rem;"], uiColors.darkGray);
35790
35886
  var ItemNameContainer = /*#__PURE__*/styled.div.withConfig({
35791
35887
  displayName: "TradingItemRow__ItemNameContainer",
35792
- componentId: "sc-mja0b5-1"
35888
+ componentId: "sc-mja0b5-2"
35793
35889
  })(["flex:60%;"]);
35794
35890
  var ItemIconContainer = /*#__PURE__*/styled.div.withConfig({
35795
35891
  displayName: "TradingItemRow__ItemIconContainer",
35796
- componentId: "sc-mja0b5-2"
35892
+ componentId: "sc-mja0b5-3"
35797
35893
  })(["display:flex;justify-content:flex-start;align-items:center;flex:0 0 58px;"]);
35798
35894
  var SpriteContainer$1 = /*#__PURE__*/styled.div.withConfig({
35799
35895
  displayName: "TradingItemRow__SpriteContainer",
35800
- componentId: "sc-mja0b5-3"
35896
+ componentId: "sc-mja0b5-4"
35801
35897
  })(["position:relative;top:-0.5rem;left:0.5rem;"]);
35802
35898
  var NameValue = /*#__PURE__*/styled.div.withConfig({
35803
35899
  displayName: "TradingItemRow__NameValue",
35804
- componentId: "sc-mja0b5-4"
35900
+ componentId: "sc-mja0b5-5"
35805
35901
  })(["p{font-size:0.75rem;margin:0;}"]);
35806
35902
  var Item$1 = /*#__PURE__*/styled.span.withConfig({
35807
35903
  displayName: "TradingItemRow__Item",
35808
- componentId: "sc-mja0b5-5"
35904
+ componentId: "sc-mja0b5-6"
35809
35905
  })(["color:white;text-align:center;z-index:1;width:100%;"]);
35810
35906
  var TextOverlay$2 = /*#__PURE__*/styled.div.withConfig({
35811
35907
  displayName: "TradingItemRow__TextOverlay",
35812
- componentId: "sc-mja0b5-6"
35908
+ componentId: "sc-mja0b5-7"
35813
35909
  })(["width:100%;position:relative;"]);
35814
35910
  var QuantityContainer = /*#__PURE__*/styled.div.withConfig({
35815
35911
  displayName: "TradingItemRow__QuantityContainer",
35816
- componentId: "sc-mja0b5-7"
35817
- })(["position:relative;display:flex;min-width:100px;width:40%;justify-content:center;align-items:center;flex:20%;"]);
35912
+ componentId: "sc-mja0b5-8"
35913
+ })(["position:relative;display:flex;min-width:100px;width:40%;justify-content:center;align-items:center;flex:40%;"]);
35818
35914
  var QuantityDisplay = /*#__PURE__*/styled.div.withConfig({
35819
35915
  displayName: "TradingItemRow__QuantityDisplay",
35820
- componentId: "sc-mja0b5-8"
35916
+ componentId: "sc-mja0b5-9"
35821
35917
  })(["font-size:", ";"], uiFonts.size.small);
35822
35918
 
35823
35919
  var TradingMenu = function TradingMenu(_ref) {
@@ -35879,7 +35975,7 @@ var TradingMenu = function TradingMenu(_ref) {
35879
35975
  onCloseButton: function onCloseButton() {
35880
35976
  if (onClose) onClose();
35881
35977
  },
35882
- width: "500px",
35978
+ width: "600px",
35883
35979
  cancelDrag: ".equipment-container-body .arrow-selector"
35884
35980
  }, React.createElement(React.Fragment, null, React.createElement("div", {
35885
35981
  style: {
@@ -35956,5 +36052,5 @@ var Container$k = /*#__PURE__*/styled.div.withConfig({
35956
36052
  return props.maxLines;
35957
36053
  });
35958
36054
 
35959
- export { Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, CheckButton, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, ErrorBoundary, HistoryDialog, ImgSide, Input, InputRadio, ItemContainer$1 as ItemContainer, ItemSelector, ItemSlot, ListMenu, NPCDialog, NPCDialogType, NPCMultiDialog, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, QuickSpells, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SkillProgressBar, SkillsContainer, Spellbook, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, useEventListener };
36055
+ export { Button, ButtonTypes, CharacterSelection, Chat, ChatDeprecated, CheckButton, CircularController, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, ErrorBoundary, HistoryDialog, ImgSide, Input, InputRadio, ItemContainer$1 as ItemContainer, ItemSelector, ItemSlot, ListMenu, NPCDialog, NPCDialogType, NPCMultiDialog, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, QuickSpells, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SkillProgressBar, SkillsContainer, SpellShortcut, Spellbook, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, useEventListener };
35960
36056
  //# sourceMappingURL=long-bow.esm.js.map