@rpg-engine/long-bow 0.6.75 → 0.6.77

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.
package/dist/index.d.ts CHANGED
@@ -33,8 +33,8 @@ export * from './components/NPCDialog/QuestionDialog/QuestionDialog';
33
33
  export * from './components/PartySystem';
34
34
  export * from './components/ProgressBar';
35
35
  export * from './components/PropertySelect/PropertySelect';
36
- export * from './components/QuestInfo/QuestInfo';
37
- export * from './components/QuestList';
36
+ export * from './components/Quests/QuestInfo/QuestInfo';
37
+ export * from './components/Quests/QuestList';
38
38
  export * from './components/RadioButton';
39
39
  export * from './components/RangeSlider';
40
40
  export * from './components/RPGUI/RPGUIContainer';
@@ -31877,237 +31877,78 @@ var QuestInfo = function QuestInfo(_ref) {
31877
31877
  };
31878
31878
  var QuestDraggableContainer = /*#__PURE__*/styled__default(DraggableContainer).withConfig({
31879
31879
  displayName: "QuestInfo__QuestDraggableContainer",
31880
- componentId: "sc-15s2boc-0"
31880
+ componentId: "sc-1wccpiy-0"
31881
31881
  })(["border:1px solid black;width:600px;padding:0 0 0 0 !important;.DraggableContainer__TitleContainer-sc-184mpyl-2{height:auto;}.container-close{position:absolute;margin-left:auto;top:20px;padding-right:5px;}img{display:inline-block;vertical-align:middle;line-height:normal;}"]);
31882
31882
  var QuestContainer = /*#__PURE__*/styled__default.div.withConfig({
31883
31883
  displayName: "QuestInfo__QuestContainer",
31884
- componentId: "sc-15s2boc-1"
31884
+ componentId: "sc-1wccpiy-1"
31885
31885
  })(["margin-right:40px;margin-left:40px;"]);
31886
31886
  var QuestsContainer = /*#__PURE__*/styled__default.div.withConfig({
31887
31887
  displayName: "QuestInfo__QuestsContainer",
31888
- componentId: "sc-15s2boc-2"
31888
+ componentId: "sc-1wccpiy-2"
31889
31889
  })(["display:flex;align-items:center;"]);
31890
31890
  var Content = /*#__PURE__*/styled__default.div.withConfig({
31891
31891
  displayName: "QuestInfo__Content",
31892
- componentId: "sc-15s2boc-3"
31892
+ componentId: "sc-1wccpiy-3"
31893
31893
  })(["padding:18px;h1{text-align:left;margin:14px 0px;}"]);
31894
31894
  var QuestSplitDiv = /*#__PURE__*/styled__default.div.withConfig({
31895
31895
  displayName: "QuestInfo__QuestSplitDiv",
31896
- componentId: "sc-15s2boc-4"
31896
+ componentId: "sc-1wccpiy-4"
31897
31897
  })(["width:100%;font-size:11px;margin-bottom:10px;hr{margin:0px;padding:0px;}p{margin-bottom:0px;}"]);
31898
31898
  var QuestColumn = /*#__PURE__*/styled__default(Column).withConfig({
31899
31899
  displayName: "QuestInfo__QuestColumn",
31900
- componentId: "sc-15s2boc-5"
31900
+ componentId: "sc-1wccpiy-5"
31901
31901
  })(["padding-top:5px;margin-bottom:20px;display:flex;justify-content:space-evenly;"]);
31902
31902
  var TitleContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
31903
31903
  displayName: "QuestInfo__TitleContainer",
31904
- componentId: "sc-15s2boc-6"
31904
+ componentId: "sc-1wccpiy-6"
31905
31905
  })(["width:100%;display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;margin-top:1rem;"]);
31906
31906
  var Title$7 = /*#__PURE__*/styled__default.h1.withConfig({
31907
31907
  displayName: "QuestInfo__Title",
31908
- componentId: "sc-15s2boc-7"
31908
+ componentId: "sc-1wccpiy-7"
31909
31909
  })(["color:white;z-index:22;font-size:", " !important;color:", " !important;"], uiFonts.size.medium, uiColors.yellow);
