@rpg-engine/long-bow 0.7.70 → 0.7.72

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.
Files changed (25) hide show
  1. package/dist/components/Item/Inventory/ItemSlot.d.ts +5 -18
  2. package/dist/components/Item/Inventory/ItemSlotTooltips.d.ts +12 -1
  3. package/dist/components/Item/Inventory/context/DraggingContext.d.ts +11 -0
  4. package/dist/hooks/useCursorPosition.d.ts +1 -1
  5. package/dist/long-bow.cjs.development.js +573 -661
  6. package/dist/long-bow.cjs.development.js.map +1 -1
  7. package/dist/long-bow.cjs.production.min.js +1 -1
  8. package/dist/long-bow.cjs.production.min.js.map +1 -1
  9. package/dist/long-bow.esm.js +575 -663
  10. package/dist/long-bow.esm.js.map +1 -1
  11. package/package.json +2 -3
  12. package/src/components/Equipment/EquipmentSet.tsx +29 -61
  13. package/src/components/Item/Inventory/DraggedItem.tsx +2 -2
  14. package/src/components/Item/Inventory/ItemContainer.tsx +44 -68
  15. package/src/components/Item/Inventory/ItemSlot.tsx +451 -239
  16. package/src/components/Item/Inventory/ItemSlotTooltips.tsx +46 -48
  17. package/src/components/Item/Inventory/context/DraggingContext.tsx +26 -0
  18. package/src/hooks/useCursorPosition.ts +20 -29
  19. package/src/stories/UI/containers/ItemContainer.stories.tsx +3 -30
  20. package/dist/components/Item/Inventory/context/ItemSlotDraggingContext.d.ts +0 -26
  21. package/dist/components/Item/Inventory/context/ItemSlotTooltipContext.d.ts +0 -28
  22. package/dist/components/Item/Inventory/hooks/useItemSlotDragAndDrop.d.ts +0 -39
  23. package/src/components/Item/Inventory/context/ItemSlotDraggingContext.tsx +0 -52
  24. package/src/components/Item/Inventory/context/ItemSlotTooltipContext.tsx +0 -95
  25. package/src/components/Item/Inventory/hooks/useItemSlotDragAndDrop.ts +0 -248
@@ -1,4 +1,4 @@
1
- import { IItem, IItemContainer, ItemContainerType, ItemSlotType, ItemType } from '@rpg-engine/shared';
1
+ import { IEquipmentSet, IItem, IItemContainer, ItemContainerType, ItemSlotType, ItemType } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  import { IPosition } from '../../../types/eventTypes';
4
4
  export declare const EquipmentSlotSpriteByType: any;
