@svelterm/core 0.1.0 → 0.21.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.
- package/CHANGELOG.md +425 -0
- package/README.md +42 -29
- package/dist/src/cli/build.d.ts +13 -0
- package/dist/src/cli/build.js +119 -0
- package/dist/src/cli/bundle.d.ts +25 -0
- package/dist/src/cli/bundle.js +61 -0
- package/dist/src/cli/dev.d.ts +10 -0
- package/dist/src/cli/dev.js +152 -0
- package/dist/src/cli/devtools.d.ts +9 -0
- package/dist/src/cli/devtools.js +47 -0
- package/dist/src/cli/init.d.ts +8 -0
- package/dist/src/cli/init.js +153 -0
- package/dist/src/cli/main.d.ts +9 -0
- package/dist/src/cli/main.js +52 -0
- package/dist/src/cli/svt-bin.d.ts +2 -0
- package/dist/src/cli/svt-bin.js +6 -0
- package/dist/src/cli/svt.d.ts +14 -0
- package/dist/src/cli/svt.js +76 -0
- package/dist/src/components/text-buffer.js +8 -5
- package/dist/src/css/animation-runner.d.ts +15 -6
- package/dist/src/css/animation-runner.js +80 -29
- package/dist/src/css/animation.d.ts +12 -0
- package/dist/src/css/animation.js +21 -0
- package/dist/src/css/calc.js +4 -3
- package/dist/src/css/color.d.ts +19 -0
- package/dist/src/css/color.js +371 -62
- package/dist/src/css/compute.d.ts +30 -3
- package/dist/src/css/compute.js +272 -33
- package/dist/src/css/defaults.d.ts +1 -1
- package/dist/src/css/defaults.js +9 -0
- package/dist/src/css/easing.d.ts +9 -0
- package/dist/src/css/easing.js +95 -0
- package/dist/src/css/incremental.d.ts +1 -1
- package/dist/src/css/incremental.js +2 -2
- package/dist/src/css/interpolate.d.ts +13 -0
- package/dist/src/css/interpolate.js +41 -0
- package/dist/src/css/parser.js +59 -3
- package/dist/src/css/pseudo-elements.d.ts +9 -0
- package/dist/src/css/pseudo-elements.js +97 -0
- package/dist/src/css/selector.d.ts +17 -2
- package/dist/src/css/selector.js +128 -13
- package/dist/src/css/specificity.js +17 -6
- package/dist/src/css/values.d.ts +6 -1
- package/dist/src/css/values.js +13 -6
- package/dist/src/debug/context.d.ts +13 -0
- package/dist/src/debug/context.js +11 -0
- package/dist/src/debug/css.d.ts +12 -0
- package/dist/src/debug/css.js +28 -0
- package/dist/src/debug/dom.d.ts +17 -0
- package/dist/src/debug/dom.js +92 -0
- package/dist/src/devtools/DevTools.compiled.js +327 -0
- package/dist/src/devtools/DevTools.css.js +1 -0
- package/dist/src/devtools/client.d.ts +36 -0
- package/dist/src/devtools/client.js +76 -0
- package/dist/src/framelog.d.ts +54 -0
- package/dist/src/framelog.js +99 -0
- package/dist/src/headless.js +12 -4
- package/dist/src/index.d.ts +65 -3
- package/dist/src/index.js +609 -81
- package/dist/src/input/checkable.d.ts +8 -0
- package/dist/src/input/checkable.js +66 -0
- package/dist/src/input/details.d.ts +6 -0
- package/dist/src/input/details.js +34 -0
- package/dist/src/input/focus.d.ts +6 -0
- package/dist/src/input/focus.js +27 -9
- package/dist/src/input/keyboard.d.ts +2 -2
- package/dist/src/input/keyboard.js +32 -5
- package/dist/src/input/label.d.ts +8 -0
- package/dist/src/input/label.js +53 -0
- package/dist/src/input/modal.d.ts +9 -0
- package/dist/src/input/modal.js +28 -0
- package/dist/src/input/mouse.d.ts +2 -2
- package/dist/src/input/mouse.js +15 -2
- package/dist/src/input/select.d.ts +12 -0
- package/dist/src/input/select.js +63 -0
- package/dist/src/input/selection.d.ts +48 -0
- package/dist/src/input/selection.js +150 -0
- package/dist/src/layout/engine.d.ts +2 -0
- package/dist/src/layout/engine.js +1084 -142
- package/dist/src/layout/flex.js +4 -4
- package/dist/src/layout/size.js +3 -2
- package/dist/src/layout/text.d.ts +3 -2
- package/dist/src/layout/text.js +96 -17
- package/dist/src/layout/unicode.d.ts +20 -0
- package/dist/src/layout/unicode.js +121 -0
- package/dist/src/render/animation-clock.d.ts +51 -0
- package/dist/src/render/animation-clock.js +213 -0
- package/dist/src/render/ansi-text.d.ts +26 -0
- package/dist/src/render/ansi-text.js +131 -0
- package/dist/src/render/ansi.d.ts +18 -0
- package/dist/src/render/ansi.js +64 -19
- package/dist/src/render/border.js +166 -17
- package/dist/src/render/buffer.d.ts +1 -0
- package/dist/src/render/buffer.js +5 -2
- package/dist/src/render/color-depth.d.ts +8 -0
- package/dist/src/render/color-depth.js +59 -0
- package/dist/src/render/context.d.ts +1 -0
- package/dist/src/render/context.js +17 -21
- package/dist/src/render/cursor-emit.d.ts +18 -0
- package/dist/src/render/cursor-emit.js +50 -0
- package/dist/src/render/diff.d.ts +12 -0
- package/dist/src/render/diff.js +120 -0
- package/dist/src/render/generation.d.ts +9 -0
- package/dist/src/render/generation.js +14 -0
- package/dist/src/render/graphics-layer.d.ts +27 -0
- package/dist/src/render/graphics-layer.js +86 -0
- package/dist/src/render/image.d.ts +27 -0
- package/dist/src/render/image.js +113 -0
- package/dist/src/render/incremental-paint.d.ts +7 -3
- package/dist/src/render/incremental-paint.js +52 -79
- package/dist/src/render/inline.d.ts +59 -0
- package/dist/src/render/inline.js +219 -0
- package/dist/src/render/kitty-graphics.d.ts +24 -0
- package/dist/src/render/kitty-graphics.js +58 -0
- package/dist/src/render/paint-text.js +68 -22
- package/dist/src/render/paint.d.ts +8 -1
- package/dist/src/render/paint.js +328 -30
- package/dist/src/render/png.d.ts +13 -0
- package/dist/src/render/png.js +145 -0
- package/dist/src/render/scrollbar.d.ts +8 -2
- package/dist/src/render/scrollbar.js +71 -14
- package/dist/src/render/snapshot.js +3 -1
- package/dist/src/renderer/default.d.ts +7 -0
- package/dist/src/renderer/default.js +11 -0
- package/dist/src/renderer/index.d.ts +8 -2
- package/dist/src/renderer/index.js +4 -2
- package/dist/src/renderer/node.d.ts +109 -0
- package/dist/src/renderer/node.js +165 -1
- package/dist/src/terminal/capabilities.d.ts +33 -0
- package/dist/src/terminal/capabilities.js +66 -0
- package/dist/src/terminal/clipboard.d.ts +9 -0
- package/dist/src/terminal/clipboard.js +39 -0
- package/dist/src/terminal/io.d.ts +82 -0
- package/dist/src/terminal/io.js +155 -0
- package/dist/src/terminal/screen.d.ts +3 -10
- package/dist/src/terminal/screen.js +5 -28
- package/dist/src/terminal/stdin-router.d.ts +8 -5
- package/dist/src/terminal/stdin-router.js +22 -11
- package/dist/src/utils/node-map.d.ts +24 -0
- package/dist/src/utils/node-map.js +75 -0
- package/dist/src/vite/config.d.ts +62 -0
- package/dist/src/vite/config.js +191 -0
- package/docs/compatibility.md +67 -0
- package/docs/debug/devtools.md +40 -0
- package/docs/debug/svt.md +50 -0
- package/docs/distribution.md +106 -0
- package/docs/elements.md +120 -0
- package/docs/getting-started.md +177 -0
- package/docs/guide/css.md +187 -0
- package/docs/guide/input.md +143 -0
- package/docs/guide/layout.md +171 -0
- package/docs/guide/theming.md +94 -0
- package/docs/how-it-works.md +115 -0
- package/docs/inline-mode.md +77 -0
- package/docs/layout.md +106 -0
- package/docs/motion.md +91 -0
- package/docs/reference/README.md +65 -0
- package/docs/reference/css/properties/border-corner.md +82 -0
- package/docs/reference/css/properties/border-style.md +168 -0
- package/docs/reference.md +226 -0
- package/docs/selectors.md +80 -0
- package/docs/terminal-css.md +149 -0
- package/docs/terminals.md +83 -0
- package/package.json +28 -7
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Terminal support
|
|
2
|
+
|
|
3
|
+
## Support matrix
|
|
4
|
+
|
|
5
|
+
"Verified" means exercised interactively (rendering, input, the feature
|
|
6
|
+
columns below). "Expected" means the terminal advertises the required
|
|
7
|
+
capabilities and svelterm's output round-trips against a terminal model
|
|
8
|
+
in CI, but nobody has watched it run there yet — reports welcome.
|
|
9
|
+
|
|
10
|
+
| Terminal | Status | Truecolor | DEC 2026 | Kitty keys | OSC 52 | Graphics |
|
|
11
|
+
|---|---|---|---|---|---|---|
|
|
12
|
+
| Ghostty | verified | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
13
|
+
| tmux (3.4+) | verified | ✓ (with `tmux-256color`) | ✓ | pass-through | needs `set-clipboard on` | passthrough only |
|
|
14
|
+
| kitty | expected | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
15
|
+
| WezTerm | expected | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
16
|
+
| iTerm2 | expected | ✓ | ✓ | ✗ (legacy keys) | ✓ | ✗ (own protocol) |
|
|
17
|
+
| Alacritty | expected | ✓ | ✗ | ✓ | ✓ | ✗ |
|
|
18
|
+
| Terminal.app | expected | ✗ (256) | ✗ | ✗ | ✗ | ✗ |
|
|
19
|
+
| Windows Terminal | unknown | ✓ | ✗ | ✗ | ✓ | ✗ |
|
|
20
|
+
| Linux console | unknown | ✗ (16) | ✗ | ✗ | ✗ | ✗ |
|
|
21
|
+
|
|
22
|
+
Every degradation path (truecolor → 256 → 16 → mono, sync output off,
|
|
23
|
+
legacy keys) is tested in CI by round-tripping svelterm's emitted ANSI
|
|
24
|
+
through a terminal model and asserting the resulting grid — so an
|
|
25
|
+
"expected" terminal failing would mean a capability report bug, not a
|
|
26
|
+
rendering one.
|
|
27
|
+
|
|
28
|
+
svelterm adapts its output to the terminal it lands in. Detection runs in
|
|
29
|
+
the background at startup; the first frame paints with today's most common
|
|
30
|
+
defaults (truecolor, synchronized output) and re-paints if the terminal
|
|
31
|
+
turns out to be older.
|
|
32
|
+
|
|
33
|
+
## Colour depth
|
|
34
|
+
|
|
35
|
+
Hex/RGB colours quantize at emit time to what the terminal can show:
|
|
36
|
+
|
|
37
|
+
| Depth | Emitted as | Chosen when |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `truecolor` | `38;2;r;g;b` | `COLORTERM=truecolor`/`24bit`, or a known-truecolor terminal answers XTVERSION (iTerm2, kitty, WezTerm, Ghostty, Alacritty, Contour, Rio, VS Code) |
|
|
40
|
+
| `256` | `38;5;n` — nearest xterm cube/grey-ramp entry | `TERM` contains `256color` |
|
|
41
|
+
| `16` | nearest base colour's SGR code | everything else |
|
|
42
|
+
| `mono` | no colour output | [`NO_COLOR`](https://no-color.org/) is set |
|
|
43
|
+
|
|
44
|
+
ANSI colour names (`red`, `cyan`, …) pass through unchanged at every depth
|
|
45
|
+
— they always mean "the terminal's palette colour".
|
|
46
|
+
|
|
47
|
+
Override detection with `run(App, { colorDepth: '256' })`.
|
|
48
|
+
|
|
49
|
+
## Synchronized output
|
|
50
|
+
|
|
51
|
+
Frames are wrapped in DEC 2026 begin/end-synchronized-update so terminals
|
|
52
|
+
that support it repaint atomically (no tearing on large updates). Support
|
|
53
|
+
is probed with `DECRQM`; terminals that don't answer get plain writes.
|
|
54
|
+
|
|
55
|
+
## Colour scheme
|
|
56
|
+
|
|
57
|
+
`prefers-color-scheme` resolves from an OSC 11 background query, polled so
|
|
58
|
+
a live theme switch re-renders the app. Pin it with
|
|
59
|
+
`run(App, { colorScheme: 'light' })` (embedded terminals do this — the
|
|
60
|
+
OSC channel is meaningless there).
|
|
61
|
+
|
|
62
|
+
## Text selection and clipboard
|
|
63
|
+
|
|
64
|
+
Mouse reporting turns off the terminal's native selection, so svelterm
|
|
65
|
+
provides its own: **drag** selects a cell range (painted inverted),
|
|
66
|
+
**double-click** selects the word, **triple-click** the line. Releasing
|
|
67
|
+
the button copies the selection — via OSC 52 (survives ssh; needs the
|
|
68
|
+
terminal to allow clipboard writes) and the platform tool (`pbcopy`,
|
|
69
|
+
`wl-copy`/`xclip`, `clip`) when one exists. The highlight clears on the
|
|
70
|
+
next click.
|
|
71
|
+
|
|
72
|
+
## Cursor shape
|
|
73
|
+
|
|
74
|
+
The real terminal cursor becomes a **bar** while a focused
|
|
75
|
+
`<input>`/`<textarea>` owns it (DECSCUSR), and resets to the terminal's
|
|
76
|
+
configured shape otherwise — including on exit.
|
|
77
|
+
|
|
78
|
+
## Queries a svelterm app may send
|
|
79
|
+
|
|
80
|
+
At startup: OSC 11 (background colour), `CSI > 0 q` (XTVERSION, only when
|
|
81
|
+
the environment didn't already decide colour depth), `CSI ? 2026 $ p`
|
|
82
|
+
(DECRQM for synchronized output). All race a short timeout, so a terminal
|
|
83
|
+
that answers none of them just gets the conservative defaults.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svelterm/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Svelte 5 components rendered to the terminal with real CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,17 +15,27 @@
|
|
|
15
15
|
"./headless": {
|
|
16
16
|
"types": "./dist/src/headless.d.ts",
|
|
17
17
|
"default": "./dist/src/headless.js"
|
|
18
|
+
},
|
|
19
|
+
"./vite": {
|
|
20
|
+
"types": "./dist/src/vite/config.d.ts",
|
|
21
|
+
"default": "./dist/src/vite/config.js"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"svelterm": "./dist/src/cli/main.js",
|
|
26
|
+
"svt": "./dist/src/cli/svt-bin.js"
|
|
27
|
+
},
|
|
20
28
|
"main": "./dist/src/renderer/default.js",
|
|
21
29
|
"types": "./dist/src/renderer/default.d.ts",
|
|
22
30
|
"files": [
|
|
23
31
|
"dist/src",
|
|
32
|
+
"docs",
|
|
24
33
|
"README.md",
|
|
25
|
-
"LICENSE"
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"CHANGELOG.md"
|
|
26
36
|
],
|
|
27
37
|
"scripts": {
|
|
28
|
-
"build": "tsc",
|
|
38
|
+
"build": "tsc && node scripts/compile-devtools.mjs",
|
|
29
39
|
"test": "node --test dist/**/*.test.js",
|
|
30
40
|
"dev": "tsc --watch",
|
|
31
41
|
"demo": "DEMO=${DEMO:-counter} npx vite build && node dist-demo/${DEMO:-counter}/main.js",
|
|
@@ -35,17 +45,20 @@
|
|
|
35
45
|
"demo:showcase": "DEMO=showcase npx vite build && node dist-demo/showcase/main.js",
|
|
36
46
|
"demo:keyboard-hero": "DEMO=keyboard-hero npx vite build && node dist-demo/keyboard-hero/main.js",
|
|
37
47
|
"demo:snake": "DEMO=snake npx vite build && node dist-demo/snake/main.js",
|
|
38
|
-
"demo:themes": "DEMO=themes npx vite build && node dist-demo/themes/main.js"
|
|
48
|
+
"demo:themes": "DEMO=themes npx vite build && node dist-demo/themes/main.js",
|
|
49
|
+
"dev:counter": "npx vite dev --config vite.dev.config.ts",
|
|
50
|
+
"demo:inline": "DEMO=inline npx vite build && node dist-demo/inline/main.js"
|
|
39
51
|
},
|
|
40
52
|
"peerDependencies": {
|
|
41
53
|
"svelte": "^5.0.0"
|
|
42
54
|
},
|
|
43
55
|
"devDependencies": {
|
|
44
|
-
"@sveltejs/vite-plugin-svelte": "
|
|
56
|
+
"@sveltejs/vite-plugin-svelte": "file:../vite-plugin-svelte-fork/packages/vite-plugin-svelte",
|
|
45
57
|
"@types/node": "^25.5.0",
|
|
46
58
|
"@types/ws": "^8.18.1",
|
|
47
59
|
"typescript": "^6.0.2",
|
|
48
|
-
"vite": "^8.0.3"
|
|
60
|
+
"vite": "^8.0.3",
|
|
61
|
+
"yoga-layout": "^3.2.1"
|
|
49
62
|
},
|
|
50
63
|
"dependencies": {
|
|
51
64
|
"ws": "^8.20.0"
|
|
@@ -60,5 +73,13 @@
|
|
|
60
73
|
"renderer"
|
|
61
74
|
],
|
|
62
75
|
"author": "Tom Yandell",
|
|
63
|
-
"license": "MIT"
|
|
76
|
+
"license": "MIT",
|
|
77
|
+
"repository": {
|
|
78
|
+
"type": "git",
|
|
79
|
+
"url": "git+https://github.com/tomyan/svelterm.git"
|
|
80
|
+
},
|
|
81
|
+
"homepage": "https://svelterm.dev",
|
|
82
|
+
"bugs": {
|
|
83
|
+
"url": "https://github.com/tomyan/svelterm/issues"
|
|
84
|
+
}
|
|
64
85
|
}
|