@zenbu-labs/pixel 0.0.22 → 0.1.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/dist/index.d.ts CHANGED
@@ -13,8 +13,8 @@ export type { DevtoolsDock } from "./web/types";
13
13
  export type { ZoomDirection } from "./web/zoom";
14
14
  export type { TerminalTheme } from "./web/session";
15
15
  export { QUIT_URL, defaultOpenWindow } from "./web/host";
16
- export { Box, Text, Input, Image, MarkedText, Path, Markdown, appLog, useTerminalColors, setClipboard, setPointerShape, requestClipboardImage, highlight, diff, parseMarkdown, HIGHLIGHT_CAPTURES, Surface, SurfaceCapture, captureFilmstrip, encodeRecording, engineLogs, useStore, } from "./react";
16
+ export { Box, Text, Input, Image, MarkedText, Path, Markdown, Link, appLog, useTerminalColors, setClipboard, setPointerShape, requestClipboardImage, highlight, diff, parseMarkdown, HIGHLIGHT_CAPTURES, Surface, SurfaceCapture, captureFilmstrip, encodeRecording, engineLogs, useStore, } from "./react";
17
17
  export type { LogRow, LogBuffer } from "./react";
18
- export type { BoxProps, TextProps, TextSpan, InputProps, InputGutter, ImageProps, ImageAdvancedProps, MarkedTextProps, MarkRef, PathProps, ShapeStroke, ClickEvent, DragEvent, EventMods, MouseMoveEvent, ScrollEvent, WheelEvent, PointerEvent, PastedImage, PasteSource, CaretInfo, ChangeInfo, ChangeSource, ContainerSelection, SelectionPart, NodeHandle, Color, Edges, InsetEdges, InsetValue, ScrollbarStyle, Style, EngineInfo, EngineKeyEvent, KeyMods, Rgba, TerminalColors, SurfaceFrame, SurfaceTexture, CaptureStats, CaptureFrameMeta, CaptureIndex, MarkdownProps, MarkdownTheme, MarkdownBlock, HighlightSpan, DiffRow, } from "./react";
18
+ export type { BoxProps, TextProps, TextSpan, InputProps, InputGutter, ImageProps, ImageAdvancedProps, MarkedTextProps, MarkRef, PathProps, ShapeStroke, ClickEvent, DragEvent, EventMods, MouseMoveEvent, ScrollEvent, WheelEvent, PointerEvent, PastedImage, PasteSource, CaretInfo, ChangeInfo, ChangeSource, ContainerSelection, SelectionPart, NodeHandle, Color, Edges, InsetEdges, InsetValue, ScrollbarStyle, Style, EngineInfo, EngineKeyEvent, KeyMods, Rgba, TerminalColors, SurfaceFrame, SurfaceTexture, CaptureStats, CaptureFrameMeta, CaptureIndex, MarkdownProps, MarkdownTheme, LinkProps, MarkdownBlock, HighlightSpan, DiffRow, } from "./react";
19
19
  export { makeTheme } from "./theme";
20
20
  export type { Theme } from "./theme";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeTheme = exports.useStore = exports.engineLogs = exports.encodeRecording = exports.captureFilmstrip = exports.SurfaceCapture = exports.Surface = exports.HIGHLIGHT_CAPTURES = exports.parseMarkdown = exports.diff = exports.highlight = exports.requestClipboardImage = exports.setPointerShape = exports.setClipboard = exports.useTerminalColors = exports.appLog = exports.Markdown = exports.Path = exports.MarkedText = exports.Image = exports.Input = exports.Text = exports.Box = exports.defaultOpenWindow = exports.QUIT_URL = exports.useRect = exports.DevTools = exports.WebView = exports.listInstances = exports.findOwner = exports.createRoot = void 0;
3
+ exports.makeTheme = exports.useStore = exports.engineLogs = exports.encodeRecording = exports.captureFilmstrip = exports.SurfaceCapture = exports.Surface = exports.HIGHLIGHT_CAPTURES = exports.parseMarkdown = exports.diff = exports.highlight = exports.requestClipboardImage = exports.setPointerShape = exports.setClipboard = exports.useTerminalColors = exports.appLog = exports.Link = exports.Markdown = exports.Path = exports.MarkedText = exports.Image = exports.Input = exports.Text = exports.Box = exports.defaultOpenWindow = exports.QUIT_URL = exports.useRect = exports.DevTools = exports.WebView = exports.listInstances = exports.findOwner = exports.createRoot = void 0;
4
4
  /// <reference path="../electron/electron.d.ts" preserve="true" />
