@rpg-engine/long-bow 0.7.68 → 0.7.70
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/components/Item/Inventory/ItemSlot.d.ts +2 -4
- package/dist/components/Item/Inventory/ItemSlotTooltips.d.ts +2 -10
- package/dist/components/Item/Inventory/context/{DraggingContext.d.ts → ItemSlotDraggingContext.d.ts} +6 -6
- package/dist/components/Item/Inventory/context/ItemSlotTooltipContext.d.ts +28 -0
- package/dist/components/Item/Inventory/hooks/useItemSlotDragAndDrop.d.ts +2 -6
- package/dist/hooks/useCursorPosition.d.ts +1 -1
- package/dist/long-bow.cjs.development.js +433 -365
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +435 -367
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Equipment/EquipmentSet.tsx +61 -29
- package/src/components/Item/Inventory/DraggedItem.tsx +2 -2
- package/src/components/Item/Inventory/ItemContainer.tsx +68 -44
- package/src/components/Item/Inventory/ItemSlot.tsx +46 -65
- package/src/components/Item/Inventory/ItemSlotTooltips.tsx +48 -42
- package/src/components/Item/Inventory/context/{DraggingContext.tsx → ItemSlotDraggingContext.tsx} +10 -10
- package/src/components/Item/Inventory/context/ItemSlotTooltipContext.tsx +95 -0
- package/src/components/Item/Inventory/hooks/useItemSlotDragAndDrop.ts +50 -30
- package/src/hooks/useCursorPosition.ts +29 -20
- package/src/mocks/skills.mocks.ts +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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,7 +8,6 @@ interface IProps {
|
|
|
8
8
|
itemContainer?: IItemContainer | null;
|
|
9
9
|
itemContainerType?: ItemContainerType | null;
|
|
10
10
|
slotSpriteMask?: ItemSlotType | null;
|
|
11
|
-
onSelected?: (selectedOption: string, item: IItem) => void;
|
|
12
11
|
onMouseOver?: (event: any, slotIndex: number, item: IItem | null, x: number, y: number) => void;
|
|
13
12
|
onMouseOut?: () => void;
|
|
14
13
|
onPointerDown: (ItemType: ItemType, itemContainerType: ItemContainerType | null, item: IItem) => void;
|
|
@@ -23,7 +22,6 @@ interface IProps {
|
|
|
23
22
|
atlasIMG: any;
|
|
24
23
|
isContextMenuDisabled?: boolean;
|
|
25
24
|
isSelectingShortcut?: boolean;
|
|
26
|
-
equipmentSet?: IEquipmentSet | null;
|
|
27
25
|
setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
|
|
28
26
|
isDepotSystem?: boolean;
|
|
29
27
|
}
|
|
@@ -41,7 +39,7 @@ export declare type DragState = {
|
|
|
41
39
|
position: IPosition;
|
|
42
40
|
dropPosition: IPosition | null;
|
|
43
41
|
};
|
|
44
|
-
export declare const ItemSlot: React.MemoExoticComponent<(({ slotIndex, item, itemContainerType: containerType, slotSpriteMask, onMouseOver, onMouseOut, onPointerDown,
|
|
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) & {
|
|
45
43
|
displayName: string;
|
|
46
44
|
}>;
|
|
47
45
|
export {};
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { IEquipmentSet, IItem } from '@rpg-engine/shared';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { IContextMenuItem } from './itemContainerHelper';
|
|
4
|
-
import type { ContextMenuState, TooltipState } from './ItemSlot';
|
|
5
3
|
interface IProps {
|
|
6
|
-
tooltipState: TooltipState;
|
|
7
|
-
setTooltipState: React.Dispatch<React.SetStateAction<TooltipState>>;
|
|
8
|
-
contextMenuState: ContextMenuState;
|
|
9
|
-
setContextMenuState: React.Dispatch<React.SetStateAction<ContextMenuState>>;
|
|
10
4
|
isFocused: boolean;
|
|
11
5
|
isContextMenuDisabled: boolean;
|
|
12
|
-
item: IItem | null;
|
|
13
|
-
contextActions: IContextMenuItem[];
|
|
14
6
|
dragScale: number | undefined;
|
|
15
7
|
onSelected?: (optionId: string, item: IItem) => void;
|
|
16
8
|
atlasIMG: any;
|
|
17
9
|
atlasJSON: any;
|
|
18
10
|
equipmentSet?: IEquipmentSet | null;
|
|
19
11
|
}
|
|
20
|
-
export declare const ItemSlotToolTips: ({
|
|
12
|
+
export declare const ItemSlotToolTips: ({ isFocused, isContextMenuDisabled, dragScale, onSelected, atlasIMG, atlasJSON, equipmentSet, }: IProps) => JSX.Element;
|
|
21
13
|
export {};
|
package/dist/components/Item/Inventory/context/{DraggingContext.d.ts → ItemSlotDraggingContext.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IItem } from '@rpg-engine/shared';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export interface
|
|
3
|
+
export interface IDragState {
|
|
4
4
|
isFocused: boolean;
|
|
5
5
|
wasDragged: boolean;
|
|
6
6
|
position: {
|
|
@@ -12,15 +12,15 @@ export interface DragState {
|
|
|
12
12
|
y: number;
|
|
13
13
|
} | null;
|
|
14
14
|
}
|
|
15
|
-
interface
|
|
15
|
+
interface IDraggingContextType {
|
|
16
16
|
item: IItem | null;
|
|
17
17
|
setDraggingItem: React.Dispatch<React.SetStateAction<IItem | null>>;
|
|
18
|
-
dragState:
|
|
19
|
-
setDragState: React.Dispatch<React.SetStateAction<
|
|
18
|
+
dragState: IDragState;
|
|
19
|
+
setDragState: React.Dispatch<React.SetStateAction<IDragState>>;
|
|
20
20
|
}
|
|
21
21
|
interface IProps {
|
|
22
22
|
children: React.ReactNode;
|
|
23
23
|
}
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
24
|
+
export declare const ItemSlotDraggingProvider: ({ children }: IProps) => JSX.Element;
|
|
25
|
+
export declare const useItemSlotDragging: () => IDraggingContextType;
|
|
26
26
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IItem } from '@rpg-engine/shared';
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { IPosition } from '../../../../types/eventTypes';
|
|
4
|
+
import { IContextMenuItem } from '../itemContainerHelper';
|
|
5
|
+
interface TooltipState {
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
mobileVisible?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ContextMenuState {
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
position?: IPosition;
|
|
12
|
+
actions?: IContextMenuItem[];
|
|
13
|
+
}
|
|
14
|
+
interface ItemDetails {
|
|
15
|
+
item?: IItem | null;
|
|
16
|
+
tooltip?: TooltipState;
|
|
17
|
+
contextMenu?: ContextMenuState;
|
|
18
|
+
}
|
|
19
|
+
interface ItemSlotTooltipContextProps {
|
|
20
|
+
itemDetails: ItemDetails;
|
|
21
|
+
updateItemDetails: (updates: Partial<ItemDetails>) => void;
|
|
22
|
+
clearItemDetails: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const ItemSlotTooltipProvider: FC<{
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const useItemSlotTooltip: () => ItemSlotTooltipContextProps;
|
|
28
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IItem, ItemContainerType, ItemType } from '@rpg-engine/shared';
|
|
3
3
|
import { DraggableEventHandler } from 'react-draggable';
|
|
4
|
-
import { ContextMenuState, TooltipState } from '../ItemSlot';
|
|
5
4
|
interface IUseItemSlotDragAndDrop {
|
|
6
5
|
isDepotSystem: boolean;
|
|
7
6
|
item: IItem;
|
|
@@ -20,13 +19,10 @@ interface IUseItemSlotDragAndDrop {
|
|
|
20
19
|
slotIndex: number;
|
|
21
20
|
openQuantitySelector: (quantity: number, onSuccess: (quantity?: number) => void) => void;
|
|
22
21
|
isContextMenuDisabled: boolean;
|
|
23
|
-
setTooltipState: React.Dispatch<React.SetStateAction<TooltipState>>;
|
|
24
|
-
setContextMenuState: React.Dispatch<React.SetStateAction<ContextMenuState>>;
|
|
25
|
-
contextMenuState: ContextMenuState;
|
|
26
22
|
}
|
|
27
|
-
export declare const useItemSlotDragAndDrop: ({ isDepotSystem, item, onDrop, onDragEnd, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, setItemShortcut, isSelectingShortcut, onDragStart, onPointerDown, containerType, slotIndex, openQuantitySelector, isContextMenuDisabled,
|
|
23
|
+
export declare const useItemSlotDragAndDrop: ({ isDepotSystem, item, onDrop, onDragEnd, checkIfItemCanBeMoved, checkIfItemShouldDragEnd, setItemShortcut, isSelectingShortcut, onDragStart, onPointerDown, containerType, slotIndex, openQuantitySelector, isContextMenuDisabled, }: IUseItemSlotDragAndDrop) => {
|
|
28
24
|
dragContainer: import("react").RefObject<HTMLDivElement>;
|
|
29
|
-
dragState: import("../context/
|
|
25
|
+
dragState: import("../context/ItemSlotDraggingContext").IDragState;
|
|
30
26
|
draggingItem: IItem | null;
|
|
31
27
|
setDraggingItem: import("react").Dispatch<import("react").SetStateAction<IItem | null>>;
|
|
32
28
|
getContainerBounds: () => {
|
|
@@ -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 {};
|