@rpg-engine/long-bow 0.2.80 → 0.2.90

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,10 +5,10 @@ import dayjs from 'dayjs';
5
5
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
6
6
  import Draggable from 'react-draggable';
7
7
  import { v4 } from 'uuid';
8
- import { observer } from 'mobx-react-lite';
9
- import isMobile from 'is-mobile';
10
8
  import 'rpgui/rpgui.min.css';
11
9
  import 'rpgui/rpgui.min.js';
10
+ import { observer } from 'mobx-react-lite';
11
+ import isMobile from 'is-mobile';
12
12
  import _ from 'lodash-es';
13
13
  import capitalize from 'lodash-es/capitalize';
14
14
 
@@ -33100,6 +33100,41 @@ var DropdownOptions = /*#__PURE__*/styled.ul.withConfig({
33100
33100
  return props.opened ? 'block' : 'none';
33101
33101
  });
33102
33102
 
33103
+ //@ts-ignore
33104
+ var _RPGUI = RPGUI;
33105
+ var RPGUIRoot = function RPGUIRoot(_ref) {
33106
+ var children = _ref.children;
33107
+ return React.createElement("div", {
33108
+ className: "rpgui-content"
33109
+ }, children);
33110
+ };
33111
+
33112
+ var RPGUIForceRenderStart = function RPGUIForceRenderStart(_ref) {
33113
+ var children = _ref.children,
33114
+ elementDOMId = _ref.elementDOMId,
33115
+ elementRenderedDOMKey = _ref.elementRenderedDOMKey,
33116
+ RPGUICreateFunction = _ref.RPGUICreateFunction;
33117
+ var _useState = useState(false),
33118
+ isRendered = _useState[0],
33119
+ setIsRendered = _useState[1];
33120
+ useEffect(function () {
33121
+ if (_RPGUI) {
33122
+ var element = document.getElementById(elementDOMId);
33123
+ // create an interval to wait for the element to be rendered
33124
+ // if it's not, trigger the rendering forcefully
33125
+ var interval = setInterval(function () {
33126
+ var dropdown = document.querySelector(elementRenderedDOMKey);
33127
+ if (!dropdown && !isRendered) {
33128
+ _RPGUI.__create_funcs[RPGUICreateFunction](element);
33129
+ setIsRendered(true);
33130
+ clearInterval(interval);
33131
+ }
33132
+ }, 10);
33133
+ }
33134
+ }, []);
33135
+ return React.createElement(React.Fragment, null, children);
33136
+ };
33137
+
33103
33138
  var CraftBook = function CraftBook(_ref) {
33104
33139
  var atlasIMG = _ref.atlasIMG,
33105
33140
  atlasJSON = _ref.atlasJSON,
@@ -33149,7 +33184,11 @@ var CraftBook = function CraftBook(_ref) {
33149
33184
  var elementValue = element.value;
33150
33185
  setCraftItem(elementValue);
33151
33186
  };
33152
- return React.createElement(DraggableContainer, {
33187
+ return React.createElement(RPGUIForceRenderStart, {
33188
+ elementDOMId: "radioInput",
33189
+ elementRenderedDOMKey: "rpgui-radio",
33190
+ RPGUICreateFunction: "radio"
33191
+ }, React.createElement(DraggableContainer, {
33153
33192
  type: RPGUIContainerTypes.Framed,
33154
33193
  width: "500px",
33155
33194
  cancelDrag: ".equipment-container-body .arrow-selector",
@@ -33183,7 +33222,8 @@ var CraftBook = function CraftBook(_ref) {
33183
33222
  type: "radio",
33184
33223
  value: option.name,
33185
33224
  name: "test",
33186
- disabled: !option.canCraft
33225
+ disabled: !option.canCraft,
33226
+ id: "radioInput"
33187
33227
  }), React.createElement("label", {
33188
33228
  onClick: handleClick,
33189
33229
  style: {
@@ -33220,7 +33260,7 @@ var CraftBook = function CraftBook(_ref) {
33220
33260
  onClick: function onClick() {
33221
33261
  return onCraftItem(craftItem);
33222
33262
  }
33223
- }, "Craft")));
33263
+ }, "Craft"))));
33224
33264
  };
