@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.
- package/dist/chrome/ContextSwitcher.js +102 -101
- package/dist/chrome/contextSwitcher/OrganizationList.js +36 -25
- package/dist/chrome/contextSwitcher/organizationLabel.d.ts +4 -0
- package/dist/chrome/contextSwitcher/organizationLabel.js +13 -0
- package/dist/shared/graphql/fetch.d.ts +6 -0
- package/dist/shared/graphql/fetch.js +114 -104
- package/dist/shared/graphql/index.d.ts +1 -0
- package/dist/shared/graphql/prepareWorkspaceRequest.d.ts +15 -0
- package/dist/shared/graphql/prepareWorkspaceRequest.js +56 -0
- package/dist/shared/graphql/workspaceToken.d.ts +1 -0
- package/dist/shared/graphql/workspaceToken.js +1 -0
- package/dist/shared-graphql.js +4 -3
- package/dist/shared.js +112 -111
- package/package.json +2 -2
|
@@ -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
|
|
5
|
-
import { useIsMobile as
|
|
6
|
-
import { TabButton as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
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
|
|
15
|
-
let
|
|
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
|
-
}),
|
|
20
|
-
|
|
21
|
-
let
|
|
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 =
|
|
26
|
+
}, []), G = h({
|
|
26
27
|
filteredWorkspaces: H,
|
|
27
|
-
currentWorkspaceId:
|
|
28
|
-
onWorkspaceChange:
|
|
28
|
+
currentWorkspaceId: C,
|
|
29
|
+
onWorkspaceChange: E
|
|
29
30
|
});
|
|
30
31
|
G.current = {
|
|
31
32
|
filteredWorkspaces: H,
|
|
32
|
-
currentWorkspaceId:
|
|
33
|
-
onWorkspaceChange:
|
|
34
|
-
}, a("header.context",
|
|
35
|
-
let K =
|
|
36
|
-
a("header.workspace",
|
|
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
|
-
!
|
|
49
|
-
}, J =
|
|
50
|
-
|
|
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
|
-
}, []),
|
|
55
|
-
|
|
55
|
+
}, []), X = f((e) => {
|
|
56
|
+
N(e), F({
|
|
56
57
|
org: "",
|
|
57
58
|
workspace: "",
|
|
58
59
|
project: ""
|
|
59
60
|
}), setTimeout(() => {
|
|
60
|
-
|
|
61
|
+
R.current?.focus();
|
|
61
62
|
}, 50);
|
|
62
63
|
}, []);
|
|
63
|
-
|
|
64
|
-
if (
|
|
64
|
+
p(() => {
|
|
65
|
+
if (I) return;
|
|
65
66
|
let e = (e) => {
|
|
66
|
-
|
|
67
|
+
L.current && !L.current.contains(e.target) && j(!1);
|
|
67
68
|
};
|
|
68
|
-
if (
|
|
69
|
-
}, [
|
|
70
|
-
if (
|
|
71
|
-
|
|
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
|
-
|
|
74
|
+
R.current?.focus();
|
|
74
75
|
}, 100);
|
|
75
76
|
return () => clearTimeout(e);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
F({
|
|
78
79
|
org: "",
|
|
79
80
|
workspace: "",
|
|
80
81
|
project: ""
|
|
81
82
|
});
|
|
82
|
-
}, [
|
|
83
|
-
let
|
|
84
|
-
|
|
85
|
-
}, oe = (e) => {
|
|
86
|
-
O && O(e);
|
|
83
|
+
}, [A]);
|
|
84
|
+
let Z = (e) => {
|
|
85
|
+
T && T(e);
|
|
87
86
|
}, se = (e) => {
|
|
88
|
-
|
|
89
|
-
},
|
|
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__ */
|
|
93
|
-
label:
|
|
94
|
-
isActive:
|
|
95
|
-
onClick: () =>
|
|
93
|
+
/* @__PURE__ */ _(o, {
|
|
94
|
+
label: k("contextSwitcher.organization", "Organization"),
|
|
95
|
+
isActive: M === "org",
|
|
96
|
+
onClick: () => X("org")
|
|
96
97
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
label:
|
|
99
|
-
isActive:
|
|
100
|
-
onClick: () =>
|
|
98
|
+
/* @__PURE__ */ _(o, {
|
|
99
|
+
label: k("contextSwitcher.workspace", "Workspace"),
|
|
100
|
+
isActive: M === "workspace",
|
|
101
|
+
onClick: () => X("workspace")
|
|
101
102
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
label:
|
|
104
|
-
isActive:
|
|
105
|
-
onClick: () =>
|
|
103
|
+
/* @__PURE__ */ _(o, {
|
|
104
|
+
label: k("contextSwitcher.project", "Project"),
|
|
105
|
+
isActive: M === "project",
|
|
106
|
+
onClick: () => X("project")
|
|
106
107
|
})
|
|
107
108
|
]
|
|
108
|
-
}), /* @__PURE__ */
|
|
109
|
+
}), /* @__PURE__ */ v("div", {
|
|
109
110
|
className: "flex-1 overflow-hidden",
|
|
110
111
|
children: [
|
|
111
|
-
|
|
112
|
-
organizations:
|
|
112
|
+
M === "org" && /* @__PURE__ */ _(c, {
|
|
113
|
+
organizations: y,
|
|
113
114
|
searchedOrganizations: J,
|
|
114
|
-
currentOrganizationId:
|
|
115
|
-
searchQuery:
|
|
116
|
-
onSearchChange: (e) =>
|
|
117
|
-
onSelect:
|
|
118
|
-
searchInputRef:
|
|
115
|
+
currentOrganizationId: S,
|
|
116
|
+
searchQuery: P.org,
|
|
117
|
+
onSearchChange: (e) => Y("org", e),
|
|
118
|
+
onSelect: Z,
|
|
119
|
+
searchInputRef: R
|
|
119
120
|
}),
|
|
120
|
-
|
|
121
|
+
M === "workspace" && /* @__PURE__ */ _(l, {
|
|
121
122
|
filteredWorkspaces: H,
|
|
122
|
-
searchedWorkspaces:
|
|
123
|
-
currentWorkspaceId:
|
|
124
|
-
searchQuery:
|
|
125
|
-
onSearchChange: (e) =>
|
|
126
|
-
onSelect:
|
|
127
|
-
searchInputRef:
|
|
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
|
-
|
|
130
|
-
onWorkspaceWideSelect:
|
|
130
|
+
M === "project" && /* @__PURE__ */ _(u, {
|
|
131
|
+
onWorkspaceWideSelect: C && O ? q : void 0,
|
|
131
132
|
filteredProjects: U,
|
|
132
|
-
searchedProjects:
|
|
133
|
-
currentProjectId:
|
|
134
|
-
searchQuery:
|
|
135
|
-
onSearchChange: (e) =>
|
|
136
|
-
onSelect:
|
|
137
|
-
searchInputRef:
|
|
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__ */
|
|
141
|
-
isOpen:
|
|
142
|
-
compact:
|
|
143
|
-
currentOrg:
|
|
144
|
-
currentWorkspace:
|
|
145
|
-
currentProject:
|
|
146
|
-
onToggle: () =>
|
|
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
|
|
149
|
+
return I ? /* @__PURE__ */ v("div", {
|
|
149
150
|
className: "relative",
|
|
150
|
-
children: [$, /* @__PURE__ */
|
|
151
|
-
open:
|
|
152
|
-
onOpenChange:
|
|
153
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
157
|
+
children: [/* @__PURE__ */ _(n, {
|
|
157
158
|
className: "px-4 pt-4 pb-2 border-b border-[var(--color-border-subtle)]",
|
|
158
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ _(r, {
|
|
159
160
|
className: "text-[var(--color-text-primary)]",
|
|
160
|
-
children:
|
|
161
|
+
children: k("contextSwitcher.title", "Switch Context")
|
|
161
162
|
})
|
|
162
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
169
|
+
}) : /* @__PURE__ */ v("div", {
|
|
169
170
|
className: "relative",
|
|
170
|
-
ref:
|
|
171
|
-
children: [$,
|
|
172
|
-
onDismiss: () =>
|
|
173
|
-
children: /* @__PURE__ */
|
|
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 {
|
|
182
|
+
export { y as ContextSwitcher };
|
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
|
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__ */
|
|
9
|
-
value:
|
|
10
|
-
onChange:
|
|
9
|
+
children: [/* @__PURE__ */ a(t, {
|
|
10
|
+
value: u,
|
|
11
|
+
onChange: d,
|
|
11
12
|
placeholder: "Search organizations...",
|
|
12
|
-
inputRef:
|
|
13
|
-
}), /* @__PURE__ */
|
|
13
|
+
inputRef: p
|
|
14
|
+
}), /* @__PURE__ */ a("div", {
|
|
14
15
|
className: "flex-1 overflow-y-auto py-1",
|
|
15
|
-
children:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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:
|
|
40
|
+
isSearchResult: u.length > 0
|
|
30
41
|
})
|
|
31
42
|
})]
|
|
32
43
|
});
|
|
33
44
|
//#endregion
|
|
34
|
-
export {
|
|
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;
|