@rpg-engine/long-bow 0.8.8 → 0.8.10

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.
@@ -646,7 +646,7 @@ var Container$1 = /*#__PURE__*/styled.div.withConfig({
646
646
  var ImgSprite = /*#__PURE__*/styled.div.withConfig({
647
647
  displayName: "SpriteFromAtlas__ImgSprite",
648
648
  componentId: "sc-1lpani8-1"
649
- })(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";", " opacity:", ";"], function (props) {
649
+ })(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";filter:", ";opacity:", ";border-radius:", ";overflow:hidden;"], function (props) {
650
650
  return props.frame.w;
651
651
  }, function (props) {
652
652
  return props.frame.h;
@@ -663,9 +663,14 @@ var ImgSprite = /*#__PURE__*/styled.div.withConfig({
663
663
  }, function (props) {
664
664
  return props.centered ? '0' : '8px';
665
665
  }, function (props) {
666
- return props.tintColor && "\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: " + props.frame.w + "px;\n height: " + props.frame.h + "px;\n background-color: " + props.tintColor + ";\n mask-image: url(" + props.atlasIMG + ");\n mask-position: -" + props.frame.x + "px -" + props.frame.y + "px;\n -webkit-mask-image: url(" + props.atlasIMG + ");\n -webkit-mask-position: -" + props.frame.x + "px -" + props.frame.y + "px;\n mix-blend-mode: color; \n " + (props.grayScale ? 'filter: grayscale(100%);' : 'none') + "\n }\n ";
666
+ var filters = [];
667
+ if (props.grayScale) filters.push('grayscale(100%)');
668
+ if (props.tintColor) filters.push("brightness(0.8) contrast(1.2) sepia(100%) hue-rotate(" + (props.tintColor === '#FFD700' ? '40deg' : '210deg') + ") saturate(400%)");
669
+ return filters.length ? filters.join(' ') : 'none';
667
670
  }, function (props) {
668
671
  return props.opacity;
672
+ }, function (props) {
673
+ return props.borderRadius || '0';
669
674
  });
670
675
 
671
676
  var frames = {
@@ -31172,7 +31177,7 @@ var ItemContainer$1 = /*#__PURE__*/React.memo(function (_ref) {
31172
31177
  onItemDragEnd = _ref.onItemDragEnd,
31173
31178
  onItemDragStart = _ref.onItemDragStart,
31174
31179
  onItemPlaceDrop = _ref.onItemPlaceDrop,
31175
- _onOutsideDrop = _ref.onOutsideDrop,
31180
+ onOutsideDrop = _ref.onOutsideDrop,
31176
31181
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
31177
31182
  initialPosition = _ref.initialPosition,
31178
31183
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
@@ -31237,12 +31242,49 @@ var ItemContainer$1 = /*#__PURE__*/React.memo(function (_ref) {
31237
31242
  }
31238
31243
  onDragEndScrollingEvents();
31239
31244
  }, [onItemDragEnd, onDragEndScrollingEvents]);
31240
- // Memoize handleSetShortcut to prevent unnecessary re-renders
31241
- var memoizedHandleSetShortcut = useCallback(function (item, index) {
31242
- handleSetShortcut(item, index);
31243
- }, [handleSetShortcut]);
31244
- // Memoize onRenderSlots to prevent re-creating the slots array on every render
31245
- var onRenderSlots = useMemo(function () {
31245
+ var handleItemClick = useCallback(function (itemType, containerType, item) {
31246
+ if (settingShortcutIndex !== -1) {
31247
+ setSettingShortcutIndex(-1);
31248
+ handleSetShortcut(item, settingShortcutIndex);
31249
+ } else if (onItemClick) {
31250
+ onItemClick(item, itemType, containerType);
31251
+ }
31252
+ }, [settingShortcutIndex, handleSetShortcut, onItemClick]);
31253
+ var handlePlaceDrop = useCallback(function (item, slotIndex, itemContainerType) {
31254
+ if (onItemPlaceDrop) {
31255
+ onItemPlaceDrop(item, slotIndex, itemContainerType);
31256
+ }
31257
+ onDragEndScrollingEvents();
31258
+ }, [onItemPlaceDrop, onDragEndScrollingEvents]);
31259
+ var handleOutsideDrop = useCallback(function (item, position) {
31260
+ if (onOutsideDrop) {
31261
+ onOutsideDrop(item, position);
31262
+ }
31263
+ onDragEndScrollingEvents();
31264
+ }, [onOutsideDrop, onDragEndScrollingEvents]);
31265
+ var handleQuantitySelect = useCallback(function (maxQuantity, callback) {
31266
+ setQuantitySelect({
31267
+ isOpen: true,
31268
+ maxQuantity: maxQuantity,
31269
+ callback: callback
31270
+ });
31271
+ }, []);
31272
+ // Memoize slot rendering configuration
31273
+ var slotConfig = useMemo(function () {
31274
+ return {
31275
+ type: type,
31276
+ atlasIMG: atlasIMG,
31277
+ atlasJSON: atlasJSON,
31278
+ scale: scale,
31279
+ equipmentSet: equipmentSet,
31280
+ isDepotSystem: isDepotSystem,
31281
+ isSelectingShortcut: settingShortcutIndex !== -1,
31282
+ checkIfItemCanBeMoved: checkIfItemCanBeMoved,
31283
+ checkIfItemShouldDragEnd: checkIfItemShouldDragEnd
31284
+ };
31285
+ }, [type, atlasIMG, atlasJSON, scale, equipmentSet, isDepotSystem, settingShortcutIndex, checkIfItemCanBeMoved, checkIfItemShouldDragEnd]);
31286
+ // Memoize slots rendering
31287
+ var renderSlots = useMemo(function () {
31246
31288
  var slots = [];
31247
31289
  for (var i = 0; i < itemContainer.slotQty; i++) {
31248
31290
  var _itemContainer$slots;
@@ -31251,55 +31293,27 @@ var ItemContainer$1 = /*#__PURE__*/React.memo(function (_ref) {
31251
31293
  key: i,
31252
31294
  slotIndex: i,
31253
31295
  item: currentItem,
31254
- itemContainerType: type,
31255
- onMouseOver: onMouseOver ? function (event, slotIndex, item) {
31256
- return onMouseOver(event, slotIndex, item);
31257
- } : undefined,
31258
- onMouseOut: undefined,
31259
- onPointerDown: function onPointerDown(itemType, containerType, item) {
31260
- if (settingShortcutIndex !== -1) {
31261
- setSettingShortcutIndex(-1);
31262
- memoizedHandleSetShortcut(item, settingShortcutIndex);
31263
- } else if (onItemClick) {
31264
- onItemClick(item, itemType, containerType);
31265
- }
31266
- },
31296
+ itemContainerType: slotConfig.type,
31297
+ onMouseOver: onMouseOver,
31298
+ onPointerDown: handleItemClick,
31267
31299
  onDragStart: onDragStartHandler,
31268
31300
  onDragEnd: onDragEndHandler,
31269
- dragScale: scale,
31270
- checkIfItemCanBeMoved: checkIfItemCanBeMoved,
31271
- checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
31272
- openQuantitySelector: function openQuantitySelector(maxQuantity, callback) {
31273
- setQuantitySelect({
31274
- isOpen: true,
31275
- maxQuantity: maxQuantity,
31276
- callback: callback
31277
- });
31278
- },
31279
- onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
31280
- if (onItemPlaceDrop) {
31281
- onItemPlaceDrop(item, slotIndex, itemContainerType);
31282
- }
31283
- console.log('PLACE DROP');
31284
- onDragEndScrollingEvents();
31285
- },
31286
- onOutsideDrop: function onOutsideDrop(item, position) {
31287
- if (_onOutsideDrop) {
31288
- _onOutsideDrop(item, position);
31289
- }
31290
- console.log('OUTSIDE DROP');
31291
- onDragEndScrollingEvents();
31292
- },
31293
- atlasIMG: atlasIMG,
31294
- atlasJSON: atlasJSON,
31295
- isSelectingShortcut: settingShortcutIndex !== -1,
31296
- equipmentSet: equipmentSet,
31297
- setItemShortcut: type === ItemContainerType.Inventory ? memoizedHandleSetShortcut : undefined,
31298
- isDepotSystem: isDepotSystem
31301
+ dragScale: slotConfig.scale,
31302
+ checkIfItemCanBeMoved: slotConfig.checkIfItemCanBeMoved,
31303
+ checkIfItemShouldDragEnd: slotConfig.checkIfItemShouldDragEnd,
31304
+ openQuantitySelector: handleQuantitySelect,
31305
+ onPlaceDrop: handlePlaceDrop,
31306
+ onOutsideDrop: handleOutsideDrop,
31307
+ atlasIMG: slotConfig.atlasIMG,
31308
+ atlasJSON: slotConfig.atlasJSON,
31309
+ isSelectingShortcut: slotConfig.isSelectingShortcut,
31310
+ equipmentSet: slotConfig.equipmentSet,
31311
+ setItemShortcut: type === ItemContainerType.Inventory ? handleSetShortcut : undefined,
31312
+ isDepotSystem: slotConfig.isDepotSystem
31299
31313
  }));
31300
31314
  }
31301
31315
  return slots;
31302
- }, [itemContainer.slotQty, itemContainer.slots, type, onMouseOver, settingShortcutIndex, memoizedHandleSetShortcut, onItemClick, onDragStartHandler, onDragEndHandler, scale, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, onItemPlaceDrop, _onOutsideDrop, atlasIMG, atlasJSON, equipmentSet, isDepotSystem, onDragEndScrollingEvents]);
31316
+ }, [itemContainer.slotQty, itemContainer.slots, slotConfig, onMouseOver, handleItemClick, onDragStartHandler, onDragEndHandler, handleQuantitySelect, handlePlaceDrop, handleOutsideDrop, handleSetShortcut, type]);
31303
31317
  return React.createElement(ItemSlotDraggingProvider, null, React.createElement(ItemSlotDetailsProvider, null, React.createElement(DraggedItem, {
31304
31318
  atlasIMG: atlasIMG,
31305
31319
  atlasJSON: atlasJSON,
@@ -31325,7 +31339,7 @@ var ItemContainer$1 = /*#__PURE__*/React.memo(function (_ref) {
31325
31339
  ref: containerRef,
31326
31340
  isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
31327
31341
  isFullScreen: isFullScreen
31328
- }, onRenderSlots)), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
31342
+ }, renderSlots)), quantitySelect.isOpen && React.createElement(ItemQuantitySelectorModal, {
31329
31343
  quantitySelect: quantitySelect,
31330
31344
  setQuantitySelect: setQuantitySelect
31331
31345
  }), React.createElement(ItemSlotToolTips, {