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