@eveshipfit/ui-ingame 1.0.0 → 1.2.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/README.md CHANGED
@@ -23,10 +23,16 @@ import { TreeLeaf, TreeList } from "@eveshipfit/ui-ingame";
23
23
  </TreeList>;
24
24
  ```
25
25
 
26
- Every colour and size is a CSS variable in `theme.css`; override them, or load your own theme instead.
26
+ Every colour and size is a CSS variable in `theme.css`; override them, or load your own theme instead. `--esf-scale` is
27
+ EVE's UI scale, `1` for 100%; the `FittingWindow`, `FittingWheel`, `ItemBrowser`, `ShipStatistics` and `HistoryBar` are
28
+ as big as EVE's at that scale.
29
+
30
+ Give the `FittingWindow` its browser and statistics to get the buttons that slide them out:
31
+ `<FittingWindow browser={<ItemBrowser />} statistics={<ShipStatistics />} />`.
27
32
 
28
33
  Icons are drawn from `@eveshipfit/images`: put the components inside an `ImagesProvider` of
29
- `@eveshipfit/react-hooks`.
34
+ `@eveshipfit/react-hooks`. The tooltips of `ShipStatistics` come from `texts.dat` of `@eveshipfit/sde`: put it inside a
35
+ `TextsProvider` too.
30
36
 
31
37
  ## License
32
38
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { DragEvent, HTMLAttributes, ReactNode } from "react";
1
+ import { DragEvent, DragEventHandler, HTMLAttributes, MouseEventHandler, ReactNode } from "react";
2
2
  //#region src/primitives/Dialog/Dialog.d.ts
3
3
  interface DialogProps {
4
4
  open: boolean;
@@ -17,11 +17,19 @@ interface TreeListProps {
17
17
  export declare function TreeList({ label, children }: TreeListProps): import("react").JSX.Element;
18
18
  interface TreeGroupProps {
19
19
  label: ReactNode;
20
+ /** Shows the type's icon in front of the label. */
21
+ typeId?: number;
22
+ /** The URL of a small image in front of the label, like a market group's icon. */
23
+ icon?: string;
24
+ /** A second line under the label. */
25
+ description?: ReactNode;
20
26
  defaultOpen?: boolean;
27
+ /** Shown at the end of the row, like a count or an action. */
28
+ after?: ReactNode;
21
29
  /** Only called while the group is open, so large trees stay cheap. */
22
30
  children: () => ReactNode;
23
31
  }
24
- export declare function TreeGroup({ label, defaultOpen, children }: TreeGroupProps): import("react").JSX.Element;
32
+ export declare function TreeGroup({ label, typeId, icon, description, defaultOpen, after, children }: TreeGroupProps): import("react").JSX.Element;
25
33
  interface TreeLeafProps {
26
34
  label: ReactNode;
27
35
  /** Shows the type's icon in front of the label. */
@@ -46,6 +54,67 @@ declare const textures: {
46
54
  "slot-low": string;
47
55
  "slot-rig": string;
48
56
  "slot-subsystem": string;
57
+ "module-unfit": string;
58
+ "module-power": string;
59
+ "module-info": string;
60
+ link: string;
61
+ search: string;
62
+ collapse: string;
63
+ checkmark: string;
64
+ close: string;
65
+ folder: string;
66
+ "fits-browser": string;
67
+ "fits-personal": string;
68
+ "fits-corporation": string;
69
+ "fits-alliance": string;
70
+ "fits-community": string;
71
+ "fits-alliance-small": string;
72
+ "fits-community-small": string;
73
+ "current-hull": string;
74
+ skills: string;
75
+ "filter-low-slot": string;
76
+ "filter-medium-slot": string;
77
+ "filter-high-slot": string;
78
+ "filter-rig-slot": string;
79
+ "filter-drones": string;
80
+ "filter-hull-restrictions": string;
81
+ "filter-resources": string;
82
+ simulate: string;
83
+ hardware: string;
84
+ statistics: string;
85
+ cargo: string;
86
+ "drone-bay": string;
87
+ "arrow-left": string;
88
+ "arrow-right": string;
89
+ "arrow-down": string;
90
+ "arrow-up": string;
91
+ price: string;
92
+ "stat-turret-dps": string;
93
+ "stat-alpha-strike": string;
94
+ "stat-shield-hp": string;
95
+ "stat-armor-hp": string;
96
+ "stat-structure-hp": string;
97
+ "stat-em-resistance": string;
98
+ "stat-thermal-resistance": string;
99
+ "stat-kinetic-resistance": string;
100
+ "stat-explosive-resistance": string;
101
+ "stat-armor-repair-rate": string;
102
+ "stat-hull-repair-rate": string;
103
+ "stat-passive-shield-recharge": string;
104
+ "stat-shield-boost-rate": string;
105
+ "stat-sensor-amarr": string;
106
+ "stat-sensor-caldari": string;
107
+ "stat-sensor-gallente": string;
108
+ "stat-sensor-minmatar": string;
109
+ "stat-scan-resolution": string;
110
+ "stat-signature-radius": string;
111
+ "stat-locked-targets": string;
112
+ "stat-mass": string;
113
+ "stat-inertia": string;
114
+ "stat-warp-speed": string;
115
+ "stat-align-time": string;
116
+ "stat-drone-bandwidth": string;
117
+ "stat-drone-control-range": string;
49
118
  };
50
119
  type IconName = keyof typeof textures;
51
120
  export declare const iconNames: IconName[];
@@ -61,8 +130,55 @@ interface TypeIconProps {
61
130
  size?: number;
62
131
  /** The tech level or faction marker. */
63
132
  marker?: boolean;
133
+ loading?: "lazy" | "eager";
134
+ }
135
+ export declare function TypeIcon({ typeId, size, marker, loading }: TypeIconProps): import("react").JSX.Element;
136
+ //#endregion
137
+ //#region src/primitives/FilterToggle/FilterToggle.d.ts
138
+ type FilterToggleProps = ({
139
+ icon: IconName;
140
+ typeId?: undefined;
141
+ } | {
142
+ icon?: undefined;
143
+ typeId: number;
144
+ }) & {
145
+ label: string;
146
+ pressed?: boolean;
147
+ /** Without it, the filter shows as not implemented yet. */
148
+ onPressedChange?: (pressed: boolean) => void;
149
+ };
150
+ /** One of the icons above EVE's lists that filter them. */
151
+ export declare function FilterToggle({ icon, typeId, label, pressed, onPressedChange }: FilterToggleProps): import("react").JSX.Element;
152
+ //#endregion
153
+ //#region src/primitives/Tooltip/Tooltip.d.ts
154
+ interface TooltipProps {
155
+ label: ReactNode;
156
+ /** One element, which the tooltip points at. */
157
+ children: ReactNode;
158
+ }
159
+ /**
160
+ * Screen readers do not get the tooltip; name `children` itself, like with `aria-label`.
161
+ *
162
+ * Firefox places the tooltip as if `children` had no CSS transform, so do not rotate or scale it, or its parents.
163
+ */
164
+ export declare function Tooltip({ label, children }: TooltipProps): import("react").JSX.Element;
165
+ interface TooltipTextProps {
166
+ title: ReactNode;
167
+ description?: ReactNode;
64
168
  }
65
- export declare function TypeIcon({ typeId, size, marker }: TypeIconProps): import("react").JSX.Element;
169
+ /** A tooltip's `label` with a title; give several to stack them. */
170
+ export declare function TooltipText({ title, description }: TooltipTextProps): import("react").JSX.Element;
171
+ //#endregion
172
+ //#region src/primitives/HistoryBar/HistoryBar.d.ts
173
+ interface HistoryBarProps {
174
+ label: string;
175
+ length: number;
176
+ /** 0 is the oldest. */
177
+ position: number;
178
+ onGoTo: (position: number) => void;
179
+ }
180
+ /** EVE's Simulation History. */
181
+ export declare function HistoryBar({ label, length, position, onGoTo }: HistoryBarProps): import("react").JSX.Element;
66
182
  //#endregion
67
183
  //#region src/primitives/Wheel/layout.d.ts
68
184
  type WheelRack = "high" | "medium" | "low" | "rig" | "subsystem";
@@ -74,7 +190,7 @@ interface WheelProps {
74
190
  label: string;
75
191
  children?: ReactNode;
76
192
  }
77
- /** Square, and as wide as `--esf-wheel-size`. */
193
+ /** Square, and as big as EVE's at `--esf-scale`, or as wide as `--esf-wheel-size`. */
78
194
  export declare function Wheel({ label, children }: WheelProps): import("react").JSX.Element;
79
195
  //#endregion
80
196
  //#region src/primitives/Wheel/WheelRackMarker.d.ts
@@ -91,6 +207,7 @@ interface WheelSlotProps extends HTMLAttributes<HTMLDivElement> {
91
207
  /** In degrees clockwise from the top. */
92
208
  angle: number;
93
209
  typeId?: number;
210
+ typeName?: string;
94
211
  chargeTypeId?: number;
95
212
  chargeable?: boolean;
96
213
  state?: SlotState;
@@ -99,8 +216,17 @@ interface WheelSlotProps extends HTMLAttributes<HTMLDivElement> {
99
216
  available?: boolean;
100
217
  /** Shown, but not fitted yet. */
101
218
  preview?: boolean;
219
+ /** Makes the slot a button, named `label`. */
220
+ onPress?: MouseEventHandler<HTMLElement>;
221
+ /** Makes the slot draggable. */
222
+ onDragStart?: DragEventHandler<HTMLDivElement>;
223
+ onDragEnd?: DragEventHandler<HTMLDivElement>;
224
+ label?: string;
225
+ onUnfit?: () => void;
226
+ onRemoveCharge?: () => void;
227
+ onTogglePower?: () => void;
102
228
  }
103
- export declare function WheelSlot({ rack, angle, typeId, chargeTypeId, chargeable, state, activatable, available, preview, className, style, ...props }: WheelSlotProps): import("react").JSX.Element;
229
+ export declare function WheelSlot({ rack, angle, typeId, typeName, chargeTypeId, chargeable, state, activatable, available, preview, onPress, onDragStart, onDragEnd, label, onUnfit, onRemoveCharge, onTogglePower, className, style, ...props }: WheelSlotProps): import("react").JSX.Element;
104
230
  //#endregion
105
231
  //#region src/primitives/Wheel/WheelHardpoints.d.ts
106
232
  interface Hardpoints {
@@ -129,4 +255,116 @@ interface WheelHullProps {
129
255
  }
130
256
  export declare function WheelHull({ typeId }: WheelHullProps): import("react").JSX.Element;
131
257
  //#endregion
132
- export type { DialogProps, Hardpoints, IconName, IconProps, MarkedRack, SlotState, TreeGroupProps, TreeLeafProps, TreeListProps, TypeIconProps, WheelGaugeProps, WheelHardpointsProps, WheelHullProps, WheelProps, WheelRack, WheelRackMarkerProps, WheelResource, WheelSlotProps };
258
+ //#region src/primitives/Stat/Stat.d.ts
259
+ interface StatProps {
260
+ /** Without one, the value still lines up with those that have one; `null` leaves that space out. */
261
+ icon?: IconName | null;
262
+ label: string;
263
+ /** `label` when left out. */
264
+ tooltip?: ReactNode;
265
+ children: ReactNode;
266
+ }
267
+ export declare function Stat({ icon, label, tooltip, children }: StatProps): import("react").JSX.Element;
268
+ //#endregion
269
+ //#region src/primitives/StatsSection/StatsSection.d.ts
270
+ interface StatsSectionProps {
271
+ title: string;
272
+ summary?: ReactNode;
273
+ /** How many `Stat`s go next to each other. */
274
+ columns?: 1 | 2;
275
+ children: ReactNode;
276
+ }
277
+ export declare function StatsSection({ title, summary, columns, children }: StatsSectionProps): import("react").JSX.Element;
278
+ //#endregion
279
+ //#region src/primitives/ResistanceBar/ResistanceBar.d.ts
280
+ type DamageType = "em" | "thermal" | "kinetic" | "explosive";
281
+ interface ResistanceBarProps {
282
+ damage: DamageType;
283
+ label: string;
284
+ /** From 0 to 1. */
285
+ resistance: number;
286
+ /** The resistance as text. */
287
+ children: ReactNode;
288
+ }
289
+ export declare function ResistanceBar({ damage, label, resistance, children }: ResistanceBarProps): import("react").JSX.Element;
290
+ //#endregion
291
+ //#region src/primitives/CapacitorRing/CapacitorRing.d.ts
292
+ interface CapacitorRingProps {
293
+ /** In GJ. */
294
+ capacity: number;
295
+ /** The level the capacitor settles at, from 0 to 1; 0 when it depletes. */
296
+ level: number;
297
+ label: string;
298
+ }
299
+ /** EVE's ring of capacitor cells. */
300
+ export declare function CapacitorRing({ capacity, level, label }: CapacitorRingProps): import("react").JSX.Element;
301
+ //#endregion
302
+ //#region src/components/FittingWheel/FittingWheel.d.ts
303
+ interface FittingWheelProps {
304
+ label?: string;
305
+ }
306
+ /** The fitting wheel of the fit in the surrounding `EveShipFitProvider`. */
307
+ export declare function FittingWheel({ label }: FittingWheelProps): import("react").JSX.Element;
308
+ //#endregion
309
+ //#region src/components/FittingWindow/FittingWindow.d.ts
310
+ interface FittingWindowProps {
311
+ label?: string;
312
+ /** Like `ItemBrowser`; slid out by the Item Browser button, which is only there with it. */
313
+ browser?: ReactNode;
314
+ /** Like `ShipStatistics`; slid out by the Statistics button, which is only there with it. */
315
+ statistics?: ReactNode;
316
+ }
317
+ /** EVE's fitting window around the `FittingWheel`. */
318
+ export declare function FittingWindow({ label, browser, statistics }: FittingWindowProps): import("react").JSX.Element;
319
+ //#endregion
320
+ //#region src/components/ItemBrowser/ItemBrowser.d.ts
321
+ interface ItemBrowserProps {
322
+ label?: string;
323
+ }
324
+ /** EVE's browser of hulls and fits, modules and charges, left of the fitting wheel. */
325
+ export declare function ItemBrowser({ label }: ItemBrowserProps): import("react").JSX.Element;
326
+ //#endregion
327
+ //#region src/components/ShipStatistics/ShipStatistics.d.ts
328
+ interface ShipStatisticsProps {
329
+ label?: string;
330
+ }
331
+ /** EVE's statistics of the fit, as its fitting window shows them. */
332
+ export declare function ShipStatistics({ label }: ShipStatisticsProps): import("react").JSX.Element;
333
+ //#endregion
334
+ //#region src/components/ShipStatistics/CapacitorStats.d.ts
335
+ export declare function CapacitorStats(): import("react").JSX.Element;
336
+ //#endregion
337
+ //#region src/components/ShipStatistics/OffenseStats.d.ts
338
+ export declare function OffenseStats(): import("react").JSX.Element;
339
+ //#endregion
340
+ //#region src/components/ShipStatistics/DefenseStats.d.ts
341
+ export declare function DefenseStats(): import("react").JSX.Element;
342
+ //#endregion
343
+ //#region src/components/ShipStatistics/RepairRate.d.ts
344
+ /** One of the ways the fit gets its hitpoints back; click it to pick another. */
345
+ export declare function RepairRate(): import("react").JSX.Element;
346
+ //#endregion
347
+ //#region src/components/ShipStatistics/Resistances.d.ts
348
+ type Layer = "shield" | "armor" | "structure";
349
+ /** The four resistances of one layer. */
350
+ export declare function Resistances({ layer }: {
351
+ layer: Layer;
352
+ }): import("react").JSX.Element[];
353
+ //#endregion
354
+ //#region src/components/ShipStatistics/TargetingStats.d.ts
355
+ export declare function TargetingStats(): import("react").JSX.Element;
356
+ //#endregion
357
+ //#region src/components/ShipStatistics/NavigationStats.d.ts
358
+ export declare function NavigationStats(): import("react").JSX.Element;
359
+ //#endregion
360
+ //#region src/components/ShipStatistics/DroneStats.d.ts
361
+ export declare function DroneStats(): import("react").JSX.Element;
362
+ //#endregion
363
+ //#region src/components/ShipStatistics/FitPrice.d.ts
364
+ interface FitPriceProps {
365
+ /** In ISK. */
366
+ price: number;
367
+ }
368
+ export declare function FitPrice({ price }: FitPriceProps): import("react").JSX.Element;
369
+ //#endregion
370
+ export type { CapacitorRingProps, DamageType, DialogProps, FilterToggleProps, FitPriceProps, FittingWheelProps, FittingWindowProps, Hardpoints, HistoryBarProps, IconName, IconProps, ItemBrowserProps, Layer, MarkedRack, ResistanceBarProps, ShipStatisticsProps, SlotState, StatProps, StatsSectionProps, TooltipProps, TooltipTextProps, TreeGroupProps, TreeLeafProps, TreeListProps, TypeIconProps, WheelGaugeProps, WheelHardpointsProps, WheelHullProps, WheelProps, WheelRack, WheelRackMarkerProps, WheelResource, WheelSlotProps };