5
5
  var root_1 = require("./root");
6
6
  Object.defineProperty(exports, "createRoot", { enumerable: true, get: function () { return root_1.createRoot; } });
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "Image", { enumerable: true, get: function () { r
24
24
  Object.defineProperty(exports, "MarkedText", { enumerable: true, get: function () { return react_1.MarkedText; } });
25
25
  Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return react_1.Path; } });
26
26
  Object.defineProperty(exports, "Markdown", { enumerable: true, get: function () { return react_1.Markdown; } });
27
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return react_1.Link; } });
27
28
  Object.defineProperty(exports, "appLog", { enumerable: true, get: function () { return react_1.appLog; } });
28
29
  Object.defineProperty(exports, "useTerminalColors", { enumerable: true, get: function () { return react_1.useTerminalColors; } });
29
30
  Object.defineProperty(exports, "setClipboard", { enumerable: true, get: function () { return react_1.setClipboard; } });
@@ -23,6 +23,8 @@ export { Surface, SurfaceCapture } from "./surface";
23
23
  export type { SurfaceFrame, SurfaceTexture, CaptureStats, CaptureFrameMeta, CaptureIndex, } from "./surface";
24
24
  export { Markdown } from "./markdown";
25
25
  export type { MarkdownProps, MarkdownTheme } from "./markdown";
26
+ export { Link } from "./link";
27
+ export type { LinkProps } from "./link";
26
28
  export { openDevtools, closeDevtools, toggleDevtools, requestLayout, engineOp };