31910
31910
  var Thumbnail = /*#__PURE__*/styled__default.img.withConfig({
31911
31911
  displayName: "QuestInfo__Thumbnail",
31912
- componentId: "sc-15s2boc-8"
31912
+ componentId: "sc-1wccpiy-8"
31913
31913
  })(["color:white;z-index:22;width:32px * 1.5;margin-right:0.5rem;position:relative;top:-4px;"]);
31914
31914
 
31915
- var RPGUIScrollbar = function RPGUIScrollbar(_ref) {
31916
- var children = _ref.children;
31917
- return React__default.createElement(Container$r, null, children);
31918
- };
31919
- var Container$r = /*#__PURE__*/styled__default.div.withConfig({
31920
- displayName: "RPGUIScrollbar__Container",
31921
- componentId: "sc-p3msmb-0"
31922
- })([".rpgui-content ::-webkit-scrollbar,.rpgui-content::-webkit-scrollbar{width:25px !important;}.rpgui-content ::-webkit-scrollbar-track,.rpgui-content::-webkit-scrollbar-track{background-size:25px 60px !important;}"]);
31923
-
31924
- var RPGUIOverrides = function RPGUIOverrides(_ref) {
31925
- var children = _ref.children;
31926
- return React__default.createElement(RPGUIScrollbar, null, children);
31927
- };
31928
-
31929
- //@ts-ignore
31930
- var _RPGUI = RPGUI;
31931
- var RPGUIRoot = function RPGUIRoot(_ref) {
31932
- var children = _ref.children;
31933
- return React__default.createElement(RPGUIOverrides, null, React__default.createElement("div", {
31934
- className: "rpgui-content"
31935
- }, children));
31936
- };
31937
-
31938
- var SimpleTooltip = function SimpleTooltip(_ref) {
31939
- var content = _ref.content,
31940
- _ref$direction = _ref.direction,
31941
- direction = _ref$direction === void 0 ? 'top' : _ref$direction,
31942
- _ref$backgroundColor = _ref.backgroundColor,
31943
- backgroundColor = _ref$backgroundColor === void 0 ? uiColors.raisinBlack : _ref$backgroundColor,
31944
- _ref$textColor = _ref.textColor,
31945
- textColor = _ref$textColor === void 0 ? uiColors.white : _ref$textColor,
31946
- children = _ref.children,
31947
- _ref$showDelay = _ref.showDelay,
31948
- showDelay = _ref$showDelay === void 0 ? 200 : _ref$showDelay,
31949
- _ref$hideDelay = _ref.hideDelay,
31950
- hideDelay = _ref$hideDelay === void 0 ? 200 : _ref$hideDelay;
31951
- var _useState = React.useState(false),
31952
- visible = _useState[0],
31953
- setVisible = _useState[1];
31954
- var _useState2 = React.useState({
31955
- top: 0,
31956
- left: 0
31957
- }),
31958
- tooltipPosition = _useState2[0],
31959
- setTooltipPosition = _useState2[1];
31960
- var tooltipRef = React.useRef(null);
31961
- var triggerRef = React.useRef(null);
31962
- var timeoutRef = React.useRef();
31963
- var calculatePosition = function calculatePosition() {
31964
- if (!triggerRef.current || !tooltipRef.current) return;
31965
- var triggerRect = triggerRef.current.getBoundingClientRect();
31966
- var tooltipRect = tooltipRef.current.getBoundingClientRect();
31967
- var top, left;
31968
- switch (direction) {
31969
- case 'top':
31970
- top = triggerRect.top - tooltipRect.height - 8;
31971
- left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
31972
- break;
31973
- case 'bottom':
31974
- top = triggerRect.bottom + 8;
31975
- left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
31976
- break;
31977
- case 'left':
31978
- top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
31979
- left = triggerRect.left - tooltipRect.width - 8;
31980
- break;
31981
- case 'right':
31982
- top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2;
31983
- left = triggerRect.right + 8;
31984
- break;
31985
- default:
31986
- top = triggerRect.top - tooltipRect.height - 8;
31987
- left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2;
31988
- }
31989
- // Ensure the tooltip stays within the viewport
31990
- if (left < 8) left = 8;
31991
- if (left + tooltipRect.width > window.innerWidth) left = window.innerWidth - tooltipRect.width - 8;
31992
- if (top < 8) top = 8;
31993
- if (top + tooltipRect.height > window.innerHeight) top = window.innerHeight - tooltipRect.height - 8;
31994
- setTooltipPosition({
31995
- top: Math.round(top),
31996
- left: Math.round(left)
31997
- });
31998
- };
31999
- var showTooltip = function showTooltip() {
32000
- clearTimeout(timeoutRef.current);
32001
- timeoutRef.current = setTimeout(function () {
32002
- setVisible(true);
32003
- calculatePosition();
32004
- }, showDelay);
32005
- };
32006
- var hideTooltip = function hideTooltip() {
32007
- clearTimeout(timeoutRef.current);
32008
- timeoutRef.current = setTimeout(function () {
32009
- setVisible(false);
32010
- }, hideDelay);
32011
- };
32012
- React.useEffect(function () {
32013
- var handleMouseMove = function handleMouseMove(event) {
32014
- if (visible && tooltipRef.current && triggerRef.current) {
32015
- var tooltipRect = tooltipRef.current.getBoundingClientRect();
32016
- var triggerRect = triggerRef.current.getBoundingClientRect();
32017
- var isOutsideTooltip = event.clientX < tooltipRect.left || event.clientX > tooltipRect.right || event.clientY < tooltipRect.top || event.clientY > tooltipRect.bottom;
32018
- var isOutsideTrigger = event.clientX < triggerRect.left || event.clientX > triggerRect.right || event.clientY < triggerRect.top || event.clientY > triggerRect.bottom;
32019
- if (isOutsideTooltip && isOutsideTrigger) {
32020
- hideTooltip();
32021
- }
32022
- }
32023
- };
32024
- var handleScroll = function handleScroll() {
32025
- if (visible) {
32026
- hideTooltip();
32027
- }
32028
- };
32029
- var handleResize = function handleResize() {
32030
- if (visible) {
32031
- calculatePosition();
32032
- }
32033
- };
32034
- document.addEventListener('mousemove', handleMouseMove);
32035
- window.addEventListener('scroll', handleScroll);
32036
- window.addEventListener('resize', handleResize);
32037
- return function () {
32038
- document.removeEventListener('mousemove', handleMouseMove);
32039
- window.removeEventListener('scroll', handleScroll);
32040
- window.removeEventListener('resize', handleResize);
32041
- clearTimeout(timeoutRef.current);
32042
- };
32043
- }, [visible]);
32044
- return React__default.createElement(TooltipContainer, {
32045
- ref: triggerRef,
32046
- onMouseEnter: showTooltip,
32047
- onMouseLeave: hideTooltip,
32048
- onFocus: showTooltip,
32049
- onBlur: hideTooltip
32050
- }, children, visible && ReactDOM.createPortal(React__default.createElement(RPGUIRoot, null, React__default.createElement(TooltipBox, {
32051
- ref: tooltipRef,
32052
- direction: direction,
32053
- backgroundColor: backgroundColor,
32054
- textColor: textColor,
32055
- style: {
32056
- top: tooltipPosition.top,
32057
- left: tooltipPosition.left
32058
- }
32059
- }, content)), document.body));
32060
- };
32061
- var TooltipContainer = /*#__PURE__*/styled__default.div.withConfig({
32062
- displayName: "SimpleTooltip__TooltipContainer",
32063
- componentId: "sc-l46vpo-0"
32064
- })(["display:inline-block;cursor:inherit;"]);
32065
- var fadeIn$1 = /*#__PURE__*/styled.keyframes(["from{opacity:0;transform:scale(0.95);}to{opacity:1;transform:scale(1);}"]);
32066
- var TooltipBox = /*#__PURE__*/styled__default.div.withConfig({
32067
- displayName: "SimpleTooltip__TooltipBox",
32068
- componentId: "sc-l46vpo-1"
32069
- })(["position:fixed;z-index:1000;background-color:", ";color:", ";padding:8px;border-radius:4px;font-size:0.65rem;max-width:250px;box-shadow:0px 4px 8px rgba(0,0,0,0.1);animation:", " 0.2s ease-out;line-height:1.3;"], function (_ref2) {
32070
- var backgroundColor = _ref2.backgroundColor;
32071
- return backgroundColor;
32072
- }, function (_ref3) {
32073
- var textColor = _ref3.textColor;
32074
- return textColor;
32075
- }, fadeIn$1);
32076
-
32077
31915
  var QuestList = function QuestList(_ref) {
32078
31916
  var quests = _ref.quests;
32079
- return React__default.createElement(QuestListContainer, null, quests && quests.length > 0 ? React__default.createElement(React__default.Fragment, null, React__default.createElement(Table, null, React__default.createElement("thead", null, React__default.createElement(TableRow, null, React__default.createElement(TableHeader, null, "Status"), React__default.createElement(TableHeader, null, "Title"), React__default.createElement(TableHeader, null, "Description"), React__default.createElement(TableHeader, null, "Objectives"), React__default.createElement(TableHeader, null, "Rewards"))), React__default.createElement("tbody", null, quests.map(function (quest, i) {
32080
- var _quest$status;
32081
- return React__default.createElement(TableRow, {
31917
+ return React__default.createElement(QuestListContainer, null, quests && quests.length > 0 ? quests.map(function (quest, i) {
31918
+ var _formatStatus;
31919
+ return React__default.createElement(QuestCard, {
32082
31920
  key: i
32083
- }, React__default.createElement(TableCell, {
31921
+ }, React__default.createElement(QuestItem, null, React__default.createElement(Label, null, "Title:"), React__default.createElement(Value, null, formatText(quest.title))), React__default.createElement(QuestItem, null, React__default.createElement(Label, null, "Status:"), React__default.createElement(Value, {
32084
31922
  style: {
32085
31923
  color: getStatusColor(quest.status)
32086
31924
  }
32087
- }, (_quest$status = quest.status) != null ? _quest$status : 'Unknown'), React__default.createElement(TableCell, null, React__default.createElement(SimpleTooltip, {
32088
- content: formatText(quest.title),
32089
- direction: "bottom"
32090
- }, React__default.createElement(Ellipsis, {
32091
- maxWidth: "300px"
32092
- }, formatText(quest.title)))), React__default.createElement(TableCell, null, React__default.createElement(SimpleTooltip, {
32093
- content: quest.description,
32094
- direction: "bottom"
32095
- }, React__default.createElement(Ellipsis, {
32096
- maxWidth: "300px"
32097
- }, quest.description))), React__default.createElement(TableCell, null, React__default.createElement(SimpleTooltip, {
32098
- content: formatObjectives(quest.objectives),
32099
- direction: "bottom"
32100
- }, React__default.createElement(Ellipsis, {
32101
- maxWidth: "300px"
32102
- }, formatObjectives(quest.objectives)))), React__default.createElement(TableCell, null, React__default.createElement(SimpleTooltip, {
32103
- content: formatRewards(quest.rewards),
32104
- direction: "bottom"
32105
- }, React__default.createElement(Ellipsis, {
32106
- maxWidth: "200px"
32107
- }, formatRewards(quest.rewards)))));
32108
- })))) : React__default.createElement(NoQuestContainer, null, React__default.createElement("p", null, "There are no ongoing quests")));
31925
+ }, (_formatStatus = formatStatus(quest.status)) != null ? _formatStatus : 'Unknown')), React__default.createElement(QuestItem, null, React__default.createElement(Label, null, "Description:"), React__default.createElement(Value, null, quest.description)), React__default.createElement(QuestItem, null, React__default.createElement(Label, null, "Objectives:"), React__default.createElement(Value, null, formatObjectives(quest.objectives))), React__default.createElement(QuestItem, null, React__default.createElement(Label, null, "Rewards:"), React__default.createElement(Value, null, formatRewards(quest.rewards))));
31926
+ }) : React__default.createElement(NoQuestContainer, null, React__default.createElement("p", null, "There are no ongoing quests")));
32109
31927
  };
