restty 0.1.35 → 0.2.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.
Files changed (186) hide show
  1. package/README.md +49 -343
  2. package/dist/chunk-30px21q2.js +0 -0
  3. package/dist/{chunk-zqscavsh.js → chunk-db9dt7pr.js} +48146 -63236
  4. package/dist/chunk-s26trws6.js +9136 -0
  5. package/dist/chunk-wdme6j9c.js +1776 -0
  6. package/dist/chunk-xykzfd81.js +0 -0
  7. package/dist/chunk-y6hfk43b.js +1690 -0
  8. package/dist/fonts/local-font-access.types.d.ts +19 -0
  9. package/dist/fonts/manager/entries.d.ts +7 -0
  10. package/dist/headless.d.ts +102 -0
  11. package/dist/headless.js +350 -0
  12. package/dist/index.d.ts +8 -4
  13. package/dist/input/keymap/default-mapping.d.ts +1 -0
  14. package/dist/input/mouse.d.ts +13 -0
  15. package/dist/input/types.d.ts +10 -1
  16. package/dist/internal/runtime.d.ts +4 -0
  17. package/dist/internal/runtime.js +12 -0
  18. package/dist/internal/surface.d.ts +6 -0
  19. package/dist/internal/surface.js +15 -0
  20. package/dist/internal.d.ts +2 -5
  21. package/dist/internal.js +23 -5
  22. package/dist/restty.esm.js +32 -11368
  23. package/dist/restty.js +8 -2
  24. package/dist/runtime/core/api.d.ts +112 -0
  25. package/dist/runtime/core/config.d.ts +133 -0
  26. package/dist/runtime/core/lifecycle.d.ts +1 -0
  27. package/dist/runtime/core/models.d.ts +124 -0
  28. package/dist/runtime/core/resources.d.ts +50 -0
  29. package/dist/runtime/core/runtime-events.d.ts +28 -0
  30. package/dist/runtime/core/session.d.ts +9 -0
  31. package/dist/runtime/{codepoint-utils.d.ts → create-runtime/codepoint-utils.d.ts} +1 -1
  32. package/dist/runtime/create-runtime/{color-glyph-atlas.d.ts → font-runtime/color-glyph-atlas.d.ts} +2 -2
  33. package/dist/runtime/create-runtime/font-runtime/grid.d.ts +6 -0
  34. package/dist/runtime/create-runtime/font-runtime/grid.types.d.ts +22 -0
  35. package/dist/runtime/create-runtime/font-runtime/index.d.ts +15 -0
  36. package/dist/runtime/create-runtime/font-runtime/text.d.ts +12 -0
  37. package/dist/runtime/create-runtime/font-runtime/text.types.d.ts +10 -0
  38. package/dist/runtime/create-runtime/{font-runtime-helpers.types.d.ts → font-runtime/types.d.ts} +5 -8
  39. package/dist/runtime/create-runtime/font-runtime/webgpu-atlas.d.ts +7 -0
  40. package/dist/runtime/create-runtime/font-runtime/webgpu-atlas.types.d.ts +23 -0
  41. package/dist/runtime/create-runtime/highlight-terminal-color-utils.d.ts +1 -8
  42. package/dist/runtime/create-runtime/highlight-terminal-color-utils.types.d.ts +9 -0
  43. package/dist/runtime/create-runtime/input-hooks.d.ts +2 -12
  44. package/dist/runtime/create-runtime/input-hooks.types.d.ts +10 -0
  45. package/dist/runtime/create-runtime/interaction-runtime/bind-ime-events.d.ts +2 -1
  46. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-aux-handlers.d.ts +1 -1
  47. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-events.d.ts +2 -1
  48. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-up-handler.d.ts +1 -1
  49. package/dist/runtime/create-runtime/{interaction-runtime.d.ts → interaction-runtime/index.d.ts} +3 -2
  50. package/dist/runtime/create-runtime/interaction-runtime/kitty-image-cache.d.ts +2 -17
  51. package/dist/runtime/create-runtime/interaction-runtime/kitty-image-cache.types.d.ts +17 -0
  52. package/dist/runtime/create-runtime/interaction-runtime/{types.d.ts → runtime.types.d.ts} +1 -47
  53. package/dist/runtime/create-runtime/interaction-runtime/scrollbar-runtime.d.ts +1 -23
  54. package/dist/runtime/create-runtime/interaction-runtime/scrollbar-runtime.types.d.ts +23 -0
  55. package/dist/runtime/create-runtime/interaction-runtime/state.types.d.ts +47 -0
  56. package/dist/runtime/create-runtime/kitty-render-runtime.d.ts +2 -36
  57. package/dist/runtime/create-runtime/kitty-render-runtime.types.d.ts +33 -0
  58. package/dist/runtime/create-runtime/{lifecycle-theme-size-canvas.d.ts → lifecycle-theme-size/canvas.d.ts} +1 -1
  59. package/dist/runtime/create-runtime/{lifecycle-theme-size.d.ts → lifecycle-theme-size/index.d.ts} +3 -3
  60. package/dist/runtime/create-runtime/lifecycle-theme-size/theme.d.ts +6 -0
  61. package/dist/runtime/create-runtime/{lifecycle-theme-size.types.d.ts → lifecycle-theme-size/types.d.ts} +1 -6
  62. package/dist/runtime/{max-scrollback.d.ts → create-runtime/max-scrollback.d.ts} +2 -5
  63. package/dist/runtime/create-runtime/max-scrollback.types.d.ts +4 -0
  64. package/dist/runtime/create-runtime/native-scrollbar-host.d.ts +2 -15
  65. package/dist/runtime/create-runtime/native-scrollbar-host.types.d.ts +13 -0
  66. package/dist/runtime/{overlay-scrollbar.d.ts → create-runtime/overlay-scrollbar.d.ts} +1 -12
  67. package/dist/runtime/create-runtime/overlay-scrollbar.types.d.ts +12 -0
  68. package/dist/runtime/create-runtime/pty-input-runtime.d.ts +2 -46
  69. package/dist/runtime/create-runtime/pty-input-runtime.types.d.ts +41 -0
  70. package/dist/runtime/{render-color-utils.d.ts → create-runtime/render-color-utils.d.ts} +1 -1
  71. package/dist/runtime/{render-stage-runtime.d.ts → create-runtime/render-stage-runtime.d.ts} +2 -2
  72. package/dist/runtime/{create-app-types.d.ts → create-runtime/render-stage-runtime.types.d.ts} +1 -29
  73. package/dist/runtime/create-runtime/render-tick-webgl-overlays.d.ts +1 -1
  74. package/dist/runtime/create-runtime/render-tick-webgl-scene.d.ts +1 -1
  75. package/dist/runtime/create-runtime/render-tick-webgl.types.d.ts +2 -5
  76. package/dist/runtime/create-runtime/render-tick-webgpu-cell-pass.d.ts +1 -1
  77. package/dist/runtime/create-runtime/render-tick-webgpu.types.d.ts +5 -9
  78. package/dist/runtime/create-runtime/runtime-controller.api.types.d.ts +96 -0
  79. package/dist/runtime/create-runtime/runtime-controller.clipboard.d.ts +10 -0
  80. package/dist/runtime/create-runtime/runtime-controller.d.ts +3 -0
  81. package/dist/runtime/create-runtime/runtime-controller.input.d.ts +24 -0
  82. package/dist/runtime/create-runtime/runtime-controller.keyboard.d.ts +19 -0
  83. package/dist/runtime/create-runtime/runtime-controller.lifecycle.d.ts +50 -0
  84. package/dist/runtime/create-runtime/runtime-controller.public-api.capabilities.d.ts +57 -0
  85. package/dist/runtime/create-runtime/runtime-controller.public-api.d.ts +28 -0
  86. package/dist/runtime/create-runtime/runtime-controller.render-loop.d.ts +20 -0
  87. package/dist/runtime/create-runtime/runtime-controller.state.types.d.ts +24 -0
  88. package/dist/runtime/create-runtime/runtime-reporting.d.ts +3 -21
  89. package/dist/runtime/create-runtime/runtime-reporting.types.d.ts +18 -0
  90. package/dist/runtime/{create-app-symbols.d.ts → create-runtime/runtime-symbols.d.ts} +2 -2
  91. package/dist/runtime/create-runtime/search-highlight-utils.d.ts +1 -1
  92. package/dist/runtime/create-runtime/search-runtime/index.d.ts +2 -0
  93. package/dist/runtime/create-runtime/{search-runtime.d.ts → search-runtime/types.d.ts} +9 -6
  94. package/dist/runtime/create-runtime/shader-stage-runtime.d.ts +2 -29
  95. package/dist/runtime/create-runtime/shader-stage-runtime.types.d.ts +27 -0
  96. package/dist/runtime/{text-decoration.d.ts → create-runtime/text-decoration.d.ts} +1 -1
  97. package/dist/runtime/create-runtime.d.ts +7 -7
  98. package/dist/runtime/font-atlas-utils/glyph-atlas-builder.d.ts +1 -1
  99. package/dist/runtime/font-atlas-utils/nerd-metrics-utils.d.ts +1 -1
  100. package/dist/runtime/{atlas-builder.d.ts → fonts/atlas-builder.d.ts} +1 -1
  101. package/dist/runtime/{font-resource-store.d.ts → fonts/font-resource-store.d.ts} +3 -2
  102. package/dist/runtime/fonts/font-sources.d.ts +4 -0
  103. package/dist/runtime/shader-stages.d.ts +1 -1
  104. package/dist/runtime/types.d.ts +6 -393
  105. package/dist/surface/{panes-context-menu.d.ts → panes/context-menu.d.ts} +1 -1
  106. package/dist/surface/panes/default-context-menu-items.d.ts +2 -2
  107. package/dist/surface/panes/layout.d.ts +1 -1
  108. package/dist/surface/panes/managed-pane-create.d.ts +3 -0
  109. package/dist/surface/panes/managed-pane-create.types.d.ts +17 -0
  110. package/dist/surface/panes/managed-pane-dom.d.ts +13 -0
  111. package/dist/surface/panes/managed-pane-manager.d.ts +6 -0
  112. package/dist/surface/panes/managed-pane-options.d.ts +6 -0
  113. package/dist/surface/panes/managed-pane-options.types.d.ts +7 -0
  114. package/dist/surface/panes/managed-pane-runtime-config.d.ts +3 -0
  115. package/dist/surface/panes/managed-pane-runtime-config.types.d.ts +9 -0
  116. package/dist/surface/panes/managed-pane-runtime.d.ts +3 -0
  117. package/dist/surface/panes/managed-pane-runtime.types.d.ts +10 -0
  118. package/dist/surface/panes/managed-pane-search-ui.d.ts +9 -0
  119. package/dist/surface/{pane-app-manager.d.ts → panes/managed-pane-types.d.ts} +34 -36
  120. package/dist/surface/panes/manager.d.ts +1 -1
  121. package/dist/surface/panes/pane-interactions.d.ts +2 -2
  122. package/dist/surface/{panes-styles.d.ts → panes/styles.d.ts} +1 -1
  123. package/dist/surface/{panes-types.d.ts → panes/types.d.ts} +48 -7
  124. package/dist/surface/panes/window-events.d.ts +1 -1
  125. package/dist/surface/{restty-plugin-types.d.ts → plugins/context.types.d.ts} +32 -88
  126. package/dist/surface/{restty/plugin-dispatcher.d.ts → plugins/dispatcher.d.ts} +4 -13
  127. package/dist/surface/plugins/dispatcher.types.d.ts +6 -0
  128. package/dist/surface/{restty/plugin-ops.d.ts → plugins/host.d.ts} +4 -3
  129. package/dist/surface/plugins/runtime.d.ts +18 -0
  130. package/dist/surface/plugins/runtime.types.d.ts +47 -0
  131. package/dist/surface/plugins/types.d.ts +83 -0
  132. package/dist/surface/restty/active-pane-api.d.ts +33 -23
  133. package/dist/surface/restty/assembly.d.ts +23 -0
  134. package/dist/surface/restty/bootstrap.d.ts +21 -0
  135. package/dist/surface/restty/config.d.ts +46 -0
  136. package/dist/surface/restty/controller.d.ts +45 -0
  137. package/dist/surface/restty/events.d.ts +14 -0
  138. package/dist/surface/restty/manager-options.d.ts +4 -23
  139. package/dist/surface/restty/manager-options.types.d.ts +32 -0
  140. package/dist/surface/restty/pane-command-ops.d.ts +37 -0
  141. package/dist/surface/restty/pane-handle-ops.d.ts +24 -0
  142. package/dist/surface/{restty-pane-handle.d.ts → restty/pane-handle.d.ts} +42 -40
  143. package/dist/surface/restty/pane-lookup.d.ts +22 -0
  144. package/dist/surface/restty/pane-manager-assembly.d.ts +18 -0
  145. package/dist/surface/restty/pane-ops.d.ts +3 -51
  146. package/dist/surface/restty/pane-style-ops.d.ts +6 -0
  147. package/dist/surface/restty/plugin-surface.d.ts +5 -0
  148. package/dist/surface/restty/shader-ops.d.ts +6 -5
  149. package/dist/surface/restty.d.ts +28 -49
  150. package/dist/surface/search-ui/controller.d.ts +2 -0
  151. package/dist/surface/search-ui/index.d.ts +2 -0
  152. package/dist/surface/search-ui/styles.d.ts +5 -0
  153. package/dist/surface/{pane-search-ui.d.ts → search-ui/types.d.ts} +22 -13
  154. package/dist/wasm/embedded.d.ts +1 -1
  155. package/dist/wasm/runtime/types.d.ts +0 -6
  156. package/dist/xterm/compat-services.d.ts +2 -0
  157. package/dist/xterm.d.ts +4 -3
  158. package/dist/xterm.js +14 -8
  159. package/package.json +52 -33
  160. package/dist/internal.esm.js +0 -22285
  161. package/dist/runtime/create-runtime/debug-tools/create-dump-glyph-render.d.ts +0 -2
  162. package/dist/runtime/create-runtime/debug-tools/diagnose-codepoint.d.ts +0 -2
  163. package/dist/runtime/create-runtime/debug-tools/dump-atlas-for-codepoint.d.ts +0 -2
  164. package/dist/runtime/create-runtime/debug-tools/read-texture-to-image-data.d.ts +0 -1
  165. package/dist/runtime/create-runtime/debug-tools/setup-debug-expose.d.ts +0 -2
  166. package/dist/runtime/create-runtime/debug-tools/types.d.ts +0 -63
  167. package/dist/runtime/create-runtime/debug-tools.d.ts +0 -6
  168. package/dist/runtime/create-runtime/font-runtime-grid-helpers.d.ts +0 -31
  169. package/dist/runtime/create-runtime/font-runtime-helpers.d.ts +0 -15
  170. package/dist/runtime/create-runtime/font-runtime-text-helpers.d.ts +0 -21
  171. package/dist/runtime/create-runtime/font-runtime-webgpu-atlas.d.ts +0 -29
  172. package/dist/runtime/create-runtime/lifecycle-theme-size-theme.d.ts +0 -6
  173. package/dist/runtime/create-runtime/runtime-app-api.d.ts +0 -113
  174. package/dist/runtime/create-runtime/runtime-logger.d.ts +0 -17
  175. package/dist/runtime/font-sources.d.ts +0 -5
  176. package/dist/runtime/pty-output-buffer.d.ts +0 -12
  177. package/dist/runtime/session.d.ts +0 -9
  178. package/dist/surface/app-factory.d.ts +0 -3
  179. package/dist/surface/restty-plugin-runtime.d.ts +0 -57
  180. package/dist/xterm/app-options.d.ts +0 -2
  181. package/dist/xterm.esm.js +0 -12210
  182. /package/dist/runtime/create-runtime/{atlas-debug-utils.d.ts → atlas-bitmap-utils.d.ts} +0 -0
  183. /package/dist/runtime/{clipboard-paste.d.ts → create-runtime/clipboard-paste.d.ts} +0 -0
  184. /package/dist/runtime/{render-stage-shaders.d.ts → create-runtime/render-stage-shaders.d.ts} +0 -0
  185. /package/dist/runtime/{create-app-io-utils.d.ts → create-runtime/runtime-io-utils.d.ts} +0 -0
  186. /package/dist/surface/{restty-plugin-utils.d.ts → plugins/utils.d.ts} +0 -0
