@textui/widgets 0.5.0 → 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.
Files changed (63) hide show
  1. package/dist/chart/line-chart.d.ts.map +1 -1
  2. package/dist/chart/line-chart.js +3 -2
  3. package/dist/control/select.d.ts.map +1 -1
  4. package/dist/control/select.js +4 -2
  5. package/dist/control/switch.d.ts.map +1 -1
  6. package/dist/control/switch.js +7 -2
  7. package/dist/data/index.d.ts.map +1 -1
  8. package/dist/data/index.js +3 -2
  9. package/dist/data/list.d.ts.map +1 -1
  10. package/dist/data/list.js +3 -2
  11. package/dist/data/log-viewer.d.ts.map +1 -1
  12. package/dist/data/log-viewer.js +7 -2
  13. package/dist/data/markdown-view.d.ts.map +1 -1
  14. package/dist/data/markdown-view.js +3 -2
  15. package/dist/data/pagination.d.ts.map +1 -1
  16. package/dist/data/pagination.js +3 -2
  17. package/dist/display/error-state.d.ts.map +1 -1
  18. package/dist/display/error-state.js +4 -3
  19. package/dist/form/danger-zone.d.ts.map +1 -1
  20. package/dist/form/danger-zone.js +7 -3
  21. package/dist/form/form-actions.d.ts.map +1 -1
  22. package/dist/form/form-actions.js +3 -2
  23. package/dist/navigation/menu.d.ts.map +1 -1
  24. package/dist/navigation/menu.js +3 -2
  25. package/dist/overlay/command-palette.d.ts +0 -14
  26. package/dist/overlay/command-palette.d.ts.map +1 -1
  27. package/dist/overlay/command-palette.js +127 -38
  28. package/dist/overlay/dialog.d.ts +11 -0
  29. package/dist/overlay/dialog.d.ts.map +1 -1
  30. package/dist/overlay/dialog.js +24 -1
  31. package/dist/overlay/index.d.ts.map +1 -1
  32. package/dist/overlay/index.js +11 -19
  33. package/dist/overlay/path-picker.d.ts.map +1 -1
  34. package/dist/overlay/path-picker.js +19 -11
  35. package/dist/overlay/prompt-dialog.d.ts.map +1 -1
  36. package/dist/overlay/prompt-dialog.js +5 -4
  37. package/dist/panel/index.d.ts.map +1 -1
  38. package/dist/panel/index.js +8 -7
  39. package/dist/panel/resource-panel.d.ts.map +1 -1
  40. package/dist/panel/resource-panel.js +9 -5
  41. package/dist/surface/mount-view.d.ts.map +1 -1
  42. package/dist/surface/mount-view.js +3 -2
  43. package/package.json +2 -2
  44. package/src/chart/line-chart.ts +3 -2
  45. package/src/control/select.ts +4 -2
  46. package/src/control/switch.ts +9 -2
  47. package/src/data/index.ts +3 -1
  48. package/src/data/list.ts +3 -1
  49. package/src/data/log-viewer.ts +7 -1
  50. package/src/data/markdown-view.ts +7 -1
  51. package/src/data/pagination.ts +3 -2
  52. package/src/display/error-state.ts +4 -3
  53. package/src/form/danger-zone.ts +7 -3
  54. package/src/form/form-actions.ts +5 -2
  55. package/src/navigation/menu.ts +3 -2
  56. package/src/overlay/command-palette.ts +152 -29
  57. package/src/overlay/dialog.ts +37 -1
  58. package/src/overlay/index.ts +11 -19
  59. package/src/overlay/path-picker.ts +23 -10
  60. package/src/overlay/prompt-dialog.ts +5 -4
  61. package/src/panel/index.ts +9 -7
  62. package/src/panel/resource-panel.ts +9 -4
  63. 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,gEA+EpB,CAAC"}
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"}
@@ -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 ?? `series ${i + 1}`, fg: 'muted' }))))
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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AE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,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"}
@@ -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 ?? `Select${theme.glyphs.ellipsis}`;
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,6DA2BjB,CAAC"}
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"}
@@ -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 { label, value = false, onChange, labels = ['off', 'on'], disabled, ...rest } = props;
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)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAwBjG;;;;;;;GAOG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAA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AChB;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;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"}
@@ -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 { columns, rows, rowKey = 'id', selectedKey, onSelect, onActivate, visibleRows, showHeader = true, emptyMessage = 'No rows', focusable = true, responsive = true, width, ...rest } = props;
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);
@@ -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;AAgB5E,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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AAQ,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 { items, selectedId, onSelect, onActivate, visibleRows, emptyMessage = 'Nothing here', marker = true, focusable = true, autoFocus, focusId, renderItem, itemHeight = 1, ...rest } = props;
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;AAa9D,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,gEA8DpB,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"}
@@ -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', { content: ' paused - end to follow', fg: 'warning', dim: true })
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;AAclG,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,mEAkLvB,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: `${theme.glyphs.ellipsis} ${hidden} more lines`, fg: 'subtle' })
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,iEAoBrB,CAAC"}
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"}
@@ -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: `${total} items`, fg: 'muted' }) : null);
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,iEAYrB,CAAC"}
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 { title = 'Something went wrong', error, onRetry, ...rest } = props;
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,iEAoBrB,CAAC"}
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"}
@@ -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 { title = 'Danger zone', description, actionLabel, onAction, confirmText, ...rest } = props;
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', { content: `Type "${confirmText}" to confirm.`, fg: 'subtle' })
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,kEAoBtB,CAAC"}
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,C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O,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"}
@@ -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: ' no matches', fg: 'subtle' })
114
+ ? h('text', { content: ` ${i18n.t('textui.menu.noMatch', undefined, 'no matches')}`, fg: 'subtle' })
114
115
  : null);
115
116
  });
116
117
  /**
@@ -58,20 +58,6 @@ export interface CommandPaletteProps extends BoxProps {
58
58
  */
59
59
  openAt?: string;
60
60
  }
61
- /**
62
- * The command palette.
63
- *
64
- * It searches the command registry rather than a list someone maintained, so
65
- * a command registered anywhere is reachable here the moment it exists - which
66
- * is the payoff for insisting actions are commands. It also *runs* what it
67
- * finds, so choosing "Open dialog" here and pressing the button that opens a
68
- * dialog are the same act, reaching the same code.
69
- *
70
- * A command that declares an argument with `choices` gets a second level:
71
- * choosing it lists the choices, and picking one runs the command with it.
72
- * That is where sub-items come from - the command says what it needs and the
73
- * palette asks, rather than every caller inventing its own submenu.
74
- */
75
61
  export declare const CommandPalette: (props: CommandPaletteProps) => import("@textui/core").RenderOutput;
76
62
  /**
77
63
  * The argument the palette should ask about, if there is one.
@@ -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;AAiB/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,Y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