@burdenoff/fe-libs 2026.1117.1 → 2026.1117.3
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/shared/assistant/history/historyControls.d.ts +5 -0
- package/dist/shared/assistant/history/historyControls.js +9 -5
- package/dist/shared/assistant/home/AssistantHomeActions.d.ts +37 -0
- package/dist/shared/assistant/home/AssistantHomeActions.js +68 -0
- package/dist/shared/assistant/home/AssistantHomeComposer.d.ts +36 -0
- package/dist/shared/assistant/home/AssistantHomeComposer.js +85 -0
- package/dist/shared/assistant/home/AssistantHomeHistory.d.ts +106 -0
- package/dist/shared/assistant/home/AssistantHomeHistory.js +499 -0
- package/dist/shared/assistant/home/AssistantHomePage.d.ts +67 -0
- package/dist/shared/assistant/home/AssistantHomePage.js +78 -0
- package/dist/shared/assistant/home/AssistantHomeStart.d.ts +171 -0
- package/dist/shared/assistant/home/AssistantHomeStart.js +224 -0
- package/dist/shared/assistant/home/assistantHomeChat.d.ts +47 -0
- package/dist/shared/assistant/home/assistantHomeChat.js +49 -0
- package/dist/shared/assistant/home/assistantHomeHistoryRows.d.ts +93 -0
- package/dist/shared/assistant/home/assistantHomeHistoryRows.js +113 -0
- package/dist/shared/assistant/home/assistantHomeRoutes.d.ts +49 -0
- package/dist/shared/assistant/home/assistantHomeRoutes.js +48 -0
- package/dist/shared/assistant/home/assistantHomeTopBar.d.ts +4 -0
- package/dist/shared/assistant/home/assistantHomeTopBar.js +10 -0
- package/dist/shared/assistant/home/useAssistantHomeHistoryRows.d.ts +46 -0
- package/dist/shared/assistant/home/useAssistantHomeHistoryRows.js +120 -0
- package/dist/shared/assistant/home.d.ts +19 -0
- package/dist/shared/assistant/home.js +11 -0
- package/dist/shared/assistant/index.d.ts +10 -0
- package/dist/shared/assistant/ui/AssistantConversationList.js +44 -48
- package/dist/shared/providers/shell/ThemeProvider.js +31 -29
- package/dist/shared-assistant.js +222 -212
- package/package.json +1 -1
- package/src/shared/tokens/depth.css +77 -18
|
@@ -5,26 +5,22 @@ import { useAssistantTr as r } from "../i18n.js";
|
|
|
5
5
|
import { chatTurns as i, voiceTurnsOnly as a } from "../voice/turnVisibility.js";
|
|
6
6
|
import { getAssistantDisplayContent as ee } from "../displayContent.js";
|
|
7
7
|
import { assistantHistory as o } from "../history/historyEngine.js";
|
|
8
|
-
import {
|
|
9
|
-
import { historyRowAcceptsControls as
|
|
10
|
-
import { selectHistorySearchList as
|
|
11
|
-
import { useAssistantHistorySearch as
|
|
8
|
+
import { ALL_HISTORY_LIST_FILTER as s, DEFAULT_HISTORY_LIST_FILTER as c, clampToCodePoints as l, codePointLength as te, historyFilterEmptyKind as u, historyFilterKey as d } from "../history/historyControls.js";
|
|
9
|
+
import { historyRowAcceptsControls as ne, selectAssistantHistoryList as re } from "../history/historyList.js";
|
|
10
|
+
import { selectHistorySearchList as ie } from "../history/historySearch.js";
|
|
11
|
+
import { useAssistantHistorySearch as ae } from "../history/useAssistantHistorySearch.js";
|
|
12
12
|
import { useAssistantHistoryStatus as f } from "../history/historyStatus.js";
|
|
13
|
-
import { useAssistantHistoryStore as
|
|
14
|
-
import { AssistantHistoryPinLimitBanner as
|
|
15
|
-
import { AssistantConversationFilters as
|
|
16
|
-
import { AssistantHistorySearchBox as
|
|
17
|
-
import { PAGE_VIEW_GUTTER as
|
|
18
|
-
import { useEffect as
|
|
19
|
-
import { Archive as
|
|
13
|
+
import { useAssistantHistoryStore as oe } from "../history/historyStore.js";
|
|
14
|
+
import { AssistantHistoryPinLimitBanner as se, AssistantHistoryUnsavedDeleteNotice as ce } from "./AssistantHistoryNotices.js";
|
|
15
|
+
import { AssistantConversationFilters as le } from "./AssistantConversationFilters.js";
|
|
16
|
+
import { AssistantHistorySearchBox as ue } from "./AssistantHistorySearchBox.js";
|
|
17
|
+
import { PAGE_VIEW_GUTTER as de, useAssistantPageLayout as fe } from "./assistantPageLayout.js";
|
|
18
|
+
import { useEffect as pe, useId as me, useLayoutEffect as he, useMemo as p, useRef as m, useState as h } from "react";
|
|
19
|
+
import { Archive as ge, ArchiveRestore as _e, ArrowLeft as ve, Check as ye, MessageSquare as be, PanelLeftClose as xe, Pencil as Se, Pin as Ce, PinOff as we, Plus as Te, Trash2 as Ee } from "lucide-react";
|
|
20
20
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
21
21
|
// src/shared/assistant/ui/AssistantConversationList.tsx
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
pinned: null,
|
|
25
|
-
archived: "INCLUDE"
|
|
26
|
-
}, De = (e) => `group relative px-3 py-2 cursor-pointer hover:bg-bg-elevated transition-colors ${e ? "bg-bg-elevated border-s-2 border-action-primary-bg" : ""}`, Oe = ({ active: e, title: t, onOpen: n, details: r, actions: i, openRef: a, actionRef: ee, testId: o }) => {
|
|
27
|
-
let s = pe(), c = `${s}-title`, l = `${s}-details`;
|
|
22
|
+
var De = (e) => `group relative px-3 py-2 cursor-pointer hover:bg-bg-elevated transition-colors ${e ? "bg-bg-elevated border-s-2 border-action-primary-bg" : ""}`, Oe = ({ active: e, title: t, onOpen: n, details: r, actions: i, openRef: a, actionRef: ee, testId: o }) => {
|
|
23
|
+
let s = me(), c = `${s}-title`, l = `${s}-details`;
|
|
28
24
|
return /* @__PURE__ */ v("div", {
|
|
29
25
|
className: De(e),
|
|
30
26
|
"data-testid": o,
|
|
@@ -72,9 +68,9 @@ var Ee = {
|
|
|
72
68
|
}
|
|
73
69
|
return n;
|
|
74
70
|
}, Ae = ({ presentation: Ae, onBack: je, onDone: y }) => {
|
|
75
|
-
let b = r(), Me =
|
|
71
|
+
let b = r(), Me = fe(), Ne = Ae === "compact", { modes: Pe } = n(), { conversations: x, activeConversationId: S, processingByConversationId: Fe, setActiveConversation: Ie, setMode: Le, createConversation: Re, deleteConversation: ze, renameConversation: Be, setConversationListOpen: C } = t(), [w, Ve] = h(null), [He, Ue] = h(""), [We, T] = h(!1), Ge = me(), E = f((e) => e.product !== null), D = f((e) => e.scopeKey), Ke = f((e) => e.loadingIds), O = f((e) => e.olderHeaders), qe = f((e) => e.unsavedDelete !== void 0), Je = f((e) => e.controlsAvailable), k = E && Je, Ye = f((e) => e.pinLimit), A = oe((e) => D === null ? void 0 : e.scopes[D]), Xe = oe((e) => e.tombstones), j = oe((e) => e.outbox), [M, Ze] = h(c), [Qe, $e] = h(!1), et = k ? M : s, tt = (e) => {
|
|
76
72
|
Ze(e), $e(!0);
|
|
77
|
-
}, [nt, rt] = h(""), it = f((e) => e.epoch), N =
|
|
73
|
+
}, [nt, rt] = h(""), it = f((e) => e.epoch), N = ae({
|
|
78
74
|
text: nt,
|
|
79
75
|
filter: M,
|
|
80
76
|
enabled: k,
|
|
@@ -98,18 +94,18 @@ var Ee = {
|
|
|
98
94
|
Xe,
|
|
99
95
|
Ke,
|
|
100
96
|
j
|
|
101
|
-
]), L = p(() => E ?
|
|
97
|
+
]), L = p(() => E ? re(I, et) : null, [
|
|
102
98
|
E,
|
|
103
99
|
I,
|
|
104
100
|
et
|
|
105
|
-
]), R = p(() => E && P ?
|
|
101
|
+
]), R = p(() => E && P ? ie(I, M, N.query, F.status === "results" ? F.hits : null) : null, [
|
|
106
102
|
E,
|
|
107
103
|
P,
|
|
108
104
|
I,
|
|
109
105
|
M,
|
|
110
106
|
N.query,
|
|
111
107
|
F
|
|
112
|
-
]), z = F.status === "results" && F.hasMore, B = F.status === "results" && F.loadingMore, at = k ? M : void 0, ot =
|
|
108
|
+
]), z = F.status === "results" && F.hasMore, B = F.status === "results" && F.loadingMore, at = k ? M : void 0, ot = d(at), V = O && O.scopeKey === D ? O : void 0, H = V ? V.filterKey !== ot || V.hasMore : A?.hasOlderHeaders === !0, U = p(() => R ? [
|
|
113
109
|
...R.server.map((e) => e.key),
|
|
114
110
|
...R.local.map((e) => e.key),
|
|
115
111
|
...R.device.map((e) => e.id)
|
|
@@ -118,7 +114,7 @@ var Ee = {
|
|
|
118
114
|
L,
|
|
119
115
|
x
|
|
120
116
|
]);
|
|
121
|
-
|
|
117
|
+
pe(() => {
|
|
122
118
|
E && o.notePanelOpened();
|
|
123
119
|
}, [E]);
|
|
124
120
|
let W = () => {
|
|
@@ -136,9 +132,9 @@ var Ee = {
|
|
|
136
132
|
let r = `${e}\u0000${t}`;
|
|
137
133
|
n ? K.current.set(r, n) : K.current.delete(r);
|
|
138
134
|
}, q = m(null), J = m(null), ut = m(null), dt = m(null), ft = m(null), pt = (e, t) => {
|
|
139
|
-
Ve(e), Ue(
|
|
135
|
+
Ve(e), Ue(l(t, 80)), T(!1);
|
|
140
136
|
}, mt = (e) => {
|
|
141
|
-
Ue(
|
|
137
|
+
Ue(l(e, 80)), T(te(e) > 80);
|
|
142
138
|
}, ht = () => {
|
|
143
139
|
w && He.trim() && Be(w, He), w && (q.current = {
|
|
144
140
|
kind: "renamed",
|
|
@@ -179,7 +175,7 @@ var Ee = {
|
|
|
179
175
|
onClick: ht,
|
|
180
176
|
className: "p-1 hover:bg-bg-sunken rounded",
|
|
181
177
|
"aria-label": b("conversations.saveTitle", "Save title"),
|
|
182
|
-
children: /* @__PURE__ */ _(
|
|
178
|
+
children: /* @__PURE__ */ _(ye, { className: "size-3 text-status-success-text" })
|
|
183
179
|
})]
|
|
184
180
|
}), /* @__PURE__ */ _("p", {
|
|
185
181
|
id: Ge,
|
|
@@ -188,42 +184,42 @@ var Ee = {
|
|
|
188
184
|
children: We ? b("conversations.titleLimit", "Titles are up to {{limit}} characters", { limit: 80 }) : ""
|
|
189
185
|
})]
|
|
190
186
|
}, e), St = (e) => {
|
|
191
|
-
let t = k &&
|
|
187
|
+
let t = k && ne(e, j, D), n = e.pinnedAt !== null, r = e.archivedAt !== null, i = [];
|
|
192
188
|
return t && !r && i.push({
|
|
193
189
|
id: "pin",
|
|
194
190
|
label: n ? b("conversations.unpin", "Unpin conversation") : b("conversations.pin", "Pin conversation"),
|
|
195
|
-
icon: _(n ?
|
|
191
|
+
icon: _(n ? we : Ce, { className: "size-3 text-text-muted" }),
|
|
196
192
|
onActivate: () => _t(e.key, "pin", { pinned: !n }),
|
|
197
193
|
testId: "pin-conversation"
|
|
198
194
|
}), (e.conversation || t) && i.push({
|
|
199
195
|
id: "rename",
|
|
200
196
|
label: b("conversations.rename", "Rename conversation"),
|
|
201
|
-
icon: /* @__PURE__ */ _(
|
|
197
|
+
icon: /* @__PURE__ */ _(Se, { className: "size-3 text-text-muted" }),
|
|
202
198
|
onActivate: () => pt(e.key, e.title),
|
|
203
199
|
testId: "rename-conversation"
|
|
204
200
|
}), t && i.push({
|
|
205
201
|
id: "archive",
|
|
206
202
|
label: r ? b("conversations.unarchive", "Unarchive conversation") : b("conversations.archive", "Archive conversation"),
|
|
207
|
-
icon: _(r ?
|
|
203
|
+
icon: _(r ? _e : ge, { className: "size-3 text-text-muted" }),
|
|
208
204
|
onActivate: () => _t(e.key, "archive", { archived: !r }),
|
|
209
205
|
testId: "archive-conversation"
|
|
210
206
|
}), i.push({
|
|
211
207
|
id: "delete",
|
|
212
208
|
label: b("conversations.delete", "Delete conversation"),
|
|
213
|
-
icon: /* @__PURE__ */ _(
|
|
209
|
+
icon: /* @__PURE__ */ _(Ee, { className: "size-3 text-status-error-text" }),
|
|
214
210
|
onActivate: () => gt(e.key),
|
|
215
211
|
testId: "delete-conversation"
|
|
216
212
|
}), i;
|
|
217
213
|
}, Ct = (e) => [{
|
|
218
214
|
id: "rename",
|
|
219
215
|
label: b("conversations.rename", "Rename conversation"),
|
|
220
|
-
icon: /* @__PURE__ */ _(
|
|
216
|
+
icon: /* @__PURE__ */ _(Se, { className: "size-3 text-text-muted" }),
|
|
221
217
|
onActivate: () => pt(e.id, e.title),
|
|
222
218
|
testId: "rename-conversation"
|
|
223
219
|
}, {
|
|
224
220
|
id: "delete",
|
|
225
221
|
label: b("conversations.delete", "Delete conversation"),
|
|
226
|
-
icon: /* @__PURE__ */ _(
|
|
222
|
+
icon: /* @__PURE__ */ _(Ee, { className: "size-3 text-status-error-text" }),
|
|
227
223
|
onActivate: () => gt(e.id),
|
|
228
224
|
testId: "delete-conversation"
|
|
229
225
|
}], X = (e, t) => {
|
|
@@ -285,7 +281,7 @@ var Ee = {
|
|
|
285
281
|
e.pinnedAt === null ? null : /* @__PURE__ */ v("span", {
|
|
286
282
|
className: `${Y} inline-flex items-center gap-0.5`,
|
|
287
283
|
"data-testid": "history-badge-pinned",
|
|
288
|
-
children: [/* @__PURE__ */ _(
|
|
284
|
+
children: [/* @__PURE__ */ _(Ce, {
|
|
289
285
|
className: "size-2.5",
|
|
290
286
|
"aria-hidden": "true"
|
|
291
287
|
}), b("conversationList.badgePinned", "Pinned")]
|
|
@@ -293,7 +289,7 @@ var Ee = {
|
|
|
293
289
|
e.archivedAt === null ? null : /* @__PURE__ */ v("span", {
|
|
294
290
|
className: `${Y} inline-flex items-center gap-0.5`,
|
|
295
291
|
"data-testid": "history-badge-archived",
|
|
296
|
-
children: [/* @__PURE__ */ _(
|
|
292
|
+
children: [/* @__PURE__ */ _(ge, {
|
|
297
293
|
className: "size-2.5",
|
|
298
294
|
"aria-hidden": "true"
|
|
299
295
|
}), b("conversationList.badgeArchived", "Archived")]
|
|
@@ -341,10 +337,10 @@ var Ee = {
|
|
|
341
337
|
}) : Dt(e), Z = (e) => /* @__PURE__ */ _("h3", {
|
|
342
338
|
className: "px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wide text-text-muted",
|
|
343
339
|
children: e
|
|
344
|
-
}), Q = R ? R.server.length + R.local.length + R.device.length : L ? L.workspace.length + L.device.length : x.length, kt = R ? Q === 0 && F.status !== "searching" && !z : L ? Q === 0 && !H : x.length === 0, At = (e) => e === 0 ? b("conversationFilters.none", "No conversations match") : e === 1 ? b("conversationFilters.countOne", "1 conversation") : b("conversationFilters.count", "{{count}} conversations", { count: e }), jt = P ? N.tooShort ? b("historySearch.tooShort", "Type 2 or more characters to search this workspace") : F.status === "searching" ? b("historySearch.searching", "Searching…") : At(Q) : void 0, Mt = P ? F.status === "fallback" ? F.reason === "busy" ? b("historySearch.busy", "Search is busy right now. Showing matches on this device.") : b("historySearch.failed", "Couldn't search this workspace. Showing matches on this device.") : F.status === "results" && F.moreFailed ? b("historySearch.moreFailed", "Couldn't load more results. Try again.") : "" : "", $ = k && !P ?
|
|
345
|
-
return
|
|
340
|
+
}), Q = R ? R.server.length + R.local.length + R.device.length : L ? L.workspace.length + L.device.length : x.length, kt = R ? Q === 0 && F.status !== "searching" && !z : L ? Q === 0 && !H : x.length === 0, At = (e) => e === 0 ? b("conversationFilters.none", "No conversations match") : e === 1 ? b("conversationFilters.countOne", "1 conversation") : b("conversationFilters.count", "{{count}} conversations", { count: e }), jt = P ? N.tooShort ? b("historySearch.tooShort", "Type 2 or more characters to search this workspace") : F.status === "searching" ? b("historySearch.searching", "Searching…") : At(Q) : void 0, Mt = P ? F.status === "fallback" ? F.reason === "busy" ? b("historySearch.busy", "Search is busy right now. Showing matches on this device.") : b("historySearch.failed", "Couldn't search this workspace. Showing matches on this device.") : F.status === "results" && F.moreFailed ? b("historySearch.moreFailed", "Couldn't load more results. Try again.") : "" : "", $ = k && !P ? u(M) : null, Nt = P ? At(0) : $ === "archived" ? b("conversationList.emptyArchived", "No archived conversations") : $ === "pinned" ? b("conversationList.emptyPinned", "No pinned conversations") : $ === "voice" ? b("conversationList.emptyVoice", "No voice conversations") : $ === "chat" ? b("conversationList.emptyChat", "No chat conversations") : b("conversations.empty", "No conversations yet"), Pt = e("assistant-open-history");
|
|
341
|
+
return he(() => {
|
|
346
342
|
w !== null && J.current?.focus({ preventScroll: !0 });
|
|
347
|
-
}, [w]),
|
|
343
|
+
}, [w]), he(() => {
|
|
348
344
|
let e = q.current;
|
|
349
345
|
if (!e || (e.kind === "deleted" ? U.includes(e.key) : e.kind === "renamed" ? w === e.key : e.kind !== "control" && (e.kind === "more" ? B : H))) return;
|
|
350
346
|
q.current = null;
|
|
@@ -385,7 +381,7 @@ var Ee = {
|
|
|
385
381
|
tabIndex: -1,
|
|
386
382
|
role: "region",
|
|
387
383
|
"aria-label": b("conversations.title", "History"),
|
|
388
|
-
className: `absolute inset-0 z-10 flex flex-col bg-bg-surface outline-none animate-in slide-in-from-left-2 fade-in duration-200${Me ? ` ${
|
|
384
|
+
className: `absolute inset-0 z-10 flex flex-col bg-bg-surface outline-none animate-in slide-in-from-left-2 fade-in duration-200${Me ? ` ${de}` : ""}`,
|
|
389
385
|
"data-testid": "conversation-list",
|
|
390
386
|
children: [
|
|
391
387
|
Ne ? /* @__PURE__ */ v("div", {
|
|
@@ -397,7 +393,7 @@ var Ee = {
|
|
|
397
393
|
className: "flex size-10 shrink-0 items-center justify-center rounded-button text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
398
394
|
"aria-label": b("menuView.back", "Back"),
|
|
399
395
|
"data-testid": "collapse-conversation-list",
|
|
400
|
-
children: /* @__PURE__ */ _(
|
|
396
|
+
children: /* @__PURE__ */ _(ve, {
|
|
401
397
|
className: "size-5",
|
|
402
398
|
"aria-hidden": "true"
|
|
403
399
|
})
|
|
@@ -412,7 +408,7 @@ var Ee = {
|
|
|
412
408
|
className: "flex size-10 shrink-0 items-center justify-center rounded-button text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
413
409
|
"aria-label": b("conversations.new", "New conversation"),
|
|
414
410
|
"data-testid": "new-conversation",
|
|
415
|
-
children: /* @__PURE__ */ _(
|
|
411
|
+
children: /* @__PURE__ */ _(Te, {
|
|
416
412
|
className: "size-5",
|
|
417
413
|
"aria-hidden": "true"
|
|
418
414
|
})
|
|
@@ -431,31 +427,31 @@ var Ee = {
|
|
|
431
427
|
className: "p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors",
|
|
432
428
|
"aria-label": b("conversations.new", "New conversation"),
|
|
433
429
|
"data-testid": "new-conversation",
|
|
434
|
-
children: /* @__PURE__ */ _(
|
|
430
|
+
children: /* @__PURE__ */ _(Te, { className: "size-4" })
|
|
435
431
|
}), /* @__PURE__ */ v("button", {
|
|
436
432
|
type: "button",
|
|
437
433
|
onClick: () => C(!1),
|
|
438
434
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors",
|
|
439
435
|
"aria-label": b("conversations.collapse", "Collapse history"),
|
|
440
436
|
"data-testid": "collapse-conversation-list",
|
|
441
|
-
children: [/* @__PURE__ */ _(
|
|
437
|
+
children: [/* @__PURE__ */ _(xe, { className: "size-4" }), /* @__PURE__ */ _("span", {
|
|
442
438
|
className: "text-[11px] font-medium",
|
|
443
439
|
children: b("conversations.collapseLabel", "Collapse")
|
|
444
440
|
})]
|
|
445
441
|
})]
|
|
446
442
|
})]
|
|
447
443
|
}),
|
|
448
|
-
E && qe ? /* @__PURE__ */ _(
|
|
449
|
-
E && Ye ? /* @__PURE__ */ _(
|
|
444
|
+
E && qe ? /* @__PURE__ */ _(ce, {}) : null,
|
|
445
|
+
E && Ye ? /* @__PURE__ */ _(se, {
|
|
450
446
|
limit: Ye.limit,
|
|
451
447
|
onDismiss: () => f.getState().notePinLimit(void 0)
|
|
452
448
|
}) : null,
|
|
453
|
-
k ? /* @__PURE__ */ _(
|
|
449
|
+
k ? /* @__PURE__ */ _(le, {
|
|
454
450
|
filter: M,
|
|
455
451
|
onChange: tt,
|
|
456
452
|
count: Q,
|
|
457
453
|
announce: Qe,
|
|
458
|
-
search: /* @__PURE__ */ _(
|
|
454
|
+
search: /* @__PURE__ */ _(ue, {
|
|
459
455
|
value: nt,
|
|
460
456
|
onChange: rt,
|
|
461
457
|
onSubmit: N.flush,
|
|
@@ -469,7 +465,7 @@ var Ee = {
|
|
|
469
465
|
className: "flex flex-col items-center justify-center h-full text-center px-4",
|
|
470
466
|
"data-testid": "history-empty",
|
|
471
467
|
children: [
|
|
472
|
-
/* @__PURE__ */ _(
|
|
468
|
+
/* @__PURE__ */ _(be, { className: "size-6 text-text-muted mb-2" }),
|
|
473
469
|
/* @__PURE__ */ _("p", {
|
|
474
470
|
className: "text-xs text-text-muted",
|
|
475
471
|
children: Nt
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { desktopSetTheme as e } from "../../native/desktop.js";
|
|
2
2
|
import { brandAttribute as t } from "./brandAttribute.js";
|
|
3
3
|
import { createContext as n, use as r, useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
|
|
4
|
-
import { jsx as
|
|
4
|
+
import { jsx as ee } from "react/jsx-runtime";
|
|
5
5
|
// src/shared/providers/shell/ThemeProvider.tsx
|
|
6
|
-
var
|
|
6
|
+
var c = /* @__PURE__ */ new Set([
|
|
7
7
|
"dark",
|
|
8
8
|
"forest",
|
|
9
9
|
"ocean",
|
|
10
10
|
"sunset",
|
|
11
11
|
"high-contrast"
|
|
12
|
-
]),
|
|
12
|
+
]), l = [
|
|
13
13
|
{
|
|
14
14
|
value: "light",
|
|
15
15
|
label: "Light",
|
|
@@ -40,10 +40,10 @@ var l = /* @__PURE__ */ new Set([
|
|
|
40
40
|
label: "High Contrast",
|
|
41
41
|
family: "dark"
|
|
42
42
|
}
|
|
43
|
-
],
|
|
44
|
-
function
|
|
43
|
+
], u = (e) => c.has(e) ? "dark" : "light";
|
|
44
|
+
function d(e) {
|
|
45
45
|
let t = /^#?([0-9a-f]{6})$/i.exec(e.trim());
|
|
46
|
-
if (!t) return
|
|
46
|
+
if (!t) return null;
|
|
47
47
|
let n = parseInt(t[1], 16), r = [
|
|
48
48
|
n >> 16 & 255,
|
|
49
49
|
n >> 8 & 255,
|
|
@@ -54,7 +54,7 @@ function f(e) {
|
|
|
54
54
|
});
|
|
55
55
|
return .2126 * r[0] + .7152 * r[1] + .0722 * r[2];
|
|
56
56
|
}
|
|
57
|
-
var p = (e) => f(e) > .45;
|
|
57
|
+
var f = (e) => d(e) ?? 0, p = (e) => f(e) > .45;
|
|
58
58
|
function m(e, t) {
|
|
59
59
|
if (typeof window > "u") return t;
|
|
60
60
|
try {
|
|
@@ -65,10 +65,10 @@ function m(e, t) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
var h = n(null);
|
|
68
|
-
function g({ children: n, defaultMode: r = "system", defaultBrand:
|
|
69
|
-
let v = (e, t) => typeof window > "u" ? t : localStorage.getItem(`${_}-${e}`) || t, [y, b] = s(() => v("mode", r)), [x, S] = s(() => v("brand",
|
|
68
|
+
function g({ children: n, defaultMode: r = "system", defaultBrand: c = "default", defaultDensity: l = "comfortable", defaultTypography: f = "default", defaultGlass: g = "full", storageKey: _ = "burdenoff-theme" }) {
|
|
69
|
+
let v = (e, t) => typeof window > "u" ? t : localStorage.getItem(`${_}-${e}`) || t, [y, b] = s(() => v("mode", r)), [x, S] = s(() => v("brand", c)), [C, te] = s(() => v("density", l)), [w, T] = s(() => v("typography", f)), [E, D] = s(() => v("glass", g)), [O, k] = s(() => v("reduce-motion", "") === "1"), [A, ne] = s(() => m(`${_}-custom-list`, [])), [j, M] = s(() => v("active-custom", "") || null), N = o(() => y === "custom" ? A.find((e) => e.id === j) ?? null : null, [
|
|
70
70
|
y,
|
|
71
|
-
|
|
71
|
+
A,
|
|
72
72
|
j
|
|
73
73
|
]), [P, F] = s(() => y === "custom" ? "light" : y === "system" ? typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : y);
|
|
74
74
|
a(() => {
|
|
@@ -78,13 +78,15 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
|
|
|
78
78
|
}
|
|
79
79
|
F(y === "custom" ? N?.base ?? "light" : y);
|
|
80
80
|
}, [y, N]);
|
|
81
|
-
let I =
|
|
81
|
+
let I = u(P), L = N?.density ?? C, R = N?.typography ?? w, z = N?.glass ?? E, B = N?.reduceMotion ?? O;
|
|
82
82
|
a(() => {
|
|
83
83
|
let n = document.documentElement;
|
|
84
84
|
if (n.setAttribute("data-theme", P), n.setAttribute("data-brand", t(x)), n.setAttribute("data-density", L), n.setAttribute("data-typography", R), n.setAttribute("data-glass", z), n.toggleAttribute("data-reduce-motion", B), I === "dark" ? n.classList.add("dark") : n.classList.remove("dark"), N) {
|
|
85
85
|
let e = N.accent;
|
|
86
|
-
n.setAttribute("data-accent", "custom"), p(e) ? n.setAttribute("data-accent-label", "dark") : n.removeAttribute("data-accent-label")
|
|
87
|
-
|
|
86
|
+
n.setAttribute("data-accent", "custom"), p(e) ? n.setAttribute("data-accent-label", "dark") : n.removeAttribute("data-accent-label");
|
|
87
|
+
let t = d(e);
|
|
88
|
+
t === null ? n.style.removeProperty("--custom-accent-luminance") : n.style.setProperty("--custom-accent-luminance", t.toFixed(4)), n.style.setProperty("--color-action-primary-bg", e), n.style.setProperty("--color-action-primary-bgHover", `color-mix(in oklab, ${e} 84%, black)`), n.style.setProperty("--color-action-primary-bgActive", `color-mix(in oklab, ${e} 70%, black)`), n.style.setProperty("--color-action-primary-text", p(e) ? "#0a0a0a" : "#ffffff");
|
|
89
|
+
} else n.removeAttribute("data-accent"), n.removeAttribute("data-accent-label"), n.style.removeProperty("--custom-accent-luminance"), n.style.removeProperty("--color-action-primary-bg"), n.style.removeProperty("--color-action-primary-bgHover"), n.style.removeProperty("--color-action-primary-bgActive"), n.style.removeProperty("--color-action-primary-text");
|
|
88
90
|
let r = () => {
|
|
89
91
|
let t = getComputedStyle(n).getPropertyValue("--color-bg-canvas").trim();
|
|
90
92
|
e({
|
|
@@ -114,28 +116,28 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
|
|
|
114
116
|
}, [V]), W = i((e) => {
|
|
115
117
|
te(e), V("density", e);
|
|
116
118
|
}, [V]), G = i((e) => {
|
|
117
|
-
|
|
119
|
+
T(e), V("typography", e);
|
|
118
120
|
}, [V]), K = i((e) => {
|
|
119
|
-
|
|
121
|
+
D(e), V("glass", e);
|
|
120
122
|
}, [V]), q = i((e) => {
|
|
121
|
-
|
|
123
|
+
k(e), V("reduce-motion", e ? "1" : "0");
|
|
122
124
|
}, [V]), J = i((e) => {
|
|
123
|
-
|
|
125
|
+
ne(e), localStorage.setItem(`${_}-custom-list`, JSON.stringify(e));
|
|
124
126
|
}, [_]), Y = i((e) => {
|
|
125
127
|
let t = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `ct-${Date.now()}-${Math.floor(performance.now())}`, n = {
|
|
126
128
|
...e,
|
|
127
129
|
id: t
|
|
128
130
|
};
|
|
129
|
-
return J([...
|
|
130
|
-
}, [
|
|
131
|
-
J(
|
|
131
|
+
return J([...A, n]), n;
|
|
132
|
+
}, [A, J]), X = i((e, t) => {
|
|
133
|
+
J(A.map((n) => n.id === e ? {
|
|
132
134
|
...n,
|
|
133
135
|
...t
|
|
134
136
|
} : n));
|
|
135
|
-
}, [
|
|
136
|
-
J(
|
|
137
|
+
}, [A, J]), Z = i((e) => {
|
|
138
|
+
J(A.filter((t) => t.id !== e)), j === e && (M(null), V("active-custom", ""), H("system"));
|
|
137
139
|
}, [
|
|
138
|
-
|
|
140
|
+
A,
|
|
139
141
|
J,
|
|
140
142
|
j,
|
|
141
143
|
V,
|
|
@@ -144,7 +146,7 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
|
|
|
144
146
|
M(e), V("active-custom", e), H("custom");
|
|
145
147
|
}, [V, H]), $ = i(() => {
|
|
146
148
|
H(I === "light" ? "dark" : "light");
|
|
147
|
-
}, [I, H]),
|
|
149
|
+
}, [I, H]), re = o(() => ({
|
|
148
150
|
mode: y,
|
|
149
151
|
brand: x,
|
|
150
152
|
density: L,
|
|
@@ -159,7 +161,7 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
|
|
|
159
161
|
setTypography: G,
|
|
160
162
|
setGlass: K,
|
|
161
163
|
setReduceMotion: q,
|
|
162
|
-
customThemes:
|
|
164
|
+
customThemes: A,
|
|
163
165
|
activeCustomId: j,
|
|
164
166
|
createCustomTheme: Y,
|
|
165
167
|
updateCustomTheme: X,
|
|
@@ -182,7 +184,7 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
|
|
|
182
184
|
G,
|
|
183
185
|
K,
|
|
184
186
|
q,
|
|
185
|
-
|
|
187
|
+
A,
|
|
186
188
|
j,
|
|
187
189
|
Y,
|
|
188
190
|
X,
|
|
@@ -190,8 +192,8 @@ function g({ children: n, defaultMode: r = "system", defaultBrand: l = "default"
|
|
|
190
192
|
Q,
|
|
191
193
|
$
|
|
192
194
|
]);
|
|
193
|
-
return /* @__PURE__ */
|
|
194
|
-
value:
|
|
195
|
+
return /* @__PURE__ */ ee(h.Provider, {
|
|
196
|
+
value: re,
|
|
195
197
|
children: n
|
|
196
198
|
});
|
|
197
199
|
}
|
|
@@ -203,4 +205,4 @@ function _() {
|
|
|
203
205
|
function v() {
|
|
204
206
|
return r(h);
|
|
205
207
|
}
|
|
206
|
-
export {
|
|
208
|
+
export { l as THEME_OPTIONS, g as ThemeProvider, _ as useTheme, v as useThemeOrNull };
|