@peers-app/peers-ui 0.34.13 → 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/delegates/acts-for-you-panel.d.ts +2 -1
- package/dist/delegates/acts-for-you-panel.js +46 -17
- package/dist/delegates/delegate-request-dialog.d.ts +3 -1
- package/dist/delegates/delegate-request-dialog.js +6 -3
- 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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A search box: a magnifier at the left and the browser's own clear button. It only searches;
|
|
4
|
+
* a screen's actions (New, Add) are buttons in its header ({@link ScreenHeader}).
|
|
5
|
+
*
|
|
6
|
+
* @param props.value - What's typed.
|
|
7
|
+
* @param props.onChange - Called with the new text as the user types.
|
|
8
|
+
* @param props.placeholder - Its hint, also its name for assistive technology, such as
|
|
9
|
+
* "Search packages".
|
|
10
|
+
* @param props.autoFocus - Focus it when the screen opens.
|
|
11
|
+
* @param props.onKeyDown - Keys typed in the field, for a screen that moves through its results.
|
|
12
|
+
* @param props.className - Classes for the field's wrapper, in place of its bottom margin
|
|
13
|
+
* (`mb-3`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function SearchField(props: {
|
|
16
|
+
value: string;
|
|
17
|
+
onChange: (value: string) => void;
|
|
18
|
+
placeholder: string;
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchField = SearchField;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* A search box: a magnifier at the left and the browser's own clear button. It only searches;
|
|
7
|
+
* a screen's actions (New, Add) are buttons in its header ({@link ScreenHeader}).
|
|
8
|
+
*
|
|
9
|
+
* @param props.value - What's typed.
|
|
10
|
+
* @param props.onChange - Called with the new text as the user types.
|
|
11
|
+
* @param props.placeholder - Its hint, also its name for assistive technology, such as
|
|
12
|
+
* "Search packages".
|
|
13
|
+
* @param props.autoFocus - Focus it when the screen opens.
|
|
14
|
+
* @param props.onKeyDown - Keys typed in the field, for a screen that moves through its results.
|
|
15
|
+
* @param props.className - Classes for the field's wrapper, in place of its bottom margin
|
|
16
|
+
* (`mb-3`).
|
|
17
|
+
*/
|
|
18
|
+
function SearchField(props) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `position-relative ${props.className ?? "mb-3"}`, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-search position-absolute text-body-secondary", style: { left: 12, top: "50%", transform: "translateY(-50%)", pointerEvents: "none" }, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("input", { type: "search", className: "form-control ps-5", value: props.value, onChange: (event) => props.onChange(event.target.value), onKeyDown: props.onKeyDown, placeholder: props.placeholder, "aria-label": props.placeholder,
|
|
20
|
+
// biome-ignore lint/a11y/noAutofocus: a list screen's search takes the keyboard on the desktop, as before
|
|
21
|
+
autoFocus: props.autoFocus })] }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** One choice in a {@link SegmentedControl}. */
|
|
2
|
+
export interface SegmentedChoice<T extends string> {
|
|
3
|
+
/** The value it stands for. */
|
|
4
|
+
value: T;
|
|
5
|
+
/** What it says. */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Two to four named choices side by side, one of them on: a compact control for a setting with
|
|
10
|
+
* a few values, such as a look ("Simple" or "With shortcuts"). Each choice is a button with
|
|
11
|
+
* `aria-pressed`, inside a group named by `label`.
|
|
12
|
+
*
|
|
13
|
+
* @param props.label - The setting's name, for assistive technology.
|
|
14
|
+
* @param props.choices - The choices, in order.
|
|
15
|
+
* @param props.value - The choice that's on.
|
|
16
|
+
* @param props.onChange - Called with the choice picked.
|
|
17
|
+
* @param props.className - Classes added to the group, such as `flex-grow-1` to fill a row.
|
|
18
|
+
*/
|
|
19
|
+
export declare function SegmentedControl<T extends string>(props: {
|
|
20
|
+
label: string;
|
|
21
|
+
choices: readonly SegmentedChoice<T>[];
|
|
22
|
+
value: T;
|
|
23
|
+
onChange: (value: T) => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SegmentedControl = SegmentedControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* Two to four named choices side by side, one of them on: a compact control for a setting with
|
|
7
|
+
* a few values, such as a look ("Simple" or "With shortcuts"). Each choice is a button with
|
|
8
|
+
* `aria-pressed`, inside a group named by `label`.
|
|
9
|
+
*
|
|
10
|
+
* @param props.label - The setting's name, for assistive technology.
|
|
11
|
+
* @param props.choices - The choices, in order.
|
|
12
|
+
* @param props.value - The choice that's on.
|
|
13
|
+
* @param props.onChange - Called with the choice picked.
|
|
14
|
+
* @param props.className - Classes added to the group, such as `flex-grow-1` to fill a row.
|
|
15
|
+
*/
|
|
16
|
+
function SegmentedControl(props) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `peers-segmented ${props.className ?? ""}`, role: "group", "aria-label": props.label, children: props.choices.map((choice) => ((0, jsx_runtime_1.jsx)("button", { type: "button", "aria-pressed": choice.value === props.value, onClick: () => props.onChange(choice.value), children: choice.label }, choice.value))) }));
|
|
18
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
+
/** A choice in a {@link Typeahead}: anything with an id. */
|
|
2
3
|
export interface TypeaheadItem {
|
|
4
|
+
/** Identifies the choice among the results and the picks. */
|
|
3
5
|
id: string;
|
|
4
6
|
[key: string]: unknown;
|
|
5
7
|
}
|
|
@@ -18,5 +20,12 @@ interface TypeaheadProps<T extends TypeaheadItem> {
|
|
|
18
20
|
debounceMs?: number;
|
|
19
21
|
maxResults?: number;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A search box that picks one or several items from async results, shown as badges.
|
|
25
|
+
*
|
|
26
|
+
* @deprecated Use `Autocomplete` (peers-ui's standard picker): it keeps the pick in the box,
|
|
27
|
+
* supports sections, a footer and keys, and portals its popup. Typeahead stays for packages that
|
|
28
|
+
* still use it.
|
|
29
|
+
*/
|
|
21
30
|
export declare function Typeahead<T extends TypeaheadItem>(props: TypeaheadProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
31
|
export {};
|
|
@@ -55,6 +55,13 @@ const typeaheadStyles = `
|
|
|
55
55
|
white-space: nowrap;
|
|
56
56
|
}
|
|
57
57
|
`;
|
|
58
|
+
/**
|
|
59
|
+
* A search box that picks one or several items from async results, shown as badges.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Use `Autocomplete` (peers-ui's standard picker): it keeps the pick in the box,
|
|
62
|
+
* supports sections, a footer and keys, and portals its popup. Typeahead stays for packages that
|
|
63
|
+
* still use it.
|
|
64
|
+
*/
|
|
58
65
|
function Typeahead(props) {
|
|
59
66
|
const { placeholder = "Search...", searchFn, onSelectionChange, renderItem, renderBadge, selectedItems = [], multiSelect = false, maxSelections, className = "form-control", disabled = false, minSearchLength = 1, debounceMs = 300, maxResults = 10, } = props;
|
|
60
67
|
const [query, setQuery] = (0, react_1.useState)("");
|
|
@@ -7,6 +7,7 @@ export interface IActsForYouPanelProps {
|
|
|
7
7
|
/**
|
|
8
8
|
* The package page's "Acts for you" setting, for the group the Packages screen shows. Shown when
|
|
9
9
|
* the package asks to act for the person or already has a grant here; a host without System
|
|
10
|
-
* Delegates shows nothing.
|
|
10
|
+
* Delegates shows nothing. In Personal, the person's other groups follow, each with its own
|
|
11
|
+
* grant: a package installed in Personal can act for them in any of their groups.
|
|
11
12
|
*/
|
|
12
13
|
export declare function ActsForYouPanel(props: IActsForYouPanelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -5,14 +5,15 @@ 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 globals_1 = require("../globals");
|
|
8
|
-
const
|
|
8
|
+
const groups_client_1 = require("../groups/groups-client");
|
|
9
9
|
const use_host_contract_1 = require("../hooks/use-host-contract");
|
|
10
10
|
const acts_for_you_control_1 = require("./acts-for-you-control");
|
|
11
11
|
const delegates_ipc_1 = require("./delegates-ipc");
|
|
12
12
|
/**
|
|
13
13
|
* The package page's "Acts for you" setting, for the group the Packages screen shows. Shown when
|
|
14
14
|
* the package asks to act for the person or already has a grant here; a host without System
|
|
15
|
-
* Delegates shows nothing.
|
|
15
|
+
* Delegates shows nothing. In Personal, the person's other groups follow, each with its own
|
|
16
|
+
* grant: a package installed in Personal can act for them in any of their groups.
|
|
16
17
|
*/
|
|
17
18
|
function ActsForYouPanel(props) {
|
|
18
19
|
const [dataContextId, setDataContextId] = (0, react_1.useState)();
|
|
@@ -31,20 +32,21 @@ function ActsForYouPanel(props) {
|
|
|
31
32
|
return (0, jsx_runtime_1.jsx)(ActsForYouPanelIn, { ...props, dataContextId: dataContextId });
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
-
* live one: it reads the grant again and hears its changes.
|
|
35
|
+
* A package's grant in one context. The consumer follows the host connection, so a reconnect
|
|
36
|
+
* gives it a live one: it reads the grant again and hears its changes.
|
|
37
|
+
*
|
|
38
|
+
* @param dataContextId The group, or the personal context.
|
|
39
|
+
* @param packageId The package.
|
|
36
40
|
*/
|
|
37
|
-
function
|
|
38
|
-
const { dataContextId } = props;
|
|
39
|
-
const [groupList] = (0, hooks_1.useObservable)(globals_1.groups);
|
|
41
|
+
function useDelegateGrant(dataContextId, packageId) {
|
|
40
42
|
const { consumer } = (0, use_host_contract_1.useHostContract)((0, delegates_ipc_1.delegatesContractFor)(dataContextId));
|
|
41
43
|
const [state, setState] = (0, react_1.useState)();
|
|
42
|
-
const [
|
|
44
|
+
const [version, setVersion] = (0, react_1.useState)(0);
|
|
43
45
|
(0, react_1.useEffect)(() => {
|
|
44
46
|
if (!consumer)
|
|
45
47
|
return;
|
|
46
48
|
let cancelled = false;
|
|
47
|
-
consumer.tools.getGrant({ packageId
|
|
49
|
+
consumer.tools.getGrant({ packageId }).then((result) => {
|
|
48
50
|
if (!cancelled)
|
|
49
51
|
setState(result);
|
|
50
52
|
}, () => {
|
|
@@ -54,23 +56,50 @@ function ActsForYouPanelIn(props) {
|
|
|
54
56
|
return () => {
|
|
55
57
|
cancelled = true;
|
|
56
58
|
};
|
|
57
|
-
}, [consumer,
|
|
59
|
+
}, [consumer, packageId, version]);
|
|
58
60
|
(0, react_1.useEffect)(() => {
|
|
59
61
|
if (!consumer)
|
|
60
62
|
return;
|
|
61
63
|
const subscription = consumer.events.changed.subscribe((event) => {
|
|
62
|
-
if (event.packageId ===
|
|
63
|
-
|
|
64
|
+
if (event.packageId === packageId && event.dataContextId === dataContextId)
|
|
65
|
+
setVersion((value) => value + 1);
|
|
64
66
|
});
|
|
65
67
|
return () => {
|
|
66
68
|
subscription.unsubscribe();
|
|
67
69
|
};
|
|
68
|
-
}, [consumer,
|
|
70
|
+
}, [consumer, packageId, dataContextId]);
|
|
71
|
+
return { consumer, state, refresh: () => setVersion((value) => value + 1) };
|
|
72
|
+
}
|
|
73
|
+
/** The panel for one group. */
|
|
74
|
+
function ActsForYouPanelIn(props) {
|
|
75
|
+
const { dataContextId } = props;
|
|
76
|
+
const groupList = (0, groups_client_1.useGroups)();
|
|
77
|
+
const { consumer, state, refresh } = useDelegateGrant(dataContextId, props.packageId);
|
|
69
78
|
if (!consumer || !state || (!state.request && !state.grant))
|
|
70
79
|
return null;
|
|
71
|
-
const
|
|
72
|
-
|
|
80
|
+
const inPersonal = dataContextId === globals_1.me?.userId;
|
|
81
|
+
const group = (groupList ?? (0, globals_1.groups)()).find((entry) => entry.groupId === dataContextId);
|
|
82
|
+
const others = inPersonal ? groupList?.filter((entry) => !entry.personal) : undefined;
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "mt-3", "data-testid": "acts-for-you-panel", children: [(0, jsx_runtime_1.jsx)("hr", {}), (0, jsx_runtime_1.jsx)("h6", { children: "Acts for you" }), state.request && ((0, jsx_runtime_1.jsxs)("p", { className: "small text-muted mb-2", children: [props.packageName, " asks: \u201C", state.request.why, "\u201D"] })), (0, jsx_runtime_1.jsx)(acts_for_you_control_1.ActsForYouControl, { packageName: props.packageName, dataContextName: inPersonal ? "Personal" : group?.name || dataContextId, grant: state.grant, userAccessLevel: state.userAccessLevel ?? 0, onChoose: async (choice) => {
|
|
73
84
|
await (0, delegates_ipc_1.applyActsForYouChoice)(consumer, { packageId: props.packageId, dataContextId }, state.grant, choice);
|
|
74
|
-
|
|
75
|
-
} })] }));
|
|
85
|
+
refresh();
|
|
86
|
+
} }), others && others.length > 0 && ((0, jsx_runtime_1.jsx)(OtherGroups, { packageId: props.packageId, packageName: props.packageName, groups: others }))] }));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The person's other groups, for a package installed in their Personal: a line each saying what
|
|
90
|
+
* the package may do there, with the group's own control behind "Change". Each starts Off.
|
|
91
|
+
*/
|
|
92
|
+
function OtherGroups(props) {
|
|
93
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "mt-3", "data-testid": "acts-for-you-groups", children: [(0, jsx_runtime_1.jsx)("div", { className: "small fw-semibold mb-1", children: "In your other groups" }), (0, jsx_runtime_1.jsx)("ul", { className: "list-unstyled mb-0", children: props.groups.map((group) => ((0, jsx_runtime_1.jsx)(OtherGroupGrant, { packageId: props.packageId, packageName: props.packageName, group: group }, group.groupId))) }), (0, jsx_runtime_1.jsx)("div", { className: "form-text", children: "Each group has its own setting, and each applies on this device only." })] }));
|
|
94
|
+
}
|
|
95
|
+
/** One group's line in {@link OtherGroups}. */
|
|
96
|
+
function OtherGroupGrant(props) {
|
|
97
|
+
const { group } = props;
|
|
98
|
+
const { consumer, state, refresh } = useDelegateGrant(group.groupId, props.packageId);
|
|
99
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
100
|
+
const name = group.name || group.groupId;
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("li", { className: "mb-1", "data-testid": `acts-for-you-group-${group.groupId}`, children: [(0, jsx_runtime_1.jsxs)("span", { children: [name, ": ", (0, jsx_runtime_1.jsx)("strong", { children: state ? (0, acts_for_you_control_1.actsForYouSummary)(state.grant) : "…" })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-link btn-sm py-0", disabled: !consumer || !state, "aria-expanded": open, onClick: () => setOpen((value) => !value), children: open ? "Done" : "Change" }), open && consumer && state && ((0, jsx_runtime_1.jsx)("div", { className: "ms-3 mt-1 mb-2", children: (0, jsx_runtime_1.jsx)(acts_for_you_control_1.ActsForYouControl, { packageName: props.packageName, dataContextName: name, grant: state.grant, userAccessLevel: state.userAccessLevel ?? 0, onChoose: async (choice) => {
|
|
102
|
+
await (0, delegates_ipc_1.applyActsForYouChoice)(consumer, { packageId: props.packageId, dataContextId: group.groupId }, state.grant, choice);
|
|
103
|
+
refresh();
|
|
104
|
+
} }) }))] }));
|
|
76
105
|
}
|
|
@@ -10,8 +10,10 @@ export declare function DelegateRequestDialog(): import("react/jsx-runtime").JSX
|
|
|
10
10
|
/** Props for {@link DelegateRequestDialogView}. */
|
|
11
11
|
export interface IDelegateRequestDialogViewProps {
|
|
12
12
|
request: IDelegatePendingRequest;
|
|
13
|
+
/** Whether the request is for the person's Personal, whose package page lists their groups. */
|
|
14
|
+
inPersonal?: boolean;
|
|
13
15
|
onChoose: React.ComponentProps<typeof ActsForYouControl>["onChoose"];
|
|
14
16
|
onClose: () => void;
|
|
15
17
|
}
|
|
16
18
|
/** The dialog's content for one request. Focus starts on "Not now" and stays inside; Escape closes. */
|
|
17
|
-
export declare function DelegateRequestDialogView({ request, onChoose, onClose, }: IDelegateRequestDialogViewProps): React.ReactPortal;
|
|
19
|
+
export declare function DelegateRequestDialogView({ request, inPersonal, onChoose, onClose, }: IDelegateRequestDialogViewProps): React.ReactPortal;
|
|
@@ -5,6 +5,7 @@ exports.DelegateRequestDialogView = DelegateRequestDialogView;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const react_dom_1 = require("react-dom");
|
|
8
|
+
const globals_1 = require("../globals");
|
|
8
9
|
const hooks_1 = require("../hooks");
|
|
9
10
|
const use_host_contract_1 = require("../hooks/use-host-contract");
|
|
10
11
|
const global_overlays_1 = require("../root-layout/global-overlays");
|
|
@@ -20,10 +21,10 @@ function DelegateRequestDialog() {
|
|
|
20
21
|
const [request] = (0, hooks_1.useObservable)(consumer?.observables.pendingRequest ?? null);
|
|
21
22
|
if (!consumer || !request)
|
|
22
23
|
return null;
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(DelegateRequestDialogView, { request: request, onChoose: (choice) => (0, delegates_ipc_1.applyActsForYouChoice)(consumer, { packageId: request.packageId, dataContextId: request.dataContextId }, request.grant, choice), onClose: () => void consumer.tools.dismissRequest({ requestId: request.requestId }) }, request.requestId));
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(DelegateRequestDialogView, { request: request, inPersonal: request.dataContextId === globals_1.me?.userId, onChoose: (choice) => (0, delegates_ipc_1.applyActsForYouChoice)(consumer, { packageId: request.packageId, dataContextId: request.dataContextId }, request.grant, choice), onClose: () => void consumer.tools.dismissRequest({ requestId: request.requestId }) }, request.requestId));
|
|
24
25
|
}
|
|
25
26
|
/** The dialog's content for one request. Focus starts on "Not now" and stays inside; Escape closes. */
|
|
26
|
-
function DelegateRequestDialogView({ request, onChoose, onClose, }) {
|
|
27
|
+
function DelegateRequestDialogView({ request, inPersonal = false, onChoose, onClose, }) {
|
|
27
28
|
const notNowRef = (0, react_1.useRef)(null);
|
|
28
29
|
(0, react_1.useEffect)(() => {
|
|
29
30
|
notNowRef.current?.focus();
|
|
@@ -55,6 +56,8 @@ function DelegateRequestDialogView({ request, onChoose, onClose, }) {
|
|
|
55
56
|
(0, jsx_runtime_1.jsx)("div", { className: "peers-apps-dialog-backdrop", onMouseDown: (event) => {
|
|
56
57
|
if (event.target === event.currentTarget)
|
|
57
58
|
onClose();
|
|
58
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "peers-apps-dialog text-body", role: "dialog", tabIndex: -1, "aria-modal": "true", "aria-labelledby": "peers-delegate-request-title", onKeyDown: onKeyDown, "data-testid": "delegate-request-dialog", children: [(0, jsx_runtime_1.jsx)("div", { className: "peers-apps-dialog-head", children: (0, jsx_runtime_1.jsxs)("h3", { id: "peers-delegate-request-title", children: ["Let ", name, " act for you in ", request.dataContextName, "?"] }) }), (0, jsx_runtime_1.jsxs)("p", { children: [name, " asks for ", (0, delegates_ipc_1.actsForYouLabel)(request.request.level), ": \u201C", request.request.why, "\u201D"] }), (0, jsx_runtime_1.jsxs)("p", { children: ["It would use the tools your other apps provide, such as Tasks, Calendar and Notes, as you, up to the level you pick. You can change it any time on ", name, "'s page in Packages
|
|
59
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "peers-apps-dialog text-body", role: "dialog", tabIndex: -1, "aria-modal": "true", "aria-labelledby": "peers-delegate-request-title", onKeyDown: onKeyDown, "data-testid": "delegate-request-dialog", children: [(0, jsx_runtime_1.jsx)("div", { className: "peers-apps-dialog-head", children: (0, jsx_runtime_1.jsxs)("h3", { id: "peers-delegate-request-title", children: ["Let ", name, " act for you in ", request.dataContextName, "?"] }) }), (0, jsx_runtime_1.jsxs)("p", { children: [name, " asks for ", (0, delegates_ipc_1.actsForYouLabel)(request.request.level), ": \u201C", request.request.why, "\u201D"] }), (0, jsx_runtime_1.jsxs)("p", { children: ["It would use the tools your other apps provide, such as Tasks, Calendar and Notes, as you, up to the level you pick. You can change it any time on ", name, "'s page in Packages", inPersonal
|
|
60
|
+
? ", where you can also let it act for you in your other groups, each on its own."
|
|
61
|
+
: "."] }), (0, jsx_runtime_1.jsx)(acts_for_you_control_1.ActsForYouControl, { packageName: name, dataContextName: request.dataContextName, grant: request.grant, userAccessLevel: request.userAccessLevel, onChoose: onChoose }), (0, jsx_runtime_1.jsx)("div", { className: "peers-apps-dialog-actions mt-3", children: (0, jsx_runtime_1.jsx)("button", { ref: notNowRef, type: "button", className: "btn peers-apps-ghost", onClick: onClose, children: "Not now" }) })] }) }), document.body);
|
|
59
62
|
}
|
|
60
63
|
(0, global_overlays_1.registerGlobalOverlay)("system-delegates-request", DelegateRequestDialog);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IGroupInfo, type IGroupsConsumer, type IHostContractConsumer, type Observable } from "@peers-app/peers-sdk";
|
|
1
|
+
import { type IGroupInfo, type IGroupsConsumer, type IHostContractConsumer, type IOrderableGroup, type Observable } from "@peers-app/peers-sdk";
|
|
2
2
|
/**
|
|
3
3
|
* System Groups bound to the person's Personal context, so it lists every group they're in.
|
|
4
4
|
* Stable, for `useHostContract`.
|
|
@@ -27,3 +27,25 @@ export declare function useGroups(): IGroupInfo[] | undefined;
|
|
|
27
27
|
export declare function useGroup(groupId: string | undefined): IGroupInfo | undefined;
|
|
28
28
|
/** The System Groups tools, bound to Personal. */
|
|
29
29
|
export declare function groupsTools(): Promise<IGroupsConsumer["tools"]>;
|
|
30
|
+
/**
|
|
31
|
+
* The person's group order as System Groups lists it: the ids of their groups but Personal, in
|
|
32
|
+
* the order they put them in. Empty before System Groups answers, and on a Peers without it.
|
|
33
|
+
*
|
|
34
|
+
* @param listed - System Groups' list ({@link useGroups}).
|
|
35
|
+
*/
|
|
36
|
+
export declare function listedGroupOrder(listed: readonly IGroupInfo[] | undefined): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Things that each belong to a group, in the person's group order: Personal first, then the
|
|
39
|
+
* order's groups, then the rest by name (all by name, with no order).
|
|
40
|
+
*
|
|
41
|
+
* @param items - What to order; not changed.
|
|
42
|
+
* @param order - Group ids in order ({@link listedGroupOrder}).
|
|
43
|
+
* @param groupOf - An item's group: its id, name, and whether it's Personal.
|
|
44
|
+
*/
|
|
45
|
+
export declare function inGroupOrder<T>(items: readonly T[], order: readonly string[], groupOf: (item: T) => IOrderableGroup): T[];
|
|
46
|
+
/**
|
|
47
|
+
* Save the order the person's groups are listed in, everywhere that lists them.
|
|
48
|
+
*
|
|
49
|
+
* @param groupIds - Their groups' ids in order, Personal left out.
|
|
50
|
+
*/
|
|
51
|
+
export declare function saveGroupOrder(groupIds: string[]): Promise<void>;
|
|
@@ -5,6 +5,9 @@ exports.groupsObservable = groupsObservable;
|
|
|
5
5
|
exports.useGroups = useGroups;
|
|
6
6
|
exports.useGroup = useGroup;
|
|
7
7
|
exports.groupsTools = groupsTools;
|
|
8
|
+
exports.listedGroupOrder = listedGroupOrder;
|
|
9
|
+
exports.inGroupOrder = inGroupOrder;
|
|
10
|
+
exports.saveGroupOrder = saveGroupOrder;
|
|
8
11
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
9
12
|
const use_observable_1 = require("../hooks/use-observable");
|
|
10
13
|
/**
|
|
@@ -79,3 +82,31 @@ function useGroup(groupId) {
|
|
|
79
82
|
async function groupsTools() {
|
|
80
83
|
return (await exports.groupsContract.get()).tools;
|
|
81
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* The person's group order as System Groups lists it: the ids of their groups but Personal, in
|
|
87
|
+
* the order they put them in. Empty before System Groups answers, and on a Peers without it.
|
|
88
|
+
*
|
|
89
|
+
* @param listed - System Groups' list ({@link useGroups}).
|
|
90
|
+
*/
|
|
91
|
+
function listedGroupOrder(listed) {
|
|
92
|
+
return (listed ?? []).filter((group) => !group.personal).map((group) => group.groupId);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Things that each belong to a group, in the person's group order: Personal first, then the
|
|
96
|
+
* order's groups, then the rest by name (all by name, with no order).
|
|
97
|
+
*
|
|
98
|
+
* @param items - What to order; not changed.
|
|
99
|
+
* @param order - Group ids in order ({@link listedGroupOrder}).
|
|
100
|
+
* @param groupOf - An item's group: its id, name, and whether it's Personal.
|
|
101
|
+
*/
|
|
102
|
+
function inGroupOrder(items, order, groupOf) {
|
|
103
|
+
return (0, peers_sdk_1.orderGroups)(items.map((item) => ({ ...groupOf(item), item })), order).map((entry) => entry.item);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Save the order the person's groups are listed in, everywhere that lists them.
|
|
107
|
+
*
|
|
108
|
+
* @param groupIds - Their groups' ids in order, Personal left out.
|
|
109
|
+
*/
|
|
110
|
+
async function saveGroupOrder(groupIds) {
|
|
111
|
+
await (await groupsTools()).setGroupOrder({ groupIds });
|
|
112
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
export { type Command, executeCommand, registerCommand, unregisterCommand, } from "./command-palette/command-palette";
|
|
2
|
+
export { Autocomplete, type AutocompleteOptionState, type AutocompleteProps, HighlightMatch, } from "./components/autocomplete";
|
|
3
|
+
export * from "./components/autocomplete-chips";
|
|
2
4
|
export * from "./components/color-picker";
|
|
5
|
+
export * from "./components/confirm-button";
|
|
3
6
|
export * from "./components/data-grid";
|
|
7
|
+
export * from "./components/empty-state";
|
|
4
8
|
export * from "./components/icon";
|
|
5
9
|
export * from "./components/icon-picker";
|
|
6
10
|
export { configureIconSearchIndexes, type IconSearchIndexSource, type IIconSearchIndexSources, } from "./components/icon-search";
|
|
11
|
+
export * from "./components/inline-create-form";
|
|
7
12
|
export * from "./components/inverse-lazy-list";
|
|
13
|
+
export * from "./components/list-row";
|
|
8
14
|
export type { IEditorEffects, IMarkdownEditorProps, IMarkdownFormatRowProps, } from "./components/markdown-editor/editor";
|
|
9
15
|
export { MarkdownEditor, MarkdownFormatRow } from "./components/markdown-editor/editor";
|
|
10
16
|
export * from "./components/markdown-editor/editor-inline";
|
|
11
17
|
export type { EditorFormat, IFormatState, ISelectionAction, } from "./components/markdown-editor/format";
|
|
12
18
|
export { ALL_FORMATS, INLINE_FORMATS } from "./components/markdown-editor/format";
|
|
13
19
|
export * from "./components/markdown-with-mentions";
|
|
20
|
+
export * from "./components/menu-button";
|
|
14
21
|
export * from "./components/responsive-section-nav";
|
|
22
|
+
export * from "./components/screen-header";
|
|
23
|
+
export * from "./components/search-field";
|
|
24
|
+
export * from "./components/segmented-control";
|
|
15
25
|
export * from "./components/sortable-list";
|
|
16
26
|
export * from "./components/tabs";
|
|
17
27
|
export { Typeahead, type TypeaheadItem } from "./components/typeahead";
|
package/dist/index.js
CHANGED
|
@@ -14,20 +14,29 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.inspectUI = exports.FRAME_SELECTOR_PREFIX = exports.actOnUI = exports.updateActiveTabTitle = exports.goToTabPath = exports.closeCurrentTab = exports.activeTabs = exports.activeTabId = exports.setRootLayout = exports.selectedRootLayoutId = exports.getRootLayouts = exports.getRootLayout = exports.DEFAULT_ROOT_LAYOUT_ID = exports.TabsLayoutApp = exports.RootLayoutHost = exports.LayoutPicker = exports.unregisterGlobalOverlay = exports.registerGlobalOverlay = exports.globalOverlays = exports.notificationHostControls = exports.openMention = exports.useMentionPlace = exports.MentionGroupContext = exports.MentionChip = exports.openLink = exports.windowWidth = exports.windowHeight = exports.mainContentPath = exports.isDesktop = exports.Typeahead = exports.INLINE_FORMATS = exports.ALL_FORMATS = exports.MarkdownFormatRow = exports.MarkdownEditor = exports.configureIconSearchIndexes = exports.unregisterCommand = exports.registerCommand = exports.executeCommand = void 0;
|
|
17
|
+
exports.inspectUI = exports.FRAME_SELECTOR_PREFIX = exports.actOnUI = exports.updateActiveTabTitle = exports.goToTabPath = exports.closeCurrentTab = exports.activeTabs = exports.activeTabId = exports.setRootLayout = exports.selectedRootLayoutId = exports.getRootLayouts = exports.getRootLayout = exports.DEFAULT_ROOT_LAYOUT_ID = exports.TabsLayoutApp = exports.RootLayoutHost = exports.LayoutPicker = exports.unregisterGlobalOverlay = exports.registerGlobalOverlay = exports.globalOverlays = exports.notificationHostControls = exports.openMention = exports.useMentionPlace = exports.MentionGroupContext = exports.MentionChip = exports.openLink = exports.windowWidth = exports.windowHeight = exports.mainContentPath = exports.isDesktop = exports.Typeahead = exports.INLINE_FORMATS = exports.ALL_FORMATS = exports.MarkdownFormatRow = exports.MarkdownEditor = exports.configureIconSearchIndexes = exports.HighlightMatch = exports.Autocomplete = exports.unregisterCommand = exports.registerCommand = exports.executeCommand = void 0;
|
|
18
18
|
// Commands in the command palette, with optional shortcuts. From a package's frame they go to the
|
|
19
19
|
// host's palette, under the package's name.
|
|
20
20
|
var command_palette_1 = require("./command-palette/command-palette");
|
|
21
21
|
Object.defineProperty(exports, "executeCommand", { enumerable: true, get: function () { return command_palette_1.executeCommand; } });
|
|
22
22
|
Object.defineProperty(exports, "registerCommand", { enumerable: true, get: function () { return command_palette_1.registerCommand; } });
|
|
23
23
|
Object.defineProperty(exports, "unregisterCommand", { enumerable: true, get: function () { return command_palette_1.unregisterCommand; } });
|
|
24
|
+
// The standard picker: one item from a list, by typing (data-grid re-exports Autocomplete too).
|
|
25
|
+
var autocomplete_1 = require("./components/autocomplete");
|
|
26
|
+
Object.defineProperty(exports, "Autocomplete", { enumerable: true, get: function () { return autocomplete_1.Autocomplete; } });
|
|
27
|
+
Object.defineProperty(exports, "HighlightMatch", { enumerable: true, get: function () { return autocomplete_1.HighlightMatch; } });
|
|
28
|
+
__exportStar(require("./components/autocomplete-chips"), exports);
|
|
24
29
|
__exportStar(require("./components/color-picker"), exports);
|
|
30
|
+
__exportStar(require("./components/confirm-button"), exports);
|
|
25
31
|
__exportStar(require("./components/data-grid"), exports);
|
|
32
|
+
__exportStar(require("./components/empty-state"), exports);
|
|
26
33
|
__exportStar(require("./components/icon"), exports);
|
|
27
34
|
__exportStar(require("./components/icon-picker"), exports);
|
|
28
35
|
var icon_search_1 = require("./components/icon-search");
|
|
29
36
|
Object.defineProperty(exports, "configureIconSearchIndexes", { enumerable: true, get: function () { return icon_search_1.configureIconSearchIndexes; } });
|
|
37
|
+
__exportStar(require("./components/inline-create-form"), exports);
|
|
30
38
|
__exportStar(require("./components/inverse-lazy-list"), exports);
|
|
39
|
+
__exportStar(require("./components/list-row"), exports);
|
|
31
40
|
var editor_1 = require("./components/markdown-editor/editor");
|
|
32
41
|
Object.defineProperty(exports, "MarkdownEditor", { enumerable: true, get: function () { return editor_1.MarkdownEditor; } });
|
|
33
42
|
Object.defineProperty(exports, "MarkdownFormatRow", { enumerable: true, get: function () { return editor_1.MarkdownFormatRow; } });
|
|
@@ -36,7 +45,11 @@ var format_1 = require("./components/markdown-editor/format");
|
|
|
36
45
|
Object.defineProperty(exports, "ALL_FORMATS", { enumerable: true, get: function () { return format_1.ALL_FORMATS; } });
|
|
37
46
|
Object.defineProperty(exports, "INLINE_FORMATS", { enumerable: true, get: function () { return format_1.INLINE_FORMATS; } });
|
|
38
47
|
__exportStar(require("./components/markdown-with-mentions"), exports);
|
|
48
|
+
__exportStar(require("./components/menu-button"), exports);
|
|
39
49
|
__exportStar(require("./components/responsive-section-nav"), exports);
|
|
50
|
+
__exportStar(require("./components/screen-header"), exports);
|
|
51
|
+
__exportStar(require("./components/search-field"), exports);
|
|
52
|
+
__exportStar(require("./components/segmented-control"), exports);
|
|
40
53
|
__exportStar(require("./components/sortable-list"), exports);
|
|
41
54
|
__exportStar(require("./components/tabs"), exports);
|
|
42
55
|
var typeahead_1 = require("./components/typeahead");
|
|
@@ -12,17 +12,9 @@ let runtimeSource;
|
|
|
12
12
|
* can't do for it yet. The list only shrinks: each entry goes when its reason does.
|
|
13
13
|
*/
|
|
14
14
|
exports.SHARED_WINDOW_PACKAGES = new Map([
|
|
15
|
-
[
|
|
16
|
-
"00mwi9ux5ate4rpcr26wdedph",
|
|
17
|
-
"Operator: Talk uses the microphone, which a frame's opaque origin can't open (Chromium and WebKit refuse it even with allow=microphone), and its settings write a secret variable (the OpenAI key), which frames can't. Its declared widget draws in the window.",
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
"00mp0gayf4f9hotacqsobyv6w",
|
|
21
|
-
"Voice Hub: it uses the microphone and wake word models, and reads its skills' widgets' DOM (Voice Skill widgets as a UI contract, embedded-ui.md slice 5)",
|
|
22
|
-
],
|
|
23
15
|
[
|
|
24
16
|
"00mkhtkl95byv5o2xsw12mi2x",
|
|
25
|
-
"Family Hub: it
|
|
17
|
+
"Family Hub: it uses Electron's <webview> for Google Photos short links and the any-page screensaver (a host-drawn web view is task 00mvik93fo14vuz86fnyzi22k), and draws an older Voice Skill provider's widget by UI id",
|
|
26
18
|
],
|
|
27
19
|
]);
|
|
28
20
|
/**
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ILocalFolderGrantInfo } from "@peers-app/peers-sdk";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { IFolderPickerRequest } from "./folder-picker-protocol";
|
|
4
|
+
/**
|
|
5
|
+
* The picker's look, with nothing to click: a framed screen's slot draws it hidden, so the slot is
|
|
6
|
+
* as big as the buttons the host draws over it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function FolderPickerFace(props: {
|
|
9
|
+
request: IFolderPickerRequest;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** Where Peers draws a picker: over this slot of the frame the host made with this id. */
|
|
12
|
+
export interface IFolderPickerPlace {
|
|
13
|
+
frameId: string;
|
|
14
|
+
slotId: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The picker a press in the host's window landed on, if any: on its buttons or in its ▾ menu.
|
|
18
|
+
*
|
|
19
|
+
* @param target - The press's target.
|
|
20
|
+
*/
|
|
21
|
+
export declare function folderPickerPressAt(target: Element | null): IFolderPickerPlace | undefined;
|
|
22
|
+
/** What a parent can do with the control: focus it, as Tab arrives at its slot. */
|
|
23
|
+
export interface IFolderPickerControlHandle {
|
|
24
|
+
focus(edge: "first" | "last"): void;
|
|
25
|
+
}
|
|
26
|
+
/** What {@link FolderPickerControl} takes. */
|
|
27
|
+
export interface IFolderPickerControlProps {
|
|
28
|
+
request: IFolderPickerRequest;
|
|
29
|
+
/** The package the grant is for; none makes a grant for the person (Peers' own screens). */
|
|
30
|
+
packageId?: string;
|
|
31
|
+
onPicked: (grant: ILocalFolderGrantInfo) => void;
|
|
32
|
+
onFailed: (message: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Over a slot: the buttons fill it, take no Tab stop of their own, and Tab leaving them goes
|
|
35
|
+
* back to the screen through this.
|
|
36
|
+
*/
|
|
37
|
+
overSlot?: {
|
|
38
|
+
onTabOut: (direction: "next" | "previous") => void;
|
|
39
|
+
place: IFolderPickerPlace;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** One folder the package already has on this device, and the groups it's used in. */
|
|
43
|
+
interface IExistingFolder {
|
|
44
|
+
absolutePath: string;
|
|
45
|
+
groupIds: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The folders a package has on this device that a request may use: whole folders, at least as
|
|
49
|
+
* writable as asked for.
|
|
50
|
+
*/
|
|
51
|
+
export declare function existingFolders(grants: readonly ILocalFolderGrantInfo[], packageId: string | undefined, request: Pick<IFolderPickerRequest, "mode">): IExistingFolder[];
|
|
52
|
+
/**
|
|
53
|
+
* Peers' folder picker buttons. A click opens the OS picker (or uses a folder from the ▾ menu) and
|
|
54
|
+
* grants it with System Local Folders, as the person, for `packageId`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const FolderPickerControl: React.ForwardRefExoticComponent<IFolderPickerControlProps & React.RefAttributes<IFolderPickerControlHandle>>;
|
|
57
|
+
export {};
|