33225
33265
  var StyledItem = /*#__PURE__*/styled.div.withConfig({
33226
33266
  displayName: "CraftBook__StyledItem",
@@ -34301,6 +34341,92 @@ var ItemsContainer = /*#__PURE__*/styled.div.withConfig({
34301
34341
  componentId: "sc-15y5p9l-0"
34302
34342
  })(["max-width:280px;display:flex;justify-content:center;flex-wrap:wrap;"]);
34303
34343
 
34344
+ var ItemSelector = function ItemSelector(_ref) {
34345
+ var atlasIMG = _ref.atlasIMG,
34346
+ atlasJSON = _ref.atlasJSON,
34347
+ options = _ref.options,
34348
+ onClose = _ref.onClose,
34349
+ onSelect = _ref.onSelect;
34350
+ var _useState = useState(),
34351
+ selectedValue = _useState[0],
34352
+ setSelectedValue = _useState[1];
34353
+ var handleClick = function handleClick() {
34354
+ var element = document.querySelector("input[name='test']:checked");
34355
+ var elementValue = element.value;
34356
+ setSelectedValue(elementValue);
34357
+ };
34358
+ useEffect(function () {
34359
+ if (selectedValue) {
34360
+ onSelect(selectedValue);
34361
+ }
34362
+ }, [selectedValue]);
34363
+ return React.createElement(DraggableContainer, {
34364
+ type: RPGUIContainerTypes.Framed,
34365
+ width: "500px",
34366
+ cancelDrag: ".equipment-container-body .arrow-selector",
34367
+ onCloseButton: function onCloseButton() {
34368
+ if (onClose) {
34369
+ onClose();
34370
+ }
34371
+ }
34372
+ }, React.createElement("div", {
34373
+ style: {
34374
+ width: '100%'
34375
+ }
34376
+ }, React.createElement(Title$2, null, 'Harvesting instruments'), React.createElement(Subtitle$1, null, 'Use the tool, you need it'), React.createElement("hr", {
34377
+ className: "golden"
34378
+ })), React.createElement(RadioInputScroller$1, null, options == null ? void 0 : options.map(function (option, index) {
34379
+ return React.createElement(RadioOptionsWrapper$1, {
34380
+ key: index
34381
+ }, React.createElement(SpriteAtlasWrapper$1, null, React.createElement(SpriteFromAtlas, {
34382
+ atlasIMG: atlasIMG,
34383
+ atlasJSON: atlasJSON,
34384
+ spriteKey: option.imageKey,
34385
+ imgScale: 3
34386
+ })), React.createElement("div", null, React.createElement("input", {
34387
+ className: "rpgui-radio",
34388
+ type: "radio",
34389
+ value: option.name,
34390
+ name: "test"
34391
+ }), React.createElement("label", {
34392
+ onClick: handleClick,
34393
+ style: {
34394
+ display: 'flex',
34395
+ alignItems: 'center'
34396
+ }
34397
+ }, option.name, " ", React.createElement("br", null), option.description)));
34398
+ })), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
34399
+ buttonType: ButtonTypes.RPGUIButton,
34400
+ onClick: onClose
34401
+ }, "Cancel"), React.createElement(Button, {
34402
+ buttonType: ButtonTypes.RPGUIButton
34403
+ }, "Select")));
34404
+ };
34405
+ var Title$2 = /*#__PURE__*/styled.h1.withConfig({
34406
+ displayName: "ItemSelector__Title",
34407
+ componentId: "sc-gptoxp-0"
34408
+ })(["font-size:0.6rem;color:yellow !important;"]);
34409
+ var Subtitle$1 = /*#__PURE__*/styled.h1.withConfig({
34410
+ displayName: "ItemSelector__Subtitle",
34411
+ componentId: "sc-gptoxp-1"
34412
+ })(["font-size:0.4rem;color:yellow !important;"]);
34413
+ var RadioInputScroller$1 = /*#__PURE__*/styled.div.withConfig({
34414
+ displayName: "ItemSelector__RadioInputScroller",
34415
+ componentId: "sc-gptoxp-2"
34416
+ })(["padding-left:15px;padding-top:10px;width:100%;margin-top:1rem;align-items:center;margin-left:20px;align-items:flex-start;overflow-y:scroll;height:360px;"]);
34417
+ var SpriteAtlasWrapper$1 = /*#__PURE__*/styled.div.withConfig({
34418
+ displayName: "ItemSelector__SpriteAtlasWrapper",
34419
+ componentId: "sc-gptoxp-3"
34420
+ })(["margin-right:40px;"]);
34421
+ var RadioOptionsWrapper$1 = /*#__PURE__*/styled.div.withConfig({
34422
+ displayName: "ItemSelector__RadioOptionsWrapper",
34423
+ componentId: "sc-gptoxp-4"
34424
+ })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
34425
+ var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
34426
+ displayName: "ItemSelector__ButtonWrapper",
34427
+ componentId: "sc-gptoxp-5"
34428
+ })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
34429
+
34304
34430
  var ListMenu = function ListMenu(_ref) {
34305
34431
  var options = _ref.options,
34306
34432
  onSelected = _ref.onSelected,
@@ -34436,7 +34562,7 @@ var QuestInfo = function QuestInfo(_ref) {
34436
34562
  onTouchStart: onRightClick
34437
34563
  }), React.createElement(QuestContainer, null, React.createElement(TitleContainer$1, {
34438
34564
  className: "drag-handler"
34439
- }, React.createElement(Title$2, null, React.createElement(Thumbnail, {
34565
+ }, React.createElement(Title$3, null, React.createElement(Thumbnail, {
34440
34566
  src: quests[currentIndex].thumbnail || img$9
34441
34567
  }), quests[currentIndex].title), React.createElement(QuestSplitDiv, null, React.createElement("hr", {
34442
34568
  className: "golden"
@@ -34455,7 +34581,7 @@ var QuestInfo = function QuestInfo(_ref) {
34455
34581
  }, button.title);
34456
34582
  })))) : React.createElement(QuestsContainer, null, React.createElement(QuestContainer, null, React.createElement(TitleContainer$1, {
34457
34583
  className: "drag-handler"
34458
- }, React.createElement(Title$2, null, React.createElement(Thumbnail, {
34584
+ }, React.createElement(Title$3, null, React.createElement(Thumbnail, {
34459
34585
  src: quests[0].thumbnail || img$9
34460
34586
  }), quests[0].title), React.createElement(QuestSplitDiv, null, React.createElement("hr", {
34461
34587
  className: "golden"
@@ -34502,7 +34628,7 @@ var TitleContainer$1 = /*#__PURE__*/styled.div.withConfig({
34502
34628
  displayName: "QuestInfo__TitleContainer",
34503
34629
  componentId: "sc-15s2boc-6"
34504
34630
  })(["width:100%;display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;margin-top:1rem;"]);
34505
- var Title$2 = /*#__PURE__*/styled.h1.withConfig({
34631
+ var Title$3 = /*#__PURE__*/styled.h1.withConfig({
34506
34632
  displayName: "QuestInfo__Title",
34507
34633
  componentId: "sc-15s2boc-7"
34508
34634
  })(["color:white;z-index:22;font-size:", " !important;color:", " !important;"], uiFonts.size.medium, uiColors.yellow);
@@ -34524,7 +34650,7 @@ var QuestList = function QuestList(_ref) {
34524
34650
  style: {
34525
34651
  width: '100%'
34526
34652
  }
34527
- }, React.createElement(Title$3, null, "Quests"), React.createElement("hr", {
34653
+ }, React.createElement(Title$4, null, "Quests"), React.createElement("hr", {
34528
34654
  className: "golden"
34529
34655
  }), React.createElement(QuestListContainer, null, quests ? quests.map(function (quest, i) {
34530
34656
  return React.createElement("div", {
@@ -34545,7 +34671,7 @@ var QuestDraggableContainer$1 = /*#__PURE__*/styled(DraggableContainer).withConf
34545
34671
  displayName: "QuestList__QuestDraggableContainer",
34546
34672
  componentId: "sc-1a2vx6q-0"
34547
34673
  })([".container-close{top:10px;right:10px;}.quest-title{text-align:left;margin-left:44px;margin-top:20px;color:yellow;}.quest-desc{margin-top:12px;margin-left:44px;}.rpgui-progress{min-width:80%;margin:0 auto;}"]);
34548
- var Title$3 = /*#__PURE__*/styled.h1.withConfig({
34674
+ var Title$4 = /*#__PURE__*/styled.h1.withConfig({
34549
34675
  displayName: "QuestList__Title",
34550
34676
  componentId: "sc-1a2vx6q-1"
34551
34677
  })(["z-index:22;font-size:", " !important;color:yellow !important;"], uiFonts.size.medium);
@@ -34558,15 +34684,6 @@ var NoQuestContainer = /*#__PURE__*/styled.div.withConfig({
34558
34684
  componentId: "sc-1a2vx6q-3"
34559
34685
  })(["text-align:center;p{margin-top:5px;}"]);
34560
34686
 
34561
- //@ts-ignore
34562
- var _RPGUI = RPGUI;
34563
- var RPGUIRoot = function RPGUIRoot(_ref) {
34564
- var children = _ref.children;
34565
- return React.createElement("div", {
34566
- className: "rpgui-content"
34567
- }, children);
34568
- };
34569
-
34570
34687
  var InputRadio = function InputRadio(_ref) {
34571
34688
  var name = _ref.name,
34572
34689
  items = _ref.items,
@@ -35038,7 +35155,7 @@ var TradingMenu = function TradingMenu(_ref) {
35038
35155
  style: {
35039
35156
  width: '100%'
35040
35157
  }
35041
- }, React.createElement(Title$4, null, Capitalize(type), " Menu"), React.createElement("hr", {
35158
+ }, React.createElement(Title$5, null, Capitalize(type), " Menu"), React.createElement("hr", {
35042
35159
  className: "golden"
35043
35160
  })), React.createElement(TradingComponentScrollWrapper, null, traderItems.map(function (tradeItem, index) {
35044
35161
  var _qtyMap$get;
@@ -35051,7 +35168,7 @@ var TradingMenu = function TradingMenu(_ref) {
35051
35168
  traderItem: tradeItem,
35052
35169
  selectedQty: (_qtyMap$get = qtyMap.get(tradeItem.key)) != null ? _qtyMap$get : 0
35053
35170
  }));
35054
- })), React.createElement(GoldWrapper, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold)), React.createElement(TotalWrapper, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertWrapper, null, React.createElement("p", null, " Sorry, not enough money.")) : React.createElement(GoldWrapper, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold())), React.createElement(ButtonWrapper$1, null, React.createElement(Button, {
35171
+ })), React.createElement(GoldWrapper, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold)), React.createElement(TotalWrapper, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertWrapper, null, React.createElement("p", null, " Sorry, not enough money.")) : React.createElement(GoldWrapper, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold())), React.createElement(ButtonWrapper$2, null, React.createElement(Button, {
35055
35172
  buttonType: ButtonTypes.RPGUIButton,
35056
35173
  disabled: !hasGoldForSale(),
35057
35174
  onClick: function onClick() {
@@ -35064,7 +35181,7 @@ var TradingMenu = function TradingMenu(_ref) {
35064
35181
  }
35065
35182
  }, "Cancel"))));
35066
35183
  };
35067
- var Title$4 = /*#__PURE__*/styled.h1.withConfig({
35184
+ var Title$5 = /*#__PURE__*/styled.h1.withConfig({
35068
35185
  displayName: "TradingMenu__Title",
35069
35186
  componentId: "sc-1wjsz1l-0"
35070
35187
  })(["z-index:22;font-size:0.6rem;color:yellow !important;"]);
@@ -35088,7 +35205,7 @@ var AlertWrapper = /*#__PURE__*/styled.div.withConfig({
35088
35205
  displayName: "TradingMenu__AlertWrapper",
35089
35206
  componentId: "sc-1wjsz1l-5"
35090
35207
  })(["margin-top:1rem;display:flex;width:100%;justify-content:center;height:20px;p{color:red !important;}"]);
35091
- var ButtonWrapper$1 = /*#__PURE__*/styled.div.withConfig({
35208
+ var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
35092
35209
  displayName: "TradingMenu__ButtonWrapper",
35093
35210
  componentId: "sc-1wjsz1l-6"
35094
35211
  })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;margin-top:1rem;"]);
@@ -35109,91 +35226,5 @@ var Container$i = /*#__PURE__*/styled.div.withConfig({
35109
35226
  return props.maxLines;
35110
35227
  });
35111
35228
 
35112
- var ItemSelector = function ItemSelector(_ref) {
35113
- var atlasIMG = _ref.atlasIMG,
35114
- atlasJSON = _ref.atlasJSON,
35115
- options = _ref.options,
35116
- onClose = _ref.onClose,
35117
- onSelect = _ref.onSelect;
35118
- var _useState = useState(),
35119
- selectedValue = _useState[0],
35120
- setSelectedValue = _useState[1];
35121
- var handleClick = function handleClick() {
35122
- var element = document.querySelector("input[name='test']:checked");
35123
- var elementValue = element.value;
35124
- setSelectedValue(elementValue);
35125
- };
35126
- useEffect(function () {
35127
- if (selectedValue) {
35128
- onSelect(selectedValue);
35129
- }
35130
- }, [selectedValue]);
35131
- return React.createElement(DraggableContainer, {
35132
- type: RPGUIContainerTypes.Framed,
35133
- width: "500px",
35134
- cancelDrag: ".equipment-container-body .arrow-selector",
35135
- onCloseButton: function onCloseButton() {
35136
- if (onClose) {
35137
- onClose();
35138
- }
35139
- }
35140
- }, React.createElement("div", {
35141
- style: {
35142
- width: '100%'
35143
- }
35144
- }, React.createElement(Title$5, null, 'Harvesting instruments'), React.createElement(Subtitle$1, null, 'Use the tool, you need it'), React.createElement("hr", {
35145
- className: "golden"
35146
- })), React.createElement(RadioInputScroller$1, null, options == null ? void 0 : options.map(function (option, index) {
35147
- return React.createElement(RadioOptionsWrapper$1, {
35148
- key: index
35149
- }, React.createElement(SpriteAtlasWrapper$1, null, React.createElement(SpriteFromAtlas, {
35150
- atlasIMG: atlasIMG,
35151
- atlasJSON: atlasJSON,
35152
- spriteKey: option.imageKey,
35153
- imgScale: 3
35154
- })), React.createElement("div", null, React.createElement("input", {
35155
- className: "rpgui-radio",
35156
- type: "radio",
35157
- value: option.name,
35158
- name: "test"
35159
- }), React.createElement("label", {
35160
- onClick: handleClick,
35161
- style: {
35162
- display: 'flex',
35163
- alignItems: 'center'
35164
- }
35165
- }, option.name, " ", React.createElement("br", null), option.description)));
35166
- })), React.createElement(ButtonWrapper$2, null, React.createElement(Button, {
35167
- buttonType: ButtonTypes.RPGUIButton,
35168
- onClick: onClose
35169
- }, "Cancel"), React.createElement(Button, {
35170
- buttonType: ButtonTypes.RPGUIButton
35171
- }, "Select")));
35172
- };
35173
- var Title$5 = /*#__PURE__*/styled.h1.withConfig({
35174
- displayName: "ItemSelector__Title",
35175
- componentId: "sc-gptoxp-0"
35176
- })(["font-size:0.6rem;color:yellow !important;"]);
35177
- var Subtitle$1 = /*#__PURE__*/styled.h1.withConfig({
35178
- displayName: "ItemSelector__Subtitle",
35179
- componentId: "sc-gptoxp-1"
35180
- })(["font-size:0.4rem;color:yellow !important;"]);
35181
- var RadioInputScroller$1 = /*#__PURE__*/styled.div.withConfig({
35182
- displayName: "ItemSelector__RadioInputScroller",
35183
- componentId: "sc-gptoxp-2"
35184
- })(["padding-left:15px;padding-top:10px;width:100%;margin-top:1rem;align-items:center;margin-left:20px;align-items:flex-start;overflow-y:scroll;height:360px;"]);
35185
- var SpriteAtlasWrapper$1 = /*#__PURE__*/styled.div.withConfig({
35186
- displayName: "ItemSelector__SpriteAtlasWrapper",
35187
- componentId: "sc-gptoxp-3"
35188
- })(["margin-right:40px;"]);
35189
- var RadioOptionsWrapper$1 = /*#__PURE__*/styled.div.withConfig({
35190
- displayName: "ItemSelector__RadioOptionsWrapper",
35191
- componentId: "sc-gptoxp-4"
35192
- })(["display:flex;align-items:stretch;margin-bottom:40px;"]);
35193
- var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
35194
- displayName: "ItemSelector__ButtonWrapper",
35195
- componentId: "sc-gptoxp-5"
35196
- })(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
35197
-
35198
- export { Button, ButtonTypes, CharacterSelection, Chat, CheckButton, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, ErrorBoundary, HistoryDialog, ImgSide, Input, InputRadio, ItemContainer, ItemSelector, ItemSlot, ListMenu, NPCDialog, NPCDialogType, NPCMultiDialog, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIRoot, RangeSlider, RangeSliderType, SkillProgressBar, SkillsContainer, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, useEventListener };
35229
+ export { Button, ButtonTypes, CharacterSelection, Chat, CheckButton, CraftBook, DraggableContainer, Dropdown, DropdownSelectorContainer, DynamicText, EquipmentSet, ErrorBoundary, HistoryDialog, ImgSide, Input, InputRadio, ItemContainer, ItemSelector, ItemSlot, ListMenu, NPCDialog, NPCDialogType, NPCMultiDialog, ProgressBar, PropertySelect, QuestInfo, QuestList, QuestionDialog, RPGUIContainer, RPGUIContainerTypes, RPGUIForceRenderStart, RPGUIRoot, RangeSlider, RangeSliderType, SkillProgressBar, SkillsContainer, SpriteFromAtlas, TextArea, TimeWidget, TradingMenu, Truncate, _RPGUI, useEventListener };
35199
35230
  //# sourceMappingURL=long-bow.esm.js.map