@sayknow-cli/tui 0.3.11 → 0.3.13

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 (39) hide show
  1. package/package.json +8 -9
  2. package/src/components/image.ts +79 -39
  3. package/src/components/markdown.ts +282 -37
  4. package/src/components/sayknow-pet.ts +435 -0
  5. package/src/components/text.ts +60 -36
  6. package/src/index.ts +1 -0
  7. package/src/terminal-capabilities.ts +42 -0
  8. package/src/tui.ts +471 -55
  9. package/src/utils.ts +144 -8
  10. package/dist/types/animation-scheduler.d.ts +0 -13
  11. package/dist/types/autocomplete.d.ts +0 -83
  12. package/dist/types/bracketed-paste.d.ts +0 -26
  13. package/dist/types/components/box.d.ts +0 -20
  14. package/dist/types/components/cancellable-loader.d.ts +0 -21
  15. package/dist/types/components/editor.d.ts +0 -126
  16. package/dist/types/components/image.d.ts +0 -16
  17. package/dist/types/components/input.d.ts +0 -16
  18. package/dist/types/components/loader.d.ts +0 -23
  19. package/dist/types/components/markdown.d.ts +0 -77
  20. package/dist/types/components/select-list.d.ts +0 -46
  21. package/dist/types/components/settings-list.d.ts +0 -39
  22. package/dist/types/components/spacer.d.ts +0 -11
  23. package/dist/types/components/tab-bar.d.ts +0 -56
  24. package/dist/types/components/text.d.ts +0 -13
  25. package/dist/types/components/truncated-text.d.ts +0 -10
  26. package/dist/types/editor-component.d.ts +0 -36
  27. package/dist/types/fuzzy.d.ts +0 -15
  28. package/dist/types/index.d.ts +0 -27
  29. package/dist/types/keybindings.d.ts +0 -201
  30. package/dist/types/keys.d.ts +0 -208
  31. package/dist/types/kill-ring.d.ts +0 -27
  32. package/dist/types/metrics.d.ts +0 -85
  33. package/dist/types/stdin-buffer.d.ts +0 -50
  34. package/dist/types/symbols.d.ts +0 -23
  35. package/dist/types/terminal-capabilities.d.ts +0 -143
  36. package/dist/types/terminal.d.ts +0 -90
  37. package/dist/types/ttyid.d.ts +0 -9
  38. package/dist/types/tui.d.ts +0 -215
  39. package/dist/types/utils.d.ts +0 -87
@@ -1,87 +0,0 @@
1
- import { Ellipsis, type ExtractSegmentsResult, type SliceResult } from "@sayknow-cli/natives";
2
- export { Ellipsis } from "@sayknow-cli/natives";
3
- export { getDefaultTabWidth, getIndentation } from "@sayknow-cli/utils";
4
- /** Test-only performance counters for advisory baseline tests. */
5
- export declare const __textHelperPerfCounters: {
6
- truncateToWidthCalls: number;
7
- wrapTextWithAnsiCalls: number;
8
- truncateLinesToWidthCalls: number;
9
- visibleWidthsCalls: number;
10
- reset(): void;
11
- };
12
- export declare function invalidateTabWidthCache(): void;
13
- export declare function isPrintableAscii(text: string): boolean;
14
- export declare function sliceWithWidth(line: string, startCol: number, length: number, strict?: boolean | null): SliceResult;
15
- export declare function truncateToWidth(text: string, maxWidth: number, ellipsisKind?: Ellipsis | null, pad?: boolean | null): string;
16
- export declare function truncateLinesToWidth(lines: readonly string[], maxWidth: number, ellipsisKind?: Ellipsis | null, pad?: boolean | null): string[];
17
- export declare function wrapTextWithAnsi(text: string, width: number): string[];
18
- export declare function extractSegments(line: string, beforeEnd: number, afterStart: number, afterLen: number, strictAfter: boolean): ExtractSegmentsResult;
19
- /**
20
- * Tab width in columns for `file`, using `process.cwd()` as the project root for relative paths.
21
- */
22
- export declare function getIndentationNoescape(file?: string): number;
23
- export declare function replaceTabs(text: string, file?: string): string;
24
- /**
25
- * Returns a string of n spaces. Uses a pre-allocated buffer for efficiency.
26
- */
27
- export declare function padding(n: number): string;
28
- /**
29
- * Get the shared grapheme segmenter instance.
30
- */
31
- export declare function getSegmenter(): Intl.Segmenter;
32
- export declare function visibleWidthRaw(str: string): number;
33
- /**
34
- * Calculate the visible width of a string in terminal columns.
35
- */
36
- export declare function visibleWidth(str: string): number;
37
- export declare function visibleWidthsNative(lines: readonly string[]): number[];
38
- export declare function visibleWidths(lines: readonly string[]): number[];
39
- /**
40
- * Normalize text for terminal output without changing logical editor content.
41
- * Some terminals render canonically decomposed Hangul jamo or precomposed
42
- * Thai/Lao AM vowels inconsistently during differential repaint. Emit a stable
43
- * terminal form while keeping the component/source strings unchanged.
44
- */
45
- export declare function normalizeTerminalOutput(str: string): string;
46
- /**
47
- * Check if a character is whitespace.
48
- */
49
- export declare function isWhitespaceChar(char: string): boolean;
50
- /**
51
- * Check if a character is punctuation.
52
- */
53
- export declare function isPunctuationChar(char: string): boolean;
54
- export type WordNavKind = "whitespace" | "delimiter" | "cjk" | "word" | "other";
55
- /**
56
- * Coarse Unicode-aware character classification for word navigation (Option/Alt + Left/Right).
57
- * This intentionally avoids language-specific word segmentation for predictability across scripts.
58
- */
59
- export declare function getWordNavKind(grapheme: string): WordNavKind;
60
- export declare function isWordNavJoiner(grapheme: string): boolean;
61
- /**
62
- * Move the cursor one "word" to the left using Unicode-aware coarse navigation.
63
- *
64
- * Returns a new cursor index in the range [0, text.length].
65
- */
66
- export declare function moveWordLeft(text: string, cursor: number): number;
67
- /**
68
- * Move the cursor one "word" to the right using Unicode-aware coarse navigation.
69
- *
70
- * Returns a new cursor index in the range [0, text.length].
71
- */
72
- export declare function moveWordRight(text: string, cursor: number): number;
73
- /**
74
- * Apply background color to a line, padding to full width.
75
- *
76
- * @param line - Line of text (may contain ANSI codes)
77
- * @param width - Total width to pad to
78
- * @param bgFn - Background color function
79
- * @returns Line with background applied and padded to width
80
- */
81
- export declare function applyBackgroundToLine(line: string, width: number, bgFn: (text: string) => string): string;
82
- /**
83
- * Extract a range of visible columns from a line. Handles ANSI codes and wide chars.
84
- *
85
- * @param strict - If true, exclude wide chars at boundary that would extend past the range
86
- */
87
- export declare function sliceByColumn(line: string, startCol: number, length: number, strict?: boolean): string;