@burdenoff/fe-libs 2026.1010.3 → 2026.1011.2

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.
@@ -1,39 +1,40 @@
1
1
  import { Sheet as e, SheetContent as t, SheetHeader as n, SheetTitle as r } from "../ui/sheet.js";
2
2
  import { useShellLabel as i } from "../shared/providers/shell/useShellLabel.js";
3
3
  import { useAssistantControl as a } from "../shared/assistant/appControls/useAssistantControl.js";
4
- import { EscapeLayer as o } from "../shared/components/EscapeLayer.js";
5
- import { useIsMobile as s } from "./contextSwitcher/useIsMobile.js";
6
- import { TabButton as c } from "./contextSwitcher/TabButton.js";
7
- import { OrganizationList as l } from "./contextSwitcher/OrganizationList.js";
8
- import { WorkspaceList as u } from "./contextSwitcher/WorkspaceList.js";
9
- import { ProjectList as d } from "./contextSwitcher/ProjectList.js";
10
- import { TriggerButton as f } from "./contextSwitcher/TriggerButton.js";
11
- import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
12
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
4
+ import { EscapeLayer as ee } from "../shared/components/EscapeLayer.js";
5
+ import { useIsMobile as te } from "./contextSwitcher/useIsMobile.js";
6
+ import { TabButton as o } from "./contextSwitcher/TabButton.js";
7
+ import { matchesOrganizationSearch as s } from "./contextSwitcher/organizationLabel.js";
8
+ import { OrganizationList as c } from "./contextSwitcher/OrganizationList.js";
9
+ import { WorkspaceList as l } from "./contextSwitcher/WorkspaceList.js";
10
+ import { ProjectList as u } from "./contextSwitcher/ProjectList.js";
11
+ import { TriggerButton as d } from "./contextSwitcher/TriggerButton.js";
12
+ import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
13
+ import { Fragment as ne, jsx as _, jsxs as v } from "react/jsx-runtime";
13
14
  //#region src/chrome/ContextSwitcher.tsx
