@visulima/ansi 4.0.0-alpha.1 → 4.0.0-alpha.2

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 (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +32 -14
  3. package/package.json +9 -7
  4. package/dist/alternative-screen.d.ts +0 -74
  5. package/dist/alternative-screen.js +0 -8
  6. package/dist/clear.d.ts +0 -77
  7. package/dist/clear.js +0 -16
  8. package/dist/constants.d.ts +0 -20
  9. package/dist/cursor.d.ts +0 -437
  10. package/dist/cursor.js +0 -3
  11. package/dist/erase.d.ts +0 -206
  12. package/dist/erase.js +0 -47
  13. package/dist/helpers.d.ts +0 -14
  14. package/dist/hyperlink.d.ts +0 -27
  15. package/dist/hyperlink.js +0 -5
  16. package/dist/image.d.ts +0 -73
  17. package/dist/image.js +0 -43
  18. package/dist/index.d.ts +0 -36
  19. package/dist/index.js +0 -26
  20. package/dist/iterm2/iterm2-properties.d.ts +0 -135
  21. package/dist/iterm2/iterm2-sequences.d.ts +0 -96
  22. package/dist/iterm2.d.ts +0 -58
  23. package/dist/iterm2.js +0 -12
  24. package/dist/mode.d.ts +0 -726
  25. package/dist/mode.js +0 -245
  26. package/dist/mouse.d.ts +0 -230
  27. package/dist/mouse.js +0 -106
  28. package/dist/packem_shared/IT2_AUTO-BGxGtZAE.js +0 -6
  29. package/dist/packem_shared/ITerm2File-DzWaT6j3.js +0 -137
  30. package/dist/packem_shared/constants-CE7WkXh_.js +0 -9
  31. package/dist/packem_shared/cursor-CHPvxMal.js +0 -71
  32. package/dist/packem_shared/resetProgressBar-kV21u2hs.js +0 -18
  33. package/dist/packem_shared/restoreCursor-GfYEeJqN.js +0 -323
  34. package/dist/passthrough.d.ts +0 -77
  35. package/dist/passthrough.js +0 -29
  36. package/dist/progress.d.ts +0 -41
  37. package/dist/reset.d.ts +0 -26
  38. package/dist/reset.js +0 -4
  39. package/dist/screen.d.ts +0 -234
  40. package/dist/screen.js +0 -27
  41. package/dist/scroll.d.ts +0 -67
  42. package/dist/scroll.js +0 -18
  43. package/dist/status.d.ts +0 -524
  44. package/dist/status.js +0 -98
  45. package/dist/strip.d.ts +0 -23
  46. package/dist/strip.js +0 -12
  47. package/dist/termcap.d.ts +0 -38
  48. package/dist/termcap.js +0 -25
  49. package/dist/title.d.ts +0 -185
  50. package/dist/title.js +0 -18
  51. package/dist/window-ops.d.ts +0 -418
  52. package/dist/window-ops.js +0 -61
  53. package/dist/xterm.d.ts +0 -94
  54. package/dist/xterm.js +0 -33
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## @visulima/ansi [4.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/ansi@4.0.0-alpha.1...@visulima/ansi@4.0.0-alpha.2) (2025-12-06)
2
+
3
+ ### Bug Fixes
4
+
5
+ * add new package image, fixed readme rendering on npm, fixed building of packages ([b790ba2](https://github.com/visulima/visulima/commit/b790ba253ea07fef83528fd822a678facf021b5f))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * update @anolilab/semantic-release-pnpm and @anolilab/semantic-release-preset to versions 3.2.2 and 12.1.2 across multiple package.json files for improved compatibility ([3921626](https://github.com/visulima/visulima/commit/3921626141fe5da398749bf0ba675f1596f18afb))
10
+
11
+
12
+ ### Dependencies
13
+
14
+ * **@visulima/colorize:** upgraded to 2.0.0-alpha.2
15
+ * **@visulima/path:** upgraded to 3.0.0-alpha.2
16
+
1
17
  ## @visulima/ansi [4.0.0-alpha.1](https://github.com/visulima/visulima/compare/@visulima/ansi@3.0.5...@visulima/ansi@4.0.0-alpha.1) (2025-12-05)
2
18
 
3
19
  ### ⚠ BREAKING CHANGES
package/README.md CHANGED
@@ -1,15 +1,24 @@
1
- <div align="center">
2
- <h3>visulima ansi</h3>
3
- <p>
4
- ANSI escape codes for some terminal swag.
5
- </p>
6
- </div>
1
+ <!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
2
+
3
+ <a href="https://www.anolilab.com/open-source" align="center">
4
+
5
+ <img src="__assets__/package-og.svg" alt="ansi" />
6
+
7
+ </a>
8
+
9
+ <h3 align="center">ANSI escape codes for some terminal swag.</h3>
10
+
11
+ <!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
7
12
 
8
13
  <br />
9
14
 
10
15
  <div align="center">
11
16
 
12
- [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
17
+ [![typescript-image][typescript-badge]][typescript-url]
18
+ [![mit licence][license-badge]][license]
19
+ [![npm downloads][npm-downloads-badge]][npm-downloads]
20
+ [![Chat][chat-badge]][chat]
21
+ [![PRs Welcome][prs-welcome-badge]][prs-welcome]
13
22
 
14
23
  </div>
15
24
 
@@ -420,14 +429,23 @@ If you would like to help take a look at the [list of issues](https://github.com
420
429
  - [Daniel Bannert](https://github.com/prisis)
421
430
  - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
422
431
 
432
+ ## Made with ❤️ at Anolilab
433
+
434
+ This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
435
+
423
436
  ## License
424
437
 
425
- The visulima ansi is open-sourced software licensed under the [MIT][license-url]
438
+ The visulima ansi is open-sourced software licensed under the [MIT][license]
426
439
 
427
- [typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
440
+ <!-- badges -->
428
441
 
429
- [typescript-url]: https://www.typescriptlang.org/ "TypeScript" "typescript"
430
- [license-image]: https://img.shields.io/npm/l/@visulima/ansi?color=blueviolet&style=for-the-badge
431
- [license-url]: LICENSE.md "license"
432
- [npm-image]: https://img.shields.io/npm/v/@visulima/ansi/latest.svg?style=for-the-badge&logo=npm
433
- [npm-url]: https://www.npmjs.com/package/@visulima/ansi/v/latest "npm"
442
+ [license-badge]: https://img.shields.io/npm/l/@visulima/ansi?style=for-the-badge
443
+ [license]: https://github.com/visulima/visulima/blob/main/LICENSE
444
+ [npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/ansi?style=for-the-badge
445
+ [npm-downloads]: https://www.npmjs.com/package/@visulima/ansi
446
+ [prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
447
+ [prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
448
+ [chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
449
+ [chat]: https://discord.gg/TtFJY8xkFK
450
+ [typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
451
+ [typescript-url]: https://www.typescriptlang.org/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/ansi",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.2",
4
4
  "description": "ANSI escape codes for some terminal swag.",
5
5
  "keywords": [
6
6
  "alternative-screen",
@@ -153,18 +153,21 @@
153
153
  "README.md",
154
154
  "CHANGELOG.md"
155
155
  ],
156
+ "dependencies": {
157
+ "type-fest": "^5.3.0"
158
+ },
156
159
  "devDependencies": {
157
160
  "@anolilab/eslint-config": "16.4.4",
158
161
  "@anolilab/prettier-config": "^6.0.8",
159
- "@anolilab/semantic-release-pnpm": "3.2.0",
160
- "@anolilab/semantic-release-preset": "^12.1.0",
162
+ "@anolilab/semantic-release-pnpm": "3.2.2",
163
+ "@anolilab/semantic-release-preset": "^12.1.2",
161
164
  "@arethetypeswrong/cli": "^0.18.2",
162
165
  "@secretlint/secretlint-rule-preset-recommend": "^11.2.5",
163
166
  "@total-typescript/ts-reset": "^0.6.1",
164
167
  "@types/node": "24.10.1",
165
- "@visulima/colorize": "2.0.0-alpha.1",
166
- "@visulima/packem": "2.0.0-alpha.37",
167
- "@visulima/path": "3.0.0-alpha.1",
168
+ "@visulima/colorize": "2.0.0-alpha.2",
169
+ "@visulima/packem": "2.0.0-alpha.40",
170
+ "@visulima/path": "3.0.0-alpha.2",
168
171
  "@vitest/coverage-v8": "^4.0.15",
169
172
  "@vitest/ui": "^4.0.15",
170
173
  "ansi-regex": "^6.2.2",
@@ -178,7 +181,6 @@
178
181
  "rimraf": "6.1.2",
179
182
  "secretlint": "11.2.5",
180
183
  "semantic-release": "^25.0.2",
181
- "type-fest": "^5.3.0",
182
184
  "typescript": "5.9.3",
183
185
  "vitest": "^4.0.15"
184
186
  },
@@ -1,74 +0,0 @@
1
- /**
2
- * ANSI escape sequence to enable the alternative screen buffer.
3
- *
4
- * This sequence (`CSI ?1049h`) instructs the terminal to switch to the alternative screen buffer.
5
- * This is a common practice for full-screen terminal applications (e.g., vim, less, htop)
6
- * to provide a separate screen area for their interface, leaving the original shell content
7
- * undisturbed and restoring it upon exit.
8
- * When this mode is activated, the original screen content is typically saved by the terminal,
9
- * and a blank screen is presented. Operations then occur on this alternative buffer.
10
- *
11
- * The specific behavior (like whether the screen is cleared on switch) can sometimes vary
12
- * slightly between terminal emulators. `?1049h` generally includes saving the cursor position
13
- * along with the screen content and clearing the alternative screen.
14
- * It is closely related to mode `?47h`, which also switches to an alternative buffer but might
15
- * have different semantics regarding screen clearing and cursor saving.
16
- * Mode `?1049h` is generally preferred for a more robust alternative screen experience.
17
- * @see {@link ALT_SCREEN_OFF} for the sequence to disable the alternative screen buffer.
18
- * @see {@link alternativeScreenOn} for a function that returns this sequence.
19
- * @see {@link https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer} Xterm Control Sequences documentation.
20
- * @see {@link https://vt100.net/docs/vt510-rm/DECSLPP.html} (related DEC modes, though 1049 is more common for this behavior).
21
- */
22
- export declare const ALT_SCREEN_ON: string;
23
- /**
24
- * ANSI escape sequence to disable the alternative screen buffer.
25
- *
26
- * This sequence (`CSI ?1049l`) instructs the terminal to switch back from the alternative
27
- * screen buffer to the main screen buffer. When this occurs, the terminal typically
28
- * restores the screen content and cursor position that were saved when the alternative
29
- * buffer was activated by {@link ALT_SCREEN_ON}.
30
- *
31
- * This is used when a full-screen application exits, allowing the user to return to their
32
- * previous shell session seamlessly.
33
- * @see {@link ALT_SCREEN_ON} for the sequence to enable the alternative screen buffer.
34
- * @see {@link alternativeScreenOff} for a function that returns this sequence.
35
- */
36
- export declare const ALT_SCREEN_OFF: string;
37
- /**
38
- * Returns the ANSI escape sequence to enable the alternative screen buffer.
39
- *
40
- * This function is a convenience wrapper around the {@link ALT_SCREEN_ON} constant.
41
- * It provides a more descriptive way to obtain the sequence for enabling the
42
- * alternative screen, often used at the initialization phase of a full-screen
43
- * terminal application.
44
- * @returns The ANSI escape sequence (`CSI ?1049h`) for enabling the alternative screen buffer.
45
- * @example
46
- * ```typescript
47
- * import { alternativeScreenOn } from '@visulima/ansi/alternative-screen';
48
- *
49
- * process.stdout.write(alternativeScreenOn());
50
- * // Terminal switches to the alternative screen buffer.
51
- * ```
52
- * @see {@link ALT_SCREEN_ON}
53
- * @see {@link alternativeScreenOff}
54
- */
55
- export declare const alternativeScreenOn: () => string;
56
- /**
57
- * Returns the ANSI escape sequence to disable the alternative screen buffer.
58
- *
59
- * This function is a convenience wrapper around the {@link ALT_SCREEN_OFF} constant.
60
- * It provides a more descriptive way to obtain the sequence for disabling the
61
- * alternative screen, typically used when a full-screen terminal application is exiting
62
- * to restore the user's original terminal state.
63
- * @returns The ANSI escape sequence (`CSI ?1049l`) for disabling the alternative screen buffer.
64
- * @example
65
- * ```typescript
66
- * import { alternativeScreenOff } from '@visulima/ansi/alternative-screen';
67
- *
68
- * process.stdout.write(alternativeScreenOff());
69
- * // Terminal switches back to the main screen buffer, restoring previous content.
70
- * ```
71
- * @see {@link ALT_SCREEN_OFF}
72
- * @see {@link alternativeScreenOn}
73
- */
74
- export declare const alternativeScreenOff: () => string;
@@ -1,8 +0,0 @@
1
- import { C as CSI } from './packem_shared/constants-CE7WkXh_.js';
2
-
3
- const ALT_SCREEN_ON = `${CSI}?1049h`;
4
- const ALT_SCREEN_OFF = `${CSI}?1049l`;
5
- const alternativeScreenOn = () => ALT_SCREEN_ON;
6
- const alternativeScreenOff = () => ALT_SCREEN_OFF;
7
-
8
- export { ALT_SCREEN_OFF, ALT_SCREEN_ON, alternativeScreenOff, alternativeScreenOn };
package/dist/clear.d.ts DELETED
@@ -1,77 +0,0 @@
1
- /**
2
- * Moves the cursor to the top-left (0,0 in 0-indexed terms) and erases from the cursor to the end of the screen.
3
- *
4
- * This sequence is a combination of:
5
- * 1. {@link cursorTo}(0, 0): Moves the cursor to the first row, first column.
6
- * (Equivalent to `CSI 1;1H` as `cursorTo` uses 0-indexed arguments which are converted to 1-indexed for the sequence).
7
- * 2. {@link eraseDisplay}({@link EraseDisplayMode.ToEnd}): Erases from the cursor position to the end of the screen (`CSI 0J` or `CSI J`).
8
- *
9
- * Effective combined sequence: `CSI 1;1H CSI J` (or `CSI 1;1H CSI 0J`).
10
- * @see {@link cursorTo}
11
- * @see {@link eraseDisplay}
12
- * @see {@link EraseDisplayMode.ToEnd}
13
- */
14
- export declare const clearScreenFromTopLeft: string;
15
- /**
16
- * Erases the entire current line and moves the cursor to the beginning of that line (column 1).
17
- *
18
- * This sequence is a combination of:
19
- * 1. {@link eraseInLine}({@link EraseLineMode.EntireLine}): Erases the entire current line (`CSI 2K`).
20
- * 2. `CSI G`: Moves the cursor to column 1 of the current line (Cursor Horizontal Absolute).
21
- * Alternatively, a carriage return (`\r`) could achieve a similar cursor move to the start of the line on many systems.
22
- *
23
- * Effective combined sequence: `CSI 2K CSI G`.
24
- * @see {@link eraseInLine}
25
- * @see {@link EraseLineMode.EntireLine}
26
- */
27
- export declare const clearLineAndHomeCursor: string;
28
- /**
29
- * Homes the cursor to the top-left position (row 1, column 1) and erases the entire screen.
30
- *
31
- * This sequence is a combination of:
32
- * 1. `CSI H`: Moves the cursor to the home position (top-left, equivalent to `CSI 1;1H`).
33
- * 2. {@link eraseDisplay}({@link EraseDisplayMode.EntireScreen}): Erases the entire screen (`CSI 2J`).
34
- *
35
- * Effective combined sequence: `CSI H CSI 2J`.
36
- * @remarks This is a very common sequence for clearing the visible terminal window.
37
- * @see {@link cursorPosition} (which `CSI H` relates to)
38
- * @see {@link eraseDisplay}
39
- * @see {@link EraseDisplayMode.EntireScreen}
40
- */
41
- export declare const clearScreenAndHomeCursor: string;
42
- /**
43
- * Clears the entire terminal display, including the scrollback buffer on supported terminals,
44
- * and attempts to reset the terminal to its initial (or a more pristine) state.
45
- *
46
- * This is generally a more comprehensive and forceful clear operation than just erasing the
47
- * visible screen content (like {@link clearScreenAndHomeCursor}).
48
- *
49
- * The exact behavior and sequences used can vary by terminal and operating system:
50
- *
51
- * - **On Windows:**
52
- * It typically uses `CSI 2J` (erase entire screen) followed by `CSI 0f`.
53
- * `CSI 0f` (or `CSI ;f`, `CSI 0;0f`) is an SGR sequence that also often acts as a cursor home command,
54
- * though its standardization can be less consistent than `CSI H`.
55
- * The primary goal is to clear the screen and move the cursor to the top-left.
56
- *
57
- * - **On other platforms (e.g., Linux, macOS with XTerm-like terminals):**
58
- * A more robust combination is used:
59
- * 1. {@link eraseDisplay}({@link EraseDisplayMode.EntireScreen}) (`CSI 2J`): Erases the entire visible screen.
60
- * 2. {@link eraseDisplay}({@link EraseDisplayMode.EntireScreenAndScrollback}) (`CSI 3J`): Erases the scrollback buffer (XTerm-specific, but widely supported).
61
- * 3. `CSI H`: Moves the cursor to the home position (top-left).
62
- * 4. `ESC c` (RIS - Reset to Initial State): This is the most powerful reset sequence. It typically resets the terminal
63
- * to its power-on state, clearing character sets, SGR attributes, modes, and more.
64
- * @returns A string containing the ANSI escape sequence(s) for resetting the terminal.
65
- * @example
66
- * ```typescript
67
- * import { resetTerminal } from '@visulima/ansi/clear';
68
- *
69
- * process.stdout.write(resetTerminal);
70
- * // The terminal attempts a full reset.
71
- * ```
72
- * @see {@link eraseDisplay}
73
- * @see {@link EraseDisplayMode.EntireScreen}
74
- * @see {@link EraseDisplayMode.EntireScreenAndScrollback}
75
- * @see {@link https://vt100.net/docs/vt510-rm/RIS.html} RIS documentation.
76
- */
77
- export declare const resetTerminal: string;
package/dist/clear.js DELETED
@@ -1,16 +0,0 @@
1
- import { C as CSI, E as ESC } from './packem_shared/constants-CE7WkXh_.js';
2
- import { s as cursorTo, A as isWindows } from './packem_shared/cursor-CHPvxMal.js';
3
- import { eraseDisplay, eraseInLine, EraseDisplayMode, EraseLineMode } from './erase.js';
4
-
5
- const clearScreenFromTopLeft = cursorTo(0, 0) + eraseDisplay(EraseDisplayMode.ToEnd);
6
- const clearLineAndHomeCursor = `${eraseInLine(EraseLineMode.EntireLine) + CSI}G`;
7
- const clearScreenAndHomeCursor = `${CSI}H${eraseDisplay(EraseDisplayMode.EntireScreen)}`;
8
- const resetTerminal = isWindows ? `${eraseDisplay(EraseDisplayMode.EntireScreen) + CSI}0f` : (
9
- // 1. Erases the screen (as a fallback/part of comprehensive clear)
10
- // 2. Erases the whole screen including scrollback buffer (XTerm)
11
- // 3. Moves cursor to the top-left position
12
- // 4. RIS - Hard Reset (most comprehensive reset)
13
- `${eraseDisplay(EraseDisplayMode.EntireScreen) + eraseDisplay(EraseDisplayMode.EntireScreenAndScrollback) + CSI}H${ESC}c`
14
- );
15
-
16
- export { clearLineAndHomeCursor, clearScreenAndHomeCursor, clearScreenFromTopLeft, resetTerminal };
@@ -1,20 +0,0 @@
1
- /** Escape character (\u001B). */
2
- export declare const ESC: string;
3
- /** Control Sequence Introducer (ESC [). */
4
- export declare const CSI: string;
5
- /** Operating System Command (ESC ]). */
6
- export declare const OSC: string;
7
- /** Bell character (\u0007). Often used to terminate OSC sequences. */
8
- export declare const BEL: string;
9
- /** Separator used in some ANSI sequences, typically a semicolon. */
10
- export declare const SEP: string;
11
- /** Device Control String (ESC P). */
12
- export declare const DCS: string;
13
- /** String Terminator (ESC \\). Used to terminate DCS, SOS, PM, APC sequences. */
14
- export declare const ST: string;
15
- /** Application Program Command (ESC _). */
16
- export declare const APC: string;
17
- /** Start of String (ESC X). */
18
- export declare const SOS: string;
19
- /** Privacy Message (ESC ^). */
20
- export declare const PM: string;