@sagmans/dsh-tui 0.1.2 → 0.2.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/README.md +82 -8
- package/cordis.patch.yml +4 -2
- package/lib/agent/host.d.ts +14 -0
- package/lib/agent/host.d.ts.map +1 -1
- package/lib/agent/host.js +20 -4
- package/lib/agent/host.js.map +1 -1
- package/lib/agent/model.d.ts +24 -0
- package/lib/agent/model.d.ts.map +1 -1
- package/lib/agent/model.js +46 -1
- package/lib/agent/model.js.map +1 -1
- package/lib/agent/present.d.ts +7 -1
- package/lib/agent/present.d.ts.map +1 -1
- package/lib/agent/present.js +33 -4
- package/lib/agent/present.js.map +1 -1
- package/lib/agent/presets.d.ts +7 -1
- package/lib/agent/presets.d.ts.map +1 -1
- package/lib/agent/presets.js +7 -3
- package/lib/agent/presets.js.map +1 -1
- package/lib/cards.d.ts +127 -7
- package/lib/cards.d.ts.map +1 -1
- package/lib/cards.js +380 -52
- package/lib/cards.js.map +1 -1
- package/lib/export.d.ts +5 -4
- package/lib/export.d.ts.map +1 -1
- package/lib/export.js +62 -13
- package/lib/export.js.map +1 -1
- package/lib/fold-cursor.d.ts +23 -0
- package/lib/fold-cursor.d.ts.map +1 -0
- package/lib/fold-cursor.js +31 -0
- package/lib/fold-cursor.js.map +1 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +310 -32
- package/lib/index.js.map +1 -1
- package/lib/input/submission.d.ts +3 -1
- package/lib/input/submission.d.ts.map +1 -1
- package/lib/input/submission.js +5 -2
- package/lib/input/submission.js.map +1 -1
- package/lib/terminal/warning-screen.d.ts +8 -0
- package/lib/terminal/warning-screen.d.ts.map +1 -0
- package/lib/terminal/warning-screen.js +66 -0
- package/lib/terminal/warning-screen.js.map +1 -0
- package/lib/theme-capability.d.ts +36 -0
- package/lib/theme-capability.d.ts.map +1 -0
- package/lib/theme-capability.js +190 -0
- package/lib/theme-capability.js.map +1 -0
- package/lib/theme-command.d.ts +10 -0
- package/lib/theme-command.d.ts.map +1 -0
- package/lib/theme-command.js +61 -0
- package/lib/theme-command.js.map +1 -0
- package/lib/theme-settings.d.ts +161 -0
- package/lib/theme-settings.d.ts.map +1 -0
- package/lib/theme-settings.js +166 -0
- package/lib/theme-settings.js.map +1 -0
- package/lib/theme-tokens.d.ts +110 -0
- package/lib/theme-tokens.d.ts.map +1 -0
- package/lib/theme-tokens.js +401 -0
- package/lib/theme-tokens.js.map +1 -0
- package/lib/theme.d.ts +32 -35
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +112 -63
- package/lib/theme.js.map +1 -1
- package/lib/tokens.d.ts +15 -0
- package/lib/tokens.d.ts.map +1 -0
- package/lib/tokens.js +29 -0
- package/lib/tokens.js.map +1 -0
- package/lib/transcript.d.ts +26 -1
- package/lib/transcript.d.ts.map +1 -1
- package/lib/transcript.js +153 -25
- package/lib/transcript.js.map +1 -1
- package/lib/ui/dock.d.ts.map +1 -1
- package/lib/ui/dock.js +67 -28
- package/lib/ui/dock.js.map +1 -1
- package/lib/ui/editor.d.ts +34 -0
- package/lib/ui/editor.d.ts.map +1 -0
- package/lib/ui/editor.js +98 -0
- package/lib/ui/editor.js.map +1 -0
- package/lib/ui/markdown.d.ts +8 -0
- package/lib/ui/markdown.d.ts.map +1 -1
- package/lib/ui/markdown.js +12 -0
- package/lib/ui/markdown.js.map +1 -1
- package/lib/ui/picker.d.ts +37 -0
- package/lib/ui/picker.d.ts.map +1 -1
- package/lib/ui/picker.js +53 -0
- package/lib/ui/picker.js.map +1 -1
- package/lib/ui/status.d.ts +3 -1
- package/lib/ui/status.d.ts.map +1 -1
- package/lib/ui/status.js +76 -24
- package/lib/ui/status.js.map +1 -1
- package/lib/ui/view.d.ts +43 -0
- package/lib/ui/view.d.ts.map +1 -1
- package/lib/ui/view.js +254 -54
- package/lib/ui/view.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
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
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { sgrBackgroundPrefix, sgrPrefix } from "./theme-capability.js";
|
|
2
|
+
const RESET = '\u001B[0m';
|
|
3
|
+
/**
|
|
4
|
+
* The reset sequence, for the code that has to recognise one.
|
|
5
|
+
*
|
|
6
|
+
* pi-tui closes a truncated row with a reset whether or not it opened a style,
|
|
7
|
+
* so a renderer that turns styling off still has to remove the ones it did not
|
|
8
|
+
* ask for.
|
|
9
|
+
*/
|
|
10
|
+
export function resetSequence() {
|
|
11
|
+
return RESET;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The muted shade every receding element shares.
|
|
15
|
+
*
|
|
16
|
+
* An explicit grey rather than a palette slot: slot 8 is whatever the reader's
|
|
17
|
+
* terminal maps it to, which on the reader's own phone was close enough to
|
|
18
|
+
* ordinary text that dimming looked like it had not been applied at all.
|
|
19
|
+
*/
|
|
20
|
+
export const MUTED_GREY = '#8a8a8a';
|
|
21
|
+
/**
|
|
22
|
+
* The shade a tool's argument takes.
|
|
23
|
+
*
|
|
24
|
+
* A call's argument is the one part of a card the reader scans for, and it must
|
|
25
|
+
* read as neither the tool's own label (warn) nor ordinary output (the default
|
|
26
|
+
* foreground); a pale blue sits between them without competing for attention.
|
|
27
|
+
*/
|
|
28
|
+
export const ARGUMENT_BLUE = '#8db3d9';
|
|
29
|
+
/**
|
|
30
|
+
* The shade a submitted prompt takes.
|
|
31
|
+
*
|
|
32
|
+
* A reader's own turns and the assistant's reply both shipped on the default
|
|
33
|
+
* foreground, so telling the two apart meant reading them; a rose separates
|
|
34
|
+
* them at a glance while staying quieter than the warn-coloured tool label.
|
|
35
|
+
*/
|
|
36
|
+
export const USER_PROMPT_ROSE = '#FCCAF0';
|
|
37
|
+
/** Palette entries a token may name instead of a literal colour. */
|
|
38
|
+
export const PALETTE_NAMES = ['default', 'muted', 'accent', 'arg', 'warn', 'added', 'removed', 'user', 'assistant'];
|
|
39
|
+
/** A row class a tool card can carry, so styling follows what the row means. */
|
|
40
|
+
export const CARD_ROW_CLASSES = [
|
|
41
|
+
'header', 'hunk', 'added', 'removed', 'line', 'lineNumber', 'path', 'match', 'truncated', 'output', 'cwd', 'status', 'source', 'url', 'detail',
|
|
42
|
+
];
|
|
43
|
+
/**
|
|
44
|
+
* Every styled element on the surface, grouped by the region that draws it.
|
|
45
|
+
*
|
|
46
|
+
* The list is the contract: a renderer names a token, and the coverage sweep
|
|
47
|
+
* fails if a token loses its default, so "every element" cannot quietly drift
|
|
48
|
+
* as the surface grows.
|
|
49
|
+
*/
|
|
50
|
+
export const TUI_TOKENS = [
|
|
51
|
+
// Transcript rows
|
|
52
|
+
'transcript.user',
|
|
53
|
+
'transcript.notice',
|
|
54
|
+
'transcript.marker',
|
|
55
|
+
'transcript.reasoning.summary',
|
|
56
|
+
'transcript.reasoning.body',
|
|
57
|
+
'transcript.reasoning.hint',
|
|
58
|
+
// A reply is markdown, so the markdown tokens are what address it.
|
|
59
|
+
// Tool cards: the generic layer
|
|
60
|
+
'tool.title',
|
|
61
|
+
'tool.glyph',
|
|
62
|
+
'tool.args',
|
|
63
|
+
'tool.stat.added',
|
|
64
|
+
'tool.stat.changed',
|
|
65
|
+
'tool.stat.removed',
|
|
66
|
+
'tool.stat.size',
|
|
67
|
+
'tool.stat.separator',
|
|
68
|
+
'tool.detail',
|
|
69
|
+
'tool.hint',
|
|
70
|
+
'tool.failed.title',
|
|
71
|
+
'tool.failed.glyph',
|
|
72
|
+
'tool.subcall.title',
|
|
73
|
+
'tool.subcall.args',
|
|
74
|
+
// Tool cards: per kind
|
|
75
|
+
'tool.diff.header',
|
|
76
|
+
'tool.diff.hunk',
|
|
77
|
+
'tool.diff.added',
|
|
78
|
+
'tool.diff.removed',
|
|
79
|
+
'tool.read.header',
|
|
80
|
+
'tool.read.lineNumber',
|
|
81
|
+
'tool.read.line',
|
|
82
|
+
'tool.search.path',
|
|
83
|
+
'tool.search.lineNumber',
|
|
84
|
+
'tool.search.match',
|
|
85
|
+
'tool.search.truncated',
|
|
86
|
+
'tool.terminal.cwd',
|
|
87
|
+
'tool.terminal.status',
|
|
88
|
+
'tool.terminal.output',
|
|
89
|
+
'tool.web.url',
|
|
90
|
+
'tool.web.source',
|
|
91
|
+
'tool.web.truncated',
|
|
92
|
+
'tool.generic.detail',
|
|
93
|
+
// Markdown
|
|
94
|
+
'markdown.heading',
|
|
95
|
+
'markdown.link',
|
|
96
|
+
'markdown.linkUrl',
|
|
97
|
+
'markdown.code',
|
|
98
|
+
'markdown.codeBlock',
|
|
99
|
+
'markdown.codeBlockBorder',
|
|
100
|
+
'markdown.quote',
|
|
101
|
+
'markdown.quoteBorder',
|
|
102
|
+
'markdown.hr',
|
|
103
|
+
'markdown.listBullet',
|
|
104
|
+
'markdown.bold',
|
|
105
|
+
'markdown.italic',
|
|
106
|
+
'markdown.strikethrough',
|
|
107
|
+
'markdown.underline',
|
|
108
|
+
// No markdown.tableHeader: pi-tui styles table headers through the bold hook
|
|
109
|
+
// it already owns, so a token here would be a setting with no call site.
|
|
110
|
+
// Picker
|
|
111
|
+
'picker.title',
|
|
112
|
+
'picker.glyph',
|
|
113
|
+
'picker.note',
|
|
114
|
+
'picker.filter',
|
|
115
|
+
'picker.row',
|
|
116
|
+
'picker.rowCurrent',
|
|
117
|
+
'picker.scrollNewer',
|
|
118
|
+
'picker.scrollOlder',
|
|
119
|
+
'picker.hint',
|
|
120
|
+
'picker.cursor',
|
|
121
|
+
// Gate
|
|
122
|
+
'gate.title',
|
|
123
|
+
'gate.glyphApproval',
|
|
124
|
+
'gate.glyphQuestion',
|
|
125
|
+
'gate.detail',
|
|
126
|
+
'gate.option',
|
|
127
|
+
'gate.optionCurrent',
|
|
128
|
+
'gate.cursor',
|
|
129
|
+
'gate.hint',
|
|
130
|
+
// Dock
|
|
131
|
+
'dock.goal',
|
|
132
|
+
'dock.planMode',
|
|
133
|
+
'dock.todos.heading',
|
|
134
|
+
'dock.todos.pending',
|
|
135
|
+
'dock.todos.inProgress',
|
|
136
|
+
'dock.todos.overflow',
|
|
137
|
+
'dock.subagents.heading',
|
|
138
|
+
'dock.subagents.running',
|
|
139
|
+
'dock.subagents.overflow',
|
|
140
|
+
'dock.jobs.heading',
|
|
141
|
+
'dock.jobs.running',
|
|
142
|
+
'dock.jobs.overflow',
|
|
143
|
+
// Status bar
|
|
144
|
+
'status.activity.working',
|
|
145
|
+
'status.activity.ready',
|
|
146
|
+
'status.elapsed',
|
|
147
|
+
'status.agentPreset',
|
|
148
|
+
'status.model',
|
|
149
|
+
'status.effort',
|
|
150
|
+
'status.permission',
|
|
151
|
+
'status.context',
|
|
152
|
+
'status.cache',
|
|
153
|
+
'status.cwd',
|
|
154
|
+
'status.separator',
|
|
155
|
+
// Editor
|
|
156
|
+
'editor.border',
|
|
157
|
+
'editor.selectList.selectedPrefix',
|
|
158
|
+
'editor.selectList.selectedText',
|
|
159
|
+
'editor.selectList.description',
|
|
160
|
+
'editor.selectList.scrollInfo',
|
|
161
|
+
'editor.selectList.noMatch',
|
|
162
|
+
];
|
|
163
|
+
/**
|
|
164
|
+
* Which token draws a card row, by the card's kind and the row's class.
|
|
165
|
+
*
|
|
166
|
+
* Two lookups rather than one because `header` means a different element on a
|
|
167
|
+
* diff than on a read: the kind is half of what a row is.
|
|
168
|
+
*/
|
|
169
|
+
export const CARD_ROW_TOKEN = {
|
|
170
|
+
diff: { header: 'tool.diff.header', hunk: 'tool.diff.hunk', added: 'tool.diff.added', removed: 'tool.diff.removed' },
|
|
171
|
+
read: { header: 'tool.read.header', lineNumber: 'tool.read.lineNumber', line: 'tool.read.line' },
|
|
172
|
+
search: {
|
|
173
|
+
path: 'tool.search.path',
|
|
174
|
+
lineNumber: 'tool.search.lineNumber',
|
|
175
|
+
match: 'tool.search.match',
|
|
176
|
+
truncated: 'tool.search.truncated',
|
|
177
|
+
},
|
|
178
|
+
terminal: { cwd: 'tool.terminal.cwd', status: 'tool.terminal.status', output: 'tool.terminal.output' },
|
|
179
|
+
web: { url: 'tool.web.url', source: 'tool.web.source', truncated: 'tool.web.truncated' },
|
|
180
|
+
generic: { detail: 'tool.generic.detail' },
|
|
181
|
+
};
|
|
182
|
+
/** The colours a token can name, so a shade is changed in one place. */
|
|
183
|
+
export const DEFAULT_PALETTE = {
|
|
184
|
+
default: '#d0d0d0',
|
|
185
|
+
muted: MUTED_GREY,
|
|
186
|
+
accent: '#5fafd7',
|
|
187
|
+
arg: ARGUMENT_BLUE,
|
|
188
|
+
warn: '#d7af5f',
|
|
189
|
+
added: '#5faf5f',
|
|
190
|
+
removed: '#d75f5f',
|
|
191
|
+
user: USER_PROMPT_ROSE,
|
|
192
|
+
assistant: '#d0d0d0',
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Muted elements share one shade, which is what makes the surface coherent.
|
|
196
|
+
*
|
|
197
|
+
* It names the palette entry rather than repeating the hex, so a reader who
|
|
198
|
+
* changes `palette.muted` once quiets every receding element together instead
|
|
199
|
+
* of hunting the tokens down. No `dim` either: faint is dropped the moment a
|
|
200
|
+
* colour is named, so carrying it would be a setting that does nothing.
|
|
201
|
+
*/
|
|
202
|
+
const muted = { fg: 'muted' };
|
|
203
|
+
const plain = {};
|
|
204
|
+
/**
|
|
205
|
+
* The shipped appearance of every token.
|
|
206
|
+
*
|
|
207
|
+
* Defaults reproduce the surface as it looked before tokens existed, except the
|
|
208
|
+
* muted family, which moves from faint-on-a-palette-slot to an explicit grey.
|
|
209
|
+
* A test asserts every token in {@link TUI_TOKENS} appears here.
|
|
210
|
+
*/
|
|
211
|
+
export const DEFAULT_TOKENS = {
|
|
212
|
+
'transcript.user': { fg: 'user', bold: true },
|
|
213
|
+
'transcript.notice': muted,
|
|
214
|
+
'transcript.marker': muted,
|
|
215
|
+
'transcript.reasoning.summary': muted,
|
|
216
|
+
'transcript.reasoning.body': muted,
|
|
217
|
+
'transcript.reasoning.hint': muted,
|
|
218
|
+
'tool.title': { fg: 'warn' },
|
|
219
|
+
'tool.glyph': { fg: 'warn' },
|
|
220
|
+
'tool.args': { fg: 'arg' },
|
|
221
|
+
'tool.stat.added': { fg: 'added' },
|
|
222
|
+
'tool.stat.changed': { fg: 'warn' },
|
|
223
|
+
'tool.stat.removed': { fg: 'removed' },
|
|
224
|
+
'tool.stat.size': muted,
|
|
225
|
+
'tool.stat.separator': muted,
|
|
226
|
+
'tool.detail': muted,
|
|
227
|
+
'tool.hint': muted,
|
|
228
|
+
'tool.failed.title': { fg: 'removed' },
|
|
229
|
+
'tool.failed.glyph': { fg: 'removed' },
|
|
230
|
+
'tool.subcall.title': muted,
|
|
231
|
+
'tool.subcall.args': { fg: 'arg' },
|
|
232
|
+
'tool.diff.header': muted,
|
|
233
|
+
'tool.diff.hunk': muted,
|
|
234
|
+
'tool.diff.added': { fg: 'added' },
|
|
235
|
+
'tool.diff.removed': { fg: 'removed' },
|
|
236
|
+
'tool.read.header': muted,
|
|
237
|
+
'tool.read.lineNumber': muted,
|
|
238
|
+
'tool.read.line': muted,
|
|
239
|
+
'tool.search.path': muted,
|
|
240
|
+
'tool.search.lineNumber': muted,
|
|
241
|
+
'tool.search.match': muted,
|
|
242
|
+
'tool.search.truncated': muted,
|
|
243
|
+
'tool.terminal.cwd': muted,
|
|
244
|
+
'tool.terminal.status': muted,
|
|
245
|
+
'tool.terminal.output': muted,
|
|
246
|
+
'tool.web.url': muted,
|
|
247
|
+
'tool.web.source': muted,
|
|
248
|
+
'tool.web.truncated': muted,
|
|
249
|
+
'tool.generic.detail': muted,
|
|
250
|
+
'markdown.heading': { fg: 'accent', bold: true },
|
|
251
|
+
'markdown.link': { fg: 'accent', underline: true },
|
|
252
|
+
'markdown.linkUrl': muted,
|
|
253
|
+
'markdown.code': { fg: 'accent' },
|
|
254
|
+
'markdown.codeBlock': plain,
|
|
255
|
+
'markdown.codeBlockBorder': muted,
|
|
256
|
+
'markdown.quote': muted,
|
|
257
|
+
'markdown.quoteBorder': muted,
|
|
258
|
+
'markdown.hr': muted,
|
|
259
|
+
'markdown.listBullet': { fg: 'accent' },
|
|
260
|
+
'markdown.bold': { bold: true },
|
|
261
|
+
'markdown.italic': { italic: true },
|
|
262
|
+
'markdown.strikethrough': { strike: true },
|
|
263
|
+
'markdown.underline': { underline: true },
|
|
264
|
+
'picker.title': { bold: true },
|
|
265
|
+
'picker.glyph': { bold: true },
|
|
266
|
+
'picker.note': { bold: true },
|
|
267
|
+
'picker.filter': muted,
|
|
268
|
+
'picker.row': plain,
|
|
269
|
+
'picker.rowCurrent': { bold: true },
|
|
270
|
+
'picker.scrollNewer': muted,
|
|
271
|
+
'picker.scrollOlder': muted,
|
|
272
|
+
'picker.hint': muted,
|
|
273
|
+
'picker.cursor': plain,
|
|
274
|
+
'gate.title': { bold: true },
|
|
275
|
+
'gate.glyphApproval': { bold: true },
|
|
276
|
+
'gate.glyphQuestion': { bold: true },
|
|
277
|
+
'gate.detail': muted,
|
|
278
|
+
'gate.option': plain,
|
|
279
|
+
'gate.optionCurrent': { bold: true },
|
|
280
|
+
'gate.cursor': plain,
|
|
281
|
+
'gate.hint': muted,
|
|
282
|
+
'dock.goal': { bold: true },
|
|
283
|
+
'dock.planMode': { bold: true },
|
|
284
|
+
'dock.todos.heading': { bold: true },
|
|
285
|
+
'dock.todos.pending': muted,
|
|
286
|
+
'dock.todos.inProgress': muted,
|
|
287
|
+
'dock.todos.overflow': muted,
|
|
288
|
+
'dock.subagents.heading': { bold: true },
|
|
289
|
+
'dock.subagents.running': muted,
|
|
290
|
+
'dock.subagents.overflow': muted,
|
|
291
|
+
'dock.jobs.heading': { bold: true },
|
|
292
|
+
'dock.jobs.running': muted,
|
|
293
|
+
'dock.jobs.overflow': muted,
|
|
294
|
+
'status.activity.working': muted,
|
|
295
|
+
'status.activity.ready': muted,
|
|
296
|
+
'status.elapsed': muted,
|
|
297
|
+
'status.agentPreset': muted,
|
|
298
|
+
'status.model': muted,
|
|
299
|
+
'status.effort': muted,
|
|
300
|
+
'status.permission': muted,
|
|
301
|
+
'status.context': muted,
|
|
302
|
+
'status.cache': muted,
|
|
303
|
+
'status.cwd': muted,
|
|
304
|
+
'status.separator': muted,
|
|
305
|
+
'editor.border': muted,
|
|
306
|
+
'editor.selectList.selectedPrefix': { fg: 'accent' },
|
|
307
|
+
'editor.selectList.selectedText': { bold: true },
|
|
308
|
+
'editor.selectList.description': muted,
|
|
309
|
+
'editor.selectList.scrollInfo': muted,
|
|
310
|
+
'editor.selectList.noMatch': muted,
|
|
311
|
+
};
|
|
312
|
+
/** Map a colour specification through the palette, leaving literals alone. */
|
|
313
|
+
function resolveColour(spec, palette) {
|
|
314
|
+
if (typeof spec === 'string' && PALETTE_NAMES.includes(spec)) {
|
|
315
|
+
return palette[spec];
|
|
316
|
+
}
|
|
317
|
+
return spec;
|
|
318
|
+
}
|
|
319
|
+
/** Drop the routing field, so a merged spec carries only what it draws. */
|
|
320
|
+
function withoutInherit(spec) {
|
|
321
|
+
const { inherit: _routing, ...rest } = spec;
|
|
322
|
+
return rest;
|
|
323
|
+
}
|
|
324
|
+
/** The fields an override really wrote, so an explicit `undefined` cannot shadow a default. */
|
|
325
|
+
function writtenFields(spec) {
|
|
326
|
+
if (spec === undefined)
|
|
327
|
+
return {};
|
|
328
|
+
const written = {};
|
|
329
|
+
for (const [key, value] of Object.entries(spec)) {
|
|
330
|
+
if (value !== undefined)
|
|
331
|
+
written[key] = value;
|
|
332
|
+
}
|
|
333
|
+
return written;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Merge one token's default, its `inherit` target, and the reader's override.
|
|
337
|
+
*
|
|
338
|
+
* The inherited token's fields replace this token's defaults, because that is
|
|
339
|
+
* what "start from another token" means; the reader's own fields still win.
|
|
340
|
+
* A path-scoped set turns a cycle into a stop, and still lets two branches
|
|
341
|
+
* inherit one token rather than sharing a single visit.
|
|
342
|
+
*/
|
|
343
|
+
export function mergeTokenSpec(token, overrides) {
|
|
344
|
+
const visiting = new Set();
|
|
345
|
+
const merge = (name) => {
|
|
346
|
+
if (visiting.has(name))
|
|
347
|
+
return {};
|
|
348
|
+
visiting.add(name);
|
|
349
|
+
const own = DEFAULT_TOKENS[name];
|
|
350
|
+
const override = overrides.get(name);
|
|
351
|
+
const parent = override?.inherit ?? own.inherit;
|
|
352
|
+
const inherited = parent === undefined ? {} : merge(parent);
|
|
353
|
+
visiting.delete(name);
|
|
354
|
+
return { ...withoutInherit(own), ...inherited, ...withoutInherit(writtenFields(override)) };
|
|
355
|
+
};
|
|
356
|
+
return merge(token);
|
|
357
|
+
}
|
|
358
|
+
/** Turn a colour SGR sequence into the parameter list it belongs to. */
|
|
359
|
+
function colourParams(sequence) {
|
|
360
|
+
return sequence === '' ? undefined : sequence.slice('\u001B['.length, -1);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Resolve one token into the escapes a renderer needs.
|
|
364
|
+
*
|
|
365
|
+
* Faint is dropped once a colour is chosen: stacking it on a deliberate grey is
|
|
366
|
+
* what made the old output differ per terminal.
|
|
367
|
+
*/
|
|
368
|
+
export function resolveToken(token, overrides, palette, mode) {
|
|
369
|
+
const merged = mergeTokenSpec(token, overrides);
|
|
370
|
+
if (merged.hidden === true)
|
|
371
|
+
return { prefix: '', suffix: '', glyph: '', hidden: true };
|
|
372
|
+
// With no colour capability the whole promise is "emit nothing", which
|
|
373
|
+
// includes attributes: a bold word is still styling a reader turned off.
|
|
374
|
+
if (mode === 'none')
|
|
375
|
+
return { prefix: '', suffix: '', glyph: merged.glyph ?? '', hidden: false };
|
|
376
|
+
const fg = merged.fg;
|
|
377
|
+
const bg = merged.bg;
|
|
378
|
+
const codes = [];
|
|
379
|
+
if (merged.bold === true)
|
|
380
|
+
codes.push('1');
|
|
381
|
+
if (merged.dim === true && fg === undefined)
|
|
382
|
+
codes.push('2');
|
|
383
|
+
if (merged.italic === true)
|
|
384
|
+
codes.push('3');
|
|
385
|
+
if (merged.underline === true)
|
|
386
|
+
codes.push('4');
|
|
387
|
+
if (merged.strike === true)
|
|
388
|
+
codes.push('9');
|
|
389
|
+
for (const params of [
|
|
390
|
+
fg === undefined ? undefined : colourParams(sgrPrefix(resolveColour(fg, palette), mode)),
|
|
391
|
+
bg === undefined ? undefined : colourParams(sgrBackgroundPrefix(resolveColour(bg, palette), mode)),
|
|
392
|
+
]) {
|
|
393
|
+
if (params !== undefined)
|
|
394
|
+
codes.push(params);
|
|
395
|
+
}
|
|
396
|
+
// One sequence for attributes and colours together: two escapes in a row would
|
|
397
|
+
// let a renderer that re-orders them drop half the style.
|
|
398
|
+
const prefix = codes.length === 0 ? '' : `\u001B[${codes.join(';')}m`;
|
|
399
|
+
return { prefix, suffix: prefix === '' ? '' : RESET, glyph: merged.glyph ?? '', hidden: false };
|
|
400
|
+
}
|
|
401
|
+
//# sourceMappingURL=theme-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-tokens.js","sourceRoot":"","sources":["../src/theme-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,mBAAmB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEvF,MAAM,KAAK,GAAG,WAAW,CAAA;AAEzB;;;;;;GAMG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAA;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAA;AAEzC,oEAAoE;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAU,CAAA;AAiC5H,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MA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,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACrE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAG,MAAM,CAAC,KAA4B,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AACzH,CAAC"}
|
package/lib/theme.d.ts
CHANGED
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Styling the surface applies, and the editor/select themes pi-tui needs. */
|
|
1
|
+
import { type EditorTheme, type MarkdownTheme } from '@earendil-works/pi-tui';
|
|
2
|
+
import { type ColourMode } from './theme-capability.ts';
|
|
3
|
+
import { type TuiToken } from './theme-tokens.ts';
|
|
4
|
+
import type { ThemeOverrides } from './theme-settings.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Styling the surface applies, and the editor/select themes pi-tui needs.
|
|
7
|
+
*
|
|
8
|
+
* Every element is drawn by naming its token, so a reader's override reaches
|
|
9
|
+
* it without the renderer knowing what the element is for.
|
|
10
|
+
*/
|
|
12
11
|
export interface TuiTheme {
|
|
12
|
+
readonly revision: number;
|
|
13
13
|
readonly color: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/** A boundary in the conversation rather than something anyone said. */
|
|
23
|
-
marker(text: string): string;
|
|
24
|
-
/** Structure the reader scans for: headings, links, inline code, list bullets. */
|
|
25
|
-
accent(text: string): string;
|
|
26
|
-
italic(text: string): string;
|
|
14
|
+
/** Draw one named element. */
|
|
15
|
+
style(token: TuiToken, text: string): string;
|
|
16
|
+
/** Cut a row to a width, so no renderer has to reach for the raw helper. */
|
|
17
|
+
cut(text: string, width: number, ellipsis?: string): string;
|
|
18
|
+
/** The mark that introduces an element, empty unless the reader set one. */
|
|
19
|
+
glyph(token: TuiToken): string;
|
|
20
|
+
/** Whether an element is drawn at all. */
|
|
21
|
+
visible(token: TuiToken): boolean;
|
|
27
22
|
readonly editor: EditorTheme;
|
|
28
23
|
readonly markdown: MarkdownTheme;
|
|
29
24
|
}
|
|
30
25
|
/**
|
|
31
|
-
*
|
|
26
|
+
* Build the surface theme.
|
|
32
27
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
28
|
+
* Every token is resolved once, when the theme is built, rather than per frame:
|
|
29
|
+
* a repaint walks the whole transcript and re-resolving a palette chain for
|
|
30
|
+
* every row would pay for the same answer thousands of times. A settings change
|
|
31
|
+
* builds a new theme instead, which is also what makes the swap atomic.
|
|
37
32
|
*/
|
|
38
|
-
export declare function
|
|
33
|
+
export declare function createTheme(mode?: ColourMode, overrides?: ThemeOverrides): TuiTheme;
|
|
39
34
|
/**
|
|
40
|
-
*
|
|
35
|
+
* An editor theme that follows a moving source.
|
|
41
36
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
37
|
+
* The editor keeps the theme it was built with for the life of the session, so
|
|
38
|
+
* a settings change has to reach it through a stable object instead of by
|
|
39
|
+
* replacing the one it captured.
|
|
45
40
|
*/
|
|
46
|
-
export declare function
|
|
41
|
+
export declare function forwardEditorTheme(source: () => EditorTheme): EditorTheme;
|
|
42
|
+
/** The markdown counterpart of {@link forwardEditorTheme}. */
|
|
43
|
+
export declare function forwardMarkdownTheme(source: () => MarkdownTheme): MarkdownTheme;
|
|
47
44
|
//# sourceMappingURL=theme.d.ts.map
|
package/lib/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","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