@burdenoff/fe-libs 2026.1018.1 → 2026.1019.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/AccountSwitcher.js +90 -89
- package/dist/chrome/Breadcrumbs.js +1 -1
- package/dist/chrome/CommandPalette.js +91 -90
- package/dist/chrome/Footer.js +31 -8
- package/dist/chrome/GlobalSearch.js +78 -77
- package/dist/chrome/HeaderBar.js +1 -1
- package/dist/chrome/HeaderThemeSwitcher.js +48 -47
- package/dist/chrome/LanguagePickerSheet.js +23 -22
- package/dist/chrome/NavCustomizeDialog.d.ts +0 -14
- package/dist/chrome/NavCustomizeDialog.js +114 -122
- package/dist/chrome/PanelTabs.js +45 -41
- package/dist/chrome/PersonaSurfaceControls.d.ts +0 -17
- package/dist/chrome/PersonaSurfaceControls.js +115 -118
- package/dist/chrome/PluginSettingsPage.js +29 -28
- package/dist/chrome/PluginWidgetGrid.js +19 -18
- package/dist/chrome/ProductPickerSheet.js +44 -47
- package/dist/chrome/ProductSwitcher.js +2 -6
- package/dist/chrome/ProfileSwitcher.js +6 -10
- package/dist/chrome/ShortcutHelpDialog.js +60 -65
- package/dist/chrome/SideNavigation.js +2 -2
- package/dist/chrome/Sidebar.js +44 -43
- package/dist/chrome/ThemePreferences.js +289 -267
- package/dist/chrome/contextSwitcher/EmptyState.js +31 -27
- package/dist/chrome/contextSwitcher/OrganizationList.js +40 -30
- package/dist/chrome/contextSwitcher/ProjectList.js +48 -44
- package/dist/chrome/contextSwitcher/SearchInput.js +44 -40
- package/dist/chrome/contextSwitcher/TriggerButton.js +2 -2
- package/dist/chrome/contextSwitcher/WorkspaceList.js +36 -32
- package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +128 -126
- package/dist/chrome/globalSearch/ResultsList.js +25 -27
- package/dist/chrome/globalSearch/SearchInput.js +16 -14
- package/dist/chrome/notificationCenter/NotificationCardItem.js +58 -47
- package/dist/chrome/notificationCenter/NotificationFilters.js +76 -62
- package/dist/chrome/notificationCenter/NotificationFooter.js +21 -21
- package/dist/chrome/notificationCenter/NotificationHeader.js +67 -63
- package/dist/chrome/notificationCenter/NotificationList.js +75 -71
- package/dist/chrome/notificationCenter/NotificationPanel.js +37 -33
- package/dist/chrome/notificationCenter/PushOptInToggle.js +33 -32
- package/dist/chrome/notificationCenter/constants.d.ts +6 -1
- package/dist/chrome/notificationCenter/constants.js +12 -11
- package/dist/chrome/useThemeOptionLabels.d.ts +33 -0
- package/dist/chrome/useThemeOptionLabels.js +39 -0
- package/dist/shared/assistant/conversation.d.ts +8 -0
- package/dist/shared/assistant/history/historyMapping.js +1 -1
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +6 -6
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +86 -85
- package/dist/shared/assistant/ui/AssistantMessageItem.js +101 -96
- package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts +2 -0
- package/dist/shared/assistant/ui/AssistantWriteProposalCard.js +93 -89
- package/dist/shared/assistant/ui/WorkflowAssistantPanel.js +152 -140
- package/dist/shared/assistant/ui/useWriteProposals.js +122 -85
- package/dist/shared/assistant/writeProposalDiscovery.d.ts +3 -1
- package/dist/shared/assistant/writeProposalDiscovery.js +2 -2
- package/dist/shared/events/sinks/RybbitSink.js +2 -2
- package/dist/shared/providers/shell/interpolateShellLabel.d.ts +3 -0
- package/dist/shared/providers/shell/interpolateShellLabel.js +11 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.d.ts +45 -0
- package/dist/shared/providers/shell/useAssistantShellLabels.js +54 -0
- package/dist/shared/tours/TourPlayer.js +33 -32
- package/dist/shared/tours/TourTooltip.js +108 -109
- package/dist/shared/tours/tourTrigger/MobileTourSheet.js +98 -85
- package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +20 -18
- package/dist/shared/tours/tourTrigger/TourListItemMobile.js +23 -25
- package/dist/shared-assistant.js +188 -188
- package/package.json +2 -2
|
@@ -1,85 +1,86 @@
|
|
|
1
1
|
import { Sheet as e, SheetContent as t, SheetHeader as n, SheetTitle as r } from "../ui/sheet.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useShellLabel as i } from "../shared/providers/shell/useShellLabel.js";
|
|
3
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
4
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
4
5
|
//#region src/chrome/AccountSwitcher.tsx
|
|
5
|
-
function
|
|
6
|
-
let [t, n] =
|
|
7
|
-
return
|
|
6
|
+
function d(e = 640) {
|
|
7
|
+
let [t, n] = s(!1);
|
|
8
|
+
return a(() => {
|
|
8
9
|
let t = () => n(window.innerWidth < e);
|
|
9
10
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
10
11
|
}, [e]), t;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function f(e, t, n) {
|
|
13
14
|
if (t && n) return `${t.charAt(0)}${n.charAt(0)}`.toUpperCase();
|
|
14
15
|
let r = e.split(" ");
|
|
15
16
|
return r.length >= 2 ? `${r[0].charAt(0)}${r[1].charAt(0)}`.toUpperCase() : e.substring(0, 2).toUpperCase();
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
-
let [
|
|
19
|
-
|
|
20
|
-
if (
|
|
18
|
+
var p = ({ accounts: p, activeAccountId: m, onSwitchAccount: h, onAddAccount: g, onRemoveAccount: _, onLogoutAll: v, compact: y = !1 }) => {
|
|
19
|
+
let b = i(), [x, S] = s(!1), C = d(), w = o(null), T = p.find((e) => e.id === m) || p[0], E = p.filter((e) => e.id !== m);
|
|
20
|
+
a(() => {
|
|
21
|
+
if (C) return;
|
|
21
22
|
let e = (e) => {
|
|
22
|
-
|
|
23
|
+
w.current && !w.current.contains(e.target) && S(!1);
|
|
23
24
|
};
|
|
24
|
-
if (
|
|
25
|
-
}, [
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
let n =
|
|
30
|
-
return /* @__PURE__ */
|
|
25
|
+
if (x) return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
26
|
+
}, [x, C]);
|
|
27
|
+
let D = (e) => {
|
|
28
|
+
h && h(e), S(!1);
|
|
29
|
+
}, O = (e, t = !1) => {
|
|
30
|
+
let n = f(e.name, e.firstName, e.lastName);
|
|
31
|
+
return /* @__PURE__ */ u("div", {
|
|
31
32
|
className: `flex items-center gap-3 p-3 ${t ? "bg-[var(--color-accent-soft)]" : "hover:bg-bg-sunken cursor-pointer"} transition-colors`,
|
|
32
|
-
onClick: () => !t &&
|
|
33
|
+
onClick: () => !t && D(e),
|
|
33
34
|
role: t ? void 0 : "button",
|
|
34
35
|
tabIndex: t ? void 0 : 0,
|
|
35
36
|
onKeyDown: (n) => {
|
|
36
|
-
!t && (n.key === "Enter" || n.key === " ") && (n.preventDefault(),
|
|
37
|
+
!t && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), D(e));
|
|
37
38
|
},
|
|
38
39
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ l("div", {
|
|
40
41
|
className: "size-10 rounded-full bg-action-primary-bg flex items-center justify-center flex-shrink-0",
|
|
41
|
-
children: e.avatar ? /* @__PURE__ */
|
|
42
|
+
children: e.avatar ? /* @__PURE__ */ l("img", {
|
|
42
43
|
src: e.avatar,
|
|
43
44
|
alt: e.name,
|
|
44
45
|
className: "w-full h-full rounded-full object-cover"
|
|
45
|
-
}) : /* @__PURE__ */
|
|
46
|
+
}) : /* @__PURE__ */ l("span", {
|
|
46
47
|
className: "text-action-primary-text font-semibold text-sm",
|
|
47
48
|
children: n
|
|
48
49
|
})
|
|
49
50
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ u("div", {
|
|
51
52
|
className: "flex-1 min-w-0",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ l("p", {
|
|
53
54
|
className: "font-medium text-text-primary truncate",
|
|
54
55
|
children: e.name
|
|
55
|
-
}), /* @__PURE__ */
|
|
56
|
+
}), /* @__PURE__ */ l("p", {
|
|
56
57
|
className: "text-sm text-text-secondary truncate",
|
|
57
58
|
children: e.email
|
|
58
59
|
})]
|
|
59
60
|
}),
|
|
60
|
-
t && /* @__PURE__ */
|
|
61
|
+
t && /* @__PURE__ */ l("svg", {
|
|
61
62
|
className: "size-5 text-action-primary-bg flex-shrink-0",
|
|
62
63
|
fill: "currentColor",
|
|
63
64
|
viewBox: "0 0 20 20",
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ l("path", {
|
|
65
66
|
fillRule: "evenodd",
|
|
66
67
|
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
67
68
|
clipRule: "evenodd"
|
|
68
69
|
})
|
|
69
70
|
}),
|
|
70
|
-
!t &&
|
|
71
|
+
!t && _ && /* @__PURE__ */ l("button", {
|
|
71
72
|
type: "button",
|
|
72
73
|
onClick: (t) => {
|
|
73
|
-
t.stopPropagation(),
|
|
74
|
+
t.stopPropagation(), _(e.id);
|
|
74
75
|
},
|
|
75
76
|
className: "p-1 rounded-button hover:bg-status-error-bg-subtle text-text-muted hover:text-status-error-text transition-colors",
|
|
76
|
-
"aria-label":
|
|
77
|
-
children: /* @__PURE__ */
|
|
77
|
+
"aria-label": b("userMenu.removeNamedAccount", "Remove {{name}}", { name: e.name }),
|
|
78
|
+
children: /* @__PURE__ */ l("svg", {
|
|
78
79
|
className: "size-4",
|
|
79
80
|
fill: "none",
|
|
80
81
|
stroke: "currentColor",
|
|
81
82
|
viewBox: "0 0 24 24",
|
|
82
|
-
children: /* @__PURE__ */
|
|
83
|
+
children: /* @__PURE__ */ l("path", {
|
|
83
84
|
strokeLinecap: "round",
|
|
84
85
|
strokeLinejoin: "round",
|
|
85
86
|
strokeWidth: 2,
|
|
@@ -89,136 +90,136 @@ var f = ({ accounts: f, activeAccountId: p, onSwitchAccount: m, onAddAccount: h,
|
|
|
89
90
|
})
|
|
90
91
|
]
|
|
91
92
|
}, e.id);
|
|
92
|
-
},
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
}, k = () => /* @__PURE__ */ u(c, { children: [
|
|
94
|
+
/* @__PURE__ */ u("div", {
|
|
94
95
|
className: "border-b border-border-subtle",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ l("p", {
|
|
96
97
|
className: "px-3 pt-3 pb-1 text-[11px] font-medium text-text-muted uppercase tracking-wider",
|
|
97
|
-
children: "Active Account"
|
|
98
|
-
}),
|
|
98
|
+
children: b("userMenu.activeAccount", "Active Account")
|
|
99
|
+
}), T && O(T, !0)]
|
|
99
100
|
}),
|
|
100
|
-
|
|
101
|
+
E.length > 0 && /* @__PURE__ */ u("div", {
|
|
101
102
|
className: "border-b border-border-subtle",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ l("p", {
|
|
103
104
|
className: "px-3 pt-3 pb-1 text-[11px] font-medium text-text-muted uppercase tracking-wider",
|
|
104
|
-
children: "Switch Account"
|
|
105
|
-
}),
|
|
105
|
+
children: b("auth.security.switchAccount", "Switch Account")
|
|
106
|
+
}), E.map((e) => O(e))]
|
|
106
107
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ u("div", {
|
|
108
109
|
className: "p-2 space-y-1",
|
|
109
|
-
children: [
|
|
110
|
+
children: [g && /* @__PURE__ */ u("button", {
|
|
110
111
|
type: "button",
|
|
111
112
|
onClick: () => {
|
|
112
|
-
|
|
113
|
+
g(), S(!1);
|
|
113
114
|
},
|
|
114
115
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-button text-text-primary hover:bg-bg-sunken transition-colors",
|
|
115
|
-
children: [/* @__PURE__ */
|
|
116
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
116
117
|
className: "size-5",
|
|
117
118
|
fill: "none",
|
|
118
119
|
stroke: "currentColor",
|
|
119
120
|
viewBox: "0 0 24 24",
|
|
120
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ l("path", {
|
|
121
122
|
strokeLinecap: "round",
|
|
122
123
|
strokeLinejoin: "round",
|
|
123
124
|
strokeWidth: 2,
|
|
124
125
|
d: "M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"
|
|
125
126
|
})
|
|
126
|
-
}), /* @__PURE__ */
|
|
127
|
+
}), /* @__PURE__ */ l("span", {
|
|
127
128
|
className: "text-sm font-medium",
|
|
128
|
-
children: "Add Another Account"
|
|
129
|
+
children: b("userMenu.addAnotherAccount", "Add Another Account")
|
|
129
130
|
})]
|
|
130
|
-
}),
|
|
131
|
+
}), v && p.length > 0 && /* @__PURE__ */ u("button", {
|
|
131
132
|
type: "button",
|
|
132
133
|
onClick: () => {
|
|
133
|
-
|
|
134
|
+
v(), S(!1);
|
|
134
135
|
},
|
|
135
136
|
className: "w-full flex items-center gap-3 px-3 py-2 rounded-button text-status-error-text hover:bg-status-error-bg-subtle transition-colors",
|
|
136
|
-
children: [/* @__PURE__ */
|
|
137
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
137
138
|
className: "size-5",
|
|
138
139
|
fill: "none",
|
|
139
140
|
stroke: "currentColor",
|
|
140
141
|
viewBox: "0 0 24 24",
|
|
141
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ l("path", {
|
|
142
143
|
strokeLinecap: "round",
|
|
143
144
|
strokeLinejoin: "round",
|
|
144
145
|
strokeWidth: 2,
|
|
145
146
|
d: "M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
|
146
147
|
})
|
|
147
|
-
}), /* @__PURE__ */
|
|
148
|
+
}), /* @__PURE__ */ l("span", {
|
|
148
149
|
className: "text-sm font-medium",
|
|
149
|
-
children: "Sign Out All Accounts"
|
|
150
|
+
children: b("userMenu.signOutAllAccounts", "Sign Out All Accounts")
|
|
150
151
|
})]
|
|
151
152
|
})]
|
|
152
153
|
})
|
|
153
|
-
] }),
|
|
154
|
-
onClick: () =>
|
|
155
|
-
className: `flex items-center gap-2 p-2 rounded-button hover:bg-bg-sunken transition-colors ${
|
|
156
|
-
"aria-label": "Account switcher",
|
|
157
|
-
"aria-expanded":
|
|
154
|
+
] }), A = /* @__PURE__ */ u("button", {
|
|
155
|
+
onClick: () => S(!x),
|
|
156
|
+
className: `flex items-center gap-2 p-2 rounded-button hover:bg-bg-sunken transition-colors ${x ? "bg-bg-sunken" : ""}`,
|
|
157
|
+
"aria-label": b("userMenu.accountSwitcher", "Account switcher"),
|
|
158
|
+
"aria-expanded": x,
|
|
158
159
|
children: [
|
|
159
|
-
|
|
160
|
+
T && /* @__PURE__ */ l("div", {
|
|
160
161
|
className: "size-8 rounded-full bg-action-primary-bg flex items-center justify-center",
|
|
161
|
-
children:
|
|
162
|
-
src:
|
|
163
|
-
alt:
|
|
162
|
+
children: T.avatar ? /* @__PURE__ */ l("img", {
|
|
163
|
+
src: T.avatar,
|
|
164
|
+
alt: T.name,
|
|
164
165
|
className: "w-full h-full rounded-full object-cover"
|
|
165
|
-
}) : /* @__PURE__ */
|
|
166
|
+
}) : /* @__PURE__ */ l("span", {
|
|
166
167
|
className: "text-action-primary-text font-semibold text-sm",
|
|
167
|
-
children:
|
|
168
|
+
children: f(T.name, T.firstName, T.lastName)
|
|
168
169
|
})
|
|
169
170
|
}),
|
|
170
|
-
!
|
|
171
|
+
!y && T && /* @__PURE__ */ l("span", {
|
|
171
172
|
className: "hidden sm:block text-body-sm font-medium text-text-primary max-w-[120px] truncate",
|
|
172
|
-
children:
|
|
173
|
+
children: T.name
|
|
173
174
|
}),
|
|
174
|
-
|
|
175
|
+
p.length > 1 && /* @__PURE__ */ u("div", {
|
|
175
176
|
className: "relative",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
177
|
-
className: `w-4 h-4 text-text-secondary transition-transform ${
|
|
177
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
178
|
+
className: `w-4 h-4 text-text-secondary transition-transform ${x ? "rotate-180" : ""}`,
|
|
178
179
|
fill: "none",
|
|
179
180
|
stroke: "currentColor",
|
|
180
181
|
viewBox: "0 0 24 24",
|
|
181
|
-
children: /* @__PURE__ */
|
|
182
|
+
children: /* @__PURE__ */ l("path", {
|
|
182
183
|
strokeLinecap: "round",
|
|
183
184
|
strokeLinejoin: "round",
|
|
184
185
|
strokeWidth: 2,
|
|
185
186
|
d: "M19 9l-7 7-7-7"
|
|
186
187
|
})
|
|
187
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ l("span", {
|
|
188
189
|
className: "absolute -top-1 -right-1 size-3 text-[10px] bg-action-primary-bg text-action-primary-text rounded-full flex items-center justify-center font-bold",
|
|
189
|
-
children:
|
|
190
|
+
children: p.length
|
|
190
191
|
})]
|
|
191
192
|
})
|
|
192
193
|
]
|
|
193
194
|
});
|
|
194
|
-
return
|
|
195
|
+
return C ? /* @__PURE__ */ u("div", {
|
|
195
196
|
className: "relative",
|
|
196
|
-
children: [
|
|
197
|
-
open:
|
|
198
|
-
onOpenChange:
|
|
199
|
-
children: /* @__PURE__ */
|
|
197
|
+
children: [A, /* @__PURE__ */ l(e, {
|
|
198
|
+
open: x,
|
|
199
|
+
onOpenChange: S,
|
|
200
|
+
children: /* @__PURE__ */ u(t, {
|
|
200
201
|
side: "bottom",
|
|
201
202
|
className: "h-auto max-h-[70vh] flex flex-col p-0",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ l(n, {
|
|
203
204
|
className: "px-4 pt-4 pb-2 border-b border-border-subtle",
|
|
204
|
-
children: /* @__PURE__ */
|
|
205
|
+
children: /* @__PURE__ */ l(r, {
|
|
205
206
|
className: "text-text-primary",
|
|
206
|
-
children: "Accounts"
|
|
207
|
+
children: b("userMenu.accounts", "Accounts")
|
|
207
208
|
})
|
|
208
|
-
}), /* @__PURE__ */
|
|
209
|
+
}), /* @__PURE__ */ l("div", {
|
|
209
210
|
className: "flex-1 overflow-y-auto",
|
|
210
|
-
children:
|
|
211
|
+
children: k()
|
|
211
212
|
})]
|
|
212
213
|
})
|
|
213
214
|
})]
|
|
214
|
-
}) : /* @__PURE__ */
|
|
215
|
+
}) : /* @__PURE__ */ u("div", {
|
|
215
216
|
className: "relative",
|
|
216
|
-
ref:
|
|
217
|
-
children: [
|
|
217
|
+
ref: w,
|
|
218
|
+
children: [A, x && /* @__PURE__ */ l("div", {
|
|
218
219
|
className: "absolute right-0 mt-2 w-80 bg-bg-elevated border border-border-subtle rounded-card shadow-[var(--shadow-elevation-4)] z-50 overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-200",
|
|
219
|
-
children:
|
|
220
|
+
children: k()
|
|
220
221
|
})]
|
|
221
222
|
});
|
|
222
223
|
};
|
|
223
224
|
//#endregion
|
|
224
|
-
export {
|
|
225
|
+
export { p as AccountSwitcher };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useShellLabel as e } from "../shared/providers/shell/useShellLabel.js";
|
|
2
|
+
import { cn as t } from "../utils/cn.js";
|
|
2
3
|
import "../utils/index.js";
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { Search as
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
5
|
+
import { Search as o, X as s } from "lucide-react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
7
|
//#region src/chrome/CommandPalette.tsx
|
|
7
|
-
function
|
|
8
|
+
function u(e) {
|
|
8
9
|
let t = e.toLowerCase().split("+").map((e) => e.trim()), n = t.length - 1;
|
|
9
10
|
return {
|
|
10
11
|
mod: t.includes("mod"),
|
|
@@ -15,52 +16,52 @@ function l(e) {
|
|
|
15
16
|
key: t[n] || ""
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
let n =
|
|
19
|
+
function d(e, t) {
|
|
20
|
+
let n = u(t);
|
|
20
21
|
return n.mod && !(e.metaKey || e.ctrlKey) || n.ctrl && !e.ctrlKey || n.alt && !e.altKey || n.shift && !e.shiftKey || n.meta && !e.metaKey || !e.key ? !1 : e.key.toLowerCase() === n.key;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
let [
|
|
23
|
+
function f({ actions: u, shortcuts: f = [], placeholder: p, className: m }) {
|
|
24
|
+
let h = e(), [g, _] = a(!1), [v, y] = a(""), [b, x] = a(0), S = i(() => u.filter((e) => !e.hidden), [u]), C = n(async (e) => {
|
|
24
25
|
try {
|
|
25
|
-
await e.action(),
|
|
26
|
+
await e.action(), _(!1);
|
|
26
27
|
} catch (e) {
|
|
27
28
|
console.error("Failed to execute command:", e);
|
|
28
29
|
}
|
|
29
|
-
}, []),
|
|
30
|
-
if (!
|
|
31
|
-
let e =
|
|
32
|
-
return
|
|
30
|
+
}, []), w = i(() => {
|
|
31
|
+
if (!v.trim()) return S;
|
|
32
|
+
let e = v.toLowerCase();
|
|
33
|
+
return S.filter((t) => {
|
|
33
34
|
let n = t.label.toLowerCase().includes(e), r = t.keywords?.some((t) => t.toLowerCase().includes(e)), i = t.description?.toLowerCase().includes(e);
|
|
34
35
|
return n || r || i;
|
|
35
36
|
});
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [
|
|
37
|
+
}, [S, v]);
|
|
38
|
+
r(() => {
|
|
39
|
+
g || (y(""), x(0));
|
|
40
|
+
}, [g]), r(() => {
|
|
40
41
|
let e = (e) => {
|
|
41
42
|
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
|
|
42
|
-
e.preventDefault(),
|
|
43
|
+
e.preventDefault(), _((e) => !e);
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
if (
|
|
46
|
-
if (e.key === "Escape") e.preventDefault(),
|
|
47
|
-
else if (e.key === "ArrowDown") e.preventDefault(),
|
|
48
|
-
else if (e.key === "ArrowUp") e.preventDefault(),
|
|
46
|
+
if (g) {
|
|
47
|
+
if (e.key === "Escape") e.preventDefault(), _(!1);
|
|
48
|
+
else if (e.key === "ArrowDown") e.preventDefault(), x((e) => e < w.length - 1 ? e + 1 : e);
|
|
49
|
+
else if (e.key === "ArrowUp") e.preventDefault(), x((e) => e > 0 ? e - 1 : e);
|
|
49
50
|
else if (e.key === "Enter") {
|
|
50
51
|
e.preventDefault();
|
|
51
|
-
let t =
|
|
52
|
-
t &&
|
|
52
|
+
let t = w[b];
|
|
53
|
+
t && C(t);
|
|
53
54
|
}
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
for (let t of
|
|
57
|
+
for (let t of f) if (d(e, t.keys)) {
|
|
57
58
|
e.preventDefault();
|
|
58
|
-
let n =
|
|
59
|
-
n &&
|
|
59
|
+
let n = S.find((e) => e.id === t.actionId);
|
|
60
|
+
n && C(n);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
for (let t of
|
|
63
|
-
e.preventDefault(),
|
|
63
|
+
for (let t of S) if (t.shortcut && d(e, t.shortcut)) {
|
|
64
|
+
e.preventDefault(), C(t);
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
};
|
|
@@ -68,117 +69,117 @@ function d({ actions: l, shortcuts: d = [], placeholder: f = "Type a command or
|
|
|
68
69
|
document.removeEventListener("keydown", e);
|
|
69
70
|
};
|
|
70
71
|
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
C,
|
|
73
|
+
w,
|
|
74
|
+
g,
|
|
75
|
+
b,
|
|
76
|
+
f,
|
|
77
|
+
S
|
|
77
78
|
]);
|
|
78
|
-
let
|
|
79
|
+
let T = i(() => w.reduce((e, t) => {
|
|
79
80
|
let n = t.section || "Actions";
|
|
80
81
|
return e[n] || (e[n] = []), e[n].push(t), e;
|
|
81
|
-
}, {}), [
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
}, [
|
|
85
|
-
let
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
className:
|
|
88
|
-
onClick: () =>
|
|
89
|
-
"data-state":
|
|
82
|
+
}, {}), [w]);
|
|
83
|
+
if (r(() => {
|
|
84
|
+
x(0);
|
|
85
|
+
}, [w]), !g) return null;
|
|
86
|
+
let E = 0;
|
|
87
|
+
return /* @__PURE__ */ c("div", {
|
|
88
|
+
className: t("fixed inset-0 z-[9999] flex items-center justify-center bg-bg-overlay backdrop-blur-md", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", m),
|
|
89
|
+
onClick: () => _(!1),
|
|
90
|
+
"data-state": g ? "open" : "closed",
|
|
90
91
|
role: "dialog",
|
|
91
92
|
"aria-modal": "true",
|
|
92
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ c("div", {
|
|
93
94
|
className: "w-full max-w-lg mx-4 max-h-[85dvh] overflow-hidden",
|
|
94
95
|
onClick: (e) => e.stopPropagation(),
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ l("div", {
|
|
96
97
|
className: "overflow-hidden rounded-2xl border border-border-subtle bg-bg-elevated shadow-[var(--shadow-elevation-5)]",
|
|
97
98
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ l("div", {
|
|
99
100
|
className: "flex items-center border-b border-border-subtle px-4",
|
|
100
101
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ c(o, { className: "size-4 mr-2 flex-shrink-0 text-text-muted" }),
|
|
103
|
+
/* @__PURE__ */ c("input", {
|
|
103
104
|
type: "text",
|
|
104
|
-
placeholder:
|
|
105
|
-
value:
|
|
106
|
-
onChange: (e) =>
|
|
105
|
+
placeholder: p ?? h("search.commandPlaceholder", "Type a command or search..."),
|
|
106
|
+
value: v,
|
|
107
|
+
onChange: (e) => y(e.target.value),
|
|
107
108
|
className: "flex-1 bg-transparent py-3.5 text-sm text-text-primary outline-none placeholder:text-text-placeholder",
|
|
108
109
|
autoFocus: !0
|
|
109
110
|
}),
|
|
110
|
-
|
|
111
|
+
v && /* @__PURE__ */ c("button", {
|
|
111
112
|
type: "button",
|
|
112
|
-
onClick: () =>
|
|
113
|
+
onClick: () => y(""),
|
|
113
114
|
className: "ml-2 rounded-button p-1 text-text-muted hover:bg-bg-sunken hover:text-text-primary transition-colors",
|
|
114
|
-
"aria-label": "Clear search",
|
|
115
|
-
children: /* @__PURE__ */ s
|
|
115
|
+
"aria-label": h("common.clearSearch", "Clear search"),
|
|
116
|
+
children: /* @__PURE__ */ c(s, { className: "size-4" })
|
|
116
117
|
})
|
|
117
118
|
]
|
|
118
119
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ l("div", {
|
|
120
121
|
className: "max-h-96 overflow-y-auto p-2",
|
|
121
|
-
children: [
|
|
122
|
+
children: [w.length === 0 && /* @__PURE__ */ c("div", {
|
|
122
123
|
className: "py-6 text-center text-sm text-text-muted",
|
|
123
|
-
children: "No commands found."
|
|
124
|
-
}), Object.entries(
|
|
124
|
+
children: h("search.noCommandsFound", "No commands found.")
|
|
125
|
+
}), Object.entries(T).map(([e, n]) => /* @__PURE__ */ l("div", {
|
|
125
126
|
className: "mb-2 last:mb-0",
|
|
126
|
-
children: [/* @__PURE__ */
|
|
127
|
+
children: [/* @__PURE__ */ c("div", {
|
|
127
128
|
className: "px-2 py-1.5 text-[11px] font-medium uppercase tracking-wider text-text-muted",
|
|
128
|
-
children:
|
|
129
|
-
}), n.map((
|
|
130
|
-
let n =
|
|
131
|
-
return
|
|
129
|
+
children: e
|
|
130
|
+
}), n.map((e) => {
|
|
131
|
+
let n = e.icon, r = E;
|
|
132
|
+
return E++, /* @__PURE__ */ l("button", {
|
|
132
133
|
type: "button",
|
|
133
|
-
onClick: () => void
|
|
134
|
-
className:
|
|
134
|
+
onClick: () => void C(e),
|
|
135
|
+
className: t("w-full flex items-start gap-3 px-2.5 py-2 text-sm rounded-button transition-colors text-left", r === b ? "bg-[var(--color-accent-soft)] text-text-primary" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"),
|
|
135
136
|
children: [
|
|
136
|
-
n && /* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
137
|
+
n && /* @__PURE__ */ c(n, { className: "size-4 mt-0.5 flex-shrink-0" }),
|
|
138
|
+
/* @__PURE__ */ l("div", {
|
|
138
139
|
className: "flex-1 min-w-0",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ c("div", {
|
|
140
141
|
className: "font-medium text-text-primary",
|
|
141
|
-
children:
|
|
142
|
-
}),
|
|
142
|
+
children: e.label
|
|
143
|
+
}), e.description && /* @__PURE__ */ c("div", {
|
|
143
144
|
className: "text-xs text-text-muted",
|
|
144
|
-
children:
|
|
145
|
+
children: e.description
|
|
145
146
|
})]
|
|
146
147
|
}),
|
|
147
|
-
|
|
148
|
+
e.shortcut && /* @__PURE__ */ c("kbd", {
|
|
148
149
|
className: "ml-auto pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border-subtle bg-bg-sunken px-1.5 font-mono text-[10px] font-medium text-text-secondary",
|
|
149
|
-
children:
|
|
150
|
+
children: e.shortcut
|
|
150
151
|
})
|
|
151
152
|
]
|
|
152
|
-
},
|
|
153
|
+
}, e.id);
|
|
153
154
|
})]
|
|
154
|
-
},
|
|
155
|
+
}, e))]
|
|
155
156
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ l("div", {
|
|
157
158
|
className: "border-t border-border-subtle px-3 py-2 text-xs text-text-muted flex items-center justify-between",
|
|
158
159
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ l("div", { children: [
|
|
161
|
+
/* @__PURE__ */ c("kbd", {
|
|
161
162
|
className: "inline-flex h-5 select-none items-center gap-1 rounded border border-border-subtle bg-bg-sunken px-1.5 font-mono text-[10px] text-text-secondary",
|
|
162
163
|
children: "↑↓"
|
|
163
164
|
}),
|
|
164
165
|
" ",
|
|
165
|
-
"Navigate"
|
|
166
|
+
h("search.navigate", "Navigate")
|
|
166
167
|
] }),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ l("div", { children: [
|
|
169
|
+
/* @__PURE__ */ c("kbd", {
|
|
169
170
|
className: "inline-flex h-5 select-none items-center gap-1 rounded border border-border-subtle bg-bg-sunken px-1.5 font-mono text-[10px] text-text-secondary",
|
|
170
171
|
children: "Enter"
|
|
171
172
|
}),
|
|
172
173
|
" ",
|
|
173
|
-
"Execute"
|
|
174
|
+
h("search.execute", "Execute")
|
|
174
175
|
] }),
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ l("div", { children: [
|
|
177
|
+
/* @__PURE__ */ c("kbd", {
|
|
177
178
|
className: "inline-flex h-5 select-none items-center gap-1 rounded border border-border-subtle bg-bg-sunken px-1.5 font-mono text-[10px] text-text-secondary",
|
|
178
179
|
children: "Esc"
|
|
179
180
|
}),
|
|
180
181
|
" ",
|
|
181
|
-
"Close"
|
|
182
|
+
h("common.close", "Close")
|
|
182
183
|
] })
|
|
183
184
|
]
|
|
184
185
|
})
|
|
@@ -188,4 +189,4 @@ function d({ actions: l, shortcuts: d = [], placeholder: f = "Type a command or
|
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
191
|
//#endregion
|
|
191
|
-
export {
|
|
192
|
+
export { f as CommandPalette };
|