@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.
@@ -654,7 +654,7 @@ var Container$1 = /*#__PURE__*/styled__default.div.withConfig({
654
654
  var ImgSprite = /*#__PURE__*/styled__default.div.withConfig({
655
655
  displayName: "SpriteFromAtlas__ImgSprite",
656
656
  componentId: "sc-1lpani8-1"
657
- })(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";", " opacity:", ";"], function (props) {
657
+ })(["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) {
658
658
  return props.frame.w;
659
659
  }, function (props) {
660
660
  return props.frame.h;
@@ -671,9 +671,14 @@ var ImgSprite = /*#__PURE__*/styled__default.div.withConfig({
671
671
  }, function (props) {
672
672
  return props.centered ? '0' : '8px';
673
673
  }, function (props) {
674
- 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 ";
674
+ var filters = [];
675
+ if (props.grayScale) filters.push('grayscale(100%)');
676
+ if (props.tintColor) filters.push("brightness(0.8) contrast(1.2) sepia(100%) hue-rotate(" + (props.tintColor === '#FFD700' ? '40deg' : '210deg') + ") saturate(400%)");
677
+ return filters.length ? filters.join(' ') : 'none';
675
678
  }, function (props) {
676
679
  return props.opacity;
680
+ }, function (props) {
681
+ return props.borderRadius || '0';
677
682
  });
678
683
 
679
684
  var frames = {
@@ -31176,7 +31181,7 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
31176
31181
  onItemDragEnd = _ref.onItemDragEnd,
31177
31182
  onItemDragStart = _ref.onItemDragStart,
31178
31183
  onItemPlaceDrop = _ref.onItemPlaceDrop,
31179
- _onOutsideDrop = _ref.onOutsideDrop,
31184
+ onOutsideDrop = _ref.onOutsideDrop,
31180
31185
  checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
31181
31186
  initialPosition = _ref.initialPosition,
31182
31187
  checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
@@ -31241,12 +31246,49 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
31241
31246
  }
31242
31247
  onDragEndScrollingEvents();
31243
31248
  }, [onItemDragEnd, onDragEndScrollingEvents]);
31244
- // Memoize handleSetShortcut to prevent unnecessary re-renders
31245
- var memoizedHandleSetShortcut = React.useCallback(function (item, index) {
31246
- handleSetShortcut(item, index);
31247
- }, [handleSetShortcut]);
31248
- // Memoize onRenderSlots to prevent re-creating the slots array on every render
31249
- var onRenderSlots = React.useMemo(function () {
31249
+ var handleItemClick = React.useCallback(function (itemType, containerType, item) {
31250
+ if (settingShortcutIndex !== -1) {
31251
+ setSettingShortcutIndex(-1);
31252
+ handleSetShortcut(item, settingShortcutIndex);
31253
+ } else if (onItemClick) {
31254
+ onItemClick(item, itemType, containerType);
31255
+ }
31256
+ }, [settingShortcutIndex, handleSetShortcut, onItemClick]);
31257
+ var handlePlaceDrop = React.useCallback(function (item, slotIndex, itemContainerType) {
31258
+ if (onItemPlaceDrop) {
31259
+ onItemPlaceDrop(item, slotIndex, itemContainerType);
31260
+ }
31261
+ onDragEndScrollingEvents();
31262
+ }, [onItemPlaceDrop, onDragEndScrollingEvents]);
31263
+ var handleOutsideDrop = React.useCallback(function (item, position) {
31264
+ if (onOutsideDrop) {
31265
+ onOutsideDrop(item, position);
31266
+ }
31267
+ onDragEndScrollingEvents();
31268
+ }, [onOutsideDrop, onDragEndScrollingEvents]);
31269
+ var handleQuantitySelect = React.useCallback(function (maxQuantity, callback) {
31270
+ setQuantitySelect({
31271
+ isOpen: true,
31272
+ maxQuantity: maxQuantity,
31273
+ callback: callback
31274
+ });
31275
+ }, []);
31276
+ // Memoize slot rendering configuration
31277
+ var slotConfig = React.useMemo(function () {
31278
+ return {
31279
+ type: type,
31280
+ atlasIMG: atlasIMG,
31281
+ atlasJSON: atlasJSON,
31282
+ scale: scale,
31283
+ equipmentSet: equipmentSet,
31284
+ isDepotSystem: isDepotSystem,
31285
+ isSelectingShortcut: settingShortcutIndex !== -1,
31286
+ checkIfItemCanBeMoved: checkIfItemCanBeMoved,
31287
+ checkIfItemShouldDragEnd: checkIfItemShouldDragEnd
31288
+ };
31289
+ }, [type, atlasIMG, atlasJSON, scale, equipmentSet, isDepotSystem, settingShortcutIndex, checkIfItemCanBeMoved, checkIfItemShouldDragEnd]);
31290
+ // Memoize slots rendering
31291
+ var renderSlots = React.useMemo(function () {
31250
31292
  var slots = [];
31251
31293
  for (var i = 0; i < itemContainer.slotQty; i++) {
31252
31294
  var _itemContainer$slots;
@@ -31255,55 +31297,27 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
31255
31297
  key: i,
31256
31298
  slotIndex: i,
31257
31299
  item: currentItem,
31258
- itemContainerType: type,
31259
- onMouseOver: onMouseOver ? function (event, slotIndex, item) {
31260
- return onMouseOver(event, slotIndex, item);
31261
- } : undefined,
31262
- onMouseOut: undefined,
31263
- onPointerDown: function onPointerDown(itemType, containerType, item) {
31264
- if (settingShortcutIndex !== -1) {
31265
- setSettingShortcutIndex(-1);
31266
- memoizedHandleSetShortcut(item, settingShortcutIndex);
31267
- } else if (onItemClick) {
31268
- onItemClick(item, itemType, containerType);
31269
- }
31270
- },
31300
+ itemContainerType: slotConfig.type,
31301
+ onMouseOver: onMouseOver,
31302
+ onPointerDown: handleItemClick,
31271
31303
  onDragStart: onDragStartHandler,
31272
31304
  onDragEnd: onDragEndHandler,
31273
- dragScale: scale,
31274
- checkIfItemCanBeMoved: checkIfItemCanBeMoved,
31275
- checkIfItemShouldDragEnd: checkIfItemShouldDragEnd,
31276
- openQuantitySelector: function openQuantitySelector(maxQuantity, callback) {
31277
- setQuantitySelect({
31278
- isOpen: true,
31279
- maxQuantity: maxQuantity,
31280
- callback: callback
31281
- });
31282
- },
31283
- onPlaceDrop: function onPlaceDrop(item, slotIndex, itemContainerType) {
31284
- if (onItemPlaceDrop) {
31285
- onItemPlaceDrop(item, slotIndex, itemContainerType);
31286
- }
31287
- console.log('PLACE DROP');
31288
- onDragEndScrollingEvents();
31289
- },
31290
- onOutsideDrop: function onOutsideDrop(item, position) {
31291
- if (_onOutsideDrop) {
31292
- _onOutsideDrop(item, position);
31293
- }
31294
- console.log('OUTSIDE DROP');
31295
- onDragEndScrollingEvents();
31296
- },
31297
- atlasIMG: atlasIMG,
31298
- atlasJSON: atlasJSON,
31299
- isSelectingShortcut: settingShortcutIndex !== -1,
31300
- equipmentSet: equipmentSet,
31301
- setItemShortcut: type === shared.ItemContainerType.Inventory ? memoizedHandleSetShortcut : undefined,
31302
- isDepotSystem: isDepotSystem
31305
+ dragScale: slotConfig.scale,
31306
+ checkIfItemCanBeMoved: slotConfig.checkIfItemCanBeMoved,
31307
+ checkIfItemShouldDragEnd: slotConfig.checkIfItemShouldDragEnd,
31308
+ openQuantitySelector: handleQuantitySelect,
31309
+ onPlaceDrop: handlePlaceDrop,
31310
+ onOutsideDrop: handleOutsideDrop,
31311
+ atlasIMG: slotConfig.atlasIMG,
31312
+ atlasJSON: slotConfig.atlasJSON,
31313
+ isSelectingShortcut: slotConfig.isSelectingShortcut,
31314
+ equipmentSet: slotConfig.equipmentSet,
31315
+ setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
31316
+ isDepotSystem: slotConfig.isDepotSystem
31303
31317
  }));
31304
31318
  }
31305
31319
  return slots;
31306
- }, [itemContainer.slotQty, itemContainer.slots, type, onMouseOver, settingShortcutIndex, memoizedHandleSetShortcut, onItemClick, onDragStartHandler, onDragEndHandler, scale, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, onItemPlaceDrop, _onOutsideDrop, atlasIMG, atlasJSON, equipmentSet, isDepotSystem, onDragEndScrollingEvents]);
31320
+ }, [itemContainer.slotQty, itemContainer.slots, slotConfig, onMouseOver, handleItemClick, onDragStartHandler, onDragEndHandler, handleQuantitySelect, handlePlaceDrop, handleOutsideDrop, handleSetShortcut, type]);
31307
31321
  return React__default.createElement(ItemSlotDraggingProvider, null, React__default.createElement(ItemSlotDetailsProvider, null, React__default.createElement(DraggedItem, {
31308
31322
  atlasIMG: atlasIMG,
31309
31323
  atlasJSON: atlasJSON,
@@ -31329,7 +31343,7 @@ var ItemContainer$1 = /*#__PURE__*/React__default.memo(function (_ref) {
31329
31343
  ref: containerRef,
31330
31344
  isScrollable: itemContainer.slotQty > MIN_SLOTS_FOR_SCROLL,
31331
31345
  isFullScreen: isFullScreen
31332
- }, onRenderSlots)), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
31346
+ }, renderSlots)), quantitySelect.isOpen && React__default.createElement(ItemQuantitySelectorModal, {
31333
31347
  quantitySelect: quantitySelect,
31334
31348
  setQuantitySelect: setQuantitySelect
31335
31349
  }), React__default.createElement(ItemSlotToolTips, {