@cortexkit/opencode-openai-auth 1.8.6 → 1.9.1
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/bin.js +2 -2
- package/dist/{index-byz2j6hz.js → index-2f9w48sc.js} +1 -1
- package/dist/{index-zah8t2d2.js → index-5sgqz46z.js} +2 -2
- package/dist/{index-jh90fx7y.js → index-6j3059fy.js} +2 -2
- package/dist/index-6r27fz5a.js +91 -0
- package/dist/{index-kphzmgq6.js → index-96971sba.js} +1 -1
- package/dist/{index-pnvp8hvs.js → index-b79fxcrc.js} +1 -1
- package/dist/{index-5wgxt362.js → index-bvswyxpt.js} +1 -1
- package/dist/index-fqt90tbq.js +76 -0
- package/dist/{index-95s2mw9w.js → index-hpb6k6st.js} +2 -2
- package/dist/{index-25p8t63g.js → index-hyjrm2vw.js} +2 -2
- package/dist/{index-zf649dj2.js → index-k1dfzavn.js} +2 -2
- package/dist/index-mtf8pv2w.js +8 -0
- package/dist/index-mw7fqra8.js +63 -0
- package/dist/index.js +1 -1
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/token-util-ybe08zph.js +1 -0
- package/dist/{token-j2jmx8k7.js → token-y2zkdr5m.js} +1 -1
- package/dist/tui-preferences.js +1 -1
- package/dist/v2/server.js +2 -2
- package/package.json +2 -2
- package/src/tui-compiled/raw/shared/0332701351b3eeec-format.js +45 -26
- package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +25 -0
- package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +20 -1
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +37 -10
- package/src/tui-compiled/raw/shared/549daf371622c304-index.tsx +288 -131
- package/src/tui-compiled/raw/shared/7c97ac0cec074ae7-format.js +30 -17
- package/src/tui-compiled/raw/shared/d0f0b6be200311af-insula.js +6 -0
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +2 -2
- package/src/tui-compiled/runtime/shared/0332701351b3eeec-format.js +45 -26
- package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +25 -0
- package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +20 -1
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +37 -10
- package/src/tui-compiled/runtime/shared/549daf371622c304-index.js +358 -225
- package/src/tui-compiled/runtime/shared/7c97ac0cec074ae7-format.js +30 -17
- package/src/tui-compiled/runtime/shared/d0f0b6be200311af-insula.js +6 -0
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +2 -2
- package/dist/index-a8wbqm6a.js +0 -74
- package/dist/index-n12zjwh9.js +0 -8
- package/dist/index-v6jcz0hz.js +0 -63
- package/dist/index-zne9tzy9.js +0 -91
- package/dist/token-util-7n2nfbyc.js +0 -1
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
createMemo,
|
|
6
6
|
createSignal,
|
|
7
7
|
For,
|
|
8
|
+
Index,
|
|
9
|
+
mergeProps,
|
|
8
10
|
Show,
|
|
9
11
|
useContext,
|
|
10
12
|
} from "solid-js"
|
|
@@ -21,7 +23,9 @@ export type Tone =
|
|
|
21
23
|
| 'error'
|
|
22
24
|
|
|
23
25
|
export type SidebarTheme = Readonly<
|
|
24
|
-
|
|
26
|
+
Partial<
|
|
27
|
+
Record<Tone | 'background' | 'borderActive', RGBA | string | undefined>
|
|
28
|
+
>
|
|
25
29
|
>
|
|
26
30
|
|
|
27
31
|
export interface SidebarAppearance {
|
|
@@ -61,7 +65,7 @@ export interface AccountView {
|
|
|
61
65
|
export interface SidebarFrameProps {
|
|
62
66
|
header: { badge: string; version?: string }
|
|
63
67
|
accounts: readonly AccountView[]
|
|
64
|
-
theme
|
|
68
|
+
theme?: SidebarTheme
|
|
65
69
|
appearance: SidebarAppearance
|
|
66
70
|
showQuota: boolean
|
|
67
71
|
now: number
|
|
@@ -70,11 +74,16 @@ export interface SidebarFrameProps {
|
|
|
70
74
|
beforeQuota?: (account: AccountView) => JSX.Element
|
|
71
75
|
afterQuota?: (account: AccountView) => JSX.Element
|
|
72
76
|
sections?: () => JSX.Element
|
|
77
|
+
collapsedSections?: () => JSX.Element
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type FrameContextProps = Omit<SidebarFrameProps, 'theme'> & {
|
|
81
|
+
theme: SidebarTheme
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
const FrameContext = createContext<
|
|
84
|
+
const FrameContext = createContext<FrameContextProps>()
|
|
76
85
|
|
|
77
|
-
function frameContext():
|
|
86
|
+
function frameContext(): FrameContextProps {
|
|
78
87
|
const context = useContext(FrameContext)
|
|
79
88
|
if (!context)
|
|
80
89
|
throw new Error('Sidebar primitives must be inside SidebarFrame')
|
|
@@ -158,9 +167,20 @@ export function SidebarStatRow(props: {
|
|
|
158
167
|
)
|
|
159
168
|
}
|
|
160
169
|
|
|
161
|
-
export function SidebarTextRow(props: {
|
|
170
|
+
export function SidebarTextRow(props: {
|
|
171
|
+
text: string
|
|
172
|
+
tone?: Tone
|
|
173
|
+
wrapMode?: JSX.IntrinsicElements['text']['wrapMode']
|
|
174
|
+
}) {
|
|
162
175
|
const context = frameContext()
|
|
163
|
-
return
|
|
176
|
+
return (
|
|
177
|
+
<text
|
|
178
|
+
fg={context.theme[props.tone ?? 'textMuted']}
|
|
179
|
+
wrapMode={props.wrapMode}
|
|
180
|
+
>
|
|
181
|
+
{props.text}
|
|
182
|
+
</text>
|
|
183
|
+
)
|
|
164
184
|
}
|
|
165
185
|
|
|
166
186
|
function usageTone(used: number, appearance: SidebarAppearance): Tone {
|
|
@@ -179,16 +199,18 @@ function barSegments(
|
|
|
179
199
|
Math.max(0, Math.min(Math.round((pct / 100) * width), width))
|
|
180
200
|
const usedCells = cells(used)
|
|
181
201
|
const tone = usageTone(used, appearance)
|
|
202
|
+
// Keep the overlay's slot even when empty so live pacing changes reuse nodes.
|
|
182
203
|
const plain = [
|
|
183
204
|
{ text: appearance.barFilledChar.repeat(usedCells), tone },
|
|
205
|
+
{ text: '', tone },
|
|
184
206
|
{ text: appearance.barEmptyChar.repeat(width - usedCells), tone },
|
|
185
207
|
]
|
|
186
208
|
const overlay = pace?.overlay
|
|
187
|
-
if (!overlay) return plain
|
|
209
|
+
if (!overlay) return plain
|
|
188
210
|
const paceCells = cells(overlay.percent)
|
|
189
211
|
const lo = Math.min(usedCells, paceCells)
|
|
190
212
|
const hi = Math.max(usedCells, paceCells)
|
|
191
|
-
if (lo === hi) return plain
|
|
213
|
+
if (lo === hi) return plain
|
|
192
214
|
return [
|
|
193
215
|
{ text: appearance.barFilledChar.repeat(lo), tone },
|
|
194
216
|
{
|
|
@@ -197,39 +219,50 @@ function barSegments(
|
|
|
197
219
|
overlay.kind === 'deficit' ? ('error' as const) : ('success' as const),
|
|
198
220
|
},
|
|
199
221
|
{ text: appearance.barEmptyChar.repeat(width - hi), tone },
|
|
200
|
-
]
|
|
222
|
+
]
|
|
201
223
|
}
|
|
202
224
|
|
|
203
225
|
function QuotaRow(props: {
|
|
204
226
|
part: QuotaWindowPart
|
|
205
227
|
pace?: PaceView
|
|
206
228
|
labelWidth: number
|
|
229
|
+
barCells: number
|
|
230
|
+
resetWidth: number
|
|
231
|
+
showReset: boolean
|
|
207
232
|
}) {
|
|
208
233
|
const context = frameContext()
|
|
209
234
|
const [columns, setColumns] = createSignal(0)
|
|
210
235
|
let row: { width: number } | undefined
|
|
211
|
-
const label = () =>
|
|
236
|
+
const label = () =>
|
|
237
|
+
props.part.name +
|
|
238
|
+
' '.repeat(Math.max(0, props.labelWidth - displayWidth(props.part.name)))
|
|
212
239
|
const figure = () =>
|
|
213
240
|
` ${props.part.kind === 'budget' && props.part.figure.startsWith(`${props.part.name} `) ? props.part.figure.slice(props.part.name.length + 1) : props.part.figure}`
|
|
214
|
-
const
|
|
215
|
-
props.part.resetIn ?? (props.part.resetSinceReading ? 'reset' : undefined)
|
|
241
|
+
const hasReading = () => props.part.reading === 'known'
|
|
216
242
|
const used = () => 100 - (props.part.remainingPercent ?? 100)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
243
|
+
// Size notifications can recompute an unchanged fit after text has been flushed
|
|
244
|
+
// for the frame. Keep equal segments, and update fixed slots in place when the
|
|
245
|
+
// bar changes, rather than replacing text nodes during layout.
|
|
246
|
+
const segments = createMemo(
|
|
247
|
+
() =>
|
|
248
|
+
hasReading()
|
|
249
|
+
? barSegments(
|
|
250
|
+
used(),
|
|
251
|
+
{ ...context.appearance, barWidth: props.barCells },
|
|
252
|
+
props.pace,
|
|
253
|
+
)
|
|
254
|
+
: [],
|
|
255
|
+
undefined,
|
|
256
|
+
{
|
|
257
|
+
equals: (previous, next) =>
|
|
258
|
+
previous.length === next.length &&
|
|
259
|
+
previous.every(
|
|
260
|
+
(segment, index) =>
|
|
261
|
+
segment.text === next[index]?.text &&
|
|
262
|
+
segment.tone === next[index]?.tone,
|
|
263
|
+
),
|
|
264
|
+
},
|
|
265
|
+
)
|
|
233
266
|
const paceLine = () => {
|
|
234
267
|
const text = props.pace?.text
|
|
235
268
|
if (!text || columns() <= 0) return text
|
|
@@ -246,43 +279,85 @@ function QuotaRow(props: {
|
|
|
246
279
|
flexDirection='row'
|
|
247
280
|
justifyContent='space-between'
|
|
248
281
|
>
|
|
249
|
-
<box
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
<
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
{
|
|
261
|
-
<text fg={context.theme
|
|
262
|
-
|
|
282
|
+
<box
|
|
283
|
+
flexDirection='row'
|
|
284
|
+
flexShrink={props.part.resetSinceReading ? 1 : 0}
|
|
285
|
+
>
|
|
286
|
+
<Show when={props.labelWidth > 0}>
|
|
287
|
+
<text fg={context.theme.textMuted} wrapMode='none' flexShrink={0}>
|
|
288
|
+
{label()}
|
|
289
|
+
</text>
|
|
290
|
+
</Show>
|
|
291
|
+
<Show
|
|
292
|
+
when={hasReading()}
|
|
293
|
+
fallback={
|
|
294
|
+
<text fg={context.theme.textMuted} wrapMode='none'>
|
|
295
|
+
no reading
|
|
263
296
|
</text>
|
|
264
|
-
|
|
265
|
-
</For>
|
|
266
|
-
<text
|
|
267
|
-
fg={context.theme[usageTone(used(), context.appearance)]}
|
|
268
|
-
wrapMode='none'
|
|
297
|
+
}
|
|
269
298
|
>
|
|
270
|
-
|
|
271
|
-
|
|
299
|
+
<Show
|
|
300
|
+
when={!props.part.resetSinceReading}
|
|
301
|
+
fallback={
|
|
302
|
+
<text fg={context.theme.textMuted} wrapMode='none'>
|
|
303
|
+
reset since last check
|
|
304
|
+
</text>
|
|
305
|
+
}
|
|
306
|
+
>
|
|
307
|
+
<Show when={props.barCells > 0}>
|
|
308
|
+
{/* Text nodes clear omitted theme colours; empty slots must not reserve a cell. */}
|
|
309
|
+
<Index each={segments()}>
|
|
310
|
+
{(segment) => (
|
|
311
|
+
<text
|
|
312
|
+
fg={context.theme[segment().tone]}
|
|
313
|
+
wrapMode='none'
|
|
314
|
+
width={segment().text ? undefined : 0}
|
|
315
|
+
>
|
|
316
|
+
{segment().text}
|
|
317
|
+
</text>
|
|
318
|
+
)}
|
|
319
|
+
</Index>
|
|
320
|
+
</Show>
|
|
321
|
+
<text
|
|
322
|
+
fg={context.theme[usageTone(used(), context.appearance)]}
|
|
323
|
+
wrapMode='none'
|
|
324
|
+
>
|
|
325
|
+
{figure()}
|
|
326
|
+
</text>
|
|
327
|
+
</Show>
|
|
328
|
+
</Show>
|
|
272
329
|
</box>
|
|
273
|
-
<Show
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
330
|
+
<Show
|
|
331
|
+
when={
|
|
332
|
+
hasReading() && props.showReset && !props.part.resetSinceReading
|
|
333
|
+
}
|
|
334
|
+
>
|
|
335
|
+
<box
|
|
336
|
+
width={props.resetWidth}
|
|
337
|
+
flexShrink={0}
|
|
338
|
+
flexDirection='row'
|
|
339
|
+
justifyContent='flex-end'
|
|
340
|
+
>
|
|
341
|
+
<Show when={props.part.resetIn}>
|
|
342
|
+
<text fg={context.theme.textMuted} wrapMode='none'>
|
|
343
|
+
{props.part.resetIn}
|
|
344
|
+
</text>
|
|
345
|
+
</Show>
|
|
346
|
+
</box>
|
|
277
347
|
</Show>
|
|
278
348
|
</box>
|
|
279
349
|
{/* A changed fitted line needs a fresh text node to draw at its new width. */}
|
|
280
|
-
<Show
|
|
350
|
+
<Show
|
|
351
|
+
when={hasReading() && !props.part.resetSinceReading && paceLine()}
|
|
352
|
+
keyed
|
|
353
|
+
>
|
|
281
354
|
{(line: string) => (
|
|
282
355
|
<box width='100%' flexDirection='row'>
|
|
283
|
-
<
|
|
284
|
-
{
|
|
285
|
-
|
|
356
|
+
<Show when={props.labelWidth > 0}>
|
|
357
|
+
<text fg={context.theme.textMuted}>
|
|
358
|
+
{''.padEnd(props.labelWidth)}
|
|
359
|
+
</text>
|
|
360
|
+
</Show>
|
|
286
361
|
<text
|
|
287
362
|
fg={context.theme[props.pace?.tone ?? 'textMuted']}
|
|
288
363
|
wrapMode='none'
|
|
@@ -301,19 +376,21 @@ function CollapsedAccountRow(props: { account: AccountView }) {
|
|
|
301
376
|
const [width, setWidth] = createSignal(0)
|
|
302
377
|
let row: { width: number } | undefined
|
|
303
378
|
const hasQuota = () =>
|
|
304
|
-
quotaWindowParts(props.account.quota, { now: context.now }).windows.
|
|
305
|
-
|
|
379
|
+
quotaWindowParts(props.account.quota, { now: context.now }).windows.some(
|
|
380
|
+
(part) => part.reading === 'known',
|
|
381
|
+
)
|
|
306
382
|
const text = () =>
|
|
307
383
|
hasQuota()
|
|
308
384
|
? formatQuota(props.account.quota, { now: context.now, form: 'narrow' })
|
|
309
|
-
:
|
|
385
|
+
: (props.account.emptyQuotaText?.collapsed ?? '\u2014')
|
|
386
|
+
// Reserve an ellipsis, a separator and the trailing indicator before keeping quota.
|
|
387
|
+
const showQuota = () => width() <= 0 || displayWidth(text()) + 4 <= width()
|
|
310
388
|
const label = () => {
|
|
311
389
|
if (width() <= 0) return props.account.label
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return fitText(props.account.label, width() - value - 1)
|
|
390
|
+
return fitText(
|
|
391
|
+
props.account.label,
|
|
392
|
+
width() - (showQuota() ? displayWidth(text()) + 3 : 2),
|
|
393
|
+
)
|
|
317
394
|
}
|
|
318
395
|
const muted = () => props.account.collapsed?.muted ?? false
|
|
319
396
|
const quotaTone = () =>
|
|
@@ -327,60 +404,121 @@ function CollapsedAccountRow(props: { account: AccountView }) {
|
|
|
327
404
|
width='100%'
|
|
328
405
|
flexDirection='row'
|
|
329
406
|
justifyContent='space-between'
|
|
407
|
+
columnGap={label() ? 1 : 0}
|
|
330
408
|
>
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
{props.account.emptyQuotaText?.collapsed ?? '\u2014'}
|
|
343
|
-
</text>
|
|
344
|
-
}
|
|
345
|
-
>
|
|
346
|
-
<box flexDirection='row' flexShrink={0}>
|
|
409
|
+
<Show when={label()}>
|
|
410
|
+
<text
|
|
411
|
+
fg={context.theme[muted() ? 'textMuted' : 'text']}
|
|
412
|
+
wrapMode='none'
|
|
413
|
+
flexShrink={1}
|
|
414
|
+
>
|
|
415
|
+
{label()}
|
|
416
|
+
</text>
|
|
417
|
+
</Show>
|
|
418
|
+
<box flexDirection='row' flexShrink={0}>
|
|
419
|
+
<Show when={showQuota()}>
|
|
347
420
|
<Show
|
|
348
|
-
when={!muted()}
|
|
421
|
+
when={hasQuota() && !muted()}
|
|
349
422
|
fallback={<text fg={context.theme.textMuted}>{text()}</text>}
|
|
350
423
|
>
|
|
351
424
|
<text fg={context.theme[quotaTone()]}>
|
|
352
425
|
<b>{text()}</b>
|
|
353
426
|
</text>
|
|
354
427
|
</Show>
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
428
|
+
</Show>
|
|
429
|
+
<text fg={context.theme[props.account.indicatorTone]}>
|
|
430
|
+
{showQuota() ? ' ' : ''}
|
|
431
|
+
{props.account.blocked ? '\u2298' : '\u25cf'}
|
|
432
|
+
</text>
|
|
433
|
+
</box>
|
|
360
434
|
</box>
|
|
361
435
|
)
|
|
362
436
|
}
|
|
363
437
|
|
|
364
|
-
function AccountBlock(props: {
|
|
365
|
-
account: AccountView
|
|
366
|
-
labelWidth: number
|
|
367
|
-
marginTop: number
|
|
368
|
-
}) {
|
|
438
|
+
function AccountBlock(props: { account: AccountView; marginTop: number }) {
|
|
369
439
|
const context = frameContext()
|
|
440
|
+
const [columns, setColumns] = createSignal(0)
|
|
441
|
+
let block: { width: number } | undefined
|
|
442
|
+
const rows = () => props.account.groups.flatMap((group) => group.rows)
|
|
443
|
+
const labelWidth = () =>
|
|
444
|
+
Math.max(
|
|
445
|
+
0,
|
|
446
|
+
...rows().map(({ part }) =>
|
|
447
|
+
part.name ? Math.max(3, displayWidth(part.name) + 1) : 0,
|
|
448
|
+
),
|
|
449
|
+
)
|
|
450
|
+
const resetWidth = () =>
|
|
451
|
+
Math.max(
|
|
452
|
+
0,
|
|
453
|
+
...rows().map(({ part }) =>
|
|
454
|
+
part.reading === 'unknown' || part.resetSinceReading
|
|
455
|
+
? 0
|
|
456
|
+
: displayWidth(part.resetIn ?? ''),
|
|
457
|
+
),
|
|
458
|
+
)
|
|
459
|
+
const figureWidth = createMemo(() =>
|
|
460
|
+
Math.max(
|
|
461
|
+
10,
|
|
462
|
+
...rows()
|
|
463
|
+
.filter(
|
|
464
|
+
({ part }) => part.reading === 'known' && !part.resetSinceReading,
|
|
465
|
+
)
|
|
466
|
+
.map(({ part }) =>
|
|
467
|
+
displayWidth(
|
|
468
|
+
` ${part.kind === 'budget' && part.figure.startsWith(`${part.name} `) ? part.figure.slice(part.name.length + 1) : part.figure}`,
|
|
469
|
+
),
|
|
470
|
+
),
|
|
471
|
+
),
|
|
472
|
+
)
|
|
473
|
+
const fit = (rowLabelWidth: number) => {
|
|
474
|
+
const desired = context.appearance.barWidth
|
|
475
|
+
// Four cells still distinguish quarters of a window without sacrificing its reset.
|
|
476
|
+
const minimum = Math.min(4, desired)
|
|
477
|
+
if (columns() <= 0)
|
|
478
|
+
return { barCells: desired, showReset: resetWidth() > 0 }
|
|
479
|
+
const room = columns() - rowLabelWidth - figureWidth()
|
|
480
|
+
const withReset = room - resetWidth() - 1
|
|
481
|
+
const showReset = resetWidth() > 0 && withReset >= minimum
|
|
482
|
+
const available = showReset ? withReset : room
|
|
483
|
+
return {
|
|
484
|
+
barCells: available >= minimum ? Math.min(desired, available) : 0,
|
|
485
|
+
showReset,
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
const label = () => {
|
|
489
|
+
const full = `${props.account.label}${props.account.titleSuffix ? ` · ${props.account.titleSuffix}` : ''}`
|
|
490
|
+
return columns() <= 0
|
|
491
|
+
? full
|
|
492
|
+
: fitText(full, columns() - displayWidth(props.account.status.text) - 1)
|
|
493
|
+
}
|
|
370
494
|
const age = () =>
|
|
371
495
|
quotaWindowParts(props.account.quota, { now: context.now }).age
|
|
372
496
|
const hasRows = () =>
|
|
373
497
|
props.account.groups.some((group) => group.rows.length > 0)
|
|
374
498
|
return (
|
|
375
|
-
<box
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
499
|
+
<box
|
|
500
|
+
ref={(element: { width: number }) => {
|
|
501
|
+
block = element
|
|
502
|
+
}}
|
|
503
|
+
onSizeChange={() => setColumns(block?.width ?? 0)}
|
|
504
|
+
width='100%'
|
|
505
|
+
flexDirection='column'
|
|
506
|
+
marginTop={props.marginTop}
|
|
507
|
+
>
|
|
508
|
+
<box
|
|
509
|
+
width='100%'
|
|
510
|
+
flexDirection='row'
|
|
511
|
+
justifyContent='space-between'
|
|
512
|
+
columnGap={1}
|
|
513
|
+
>
|
|
514
|
+
<text fg={context.theme.text} wrapMode='none' flexShrink={1}>
|
|
515
|
+
<b>{label()}</b>
|
|
382
516
|
</text>
|
|
383
|
-
<text
|
|
517
|
+
<text
|
|
518
|
+
fg={context.theme[props.account.status.tone]}
|
|
519
|
+
wrapMode='none'
|
|
520
|
+
flexShrink={0}
|
|
521
|
+
>
|
|
384
522
|
<b>{props.account.status.text}</b>
|
|
385
523
|
</text>
|
|
386
524
|
</box>
|
|
@@ -390,6 +528,7 @@ function AccountBlock(props: {
|
|
|
390
528
|
fallback={
|
|
391
529
|
<SidebarTextRow
|
|
392
530
|
text={props.account.emptyQuotaText?.expanded ?? '\u2014'}
|
|
531
|
+
wrapMode='none'
|
|
393
532
|
/>
|
|
394
533
|
}
|
|
395
534
|
>
|
|
@@ -397,23 +536,36 @@ function AccountBlock(props: {
|
|
|
397
536
|
{(group) => (
|
|
398
537
|
<>
|
|
399
538
|
<Show when={group.title}>
|
|
400
|
-
<SidebarTextRow
|
|
539
|
+
<SidebarTextRow
|
|
540
|
+
text={group.title ?? ''}
|
|
541
|
+
tone='text'
|
|
542
|
+
wrapMode='none'
|
|
543
|
+
/>
|
|
401
544
|
</Show>
|
|
402
545
|
<For each={group.rows}>
|
|
403
|
-
{(row) =>
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
546
|
+
{(row) => {
|
|
547
|
+
const rowLabelWidth = () => (row.part.name ? labelWidth() : 0)
|
|
548
|
+
const rowFit = createMemo(() => fit(rowLabelWidth()))
|
|
549
|
+
return (
|
|
550
|
+
<QuotaRow
|
|
551
|
+
part={row.part}
|
|
552
|
+
pace={row.pace}
|
|
553
|
+
labelWidth={rowLabelWidth()}
|
|
554
|
+
barCells={rowFit().barCells}
|
|
555
|
+
resetWidth={resetWidth()}
|
|
556
|
+
showReset={rowFit().showReset}
|
|
557
|
+
/>
|
|
558
|
+
)
|
|
559
|
+
}}
|
|
410
560
|
</For>
|
|
411
561
|
</>
|
|
412
562
|
)}
|
|
413
563
|
</For>
|
|
414
564
|
</Show>
|
|
415
565
|
<Show when={age()}>
|
|
416
|
-
{(text: () => string) =>
|
|
566
|
+
{(text: () => string) => (
|
|
567
|
+
<SidebarTextRow text={text()} wrapMode='none' />
|
|
568
|
+
)}
|
|
417
569
|
</Show>
|
|
418
570
|
{context.afterQuota?.(props.account)}
|
|
419
571
|
</box>
|
|
@@ -427,25 +579,26 @@ export function SidebarFrame(props: SidebarFrameProps) {
|
|
|
427
579
|
!hasData()
|
|
428
580
|
? props.header.badge
|
|
429
581
|
: `${props.collapsed ? '\u25b6' : '\u25bc'} ${props.header.badge}`
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
582
|
+
// Missing semantic colors inherit normal text; an unset palette uses terminal defaults.
|
|
583
|
+
const context = mergeProps(props, {
|
|
584
|
+
get theme(): SidebarTheme {
|
|
585
|
+
const theme = props.theme
|
|
586
|
+
return {
|
|
587
|
+
...theme,
|
|
588
|
+
textMuted: theme?.textMuted ?? theme?.text,
|
|
589
|
+
accent: theme?.accent ?? theme?.text,
|
|
590
|
+
success: theme?.success ?? theme?.text,
|
|
591
|
+
warning: theme?.warning ?? theme?.text,
|
|
592
|
+
error: theme?.error ?? theme?.text,
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
})
|
|
596
|
+
// Inverting an incomplete badge palette can put light text on a light background.
|
|
597
|
+
const invertBadge = () =>
|
|
598
|
+
props.theme?.accent !== undefined && props.theme?.background !== undefined
|
|
439
599
|
return (
|
|
440
|
-
<FrameContext.Provider value={
|
|
441
|
-
<box
|
|
442
|
-
width='100%'
|
|
443
|
-
flexDirection='column'
|
|
444
|
-
paddingTop={1}
|
|
445
|
-
paddingBottom={1}
|
|
446
|
-
paddingLeft={1}
|
|
447
|
-
paddingRight={1}
|
|
448
|
-
>
|
|
600
|
+
<FrameContext.Provider value={context}>
|
|
601
|
+
<box width='100%' flexDirection='column'>
|
|
449
602
|
{/* Blocked accounts retain their own indicators; the header always keeps its version. */}
|
|
450
603
|
{/* biome-ignore lint/a11y/noStaticElementInteractions: OpenTUI terminal widgets do not have DOM roles */}
|
|
451
604
|
<box
|
|
@@ -460,20 +613,25 @@ export function SidebarFrame(props: SidebarFrameProps) {
|
|
|
460
613
|
<box
|
|
461
614
|
paddingLeft={1}
|
|
462
615
|
paddingRight={1}
|
|
463
|
-
backgroundColor={props.theme
|
|
616
|
+
backgroundColor={invertBadge() ? props.theme?.accent : undefined}
|
|
464
617
|
>
|
|
465
|
-
<text
|
|
618
|
+
<text
|
|
619
|
+
fg={
|
|
620
|
+
invertBadge() ? props.theme?.background : context.theme.accent
|
|
621
|
+
}
|
|
622
|
+
>
|
|
466
623
|
<b>{headerLabel()}</b>
|
|
467
624
|
</text>
|
|
468
625
|
</box>
|
|
469
626
|
<Show when={props.header.version}>
|
|
470
|
-
<text fg={
|
|
627
|
+
<text fg={context.theme.textMuted}>{props.header.version}</text>
|
|
471
628
|
</Show>
|
|
472
629
|
</box>
|
|
473
630
|
<Show when={props.collapsed && hasData()}>
|
|
474
631
|
<For each={props.accounts}>
|
|
475
632
|
{(account) => <CollapsedAccountRow account={account} />}
|
|
476
633
|
</For>
|
|
634
|
+
{props.collapsedSections?.()}
|
|
477
635
|
</Show>
|
|
478
636
|
<Show when={!props.collapsed || !hasData()}>
|
|
479
637
|
<Show when={props.showQuota && hasData()}>
|
|
@@ -482,7 +640,6 @@ export function SidebarFrame(props: SidebarFrameProps) {
|
|
|
482
640
|
{(account, index) => (
|
|
483
641
|
<AccountBlock
|
|
484
642
|
account={account}
|
|
485
|
-
labelWidth={labelWidth()}
|
|
486
643
|
marginTop={index() === 0 ? 0 : 1}
|
|
487
644
|
/>
|
|
488
645
|
)}
|