@peers-app/peers-ui 0.33.23 → 0.33.24

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.
@@ -4,7 +4,15 @@
4
4
  * `100dvh` is the height actually visible. `100vh` in a mobile browser is the height with its
5
5
  * toolbars hidden, so a shell sized to it is taller than the screen and the whole page scrolls,
6
6
  * header and all. The host sets `--peers-shell-top` and `--peers-shell-bottom`: the PWA uses the
7
- * device's safe areas (the status bar and home indicator of an installed iOS app); without them
8
- * the top defaults to Electron's 25px macOS titlebar.
7
+ * device's safe areas (the status bar and home indicator of an installed iOS app). Both default
8
+ * to none: Electron draws no title bar of its own in the page.
9
9
  */
10
- export declare const APP_SHELL_HEIGHT = "calc(100dvh - var(--peers-shell-top, 25px) - var(--peers-shell-bottom, 0px))";
10
+ export declare const APP_SHELL_HEIGHT = "calc(100dvh - var(--peers-shell-top, 0px) - var(--peers-shell-bottom, 0px))";
11
+ /**
12
+ * Room the shell's top strip leaves at its left end for the window's own buttons, which the host
13
+ * draws over the page: macOS's red, yellow and green buttons in Electron, which has no title bar
14
+ * there. The host sets `--peers-window-controls-left` (none in full screen, where the buttons
15
+ * hide), and adds the `peers-window-draggable` class to `<html>` so the strip's empty space moves
16
+ * the window (theme.css). Elsewhere it's none.
17
+ */
18
+ export declare const WINDOW_CONTROLS_LEFT = "var(--peers-window-controls-left, 0px)";
@@ -1,13 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APP_SHELL_HEIGHT = void 0;
3
+ exports.WINDOW_CONTROLS_LEFT = exports.APP_SHELL_HEIGHT = void 0;
4
4
  /**
5
5
  * Height of the app shell: the visible viewport less the room the host keeps outside it.
6
6
  *
7
7
  * `100dvh` is the height actually visible. `100vh` in a mobile browser is the height with its
8
8
  * toolbars hidden, so a shell sized to it is taller than the screen and the whole page scrolls,
9
9
  * header and all. The host sets `--peers-shell-top` and `--peers-shell-bottom`: the PWA uses the
10
- * device's safe areas (the status bar and home indicator of an installed iOS app); without them
11
- * the top defaults to Electron's 25px macOS titlebar.
10
+ * device's safe areas (the status bar and home indicator of an installed iOS app). Both default
11
+ * to none: Electron draws no title bar of its own in the page.
12
12
  */
