herm-tui 1.0.0-dev.1 → 1.0.0-dev.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/db.worker.js +81 -0
- package/highlights-eq9cgrbb.scm +604 -0
- package/highlights-ghv9g403.scm +205 -0
- package/highlights-hk7bwhj4.scm +284 -0
- package/highlights-r812a2qc.scm +150 -0
- package/highlights-x6tmsnaa.scm +115 -0
- package/index.js +10374 -0
- package/injections-73j83es3.scm +27 -0
- package/package.json +14 -64
- package/parser.worker.js +8 -0
- package/tree-sitter-3jzf13jk.wasm +0 -0
- package/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/tree-sitter-zig-e78zbjpm.wasm +0 -0
- package/scripts/postinstall.ts +0 -29
- package/src/app/gateway.tsx +0 -83
- package/src/app/gatewayEvents.ts +0 -203
- package/src/app/launch.ts +0 -41
- package/src/app/skin.tsx +0 -31
- package/src/app/spawnHistory.ts +0 -75
- package/src/app/tabs.ts +0 -23
- package/src/app/turnReducer.ts +0 -390
- package/src/app/useAppKeys.ts +0 -268
- package/src/app/useAtRefPopover.ts +0 -99
- package/src/app/useInputHistory.ts +0 -66
- package/src/app/useSession.ts +0 -102
- package/src/app/useSlashCommands.ts +0 -70
- package/src/app/useSlashPopover.ts +0 -48
- package/src/app.tsx +0 -917
- package/src/commands/slash.ts +0 -151
- package/src/components/avatar/AnimatedAvatar.tsx +0 -66
- package/src/components/avatar/eikon.ts +0 -144
- package/src/components/avatar/states/error.ts +0 -1155
- package/src/components/avatar/states/idle.ts +0 -1155
- package/src/components/avatar/states/index.ts +0 -30
- package/src/components/avatar/states/listening.ts +0 -1155
- package/src/components/avatar/states/speaking.ts +0 -1155
- package/src/components/avatar/states/thinking.ts +0 -1155
- package/src/components/avatar/states/working.ts +0 -1155
- package/src/components/chat/AtRefPopover.tsx +0 -54
- package/src/components/chat/CodeBlock.tsx +0 -67
- package/src/components/chat/Composer.tsx +0 -347
- package/src/components/chat/DiffBlock.tsx +0 -116
- package/src/components/chat/ErrorBlock.tsx +0 -70
- package/src/components/chat/MediaChip.tsx +0 -114
- package/src/components/chat/MessageItem.tsx +0 -282
- package/src/components/chat/MessageList.tsx +0 -114
- package/src/components/chat/PromptCard.tsx +0 -359
- package/src/components/chat/SlashPopover.tsx +0 -158
- package/src/components/chat/ThoughtCloud.tsx +0 -185
- package/src/components/chat/TypingIndicator.tsx +0 -25
- package/src/components/chat/tool/Subagent.tsx +0 -75
- package/src/components/chat/tool/frame.tsx +0 -69
- package/src/components/chat/tool/index.tsx +0 -65
- package/src/components/chat/tool/preview.ts +0 -57
- package/src/components/sidebar/ContextGauge.tsx +0 -102
- package/src/components/sidebar/Sidebar.tsx +0 -143
- package/src/components/tabs/TabBar.tsx +0 -50
- package/src/components/ui/FileLink.tsx +0 -52
- package/src/config/index.ts +0 -156
- package/src/config/lane.ts +0 -161
- package/src/config/models.ts +0 -95
- package/src/config/rules.ts +0 -80
- package/src/config/schema.ts +0 -308
- package/src/dialogs/alert.tsx +0 -52
- package/src/dialogs/chafa.tsx +0 -72
- package/src/dialogs/confirm.tsx +0 -58
- package/src/dialogs/curator.tsx +0 -153
- package/src/dialogs/eikon-picker.tsx +0 -95
- package/src/dialogs/help.tsx +0 -80
- package/src/dialogs/history.tsx +0 -92
- package/src/dialogs/info.tsx +0 -115
- package/src/dialogs/keys.tsx +0 -170
- package/src/dialogs/logs.tsx +0 -42
- package/src/dialogs/message.tsx +0 -38
- package/src/dialogs/model-picker.tsx +0 -123
- package/src/dialogs/new-profile.tsx +0 -69
- package/src/dialogs/new-task.tsx +0 -103
- package/src/dialogs/profile.tsx +0 -55
- package/src/dialogs/rollback.tsx +0 -190
- package/src/dialogs/spawn-history.tsx +0 -80
- package/src/dialogs/text-prompt.tsx +0 -68
- package/src/dialogs/theme-picker.tsx +0 -50
- package/src/home/index.ts +0 -23
- package/src/home/store.ts +0 -267
- package/src/index.tsx +0 -113
- package/src/keys/catalog.ts +0 -115
- package/src/keys/chord.ts +0 -125
- package/src/keys/conflicts.ts +0 -48
- package/src/keys/context.tsx +0 -112
- package/src/keys/index.ts +0 -5
- package/src/keys/list.ts +0 -94
- package/src/keys/oc-compat.ts +0 -87
- package/src/tabs/Agents.tsx +0 -607
- package/src/tabs/Analytics.tsx +0 -154
- package/src/tabs/Chat.tsx +0 -50
- package/src/tabs/Config.tsx +0 -605
- package/src/tabs/Context.tsx +0 -599
- package/src/tabs/Cron.tsx +0 -294
- package/src/tabs/Env.tsx +0 -227
- package/src/tabs/Kanban.tsx +0 -367
- package/src/tabs/Memory.tsx +0 -294
- package/src/tabs/Sessions.tsx +0 -786
- package/src/tabs/Skills.tsx +0 -507
- package/src/tabs/Toolsets.tsx +0 -266
- package/src/theme/builtin.ts +0 -78
- package/src/theme/context.tsx +0 -106
- package/src/theme/index.ts +0 -4
- package/src/theme/resolve.ts +0 -134
- package/src/theme/syntax.ts +0 -31
- package/src/theme/themes/aura.json +0 -69
- package/src/theme/themes/ayu.json +0 -80
- package/src/theme/themes/carbonfox.json +0 -248
- package/src/theme/themes/catppuccin-frappe.json +0 -233
- package/src/theme/themes/catppuccin-macchiato.json +0 -233
- package/src/theme/themes/catppuccin.json +0 -112
- package/src/theme/themes/cobalt2.json +0 -228
- package/src/theme/themes/cursor.json +0 -249
- package/src/theme/themes/dracula.json +0 -219
- package/src/theme/themes/everforest.json +0 -241
- package/src/theme/themes/flexoki.json +0 -237
- package/src/theme/themes/github.json +0 -233
- package/src/theme/themes/gruvbox.json +0 -242
- package/src/theme/themes/kanagawa.json +0 -77
- package/src/theme/themes/lucent-orng.json +0 -237
- package/src/theme/themes/material.json +0 -235
- package/src/theme/themes/matrix.json +0 -77
- package/src/theme/themes/mercury.json +0 -252
- package/src/theme/themes/monokai.json +0 -221
- package/src/theme/themes/nightowl.json +0 -221
- package/src/theme/themes/nord.json +0 -223
- package/src/theme/themes/one-dark.json +0 -84
- package/src/theme/themes/opencode.json +0 -245
- package/src/theme/themes/orng.json +0 -249
- package/src/theme/themes/osaka-jade.json +0 -93
- package/src/theme/themes/palenight.json +0 -222
- package/src/theme/themes/rosepine.json +0 -234
- package/src/theme/themes/solarized.json +0 -223
- package/src/theme/themes/synthwave84.json +0 -226
- package/src/theme/themes/tokyonight.json +0 -243
- package/src/theme/themes/vercel.json +0 -245
- package/src/theme/themes/vesper.json +0 -218
- package/src/theme/themes/zenburn.json +0 -223
- package/src/theme/types.ts +0 -119
- package/src/types/message.ts +0 -97
- package/src/ui/ChafaImage.tsx +0 -64
- package/src/ui/Splash.tsx +0 -118
- package/src/ui/borders.ts +0 -28
- package/src/ui/command.tsx +0 -104
- package/src/ui/dialog-select.tsx +0 -164
- package/src/ui/dialog.tsx +0 -102
- package/src/ui/fmt.ts +0 -82
- package/src/ui/kv.tsx +0 -28
- package/src/ui/shell.tsx +0 -45
- package/src/ui/spinner.tsx +0 -59
- package/src/ui/splash-art.ts +0 -123
- package/src/ui/table.tsx +0 -117
- package/src/ui/ticker.tsx +0 -90
- package/src/ui/toast.tsx +0 -130
- package/src/utils/categorical.ts +0 -77
- package/src/utils/chafa.ts +0 -173
- package/src/utils/clipboard.ts +0 -67
- package/src/utils/context-segments.ts +0 -317
- package/src/utils/control.ts +0 -495
- package/src/utils/drop.ts +0 -25
- package/src/utils/editor.ts +0 -33
- package/src/utils/fuzzy.ts +0 -45
- package/src/utils/gateway-client.ts +0 -253
- package/src/utils/gateway-types.ts +0 -282
- package/src/utils/git.ts +0 -57
- package/src/utils/hermes-analytics.ts +0 -134
- package/src/utils/hermes-home.ts +0 -821
- package/src/utils/hermes-kanban.ts +0 -154
- package/src/utils/hermes-profiles.ts +0 -217
- package/src/utils/interpolate.ts +0 -31
- package/src/utils/math-unicode.ts +0 -818
- package/src/utils/memory-activity.ts +0 -140
- package/src/utils/open-file.ts +0 -13
- package/src/utils/paths.ts +0 -52
- package/src/utils/perf.ts +0 -235
- package/src/utils/preferences.ts +0 -150
- package/src/utils/sessions-db.ts +0 -396
- package/src/utils/subagent-tree.ts +0 -146
- package/src/utils/terminal-reset.ts +0 -129
- package/src/utils/tips.ts +0 -67
- package/src/utils/tokens.ts +0 -87
package/src/ui/splash-art.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// GENERATED by scripts/bake-splash.ts — do not edit.
|
|
2
|
-
// Baked braille 9-patch frame pieces for the launch splash (herm-tji.2).
|
|
3
|
-
// Source: docs/splash/frame/nine/2-*.png @ PICK.md settings.
|
|
4
|
-
|
|
5
|
-
/* eslint-disable */
|
|
6
|
-
|
|
7
|
-
export const FRAME = { cw: 16, ch: 8, tw: 20, tv: 8 } as const
|
|
8
|
-
|
|
9
|
-
const TL = [
|
|
10
|
-
"⠀⢀⣤⠤⢄⣀⠄⢀⣠⣤⣄⡤⡄⡀⠀⠀",
|
|
11
|
-
"⠀⣜⡁⢩⣈⡂⢀⣋⣭⠉⠈⢈⣮⣻⡑⣶",
|
|
12
|
-
"⠀⢸⡖⢿⠏⣤⣶⣽⣫⢶⣢⡌⠹⣧⡏⠻",
|
|
13
|
-
"⠀⠈⡤⢒⣦⢻⣿⣿⣿⢿⣅⡇⣆⡉⠂⢀",
|
|
14
|
-
"⠁⢸⡏⠘⠋⢞⢳⣿⣿⣟⡍⡍⣤⠅⠀⢨",
|
|
15
|
-
"⠀⠤⢯⣆⣀⠙⢦⣿⡋⢀⣜⠇⣁⣒⣊⣉",
|
|
16
|
-
"⠀⢀⣷⣝⣻⣶⣶⢄⠍⠘⡁⡇⣧⣠⣤⡢",
|
|
17
|
-
"⠀⠀⠘⢎⢿⣯⠃⠁⡤⣚⡼⠀⡏⣹⣿⡩",
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
const TR = [
|
|
21
|
-
"⠀⠀⢀⢠⢠⣠⣤⣀⡀⠠⣀⡠⠤⣤⣀⠀",
|
|
22
|
-
"⣶⢊⣟⣵⡁⠁⠉⣭⣙⠀⢐⣂⡍⢈⣣⠀",
|
|
23
|
-
"⠟⢹⣼⠏⢡⣔⢶⣝⣯⣶⣤⠹⡿⢲⡇⠀",
|
|
24
|
-
"⡀⠁⢉⣰⢸⣨⡿⣿⣿⣿⡟⣴⡒⢤⠁⠀",
|
|
25
|
-
"⡅⠄⠨⣤⢩⢩⣻⣿⣿⡞⡳⠙⠃⢹⡇⠀",
|
|
26
|
-
"⣉⣑⣒⣈⠸⣣⡀⢙⣿⡴⠋⣀⣰⡽⠤⢀",
|
|
27
|
-
"⢄⣤⣄⣸⢸⢈⠃⠩⡠⣶⣶⣟⣫⣾⠂⠀",
|
|
28
|
-
"⢍⣿⢟⢹⠀⢧⣒⢤⠁⠈⣽⡿⡱⠇⠀⠀",
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
const BL = [
|
|
32
|
-
"⠀⠀⣀⣿⣿⡟⠁⠀⠻⢬⣳⠀⣇⣲⣟⢿",
|
|
33
|
-
"⠀⢐⡺⣛⡯⣭⠷⠌⢂⢀⡂⡇⡏⠙⠛⠧",
|
|
34
|
-
"⠀⠖⡼⠉⠉⢠⣰⠥⢭⠘⣛⣄⢋⣉⣉⡙",
|
|
35
|
-
"⠀⢸⡌⢀⣠⣵⣿⣿⣿⣿⣨⠃⠷⠂⠐⢍",
|
|
36
|
-
"⠀⠀⠻⠝⠿⣴⣿⣿⡿⣿⣟⣋⡏⡁⠄⠘",
|
|
37
|
-
"⠀⢸⣰⣶⣄⠻⠿⣿⣹⠰⠟⢂⢠⡟⣆⣴",
|
|
38
|
-
"⠀⢪⡉⠸⣻⠇⠀⡝⣛⢀⡀⣘⡟⡷⣫⡯",
|
|
39
|
-
"⠀⠙⠻⠪⠜⠓⠂⠈⠛⠓⠛⠙⠚⠈⠁⠀",
|
|
40
|
-
]
|
|
41
|
-
|
|
42
|
-
const BR = [
|
|
43
|
-
"⡿⣻⣖⣸⠀⣞⡡⠟⢀⠄⢻⣿⣿⣀⠀⠀",
|
|
44
|
-
"⠶⠛⠋⢹⢸⢐⡀⡐⠡⠾⣭⢽⣛⢗⡂⠀",
|
|
45
|
-
"⢋⣉⣉⡙⣠⣛⠃⡭⠬⣆⡄⠉⠩⢧⠲⠀",
|
|
46
|
-
"⡩⠂⠐⠾⠘⣅⣿⣿⣿⣿⣮⣄⡀⢱⡇⠀",
|
|
47
|
-
"⠃⢀⢈⢳⣙⣻⣿⣟⣿⣿⣦⠿⠫⠟⠀⠀",
|
|
48
|
-
"⣦⣰⢻⡄⡐⠻⠃⣏⣿⠿⠟⣠⣶⣆⡇⠀",
|
|
49
|
-
"⢽⣝⢯⢻⣃⢀⡀⣛⣩⠀⠸⣟⠇⢉⡕⠀",
|
|
50
|
-
"⠁⠀⠁⠓⠋⠛⠚⠛⠁⠐⠚⠣⠇⠟⠋⠀",
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
const T = [
|
|
54
|
-
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
|
55
|
-
"⡄⣢⣴⣶⠶⠖⠲⣌⠘⠉⠢⡛⢡⠴⠲⠶⣰⢖⢴⣤",
|
|
56
|
-
"⣾⣥⠿⠀⣠⢰⠿⢾⡐⠾⠿⢇⡳⣿⣗⠄⠀⠣⣑⣵",
|
|
57
|
-
"⢾⡟⠄⠐⢭⣍⢖⡄⠨⢻⣫⠽⡼⡿⢽⢥⡂⠄⠻⡽",
|
|
58
|
-
"⠓⡻⢶⣄⡈⠘⠭⠚⠍⢻⡉⠋⠋⠭⠃⠃⡡⣶⣟⢾",
|
|
59
|
-
"⠁⠄⠉⠉⠚⠤⠤⠬⠟⠰⠧⠊⠯⠴⠤⠓⠛⠉⠐⠢",
|
|
60
|
-
"⣛⣛⡟⣛⡛⣛⣛⢛⣛⣛⡛⣛⣛⢛⣻⣻⣟⠛⣻⢻",
|
|
61
|
-
"⣊⣉⣉⣛⣋⣙⣋⣼⣷⣥⣯⣺⣋⣵⣷⣭⣙⣑⣻⣽",
|
|
62
|
-
]
|
|
63
|
-
|
|
64
|
-
const B = [
|
|
65
|
-
"⣿⢿⣿⣿⢿⣿⡿⡿⣿⣿⠿⣿⢿⡿⣿⣿⡿⣿⡿⢿",
|
|
66
|
-
"⣃⣛⣈⣓⣚⣚⣃⣙⣛⣉⣛⣛⣁⣛⣙⣙⣋⣘⣉⣙",
|
|
67
|
-
"⠠⢄⢄⣀⡤⣤⠐⣠⢄⢠⡄⡤⣄⠀⡤⢄⣀⡀⢀⢀",
|
|
68
|
-
"⣱⠬⠫⠑⢁⣠⢠⡫⣡⣠⣤⣉⢅⢄⣄⠉⠻⡐⢥⣌",
|
|
69
|
-
"⢔⣈⠀⢰⡁⢶⣿⣿⣟⣿⣃⡛⠕⠍⣦⣃⡄⠂⣹⡢",
|
|
70
|
-
"⡿⢏⢄⠀⠃⣫⣿⢜⢩⣶⣦⠉⡶⣾⡖⠛⠀⣠⡛⡿",
|
|
71
|
-
"⠼⢾⠿⣵⣖⣘⠴⠃⠈⢆⢀⠀⡳⠤⣂⣲⣾⠯⠚⠏",
|
|
72
|
-
"⠀⠀⠁⠀⠀⠀⠀⠈⠉⠙⠋⠉⠁⠀⠀⠀⠀⠀⠀⠀",
|
|
73
|
-
]
|
|
74
|
-
|
|
75
|
-
const L = [
|
|
76
|
-
"⠀⠀⢐⢟⣾⠿⠮⠶⡷⣪⠾⠂⡗⢭⢿⢹",
|
|
77
|
-
"⠀⠀⣨⡕⠉⡡⠤⣁⡌⠪⢧⠁⡇⣰⣿⢼",
|
|
78
|
-
"⠀⠀⠹⡃⢾⣕⣷⡦⣓⡀⡉⡆⡏⣶⡣⣻",
|
|
79
|
-
"⠀⢰⡶⢬⣭⡜⣿⣿⣯⢈⢓⠁⡏⣚⡾⣿",
|
|
80
|
-
"⠀⠘⡛⢊⣙⠣⢇⢯⣿⠨⡭⡁⡧⢼⣲⣿",
|
|
81
|
-
"⠀⠀⢱⡉⢿⡇⠤⣝⡄⠀⡁⠁⡏⣶⢖⢿",
|
|
82
|
-
"⠀⠀⢰⣧⡀⠓⠓⠉⢁⣴⡍⠀⡇⠺⠽⢺",
|
|
83
|
-
"⠀⠀⠨⠺⣽⣷⣦⡴⡚⠃⢀⠀⡇⡾⣿⢹",
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
const R = [
|
|
87
|
-
"⡏⡿⡭⢺⢀⠷⢝⢾⠶⠵⠿⣷⡻⡂⠀⠀",
|
|
88
|
-
"⡧⣿⣆⢸⠀⡼⠕⢡⣀⠤⢌⠉⢪⣅⠁⠀",
|
|
89
|
-
"⣟⢜⣶⢹⢰⢉⢀⣚⢴⣾⣪⡷⢘⠏⠀⠀",
|
|
90
|
-
"⣿⢷⡛⢹⠈⡚⡁⣽⣿⣿⢣⣭⡥⢶⡆⠀",
|
|
91
|
-
"⣿⣖⡧⢼⢈⢭⠅⣿⡽⡸⡘⣋⡑⢛⠃⠀",
|
|
92
|
-
"⡿⡲⣶⢹⠈⢈⠀⢠⣫⠤⢸⡿⢉⡆⠀⠀",
|
|
93
|
-
"⡗⠯⠗⢸⠀⢩⣦⡈⠉⠚⠚⢀⣼⡆⠀⠀",
|
|
94
|
-
"⡏⣿⢯⢸⠀⢀⠘⢓⢦⢶⣾⣯⠗⠅⠀⠀",
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
export type Inner = { x: number; y: number; w: number; h: number }
|
|
98
|
-
|
|
99
|
-
/** Assemble the frame at terminal size. Returns the full row list plus
|
|
100
|
-
* the inner text window (where wordmark + info + prompt go). Rows are
|
|
101
|
-
* exactly `w` grapheme-columns wide. Returns no frame below minimum. */
|
|
102
|
-
export function frame(w: number, h: number): { lines: string[]; inner: Inner } {
|
|
103
|
-
const { cw, ch, tw, tv } = FRAME
|
|
104
|
-
const mw = w - 2 * cw
|
|
105
|
-
const mh = h - 2 * ch
|
|
106
|
-
const inner: Inner = { x: cw, y: ch, w: Math.max(0, mw), h: Math.max(0, mh) }
|
|
107
|
-
if (mw < 4 || mh < 2) return { lines: [], inner }
|
|
108
|
-
|
|
109
|
-
const repH = (p: string[], span: number) =>
|
|
110
|
-
p.map(l => l.repeat(Math.ceil(span / tw)).slice(0, span))
|
|
111
|
-
const repV = (p: string[], span: number) =>
|
|
112
|
-
Array.from({ length: span }, (_, i) => p[i % tv])
|
|
113
|
-
|
|
114
|
-
const t = repH(T, mw), b = repH(B, mw)
|
|
115
|
-
const l = repV(L, mh), r = repV(R, mh)
|
|
116
|
-
const mid = " ".repeat(mw)
|
|
117
|
-
|
|
118
|
-
const out: string[] = []
|
|
119
|
-
for (let i = 0; i < ch; i++) out.push(TL[i] + t[i] + TR[i])
|
|
120
|
-
for (let i = 0; i < mh; i++) out.push(l[i] + mid + r[i])
|
|
121
|
-
for (let i = 0; i < ch; i++) out.push(BL[i] + b[i] + BR[i])
|
|
122
|
-
return { lines: out, inner }
|
|
123
|
-
}
|
package/src/ui/table.tsx
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect, type ReactNode } from "react"
|
|
2
|
-
import type { RGBA } from "@opentui/core"
|
|
3
|
-
import { useTheme } from "../theme"
|
|
4
|
-
import * as prefs from "../utils/preferences"
|
|
5
|
-
|
|
6
|
-
// Flex-cell column primitive for list tabs. Replaces the .padEnd(N)
|
|
7
|
-
// single-<text> pattern that bleeds whenever a value exceeds its pad
|
|
8
|
-
// width or the terminal narrows. A Col is either fixed-width-clipped
|
|
9
|
-
// (w) or grow-truncated (grow); height=1 + overflow=hidden guarantees
|
|
10
|
-
// single-line, so the worst case is an ellipsis-free cut, never a
|
|
11
|
-
// shove into the neighbouring column.
|
|
12
|
-
|
|
13
|
-
// Scrollbox v-bar steals 1 col from body rows. Headers that sit
|
|
14
|
-
// outside the scrollbox pad by the same so the grow column lands on
|
|
15
|
-
// identical x in both. Requires the scrollbox to force its v-bar
|
|
16
|
-
// visible (auto-hide would make the gutter conditional → post-layout
|
|
17
|
-
// feedback loop).
|
|
18
|
-
export const VBAR_W = 1
|
|
19
|
-
|
|
20
|
-
// Stable prop for list scrollboxes so `updateProperties`' `!==`
|
|
21
|
-
// check doesn't re-set the scrollbar config on every host reconcile.
|
|
22
|
-
// Inline `{{ visible: true }}` is a new object each render → every
|
|
23
|
-
// reconcile triggers `setProperty → requestRender()` for nothing.
|
|
24
|
-
export const VBAR = { visible: true } as const
|
|
25
|
-
|
|
26
|
-
export const Col = (p: {
|
|
27
|
-
/** Fixed width in cells. Mutually exclusive with `grow`. */
|
|
28
|
-
w?: number
|
|
29
|
-
/** Take remaining width; truncates under narrow terminals. */
|
|
30
|
-
grow?: boolean
|
|
31
|
-
/** Floor for a grow column (default 12). Ignored when `w` is set. */
|
|
32
|
-
min?: number
|
|
33
|
-
right?: boolean
|
|
34
|
-
fg?: RGBA
|
|
35
|
-
bold?: boolean
|
|
36
|
-
children: string
|
|
37
|
-
}) => {
|
|
38
|
-
const theme = useTheme().theme
|
|
39
|
-
const fg = p.fg ?? theme.text
|
|
40
|
-
return (
|
|
41
|
-
<box width={p.w} flexGrow={p.grow ? 1 : 0} flexShrink={p.grow ? 1 : 0}
|
|
42
|
-
minWidth={p.grow ? (p.min ?? 12) : p.w} height={1} overflow="hidden"
|
|
43
|
-
flexDirection="row" justifyContent={p.right ? "flex-end" : "flex-start"}>
|
|
44
|
-
<text>{p.bold
|
|
45
|
-
? <span fg={fg}><strong>{p.children}</strong></span>
|
|
46
|
-
: <span fg={fg}>{p.children}</span>}</text>
|
|
47
|
-
</box>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Header row container. paddingRight mirrors the body scrollbox's
|
|
52
|
-
// v-bar so header and data Cols share available width.
|
|
53
|
-
export const Hdr = (p: { children: ReactNode }) => (
|
|
54
|
-
<box flexDirection="row" height={1} paddingRight={VBAR_W}>
|
|
55
|
-
{p.children}
|
|
56
|
-
</box>
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
// A Col that horizontal-scrolls its text while active. The box still
|
|
60
|
-
// truncates via overflow; the string is just rotated each tick so the
|
|
61
|
-
// clipped slice advances. Only animates when the full text doesn't
|
|
62
|
-
// fit (measured post-layout from the renderable's width), so
|
|
63
|
-
// non-truncated cells and unselected rows don't tick.
|
|
64
|
-
export const Marquee = (p: {
|
|
65
|
-
w?: number; grow?: boolean; min?: number
|
|
66
|
-
fg?: RGBA; bold?: boolean
|
|
67
|
-
active: boolean
|
|
68
|
-
/** ms per character step (default 180). */
|
|
69
|
-
speed?: number
|
|
70
|
-
/** ms to sit still before scrolling starts (default 600). */
|
|
71
|
-
hold?: number
|
|
72
|
-
children: string
|
|
73
|
-
}) => {
|
|
74
|
-
const theme = useTheme().theme
|
|
75
|
-
const fg = p.fg ?? theme.text
|
|
76
|
-
const text = p.children
|
|
77
|
-
const box = useRef<import("@opentui/core").BoxRenderable | null>(null)
|
|
78
|
-
const node = useRef<import("@opentui/core").TextRenderable | null>(null)
|
|
79
|
-
|
|
80
|
-
const animate = prefs.get("animations") !== false && p.active
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
const tn = node.current
|
|
83
|
-
if (!tn) return
|
|
84
|
-
if (!animate) { tn.scrollX = 0; return }
|
|
85
|
-
// Hold static briefly before scrolling so the cell is readable at
|
|
86
|
-
// rest on select; also keeps frame-snapshot tests deterministic.
|
|
87
|
-
// scrollX on the TextRenderable is a direct native paint request
|
|
88
|
-
// — zero React reconciles per tick (vs ~5/s at 180ms with the
|
|
89
|
-
// previous setState(off)).
|
|
90
|
-
let id: ReturnType<typeof setInterval> | undefined
|
|
91
|
-
const period = text.length + GAP.length
|
|
92
|
-
const hold = setTimeout(() => {
|
|
93
|
-
id = setInterval(() => {
|
|
94
|
-
const w = box.current?.width ?? 0
|
|
95
|
-
if (text.length <= w) { tn.scrollX = 0; return }
|
|
96
|
-
tn.scrollX = (tn.scrollX + 1) % period
|
|
97
|
-
}, p.speed ?? 180)
|
|
98
|
-
}, p.hold ?? 600)
|
|
99
|
-
return () => {
|
|
100
|
-
clearTimeout(hold); if (id) clearInterval(id)
|
|
101
|
-
if (node.current) node.current.scrollX = 0
|
|
102
|
-
}
|
|
103
|
-
}, [animate, text, p.speed, p.hold])
|
|
104
|
-
|
|
105
|
-
// `text + GAP + text` renders once; scrollX wraps at period so the
|
|
106
|
-
// visible window always has GAP-then-head following the tail.
|
|
107
|
-
return (
|
|
108
|
-
<box ref={box}
|
|
109
|
-
width={p.w} flexGrow={p.grow ? 1 : 0} flexShrink={p.grow ? 1 : 0}
|
|
110
|
-
minWidth={p.grow ? (p.min ?? 12) : p.w} height={1} overflow="hidden">
|
|
111
|
-
<text ref={node} wrapMode="none">{p.bold
|
|
112
|
-
? <span fg={fg}><strong>{text + GAP + text}</strong></span>
|
|
113
|
-
: <span fg={fg}>{text + GAP + text}</span>}</text>
|
|
114
|
-
</box>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
const GAP = " "
|
package/src/ui/ticker.tsx
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Single-line styled text that horizontally auto-scrolls when active.
|
|
2
|
-
//
|
|
3
|
-
// Differs from ui/table.tsx Marquee in two ways:
|
|
4
|
-
// 1. Content is a ReactNode (styled <span>s), not a plain string —
|
|
5
|
-
// the component can't slice it, so it animates the text node's
|
|
6
|
-
// native scrollX instead of rebuilding a substring each tick.
|
|
7
|
-
// 2. Because scrollX is driven via ref (not React state), there's
|
|
8
|
-
// exactly one React render regardless of scroll position. At
|
|
9
|
-
// 35ms/char that's 0 extra renders vs Marquee's ~28/s.
|
|
10
|
-
//
|
|
11
|
-
// The trade-off: no gap-and-loop. When scrollX hits maxScrollX the
|
|
12
|
-
// animation reverses back to 0 (ping-pong). Cheaper than duplicating
|
|
13
|
-
// the span tree to fake a seamless loop.
|
|
14
|
-
|
|
15
|
-
import { useEffect, useRef, type ReactNode } from "react"
|
|
16
|
-
import type { TextRenderable } from "@opentui/core"
|
|
17
|
-
import * as prefs from "../utils/preferences"
|
|
18
|
-
|
|
19
|
-
export const Ticker = (p: {
|
|
20
|
-
active: boolean
|
|
21
|
-
/** ms per cell (default 35 — fast). */
|
|
22
|
-
speed?: number
|
|
23
|
-
/** ms to sit still before scrolling (default 150). */
|
|
24
|
-
hold?: number
|
|
25
|
-
fg?: import("@opentui/core").RGBA
|
|
26
|
-
children: ReactNode
|
|
27
|
-
}) => {
|
|
28
|
-
const ref = useRef<TextRenderable | null>(null)
|
|
29
|
-
|
|
30
|
-
const animate = prefs.get("animations") !== false && p.active
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const node = ref.current
|
|
33
|
-
if (!node) return
|
|
34
|
-
if (!animate) { node.scrollX = 0; return }
|
|
35
|
-
let dir = 1
|
|
36
|
-
let id: ReturnType<typeof setInterval> | undefined
|
|
37
|
-
const hold = setTimeout(() => {
|
|
38
|
-
id = setInterval(() => {
|
|
39
|
-
const max = node.maxScrollX
|
|
40
|
-
if (max <= 0) return
|
|
41
|
-
const next = node.scrollX + dir
|
|
42
|
-
if (next >= max) { dir = -1; node.scrollX = max; return }
|
|
43
|
-
if (next <= 0) { dir = 1; node.scrollX = 0; return }
|
|
44
|
-
node.scrollX = next
|
|
45
|
-
}, p.speed ?? 35)
|
|
46
|
-
}, p.hold ?? 150)
|
|
47
|
-
return () => {
|
|
48
|
-
clearTimeout(hold)
|
|
49
|
-
if (id) clearInterval(id)
|
|
50
|
-
if (ref.current) ref.current.scrollX = 0
|
|
51
|
-
}
|
|
52
|
-
}, [animate, p.speed, p.hold])
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<box flexGrow={1} flexShrink={1} minWidth={0} height={1} overflow="hidden">
|
|
56
|
-
<text ref={ref} wrapMode="none" fg={p.fg}>{p.children}</text>
|
|
57
|
-
</box>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// ─── Inline markdown → spans ─────────────────────────────────────────
|
|
62
|
-
// Just enough for a one-line peek: **bold**, `code`, _italic_/*italic*.
|
|
63
|
-
// Block syntax (headings, lists, fences) was already flattened by the
|
|
64
|
-
// caller's whitespace collapse; we strip the markers we don't style.
|
|
65
|
-
|
|
66
|
-
type Seg = { t: string; b?: boolean; c?: boolean; i?: boolean }
|
|
67
|
-
|
|
68
|
-
// Order matters — code first so ** inside backticks stays literal.
|
|
69
|
-
// Single * / _ require a non-word char (or start/end) on the outer
|
|
70
|
-
// side so snake_case and a*b don't become italics.
|
|
71
|
-
const RX = /(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|((?<![\w*])\*[^*\s][^*]*\*(?![\w*]))|((?<!\w)_[^_\s][^_]*_(?!\w))/g
|
|
72
|
-
|
|
73
|
-
/** Tokenize one line of collapsed markdown into styled segments. */
|
|
74
|
-
export const inline = (s: string): Seg[] => {
|
|
75
|
-
const out: Seg[] = []
|
|
76
|
-
let last = 0
|
|
77
|
-
for (const m of s.matchAll(RX)) {
|
|
78
|
-
const at = m.index ?? 0
|
|
79
|
-
if (at > last) out.push({ t: s.slice(last, at) })
|
|
80
|
-
const hit = m[0]
|
|
81
|
-
if (hit.startsWith("`")) out.push({ t: hit.slice(1, -1), c: true })
|
|
82
|
-
else if (hit.startsWith("**") || hit.startsWith("__"))
|
|
83
|
-
out.push({ t: hit.slice(2, -2), b: true })
|
|
84
|
-
else out.push({ t: hit.slice(1, -1), i: true })
|
|
85
|
-
last = at + hit.length
|
|
86
|
-
}
|
|
87
|
-
if (last < s.length) out.push({ t: s.slice(last) })
|
|
88
|
-
// Scrub residual block markers that survived the collapse.
|
|
89
|
-
return out.map(seg => seg.c ? seg : { ...seg, t: seg.t.replace(/^#{1,6}\s+/, "") })
|
|
90
|
-
}
|
package/src/ui/toast.tsx
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Toast notification system — auto-dismiss messages.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* <ToastProvider><App /></ToastProvider>
|
|
6
|
-
*
|
|
7
|
-
* const toast = useToast()
|
|
8
|
-
* toast.show({ variant: "success", message: "Done!" })
|
|
9
|
-
* toast.error(new Error("oops"))
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { createContext, useContext, useState, useCallback, useRef, useMemo, useEffect } from "react"
|
|
13
|
-
import type { ReactNode } from "react"
|
|
14
|
-
import { useTheme } from "../theme"
|
|
15
|
-
import type { RGBA } from "@opentui/core"
|
|
16
|
-
|
|
17
|
-
type ToastVariant = "info" | "error" | "warning" | "success"
|
|
18
|
-
|
|
19
|
-
type ToastOptions = {
|
|
20
|
-
readonly variant: ToastVariant
|
|
21
|
-
readonly title?: string
|
|
22
|
-
readonly message: string
|
|
23
|
-
readonly duration?: number
|
|
24
|
-
/** Clickable affordance on the toast (e.g. "view" → open dialog). */
|
|
25
|
-
readonly action?: { label: string; run: () => void }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type ToastEntry = ToastOptions & {
|
|
29
|
-
readonly id: number
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type ToastContext = {
|
|
33
|
-
readonly show: (opts: ToastOptions) => void
|
|
34
|
-
readonly error: (err: Error) => void
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const Ctx = createContext<ToastContext | null>(null)
|
|
38
|
-
|
|
39
|
-
const DEFAULT_DURATION = 3000
|
|
40
|
-
|
|
41
|
-
export const ToastProvider = ({ children }: { children: ReactNode }) => {
|
|
42
|
-
const [items, setItems] = useState<ToastEntry[]>([])
|
|
43
|
-
const counter = useRef(0)
|
|
44
|
-
const timers = useRef(new Map<number, ReturnType<typeof setTimeout>>())
|
|
45
|
-
|
|
46
|
-
useEffect(() => () => {
|
|
47
|
-
for (const t of timers.current.values()) clearTimeout(t)
|
|
48
|
-
}, [])
|
|
49
|
-
|
|
50
|
-
const show = useCallback((opts: ToastOptions) => {
|
|
51
|
-
const id = ++counter.current
|
|
52
|
-
setItems(prev => [...prev, { ...opts, id }])
|
|
53
|
-
const dur = opts.duration ?? DEFAULT_DURATION
|
|
54
|
-
timers.current.set(id, setTimeout(() => {
|
|
55
|
-
timers.current.delete(id)
|
|
56
|
-
setItems(prev => prev.filter(t => t.id !== id))
|
|
57
|
-
}, dur))
|
|
58
|
-
}, [])
|
|
59
|
-
|
|
60
|
-
const error = useCallback((err: Error) => {
|
|
61
|
-
show({ variant: "error", title: "Error", message: err.message })
|
|
62
|
-
}, [show])
|
|
63
|
-
|
|
64
|
-
const value = useMemo<ToastContext>(() => ({ show, error }), [show, error])
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Ctx.Provider value={value}>
|
|
68
|
-
{children}
|
|
69
|
-
{items.length > 0 ? <ToastOverlay items={items} /> : null}
|
|
70
|
-
</Ctx.Provider>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const ToastOverlay = ({ items }: { items: ReadonlyArray<ToastEntry> }) => {
|
|
75
|
-
const theme = useTheme().theme
|
|
76
|
-
|
|
77
|
-
const color = (variant: ToastVariant): RGBA => {
|
|
78
|
-
switch (variant) {
|
|
79
|
-
case "error": return theme.error
|
|
80
|
-
case "warning": return theme.warning
|
|
81
|
-
case "success": return theme.success
|
|
82
|
-
default: return theme.info
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<box
|
|
88
|
-
position="absolute"
|
|
89
|
-
top={2}
|
|
90
|
-
right={2}
|
|
91
|
-
flexDirection="column"
|
|
92
|
-
gap={1}
|
|
93
|
-
zIndex={200}
|
|
94
|
-
maxWidth={60}
|
|
95
|
-
>
|
|
96
|
-
{items.map(item => (
|
|
97
|
-
<box
|
|
98
|
-
key={item.id}
|
|
99
|
-
backgroundColor={theme.backgroundPanel}
|
|
100
|
-
border={["left"] as const}
|
|
101
|
-
borderStyle="single"
|
|
102
|
-
borderColor={color(item.variant)}
|
|
103
|
-
paddingLeft={1}
|
|
104
|
-
paddingRight={1}
|
|
105
|
-
flexDirection="column"
|
|
106
|
-
>
|
|
107
|
-
{item.title ? (
|
|
108
|
-
<text fg={theme.text}>
|
|
109
|
-
<strong>{item.title}</strong>
|
|
110
|
-
</text>
|
|
111
|
-
) : null}
|
|
112
|
-
<text fg={theme.textMuted} wrapMode="word">
|
|
113
|
-
{item.message}
|
|
114
|
-
</text>
|
|
115
|
-
{item.action ? (
|
|
116
|
-
<box height={1} marginTop={0} onMouseDown={item.action.run}>
|
|
117
|
-
<text fg={color(item.variant)}><u>{item.action.label}</u></text>
|
|
118
|
-
</box>
|
|
119
|
-
) : null}
|
|
120
|
-
</box>
|
|
121
|
-
))}
|
|
122
|
-
</box>
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export const useToast = (): ToastContext => {
|
|
127
|
-
const ctx = useContext(Ctx)
|
|
128
|
-
if (!ctx) throw new Error("useToast() must be inside <ToastProvider>")
|
|
129
|
-
return ctx
|
|
130
|
-
}
|
package/src/utils/categorical.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Categorical color ramp — golden-angle HSL walk anchored on a seed color.
|
|
3
|
-
*
|
|
4
|
-
* Used by the Context grid where N adjacent category swatches must be
|
|
5
|
-
* mutually distinguishable. Theme-semantic keys (info/accent/…) weren't
|
|
6
|
-
* designed for that; this generates the ramp at runtime so no per-theme
|
|
7
|
-
* palette is needed.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { RGBA } from "@opentui/core"
|
|
11
|
-
|
|
12
|
-
/** Golden angle in degrees — maximally irrational, so successive hues spread evenly for any N. */
|
|
13
|
-
const GOLDEN_ANGLE = 137.50776405003785
|
|
14
|
-
|
|
15
|
-
export function luminance(c: RGBA): number {
|
|
16
|
-
return 0.299 * c.r + 0.587 * c.g + 0.114 * c.b
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** RGBA (0–1 floats) → [h°, s, l] with h in [0,360), s/l in [0,1]. */
|
|
20
|
-
export function rgbaToHsl(c: RGBA): [number, number, number] {
|
|
21
|
-
const r = c.r, g = c.g, b = c.b
|
|
22
|
-
const max = Math.max(r, g, b), min = Math.min(r, g, b)
|
|
23
|
-
const l = (max + min) / 2
|
|
24
|
-
const d = max - min
|
|
25
|
-
if (d === 0) return [0, 0, l]
|
|
26
|
-
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
|
|
27
|
-
let h: number
|
|
28
|
-
switch (max) {
|
|
29
|
-
case r: h = (g - b) / d + (g < b ? 6 : 0); break
|
|
30
|
-
case g: h = (b - r) / d + 2; break
|
|
31
|
-
default: h = (r - g) / d + 4
|
|
32
|
-
}
|
|
33
|
-
return [h * 60, s, l]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** [h°, s, l] → RGBA (0–1 floats, alpha=1). */
|
|
37
|
-
export function hslToRgba(h: number, s: number, l: number): RGBA {
|
|
38
|
-
h = ((h % 360) + 360) % 360 / 360
|
|
39
|
-
if (s === 0) return RGBA.fromValues(l, l, l, 1)
|
|
40
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s
|
|
41
|
-
const p = 2 * l - q
|
|
42
|
-
const ch = (t: number) => {
|
|
43
|
-
if (t < 0) t += 1
|
|
44
|
-
if (t > 1) t -= 1
|
|
45
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t
|
|
46
|
-
if (t < 1 / 2) return q
|
|
47
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6
|
|
48
|
-
return p
|
|
49
|
-
}
|
|
50
|
-
return RGBA.fromValues(ch(h + 1 / 3), ch(h), ch(h - 1 / 3), 1)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Generate N categorical colors.
|
|
55
|
-
*
|
|
56
|
-
* Hue starts at `seed`'s hue and steps by the golden angle. Saturation and
|
|
57
|
-
* lightness are picked from `bg` luminance so swatches stay legible on both
|
|
58
|
-
* dark and light themes without per-theme tuning. Slot i is stable across
|
|
59
|
-
* calls: same id → same slot → same hue family on every theme.
|
|
60
|
-
*/
|
|
61
|
-
export function categorical(seed: RGBA, bg: RGBA, n: number): RGBA[] {
|
|
62
|
-
const [h0] = rgbaToHsl(seed)
|
|
63
|
-
const dark = luminance(bg) < 0.5
|
|
64
|
-
const s = dark ? 0.60 : 0.70
|
|
65
|
-
const l = dark ? 0.62 : 0.42
|
|
66
|
-
const out: RGBA[] = []
|
|
67
|
-
for (let i = 0; i < n; i++) out.push(hslToRgba(h0 + i * GOLDEN_ANGLE, s, l))
|
|
68
|
-
return out
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Minimum hue separation (degrees) across N golden-angle slots. Useful for test assertions. */
|
|
72
|
-
export function minHueSeparation(n: number): number {
|
|
73
|
-
const hs = Array.from({ length: n }, (_, i) => (i * GOLDEN_ANGLE) % 360).sort((a, b) => a - b)
|
|
74
|
-
let min = 360 - hs[n - 1] + hs[0]
|
|
75
|
-
for (let i = 1; i < n; i++) min = Math.min(min, hs[i] - hs[i - 1])
|
|
76
|
-
return min
|
|
77
|
-
}
|