@peers-app/peers-ui 0.34.14 → 0.34.15
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/apps-home/app-menu.d.ts +1 -2
- package/dist/apps-home/app-menu.js +29 -25
- package/dist/command-palette/command-palette-ui.js +13 -12
- package/dist/components/autocomplete-chips.d.ts +18 -0
- package/dist/components/autocomplete-chips.js +49 -0
- package/dist/components/autocomplete.d.ts +88 -0
- package/dist/components/autocomplete.js +346 -0
- package/dist/components/confirm-button.d.ts +26 -0
- package/dist/components/confirm-button.js +55 -0
- package/dist/components/data-grid/autocomplete.d.ts +1 -31
- package/dist/components/data-grid/autocomplete.js +5 -197
- package/dist/components/empty-state.d.ts +16 -0
- package/dist/components/empty-state.js +16 -0
- package/dist/components/group-switcher.d.ts +3 -3
- package/dist/components/group-switcher.js +22 -17
- package/dist/components/inline-create-form.d.ts +22 -0
- package/dist/components/inline-create-form.js +56 -0
- package/dist/components/list-row.d.ts +33 -0
- package/dist/components/list-row.js +30 -0
- package/dist/components/list-screen.d.ts +31 -3
- package/dist/components/list-screen.js +61 -28
- package/dist/components/markdown-editor/format-bar.js +15 -40
- package/dist/components/markdown-editor/link-plugin.js +38 -9
- package/dist/components/markdown-editor/selection-bar-place.d.ts +37 -0
- package/dist/components/markdown-editor/selection-bar-place.js +107 -0
- package/dist/components/menu-button.d.ts +34 -0
- package/dist/components/menu-button.js +66 -0
- package/dist/components/screen-header.d.ts +35 -0
- package/dist/components/screen-header.js +30 -0
- package/dist/components/search-field.d.ts +22 -0
- package/dist/components/search-field.js +22 -0
- package/dist/components/segmented-control.d.ts +25 -0
- package/dist/components/segmented-control.js +18 -0
- package/dist/components/typeahead.d.ts +9 -0
- package/dist/components/typeahead.js +7 -0
- package/dist/groups/groups-client.d.ts +23 -1
- package/dist/groups/groups-client.js +31 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +14 -1
- package/dist/isolated-screens/config.js +1 -9
- package/dist/isolated-screens/folder-picker-control.d.ts +57 -0
- package/dist/isolated-screens/folder-picker-control.js +217 -0
- package/dist/isolated-screens/folder-picker-host.d.ts +57 -0
- package/dist/isolated-screens/folder-picker-host.js +178 -0
- package/dist/isolated-screens/folder-picker-protocol.d.ts +75 -0
- package/dist/isolated-screens/folder-picker-protocol.js +104 -0
- package/dist/isolated-screens/frame-bridge.js +8 -0
- package/dist/isolated-screens/frame-document.js +2 -1
- package/dist/isolated-screens/frame-microphone.d.ts +55 -0
- package/dist/isolated-screens/frame-microphone.js +265 -0
- package/dist/isolated-screens/frame-permissions.d.ts +19 -0
- package/dist/isolated-screens/frame-permissions.js +32 -0
- package/dist/isolated-screens/frame-protocol.d.ts +26 -0
- package/dist/isolated-screens/frame-protocol.js +9 -0
- package/dist/isolated-screens/frame-pvars.d.ts +27 -0
- package/dist/isolated-screens/frame-pvars.js +101 -14
- package/dist/isolated-screens/global-widgets.d.ts +1 -2
- package/dist/isolated-screens/index.d.ts +2 -0
- package/dist/isolated-screens/index.js +3 -1
- package/dist/isolated-screens/isolated-screen.d.ts +21 -0
- package/dist/isolated-screens/isolated-screen.js +88 -5
- package/dist/isolated-screens/local-folder-picker.d.ts +55 -0
- package/dist/isolated-screens/local-folder-picker.js +143 -0
- package/dist/isolated-screens/microphone-host.d.ts +110 -0
- package/dist/isolated-screens/microphone-host.js +397 -0
- package/dist/isolated-screens/microphone-prompt.d.ts +20 -0
- package/dist/isolated-screens/microphone-prompt.js +60 -0
- package/dist/isolated-screens/piece-frames.js +5 -94
- package/dist/isolated-screens/piece-reach.d.ts +1 -0
- package/dist/isolated-screens/port-channel.d.ts +21 -11
- package/dist/isolated-screens/port-channel.js +15 -5
- package/dist/isolated-screens/slot-rect.d.ts +38 -0
- package/dist/isolated-screens/slot-rect.js +121 -0
- package/dist/isolated-screens/test-ports.d.ts +17 -0
- package/dist/isolated-screens/test-ports.js +25 -3
- package/dist/mentions/mention-chooser.js +1 -1
- package/dist/notifications/notifications-screen.js +1 -1
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -0
- package/dist/screens/data-explorer/data-explorer.js +28 -10
- package/dist/screens/data-explorer/query-executor.d.ts +1 -0
- package/dist/screens/data-explorer/query-executor.js +3 -1
- package/dist/screens/groups/group-list.d.ts +13 -3
- package/dist/screens/groups/group-list.js +88 -11
- package/dist/screens/identity/identity-routes.d.ts +16 -0
- package/dist/screens/identity/identity-routes.js +27 -10
- package/dist/screens/identity/identity-screen.js +4 -1
- package/dist/screens/invites/activity-view.d.ts +3 -1
- package/dist/screens/invites/activity-view.js +7 -3
- package/dist/screens/invites/pending-invites-list.d.ts +8 -4
- package/dist/screens/invites/pending-invites-list.js +44 -45
- package/dist/screens/network-viewer/graph/network-graph-controls.js +3 -3
- package/dist/screens/packages/local-folder-grants-panel.d.ts +2 -0
- package/dist/screens/packages/local-folder-grants-panel.js +1 -1
- package/dist/screens/packages/package-info.js +2 -1
- package/dist/screens/packages/package-list.d.ts +2 -2
- package/dist/screens/packages/package-list.js +89 -105
- package/dist/screens/packages/package-microphone-panel.d.ts +14 -0
- package/dist/screens/packages/package-microphone-panel.js +62 -0
- package/dist/screens/packages/package-runtime-status.d.ts +10 -2
- package/dist/screens/packages/package-runtime-status.js +17 -4
- package/dist/screens/peer-types/peer-type-details.js +3 -2
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -1
- package/dist/screens/peer-types/peer-type-list.js +4 -4
- package/dist/screens/settings/settings-page.js +1 -4
- package/dist/screens/tools/tool-details.js +2 -1
- package/dist/screens/tools/tool-list.d.ts +1 -1
- package/dist/screens/tools/tool-list.js +22 -60
- package/dist/screens/variables/variable-details.js +5 -4
- package/dist/screens/variables/variable-list.d.ts +17 -0
- package/dist/screens/variables/variable-list.js +72 -28
- package/dist/tabs-layout/network-status-details.d.ts +4 -4
- package/dist/tabs-layout/network-status-details.js +6 -5
- package/dist/tabs-layout/network-status-indicator.d.ts +1 -0
- package/dist/tabs-layout/network-status-indicator.js +1 -0
- package/dist/tabs-layout/tab-bar-shortcuts.d.ts +46 -0
- package/dist/tabs-layout/tab-bar-shortcuts.js +140 -0
- package/dist/tabs-layout/tabs-layout.js +11 -9
- package/dist/theme.css +326 -6
- package/dist/ui-contracts/popover-surface.d.ts +3 -0
- package/dist/ui-contracts/popover-surface.js +6 -3
- package/dist/ui-defaults/list-screen.js +10 -4
- package/package.json +3 -3
|
@@ -27,10 +27,13 @@ function openPortChannel(port, opts = {}) {
|
|
|
27
27
|
const pending = new Map();
|
|
28
28
|
const requestHandlers = new Map();
|
|
29
29
|
const notifyHandlers = new Map();
|
|
30
|
-
const post = (message) => {
|
|
30
|
+
const post = (message, transfer) => {
|
|
31
31
|
if (closed)
|
|
32
32
|
return;
|
|
33
|
-
|
|
33
|
+
if (transfer?.length)
|
|
34
|
+
port.postMessage(message, transfer);
|
|
35
|
+
else
|
|
36
|
+
port.postMessage(message);
|
|
34
37
|
};
|
|
35
38
|
const listener = (event) => {
|
|
36
39
|
if (closed)
|
|
@@ -74,7 +77,11 @@ function openPortChannel(port, opts = {}) {
|
|
|
74
77
|
if (message.kind === "request") {
|
|
75
78
|
const { id, type } = message;
|
|
76
79
|
const handler = requestHandlers.get(type);
|
|
80
|
+
const ports = event.ports ?? [];
|
|
77
81
|
if (!handler) {
|
|
82
|
+
// Nothing takes the ports, so they're closed rather than left open.
|
|
83
|
+
for (const transferred of ports)
|
|
84
|
+
transferred.close();
|
|
78
85
|
post({ kind: "response", id, ok: false, error: `Unknown request: ${type}` });
|
|
79
86
|
try {
|
|
80
87
|
opts.onUnknownRequest?.(type);
|
|
@@ -86,10 +93,13 @@ function openPortChannel(port, opts = {}) {
|
|
|
86
93
|
}
|
|
87
94
|
void (async () => {
|
|
88
95
|
try {
|
|
89
|
-
const
|
|
96
|
+
const payload = (0, peers_sdk_1.fromJSON)(message.payload);
|
|
97
|
+
const value = await (ports.length ? handler(payload, ports) : handler(payload));
|
|
90
98
|
post({ kind: "response", id, ok: true, value: (0, peers_sdk_1.toJSONKeepingBytes)(value) });
|
|
91
99
|
}
|
|
92
100
|
catch (error) {
|
|
101
|
+
for (const transferred of ports)
|
|
102
|
+
transferred.close();
|
|
93
103
|
post({ kind: "response", id, ok: false, error: errorMessage(error) });
|
|
94
104
|
}
|
|
95
105
|
})();
|
|
@@ -98,14 +108,14 @@ function openPortChannel(port, opts = {}) {
|
|
|
98
108
|
port.addEventListener("message", listener);
|
|
99
109
|
port.start?.();
|
|
100
110
|
return {
|
|
101
|
-
request(type, payload) {
|
|
111
|
+
request(type, payload, transfer) {
|
|
102
112
|
if (closed)
|
|
103
113
|
return Promise.reject(new Error("The frame's channel is closed"));
|
|
104
114
|
const id = nextId++;
|
|
105
115
|
return new Promise((resolve, reject) => {
|
|
106
116
|
pending.set(id, { resolve, reject });
|
|
107
117
|
try {
|
|
108
|
-
post({ kind: "request", id, type, payload: (0, peers_sdk_1.toJSONKeepingBytes)(payload) });
|
|
118
|
+
post({ kind: "request", id, type, payload: (0, peers_sdk_1.toJSONKeepingBytes)(payload) }, transfer);
|
|
109
119
|
}
|
|
110
120
|
catch (error) {
|
|
111
121
|
pending.delete(id);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a slot in a framed screen is, for the host that draws over it: a piece's frame
|
|
3
|
+
* (`piece-frames.tsx`) or a control Peers draws itself (`local-folder-picker.tsx`).
|
|
4
|
+
*/
|
|
5
|
+
/** A slot's box, in the frame's coordinates. */
|
|
6
|
+
export interface ISlotRect {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
/** How much of each side of a slot is hidden, by scrolling boxes around it or the window's edge. */
|
|
13
|
+
export interface ISlotClip {
|
|
14
|
+
top: number;
|
|
15
|
+
right: number;
|
|
16
|
+
bottom: number;
|
|
17
|
+
left: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The part of a slot that shows: its rectangle cut by every scrolling box around it.
|
|
21
|
+
*
|
|
22
|
+
* @param element - The slot.
|
|
23
|
+
* @param rect - Its bounding rectangle.
|
|
24
|
+
* @returns How much of each side is cut off.
|
|
25
|
+
*/
|
|
26
|
+
export declare function visibleClip(element: HTMLElement, rect: DOMRect): ISlotClip;
|
|
27
|
+
/**
|
|
28
|
+
* Report where a slot is, once per animation frame while anything moves it, until stopped. A
|
|
29
|
+
* resize or a scroll always reports it. Content above the slot that grows or shrinks moves the
|
|
30
|
+
* slot without resizing it, so any other change in the screen (its document, an image that loaded,
|
|
31
|
+
* a transition that ended) measures the slot again, and reports only if it moved. The first report
|
|
32
|
+
* comes on the next animation frame.
|
|
33
|
+
*
|
|
34
|
+
* @param slot - The slot, read at each report; nothing is reported while it's gone.
|
|
35
|
+
* @param send - Called with the slot's box and the part of it that's hidden.
|
|
36
|
+
* @returns Stops watching.
|
|
37
|
+
*/
|
|
38
|
+
export declare function watchSlotRect(slot: () => HTMLElement | null, send: (rect: ISlotRect, clip: ISlotClip) => void): () => void;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Where a slot in a framed screen is, for the host that draws over it: a piece's frame
|
|
4
|
+
* (`piece-frames.tsx`) or a control Peers draws itself (`local-folder-picker.tsx`).
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.visibleClip = visibleClip;
|
|
8
|
+
exports.watchSlotRect = watchSlotRect;
|
|
9
|
+
/**
|
|
10
|
+
* The part of a slot that shows: its rectangle cut by every scrolling box around it.
|
|
11
|
+
*
|
|
12
|
+
* @param element - The slot.
|
|
13
|
+
* @param rect - Its bounding rectangle.
|
|
14
|
+
* @returns How much of each side is cut off.
|
|
15
|
+
*/
|
|
16
|
+
function visibleClip(element, rect) {
|
|
17
|
+
let top = rect.top;
|
|
18
|
+
let left = rect.left;
|
|
19
|
+
let bottom = rect.bottom;
|
|
20
|
+
let right = rect.right;
|
|
21
|
+
for (let parent = element.parentElement; parent; parent = parent.parentElement) {
|
|
22
|
+
const style = getComputedStyle(parent);
|
|
23
|
+
if (style.overflowX === "visible" && style.overflowY === "visible")
|
|
24
|
+
continue;
|
|
25
|
+
const box = parent.getBoundingClientRect();
|
|
26
|
+
if (style.overflowY !== "visible") {
|
|
27
|
+
top = Math.max(top, box.top);
|
|
28
|
+
bottom = Math.min(bottom, box.bottom);
|
|
29
|
+
}
|
|
30
|
+
if (style.overflowX !== "visible") {
|
|
31
|
+
left = Math.max(left, box.left);
|
|
32
|
+
right = Math.min(right, box.right);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
top = Math.max(top, 0);
|
|
36
|
+
left = Math.max(left, 0);
|
|
37
|
+
bottom = Math.min(bottom, window.innerHeight);
|
|
38
|
+
right = Math.min(right, window.innerWidth);
|
|
39
|
+
return {
|
|
40
|
+
top: Math.max(0, top - rect.top),
|
|
41
|
+
left: Math.max(0, left - rect.left),
|
|
42
|
+
bottom: Math.max(0, rect.bottom - bottom),
|
|
43
|
+
right: Math.max(0, rect.right - right),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Events, heard on the way down to their target, after which a slot may have moved without the
|
|
48
|
+
* screen's DOM changing: an image (or other element) that loaded, a CSS transition or animation
|
|
49
|
+
* that ended.
|
|
50
|
+
*/
|
|
51
|
+
const LAYOUT_EVENTS = ["load", "transitionend", "animationend"];
|
|
52
|
+
/**
|
|
53
|
+
* Report where a slot is, once per animation frame while anything moves it, until stopped. A
|
|
54
|
+
* resize or a scroll always reports it. Content above the slot that grows or shrinks moves the
|
|
55
|
+
* slot without resizing it, so any other change in the screen (its document, an image that loaded,
|
|
56
|
+
* a transition that ended) measures the slot again, and reports only if it moved. The first report
|
|
57
|
+
* comes on the next animation frame.
|
|
58
|
+
*
|
|
59
|
+
* @param slot - The slot, read at each report; nothing is reported while it's gone.
|
|
60
|
+
* @param send - Called with the slot's box and the part of it that's hidden.
|
|
61
|
+
* @returns Stops watching.
|
|
62
|
+
*/
|
|
63
|
+
function watchSlotRect(slot, send) {
|
|
64
|
+
let scheduled = 0;
|
|
65
|
+
let always = false;
|
|
66
|
+
let sent = "";
|
|
67
|
+
const report = () => {
|
|
68
|
+
scheduled = 0;
|
|
69
|
+
const force = always;
|
|
70
|
+
always = false;
|
|
71
|
+
const element = slot();
|
|
72
|
+
if (!element)
|
|
73
|
+
return;
|
|
74
|
+
const rect = element.getBoundingClientRect();
|
|
75
|
+
const box = { x: rect.left, y: rect.top, width: rect.width, height: rect.height };
|
|
76
|
+
const clip = visibleClip(element, rect);
|
|
77
|
+
const key = JSON.stringify([box, clip]);
|
|
78
|
+
if (!force && key === sent)
|
|
79
|
+
return;
|
|
80
|
+
sent = key;
|
|
81
|
+
send(box, clip);
|
|
82
|
+
};
|
|
83
|
+
const schedule = () => {
|
|
84
|
+
always = true;
|
|
85
|
+
if (!scheduled)
|
|
86
|
+
scheduled = requestAnimationFrame(report);
|
|
87
|
+
};
|
|
88
|
+
const check = () => {
|
|
89
|
+
if (!scheduled)
|
|
90
|
+
scheduled = requestAnimationFrame(report);
|
|
91
|
+
};
|
|
92
|
+
const resize = new ResizeObserver(schedule);
|
|
93
|
+
const changes = new MutationObserver(check);
|
|
94
|
+
schedule();
|
|
95
|
+
const element = slot();
|
|
96
|
+
if (element)
|
|
97
|
+
resize.observe(element);
|
|
98
|
+
resize.observe(document.body);
|
|
99
|
+
window.addEventListener("resize", schedule);
|
|
100
|
+
document.addEventListener("scroll", schedule, true);
|
|
101
|
+
// The whole document: a class on <html> or a style in <head> can move it too.
|
|
102
|
+
changes.observe(document.documentElement, {
|
|
103
|
+
subtree: true,
|
|
104
|
+
childList: true,
|
|
105
|
+
attributes: true,
|
|
106
|
+
characterData: true,
|
|
107
|
+
});
|
|
108
|
+
for (const type of LAYOUT_EVENTS)
|
|
109
|
+
document.addEventListener(type, check, true);
|
|
110
|
+
return () => {
|
|
111
|
+
if (scheduled)
|
|
112
|
+
cancelAnimationFrame(scheduled);
|
|
113
|
+
scheduled = 0;
|
|
114
|
+
resize.disconnect();
|
|
115
|
+
changes.disconnect();
|
|
116
|
+
window.removeEventListener("resize", schedule);
|
|
117
|
+
document.removeEventListener("scroll", schedule, true);
|
|
118
|
+
for (const type of LAYOUT_EVENTS)
|
|
119
|
+
document.removeEventListener(type, check, true);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import type { IPortLike } from "./port-channel";
|
|
2
2
|
/** Two connected ports for tests: what one posts, the other's listeners get, a tick later. */
|
|
3
3
|
export declare function portPair(): [IPortLike, IPortLike];
|
|
4
|
+
/** A worklet processor as a test drives it: its port, and `process`. */
|
|
5
|
+
export interface ITestWorkletProcessor {
|
|
6
|
+
port: {
|
|
7
|
+
onmessage: ((event: {
|
|
8
|
+
data: unknown;
|
|
9
|
+
}) => void) | null;
|
|
10
|
+
};
|
|
11
|
+
process(inputs: Float32Array[][], outputs?: Float32Array[][]): boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Run an AudioWorklet module's source here, off any audio thread, and make one of the processors
|
|
15
|
+
* it registers, as the engine would.
|
|
16
|
+
*
|
|
17
|
+
* @param source - The module's source.
|
|
18
|
+
* @param sampleRate - The worklet scope's `sampleRate`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadWorkletProcessor(source: string, sampleRate: number): ITestWorkletProcessor;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.portPair = portPair;
|
|
4
|
+
exports.loadWorkletProcessor = loadWorkletProcessor;
|
|
4
5
|
const node_v8_1 = require("node:v8");
|
|
5
6
|
/** Two connected ports for tests: what one posts, the other's listeners get, a tick later. */
|
|
6
7
|
function portPair() {
|
|
7
8
|
const listeners = [new Set(), new Set()];
|
|
8
9
|
const make = (mine, theirs) => ({
|
|
9
|
-
postMessage: (message) => {
|
|
10
|
-
// A structured clone, as a real port makes.
|
|
10
|
+
postMessage: (message, transfer) => {
|
|
11
|
+
// A structured clone, as a real port makes. Transferred ports arrive as they are.
|
|
11
12
|
const data = (0, node_v8_1.deserialize)((0, node_v8_1.serialize)(message));
|
|
13
|
+
const ports = (transfer ?? []);
|
|
12
14
|
setTimeout(() => {
|
|
13
15
|
for (const listener of theirs)
|
|
14
|
-
listener({ data });
|
|
16
|
+
listener({ data, ports });
|
|
15
17
|
}, 0);
|
|
16
18
|
},
|
|
17
19
|
addEventListener: (_type, listener) => mine.add(listener),
|
|
@@ -19,3 +21,23 @@ function portPair() {
|
|
|
19
21
|
});
|
|
20
22
|
return [make(listeners[0], listeners[1]), make(listeners[1], listeners[0])];
|
|
21
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Run an AudioWorklet module's source here, off any audio thread, and make one of the processors
|
|
26
|
+
* it registers, as the engine would.
|
|
27
|
+
*
|
|
28
|
+
* @param source - The module's source.
|
|
29
|
+
* @param sampleRate - The worklet scope's `sampleRate`.
|
|
30
|
+
*/
|
|
31
|
+
function loadWorkletProcessor(source, sampleRate) {
|
|
32
|
+
class AudioWorkletProcessor {
|
|
33
|
+
port = { onmessage: null };
|
|
34
|
+
}
|
|
35
|
+
let registered;
|
|
36
|
+
const registerProcessor = (_name, processor) => {
|
|
37
|
+
registered = processor;
|
|
38
|
+
};
|
|
39
|
+
new Function("AudioWorkletProcessor", "registerProcessor", "sampleRate", source)(AudioWorkletProcessor, registerProcessor, sampleRate);
|
|
40
|
+
if (!registered)
|
|
41
|
+
throw new Error("The module registered no processor");
|
|
42
|
+
return new registered();
|
|
43
|
+
}
|
|
@@ -55,7 +55,7 @@ function handleFrontDialogKeys(inside, onEscape) {
|
|
|
55
55
|
onEscape();
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
const controls = Array.from(front.querySelectorAll("button, input"));
|
|
58
|
+
const controls = Array.from(front.querySelectorAll("button:enabled, input:enabled"));
|
|
59
59
|
const active = document.activeElement;
|
|
60
60
|
const index = active instanceof HTMLElement ? controls.indexOf(active) : -1;
|
|
61
61
|
const next = e.shiftKey
|
|
@@ -166,7 +166,7 @@ function NotificationSettings() {
|
|
|
166
166
|
const key = `${source.match.groupId ?? ""}:${source.match.packageId ?? ""}:${source.match.fromUserId ?? ""}:${source.match.kind ?? ""}`;
|
|
167
167
|
return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-wrap align-items-center gap-2 px-2 py-2 border-bottom", children: [(0, jsx_runtime_1.jsx)("span", { className: "flex-grow-1 small", children: source.label }), (0, jsx_runtime_1.jsxs)("select", { className: "form-select form-select-sm", style: { width: "auto" }, "aria-label": `Level for ${source.label}`, value: rule?.level ?? "", onChange: (event) => setRule(source.match, {
|
|
168
168
|
level: (event.target.value || undefined),
|
|
169
|
-
}), children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: "As the app asks" }), ["priority", "loud", "quiet", "background", "off"].map((level) => ((0, jsx_runtime_1.jsx)("option", { value: level, children: levelLabels[level] }, level)))] }), source.match.fromUserId && ((0, jsx_runtime_1.jsxs)("label", { className: "form-check-label small d-flex align-items-center gap-
|
|
169
|
+
}), children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: "As the app asks" }), ["priority", "loud", "quiet", "background", "off"].map((level) => ((0, jsx_runtime_1.jsx)("option", { value: level, children: levelLabels[level] }, level)))] }), source.match.fromUserId && ((0, jsx_runtime_1.jsxs)("label", { className: "form-check form-switch form-check-label small d-flex align-items-center gap-2 m-0 ps-0", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", role: "switch", className: "form-check-input m-0", checked: rule?.allowPriority === true, "aria-checked": rule?.allowPriority === true, onChange: (event) => setRule(source.match, {
|
|
170
170
|
allowPriority: event.target.checked ? true : undefined,
|
|
171
171
|
}) }), "Allow priority"] }))] }, key));
|
|
172
172
|
})] })] })] }));
|
|
@@ -4,6 +4,8 @@ exports.DataExplorerList = DataExplorerList;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const loading_indicator_1 = require("../../components/loading-indicator");
|
|
7
|
+
const menu_button_1 = require("../../components/menu-button");
|
|
8
|
+
const screen_header_1 = require("../../components/screen-header");
|
|
7
9
|
const globals_1 = require("../../globals");
|
|
8
10
|
const ui_loader_1 = require("../../ui-router/ui-loader");
|
|
9
11
|
function getDataExplorerApi() {
|
|
@@ -42,6 +44,7 @@ function DeleteConfirmModal({ tableName, onConfirm, onCancel, }) {
|
|
|
42
44
|
// biome-ignore lint/a11y/noAutofocus: confirmation input needs immediate focus
|
|
43
45
|
autoFocus: true })] }), (0, jsx_runtime_1.jsxs)("div", { className: "card-footer d-flex justify-content-end gap-2", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-secondary", onClick: onCancel, disabled: deleting, children: "Cancel" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-danger", disabled: confirmText !== tableName || deleting, onClick: handleConfirm, children: deleting ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-1" }), "Deleting..."] })) : ("Delete Table") })] })] }) }));
|
|
44
46
|
}
|
|
47
|
+
/** Browses tables, storage use and change-history commands for the current desktop context. */
|
|
45
48
|
function DataExplorerList() {
|
|
46
49
|
const [tables, setTables] = (0, react_1.useState)([]);
|
|
47
50
|
const [deletedTables, setDeletedTables] = (0, react_1.useState)([]);
|
|
@@ -188,16 +191,31 @@ function DataExplorerList() {
|
|
|
188
191
|
}
|
|
189
192
|
const registeredTables = tables.filter((t) => t.isRegistered);
|
|
190
193
|
const unregisteredTables = tables.filter((t) => !t.isRegistered);
|
|
191
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
},
|
|
194
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-xxl p-3", children: [deleteTarget && ((0, jsx_runtime_1.jsx)(DeleteConfirmModal, { tableName: deleteTarget, onConfirm: handleDeleteTable, onCancel: () => setDeleteTarget(null) })), (0, jsx_runtime_1.jsx)(screen_header_1.ScreenHeader, { icon: "bi-database", title: "Data Explorer", subtitle: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [currentContext, " \u00B7 ", formatBytes(tables.reduce((sum, t) => sum + (t.bytes || 0), 0)), " in all"] }), actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-primary text-nowrap", onClick: () => {
|
|
195
|
+
setLoading(true);
|
|
196
|
+
loadTables();
|
|
197
|
+
}, disabled: compacting, children: compacting ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-1", "aria-hidden": "true" }), "Compacting\u2026"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-arrow-clockwise me-1", "aria-hidden": "true" }), "Refresh"] })) }), (0, jsx_runtime_1.jsx)(menu_button_1.MenuButton, { items: [
|
|
198
|
+
{
|
|
199
|
+
label: "Compact database (history over 2 weeks old)",
|
|
200
|
+
icon: "bi-disc",
|
|
201
|
+
disabled: compacting || loading,
|
|
202
|
+
onSelect: () => void compactDatabase(),
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: "Remove all change history",
|
|
206
|
+
icon: "bi-exclamation-triangle",
|
|
207
|
+
danger: true,
|
|
208
|
+
disabled: compacting || loading,
|
|
209
|
+
onSelect: () => void compactDatabase(Date.now()),
|
|
210
|
+
},
|
|
211
|
+
"divider",
|
|
212
|
+
{
|
|
213
|
+
label: "Reset change tracking",
|
|
214
|
+
icon: "bi-arrow-clockwise",
|
|
215
|
+
disabled: compacting || loading,
|
|
216
|
+
onSelect: () => void resetChangeTracking(),
|
|
217
|
+
},
|
|
218
|
+
] })] }) }), (0, jsx_runtime_1.jsxs)("ul", { className: "nav nav-tabs mb-4", children: [(0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: (0, jsx_runtime_1.jsxs)("a", { className: "nav-link active", href: "#/data-explorer", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-table" }), " Tables"] }) }), (0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: (0, jsx_runtime_1.jsxs)("a", { className: "nav-link", href: "#/data-explorer/query", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-terminal" }), " Query"] }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "card mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "card-body", children: [(0, jsx_runtime_1.jsxs)("h5", { className: "card-title", children: ["Registered Tables (", registeredTables.length, ")", (0, jsx_runtime_1.jsx)("span", { className: "badge bg-success ms-2", children: "Active" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted small", children: "These tables are registered with the TableContainer and actively used by the application." }), registeredTables.length === 0 ? ((0, jsx_runtime_1.jsx)("p", { className: "text-muted", children: "No registered tables found" })) : ((0, jsx_runtime_1.jsx)("div", { className: "table-responsive", children: (0, jsx_runtime_1.jsxs)("table", { className: "table table-hover table-sm", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "Table Name" }), (0, jsx_runtime_1.jsx)("th", { children: "Table ID" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Row Count" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Bytes" }), (0, jsx_runtime_1.jsx)("th", { style: { width: "1%" } })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: registeredTables.map((table) => ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("strong", { children: table.tableName }) }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("code", { className: "text-muted small", children: table.tableId || "system" }) }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: table.rowCount !== undefined ? table.rowCount.toLocaleString() : "-" }), (0, jsx_runtime_1.jsx)("td", { className: `text-end fw-bold ${getBytesColorClass(table.bytes)}`, children: formatBytes(table.bytes) }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-danger border-0", title: `Delete ${table.tableName}`, onClick: () => setDeleteTarget(table.tableName), children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-trash" }) }) })] }, table.tableName))) })] }) }))] }) }), unregisteredTables.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "card mb-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "card-body", children: [(0, jsx_runtime_1.jsxs)("h5", { className: "card-title", children: ["Unregistered Tables (", unregisteredTables.length, ")", (0, jsx_runtime_1.jsx)("span", { className: "badge bg-warning text-dark ms-2", children: "Raw SQLite" })] }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted small", children: "These tables exist in the SQLite database but are not registered with the TableContainer. They may be system tables, change tracking tables, or legacy tables." }), (0, jsx_runtime_1.jsx)("div", { className: "table-responsive", children: (0, jsx_runtime_1.jsxs)("table", { className: "table table-hover table-sm", children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "Table Name" }), (0, jsx_runtime_1.jsx)("th", { children: "Type" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Row Count" }), (0, jsx_runtime_1.jsx)("th", { className: "text-end", children: "Bytes" }), (0, jsx_runtime_1.jsx)("th", { children: "SQL Definition" }), (0, jsx_runtime_1.jsx)("th", { style: { width: "1%" } })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: unregisteredTables.map((table) => ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("strong", { children: table.tableName }) }), (0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)("span", { className: "badge bg-secondary", children: table.type || "table" }) }), (0, jsx_runtime_1.jsx)("td", { className: "text-end", children: table.rowCount !== undefined ? table.rowCount.toLocaleString() : "-" }), (0, jsx_runtime_1.jsx)("td", { className: `text-end fw-bold ${getBytesColorClass(table.bytes)}`, children: formatBytes(table.bytes) }), (0, jsx_runtime_1.jsx)("td", { children: table.sql ? ((0, jsx_runtime_1.jsxs)("details", { children: [(0, jsx_runtime_1.jsx)("summary", { className: "cursor-pointer text-primary", style: { cursor: "pointer" }, children: (0, jsx_runtime_1.jsx)("small", { children: "View SQL" }) }), (0, jsx_runtime_1.jsx)("pre", { className: "mt-2 p-2 bg-body-secondary border rounded", style: {
|
|
201
219
|
fontSize: "0.75rem",
|
|
202
220
|
maxHeight: "300px",
|
|
203
221
|
overflow: "auto",
|
|
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const loading_indicator_1 = require("../../components/loading-indicator");
|
|
8
|
+
const screen_header_1 = require("../../components/screen-header");
|
|
8
9
|
const globals_1 = require("../../globals");
|
|
9
10
|
const hooks_1 = require("../../hooks");
|
|
10
11
|
const ui_loader_1 = require("../../ui-router/ui-loader");
|
|
@@ -25,6 +26,7 @@ const queryTabs = (0, peers_sdk_1.groupDeviceVar)("dataExplorerQueryTabs", {
|
|
|
25
26
|
const activeQueryTabId = (0, peers_sdk_1.groupDeviceVar)("dataExplorerActiveQueryTab", {
|
|
26
27
|
defaultValue: "",
|
|
27
28
|
});
|
|
29
|
+
/** Runs SQL against the current desktop context and displays the results in query tabs. */
|
|
28
30
|
function QueryExecutor() {
|
|
29
31
|
(0, hooks_1.useObservable)(queryTabs);
|
|
30
32
|
(0, hooks_1.useObservable)(activeQueryTabId);
|
|
@@ -205,7 +207,7 @@ function QueryExecutor() {
|
|
|
205
207
|
if (!(0, globals_1.isDesktop)()) {
|
|
206
208
|
return ((0, jsx_runtime_1.jsx)("div", { className: "container-fluid p-4", children: (0, jsx_runtime_1.jsx)("div", { className: "alert alert-info", children: "Query Executor is only available in the desktop application." }) }));
|
|
207
209
|
}
|
|
208
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-
|
|
210
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "container-xxl p-3", children: [(0, jsx_runtime_1.jsx)(screen_header_1.ScreenHeader, { icon: "bi-database", title: "Data Explorer", subtitle: "Run SQL against this device's copy of the group's data" }), (0, jsx_runtime_1.jsxs)("ul", { className: "nav nav-tabs mb-4", children: [(0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: (0, jsx_runtime_1.jsxs)("a", { className: "nav-link", href: "#/data-explorer", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-table" }), " Tables"] }) }), (0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: (0, jsx_runtime_1.jsxs)("a", { className: "nav-link active", href: "#/data-explorer/query", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-terminal" }), " Query"] }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "mb-3", children: (0, jsx_runtime_1.jsxs)("ul", { className: "nav nav-tabs", children: [tabs.map((tab) => ((0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: (0, jsx_runtime_1.jsxs)("div", { className: `nav-link ${tab.id === activeTabId ? "active" : ""}`, style: { cursor: "pointer", display: "flex", alignItems: "center", gap: "8px" }, children: [(0, jsx_runtime_1.jsx)("span", { onClick: () => activeQueryTabId(tab.id), style: { flex: 1 }, children: tab.name }), tabs.length > 1 && ((0, jsx_runtime_1.jsx)("button", { className: "btn btn-sm p-0", onClick: (e) => {
|
|
209
211
|
e.stopPropagation();
|
|
210
212
|
closeTab(tab.id);
|
|
211
213
|
}, style: {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type GroupMemberRole, type IGroup, type UserContext } from "@peers-app/peers-sdk";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Search, summarize, and create groups owned by the signed-in user. The groups are listed in the
|
|
4
|
+
* person's order, and dragging one by its grip saves a new order (System Groups'
|
|
5
|
+
* `setGroupOrder`), which the group switcher and every app that lists groups follow.
|
|
6
|
+
*/
|
|
3
7
|
export declare function GroupList(props?: {
|
|
4
8
|
creating?: boolean;
|
|
5
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,7 +21,13 @@ export interface IGroupSummary {
|
|
|
17
21
|
/** Signed-in user's role in this group. */
|
|
18
22
|
myRole?: GroupMemberRole;
|
|
19
23
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Compact, fully clickable group summary row.
|
|
26
|
+
*
|
|
27
|
+
* @param summary - The group and its counts.
|
|
28
|
+
* @param arrangeable - Show the grip that drags it to a new place in the list.
|
|
29
|
+
*/
|
|
30
|
+
export declare function GroupSummaryRow({ summary, arrangeable, }: {
|
|
22
31
|
summary: IGroupSummary;
|
|
32
|
+
arrangeable?: boolean;
|
|
23
33
|
}): import("react/jsx-runtime").JSX.Element;
|