@@ -8,6 +8,7 @@ interface IProps {
8
8
  itemContainer?: IItemContainer | null;
9
9
  itemContainerType?: ItemContainerType | null;
10
10
  slotSpriteMask?: ItemSlotType | null;
11
+ onSelected?: (selectedOption: string, item: IItem) => void;
11
12
  onMouseOver?: (event: any, slotIndex: number, item: IItem | null, x: number, y: number) => void;
12
13
  onMouseOut?: () => void;
13
14
  onPointerDown: (ItemType: ItemType, itemContainerType: ItemContainerType | null, item: IItem) => void;
@@ -16,30 +17,16 @@ interface IProps {
16
17
  onOutsideDrop?: (item: IItem, position: IPosition) => void;
17
18
  dragScale?: number;
18
19
  checkIfItemCanBeMoved?: () => boolean;
20
+ checkIfItemShouldDragEnd?: () => boolean;
19
21
  openQuantitySelector?: (maxQuantity: number, callback: () => void) => void;
20
22
  onPlaceDrop?: (item: IItem | null, slotIndex: number, itemContainerType: ItemContainerType | null) => void;
21
23
  atlasJSON: any;
22
24
  atlasIMG: any;
23
25
  isContextMenuDisabled?: boolean;
24
26
  isSelectingShortcut?: boolean;
27
+ equipmentSet?: IEquipmentSet | null;
25
28
  setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
26
29
  isDepotSystem?: boolean;
27
30
  }
28
- export declare type TooltipState = {
29
- visible: boolean;
30
- mobileVisible: boolean;
31
- };
32
- export declare type ContextMenuState = {
33
- position: IPosition;
34
- visible: boolean;
35
- };
36
- export declare type DragState = {
37
- isFocused: boolean;
38
- wasDragged: boolean;
39
- position: IPosition;
40
- dropPosition: IPosition | null;
41
- };
42
- export declare const ItemSlot: React.MemoExoticComponent<(({ slotIndex, item, itemContainerType: containerType, slotSpriteMask, onMouseOver, onMouseOut, onPointerDown, atlasJSON, atlasIMG, isContextMenuDisabled, onDragEnd, onDragStart, onPlaceDrop, onOutsideDrop: onDrop, checkIfItemCanBeMoved, openQuantitySelector, dragScale, isSelectingShortcut, setItemShortcut, isDepotSystem, }: IProps) => JSX.Element) & {
43
- displayName: string;
44
- }>;
31
+ export declare const ItemSlot: React.FC<IProps>;
45
32
  export {};
@@ -1,13 +1,24 @@
1
1
  /// <reference types="react" />
2
2
  import { IEquipmentSet, IItem } from '@rpg-engine/shared';
3
+ import { IPosition } from '../../../types/eventTypes';
4
+ import { IContextMenuItem } from './itemContainerHelper';
3
5
  interface IProps {
6
+ isTooltipVisible: boolean;
4
7
  isFocused: boolean;
8
+ isContextMenuVisible: boolean;
5
9
  isContextMenuDisabled: boolean;
10
+ item: IItem | null;
11
+ isTooltipMobileVisible: boolean;
12
+ contextActions: IContextMenuItem[];
13
+ contextMenuPosition: IPosition;
6
14
  dragScale: number | undefined;
15
+ setIsContextMenuVisible: (visible: boolean) => void;
16
+ setIsTooltipMobileVisible: (visible: boolean) => void;
17
+ setIsTooltipVisible: (visible: boolean) => void;
7
18
  onSelected?: (optionId: string, item: IItem) => void;
8
19
  atlasIMG: any;
9
20
  atlasJSON: any;
10
21
  equipmentSet?: IEquipmentSet | null;
11
22
  }
12
- export declare const ItemSlotToolTips: ({ isFocused, isContextMenuDisabled, dragScale, onSelected, atlasIMG, atlasJSON, equipmentSet, }: IProps) => JSX.Element;
23
+ export declare const ItemSlotToolTips: ({ isTooltipVisible, isFocused, isContextMenuVisible, isContextMenuDisabled, item, contextActions, contextMenuPosition, dragScale, setIsContextMenuVisible, setIsTooltipMobileVisible, isTooltipMobileVisible, onSelected, atlasIMG, atlasJSON, equipmentSet, }: IProps) => JSX.Element;
13
24
  export {};
@@ -0,0 +1,11 @@
1
+ import { IItem } from '@rpg-engine/shared';
2
+ import React from 'react';
3
+ export declare const useDragging: () => {
4
+ item: IItem | null;
5
+ setDraggingItem: React.Dispatch<React.SetStateAction<IItem | null>>;
6
+ };
7
+ interface IProps {
8
+ children: React.ReactNode;
9
+ }
10
+ export declare const DraggingProvider: ({ children }: IProps) => JSX.Element;
11
+ export {};
@@ -2,5 +2,5 @@ import { IPosition } from '../types/eventTypes';
2
2
  interface ICursorPositionProps {
3
3
  scale?: number;
4
4
  }
5
- export declare const useCursorPosition: ({ scale, }: ICursorPositionProps) => IPosition;
5
+ export declare const useCursorPosition: ({ scale }: ICursorPositionProps) => IPosition;
6
6
  export {};