32110
- // Updated helper function to format objectives
31928
+ var QuestListContainer = /*#__PURE__*/styled__default.div.withConfig({
31929
+ displayName: "QuestList__QuestListContainer",
31930
+ componentId: "sc-1c1y8sp-0"
31931
+ })(["margin-top:20px;margin-bottom:40px;overflow-y:auto;max-height:400px;padding:10px;border-radius:10px;font-size:0.7rem;"]);
31932
+ var QuestCard = /*#__PURE__*/styled__default.div.withConfig({
31933
+ displayName: "QuestList__QuestCard",
31934
+ componentId: "sc-1c1y8sp-1"
31935
+ })(["background-color:", ";padding:15px;margin-bottom:10px;border-radius:10px;border:1px solid ", ";display:flex;flex-direction:column;"], uiColors.darkGray, uiColors.gray);
31936
+ var QuestItem = /*#__PURE__*/styled__default.div.withConfig({
31937
+ displayName: "QuestList__QuestItem",
31938
+ componentId: "sc-1c1y8sp-2"
31939
+ })(["display:flex;margin-bottom:5px;flex-wrap:wrap;&:last-child{margin-bottom:0;}"]);
31940
+ var Label = /*#__PURE__*/styled__default.span.withConfig({
31941
+ displayName: "QuestList__Label",
31942
+ componentId: "sc-1c1y8sp-3"
31943
+ })(["font-weight:bold;color:", " !important;margin-right:10px;"], uiColors.yellow);
31944
+ var Value = /*#__PURE__*/styled__default.span.withConfig({
31945
+ displayName: "QuestList__Value",
31946
+ componentId: "sc-1c1y8sp-4"
31947
+ })(["flex-grow:1;color:", ";word-wrap:break-word;"], uiColors.white);
31948
+ var NoQuestContainer = /*#__PURE__*/styled__default.div.withConfig({
31949
+ displayName: "QuestList__NoQuestContainer",
31950
+ componentId: "sc-1c1y8sp-5"
31951
+ })(["text-align:center;p{margin-top:5px;color:", ";}"], uiColors.lightGray);
32111
31952
  var formatObjectives = function formatObjectives(objectives) {
32112
31953
  try {
32113
31954
  if (!objectives || !Array.isArray(objectives)) return 'No objectives';
@@ -32129,22 +31970,28 @@ var formatObjectives = function formatObjectives(objectives) {
32129
31970
  return 'Error formatting objectives';
32130
31971
  }
32131
31972
  };
32132
- // Updated helper function to format rewards
32133
31973
  var formatRewards = function formatRewards(rewards) {
32134
31974
  try {
32135
31975
  if (!rewards || !Array.isArray(rewards)) return 'No rewards';
32136
31976
  return rewards.map(function (reward) {
32137
- var _reward$itemKeys;
32138
- return "" + formatText(reward == null ? void 0 : (_reward$itemKeys = reward.itemKeys) == null ? void 0 : _reward$itemKeys.map(function (itemKey) {
32139
- return itemKey + ' x' + (reward == null ? void 0 : reward.qty);
32140
- }).join(', ')) + (reward != null && reward.spellKeys ? ", Spells: " + formatText(reward.spellKeys.join(', ')) : '');
32141
- }).join('; ');
31977
+ var _reward$itemKeys, _reward$spellKeys;
31978
+ var itemKeysFormatted = reward == null ? void 0 : (_reward$itemKeys = reward.itemKeys) == null ? void 0 : _reward$itemKeys.map(function (itemKey) {
31979
+ return itemKey && (reward == null ? void 0 : reward.qty) !== undefined ? itemKey + " x" + reward.qty : '';
31980
+ }).filter(Boolean).join(', ');
31981
+ var spellKeysFormatted = reward == null ? void 0 : (_reward$spellKeys = reward.spellKeys) == null ? void 0 : _reward$spellKeys.filter(Boolean).join(', ');
31982
+ var formattedReward = itemKeysFormatted ? "" + formatText(itemKeysFormatted) : '';
31983
+ if (spellKeysFormatted) {
31984
+ return formattedReward ? formattedReward + ", Spells: " + formatText(spellKeysFormatted) : "Spells: " + formatText(spellKeysFormatted);
31985
+ }
31986
+ return formattedReward || 'No rewards';
31987
+ }).filter(Boolean).join('; ');
32142
31988
  } catch (error) {
32143
31989
  console.error("Error formatting rewards: " + JSON.stringify(rewards) + ":", error);
32144
31990
  return 'Error on rewards';
32145
31991
  }