package/README.md CHANGED
@@ -1,42 +1,20 @@
1
1
  # restty
2
2
 
3
3
  [![Version](https://img.shields.io/npm/v/restty?style=flat-square)](https://www.npmjs.com/package/restty)
4
- [![Downloads](https://img.shields.io/npm/dm/restty)](https://www.npmjs.com/package/restty)
5
- [![Package Size](https://img.shields.io/npm/unpacked-size/restty?style=flat-square)](https://www.npmjs.com/package/restty)
4
+ [![Downloads](https://img.shields.io/npm/dm/restty?style=flat-square)](https://www.npmjs.com/package/restty)
6
5
  [![CI](https://img.shields.io/github/actions/workflow/status/wiedymi/restty/ci.yml?branch=main&style=flat-square)](https://github.com/wiedymi/restty/actions/workflows/ci.yml)
7
- [![Publish](https://img.shields.io/github/actions/workflow/status/wiedymi/restty/publish.yml?style=flat-square&label=publish)](https://github.com/wiedymi/restty/actions/workflows/publish.yml)
8
6
  [![Demo](https://img.shields.io/badge/demo-restty.pages.dev-0ea5e9?style=flat-square)](https://restty.pages.dev/)
9
7
 
10
- [![GitHub](https://img.shields.io/badge/-GitHub-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/wiedymi)
11
- [![Twitter](https://img.shields.io/badge/-Twitter-1DA1F2?style=flat-square&logo=twitter&logoColor=white)](https://x.com/wiedymi)
12
- [![Email](https://img.shields.io/badge/-Email-EA4335?style=flat-square&logo=gmail&logoColor=white)](mailto:contact@wiedymi.com)
13
- [![Discord](https://img.shields.io/badge/-Discord-5865F2?style=flat-square&logo=discord&logoColor=white)](https://discord.gg/zemMZtrkSb)
14
- [![Support me](https://img.shields.io/badge/-Support%20me-ff69b4?style=flat-square&logo=githubsponsors&logoColor=white)](https://github.com/sponsors/vivy-company)
8
+ Browser terminal rendering for web apps, powered by `libghostty-vt` in WASM,
9
+ WebGPU with WebGL2 fallback, and TypeScript text shaping.
15
10
 
16
- Powerful, lightweight browser terminal. Batteries included.
11
+ - Demo: <https://restty.pages.dev/>
12
+ - Canonical docs: <https://restty.pages.dev/docs>
13
+ - npm: <https://www.npmjs.com/package/restty>
14
+ - Issues: <https://github.com/wiedymi/restty/issues>
17
15
 
18
- Live demo: `https://restty.pages.dev/`
19
-
20
- Powered by:
21
-
22
- - `libghostty-vt` (WASM terminal core)
23
- - `WebGPU` (with WebGL2 fallback)
24
- - `text-shaper` (shaping + raster)
25
-
26
- Recent additions:
27
-
28
- - programming ligatures with cross-cell shaping
29
- - desktop double-click word selection and triple-click line selection
30
- - standalone ESM bundles at `restty/esm`, `restty/esm/internal`, and `restty/esm/xterm`
31
-
32
- ## Release Status
33
-
34
- `restty` is in an early release stage.
35
-
36
- - Known issue: kitty image protocol handling can still fail in some edge cases.
37
- - API note: high-level APIs are usable now, but some APIs may still change to improve DX.
38
-
39
- If you hit an issue, please open one on GitHub with repro steps.
16
+ `restty` is early-release software. The high-level API is usable, but some APIs may still change
17
+ while the developer experience settles.
40
18
 
41
19
  ## Install
42
20
 
@@ -60,300 +38,36 @@ const restty = new Restty({
60
38
  restty.connectPty("ws://localhost:8787/pty");
61
39
  ```
62
40
 
63
- That is the primary API: `new Restty(...)`.
64
- `restty` creates pane DOM, canvas, and hidden IME input for you.
65
-
66
- ## Common Tasks
67
-
68
- ### Apply a built-in theme
69
-
70
- ```ts
71
- import { getBuiltinTheme } from "restty";
72
-
73
- const theme = getBuiltinTheme("Aizen Dark");
74
- if (theme) restty.applyTheme(theme);
75
- ```
76
-
77
- ### Parse and apply a Ghostty theme file
78
-
79
- ```ts
80
- import { parseGhosttyTheme } from "restty";
81
-
82
- const theme = parseGhosttyTheme(`
83
- foreground = #c0caf5
84
- background = #1a1b26
85
- cursor-color = #c0caf5
86
- `);
87
-
88
- restty.applyTheme(theme, "inline");
89
- ```
90
-
91
- ### Split panes and operate per pane
92
-
93
- ```ts
94
- restty.splitActivePane("vertical");
95
- restty.splitActivePane("horizontal");
96
-
97
- for (const pane of restty.panes()) {
98
- pane.connectPty("ws://localhost:8787/pty");
99
- }
100
- ```
101
-
102
- ### Use active-pane convenience methods
103
-
104
- ```ts
105
- restty.setFontSize(15);
106
- restty.setLigatures(true);
107
- restty.sendInput("ls -la\n");
108
- restty.copySelectionToClipboard();
109
- restty.selectWordAtClientPoint(120, 48);
110
- ```
111
-
112
- ### Provide custom fonts
113
-
114
- By default, restty uses a local-first font preset with CDN fallback. To fully control fonts, disable the preset and pass `fontSources`.
115
-
116
- ```ts
117
- const restty = new Restty({
118
- root: document.getElementById("terminal") as HTMLElement,
119
- appOptions: {
120
- fontPreset: "none",
121
- },
122
- fontSources: [
123
- {
124
- type: "url",
125
- url: "https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono@v2.304/fonts/ttf/JetBrainsMono-Regular.ttf",
126
- label: "JetBrains Mono",
127
- },
128
- {
129
- type: "local",
130
- matchers: ["jetbrains mono nerd font", "fira code nerd font"],
131
- label: "Local fallback",
132
- },
133
- ],
134
- });
135
- ```
136
-
137
- Update fonts at runtime (all panes):
138
-
139
- ```ts
140
- await restty.setFontSources([
141
- { type: "local", matchers: ["sf mono"], required: true },
142
- {
143
- type: "url",
144
- url: "https://cdn.jsdelivr.net/gh/ryanoasis/nerd-fonts@v3.4.0/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFontMono-Regular.ttf",
145
- },
146
- ]);
147
- ```
148
-
149
- ### Use standalone single-file ESM bundles
150
-
151
- When you want self-contained browser ESM artifacts instead of the split package entrypoints:
152
-
153
- ```ts
154
- import { Restty } from "restty/esm";
155
- import { Terminal } from "restty/esm/xterm";
156
- ```
157
-
158
- Package outputs:
159
-
160
- - `restty/esm` -> `dist/restty.esm.js`
161
- - `restty/esm/internal` -> `dist/internal.esm.js`
162
- - `restty/esm/xterm` -> `dist/xterm.esm.js`
163
-
164
- ### Touch behavior (pan-first by default)
165
-
166
- On touch devices, restty defaults to pan-first scrolling with long-press selection.
167
-
168
- ```ts
169
- const restty = new Restty({
170
- root: document.getElementById("terminal") as HTMLElement,
171
- appOptions: {
172
- // "long-press" (default) | "drag" | "off"
173
- touchSelectionMode: "long-press",
174
- // Optional tuning knobs:
175
- touchSelectionLongPressMs: 450,
176
- touchSelectionMoveThresholdPx: 10,
177
- },
178
- });
179
- ```
180
-
181
- ### Plugin system (native)
182
-
183
- Use plugins when you want to extend restty behavior without patching core.
184
-
185
- ```ts
186
- import type { ResttyPlugin } from "restty";
187
-
188
- const metricsPlugin: ResttyPlugin = {
189
- id: "example/metrics",
190
- apiVersion: 1,
191
- activate(ctx) {
192
- const paneCreated = ctx.on("pane:created", ({ paneId }) => {
193
- console.log("pane created", paneId);
194
- });
195
- const outgoing = ctx.addInputInterceptor(({ text }) => text.replace(/\t/g, " "));
196
- const lifecycle = ctx.addLifecycleHook(({ phase, action }) => {
197
- console.log("lifecycle", phase, action);
198
- });
199
- const stage = ctx.addRenderStage({
200
- id: "metrics/tint",
201
- mode: "after-main",
202
- uniforms: [0.12],
203
- shader: {
204
- wgsl: `
205
- fn resttyStage(color: vec4f, uv: vec2f, time: f32, params0: vec4f, params1: vec4f) -> vec4f {
206
- return vec4f(min(vec3f(1.0), color.rgb + vec3f(params0.x, 0.0, 0.0)), color.a);
207
- }
208
- `,
209
- },
210
- });
211
- return () => {
212
- paneCreated.dispose();
213
- outgoing.dispose();
214
- lifecycle.dispose();
215
- stage.dispose();
216
- };
217
- },
218
- };
219
-
220
- await restty.use(metricsPlugin, { sampleRate: 1 });
221
- console.log(restty.pluginInfo("example/metrics"));
222
- restty.unuse("example/metrics");
223
- ```
224
-
225
- Declarative loading (manifest + registry):
41
+ `new Restty(...)` creates the pane DOM, canvas, and hidden IME input for you.
226
42
 
227
- ```ts
228
- await restty.loadPlugins(
229
- [{ id: "example/metrics", options: { sampleRate: 1 } }],
230
- {
231
- "example/metrics": () => metricsPlugin,
232
- },
233
- );
234
- ```
235
-
236
- See `docs/plugins.md` for full plugin authoring details.
237
-
238
- ### Shader stages
43
+ ## Main Entrypoints
239
44
 
240
- Shader stages let you extend the final frame pipeline with WGSL/GLSL passes.
45
+ - `restty`: primary API (`Restty`, `createRestty`, themes, fonts, PTY helpers, plugin types).
46
+ - `restty/xterm`: focused xterm.js-style compatibility wrapper.
47
+ - `restty/headless`: DOM-free WASM terminal core wrapper for replay, tests, and backend-owned sessions.
48
+ - `restty/esm`: standalone browser ESM bundle for script/CDN usage.
49
+ - `restty/internal`, `restty/internal/runtime`, `restty/internal/surface`: unstable advanced modules.
241
50
 
242
- Global stages:
51
+ See the canonical [API surface docs](https://restty.pages.dev/docs/api-surface) for the current
52
+ method and export list.
243
53
 
244
- ```ts
245
- restty.setShaderStages([
246
- {
247
- id: "app/crt-lite",
248
- mode: "after-main",
249
- backend: "both",
250
- uniforms: [0.24, 0.12],
251
- shader: {
252
- wgsl: `
253
- fn resttyStage(color: vec4f, uv: vec2f, time: f32, params0: vec4f, params1: vec4f) -> vec4f {
254
- let v = clamp(params0.x, 0.0, 0.8);
255
- let centered = (uv - vec2f(0.5, 0.5)) * 2.0;
256
- let vignette = max(0.0, 1.0 - v * dot(centered, centered));
257
- return vec4f(color.rgb * vignette, color.a);
258
- }
259
- `,
260
- },
261
- },
262
- ]);
263
-
264
- const stage = restty.addShaderStage({
265
- id: "app/mono",
266
- mode: "after-main",
267
- uniforms: [1.0],
268
- shader: {
269
- wgsl: `
270
- fn resttyStage(color: vec4f, uv: vec2f, time: f32, params0: vec4f, params1: vec4f) -> vec4f {
271
- let l = dot(color.rgb, vec3f(0.2126, 0.7152, 0.0722));
272
- return vec4f(l * 0.12, l * 0.95, l * 0.35, color.a);
273
- }
274
- `,
275
- },
276
- });
277
-
278
- stage.setEnabled(false);
279
- restty.removeShaderStage("app/mono");
280
- ```
281
-
282
- ### xterm compatibility layer
283
-
284
- For migration from xterm.js-style app code, use `restty/xterm`:
285
-
286
- ```ts
287
- import { Terminal } from "restty/xterm";
54
+ ## Common Links
288
55
 
289
- const term = new Terminal({ cols: 100, rows: 30 });
290
- term.open(document.getElementById("terminal") as HTMLElement);
291
-
292
- term.onData((data) => console.log("input", data));
293
- term.onResize(({ cols, rows }) => console.log("resize", cols, rows));
294
-
295
- term.write("hello");
296
- term.writeln(" world");
297
- term.resize(120, 40);
298
- term.loadAddon({
299
- activate() {},
300
- dispose() {},
301
- });
302
- ```
303
-
304
- Compatibility scope:
305
-
306
- - Good for common embed/migration flows.
307
- - Not full xterm internals parity (buffer/parser/marker ecosystem APIs are not all implemented).
308
- - Prefer native `Restty` API for long-term integrations.
309
-
310
- ## API Snapshot
311
-
312
- Primary class:
313
-
314
- - `new Restty({ root, ...options })`
315
- - `createRestty(options)`
316
-
317
- Xterm compatibility:
318
-
319
- - `import { Terminal } from "restty/xterm"`
320
- - Supports `open`, `write`, `writeln`, `resize`, `focus`, `blur`, `clear`, `reset`, `onData`, `onResize`, `options`, `loadAddon`, `dispose`
321
-
322
- Pane access:
323
-
324
- - `panes()` / `pane(id)` / `activePane()` / `focusedPane()` / `forEachPane(visitor)`
325
- - `splitActivePane("vertical" | "horizontal")` / `splitPane(id, direction)` / `closePane(id)`
326
-
327
- Active-pane convenience:
328
-
329
- - `connectPty(url)` / `disconnectPty()` / `isPtyConnected()`
330
- - `setRenderer("auto" | "webgpu" | "webgl2")`
331
- - `setFontSize(number)` / `setLigatures(boolean)` / `setFontSources([...])`
332
- - `applyTheme(theme)` / `resetTheme()`
333
- - `setMouseMode("auto" | "on" | "off")`
334
- - `sendInput(text)` / `sendKeyInput(text)`
335
- - `copySelectionToClipboard()` / `pasteFromClipboard()`
336
- - `selectWordAtClientPoint(x, y)`
337
- - `resize(cols, rows)` / `focus()` / `blur()`
338
- - `updateSize(force?)`
339
- - `destroy()`
340
-
341
- Plugin host:
342
-
343
- - `use(plugin, options?)` / `loadPlugins(manifest, registry)` / `unuse(pluginId)` / `plugins()` / `pluginInfo(pluginId?)`
344
- - plugin context supports `on(...)`, `addInputInterceptor(...)`, `addOutputInterceptor(...)`, `addLifecycleHook(...)`, `addRenderHook(...)`, `addRenderStage(...)`
345
-
346
- Shader stages:
347
-
348
- - `setShaderStages(stages)` / `getShaderStages()`
349
- - `addShaderStage(stage)` / `removeShaderStage(id)`
350
-
351
- ## Advanced / Internal Modules
352
-
353
- Use these only when you need lower-level control:
354
-
355
- - `restty/internal`: full internal barrel (unstable; includes low-level modules like WASM/input/pty helpers)
356
- - `restty/esm`, `restty/esm/internal`, `restty/esm/xterm`: standalone bundled browser ESM entrypoints
56
+ - [Getting started](https://restty.pages.dev/docs/getting-started)
57
+ - [Core concepts](https://restty.pages.dev/docs/core-concepts)
58
+ - [Surface and panes](https://restty.pages.dev/docs/surface-and-panes)
59
+ - [Configuration](https://restty.pages.dev/docs/configuration)
60
+ - [PTY backends](https://restty.pages.dev/docs/pty-backends)
61
+ - [Headless terminal](https://restty.pages.dev/docs/headless)
62
+ - [Search](https://restty.pages.dev/docs/search)
63
+ - [Playground examples](https://restty.pages.dev/docs/playground-examples)
64
+ - [Fonts](https://restty.pages.dev/docs/fonts)
65
+ - [Themes and shaders](https://restty.pages.dev/docs/themes)
66
+ - [Plugins](https://restty.pages.dev/docs/plugins)
67
+ - [xterm compatibility](https://restty.pages.dev/docs/xterm-compat)
68
+ - [Troubleshooting](https://restty.pages.dev/docs/troubleshooting)
69
+ - [Architecture](https://restty.pages.dev/docs/architecture)
70
+ - [Runnable examples](./examples)
357
71
 
358
72
  ## Local Development
359
73
 
@@ -368,31 +82,23 @@ bun run playground
368
82
 
369
83
  Open `http://localhost:5173`.
370
84
 
371
- ## Code Layout
372
-
373
- - `src/surface/`: public API (`Restty`), pane manager orchestration, plugin host, xterm shim.
374
- - `src/runtime/`: terminal runtime/render loop implementation.
375
- - `src/renderer/`, `src/input/`, `src/pty/`, `src/fonts/`, `src/theme/`, `src/wasm/`, `src/selection/`: subsystem modules.
376
- - `src/app/`: compatibility re-export layer while internals are refactored.
377
-
378
- ## Repository Commands
85
+ Useful checks:
379
86
 
380
87
  ```bash
381
- bun run build # build package output
382
- bun run test # full tests
383
- bun run test:ci # CI-safe test target
384
- bun run lint # lint
385
- bun run format:check # formatting check
386
- bun run build:assets # static playground bundle (playground/public/playground.js)
387
- bun run playground # one-command local dev (PTY + playground dev server)
388
- bun run pty # PTY websocket server only
88
+ bun run build
89
+ bun run test:ci
90
+ bun run lint
91
+ bun run format:check
92
+ bun run playground:build
389
93
  ```
390
94
 
391
- ## Documentation
95
+ Cloudflare Pages deployment settings:
96
+
97
+ - Framework preset: `None`
98
+ - Build command: `bun install --frozen-lockfile && bun run pages:build`
99
+ - Build output directory: `playground/dist`
100
+ - Root directory: leave blank
101
+ - Environment variables: set `SKIP_DEPENDENCY_INSTALL=1` when using the build command above.
392
102
 
393
- - `docs/README.md` - docs index
394
- - `docs/usage.md` - practical integration guide
395
- - `docs/xterm-compat.md` - xterm migration shim
396
- - `docs/how-it-works.md` - runtime flow
397
- - `docs/internals/` - implementation notes and architecture
398
- - `THIRD_PARTY_NOTICES.md` - third-party credits and notices
103
+ The hosted docs are sourced from `playground/content/docs/`. Repository notes under `docs/` are
104
+ legacy/internal references for development context.
File without changes