@cmodjs/core 8.8.4 → 8.9.0
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/docs/commands.md +27 -7
- package/docs/ui.md +2 -2
- package/package.json +1 -1
- package/records.d.ts +8 -1
- package/records.d.ts.map +1 -1
- package/records.js +7 -3
- package/register.d.ts.map +1 -1
- package/register.js +1 -0
- package/runtime/claude.d.ts +2 -0
- package/runtime/claude.d.ts.map +1 -1
- package/runtime/conversations.d.ts.map +1 -1
- package/runtime/conversations.js +40 -4
- package/runtime/interfaces.d.ts +1 -1
- package/runtime/interfaces.d.ts.map +1 -1
- package/runtime/interfaces.js +1 -1
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +9 -2
- package/runtime/sessions.d.ts +1 -1
- package/runtime/sessions.d.ts.map +1 -1
- package/runtime/sessions.js +1 -1
- package/runtime/web.js +9 -4
- package/src/records.ts +12 -4
- package/src/register.ts +1 -0
- package/src/runtime/claude.ts +2 -0
- package/src/runtime/conversations.ts +37 -4
- package/src/runtime/interfaces.ts +1 -1
- package/src/runtime/lifecycle.ts +10 -2
- package/src/runtime/sessions.ts +1 -1
- package/src/runtime/web.ts +9 -4
- package/src/testing/fake-claude.ts +1 -0
- package/src/ui/components.ts +50 -15
- package/src/ui/elements.ts +16 -4
- package/testing/fake-claude.d.ts.map +1 -1
- package/testing/fake-claude.js +1 -0
- package/ui/components.d.ts +6 -1
- package/ui/components.d.ts.map +1 -1
- package/ui/components.js +43 -12
- package/ui/elements.d.ts +5 -1
- package/ui/elements.d.ts.map +1 -1
- package/ui/elements.js +10 -3
package/runtime/web.js
CHANGED
|
@@ -158,11 +158,16 @@ const elements = {
|
|
|
158
158
|
const label = typeof props['label'] === 'string' ? props['label'] : undefined;
|
|
159
159
|
const value = numberOr(props['value'], 0);
|
|
160
160
|
const shared = `${attribute('aria-label', label)}${attribute('style', `width:${across(numberOr(props['width'], 24))}`)}`;
|
|
161
|
-
|
|
161
|
+
const buffer = Math.min(numberOr(props['buffer'], value), 100) - value;
|
|
162
|
+
if (!Array.isArray(props['sections']) && buffer <= 0)
|
|
162
163
|
return `<progress class="progress" max="100" value="${value}"${shared}></progress>`;
|
|
163
|
-
const sections = props['sections'].filter((each) => typeof each === 'object' && each !== null);
|
|
164
|
-
const section = (each) =>
|
|
165
|
-
|
|
164
|
+
const sections = Array.isArray(props['sections']) ? props['sections'].filter((each) => typeof each === 'object' && each !== null) : [{ value }];
|
|
165
|
+
const section = (each) => {
|
|
166
|
+
const color = colorOf(each['color']);
|
|
167
|
+
return `<span class="progress-section${each['tone'] === undefined ? '' : ` tone-${toneOf(each['tone'])}`}" style="width:${numberOr(each['value'], 0)}%${color === undefined ? '' : `;background:${color}`}"></span>`;
|
|
168
|
+
};
|
|
169
|
+
const buffered = buffer > 0 ? `<span class="progress-buffer" style="width:${buffer}%"></span>` : '';
|
|
170
|
+
return `<div class="progress-bar" role="meter" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${value}"${shared}>${sections.map(section).join('')}${buffered}</div>`;
|
|
166
171
|
},
|
|
167
172
|
List: (props, drawing) => `<ul class="list"${attribute('aria-label', textOr(props['label'], ''))}>${nodeHtml(props['children'], drawing)}</ul>`,
|
|
168
173
|
ListItem: (props, drawing) => {
|
package/src/records.ts
CHANGED
|
@@ -381,14 +381,14 @@ export function preferencesPath(store: string): string {
|
|
|
381
381
|
return `${store}/preferences.json`
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
export type Preferences = { readonly showsInstalledModErrors: boolean; readonly servesWebUi: boolean; readonly servesTailnet: boolean }
|
|
384
|
+
export type Preferences = { readonly showsInstalledModErrors: boolean; readonly servesWebUi: boolean; readonly servesTailnet: boolean; readonly roundsBarEnds: boolean }
|
|
385
385
|
|
|
386
|
-
const preferenceKeys = ['showsInstalledModErrors', 'servesWebUi', 'servesTailnet'] as const satisfies readonly (keyof Preferences)[]
|
|
386
|
+
const preferenceKeys = ['showsInstalledModErrors', 'servesWebUi', 'servesTailnet', 'roundsBarEnds'] as const satisfies readonly (keyof Preferences)[]
|
|
387
387
|
|
|
388
388
|
export function parsePreferences(value: unknown, path: string): Preferences {
|
|
389
389
|
if (value !== undefined && (!isObject(value) || preferenceKeys.some((key) => value[key] !== undefined && typeof value[key] !== 'boolean'))) throw new Error(`${path} is not a map of cmod's preferences to true or false. Delete it, and cmod uses its defaults.`)
|
|
390
390
|
const saved = isObject(value) ? value : {}
|
|
391
|
-
return { showsInstalledModErrors: saved['showsInstalledModErrors'] === true, servesWebUi: saved['servesWebUi'] === true, servesTailnet: saved['servesTailnet'] !== false }
|
|
391
|
+
return { showsInstalledModErrors: saved['showsInstalledModErrors'] === true, servesWebUi: saved['servesWebUi'] === true, servesTailnet: saved['servesTailnet'] !== false, roundsBarEnds: saved['roundsBarEnds'] === true }
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
export function tailnetFolder(store: string, mod: string): string {
|
|
@@ -422,6 +422,14 @@ export function parseWebUi(value: unknown, path: string): WebUi | undefined {
|
|
|
422
422
|
|
|
423
423
|
export type BrowserEnv = { readonly os: string; readonly browser?: string | undefined; readonly sshConnection?: string | undefined; readonly display?: string | undefined; readonly waylandDisplay?: string | undefined }
|
|
424
424
|
|
|
425
|
+
export type TerminalVariables = { readonly program?: string | undefined; readonly ghostty?: string | undefined; readonly wezterm?: string | undefined }
|
|
426
|
+
|
|
427
|
+
const nerdFontTerminals: readonly string[] = ['herdr', 'ghostty', 'WezTerm']
|
|
428
|
+
|
|
429
|
+
export function isNerdFontTerminal({ program, ghostty, wezterm }: TerminalVariables): boolean {
|
|
430
|
+
return nerdFontTerminals.includes(program ?? '') || (ghostty ?? '') !== '' || (wezterm ?? '') !== ''
|
|
431
|
+
}
|
|
432
|
+
|
|
425
433
|
export function browserCommand(env: BrowserEnv, href: string): readonly string[] | undefined {
|
|
426
434
|
if (env.browser === 'true') return undefined
|
|
427
435
|
if (env.browser) return [env.browser, href]
|
|
@@ -499,7 +507,7 @@ function readHotkeys(hotkeys: unknown): Steps {
|
|
|
499
507
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
|
|
500
508
|
}
|
|
501
509
|
|
|
502
|
-
export const coreVersion = '8.
|
|
510
|
+
export const coreVersion = '8.9.0'
|
|
503
511
|
|
|
504
512
|
export const oldestCmodVersion = '8.0.0'
|
|
505
513
|
|
package/src/register.ts
CHANGED
|
@@ -114,6 +114,7 @@ async function startMod($: EngineInterface, eventInput: Frozen<Args<'session.sta
|
|
|
114
114
|
sshConnection: () => $.env.get('SSH_CONNECTION'),
|
|
115
115
|
display: () => $.env.get('DISPLAY'),
|
|
116
116
|
waylandDisplay: () => $.env.get('WAYLAND_DISPLAY'),
|
|
117
|
+
terminal: async () => ({ program: await $.env.get('TERM_PROGRAM'), ghostty: await $.env.get('GHOSTTY_RESOURCES_DIR'), wezterm: await $.env.get('WEZTERM_EXECUTABLE') }),
|
|
117
118
|
},
|
|
118
119
|
device: { read: () => readDevice(claude) },
|
|
119
120
|
cmod: { call: (input) => $.cmod.call(input) },
|
package/src/runtime/claude.ts
CHANGED
|
@@ -45,6 +45,7 @@ import type {
|
|
|
45
45
|
UiScrollResult,
|
|
46
46
|
} from 'claude-code'
|
|
47
47
|
import type { Device } from '../session/context/turn/device.js'
|
|
48
|
+
import type { TerminalVariables } from '../records.js'
|
|
48
49
|
|
|
49
50
|
export const heldInput = 'the session was stopped and nobody has sent input since'
|
|
50
51
|
|
|
@@ -121,6 +122,7 @@ export type Claude = {
|
|
|
121
122
|
sshConnection(): Promise<string | undefined>
|
|
122
123
|
display(): Promise<string | undefined>
|
|
123
124
|
waylandDisplay(): Promise<string | undefined>
|
|
125
|
+
terminal(): Promise<TerminalVariables>
|
|
124
126
|
}
|
|
125
127
|
readonly device: { read(): Promise<Device> }
|
|
126
128
|
readonly cmod: { call(input: Args<'cmod.call'>): Promise<unknown> }
|
|
@@ -46,6 +46,8 @@ const questionTool = 'AskUserQuestion'
|
|
|
46
46
|
|
|
47
47
|
const permissionPrompt = 'permission prompt'
|
|
48
48
|
|
|
49
|
+
const carryOn = 'The conversation was compacted. Carry on with the work from before the compaction.'
|
|
50
|
+
|
|
49
51
|
export type Conversations = {
|
|
50
52
|
answer(e: Frozen<Args<'cmod.call'>> & { readonly caller?: string }): Promise<EventResult<'cmod.call'> | undefined>
|
|
51
53
|
moved(): void
|
|
@@ -114,6 +116,7 @@ export function serveConversations({
|
|
|
114
116
|
const waitingRows = new Map<string, Row[]>()
|
|
115
117
|
const engineTurns = new Map<string, string>()
|
|
116
118
|
let endsAfterTurn = false
|
|
119
|
+
let compactsAfterTurn: { readonly keep?: string } | undefined
|
|
117
120
|
let isWorking = false
|
|
118
121
|
let waitingFor: HeldStatus['waitingFor']
|
|
119
122
|
let waitingOn: string | undefined
|
|
@@ -184,8 +187,20 @@ export function serveConversations({
|
|
|
184
187
|
engineTurns.delete(task ?? '')
|
|
185
188
|
if (!isInterrupted) dispatch(conversation.endTurn(new Date().toISOString(), ending, task))
|
|
186
189
|
if (task === undefined && endsAfterTurn) claude.clock.after(0, () => void exitNow())
|
|
190
|
+
if (task === undefined && compactsAfterTurn !== undefined && !isInterrupted) claude.clock.after(1, () => void compactNow())
|
|
187
191
|
return below
|
|
188
192
|
}
|
|
193
|
+
const compactNow = async () => {
|
|
194
|
+
const asked = compactsAfterTurn
|
|
195
|
+
compactsAfterTurn = undefined
|
|
196
|
+
if (asked === undefined) return
|
|
197
|
+
try {
|
|
198
|
+
await claude.command.run({ command: 'compact', ...(asked.keep === undefined ? {} : { args: asked.keep }) })
|
|
199
|
+
await claude.prompt.submit({ text: carryOn })
|
|
200
|
+
} catch (error) {
|
|
201
|
+
report('compact', 'Could not compact the conversation', error)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
189
204
|
router.add('classic.Stop', async (e, next) => endTurn({ reason: 'answer', ...(e.last_assistant_message === undefined ? {} : { answer: e.last_assistant_message }) })(await next(e), next.signal.aborted))
|
|
190
205
|
router.add('classic.StopFailure', async (e, next) => {
|
|
191
206
|
const text = e.error_details ?? e.last_assistant_message ?? String(e.error)
|
|
@@ -213,7 +228,10 @@ export function serveConversations({
|
|
|
213
228
|
|
|
214
229
|
const liveTasksOver = async (saved: readonly TaskData[], request: Readonly<Record<string, unknown>>): Promise<TaskData[]> => {
|
|
215
230
|
await starting
|
|
216
|
-
const
|
|
231
|
+
const closed = new Map(saved.flatMap((task) => (task.closedAt === undefined ? [] : [[task.id, task] as const])))
|
|
232
|
+
const kept = liveTasks()
|
|
233
|
+
.filter((task) => request['all'] === true || task.parent === request['task'])
|
|
234
|
+
.map((task) => (task.closedAt === undefined ? (closed.get(task.id) ?? task) : task))
|
|
217
235
|
const running = await claude.agent.list().catch((error: unknown) => (claude.ui.warn('tasks:status', `cmod: the tasks show no status, because Claude Code listed no agents: ${messageOf(error)}`), []))
|
|
218
236
|
const background = saved.flatMap(({ id, status, isBackground }) => (status === undefined || isBackground !== true ? [] : [{ id, status }]))
|
|
219
237
|
return tasksWithAgents(merged(saved, kept, (task) => task.id), [...running, ...background])
|
|
@@ -330,7 +348,10 @@ export function serveConversations({
|
|
|
330
348
|
throw last instanceof Error ? last : new Error(String(last))
|
|
331
349
|
}
|
|
332
350
|
|
|
333
|
-
const read = <Value>(id: string, part: string, options: Request = {}): Promise<Value> =>
|
|
351
|
+
const read = <Value>(id: string, part: string, options: Request = {}): Promise<Value> =>
|
|
352
|
+
firstHolding((client) => client.request<Value>(`${sessionsInterface}.read`, [id, part, { project: project(), ...options }])).catch((error: unknown) => {
|
|
353
|
+
throw isNotHeld(error) ? new Error(`no session ${id} on any of your devices.`) : error
|
|
354
|
+
})
|
|
334
355
|
|
|
335
356
|
const listAll = async (scope: Request): Promise<SessionData[]> => {
|
|
336
357
|
const lists = await Promise.all((await providers()).map((client) => client.request<SessionData[]>(`${sessionsInterface}.sessions`, [scope]).catch((error: unknown) => (client === local.client ? Promise.reject(error) : (report('store', 'Lists no sessions of another sessions provider', error), [])))))
|
|
@@ -730,6 +751,17 @@ export function serveConversations({
|
|
|
730
751
|
else claude.clock.after(0, () => void exitNow())
|
|
731
752
|
return null
|
|
732
753
|
}
|
|
754
|
+
if (action === 'compact') {
|
|
755
|
+
const { keep } = (isObject(input) ? input : {}) as { readonly keep?: string }
|
|
756
|
+
compactsAfterTurn = typeof keep === 'string' && keep.trim() !== '' ? { keep } : {}
|
|
757
|
+
if (!engineTurns.has('')) claude.clock.after(0, () => void compactNow())
|
|
758
|
+
return null
|
|
759
|
+
}
|
|
760
|
+
if (action === 'sendTo') {
|
|
761
|
+
const { to, type, text } = input as Pick<SessionSend, 'type' | 'text'> & { readonly to: string }
|
|
762
|
+
if (to === session) throw new Error(`session ${session} cannot send as itself to itself.`)
|
|
763
|
+
return actElsewhere(caller, to, 'send', { type, text, as: Session } satisfies SessionSend, undefined)
|
|
764
|
+
}
|
|
733
765
|
if (action === 'send') {
|
|
734
766
|
const { type, text, as } = input as SessionSend
|
|
735
767
|
if (as === Session) throw new Error(`session ${session} cannot send as itself to itself.`)
|
|
@@ -902,9 +934,10 @@ export function serveConversations({
|
|
|
902
934
|
},
|
|
903
935
|
async [conversationMethods.search](request) {
|
|
904
936
|
const record = fields(request, ['session', 'task', 'turn', 'context', 'isAgent'])
|
|
905
|
-
const options = { project: project(), ...fields(request, ['since', 'everyProject', 'running', 'before']), record }
|
|
937
|
+
const options = { project: project(), ...fields(request, ['since', 'everyProject', 'running', 'before', 'limit']), record }
|
|
906
938
|
const pages = await Promise.all((await providers()).map((client) => client.request<Message[]>(`${sessionsInterface}.search`, [String(request['text']), options]).catch((error: unknown) => (client === local.client ? Promise.reject(error) : []))))
|
|
907
|
-
|
|
939
|
+
const found = pages.flat().sort((first, second) => second.at.localeCompare(first.at))
|
|
940
|
+
return typeof request['limit'] === 'number' ? found.slice(0, request['limit']) : found
|
|
908
941
|
},
|
|
909
942
|
async [conversationMethods.messages](request) {
|
|
910
943
|
const id = String(request['session'])
|
|
@@ -335,7 +335,7 @@ export type SessionRouting = {
|
|
|
335
335
|
close(): void
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
export const sessionActions = ['send', 'abort', 'end', 'fork', 'startTask', 'callTool', 'usage', 'surfaces', 'visit', 'delete'] as const
|
|
338
|
+
export const sessionActions = ['send', 'abort', 'end', 'fork', 'startTask', 'callTool', 'usage', 'surfaces', 'visit', 'delete', 'compact', 'startBackgroundTask', 'sendTo'] as const
|
|
339
339
|
|
|
340
340
|
export const showLeaseMs = 16_000
|
|
341
341
|
|
package/src/runtime/lifecycle.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Step } from '../installer.js'
|
|
|
3
3
|
|
|
4
4
|
import type { Imports, Mod, ModDefinition, Reservation, SettingsFile, SettingsFileChange, Subscription, Timer as ModTimer } from '../mod.js'
|
|
5
5
|
import type { Options, OptionValues } from '../options.js'
|
|
6
|
-
import { cacheFolder, dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programModifiedMs, readRecord, readSteps, recordPath, scriptsSha256, serviceFolder, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
|
|
6
|
+
import { cacheFolder, dataFolder, finishStepsMethod, isAtLeast, isNerdFontTerminal, parsePreferences, preferencesPath, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programModifiedMs, readRecord, readSteps, recordPath, scriptsSha256, serviceFolder, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
|
|
7
7
|
import { homePrefix, ifMissing, relativePath } from '../utils/paths.js'
|
|
8
8
|
import { firstLine, formatExit, messageOf } from '../utils/text.js'
|
|
9
9
|
import type { Claude } from './claude.js'
|
|
@@ -141,6 +141,12 @@ const settingsLoadMs = 500
|
|
|
141
141
|
|
|
142
142
|
const shellTools: readonly string[] = ['Bash', 'PowerShell']
|
|
143
143
|
|
|
144
|
+
async function roundsBarEnds(claude: Claude): Promise<boolean> {
|
|
145
|
+
const path = preferencesPath(await cmodStore(claude))
|
|
146
|
+
const text = await claude.fs.read(path).catch(ifMissing(undefined))
|
|
147
|
+
return parsePreferences(text === undefined ? undefined : (JSON.parse(text) as unknown), path).roundsBarEnds
|
|
148
|
+
}
|
|
149
|
+
|
|
144
150
|
export async function readPlugin(claude: Claude): Promise<Plugin> {
|
|
145
151
|
const { name, root } = claude.plugin
|
|
146
152
|
const read: ReadFile = async (path) => {
|
|
@@ -732,12 +738,13 @@ export function createLifecycle<State extends object, Declared extends Options =
|
|
|
732
738
|
(done) => done === 'copied' && runtime?.toaster.toast.success('Copied the link', { description: 'Paste it in your browser.' }),
|
|
733
739
|
(error: unknown) => toastFailure({ id: 'open-link', message: 'Could not open the link', error, isCritical: true }),
|
|
734
740
|
)
|
|
741
|
+
let hasNerdFont = false
|
|
735
742
|
const naming: Claude = {
|
|
736
743
|
...claudeCalls,
|
|
737
744
|
ui: {
|
|
738
745
|
...claudeCalls.ui,
|
|
739
746
|
warn: (id, text) => (runtime === undefined ? claudeCalls.ui.warn(id, text) : runtime.toaster.warn(id, text)),
|
|
740
|
-
resolve: (e) => forClaudeCode(claudeCalls.ui.resolve(e), e.surface, open),
|
|
747
|
+
resolve: (e) => forClaudeCode(claudeCalls.ui.resolve(e), e.surface, open, { hasNerdFont }),
|
|
741
748
|
},
|
|
742
749
|
session: { ...claudeCalls.session, id: async () => startingSession ?? claudeCalls.session.id() },
|
|
743
750
|
}
|
|
@@ -755,6 +762,7 @@ export function createLifecycle<State extends object, Declared extends Options =
|
|
|
755
762
|
readStarted = read
|
|
756
763
|
try {
|
|
757
764
|
drawCount = (await claudeCalls.clock.now()) * drawsPerMs
|
|
765
|
+
hasNerdFont = (await roundsBarEnds(claudeCalls).catch((error: unknown) => (claudeCalls.ui.warn('preferences:read', `${definition.name} rounds its bars only in a terminal it knows: ${messageOf(error)}`), false))) || isNerdFontTerminal(await claudeCalls.env.terminal())
|
|
758
766
|
await programs.refresh()
|
|
759
767
|
await begin().catch(report)
|
|
760
768
|
} finally {
|
package/src/runtime/sessions.ts
CHANGED
|
@@ -57,7 +57,7 @@ export function pickedColor(args: string): string | undefined {
|
|
|
57
57
|
return resetColors.includes(picked) ? undefined : picked
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const acts = ['send', 'startTask', 'fork', 'clone', 'startBackgroundTask', 'callTool', 'usage', 'surfaces', 'abort', 'end', 'visit', 'delete'] as const
|
|
60
|
+
const acts = ['send', 'startTask', 'fork', 'clone', 'startBackgroundTask', 'callTool', 'usage', 'surfaces', 'abort', 'end', 'visit', 'delete', 'compact', 'sendTo'] as const
|
|
61
61
|
|
|
62
62
|
export type Act = (typeof acts)[number]
|
|
63
63
|
|
package/src/runtime/web.ts
CHANGED
|
@@ -176,10 +176,15 @@ const elements: Readonly<Record<string, (props: Props, drawing: Drawing) => stri
|
|
|
176
176
|
const label = typeof props['label'] === 'string' ? props['label'] : undefined
|
|
177
177
|
const value = numberOr(props['value'], 0)
|
|
178
178
|
const shared = `${attribute('aria-label', label)}${attribute('style', `width:${across(numberOr(props['width'], 24))}`)}`
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
179
|
+
const buffer = Math.min(numberOr(props['buffer'], value), 100) - value
|
|
180
|
+
if (!Array.isArray(props['sections']) && buffer <= 0) return `<progress class="progress" max="100" value="${value}"${shared}></progress>`
|
|
181
|
+
const sections = Array.isArray(props['sections']) ? props['sections'].filter((each): each is Props => typeof each === 'object' && each !== null) : [{ value }]
|
|
182
|
+
const section = (each: Props) => {
|
|
183
|
+
const color = colorOf(each['color'])
|
|
184
|
+
return `<span class="progress-section${each['tone'] === undefined ? '' : ` tone-${toneOf(each['tone'])}`}" style="width:${numberOr(each['value'], 0)}%${color === undefined ? '' : `;background:${color}`}"></span>`
|
|
185
|
+
}
|
|
186
|
+
const buffered = buffer > 0 ? `<span class="progress-buffer" style="width:${buffer}%"></span>` : ''
|
|
187
|
+
return `<div class="progress-bar" role="meter" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${value}"${shared}>${sections.map(section).join('')}${buffered}</div>`
|
|
183
188
|
},
|
|
184
189
|
List: (props, drawing) => `<ul class="list"${attribute('aria-label', textOr(props['label'], ''))}>${nodeHtml(props['children'], drawing)}</ul>`,
|
|
185
190
|
ListItem: (props, drawing) => {
|
|
@@ -267,6 +267,7 @@ export function fakeClaude(plugin: { readonly name: string; readonly root: strin
|
|
|
267
267
|
sshConnection: async () => undefined,
|
|
268
268
|
display: async () => undefined,
|
|
269
269
|
waylandDisplay: async () => undefined,
|
|
270
|
+
terminal: async () => ({}),
|
|
270
271
|
},
|
|
271
272
|
device: { read: rejected('device.read', () => fakes.device.read ?? (async () => testDevice)) },
|
|
272
273
|
cmod: { call: async (args) => cmodCall(clonedAsClaudeCodeDoes(args)) },
|
package/src/ui/components.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, Button, hostComponent, Text } from './elements.js'
|
|
1
|
+
import { Box, Button, drawnIn, hostComponent, Text, type Color } from './elements.js'
|
|
2
2
|
|
|
3
3
|
export type Tab = { readonly key: string; readonly label: string; readonly hotkey?: string }
|
|
4
4
|
|
|
@@ -117,39 +117,74 @@ export const Pagination = hostComponent(
|
|
|
117
117
|
}),
|
|
118
118
|
)
|
|
119
119
|
|
|
120
|
-
export type ProgressSection = { readonly value: number
|
|
120
|
+
export type ProgressSection = { readonly value: number } & ({ readonly tone?: Tone } | { readonly color: Color })
|
|
121
121
|
|
|
122
|
-
type ProgressProps = ({ readonly value: number; readonly tone?: Tone } | { readonly sections: readonly ProgressSection[] }) & { readonly width?: number; readonly label?: string }
|
|
122
|
+
type ProgressProps = ({ readonly value: number; readonly tone?: Tone } | { readonly sections: readonly ProgressSection[] }) & { readonly buffer?: number; readonly width?: number; readonly label?: string }
|
|
123
123
|
|
|
124
|
-
type ProgressData = { readonly value: number; readonly width: number; readonly label?: string; readonly sections?: readonly ProgressSection[] }
|
|
124
|
+
type ProgressData = { readonly value: number; readonly width: number; readonly label?: string; readonly sections?: readonly ProgressSection[]; readonly buffer?: number }
|
|
125
|
+
|
|
126
|
+
const eighths = ['', '▏', '▎', '▍', '▌', '▋', '▊', '▉']
|
|
127
|
+
|
|
128
|
+
const roundedLeft = '\u{E0B6}'
|
|
129
|
+
|
|
130
|
+
const roundedRight = '\u{E0B4}'
|
|
131
|
+
|
|
132
|
+
const barColors: Readonly<Record<Tone, string>> = { neutral: 'inactive', info: 'suggestion', success: 'success', warning: 'warning', critical: 'error' }
|
|
125
133
|
|
|
126
134
|
function filledSections(sections: readonly ProgressSection[]): ProgressSection[] {
|
|
127
135
|
let reached = 0
|
|
128
|
-
return sections.map((
|
|
129
|
-
const filled = Math.min(Math.max(value, 0), 100 - reached)
|
|
136
|
+
return sections.map((section) => {
|
|
137
|
+
const filled = Math.min(Math.max(section.value, 0), 100 - reached)
|
|
130
138
|
reached += filled
|
|
131
|
-
return { value: filled
|
|
139
|
+
return { ...section, value: filled }
|
|
132
140
|
})
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
export const Progress = hostComponent(
|
|
136
144
|
'Progress',
|
|
137
|
-
({ width = 24, label, ...given }: ProgressProps): ProgressData => {
|
|
145
|
+
({ width = 24, label, buffer, ...given }: ProgressProps): ProgressData => {
|
|
138
146
|
const sections = 'sections' in given ? filledSections(given.sections) : given.tone === undefined ? undefined : filledSections([given])
|
|
139
147
|
const value = sections === undefined && 'value' in given ? Math.min(Math.max(given.value, 0), 100) : (sections ?? []).reduce((sum, each) => sum + each.value, 0)
|
|
140
|
-
|
|
148
|
+
const buffered = buffer === undefined ? undefined : Math.min(Math.max(buffer, value), 100)
|
|
149
|
+
return { value, width, ...(label === undefined ? {} : { label }), ...(sections === undefined ? {} : { sections }), ...(buffered === undefined || buffered === value ? {} : { buffer: buffered }) }
|
|
141
150
|
},
|
|
142
|
-
({ value, width, sections }: ProgressData) => {
|
|
151
|
+
({ value, width, sections, buffer }: ProgressData) => {
|
|
152
|
+
const isRounded = drawnIn().hasNerdFont && width > 2
|
|
153
|
+
const cells = isRounded ? width - 2 : width
|
|
154
|
+
const units = cells * eighths.length
|
|
143
155
|
let reached = 0
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
reached
|
|
147
|
-
return Text({ ...(tone === undefined ? { color: 'claude' } : textOf(tone)), children: '█'.repeat(Math.round((reached / 100) * width) - from) })
|
|
156
|
+
const ends = (sections ?? [{ value }]).map((section) => {
|
|
157
|
+
reached += section.value
|
|
158
|
+
return { end: Math.round((reached / 100) * units), color: 'color' in section ? section.color : section.tone === undefined ? 'claude' : barColors[section.tone] }
|
|
148
159
|
})
|
|
149
|
-
|
|
160
|
+
const buffered = Math.round(((buffer ?? 0) / 100) * units)
|
|
161
|
+
const colorAt = (unit: number) => ends.find(({ end }) => unit < end)?.color ?? (unit < buffered ? 'promptBorder' : 'subtle')
|
|
162
|
+
const drawn: BarCell[] = []
|
|
163
|
+
for (let cell = 0; cell < cells; cell++) {
|
|
164
|
+
const from = cell * eighths.length
|
|
165
|
+
const left = colorAt(from)
|
|
166
|
+
const right = colorAt(from + eighths.length - 1)
|
|
167
|
+
let edge = 1
|
|
168
|
+
while (edge < eighths.length && colorAt(from + edge) === left) edge++
|
|
169
|
+
drawn.push(left === right ? { color: left, children: '█' } : { color: left, backgroundColor: right, children: eighths[edge] ?? '█' })
|
|
170
|
+
}
|
|
171
|
+
const capped = isRounded ? [{ color: colorAt(0), children: roundedLeft }, ...drawn, { color: colorAt(units - 1), children: roundedRight }] : drawn
|
|
172
|
+
return Text({ children: runsOf(capped).map((run) => Text(run)) })
|
|
150
173
|
},
|
|
151
174
|
)
|
|
152
175
|
|
|
176
|
+
type BarCell = { color: string; backgroundColor?: string; children: string }
|
|
177
|
+
|
|
178
|
+
function runsOf(cells: readonly BarCell[]): BarCell[] {
|
|
179
|
+
const runs: BarCell[] = []
|
|
180
|
+
for (const cell of cells) {
|
|
181
|
+
const last = runs.at(-1)
|
|
182
|
+
if (last !== undefined && last.color === cell.color && last.backgroundColor === cell.backgroundColor && last.children !== roundedLeft && cell.children !== roundedRight) last.children += cell.children
|
|
183
|
+
else runs.push({ ...cell })
|
|
184
|
+
}
|
|
185
|
+
return runs
|
|
186
|
+
}
|
|
187
|
+
|
|
153
188
|
export const List = hostComponent(
|
|
154
189
|
'List',
|
|
155
190
|
({ label, children }: { readonly label: string; readonly children?: JSX.Children }) => ({ label, ...(children === undefined ? {} : { children }) }),
|
package/src/ui/elements.ts
CHANGED
|
@@ -40,7 +40,17 @@ type Terminal = Elements['terminal'] & Elements['desktop']
|
|
|
40
40
|
|
|
41
41
|
type CompletedTable = Record<ElementName, (props: object) => RenderElement>
|
|
42
42
|
|
|
43
|
-
type
|
|
43
|
+
export type DrawnIn = { readonly hasNerdFont: boolean }
|
|
44
|
+
|
|
45
|
+
type Drawing = { readonly table: CompletedTable; readonly markdown: ((props: MarkdownProps) => RenderElement) | undefined; readonly drawnIn: DrawnIn }
|
|
46
|
+
|
|
47
|
+
const tableFacts = new WeakMap<ElementTable, DrawnIn>()
|
|
48
|
+
|
|
49
|
+
const plainTerminal: DrawnIn = { hasNerdFont: false }
|
|
50
|
+
|
|
51
|
+
export function drawnIn(): DrawnIn {
|
|
52
|
+
return drawing?.drawnIn ?? plainTerminal
|
|
53
|
+
}
|
|
44
54
|
|
|
45
55
|
const unbuilt = Symbol('an element built outside a render')
|
|
46
56
|
|
|
@@ -61,7 +71,7 @@ function elementNamed(name: string, props: object): RenderElement {
|
|
|
61
71
|
|
|
62
72
|
export function drawWith<Drawn>(table: ElementTable, draw: () => Drawn, markdown?: (props: MarkdownProps) => RenderElement): Drawn {
|
|
63
73
|
const outer = drawing
|
|
64
|
-
const current = { table: table as CompletedTable, markdown }
|
|
74
|
+
const current = { table: table as CompletedTable, markdown, drawnIn: tableFacts.get(table) ?? plainTerminal }
|
|
65
75
|
drawing = current
|
|
66
76
|
try {
|
|
67
77
|
return built(current, draw()) as Drawn
|
|
@@ -153,7 +163,7 @@ export function drawsFocusable(data: unknown, key: string): boolean {
|
|
|
153
163
|
return Object.values(fields).some((each) => drawsFocusable(each, key))
|
|
154
164
|
}
|
|
155
165
|
|
|
156
|
-
export function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void): ElementTable {
|
|
166
|
+
export function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void, { hasNerdFont }: DrawnIn = plainTerminal): ElementTable {
|
|
157
167
|
const { Button: button, Link: link, Image: image, Svg: svg, Raster: raster } = table as CompletedTable
|
|
158
168
|
const opening = (props: Readonly<Record<string, unknown>>) => {
|
|
159
169
|
const { href, ...rest } = props
|
|
@@ -167,7 +177,9 @@ export function forClaudeCode(table: ElementTable, surface: RenderSurface, open:
|
|
|
167
177
|
(draw: (props: object) => RenderElement) =>
|
|
168
178
|
({ label, ...rest }: Readonly<Record<string, unknown>>) =>
|
|
169
179
|
draw({ alt: label, ...rest })
|
|
170
|
-
|
|
180
|
+
const resolved = { ...table, Button: opening, Image: named(image), Svg: named(svg), Raster: ({ label, ...rest }: Readonly<Record<string, unknown>>) => raster(rest) }
|
|
181
|
+
tableFacts.set(resolved, { hasNerdFont: hasNerdFont && surface === 'terminal' })
|
|
182
|
+
return resolved
|
|
171
183
|
}
|
|
172
184
|
|
|
173
185
|
export const Box = element('Box')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-claude.d.ts","sourceRoot":"","sources":["../src/testing/fake-claude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAS,MAAM,aAAa,CAAA;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAK/D,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,MAAM,MAAM,QAAQ,GAAG;IACrB,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C3B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACvB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,OAAO,CAGtF;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAyN/F"}
|
package/testing/fake-claude.js
CHANGED
|
@@ -214,6 +214,7 @@ export function fakeClaude(plugin) {
|
|
|
214
214
|
sshConnection: async () => undefined,
|
|
215
215
|
display: async () => undefined,
|
|
216
216
|
waylandDisplay: async () => undefined,
|
|
217
|
+
terminal: async () => ({}),
|
|
217
218
|
},
|
|
218
219
|
device: { read: rejected('device.read', () => fakes.device.read ?? (async () => testDevice)) },
|
|
219
220
|
cmod: { call: async (args) => cmodCall(clonedAsClaudeCodeDoes(args)) },
|
package/ui/components.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Color } from './elements.js';
|
|
1
2
|
export type Tab = {
|
|
2
3
|
readonly key: string;
|
|
3
4
|
readonly label: string;
|
|
@@ -47,14 +48,18 @@ export declare const Pagination: (props: {
|
|
|
47
48
|
}) => JSX.Element;
|
|
48
49
|
export type ProgressSection = {
|
|
49
50
|
readonly value: number;
|
|
51
|
+
} & ({
|
|
50
52
|
readonly tone?: Tone;
|
|
51
|
-
}
|
|
53
|
+
} | {
|
|
54
|
+
readonly color: Color;
|
|
55
|
+
});
|
|
52
56
|
type ProgressProps = ({
|
|
53
57
|
readonly value: number;
|
|
54
58
|
readonly tone?: Tone;
|
|
55
59
|
} | {
|
|
56
60
|
readonly sections: readonly ProgressSection[];
|
|
57
61
|
}) & {
|
|
62
|
+
readonly buffer?: number;
|
|
58
63
|
readonly width?: number;
|
|
59
64
|
readonly label?: string;
|
|
60
65
|
};
|
package/ui/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/ui/components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/ui/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAErF,MAAM,MAAM,GAAG,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE5F,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;AAE1E,KAAK,OAAO,GAAG,MAAM,IAAI,CAAA;AASzB,eAAO,MAAM,IAAI;mBAE2C,SAAS,GAAG,EAAE;uBAAqB,MAAM;uBAAqB,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI;wBAAsB,GAAG,CAAC,QAAQ;iBAahL,CAAA;AAED,eAAO,MAAM,KAAK;uBAEoB,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iBAUjK,CAAA"}
|
package/ui/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, Button, hostComponent, Text } from './elements.js';
|
|
1
|
+
import { Box, Button, drawnIn, hostComponent, Text } from './elements.js';
|
|
2
2
|
const toneColors = { neutral: undefined, info: 'suggestion', success: 'success', warning: 'warning', critical: 'error' };
|
|
3
3
|
const textOf = (tone) => {
|
|
4
4
|
const color = toneColors[tone];
|
|
@@ -59,27 +59,58 @@ export const Pagination = hostComponent('Pagination', ({ page, pages, onPage })
|
|
|
59
59
|
onNext === undefined ? Text({ dimColor: true, children: 'n: Next' }) : Button({ plain: true, hotkey: 'n', label: 'Next', onPress: onNext }),
|
|
60
60
|
],
|
|
61
61
|
}));
|
|
62
|
+
const eighths = ['', '▏', '▎', '▍', '▌', '▋', '▊', '▉'];
|
|
63
|
+
const roundedLeft = '\u{E0B6}';
|
|
64
|
+
const roundedRight = '\u{E0B4}';
|
|
65
|
+
const barColors = { neutral: 'inactive', info: 'suggestion', success: 'success', warning: 'warning', critical: 'error' };
|
|
62
66
|
function filledSections(sections) {
|
|
63
67
|
let reached = 0;
|
|
64
|
-
return sections.map((
|
|
65
|
-
const filled = Math.min(Math.max(value, 0), 100 - reached);
|
|
68
|
+
return sections.map((section) => {
|
|
69
|
+
const filled = Math.min(Math.max(section.value, 0), 100 - reached);
|
|
66
70
|
reached += filled;
|
|
67
|
-
return { value: filled
|
|
71
|
+
return { ...section, value: filled };
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
|
-
export const Progress = hostComponent('Progress', ({ width = 24, label, ...given }) => {
|
|
74
|
+
export const Progress = hostComponent('Progress', ({ width = 24, label, buffer, ...given }) => {
|
|
71
75
|
const sections = 'sections' in given ? filledSections(given.sections) : given.tone === undefined ? undefined : filledSections([given]);
|
|
72
76
|
const value = sections === undefined && 'value' in given ? Math.min(Math.max(given.value, 0), 100) : (sections ?? []).reduce((sum, each) => sum + each.value, 0);
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
const buffered = buffer === undefined ? undefined : Math.min(Math.max(buffer, value), 100);
|
|
78
|
+
return { value, width, ...(label === undefined ? {} : { label }), ...(sections === undefined ? {} : { sections }), ...(buffered === undefined || buffered === value ? {} : { buffer: buffered }) };
|
|
79
|
+
}, ({ value, width, sections, buffer }) => {
|
|
80
|
+
const isRounded = drawnIn().hasNerdFont && width > 2;
|
|
81
|
+
const cells = isRounded ? width - 2 : width;
|
|
82
|
+
const units = cells * eighths.length;
|
|
75
83
|
let reached = 0;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
reached
|
|
79
|
-
return Text({ ...(tone === undefined ? { color: 'claude' } : textOf(tone)), children: '█'.repeat(Math.round((reached / 100) * width) - from) });
|
|
84
|
+
const ends = (sections ?? [{ value }]).map((section) => {
|
|
85
|
+
reached += section.value;
|
|
86
|
+
return { end: Math.round((reached / 100) * units), color: 'color' in section ? section.color : section.tone === undefined ? 'claude' : barColors[section.tone] };
|
|
80
87
|
});
|
|
81
|
-
|
|
88
|
+
const buffered = Math.round(((buffer ?? 0) / 100) * units);
|
|
89
|
+
const colorAt = (unit) => ends.find(({ end }) => unit < end)?.color ?? (unit < buffered ? 'promptBorder' : 'subtle');
|
|
90
|
+
const drawn = [];
|
|
91
|
+
for (let cell = 0; cell < cells; cell++) {
|
|
92
|
+
const from = cell * eighths.length;
|
|
93
|
+
const left = colorAt(from);
|
|
94
|
+
const right = colorAt(from + eighths.length - 1);
|
|
95
|
+
let edge = 1;
|
|
96
|
+
while (edge < eighths.length && colorAt(from + edge) === left)
|
|
97
|
+
edge++;
|
|
98
|
+
drawn.push(left === right ? { color: left, children: '█' } : { color: left, backgroundColor: right, children: eighths[edge] ?? '█' });
|
|
99
|
+
}
|
|
100
|
+
const capped = isRounded ? [{ color: colorAt(0), children: roundedLeft }, ...drawn, { color: colorAt(units - 1), children: roundedRight }] : drawn;
|
|
101
|
+
return Text({ children: runsOf(capped).map((run) => Text(run)) });
|
|
82
102
|
});
|
|
103
|
+
function runsOf(cells) {
|
|
104
|
+
const runs = [];
|
|
105
|
+
for (const cell of cells) {
|
|
106
|
+
const last = runs.at(-1);
|
|
107
|
+
if (last !== undefined && last.color === cell.color && last.backgroundColor === cell.backgroundColor && last.children !== roundedLeft && cell.children !== roundedRight)
|
|
108
|
+
last.children += cell.children;
|
|
109
|
+
else
|
|
110
|
+
runs.push({ ...cell });
|
|
111
|
+
}
|
|
112
|
+
return runs;
|
|
113
|
+
}
|
|
83
114
|
export const List = hostComponent('List', ({ label, children }) => ({ label, ...(children === undefined ? {} : { children }) }), ({ children }) => Box({ flexDirection: 'column', children }));
|
|
84
115
|
const statusOf = (tone) => (tone === undefined ? [] : [tone === 'off' ? Text({ dimColor: true, children: '○ ' }) : Text({ ...textOf(tone), children: '● ' })]);
|
|
85
116
|
function treeRow({ key, label, description, leading, trailing, tone, isSelected, depth = 0, isOpen, onToggle, onPress }) {
|
package/ui/elements.d.ts
CHANGED
|
@@ -27,6 +27,10 @@ export type ButtonProps = Omit<ClaudeButtonProps, 'onPress'> & ({
|
|
|
27
27
|
readonly href: string;
|
|
28
28
|
readonly onPress?: never;
|
|
29
29
|
});
|
|
30
|
+
export type DrawnIn = {
|
|
31
|
+
readonly hasNerdFont: boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare function drawnIn(): DrawnIn;
|
|
30
34
|
export declare function hostComponent<Props extends object, Canonical extends object>(name: string, canonical: (props: Props) => Canonical, lower: (props: Canonical) => JSX.Element): (props: Props) => JSX.Element;
|
|
31
35
|
export declare function drawWith<Drawn>(table: ElementTable, draw: () => Drawn, markdown?: (props: MarkdownProps) => RenderElement): Drawn;
|
|
32
36
|
export declare function drawKeyed<Drawn>(keyPrefix: string, draw: () => Drawn): Drawn;
|
|
@@ -34,7 +38,7 @@ export type Handler = (...args: unknown[]) => unknown;
|
|
|
34
38
|
export declare function elementData(value: unknown, numberOf: (run: Handler) => number): unknown;
|
|
35
39
|
export declare function elementOf(data: unknown, keyPrefix: string, press: (handler: number, args: readonly unknown[]) => void): unknown;
|
|
36
40
|
export declare function drawsFocusable(data: unknown, key: string): boolean;
|
|
37
|
-
export declare function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void): ElementTable;
|
|
41
|
+
export declare function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void, { hasNerdFont }?: DrawnIn): ElementTable;
|
|
38
42
|
export declare const Box: ElementConstructor<ClaudeBoxProps>;
|
|
39
43
|
export declare const Text: ElementConstructor<ClaudeTextProps>;
|
|
40
44
|
export declare const Button: ElementConstructor<ButtonProps>;
|
package/ui/elements.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../src/ui/elements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,IAAI,cAAc,EAC1B,WAAW,IAAI,iBAAiB,EAChC,WAAW,IAAI,iBAAiB,EAChC,SAAS,IAAI,eAAe,EAC5B,KAAK,IAAI,WAAW,EACpB,kBAAkB,EAElB,YAAY,EAEZ,UAAU,IAAI,gBAAgB,EAC9B,UAAU,IAAI,gBAAgB,EAC9B,aAAa,IAAI,mBAAmB,EACpC,WAAW,IAAI,iBAAiB,EAChC,aAAa,EACb,aAAa,EACb,WAAW,IAAI,iBAAiB,EAChC,QAAQ,IAAI,cAAc,EAC1B,SAAS,IAAI,eAAe,EAC5B,eAAe,EAChB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,QAAQ,GAAG,cAAc,CAAA;AACrC,MAAM,MAAM,SAAS,GAAG,eAAe,CAAA;AACvC,MAAM,MAAM,SAAS,GAAG,eAAe,CAAA;AACvC,MAAM,MAAM,aAAa,GAAG,mBAAmB,CAAA;AAC/C,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAA;AACzC,MAAM,MAAM,WAAW,GAAG,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