32146
31992
  };
32147
31993
  var formatText = function formatText(text) {
31994
+ if (!text) return 'Unknown';
32148
31995
  return text.split('-').map(function (word) {
32149
31996
  return word.charAt(0).toUpperCase() + word.slice(1);
32150
31997
  }).join(' ');
@@ -32153,26 +32000,20 @@ var getStatusColor = function getStatusColor(status) {
32153
32000
  switch (status) {
32154
32001
  case shared.QuestStatus.Pending:
32155
32002
  return uiColors.orange;
32156
- // Orange
32157
32003
  case shared.QuestStatus.InProgress:
32158
32004
  return uiColors.blue;
32159
- // Deep Sky Blue
32160
32005
  case shared.QuestStatus.Completed:
32161
32006
  return uiColors.lightGreen;
32162
- // Lime Green
32163
32007
  default:
32164
32008
  return uiColors.white;
32165
- // Default to white
32166
32009
  }
32167
32010
  };
32168
- var QuestListContainer = /*#__PURE__*/styled__default.div.withConfig({
32169
- displayName: "QuestList__QuestListContainer",
32170
- componentId: "sc-1a2vx6q-0"
32171
- })(["margin-top:20px;margin-bottom:40px;overflow-y:auto;max-height:400px;background-color:", ";padding:20px;border-radius:10px;border:1px solid ", ";font-size:0.7rem;"], uiColors.darkGray, uiColors.gray);
32172
- var NoQuestContainer = /*#__PURE__*/styled__default.div.withConfig({
32173
- displayName: "QuestList__NoQuestContainer",
32174
- componentId: "sc-1a2vx6q-1"
32175
- })(["text-align:center;p{margin-top:5px;color:", ";}"], uiColors.lightGray);
32011
+ var formatStatus = function formatStatus(status) {
32012
+ if (!status) return 'Unknown';
32013
+ return status.split(/(?=[A-Z])/).join(' ').replace(/^\w/, function (c) {
32014
+ return c.toUpperCase();
32015
+ });
32016
+ };
32176
32017
 
32177
32018
  var InputRadio$1 = function InputRadio(_ref) {
32178
32019
  var name = _ref.name,
@@ -32206,6 +32047,29 @@ var InputRadio$1 = function InputRadio(_ref) {
32206
32047
  }));