27
29
  /**
28
30
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inspectorStore = exports.engineOp = exports.requestLayout = exports.toggleDevtools = exports.closeDevtools = exports.openDevtools = exports.Markdown = exports.SurfaceCapture = exports.Surface = exports.useTerminalColors = exports.parseMarkdown = exports.highlight = exports.encodeRecording = exports.diff = exports.captureFilmstrip = exports.HIGHLIGHT_CAPTURES = exports.useStore = exports.engineLogs = exports.profilerStore = exports.layoutStore = exports.Path = exports.MarkedText = exports.Image = exports.Input = exports.Text = exports.Box = void 0;
3
+ exports.inspectorStore = exports.engineOp = exports.requestLayout = exports.toggleDevtools = exports.closeDevtools = exports.openDevtools = exports.Link = exports.Markdown = exports.SurfaceCapture = exports.Surface = exports.useTerminalColors = exports.parseMarkdown = exports.highlight = exports.encodeRecording = exports.diff = exports.captureFilmstrip = exports.HIGHLIGHT_CAPTURES = exports.useStore = exports.engineLogs = exports.profilerStore = exports.layoutStore = exports.Path = exports.MarkedText = exports.Image = exports.Input = exports.Text = exports.Box = void 0;
4
4
  exports.appLog = appLog;
5
5
  exports.setKeyCapture = setKeyCapture;
6
6
  exports.setPointerShape = setPointerShape;
@@ -56,6 +56,8 @@ Object.defineProperty(exports, "Surface", { enumerable: true, get: function () {
56
56
  Object.defineProperty(exports, "SurfaceCapture", { enumerable: true, get: function () { return surface_2.SurfaceCapture; } });
57
57
  var markdown_1 = require("./markdown");
58
58
  Object.defineProperty(exports, "Markdown", { enumerable: true, get: function () { return markdown_1.Markdown; } });
59
+ var link_1 = require("./link");
60
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return link_1.Link; } });
59
61
  /**
60
62
  *
61
63
  * i think this api exists to support capturing a click to focus the input,
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ClickEvent } from "./reconciler-config";
3
+ import type { Style } from "./styles";
4
+ export interface LinkProps {
5
+ href: string;
6
+ children: ReactNode;
7
+ style?: Style;
8
+ onClick?(event: ClickEvent): void;
9
+ }
10
+ export declare function Link({ href, children, style, onClick }: LinkProps): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Link = Link;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const electron_1 = require("electron");
6
+ const components_1 = require("./components");
7
+ const index_1 = require("./index");
8
+ function Link({ href, children, style, onClick }) {
9
+ const plain = typeof children === "string" || typeof children === "number";
10
+ return ((0, jsx_runtime_1.jsx)(components_1.Box, { style: plain ? undefined : style, onClick: (event) => (onClick ? onClick(event) : void electron_1.shell.openExternal(href)), onMouseEnter: () => (0, index_1.setPointerShape)("pointer"), onMouseLeave: () => (0, index_1.setPointerShape)("default"), children: plain ? (0, jsx_runtime_1.jsx)(components_1.Text, { style: { selectable: false, ...style }, children: children }) : children }));
11
+ }
@@ -3,7 +3,7 @@ export type { Detect, Direction, ListPanesOptions, Pane, PaneContext, PaneDetail
3
3
  export { canSplit } from "./terminal";
4
4
  export type { Run } from "./run";
5
5
  export { shellIn } from "./run";
6
- export { bracketedPaste, callerTty, shellLiteral } from "./shared";
6
+ export { bracketedPaste, callerTty, PASTE_KEY, shellLiteral } from "./shared";
7
7
  export type { TerminalCheck } from "./detect";
8
8
  export { cannotOpenPanes, checkTerminal, detect } from "./detect";
9
9
  export type { GraphicsSupport } from "./graphics";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GRAPHICS_SKIP_ENV = exports.unsupportedGraphicsMessage = exports.probeGraphics = exports.EMBED_PROTOCOL = exports.listInstances = exports.findOwner = exports.detect = exports.checkTerminal = exports.cannotOpenPanes = exports.shellLiteral = exports.callerTty = exports.bracketedPaste = exports.shellIn = exports.canSplit = void 0;
3
+ exports.GRAPHICS_SKIP_ENV = exports.unsupportedGraphicsMessage = exports.probeGraphics = exports.EMBED_PROTOCOL = exports.listInstances = exports.findOwner = exports.detect = exports.checkTerminal = exports.cannotOpenPanes = exports.shellLiteral = exports.PASTE_KEY = exports.callerTty = exports.bracketedPaste = exports.shellIn = exports.canSplit = void 0;
4
4
  var terminal_1 = require("./terminal");
5
5
  Object.defineProperty(exports, "canSplit", { enumerable: true, get: function () { return terminal_1.canSplit; } });
6
6
  var run_1 = require("./run");
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "shellIn", { enumerable: true, get: function () {
8
8
  var shared_1 = require("./shared");
9
9
  Object.defineProperty(exports, "bracketedPaste", { enumerable: true, get: function () { return shared_1.bracketedPaste; } });
10
10
  Object.defineProperty(exports, "callerTty", { enumerable: true, get: function () { return shared_1.callerTty; } });
11
+ Object.defineProperty(exports, "PASTE_KEY", { enumerable: true, get: function () { return shared_1.PASTE_KEY; } });
11
12
  Object.defineProperty(exports, "shellLiteral", { enumerable: true, get: function () { return shared_1.shellLiteral; } });
12
13
  var detect_1 = require("./detect");
13
14
  Object.defineProperty(exports, "cannotOpenPanes", { enumerable: true, get: function () { return detect_1.cannotOpenPanes; } });
@@ -17,4 +17,5 @@ export declare function paneById(panes: () => Promise<Pane[]>, id: string | null
17
17
  export declare function shellQuote(argv: string[]): string;
18
18
  export declare const sleep: (ms: number) => Promise<unknown>;
19
19
  export declare function shellLiteral(text: string): string;
20
+ export declare const PASTE_KEY = "\u0016";
20
21
  export declare function bracketedPaste(text: string): string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sleep = void 0;
6
+ exports.PASTE_KEY = exports.sleep = void 0;
7
7
  exports.adjacentPane = adjacentPane;
8
8
  exports.callerTty = callerTty;
9
9
  exports.setPaneWorkingDirectory = setPaneWorkingDirectory;
@@ -81,6 +81,7 @@ exports.sleep = sleep;
81
81
  function shellLiteral(text) {
82
82
  return `'${text.replace(/['\\]/g, (char) => (char === "'" ? "'\\''" : "'\\\\'"))}'`;
83
83
  }
84
+ exports.PASTE_KEY = "\x16";
84
85
  function bracketedPaste(text) {
85
86
  if (!text.includes("\n"))
86
87
  return text;
@@ -60,6 +60,7 @@ export interface Terminal {
60
60
  listPanes?(options?: ListPanesOptions): Promise<PaneDetails[]>;
61
61
  neighbor?(from: Pane, direction: Direction): Promise<Pane | null>;
62
62
  sendText?(pane: string, text: string): Promise<void>;
63
+ pasteKey?(pane: string): Promise<void>;
63
64
  focusPane?(pane: string): Promise<void>;
64
65
  }
65
66
  export type Detect = (env: NodeJS.ProcessEnv, run: Run) => Terminal | null;
@@ -83,6 +83,9 @@ const cmux = (env, run) => {
83
83
  async sendText(pane, text) {
84
84
  await cmux(["rpc", "terminal.paste", JSON.stringify({ text, surface_id: pane, submit_key: "none" })]);
85
85
  },
86
+ async pasteKey(pane) {
87
+ await cmux(["send", "--surface", pane, "--", shared_1.PASTE_KEY]);
88
+ },
86
89
  async focusPane(pane) {
87
90
  await cmux(["focus-panel", "--panel", pane]);
88
91
  },
@@ -309,6 +309,9 @@ const ghostty = (env, run) => {
309
309
  if (result !== "ok")
310
310
  throw new Error(`Ghostty could not type into pane ${pane}`);
311
311
  },
312
+ async pasteKey(pane) {
313
+ await ghosttyCommand("action", [pane, "text:\\x16"]);
314
+ },
312
315
  async neighbor(from, direction) {
313
316
  const [window, tab] = from.tab.split(":");
314
317
  const result = (await ghosttyCommand("neighbor", [window, tab, from.id, direction])).trim();
@@ -125,6 +125,9 @@ const herdr = (env, run) => {
125
125
  async sendText(pane, text) {
126
126
  await herdr(["pane", "send-text", pane, (0, shared_1.bracketedPaste)(text)]);
127
127
  },
128
+ async pasteKey(pane) {
129
+ await herdr(["pane", "send-text", pane, shared_1.PASTE_KEY]);
130
+ },
128
131
  focusPane,
129
132
  async split({ from, direction, command, size }) {
130
133
  const native = NATIVE_DIRECTION[direction];
@@ -192,6 +192,9 @@ const kitty = (env, run) => {
192
192
  await kitten(target, text);
193
193
  }
194
194
  },
195
+ async pasteKey(pane) {
196
+ await kitten(["send-text", "--match", `id:${pane}`, "--stdin"], shared_1.PASTE_KEY);
197
+ },
195
198
  async focusPane(pane) {
196
199
  await kitten(["focus-window", "--match", `id:${pane}`]);
197
200
  },
@@ -55,6 +55,10 @@ const supacode = (env, run) => {
55
55
  const { worktree, tab } = await home(pane);
56
56
  await supacode(["surface", "focus", "-w", worktree, "-t", tab, "-s", pane, "--input", text, "--timeout", "5"]);
57
57
  },
58
+ async pasteKey(pane) {
59
+ const { worktree, tab } = await home(pane);
60
+ await supacode(["surface", "focus", "-w", worktree, "-t", tab, "-s", pane, "--input", shared_1.PASTE_KEY, "--timeout", "5"]);
61
+ },
58
62
  async focusPane(pane) {
59
63
  const { worktree, tab } = await home(pane);
60
64
  await supacode(["surface", "focus", "-w", worktree, "-t", tab, "-s", pane, "--timeout", "5"]);
@@ -88,6 +88,9 @@ const tmux = (env, run) => {
88
88
  await run("tmux", ["load-buffer", "-b", "pixel-send", "-"], text);
89
89
  await tmux(["paste-buffer", "-p", "-d", "-b", "pixel-send", "-t", pane]);
90
90
  },
91
+ async pasteKey(pane) {
92
+ await tmux(["send-keys", "-t", pane, "C-v"]);
93
+ },
91
94
  async focusPane(pane) {
92
95
  const client = await userClient();
93
96
  if (client) {
@@ -44,6 +44,9 @@ const tty7 = (env, run) => {
44
44
  async sendText(pane, text) {
45
45
  await tty7(["send", `%${pane}`, (0, shared_1.bracketedPaste)(text)]);
46
46
  },
47
+ async pasteKey(pane) {
48
+ await tty7(["send", `%${pane}`, shared_1.PASTE_KEY]);
49
+ },
47
50
  async split({ from, direction, command, size }) {
48
51
  if (direction !== "right" && direction !== "down") {
49
52
  throw new Error("tty7 only splits right and down");
@@ -48,6 +48,9 @@ const wezterm = (env, run) => {
48
48
  async sendText(pane, text) {
49
49
  await wezterm(["cli", "send-text", "--pane-id", pane], text);
50
50
  },
51
+ async pasteKey(pane) {
52
+ await wezterm(["cli", "send-text", "--no-paste", "--pane-id", pane], shared_1.PASTE_KEY);
53
+ },
51
54
  async focusPane(pane) {
52
55
  await wezterm(["cli", "activate-pane", "--pane-id", pane]);
53
56
  },
@@ -7,7 +7,7 @@ const CSS_CURSORS = new Set([
7
7
  "no-drop", "not-allowed", "grab", "grabbing", "zoom-in", "zoom-out",
8
8
  "e-resize", "n-resize", "ne-resize", "nw-resize", "s-resize", "se-resize",
9
9
  "sw-resize", "w-resize", "ns-resize", "ew-resize", "nesw-resize",
10
- "nwse-resize", "col-resize", "row-resize",
10
+ "nwse-resize",
11
11
  ]);
12
12
  function cursorShapeFor(type) {
13
13
  // chromium's "pointer" is the plain arrow; its css pointer is "hand"
@@ -15,6 +15,11 @@ function cursorShapeFor(type) {
15
15
  return "pointer";
16
16
  if (CSS_CURSORS.has(type))
17
17
  return type;
18
+ // kitty's pointer shape protocol has no col/row-resize; the axis arrows mean the same
19
+ if (type === "col-resize")
20
+ return "ew-resize";
21
+ if (type === "row-resize")
22
+ return "ns-resize";
18
23
  if (type === "nodrop")
19
24
  return "no-drop";
20
25
  if (type.endsWith("-panning"))
package/dist/webview.js CHANGED
@@ -93,8 +93,8 @@ exports.WebView = (0, react_1.forwardRef)(function WebView(props, ref) {
93
93
  const h = hover.current;
94
94
  const shape = h.divider
95
95
  ? dockRef.current === "bottom"
96
- ? "row-resize"
97
- : "col-resize"
96
+ ? "ns-resize"
97
+ : "ew-resize"
98
98
  : h.devtools
99
99
  ? host?.devtools?.cursorShape ?? "default"
100
100
  : host?.popup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenbu-labs/pixel",
3
- "version": "0.0.22",
3
+ "version": "0.1.0",
4
4
  "description": "Build graphical applications in the terminal",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -58,10 +58,10 @@
58
58
  "react": "^18.3.1"
59
59
  },
60
60
  "optionalDependencies": {
61
- "@zenbu-labs/pixel-native-darwin-arm64": "0.0.22",
62
- "@zenbu-labs/pixel-native-darwin-x64": "0.0.22",
63
- "@zenbu-labs/pixel-native-linux-arm64": "0.0.22",
64
- "@zenbu-labs/pixel-native-linux-x64": "0.0.22"
61
+ "@zenbu-labs/pixel-native-darwin-arm64": "0.1.0",
62
+ "@zenbu-labs/pixel-native-darwin-x64": "0.1.0",
63
+ "@zenbu-labs/pixel-native-linux-arm64": "0.1.0",
64
+ "@zenbu-labs/pixel-native-linux-x64": "0.1.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/node": "^22.0.0",