@burdenoff/fe-libs 2026.1113.8 → 2026.1113.10

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 (26) hide show
  1. package/dist/chrome/shell/WorkspaceMenu.d.ts +15 -1
  2. package/dist/chrome/shell/WorkspaceMenu.js +322 -240
  3. package/dist/chrome/shell/useWorkspaceMenuControls.d.ts +10 -0
  4. package/dist/chrome/shell/useWorkspaceMenuControls.js +39 -0
  5. package/dist/chrome/shell/useWorkspaceMenuLists.d.ts +33 -0
  6. package/dist/chrome/shell/useWorkspaceMenuLists.js +59 -0
  7. package/dist/chrome/shell/workspaceMenuLists.d.ts +61 -0
  8. package/dist/chrome/shell/workspaceMenuLists.js +31 -0
  9. package/dist/chrome/shellLabelManifest.d.ts +7 -0
  10. package/dist/shared/assistant/index.d.ts +2 -0
  11. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +7 -0
  12. package/dist/shared/assistant/ui/AIAssistantPanel.js +214 -212
  13. package/dist/shared/assistant/ui/AssistantHeader.d.ts +2 -1
  14. package/dist/shared/assistant/ui/AssistantHeader.js +1 -1
  15. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +46 -2
  16. package/dist/shared/assistant/ui/AssistantOverlay.js +359 -307
  17. package/dist/shared/assistant/ui/AssistantPageHost.d.ts +11 -0
  18. package/dist/shared/assistant/ui/AssistantPageHost.js +17 -0
  19. package/dist/shared/assistant/ui/assistantPageSurface.d.ts +11 -0
  20. package/dist/shared/assistant/ui/assistantPageSurface.js +10 -0
  21. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +2 -1
  22. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +2 -2
  23. package/dist/shared/assistant/ui/compact/AssistantMenuView.d.ts +5 -2
  24. package/dist/shared/assistant/ui/compact/AssistantMenuView.js +4 -4
  25. package/dist/shared-assistant.js +69 -67
  26. package/package.json +1 -1