13
- exports.APP_SHELL_HEIGHT = "calc(100dvh - var(--peers-shell-top, 25px) - var(--peers-shell-bottom, 0px))";
13
+ exports.APP_SHELL_HEIGHT = "calc(100dvh - var(--peers-shell-top, 0px) - var(--peers-shell-bottom, 0px))";
14
+ /**
15
+ * Room the shell's top strip leaves at its left end for the window's own buttons, which the host
16
+ * draws over the page: macOS's red, yellow and green buttons in Electron, which has no title bar
17
+ * there. The host sets `--peers-window-controls-left` (none in full screen, where the buttons
18
+ * hide), and adds the `peers-window-draggable` class to `<html>` so the strip's empty space moves
19
+ * the window (theme.css). Elsewhere it's none.
20
+ */
21
+ exports.WINDOW_CONTROLS_LEFT = "var(--peers-window-controls-left, 0px)";
@@ -41,7 +41,11 @@ function FullScreenLayout() {
41
41
  const isLauncher = activeTab.packageId === "launcher" || activeTab.tabId === "launcher";
42
42
  const isLight = mode === "light";
43
43
  const title = isLauncher ? "Apps" : activeTab.title;
44
- return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-column", style: { height: app_shell_height_1.APP_SHELL_HEIGHT, overflow: "hidden" }, children: [(0, jsx_runtime_1.jsxs)("div", { className: `border-bottom peers-tab-strip d-flex align-items-center px-1 ${isLight ? "" : "bg-dark"}`, style: { height: "36px", borderBottomColor: isLight ? "var(--peers-tab-edge)" : "#495057" }, children: [(0, jsx_runtime_1.jsx)(group_switcher_1.GroupSwitcher, { colorMode: mode, isMobile: isMobile }), (0, jsx_runtime_1.jsx)(HeaderButton, { isLight: isLight, active: isLauncher, icon: "bi-grid-3x3-gap", label: "Apps", onClick: () => (0, tabs_state_1.activeTabId)("launcher") }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center flex-grow-1 overflow-hidden px-2", children: [!isLauncher && activeTab.iconClassName && ((0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: activeTab.iconClassName, className: "me-2" })), (0, jsx_runtime_1.jsx)("span", { className: "text-truncate fw-medium", style: { fontSize: "13px" }, children: title })] }), (0, jsx_runtime_1.jsx)(notification_bell_1.NotificationBell, { compact: true }), (0, jsx_runtime_1.jsx)(HeaderButton, { isLight: isLight, icon: "bi-search", label: `Search and navigate (${paletteHint})`, onClick: command_palette_1.openCommandPalette, children: (0, jsx_runtime_1.jsx)("span", { className: "d-none d-md-inline ms-1", style: { fontSize: "11px" }, children: paletteHint }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1 overflow-hidden", children: (0, jsx_runtime_1.jsx)(tabs_layout_1.TabErrorBoundary, { tabTitle: activeTab.title, tabId: activeTab.tabId, children: (0, jsx_runtime_1.jsx)(tabs_layout_1.TabContent, { tab: activeTab, isMobile: isMobile, isActive: true }) }, activeTab.tabId) })] }));
44
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-column", style: { height: app_shell_height_1.APP_SHELL_HEIGHT, overflow: "hidden" }, children: [(0, jsx_runtime_1.jsxs)("div", { className: `border-bottom peers-tab-strip d-flex align-items-center pe-1 ${isLight ? "" : "bg-dark"}`, style: {
45
+ height: "36px",
46
+ paddingLeft: `calc(${app_shell_height_1.WINDOW_CONTROLS_LEFT} + 0.25rem)`,
47
+ borderBottomColor: isLight ? "var(--peers-tab-edge)" : "#495057",
48
+ }, children: [(0, jsx_runtime_1.jsx)(group_switcher_1.GroupSwitcher, { colorMode: mode, isMobile: isMobile }), (0, jsx_runtime_1.jsx)(HeaderButton, { isLight: isLight, active: isLauncher, icon: "bi-grid-3x3-gap", label: "Apps", onClick: () => (0, tabs_state_1.activeTabId)("launcher") }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center flex-grow-1 overflow-hidden px-2", children: [!isLauncher && activeTab.iconClassName && ((0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: activeTab.iconClassName, className: "me-2" })), (0, jsx_runtime_1.jsx)("span", { className: "text-truncate fw-medium", style: { fontSize: "13px" }, children: title })] }), (0, jsx_runtime_1.jsx)(notification_bell_1.NotificationBell, { compact: true }), (0, jsx_runtime_1.jsx)(HeaderButton, { isLight: isLight, icon: "bi-search", label: `Search and navigate (${paletteHint})`, onClick: command_palette_1.openCommandPalette, children: (0, jsx_runtime_1.jsx)("span", { className: "d-none d-md-inline ms-1", style: { fontSize: "11px" }, children: paletteHint }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow-1 overflow-hidden", children: (0, jsx_runtime_1.jsx)(tabs_layout_1.TabErrorBoundary, { tabTitle: activeTab.title, tabId: activeTab.tabId, children: (0, jsx_runtime_1.jsx)(tabs_layout_1.TabContent, { tab: activeTab, isMobile: isMobile, isActive: true }) }, activeTab.tabId) })] }));
45
49
  }
46
50
  /** A small, transparent header button matching the tabs layout's toolbar styling. */
