@h-rig/cli 0.0.6-alpha.89 → 0.0.6-alpha.90
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/bin/build-rig-binaries.js +8 -40
- package/dist/bin/rig.js +12519 -26675
- package/dist/src/app/board.js +74 -693
- package/dist/src/app/drone-ui.js +1 -1
- package/dist/src/app/theme.js +0 -1
- package/dist/src/commands/_async-ui.js +1 -1
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +12 -2
- package/dist/src/commands/_cli-format.d.ts +1 -10
- package/dist/src/commands/_cli-format.js +2 -5
- package/dist/src/commands/_connection-state.d.ts +1 -11
- package/dist/src/commands/_connection-state.js +5 -50
- package/dist/src/commands/_doctor-checks.js +40 -501
- package/dist/src/commands/_help-catalog.js +17 -99
- package/dist/src/commands/_json-output.js +0 -4
- package/dist/src/commands/_operator-view.js +54 -575
- package/dist/src/commands/_pi-frontend.d.ts +0 -27
- package/dist/src/commands/_pi-frontend.js +52 -576
- package/dist/src/commands/_preflight.js +66 -553
- package/dist/src/commands/_server-client.d.ts +0 -33
- package/dist/src/commands/_server-client.js +46 -541
- package/dist/src/commands/_snapshot-upload.js +42 -503
- package/dist/src/commands/_spinner.js +1 -1
- package/dist/src/commands/agent.js +12 -2
- package/dist/src/commands/browser.js +1 -1
- package/dist/src/commands/connect.js +15 -626
- package/dist/src/commands/doctor.js +41 -502
- package/dist/src/commands/github.js +51 -584
- package/dist/src/commands/inbox.js +41 -502
- package/dist/src/commands/init.js +74 -561
- package/dist/src/commands/inspect.js +41 -502
- package/dist/src/commands/run.js +54 -578
- package/dist/src/commands/server.js +163 -692
- package/dist/src/commands/setup.js +46 -507
- package/dist/src/commands/stats.js +58 -601
- package/dist/src/commands/task-run-driver.js +58 -509
- package/dist/src/commands/task.js +110 -729
- package/dist/src/commands.js +237 -1112
- package/dist/src/index.js +244 -1123
- package/dist/src/launcher.js +0 -4
- package/package.json +9 -13
- package/dist/src/app-opentui/adapters/command.d.ts +0 -2
- package/dist/src/app-opentui/adapters/command.js +0 -329
- package/dist/src/app-opentui/adapters/common.d.ts +0 -56
- package/dist/src/app-opentui/adapters/common.js +0 -153
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -9
- package/dist/src/app-opentui/adapters/doctor.js +0 -1217
- package/dist/src/app-opentui/adapters/family.d.ts +0 -62
- package/dist/src/app-opentui/adapters/family.js +0 -14855
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -14
- package/dist/src/app-opentui/adapters/fleet.js +0 -1335
- package/dist/src/app-opentui/adapters/inbox.d.ts +0 -43
- package/dist/src/app-opentui/adapters/inbox.js +0 -1944
- package/dist/src/app-opentui/adapters/init.d.ts +0 -11
- package/dist/src/app-opentui/adapters/init.js +0 -2818
- package/dist/src/app-opentui/adapters/inspect.d.ts +0 -52
- package/dist/src/app-opentui/adapters/inspect.js +0 -1455
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +0 -32
- package/dist/src/app-opentui/adapters/pi-attach.js +0 -2101
- package/dist/src/app-opentui/adapters/pi.d.ts +0 -23
- package/dist/src/app-opentui/adapters/pi.js +0 -363
- package/dist/src/app-opentui/adapters/plugin.d.ts +0 -84
- package/dist/src/app-opentui/adapters/plugin.js +0 -544
- package/dist/src/app-opentui/adapters/repo.d.ts +0 -37
- package/dist/src/app-opentui/adapters/repo.js +0 -186
- package/dist/src/app-opentui/adapters/run-detail.d.ts +0 -27
- package/dist/src/app-opentui/adapters/run-detail.js +0 -1441
- package/dist/src/app-opentui/adapters/server.d.ts +0 -48
- package/dist/src/app-opentui/adapters/server.js +0 -1561
- package/dist/src/app-opentui/adapters/tasks.d.ts +0 -64
- package/dist/src/app-opentui/adapters/tasks.js +0 -4524
- package/dist/src/app-opentui/adapters/workspace.d.ts +0 -49
- package/dist/src/app-opentui/adapters/workspace.js +0 -333
- package/dist/src/app-opentui/autocomplete.d.ts +0 -20
- package/dist/src/app-opentui/autocomplete.js +0 -578
- package/dist/src/app-opentui/bootstrap.d.ts +0 -11
- package/dist/src/app-opentui/bootstrap.js +0 -27833
- package/dist/src/app-opentui/command-palette.d.ts +0 -3
- package/dist/src/app-opentui/command-palette.js +0 -1038
- package/dist/src/app-opentui/command-pty-host.d.ts +0 -62
- package/dist/src/app-opentui/command-pty-host.js +0 -248
- package/dist/src/app-opentui/drone.d.ts +0 -12
- package/dist/src/app-opentui/drone.js +0 -230
- package/dist/src/app-opentui/events.d.ts +0 -7
- package/dist/src/app-opentui/events.js +0 -28
- package/dist/src/app-opentui/fleet-stats.d.ts +0 -32
- package/dist/src/app-opentui/fleet-stats.js +0 -114
- package/dist/src/app-opentui/focus-manager.d.ts +0 -14
- package/dist/src/app-opentui/focus-manager.js +0 -24
- package/dist/src/app-opentui/index.d.ts +0 -8
- package/dist/src/app-opentui/index.js +0 -5260
- package/dist/src/app-opentui/intent.d.ts +0 -3
- package/dist/src/app-opentui/intent.js +0 -365
- package/dist/src/app-opentui/keymap.d.ts +0 -21
- package/dist/src/app-opentui/keymap.js +0 -1377
- package/dist/src/app-opentui/launch-routing.d.ts +0 -16
- package/dist/src/app-opentui/launch-routing.js +0 -55
- package/dist/src/app-opentui/layout.d.ts +0 -22
- package/dist/src/app-opentui/layout.js +0 -51
- package/dist/src/app-opentui/list-search.d.ts +0 -36
- package/dist/src/app-opentui/list-search.js +0 -130
- package/dist/src/app-opentui/pi-host-child.d.ts +0 -2
- package/dist/src/app-opentui/pi-host-child.js +0 -1299
- package/dist/src/app-opentui/pi-pty-host.d.ts +0 -28
- package/dist/src/app-opentui/pi-pty-host.js +0 -10
- package/dist/src/app-opentui/react/App.d.ts +0 -9
- package/dist/src/app-opentui/react/App.js +0 -3866
- package/dist/src/app-opentui/react/Backdrop.d.ts +0 -5
- package/dist/src/app-opentui/react/Backdrop.js +0 -823
- package/dist/src/app-opentui/react/ChromeHost.d.ts +0 -5
- package/dist/src/app-opentui/react/ChromeHost.js +0 -1539
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +0 -7
- package/dist/src/app-opentui/react/SceneFrameView.js +0 -579
- package/dist/src/app-opentui/react/context.d.ts +0 -17
- package/dist/src/app-opentui/react/context.js +0 -37
- package/dist/src/app-opentui/react/launch.d.ts +0 -2
- package/dist/src/app-opentui/react/launch.js +0 -4897
- package/dist/src/app-opentui/react/nav.d.ts +0 -18
- package/dist/src/app-opentui/react/nav.js +0 -54
- package/dist/src/app-opentui/react/scroll.d.ts +0 -12
- package/dist/src/app-opentui/react/scroll.js +0 -21
- package/dist/src/app-opentui/react/syntax.d.ts +0 -2
- package/dist/src/app-opentui/react/syntax.js +0 -65
- package/dist/src/app-opentui/registry.d.ts +0 -4
- package/dist/src/app-opentui/registry.js +0 -22876
- package/dist/src/app-opentui/remote-link.d.ts +0 -10
- package/dist/src/app-opentui/remote-link.js +0 -47
- package/dist/src/app-opentui/render/ascii-fleet.d.ts +0 -15
- package/dist/src/app-opentui/render/ascii-fleet.js +0 -82
- package/dist/src/app-opentui/render/constants.d.ts +0 -30
- package/dist/src/app-opentui/render/constants.js +0 -64
- package/dist/src/app-opentui/render/graphics.d.ts +0 -40
- package/dist/src/app-opentui/render/graphics.js +0 -713
- package/dist/src/app-opentui/render/hover.d.ts +0 -11
- package/dist/src/app-opentui/render/hover.js +0 -34
- package/dist/src/app-opentui/render/native-host.d.ts +0 -37
- package/dist/src/app-opentui/render/native-host.js +0 -180
- package/dist/src/app-opentui/render/panel-layout.d.ts +0 -38
- package/dist/src/app-opentui/render/panel-layout.js +0 -48
- package/dist/src/app-opentui/render/panels.d.ts +0 -12
- package/dist/src/app-opentui/render/panels.js +0 -288
- package/dist/src/app-opentui/render/preloader.d.ts +0 -10
- package/dist/src/app-opentui/render/preloader.js +0 -166
- package/dist/src/app-opentui/render/scene.d.ts +0 -68
- package/dist/src/app-opentui/render/scene.js +0 -300
- package/dist/src/app-opentui/render/terminal-handoff.d.ts +0 -16
- package/dist/src/app-opentui/render/terminal-handoff.js +0 -14
- package/dist/src/app-opentui/render/text.d.ts +0 -29
- package/dist/src/app-opentui/render/text.js +0 -177
- package/dist/src/app-opentui/render/type-bar.d.ts +0 -15
- package/dist/src/app-opentui/render/type-bar.js +0 -212
- package/dist/src/app-opentui/runtime-resources.d.ts +0 -16
- package/dist/src/app-opentui/runtime-resources.js +0 -62
- package/dist/src/app-opentui/runtime.d.ts +0 -45
- package/dist/src/app-opentui/runtime.js +0 -5232
- package/dist/src/app-opentui/scenes/command.d.ts +0 -3
- package/dist/src/app-opentui/scenes/command.js +0 -118
- package/dist/src/app-opentui/scenes/doctor.d.ts +0 -3
- package/dist/src/app-opentui/scenes/doctor.js +0 -296
- package/dist/src/app-opentui/scenes/error.d.ts +0 -2
- package/dist/src/app-opentui/scenes/error.js +0 -277
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/agent.js +0 -349
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/browser.js +0 -196
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/dist.js +0 -244
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/git.js +0 -196
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/github.js +0 -275
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/harness.js +0 -153
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +0 -4
- package/dist/src/app-opentui/scenes/family-domains/index.js +0 -1680
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +0 -76
- package/dist/src/app-opentui/scenes/family-domains/kit.js +0 -306
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/profile.js +0 -213
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/queue.js +0 -147
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/remote.js +0 -519
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/review.js +0 -281
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/setup.js +0 -268
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/stats.js +0 -371
- package/dist/src/app-opentui/scenes/family.d.ts +0 -3
- package/dist/src/app-opentui/scenes/family.js +0 -2199
- package/dist/src/app-opentui/scenes/fleet.d.ts +0 -3
- package/dist/src/app-opentui/scenes/fleet.js +0 -766
- package/dist/src/app-opentui/scenes/handoff.d.ts +0 -2
- package/dist/src/app-opentui/scenes/handoff.js +0 -455
- package/dist/src/app-opentui/scenes/help.d.ts +0 -3
- package/dist/src/app-opentui/scenes/help.js +0 -725
- package/dist/src/app-opentui/scenes/inbox.d.ts +0 -3
- package/dist/src/app-opentui/scenes/inbox.js +0 -427
- package/dist/src/app-opentui/scenes/init.d.ts +0 -3
- package/dist/src/app-opentui/scenes/init.js +0 -181
- package/dist/src/app-opentui/scenes/inspect.d.ts +0 -3
- package/dist/src/app-opentui/scenes/inspect.js +0 -794
- package/dist/src/app-opentui/scenes/main.d.ts +0 -3
- package/dist/src/app-opentui/scenes/main.js +0 -332
- package/dist/src/app-opentui/scenes/pi.d.ts +0 -3
- package/dist/src/app-opentui/scenes/pi.js +0 -509
- package/dist/src/app-opentui/scenes/plugin.d.ts +0 -3
- package/dist/src/app-opentui/scenes/plugin.js +0 -487
- package/dist/src/app-opentui/scenes/repo.d.ts +0 -3
- package/dist/src/app-opentui/scenes/repo.js +0 -425
- package/dist/src/app-opentui/scenes/run-detail.d.ts +0 -3
- package/dist/src/app-opentui/scenes/run-detail.js +0 -467
- package/dist/src/app-opentui/scenes/server.d.ts +0 -3
- package/dist/src/app-opentui/scenes/server.js +0 -378
- package/dist/src/app-opentui/scenes/tasks.d.ts +0 -3
- package/dist/src/app-opentui/scenes/tasks.js +0 -768
- package/dist/src/app-opentui/scenes/workspace.d.ts +0 -3
- package/dist/src/app-opentui/scenes/workspace.js +0 -427
- package/dist/src/app-opentui/selectable.d.ts +0 -19
- package/dist/src/app-opentui/selectable.js +0 -80
- package/dist/src/app-opentui/state.d.ts +0 -4
- package/dist/src/app-opentui/state.js +0 -399
- package/dist/src/app-opentui/surface-catalog.d.ts +0 -20
- package/dist/src/app-opentui/surface-catalog.js +0 -542
- package/dist/src/app-opentui/theme.d.ts +0 -59
- package/dist/src/app-opentui/theme.js +0 -142
- package/dist/src/app-opentui/types.d.ts +0 -313
- package/dist/src/app-opentui/types.js +0 -1
- package/dist/src/commands/_server-events.d.ts +0 -26
- package/dist/src/commands/_server-events.js +0 -715
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { StageLayout } from "../layout";
|
|
2
|
-
import type { AppSceneFrame, AppSceneLine } from "../types";
|
|
3
|
-
export declare function SceneFrameView(props: {
|
|
4
|
-
frame: AppSceneFrame;
|
|
5
|
-
layout: StageLayout;
|
|
6
|
-
onLineClick?: (line: AppSceneLine) => void;
|
|
7
|
-
}): React.ReactNode;
|
|
@@ -1,579 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/app-opentui/react/SceneFrameView.tsx
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { useRenderer } from "@opentui/react";
|
|
5
|
-
import { TextAttributes as TextAttributes4 } from "@opentui/core";
|
|
6
|
-
|
|
7
|
-
// packages/cli/src/app-opentui/theme.ts
|
|
8
|
-
import {
|
|
9
|
-
bold as otuiBold,
|
|
10
|
-
dim as otuiDim,
|
|
11
|
-
fg as otuiFg,
|
|
12
|
-
t,
|
|
13
|
-
TextAttributes
|
|
14
|
-
} from "@opentui/core";
|
|
15
|
-
var RIG_UI = {
|
|
16
|
-
bg: "#070809",
|
|
17
|
-
bg2: "#0b0c0e",
|
|
18
|
-
panel: "#101115",
|
|
19
|
-
panel2: "#14161b",
|
|
20
|
-
hover: "#181b24",
|
|
21
|
-
glass: "#1e2230",
|
|
22
|
-
border: "#2a2e3a",
|
|
23
|
-
ink: "#f4f5f8",
|
|
24
|
-
ink2: "#c7c9d3",
|
|
25
|
-
ink3: "#9aa0ae",
|
|
26
|
-
ink4: "#787b86",
|
|
27
|
-
lime: "#ccff4d",
|
|
28
|
-
limeDim: "#a9d63f",
|
|
29
|
-
cyan: "#56d8ff",
|
|
30
|
-
cyanDim: "#3f9fbd",
|
|
31
|
-
red: "#ff5d5d",
|
|
32
|
-
yellow: "#ffd24d",
|
|
33
|
-
magenta: "#ff79b0"
|
|
34
|
-
};
|
|
35
|
-
var styles = {
|
|
36
|
-
ink: otuiFg(RIG_UI.ink),
|
|
37
|
-
ink2: otuiFg(RIG_UI.ink2),
|
|
38
|
-
ink3: otuiFg(RIG_UI.ink3),
|
|
39
|
-
ink4: otuiFg(RIG_UI.ink4),
|
|
40
|
-
lime: otuiFg(RIG_UI.lime),
|
|
41
|
-
limeDim: otuiFg(RIG_UI.limeDim),
|
|
42
|
-
cyan: otuiFg(RIG_UI.cyan),
|
|
43
|
-
red: otuiFg(RIG_UI.red),
|
|
44
|
-
yellow: otuiFg(RIG_UI.yellow),
|
|
45
|
-
magenta: otuiFg(RIG_UI.magenta)
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// packages/cli/src/app-opentui/layout.ts
|
|
49
|
-
function visibleWidth(text) {
|
|
50
|
-
return [...text].length;
|
|
51
|
-
}
|
|
52
|
-
function alignText(text, width, align = "left") {
|
|
53
|
-
const length = visibleWidth(text);
|
|
54
|
-
if (length >= width)
|
|
55
|
-
return text;
|
|
56
|
-
const pad = width - length;
|
|
57
|
-
if (align === "right")
|
|
58
|
-
return `${" ".repeat(pad)}${text}`;
|
|
59
|
-
if (align === "center") {
|
|
60
|
-
const left = Math.floor(pad / 2);
|
|
61
|
-
return `${" ".repeat(left)}${text}${" ".repeat(pad - left)}`;
|
|
62
|
-
}
|
|
63
|
-
return text;
|
|
64
|
-
}
|
|
65
|
-
function truncateText(text, width) {
|
|
66
|
-
if (visibleWidth(text) <= width)
|
|
67
|
-
return text;
|
|
68
|
-
if (width <= 1)
|
|
69
|
-
return "\u2026";
|
|
70
|
-
return `${[...text].slice(0, Math.max(0, width - 1)).join("")}\u2026`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// packages/cli/src/app-opentui/drone.ts
|
|
74
|
-
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
75
|
-
var COLOR = {
|
|
76
|
-
body: RGBA.fromHex(RIG_UI.lime),
|
|
77
|
-
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
78
|
-
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
79
|
-
path: RGBA.fromHex(RIG_UI.cyan),
|
|
80
|
-
eye: RGBA.fromHex(RIG_UI.ink),
|
|
81
|
-
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
82
|
-
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// packages/cli/src/app-opentui/render/scene.ts
|
|
86
|
-
function fitSceneLine(input, layout) {
|
|
87
|
-
const fitted = truncateText(input.text, layout.centerWidth);
|
|
88
|
-
return {
|
|
89
|
-
...input,
|
|
90
|
-
text: alignText(fitted, layout.centerWidth, input.align ?? "left")
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function fitSceneLines(lines, layout) {
|
|
94
|
-
return lines.slice(0, layout.centerHeight).map((entry) => fitSceneLine(entry, layout));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// packages/cli/src/app-opentui/render/text.ts
|
|
98
|
-
import { RGBA as RGBA2, TextAttributes as TextAttributes3, TextRenderable } from "@opentui/core";
|
|
99
|
-
|
|
100
|
-
// packages/cli/src/app-opentui/render/hover.ts
|
|
101
|
-
var hoveredId;
|
|
102
|
-
var listeners = new Set;
|
|
103
|
-
function isHovered(id) {
|
|
104
|
-
return id !== undefined && id === hoveredId;
|
|
105
|
-
}
|
|
106
|
-
function setHoveredSelectableId(id) {
|
|
107
|
-
if (hoveredId === id)
|
|
108
|
-
return;
|
|
109
|
-
hoveredId = id;
|
|
110
|
-
for (const listener of listeners)
|
|
111
|
-
listener();
|
|
112
|
-
}
|
|
113
|
-
function clearHoveredSelectableId(id) {
|
|
114
|
-
if (id !== undefined && hoveredId === id)
|
|
115
|
-
setHoveredSelectableId(undefined);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// packages/cli/src/app-opentui/render/text.ts
|
|
119
|
-
var TRANSPARENT = RGBA2.fromInts(0, 0, 0, 0);
|
|
120
|
-
var HOVER_BG = RGBA2.fromHex(RIG_UI.hover);
|
|
121
|
-
function lineIsClickable(line) {
|
|
122
|
-
return line?.selectable !== undefined || line?.selectableIndex !== undefined;
|
|
123
|
-
}
|
|
124
|
-
function lineSelectableId(line) {
|
|
125
|
-
return line?.selectable?.id ?? line?.selectableId;
|
|
126
|
-
}
|
|
127
|
-
function lineBackground(line) {
|
|
128
|
-
if (line?.bg)
|
|
129
|
-
return RGBA2.fromHex(line.bg);
|
|
130
|
-
const id = lineSelectableId(line);
|
|
131
|
-
if (id !== undefined && isHovered(id))
|
|
132
|
-
return HOVER_BG;
|
|
133
|
-
return TRANSPARENT;
|
|
134
|
-
}
|
|
135
|
-
function selectableMouseHandler(currentLineRef, onLineMouseDown) {
|
|
136
|
-
return (event) => {
|
|
137
|
-
const currentLine = currentLineRef();
|
|
138
|
-
if (!lineIsClickable(currentLine))
|
|
139
|
-
return;
|
|
140
|
-
onLineMouseDown?.(currentLine, event);
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function hoverHandlers(currentLineRef) {
|
|
144
|
-
return {
|
|
145
|
-
onMouseOver: () => {
|
|
146
|
-
const id = lineSelectableId(currentLineRef());
|
|
147
|
-
if (id !== undefined)
|
|
148
|
-
setHoveredSelectableId(id);
|
|
149
|
-
},
|
|
150
|
-
onMouseOut: () => clearHoveredSelectableId(lineSelectableId(currentLineRef()))
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function createFlowTextLine(renderer, id, onLineMouseDown) {
|
|
154
|
-
let currentLine;
|
|
155
|
-
const renderable = new TextRenderable(renderer, {
|
|
156
|
-
id,
|
|
157
|
-
content: "",
|
|
158
|
-
width: "100%",
|
|
159
|
-
height: 1,
|
|
160
|
-
flexShrink: 0,
|
|
161
|
-
fg: RIG_UI.ink2,
|
|
162
|
-
selectable: true,
|
|
163
|
-
onMouseDown: selectableMouseHandler(() => currentLine, onLineMouseDown),
|
|
164
|
-
...hoverHandlers(() => currentLine)
|
|
165
|
-
});
|
|
166
|
-
renderable.setRigSceneLine = (line) => {
|
|
167
|
-
currentLine = line;
|
|
168
|
-
};
|
|
169
|
-
return renderable;
|
|
170
|
-
}
|
|
171
|
-
function applyFlowTextLine(renderable, line, width) {
|
|
172
|
-
renderable.setRigSceneLine?.(line);
|
|
173
|
-
renderable.visible = Boolean(line);
|
|
174
|
-
renderable.height = line ? 1 : 0;
|
|
175
|
-
renderable.width = Math.max(1, width);
|
|
176
|
-
renderable.content = line?.styledText ?? line?.text ?? "";
|
|
177
|
-
renderable.fg = line?.fg ?? RIG_UI.ink2;
|
|
178
|
-
renderable.bg = lineBackground(line);
|
|
179
|
-
renderable.attributes = line?.bold ? TextAttributes3.BOLD : line?.dim ? TextAttributes3.DIM : 0;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// packages/cli/src/app-opentui/render/panels.ts
|
|
183
|
-
import { RGBA as RGBA3, ScrollBoxRenderable } from "@opentui/core";
|
|
184
|
-
|
|
185
|
-
// packages/cli/src/app-opentui/render/panel-layout.ts
|
|
186
|
-
function panelCellRect(layout, panel) {
|
|
187
|
-
const left = Math.max(0, Math.min(layout.width - 1, layout.centerLeft + (panel.left ?? 0)));
|
|
188
|
-
const desiredWidth = panel.width ?? layout.centerWidth;
|
|
189
|
-
const width = Math.max(1, Math.min(layout.width - left, desiredWidth));
|
|
190
|
-
const top = Math.max(0, Math.min(layout.height - 1, layout.centerTop + panel.top));
|
|
191
|
-
const height = Math.max(1, Math.min(layout.height - top, panel.height));
|
|
192
|
-
if (width <= 3 || height <= 3)
|
|
193
|
-
return null;
|
|
194
|
-
const right = left + width - 1;
|
|
195
|
-
const bottom = top + height - 1;
|
|
196
|
-
const headerHeight = panel.chrome === "ad-terminal" ? Math.max(3, Math.min(height - 2, panel.headerHeight ?? 3)) : 0;
|
|
197
|
-
const dividerY = headerHeight ? Math.min(bottom - 1, top + headerHeight) : top;
|
|
198
|
-
return { left, top, width, height, right, bottom, headerHeight, dividerY };
|
|
199
|
-
}
|
|
200
|
-
function panelContentRect(layout, panel) {
|
|
201
|
-
const rect = panelCellRect(layout, panel);
|
|
202
|
-
if (!rect)
|
|
203
|
-
return null;
|
|
204
|
-
const chromeInset = panel.chrome === "ad-terminal" ? 1 : 0;
|
|
205
|
-
const left = rect.left + chromeInset;
|
|
206
|
-
const top = rect.top + rect.headerHeight + chromeInset;
|
|
207
|
-
const width = Math.max(1, Math.min(layout.width - left, rect.width - chromeInset * 2));
|
|
208
|
-
const height = Math.max(1, Math.min(layout.height - top, rect.height - rect.headerHeight - chromeInset * 2));
|
|
209
|
-
const paddingX = panel.paddingX ?? (panel.chrome === "ad-terminal" ? 5 : 2);
|
|
210
|
-
const paddingY = panel.paddingY ?? (panel.chrome === "ad-terminal" ? 2 : 1);
|
|
211
|
-
const contentWidth = Math.max(1, width - paddingX * 2 - 1);
|
|
212
|
-
return { left, top, width, height, paddingX, paddingY, contentWidth };
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// packages/cli/src/app-opentui/render/panels.ts
|
|
216
|
-
var TRANSPARENT2 = RGBA3.fromInts(0, 0, 0, 0);
|
|
217
|
-
var MAX_PANEL_LINES = 420;
|
|
218
|
-
var PANEL_OPAQUE_ALPHA = 255;
|
|
219
|
-
var PANEL_BORDER = hexToRgba(RIG_UI.border, 255);
|
|
220
|
-
function hexToRgba(hex, alpha) {
|
|
221
|
-
const clean = hex.replace(/^#/, "");
|
|
222
|
-
const full = clean.length === 3 ? clean.split("").map((part) => `${part}${part}`).join("") : clean;
|
|
223
|
-
const value = Number.parseInt(full, 16);
|
|
224
|
-
if (!Number.isFinite(value))
|
|
225
|
-
return RGBA3.fromInts(14, 15, 17, alpha);
|
|
226
|
-
return RGBA3.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
|
|
227
|
-
}
|
|
228
|
-
function panelBackground(panel) {
|
|
229
|
-
return hexToRgba(panel.backgroundColor ?? RIG_UI.panel, PANEL_OPAQUE_ALPHA);
|
|
230
|
-
}
|
|
231
|
-
function panelBorder(panel) {
|
|
232
|
-
if (panel.borderColor)
|
|
233
|
-
return hexToRgba(panel.borderColor, panel.borderAlpha ?? 255);
|
|
234
|
-
return PANEL_BORDER;
|
|
235
|
-
}
|
|
236
|
-
function createScrollPanelLayer(renderer, id, onLineMouseDown) {
|
|
237
|
-
const panel = new ScrollBoxRenderable(renderer, {
|
|
238
|
-
id,
|
|
239
|
-
position: "absolute",
|
|
240
|
-
left: 0,
|
|
241
|
-
top: -2,
|
|
242
|
-
width: 1,
|
|
243
|
-
height: 1,
|
|
244
|
-
backgroundColor: TRANSPARENT2,
|
|
245
|
-
border: false,
|
|
246
|
-
shouldFill: true,
|
|
247
|
-
opacity: 1,
|
|
248
|
-
zIndex: 6,
|
|
249
|
-
scrollY: true,
|
|
250
|
-
scrollX: false,
|
|
251
|
-
stickyScroll: false,
|
|
252
|
-
viewportCulling: true,
|
|
253
|
-
paddingX: 2,
|
|
254
|
-
paddingY: 1,
|
|
255
|
-
verticalScrollbarOptions: {
|
|
256
|
-
showArrows: false,
|
|
257
|
-
visible: false,
|
|
258
|
-
width: 1,
|
|
259
|
-
trackOptions: {
|
|
260
|
-
backgroundColor: TRANSPARENT2,
|
|
261
|
-
foregroundColor: hexToRgba(RIG_UI.ink4, 84)
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
horizontalScrollbarOptions: {
|
|
265
|
-
height: 0,
|
|
266
|
-
visible: false,
|
|
267
|
-
trackOptions: {
|
|
268
|
-
backgroundColor: TRANSPARENT2,
|
|
269
|
-
foregroundColor: TRANSPARENT2
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
panel.__rigTextLines = [];
|
|
274
|
-
panel.__rigRenderer = renderer;
|
|
275
|
-
panel.__rigOnLineMouseDown = onLineMouseDown;
|
|
276
|
-
return panel;
|
|
277
|
-
}
|
|
278
|
-
function ensurePanelLineCount(panel, desiredCount) {
|
|
279
|
-
const target = Math.min(MAX_PANEL_LINES, Math.max(0, desiredCount));
|
|
280
|
-
while (panel.__rigTextLines.length < target) {
|
|
281
|
-
const index = panel.__rigTextLines.length;
|
|
282
|
-
const line = createFlowTextLine(panel.__rigRenderer, `${panel.id}-line-${index}`, panel.__rigOnLineMouseDown);
|
|
283
|
-
panel.__rigTextLines.push(line);
|
|
284
|
-
panel.add(line);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
function hidePanel(panel) {
|
|
288
|
-
panel.visible = false;
|
|
289
|
-
panel.top = -2;
|
|
290
|
-
panel.left = 0;
|
|
291
|
-
panel.width = 1;
|
|
292
|
-
panel.height = 1;
|
|
293
|
-
panel.backgroundColor = TRANSPARENT2;
|
|
294
|
-
panel.border = false;
|
|
295
|
-
panel.__rigPanelId = undefined;
|
|
296
|
-
panel.__rigTextLines.forEach((line) => applyFlowTextLine(line, undefined, 1));
|
|
297
|
-
}
|
|
298
|
-
function applyScrollPanels(panels, layout, scenePanels) {
|
|
299
|
-
panels.forEach((renderable, index) => {
|
|
300
|
-
const panel = scenePanels[index];
|
|
301
|
-
if (!panel || panel.height <= 0) {
|
|
302
|
-
hidePanel(renderable);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
const contentRect = panelContentRect(layout, panel);
|
|
306
|
-
if (!contentRect) {
|
|
307
|
-
hidePanel(renderable);
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const { left, top, width, height, paddingX, paddingY, contentWidth } = contentRect;
|
|
311
|
-
renderable.visible = true;
|
|
312
|
-
renderable.left = left;
|
|
313
|
-
renderable.top = top;
|
|
314
|
-
renderable.width = width;
|
|
315
|
-
renderable.height = height;
|
|
316
|
-
renderable.zIndex = panel.zIndex ?? 6;
|
|
317
|
-
renderable.opacity = panel.opacity ?? 1;
|
|
318
|
-
const adTerminal = panel.chrome === "ad-terminal";
|
|
319
|
-
renderable.backgroundColor = adTerminal ? TRANSPARENT2 : panelBackground(panel);
|
|
320
|
-
renderable.border = adTerminal ? false : true;
|
|
321
|
-
renderable.borderColor = adTerminal ? TRANSPARENT2 : panelBorder(panel);
|
|
322
|
-
renderable.paddingX = paddingX;
|
|
323
|
-
renderable.paddingY = paddingY;
|
|
324
|
-
renderable.stickyScroll = panel.stickyScroll ?? false;
|
|
325
|
-
renderable.stickyStart = panel.stickyStart;
|
|
326
|
-
renderable.verticalScrollBar.visible = false;
|
|
327
|
-
renderable.horizontalScrollBar.visible = false;
|
|
328
|
-
if (renderable.__rigPanelId !== panel.id) {
|
|
329
|
-
renderable.__rigPanelId = panel.id;
|
|
330
|
-
renderable.scrollTo(0);
|
|
331
|
-
}
|
|
332
|
-
const lineCount = Math.min(panel.lines.length, MAX_PANEL_LINES);
|
|
333
|
-
ensurePanelLineCount(renderable, lineCount);
|
|
334
|
-
renderable.__rigTextLines.forEach((line, lineIndex) => {
|
|
335
|
-
applyFlowTextLine(line, lineIndex < lineCount ? panel.lines[lineIndex] : undefined, contentWidth);
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// packages/cli/src/app-opentui/render/native-host.ts
|
|
341
|
-
import {
|
|
342
|
-
BoxRenderable,
|
|
343
|
-
CodeRenderable,
|
|
344
|
-
DiffRenderable,
|
|
345
|
-
RGBA as RGBA4,
|
|
346
|
-
ScrollBoxRenderable as ScrollBoxRenderable2,
|
|
347
|
-
SyntaxStyle,
|
|
348
|
-
TextRenderable as TextRenderable2,
|
|
349
|
-
TextTableRenderable
|
|
350
|
-
} from "@opentui/core";
|
|
351
|
-
var syntaxStyle = null;
|
|
352
|
-
function rigSyntaxStyle() {
|
|
353
|
-
if (syntaxStyle)
|
|
354
|
-
return syntaxStyle;
|
|
355
|
-
syntaxStyle = SyntaxStyle.fromStyles({
|
|
356
|
-
keyword: { fg: RGBA4.fromHex(RIG_UI.magenta), bold: true },
|
|
357
|
-
string: { fg: RGBA4.fromHex(RIG_UI.lime) },
|
|
358
|
-
number: { fg: RGBA4.fromHex(RIG_UI.cyan) },
|
|
359
|
-
comment: { fg: RGBA4.fromHex(RIG_UI.ink4), italic: true },
|
|
360
|
-
function: { fg: RGBA4.fromHex(RIG_UI.cyan) },
|
|
361
|
-
type: { fg: RGBA4.fromHex(RIG_UI.limeDim) },
|
|
362
|
-
constant: { fg: RGBA4.fromHex(RIG_UI.yellow) },
|
|
363
|
-
default: { fg: RGBA4.fromHex(RIG_UI.ink2) }
|
|
364
|
-
});
|
|
365
|
-
return syntaxStyle;
|
|
366
|
-
}
|
|
367
|
-
function tableContent(rows) {
|
|
368
|
-
return rows.map((row, rowIndex) => row.map((cell) => [{ __isChunk: true, text: cell, fg: RGBA4.fromHex(rowIndex === 0 ? RIG_UI.ink3 : RIG_UI.ink2) }]));
|
|
369
|
-
}
|
|
370
|
-
function createNativeHost(renderer) {
|
|
371
|
-
try {
|
|
372
|
-
const scrollBox = new ScrollBoxRenderable2(renderer, {
|
|
373
|
-
id: "rig-native-scrollbox",
|
|
374
|
-
position: "absolute",
|
|
375
|
-
left: 0,
|
|
376
|
-
top: 0,
|
|
377
|
-
width: 1,
|
|
378
|
-
height: 1,
|
|
379
|
-
scrollY: true,
|
|
380
|
-
zIndex: 9,
|
|
381
|
-
visible: false
|
|
382
|
-
});
|
|
383
|
-
renderer.root.add(scrollBox);
|
|
384
|
-
return { scrollBox, code: null, diff: null, table: null, active: null, lastKey: "" };
|
|
385
|
-
} catch {
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
function hideAllChildren(host) {
|
|
390
|
-
if (host.code)
|
|
391
|
-
host.code.visible = false;
|
|
392
|
-
if (host.diff)
|
|
393
|
-
host.diff.visible = false;
|
|
394
|
-
if (host.table)
|
|
395
|
-
host.table.visible = false;
|
|
396
|
-
}
|
|
397
|
-
function hideNativeHost(host) {
|
|
398
|
-
if (!host)
|
|
399
|
-
return;
|
|
400
|
-
host.scrollBox.visible = false;
|
|
401
|
-
hideAllChildren(host);
|
|
402
|
-
host.active = null;
|
|
403
|
-
}
|
|
404
|
-
function applyNativeHost(host, mount, layout) {
|
|
405
|
-
if (!host)
|
|
406
|
-
return false;
|
|
407
|
-
try {
|
|
408
|
-
const left = mount.left ?? layout.centerLeft;
|
|
409
|
-
const top = mount.top ?? layout.centerTop;
|
|
410
|
-
const width = Math.max(8, mount.width ?? layout.centerWidth);
|
|
411
|
-
const height = Math.max(3, mount.height ?? layout.centerHeight);
|
|
412
|
-
host.scrollBox.left = left;
|
|
413
|
-
host.scrollBox.top = top;
|
|
414
|
-
host.scrollBox.width = width;
|
|
415
|
-
host.scrollBox.height = height;
|
|
416
|
-
host.scrollBox.visible = true;
|
|
417
|
-
hideAllChildren(host);
|
|
418
|
-
const rowCount = mount.rows?.length ?? 0;
|
|
419
|
-
const key = `${mount.kind}:${width}x${height}:${mount.content.length}:${mount.filetype ?? ""}:${rowCount}`;
|
|
420
|
-
if (mount.kind === "table") {
|
|
421
|
-
if (!host.table) {
|
|
422
|
-
host.table = new TextTableRenderable(host.scrollBox.ctx, { id: "rig-native-table", content: [], width: "100%", showBorders: true, columnWidthMode: "full", borderColor: RIG_UI.ink4 });
|
|
423
|
-
host.scrollBox.add(host.table);
|
|
424
|
-
}
|
|
425
|
-
if (host.lastKey !== key)
|
|
426
|
-
host.table.content = tableContent(mount.rows ?? []);
|
|
427
|
-
host.table.visible = true;
|
|
428
|
-
} else if (mount.kind === "diff") {
|
|
429
|
-
if (!host.diff) {
|
|
430
|
-
host.diff = new DiffRenderable(host.scrollBox.ctx, { id: "rig-native-diff", diff: "", width: "100%" });
|
|
431
|
-
host.scrollBox.add(host.diff);
|
|
432
|
-
}
|
|
433
|
-
if (host.lastKey !== key)
|
|
434
|
-
host.diff.diff = mount.content;
|
|
435
|
-
host.diff.visible = true;
|
|
436
|
-
} else {
|
|
437
|
-
const filetype = mount.kind === "markdown" ? "markdown" : mount.filetype ?? "text";
|
|
438
|
-
if (!host.code) {
|
|
439
|
-
host.code = new CodeRenderable(host.scrollBox.ctx, { id: "rig-native-code", content: "", filetype, syntaxStyle: rigSyntaxStyle(), width: "100%" });
|
|
440
|
-
host.scrollBox.add(host.code);
|
|
441
|
-
}
|
|
442
|
-
if (host.lastKey !== key) {
|
|
443
|
-
host.code.filetype = filetype;
|
|
444
|
-
host.code.content = mount.content;
|
|
445
|
-
}
|
|
446
|
-
host.code.visible = true;
|
|
447
|
-
}
|
|
448
|
-
host.active = mount.kind;
|
|
449
|
-
host.lastKey = key;
|
|
450
|
-
if (mount.stickyBottom)
|
|
451
|
-
host.scrollBox.scrollTo?.({ x: 0, y: Number.MAX_SAFE_INTEGER });
|
|
452
|
-
return true;
|
|
453
|
-
} catch {
|
|
454
|
-
hideNativeHost(host);
|
|
455
|
-
return false;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
function destroyNativeHost(host) {
|
|
459
|
-
if (!host)
|
|
460
|
-
return;
|
|
461
|
-
try {
|
|
462
|
-
host.scrollBox.destroy?.();
|
|
463
|
-
} catch {}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// packages/cli/src/app-opentui/react/scroll.ts
|
|
467
|
-
var registries = new Set;
|
|
468
|
-
function registerScrollables(provider) {
|
|
469
|
-
registries.add(provider);
|
|
470
|
-
return () => {
|
|
471
|
-
registries.delete(provider);
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// packages/cli/src/app-opentui/react/SceneFrameView.tsx
|
|
476
|
-
import { jsxDEV, Fragment } from "@opentui/react/jsx-dev-runtime";
|
|
477
|
-
function lineAttributes(line) {
|
|
478
|
-
return line?.bold ? TextAttributes4.BOLD : line?.dim ? TextAttributes4.DIM : 0;
|
|
479
|
-
}
|
|
480
|
-
function lineContent(line) {
|
|
481
|
-
return line.styledText ?? line.text ?? "";
|
|
482
|
-
}
|
|
483
|
-
function LineView(props) {
|
|
484
|
-
const { line, onLineClick } = props;
|
|
485
|
-
const id = lineSelectableId(line);
|
|
486
|
-
return /* @__PURE__ */ jsxDEV("text", {
|
|
487
|
-
style: { position: "absolute", left: props.left, top: props.top, width: props.width, zIndex: 5 },
|
|
488
|
-
fg: line.fg ?? RIG_UI.ink2,
|
|
489
|
-
bg: lineBackground(line),
|
|
490
|
-
attributes: lineAttributes(line),
|
|
491
|
-
content: lineContent(line),
|
|
492
|
-
onMouseDown: onLineClick ? () => onLineClick(line) : undefined,
|
|
493
|
-
onMouseOver: id !== undefined ? () => setHoveredSelectableId(id) : undefined,
|
|
494
|
-
onMouseOut: id !== undefined ? () => clearHoveredSelectableId(id) : undefined
|
|
495
|
-
}, undefined, false, undefined, this);
|
|
496
|
-
}
|
|
497
|
-
function PanelHost(props) {
|
|
498
|
-
const renderer = useRenderer();
|
|
499
|
-
const poolRef = useRef([]);
|
|
500
|
-
const clickRef = useRef(props.onLineClick);
|
|
501
|
-
clickRef.current = props.onLineClick;
|
|
502
|
-
useEffect(() => {
|
|
503
|
-
const unregister = registerScrollables(() => poolRef.current);
|
|
504
|
-
return () => {
|
|
505
|
-
unregister();
|
|
506
|
-
for (const panel of poolRef.current) {
|
|
507
|
-
try {
|
|
508
|
-
renderer.root.remove(panel.id);
|
|
509
|
-
} catch {}
|
|
510
|
-
}
|
|
511
|
-
poolRef.current = [];
|
|
512
|
-
};
|
|
513
|
-
}, [renderer]);
|
|
514
|
-
useEffect(() => {
|
|
515
|
-
const pool = poolRef.current;
|
|
516
|
-
while (pool.length < props.panels.length) {
|
|
517
|
-
const panel = createScrollPanelLayer(renderer, `react-scroll-panel-${pool.length}`, (line) => clickRef.current?.(line));
|
|
518
|
-
renderer.root.add(panel);
|
|
519
|
-
pool.push(panel);
|
|
520
|
-
}
|
|
521
|
-
applyScrollPanels(pool, props.layout, props.panels);
|
|
522
|
-
});
|
|
523
|
-
return null;
|
|
524
|
-
}
|
|
525
|
-
function NativeHostView(props) {
|
|
526
|
-
const renderer = useRenderer();
|
|
527
|
-
const hostRef = useRef(null);
|
|
528
|
-
useEffect(() => {
|
|
529
|
-
const host = createNativeHost(renderer);
|
|
530
|
-
hostRef.current = host;
|
|
531
|
-
const unregister = registerScrollables(() => host ? [host.scrollBox] : []);
|
|
532
|
-
return () => {
|
|
533
|
-
unregister();
|
|
534
|
-
destroyNativeHost(hostRef.current);
|
|
535
|
-
hostRef.current = null;
|
|
536
|
-
};
|
|
537
|
-
}, [renderer]);
|
|
538
|
-
useEffect(() => {
|
|
539
|
-
const host = hostRef.current;
|
|
540
|
-
if (!host)
|
|
541
|
-
return;
|
|
542
|
-
if (props.native) {
|
|
543
|
-
if (!applyNativeHost(host, props.native, props.layout))
|
|
544
|
-
hideNativeHost(host);
|
|
545
|
-
} else {
|
|
546
|
-
hideNativeHost(host);
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
return null;
|
|
550
|
-
}
|
|
551
|
-
function SceneFrameView(props) {
|
|
552
|
-
const { frame, layout } = props;
|
|
553
|
-
const contentLayout = frame.fullScreen ? { ...layout, centerWidth: layout.width, centerLeft: 0, centerTop: 0 } : layout;
|
|
554
|
-
const lines = fitSceneLines(frame.lines ?? [], contentLayout);
|
|
555
|
-
const nativeActive = frame.native && !frame.terminalActive;
|
|
556
|
-
return /* @__PURE__ */ jsxDEV(Fragment, {
|
|
557
|
-
children: [
|
|
558
|
-
lines.map((line, index) => /* @__PURE__ */ jsxDEV(LineView, {
|
|
559
|
-
line,
|
|
560
|
-
top: contentLayout.centerTop + index,
|
|
561
|
-
left: contentLayout.centerLeft,
|
|
562
|
-
width: contentLayout.centerWidth,
|
|
563
|
-
onLineClick: props.onLineClick
|
|
564
|
-
}, `line-${index}`, false, undefined, this)),
|
|
565
|
-
/* @__PURE__ */ jsxDEV(PanelHost, {
|
|
566
|
-
panels: frame.panels ?? [],
|
|
567
|
-
layout: contentLayout,
|
|
568
|
-
onLineClick: props.onLineClick
|
|
569
|
-
}, undefined, false, undefined, this),
|
|
570
|
-
/* @__PURE__ */ jsxDEV(NativeHostView, {
|
|
571
|
-
native: nativeActive ? frame.native : undefined,
|
|
572
|
-
layout: contentLayout
|
|
573
|
-
}, undefined, false, undefined, this)
|
|
574
|
-
]
|
|
575
|
-
}, undefined, true, undefined, this);
|
|
576
|
-
}
|
|
577
|
-
export {
|
|
578
|
-
SceneFrameView
|
|
579
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AppRuntime, AppState, AppStore } from "../types";
|
|
2
|
-
type RigAppContextValue = {
|
|
3
|
-
readonly store: AppStore;
|
|
4
|
-
readonly runtime: AppRuntime;
|
|
5
|
-
readonly runAppAction: (label: string, action: () => Promise<unknown>) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function RigAppProvider(props: {
|
|
8
|
-
value: RigAppContextValue;
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
}): React.ReactNode;
|
|
11
|
-
export declare function useAppState(): AppState;
|
|
12
|
-
export declare function useRuntime(): AppRuntime;
|
|
13
|
-
/** The raw store — needed by the reused legacy selection helpers
|
|
14
|
-
* (moveSelection/selectIndex/selectById) which operate on the store directly. */
|
|
15
|
-
export declare function useStore(): AppStore;
|
|
16
|
-
export declare function useRunAppAction(): RigAppContextValue["runAppAction"];
|
|
17
|
-
export type { RigAppContextValue };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/app-opentui/react/context.tsx
|
|
3
|
-
import { createContext, useContext, useSyncExternalStore } from "react";
|
|
4
|
-
import { jsxDEV } from "@opentui/react/jsx-dev-runtime";
|
|
5
|
-
var RigAppContext = createContext(null);
|
|
6
|
-
function RigAppProvider(props) {
|
|
7
|
-
return /* @__PURE__ */ jsxDEV(RigAppContext.Provider, {
|
|
8
|
-
value: props.value,
|
|
9
|
-
children: props.children
|
|
10
|
-
}, undefined, false, undefined, this);
|
|
11
|
-
}
|
|
12
|
-
function useCtx() {
|
|
13
|
-
const value = useContext(RigAppContext);
|
|
14
|
-
if (!value)
|
|
15
|
-
throw new Error("Rig react components must render inside <RigAppProvider>.");
|
|
16
|
-
return value;
|
|
17
|
-
}
|
|
18
|
-
function useAppState() {
|
|
19
|
-
const { store } = useCtx();
|
|
20
|
-
return useSyncExternalStore(store.subscribe, store.getState, store.getState);
|
|
21
|
-
}
|
|
22
|
-
function useRuntime() {
|
|
23
|
-
return useCtx().runtime;
|
|
24
|
-
}
|
|
25
|
-
function useStore() {
|
|
26
|
-
return useCtx().store;
|
|
27
|
-
}
|
|
28
|
-
function useRunAppAction() {
|
|
29
|
-
return useCtx().runAppAction;
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
useStore,
|
|
33
|
-
useRuntime,
|
|
34
|
-
useRunAppAction,
|
|
35
|
-
useAppState,
|
|
36
|
-
RigAppProvider
|
|
37
|
-
};
|