14
- var x = ({ organizations: x, workspaces: S, projects: C, currentOrganizationId: w, currentWorkspaceId: T, currentProjectId: E, onOrganizationChange: D, onWorkspaceChange: O, onProjectChange: k, onWorkspaceWideChange: A, compact: ee = !1 }) => {
15
- let j = i(), [M, N] = _(!1), [P, F] = _(() => w ? "workspace" : "org"), [I, L] = _({
15
+ var y = ({ organizations: y, workspaces: b, projects: x, currentOrganizationId: S, currentWorkspaceId: C, currentProjectId: w, onOrganizationChange: T, onWorkspaceChange: E, onProjectChange: D, onWorkspaceWideChange: O, compact: re = !1 }) => {
16
+ let k = i(), [A, j] = g(!1), [M, N] = g(() => S ? "workspace" : "org"), [P, F] = g({
16
17
  org: "",
17
18
  workspace: "",
18
19
  project: ""
19
- }), R = s(), z = g(null), B = g(null), V = g(w);
20
- V.current = w;
21
- let te = x.find((e) => e.id === w), ne = S.find((e) => e.id === T), re = C.find((e) => e.id === E), H = S.filter((e) => e.organizationId === w), U = C.filter((e) => e.workspaceId === T), W = p((e, t) => {
20
+ }), I = te(), L = h(null), R = h(null), z = h(S);
21
+ z.current = S;
22
+ let ie = y.find((e) => e.id === S), B = b.find((e) => e.id === C), V = x.find((e) => e.id === w), H = b.filter((e) => e.organizationId === S), U = x.filter((e) => e.workspaceId === C), W = f((e, t) => {
22
23
  if (!t.trim()) return e;
23
24
  let n = t.toLowerCase().trim();
24
25
  return e.filter((e) => e.name.toLowerCase().includes(n));
25
- }, []), G = g({
26
+ }, []), G = h({
26
27
  filteredWorkspaces: H,
27
- currentWorkspaceId: T,
28
- onWorkspaceChange: O
28
+ currentWorkspaceId: C,
29
+ onWorkspaceChange: E
29
30
  });
30
31
  G.current = {
31
32
  filteredWorkspaces: H,
32
- currentWorkspaceId: T,
33
- onWorkspaceChange: O
34
- }, a("header.context", h(() => ({ run: () => M ? { status: "already" } : (N(!0), { status: "done" }) }), [M]));
35
- let K = O !== void 0;
36
- a("header.workspace", h(() => K ? {
33
+ currentWorkspaceId: C,
34
+ onWorkspaceChange: E
35
+ }, a("header.context", m(() => ({ run: () => A ? { status: "already" } : (j(!0), { status: "done" }) }), [A]));
36
+ let K = E !== void 0;
37
+ a("header.workspace", m(() => K ? {
37
38
  targets: () => G.current.filteredWorkspaces.map((e) => ({
38
39
  id: e.id,
39
40
  label: e.name,
@@ -45,132 +46,132 @@ var x = ({ organizations: x, workspaces: S, projects: C, currentOrganizationId:
45
46
  }
46
47
  } : null, [K]));
47
48
  let q = () => {
48
- !T || !A || (A(), N(!1));
49
- }, J = W(x, I.org), Y = W(H, I.workspace), ie = W(U, I.project), X = p((e, t) => {
50
- L((n) => ({
49
+ !C || !O || (O(), j(!1));
50
+ }, J = y.filter((e) => s(e, P.org)), ae = W(H, P.workspace), oe = W(U, P.project), Y = f((e, t) => {
51
+ F((n) => ({
51
52
  ...n,
52
53
  [e]: t
53
54
  }));
54
- }, []), Z = p((e) => {
55
- F(e), L({
55
+ }, []), X = f((e) => {
56
+ N(e), F({
56
57
  org: "",
57
58
  workspace: "",
58
59
  project: ""
59
60
  }), setTimeout(() => {
60
- B.current?.focus();
61
+ R.current?.focus();
61
62
  }, 50);
62
63
  }, []);
63
- m(() => {
64
- if (R) return;
64
+ p(() => {
65
+ if (I) return;
65
66
  let e = (e) => {
66
- z.current && !z.current.contains(e.target) && N(!1);
67
+ L.current && !L.current.contains(e.target) && j(!1);
67
68
  };
68
- if (M) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
69
- }, [M, R]), m(() => {
70
- if (M) {
71
- F(V.current ? "workspace" : "org");
69
+ if (A) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
70
+ }, [A, I]), p(() => {
71
+ if (A) {
72
+ N(z.current ? "workspace" : "org");
72
73
  let e = setTimeout(() => {
73
- B.current?.focus();
74
+ R.current?.focus();
74
75
  }, 100);
75
76
  return () => clearTimeout(e);
76
77
  }
77
- L({
78
+ F({
78
79
  org: "",
79
80
  workspace: "",
80
81
  project: ""
81
82
  });
82
- }, [M]);
83
- let ae = (e) => {
84
- D && D(e);
85
- }, oe = (e) => {
86
- O && O(e);
83
+ }, [A]);
84
+ let Z = (e) => {
85
+ T && T(e);
87
86
  }, se = (e) => {
88
- k && k(e), N(!1);
89
- }, Q = () => /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("div", {
87
+ E && E(e);
88
+ }, ce = (e) => {
89
+ D && D(e), j(!1);
90
+ }, Q = () => /* @__PURE__ */ v(ne, { children: [/* @__PURE__ */ v("div", {
90
91
  className: "flex items-stretch border-b border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)]",
91
92
  children: [
92
- /* @__PURE__ */ y(c, {
93
- label: j("contextSwitcher.organization", "Organization"),
94
- isActive: P === "org",
95
- onClick: () => Z("org")
93
+ /* @__PURE__ */ _(o, {
94
+ label: k("contextSwitcher.organization", "Organization"),
95
+ isActive: M === "org",
96
+ onClick: () => X("org")
96
97
  }),
97
- /* @__PURE__ */ y(c, {
98
- label: j("contextSwitcher.workspace", "Workspace"),
99
- isActive: P === "workspace",
100
- onClick: () => Z("workspace")
98
+ /* @__PURE__ */ _(o, {
99
+ label: k("contextSwitcher.workspace", "Workspace"),
100
+ isActive: M === "workspace",
101
+ onClick: () => X("workspace")
101
102
  }),
102
- /* @__PURE__ */ y(c, {
103
- label: j("contextSwitcher.project", "Project"),
104
- isActive: P === "project",
105
- onClick: () => Z("project")
103
+ /* @__PURE__ */ _(o, {
104
+ label: k("contextSwitcher.project", "Project"),
105
+ isActive: M === "project",
106
+ onClick: () => X("project")
106
107
  })
107
108
  ]
108
- }), /* @__PURE__ */ b("div", {
109
+ }), /* @__PURE__ */ v("div", {
109
110
  className: "flex-1 overflow-hidden",
110
111
  children: [
111
- P === "org" && /* @__PURE__ */ y(l, {
112
- organizations: x,
112
+ M === "org" && /* @__PURE__ */ _(c, {
113
+ organizations: y,
113
114
  searchedOrganizations: J,
114
- currentOrganizationId: w,
115
- searchQuery: I.org,
116
- onSearchChange: (e) => X("org", e),
117
- onSelect: ae,
118
- searchInputRef: B
115
+ currentOrganizationId: S,
116
+ searchQuery: P.org,
117
+ onSearchChange: (e) => Y("org", e),
118
+ onSelect: Z,
119
+ searchInputRef: R
119
120
  }),
120
- P === "workspace" && /* @__PURE__ */ y(u, {
121
+ M === "workspace" && /* @__PURE__ */ _(l, {
121
122
  filteredWorkspaces: H,
122
- searchedWorkspaces: Y,
123
- currentWorkspaceId: T,
124
- searchQuery: I.workspace,
125
- onSearchChange: (e) => X("workspace", e),
126
- onSelect: oe,
127
- searchInputRef: B
123
+ searchedWorkspaces: ae,
124
+ currentWorkspaceId: C,
125
+ searchQuery: P.workspace,
126
+ onSearchChange: (e) => Y("workspace", e),
127
+ onSelect: se,
128
+ searchInputRef: R
128
129
  }),
129
- P === "project" && /* @__PURE__ */ y(d, {
130
- onWorkspaceWideSelect: T && A ? q : void 0,
130
+ M === "project" && /* @__PURE__ */ _(u, {
131
+ onWorkspaceWideSelect: C && O ? q : void 0,
131
132
  filteredProjects: U,
132
- searchedProjects: ie,
133
- currentProjectId: E,
134
- searchQuery: I.project,
135
- onSearchChange: (e) => X("project", e),
136
- onSelect: se,
137
- searchInputRef: B
133
+ searchedProjects: oe,
134
+ currentProjectId: w,
135
+ searchQuery: P.project,
136
+ onSearchChange: (e) => Y("project", e),
137
+ onSelect: ce,
138
+ searchInputRef: R
138
139
  })
139
140
  ]
140
- })] }), $ = /* @__PURE__ */ y(f, {
141
- isOpen: M,
142
- compact: ee,
143
- currentOrg: te,
144
- currentWorkspace: ne,
145
- currentProject: re,
146
- onToggle: () => N(!M)
141
+ })] }), $ = /* @__PURE__ */ _(d, {
142
+ isOpen: A,
143
+ compact: re,
144
+ currentOrg: ie,
145
+ currentWorkspace: B,
146
+ currentProject: V,
147
+ onToggle: () => j(!A)
147
148
  });
148
- return R ? /* @__PURE__ */ b("div", {
149
+ return I ? /* @__PURE__ */ v("div", {
149
150
  className: "relative",
150
- children: [$, /* @__PURE__ */ y(e, {
151
- open: M,
152
- onOpenChange: N,
153
- children: /* @__PURE__ */ b(t, {
151
+ children: [$, /* @__PURE__ */ _(e, {
152
+ open: A,
153
+ onOpenChange: j,
154
+ children: /* @__PURE__ */ v(t, {
154
155
  side: "bottom",
155
156
  className: "h-[70vh] flex flex-col p-0",
156
- children: [/* @__PURE__ */ y(n, {
157
+ children: [/* @__PURE__ */ _(n, {
157
158
  className: "px-4 pt-4 pb-2 border-b border-[var(--color-border-subtle)]",
158
- children: /* @__PURE__ */ y(r, {
159
+ children: /* @__PURE__ */ _(r, {
159
160
  className: "text-[var(--color-text-primary)]",
160
- children: j("contextSwitcher.title", "Switch Context")
161
+ children: k("contextSwitcher.title", "Switch Context")
161
162
  })
162
- }), /* @__PURE__ */ y("div", {
163
+ }), /* @__PURE__ */ _("div", {
163
164
  className: "flex-1 flex flex-col overflow-hidden",
164
165
  children: Q()
165
166
  })]
166
167
  })
167
168
  })]
168
- }) : /* @__PURE__ */ b("div", {
169
+ }) : /* @__PURE__ */ v("div", {
169
170
  className: "relative",
170
- ref: z,
171
- children: [$, M && /* @__PURE__ */ y(o, {
172
- onDismiss: () => N(!1),
173
- children: /* @__PURE__ */ y("div", {
171
+ ref: L,
172
+ children: [$, A && /* @__PURE__ */ _(ee, {
173
+ onDismiss: () => j(!1),
174
+ children: /* @__PURE__ */ _("div", {
174
175
  className: "absolute right-0 mt-2 w-[calc(100vw-2rem)] sm:w-[26rem] bg-[var(--color-bg-elevated)] border border-[var(--color-border-subtle)] rounded-card shadow-[var(--shadow-elevation-4)] z-50 flex flex-col max-h-[400px] overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-200",
175
176
  children: Q()
176
177
  })
@@ -178,4 +179,4 @@ var x = ({ organizations: x, workspaces: S, projects: C, currentOrganizationId:
178
179
  });
179
180
  };
180
181
  //#endregion
181
- export { x as ContextSwitcher };
182
+ export { y as ContextSwitcher };
@@ -1,34 +1,45 @@
1
- import { SearchInput as e } from "./SearchInput.js";
2
- import { EmptyState as t } from "./EmptyState.js";
3
- import { BuildingIcon as n, CheckIcon as r } from "./icons.js";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
1
+ import { organizationDetail as e } from "./organizationLabel.js";
2
+ import { SearchInput as t } from "./SearchInput.js";
3
+ import { EmptyState as n } from "./EmptyState.js";
4
+ import { BuildingIcon as r, CheckIcon as i } from "./icons.js";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
6
  //#region src/chrome/contextSwitcher/OrganizationList.tsx
6
- var o = ({ searchedOrganizations: o, currentOrganizationId: s, searchQuery: c, onSearchChange: l, onSelect: u, searchInputRef: d }) => /* @__PURE__ */ a("div", {
7
+ var s = ({ organizations: s, searchedOrganizations: c, currentOrganizationId: l, searchQuery: u, onSearchChange: d, onSelect: f, searchInputRef: p }) => /* @__PURE__ */ o("div", {
7
8
  className: "h-full flex flex-col",
8
- children: [/* @__PURE__ */ i(e, {
9
- value: c,
10
- onChange: l,
9
+ children: [/* @__PURE__ */ a(t, {
10
+ value: u,
11
+ onChange: d,
11
12
  placeholder: "Search organizations...",
12
- inputRef: d
13
- }), /* @__PURE__ */ i("div", {
13
+ inputRef: p
14
+ }), /* @__PURE__ */ a("div", {
14
15
  className: "flex-1 overflow-y-auto py-1",
15
- children: o.length > 0 ? o.map((e, t) => /* @__PURE__ */ a("button", {
16
- onClick: () => u(e),
17
- className: `w-full flex items-center gap-3 px-4 py-3 text-sm transition-all duration-200 ease-[var(--motion-easing-out)] animate-in fade-in-0 slide-in-from-left-2 ${e.id === s ? "bg-[var(--color-accent-soft)] text-text-primary font-medium" : "text-text-primary hover:bg-bg-sunken hover:translate-x-0.5"}`,
18
- style: { animationDelay: `${t * 30}ms` },
19
- children: [
20
- /* @__PURE__ */ i(n, { className: "size-5 text-[var(--color-text-secondary)] flex-shrink-0" }),
21
- /* @__PURE__ */ i("span", {
22
- className: "flex-1 text-left truncate",
23
- children: e.name
24
- }),
25
- e.id === s && /* @__PURE__ */ i(r, { className: "size-5 text-[var(--color-action-primary-bg)] flex-shrink-0 animate-in zoom-in-50 duration-200" })
26
- ]
27
- }, e.id)) : /* @__PURE__ */ i(t, {
16
+ children: c.length > 0 ? c.map((t, n) => {
17
+ let c = e(t, s);
18
+ return /* @__PURE__ */ o("button", {
19
+ "aria-label": c ? `${t.name} (${c})` : void 0,
20
+ onClick: () => f(t),
21
+ className: `w-full flex items-center gap-3 px-4 py-3 text-sm transition-all duration-200 ease-[var(--motion-easing-out)] animate-in fade-in-0 slide-in-from-left-2 ${t.id === l ? "bg-[var(--color-accent-soft)] text-text-primary font-medium" : "text-text-primary hover:bg-bg-sunken hover:translate-x-0.5"}`,
22
+ style: { animationDelay: `${n * 30}ms` },
23
+ children: [
24
+ /* @__PURE__ */ a(r, { className: "size-5 text-[var(--color-text-secondary)] flex-shrink-0" }),
25
+ /* @__PURE__ */ o("span", {
26
+ className: "flex-1 min-w-0 text-left",
27
+ children: [/* @__PURE__ */ a("span", {
28
+ className: "block truncate",
29
+ children: t.name
30
+ }), c && /* @__PURE__ */ a("span", {
31
+ className: "block break-all text-xs text-[var(--color-text-secondary)]",
32
+ children: c
33
+ })]
34
+ }),
35
+ t.id === l && /* @__PURE__ */ a(i, { className: "size-5 text-[var(--color-action-primary-bg)] flex-shrink-0 animate-in zoom-in-50 duration-200" })
36
+ ]
37
+ }, t.id);
38
+ }) : /* @__PURE__ */ a(n, {
28
39
  message: "No organizations available",
29
- isSearchResult: c.length > 0
40
+ isSearchResult: u.length > 0
30
41
  })
31
42
  })]
32
43
  });
33
44
  //#endregion
34
- export { o as OrganizationList };
45
+ export { s as OrganizationList };
@@ -0,0 +1,4 @@
1
+ import { Organization } from './types';
2
+ /** Keep a label stable across filtering and ordering; never use a list position. */
3
+ export declare function organizationDetail(org: Organization, organizations: Organization[]): string | undefined;
4
+ export declare function matchesOrganizationSearch(org: Organization, query: string): boolean;
@@ -0,0 +1,13 @@
1
+ //#region src/chrome/contextSwitcher/organizationLabel.ts
2
+ function e(e, t) {
3
+ let n = t.filter((t) => t.name === e.name);
4
+ if (n.length < 2) return;
5
+ let r = e.slug?.trim();
6
+ return r ? n.filter((e) => e.slug?.trim() === r).length === 1 ? r : `${r} · ID: ${e.id}` : `ID: ${e.id}`;
7
+ }
8
+ function t(e, t) {
9
+ let n = t.toLowerCase().trim();
10
+ return !n || e.name.toLowerCase().includes(n) || !!e.slug?.toLowerCase().includes(n);
11
+ }
12
+ //#endregion
13
+ export { t as matchesOrganizationSearch, e as organizationDetail };
@@ -148,6 +148,12 @@ export declare function ensureWorkspaceToken(options: {
148
148
  */
149
149
  signal?: AbortSignal;
150
150
  currentQuery: string;
151
+ /** Optional predispatch facade guard; legacy caller behavior remains unchanged. */
152
+ issuanceGuard?: {
153
+ identityKey: string;
154
+ isCurrent(): boolean;
155
+ accepts(token: string, workspaceId: string): boolean;
156
+ };
151
157
  }): Promise<string | null>;
152
158
  /** Resolve full gateway GraphQL URL */
153
159
  export declare function resolveGatewayUrl(gateway: Gateway, baseUrl?: string): string;