feat: rewrite Output class with StyledChar[][] grid for correct emoji/wide char handling

Port Ink's output character model using @alcalzone/ansi-tokenize. Each cell is now a
StyledChar with proper grapheme clustering. Fixes emoji alignment, wide char boundaries,
and changes clipping to top-only (matching Ink). Upgraded ansi-tokenize to ^0.3.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-26 13:19:50 +08:00
parent 8b834c2b7f
commit 957d30f43a
6 changed files with 251 additions and 150 deletions
+8 -14
View File
@@ -7,8 +7,8 @@ settings:
catalogs:
default:
'@alcalzone/ansi-tokenize':
specifier: ^0.1.3
version: 0.1.3
specifier: ^0.3.0
version: 0.3.0
'@types/node':
specifier: ^24.12.4
version: 24.12.4
@@ -145,7 +145,7 @@ importers:
dependencies:
'@alcalzone/ansi-tokenize':
specifier: 'catalog:'
version: 0.1.3
version: 0.3.0
'@vue/runtime-core':
specifier: ^3.4.0
version: 3.5.34
@@ -241,9 +241,9 @@ importers:
packages:
'@alcalzone/ansi-tokenize@0.1.3':
resolution: {integrity: sha512-3yWxPTq3UQ/FY9p1ErPxIyfT64elWaMvM9lIHnaqpyft63tkxodF5aUElYHrdisWve5cETkh1+KBw1yJuW0aRw==}
engines: {node: '>=14.13.1'}
'@alcalzone/ansi-tokenize@0.3.0':
resolution: {integrity: sha512-p+CMKJ93HFmLkjXKlXiVGlMQEuRb6H0MokBSwUsX+S6BRX8eV5naFZpQJFfJHjRZY0Hmnqy1/r6UWl3x+19zYA==}
engines: {node: '>=18'}
'@babel/code-frame@7.29.0':
resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}
@@ -1354,10 +1354,6 @@ packages:
humanize-ms@1.2.1:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
is-fullwidth-code-point@4.0.0:
resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==}
engines: {node: '>=12'}
is-fullwidth-code-point@5.1.0:
resolution: {integrity: sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==}
engines: {node: '>=18'}
@@ -1762,10 +1758,10 @@ packages:
snapshots:
'@alcalzone/ansi-tokenize@0.1.3':
'@alcalzone/ansi-tokenize@0.3.0':
dependencies:
ansi-styles: 6.2.3
is-fullwidth-code-point: 4.0.0
is-fullwidth-code-point: 5.1.0
'@babel/code-frame@7.29.0':
dependencies:
@@ -2741,8 +2737,6 @@ snapshots:
dependencies:
ms: 2.1.3
is-fullwidth-code-point@4.0.0: {}
is-fullwidth-code-point@5.1.0:
dependencies:
get-east-asian-width: 1.6.0