@textui/widgets 0.6.1 → 0.7.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/chart/line-chart.d.ts.map +1 -1
- package/dist/chart/line-chart.js +3 -2
- package/dist/control/select.d.ts.map +1 -1
- package/dist/control/select.js +4 -2
- package/dist/control/switch.d.ts.map +1 -1
- package/dist/control/switch.js +7 -2
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +3 -2
- package/dist/data/list.d.ts.map +1 -1
- package/dist/data/list.js +3 -2
- package/dist/data/log-viewer.d.ts.map +1 -1
- package/dist/data/log-viewer.js +7 -2
- package/dist/data/markdown-view.d.ts.map +1 -1
- package/dist/data/markdown-view.js +3 -2
- package/dist/data/pagination.d.ts.map +1 -1
- package/dist/data/pagination.js +3 -2
- package/dist/display/error-state.d.ts.map +1 -1
- package/dist/display/error-state.js +4 -3
- package/dist/form/danger-zone.d.ts.map +1 -1
- package/dist/form/danger-zone.js +7 -3
- package/dist/form/form-actions.d.ts.map +1 -1
- package/dist/form/form-actions.js +3 -2
- package/dist/navigation/menu.d.ts.map +1 -1
- package/dist/navigation/menu.js +3 -2
- package/dist/overlay/command-palette.d.ts.map +1 -1
- package/dist/overlay/command-palette.js +55 -15
- package/dist/overlay/dialog.d.ts +11 -0
- package/dist/overlay/dialog.d.ts.map +1 -1
- package/dist/overlay/dialog.js +24 -1
- package/dist/overlay/index.d.ts.map +1 -1
- package/dist/overlay/index.js +11 -19
- package/dist/overlay/path-picker.d.ts.map +1 -1
- package/dist/overlay/path-picker.js +19 -11
- package/dist/overlay/prompt-dialog.d.ts.map +1 -1
- package/dist/overlay/prompt-dialog.js +5 -4
- package/dist/panel/index.d.ts.map +1 -1
- package/dist/panel/index.js +8 -7
- package/dist/panel/resource-panel.d.ts.map +1 -1
- package/dist/panel/resource-panel.js +9 -5
- package/dist/surface/mount-view.d.ts.map +1 -1
- package/dist/surface/mount-view.js +3 -2
- package/package.json +2 -2
- package/src/chart/line-chart.ts +3 -2
- package/src/control/select.ts +4 -2
- package/src/control/switch.ts +9 -2
- package/src/data/index.ts +3 -1
- package/src/data/list.ts +3 -1
- package/src/data/log-viewer.ts +7 -1
- package/src/data/markdown-view.ts +7 -1
- package/src/data/pagination.ts +3 -2
- package/src/display/error-state.ts +4 -3
- package/src/form/danger-zone.ts +7 -3
- package/src/form/form-actions.ts +5 -2
- package/src/navigation/menu.ts +3 -2
- package/src/overlay/command-palette.ts +66 -14
- package/src/overlay/dialog.ts +37 -1
- package/src/overlay/index.ts +11 -19
- package/src/overlay/path-picker.ts +23 -10
- package/src/overlay/prompt-dialog.ts +5 -4
- package/src/panel/index.ts +9 -7
- package/src/panel/resource-panel.ts +9 -4
- package/src/surface/mount-view.ts +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, nameOf, useEffect, useInput, useRuntime, useState, useTheme, } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, nameOf, useEffect, useI18n, useInput, useRuntime, useState, useTheme, } from '@textui/core';
|
|
2
2
|
import { TextInput } from '../control/index.js';
|
|
3
3
|
import { Menu } from '../navigation/index.js';
|
|
4
4
|
import { hint } from './shared.js';
|
|
@@ -17,6 +17,8 @@ export function parentOf(uri) {
|
|
|
17
17
|
export const PathPicker = defineComponent('PathPicker', (props) => {
|
|
18
18
|
const { start, wants = 'file', title, placeholder, visibleRows = 10, width = 60, onPick, onCancel, ...rest } = props;
|
|
19
19
|
const theme = useTheme();
|
|
20
|
+
const i18n = useI18n();
|
|
21
|
+
const ellipsis = theme.glyphs.ellipsis;
|
|
20
22
|
const runtime = useRuntime();
|
|
21
23
|
const app = runtime.app();
|
|
22
24
|
const [at, setAt] = useState(start);
|
|
@@ -63,7 +65,7 @@ export const PathPicker = defineComponent('PathPicker', (props) => {
|
|
|
63
65
|
// child to press enter on and a hidden chord for it is a chord nobody
|
|
64
66
|
// finds. It is first, since it is the answer most often wanted.
|
|
65
67
|
...(wants === 'directory'
|
|
66
|
-
? [{ id: '.', label: 'Use this folder', icon: theme.glyphs.check }]
|
|
68
|
+
? [{ id: '.', label: i18n.t('textui.pathPicker.useFolder', undefined, 'Use this folder'), icon: theme.glyphs.check }]
|
|
67
69
|
: []),
|
|
68
70
|
...(parent !== null ? [{ id: '..', label: '..', icon: theme.glyphs.chevronUp }] : []),
|
|
69
71
|
...shown.map((e) => ({
|
|
@@ -130,16 +132,18 @@ export const PathPicker = defineComponent('PathPicker', (props) => {
|
|
|
130
132
|
}
|
|
131
133
|
return false;
|
|
132
134
|
}, { global: true });
|
|
133
|
-
const move = `${theme.glyphs.arrowUp}${theme.glyphs.arrowDown} move
|
|
135
|
+
const move = i18n.t('textui.pathPicker.hint.move', { arrows: `${theme.glyphs.arrowUp}${theme.glyphs.arrowDown}` }, '{arrows} move');
|
|
134
136
|
return h('box', {
|
|
135
137
|
role: 'dialog',
|
|
136
|
-
label: title ?? 'Choose',
|
|
138
|
+
label: title ?? i18n.t('textui.pathPicker.label', undefined, 'Choose'),
|
|
137
139
|
border: theme.border,
|
|
138
140
|
bg: 'overlay',
|
|
139
141
|
width,
|
|
140
142
|
direction: 'column',
|
|
141
143
|
...(theme.border === 'none' ? { padding: { left: 1, right: 1 } } : {}),
|
|
142
|
-
title: ` ${title ?? (wants === 'directory'
|
|
144
|
+
title: ` ${title ?? (wants === 'directory'
|
|
145
|
+
? i18n.t('textui.pathPicker.titleFolder', undefined, 'choose a folder')
|
|
146
|
+
: i18n.t('textui.pathPicker.titleFile', undefined, 'choose a file'))} `,
|
|
143
147
|
...rest,
|
|
144
148
|
},
|
|
145
149
|
// Where you are. A column of bare names with no header is a list you can
|
|
@@ -161,7 +165,7 @@ export const PathPicker = defineComponent('PathPicker', (props) => {
|
|
|
161
165
|
*/
|
|
162
166
|
onEdge: (edge) => { if (edge === 'start')
|
|
163
167
|
up(); },
|
|
164
|
-
placeholder: placeholder ??
|
|
168
|
+
placeholder: placeholder ?? i18n.t('textui.pathPicker.placeholder', { ellipsis }, 'Filter{ellipsis}'),
|
|
165
169
|
search: true,
|
|
166
170
|
autoFocus: true,
|
|
167
171
|
border: 'none',
|
|
@@ -183,16 +187,20 @@ export const PathPicker = defineComponent('PathPicker', (props) => {
|
|
|
183
187
|
shown.length === 0
|
|
184
188
|
? h('text', {
|
|
185
189
|
content: loading
|
|
186
|
-
?
|
|
187
|
-
: (q === ''
|
|
190
|
+
? i18n.t('textui.pathPicker.reading', { ellipsis }, 'Reading{ellipsis}')
|
|
191
|
+
: (q === ''
|
|
192
|
+
? i18n.t('textui.pathPicker.empty', undefined, 'Nothing here.')
|
|
193
|
+
: i18n.t('textui.pathPicker.noMatch', undefined, 'Nothing matches.')),
|
|
188
194
|
fg: 'muted',
|
|
189
195
|
})
|
|
190
196
|
: null, h('box', { height: 1, fill: theme.borderChars().top, fg: 'borderSubtle' }), h('text', {
|
|
191
197
|
content: hint(theme, [
|
|
192
198
|
move,
|
|
193
|
-
wants === 'directory'
|
|
194
|
-
|
|
195
|
-
|
|
199
|
+
wants === 'directory'
|
|
200
|
+
? i18n.t('textui.pathPicker.hint.open', undefined, 'enter open')
|
|
201
|
+
: i18n.t('textui.pathPicker.hint.choose', undefined, 'enter choose'),
|
|
202
|
+
i18n.t('textui.pathPicker.hint.up', { glyph: theme.glyphs.chevronLeft }, '{glyph} up'),
|
|
203
|
+
i18n.t('textui.pathPicker.hint.cancel', undefined, 'esc cancel'),
|
|
196
204
|
]),
|
|
197
205
|
fg: 'subtle',
|
|
198
206
|
truncate: 'end',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-dialog.d.ts","sourceRoot":"","sources":["../../src/overlay/prompt-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAK7C,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"prompt-dialog.d.ts","sourceRoot":"","sources":["../../src/overlay/prompt-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAK7C,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,mEA8BvB,CAAC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent, h, useState } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useI18n, useState } from '@textui/core';
|
|
2
2
|
import { TextInput } from '../control/index.js';
|
|
3
3
|
import { Dialog } from './dialog.js';
|
|
4
4
|
export const PromptDialog = defineComponent('PromptDialog', (props) => {
|
|
5
5
|
const { title, message, placeholder, initialValue = '', mask, onSubmit, onCancel, ...rest } = props;
|
|
6
|
+
const i18n = useI18n();
|
|
6
7
|
const [value, setValue] = useState(initialValue);
|
|
7
8
|
return h(Dialog, {
|
|
8
|
-
title,
|
|
9
|
+
title: title ?? i18n.t('textui.promptDialog.title', undefined, 'Input'),
|
|
9
10
|
width: 50,
|
|
10
11
|
onClose: onCancel,
|
|
11
12
|
actions: [
|
|
12
|
-
{ id: 'ok', label: 'OK', tone: 'primary', onPress: () => onSubmit?.(value) },
|
|
13
|
-
{ id: 'cancel', label: 'Cancel', onPress: onCancel },
|
|
13
|
+
{ id: 'ok', label: i18n.t('textui.promptDialog.ok', undefined, 'OK'), tone: 'primary', onPress: () => onSubmit?.(value) },
|
|
14
|
+
{ id: 'cancel', label: i18n.t('textui.promptDialog.cancel', undefined, 'Cancel'), onPress: onCancel },
|
|
14
15
|
],
|
|
15
16
|
...rest,
|
|
16
17
|
}, message ? h('text', { content: message, wrap: 'word' }) : null, h(TextInput, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/panel/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EAEX,iBAAiB,EACjB,aAAa,EAEb,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAalE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,cAAc,qBAAqB,CAAC;AAEpC,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAEvD;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAEpF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAE/D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE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S,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,QAAQ,EAAE,CAAC,GACV,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CA0BlC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAUxD;AAgDD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,SAAS,GAAG,iBAAiB,EAAE,CAwFjE"}
|
package/dist/panel/index.js
CHANGED
|
@@ -182,18 +182,19 @@ export function panelCommands(app) {
|
|
|
182
182
|
* to draw it.
|
|
183
183
|
*/
|
|
184
184
|
const targetUri = (args, id) => args.uri ?? (id === null ? null : panelUri(app.store, id));
|
|
185
|
+
const category = app.i18n.t('textui.panel.category', undefined, 'View');
|
|
185
186
|
return [
|
|
186
187
|
{
|
|
187
188
|
id: 'panel.openWith',
|
|
188
|
-
title: 'Open With…',
|
|
189
|
-
category
|
|
189
|
+
title: app.i18n.t('textui.panel.openWith', undefined, 'Open With…'),
|
|
190
|
+
category,
|
|
190
191
|
slots: ['palette'],
|
|
191
192
|
when: PANEL_PATH,
|
|
192
193
|
args: [{
|
|
193
194
|
name: 'renderer',
|
|
194
195
|
type: 'string',
|
|
195
196
|
required: true,
|
|
196
|
-
description: 'How to show this resource',
|
|
197
|
+
description: app.i18n.t('textui.panel.renderer', undefined, 'How to show this resource'),
|
|
197
198
|
choices: async () => {
|
|
198
199
|
const id = activePanel(app.store);
|
|
199
200
|
return (await choicesFor(app, id === null ? null : panelUri(app.store, id)))
|
|
@@ -210,8 +211,8 @@ export function panelCommands(app) {
|
|
|
210
211
|
},
|
|
211
212
|
{
|
|
212
213
|
id: 'panel.nextRenderer',
|
|
213
|
-
title: 'Next View',
|
|
214
|
-
category
|
|
214
|
+
title: app.i18n.t('textui.panel.nextView', undefined, 'Next View'),
|
|
215
|
+
category,
|
|
215
216
|
slots: ['palette'],
|
|
216
217
|
when: PANEL_PATH,
|
|
217
218
|
run: async (args, ctx) => {
|
|
@@ -230,8 +231,8 @@ export function panelCommands(app) {
|
|
|
230
231
|
},
|
|
231
232
|
{
|
|
232
233
|
id: 'panel.toggleEdit',
|
|
233
|
-
title: 'Edit / View',
|
|
234
|
-
category
|
|
234
|
+
title: app.i18n.t('textui.panel.toggleEdit', undefined, 'Edit / View'),
|
|
235
|
+
category,
|
|
235
236
|
slots: ['palette'],
|
|
236
237
|
when: PANEL_PATH,
|
|
237
238
|
run: async (args, ctx) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-panel.d.ts","sourceRoot":"","sources":["../../src/panel/resource-panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,mBAAmB,EAEnB,QAAQ,EACR,0BAA0B,EAC3B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-panel.d.ts","sourceRoot":"","sources":["../../src/panel/resource-panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,mBAAmB,EAEnB,QAAQ,EACR,0BAA0B,EAC3B,MAAM,cAAc,CAAC;AAgBtB,sCAAsC;AACtC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,sCAAsC;AACtC,eAAO,MAAM,UAAU,EAAmB,WAAW,CAAC;AAEtD,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAEjD;AAED,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAElE;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAEpD;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CA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|
|
|
1
|
-
import { defineComponent, escapeSegment, h, useEffect, useFocusScope, useRef, useRuntime, useStoreValue, useTask, } from '@textui/core';
|
|
1
|
+
import { defineComponent, escapeSegment, h, useEffect, useFocusScope, useI18n, useRef, useRuntime, useStoreValue, useTask, } from '@textui/core';
|
|
2
2
|
import { EmptyState, ErrorState, Spinner } from '../display/index.js';
|
|
3
3
|
import { LOOSE, PanelContext } from './shared.js';
|
|
4
4
|
/** Every panel's remembered state. */
|
|
@@ -67,6 +67,7 @@ export function defaultRenderer(renderers) {
|
|
|
67
67
|
*/
|
|
68
68
|
export const ResourcePanel = defineComponent('ResourcePanel', (props) => {
|
|
69
69
|
const runtime = useRuntime();
|
|
70
|
+
const i18n = useI18n();
|
|
70
71
|
const { id: named, uri, renderer, mode, rendererProps, fallbackComponent, autoFocus, emptyTitle, ...rest } = props;
|
|
71
72
|
const app = runtime.app();
|
|
72
73
|
const scope = useFocusScope({
|
|
@@ -178,20 +179,23 @@ export const ResourcePanel = defineComponent('ResourcePanel', (props) => {
|
|
|
178
179
|
runtime.store.set(panelClaimPath(id), 0);
|
|
179
180
|
}, [id, claim, chosen?.id ?? null]);
|
|
180
181
|
if (!uri)
|
|
181
|
-
return h(EmptyState, { title: emptyTitle ?? 'Nothing selected', ...rest });
|
|
182
|
+
return h(EmptyState, { title: emptyTitle ?? i18n.t('textui.resourcePanel.empty', undefined, 'Nothing selected'), ...rest });
|
|
182
183
|
if (!app)
|
|
183
184
|
return null;
|
|
184
185
|
if (task.status === 'running' || task.status === 'idle') {
|
|
185
|
-
return h(Spinner, { label: 'Loading…', ...rest });
|
|
186
|
+
return h(Spinner, { label: i18n.t('textui.resourcePanel.loading', undefined, 'Loading…'), ...rest });
|
|
186
187
|
}
|
|
187
188
|
if (task.status === 'error')
|
|
188
189
|
return h(ErrorState, { error: task.error, ...rest });
|
|
189
190
|
if (!resource)
|
|
190
|
-
return h(EmptyState, { title: 'Not found', message: uri, ...rest });
|
|
191
|
+
return h(EmptyState, { title: i18n.t('textui.resourcePanel.notFound', undefined, 'Not found'), message: uri, ...rest });
|
|
191
192
|
if (!chosen) {
|
|
192
193
|
return h('box', { direction: 'column', flex: 1, id: scope, ...rest }, fallbackComponent
|
|
193
194
|
? { component: fallbackComponent, resource, uri }
|
|
194
|
-
: h(EmptyState, {
|
|
195
|
+
: h(EmptyState, {
|
|
196
|
+
title: i18n.t('textui.resourcePanel.noRenderer', undefined, 'No renderer'),
|
|
197
|
+
message: resource.kind,
|
|
198
|
+
}));
|
|
195
199
|
}
|
|
196
200
|
const node = {
|
|
197
201
|
component: chosen.component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount-view.d.ts","sourceRoot":"","sources":["../../src/surface/mount-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAiB,KAAK,EAAE,MAAM,cAAc,CAAC;AAIhF,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,KAAK,EAAE,KAAK,CAAC;CACd;AAED,+EAA+E;AAC/E,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"mount-view.d.ts","sourceRoot":"","sources":["../../src/surface/mount-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAiB,KAAK,EAAE,MAAM,cAAc,CAAC;AAIhF,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,KAAK,EAAE,KAAK,CAAC;CACd;AAED,+EAA+E;AAC/E,eAAO,MAAM,SAAS,gEAqBpB,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { defineComponent, h, useRuntime } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useI18n, useRuntime } from '@textui/core';
|
|
2
2
|
import { EmptyState } from '../display/index.js';
|
|
3
3
|
/** Renders one mount's target - an inline node, or a node read from a path. */
|
|
4
4
|
export const MountView = defineComponent('MountView', ({ mount, ...rest }) => {
|
|
5
5
|
const runtime = useRuntime();
|
|
6
|
+
const i18n = useI18n();
|
|
6
7
|
const target = mount.target;
|
|
7
8
|
const node = 'component' in target
|
|
8
9
|
? target
|
|
9
10
|
: (runtime.store.get(target.path) ?? null);
|
|
10
11
|
if (!node) {
|
|
11
|
-
return h(EmptyState, { title: 'Nothing mounted', ...rest });
|
|
12
|
+
return h(EmptyState, { title: i18n.t('textui.mountView.empty', undefined, 'Nothing mounted'), ...rest });
|
|
12
13
|
}
|
|
13
14
|
// A mount's data context makes relative paths inside it resolve against the
|
|
14
15
|
// record it was opened for.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textui/widgets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "The TextUI component catalog - layout, display, controls, data, overlays and charts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"terminal",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"test": "vitest run"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@textui/core": "^0.
|
|
49
|
+
"@textui/core": "^0.7.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
package/src/chart/line-chart.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PaintSurface, RenderContext } from '@textui/core';
|
|
2
|
-
import { defineComponent, fitTo, h, stringWidth, useTheme } from '@textui/core';
|
|
2
|
+
import { defineComponent, fitTo, h, stringWidth, useI18n, useTheme } from '@textui/core';
|
|
3
3
|
import type { LineChartProps } from './shared.js';
|
|
4
4
|
import { TONE, bounds, resample } from './shared.js';
|
|
5
5
|
|
|
@@ -9,6 +9,7 @@ import { TONE, bounds, resample } from './shared.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export const LineChart = defineComponent<LineChartProps>('LineChart', (props) => {
|
|
11
11
|
const theme = useTheme();
|
|
12
|
+
const i18n = useI18n();
|
|
12
13
|
const {
|
|
13
14
|
series, min, max, chartWidth, chartHeight = 8,
|
|
14
15
|
axis = true, area = false, format, ...rest
|
|
@@ -83,7 +84,7 @@ export const LineChart = defineComponent<LineChartProps>('LineChart', (props) =>
|
|
|
83
84
|
...series.map((s, i) =>
|
|
84
85
|
h('box', { key: i, direction: 'row', gap: 1 },
|
|
85
86
|
h('text', { content: theme.glyphs.bulletFilled, fg: TONE[s.tone ?? (i === 0 ? 'accent' : 'secondary')] }),
|
|
86
|
-
h('text', { content: s.label ??
|
|
87
|
+
h('text', { content: s.label ?? i18n.t('textui.lineChart.series', { n: i + 1 }, 'series {n}'), fg: 'muted' }))))
|
|
87
88
|
: null,
|
|
88
89
|
);
|
|
89
90
|
});
|
package/src/control/select.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BoxProps, ComponentNode, RenderOutput } from '@textui/core';
|
|
2
2
|
import {
|
|
3
|
-
defineComponent, h, useApp, useEffect, useFocus, useInput, useMeasure, useState, useTheme,
|
|
3
|
+
defineComponent, h, useApp, useEffect, useFocus, useI18n, useInput, useMeasure, useState, useTheme,
|
|
4
4
|
} from '@textui/core';
|
|
5
5
|
|
|
6
6
|
export interface SelectOption {
|
|
@@ -46,6 +46,7 @@ export interface SelectProps extends BoxProps {
|
|
|
46
46
|
|
|
47
47
|
export const Select = defineComponent<SelectProps>('Select', (props) => {
|
|
48
48
|
const theme = useTheme();
|
|
49
|
+
const i18n = useI18n();
|
|
49
50
|
const {
|
|
50
51
|
options, value, onChange, label, placeholder,
|
|
51
52
|
open: openProp, visibleRows = 6, disabled, mode = 'inline', ...rest
|
|
@@ -54,7 +55,8 @@ export const Select = defineComponent<SelectProps>('Select', (props) => {
|
|
|
54
55
|
const app = useApp();
|
|
55
56
|
const focus = useFocus({ disabled });
|
|
56
57
|
const measured = useMeasure();
|
|
57
|
-
const empty = placeholder
|
|
58
|
+
const empty = placeholder
|
|
59
|
+
?? i18n.t('textui.select.placeholder', { ellipsis: theme.glyphs.ellipsis }, 'Select{ellipsis}');
|
|
58
60
|
const [open, setOpen] = useState(openProp ?? false);
|
|
59
61
|
const index = Math.max(0, options.findIndex((o) => o.value === value));
|
|
60
62
|
const [highlight, setHighlight] = useState(index);
|
package/src/control/switch.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps } from '@textui/core';
|
|
2
|
-
import { defineComponent, h, useFocus, useInput } from '@textui/core';
|
|
2
|
+
import { defineComponent, h, useFocus, useI18n, useInput } from '@textui/core';
|
|
3
3
|
|
|
4
4
|
export interface SwitchProps extends BoxProps {
|
|
5
5
|
label?: string;
|
|
@@ -10,7 +10,14 @@ export interface SwitchProps extends BoxProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const Switch = defineComponent<SwitchProps>('Switch', (props) => {
|
|
13
|
-
const
|
|
13
|
+
const i18n = useI18n();
|
|
14
|
+
const {
|
|
15
|
+
label, value = false, onChange, disabled, ...rest
|
|
16
|
+
} = props;
|
|
17
|
+
const labels = props.labels ?? [
|
|
18
|
+
i18n.t('textui.switch.off', undefined, 'off'),
|
|
19
|
+
i18n.t('textui.switch.on', undefined, 'on'),
|
|
20
|
+
];
|
|
14
21
|
const focus = useFocus({ disabled });
|
|
15
22
|
|
|
16
23
|
useInput(
|
package/src/data/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
h,
|
|
7
7
|
stringWidth,
|
|
8
8
|
useFocus,
|
|
9
|
+
useI18n,
|
|
9
10
|
useInput,
|
|
10
11
|
useMeasure,
|
|
11
12
|
useState,
|
|
@@ -79,9 +80,10 @@ export interface TableProps<T extends object = Record<string, unknown>> extends
|
|
|
79
80
|
*/
|
|
80
81
|
const TableImpl = defineComponent<TableProps<Record<string, unknown>>>('Table', (props) => {
|
|
81
82
|
const theme = useTheme();
|
|
83
|
+
const i18n = useI18n();
|
|
82
84
|
const {
|
|
83
85
|
columns, rows, rowKey = 'id', selectedKey, onSelect, onActivate,
|
|
84
|
-
visibleRows, showHeader = true, emptyMessage = 'No rows',
|
|
86
|
+
visibleRows, showHeader = true, emptyMessage = i18n.t('textui.table.empty', undefined, 'No rows'),
|
|
85
87
|
focusable = true, responsive = true, width, ...rest
|
|
86
88
|
} = props;
|
|
87
89
|
|
package/src/data/list.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
defineComponent,
|
|
5
5
|
h,
|
|
6
6
|
useFocus,
|
|
7
|
+
useI18n,
|
|
7
8
|
useInput,
|
|
8
9
|
useMeasure,
|
|
9
10
|
useState,
|
|
@@ -98,9 +99,10 @@ export interface ListProps<T extends ListItem = ListItem> extends BoxProps {
|
|
|
98
99
|
|
|
99
100
|
function ListView<T extends ListItem>(props: ListProps<T>): RenderOutput {
|
|
100
101
|
const theme = useTheme();
|
|
102
|
+
const i18n = useI18n();
|
|
101
103
|
const {
|
|
102
104
|
items, selectedId, onSelect, onActivate, visibleRows,
|
|
103
|
-
emptyMessage = 'Nothing here', marker = true, focusable = true,
|
|
105
|
+
emptyMessage = i18n.t('textui.list.empty', undefined, 'Nothing here'), marker = true, focusable = true,
|
|
104
106
|
autoFocus, focusId, renderItem, itemHeight = 1, ...rest
|
|
105
107
|
} = props;
|
|
106
108
|
|
package/src/data/log-viewer.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
defineComponent,
|
|
5
5
|
h,
|
|
6
6
|
useFocus,
|
|
7
|
+
useI18n,
|
|
7
8
|
useInput,
|
|
8
9
|
useMeasure,
|
|
9
10
|
useState,
|
|
@@ -45,6 +46,7 @@ export const LogViewer = defineComponent<LogViewerProps>('LogViewer', (props) =>
|
|
|
45
46
|
lines, visibleRows: visibleRowsProp, follow: followProp, showTime = true,
|
|
46
47
|
showLevel = true, onFollowChange, ...rest
|
|
47
48
|
} = props;
|
|
49
|
+
const i18n = useI18n();
|
|
48
50
|
|
|
49
51
|
const focus = useFocus({});
|
|
50
52
|
const measured = useMeasure();
|
|
@@ -99,7 +101,11 @@ export const LogViewer = defineComponent<LogViewerProps>('LogViewer', (props) =>
|
|
|
99
101
|
h('text', { content: line.message, flex: 1, truncate: 'end' }),
|
|
100
102
|
)),
|
|
101
103
|
!follow
|
|
102
|
-
? h('text', {
|
|
104
|
+
? h('text', {
|
|
105
|
+
content: ` ${i18n.t('textui.logViewer.paused', undefined, 'paused - end to follow')}`,
|
|
106
|
+
fg: 'warning',
|
|
107
|
+
dim: true,
|
|
108
|
+
})
|
|
103
109
|
: null,
|
|
104
110
|
);
|
|
105
111
|
});
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
h,
|
|
5
5
|
layoutMarkdown,
|
|
6
6
|
repeatToWidth,
|
|
7
|
+
useI18n,
|
|
7
8
|
useMeasure,
|
|
8
9
|
useMemo,
|
|
9
10
|
useTheme,
|
|
@@ -52,6 +53,7 @@ export const MarkdownView = defineComponent<MarkdownViewProps>('MarkdownView', (
|
|
|
52
53
|
// a document with no search over it carries no extra prop per run.
|
|
53
54
|
const hit = match ? { match } : {};
|
|
54
55
|
const theme = useTheme();
|
|
56
|
+
const i18n = useI18n();
|
|
55
57
|
const measured = useMeasure();
|
|
56
58
|
const width = measured.width > 0 ? measured.width : 0;
|
|
57
59
|
const ruled = theme.border !== 'none';
|
|
@@ -221,7 +223,11 @@ export const MarkdownView = defineComponent<MarkdownViewProps>('MarkdownView', (
|
|
|
221
223
|
return h('box', { role: 'document', direction: 'column', ...rest },
|
|
222
224
|
...out,
|
|
223
225
|
hidden > 0
|
|
224
|
-
? h('text', { content:
|
|
226
|
+
? h('text', { content: i18n.t(
|
|
227
|
+
'textui.markdown.moreLines',
|
|
228
|
+
{ glyph: theme.glyphs.ellipsis, count: hidden },
|
|
229
|
+
'{glyph} {count} more lines',
|
|
230
|
+
), fg: 'subtle' })
|
|
225
231
|
: null,
|
|
226
232
|
);
|
|
227
233
|
});
|
package/src/data/pagination.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps } from '@textui/core';
|
|
2
|
-
import { defineComponent, h, useFocus, useInput, useTheme } from '@textui/core';
|
|
2
|
+
import { defineComponent, h, useFocus, useI18n, useInput, useTheme } from '@textui/core';
|
|
3
3
|
|
|
4
4
|
export interface PaginationProps extends BoxProps {
|
|
5
5
|
page: number;
|
|
@@ -10,6 +10,7 @@ export interface PaginationProps extends BoxProps {
|
|
|
10
10
|
|
|
11
11
|
export const Pagination = defineComponent<PaginationProps>('Pagination', (props) => {
|
|
12
12
|
const theme = useTheme();
|
|
13
|
+
const i18n = useI18n();
|
|
13
14
|
const { page, pageCount, total, onChange, ...rest } = props;
|
|
14
15
|
const focus = useFocus({});
|
|
15
16
|
|
|
@@ -26,6 +27,6 @@ export const Pagination = defineComponent<PaginationProps>('Pagination', (props)
|
|
|
26
27
|
h('text', { content: theme.glyphs.chevronLeft, fg: page > 1 ? 'accent' : 'disabled' }),
|
|
27
28
|
h('text', { content: `${page} / ${pageCount}`, bold: focus.focused }),
|
|
28
29
|
h('text', { content: theme.glyphs.chevronRight, fg: page < pageCount ? 'accent' : 'disabled' }),
|
|
29
|
-
total !== undefined ? h('text', { content:
|
|
30
|
+
total !== undefined ? h('text', { content: i18n.t('textui.pagination.total', { total }, '{total} items'), fg: 'muted' }) : null,
|
|
30
31
|
);
|
|
31
32
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps } from '@textui/core';
|
|
2
|
-
import { defineComponent, h, useTheme } from '@textui/core';
|
|
2
|
+
import { defineComponent, h, useI18n, useTheme } from '@textui/core';
|
|
3
3
|
|
|
4
4
|
export interface ErrorStateProps extends BoxProps {
|
|
5
5
|
title?: string;
|
|
@@ -10,7 +10,8 @@ export interface ErrorStateProps extends BoxProps {
|
|
|
10
10
|
|
|
11
11
|
export const ErrorState = defineComponent<ErrorStateProps>('ErrorState', (props) => {
|
|
12
12
|
const theme = useTheme();
|
|
13
|
-
const
|
|
13
|
+
const i18n = useI18n();
|
|
14
|
+
const { title = i18n.t('textui.errorState.title', undefined, 'Something went wrong'), error, onRetry, ...rest } = props;
|
|
14
15
|
const message = error instanceof Error ? error.message : String(error);
|
|
15
16
|
|
|
16
17
|
return h('box', { role: 'alert', direction: 'column', gap: 1, padding: 1, ...rest },
|
|
@@ -18,6 +19,6 @@ export const ErrorState = defineComponent<ErrorStateProps>('ErrorState', (props)
|
|
|
18
19
|
h('text', { content: theme.glyphs.cross, fg: 'danger' }),
|
|
19
20
|
h('text', { content: title, bold: true, fg: 'danger' })),
|
|
20
21
|
h('text', { content: message, fg: 'muted', wrap: 'word' }),
|
|
21
|
-
onRetry ? h('text', { content: 'r retry', fg: 'subtle' }) : null,
|
|
22
|
+
onRetry ? h('text', { content: i18n.t('textui.errorState.retry', undefined, 'r retry'), fg: 'subtle' }) : null,
|
|
22
23
|
);
|
|
23
24
|
});
|
package/src/form/danger-zone.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps } from '@textui/core';
|
|
2
|
-
import { defineComponent, h, useTheme } from '@textui/core';
|
|
2
|
+
import { defineComponent, h, useI18n, useTheme } from '@textui/core';
|
|
3
3
|
import { Button } from '../control/index.js';
|
|
4
4
|
|
|
5
5
|
export interface DangerZoneProps extends BoxProps {
|
|
@@ -13,8 +13,9 @@ export interface DangerZoneProps extends BoxProps {
|
|
|
13
13
|
|
|
14
14
|
export const DangerZone = defineComponent<DangerZoneProps>('DangerZone', (props) => {
|
|
15
15
|
const theme = useTheme();
|
|
16
|
+
const i18n = useI18n();
|
|
16
17
|
const {
|
|
17
|
-
title = 'Danger zone', description, actionLabel, onAction, confirmText, ...rest
|
|
18
|
+
title = i18n.t('textui.dangerZone.title', undefined, 'Danger zone'), description, actionLabel, onAction, confirmText, ...rest
|
|
18
19
|
} = props;
|
|
19
20
|
|
|
20
21
|
return h('box', {
|
|
@@ -26,7 +27,10 @@ export const DangerZone = defineComponent<DangerZoneProps>('DangerZone', (props)
|
|
|
26
27
|
},
|
|
27
28
|
description ? h('text', { content: description, fg: 'muted', wrap: 'word' }) : null,
|
|
28
29
|
confirmText
|
|
29
|
-
? h('text', {
|
|
30
|
+
? h('text', {
|
|
31
|
+
content: i18n.t('textui.dangerZone.confirm', { text: confirmText }, 'Type "{text}" to confirm.'),
|
|
32
|
+
fg: 'subtle',
|
|
33
|
+
})
|
|
30
34
|
: null,
|
|
31
35
|
h('box', { direction: 'row', justify: 'end' },
|
|
32
36
|
h(Button, { label: actionLabel, tone: 'danger', variant: 'outline', onPress: onAction })),
|
package/src/form/form-actions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps, SemanticVariant } from '@textui/core';
|
|
2
|
-
import { defineComponent, h, useTheme } from '@textui/core';
|
|
2
|
+
import { defineComponent, h, useI18n, useTheme } from '@textui/core';
|
|
3
3
|
import { Button } from '../control/index.js';
|
|
4
4
|
import { useFormContext } from './shared.js';
|
|
5
5
|
|
|
@@ -14,9 +14,12 @@ export interface FormActionsProps extends BoxProps {
|
|
|
14
14
|
|
|
15
15
|
export const FormActions = defineComponent<FormActionsProps>('FormActions', (props) => {
|
|
16
16
|
const theme = useTheme();
|
|
17
|
+
const i18n = useI18n();
|
|
17
18
|
const form = useFormContext();
|
|
18
19
|
const {
|
|
19
|
-
submitLabel = '
|
|
20
|
+
submitLabel = i18n.t('textui.formActions.submit', undefined, 'Submit'),
|
|
21
|
+
cancelLabel = i18n.t('textui.formActions.cancel', undefined, 'Cancel'),
|
|
22
|
+
onCancel,
|
|
20
23
|
tone = 'primary', requireDirty = false, ...rest
|
|
21
24
|
} = props;
|
|
22
25
|
|
package/src/navigation/menu.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps, SemanticVariant } from '@textui/core';
|
|
2
|
-
import { defineComponent, h, stringWidth, useFocus, useInput, useState, useTheme } from '@textui/core';
|
|
2
|
+
import { defineComponent, h, stringWidth, useFocus, useI18n, useInput, useState, useTheme } from '@textui/core';
|
|
3
3
|
import { Marquee } from '../display/index.js';
|
|
4
4
|
import { TONE } from '../tone.js';
|
|
5
5
|
|
|
@@ -63,6 +63,7 @@ export interface MenuProps extends BoxProps {
|
|
|
63
63
|
|
|
64
64
|
export const Menu = defineComponent<MenuProps>('Menu', (props) => {
|
|
65
65
|
const theme = useTheme();
|
|
66
|
+
const i18n = useI18n();
|
|
66
67
|
const {
|
|
67
68
|
items, onSelect, visibleRows, activeId, autoFocus, interactive = true,
|
|
68
69
|
descriptions = 'inline', ...rest
|
|
@@ -188,7 +189,7 @@ export const Menu = defineComponent<MenuProps>('Menu', (props) => {
|
|
|
188
189
|
: [row];
|
|
189
190
|
}),
|
|
190
191
|
selectable.length === 0
|
|
191
|
-
? h('text', { content: '
|
|
192
|
+
? h('text', { content: ` ${i18n.t('textui.menu.noMatch', undefined, 'no matches')}`, fg: 'subtle' })
|
|
192
193
|
: null,
|
|
193
194
|
);
|
|
194
195
|
});
|