@textui/widgets 0.7.0 → 0.8.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/control/text-area.d.ts +2 -0
- package/dist/control/text-area.d.ts.map +1 -1
- package/dist/control/text-area.js +16 -8
- package/dist/data/code-viewer.d.ts +2 -0
- package/dist/data/code-viewer.d.ts.map +1 -1
- package/dist/data/code-viewer.js +9 -1
- package/dist/data/index.d.ts +9 -0
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +8 -2
- package/dist/data/list.d.ts +9 -0
- package/dist/data/list.d.ts.map +1 -1
- package/dist/data/list.js +20 -3
- package/dist/data/markdown-view.d.ts.map +1 -1
- package/dist/data/markdown-view.js +4 -1
- package/dist/data/pagination.d.ts.map +1 -1
- package/dist/data/pagination.js +4 -1
- package/dist/data/tree.d.ts +2 -0
- package/dist/data/tree.d.ts.map +1 -1
- package/dist/data/tree.js +8 -2
- package/dist/display/card.d.ts.map +1 -1
- package/dist/display/card.js +12 -0
- package/dist/display/color-text.d.ts +13 -1
- package/dist/display/color-text.d.ts.map +1 -1
- package/dist/display/color-text.js +28 -6
- package/dist/display/font-text.d.ts +72 -0
- package/dist/display/font-text.d.ts.map +1 -0
- package/dist/display/font-text.js +35 -0
- package/dist/display/fonts.d.ts +138 -0
- package/dist/display/fonts.d.ts.map +1 -0
- package/dist/display/fonts.js +893 -0
- package/dist/display/gard.d.ts +26 -0
- package/dist/display/gard.d.ts.map +1 -0
- package/dist/display/gard.js +479 -0
- package/dist/display/index.d.ts +3 -0
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.js +7 -0
- package/dist/display/key-value.d.ts +25 -5
- package/dist/display/key-value.d.ts.map +1 -1
- package/dist/display/key-value.js +13 -3
- package/dist/display/pagga.d.ts +29 -0
- package/dist/display/pagga.d.ts.map +1 -0
- package/dist/display/pagga.js +101 -0
- package/dist/display/pattern.d.ts +117 -0
- package/dist/display/pattern.d.ts.map +1 -0
- package/dist/display/pattern.js +257 -0
- package/dist/display/spinner.d.ts +2 -0
- package/dist/display/spinner.d.ts.map +1 -1
- package/dist/display/spinner.js +3 -2
- package/dist/navigation/menu.d.ts +2 -0
- package/dist/navigation/menu.d.ts.map +1 -1
- package/dist/navigation/menu.js +19 -6
- package/dist/navigation/tabs.d.ts +2 -0
- package/dist/navigation/tabs.d.ts.map +1 -1
- package/dist/navigation/tabs.js +12 -2
- package/package.json +2 -2
- package/src/control/text-area.ts +18 -7
- package/src/data/code-viewer.ts +10 -1
- package/src/data/index.ts +9 -2
- package/src/data/list.ts +21 -3
- package/src/data/markdown-view.ts +7 -4
- package/src/data/pagination.ts +4 -1
- package/src/data/tree.ts +9 -2
- package/src/display/card.ts +12 -0
- package/src/display/color-text.ts +33 -10
- package/src/display/font-text.tsx +94 -0
- package/src/display/fonts.ts +990 -0
- package/src/display/gard.ts +475 -0
- package/src/display/index.ts +7 -0
- package/src/display/key-value.ts +44 -6
- package/src/display/pagga.ts +102 -0
- package/src/display/pattern.tsx +427 -0
- package/src/display/spinner.ts +5 -2
- package/src/navigation/menu.ts +20 -6
- package/src/navigation/tabs.ts +13 -2
|
@@ -96,5 +96,7 @@ export interface TextAreaProps extends BoxProps {
|
|
|
96
96
|
* is what typing is. That single fact is why an application with one of these
|
|
97
97
|
* cannot have single-letter global commands, and why it does not need to.
|
|
98
98
|
*/
|
|
99
|
+
/** The name a theme styles this field's selection under. See `LIST`. */
|
|
100
|
+
export declare const TEXT_AREA = "TextArea";
|
|
99
101
|
export declare const TextArea: (props: TextAreaProps) => import("@textui/core").RenderOutput;
|
|
100
102
|
//# sourceMappingURL=text-area.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../src/control/text-area.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,eAAe,EAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../src/control/text-area.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAwB,eAAe,EAAS,MAAM,cAAc,CAAC;AA4B3F,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,IAAI,CAAC;IAClB,gEAAgE;IAChE,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACrC;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IACnC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wEAAwE;AACxE,eAAO,MAAM,SAAS,aAAa,CAAC;AAEpC,eAAO,MAAM,QAAQ,+DAqsBnB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, graphemes, h, stringWidth, useClipboard, useEffect, useFocus, useInput, useMeasure, useRef, useState, useTheme, useTicker, } from '@textui/core';
|
|
1
|
+
import { NO_INTERACTION, defineComponent, graphemes, h, stateVariants, stringWidth, useClipboard, useEffect, useFocus, useInput, useMeasure, useRef, useState, useTheme, useTicker, } from '@textui/core';
|
|
2
2
|
/** How many edits back a field remembers. */
|
|
3
3
|
const MEMORY = 200;
|
|
4
4
|
/**
|
|
@@ -18,6 +18,8 @@ const MEMORY = 200;
|
|
|
18
18
|
* is what typing is. That single fact is why an application with one of these
|
|
19
19
|
* cannot have single-letter global commands, and why it does not need to.
|
|
20
20
|
*/
|
|
21
|
+
/** The name a theme styles this field's selection under. See `LIST`. */
|
|
22
|
+
export const TEXT_AREA = 'TextArea';
|
|
21
23
|
export const TextArea = defineComponent('TextArea', (props) => {
|
|
22
24
|
const { value, onChange, onSubmit, onCancel, onOverflow, onEdge, placeholder, maxRows = 6, maxLength, autoFocus, focusId, disabled, caretTone, blink = true, wrap = 'word', caretStyle, copyOnSelect = true, ...rest } = props;
|
|
23
25
|
const theme = useTheme();
|
|
@@ -104,14 +106,20 @@ export const TextArea = defineComponent('TextArea', (props) => {
|
|
|
104
106
|
/**
|
|
105
107
|
* How a selected cell is drawn.
|
|
106
108
|
*
|
|
107
|
-
* The same pair a selected list row uses
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
109
|
+
* The theme's to say, and the same pair a selected list row uses: the
|
|
110
|
+
* `TextArea.focused` fill while the field has the keyboard and the dimmer
|
|
111
|
+
* `TextArea.selected` one once it does not, because a selection left
|
|
112
|
+
* visible in an unfocused field says what is on the clipboard, and saying it
|
|
113
|
+
* as loudly as the live one would put two selections on the screen.
|
|
114
|
+
*
|
|
115
|
+
* Asked for here rather than read off a node, because the field's selection
|
|
116
|
+
* is painted across cells that are not themselves selected nodes.
|
|
111
117
|
*/
|
|
112
|
-
const selectionStyle =
|
|
113
|
-
|
|
114
|
-
:
|
|
118
|
+
const selectionStyle = theme.styleFor(TEXT_AREA, stateVariants({
|
|
119
|
+
...NO_INTERACTION,
|
|
120
|
+
selected: true,
|
|
121
|
+
focused: focus.focused,
|
|
122
|
+
}));
|
|
115
123
|
const before = chars.slice(0, position).join('');
|
|
116
124
|
const lines = value === '' ? [''] : value.split('\n');
|
|
117
125
|
const caretLine = before.split('\n').length - 1;
|
|
@@ -67,5 +67,7 @@ export declare const HORIZONTAL_STEP = 4;
|
|
|
67
67
|
* around it. And it colours by asking the registry for a highlighter, so a new
|
|
68
68
|
* file type arrives coloured without this component learning what it is.
|
|
69
69
|
*/
|
|
70
|
+
/** The name a theme styles a code row under. See `LIST`. */
|
|
71
|
+
export declare const CODE_VIEWER = "CodeViewer";
|
|
70
72
|
export declare const CodeViewer: (props: CodeViewerProps) => RenderOutput;
|
|
71
73
|
//# sourceMappingURL=code-viewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-viewer.d.ts","sourceRoot":"","sources":["../../src/data/code-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAiB,WAAW,EAAE,MAAM,cAAc,CAAC;AAuBvF,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,yEAAyE;IACzE,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,C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,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,uDAAuD;IACvD,UAAU,CAAC,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAChD,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;;;;;;GAQG;AACH,4DAA4D;AAC5D,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC,eAAO,MAAM,UAAU,0CAyMrB,CAAC"}
|
package/dist/data/code-viewer.js
CHANGED
|
@@ -19,6 +19,8 @@ export const HORIZONTAL_STEP = 4;
|
|
|
19
19
|
* around it. And it colours by asking the registry for a highlighter, so a new
|
|
20
20
|
* file type arrives coloured without this component learning what it is.
|
|
21
21
|
*/
|
|
22
|
+
/** The name a theme styles a code row under. See `LIST`. */
|
|
23
|
+
export const CODE_VIEWER = 'CodeViewer';
|
|
22
24
|
export const CodeViewer = defineComponent('CodeViewer', (props) => {
|
|
23
25
|
const { content, lineNumbers = true, startLine = 1, visibleRows, highlight = [], tokens, language, kind, uri, line, onLineChange, onPosition, scrollbar = true, showCaret = true, tabWidth = 4, disabled, autoFocus, ...rest } = props;
|
|
24
26
|
const theme = useTheme();
|
|
@@ -158,7 +160,13 @@ export const CodeViewer = defineComponent('CodeViewer', (props) => {
|
|
|
158
160
|
key: number,
|
|
159
161
|
direction: 'row',
|
|
160
162
|
height: 1,
|
|
161
|
-
|
|
163
|
+
styleAs: CODE_VIEWER,
|
|
164
|
+
// A marked line is a selection; the caret line is that selection with
|
|
165
|
+
// the keyboard on it. Both fills are the theme's - `CodeViewer.selected`
|
|
166
|
+
// and `CodeViewer.focused` - and both carry the colour that reads on
|
|
167
|
+
// the fill, so a token inside the row that states its own keeps it.
|
|
168
|
+
selected: marked,
|
|
169
|
+
focused: onCaret,
|
|
162
170
|
}, lineNumbers
|
|
163
171
|
? h('text', {
|
|
164
172
|
content: `${String(number).padStart(gutter)} `,
|
package/dist/data/index.d.ts
CHANGED
|
@@ -44,6 +44,15 @@ export interface TableProps<T extends object = Record<string, unknown>> extends
|
|
|
44
44
|
/** Width below which low-priority columns start being dropped. */
|
|
45
45
|
responsive?: boolean;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* A data table.
|
|
49
|
+
*
|
|
50
|
+
* Responsiveness is a column-priority problem, not a font-size problem: as the
|
|
51
|
+
* table narrows it drops the lowest-priority columns rather than squeezing
|
|
52
|
+
* every column until none of them is readable.
|
|
53
|
+
*/
|
|
54
|
+
/** The name a theme styles a table row under. See `LIST` in `./list.js`. */
|
|
55
|
+
export declare const TABLE = "Table";
|
|
47
56
|
/**
|
|
48
57
|
* Exported with its own generic signature so a caller's row type flows into
|
|
49
58
|
* `format` and `tone` - the alternative is every table taking
|
package/dist/data/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ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O,CAAC;CAChB;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,QAAQ;IACtF,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;IACrC,UAAU,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,4EAA4E;AAC5E,eAAO,MAAM,KAAK,UAAU,CAAC;AA0J7B;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC;AAE3F,eAAO,MAAM,eAAe,EAAE,mBAAmB,EAShD,CAAC"}
|
package/dist/data/index.js
CHANGED
|
@@ -32,6 +32,8 @@ export * from './tree.js';
|
|
|
32
32
|
* table narrows it drops the lowest-priority columns rather than squeezing
|
|
33
33
|
* every column until none of them is readable.
|
|
34
34
|
*/
|
|
35
|
+
/** The name a theme styles a table row under. See `LIST` in `./list.js`. */
|
|
36
|
+
export const TABLE = 'Table';
|
|
35
37
|
const TableImpl = defineComponent('Table', (props) => {
|
|
36
38
|
const theme = useTheme();
|
|
37
39
|
const i18n = useI18n();
|
|
@@ -153,11 +155,15 @@ const TableImpl = defineComponent('Table', (props) => {
|
|
|
153
155
|
return h('box', {
|
|
154
156
|
key,
|
|
155
157
|
role: 'row',
|
|
158
|
+
styleAs: TABLE,
|
|
156
159
|
selected: active,
|
|
160
|
+
// The keyboard is the table's; the row is told which row it lands on.
|
|
161
|
+
focused: active && focus.focused,
|
|
157
162
|
direction: 'row',
|
|
158
163
|
gap,
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
// What the row is filled with is the theme's to say - `Table.selected`
|
|
165
|
+
// for the current row and `Table.focused` over it while the table has
|
|
166
|
+
// the keyboard - as it is for a list, a tree and a menu.
|
|
161
167
|
onClick: () => {
|
|
162
168
|
if (selectedKey === undefined)
|
|
163
169
|
setInternalKey(key);
|
package/dist/data/list.d.ts
CHANGED
|
@@ -8,6 +8,15 @@ export interface ListItem {
|
|
|
8
8
|
meta?: string;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The name a theme styles a row under.
|
|
13
|
+
*
|
|
14
|
+
* A row is a plain `box`, so without this `components.List` in a theme is a
|
|
15
|
+
* key nothing reads. Stated once here because the row, the tree, the table
|
|
16
|
+
* and the menu all fill the same two colours and a theme author comparing
|
|
17
|
+
* them should be reading the same four names.
|
|
18
|
+
*/
|
|
19
|
+
export declare const LIST = "List";
|
|
11
20
|
/** How a row stands at the moment it is asked to draw itself. */
|
|
12
21
|
export interface ListItemState {
|
|
13
22
|
/** The row the selection is on. */
|
package/dist/data/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/data/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAiB5E,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW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,CAAC;IACjB;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,GAAG,YAAY,CAAC;IACzD;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,iBAAS,QAAQ,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,CAwIvE;AAED,eAAO,MAAM,IAAI,EAA8E,OAAO,QAAQ,CAAC"}
|
package/dist/data/list.js
CHANGED
|
@@ -2,6 +2,15 @@ import { chorded, defineComponent, h, useFocus, useI18n, useInput, useMeasure, u
|
|
|
2
2
|
import { EmptyState } from '../display/index.js';
|
|
3
3
|
import { TONE } from '../tone.js';
|
|
4
4
|
import { viewportRows } from '../viewport.js';
|
|
5
|
+
/**
|
|
6
|
+
* The name a theme styles a row under.
|
|
7
|
+
*
|
|
8
|
+
* A row is a plain `box`, so without this `components.List` in a theme is a
|
|
9
|
+
* key nothing reads. Stated once here because the row, the tree, the table
|
|
10
|
+
* and the menu all fill the same two colours and a theme author comparing
|
|
11
|
+
* them should be reading the same four names.
|
|
12
|
+
*/
|
|
13
|
+
export const LIST = 'List';
|
|
5
14
|
function ListView(props) {
|
|
6
15
|
const theme = useTheme();
|
|
7
16
|
const i18n = useI18n();
|
|
@@ -105,14 +114,22 @@ function ListView(props) {
|
|
|
105
114
|
key: item.id,
|
|
106
115
|
role: 'listitem',
|
|
107
116
|
label: item.label,
|
|
117
|
+
styleAs: LIST,
|
|
108
118
|
selected: active,
|
|
119
|
+
// The keyboard is the list's, not the row's, so the row is told. It is
|
|
120
|
+
// the difference between "the current row" and "the current row you
|
|
121
|
+
// can type at", and a theme states the two fills separately.
|
|
122
|
+
focused: active && focus.focused,
|
|
109
123
|
direction: 'row',
|
|
110
124
|
gap: 1,
|
|
111
125
|
// One background over the whole row, however many lines it draws: a
|
|
112
126
|
// highlight that stopped after the first would split the row it is
|
|
113
|
-
// highlighting in two.
|
|
114
|
-
|
|
115
|
-
|
|
127
|
+
// highlighting in two. What it is filled with is the theme's to say -
|
|
128
|
+
// `List.selected` for the current row, `List.focused` over it while
|
|
129
|
+
// the list has the keyboard - and a background always comes with the
|
|
130
|
+
// colour that reads on it, which is why that pairing lives in the
|
|
131
|
+
// theme rather than here.
|
|
132
|
+
fg: item.disabled ? 'disabled' : undefined,
|
|
116
133
|
onClick: () => {
|
|
117
134
|
if (item.disabled)
|
|
118
135
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-view.d.ts","sourceRoot":"","sources":["../../src/data/markdown-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAA0C,MAAM,cAAc,CAAC;AAelG,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;IACrB,+EAA+E;IAC/E,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"markdown-view.d.ts","sourceRoot":"","sources":["../../src/data/markdown-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAA0C,MAAM,cAAc,CAAC;AAelG,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;IACrB,+EAA+E;IAC/E,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,mEA0LvB,CAAC"}
|
|
@@ -167,7 +167,10 @@ export const MarkdownView = defineComponent('MarkdownView', (props) => {
|
|
|
167
167
|
i++;
|
|
168
168
|
}
|
|
169
169
|
return h('box', { role: 'document', direction: 'column', ...rest }, ...out, hidden > 0
|
|
170
|
-
? h('text', { content: i18n.
|
|
170
|
+
? h('text', { content: i18n.plural(hidden, {
|
|
171
|
+
one: i18n.t('textui.markdown.moreLines.one', undefined, '{glyph} {count} more line'),
|
|
172
|
+
other: i18n.t('textui.markdown.moreLines.other', undefined, '{glyph} {count} more lines'),
|
|
173
|
+
}, { glyph: theme.glyphs.ellipsis }), fg: 'subtle' })
|
|
171
174
|
: null);
|
|
172
175
|
});
|
|
173
176
|
/** One `text` per run, so a bold half of a sentence stays bold after wrapping. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/data/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/data/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,UAAU,iEAwBrB,CAAC"}
|
package/dist/data/pagination.js
CHANGED
|
@@ -15,5 +15,8 @@ export const Pagination = defineComponent('Pagination', (props) => {
|
|
|
15
15
|
}
|
|
16
16
|
return false;
|
|
17
17
|
}, { focusId: focus.id });
|
|
18
|
-
return h('box', { id: focus.id, direction: 'row', gap: 1, ...rest }, h('text', { content: theme.glyphs.chevronLeft, fg: page > 1 ? 'accent' : 'disabled' }), h('text', { content: `${page} / ${pageCount}`, bold: focus.focused }), h('text', { content: theme.glyphs.chevronRight, fg: page < pageCount ? 'accent' : 'disabled' }), total !== undefined ? h('text', { content: i18n.
|
|
18
|
+
return h('box', { id: focus.id, direction: 'row', gap: 1, ...rest }, h('text', { content: theme.glyphs.chevronLeft, fg: page > 1 ? 'accent' : 'disabled' }), h('text', { content: `${page} / ${pageCount}`, bold: focus.focused }), h('text', { content: theme.glyphs.chevronRight, fg: page < pageCount ? 'accent' : 'disabled' }), total !== undefined ? h('text', { content: i18n.plural(total, {
|
|
19
|
+
one: i18n.t('textui.pagination.total.one', undefined, '{count} item'),
|
|
20
|
+
other: i18n.t('textui.pagination.total.other', undefined, '{count} items'),
|
|
21
|
+
}), fg: 'muted' }) : null);
|
|
19
22
|
});
|
package/dist/data/tree.d.ts
CHANGED
package/dist/data/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot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MAAM,IAAI,SAAS,CAAC;AAE3B,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5C,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAmBD,eAAO,MAAM,IAAI,2DAyJf,CAAC"}
|
package/dist/data/tree.js
CHANGED
|
@@ -2,6 +2,8 @@ import { chorded, defineComponent, h, useFocus, useInput, useMeasure, useTheme,
|
|
|
2
2
|
import { usePanelState } from '../panel/index.js';
|
|
3
3
|
import { TONE } from '../tone.js';
|
|
4
4
|
import { viewportRows } from '../viewport.js';
|
|
5
|
+
/** The name a theme styles a tree row under. See `LIST`. */
|
|
6
|
+
export const TREE = 'Tree';
|
|
5
7
|
function flatten(nodes, expanded, depth = 0, out = []) {
|
|
6
8
|
for (const node of nodes) {
|
|
7
9
|
const expandable = Boolean(node.hasChildren || (node.children && node.children.length > 0));
|
|
@@ -135,11 +137,15 @@ export const Tree = defineComponent('Tree', (props) => {
|
|
|
135
137
|
key: row.node.id,
|
|
136
138
|
role: 'treeitem',
|
|
137
139
|
label: row.node.label,
|
|
140
|
+
styleAs: TREE,
|
|
138
141
|
selected: active,
|
|
142
|
+
// The keyboard is the tree's; the row is told which row it lands on.
|
|
143
|
+
focused: active && focus.focused,
|
|
139
144
|
direction: 'row',
|
|
140
145
|
gap: 1,
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
// What the row is filled with is the theme's to say - `Tree.selected`
|
|
147
|
+
// for the current row and `Tree.focused` over it while the tree has
|
|
148
|
+
// the keyboard - as it is for a list, a table and a menu.
|
|
143
149
|
onClick: () => {
|
|
144
150
|
if (selectedId === undefined)
|
|
145
151
|
setInternalSelected(row.node.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/display/card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/display/card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,IAAI,2DAyBf,CAAC"}
|
package/dist/display/card.js
CHANGED
|
@@ -4,6 +4,18 @@ export const Card = defineComponent('Card', (props) => {
|
|
|
4
4
|
const { title, subtitle, children, ...rest } = props;
|
|
5
5
|
return h('box', {
|
|
6
6
|
border: theme.border,
|
|
7
|
+
/*
|
|
8
|
+
* A card is a surface, so it states a background and is opaque.
|
|
9
|
+
*
|
|
10
|
+
* A bordered box that states none is a frame around whatever is already
|
|
11
|
+
* there, and what is already there can be a pattern, a scrim or a
|
|
12
|
+
* neighbouring block - a card dropped on a pattern showed the pattern
|
|
13
|
+
* through its own interior, which reads as a hole rather than as something
|
|
14
|
+
* laid on top. `Dialog` and `CommandPalette` have always stated `overlay`
|
|
15
|
+
* for the same reason; this is the page-level one. `...rest` still wins, so
|
|
16
|
+
* a caller that wants a different colour names it.
|
|
17
|
+
*/
|
|
18
|
+
bg: 'surface',
|
|
7
19
|
padding: theme.density === 'compact' ? 0 : [0, 1],
|
|
8
20
|
direction: 'column',
|
|
9
21
|
title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CellStyle, Color, RenderContext, StyleColor, TextProps } from '@textui/core';
|
|
1
|
+
import type { CellStyle, Color, Style, RenderContext, StyleColor, TextProps } from '@textui/core';
|
|
2
2
|
/**
|
|
3
3
|
* One cell, as the ink sees it.
|
|
4
4
|
*
|
|
@@ -154,5 +154,17 @@ export declare function blend(a: Color, b: Color, t: number): Color;
|
|
|
154
154
|
* Exported so a component that paints its own cells - a chart, a viewer with a
|
|
155
155
|
* heat column - can take an `Ink` and mean the same thing by it.
|
|
156
156
|
*/
|
|
157
|
+
/**
|
|
158
|
+
* A component's own style, resolved for the state it is in.
|
|
159
|
+
*
|
|
160
|
+
* A canvas is not told what it was nested in, so a component that paints its
|
|
161
|
+
* own cells cannot inherit the way a `text` does: it resolves the props it was
|
|
162
|
+
* given against the theme, and hands the result to every cell the ink declines.
|
|
163
|
+
* Exported beside `painterOf` so a second painter means the same thing by it -
|
|
164
|
+
* `ColorText` and `Pattern` both paint their own cells and read the same way.
|
|
165
|
+
*/
|
|
166
|
+
export declare function inkOwnStyle(props: Record<string, unknown>, ctx: RenderContext): Style;
|
|
167
|
+
/** The cell style a canvas painter starts from, given that own style. */
|
|
168
|
+
export declare function inkCellStyle(own: Style, ctx: RenderContext, link?: unknown): CellStyle;
|
|
157
169
|
export declare function painterOf(ink: Ink | undefined, ctx: RenderContext): (cell: InkCell) => CellStyle | undefined;
|
|
158
170
|
//# sourceMappingURL=color-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-text.d.ts","sourceRoot":"","sources":["../../src/display/color-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"color-text.d.ts","sourceRoot":"","sources":["../../src/display/color-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAAE,KAAK,EAAkC,KAAK,EACvD,aAAa,EAAE,UAAU,EAAE,SAAS,EACrC,MAAM,cAAc,CAAC;AAOtB;;;;;;;;;GASG;AACH,MAAM,WAAW,OAAO;IACtB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,KAAK,UAAU,GAAG,SAAS,GAAG,SAA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,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,aAAa,GAAG,KAAK,CAKrF;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAMtF;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,GAAG,GAAG,SAAS,EACpB,GAAG,EAAE,aAAa,GACjB,CAAC,IAAI,EAAE,OAAO,KAAK,SAAS,GAAG,SAAS,CA+D1C"}
|
|
@@ -45,12 +45,9 @@ export const ColorText = defineComponent('ColorText', (props) => {
|
|
|
45
45
|
return;
|
|
46
46
|
// The component's own style, resolved for the state it is in. Not the
|
|
47
47
|
// inherited one - a canvas is not told what it was nested in.
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
attrs: attrsFromStyle(own),
|
|
52
|
-
link: typeof props.link === 'string' ? props.link : undefined,
|
|
53
|
-
};
|
|
48
|
+
const ownProps = props;
|
|
49
|
+
const own = inkOwnStyle(ownProps, ctx);
|
|
50
|
+
const rest = inkCellStyle(own, ctx, props.link);
|
|
54
51
|
const cut = props.truncate ?? truncateSideOf(wrap) ?? 'end';
|
|
55
52
|
const dots = ellipsis ?? ctx.theme.glyphs.ellipsis;
|
|
56
53
|
const lines = linesOf(source, wrap, area).map((line) => (stringWidth(line) > area && cut !== false ? truncate(line, area, dots, cut) : line));
|
|
@@ -114,9 +111,34 @@ export function blend(a, b, t) {
|
|
|
114
111
|
* Exported so a component that paints its own cells - a chart, a viewer with a
|
|
115
112
|
* heat column - can take an `Ink` and mean the same thing by it.
|
|
116
113
|
*/
|
|
114
|
+
/**
|
|
115
|
+
* A component's own style, resolved for the state it is in.
|
|
116
|
+
*
|
|
117
|
+
* A canvas is not told what it was nested in, so a component that paints its
|
|
118
|
+
* own cells cannot inherit the way a `text` does: it resolves the props it was
|
|
119
|
+
* given against the theme, and hands the result to every cell the ink declines.
|
|
120
|
+
* Exported beside `painterOf` so a second painter means the same thing by it -
|
|
121
|
+
* `ColorText` and `Pattern` both paint their own cells and read the same way.
|
|
122
|
+
*/
|
|
123
|
+
export function inkOwnStyle(props, ctx) {
|
|
124
|
+
return mergeStyles(styleFromProps(props), flattenStyleInput(props.style, stateOf(ctx)));
|
|
125
|
+
}
|
|
126
|
+
/** The cell style a canvas painter starts from, given that own style. */
|
|
127
|
+
export function inkCellStyle(own, ctx, link) {
|
|
128
|
+
return {
|
|
129
|
+
fg: resolveColor(own.fg, ctx.theme, 'default'),
|
|
130
|
+
attrs: attrsFromStyle(own),
|
|
131
|
+
link: typeof link === 'string' ? link : undefined,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
117
134
|
export function painterOf(ink, ctx) {
|
|
118
135
|
if (ink === undefined)
|
|
119
136
|
return () => undefined;
|
|
137
|
+
// A theme with no colour has no inks, and this is not only faster: a ramp
|
|
138
|
+
// whose stops all resolve to the terminal's own still has to be *mixed*, and
|
|
139
|
+
// mixing "no colour" with itself lands on black - which is a colour.
|
|
140
|
+
if (ctx.theme.monochrome)
|
|
141
|
+
return () => undefined;
|
|
120
142
|
if (typeof ink === 'function') {
|
|
121
143
|
return (cell) => styleOf(ink(cell, ctx), ctx);
|
|
122
144
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BoxProps } from '@textui/core';
|
|
2
|
+
import type { Font } from './fonts.js';
|
|
3
|
+
/**
|
|
4
|
+
* `wrap` is not `BoxProps.wrap`.
|
|
5
|
+
*
|
|
6
|
+
* On a `text` it means where a line of *characters* is cut, and the whole point
|
|
7
|
+
* of this component is that the block it draws is not a line of characters: its
|
|
8
|
+
* rows are the rows of the letters, so cutting one at column sixty cuts every
|
|
9
|
+
* letter in it in half. `wrap` here means the one thing that can be done
|
|
10
|
+
* instead - break the *text* between its words, measured in the font - and it
|
|
11
|
+
* has no `char`, because a banner broken mid-word is not a banner. The drawn
|
|
12
|
+
* rows are handed to the `text` node as `wrap: 'none'` always; a caller cannot
|
|
13
|
+
* reach that.
|
|
14
|
+
*/
|
|
15
|
+
export interface FontTextProps extends Omit<BoxProps, 'wrap'> {
|
|
16
|
+
/** The text to draw. A newline is a line, and each is a line of banner. */
|
|
17
|
+
content: string;
|
|
18
|
+
/**
|
|
19
|
+
* The font to draw it in. The shipped `block` table by default.
|
|
20
|
+
*
|
|
21
|
+
* A font may name a substitute for a terminal that cannot draw its glyphs -
|
|
22
|
+
* `fallback` - and that is used here in place of it. There is no guessing one
|
|
23
|
+
* for a table the library has never seen, which is why the font says.
|
|
24
|
+
*/
|
|
25
|
+
font?: Font;
|
|
26
|
+
/**
|
|
27
|
+
* Break the text between its words so the drawn banner fits the box.
|
|
28
|
+
*
|
|
29
|
+
* `'none'` - the default - draws the text as it was written, however wide
|
|
30
|
+
* that is: a banner is usually a size somebody picked, and at a width the
|
|
31
|
+
* caller did not intend, letters that reflow are worse than letters that
|
|
32
|
+
* overflow. `'word'` asks the box for its width and breaks the text to it,
|
|
33
|
+
* words first and a word too wide for a line of its own spent a character at
|
|
34
|
+
* a time, which is the only place a letter boundary is ever crossed.
|
|
35
|
+
*
|
|
36
|
+
* It measures the box, so the first frame - which has no width yet - draws
|
|
37
|
+
* one unbroken line, exactly as `'none'` would.
|
|
38
|
+
*/
|
|
39
|
+
wrap?: 'none' | 'word';
|
|
40
|
+
/**
|
|
41
|
+
* Blank rows between one line of the block and the next. One by default.
|
|
42
|
+
*
|
|
43
|
+
* Not `gap`, which every box already has and means the space between its
|
|
44
|
+
* *children*: this is the space between the rows of one drawing. `0` butts
|
|
45
|
+
* the lines together, which for a font with a ground of its own - `pagga`'s
|
|
46
|
+
* `░`, `tmplt`'s rules - merges them into one texture; a larger number is air
|
|
47
|
+
* between them, and reads as two lines rather than as one.
|
|
48
|
+
*
|
|
49
|
+
* A newline in `content` is a line, and so is a wrap when `wrap: 'word'` is
|
|
50
|
+
* breaking the text: the gap is the same one either way.
|
|
51
|
+
*/
|
|
52
|
+
lineGap?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Text as block letters.
|
|
56
|
+
*
|
|
57
|
+
* The shape only: a string in, the same string drawn in the font's glyphs out,
|
|
58
|
+
* as a `text` node that inherits its colour like any other. Colouring the
|
|
59
|
+
* letters cell by cell - a ramp across a banner, a palette down it - is
|
|
60
|
+
* [`ColorText`](color-text.md), and handing it this output is the pair the two
|
|
61
|
+
* were split for.
|
|
62
|
+
*
|
|
63
|
+
* The letters are laid out by [`banner`](fonts.ts), which measures in the font
|
|
64
|
+
* rather than in cells, so the tracking is the font's and a glyph is
|
|
65
|
+
* proportional to what it actually draws. A character the font has no glyph for
|
|
66
|
+
* becomes a word space, so a missing letter shows as a gap rather than quietly
|
|
67
|
+
* closing up, and the placeholders a table is written in - `#`, `%`, `^`, `v` -
|
|
68
|
+
* are filled from the theme's own glyphs, which is what keeps a banner legible
|
|
69
|
+
* on a terminal that can only do ascii.
|
|
70
|
+
*/
|
|
71
|
+
export declare const FontText: (props: FontTextProps) => import("@textui/core").RenderOutput;
|
|
72
|
+
//# sourceMappingURL=font-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-text.d.ts","sourceRoot":"","sources":["../../src/display/font-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3D,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,+DAmBnB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent, h, useCapabilities, useMeasure, useTheme } from '@textui/core';
|
|
2
|
+
import { banner, DEFAULT_FONT, fontAt, inkGlyphs } from './fonts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Text as block letters.
|
|
5
|
+
*
|
|
6
|
+
* The shape only: a string in, the same string drawn in the font's glyphs out,
|
|
7
|
+
* as a `text` node that inherits its colour like any other. Colouring the
|
|
8
|
+
* letters cell by cell - a ramp across a banner, a palette down it - is
|
|
9
|
+
* [`ColorText`](color-text.md), and handing it this output is the pair the two
|
|
10
|
+
* were split for.
|
|
11
|
+
*
|
|
12
|
+
* The letters are laid out by [`banner`](fonts.ts), which measures in the font
|
|
13
|
+
* rather than in cells, so the tracking is the font's and a glyph is
|
|
14
|
+
* proportional to what it actually draws. A character the font has no glyph for
|
|
15
|
+
* becomes a word space, so a missing letter shows as a gap rather than quietly
|
|
16
|
+
* closing up, and the placeholders a table is written in - `#`, `%`, `^`, `v` -
|
|
17
|
+
* are filled from the theme's own glyphs, which is what keeps a banner legible
|
|
18
|
+
* on a terminal that can only do ascii.
|
|
19
|
+
*/
|
|
20
|
+
export const FontText = defineComponent('FontText', (props) => {
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const capabilities = useCapabilities();
|
|
23
|
+
const measured = useMeasure();
|
|
24
|
+
const { content, font: chosen, wrap, lineGap, ...rest } = props;
|
|
25
|
+
const unicode = capabilities.unicode !== 'ascii';
|
|
26
|
+
const picked = chosen ?? DEFAULT_FONT;
|
|
27
|
+
const font = !unicode && picked.fallback ? fontAt(picked.fallback) : picked;
|
|
28
|
+
const width = wrap === 'word' ? measured.width : undefined;
|
|
29
|
+
const drawn = banner(content, font, inkGlyphs(theme.glyphs, unicode), width ?? Number.POSITIVE_INFINITY, lineGap);
|
|
30
|
+
// `wrap: 'none'` *after* the spread, so the lines `banner` decided on are the
|
|
31
|
+
// lines drawn. Every one of them is a row of letters; a text node wrapping
|
|
32
|
+
// one cuts letters in half, and a caller who passed a `TextWrap` through
|
|
33
|
+
// `...rest` would be doing exactly that.
|
|
34
|
+
return h('text', { content: drawn, ...rest, wrap: 'none' });
|
|
35
|
+
});
|