@visulima/ansi 1.1.0 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -1,24 +1,103 @@
1
- ## @visulima/ansi [1.1.0](https://github.com/visulima/visulima/compare/@visulima/ansi@1.0.18...@visulima/ansi@1.1.0) (2025-05-30)
1
+ ## @visulima/ansi [2.0.1](https://github.com/visulima/visulima/compare/@visulima/ansi@2.0.0...@visulima/ansi@2.0.1) (2025-06-04)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **ansi:** remove unused prettier linting scripts from package.json ([a4a9e27](https://github.com/visulima/visulima/commit/a4a9e2722888375bd2e77f493ec3316bfef7575a))
6
+ * update ESLint configuration and dependencies ([1cf0391](https://github.com/visulima/visulima/commit/1cf0391cf67757844387b4d98b1f28d458e7f233))
7
+ * update package dependencies and remove unused ESLint config ([0cd4c8f](https://github.com/visulima/visulima/commit/0cd4c8fe582cc5f7b20614245100137b41a5d842))
8
+
9
+
10
+ ### Dependencies
11
+
12
+ * **@visulima/colorize:** upgraded to 1.4.23
13
+ * **@visulima/path:** upgraded to 1.4.0
14
+
15
+ ## @visulima/ansi [2.0.0](https://github.com/visulima/visulima/compare/@visulima/ansi@1.0.18...@visulima/ansi@2.0.0) (2025-05-31)
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * **ansi:** Version 2.0.0 of `@visulima/ansi` introduces a significant number of changes, including refactoring of exports, renaming of functions for clarity and consistency, and the addition of many new features. Users upgrading from v1.x must review the following breaking changes carefully and update their code accordingly.
20
+
21
+ Many functions and constants have been renamed or their export style has changed. Below is a list of common v1 exports and their v2 equivalents:
22
+
23
+ | v1 Export | v2 Status | Notes for Migration |
24
+ | :----------------------- | :--------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ |
25
+ | `alternativeScreenEnter` | Renamed to `alternativeScreenOn` (function) / `ALT_SCREEN_ON` (const) | Update function calls to `alternativeScreenOn()`. The direct sequence is `ALT_SCREEN_ON`. |
26
+ | `alternativeScreenExit` | Renamed to `alternativeScreenOff` (function) / `ALT_SCREEN_OFF` (const) | Update function calls to `alternativeScreenOff()`. The direct sequence is `ALT_SCREEN_OFF`. |
27
+ | `clearLine` | Effectively `eraseLine` | While `clearLine` is not directly exported, `eraseLine` provides the same functionality. |
28
+ | `clearScreen` | Effectively `eraseScreen` | Use `eraseScreen`. |
29
+ | `clearTerminal` | Renamed to `resetTerminal` | Replace calls to `clearTerminal()` with `resetTerminal()`. |
30
+ | `fullReset` | Replaced by `RIS` (const) or `RESET_INITIAL_STATE` (const) | `RIS` (Reset to Initial State) is the recommended constant for the `ESC c` sequence. |
31
+ | `image` (default export) | Named export `image` | Change import from `import image from "@visulima/ansi";` to `import { image } from "@visulima/ansi";`. |
32
+ | `link` (default export) | Renamed to `hyperlink` (default export) | Change import from `import link from "@visulima/ansi";` to `import hyperlink from "@visulima/ansi";`. The function usage remains similar. |
33
+
34
+ **The following v1 exports are still available in v2 with the same name and generally the same behavior (though always test):**
35
+
36
+ * `beep`
37
+ * `cursorBackward`
38
+ * `cursorDown`
39
+ * `cursorForward`
40
+ * `cursorHide`
41
+ * `cursorLeft`
42
+ * `cursorMove`
43
+ * `cursorNextLine`
44
+ * `cursorPreviousLine`
45
+ * `cursorRestore` (function, v2 also adds `RESTORE_CURSOR_DEC` constant)
46
+ * `cursorSave` (function, v2 also adds `SAVE_CURSOR_DEC` constant)
47
+ * `cursorShow`
48
+ * `cursorTo`
49
+ * `cursorUp`
50
+ * `eraseDown`
51
+ * `eraseLine`
52
+ * `eraseLineEnd`
53
+ * `eraseLines`
54
+ * `eraseLineStart`
55
+ * `eraseScreen`
56
+ * `eraseUp`
57
+ * `scrollDown`
58
+ * `scrollUp`
59
+ * `strip` (default export)
60
+
61
+ * **`clearScrollbar`**:
62
+ * This export from v1 (which was `ESC + "2J"`, i.e., `CSI 2J`) has been removed.
63
+ * The name was misleading, as `CSI 2J` clears the visible screen, and its effect on the scrollback buffer is not standard across all terminals.
64
+ * The functionality of `CSI 2J` (erase entire screen) is available via the `eraseScreen` constant or `eraseDisplay(EraseDisplayMode.EntireScreen)`.
65
+ * **For clearing the scrollback buffer (and screen)**: v2 provides the accurately named `eraseScreenAndScrollback` constant (sequence `CSI 3J`), or you can use `eraseDisplay(EraseDisplayMode.EntireScreenAndScrollback)`. Note that `CSI 3J` is an XTerm extension but widely adopted.
66
+
67
+ * **`decswt(title: string)` and `decsin(name: string)`**:
68
+ * These functions, if you were using similar named functions or expecting specific DEC behavior in v1, are now explicitly implemented in v2 to generate OSC sequences (`OSC 2 ; 1;<title> BEL` for `decswt` and `OSC 2 ; L;<name> BEL` for `decsin`) aligned with DEC VT520/VT525 behavior.
69
+ * **Impact**: This provides accurate VT520/VT525 emulation but may not be supported by other terminals.
70
+ * **Recommendation**: Test thoroughly. For broader compatibility for window/icon titles, consider using the v2 functions `setWindowTitle(title)`, `setIconName(name)`, or `setIconNameAndWindowTitle(title)`.
71
+
72
+ Version 2 introduces a vast number of new exports and features, providing much finer-grained control over terminal behavior. Some notable areas of expansion include:
73
+
74
+ * **Cursor Control**: Additional functions like `cursorToColumn1`, `cursorHorizontalAbsolute`, `cursorVerticalAbsolute`, `setCursorStyle`, and constants like `REQUEST_CURSOR_POSITION`.
75
+ * **Erasing**: More specific erase functions like `eraseCharacter`, `eraseInLine`, and the new `eraseScreenAndScrollback`.
76
+ * **Terminal Modes**: Comprehensive support for setting, resetting, and reporting ANSI and DEC private modes (e.g., `setMode`, `resetMode`, `InsertReplaceMode`, `LineFeedNewLineMode`, etc.).
77
+ * **Mouse Support**: Functions to enable/disable various mouse tracking modes (X10, SGR, Focus, Button-event) and encode mouse sequences.
78
+ * **Status Reports**: Extensive support for Device Status Reports (DSR) and Device Attributes (DA), including `DA1`, `DA2`, `DA3`, `CPR` (Cursor Position Report), `DECXCPR`, `XTVERSION`, and requests/reports for printer status, UDK status, keyboard language, etc.
79
+ * **iTerm2 Integration**: Specific functions and constants for iTerm2's proprietary escape codes, including file and image display.
80
+ * **Termcap/Terminfo**: Functions to request termcap/terminfo strings (`XTGETTCAP`).
81
+ * **Window Operations**: Expanded title-setting functions (`setWindowTitle`, `setIconName`, `setIconNameAndWindowTitle`, including `ST` terminated versions) and other XTerm window operations.
82
+
83
+ 1. **Review Imports**: Carefully check all your imports from `@visulima/ansi` and update them according to the changes listed above.
84
+ 2. **Test Thoroughly**: Due to the nature of terminal control sequences, it's crucial to test your application on all target terminal emulators after upgrading.
85
+ 3. **Consult v2 `index.ts`**: The file `packages/ansi/src/index.ts` in the v2 codebase is the source of truth for all exported members.
86
+ 4. **Update Default Imports**: For `image` and `link` (now `hyperlink`), change your default imports to named imports or update the new default import name.
2
87
 
3
88
  ### Features
4
89
 
5
- * **ansi:** introduces a significant number of changes, including refactoring of exports, renaming of functions for clarity and consistency ([d80d2db](https://github.com/visulima/visulima/commit/d80d2dba2580e208cbf21f60d27bfb4e95417281))
90
+ * **ansi:** introduces a significant number of changes, including refactoring of exports, renaming of functions for clarity and consistency ([c3514c6](https://github.com/visulima/visulima/commit/c3514c6de41603d0a8da0d0fa707e8a9466eeeaa))
6
91
 
7
92
  ### Bug Fixes
8
93
 
9
- * **ansi:** improved readme, added all files as export ([a70ad00](https://github.com/visulima/visulima/commit/a70ad0026e05552b4c56b0be355bf439a40c3c3e))
94
+ * **ansi:** improved readme, added all files as export ([d5a789f](https://github.com/visulima/visulima/commit/d5a789fe8a583a130d8dd6dbf742fa0dba151b8f))
10
95
  * **ansi:** update dependencies ([85478c4](https://github.com/visulima/visulima/commit/85478c4614b3fe78ee80e090b36829bc64f6e4c1))
11
96
 
12
97
  ### Miscellaneous Chores
13
98
 
14
99
  * updated dev dependencies ([2433ed5](https://github.com/visulima/visulima/commit/2433ed5fb662e0303c37edee8ddc21b46c21263f))
15
100
 
16
-
17
- ### Dependencies
18
-
19
- * **@visulima/colorize:** upgraded to 1.4.22
20
- * **@visulima/path:** upgraded to 1.3.6
21
-
22
101
  ## @visulima/ansi [1.0.18](https://github.com/visulima/visulima/compare/@visulima/ansi@1.0.17...@visulima/ansi@1.0.18) (2025-03-07)
23
102
 
24
103
  ### Bug Fixes
@@ -24,6 +24,4 @@
24
24
  * @see {@link https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda} for supported terminals.
25
25
  */
26
26
  declare const hyperlink: (text: string, url: string) => string;
27
-
28
-
29
- export = hyperlink;
27
+ export = hyperlink;
@@ -24,6 +24,4 @@
24
24
  * @see {@link https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda} for supported terminals.
25
25
  */
26
26
  declare const hyperlink: (text: string, url: string) => string;
27
-
28
-
29
- export = hyperlink;
27
+ export = hyperlink;
package/dist/strip.d.cts CHANGED
@@ -20,6 +20,4 @@
20
20
  * ```
21
21
  */
22
22
  declare const strip: (input: string) => string;
23
-
24
-
25
- export = strip;
23
+ export = strip;
package/dist/strip.d.ts CHANGED
@@ -20,6 +20,4 @@
20
20
  * ```
21
21
  */
22
22
  declare const strip: (input: string) => string;
23
-
24
-
25
- export = strip;
23
+ export = strip;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/ansi",
3
- "version": "1.1.0",
3
+ "version": "2.0.1",
4
4
  "description": "ANSI escape codes for some terminal swag.",
5
5
  "keywords": [
6
6
  "alternative-screen",