@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../src/chart/line-chart.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../src/chart/line-chart.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,SAAS,gEAgFpB,CAAC"}
|
package/dist/chart/line-chart.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, fitTo, h, stringWidth, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, fitTo, h, stringWidth, useI18n, useTheme } from '@textui/core';
|
|
2
2
|
import { TONE, bounds, resample } from './shared.js';
|
|
3
3
|
/**
|
|
4
4
|
* A line chart on a braille canvas: each cell holds a 2x4 dot grid, so a
|
|
@@ -6,6 +6,7 @@ import { TONE, bounds, resample } from './shared.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export const LineChart = defineComponent('LineChart', (props) => {
|
|
8
8
|
const theme = useTheme();
|
|
9
|
+
const i18n = useI18n();
|
|
9
10
|
const { series, min, max, chartWidth, chartHeight = 8, axis = true, area = false, format, ...rest } = props;
|
|
10
11
|
const all = series.flatMap((s) => s.values);
|
|
11
12
|
const [lo, hi] = bounds(all, min, max);
|
|
@@ -60,7 +61,7 @@ export const LineChart = defineComponent('LineChart', (props) => {
|
|
|
60
61
|
const fmt = format ?? ((v) => (Number.isInteger(v) ? String(v) : v.toFixed(1)));
|
|
61
62
|
const axisWidth = Math.max(stringWidth(fmt(hi)), stringWidth(fmt(lo)));
|
|
62
63
|
return h('box', { direction: 'column', ...rest }, h('box', { direction: 'row', gap: 1 }, h('box', { direction: 'column', width: axisWidth, height: chartHeight, justify: 'between' }, h('text', { content: fitTo(fmt(hi), axisWidth, 'right'), fg: 'subtle' }), h('text', { content: fitTo(fmt(lo), axisWidth, 'right'), fg: 'subtle' })), chart), series.some((s) => s.label)
|
|
63
|
-
? h('box', { direction: 'row', gap: 2 }, ...series.map((s, i) => h('box', { key: i, direction: 'row', gap: 1 }, h('text', { content: theme.glyphs.bulletFilled, fg: TONE[s.tone ?? (i === 0 ? 'accent' : 'secondary')] }), h('text', { content: s.label ??
|
|
64
|
+
? h('box', { direction: 'row', gap: 2 }, ...series.map((s, i) => h('box', { key: i, direction: 'row', gap: 1 }, h('text', { content: theme.glyphs.bulletFilled, fg: TONE[s.tone ?? (i === 0 ? 'accent' : 'secondary')] }), h('text', { content: s.label ?? i18n.t('textui.lineChart.series', { n: i + 1 }, 'series {n}'), fg: 'muted' }))))
|
|
64
65
|
: null);
|
|
65
66
|
});
|
|
66
67
|
function brailleBit(x, y) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/control/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAiB,YAAY,EAAE,MAAM,cAAc,CAAC;AAK1E,MA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MAAM,CAAC;IACrB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;CACxC;AAED,eAAO,MAAM,MAAM,sCAmMjB,CAAC"}
|
package/dist/control/select.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { defineComponent, h, useApp, useEffect, useFocus, useInput, useMeasure, useState, useTheme, } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useApp, useEffect, useFocus, useI18n, useInput, useMeasure, useState, useTheme, } from '@textui/core';
|
|
2
2
|
export const Select = defineComponent('Select', (props) => {
|
|
3
3
|
const theme = useTheme();
|
|
4
|
+
const i18n = useI18n();
|
|
4
5
|
const { options, value, onChange, label, placeholder, open: openProp, visibleRows = 6, disabled, mode = 'inline', ...rest } = props;
|
|
5
6
|
const app = useApp();
|
|
6
7
|
const focus = useFocus({ disabled });
|
|
7
8
|
const measured = useMeasure();
|
|
8
|
-
const empty = placeholder
|
|
9
|
+
const empty = placeholder
|
|
10
|
+
?? i18n.t('textui.select.placeholder', { ellipsis: theme.glyphs.ellipsis }, 'Select{ellipsis}');
|
|
9
11
|
const [open, setOpen] = useState(openProp ?? false);
|
|
10
12
|
const index = Math.max(0, options.findIndex((o) => o.value === value));
|
|
11
13
|
const [highlight, setHighlight] = useState(index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/control/switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/control/switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,MAAM,6DAkCjB,CAAC"}
|
package/dist/control/switch.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { defineComponent, h, useFocus, useInput } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useFocus, useI18n, useInput } from '@textui/core';
|
|
2
2
|
export const Switch = defineComponent('Switch', (props) => {
|
|
3
|
-
const
|
|
3
|
+
const i18n = useI18n();
|
|
4
|
+
const { label, value = false, onChange, disabled, ...rest } = props;
|
|
5
|
+
const labels = props.labels ?? [
|
|
6
|
+
i18n.t('textui.switch.off', undefined, 'off'),
|
|
7
|
+
i18n.t('textui.switch.on', undefined, 'on'),
|
|
8
|
+
];
|
|
4
9
|
const focus = useFocus({ disabled });
|
|
5
10
|
useInput((event) => {
|
|
6
11
|
if (disabled)
|
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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,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;AA6JD;;;;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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chorded, defineComponent, fitTo, h, stringWidth, useFocus, useInput, useMeasure, useState, useTheme, } from '@textui/core';
|
|
1
|
+
import { chorded, defineComponent, fitTo, h, stringWidth, useFocus, useI18n, useInput, useMeasure, useState, useTheme, } from '@textui/core';
|
|
2
2
|
import { EmptyState } from '../display/index.js';
|
|
3
3
|
import { TONE } from '../tone.js';
|
|
4
4
|
import { viewportRows } from '../viewport.js';
|
|
@@ -34,7 +34,8 @@ export * from './tree.js';
|
|
|
34
34
|
*/
|
|
35
35
|
const TableImpl = defineComponent('Table', (props) => {
|
|
36
36
|
const theme = useTheme();
|
|
37
|
-
const
|
|
37
|
+
const i18n = useI18n();
|
|
38
|
+
const { columns, rows, rowKey = 'id', selectedKey, onSelect, onActivate, visibleRows, showHeader = true, emptyMessage = i18n.t('textui.table.empty', undefined, 'No rows'), focusable = true, responsive = true, width, ...rest } = props;
|
|
38
39
|
const focus = useFocus({ disabled: !focusable });
|
|
39
40
|
const measured = useMeasure();
|
|
40
41
|
const [internalKey, setInternalKey] = useState(null);
|
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;
|
|
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,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,QAAQ;IACxE;;;;;;;;OAQG;IACH,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACrC,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACvC,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,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,CAgIvE;AAED,eAAO,MAAM,IAAI,EAA8E,OAAO,QAAQ,CAAC"}
|
package/dist/data/list.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { chorded, defineComponent, h, useFocus, useInput, useMeasure, useState, useTheme, } from '@textui/core';
|
|
1
|
+
import { chorded, defineComponent, h, useFocus, useI18n, useInput, useMeasure, useState, useTheme, } from '@textui/core';
|
|
2
2
|
import { EmptyState } from '../display/index.js';
|
|
3
3
|
import { TONE } from '../tone.js';
|
|
4
4
|
import { viewportRows } from '../viewport.js';
|
|
5
5
|
function ListView(props) {
|
|
6
6
|
const theme = useTheme();
|
|
7
|
-
const
|
|
7
|
+
const i18n = useI18n();
|
|
8
|
+
const { items, selectedId, onSelect, onActivate, visibleRows, emptyMessage = i18n.t('textui.list.empty', undefined, 'Nothing here'), marker = true, focusable = true, autoFocus, focusId, renderItem, itemHeight = 1, ...rest } = props;
|
|
8
9
|
const focus = useFocus({
|
|
9
10
|
...(focusId ? { id: focusId } : {}),
|
|
10
11
|
disabled: !focusable,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-viewer.d.ts","sourceRoot":"","sources":["../../src/data/log-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"log-viewer.d.ts","sourceRoot":"","sources":["../../src/data/log-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,cAAc,CAAC;AAc9D,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACxC;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,gEAmEpB,CAAC"}
|
package/dist/data/log-viewer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chorded, defineComponent, h, useFocus, useInput, useMeasure, useState, } from '@textui/core';
|
|
1
|
+
import { chorded, defineComponent, h, useFocus, useI18n, useInput, useMeasure, useState, } from '@textui/core';
|
|
2
2
|
import { TONE } from '../tone.js';
|
|
3
3
|
import { viewportRows } from '../viewport.js';
|
|
4
4
|
const LEVEL_TONE = {
|
|
@@ -13,6 +13,7 @@ const LEVEL_TONE = {
|
|
|
13
13
|
*/
|
|
14
14
|
export const LogViewer = defineComponent('LogViewer', (props) => {
|
|
15
15
|
const { lines, visibleRows: visibleRowsProp, follow: followProp, showTime = true, showLevel = true, onFollowChange, ...rest } = props;
|
|
16
|
+
const i18n = useI18n();
|
|
16
17
|
const focus = useFocus({});
|
|
17
18
|
const measured = useMeasure();
|
|
18
19
|
const [offset, setOffset] = useState(0);
|
|
@@ -64,6 +65,10 @@ export const LogViewer = defineComponent('LogViewer', (props) => {
|
|
|
64
65
|
fg: TONE[LEVEL_TONE[line.level] ?? 'muted'],
|
|
65
66
|
})
|
|
66
67
|
: null, line.source ? h('text', { content: line.source, fg: 'muted' }) : null, h('text', { content: line.message, flex: 1, truncate: 'end' }))), !follow
|
|
67
|
-
? h('text', {
|
|
68
|
+
? h('text', {
|
|
69
|
+
content: ` ${i18n.t('textui.logViewer.paused', undefined, 'paused - end to follow')}`,
|
|
70
|
+
fg: 'warning',
|
|
71
|
+
dim: true,
|
|
72
|
+
})
|
|
68
73
|
: null);
|
|
69
74
|
});
|
|
@@ -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;
|
|
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,mEAuLvB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, layoutMarkdown, repeatToWidth, useMeasure, useMemo, useTheme, } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, layoutMarkdown, repeatToWidth, useI18n, useMeasure, useMemo, useTheme, } from '@textui/core';
|
|
2
2
|
import { CodeViewer } from './code-viewer.js';
|
|
3
3
|
/**
|
|
4
4
|
* Markdown, drawn into the width it was given.
|
|
@@ -19,6 +19,7 @@ export const MarkdownView = defineComponent('MarkdownView', (props) => {
|
|
|
19
19
|
// a document with no search over it carries no extra prop per run.
|
|
20
20
|
const hit = match ? { match } : {};
|
|
21
21
|
const theme = useTheme();
|
|
22
|
+
const i18n = useI18n();
|
|
22
23
|
const measured = useMeasure();
|
|
23
24
|
const width = measured.width > 0 ? measured.width : 0;
|
|
24
25
|
const ruled = theme.border !== 'none';
|
|
@@ -166,7 +167,7 @@ export const MarkdownView = defineComponent('MarkdownView', (props) => {
|
|
|
166
167
|
i++;
|
|
167
168
|
}
|
|
168
169
|
return h('box', { role: 'document', direction: 'column', ...rest }, ...out, hidden > 0
|
|
169
|
-
? h('text', { content:
|
|
170
|
+
? h('text', { content: i18n.t('textui.markdown.moreLines', { glyph: theme.glyphs.ellipsis, count: hidden }, '{glyph} {count} more lines'), fg: 'subtle' })
|
|
170
171
|
: null);
|
|
171
172
|
});
|
|
172
173
|
/** 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,iEAqBrB,CAAC"}
|
package/dist/data/pagination.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent, h, useFocus, useInput, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useFocus, useI18n, useInput, useTheme } from '@textui/core';
|
|
2
2
|
export const Pagination = defineComponent('Pagination', (props) => {
|
|
3
3
|
const theme = useTheme();
|
|
4
|
+
const i18n = useI18n();
|
|
4
5
|
const { page, pageCount, total, onChange, ...rest } = props;
|
|
5
6
|
const focus = useFocus({});
|
|
6
7
|
useInput((event) => {
|
|
@@ -14,5 +15,5 @@ export const Pagination = defineComponent('Pagination', (props) => {
|
|
|
14
15
|
}
|
|
15
16
|
return false;
|
|
16
17
|
}, { focusId: focus.id });
|
|
17
|
-
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:
|
|
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.t('textui.pagination.total', { total }, '{total} items'), fg: 'muted' }) : null);
|
|
18
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-state.d.ts","sourceRoot":"","sources":["../../src/display/error-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"error-state.d.ts","sourceRoot":"","sources":["../../src/display/error-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,iEAarB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent, h, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useI18n, useTheme } from '@textui/core';
|
|
2
2
|
export const ErrorState = defineComponent('ErrorState', (props) => {
|
|
3
3
|
const theme = useTheme();
|
|
4
|
-
const
|
|
4
|
+
const i18n = useI18n();
|
|
5
|
+
const { title = i18n.t('textui.errorState.title', undefined, 'Something went wrong'), error, onRetry, ...rest } = props;
|
|
5
6
|
const message = error instanceof Error ? error.message : String(error);
|
|
6
|
-
return h('box', { role: 'alert', direction: 'column', gap: 1, padding: 1, ...rest }, h('box', { direction: 'row', gap: 1 }, h('text', { content: theme.glyphs.cross, fg: 'danger' }), h('text', { content: title, bold: true, fg: 'danger' })), h('text', { content: message, fg: 'muted', wrap: 'word' }), onRetry ? h('text', { content: 'r retry', fg: 'subtle' }) : null);
|
|
7
|
+
return h('box', { role: 'alert', direction: 'column', gap: 1, padding: 1, ...rest }, h('box', { direction: 'row', gap: 1 }, h('text', { content: theme.glyphs.cross, fg: 'danger' }), h('text', { content: title, bold: true, fg: 'danger' })), h('text', { content: message, fg: 'muted', wrap: 'word' }), onRetry ? h('text', { content: i18n.t('textui.errorState.retry', undefined, 'r retry'), fg: 'subtle' }) : null);
|
|
7
8
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"danger-zone.d.ts","sourceRoot":"","sources":["../../src/form/danger-zone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,IAAI,CAAC;IAClB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"danger-zone.d.ts","sourceRoot":"","sources":["../../src/form/danger-zone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,IAAI,CAAC;IAClB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,iEAwBrB,CAAC"}
|
package/dist/form/danger-zone.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, h, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useI18n, useTheme } from '@textui/core';
|
|
2
2
|
import { Button } from '../control/index.js';
|
|
3
3
|
export const DangerZone = defineComponent('DangerZone', (props) => {
|
|
4
4
|
const theme = useTheme();
|
|
5
|
-
const
|
|
5
|
+
const i18n = useI18n();
|
|
6
|
+
const { title = i18n.t('textui.dangerZone.title', undefined, 'Danger zone'), description, actionLabel, onAction, confirmText, ...rest } = props;
|
|
6
7
|
return h('box', {
|
|
7
8
|
border: { style: theme.border, color: 'danger' },
|
|
8
9
|
padding: [0, 1],
|
|
@@ -10,6 +11,9 @@ export const DangerZone = defineComponent('DangerZone', (props) => {
|
|
|
10
11
|
title: ` ${title} `,
|
|
11
12
|
...rest,
|
|
12
13
|
}, description ? h('text', { content: description, fg: 'muted', wrap: 'word' }) : null, confirmText
|
|
13
|
-
? h('text', {
|
|
14
|
+
? h('text', {
|
|
15
|
+
content: i18n.t('textui.dangerZone.confirm', { text: confirmText }, 'Type "{text}" to confirm.'),
|
|
16
|
+
fg: 'subtle',
|
|
17
|
+
})
|
|
14
18
|
: null, h('box', { direction: 'row', justify: 'end' }, h(Button, { label: actionLabel, tone: 'danger', variant: 'outline', onPress: onAction })));
|
|
15
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-actions.d.ts","sourceRoot":"","sources":["../../src/form/form-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"form-actions.d.ts","sourceRoot":"","sources":["../../src/form/form-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,kEAuBtB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent, h, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useI18n, useTheme } from '@textui/core';
|
|
2
2
|
import { Button } from '../control/index.js';
|
|
3
3
|
import { useFormContext } from './shared.js';
|
|
4
4
|
export const FormActions = defineComponent('FormActions', (props) => {
|
|
5
5
|
const theme = useTheme();
|
|
6
|
+
const i18n = useI18n();
|
|
6
7
|
const form = useFormContext();
|
|
7
|
-
const { submitLabel = 'Submit', cancelLabel = 'Cancel', onCancel, tone = 'primary', requireDirty = false, ...rest } = props;
|
|
8
|
+
const { submitLabel = i18n.t('textui.formActions.submit', undefined, 'Submit'), cancelLabel = i18n.t('textui.formActions.cancel', undefined, 'Cancel'), onCancel, tone = 'primary', requireDirty = false, ...rest } = props;
|
|
8
9
|
const blocked = form.submitting || (requireDirty && !form.dirty);
|
|
9
10
|
return h('box', { direction: 'row', gap: 1, justify: 'end', ...rest }, onCancel ? h(Button, { label: cancelLabel, onPress: onCancel }) : null, h(Button, {
|
|
10
11
|
label: form.submitting ? `${submitLabel}${theme.glyphs.ellipsis}` : submitLabel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/navigation/menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5C,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/navigation/menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5C,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,IAAI,2DAmIf,CAAC"}
|
package/dist/navigation/menu.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, h, stringWidth, useFocus, useInput, useState, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, stringWidth, useFocus, useI18n, useInput, useState, useTheme } from '@textui/core';
|
|
2
2
|
import { Marquee } from '../display/index.js';
|
|
3
3
|
import { TONE } from '../tone.js';
|
|
4
4
|
export const Menu = defineComponent('Menu', (props) => {
|
|
5
5
|
const theme = useTheme();
|
|
6
|
+
const i18n = useI18n();
|
|
6
7
|
const { items, onSelect, visibleRows, activeId, autoFocus, interactive = true, descriptions = 'inline', ...rest } = props;
|
|
7
8
|
const focus = useFocus({ autoFocus, disabled: !interactive });
|
|
8
9
|
const selectable = items.filter((i) => !i.disabled);
|
|
@@ -110,7 +111,7 @@ export const Menu = defineComponent('Menu', (props) => {
|
|
|
110
111
|
? [h('box', { key: `${item.id}-sep`, height: 1, fill: theme.borderChars().top, fg: 'borderSubtle' }), row]
|
|
111
112
|
: [row];
|
|
112
113
|
}), selectable.length === 0
|
|
113
|
-
? h('text', { content: '
|
|
114
|
+
? h('text', { content: ` ${i18n.t('textui.menu.noMatch', undefined, 'no matches')}`, fg: 'subtle' })
|
|
114
115
|
: null);
|
|
115
116
|
});
|
|
116
117
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../src/overlay/command-palette.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../src/overlay/command-palette.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAa,MAAM,cAAc,CAAC;AAkB/F,MAAM,WAAW,mBAAoB,SAAQ,QAAQ;IACnD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,iBAAiB,EAAE,CAAC,CAAC;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,KAAK,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAyBD,eAAO,MAAM,cAAc,qEAsezB,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,EAC1B,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACtC,OAAO,GAAG,SAAS,CAKrB;AA2DD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAehG"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { defineComponent, h, stringWidth, useEffect, useFocusScope, useInput, useRuntime, useState, useTheme, } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, stringWidth, useEffect, useFocusScope, 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';
|
|
5
5
|
export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
6
6
|
const theme = useTheme();
|
|
7
|
+
const i18n = useI18n();
|
|
8
|
+
const ellipsis = theme.glyphs.ellipsis;
|
|
7
9
|
const runtime = useRuntime();
|
|
8
10
|
const { commands, placeholder, onRun, onClose, execute = true, grouped = true, visibleRows = 8, width, maxWidth = 60, openAt, descriptions = 'inline', ...rest } = props;
|
|
9
11
|
const [query, setQuery] = useState('');
|
|
@@ -28,7 +30,9 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
28
30
|
const app = runtime.app();
|
|
29
31
|
const given = typeof commands === 'function' ? commands() : commands;
|
|
30
32
|
const all = given ?? app?.commands.list({ slot: 'palette', enabledOnly: true }) ?? [];
|
|
31
|
-
const matches = pending
|
|
33
|
+
const matches = pending
|
|
34
|
+
? []
|
|
35
|
+
: grouped && query.trim() === '' ? byCategory(all) : filterCommands(all, query);
|
|
32
36
|
const offered = pending ? filterChoices(choices, query) : [];
|
|
33
37
|
const rows = pending ? offered.map((choice) => choice.value) : matches.map((c) => c.id);
|
|
34
38
|
const index = Math.max(0, Math.min(highlight, rows.length - 1));
|
|
@@ -42,7 +46,9 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
42
46
|
// the only thing the palette itself knows about a value.
|
|
43
47
|
...(choice.description
|
|
44
48
|
? { description: choice.description }
|
|
45
|
-
: pending.arg.default === choice.value
|
|
49
|
+
: pending.arg.default === choice.value
|
|
50
|
+
? { description: i18n.t('textui.palette.default', undefined, 'default') }
|
|
51
|
+
: {}),
|
|
46
52
|
}))
|
|
47
53
|
// One row, saying which kind of nothing this is. A disabled item rather
|
|
48
54
|
// than no items: the panel keeps its height, so the answer arriving does
|
|
@@ -50,8 +56,10 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
50
56
|
: [{
|
|
51
57
|
id: '',
|
|
52
58
|
label: asking
|
|
53
|
-
?
|
|
54
|
-
: (query === ''
|
|
59
|
+
? i18n.t('textui.palette.asking', { ellipsis }, 'Asking{ellipsis}')
|
|
60
|
+
: (query === ''
|
|
61
|
+
? i18n.t('textui.palette.nothingToChoose', undefined, 'Nothing to choose')
|
|
62
|
+
: i18n.t('textui.palette.noMatch', undefined, 'No match')),
|
|
55
63
|
disabled: true,
|
|
56
64
|
}])
|
|
57
65
|
: matches.map((command, i) => ({
|
|
@@ -304,7 +312,8 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
304
312
|
return false;
|
|
305
313
|
}, { global: true });
|
|
306
314
|
const highlighted = pending ? undefined : matches[index];
|
|
307
|
-
const move = `${theme.glyphs.arrowUp}${theme.glyphs.arrowDown} move
|
|
315
|
+
const move = i18n.t('textui.palette.hint.move', { arrows: `${theme.glyphs.arrowUp}${theme.glyphs.arrowDown}` }, '{arrows} move');
|
|
316
|
+
const escBack = i18n.t('textui.palette.hint.back', undefined, 'esc back');
|
|
308
317
|
// What the highlighted row is, in full.
|
|
309
318
|
//
|
|
310
319
|
// The rows themselves have to fit, so a choice's own sentence is truncated
|
|
@@ -316,7 +325,8 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
316
325
|
const chosen = pending ? offered[index] : undefined;
|
|
317
326
|
const detail = pending
|
|
318
327
|
? chosen?.description
|
|
319
|
-
?? pending.arg.description
|
|
328
|
+
?? pending.arg.description
|
|
329
|
+
?? i18n.t('textui.palette.needs', { command: pending.command.title, arg: pending.arg.name }, '{command} needs a {arg}')
|
|
320
330
|
: highlighted?.description ?? highlighted?.id ?? '';
|
|
321
331
|
/*
|
|
322
332
|
* How wide the panel wants to be.
|
|
@@ -341,7 +351,7 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
341
351
|
: []));
|
|
342
352
|
return h('box', {
|
|
343
353
|
role: 'dialog',
|
|
344
|
-
label: 'Commands',
|
|
354
|
+
label: i18n.t('textui.palette.label', undefined, 'Commands'),
|
|
345
355
|
border: theme.border,
|
|
346
356
|
bg: 'overlay',
|
|
347
357
|
// A stated width is a width. Left off, it fits what it holds.
|
|
@@ -357,8 +367,8 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
357
367
|
// where you are; "commands › id" is what the parameter happens to be
|
|
358
368
|
// called, which is the author's business rather than the reader's.
|
|
359
369
|
title: pending
|
|
360
|
-
? ` commands ${theme.glyphs.breadcrumb} ${pending.command.title} `
|
|
361
|
-
: ' commands
|
|
370
|
+
? ` ${i18n.t('textui.palette.title', undefined, 'commands')} ${theme.glyphs.breadcrumb} ${pending.command.title} `
|
|
371
|
+
: ` ${i18n.t('textui.palette.title', undefined, 'commands')} `,
|
|
362
372
|
...rest,
|
|
363
373
|
}, h(TextInput, {
|
|
364
374
|
value: query,
|
|
@@ -396,8 +406,8 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
396
406
|
? pending.arg.description ?? `${pending.command.title}${theme.glyphs.ellipsis}`
|
|
397
407
|
: offered.some((choice) => choice.description) && pending.arg.description
|
|
398
408
|
? pending.arg.description
|
|
399
|
-
:
|
|
400
|
-
: (placeholder ??
|
|
409
|
+
: i18n.t('textui.palette.choose', { command: pending.command.title.toLowerCase(), ellipsis }, 'Choose {command}{ellipsis}'))
|
|
410
|
+
: (placeholder ?? i18n.t('textui.palette.placeholder', { ellipsis }, 'Type a command{ellipsis}')),
|
|
401
411
|
search: true,
|
|
402
412
|
autoFocus: true,
|
|
403
413
|
border: 'none',
|
|
@@ -421,11 +431,22 @@ export const CommandPalette = defineComponent('CommandPalette', (props) => {
|
|
|
421
431
|
h('box', { direction: 'row', gap: 1, align: 'start' }, h('text', { content: detail, fg: 'muted', flex: 1, wrap: 'word' }), h('text', { content: `${rows.length}`, fg: 'subtle' })), h('box', { direction: 'row', gap: 1 }, h('text', {
|
|
422
432
|
content: pending
|
|
423
433
|
? (pending.arg.choices === undefined
|
|
424
|
-
? hint(theme, [
|
|
434
|
+
? hint(theme, [
|
|
435
|
+
i18n.t('textui.palette.hint.type', undefined, 'type it'),
|
|
436
|
+
i18n.t('textui.palette.hint.confirm', undefined, 'enter confirm'),
|
|
437
|
+
escBack,
|
|
438
|
+
])
|
|
425
439
|
// Nothing to choose is nothing to press enter on, and offering it
|
|
426
440
|
// is how a panel reads as broken rather than as empty.
|
|
427
|
-
: hint(theme, rows.length > 0
|
|
428
|
-
|
|
441
|
+
: hint(theme, rows.length > 0
|
|
442
|
+
? [move, i18n.t('textui.palette.hint.choose', undefined, 'enter choose'), escBack]
|
|
443
|
+
: [escBack]))
|
|
444
|
+
: hint(theme, [
|
|
445
|
+
move,
|
|
446
|
+
i18n.t('textui.palette.hint.run', undefined, 'enter run'),
|
|
447
|
+
i18n.t('textui.palette.hint.subItems', { glyph: theme.glyphs.chevronRight }, '{glyph} sub-items'),
|
|
448
|
+
i18n.t('textui.palette.hint.close', undefined, 'esc close'),
|
|
449
|
+
]),
|
|
429
450
|
fg: 'subtle',
|
|
430
451
|
truncate: 'end',
|
|
431
452
|
})));
|
|
@@ -485,6 +506,25 @@ function filterChoices(choices, query) {
|
|
|
485
506
|
return choices.filter((choice) => `${choice.label ?? ''} ${choice.value} ${choice.description ?? ''}`
|
|
486
507
|
.toLowerCase().includes(q));
|
|
487
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
* Each category's commands together, the categories in the order they first
|
|
511
|
+
* appear and the commands in the order they came.
|
|
512
|
+
*
|
|
513
|
+
* Registration order is whatever order the code happened to run in, so a
|
|
514
|
+
* category registered in two places would be two groups with the same name
|
|
515
|
+
* over them.
|
|
516
|
+
*/
|
|
517
|
+
function byCategory(commands) {
|
|
518
|
+
const groups = new Map();
|
|
519
|
+
for (const command of commands) {
|
|
520
|
+
const group = groups.get(command.category);
|
|
521
|
+
if (group)
|
|
522
|
+
group.push(command);
|
|
523
|
+
else
|
|
524
|
+
groups.set(command.category, [command]);
|
|
525
|
+
}
|
|
526
|
+
return [...groups.values()].flat();
|
|
527
|
+
}
|
|
488
528
|
export function filterCommands(commands, query) {
|
|
489
529
|
const q = query.trim().toLowerCase();
|
|
490
530
|
if (q === '')
|
package/dist/overlay/dialog.d.ts
CHANGED
|
@@ -13,4 +13,15 @@ export interface DialogProps extends BoxProps {
|
|
|
13
13
|
width?: number;
|
|
14
14
|
}
|
|
15
15
|
export declare const Dialog: (props: DialogProps) => import("@textui/core").RenderOutput;
|
|
16
|
+
export interface ConfirmDialogProps extends BoxProps {
|
|
17
|
+
title?: string;
|
|
18
|
+
message: string;
|
|
19
|
+
confirmLabel?: string;
|
|
20
|
+
cancelLabel?: string;
|
|
21
|
+
tone?: SemanticVariant;
|
|
22
|
+
onConfirm?(): void;
|
|
23
|
+
onCancel?(): void;
|
|
24
|
+
}
|
|
25
|
+
/** Two-button dialog behind the `confirm` helper. */
|
|
26
|
+
export declare const ConfirmDialog: (props: ConfirmDialogProps) => import("@textui/core").RenderOutput;
|
|
16
27
|
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/overlay/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI9D,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,eAAe,CAAC;QAAC,OAAO,CAAC,IAAI,IAAI,CAAA;KAAE,EAAE,CAAC;IACpF,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,6DAmDjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/overlay/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI9D,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,eAAe,CAAC;QAAC,OAAO,CAAC,IAAI,IAAI,CAAA;KAAE,EAAE,CAAC;IACpF,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,6DAmDjB,CAAC;AAEH,MAAM,WAAW,kBAAmB,SAAQ,QAAQ;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,SAAS,CAAC,IAAI,IAAI,CAAC;IACnB,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,qDAAqD;AACrD,eAAO,MAAM,aAAa,oEAuBxB,CAAC"}
|
package/dist/overlay/dialog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, useFocusScope, useInput, useTheme } from '@textui/core';
|
|
1
|
+
import { defineComponent, h, useFocusScope, useI18n, useInput, useTheme } from '@textui/core';
|
|
2
2
|
import { Button } from '../control/index.js';
|
|
3
3
|
export const Dialog = defineComponent('Dialog', (props) => {
|
|
4
4
|
const theme = useTheme();
|
|
@@ -42,3 +42,26 @@ export const Dialog = defineComponent('Dialog', (props) => {
|
|
|
42
42
|
})))
|
|
43
43
|
: null);
|
|
44
44
|
});
|
|
45
|
+
/** Two-button dialog behind the `confirm` helper. */
|
|
46
|
+
export const ConfirmDialog = defineComponent('ConfirmDialog', (props) => {
|
|
47
|
+
const i18n = useI18n();
|
|
48
|
+
const { title, message, confirmLabel, cancelLabel, tone, onConfirm, onCancel, ...rest } = props;
|
|
49
|
+
return h(Dialog, {
|
|
50
|
+
title: title ?? i18n.t('textui.confirmDialog.title', undefined, 'Confirm'),
|
|
51
|
+
width: 50,
|
|
52
|
+
actions: [
|
|
53
|
+
{
|
|
54
|
+
id: 'confirm',
|
|
55
|
+
label: confirmLabel ?? i18n.t('textui.confirmDialog.confirm', undefined, 'Confirm'),
|
|
56
|
+
tone: tone ?? 'primary',
|
|
57
|
+
onPress: onConfirm,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'cancel',
|
|
61
|
+
label: cancelLabel ?? i18n.t('textui.confirmDialog.cancel', undefined, 'Cancel'),
|
|
62
|
+
onPress: onCancel,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
...rest,
|
|
66
|
+
}, h('text', { content: message, wrap: 'word' }));
|
|
67
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,SAAS,EACV,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtD;;;;;;GAMG;AACH,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED;;;;GAIG;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command-palette.js';
|
|
2
|
-
import { Dialog } from './dialog.js';
|
|
2
|
+
import { ConfirmDialog, Dialog } from './dialog.js';
|
|
3
3
|
import { LayerScope } from './layer-scope.js';
|
|
4
4
|
import { PathPicker } from './path-picker.js';
|
|
5
5
|
import { PromptDialog } from './prompt-dialog.js';
|
|
@@ -45,23 +45,14 @@ export function confirm(layers, options) {
|
|
|
45
45
|
dismissOnEscape: true,
|
|
46
46
|
onClose: () => finish(false),
|
|
47
47
|
node: {
|
|
48
|
-
component: '
|
|
49
|
-
title: options.title
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
tone: options.tone ?? 'primary',
|
|
57
|
-
onPress: () => finish(true),
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: 'cancel',
|
|
61
|
-
label: options.cancelLabel ?? 'Cancel',
|
|
62
|
-
onPress: () => finish(false),
|
|
63
|
-
},
|
|
64
|
-
],
|
|
48
|
+
component: 'ConfirmDialog',
|
|
49
|
+
title: options.title,
|
|
50
|
+
message: options.message,
|
|
51
|
+
confirmLabel: options.confirmLabel,
|
|
52
|
+
cancelLabel: options.cancelLabel,
|
|
53
|
+
tone: options.tone,
|
|
54
|
+
onConfirm: { handler: () => finish(true) },
|
|
55
|
+
onCancel: { handler: () => finish(false) },
|
|
65
56
|
},
|
|
66
57
|
});
|
|
67
58
|
});
|
|
@@ -85,7 +76,7 @@ export function prompt(layers, options) {
|
|
|
85
76
|
onClose: () => finish(null),
|
|
86
77
|
node: {
|
|
87
78
|
component: 'PromptDialog',
|
|
88
|
-
title: options.title
|
|
79
|
+
title: options.title,
|
|
89
80
|
message: options.message,
|
|
90
81
|
placeholder: options.placeholder,
|
|
91
82
|
initialValue: options.initialValue,
|
|
@@ -147,6 +138,7 @@ export function toastPosition(anchor) {
|
|
|
147
138
|
}
|
|
148
139
|
export const OVERLAY_COMPONENTS = [
|
|
149
140
|
{ component: 'Dialog', category: 'overlay', renderer: { kind: 'function', render: Dialog }, role: 'dialog', description: 'Modal box with actions; traps focus and restores it.' },
|
|
141
|
+
{ component: 'ConfirmDialog', category: 'overlay', renderer: { kind: 'function', render: ConfirmDialog }, role: 'dialog', description: 'Two-button dialog behind the `confirm` helper.' },
|
|
150
142
|
{ component: 'PromptDialog', category: 'overlay', renderer: { kind: 'function', render: PromptDialog }, role: 'dialog', description: 'One-field dialog behind the `prompt` helper.' },
|
|
151
143
|
{ component: 'PathPicker', category: 'overlay', renderer: { kind: 'function', render: PathPicker }, role: 'dialog', description: 'Walk the resource tree and pick a file or a folder.' },
|
|
152
144
|
{ component: 'Tooltip', category: 'overlay', renderer: { kind: 'function', render: Tooltip }, role: 'tooltip', description: 'Small anchored hint.' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-picker.d.ts","sourceRoot":"","sources":["../../src/overlay/path-picker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"path-picker.d.ts","sourceRoot":"","sources":["../../src/overlay/path-picker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiB7C,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQnD;AAED,eAAO,MAAM,UAAU,iEA6LrB,CAAC"}
|