47
51
  function HeaderButton({ isLight, icon, label, onClick, active, children }) {
@@ -15,7 +15,7 @@ const MIN_SIZE = 120;
15
15
  function clamp(value, min, max) {
16
16
  return Math.max(min, Math.min(max, value));
17
17
  }
18
- /** Pixels occupied by the fixed titlebar (macOS = 25, hidden elsewhere). */
18
+ /** Pixels the host keeps above the page (its body's top padding; none in Electron now). */
19
19
  function getTopOffset() {
20
20
  if (typeof document === "undefined")
21
21
  return 0;
@@ -140,6 +140,7 @@ function TabsLayoutInternal({ fillContainer = false } = {}) {
140
140
  justifyContent: "center",
141
141
  backgroundColor: _colorMode === "light" ? "rgba(var(--bs-body-bg-rgb), 0.85)" : "rgba(0,0,0,0.85)",
142
142
  }, children: (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "spinner-border text-secondary mb-3", role: "status" }), (0, jsx_runtime_1.jsx)("div", { className: `small ${_colorMode === "light" ? "text-muted" : "text-secondary"}`, children: "Switching group..." })] }) })), (0, jsx_runtime_1.jsx)("div", { className: `border-bottom peers-tab-strip ${_colorMode === "light" ? "" : "bg-dark"}`, style: {
143
+ paddingLeft: app_shell_height_1.WINDOW_CONTROLS_LEFT,
143
144
  borderBottomWidth: "1px",
144
145
  borderBottomColor: _colorMode === "light" ? "var(--peers-tab-edge)" : "#495057",
145
146
  }, 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)(group_switcher_1.GroupSwitcher, { colorMode: _colorMode, isMobile: false }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm me-2 d-flex align-items-center", onClick: command_palette_1.openCommandPalette, title: "Search everything (Cmd+K)", style: {
package/dist/theme.css CHANGED
@@ -95,6 +95,45 @@
95
95
  --bs-table-bg: var(--peers-surface-bg);
96
96
  }
97
97
 
98
+ /* The host draws the window's own buttons over the strip's left end and has no title bar
99
+ (Electron on macOS: peers-window-draggable on <html>, room in --peers-window-controls-left).
100
+ The strip's empty space moves the window, and what takes a click in it stays clickable. So does
101
+ an overlay that can cover the strip (position-fixed, a modal, or peers-window-no-drag on a
102
+ package's own): the region ignores what's drawn on top, so its top edge would move the window. */
103
+ .peers-window-draggable .peers-tab-strip {
104
+ -webkit-app-region: drag;
105
+ app-region: drag;
106
+ }
107
+
108
+ .peers-window-draggable
109
+ .peers-tab-strip
110
+ :is(
111
+ button,
112
+ a,
113
+ input,
114
+ select,
115
+ textarea,
116
+ label,
117
+ [role="button"],
118
+ [role="dialog"],
119
+ [role="menu"],
120
+ .peers-tab,
121
+ .dropdown-menu
122
+ ),
123
+ .peers-window-draggable
124
+ :is(
125
+ .position-fixed,
126
+ .fixed-top,
127
+ .modal,
128
+ .modal-backdrop,
129
+ .offcanvas,
130
+ .toast-container,
131
+ .peers-window-no-drag
132
+ ) {
133
+ -webkit-app-region: no-drag;
134
+ app-region: no-drag;
135
+ }
136
+
98
137
  [data-bs-theme="light"] .peers-tab-strip {
99
138
  --bs-border-color: var(--peers-tab-edge);
100
139
  background-color: var(--peers-tab-strip-bg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-ui",
3
- "version": "0.33.23",
3
+ "version": "0.33.24",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/peers-app/peers-ui.git"
@@ -36,7 +36,7 @@
36
36
  "lint:fix": "biome check --write ."
37
37
  },
38
38
  "peerDependencies": {
39
- "@peers-app/peers-sdk": "^0.33.23",
39
+ "@peers-app/peers-sdk": "^0.33.24",
40
40
  "bootstrap": "^5.3.3",
41
41
  "react": "^18.0.0",
42
42
  "react-dom": "^18.0.0"
@@ -47,7 +47,7 @@
47
47
  "@babel/preset-react": "^7.24.1",
48
48
  "@babel/preset-typescript": "^7.27.1",
49
49
  "@biomejs/biome": "2.3.11",
50
- "@peers-app/peers-sdk": "0.33.23",
50
+ "@peers-app/peers-sdk": "0.33.24",
51
51
  "@testing-library/dom": "^10.4.0",
52
52
  "@testing-library/jest-dom": "^6.6.3",
53
53
  "@testing-library/react": "^16.3.0",