@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.
Files changed (126) hide show
  1. package/dist/apps-home/app-menu.d.ts +1 -2
  2. package/dist/apps-home/app-menu.js +29 -25
  3. package/dist/command-palette/command-palette-ui.js +13 -12
  4. package/dist/components/autocomplete-chips.d.ts +18 -0
  5. package/dist/components/autocomplete-chips.js +49 -0
  6. package/dist/components/autocomplete.d.ts +88 -0
  7. package/dist/components/autocomplete.js +346 -0
  8. package/dist/components/confirm-button.d.ts +26 -0
  9. package/dist/components/confirm-button.js +55 -0
  10. package/dist/components/data-grid/autocomplete.d.ts +1 -31
  11. package/dist/components/data-grid/autocomplete.js +5 -197
  12. package/dist/components/empty-state.d.ts +16 -0
  13. package/dist/components/empty-state.js +16 -0
  14. package/dist/components/group-switcher.d.ts +3 -3
  15. package/dist/components/group-switcher.js +22 -17
  16. package/dist/components/inline-create-form.d.ts +22 -0
  17. package/dist/components/inline-create-form.js +56 -0
  18. package/dist/components/list-row.d.ts +33 -0
  19. package/dist/components/list-row.js +30 -0
  20. package/dist/components/list-screen.d.ts +31 -3
  21. package/dist/components/list-screen.js +61 -28
  22. package/dist/components/markdown-editor/format-bar.js +15 -40
  23. package/dist/components/markdown-editor/link-plugin.js +38 -9
  24. package/dist/components/markdown-editor/selection-bar-place.d.ts +37 -0
  25. package/dist/components/markdown-editor/selection-bar-place.js +107 -0
  26. package/dist/components/menu-button.d.ts +34 -0
  27. package/dist/components/menu-button.js +66 -0
  28. package/dist/components/screen-header.d.ts +35 -0
  29. package/dist/components/screen-header.js +30 -0
  30. package/dist/components/search-field.d.ts +22 -0
  31. package/dist/components/search-field.js +22 -0
  32. package/dist/components/segmented-control.d.ts +25 -0
  33. package/dist/components/segmented-control.js +18 -0
  34. package/dist/components/typeahead.d.ts +9 -0
  35. package/dist/components/typeahead.js +7 -0
  36. package/dist/delegates/acts-for-you-panel.d.ts +2 -1
  37. package/dist/delegates/acts-for-you-panel.js +46 -17
  38. package/dist/delegates/delegate-request-dialog.d.ts +3 -1
  39. package/dist/delegates/delegate-request-dialog.js +6 -3
  40. package/dist/groups/groups-client.d.ts +23 -1
  41. package/dist/groups/groups-client.js +31 -0
  42. package/dist/index.d.ts +10 -0
  43. package/dist/index.js +14 -1
  44. package/dist/isolated-screens/config.js +1 -9
  45. package/dist/isolated-screens/folder-picker-control.d.ts +57 -0
  46. package/dist/isolated-screens/folder-picker-control.js +217 -0
  47. package/dist/isolated-screens/folder-picker-host.d.ts +57 -0
  48. package/dist/isolated-screens/folder-picker-host.js +178 -0
  49. package/dist/isolated-screens/folder-picker-protocol.d.ts +75 -0
  50. package/dist/isolated-screens/folder-picker-protocol.js +104 -0
  51. package/dist/isolated-screens/frame-bridge.js +8 -0
  52. package/dist/isolated-screens/frame-document.js +2 -1
  53. package/dist/isolated-screens/frame-microphone.d.ts +55 -0
  54. package/dist/isolated-screens/frame-microphone.js +265 -0
  55. package/dist/isolated-screens/frame-permissions.d.ts +19 -0
  56. package/dist/isolated-screens/frame-permissions.js +32 -0
  57. package/dist/isolated-screens/frame-protocol.d.ts +26 -0
  58. package/dist/isolated-screens/frame-protocol.js +9 -0
  59. package/dist/isolated-screens/frame-pvars.d.ts +27 -0
  60. package/dist/isolated-screens/frame-pvars.js +101 -14
  61. package/dist/isolated-screens/global-widgets.d.ts +1 -2
  62. package/dist/isolated-screens/index.d.ts +2 -0
  63. package/dist/isolated-screens/index.js +3 -1
  64. package/dist/isolated-screens/isolated-screen.d.ts +21 -0
  65. package/dist/isolated-screens/isolated-screen.js +88 -5
  66. package/dist/isolated-screens/local-folder-picker.d.ts +55 -0
  67. package/dist/isolated-screens/local-folder-picker.js +143 -0
  68. package/dist/isolated-screens/microphone-host.d.ts +110 -0
  69. package/dist/isolated-screens/microphone-host.js +397 -0
  70. package/dist/isolated-screens/microphone-prompt.d.ts +20 -0
  71. package/dist/isolated-screens/microphone-prompt.js +60 -0
  72. package/dist/isolated-screens/piece-frames.js +5 -94
  73. package/dist/isolated-screens/piece-reach.d.ts +1 -0
  74. package/dist/isolated-screens/port-channel.d.ts +21 -11
  75. package/dist/isolated-screens/port-channel.js +15 -5
  76. package/dist/isolated-screens/slot-rect.d.ts +38 -0
  77. package/dist/isolated-screens/slot-rect.js +121 -0
  78. package/dist/isolated-screens/test-ports.d.ts +17 -0
  79. package/dist/isolated-screens/test-ports.js +25 -3
  80. package/dist/mentions/mention-chooser.js +1 -1
  81. package/dist/notifications/notifications-screen.js +1 -1
  82. package/dist/screens/data-explorer/data-explorer.d.ts +1 -0
  83. package/dist/screens/data-explorer/data-explorer.js +28 -10
  84. package/dist/screens/data-explorer/query-executor.d.ts +1 -0
  85. package/dist/screens/data-explorer/query-executor.js +3 -1
  86. package/dist/screens/groups/group-list.d.ts +13 -3
  87. package/dist/screens/groups/group-list.js +88 -11
  88. package/dist/screens/identity/identity-routes.d.ts +16 -0
  89. package/dist/screens/identity/identity-routes.js +27 -10
  90. package/dist/screens/identity/identity-screen.js +4 -1
  91. package/dist/screens/invites/activity-view.d.ts +3 -1
  92. package/dist/screens/invites/activity-view.js +7 -3
  93. package/dist/screens/invites/pending-invites-list.d.ts +8 -4
  94. package/dist/screens/invites/pending-invites-list.js +44 -45
  95. package/dist/screens/network-viewer/graph/network-graph-controls.js +3 -3
  96. package/dist/screens/packages/local-folder-grants-panel.d.ts +2 -0
  97. package/dist/screens/packages/local-folder-grants-panel.js +1 -1
  98. package/dist/screens/packages/package-info.js +2 -1
  99. package/dist/screens/packages/package-list.d.ts +2 -2
  100. package/dist/screens/packages/package-list.js +89 -105
  101. package/dist/screens/packages/package-microphone-panel.d.ts +14 -0
  102. package/dist/screens/packages/package-microphone-panel.js +62 -0
  103. package/dist/screens/packages/package-runtime-status.d.ts +10 -2
  104. package/dist/screens/packages/package-runtime-status.js +17 -4
  105. package/dist/screens/peer-types/peer-type-details.js +3 -2
  106. package/dist/screens/peer-types/peer-type-list.d.ts +1 -1
  107. package/dist/screens/peer-types/peer-type-list.js +4 -4
  108. package/dist/screens/settings/settings-page.js +1 -4
  109. package/dist/screens/tools/tool-details.js +2 -1
  110. package/dist/screens/tools/tool-list.d.ts +1 -1
  111. package/dist/screens/tools/tool-list.js +22 -60
  112. package/dist/screens/variables/variable-details.js +5 -4
  113. package/dist/screens/variables/variable-list.d.ts +17 -0
  114. package/dist/screens/variables/variable-list.js +72 -28
  115. package/dist/tabs-layout/network-status-details.d.ts +4 -4
  116. package/dist/tabs-layout/network-status-details.js +6 -5
  117. package/dist/tabs-layout/network-status-indicator.d.ts +1 -0
  118. package/dist/tabs-layout/network-status-indicator.js +1 -0
  119. package/dist/tabs-layout/tab-bar-shortcuts.d.ts +46 -0
  120. package/dist/tabs-layout/tab-bar-shortcuts.js +140 -0
  121. package/dist/tabs-layout/tabs-layout.js +11 -9
  122. package/dist/theme.css +326 -6
  123. package/dist/ui-contracts/popover-surface.d.ts +3 -0
  124. package/dist/ui-contracts/popover-surface.js +6 -3
  125. package/dist/ui-defaults/list-screen.js +10 -4
  126. package/package.json +3 -3
