@peers-app/peers-ui 0.33.19 → 0.33.21
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/command-palette/command-palette.d.ts +47 -0
- package/dist/command-palette/command-palette.js +42 -9
- package/dist/components/group-switcher.d.ts +3 -2
- package/dist/components/group-switcher.js +16 -3
- package/dist/graph/ring-layout.d.ts +62 -0
- package/dist/graph/ring-layout.js +100 -0
- package/dist/groups/group-appearance-dialog.d.ts +27 -7
- package/dist/groups/group-appearance-dialog.js +49 -16
- package/dist/groups/index.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/screens/groups/group-details.js +1 -1
- package/dist/screens/groups/group-list.js +1 -1
- package/dist/screens/network-viewer/graph/edge-route.d.ts +33 -0
- package/dist/screens/network-viewer/graph/edge-route.js +133 -0
- package/dist/screens/network-viewer/graph/label-placement.d.ts +54 -0
- package/dist/screens/network-viewer/graph/label-placement.js +134 -0
- package/dist/screens/network-viewer/graph/network-graph-card.d.ts +30 -0
- package/dist/screens/network-viewer/graph/network-graph-card.js +91 -0
- package/dist/screens/network-viewer/graph/network-graph-controls.d.ts +26 -0
- package/dist/screens/network-viewer/graph/network-graph-controls.js +80 -0
- package/dist/screens/network-viewer/graph/network-graph-model.d.ts +282 -0
- package/dist/screens/network-viewer/graph/network-graph-model.js +553 -0
- package/dist/screens/network-viewer/graph/network-graph-settings.d.ts +27 -0
- package/dist/screens/network-viewer/graph/network-graph-settings.js +81 -0
- package/dist/screens/network-viewer/graph/network-graph.d.ts +17 -0
- package/dist/screens/network-viewer/graph/network-graph.js +419 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +3 -2
- package/dist/screens/network-viewer/network-viewer.js +65 -8
- package/dist/tabs-layout/linger.d.ts +75 -0
- package/dist/tabs-layout/linger.js +121 -0
- package/dist/tabs-layout/network-status-details.d.ts +27 -0
- package/dist/tabs-layout/network-status-details.js +203 -0
- package/dist/tabs-layout/network-status-format.d.ts +22 -0
- package/dist/tabs-layout/network-status-format.js +58 -0
- package/dist/tabs-layout/network-status-indicator.d.ts +1 -13
- package/dist/tabs-layout/network-status-indicator.js +27 -133
- package/dist/tabs-layout/network-status-model.d.ts +71 -0
- package/dist/tabs-layout/network-status-model.js +155 -0
- package/dist/tabs-layout/tab-color.d.ts +9 -2
- package/dist/tabs-layout/tab-color.js +14 -4
- package/dist/tabs-layout/tab-order.d.ts +51 -0
- package/dist/tabs-layout/tab-order.js +70 -0
- package/dist/tabs-layout/tab-switcher-overlay.d.ts +16 -0
- package/dist/tabs-layout/tab-switcher-overlay.js +68 -0
- package/dist/tabs-layout/tab-switcher.d.ts +64 -0
- package/dist/tabs-layout/tab-switcher.js +150 -0
- package/dist/tabs-layout/tabs-layout.d.ts +3 -1
- package/dist/tabs-layout/tabs-layout.js +90 -46
- package/dist/tabs-layout/tabs-state.d.ts +34 -13
- package/dist/tabs-layout/tabs-state.js +104 -31
- package/dist/tabs-layout/use-network-details-data.d.ts +28 -0
- package/dist/tabs-layout/use-network-details-data.js +90 -0
- package/dist/tabs-layout/use-syncing-look.d.ts +18 -0
- package/dist/tabs-layout/use-syncing-look.js +50 -0
- package/dist/theme.css +741 -0
- package/package.json +3 -3
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { type INetworkConnectionInfo, type INetworkDisconnectedDevice, type INetworkGroupSyncInfo, type INetworkOverview, type INetworkTopology, TrustLevel } from "@peers-app/peers-sdk";
|
|
2
|
+
/** What a device is to the person looking: this device, another of theirs, someone else's, or a service. */
|
|
3
|
+
export type NetNodeKind = "self" | "mine" | "other" | "service";
|
|
4
|
+
/** One device in the graph. */
|
|
5
|
+
export interface NetNode {
|
|
6
|
+
/** The device id. */
|
|
7
|
+
key: string;
|
|
8
|
+
kind: NetNodeKind;
|
|
9
|
+
/** The device's name, or a short id when nothing is known about it. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Who owns it, when known. */
|
|
12
|
+
owner?: string;
|
|
13
|
+
userId?: string;
|
|
14
|
+
/** Known but not connected to anything shown. */
|
|
15
|
+
offline?: boolean;
|
|
16
|
+
/** This device's live connection to it, for a directly connected device. */
|
|
17
|
+
connection?: INetworkConnectionInfo;
|
|
18
|
+
/** When an offline device was last seen. */
|
|
19
|
+
lastSeen?: Date;
|
|
20
|
+
/** How old its own report of its connections is, in milliseconds, when it has sent one. */
|
|
21
|
+
reportAgeMs?: number;
|
|
22
|
+
}
|
|
23
|
+
/** How a connection is doing. */
|
|
24
|
+
export type EdgeHealth = "ok" | "slow" | "failing";
|
|
25
|
+
/** One group's election result for a connection between `a` and `b`. */
|
|
26
|
+
export interface NetEdgeGroup {
|
|
27
|
+
groupId: string;
|
|
28
|
+
groupName: string;
|
|
29
|
+
/** `a` chose `b` to sync with in this group. */
|
|
30
|
+
aPrefersB: boolean;
|
|
31
|
+
/** `b` chose `a` to sync with in this group. */
|
|
32
|
+
bPrefersA: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** One live connection between two devices. */
|
|
35
|
+
export interface NetEdge {
|
|
36
|
+
/** `a|b`. */
|
|
37
|
+
key: string;
|
|
38
|
+
/** This device for one of its own connections; otherwise the lower device id. */
|
|
39
|
+
a: string;
|
|
40
|
+
b: string;
|
|
41
|
+
/** Whether this device is one end, so traffic and route are known. */
|
|
42
|
+
own: boolean;
|
|
43
|
+
/** Every group whose election data reports this connection. */
|
|
44
|
+
groups: NetEdgeGroup[];
|
|
45
|
+
latencyMs?: number;
|
|
46
|
+
errorRate?: number;
|
|
47
|
+
/** Bytes per second from `a` to `b`, for this device's own connections. */
|
|
48
|
+
sendBps?: number;
|
|
49
|
+
/** Bytes per second from `b` to `a`, for this device's own connections. */
|
|
50
|
+
receiveBps?: number;
|
|
51
|
+
}
|
|
52
|
+
/** A group in the filter list. */
|
|
53
|
+
export interface NetGroup {
|
|
54
|
+
groupId: string;
|
|
55
|
+
groupName: string;
|
|
56
|
+
syncState?: string;
|
|
57
|
+
totalMembers?: number;
|
|
58
|
+
}
|
|
59
|
+
/** Everything the graph view draws from. */
|
|
60
|
+
export interface NetGraph {
|
|
61
|
+
selfId: string;
|
|
62
|
+
nodes: Map<string, NetNode>;
|
|
63
|
+
edges: NetEdge[];
|
|
64
|
+
groups: NetGroup[];
|
|
65
|
+
/** False when the host can't report what other devices are connected to (an older build). */
|
|
66
|
+
hasTopology: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** The host's answers the graph is built from. */
|
|
69
|
+
export interface NetGraphInput {
|
|
70
|
+
overview: INetworkOverview;
|
|
71
|
+
connections: readonly INetworkConnectionInfo[];
|
|
72
|
+
groupSync: readonly INetworkGroupSyncInfo[];
|
|
73
|
+
disconnected: readonly INetworkDisconnectedDevice[];
|
|
74
|
+
/** Missing when the host doesn't provide `getTopology`. */
|
|
75
|
+
topology?: INetworkTopology;
|
|
76
|
+
/** What to call this device. */
|
|
77
|
+
selfName?: string;
|
|
78
|
+
}
|
|
79
|
+
/** A device id cut down to something that fits a label. */
|
|
80
|
+
export declare function shortId(deviceId: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether a connection is to a Peers Services relay (peers.app) and not to a device that syncs:
|
|
83
|
+
* it shares no group and its address is a web address.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isServiceConnection(connection: INetworkConnectionInfo): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Whether a known, unconnected device is a Peers Services relay (peers.app). A relay reports its
|
|
88
|
+
* web address as its user name, and each Services restart brings a new device id, so a long-used
|
|
89
|
+
* device knows dozens of relays that are gone for good. The graph leaves them off its offline
|
|
90
|
+
* ring; the List's Disconnected Devices table still has them.
|
|
91
|
+
*/
|
|
92
|
+
export declare function isServiceDevice(device: INetworkDisconnectedDevice): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* How a connection travels, from its address: WebRTC, WebSocket or WebTransport.
|
|
95
|
+
*
|
|
96
|
+
* @param address - The connection's address, such as `wrtc://…` or `wss://…`.
|
|
97
|
+
* @returns A label, or undefined when the address says nothing.
|
|
98
|
+
*/
|
|
99
|
+
export declare function transportOf(address: string | undefined): string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Build the graph: this device, the devices it's connected to, the devices those are connected
|
|
102
|
+
* to, and every connection among them with each group's election result.
|
|
103
|
+
*
|
|
104
|
+
* @param input - The host's diagnostics answers.
|
|
105
|
+
*/
|
|
106
|
+
export declare function buildNetworkGraph(input: NetGraphInput): NetGraph;
|
|
107
|
+
/** The view's settings. */
|
|
108
|
+
export interface NetGraphShows {
|
|
109
|
+
/** 1 for this device's connections; 2 adds the connections those devices have. */
|
|
110
|
+
steps: 1 | 2;
|
|
111
|
+
/** Show known devices that aren't connected. */
|
|
112
|
+
offline: boolean;
|
|
113
|
+
/** Show peers.app and other service relays. */
|
|
114
|
+
service: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A connected node's neighbors in the order the layout places them: services first, then the
|
|
118
|
+
* person's own devices, then others by name. Offline devices have no connections, so they
|
|
119
|
+
* aren't anyone's neighbor; see {@link offlineNodes}.
|
|
120
|
+
*
|
|
121
|
+
* @param graph - The graph.
|
|
122
|
+
* @param shows - The view's settings.
|
|
123
|
+
* @returns The neighbors of a node, for the ring layout.
|
|
124
|
+
*/
|
|
125
|
+
export declare function neighborsFor(graph: NetGraph, shows: NetGraphShows): (key: string) => string[];
|
|
126
|
+
/**
|
|
127
|
+
* The known devices that aren't connected, most recently seen first, for the outer ring.
|
|
128
|
+
*
|
|
129
|
+
* @param graph - The graph.
|
|
130
|
+
* @param max - The most to draw.
|
|
131
|
+
* @returns The devices to draw, and how many more there are.
|
|
132
|
+
*/
|
|
133
|
+
export declare function offlineNodes(graph: NetGraph, max: number): {
|
|
134
|
+
shown: NetNode[];
|
|
135
|
+
more: number;
|
|
136
|
+
};
|
|
137
|
+
/** A connection as the group filter leaves it. */
|
|
138
|
+
export interface NetEdgeView {
|
|
139
|
+
/** Whether a selected group reports this connection (always, with no filter or for a service). */
|
|
140
|
+
inFilter: boolean;
|
|
141
|
+
/** `a` chose `b` in a group that counts. */
|
|
142
|
+
aPrefersB: boolean;
|
|
143
|
+
/** `b` chose `a` in a group that counts. */
|
|
144
|
+
bPrefersA: boolean;
|
|
145
|
+
/** The groups that count. */
|
|
146
|
+
groups: NetEdgeGroup[];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Apply the group filter to a connection. With no group selected every group counts. With some
|
|
150
|
+
* selected, only they do, and a connection none of them reports is out of the filter. A
|
|
151
|
+
* connection no group reports at all (a service relay) is never filtered out.
|
|
152
|
+
*
|
|
153
|
+
* @param edge - The connection.
|
|
154
|
+
* @param selectedGroupIds - The selected groups; empty for all.
|
|
155
|
+
*/
|
|
156
|
+
export declare function viewEdge(edge: NetEdge, selectedGroupIds: readonly string[]): NetEdgeView;
|
|
157
|
+
/** Latency at or above this is slow whatever the connection usually does, in milliseconds. */
|
|
158
|
+
export declare const SLOW_LATENCY_MS = 1000;
|
|
159
|
+
/** Latency at or above this is failing, in milliseconds. */
|
|
160
|
+
export declare const FAILING_LATENCY_MS = 5000;
|
|
161
|
+
/** Share of failed calls at or above which a connection is slow. */
|
|
162
|
+
export declare const SLOW_ERROR_RATE = 0.05;
|
|
163
|
+
/** Share of failed calls at or above which a connection is failing. */
|
|
164
|
+
export declare const FAILING_ERROR_RATE = 0.25;
|
|
165
|
+
/**
|
|
166
|
+
* Judge a connection. It's failing when most calls time out or a quarter fail, and slow when
|
|
167
|
+
* calls fail now and then, latency is very high, or latency is at least twice what this
|
|
168
|
+
* connection usually manages (and at least 150 ms above it). A far-away device with a steady
|
|
169
|
+
* 300 ms is normal; the same device at 700 ms is slow.
|
|
170
|
+
*
|
|
171
|
+
* @param latencyMs - Current latency.
|
|
172
|
+
* @param errorRate - Current share of failed calls, 0 to 1.
|
|
173
|
+
* @param usualLatencyMs - What this connection usually manages, when enough has been seen.
|
|
174
|
+
*/
|
|
175
|
+
export declare function edgeHealth(latencyMs: number | undefined, errorRate: number | undefined, usualLatencyMs?: number): EdgeHealth;
|
|
176
|
+
/**
|
|
177
|
+
* What each connection's latency usually is, from what the viewer has seen while open: the
|
|
178
|
+
* lower quartile of the last ten minutes, once there are ten readings.
|
|
179
|
+
*/
|
|
180
|
+
export declare class LatencyHistory {
|
|
181
|
+
private readonly readings;
|
|
182
|
+
/** Keep readings this long, in milliseconds. */
|
|
183
|
+
static readonly WINDOW_MS: number;
|
|
184
|
+
/** Readings needed before {@link usual} answers. */
|
|
185
|
+
static readonly MIN_READINGS = 10;
|
|
186
|
+
/**
|
|
187
|
+
* Add a reading.
|
|
188
|
+
*
|
|
189
|
+
* @param key - The connection.
|
|
190
|
+
* @param latencyMs - Its latency now.
|
|
191
|
+
* @param now - The time, in epoch milliseconds.
|
|
192
|
+
*/
|
|
193
|
+
record(key: string, latencyMs: number, now: number): void;
|
|
194
|
+
/**
|
|
195
|
+
* What a connection usually manages.
|
|
196
|
+
*
|
|
197
|
+
* @param key - The connection.
|
|
198
|
+
* @returns Its usual latency, or undefined until enough readings exist.
|
|
199
|
+
*/
|
|
200
|
+
usual(key: string): number | undefined;
|
|
201
|
+
/** Forget connections that are gone. */
|
|
202
|
+
keepOnly(keys: ReadonlySet<string>): void;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Rates under this many bytes a second count as idle: an open connection always carries a few
|
|
206
|
+
* keepalive bytes, and drawing those would put dots on every line.
|
|
207
|
+
*/
|
|
208
|
+
export declare const IDLE_BYTES_PER_SECOND = 256;
|
|
209
|
+
/** How much data is moving: none, a trickle, steady or heavy. */
|
|
210
|
+
export type TrafficStep = 0 | 1 | 2 | 3;
|
|
211
|
+
/**
|
|
212
|
+
* Sort a rate into the three dot sizes: under 10 KB/s, under 1 MB/s, and more.
|
|
213
|
+
*
|
|
214
|
+
* @param bytesPerSecond - The rate.
|
|
215
|
+
* @returns 0 when nothing is moving.
|
|
216
|
+
*/
|
|
217
|
+
export declare function trafficStep(bytesPerSecond: number | undefined): TrafficStep;
|
|
218
|
+
/**
|
|
219
|
+
* A rate for people: `idle`, `0.3 KB/s`, `40 KB/s`, `1.2 MB/s`.
|
|
220
|
+
*
|
|
221
|
+
* @param bytesPerSecond - The rate.
|
|
222
|
+
*/
|
|
223
|
+
export declare function formatRate(bytesPerSecond: number | undefined): string;
|
|
224
|
+
/** Latency for people: `379 ms`. */
|
|
225
|
+
export declare function formatLatency(latencyMs: number | undefined): string;
|
|
226
|
+
/** An error rate for people: `no errors`, `6.3% errors`. */
|
|
227
|
+
export declare function formatErrors(errorRate: number | undefined): string;
|
|
228
|
+
/**
|
|
229
|
+
* A trust level's name: the highest named level at or below it, as the trust badge reads it.
|
|
230
|
+
*
|
|
231
|
+
* @param level - The level; missing reads as Unknown.
|
|
232
|
+
*/
|
|
233
|
+
export declare function trustName(level: TrustLevel | undefined): string;
|
|
234
|
+
/**
|
|
235
|
+
* Whose a device is, for the line under its name: `Yours`, `Blair's`, `Its own account`.
|
|
236
|
+
*
|
|
237
|
+
* @param node - The device.
|
|
238
|
+
*/
|
|
239
|
+
export declare function ownerLabel(node: NetNode): string;
|
|
240
|
+
/**
|
|
241
|
+
* What to call a device on the graph: its name, with its owner first when it's someone else's
|
|
242
|
+
* (`Blair · Laptop`), so two people's laptops can be told apart. A device on an account named
|
|
243
|
+
* after it keeps just its name.
|
|
244
|
+
*
|
|
245
|
+
* @param node - The device.
|
|
246
|
+
*/
|
|
247
|
+
export declare function graphName(node: NetNode): string;
|
|
248
|
+
/**
|
|
249
|
+
* How a connection travels, for people: `WebRTC`, `WebSocket · through another device`.
|
|
250
|
+
*
|
|
251
|
+
* @param address - The connection's address.
|
|
252
|
+
* @param pathType - Whether it's direct or relayed through another device.
|
|
253
|
+
*/
|
|
254
|
+
export declare function routeOf(address: string | undefined, pathType: string | undefined): string;
|
|
255
|
+
/**
|
|
256
|
+
* A group's sync state in a word: `Synced`, `Syncing`, `Sync error`, or `Unknown`.
|
|
257
|
+
*
|
|
258
|
+
* @param state - The state the host reports, if any.
|
|
259
|
+
*/
|
|
260
|
+
export declare function syncStateWord(state: string | undefined): string;
|
|
261
|
+
/** Join names the way a sentence does: `A`, `A and B`, `A, B and C`. */
|
|
262
|
+
export declare function listNames(names: readonly string[]): string;
|
|
263
|
+
/**
|
|
264
|
+
* Say which groups chose a connection, and which way, one line per kind of choice.
|
|
265
|
+
*
|
|
266
|
+
* @param view - The connection under the current filter.
|
|
267
|
+
* @param aName - What to call `a`.
|
|
268
|
+
* @param bName - What to call `b`.
|
|
269
|
+
*/
|
|
270
|
+
export declare function describeChoices(view: NetEdgeView, aName: string, bName: string): string[];
|
|
271
|
+
/**
|
|
272
|
+
* Who a device syncs with and who chose it, under the current filter.
|
|
273
|
+
*
|
|
274
|
+
* @param graph - The graph.
|
|
275
|
+
* @param deviceId - The device.
|
|
276
|
+
* @param selectedGroupIds - The selected groups; empty for all.
|
|
277
|
+
*/
|
|
278
|
+
export declare function syncSummary(graph: NetGraph, deviceId: string, selectedGroupIds: readonly string[]): {
|
|
279
|
+
chose: string[];
|
|
280
|
+
chosenBy: string[];
|
|
281
|
+
connectedOnly: string[];
|
|
282
|
+
};
|