32207
32048
  };
32208
32049
 
32050
+ var RPGUIScrollbar = function RPGUIScrollbar(_ref) {
32051
+ var children = _ref.children;
32052
+ return React__default.createElement(Container$r, null, children);
32053
+ };
32054
+ var Container$r = /*#__PURE__*/styled__default.div.withConfig({
32055
+ displayName: "RPGUIScrollbar__Container",
32056
+ componentId: "sc-p3msmb-0"
32057
+ })([".rpgui-content ::-webkit-scrollbar,.rpgui-content::-webkit-scrollbar{width:25px !important;}.rpgui-content ::-webkit-scrollbar-track,.rpgui-content::-webkit-scrollbar-track{background-size:25px 60px !important;}"]);
32058
+
32059
+ var RPGUIOverrides = function RPGUIOverrides(_ref) {
32060
+ var children = _ref.children;
32061
+ return React__default.createElement(RPGUIScrollbar, null, children);
32062
+ };
32063
+
32064
+ //@ts-ignore
32065
+ var _RPGUI = RPGUI;
32066
+ var RPGUIRoot = function RPGUIRoot(_ref) {
32067
+ var children = _ref.children;
32068
+ return React__default.createElement(RPGUIOverrides, null, React__default.createElement("div", {
32069
+ className: "rpgui-content"
32070
+ }, children));
32071
+ };
32072
+
32209
32073
  var Shortcuts = function Shortcuts(_ref) {
32210
32074
  var shortcuts = _ref.shortcuts,
32211
32075
  onShortcutCast = _ref.onShortcutCast,