@eveshipfit/ui-ingame 1.0.0
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/LICENSE +19 -0
- package/README.md +33 -0
- package/dist/index.d.mts +132 -0
- package/dist/index.mjs +1004 -0
- package/dist/style.css +313 -0
- package/dist/theme.css +23 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2023 EVEShipFit Team
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @eveshipfit/ui-ingame
|
|
2
|
+
|
|
3
|
+
React components for EVE Online ship fitting that look like the in-game UI.
|
|
4
|
+
|
|
5
|
+
Part of [EVEShip.fit](https://eveship.fit).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @eveshipfit/ui-ingame @eveshipfit/images react react-dom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Load the theme once, then use the components:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import "@eveshipfit/ui-ingame/theme.css";
|
|
19
|
+
import { TreeLeaf, TreeList } from "@eveshipfit/ui-ingame";
|
|
20
|
+
|
|
21
|
+
<TreeList label="Ships">
|
|
22
|
+
<TreeLeaf label="Rifter" typeId={587} onActivate={() => console.log("Rifter")} />
|
|
23
|
+
</TreeList>;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Every colour and size is a CSS variable in `theme.css`; override them, or load your own theme instead.
|
|
27
|
+
|
|
28
|
+
Icons are drawn from `@eveshipfit/images`: put the components inside an `ImagesProvider` of
|
|
29
|
+
`@eveshipfit/react-hooks`.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { DragEvent, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/primitives/Dialog/Dialog.d.ts
|
|
3
|
+
interface DialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
title: string;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** A modal; `onClose` is called when the user closes it, by Escape or the close button. */
|
|
10
|
+
export declare function Dialog({ open, title, onClose, children }: DialogProps): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/primitives/TreeList/TreeList.d.ts
|
|
13
|
+
interface TreeListProps {
|
|
14
|
+
label: string;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare function TreeList({ label, children }: TreeListProps): import("react").JSX.Element;
|
|
18
|
+
interface TreeGroupProps {
|
|
19
|
+
label: ReactNode;
|
|
20
|
+
defaultOpen?: boolean;
|
|
21
|
+
/** Only called while the group is open, so large trees stay cheap. */
|
|
22
|
+
children: () => ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export declare function TreeGroup({ label, defaultOpen, children }: TreeGroupProps): import("react").JSX.Element;
|
|
25
|
+
interface TreeLeafProps {
|
|
26
|
+
label: ReactNode;
|
|
27
|
+
/** Shows the type's icon in front of the label. */
|
|
28
|
+
typeId?: number;
|
|
29
|
+
title?: string;
|
|
30
|
+
onActivate?: () => void;
|
|
31
|
+
onHover?: (hovering: boolean) => void;
|
|
32
|
+
onDragStart?: (event: DragEvent) => void;
|
|
33
|
+
onDragEnd?: () => void;
|
|
34
|
+
/** Shown at the end of the row, like a count or an action. */
|
|
35
|
+
after?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/** Activates on double click, as EVE's own lists do; single clicks are for selecting text and dragging. */
|
|
38
|
+
export declare function TreeLeaf({ label, typeId, title, onActivate, onHover, onDragStart, onDragEnd, after }: TreeLeafProps): import("react").JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/primitives/Icon/Icon.d.ts
|
|
41
|
+
declare const textures: {
|
|
42
|
+
"hardpoint-turret": string;
|
|
43
|
+
"hardpoint-launcher": string;
|
|
44
|
+
"slot-high": string;
|
|
45
|
+
"slot-medium": string;
|
|
46
|
+
"slot-low": string;
|
|
47
|
+
"slot-rig": string;
|
|
48
|
+
"slot-subsystem": string;
|
|
49
|
+
};
|
|
50
|
+
type IconName = keyof typeof textures;
|
|
51
|
+
export declare const iconNames: IconName[];
|
|
52
|
+
interface IconProps {
|
|
53
|
+
name: IconName;
|
|
54
|
+
size?: number;
|
|
55
|
+
}
|
|
56
|
+
export declare function Icon({ name, size }: IconProps): import("react").JSX.Element;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/primitives/TypeIcon/TypeIcon.d.ts
|
|
59
|
+
interface TypeIconProps {
|
|
60
|
+
typeId: number;
|
|
61
|
+
size?: number;
|
|
62
|
+
/** The tech level or faction marker. */
|
|
63
|
+
marker?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare function TypeIcon({ typeId, size, marker }: TypeIconProps): import("react").JSX.Element;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/primitives/Wheel/layout.d.ts
|
|
68
|
+
type WheelRack = "high" | "medium" | "low" | "rig" | "subsystem";
|
|
69
|
+
export declare function rackSize(rack: WheelRack): number;
|
|
70
|
+
export declare function slotAngle(rack: WheelRack, index: number): number;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/primitives/Wheel/Wheel.d.ts
|
|
73
|
+
interface WheelProps {
|
|
74
|
+
label: string;
|
|
75
|
+
children?: ReactNode;
|
|
76
|
+
}
|
|
77
|
+
/** Square, and as wide as `--esf-wheel-size`. */
|
|
78
|
+
export declare function Wheel({ label, children }: WheelProps): import("react").JSX.Element;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/primitives/Wheel/WheelRackMarker.d.ts
|
|
81
|
+
type MarkedRack = Extract<WheelRack, "high" | "medium" | "low">;
|
|
82
|
+
interface WheelRackMarkerProps {
|
|
83
|
+
rack: MarkedRack;
|
|
84
|
+
}
|
|
85
|
+
export declare function WheelRackMarker({ rack }: WheelRackMarkerProps): import("react").JSX.Element;
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/primitives/Wheel/WheelSlot.d.ts
|
|
88
|
+
type SlotState = "offline" | "online" | "active" | "overload";
|
|
89
|
+
interface WheelSlotProps extends HTMLAttributes<HTMLDivElement> {
|
|
90
|
+
rack: WheelRack;
|
|
91
|
+
/** In degrees clockwise from the top. */
|
|
92
|
+
angle: number;
|
|
93
|
+
typeId?: number;
|
|
94
|
+
chargeTypeId?: number;
|
|
95
|
+
chargeable?: boolean;
|
|
96
|
+
state?: SlotState;
|
|
97
|
+
activatable?: boolean;
|
|
98
|
+
/** False for a slot the ship does not have. */
|
|
99
|
+
available?: boolean;
|
|
100
|
+
/** Shown, but not fitted yet. */
|
|
101
|
+
preview?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export declare function WheelSlot({ rack, angle, typeId, chargeTypeId, chargeable, state, activatable, available, preview, className, style, ...props }: WheelSlotProps): import("react").JSX.Element;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/primitives/Wheel/WheelHardpoints.d.ts
|
|
106
|
+
interface Hardpoints {
|
|
107
|
+
used: number;
|
|
108
|
+
total: number;
|
|
109
|
+
}
|
|
110
|
+
interface WheelHardpointsProps {
|
|
111
|
+
turrets: Hardpoints;
|
|
112
|
+
launchers: Hardpoints;
|
|
113
|
+
}
|
|
114
|
+
export declare function WheelHardpoints({ turrets, launchers }: WheelHardpointsProps): import("react").JSX.Element;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/primitives/Wheel/WheelGauge.d.ts
|
|
117
|
+
type WheelResource = "cpu" | "powergrid" | "calibration";
|
|
118
|
+
interface WheelGaugeProps {
|
|
119
|
+
resource: WheelResource;
|
|
120
|
+
used: number;
|
|
121
|
+
total: number;
|
|
122
|
+
valueText?: string;
|
|
123
|
+
}
|
|
124
|
+
export declare function WheelGauge({ resource, used, total, valueText }: WheelGaugeProps): import("react").JSX.Element;
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/primitives/Wheel/WheelHull.d.ts
|
|
127
|
+
interface WheelHullProps {
|
|
128
|
+
typeId: number;
|
|
129
|
+
}
|
|
130
|
+
export declare function WheelHull({ typeId }: WheelHullProps): import("react").JSX.Element;
|
|
131
|
+
//#endregion
|
|
132
|
+
export type { DialogProps, Hardpoints, IconName, IconProps, MarkedRack, SlotState, TreeGroupProps, TreeLeafProps, TreeListProps, TypeIconProps, WheelGaugeProps, WheelHardpointsProps, WheelHullProps, WheelProps, WheelRack, WheelRackMarkerProps, WheelResource, WheelSlotProps };
|