@textui/core 0.7.0 → 0.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/dist/app/app.d.ts.map +1 -1
- package/dist/app/app.js +8 -1
- package/dist/core/i18n.d.ts +1 -1
- package/dist/core/i18n.d.ts.map +1 -1
- package/dist/core/i18n.js +2 -2
- package/dist/jsx/intrinsics.d.ts +23 -0
- package/dist/jsx/intrinsics.d.ts.map +1 -1
- package/dist/runtime/paint.js +12 -2
- package/dist/runtime/style.d.ts +17 -7
- package/dist/runtime/style.d.ts.map +1 -1
- package/dist/runtime/style.js +66 -6
- package/dist/themes/builtin.d.ts +4 -13
- package/dist/themes/builtin.d.ts.map +1 -1
- package/dist/themes/builtin.js +160 -48
- package/dist/themes/registry.d.ts.map +1 -1
- package/dist/themes/registry.js +26 -0
- package/dist/types/i18n.d.ts +9 -1
- package/dist/types/i18n.d.ts.map +1 -1
- package/dist/types/style.d.ts +53 -14
- package/dist/types/style.d.ts.map +1 -1
- package/dist/types/theme.d.ts +37 -3
- package/dist/types/theme.d.ts.map +1 -1
- package/dist/util/text.d.ts +9 -0
- package/dist/util/text.d.ts.map +1 -1
- package/dist/util/text.js +16 -0
- package/package.json +1 -1
- package/src/app/app.ts +8 -1
- package/src/core/i18n.ts +2 -2
- package/src/jsx/intrinsics.ts +25 -0
- package/src/runtime/paint.ts +11 -2
- package/src/runtime/style.ts +73 -9
- package/src/themes/builtin.ts +165 -49
- package/src/themes/registry.ts +23 -0
- package/src/types/i18n.ts +9 -1
- package/src/types/style.ts +85 -18
- package/src/types/theme.ts +37 -3
- package/src/util/text.ts +15 -0
package/dist/themes/builtin.js
CHANGED
|
@@ -7,6 +7,72 @@
|
|
|
7
7
|
* airy report or a workbench without a component knowing which - so the
|
|
8
8
|
* difference lives here, in border style and density, not in the catalog.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* A selection, in the two states it has.
|
|
12
|
+
*
|
|
13
|
+
* `selected` is "this is the current one" and `focus` is the same row while
|
|
14
|
+
* the component holds the keyboard, so a theme states the bright fill once and
|
|
15
|
+
* the dimmer one for everything the reader has walked away from. They were one
|
|
16
|
+
* name once - `active` meant both this and pressed - and a word that means two
|
|
17
|
+
* things gets filled with either.
|
|
18
|
+
*
|
|
19
|
+
* Both name tokens rather than colours, which is the point of the whole
|
|
20
|
+
* arrangement: retint the palette and every component that has not said
|
|
21
|
+
* otherwise moves with it, while a theme that states `components.List.focused`
|
|
22
|
+
* moves the list and leaves the table where it was.
|
|
23
|
+
*/
|
|
24
|
+
const SELECTION_FOCUSED = { bg: 'selected', fg: 'onSelected', bold: true };
|
|
25
|
+
const SELECTION_UNFOCUSED = { bg: 'active', fg: 'onActive' };
|
|
26
|
+
const SELECTION_HOVER = { bg: 'hover', fg: 'onActive' };
|
|
27
|
+
// The other way to draw a selection: reverse video, which is legible whatever
|
|
28
|
+
// a theme's own two colours are. Left beside the three above while that is
|
|
29
|
+
// decided - nothing reads them yet.
|
|
30
|
+
// const SELECTION_DEFAULT: Style = { bg: 'default', fg: 'default', inverse: true };
|
|
31
|
+
// const SELECTION_DIMMED: Style = { bg: 'default', fg: 'default', inverse: true, dim: true };
|
|
32
|
+
/**
|
|
33
|
+
* The state colours every built-in theme starts from.
|
|
34
|
+
*
|
|
35
|
+
* Stated once and spread into `dark` and `light` because a theme that
|
|
36
|
+
* extends either inherits it whole: the entries name tokens, so `console`
|
|
37
|
+
* keeps its own `selected` and gets its own fills, without restating a single
|
|
38
|
+
* component. That is also what makes them the *defaults* - a theme states
|
|
39
|
+
* `components` to differ, and says nothing here about what it does not.
|
|
40
|
+
*/
|
|
41
|
+
const STATE_STYLES = {
|
|
42
|
+
List: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
43
|
+
Tree: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
44
|
+
Table: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
45
|
+
// The field's own selection, over the text it covers. Same pair, same
|
|
46
|
+
// reason: a selection left visible in an unfocused field says what is on
|
|
47
|
+
// the clipboard, and saying it as loudly as the live one would put two
|
|
48
|
+
// selections on the screen.
|
|
49
|
+
TextArea: { selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
50
|
+
// A marked line is a selection. The caret line is that selection plus the
|
|
51
|
+
// keyboard, so it takes the next fill up rather than a colour of its own.
|
|
52
|
+
CodeViewer: { selected: SELECTION_UNFOCUSED, focus: SELECTION_HOVER },
|
|
53
|
+
Menu: { base: { fg: 'text' }, selected: SELECTION_UNFOCUSED, focus: SELECTION_FOCUSED },
|
|
54
|
+
TextInput: { base: { fg: 'text' } },
|
|
55
|
+
// A tab is open, not selected. Dimming it when the strip does not have the
|
|
56
|
+
// keyboard would say no document is open, which is a different claim and a
|
|
57
|
+
// wrong one - so it has one state and no second.
|
|
58
|
+
//
|
|
59
|
+
// Whether a tab is *filled* is a property of the variant rather than of the
|
|
60
|
+
// state: a solid tab is, an underline one is not. So the pair is stated for
|
|
61
|
+
// the state and the fill only for the variant that has one.
|
|
62
|
+
Tabs: { selected: { fg: 'onSelected' }, 'solid.selected': SELECTION_FOCUSED },
|
|
63
|
+
// The chat rows take the same fills, and for the same reason. `ToolCallRow`
|
|
64
|
+
// and `ReasoningBlock` are selections in a transcript that the caller
|
|
65
|
+
// names, so they have `selected` and no `focus`; a `ComposerChip` lights up
|
|
66
|
+
// only while it holds the keyboard, so it has `focus` and no `selected`.
|
|
67
|
+
ToolCallRow: { selected: SELECTION_FOCUSED },
|
|
68
|
+
ReasoningBlock: { selected: SELECTION_FOCUSED },
|
|
69
|
+
ComposerChip: { focus: SELECTION_FOCUSED },
|
|
70
|
+
// A range in a document is a selection, drawn in reverse video so it keeps
|
|
71
|
+
// the colours the text under it was already drawn in - the syntax of a
|
|
72
|
+
// selection is the syntax of the code it covers - and shows whether or not
|
|
73
|
+
// the theme's `active` is a fill.
|
|
74
|
+
Editor: { selected: { inverse: true } },
|
|
75
|
+
};
|
|
10
76
|
export const DARK = {
|
|
11
77
|
id: 'dark',
|
|
12
78
|
name: 'Dark',
|
|
@@ -22,9 +88,9 @@ export const DARK = {
|
|
|
22
88
|
borderStrong: '#484f58',
|
|
23
89
|
borderSubtle: '#21262d',
|
|
24
90
|
divider: '#484f58',
|
|
25
|
-
text: '#
|
|
91
|
+
text: '#f3e6f1',
|
|
26
92
|
muted: '#8b949e',
|
|
27
|
-
subtle: '#
|
|
93
|
+
subtle: '#546f94',
|
|
28
94
|
inverted: '#0d1117',
|
|
29
95
|
accent: '#58a6ff',
|
|
30
96
|
primary: '#388bfd',
|
|
@@ -43,8 +109,10 @@ export const DARK = {
|
|
|
43
109
|
onWarning: '#0d1117',
|
|
44
110
|
onDanger: '#0d1117',
|
|
45
111
|
hover: '#1f2937',
|
|
46
|
-
active: '
|
|
47
|
-
|
|
112
|
+
active: 'default',
|
|
113
|
+
onActive: '#3191ff',
|
|
114
|
+
selected: 'default',
|
|
115
|
+
onSelected: '#3191ff',
|
|
48
116
|
focus: '#58a6ff',
|
|
49
117
|
disabled: '#484f58',
|
|
50
118
|
scrim: '#010409',
|
|
@@ -52,6 +120,7 @@ export const DARK = {
|
|
|
52
120
|
shadow: '#010409',
|
|
53
121
|
},
|
|
54
122
|
spacing: { none: 0, xs: 0, sm: 1, md: 1, lg: 2, xl: 3 },
|
|
123
|
+
components: { ...STATE_STYLES },
|
|
55
124
|
};
|
|
56
125
|
export const LIGHT = {
|
|
57
126
|
id: 'light',
|
|
@@ -89,8 +158,10 @@ export const LIGHT = {
|
|
|
89
158
|
onWarning: '#ffffff',
|
|
90
159
|
onDanger: '#ffffff',
|
|
91
160
|
hover: '#eaeef2',
|
|
92
|
-
active: '
|
|
93
|
-
|
|
161
|
+
active: 'default',
|
|
162
|
+
onActive: '#0969da',
|
|
163
|
+
selected: 'default',
|
|
164
|
+
onSelected: '#0969da',
|
|
94
165
|
focus: '#0969da',
|
|
95
166
|
disabled: '#8c959f',
|
|
96
167
|
scrim: '#8c959f',
|
|
@@ -98,6 +169,7 @@ export const LIGHT = {
|
|
|
98
169
|
shadow: '#d0d7de',
|
|
99
170
|
},
|
|
100
171
|
spacing: { none: 0, xs: 0, sm: 1, md: 1, lg: 2, xl: 3 },
|
|
172
|
+
components: { ...STATE_STYLES },
|
|
101
173
|
};
|
|
102
174
|
/** Dense, bordered, high contrast. Every region is a labelled box. */
|
|
103
175
|
export const CONSOLE = {
|
|
@@ -122,11 +194,16 @@ export const CONSOLE = {
|
|
|
122
194
|
//
|
|
123
195
|
// The two selection backgrounds are picked rather than derived: `selected`
|
|
124
196
|
// carries `inverted` text so it has to be light, and `active` carries
|
|
125
|
-
// `text` so it has to be dark. Same hue, opposite ends.
|
|
197
|
+
// `text` so it has to be dark. Same hue, opposite ends. `active` is what
|
|
198
|
+
// a selection looks like when the component does not have the keyboard -
|
|
199
|
+
// it is the dim end of the pair, not a pressed control.
|
|
126
200
|
primary: '#88c0d0',
|
|
127
201
|
info: '#88c0d0',
|
|
128
202
|
selected: '#6ba3b2',
|
|
129
203
|
active: '#1e3d47',
|
|
204
|
+
// Stated, because `dark` states its own for a selection with no fill.
|
|
205
|
+
onSelected: '#0a0e14',
|
|
206
|
+
onActive: '#d8dee9',
|
|
130
207
|
onAccent: '#0a0e14',
|
|
131
208
|
onPrimary: '#0a0e14',
|
|
132
209
|
onInfo: '#0a0e14',
|
|
@@ -166,6 +243,7 @@ export const PAPER = {
|
|
|
166
243
|
warning: '#d29922',
|
|
167
244
|
danger: '#f85149',
|
|
168
245
|
info: '#58a6ff',
|
|
246
|
+
/* ---- */
|
|
169
247
|
onAccent: '#0d1117',
|
|
170
248
|
onDefault: '#0d1117',
|
|
171
249
|
onPrimary: '#0d1117',
|
|
@@ -175,17 +253,22 @@ export const PAPER = {
|
|
|
175
253
|
onInfo: '#0d1117',
|
|
176
254
|
onWarning: '#0d1117',
|
|
177
255
|
onDanger: '#0d1117',
|
|
256
|
+
/* ---- */
|
|
178
257
|
hover: '#1f2937',
|
|
179
|
-
active: '
|
|
180
|
-
|
|
258
|
+
active: 'default',
|
|
259
|
+
onActive: '#3191ff',
|
|
260
|
+
selected: 'default',
|
|
261
|
+
onSelected: '#58a6ff',
|
|
181
262
|
focus: '#58a6ff',
|
|
182
263
|
disabled: '#484f58',
|
|
264
|
+
/* ---- */
|
|
183
265
|
scrim: '#010409',
|
|
184
266
|
cursor: 'default',
|
|
185
267
|
shadow: '#010409',
|
|
186
268
|
},
|
|
187
269
|
spacing: { none: 0, xs: 1, sm: 1, md: 2, lg: 3, xl: 4 },
|
|
188
270
|
components: {
|
|
271
|
+
...STATE_STYLES,
|
|
189
272
|
Panel: { base: { border: 'none', padding: [1, 2] } },
|
|
190
273
|
Button: { base: { padding: [0, 2] } },
|
|
191
274
|
},
|
|
@@ -217,6 +300,9 @@ export const PAPER_LIGHT = {
|
|
|
217
300
|
hover: '#f7f1e7',
|
|
218
301
|
active: '#efe4d2',
|
|
219
302
|
selected: '#eadcc6',
|
|
303
|
+
// Stated, because `light` states its own for a selection with no fill.
|
|
304
|
+
onActive: '#2b2a27',
|
|
305
|
+
onSelected: '#2b2a27',
|
|
220
306
|
inverted: '#2b2a27',
|
|
221
307
|
focus: '#b4531f',
|
|
222
308
|
},
|
|
@@ -226,6 +312,48 @@ export const PAPER_LIGHT = {
|
|
|
226
312
|
Button: { base: { padding: [0, 2] } },
|
|
227
313
|
},
|
|
228
314
|
};
|
|
315
|
+
/**
|
|
316
|
+
* Paper, after dark.
|
|
317
|
+
*
|
|
318
|
+
* The same airy, borderless, warm-accented character as `paper` - the point of
|
|
319
|
+
* it is the restraint, not the brightness - with the ink and the page swapped.
|
|
320
|
+
* A warm dark rather than a blue one, so the two read as one family and a
|
|
321
|
+
* reader moving between them is not moving between two different products.
|
|
322
|
+
*/
|
|
323
|
+
export const PAPER_DARK = {
|
|
324
|
+
id: 'paper-dark',
|
|
325
|
+
name: 'Paper Dark',
|
|
326
|
+
appearance: 'dark',
|
|
327
|
+
extends: 'dark',
|
|
328
|
+
border: 'none',
|
|
329
|
+
density: 'airy',
|
|
330
|
+
colors: {
|
|
331
|
+
canvas: '#1c1a17',
|
|
332
|
+
surface: '#1c1a17',
|
|
333
|
+
surfaceAlt: '#26231f',
|
|
334
|
+
border: '#3a352e',
|
|
335
|
+
borderSubtle: '#2a2621',
|
|
336
|
+
divider: 'default',
|
|
337
|
+
subtle: '#db8c4c',
|
|
338
|
+
text: '#e8e3d9',
|
|
339
|
+
muted: '#9a9287',
|
|
340
|
+
accent: '#e0873f',
|
|
341
|
+
primary: '#e0873f',
|
|
342
|
+
// The same restraint, the other way up.
|
|
343
|
+
hover: '#26231f',
|
|
344
|
+
active: 'default',
|
|
345
|
+
onActive: '#e0873f',
|
|
346
|
+
selected: 'default',
|
|
347
|
+
onSelected: '#e0873f',
|
|
348
|
+
inverted: '#f4efe6',
|
|
349
|
+
focus: '#e0873f',
|
|
350
|
+
},
|
|
351
|
+
spacing: { none: 0, xs: 1, sm: 1, md: 2, lg: 3, xl: 4 },
|
|
352
|
+
components: {
|
|
353
|
+
Panel: { base: { border: 'none', padding: [1, 2] } },
|
|
354
|
+
Button: { base: { padding: [0, 2] } },
|
|
355
|
+
},
|
|
356
|
+
};
|
|
229
357
|
/** Rounded chrome around a persistent frame. */
|
|
230
358
|
export const WORKBENCH = {
|
|
231
359
|
id: 'workbench',
|
|
@@ -255,6 +383,10 @@ export const WORKBENCH = {
|
|
|
255
383
|
hover: '#313244',
|
|
256
384
|
active: '#45475a',
|
|
257
385
|
selected: '#585b70',
|
|
386
|
+
// The selection is a mid grey, so the light text is what reads on it; the
|
|
387
|
+
// inherited `inverted` is darker than the fill and nearly disappears.
|
|
388
|
+
onSelected: '#cdd6f4',
|
|
389
|
+
onActive: '#cdd6f4',
|
|
258
390
|
focus: '#89b4fa',
|
|
259
391
|
scrim: '#11111b',
|
|
260
392
|
},
|
|
@@ -267,7 +399,12 @@ export const MONO = {
|
|
|
267
399
|
id: 'mono',
|
|
268
400
|
name: 'Monochrome',
|
|
269
401
|
appearance: 'dark',
|
|
402
|
+
// The theme's own colours are all `default`; this is what makes that true of
|
|
403
|
+
// the ones a component states for itself, which is the difference between a
|
|
404
|
+
// palette that happens to be grey and a theme with no colour in it.
|
|
405
|
+
monochrome: true,
|
|
270
406
|
border: 'ascii',
|
|
407
|
+
// border: 'none',
|
|
271
408
|
cursor: 'underline',
|
|
272
409
|
// Chosen, not downgraded to: this theme is ascii on a terminal that could
|
|
273
410
|
// draw anything, so the rule has to say so too.
|
|
@@ -308,46 +445,21 @@ export const MONO = {
|
|
|
308
445
|
cursor: 'default',
|
|
309
446
|
shadow: 'default',
|
|
310
447
|
},
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* Paper, after dark.
|
|
314
|
-
*
|
|
315
|
-
* The same airy, borderless, warm-accented character as `paper` - the point of
|
|
316
|
-
* it is the restraint, not the brightness - with the ink and the page swapped.
|
|
317
|
-
* A warm dark rather than a blue one, so the two read as one family and a
|
|
318
|
-
* reader moving between them is not moving between two different products.
|
|
319
|
-
*/
|
|
320
|
-
export const PAPER_DARK = {
|
|
321
|
-
id: 'paper-dark',
|
|
322
|
-
name: 'Paper Dark',
|
|
323
|
-
appearance: 'dark',
|
|
324
|
-
extends: 'dark',
|
|
325
|
-
border: 'none',
|
|
326
|
-
density: 'airy',
|
|
327
|
-
colors: {
|
|
328
|
-
canvas: '#1c1a17',
|
|
329
|
-
surface: '#1c1a17',
|
|
330
|
-
surfaceAlt: '#26231f',
|
|
331
|
-
border: '#3a352e',
|
|
332
|
-
borderSubtle: '#2a2621',
|
|
333
|
-
divider: 'default',
|
|
334
|
-
subtle: '#db8c4c',
|
|
335
|
-
text: '#e8e3d9',
|
|
336
|
-
muted: '#9a9287',
|
|
337
|
-
accent: '#e0873f',
|
|
338
|
-
primary: '#e0873f',
|
|
339
|
-
// The same restraint, the other way up.
|
|
340
|
-
hover: '#26231f',
|
|
341
|
-
active: '#332e27',
|
|
342
|
-
selected: '#3d362c',
|
|
343
|
-
inverted: '#f4efe6',
|
|
344
|
-
focus: '#e0873f',
|
|
345
|
-
},
|
|
346
|
-
spacing: { none: 0, xs: 1, sm: 1, md: 2, lg: 3, xl: 4 },
|
|
347
448
|
components: {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
449
|
+
List: { selected: { bold: true }, focus: { bold: true } },
|
|
450
|
+
Tree: { selected: { bold: true }, focus: { bold: true } },
|
|
451
|
+
Table: { selected: { bold: true }, focus: { bold: true } },
|
|
452
|
+
TextArea: { selected: { bold: true }, focus: { bold: true } },
|
|
453
|
+
CodeViewer: { selected: { bold: true }, focus: { bold: true } },
|
|
454
|
+
Menu: { selected: { bold: true }, focus: { bold: true } },
|
|
455
|
+
Tabs: { selected: { bold: true }, 'solid.selected': { bold: true } },
|
|
456
|
+
ToolCallRow: { selected: { bold: true } },
|
|
457
|
+
ReasoningBlock: { selected: { bold: true } },
|
|
458
|
+
ComposerChip: { focus: { bold: true } },
|
|
459
|
+
Editor: { selected: { bold: true } },
|
|
460
|
+
Panel: { base: { border: 'ascii', padding: [0, 1] } },
|
|
461
|
+
Button: { base: { padding: [0, 1] } },
|
|
462
|
+
}
|
|
351
463
|
};
|
|
352
464
|
export const BUILTIN_THEMES = [
|
|
353
465
|
DARK, LIGHT, CONSOLE, PAPER, PAPER_LIGHT, PAPER_DARK, WORKBENCH, MONO,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/themes/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAAe,aAAa,EAC3D,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/themes/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,eAAe,EAAe,aAAa,EAC3D,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAsDzD,qBAAa,MAAO,YAAW,aAAa;IAC1C,OAAO,CAAC,IAAI,CAAsC;IAClD,OAAO,CAAC,KAAK,CAAoC;gBAErC,OAAO,GAAE,eAAe,EAAmB;IAIvD,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU;IAS1C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAK5B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI5C,IAAI,IAAI,eAAe,EAAE;IAIzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,aAAa;CA6K/D;AAED,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,GAAG,MAAM,CAEhE"}
|
package/dist/themes/registry.js
CHANGED
|
@@ -13,6 +13,7 @@ const FALLBACK_COLORS = {
|
|
|
13
13
|
onDefault: 'default', onMuted: 'default',
|
|
14
14
|
onAccent: 'default', onPrimary: 'default', onSecondary: 'default',
|
|
15
15
|
onSuccess: 'default', onWarning: 'default', onDanger: 'default', onInfo: 'default',
|
|
16
|
+
onSelected: 'default', onActive: 'default',
|
|
16
17
|
hover: 'default', active: 'default', selected: 'default', focus: 'default',
|
|
17
18
|
disabled: 'default', scrim: 'default', cursor: 'default', shadow: 'default',
|
|
18
19
|
};
|
|
@@ -105,6 +106,7 @@ export class Themes {
|
|
|
105
106
|
// opts in rather than out.
|
|
106
107
|
let tableRules = 'header';
|
|
107
108
|
let density = 'normal';
|
|
109
|
+
let monochrome = false;
|
|
108
110
|
const components = {};
|
|
109
111
|
let syntaxOverrides = {};
|
|
110
112
|
for (const def of chain) {
|
|
@@ -143,10 +145,28 @@ export class Themes {
|
|
|
143
145
|
tableRules = def.tableRules;
|
|
144
146
|
if (def.density)
|
|
145
147
|
density = def.density;
|
|
148
|
+
if (def.monochrome !== undefined)
|
|
149
|
+
monochrome = def.monochrome;
|
|
146
150
|
for (const [name, variants] of Object.entries(def.components ?? {})) {
|
|
147
151
|
components[name] = { ...components[name], ...variants };
|
|
148
152
|
}
|
|
149
153
|
}
|
|
154
|
+
// What is written on a filled row, derived rather than restated.
|
|
155
|
+
//
|
|
156
|
+
// A selection background is only half a pair: `selected` carries
|
|
157
|
+
// `inverted` and `active` carries `text`. Stated as two independent
|
|
158
|
+
// colours, a theme that restates one half - `paper-light` restates
|
|
159
|
+
// `inverted`, `paper` leaves `text` as the terminal's - would take the
|
|
160
|
+
// other half from the theme it extends, or from the terminal, and a row
|
|
161
|
+
// could come out unreadable with nothing in the theme saying so.
|
|
162
|
+
//
|
|
163
|
+
// So the pair follows the theme's own values unless it says otherwise. A
|
|
164
|
+
// theme that wants a different colour on a fill states it, which is what
|
|
165
|
+
// `paper` does for `active`.
|
|
166
|
+
if (colors.onSelected === 'default')
|
|
167
|
+
colors.onSelected = colors.inverted;
|
|
168
|
+
if (colors.onActive === 'default')
|
|
169
|
+
colors.onActive = colors.text;
|
|
150
170
|
// A colourless terminal gets no colour, whatever the theme says.
|
|
151
171
|
if (caps.colorDepth === 0) {
|
|
152
172
|
for (const token of Object.keys(colors)) {
|
|
@@ -175,6 +195,7 @@ export class Themes {
|
|
|
175
195
|
id: leaf.id,
|
|
176
196
|
name: leaf.name,
|
|
177
197
|
appearance: leaf.appearance,
|
|
198
|
+
monochrome,
|
|
178
199
|
colors,
|
|
179
200
|
spacing,
|
|
180
201
|
glyphs,
|
|
@@ -186,6 +207,11 @@ export class Themes {
|
|
|
186
207
|
components,
|
|
187
208
|
syntax,
|
|
188
209
|
color(token) {
|
|
210
|
+
// A monochrome theme has no colour to give, and that has to include the
|
|
211
|
+
// literal a component states for itself - otherwise the one theme whose
|
|
212
|
+
// whole point is no colour is the one that cannot promise it.
|
|
213
|
+
if (monochrome)
|
|
214
|
+
return 'default';
|
|
189
215
|
if (token in colors)
|
|
190
216
|
return colors[token];
|
|
191
217
|
// Not a token: a literal colour passed straight through.
|
package/dist/types/i18n.d.ts
CHANGED
|
@@ -20,7 +20,15 @@ export interface I18n {
|
|
|
20
20
|
date(value: Date | number, options?: Intl.DateTimeFormatOptions): string;
|
|
21
21
|
relative(value: number, unit: Intl.RelativeTimeFormatUnit): string;
|
|
22
22
|
list(items: string[], options?: Intl.ListFormatOptions): string;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The form the locale's plural rules pick for `count`, with `{count}` and
|
|
25
|
+
* anything the sentence needs around it.
|
|
26
|
+
*
|
|
27
|
+
* `values` carries what else the form names - a limit, a glyph, the total a
|
|
28
|
+
* count is out of - because a sentence that inflects a noun is the whole
|
|
29
|
+
* sentence and not a noun with a number in front of it.
|
|
30
|
+
*/
|
|
31
|
+
plural(count: number, forms: Record<string, string>, values?: Record<string, unknown>): string;
|
|
24
32
|
onChange(fn: (locale: LocaleId) => void): Disposable;
|
|
25
33
|
}
|
|
26
34
|
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/types/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/types/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,QAAQ,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC;IACjB,S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AAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,CAAC;IAChD,OAAO,IAAI,QAAQ,EAAE,CAAC;IACtB;;;OAGG;IACH,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5E,2DAA2D;IAC3D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC;IAClE,IAAI,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,sBAAsB,GAAG,MAAM,CAAC;IACnE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC;IAChE;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAC/F,QAAQ,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,GAAG,UAAU,CAAC;CACtD"}
|
package/dist/types/style.d.ts
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
import type { Color } from './cells.js';
|
|
2
2
|
import type { EdgeSpec } from './geometry.js';
|
|
3
3
|
/**
|
|
4
|
-
* Semantic theme tokens
|
|
5
|
-
*
|
|
6
|
-
* a
|
|
4
|
+
* Semantic theme tokens, split by the channel each one is written in.
|
|
5
|
+
*
|
|
6
|
+
* A component names a role, never a colour - which is what lets one catalog
|
|
7
|
+
* render the same under a light theme, a dark theme and a 16-colour ssh
|
|
8
|
+
* session. The role is not enough on its own, though: a token also has to be
|
|
9
|
+
* somewhere it can actually be drawn. `canvas` is a fill, `onAccent` is
|
|
10
|
+
* writing, `borderStrong` is a rule - and one union for all three is what let
|
|
11
|
+
* `fg: 'canvas'` and `border: 'onAccent'` compile, to be found by somebody
|
|
12
|
+
* looking at a frame.
|
|
13
|
+
*
|
|
14
|
+
* So each token is listed under the channels it may appear in, and `Style`
|
|
15
|
+
* takes the matching one. A token may appear in more than one - the tones are
|
|
16
|
+
* both a fill and a colour of their own - and a literal colour is the shared
|
|
17
|
+
* escape out of all three.
|
|
18
|
+
*
|
|
19
|
+
* A token missing from a list is a token that channel cannot use. Adding one
|
|
20
|
+
* is a decision about where it reads, not a convenience.
|
|
7
21
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
/** Colours a cell's foreground may be. */
|
|
23
|
+
export type FgColorToken = 'accent' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'hover' | 'active' | 'selected' | 'focus' | 'disabled' | 'text' | 'muted' | 'subtle' | 'inverted' | 'borderSubtle' | 'cursor' | 'onDefault' | 'onMuted' | 'onAccent' | 'onPrimary' | 'onSecondary' | 'onSuccess' | 'onWarning' | 'onDanger' | 'onInfo' | 'onSelected' | 'onActive';
|
|
24
|
+
/** Colours a cell's background may be. */
|
|
25
|
+
export type BgColorToken = 'canvas' | 'surface' | 'surfaceAlt' | 'overlay' | 'hover' | 'active' | 'selected' | 'focus' | 'disabled' | 'accent' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'scrim' | 'cursor' | 'shadow';
|
|
26
|
+
/** Colours a rule may be. */
|
|
27
|
+
export type BorderColorToken = 'border' | 'borderStrong' | 'borderSubtle' | 'divider' | 'accent' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'hover' | 'focus' | 'muted' | 'subtle';
|
|
28
|
+
/** Every token, for the places that take a colour without saying which. */
|
|
29
|
+
export type ColorToken = FgColorToken | BgColorToken | BorderColorToken;
|
|
30
|
+
/** A foreground: an `FgColorToken`, or a literal colour. */
|
|
31
|
+
export type FgColor = FgColorToken | Color;
|
|
32
|
+
/** A background: a `BgColorToken`, or a literal colour. */
|
|
33
|
+
export type BgColor = BgColorToken | Color;
|
|
34
|
+
/** A rule: a `BorderColorToken`, or a literal colour. */
|
|
35
|
+
export type BorderColor = BorderColorToken | Color;
|
|
36
|
+
/** Anywhere a colour is accepted, any token and any literal are accepted too. */
|
|
10
37
|
export type StyleColor = ColorToken | Color;
|
|
11
38
|
export type Dimension = number | `${number}%` | 'auto';
|
|
12
39
|
export type BorderStyle = 'none' | 'single' | 'double' | 'round' | 'bold' | 'dashed' | 'ascii' | 'thick' | 'half';
|
|
@@ -62,14 +89,14 @@ export type BorderSides = {
|
|
|
62
89
|
};
|
|
63
90
|
/** A colour per edge. Unnamed edges fall back to the border's `color`. */
|
|
64
91
|
export type BorderColors = {
|
|
65
|
-
top?:
|
|
66
|
-
right?:
|
|
67
|
-
bottom?:
|
|
68
|
-
left?:
|
|
92
|
+
top?: BorderColor;
|
|
93
|
+
right?: BorderColor;
|
|
94
|
+
bottom?: BorderColor;
|
|
95
|
+
left?: BorderColor;
|
|
69
96
|
};
|
|
70
97
|
export type BorderSpec = BorderStyle | {
|
|
71
98
|
style?: BorderStyle;
|
|
72
|
-
color?:
|
|
99
|
+
color?: BorderColor;
|
|
73
100
|
/**
|
|
74
101
|
* Per-edge colour, over `color`. A corner belongs to the edge that runs
|
|
75
102
|
* through it - the top rule owns both top corners - because a cell holds
|
|
@@ -111,7 +138,7 @@ export interface Style {
|
|
|
111
138
|
* but stays legible, rather than being replaced by a rectangle of nothing.
|
|
112
139
|
* `true` uses the theme's `scrim` token; a number sets the strength.
|
|
113
140
|
*/
|
|
114
|
-
scrim?: boolean |
|
|
141
|
+
scrim?: boolean | BgColor;
|
|
115
142
|
scrimStrength?: number;
|
|
116
143
|
display?: 'flex' | 'none';
|
|
117
144
|
direction?: 'row' | 'column';
|
|
@@ -160,8 +187,8 @@ export interface Style {
|
|
|
160
187
|
overflowX?: Overflow;
|
|
161
188
|
/** Overrides `overflow` downwards. The usual scroll container. */
|
|
162
189
|
overflowY?: Overflow;
|
|
163
|
-
fg?:
|
|
164
|
-
bg?:
|
|
190
|
+
fg?: FgColor;
|
|
191
|
+
bg?: BgColor;
|
|
165
192
|
bold?: boolean;
|
|
166
193
|
dim?: boolean;
|
|
167
194
|
italic?: boolean;
|
|
@@ -175,15 +202,27 @@ export interface Style {
|
|
|
175
202
|
/** Character painted into empty cells of this box. */
|
|
176
203
|
fill?: string;
|
|
177
204
|
}
|
|
178
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* Styles selected by interaction state. Merged over the base in this order.
|
|
207
|
+
*
|
|
208
|
+
* `selected` is "this is the current one"; `focus` is "and the keyboard is
|
|
209
|
+
* here", so a row that has both wears `focus` and a row that has only the
|
|
210
|
+
* first wears the dimmer `selected`. They are separate names because they
|
|
211
|
+
* were the same word once - `active` meant both the unfocused selection here
|
|
212
|
+
* and the pressed state in `InteractionState` - and a token that meant two
|
|
213
|
+
* things could be filled with either and looked wrong half the time.
|
|
214
|
+
*/
|
|
179
215
|
export interface StatefulStyle {
|
|
180
216
|
base?: Style;
|
|
181
217
|
focus?: Style;
|
|
182
218
|
hover?: Style;
|
|
219
|
+
/** Pressed. Never a selection. */
|
|
183
220
|
active?: Style;
|
|
184
221
|
selected?: Style;
|
|
185
222
|
disabled?: Style;
|
|
186
223
|
}
|
|
224
|
+
/** The states, in the order the last one wins. The shared vocabulary. */
|
|
225
|
+
export type StateName = 'selected' | 'hover' | 'active' | 'focus' | 'disabled';
|
|
187
226
|
export type StyleInput = Style | StatefulStyle | (Style | StatefulStyle | undefined | false)[];
|
|
188
227
|
/** Global semantic variants, available to every component that opts in. */
|
|
189
228
|
export type SemanticVariant = 'default' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'muted';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/types/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/types/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,YAAY,GAEpB,QAAQ,GAAG,SAAS,GAAG,WAAW,GAClC,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAGzC,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GACtD,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAExC,cAAc,GAId,QAAQ,GACR,WAAW,GAAG,SAAS,GACvB,UAAU,GAAG,WAAW,GAAG,aAAa,GACxC,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GACjD,YAAY,GAAG,UAAU,CAAC;AAE9B,0CAA0C;AAC1C,MAAM,MAAM,YAAY,GACpB,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAC/C,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GACtD,QAAQ,GAAG,SAAS,GAAG,WAAW,GAClC,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAEzC,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElC,6BAA6B;AAC7B,MAAM,MAAM,gBAAgB,GACxB,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AC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE/E,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,aAAa,GAAG,CAAC,KAAK,GAAG,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC;AAE/F,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GACvB,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAC9C,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAExD,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
package/dist/types/theme.d.ts
CHANGED
|
@@ -71,6 +71,16 @@ export interface ThemeDefinition {
|
|
|
71
71
|
id: string;
|
|
72
72
|
name: string;
|
|
73
73
|
appearance: 'light' | 'dark';
|
|
74
|
+
/**
|
|
75
|
+
* Whether this theme has any colour to give.
|
|
76
|
+
*
|
|
77
|
+
* A theme's palette is its own business, but a component can state a literal
|
|
78
|
+
* colour - an ink, a chart, a hand-picked hex - and that used to come through
|
|
79
|
+
* untouched, so `mono` painted a rainbow the moment a banner asked for one.
|
|
80
|
+
* Stated, every colour resolves to the terminal's own: tokens and literals
|
|
81
|
+
* alike, which is what a theme that says it has no colour has to mean.
|
|
82
|
+
*/
|
|
83
|
+
monochrome?: boolean;
|
|
74
84
|
/** Extend another registered theme; only the differences need stating. */
|
|
75
85
|
extends?: string;
|
|
76
86
|
colors: Partial<Record<ColorToken, Color>>;
|
|
@@ -99,7 +109,16 @@ export interface ThemeDefinition {
|
|
|
99
109
|
*/
|
|
100
110
|
tableRules?: TableRules;
|
|
101
111
|
density?: Density;
|
|
102
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Per-component style overrides, keyed by component name then variant or
|
|
114
|
+
* state.
|
|
115
|
+
*
|
|
116
|
+
* A composite component has to name which of its boxes this is - a list row
|
|
117
|
+
* is a `box` node, and `List` is what a theme author knows it by - so the
|
|
118
|
+
* name is stated at the node with `styleAs` and the map is keyed by it.
|
|
119
|
+
* `base` is the component at rest; the rest are the variants it supports and
|
|
120
|
+
* the five states in `StateName`.
|
|
121
|
+
*/
|
|
103
122
|
components?: Record<string, Record<string, Style>>;
|
|
104
123
|
/**
|
|
105
124
|
* Colours for syntax scopes. Every scope has a default drawn from the
|
|
@@ -113,6 +132,8 @@ export interface ResolvedTheme {
|
|
|
113
132
|
id: string;
|
|
114
133
|
name: string;
|
|
115
134
|
appearance: 'light' | 'dark';
|
|
135
|
+
/** Whether every colour this theme gives back is the terminal's own. */
|
|
136
|
+
monochrome: boolean;
|
|
116
137
|
colors: Record<ColorToken, Color>;
|
|
117
138
|
spacing: ThemeSpacing;
|
|
118
139
|
glyphs: ThemeGlyphs;
|
|
@@ -124,11 +145,24 @@ export interface ResolvedTheme {
|
|
|
124
145
|
components: Record<string, Record<string, Style>>;
|
|
125
146
|
/** Every syntax scope, resolved to a colour. */
|
|
126
147
|
syntax: Record<SyntaxScope, Color>;
|
|
127
|
-
/** Resolve a token (or pass a literal colour through). */
|
|
148
|
+
/** Resolve a token (or pass a literal colour through, unless monochrome). */
|
|
128
149
|
color(token: string): Color;
|
|
129
150
|
borderChars(style?: BorderStyle): BorderChars;
|
|
130
151
|
dividerChars(style?: DividerStyle): DividerChars;
|
|
131
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Component style for a name and a list of names to merge over it, in the
|
|
154
|
+
* order given - later names win.
|
|
155
|
+
*
|
|
156
|
+
* The names are the component's `variant`, `tone` and `size` followed by the
|
|
157
|
+
* interaction states that are true: `selected`, `hover`, `active` (pressed),
|
|
158
|
+
* `focus` and `disabled`. So `components.List.selected` is the fill on the
|
|
159
|
+
* current row, and `components.List.focused` is the brighter one on the
|
|
160
|
+
* current row while the list has the keyboard.
|
|
161
|
+
*
|
|
162
|
+
* The order is the same one `flattenStyleInput` merges a `style` prop in, so
|
|
163
|
+
* a state stated at the node and the same state stated by the theme resolve
|
|
164
|
+
* to one answer rather than to whichever happened to be asked second.
|
|
165
|
+
*/
|
|
132
166
|
styleFor(component: string, variants?: string[]): Style;
|
|
133
167
|
}
|
|
134
168
|
export interface ThemeRegistry {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EACV,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EACtF,KAAK,EAAE,UAAU,EAAE,UAAU,EAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC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