@@ -9,6 +9,7 @@ const input_1 = require("../../components/input");
9
9
  const loading_indicator_1 = require("../../components/loading-indicator");
10
10
  const editor_inline_1 = require("../../components/markdown-editor/editor-inline");
11
11
  const save_button_1 = require("../../components/save-button");
12
+ const screen_header_1 = require("../../components/screen-header");
12
13
  const tabs_1 = require("../../components/tabs");
13
14
  const hooks_1 = require("../../hooks");
14
15
  const host_shell_consumer_1 = require("../../host-shell/host-shell-consumer");
@@ -39,7 +40,7 @@ const VariableDetails = (props) => {
39
40
  if (!persistentVariable) {
40
41
  return (0, jsx_runtime_1.jsx)(loading_indicator_1.LoadingIndicator, {});
41
42
  }
42
- return ((0, jsx_runtime_1.jsxs)("div", { className: "container-fluid p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)("i", { className: `${(0, peers_sdk_1.getIconClassName)((0, peers_sdk_1.PersistentVars)())} me-2"` }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1", children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)(input_1.Input, { className: "border border-0", style: { width: "100%", outline: "none", backgroundColor: "transparent" }, value: persistentVariable.qs.name }, persistentVariable.persistentVarId) }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(save_button_1.SaveButton, { doc: persistentVariable }, persistentVariable.persistentVarId) })] }), (0, jsx_runtime_1.jsx)(tabs_1.Tabs, { tabs: [
43
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "container-fluid p-3", children: [(0, jsx_runtime_1.jsx)(screen_header_1.BackLink, { href: "#variables", label: "Variables" }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex", children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)("i", { className: `${(0, peers_sdk_1.getIconClassName)((0, peers_sdk_1.PersistentVars)())} me-2` }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1", children: (0, jsx_runtime_1.jsx)("h4", { children: (0, jsx_runtime_1.jsx)(input_1.Input, { className: "border border-0", style: { width: "100%", outline: "none", backgroundColor: "transparent" }, value: persistentVariable.qs.name }, persistentVariable.persistentVarId) }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(save_button_1.SaveButton, { doc: persistentVariable }, persistentVariable.persistentVarId) })] }), (0, jsx_runtime_1.jsx)(tabs_1.Tabs, { tabs: [
43
44
  {
44
45
  name: "Info",
45
46
  content: ((0, jsx_runtime_1.jsx)(tabs_1.ScreenTabBody, { children: (0, jsx_runtime_1.jsx)(VariableInfo, { persistentVariable: persistentVariable }) })),
@@ -50,7 +51,7 @@ exports.VariableDetails = VariableDetails;
50
51
  const VariableInfo = (props) => {
51
52
  const { persistentVariable: pvar } = props;
52
53
  pvar.description = pvar.description || "";
53
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("small", { children: "Name:" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: pvar.qs.name, className: "form-control mb-3 p-0 ps-2", placeholder: "Variable name", title: "Variable name" }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-row", children: [(0, jsx_runtime_1.jsx)(VariableScope, { pvar: pvar }), (0, jsx_runtime_1.jsxs)("div", { className: "ms-2", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small mt-2 me-2", children: "Is Secret:" }), (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: "form-check-input mt-2", checked: pvar.qs.isSecret })] })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(VariableValue, { pvar: pvar }), (0, jsx_runtime_1.jsx)("small", { className: "mt-2", children: "Description:" }), (0, jsx_runtime_1.jsx)(editor_inline_1.MarkdownEditorInline, { value: pvar.qs.description })] }));
54
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("small", { children: "Name:" }), (0, jsx_runtime_1.jsx)(input_1.Input, { value: pvar.qs.name, className: "form-control mb-3", placeholder: "Variable name", title: "Variable name" }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-row", children: [(0, jsx_runtime_1.jsx)(VariableScope, { pvar: pvar }), (0, jsx_runtime_1.jsxs)("div", { className: "ms-2", children: [(0, jsx_runtime_1.jsx)("label", { className: "form-label small mt-2 me-2", children: "Is Secret:" }), (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: "form-check-input mt-2", checked: pvar.qs.isSecret })] })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(VariableValue, { pvar: pvar }), (0, jsx_runtime_1.jsx)("small", { className: "mt-2", children: "Description:" }), (0, jsx_runtime_1.jsx)(editor_inline_1.MarkdownEditorInline, { value: pvar.qs.description })] }));
54
55
  };
55
56
  const VariableScope = (props) => {
56
57
  const { pvar } = props;
@@ -70,7 +71,7 @@ const VariableValue = (props) => {
70
71
  });
71
72
  const valueLabel = ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center justify-content-between", children: [(0, jsx_runtime_1.jsx)("small", { children: "Value:" }), (0, jsx_runtime_1.jsx)(CopyValueButton, { pvar: pvar })] }));
72
73
  if (isSecret) {
73
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [valueLabel, (0, jsx_runtime_1.jsx)(input_1.Input, { value: scalarValue, type: "password", className: "form-control mb-3 p-0 ps-2", placeholder: "Variable value", title: "Variable value" })] }));
74
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [valueLabel, (0, jsx_runtime_1.jsx)(input_1.Input, { value: scalarValue, type: "password", className: "form-control mb-3", placeholder: "Variable value", title: "Variable value" })] }));
74
75
  }
75
76
  // The markdown editor only handles strings. System/package pvars may hold booleans,
76
77
  // numbers, or objects, so render those read-only (still copyable via the button).
@@ -83,7 +84,7 @@ const VariableValue = (props) => {
83
84
  : isObject
84
85
  ? JSON.stringify(scalar, null, 2)
85
86
  : String(scalar);
86
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [valueLabel, isObject ? ((0, jsx_runtime_1.jsx)("pre", { className: "form-control mb-1 p-2", style: { whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: 300 }, children: display })) : ((0, jsx_runtime_1.jsx)("input", { className: "form-control mb-1 p-0 ps-2", value: display, readOnly: true, title: "Variable value" })), (0, jsx_runtime_1.jsxs)("div", { className: "form-text text-muted mb-3", children: ["This ", typeof scalar, " value is read-only here \u2014 use Copy Value to copy it."] })] }));
87
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [valueLabel, isObject ? ((0, jsx_runtime_1.jsx)("pre", { className: "form-control mb-1 p-2", style: { whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: 300 }, children: display })) : ((0, jsx_runtime_1.jsx)("input", { className: "form-control mb-1", value: display, readOnly: true, title: "Variable value" })), (0, jsx_runtime_1.jsxs)("div", { className: "form-text text-muted mb-3", children: ["This ", typeof scalar, " value is read-only here \u2014 use Copy Value to copy it."] })] }));
87
88
  }
88
89
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [valueLabel, (0, jsx_runtime_1.jsx)(editor_inline_1.MarkdownEditorInline, { value: scalarValue, hideToolbar: true }), (0, jsx_runtime_1.jsx)("br", {})] }));
89
90
  };
@@ -1 +1,18 @@
1
+ import { type IPersistentVar } from "@peers-app/peers-sdk";
2
+ /**
3
+ * A variable's name as its owner wrote it: without the owning package's id in front, and, for
4
+ * the per-group scopes, without the group's id after.
5
+ *
6
+ * @param persistentVar - The variable.
7
+ * @returns The shown name, and the owning package's id if it has one.
8
+ */
9
+ export declare function shownVariableName(persistentVar: IPersistentVar): {
10
+ name: string;
11
+ packageId?: string;
12
+ };
13
+ /**
14
+ * The Variables screen: what Peers and the apps remember, for the user, a device or the group.
15
+ * "Yours" lists the variables the user made (New variable makes one); "Apps' and Peers'" lists
16
+ * the rest, each with the app that owns it.
17
+ */
1
18
  export declare function VariableList(): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +1,81 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shownVariableName = shownVariableName;
3
4
  exports.VariableList = VariableList;
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
5
6
  const peers_sdk_1 = require("@peers-app/peers-sdk");
7
+ const react_1 = require("react");
8
+ const list_row_1 = require("../../components/list-row");
6
9
  const list_screen_1 = require("../../components/list-screen");
7
- const markdown_with_mentions_1 = require("../../components/markdown-with-mentions");
8
- const tabs_1 = require("../../components/tabs");
10
+ const segmented_control_1 = require("../../components/segmented-control");
9
11
  const globals_1 = require("../../globals");
10
12
  const ui_loader_1 = require("../../ui-router/ui-loader");
11
- function renderItem(persistentVar) {
12
- return ((0, jsx_runtime_1.jsxs)("div", { className: "container-fluid pb-4", children: [(0, jsx_runtime_1.jsx)("i", { className: (0, peers_sdk_1.getIconClassName)((0, peers_sdk_1.PersistentVars)()) }), "\u00A0", (0, jsx_runtime_1.jsx)("a", { href: `#variables/${persistentVar.persistentVarId}`, children: persistentVar.name || "<empty-name>" }), (0, jsx_runtime_1.jsx)("div", { style: { paddingLeft: "20px" }, children: (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: persistentVar.description || "" }) })] }, persistentVar.persistentVarId));
13
+ /** What each scope means, in a row's badge. */
14
+ const SCOPE_WORDS = {
15
+ device: "this device",
16
+ user: "you",
17
+ group: "the group",
18
+ groupDevice: "this device, per group",
19
+ groupUser: "you, per group",
20
+ };
21
+ /**
22
+ * A variable's name as its owner wrote it: without the owning package's id in front, and, for
23
+ * the per-group scopes, without the group's id after.
24
+ *
25
+ * @param persistentVar - The variable.
26
+ * @returns The shown name, and the owning package's id if it has one.
27
+ */
28
+ function shownVariableName(persistentVar) {
29
+ let name = persistentVar.name ?? "";
30
+ if (persistentVar.userCreated)
31
+ return { name };
32
+ if (persistentVar.scope === "groupDevice" || persistentVar.scope === "groupUser") {
33
+ const suffix = name.lastIndexOf("_");
34
+ if (suffix > 0 && (0, peers_sdk_1.isid)(name.slice(suffix + 1)))
35
+ name = name.slice(0, suffix);
36
+ }
37
+ const prefix = name.slice(0, 25);
38
+ if (name[25] === "_" && (0, peers_sdk_1.isid)(prefix))
39
+ return { name: name.slice(26), packageId: prefix };
40
+ return { name };
41
+ }
42
+ /** The names of the group's packages, by id, for the rows' owner line. */
43
+ function usePackageNames() {
44
+ const [names, setNames] = (0, react_1.useState)(() => new Map());
45
+ (0, react_1.useEffect)(() => {
46
+ let disposed = false;
47
+ (0, peers_sdk_1.Packages)()
48
+ .list()
49
+ .then((packages) => {
50
+ if (!disposed)
51
+ setNames(new Map(packages.map((pkg) => [pkg.packageId, pkg.name])));
52
+ })
53
+ .catch(() => { });
54
+ return () => {
55
+ disposed = true;
56
+ };
57
+ }, []);
58
+ return names;
13
59
  }
14
- /** List of user-created variables, with search-to-create. */
15
- function UserVariableList() {
60
+ function VariableRow(props) {
61
+ const { persistentVar, packageNames } = props;
62
+ const shown = shownVariableName(persistentVar);
63
+ const owner = shown.packageId ? (packageNames.get(shown.packageId) ?? "An app") : undefined;
64
+ const description = persistentVar.isSecret ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-key me-1", "aria-hidden": "true" }), "Secret", owner && ` · ${owner}`] })) : owner ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-box me-1", "aria-hidden": "true" }), owner] })) : ((0, list_screen_1.firstLineOf)(persistentVar.description));
65
+ return ((0, jsx_runtime_1.jsx)(list_row_1.ListRow, { href: `#variables/${persistentVar.persistentVarId}`, icon: (0, jsx_runtime_1.jsx)("i", { className: "bi-braces text-info" }), title: shown.name || "(no name)", monospace: true, description: description, badges: (0, jsx_runtime_1.jsx)("span", { className: "badge peers-fact-badge", children: SCOPE_WORDS[persistentVar.scope] ?? persistentVar.scope }) }));
66
+ }
67
+ const KIND_CHOICES = [
68
+ { value: "yours", label: "Yours" },
69
+ { value: "apps", label: "Apps' and Peers'" },
70
+ ];
71
+ /**
72
+ * The Variables screen: what Peers and the apps remember, for the user, a device or the group.
73
+ * "Yours" lists the variables the user made (New variable makes one); "Apps' and Peers'" lists
74
+ * the rest, each with the app that owns it.
75
+ */
76
+ function VariableList() {
77
+ const [kind, setKind] = (0, react_1.useState)("yours");
78
+ const packageNames = usePackageNames();
16
79
  async function newRecord(name) {
17
80
  const userContext = await (0, peers_sdk_1.getUserContext)();
18
81
  const isPersonal = userContext.currentlyActiveGroupId() === userContext.userId;
@@ -31,30 +94,11 @@ function UserVariableList() {
31
94
  function getFilter(searchText) {
32
95
  return {
33
96
  $or: [{ name: { $matchWords: searchText } }, { description: { $matchWords: searchText } }],
34
- userCreated: true,
35
- };
36
- }
37
- return ((0, jsx_runtime_1.jsx)(list_screen_1.ListScreen, { table: (0, peers_sdk_1.PersistentVars)(), newRecord: newRecord, getFilter: getFilter, sortBy: ["name"], renderItem: renderItem, placeholderName: "environment variable" }));
38
- }
39
- /**
40
- * Browse/search list of non-user-created variables (system and package-owned pvars).
41
- * These are read-only here (no create); selecting one opens the same detail screen.
42
- */
43
- function SystemVariableList() {
44
- function getFilter(searchText) {
45
- return {
46
- $or: [{ name: { $matchWords: searchText } }, { description: { $matchWords: searchText } }],
47
- // $ne: true matches both `false` and unset (system/package pvars omit userCreated)
48
- userCreated: { $ne: true },
97
+ // $ne: true matches both `false` and unset (system and package variables leave it out)
98
+ userCreated: kind === "yours" ? true : { $ne: true },
49
99
  };
50
100
  }
51
- return ((0, jsx_runtime_1.jsx)(list_screen_1.ListScreen, { table: (0, peers_sdk_1.PersistentVars)(), getFilter: getFilter, sortBy: ["name"], renderItem: renderItem, placeholderName: "system variable" }));
52
- }
53
- function VariableList() {
54
- return ((0, jsx_runtime_1.jsx)(tabs_1.Tabs, { tabs: [
55
- { name: "User", content: (0, jsx_runtime_1.jsx)(UserVariableList, {}) },
56
- { name: "System", content: (0, jsx_runtime_1.jsx)(SystemVariableList, {}) },
57
- ] }));
101
+ return ((0, jsx_runtime_1.jsx)(list_screen_1.ListScreen, { table: (0, peers_sdk_1.PersistentVars)(), newRecord: newRecord, getFilter: getFilter, sortBy: ["name"], renderItem: (persistentVar) => ((0, jsx_runtime_1.jsx)(VariableRow, { persistentVar: persistentVar, packageNames: packageNames }, persistentVar.persistentVarId)), placeholderName: "variable", icon: "bi-braces", title: "Variables", subtitle: "What Peers and your apps remember, for you, a device or the group", resetKey: kind, toolbar: (0, jsx_runtime_1.jsx)(segmented_control_1.SegmentedControl, { label: "Show", className: "mb-3", choices: KIND_CHOICES, value: kind, onChange: setKind }) }));
58
102
  }
59
103
  (0, ui_loader_1.registerInternalPeersUI)({
60
104
  peersUIId: "00m5fshz2g6ea23v8z6y0a1ci",
@@ -2,10 +2,10 @@ import type { IAppUpdateStatus, INetworkStatusSummary } from "@peers-app/peers-s
2
2
  import type { INetworkDetailsData } from "./use-network-details-data";
3
3
  import { type SyncingLook } from "./use-syncing-look";
4
4
  /**
5
- * The network status popover: Use Invite and Identity, then a headline, a line per group and the
6
- * connected devices as chips. It's built to hold still while the status changes: groups keep
7
- * their lines and change in place, and anything that goes away (a device, an error, an alert)
8
- * stays a moment, faded, before it folds out.
5
+ * The network status popover: Use Invite and Identity, then a headline, a line per group, the
6
+ * connected devices as chips, and the switch for the tab bar's look. It's built to hold still
7
+ * while the status changes: groups keep their lines and change in place, and anything that goes
8
+ * away (a device, an error, an alert) stays a moment, faded, before it folds out.
9
9
  */
10
10
  export declare function NetworkStatusDetails({ detailsId, status, missingChangeCount, appUpdate, unavailable, data, syncingLook, syncingCount, onUseInvite, onOpenIdentity, onOpenViewer, onOpenRecovery, }: {
11
11
  detailsId: string;
@@ -6,6 +6,7 @@ const app_update_controls_1 = require("../app-updates/app-update-controls");
6
6
  const linger_1 = require("./linger");
7
7
  const network_status_format_1 = require("./network-status-format");
8
8
  const network_status_model_1 = require("./network-status-model");
9
+ const tab_bar_shortcuts_1 = require("./tab-bar-shortcuts");
9
10
  const use_syncing_look_1 = require("./use-syncing-look");
10
11
  const DETAILS_CSS = `
11
12
  .peers-netstat-fold {
@@ -191,13 +192,13 @@ function stuckRecoveryText(stuckRecoveryCount) {
191
192
  : `${stuckRecoveryCount} records need attention`;
192
193
  }
193
194
  /**
194
- * The network status popover: Use Invite and Identity, then a headline, a line per group and the
195
- * connected devices as chips. It's built to hold still while the status changes: groups keep
196
- * their lines and change in place, and anything that goes away (a device, an error, an alert)
197
- * stays a moment, faded, before it folds out.
195
+ * The network status popover: Use Invite and Identity, then a headline, a line per group, the
196
+ * connected devices as chips, and the switch for the tab bar's look. It's built to hold still
197
+ * while the status changes: groups keep their lines and change in place, and anything that goes
198
+ * away (a device, an error, an alert) stays a moment, faded, before it folds out.
198
199
  */
199
200
  function NetworkStatusDetails({ detailsId, status, missingChangeCount, appUpdate, unavailable, data, syncingLook, syncingCount, onUseInvite, onOpenIdentity, onOpenViewer, onOpenRecovery, }) {
200
201
  const needsRecovery = !!status && (status.stuckRecoveryCount > 0 || missingChangeCount > 0);
201
202
  const rows = status && data.groups ? (0, network_status_model_1.groupRows)(data.groups, status, data.myUserId) : undefined;
202
- return ((0, jsx_runtime_1.jsxs)("div", { id: detailsId, role: "dialog", "aria-label": "Network status details", className: "card shadow position-absolute end-0 mt-1", style: { top: "100%", width: "320px", zIndex: 1100 }, children: [(0, jsx_runtime_1.jsx)("style", { children: DETAILS_CSS }), (0, jsx_runtime_1.jsxs)("div", { className: "card-body p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex gap-2 mb-3", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: "btn btn-sm btn-outline-primary flex-fill", onClick: onUseInvite, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-qr-code me-1", "aria-hidden": "true" }), "Use Invite"] }), (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "btn btn-sm btn-outline-primary flex-fill", onClick: onOpenIdentity, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-person-badge me-1", "aria-hidden": "true" }), "Identity"] })] }), (0, jsx_runtime_1.jsx)(app_update_controls_1.AppUpdatePopoverSection, { status: appUpdate }), unavailable || !status ? ((0, jsx_runtime_1.jsx)("p", { className: "small text-muted mb-3", children: "Network diagnostics are temporarily unavailable. The local host may still be starting or reconnecting." })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Headline, { status: status, syncingLook: syncingLook, syncingCount: syncingCount, groupCount: data.groups?.length }), (0, jsx_runtime_1.jsx)("div", { className: "peers-netstat-section", children: "Groups" }), (0, jsx_runtime_1.jsx)(GroupList, { rows: rows }), (0, jsx_runtime_1.jsx)("div", { className: "peers-netstat-section", children: "Devices" }), (0, jsx_runtime_1.jsx)(DeviceChips, { data: data }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3", children: [(0, jsx_runtime_1.jsx)(LingeringAlert, { text: stuckRecoveryText(status.stuckRecoveryCount) }), (0, jsx_runtime_1.jsx)(LingeringAlert, { text: missingChangesText(missingChangeCount) })] })] })), (0, jsx_runtime_1.jsx)("button", { type: "button", className: `btn btn-sm btn-outline-primary w-100${needsRecovery ? " mb-2" : ""}`, onClick: onOpenViewer, children: "Open Network Viewer" }), needsRecovery && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-warning w-100", onClick: onOpenRecovery, children: "Sync recovery" }))] })] }));
203
+ return ((0, jsx_runtime_1.jsxs)("div", { id: detailsId, role: "dialog", "aria-label": "Network status details", className: "card shadow position-absolute end-0 mt-1", style: { top: "100%", width: "320px", zIndex: 1100 }, children: [(0, jsx_runtime_1.jsx)("style", { children: DETAILS_CSS }), (0, jsx_runtime_1.jsxs)("div", { className: "card-body p-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex gap-2 mb-3", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: "btn btn-sm btn-outline-primary flex-fill", onClick: onUseInvite, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-qr-code me-1", "aria-hidden": "true" }), "Use Invite"] }), (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "btn btn-sm btn-outline-primary flex-fill", onClick: onOpenIdentity, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-person-badge me-1", "aria-hidden": "true" }), "Identity"] })] }), (0, jsx_runtime_1.jsx)(app_update_controls_1.AppUpdatePopoverSection, { status: appUpdate }), unavailable || !status ? ((0, jsx_runtime_1.jsx)("p", { className: "small text-muted mb-3", children: "Network diagnostics are temporarily unavailable. The local host may still be starting or reconnecting." })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Headline, { status: status, syncingLook: syncingLook, syncingCount: syncingCount, groupCount: data.groups?.length }), (0, jsx_runtime_1.jsx)("div", { className: "peers-netstat-section", children: "Groups" }), (0, jsx_runtime_1.jsx)(GroupList, { rows: rows }), (0, jsx_runtime_1.jsx)("div", { className: "peers-netstat-section", children: "Devices" }), (0, jsx_runtime_1.jsx)(DeviceChips, { data: data }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3", children: [(0, jsx_runtime_1.jsx)(LingeringAlert, { text: stuckRecoveryText(status.stuckRecoveryCount) }), (0, jsx_runtime_1.jsx)(LingeringAlert, { text: missingChangesText(missingChangeCount) })] })] })), (0, jsx_runtime_1.jsx)(tab_bar_shortcuts_1.TabBarLookSwitch, {}), (0, jsx_runtime_1.jsx)("button", { type: "button", className: `btn btn-sm btn-outline-primary w-100${needsRecovery ? " mb-2" : ""}`, onClick: onOpenViewer, children: "Open Network Viewer" }), needsRecovery && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-warning w-100", onClick: onOpenRecovery, children: "Sync recovery" }))] })] }));
203
204
  }
@@ -1,5 +1,6 @@
1
1
  import type { IAppUpdateStatus } from "@peers-app/peers-sdk";
2
2
  import { type INetworkStatusViewState } from "./use-network-status";
3
+ /** Timing thresholds for the network indicator's syncing appearance. */
3
4
  export { SYNCED_STABLE_MS, SYNCING_GREEN_MS } from "./use-syncing-look";
4
5
  type NetworkStatusMark = "solid" | "pulse" | "indeterminate";
5
6
  interface INetworkStatusPresentation {
@@ -19,6 +19,7 @@ const tabs_state_1 = require("./tabs-state");
19
19
  const use_network_details_data_1 = require("./use-network-details-data");
20
20
  const use_network_status_1 = require("./use-network-status");
21
21
  const use_syncing_look_1 = require("./use-syncing-look");
22
+ /** Timing thresholds for the network indicator's syncing appearance. */
22
23
  var use_syncing_look_2 = require("./use-syncing-look");
23
24
  Object.defineProperty(exports, "SYNCED_STABLE_MS", { enumerable: true, get: function () { return use_syncing_look_2.SYNCED_STABLE_MS; } });
24
25
  Object.defineProperty(exports, "SYNCING_GREEN_MS", { enumerable: true, get: function () { return use_syncing_look_2.SYNCING_GREEN_MS; } });
@@ -0,0 +1,46 @@
1
+ import type React from "react";
2
+ /**
3
+ * How the tab bar looks: `shortcuts` puts Use Invite and Identity on it as icons (left of Search
4
+ * on the desktop, in the first row of the phone's menu); `simple` leaves them in the network
5
+ * popover only.
6
+ */
7
+ export type TabBarLook = "simple" | "shortcuts";
8
+ /**
9
+ * The user's tab bar look, the same on all their devices. It starts with the shortcuts, so a new
10
+ * person finds their invites and Identity without knowing the network popover.
11
+ */
12
+ export declare const tabBarLook: import("@peers-app/peers-sdk").PersistentVar<TabBarLook>;
13
+ /** How many invites wait on the user's answer: those Identity's Activity asks them to answer. */
14
+ export declare function useInvitesWaiting(): number;
15
+ /**
16
+ * Opens what Use Invite is for: the invites waiting on the user, in Identity's Activity, or the
17
+ * page for pasting or scanning one when none wait. When the invites can't be read, Activity.
18
+ */
19
+ export declare function openUseInvite(): Promise<void>;
20
+ /** Opens Identity at the user's own account. */
21
+ export declare function openIdentity(): void;
22
+ /**
23
+ * Use Invite's name, with how many invites wait.
24
+ *
25
+ * @param waiting - How many invites wait on the user.
26
+ */
27
+ export declare function inviteButtonLabel(waiting: number): string;
28
+ /**
29
+ * Use Invite and Identity as icons on the desktop tab bar, left of Search, in the shortcuts look.
30
+ * The simple look renders nothing and reads no invites.
31
+ */
32
+ export declare function TabBarShortcuts(): import("react/jsx-runtime").JSX.Element | null;
33
+ /** The props of {@link MenuShortcuts}. */
34
+ export interface MenuShortcutsProps {
35
+ /** The first row's icon item style, so they match Search and the bell. */
36
+ itemStyle: React.CSSProperties;
37
+ /** Closes the menu after one is picked. */
38
+ onDone: () => void;
39
+ }
40
+ /**
41
+ * Use Invite and Identity as icons in the phone menu's first row, in the shortcuts look. The
42
+ * simple look renders nothing and reads no invites.
43
+ */
44
+ export declare function MenuShortcuts(props: MenuShortcutsProps): import("react/jsx-runtime").JSX.Element | null;
45
+ /** The network popover's switch between the two tab bar looks. */
46
+ export declare function TabBarLookSwitch(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tabBarLook = void 0;
4
+ exports.useInvitesWaiting = useInvitesWaiting;
5
+ exports.openUseInvite = openUseInvite;
6
+ exports.openIdentity = openIdentity;
7
+ exports.inviteButtonLabel = inviteButtonLabel;
8
+ exports.TabBarShortcuts = TabBarShortcuts;
9
+ exports.MenuShortcuts = MenuShortcuts;
10
+ exports.TabBarLookSwitch = TabBarLookSwitch;
11
+ const jsx_runtime_1 = require("react/jsx-runtime");
12
+ const peers_sdk_1 = require("@peers-app/peers-sdk");
13
+ const react_1 = require("react");
14
+ const segmented_control_1 = require("../components/segmented-control");
15
+ const hooks_1 = require("../hooks");
16
+ const identity_routes_1 = require("../screens/identity/identity-routes");
17
+ const tabs_state_1 = require("./tabs-state");
18
+ /**
19
+ * The user's tab bar look, the same on all their devices. It starts with the shortcuts, so a new
20
+ * person finds their invites and Identity without knowing the network popover.
21
+ */
22
+ exports.tabBarLook = (0, peers_sdk_1.userVar)("tabBarLook", { defaultValue: "shortcuts" });
23
+ const LOOK_CHOICES = [
24
+ { value: "simple", label: "Simple" },
25
+ { value: "shortcuts", label: "With shortcuts" },
26
+ ];
27
+ /** How many invites wait on the user's answer: those Identity's Activity asks them to answer. */
28
+ function useInvitesWaiting() {
29
+ const [count, setCount] = (0, react_1.useState)(0);
30
+ (0, react_1.useEffect)(() => {
31
+ let disposed = false;
32
+ let unsubscribe;
33
+ const readFailed = (err) => console.warn("[tab bar] couldn't count waiting invites", String(err));
34
+ void (0, peers_sdk_1.getUserContext)()
35
+ .then((userContext) => {
36
+ if (disposed)
37
+ return;
38
+ const invites = (0, peers_sdk_1.Invites)(userContext.userDataContext);
39
+ const refresh = async () => {
40
+ const rows = await invites.list({ status: "pending" });
41
+ if (!disposed)
42
+ setCount(rows.filter(peers_sdk_1.inviteNeedsAnswer).length);
43
+ };
44
+ const subscription = invites.dataChanged.subscribe(() => void refresh().catch(readFailed));
45
+ unsubscribe = () => subscription.unsubscribe();
46
+ return refresh();
47
+ })
48
+ .catch(readFailed);
49
+ return () => {
50
+ disposed = true;
51
+ unsubscribe?.();
52
+ };
53
+ }, []);
54
+ return count;
55
+ }
56
+ /**
57
+ * Opens what Use Invite is for: the invites waiting on the user, in Identity's Activity, or the
58
+ * page for pasting or scanning one when none wait. When the invites can't be read, Activity.
59
+ */
60
+ async function openUseInvite() {
61
+ let waiting;
62
+ try {
63
+ const userContext = await (0, peers_sdk_1.getUserContext)();
64
+ const pending = await (0, peers_sdk_1.Invites)(userContext.userDataContext).list({ status: "pending" });
65
+ waiting = pending.some(peers_sdk_1.inviteNeedsAnswer);
66
+ }
67
+ catch (err) {
68
+ // Activity lists the invites itself, and says so when it can't.
69
+ console.warn("[tab bar] couldn't read waiting invites", String(err));
70
+ waiting = true;
71
+ }
72
+ (0, tabs_state_1.goToTabPath)(waiting ? identity_routes_1.IDENTITY_ACTIVITY_PATH : identity_routes_1.IDENTITY_ACCEPT_PATH);
73
+ }
74
+ /** Opens Identity at the user's own account. */
75
+ function openIdentity() {
76
+ (0, tabs_state_1.goToTabPath)(identity_routes_1.IDENTITY_ACCOUNT_PATH);
77
+ }
78
+ /**
79
+ * Use Invite's name, with how many invites wait.
80
+ *
81
+ * @param waiting - How many invites wait on the user.
82
+ */
83
+ function inviteButtonLabel(waiting) {
84
+ if (!waiting)
85
+ return "Use Invite";
86
+ return `Use Invite · ${waiting} invite${waiting === 1 ? "" : "s"} waiting for you`;
87
+ }
88
+ /**
89
+ * The count over Use Invite: the bell's badge, in Use Invite's blue, so past 99 it reads "99+"
90
+ * as the bell's does; the button's name carries the exact count.
91
+ */
92
+ function WaitingBadge({ count }) {
93
+ if (!count)
94
+ return null;
95
+ return ((0, jsx_runtime_1.jsx)("span", { className: "badge rounded-pill bg-primary position-absolute", style: { fontSize: "0.55rem", top: "-0.45rem", right: "-0.7rem", padding: "0.2em 0.4em" }, "aria-hidden": "true", "data-testid": "use-invite-count", children: count > 99 ? "99+" : count }));
96
+ }
97
+ /**
98
+ * Use Invite and Identity as icons on the desktop tab bar, left of Search, in the shortcuts look.
99
+ * The simple look renders nothing and reads no invites.
100
+ */
101
+ function TabBarShortcuts() {
102
+ const [look] = (0, hooks_1.useObservable)(exports.tabBarLook);
103
+ return look === "shortcuts" ? (0, jsx_runtime_1.jsx)(StripShortcuts, {}) : null;
104
+ }
105
+ function StripShortcuts() {
106
+ const waiting = useInvitesWaiting();
107
+ const inviteLabel = inviteButtonLabel(waiting);
108
+ const className = "btn btn-sm ms-1 d-flex align-items-center flex-shrink-0 peers-strip-icon-button peers-strip-shortcut";
109
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: className, onClick: () => void openUseInvite(), title: inviteLabel, "aria-label": inviteLabel, "data-testid": "tab-bar-use-invite", children: (0, jsx_runtime_1.jsxs)("span", { className: "position-relative d-inline-flex", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-qr-code", style: { fontSize: "14px" }, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)(WaitingBadge, { count: waiting })] }) }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: className, onClick: openIdentity, title: "Identity", "aria-label": "Identity", "data-testid": "tab-bar-identity", children: (0, jsx_runtime_1.jsx)("i", { className: "bi-person-badge", style: { fontSize: "14px" }, "aria-hidden": "true" }) })] }));
110
+ }
111
+ /**
112
+ * Use Invite and Identity as icons in the phone menu's first row, in the shortcuts look. The
113
+ * simple look renders nothing and reads no invites.
114
+ */
115
+ function MenuShortcuts(props) {
116
+ const [look] = (0, hooks_1.useObservable)(exports.tabBarLook);
117
+ return look === "shortcuts" ? (0, jsx_runtime_1.jsx)(MenuShortcutItems, { ...props }) : null;
118
+ }
119
+ function MenuShortcutItems(props) {
120
+ const waiting = useInvitesWaiting();
121
+ const inviteLabel = inviteButtonLabel(waiting);
122
+ const className = "dropdown-item d-flex align-items-center justify-content-center peers-menu-shortcut";
123
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: className, style: props.itemStyle, title: inviteLabel, "aria-label": inviteLabel, "data-testid": "mobile-menu-use-invite", onClick: () => {
124
+ void openUseInvite();
125
+ props.onDone();
126
+ }, children: (0, jsx_runtime_1.jsxs)("span", { className: "position-relative d-inline-flex", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-qr-code", style: { fontSize: "20px" }, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)(WaitingBadge, { count: waiting })] }) }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: className, style: props.itemStyle, title: "Identity", "aria-label": "Identity", "data-testid": "mobile-menu-identity", onClick: () => {
127
+ openIdentity();
128
+ props.onDone();
129
+ }, children: (0, jsx_runtime_1.jsx)("i", { className: "bi-person-badge", style: { fontSize: "20px" }, "aria-hidden": "true" }) })] }));
130
+ }
131
+ /** The network popover's switch between the two tab bar looks. */
132
+ function TabBarLookSwitch() {
133
+ const [look] = (0, hooks_1.useObservable)(exports.tabBarLook);
134
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-2 mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "small text-body-secondary text-nowrap", children: "Tab bar" }), (0, jsx_runtime_1.jsx)(segmented_control_1.SegmentedControl, { label: "Tab bar", className: "flex-grow-1", choices: LOOK_CHOICES, value: look, onChange: async (value) => {
135
+ // The SDK starts saving choices after its initial load. A previous save failure
136
+ // is already logged there, and the user can still switch the look locally.
137
+ await exports.tabBarLook.loadingPromise.catch(() => { });
138
+ (0, exports.tabBarLook)(value);
139
+ } })] }));
140
+ }
@@ -62,6 +62,7 @@ const color_mode_dropdown_1 = require("../screens/settings/color-mode-dropdown")
62
62
  const console_app_1 = require("../system-apps/console.app");
63
63
  const ui_loader_1 = require("../ui-router/ui-loader");
64
64
  const network_status_indicator_1 = require("./network-status-indicator");
65
+ const tab_bar_shortcuts_1 = require("./tab-bar-shortcuts");
65
66
  const tab_color_1 = require("./tab-color");
66
67
  const tab_order_1 = require("./tab-order");
67
68
  const tab_switcher_overlay_1 = require("./tab-switcher-overlay");
@@ -110,14 +111,13 @@ function TabsLayoutInternal({ fillContainer = false } = {}) {
110
111
  const [_colorMode] = (0, hooks_1.useObservable)(color_mode_dropdown_1.colorMode);
111
112
  const [tabs] = (0, hooks_1.useObservable)(tabs_state_1.activeTabs);
112
113
  const [activeTab] = (0, hooks_1.useObservable)(tabs_state_1.activeTabId);
113
- const [currentlyActiveGroupId, setCurrentlyActiveGroupId] = (0, react_1.useState)("");
114
+ const [groupSwitchKey, setGroupSwitchKey] = (0, react_1.useState)("");
114
115
  const [switchingGroup, setSwitchingGroup] = (0, react_1.useState)(false);
115
116
  (0, react_1.useEffect)(() => {
116
117
  let sub;
117
118
  (0, peers_sdk_1.getUserContext)().then((userContext) => {
118
- setCurrentlyActiveGroupId(userContext.currentlyActiveGroupId() || userContext.userId);
119
- sub = userContext.currentlyActiveGroupId.subscribe(async (_groupId) => {
120
- setCurrentlyActiveGroupId(userContext.currentlyActiveGroupId() || userContext.userId);
119
+ sub = userContext.currentlyActiveGroupId.subscribe(async (groupId) => {
120
+ setGroupSwitchKey(groupId || userContext.userId);
121
121
  setSwitchingGroup(true);
122
122
  await userContext.waitForActiveGroupPersistence();
123
123
  await peers_sdk_1.rpcServerCalls.flushDatabases();
@@ -148,7 +148,7 @@ function TabsLayoutInternal({ fillContainer = false } = {}) {
148
148
  paddingRight: app_shell_height_1.WINDOW_CONTROLS_RIGHT,
149
149
  borderBottomWidth: "1px",
150
150
  borderBottomColor: _colorMode === "light" ? "var(--peers-tab-edge)" : "#495057",
151
- }, children: isMobile ? ((0, jsx_runtime_1.jsx)(MobileTabsHeader, { tabs: tabs, activeTab: activeTab, onSwitch: switchTab, onClose: tabs_state_1.closeTab, colorMode: _colorMode })) : ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center px-1", style: { height: "36px" }, children: [(0, jsx_runtime_1.jsx)(host_app_menu_1.HostAppMenuButton, {}), (0, jsx_runtime_1.jsx)(group_switcher_1.GroupSwitcher, { colorMode: _colorMode, isMobile: false }), (0, jsx_runtime_1.jsx)(DesktopTabStrip, { tabs: tabs, activeTab: activeTab, onSwitch: switchTab, colorMode: _colorMode }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm ms-1 d-flex align-items-center flex-shrink-0 peers-strip-icon-button", onClick: command_palette_1.openCommandPalette, title: "Search everything (Cmd+K)", children: (0, jsx_runtime_1.jsx)("i", { className: "bi-search", style: { fontSize: "14px" } }) }), (0, jsx_runtime_1.jsx)(network_status_indicator_1.TabsStripIndicators, {})] })) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1 overflow-hidden", children: inPaneOrder(tabs).map((tab) => ((0, jsx_runtime_1.jsx)("div", { className: `h-100 ${activeTab === tab.tabId ? "d-block" : "d-none"}`, style: { display: activeTab === tab.tabId ? "block" : "none" }, children: (0, jsx_runtime_1.jsx)(TabErrorBoundary, { tabTitle: tab.title, tabId: tab.tabId, children: (0, jsx_runtime_1.jsx)(TabContent, { tab: tab, isMobile: isMobile, isActive: activeTab === tab.tabId }) }) }, tab.tabId))) }), (0, jsx_runtime_1.jsx)(tab_switcher_overlay_1.TabSwitcherOverlay, {})] }, currentlyActiveGroupId));
151
+ }, children: isMobile ? ((0, jsx_runtime_1.jsx)(MobileTabsHeader, { tabs: tabs, activeTab: activeTab, onSwitch: switchTab, onClose: tabs_state_1.closeTab, colorMode: _colorMode })) : ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center px-1", style: { height: "36px" }, children: [(0, jsx_runtime_1.jsx)(host_app_menu_1.HostAppMenuButton, {}), (0, jsx_runtime_1.jsx)(group_switcher_1.GroupSwitcher, { colorMode: _colorMode, isMobile: false }), (0, jsx_runtime_1.jsx)(DesktopTabStrip, { tabs: tabs, activeTab: activeTab, onSwitch: switchTab, colorMode: _colorMode }), (0, jsx_runtime_1.jsx)(tab_bar_shortcuts_1.TabBarShortcuts, {}), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm ms-1 d-flex align-items-center flex-shrink-0 peers-strip-icon-button", onClick: command_palette_1.openCommandPalette, title: "Search everything (Cmd+K)", children: (0, jsx_runtime_1.jsx)("i", { className: "bi-search", style: { fontSize: "14px" } }) }), (0, jsx_runtime_1.jsx)(network_status_indicator_1.TabsStripIndicators, {})] })) }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1 overflow-hidden", children: inPaneOrder(tabs).map((tab) => ((0, jsx_runtime_1.jsx)("div", { className: `h-100 ${activeTab === tab.tabId ? "d-block" : "d-none"}`, style: { display: activeTab === tab.tabId ? "block" : "none" }, children: (0, jsx_runtime_1.jsx)(TabErrorBoundary, { tabTitle: tab.title, tabId: tab.tabId, children: (0, jsx_runtime_1.jsx)(TabContent, { tab: tab, isMobile: isMobile, isActive: activeTab === tab.tabId }) }) }, tab.tabId))) }), (0, jsx_runtime_1.jsx)(tab_switcher_overlay_1.TabSwitcherOverlay, {})] }, groupSwitchKey));
152
152
  }
153
153
  /**
154
154
  * The tabs in an order that never changes for tabs already open (by id), so a reorder in the
@@ -194,10 +194,12 @@ function DesktopTabStrip({ tabs, activeTab, onSwitch, colorMode }) {
194
194
  exports.MENU_DOUBLE_TAP_MS = 350;
195
195
  /** The mobile menu's width: room for a notification's text, and a 0.5 rem gutter each side. */
196
196
  const MOBILE_MENU_WIDTH = "min(24rem, calc(100vw - 1rem))";
197
- /** The first row's icon items (Search, Notifications): square touch targets beside Apps. */
197
+ /** The first row's icon items (the shortcuts, Search, Notifications): square touch targets. */
198
+ // 56px wide, shrinking to a 44px touch target when the row is tight (four icons and Apps on a
199
+ // 320px-wide phone).
198
200
  const MENU_ICON_ITEM_STYLE = {
199
- width: "56px",
200
- flex: "0 0 auto",
201
+ flex: "0 1 56px",
202
+ minWidth: "44px",
201
203
  padding: "14px 0",
202
204
  };
203
205
  function MobileTabsHeader({ tabs, activeTab, onSwitch, onClose, colorMode, }) {
@@ -276,7 +278,7 @@ function MobileTabsHeader({ tabs, activeTab, onSwitch, onClose, colorMode, }) {
276
278
  }, "data-testid": "mobile-menu", children: menuView === "notifications" ? ((0, jsx_runtime_1.jsx)(notifications_panel_1.NotificationsPanel, { onClose: closeMenu, onBack: () => setMenuView("menu"), fillHeight: true })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-stretch", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: `dropdown-item d-flex align-items-center flex-grow-1 ${activeTab === "launcher" ? "active" : ""}`, style: { padding: "14px 18px", fontSize: "17px" }, onClick: () => {
277
279
  onSwitch("launcher");
278
280
  closeMenu();
279
- }, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-grid-3x3-gap me-3", style: { fontSize: "20px" } }), (0, jsx_runtime_1.jsx)("span", { children: "Apps" })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "dropdown-item d-flex align-items-center justify-content-center", style: MENU_ICON_ITEM_STYLE, title: "Search", "aria-label": "Search", onClick: () => {
281
+ }, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-grid-3x3-gap me-3", style: { fontSize: "20px" } }), (0, jsx_runtime_1.jsx)("span", { children: "Apps" })] }), (0, jsx_runtime_1.jsx)(tab_bar_shortcuts_1.MenuShortcuts, { itemStyle: MENU_ICON_ITEM_STYLE, onDone: closeMenu }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "dropdown-item d-flex align-items-center justify-content-center", style: MENU_ICON_ITEM_STYLE, title: "Search", "aria-label": "Search", onClick: () => {
280
282
  (0, command_palette_1.openCommandPalette)();
281
283
  closeMenu();
282
284
  }, children: (0, jsx_runtime_1.jsx)("i", { className: "bi-search", style: { fontSize: "20px" } }) }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "dropdown-item d-flex align-items-center justify-content-center", style: MENU_ICON_ITEM_STYLE, title: notificationsLabel, "aria-label": notificationsLabel, "data-testid": "mobile-menu-notifications", onClick: () => setMenuView("notifications"), children: (0, jsx_runtime_1.jsxs)("span", { className: "position-relative d-inline-flex", children: [(0, jsx_runtime_1.jsx)("i", { className: notificationSummary.paused