@peers-app/peers-ui 0.33.8 → 0.33.9

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.
@@ -0,0 +1,55 @@
1
+ import type React from "react";
2
+ import type { IAppEntry } from "../ui-router/app-catalog";
3
+ import type { IAppPackageStatus } from "./app-status";
4
+ /** Where the menu opens: at a point (a right-click), or beside an element (the keyboard). */
5
+ export type AppMenuAnchor = {
6
+ x: number;
7
+ y: number;
8
+ } | {
9
+ rect: DOMRect;
10
+ };
11
+ /** One action in the app menu. */
12
+ export interface IAppMenuAction {
13
+ /** Stable key, also the test id suffix. */
14
+ key: string;
15
+ /** The item's text. */
16
+ label: string;
17
+ /** Bootstrap icon class. */
18
+ iconClassName: string;
19
+ /** A second, smaller line under the label. */
20
+ detail?: string;
21
+ /** Draw it highlighted, as the one thing to do now. */
22
+ emphasis?: boolean;
23
+ /** Draw it as destructive, after a divider. */
24
+ danger?: boolean;
25
+ /** What choosing it does; the menu closes first. */
26
+ run: () => void;
27
+ }
28
+ interface IAppMenuProps {
29
+ /** The app the menu is for. */
30
+ entry: IAppEntry;
31
+ /** Its package's status, for the header's version and channel. */
32
+ status?: IAppPackageStatus;
33
+ /** Why it isn't running here, if it failed. */
34
+ failure?: string;
35
+ /** The items, in order. */
36
+ actions: IAppMenuAction[];
37
+ /** Where to open. */
38
+ anchor: AppMenuAnchor;
39
+ /** The resolved color mode, for the menu surface. */
40
+ colorMode: string;
41
+ /** Close without choosing. */
42
+ onClose: () => void;
43
+ }
44
+ /**
45
+ * The header's second line: the package (when its name differs from the app's), the version
46
+ * running here and the channel it follows; "Built into Peers" for a built-in app.
47
+ */
48
+ export declare function appMenuSubtitle(entry: IAppEntry, status?: IAppPackageStatus): string;
49
+ /**
50
+ * The menu for one app on the Apps screen: a header with the app's name and channel, then its
51
+ * actions. Arrow keys move between items, Escape or a click outside closes it, and choosing an
52
+ * item closes it before running the action.
53
+ */
54
+ export declare function AppMenu({ entry, status, failure, actions, anchor, colorMode, onClose, }: IAppMenuProps): React.ReactPortal;
55
+ export {};
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appMenuSubtitle = appMenuSubtitle;
4
+ exports.AppMenu = AppMenu;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const react_dom_1 = require("react-dom");
8
+ const menu_surface_1 = require("../components/menu-surface");
9
+ /** Space kept between the menu and the window's edges. */
10
+ const EDGE = 8;
11
+ /**
12
+ * The header's second line: the package (when its name differs from the app's), the version
13
+ * running here and the channel it follows; "Built into Peers" for a built-in app.
14
+ */
15
+ function appMenuSubtitle(entry, status) {
16
+ if (entry.kind === "system")
17
+ return "Built into Peers";
18
+ const parts = [];
19
+ if (entry.packageName && entry.packageName !== entry.displayName)
20
+ parts.push(entry.packageName);
21
+ const pv = status?.activePv;
22
+ if (pv?.version)
23
+ parts.push(`v${pv.version}`);
24
+ if (pv)
25
+ parts.push(pv.versionTag || "dev");
26
+ return parts.join(" · ");
27
+ }
28
+ /**
29
+ * The menu for one app on the Apps screen: a header with the app's name and channel, then its
30
+ * actions. Arrow keys move between items, Escape or a click outside closes it, and choosing an
31
+ * item closes it before running the action.
32
+ */
33
+ function AppMenu({ entry, status, failure, actions, anchor, colorMode, onClose, }) {
34
+ const menuRef = (0, react_1.useRef)(null);
35
+ const [position, setPosition] = (0, react_1.useState)();
36
+ // Place the menu once its size is known, inside the window.
37
+ (0, react_1.useLayoutEffect)(() => {
38
+ const menu = menuRef.current;
39
+ if (!menu)
40
+ return;
41
+ const { width, height } = menu.getBoundingClientRect();
42
+ const maxLeft = window.innerWidth - width - EDGE;
43
+ const maxTop = window.innerHeight - height - EDGE;
44
+ let left;
45
+ let top;
46
+ if ("rect" in anchor) {
47
+ left = anchor.rect.right + 6;
48
+ if (left > maxLeft)
49
+ left = anchor.rect.left - width - 6;
50
+ if (left < EDGE)
51
+ left = Math.min(Math.max(anchor.rect.left, EDGE), maxLeft);
52
+ top = anchor.rect.top;
53
+ }
54
+ else {
55
+ left = anchor.x;
56
+ top = anchor.y;
57
+ }
58
+ setPosition({
59
+ left: Math.max(EDGE, Math.min(left, maxLeft)),
60
+ top: Math.max(EDGE, Math.min(top, maxTop)),
61
+ });
62
+ }, [anchor]);
63
+ // Focus the first item once the menu is placed and visible: a hidden element takes no focus.
64
+ const placed = position !== undefined;
65
+ (0, react_1.useEffect)(() => {
66
+ if (placed)
67
+ menuRef.current?.querySelector('[role="menuitem"]')?.focus();
68
+ }, [placed]);
69
+ // Escape closes the menu even when focus has left it.
70
+ (0, react_1.useEffect)(() => {
71
+ const onKey = (event) => {
72
+ if (event.key === "Escape")
73
+ onClose();
74
+ };
75
+ document.addEventListener("keydown", onKey);
76
+ return () => document.removeEventListener("keydown", onKey);
77
+ }, [onClose]);
78
+ const items = () => Array.from(menuRef.current?.querySelectorAll('[role="menuitem"]') ?? []);
79
+ const onKeyDown = (event) => {
80
+ const list = items();
81
+ const index = list.indexOf(document.activeElement);
82
+ const focus = (next) => list[(next + list.length) % list.length]?.focus();
83
+ switch (event.key) {
84
+ case "ArrowDown":
85
+ event.preventDefault();
86
+ focus(index + 1);
87
+ break;
88
+ case "ArrowUp":
89
+ event.preventDefault();
90
+ focus(index - 1);
91
+ break;
92
+ case "Home":
93
+ event.preventDefault();
94
+ focus(0);
95
+ break;
96
+ case "End":
97
+ event.preventDefault();
98
+ focus(list.length - 1);
99
+ break;
100
+ case "Escape":
101
+ case "Tab":
102
+ event.preventDefault();
103
+ event.stopPropagation();
104
+ event.nativeEvent.stopImmediatePropagation();
105
+ onClose();
106
+ break;
107
+ }
108
+ };
109
+ const subtitle = appMenuSubtitle(entry, status);
110
+ const safeActions = actions.filter((action) => !action.danger);
111
+ const dangerActions = actions.filter((action) => action.danger);
112
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "position-fixed", style: { inset: 0, zIndex: 1059 }, "data-testid": "app-menu-backdrop", onMouseDown: onClose, onContextMenu: (event) => {
113
+ event.preventDefault();
114
+ onClose();
115
+ } }), (0, jsx_runtime_1.jsxs)("div", { ref: menuRef, role: "menu", "aria-label": entry.displayName, className: `${(0, menu_surface_1.menuSurfaceClassName)(colorMode)} peers-app-menu shadow`, style: {
116
+ left: position?.left ?? 0,
117
+ top: position?.top ?? 0,
118
+ visibility: position ? "visible" : "hidden",
119
+ }, onKeyDown: onKeyDown, "data-testid": "app-menu", children: [(0, jsx_runtime_1.jsxs)("div", { className: "px-3 pt-1 pb-2 mb-1 border-bottom", children: [(0, jsx_runtime_1.jsx)("div", { className: "fw-semibold text-truncate", children: entry.displayName }), subtitle && (0, jsx_runtime_1.jsx)("div", { className: "peers-app-menu-detail text-truncate", children: subtitle }), failure && ((0, jsx_runtime_1.jsxs)("div", { className: "small text-danger mt-1", style: { maxWidth: 260 }, children: ["Not running here: ", failure] }))] }), safeActions.map((action) => ((0, jsx_runtime_1.jsx)(MenuItem, { action: action, onClose: onClose }, action.key))), dangerActions.length > 0 && (0, jsx_runtime_1.jsx)("div", { className: "dropdown-divider" }), dangerActions.map((action) => ((0, jsx_runtime_1.jsx)(MenuItem, { action: action, onClose: onClose }, action.key)))] })] }), document.body);
120
+ }
121
+ function MenuItem({ action, onClose }) {
122
+ return ((0, jsx_runtime_1.jsxs)("button", { type: "button", role: "menuitem", className: `dropdown-item ${action.emphasis ? "active" : ""} ${action.danger ? "text-danger" : ""}`, "data-testid": `app-menu-${action.key}`, onClick: () => {
123
+ onClose();
124
+ action.run();
125
+ }, children: [(0, jsx_runtime_1.jsx)("i", { className: action.iconClassName, "aria-hidden": "true", style: { paddingTop: 2 } }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("span", { className: action.emphasis ? "fw-semibold" : undefined, children: action.label }), action.detail && (0, jsx_runtime_1.jsx)("span", { className: "peers-app-menu-detail", children: action.detail })] })] }));
126
+ }
@@ -0,0 +1,34 @@
1
+ import { type IPackage, type IPackageObservedRuntime, type IPackageVersion } from "@peers-app/peers-sdk";
2
+ /** What an installed app's tile and menu say about its package on this device. */
3
+ export interface IAppPackageStatus {
4
+ /** The version selected here, once known. */
5
+ activePv?: IPackageVersion;
6
+ /** A newer release on the channel the package follows, when one is ready. */
7
+ updatePv?: IPackageVersion;
8
+ /** The selected version is a dev build from a local folder. */
9
+ dev: boolean;
10
+ }
11
+ /**
12
+ * The selected version of a package and the update waiting for it, kept current as its version
13
+ * rows and this device's selection change. The same check the Packages screen's update button
14
+ * uses: no update is offered for a dev build.
15
+ *
16
+ * @param pkg - The installed package, or `undefined` for a built-in app.
17
+ */
18
+ export declare function usePackageVersionStatus(pkg: IPackage | undefined): IAppPackageStatus;
19
+ /**
20
+ * The update waiting for a package now: the same check as {@link usePackageVersionStatus},
21
+ * read fresh, so an action taken from a menu opened a while ago can't select an older version
22
+ * than the one already running.
23
+ *
24
+ * @param pkg - The installed package.
25
+ * @returns The newer release on the channel it follows, or `undefined` when there's none.
26
+ */
27
+ export declare function currentPackageUpdate(pkg: IPackage): Promise<IPackageVersion | undefined>;
28
+ /**
29
+ * Why a package isn't running on this device, or `undefined` when nothing failed. A package that
30
+ * still runs an older version after a failed update isn't counted: it works.
31
+ *
32
+ * @param runtime - The package's observed runtime state on this device.
33
+ */
34
+ export declare function packageFailure(runtime: Pick<IPackageObservedRuntime, "status" | "running" | "worker" | "lastError"> | undefined): string | undefined;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePackageVersionStatus = usePackageVersionStatus;
4
+ exports.currentPackageUpdate = currentPackageUpdate;
5
+ exports.packageFailure = packageFailure;
6
+ const peers_sdk_1 = require("@peers-app/peers-sdk");
7
+ const react_1 = require("react");
8
+ const use_observable_1 = require("../hooks/use-observable");
9
+ const use_promise_1 = require("../hooks/use-promise");
10
+ const package_helpers_1 = require("../screens/packages/package-helpers");
11
+ /**
12
+ * The selected version of a package and the update waiting for it, kept current as its version
13
+ * rows and this device's selection change. The same check the Packages screen's update button
14
+ * uses: no update is offered for a dev build.
15
+ *
16
+ * @param pkg - The installed package, or `undefined` for a built-in app.
17
+ */
18
+ function usePackageVersionStatus(pkg) {
19
+ const packageId = pkg?.packageId;
20
+ const prefsVar = (0, react_1.useMemo)(() => packageId
21
+ ? (0, peers_sdk_1.packagePrefsVar)(packageId)
22
+ : undefined, [packageId]);
23
+ const [devicePrefs] = (0, use_observable_1.useObservable)(prefsVar, [prefsVar]);
24
+ const effective = pkg ? (0, peers_sdk_1.getEffectivePackagePrefs)(pkg, devicePrefs) : undefined;
25
+ // A dev reload rewrites the selected version row in place, so recheck on this package's rows.
26
+ const [revision, setRevision] = (0, react_1.useState)(0);
27
+ (0, react_1.useEffect)(() => {
28
+ if (!packageId)
29
+ return;
30
+ const sub = (0, peers_sdk_1.PackageVersions)().dataChanged.subscribe((evt) => {
31
+ if (evt.dataObject?.packageId === packageId)
32
+ setRevision((value) => value + 1);
33
+ });
34
+ return () => {
35
+ sub.unsubscribe();
36
+ };
37
+ }, [packageId]);
38
+ const status = (0, use_promise_1.usePromise)(async () => {
39
+ if (!packageId || !effective?.activePackageVersionId)
40
+ return null;
41
+ return (0, package_helpers_1.checkVersionStatus)(packageId, effective.activePackageVersionId, effective.followTags);
42
+ }, null, [packageId, effective?.activePackageVersionId, effective?.followTags, revision]);
43
+ const dev = status?.activePv.versionTag === "dev";
44
+ return {
45
+ activePv: status?.activePv,
46
+ updatePv: !dev && status?.newerLevel && status.newestPv ? status.newestPv : undefined,
47
+ dev,
48
+ };
49
+ }
50
+ /**
51
+ * The update waiting for a package now: the same check as {@link usePackageVersionStatus},
52
+ * read fresh, so an action taken from a menu opened a while ago can't select an older version
53
+ * than the one already running.
54
+ *
55
+ * @param pkg - The installed package.
56
+ * @returns The newer release on the channel it follows, or `undefined` when there's none.
57
+ */
58
+ async function currentPackageUpdate(pkg) {
59
+ const prefsVar = (0, peers_sdk_1.packagePrefsVar)(pkg.packageId);
60
+ await prefsVar.loadingPromise;
61
+ const effective = (0, peers_sdk_1.getEffectivePackagePrefs)(pkg, prefsVar());
62
+ if (!effective.activePackageVersionId)
63
+ return undefined;
64
+ const status = await (0, package_helpers_1.checkVersionStatus)(pkg.packageId, effective.activePackageVersionId, effective.followTags);
65
+ if (!status || status.activePv.versionTag === "dev" || !status.newerLevel)
66
+ return undefined;
67
+ return status.newestPv ?? undefined;
68
+ }
69
+ /**
70
+ * Why a package isn't running on this device, or `undefined` when nothing failed. A package that
71
+ * still runs an older version after a failed update isn't counted: it works.
72
+ *
73
+ * @param runtime - The package's observed runtime state on this device.
74
+ */
75
+ function packageFailure(runtime) {
76
+ if (!runtime)
77
+ return undefined;
78
+ if (runtime.worker?.lastWorkerError) {
79
+ return runtime.worker.lastWorkerError.message || "The package worker failed";
80
+ }
81
+ if (runtime.status === "failed" && !runtime.running) {
82
+ return runtime.lastError?.message || "It failed to start on this device";
83
+ }
84
+ return undefined;
85
+ }
@@ -0,0 +1,33 @@
1
+ import type { IPackage } from "@peers-app/peers-sdk";
2
+ import type { IAppEntry } from "../ui-router/app-catalog";
3
+ import type { AppMenuAnchor } from "./app-menu";
4
+ import { type IAppPackageStatus } from "./app-status";
5
+ /** The three tile sizes: pinned apps, the group's other apps, and built-in apps. */
6
+ export type AppTileSize = "pinned" | "more" | "system";
7
+ interface IAppTileProps {
8
+ /** The app. */
9
+ entry: IAppEntry;
10
+ /** Its package, for status; `undefined` for a built-in app. */
11
+ pkg?: IPackage;
12
+ /** Which section it's in. */
13
+ size: AppTileSize;
14
+ /** Whether it's pinned. */
15
+ pinned: boolean;
16
+ /** Whether the screen is in edit mode. */
17
+ editing: boolean;
18
+ /** Why its package isn't running here, if it failed. */
19
+ failure?: string;
20
+ /** Open the app. */
21
+ onOpen: (entry: IAppEntry) => void;
22
+ /** Open its menu. `returnFocus` is the tile, when the keyboard opened it. */
23
+ onMenu: (entry: IAppEntry, anchor: AppMenuAnchor, status: IAppPackageStatus, returnFocus?: HTMLElement) => void;
24
+ /** Pin or unpin it (edit mode's − and +). */
25
+ onTogglePin: (entry: IAppEntry) => void;
26
+ }
27
+ /**
28
+ * One app on the Apps screen: its colored icon over its name, with its status at the corner.
29
+ * A click opens it (in edit mode, its menu). A right-click, a press-and-hold, Shift+F10 or the
30
+ * context-menu key opens its menu.
31
+ */
32
+ export declare function AppTile({ entry, pkg, size, pinned, editing, failure, onOpen, onMenu, onTogglePin, }: IAppTileProps): import("react/jsx-runtime").JSX.Element;
33
+ export {};
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppTile = AppTile;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const app_status_1 = require("./app-status");
7
+ /** How long a press must last to open the menu on a touch screen. */
8
+ const LONG_PRESS_MS = 500;
9
+ /** How far a finger may move before a press counts as a scroll. */
10
+ const LONG_PRESS_SLOP_PX = 10;
11
+ /**
12
+ * One app on the Apps screen: its colored icon over its name, with its status at the corner.
13
+ * A click opens it (in edit mode, its menu). A right-click, a press-and-hold, Shift+F10 or the
14
+ * context-menu key opens its menu.
15
+ */
16
+ function AppTile({ entry, pkg, size, pinned, editing, failure, onOpen, onMenu, onTogglePin, }) {
17
+ const status = (0, app_status_1.usePackageVersionStatus)(pkg);
18
+ const buttonRef = (0, react_1.useRef)(null);
19
+ const press = (0, react_1.useRef)();
20
+ // The click a touch screen sends after a long press opened the menu.
21
+ const suppressClick = (0, react_1.useRef)(false);
22
+ const pressOpenedMenu = (0, react_1.useRef)(false);
23
+ (0, react_1.useEffect)(() => () => clearTimeout(press.current?.timer), []);
24
+ const rectAnchor = () => ({
25
+ rect: (buttonRef.current ?? document.body).getBoundingClientRect(),
26
+ });
27
+ const cancelPress = () => {
28
+ if (press.current)
29
+ clearTimeout(press.current.timer);
30
+ press.current = undefined;
31
+ };
32
+ const onPointerDown = (event) => {
33
+ suppressClick.current = false;
34
+ pressOpenedMenu.current = false;
35
+ cancelPress();
36
+ // Touch only: a mouse has right-click. In edit mode a pinned tile's press starts a drag.
37
+ if (event.pointerType !== "touch" || (editing && pinned))
38
+ return;
39
+ press.current = {
40
+ x: event.clientX,
41
+ y: event.clientY,
42
+ timer: setTimeout(() => {
43
+ press.current = undefined;
44
+ pressOpenedMenu.current = true;
45
+ suppressClick.current = true;
46
+ onMenu(entry, rectAnchor(), status);
47
+ }, LONG_PRESS_MS),
48
+ };
49
+ };
50
+ const onPointerMove = (event) => {
51
+ const start = press.current;
52
+ if (!start)
53
+ return;
54
+ if (Math.hypot(event.clientX - start.x, event.clientY - start.y) > LONG_PRESS_SLOP_PX) {
55
+ cancelPress();
56
+ }
57
+ };
58
+ const onClick = () => {
59
+ if (suppressClick.current) {
60
+ suppressClick.current = false;
61
+ return;
62
+ }
63
+ if (editing) {
64
+ onMenu(entry, rectAnchor(), status, buttonRef.current ?? undefined);
65
+ }
66
+ else {
67
+ onOpen(entry);
68
+ }
69
+ };
70
+ const onContextMenu = (event) => {
71
+ event.preventDefault();
72
+ cancelPress();
73
+ // Android sends a long press as a contextmenu, which may be followed by a click.
74
+ const touch = event.nativeEvent.pointerType === "touch";
75
+ if (!touch) {
76
+ onMenu(entry, { x: event.clientX, y: event.clientY }, status);
77
+ return;
78
+ }
79
+ if (editing && pinned)
80
+ return; // the press is a drag
81
+ suppressClick.current = true;
82
+ if (!pressOpenedMenu.current)
83
+ onMenu(entry, rectAnchor(), status);
84
+ };
85
+ const onKeyDown = (event) => {
86
+ if (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey)) {
87
+ event.preventDefault();
88
+ onMenu(entry, rectAnchor(), status, buttonRef.current ?? undefined);
89
+ }
90
+ };
91
+ const states = [
92
+ status.updatePv && "update ready",
93
+ failure && "not running",
94
+ status.dev && "dev build",
95
+ ].filter(Boolean);
96
+ return ((0, jsx_runtime_1.jsxs)("div", { className: [
97
+ "peers-app-tile-wrap",
98
+ `peers-app-tile-${size}`,
99
+ failure ? "peers-app-tile-failed" : "",
100
+ status.dev ? "peers-app-tile-dev" : "",
101
+ ].join(" "), "data-app-path": entry.path, children: [(0, jsx_runtime_1.jsxs)("button", { ref: buttonRef, type: "button", className: "peers-app-tile", title: entry.displayName, "aria-label": [entry.displayName, ...states].join(", "), "aria-haspopup": editing ? "menu" : undefined, onClick: onClick, onContextMenu: onContextMenu, onKeyDown: onKeyDown, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: cancelPress, onPointerCancel: cancelPress, onPointerLeave: cancelPress, "data-testid": `app-tile-${entry.path}`, children: [(0, jsx_runtime_1.jsx)("span", { className: `peers-app-icon peers-app-color-${entry.color}`, "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("i", { className: entry.iconClassName }) }), (0, jsx_runtime_1.jsx)("span", { className: "peers-app-label", children: entry.displayName })] }), !editing && (0, jsx_runtime_1.jsx)(TileStatus, { status: status, failure: failure }), editing && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: `peers-app-edit-badge ${pinned ? "peers-app-edit-badge-unpin" : "peers-app-edit-badge-pin"}`, "aria-label": `${pinned ? "Unpin" : "Pin"} ${entry.displayName}`, title: pinned ? "Unpin" : "Pin", onClick: () => onTogglePin(entry), "data-testid": `app-${pinned ? "unpin" : "pin"}-${entry.path}`, children: pinned ? "−" : "+" }))] }));
102
+ }
103
+ /** The badge at a tile's corner: not running beats an update; a dev build gets its pill. */
104
+ function TileStatus({ status, failure }) {
105
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [failure ? ((0, jsx_runtime_1.jsx)("span", { className: "peers-app-status peers-app-status-failed", title: failure, children: "!" })) : status.updatePv ? ((0, jsx_runtime_1.jsx)("span", { className: "peers-app-status peers-app-status-update", title: `v${status.updatePv.version} is ready`, children: (0, jsx_runtime_1.jsx)("i", { className: "bi-arrow-up-circle-fill" }) })) : null, status.dev && (0, jsx_runtime_1.jsx)("span", { className: "peers-app-status peers-app-status-dev", children: "DEV" })] }));
106
+ }
@@ -0,0 +1,29 @@
1
+ import { type IAppEntry } from "../ui-router/app-catalog";
2
+ /**
3
+ * The Apps screen: the group's installed apps as a home screen. The user's pinned apps come
4
+ * first, in their order, then the group's other apps by name, then the built-in apps. Edit mode
5
+ * pins, unpins and reorders; each app's menu opens, pins, updates, shows details or removes it.
6
+ *
7
+ * @param isMobile - Use the phone layout: 4-column grids and folded built-in apps.
8
+ */
9
+ export declare function AppsHome({ isMobile }: {
10
+ isMobile: boolean;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ /** The home's three sections, after the search. */
13
+ export interface IHomeSections {
14
+ /** Pinned apps that are installed, in pin order. */
15
+ pinned: IAppEntry[];
16
+ /** The group's other apps, by display name. */
17
+ more: IAppEntry[];
18
+ /** Built-in apps that aren't pinned, in their curated order. */
19
+ system: IAppEntry[];
20
+ }
21
+ /**
22
+ * Split the catalog into the home's sections. A pin whose app isn't installed is left out (and
23
+ * kept in the pins), and each app appears once: a pinned app leaves its usual section.
24
+ *
25
+ * @param catalog - Every app here, packages first, then built-in apps in order.
26
+ * @param pins - Pinned app paths, in order.
27
+ * @param query - The search; empty shows everything.
28
+ */
29
+ export declare function homeSections(catalog: readonly IAppEntry[], pins: readonly string[], query: string): IHomeSections;