@alchemy.run/sigil 0.0.0-alpha.5 → 0.0.0-alpha.7

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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/{Text-D5HUf3Fj.d.ts → Text-DV9CuzAT.d.ts} +3 -3
  3. package/dist/ansi.d.ts +1 -1
  4. package/dist/ansi.js +2 -2
  5. package/dist/capabilities.d.ts +4 -4
  6. package/dist/capabilities.js +2 -2
  7. package/dist/{color-policy-BMzMwV7Q.d.ts → color-policy-CCxuHIdD.d.ts} +2 -2
  8. package/dist/{color-policy-SVj1pYTA.js → color-policy-DlrZXC0f.js} +31 -13
  9. package/dist/{color-profile-u0Nhe9Nv.d.ts → color-profile-CyeHnG1T.d.ts} +1 -1
  10. package/dist/color.d.ts +2 -2
  11. package/dist/{detect-BuTXtY6e.js → detect-B3dL4Q11.js} +3 -2
  12. package/dist/{detect-Bh4yGP6w.d.ts → detect-Db6GbKOm.d.ts} +9 -0
  13. package/dist/{index-Bmc2tRPk.d.ts → index-D48vQhhe.d.ts} +2 -2
  14. package/dist/index.d.ts +10 -6
  15. package/dist/index.js +85 -72
  16. package/dist/{osc-CCH7xDoS.js → osc-BFKKSqpg.js} +1 -1
  17. package/dist/{paint-C19minOS.d.ts → paint-Cx-zC_sX.d.ts} +2 -2
  18. package/dist/{query-vaIeGOkH.d.ts → query-BNc2B8GD.d.ts} +1 -1
  19. package/dist/router.d.ts +1 -1
  20. package/dist/router.js +1 -1
  21. package/dist/{screen-BReKIheE.d.ts → screen-CgC2WlVM.d.ts} +12 -3
  22. package/dist/{screen-BOh__-65.js → screen-CiPytswf.js} +30 -12
  23. package/dist/screen.d.ts +3 -3
  24. package/dist/screen.js +1 -1
  25. package/dist/{session-BJmzX2NJ.js → session-Cg6STjFV.js} +45 -9
  26. package/dist/{store-CgrG9K4y.d.ts → store-C1P5fOUi.d.ts} +1 -1
  27. package/dist/terminal.d.ts +8 -5
  28. package/dist/terminal.js +1 -1
  29. package/dist/{use-focus-C2sciZOo.js → use-focus-DSV01Ulb.js} +3 -1
  30. package/package.json +1 -1
  31. package/src/capabilities/detect.ts +15 -1
  32. package/src/capabilities/store.ts +17 -2
  33. package/src/components/Text.tsx +1 -1
  34. package/src/dom.ts +6 -0
  35. package/src/hooks/use-window-size.ts +8 -19
  36. package/src/ink.tsx +93 -23
  37. package/src/paint-tree.ts +7 -3
  38. package/src/screen/canvas.ts +49 -26
  39. package/src/screen/screen.ts +45 -12
  40. package/src/structured-text.ts +4 -0
  41. package/src/styles.ts +7 -1
  42. package/src/terminal/screen-presenter.ts +62 -8
  43. package/src/terminal/session.ts +3 -2
  44. package/src/testing/terminal.ts +15 -3
  45. package/src/wrap-text.ts +4 -0
  46. package/src/utils.ts +0 -40
@@ -100,7 +100,13 @@ export type TerminalApp = {
100
100
  */
101
101
  type: (text: string) => void;
102
102
 
103
- resize: (columns: number, rows: number) => void;
103
+ /**
104
+ Resizes the PTY and the emulator. Real terminal apps never do both at
105
+ once: `emulatorLag` (ms) delays the emulator's rewrap behind the PTY
106
+ resize, simulating an app that reports the new size to the process
107
+ before its screen has been rewrapped.
108
+ */
109
+ resize: (columns: number, rows: number, options?: { readonly emulatorLag?: number }) => void;
104
110
 
105
111
  /**
106
112
  Flips the emulated OS color scheme (Ghostty engine only) — the app
@@ -306,9 +312,15 @@ export const launchTerminal = async (
306
312
  type: (text) => {
307
313
  child.write(text);
308
314
  },
309
- resize: (nextColumns, nextRows) => {
315
+ resize: (nextColumns, nextRows, options = {}) => {
310
316
  child.resize(nextColumns, nextRows);
311
- emulator.resize(nextColumns, nextRows);
317
+ if (options.emulatorLag === undefined) {
318
+ emulator.resize(nextColumns, nextRows);
319
+ return;
320
+ }
321
+ setTimeout(() => {
322
+ if (!closed) emulator.resize(nextColumns, nextRows);
323
+ }, options.emulatorLag);
312
324
  },
313
325
  setColorScheme: (scheme) => {
314
326
  if (!emulator.setColorScheme) {
package/src/wrap-text.ts CHANGED
@@ -6,6 +6,10 @@ import { type Styles } from "#/styles.ts";
6
6
  export const wrapTextCache = new QuickLRU<string, string>({ maxSize: 4096 });
7
7
 
8
8
  export const wrapText = (text: string, maxWidth: number, wrapType: Styles["textWrap"]): string => {
9
+ if (wrapType === "none") {
10
+ return text;
11
+ }
12
+
9
13
  const cacheKey = text + String(maxWidth) + String(wrapType);
10
14
  const cachedText = wrapTextCache.get(cacheKey);
11
15
 
package/src/utils.ts DELETED
@@ -1,40 +0,0 @@
1
- import type { OutputStream } from "#/stream.ts";
2
- import { terminalSize } from "#/terminal-size.ts";
3
-
4
- const resolveDimension = (
5
- value: number | undefined,
6
- fallback: number | undefined,
7
- defaultValue: number,
8
- ): number => {
9
- if (value !== undefined && value > 0) {
10
- return value;
11
- }
12
-
13
- if (fallback !== undefined && fallback > 0) {
14
- return fallback;
15
- }
16
-
17
- return defaultValue;
18
- };
19
-
20
- /**
21
- Get the effective terminal dimensions from the given stdout stream.
22
-
23
- Falls back to `terminal-size` for columns in piped processes where `stdout.columns` is 0, and uses standard defaults (80×24) when dimensions cannot be determined.
24
- */
25
- export const getWindowSize = (stdout: OutputStream): { columns: number; rows: number } => {
26
- // `stdout.columns`/`rows` can be 0 or undefined in non-TTY environments.
27
- const columns = stdout.columns ?? 0;
28
- const rows = stdout.rows ?? 0;
29
-
30
- if (columns && rows) {
31
- return { columns, rows };
32
- }
33
-
34
- const fallbackSize = terminalSize();
35
-
36
- return {
37
- columns: resolveDimension(columns, fallbackSize.columns, 80),
38
- rows: resolveDimension(rows, fallbackSize.rows, 24),
39
- };
40
- };