@tuidom/headless-backend 0.6.1 → 0.7.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.
@@ -1,4 +1,4 @@
1
- import type { ITerminalBackend } from "@tuidom/core/backend/iTerminalBackend";
1
+ import { type HostTerminalColors, type ITerminalBackend } from "@tuidom/core/backend/iTerminalBackend";
2
2
  import { Point, Size } from "@tuidom/core/common/geometryPromitives";
3
3
  import type { KeyPressEvent } from "@tuidom/core/input/keyEvent";
4
4
  import type { MouseToken } from "@tuidom/core/input/rawTerminalToken";
@@ -46,6 +46,14 @@ export declare class HeadlessCaptureBackend implements ITerminalBackend {
46
46
  * so version-dependent behavior stays at its deterministic default.
47
47
  */
48
48
  probeTerminalVersion(onResult: (nameAndVersion: string | undefined) => void): void;
49
+ /**
50
+ * What {@link probeHostColors} reports — the colors of the terminal this capture
51
+ * pretends to be. Default: nothing reported (the app keeps its own palette); a host
52
+ * sets it before the app probes, e.g. for a screenshot of a "host colors" mode.
53
+ */
54
+ hostColors: HostTerminalColors;
55
+ /** Answers right away with {@link hostColors} — there is no terminal round-trip. */
56
+ probeHostColors(onResult: (colors: HostTerminalColors) => void): void;
49
57
  renderFrame(grid: Grid, cursorPosition: Point | null): void;
50
58
  getSize(): Size;
51
59
  setup(): void;
@@ -1,3 +1,4 @@
1
+ import { NO_HOST_COLORS } from "@tuidom/core/backend/iTerminalBackend";
1
2
  import { Point, Size } from "@tuidom/core/common/geometryPromitives";
2
3
  import { KeyInputParser } from "@tuidom/core/input/keyInputParser";
3
4
  import { serializeKey } from "@tuidom/core/input/serializeKey";
@@ -62,6 +63,16 @@ export class HeadlessCaptureBackend {
62
63
  probeTerminalVersion(onResult) {
63
64
  onResult(undefined);
64
65
  }
66
+ /**
67
+ * What {@link probeHostColors} reports — the colors of the terminal this capture
68
+ * pretends to be. Default: nothing reported (the app keeps its own palette); a host
69
+ * sets it before the app probes, e.g. for a screenshot of a "host colors" mode.
70
+ */
71
+ hostColors = NO_HOST_COLORS;
72
+ /** Answers right away with {@link hostColors} — there is no terminal round-trip. */
73
+ probeHostColors(onResult) {
74
+ onResult(this.hostColors);
75
+ }
65
76
  renderFrame(grid, cursorPosition) {
66
77
  this.lastFrame = snapshotGrid(grid, cursorPosition);
67
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuidom/headless-backend",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Experimental terminal UI DOM — headless capture backend (in-memory frames for screenshots/e2e). API is unstable.",
6
6
  "license": "MIT",
@@ -28,6 +28,6 @@
28
28
  "./*": "./dist/*.js"
29
29
  },
30
30
  "dependencies": {
31
- "@tuidom/core": "0.6.1"
31
+ "@tuidom/core": "0.7.0"
32
32
  }
33
33
  }