@@ -30,6 +30,13 @@ export interface WorkspaceMenuProps {
30
30
  * an explicit choice.
31
31
  */
32
32
  onSelectWorkspaceWide?(): void;
33
+ /**
34
+ * BOFF-13461: adds "New project" at the end of the PROJECT group, shown only
35
+ * when this is passed (like `onNewWorkspace`) and a workspace is active. With
36
+ * it, the group shows even while the workspace has no project yet, so the
37
+ * first one can be made from here.
38
+ */
39
+ onNewProject?(): void;
33
40
  organizations: {
34
41
  id: string;
35
42
  name: string;
@@ -50,5 +57,12 @@ export interface WorkspaceMenuProps {
50
57
  onSelectProduct(id: string): void;
51
58
  /** Phone top-bar trigger: fills the bar, menu drops from its start edge. */
52
59
  compact?: boolean;
60
+ /**
61
+ * BOFF-13461 (Navigation v2): each list shows about six rows in a visible
62
+ * scroll area and gets a search box past five rows; ORGANIZATION lists every
63
+ * organization in place (the active one checked) instead of the ⇅ sub-menu.
64
+ * Absent or false: the menu of before.
65
+ */
66
+ searchableLists?: boolean;
53
67
  }
54
- export declare function WorkspaceMenu({ logo, workspaceName, orgName, workspaces, activeWorkspaceId, onSelectWorkspace, onNewWorkspace, projects, activeProjectId, onSelectProject, onSelectWorkspaceWide, organizations, activeOrganizationId, onSelectOrganization, currentProduct, products, onSelectProduct, compact, }: WorkspaceMenuProps): import('react').JSX.Element;
68
+ export declare function WorkspaceMenu(props: WorkspaceMenuProps): import('react').JSX.Element;
@@ -1,278 +1,360 @@
1
- import { useAssistantControl as e } from "../../shared/assistant/appControls/useAssistantControl.js";
2
- import { cn as t } from "../../shared-utils.js";
3
- import { useShellLabel as n } from "../../shared/providers/shell/useShellLabel.js";
4
- import { DropdownMenu as r, DropdownMenuContent as i, DropdownMenuItem as a, DropdownMenuSeparator as o, DropdownMenuSub as s, DropdownMenuSubContent as c, DropdownMenuSubTrigger as l, DropdownMenuTrigger as u } from "../../ui/dropdown-menu.js";
5
- import { useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
6
- import { Check as h, ChevronDown as g, ChevronsUpDown as ee, Folders as _, Landmark as v, LayoutGrid as y, Plus as b } from "lucide-react";
7
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
1
+ import { cn as e } from "../../shared-utils.js";
2
+ import { useShellLabel as t } from "../../shared/providers/shell/useShellLabel.js";
3
+ import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuSeparator as a, DropdownMenuSub as o, DropdownMenuSubContent as s, DropdownMenuSubTrigger as c, DropdownMenuTrigger as l } from "../../ui/dropdown-menu.js";
4
+ import { Input as u } from "../../ui/input.js";
5
+ import { ScrollBar as d } from "../../ui/scroll-area.js";
6
+ import { WORKSPACE_MENU_LIST_ATTR as f, onWorkspaceMenuSearchKeyDown as p } from "./workspaceMenuLists.js";
7
+ import { useWorkspaceMenuLists as m } from "./useWorkspaceMenuLists.js";
8
+ import { useWorkspaceMenuControls as h } from "./useWorkspaceMenuControls.js";
9
+ import { useId as g, useState as _ } from "react";
10
+ import { Check as v, ChevronDown as y, ChevronsUpDown as b, Folders as x, Landmark as S, LayoutGrid as C, Plus as w, Search as T } from "lucide-react";
11
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
12
+ import * as k from "@radix-ui/react-scroll-area";
8
13
  // src/chrome/shell/WorkspaceMenu.tsx
9
- var w = "rounded-card border border-border-subtle bg-popover p-1.5 shadow-overlay", T = "h-control-sm gap-2.5 rounded-button px-2.5 focus:bg-bg-sunken", E = "px-2.5 pb-1 pt-2 text-caption font-semibold uppercase tracking-wider text-text-muted", D = "max-h-80 overflow-y-auto rounded-card border border-border-subtle bg-popover p-1.5 shadow-overlay";
10
- function O(e) {
14
+ var A = "rounded-card border border-border-subtle bg-popover p-1.5 shadow-overlay", j = "h-control-sm gap-2.5 rounded-button px-2.5 focus:bg-bg-sunken", M = "px-2.5 pb-1 pt-2 text-caption font-semibold uppercase tracking-wider text-text-muted", N = "max-h-80 overflow-y-auto rounded-card border border-border-subtle bg-popover p-1.5 shadow-overlay";
15
+ function P(e) {
11
16
  let t = e.trim().charAt(0).toUpperCase() || "?";
12
- return /* @__PURE__ */ S("span", {
17
+ return /* @__PURE__ */ D("span", {
13
18
  "aria-hidden": "true",
14
19
  className: "flex size-5 flex-shrink-0 items-center justify-center rounded-button bg-accent-soft text-caption font-semibold text-accent-primary",
15
20
  children: t
16
21
  });
17
22
  }
18
- function k(e) {
19
- return e ? /* @__PURE__ */ S(h, {
23
+ var F = [];
24
+ function I(e) {
25
+ return e ? /* @__PURE__ */ D(v, {
20
26
  className: "ms-auto size-4 flex-shrink-0 text-accent-primary",
21
27
  "aria-hidden": "true"
22
28
  }) : null;
23
29
  }
24
- function A({ logo: h, workspaceName: A, orgName: j, workspaces: M, activeWorkspaceId: N, onSelectWorkspace: P, onNewWorkspace: F, projects: I = [], activeProjectId: L, onSelectProject: R, onSelectWorkspaceWide: z, organizations: B, activeOrganizationId: V, onSelectOrganization: H, currentProduct: U, products: W, onSelectProduct: G, compact: K = !1 }) {
25
- let q = n(), [J, Y] = m(!1), X = B.find((e) => e.id === V)?.name ?? j, Z = W.filter((e) => e.id !== U.id), Q = I.length > 0 && R !== void 0, te = Q && !!N && z !== void 0, $ = p({
26
- open: J,
27
- workspaces: M,
28
- activeWorkspaceId: N,
29
- onSelectWorkspace: P
30
+ function L({ id: e, testId: t, current: n, onPick: r, icon: a, label: o, rowProps: s }) {
31
+ return /* @__PURE__ */ O(i, {
32
+ className: j,
33
+ onSelect: () => r(),
34
+ "data-testid": t,
35
+ "aria-current": n ? "true" : void 0,
36
+ ...s,
37
+ children: [
38
+ a,
39
+ /* @__PURE__ */ D("span", {
40
+ className: "min-w-0 flex-1 truncate",
41
+ children: o
42
+ }),
43
+ I(n)
44
+ ]
45
+ }, e);
46
+ }
47
+ function R(e, t, n) {
48
+ return /* @__PURE__ */ O(i, {
49
+ className: j,
50
+ onSelect: () => n(),
51
+ "data-testid": e,
52
+ children: [/* @__PURE__ */ D(w, {
53
+ className: "size-4 flex-shrink-0 text-text-secondary",
54
+ "aria-hidden": "true"
55
+ }), /* @__PURE__ */ D("span", {
56
+ className: "truncate",
57
+ children: t
58
+ })]
59
+ });
60
+ }
61
+ function z(e, t) {
62
+ return /* @__PURE__ */ D("div", {
63
+ role: "presentation",
64
+ className: M,
65
+ ...t ? { id: t } : {},
66
+ children: e
67
+ });
68
+ }
69
+ var B = "max-h-[calc(var(--size-controlHeight-sm)*6.5)] pe-2.5 [&>div]:block! focus-visible:outline-none", V = "pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted", H = "px-2.5 py-2 text-body-sm text-text-muted", U = "max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-auto";
70
+ function W({ labelledBy: e, testId: t, rows: n, search: r }) {
71
+ return /* @__PURE__ */ O("div", {
72
+ role: "group",
73
+ "aria-labelledby": e,
74
+ "data-testid": `${t}-list`,
75
+ [f]: "",
76
+ children: [
77
+ r && /* @__PURE__ */ O("div", {
78
+ className: "relative px-1 pb-1",
79
+ children: [/* @__PURE__ */ D(T, {
80
+ className: V,
81
+ "aria-hidden": "true"
82
+ }), /* @__PURE__ */ D(u, {
83
+ type: "search",
84
+ value: r.query,
85
+ onChange: (e) => r.onQueryChange(e.target.value),
86
+ onKeyDown: p,
87
+ placeholder: r.label,
88
+ "aria-label": r.label,
89
+ autoComplete: "off",
90
+ spellCheck: !1,
91
+ "data-testid": `shell-workspace-search-${r.name}`,
92
+ className: "h-control-sm ps-8 text-body-sm"
93
+ })]
94
+ }),
95
+ /* @__PURE__ */ O(k.Root, {
96
+ type: "auto",
97
+ className: "relative overflow-hidden",
98
+ children: [/* @__PURE__ */ D(k.Viewport, {
99
+ className: B,
100
+ "data-testid": t,
101
+ children: n
102
+ }), /* @__PURE__ */ D(d, {})]
103
+ }),
104
+ r && /* @__PURE__ */ D("div", {
105
+ role: "status",
106
+ "data-testid": `shell-workspace-nomatch-${r.name}`,
107
+ children: r.noMatch ? /* @__PURE__ */ D("p", {
108
+ className: H,
109
+ children: r.noMatch
110
+ }) : null
111
+ })
112
+ ]
113
+ });
114
+ }
115
+ function G(e, { name: t, testId: n, plainTestId: r, rows: i }) {
116
+ return e.searchable ? W({
117
+ labelledBy: `${e.labelIds}-${t}`,
118
+ testId: n,
119
+ rows: i,
120
+ search: e.lists[t].search
121
+ }) : /* @__PURE__ */ D("div", {
122
+ className: "max-h-60 overflow-y-auto",
123
+ ...r ? { "data-testid": r } : {},
124
+ children: i
125
+ });
126
+ }
127
+ function K(e) {
128
+ let { props: t, lists: n, shellLabel: r, labelIds: i, orgLabel: a, searchable: o } = e, { activeWorkspaceId: s, onSelectWorkspace: c, onNewWorkspace: l } = t, u = n.workspaces, d = u.shown.map((e) => L({
129
+ id: e.id,
130
+ testId: `shell-workspace-item-${e.id}`,
131
+ current: e.id === s,
132
+ onPick: () => {
133
+ e.id !== s && c(e.id);
134
+ },
135
+ icon: P(e.name),
136
+ label: e.name,
137
+ rowProps: u.rowProps
138
+ }));
139
+ return /* @__PURE__ */ O(E, { children: [
140
+ z(r("shell.workspaceMenu.workspacesIn", "Workspaces in {{org}}", { org: a }), o ? `${i}-workspaces` : void 0),
141
+ G(e, {
142
+ name: "workspaces",
143
+ testId: "shell-workspace-workspaces",
144
+ rows: d
145
+ }),
146
+ l && R("shell-workspace-new", r("shell.workspaceMenu.newWorkspace", "New workspace"), () => l())
147
+ ] });
148
+ }
149
+ function q(e) {
150
+ let { props: t, projects: n, lists: r, shellLabel: i, labelIds: o, searchable: s } = e, { activeWorkspaceId: c, activeProjectId: l, onSelectProject: u, onSelectWorkspaceWide: d } = t, { onNewProject: f } = t, p = n.length > 0 && u !== void 0, m = f !== void 0 && !!c;
151
+ if (!p && !m) return null;
152
+ let h = r.projects, g = !!c && d !== void 0 && !h.filtering, _ = /* @__PURE__ */ O(E, { children: [g && L({
153
+ id: "workspace-wide",
154
+ testId: "shell-workspace-all-projects",
155
+ current: !l,
156
+ onPick: () => d?.(),
157
+ icon: /* @__PURE__ */ D("span", {
158
+ className: "flex size-5 flex-shrink-0 items-center justify-center",
159
+ children: /* @__PURE__ */ D(x, {
160
+ className: "size-4 text-text-secondary",
161
+ "aria-hidden": "true"
162
+ })
163
+ }),
164
+ label: i("contextSwitcher.allProjectsWorkspaceWide", "All projects (workspace-wide)"),
165
+ rowProps: h.rowProps
166
+ }), h.shown.map((e) => L({
167
+ id: e.id,
168
+ testId: `shell-workspace-project-${e.id}`,
169
+ current: e.id === l,
170
+ onPick: () => {
171
+ e.id !== l && u?.(e.id);
172
+ },
173
+ icon: P(e.name),
174
+ label: e.name,
175
+ rowProps: h.rowProps
176
+ }))] });
177
+ return /* @__PURE__ */ O(E, { children: [
178
+ /* @__PURE__ */ D(a, { className: "my-1.5" }),
179
+ z(i("contextSwitcher.project", "Project"), s ? `${o}-projects` : void 0),
180
+ p && G(e, {
181
+ name: "projects",
182
+ testId: "shell-workspace-projects",
183
+ plainTestId: "shell-workspace-projects",
184
+ rows: _
185
+ }),
186
+ m && R("shell-workspace-new-project", i("shell.workspaceMenu.newProject", "New project"), () => f?.())
187
+ ] });
188
+ }
189
+ function J(t, n) {
190
+ return /* @__PURE__ */ O(o, { children: [/* @__PURE__ */ O(c, {
191
+ className: j,
192
+ "data-testid": "shell-workspace-org-trigger",
193
+ indicator: /* @__PURE__ */ D(b, {
194
+ className: "size-4 flex-shrink-0 text-text-muted",
195
+ "aria-hidden": "true"
196
+ }),
197
+ children: [/* @__PURE__ */ D(S, {
198
+ className: "size-4 flex-shrink-0 text-text-secondary",
199
+ "aria-hidden": "true"
200
+ }), /* @__PURE__ */ D("span", {
201
+ className: "min-w-0 flex-1 truncate",
202
+ children: t
203
+ })]
204
+ }), /* @__PURE__ */ D(s, {
205
+ sideOffset: 6,
206
+ "data-testid": "shell-workspace-org-menu",
207
+ className: e(N, "w-64"),
208
+ children: n
209
+ })] });
210
+ }
211
+ function Y(e) {
212
+ let { props: t, lists: n, shellLabel: r, labelIds: i, orgLabel: o, searchable: s } = e, { organizations: c, activeOrganizationId: l, onSelectOrganization: u } = t;
213
+ if (c.length === 0) return null;
214
+ let d = n.organizations, f = d.shown.map((e) => L({
215
+ id: e.id,
216
+ testId: `shell-workspace-org-${e.id}`,
217
+ current: e.id === l,
218
+ onPick: () => {
219
+ e.id !== l && u(e.id);
220
+ },
221
+ icon: /* @__PURE__ */ D(S, {
222
+ className: "size-4 flex-shrink-0 text-text-secondary",
223
+ "aria-hidden": "true"
224
+ }),
225
+ label: e.name,
226
+ rowProps: d.rowProps
227
+ }));
228
+ return /* @__PURE__ */ O(E, { children: [
229
+ /* @__PURE__ */ D(a, { className: "my-1.5" }),
230
+ z(r("shell.workspaceMenu.organization", "Organization"), s ? `${i}-organizations` : void 0),
231
+ s ? W({
232
+ labelledBy: `${i}-organizations`,
233
+ testId: "shell-workspace-orgs",
234
+ rows: f,
235
+ search: d.search
236
+ }) : J(o, f)
237
+ ] });
238
+ }
239
+ function X({ props: t, shellLabel: n }) {
240
+ let { currentProduct: r, products: l, onSelectProduct: u } = t, d = l.filter((e) => e.id !== r.id);
241
+ return /* @__PURE__ */ O(E, { children: [
242
+ /* @__PURE__ */ D(a, { className: "my-1.5" }),
243
+ z(n("shell.workspaceMenu.product", "Product")),
244
+ /* @__PURE__ */ O(i, {
245
+ className: j,
246
+ "aria-current": "true",
247
+ "data-testid": `shell-workspace-product-${r.id}`,
248
+ children: [
249
+ /* @__PURE__ */ D("span", {
250
+ className: "flex size-5 flex-shrink-0 items-center justify-center",
251
+ children: r.logo ?? P(r.name)
252
+ }),
253
+ /* @__PURE__ */ D("span", {
254
+ className: "min-w-0 flex-1 truncate",
255
+ children: r.name
256
+ }),
257
+ I(!0)
258
+ ]
259
+ }),
260
+ d.length > 0 && /* @__PURE__ */ O(o, { children: [/* @__PURE__ */ O(c, {
261
+ className: j,
262
+ "data-testid": "shell-workspace-switch-product",
263
+ children: [/* @__PURE__ */ D(C, {
264
+ className: "size-4 flex-shrink-0 text-text-secondary",
265
+ "aria-hidden": "true"
266
+ }), /* @__PURE__ */ D("span", {
267
+ className: "min-w-0 flex-1 truncate",
268
+ children: n("productSwitcher.title", "Switch product")
269
+ })]
270
+ }), /* @__PURE__ */ D(s, {
271
+ sideOffset: 6,
272
+ "data-testid": "shell-workspace-product-menu",
273
+ className: e(N, "w-64"),
274
+ children: d.map((e) => /* @__PURE__ */ O(i, {
275
+ className: j,
276
+ onSelect: () => u(e.id),
277
+ "data-testid": `shell-workspace-product-${e.id}`,
278
+ children: [/* @__PURE__ */ D("span", {
279
+ className: "flex size-5 flex-shrink-0 items-center justify-center",
280
+ children: e.icon ?? P(e.name)
281
+ }), /* @__PURE__ */ D("span", {
282
+ className: "min-w-0 flex-1 truncate",
283
+ children: e.name
284
+ })]
285
+ }, e.id))
286
+ })] })
287
+ ] });
288
+ }
289
+ function Z(i) {
290
+ let { logo: a, workspaceName: o, orgName: s, workspaces: c, organizations: u } = i, { activeWorkspaceId: d, onSelectWorkspace: f, activeOrganizationId: p } = i, v = i.compact ?? !1, b = i.searchableLists ?? !1, x = i.projects ?? F, S = t(), [C, w] = _(!1), T = g(), E = m(b, {
291
+ workspaces: c,
292
+ projects: x,
293
+ organizations: u
30
294
  });
31
- d(() => {
32
- $.current = {
33
- open: J,
34
- workspaces: M,
35
- activeWorkspaceId: N,
36
- onSelectWorkspace: P
37
- };
38
- }, [
39
- J,
40
- M,
41
- N,
42
- P
43
- ]);
44
- let ne = f(() => ({ run: () => $.current.open ? { status: "already" } : (Y(!0), { status: "done" }) }), []);
45
- e("header.context", ne);
46
- let re = f(() => ({
47
- targets: () => $.current.workspaces.map((e) => ({
48
- id: e.id,
49
- label: e.name,
50
- current: e.id === $.current.activeWorkspaceId
51
- })),
52
- switchTo: (e) => {
53
- let t = $.current, n = t.workspaces.find((t) => t.id === e);
54
- return n ? n.id === t.activeWorkspaceId ? { status: "already" } : (t.onSelectWorkspace(n.id), { status: "done" }) : { status: "failed" };
55
- }
56
- }), []);
57
- return e("header.workspace", re), /* @__PURE__ */ C(r, {
58
- open: J,
59
- onOpenChange: Y,
295
+ h({
296
+ open: C,
297
+ setOpen: w,
298
+ workspaces: c,
299
+ activeWorkspaceId: d,
300
+ onSelectWorkspace: f
301
+ });
302
+ let k = u.find((e) => e.id === p)?.name ?? s, j = {
303
+ props: i,
304
+ projects: x,
305
+ lists: E,
306
+ shellLabel: S,
307
+ labelIds: T,
308
+ orgLabel: k,
309
+ searchable: b
310
+ };
311
+ return /* @__PURE__ */ O(n, {
312
+ open: C,
313
+ onOpenChange: (e) => {
314
+ w(e), e || E.clear();
315
+ },
60
316
  modal: !1,
61
- children: [/* @__PURE__ */ S(u, {
317
+ children: [/* @__PURE__ */ D(l, {
62
318
  asChild: !0,
63
- children: /* @__PURE__ */ C("button", {
319
+ children: /* @__PURE__ */ O("button", {
64
320
  type: "button",
65
- "aria-label": q("shell.workspaceMenu.trigger", "Switch workspace: {{name}}", { name: A }),
321
+ "aria-label": S("shell.workspaceMenu.trigger", "Switch workspace: {{name}}", { name: o }),
66
322
  "data-testid": "shell-workspace-trigger",
67
- className: t("group flex min-w-0 items-center gap-2.5 rounded-button p-1 text-start outline-none transition-colors hover:bg-bg-sunken focus-visible:ring-2 focus-visible:ring-focus-ring data-[state=open]:bg-bg-elevated", K ? "w-full" : "flex-1"),
323
+ className: e("group flex min-w-0 items-center gap-2.5 rounded-button p-1 text-start outline-none transition-colors hover:bg-bg-sunken focus-visible:ring-2 focus-visible:ring-focus-ring data-[state=open]:bg-bg-elevated", v ? "w-full" : "flex-1"),
68
324
  children: [
69
- /* @__PURE__ */ S("span", {
325
+ /* @__PURE__ */ D("span", {
70
326
  className: "flex size-8 flex-shrink-0 items-center justify-center",
71
- children: h
327
+ children: a
72
328
  }),
73
- /* @__PURE__ */ C("span", {
329
+ /* @__PURE__ */ O("span", {
74
330
  className: "min-w-0 flex-1",
75
- children: [/* @__PURE__ */ S("span", {
331
+ children: [/* @__PURE__ */ D("span", {
76
332
  className: "block truncate text-body-sm font-semibold text-text-primary",
77
- children: A
78
- }), /* @__PURE__ */ S("span", {
333
+ children: o
334
+ }), /* @__PURE__ */ D("span", {
79
335
  className: "block truncate text-xs text-text-muted",
80
- children: X
336
+ children: k
81
337
  })]
82
338
  }),
83
- /* @__PURE__ */ S(g, {
339
+ /* @__PURE__ */ D(y, {
84
340
  className: "size-3.5 flex-shrink-0 text-text-muted",
85
341
  "aria-hidden": "true"
86
342
  })
87
343
  ]
88
344
  })
89
- }), /* @__PURE__ */ C(i, {
345
+ }), /* @__PURE__ */ O(r, {
90
346
  side: "bottom",
91
347
  align: "start",
92
348
  sideOffset: 6,
93
349
  "data-testid": "shell-workspace-menu",
94
- className: t(w, "w-[300px]"),
350
+ className: e(A, "w-[300px]", b && U),
95
351
  children: [
96
- /* @__PURE__ */ S("div", {
97
- role: "presentation",
98
- className: E,
99
- children: q("shell.workspaceMenu.workspacesIn", "Workspaces in {{org}}", { org: X })
100
- }),
101
- /* @__PURE__ */ S("div", {
102
- className: "max-h-60 overflow-y-auto",
103
- children: M.map((e) => /* @__PURE__ */ C(a, {
104
- className: T,
105
- onSelect: () => {
106
- e.id !== N && P(e.id);
107
- },
108
- "data-testid": `shell-workspace-item-${e.id}`,
109
- "aria-current": e.id === N ? "true" : void 0,
110
- children: [
111
- O(e.name),
112
- /* @__PURE__ */ S("span", {
113
- className: "min-w-0 flex-1 truncate",
114
- children: e.name
115
- }),
116
- k(e.id === N)
117
- ]
118
- }, e.id))
119
- }),
120
- F && /* @__PURE__ */ C(a, {
121
- className: T,
122
- onSelect: () => F(),
123
- "data-testid": "shell-workspace-new",
124
- children: [/* @__PURE__ */ S(b, {
125
- className: "size-4 flex-shrink-0 text-text-secondary",
126
- "aria-hidden": "true"
127
- }), /* @__PURE__ */ S("span", {
128
- className: "truncate",
129
- children: q("shell.workspaceMenu.newWorkspace", "New workspace")
130
- })]
131
- }),
132
- Q && /* @__PURE__ */ C(x, { children: [
133
- /* @__PURE__ */ S(o, { className: "my-1.5" }),
134
- /* @__PURE__ */ S("div", {
135
- role: "presentation",
136
- className: E,
137
- children: q("contextSwitcher.project", "Project")
138
- }),
139
- /* @__PURE__ */ C("div", {
140
- className: "max-h-60 overflow-y-auto",
141
- "data-testid": "shell-workspace-projects",
142
- children: [te && /* @__PURE__ */ C(a, {
143
- className: T,
144
- onSelect: () => z?.(),
145
- "data-testid": "shell-workspace-all-projects",
146
- "aria-current": L ? void 0 : "true",
147
- children: [
148
- /* @__PURE__ */ S("span", {
149
- className: "flex size-5 flex-shrink-0 items-center justify-center",
150
- children: /* @__PURE__ */ S(_, {
151
- className: "size-4 text-text-secondary",
152
- "aria-hidden": "true"
153
- })
154
- }),
155
- /* @__PURE__ */ S("span", {
156
- className: "min-w-0 flex-1 truncate",
157
- children: q("contextSwitcher.allProjectsWorkspaceWide", "All projects (workspace-wide)")
158
- }),
159
- k(!L)
160
- ]
161
- }), I.map((e) => /* @__PURE__ */ C(a, {
162
- className: T,
163
- onSelect: () => {
164
- e.id !== L && R?.(e.id);
165
- },
166
- "data-testid": `shell-workspace-project-${e.id}`,
167
- "aria-current": e.id === L ? "true" : void 0,
168
- children: [
169
- O(e.name),
170
- /* @__PURE__ */ S("span", {
171
- className: "min-w-0 flex-1 truncate",
172
- children: e.name
173
- }),
174
- k(e.id === L)
175
- ]
176
- }, e.id))]
177
- })
178
- ] }),
179
- B.length > 0 && /* @__PURE__ */ C(x, { children: [
180
- /* @__PURE__ */ S(o, { className: "my-1.5" }),
181
- /* @__PURE__ */ S("div", {
182
- role: "presentation",
183
- className: E,
184
- children: q("shell.workspaceMenu.organization", "Organization")
185
- }),
186
- /* @__PURE__ */ C(s, { children: [/* @__PURE__ */ C(l, {
187
- className: T,
188
- "data-testid": "shell-workspace-org-trigger",
189
- indicator: /* @__PURE__ */ S(ee, {
190
- className: "size-4 flex-shrink-0 text-text-muted",
191
- "aria-hidden": "true"
192
- }),
193
- children: [/* @__PURE__ */ S(v, {
194
- className: "size-4 flex-shrink-0 text-text-secondary",
195
- "aria-hidden": "true"
196
- }), /* @__PURE__ */ S("span", {
197
- className: "min-w-0 flex-1 truncate",
198
- children: X
199
- })]
200
- }), /* @__PURE__ */ S(c, {
201
- sideOffset: 6,
202
- "data-testid": "shell-workspace-org-menu",
203
- className: t(D, "w-64"),
204
- children: B.map((e) => /* @__PURE__ */ C(a, {
205
- className: T,
206
- onSelect: () => {
207
- e.id !== V && H(e.id);
208
- },
209
- "data-testid": `shell-workspace-org-${e.id}`,
210
- "aria-current": e.id === V ? "true" : void 0,
211
- children: [
212
- /* @__PURE__ */ S(v, {
213
- className: "size-4 flex-shrink-0 text-text-secondary",
214
- "aria-hidden": "true"
215
- }),
216
- /* @__PURE__ */ S("span", {
217
- className: "min-w-0 flex-1 truncate",
218
- children: e.name
219
- }),
220
- k(e.id === V)
221
- ]
222
- }, e.id))
223
- })] })
224
- ] }),
225
- /* @__PURE__ */ S(o, { className: "my-1.5" }),
226
- /* @__PURE__ */ S("div", {
227
- role: "presentation",
228
- className: E,
229
- children: q("shell.workspaceMenu.product", "Product")
230
- }),
231
- /* @__PURE__ */ C(a, {
232
- className: T,
233
- "aria-current": "true",
234
- "data-testid": `shell-workspace-product-${U.id}`,
235
- children: [
236
- /* @__PURE__ */ S("span", {
237
- className: "flex size-5 flex-shrink-0 items-center justify-center",
238
- children: U.logo ?? O(U.name)
239
- }),
240
- /* @__PURE__ */ S("span", {
241
- className: "min-w-0 flex-1 truncate",
242
- children: U.name
243
- }),
244
- k(!0)
245
- ]
246
- }),
247
- Z.length > 0 && /* @__PURE__ */ C(s, { children: [/* @__PURE__ */ C(l, {
248
- className: T,
249
- "data-testid": "shell-workspace-switch-product",
250
- children: [/* @__PURE__ */ S(y, {
251
- className: "size-4 flex-shrink-0 text-text-secondary",
252
- "aria-hidden": "true"
253
- }), /* @__PURE__ */ S("span", {
254
- className: "min-w-0 flex-1 truncate",
255
- children: q("productSwitcher.title", "Switch product")
256
- })]
257
- }), /* @__PURE__ */ S(c, {
258
- sideOffset: 6,
259
- "data-testid": "shell-workspace-product-menu",
260
- className: t(D, "w-64"),
261
- children: Z.map((e) => /* @__PURE__ */ C(a, {
262
- className: T,
263
- onSelect: () => G(e.id),
264
- "data-testid": `shell-workspace-product-${e.id}`,
265
- children: [/* @__PURE__ */ S("span", {
266
- className: "flex size-5 flex-shrink-0 items-center justify-center",
267
- children: e.icon ?? O(e.name)
268
- }), /* @__PURE__ */ S("span", {
269
- className: "min-w-0 flex-1 truncate",
270
- children: e.name
271
- })]
272
- }, e.id))
273
- })] })
352
+ K(j),
353
+ q(j),
354
+ Y(j),
355
+ X(j)
274
356
  ]
275
357
  })]
276
358
  });
277
359
  }
278
- export { A as WorkspaceMenu };
360
+ export { Z as WorkspaceMenu };
@@ -0,0 +1,10 @@
1
+ export declare function useWorkspaceMenuControls(now: {
2
+ open: boolean;
3
+ setOpen(open: boolean): void;
4
+ workspaces: readonly {
5
+ id: string;
6
+ name: string;
7
+ }[];
8
+ activeWorkspaceId?: string;
9
+ onSelectWorkspace(id: string): void;
10
+ }): void;
@@ -0,0 +1,39 @@
1
+ import { useAssistantControl as e } from "../../shared/assistant/appControls/useAssistantControl.js";
2
+ import { useEffect as t, useMemo as n, useRef as r } from "react";
3
+ // src/chrome/shell/useWorkspaceMenuControls.ts
4
+ function i(i) {
5
+ let { open: a, setOpen: o, workspaces: s, activeWorkspaceId: c, onSelectWorkspace: l } = i, u = r({
6
+ open: a,
7
+ workspaces: s,
8
+ activeWorkspaceId: c,
9
+ onSelectWorkspace: l
10
+ });
11
+ t(() => {
12
+ u.current = {
13
+ open: a,
14
+ workspaces: s,
15
+ activeWorkspaceId: c,
16
+ onSelectWorkspace: l
17
+ };
18
+ }, [
19
+ a,
20
+ s,
21
+ c,
22
+ l
23
+ ]);
24
+ let d = n(() => ({ run: () => u.current.open ? { status: "already" } : (o(!0), { status: "done" }) }), [o]);
25
+ e("header.context", d);
26
+ let f = n(() => ({
27
+ targets: () => u.current.workspaces.map((e) => ({
28
+ id: e.id,
29
+ label: e.name,
30
+ current: e.id === u.current.activeWorkspaceId
31
+ })),
32
+ switchTo: (e) => {
33
+ let t = u.current, n = t.workspaces.find((t) => t.id === e);
34
+ return n ? n.id === t.activeWorkspaceId ? { status: "already" } : (t.onSelectWorkspace(n.id), { status: "done" }) : { status: "failed" };
35
+ }
36
+ }), []);
37
+ e("header.workspace", f);
38
+ }
39
+ export { i as useWorkspaceMenuControls };