@zenbu-labs/pixel 0.0.0 → 0.0.12

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 (153) hide show
  1. package/dist/bin.d.ts +2 -0
  2. package/dist/bin.js +166 -0
  3. package/dist/bootstrap.d.ts +1 -0
  4. package/dist/bootstrap.js +75 -0
  5. package/dist/context-menu.d.ts +20 -0
  6. package/dist/context-menu.js +57 -0
  7. package/dist/debug.d.ts +1 -0
  8. package/dist/debug.js +9 -0
  9. package/dist/devtools-layout.d.ts +21 -0
  10. package/dist/devtools-layout.js +45 -0
  11. package/dist/devtools.d.ts +33 -0
  12. package/dist/devtools.js +125 -0
  13. package/dist/electron/index.d.ts +3 -0
  14. package/dist/electron/index.js +4 -0
  15. package/dist/host/guest.d.ts +5 -0
  16. package/dist/host/guest.js +178 -0
  17. package/dist/host/server.d.ts +91 -0
  18. package/dist/host/server.js +296 -0
  19. package/dist/host/shell.d.ts +35 -0
  20. package/dist/host/shell.js +113 -0
  21. package/dist/host/strip.d.ts +6 -0
  22. package/dist/host/strip.js +63 -0
  23. package/dist/icons.d.ts +30 -0
  24. package/dist/icons.js +58 -0
  25. package/dist/index.d.ts +17 -0
  26. package/dist/index.js +39 -0
  27. package/dist/instances.d.ts +30 -0
  28. package/dist/instances.js +177 -0
  29. package/dist/layout.d.ts +5 -0
  30. package/dist/layout.js +34 -0
  31. package/dist/popup.d.ts +21 -0
  32. package/dist/popup.js +47 -0
  33. package/dist/preload/index.d.ts +15 -0
  34. package/dist/preload/index.js +3 -0
  35. package/dist/react/colors.d.ts +3 -0
  36. package/dist/react/colors.js +25 -0
  37. package/dist/react/components.d.ts +21 -0
  38. package/dist/react/components.js +45 -0
  39. package/dist/react/devtools/app.d.ts +3 -0
  40. package/dist/react/devtools/app.js +89 -0
  41. package/dist/react/devtools/console-capture.d.ts +1 -0
  42. package/dist/react/devtools/console-capture.js +41 -0
  43. package/dist/react/devtools/controller.d.ts +45 -0
  44. package/dist/react/devtools/controller.js +252 -0
  45. package/dist/react/devtools/elements.d.ts +4 -0
  46. package/dist/react/devtools/elements.js +152 -0
  47. package/dist/react/devtools/export-profile.d.ts +2 -0
  48. package/dist/react/devtools/export-profile.js +225 -0
  49. package/dist/react/devtools/fiber-hook.d.ts +1 -0
  50. package/dist/react/devtools/fiber-hook.js +89 -0
  51. package/dist/react/devtools/log-panel.d.ts +4 -0
  52. package/dist/react/devtools/log-panel.js +113 -0
  53. package/dist/react/devtools/profiler.d.ts +11 -0
  54. package/dist/react/devtools/profiler.js +374 -0
  55. package/dist/react/devtools/store.d.ts +27 -0
  56. package/dist/react/devtools/store.js +61 -0
  57. package/dist/react/devtools/stores.d.ts +92 -0
  58. package/dist/react/devtools/stores.js +41 -0
  59. package/dist/react/devtools/theme.d.ts +35 -0
  60. package/dist/react/devtools/theme.js +77 -0
  61. package/dist/react/devtools/ui.d.ts +24 -0
  62. package/dist/react/devtools/ui.js +59 -0
  63. package/dist/react/index.d.ts +110 -0
  64. package/dist/react/index.js +538 -0
  65. package/dist/react/markdown.d.ts +25 -0
  66. package/dist/react/markdown.js +270 -0
  67. package/dist/react/native.d.ts +116 -0
  68. package/dist/react/native.js +56 -0
  69. package/dist/react/reconciler-config.d.ts +241 -0
  70. package/dist/react/reconciler-config.js +412 -0
  71. package/dist/react/styles.d.ts +88 -0
  72. package/dist/react/styles.js +85 -0
  73. package/dist/react/surface.d.ts +55 -0
  74. package/dist/react/surface.js +74 -0
  75. package/dist/registry.d.ts +53 -0
  76. package/dist/registry.js +193 -0
  77. package/dist/root.d.ts +19 -0
  78. package/dist/root.js +342 -0
  79. package/dist/sandbox.d.ts +4 -0
  80. package/dist/sandbox.js +84 -0
  81. package/dist/scale.d.ts +7 -0
  82. package/dist/scale.js +31 -0
  83. package/dist/ssh/index.d.ts +58 -0
  84. package/dist/ssh/index.js +445 -0
  85. package/dist/terminal/applescript.d.ts +2 -0
  86. package/dist/terminal/applescript.js +20 -0
  87. package/dist/terminal/detect.d.ts +10 -0
  88. package/dist/terminal/detect.js +34 -0
  89. package/dist/terminal/graphics.d.ts +9 -0
  90. package/dist/terminal/graphics.js +142 -0
  91. package/dist/terminal/index.d.ts +12 -0
  92. package/dist/terminal/index.js +23 -0
  93. package/dist/terminal/run.d.ts +2 -0
  94. package/dist/terminal/run.js +15 -0
  95. package/dist/terminal/shared.d.ts +20 -0
  96. package/dist/terminal/shared.js +88 -0
  97. package/dist/terminal/terminal.d.ts +66 -0
  98. package/dist/terminal/terminal.js +6 -0
  99. package/dist/terminal/terminals/cmux.d.ts +2 -0
  100. package/dist/terminal/terminals/cmux.js +98 -0
  101. package/dist/terminal/terminals/ghostty-script.d.ts +1 -0
  102. package/dist/terminal/terminals/ghostty-script.js +179 -0
  103. package/dist/terminal/terminals/ghostty.d.ts +2 -0
  104. package/dist/terminal/terminals/ghostty.js +336 -0
  105. package/dist/terminal/terminals/herdr.d.ts +2 -0
  106. package/dist/terminal/terminals/herdr.js +141 -0
  107. package/dist/terminal/terminals/index.d.ts +5 -0
  108. package/dist/terminal/terminals/index.js +26 -0
  109. package/dist/terminal/terminals/kitty.d.ts +2 -0
  110. package/dist/terminal/terminals/kitty.js +209 -0
  111. package/dist/terminal/terminals/supacode.d.ts +2 -0
  112. package/dist/terminal/terminals/supacode.js +79 -0
  113. package/dist/terminal/terminals/tmux.d.ts +2 -0
  114. package/dist/terminal/terminals/tmux.js +132 -0
  115. package/dist/terminal/terminals/tty7.d.ts +2 -0
  116. package/dist/terminal/terminals/tty7.js +58 -0
  117. package/dist/terminal/terminals/vscode.d.ts +2 -0
  118. package/dist/terminal/terminals/vscode.js +13 -0
  119. package/dist/terminal/terminals/wezterm.d.ts +2 -0
  120. package/dist/terminal/terminals/wezterm.js +59 -0
  121. package/dist/theme.d.ts +22 -0
  122. package/dist/theme.js +40 -0
  123. package/dist/web/browser-session.d.ts +13 -0
  124. package/dist/web/browser-session.js +186 -0
  125. package/dist/web/cursor.d.ts +1 -0
  126. package/dist/web/cursor.js +24 -0
  127. package/dist/web/devtools.d.ts +39 -0
  128. package/dist/web/devtools.js +300 -0
  129. package/dist/web/favicon.d.ts +7 -0
  130. package/dist/web/favicon.js +73 -0
  131. package/dist/web/frame-rate.d.ts +1 -0
  132. package/dist/web/frame-rate.js +12 -0
  133. package/dist/web/host.d.ts +123 -0
  134. package/dist/web/host.js +573 -0
  135. package/dist/web/input.d.ts +49 -0
  136. package/dist/web/input.js +468 -0
  137. package/dist/web/offscreen.d.ts +2 -0
  138. package/dist/web/offscreen.js +23 -0
  139. package/dist/web/paint.d.ts +11 -0
  140. package/dist/web/paint.js +128 -0
  141. package/dist/web/popup.d.ts +40 -0
  142. package/dist/web/popup.js +144 -0
  143. package/dist/web/session.d.ts +20 -0
  144. package/dist/web/session.js +110 -0
  145. package/dist/web/types.d.ts +38 -0
  146. package/dist/web/types.js +39 -0
  147. package/dist/web/zoom.d.ts +5 -0
  148. package/dist/web/zoom.js +36 -0
  149. package/dist/webview.d.ts +55 -0
  150. package/dist/webview.js +481 -0
  151. package/package.json +69 -3
  152. package/scripts/apparmor.sh +71 -0
  153. package/scripts/postinstall.mjs +150 -0
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI = exports.MONO = exports.theme = void 0;
4
+ exports.refreshTheme = refreshTheme;
5
+ const FALLBACK_BG = [30, 31, 34, 255];
6
+ const FALLBACK_FG = [223, 225, 229, 255];
7
+ function hexToRgba(value) {
8
+ const n = parseInt(value.slice(1), 16);
9
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255, 255];
10
+ }
11
+ function mix(base, toward, t) {
12
+ const channel = (b, c) => Math.round(b + (c - b) * t);
13
+ return [
14
+ channel(base[0], toward[0]),
15
+ channel(base[1], toward[1]),
16
+ channel(base[2], toward[2]),
17
+ 255,
18
+ ];
19
+ }
20
+ function hex(color) {
21
+ return `#${color
22
+ .slice(0, 3)
23
+ .map((c) => Math.max(0, Math.min(255, c)).toString(16).padStart(2, "0"))
24
+ .join("")}`;
25
+ }
26
+ function build(colors) {
27
+ const bg = colors.background ?? FALLBACK_BG;
28
+ const fg = colors.foreground ?? FALLBACK_FG;
29
+ const slot = (at, fallback) => colors.palette[at] ?? hexToRgba(fallback);
30
+ const accent = colors.palette[12] ?? slot(4, "#4d9fff");
31
+ const red = slot(1, "#e06c75");
32
+ const green = slot(2, "#98c379");
33
+ const yellow = slot(3, "#e5c07b");
34
+ const magenta = slot(5, "#c586c0");
35
+ const cyan = slot(6, "#5db0d7");
36
+ // shades of one hue so stacked bars in a flame lane stay apart
37
+ const lane = (base, count) => Array.from({ length: count }, (_, i) => hex(i % 2 === 0 ? mix(base, fg, i * 0.12) : mix(base, bg, i * 0.1)));
38
+ return {
39
+ bg: hex(bg),
40
+ panel: hex(mix(bg, fg, 0.04)),
41
+ chrome: hex(mix(bg, fg, 0.09)),
42
+ chromeActive: hex(mix(bg, fg, 0.15)),
43
+ border: hex(mix(bg, fg, 0.18)),
44
+ text: hex(fg),
45
+ dim: hex(mix(fg, bg, 0.35)),
46
+ faint: hex(mix(fg, bg, 0.55)),
47
+ accent: hex(accent),
48
+ accentDim: hex(mix(bg, accent, 0.4)),
49
+ selectionBg: hex(mix(bg, accent, 0.35)),
50
+ hover: hex(mix(bg, fg, 0.11)),
51
+ tag: hex(cyan),
52
+ attrName: hex(yellow),
53
+ attrValue: hex(green),
54
+ danger: hex(red),
55
+ warn: hex(yellow),
56
+ ok: hex(green),
57
+ levels: {
58
+ debug: hex(mix(fg, bg, 0.45)),
59
+ info: hex(fg),
60
+ warn: hex(yellow),
61
+ error: hex(red),
62
+ },
63
+ flame: {
64
+ react: lane(accent, 4),
65
+ bridge: lane(magenta, 2),
66
+ engine: lane(green, 4),
67
+ devtools: lane(mix(fg, bg, 0.45), 2),
68
+ images: lane(cyan, 2),
69
+ },
70
+ };
71
+ }
72
+ exports.theme = build({ foreground: null, background: null, palette: [] });
73
+ function refreshTheme(colors) {
74
+ exports.theme = build(colors);
75
+ }
76
+ exports.MONO = 0;
77
+ exports.UI = 0;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ export declare function Button(props: {
3
+ label: string;
4
+ onClick: () => void;
5
+ active?: boolean;
6
+ danger?: boolean;
7
+ rem: number;
8
+ }): React.JSX.Element;
9
+ export declare function Chip(props: {
10
+ label: string;
11
+ onClick?: () => void;
12
+ active?: boolean;
13
+ color?: string;
14
+ rem: number;
15
+ }): React.JSX.Element;
16
+ export declare function Toolbar(props: {
17
+ rem: number;
18
+ children?: React.ReactNode;
19
+ }): React.JSX.Element;
20
+ export declare function Divider(): React.JSX.Element;
21
+ export declare function Empty(props: {
22
+ text: string;
23
+ rem: number;
24
+ }): React.JSX.Element;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = Button;
4
+ exports.Chip = Chip;
5
+ exports.Toolbar = Toolbar;
6
+ exports.Divider = Divider;
7
+ exports.Empty = Empty;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const components_1 = require("../components");
10
+ const theme_1 = require("./theme");
11
+ function Button(props) {
12
+ const { label, onClick, active, danger, rem } = props;
13
+ return ((0, jsx_runtime_1.jsx)(components_1.Box, { style: {
14
+ padding: { left: rem * 0.5, right: rem * 0.5, top: rem * 0.15, bottom: rem * 0.15 },
15
+ cornerRadius: rem * 0.25,
16
+ background: active ? theme_1.theme.accentDim : undefined,
17
+ hoverBackground: active ? theme_1.theme.accentDim : theme_1.theme.hover,
18
+ border: active ? { width: 1, color: theme_1.theme.accent } : { width: 1, color: theme_1.theme.border },
19
+ }, onClick: onClick, children: (0, jsx_runtime_1.jsx)(components_1.Text, { style: {
20
+ color: danger ? theme_1.theme.danger : active ? theme_1.theme.accent : theme_1.theme.text,
21
+ fontSize: rem * 0.75,
22
+ wrap: false,
23
+ }, children: label }) }));
24
+ }
25
+ function Chip(props) {
26
+ const { label, onClick, active, color, rem } = props;
27
+ return ((0, jsx_runtime_1.jsx)(components_1.Box, { style: {
28
+ padding: { left: rem * 0.4, right: rem * 0.4, top: rem * 0.08, bottom: rem * 0.08 },
29
+ cornerRadius: rem * 0.5,
30
+ background: active ? theme_1.theme.accentDim : theme_1.theme.chrome,
31
+ hoverBackground: onClick ? theme_1.theme.chromeActive : undefined,
32
+ }, onClick: onClick, children: (0, jsx_runtime_1.jsx)(components_1.Text, { style: {
33
+ color: color ?? (active ? theme_1.theme.accent : theme_1.theme.dim),
34
+ fontSize: rem * 0.68,
35
+ wrap: false,
36
+ }, children: label }) }));
37
+ }
38
+ function Toolbar(props) {
39
+ return ((0, jsx_runtime_1.jsx)(components_1.Box, { style: {
40
+ flexDirection: "row",
41
+ alignItems: "center",
42
+ gap: props.rem * 0.4,
43
+ padding: props.rem * 0.35,
44
+ background: theme_1.theme.panel,
45
+ border: { width: 0, color: theme_1.theme.border },
46
+ flexShrink: 0,
47
+ }, children: props.children }));
48
+ }
49
+ function Divider() {
50
+ return (0, jsx_runtime_1.jsx)(components_1.Box, { style: { height: 1, background: theme_1.theme.border, flexShrink: 0 } });
51
+ }
52
+ function Empty(props) {
53
+ return ((0, jsx_runtime_1.jsx)(components_1.Box, { style: {
54
+ flexGrow: 1,
55
+ alignItems: "center",
56
+ justifyContent: "center",
57
+ padding: props.rem,
58
+ }, children: (0, jsx_runtime_1.jsx)(components_1.Text, { style: { color: theme_1.theme.faint, fontSize: props.rem * 0.8 }, children: props.text }) }));
59
+ }
@@ -0,0 +1,110 @@
1
+ import { type ReactNode } from "react";
2
+ import type { PastedImage } from "./reconciler-config";
3
+ import type { EngineInfo, HostOptions, TerminalColors } from "./native";
4
+ import { Surface } from "./surface";
5
+ import { closeDevtools, engineOp, openDevtools, requestLayout, toggleDevtools } from "./devtools/controller";
6
+ import type { Rgba } from "./native";
7
+ import { inspectorStore, LayoutSnapshot } from "./devtools/stores";
8
+ import type { LogLevel } from "./devtools/store";
9
+ declare function appLog(level: LogLevel, target: string, text: string): void;
10
+ export { Box, Text, Input, Image, MarkedText, Path, } from "./components";
11
+ export type { NodeHandle } from "./components";
12
+ export { appLog };
13
+ export { layoutStore, profilerStore } from "./devtools/stores";
14
+ export type { LayoutSnapshot, ProfileSession } from "./devtools/stores";
15
+ export type { BoxProps, TextProps, TextSpan, InputGutter, InputProps, MarkRef, PasteSource, PastedImage, CaretInfo, ChangeInfo, ChangeSource, ImageProps, ImageAdvancedProps, MarkedTextProps, ClickEvent, ContainerSelection, DragEvent, EventMods, MouseMoveEvent, ScrollEvent, SelectionPart, WheelEvent, PointerEvent, ShapeStroke, PathProps, } from "./reconciler-config";
16
+ export type { Color, Edges, InsetEdges, InsetValue, ScrollbarStyle, Style } from "./styles";
17
+ export type { DiffEmphasis, DiffRow, EngineInfo, HighlightSpan, HostOptions, MarkdownBlock, MarkdownCell, MarkdownRow, MarkdownSpan, Rgba, SurfaceShm, TerminalColors, } from "./native";
18
+ export { HIGHLIGHT_CAPTURES, captureFilmstrip, diff, encodeRecording, highlight, parseMarkdown } from "./native";
19
+ export { useTerminalColors } from "./colors";
20
+ export { Surface, SurfaceCapture } from "./surface";
21
+ export type { SurfaceFrame, SurfaceTexture, CaptureStats, CaptureFrameMeta, CaptureIndex, } from "./surface";
22
+ export { Markdown } from "./markdown";
23
+ export type { MarkdownProps, MarkdownTheme } from "./markdown";
24
+ export { openDevtools, closeDevtools, toggleDevtools, requestLayout, engineOp };
25
+ /**
26
+ *
27
+ * i think this api exists to support capturing a click to focus the input,
28
+ * this is dumb we can abstract this with a more cannonical capture/bubble phase
29
+ */
30
+ export declare function setKeyCapture(keys: string[]): void;
31
+ export declare function setPointerShape(shape: string): void;
32
+ export declare function requestClipboardImage(): void;
33
+ export declare function setClipboard(text: string): void;
34
+ export interface KeyMods {
35
+ shift: boolean;
36
+ alt: boolean;
37
+ ctrl: boolean;
38
+ super: boolean;
39
+ }
40
+ export interface EngineKeyEvent {
41
+ key: string;
42
+ kind: "press" | "repeat" | "release";
43
+ text?: string;
44
+ mods: KeyMods;
45
+ }
46
+ export interface RootOptions {
47
+ onKey?: (event: EngineKeyEvent) => void;
48
+ onRightClick?: (event: {
49
+ x: number;
50
+ y: number;
51
+ }) => void;
52
+ onPaste?: (text: string) => void;
53
+ onFocus?: (focused: boolean) => void;
54
+ onPasteImage?: (image: PastedImage) => void;
55
+ onEngineExit?: (error: string | null) => void;
56
+ onResize?: (size: {
57
+ width: number;
58
+ height: number;
59
+ basePx: number;
60
+ }) => void;
61
+ onColors?: (colors: TerminalColors) => void;
62
+ onLayout?: (snapshot: LayoutSnapshot) => void;
63
+ onHostClosed?: () => void;
64
+ onHandoff?: (handoff: {
65
+ tty?: string;
66
+ socket?: string;
67
+ }) => void;
68
+ keyEventTypes?: boolean;
69
+ devtools?: boolean;
70
+ cwd?: string;
71
+ tty?: string;
72
+ host?: HostOptions;
73
+ wrapper?: "tmux";
74
+ sessionEnv?: NodeJS.ProcessEnv;
75
+ }
76
+ export interface PixelRoot {
77
+ info: EngineInfo;
78
+ sharedTextures: boolean;
79
+ render(element: ReactNode): void;
80
+ flushSync<T>(fn: () => T): T;
81
+ registerFont(path: string): Promise<number>;
82
+ createSurface(): Surface;
83
+ surfaceStats(): SurfaceStats;
84
+ stop(): void;
85
+ openDevtools(): void;
86
+ closeDevtools(): void;
87
+ nudgeResize(): void;
88
+ queryLayout(): void;
89
+ setPointerShape(shape: string): void;
90
+ setClearColor(color: Rgba): void;
91
+ setKeyCapture(keys: string[]): void;
92
+ requestClipboardImage(): void;
93
+ setClipboard(text: string): void;
94
+ setTitle(text: string): void;
95
+ retarget(target: RetargetTarget): Promise<void>;
96
+ }
97
+ export type RetargetTarget = {
98
+ tty: string;
99
+ wrapper?: "tmux";
100
+ } | {
101
+ host: HostOptions;
102
+ };
103
+ export interface SurfaceStats {
104
+ submitted: number;
105
+ coalesced: number;
106
+ presented: number;
107
+ rows: number;
108
+ }
109
+ export declare function createRoot(options?: RootOptions): PixelRoot;
110
+ export { inspectorStore };