@encoredigitalgroup/opencode 0.2.9 → 0.2.10
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/tui/index.js +72 -55
- package/package.json +1 -1
package/dist/tui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/tui/index.tsx
|
|
3
3
|
import { Plugin as Plugin2 } from "@opencode/plugin/tui";
|
|
4
|
-
import { fg, StyledText } from "@opentui/core";
|
|
4
|
+
import { fg as fg2, StyledText as StyledText2 } from "@opentui/core";
|
|
5
5
|
|
|
6
6
|
// node_modules/solid-js/dist/solid.js
|
|
7
7
|
var sharedConfig = {
|
|
@@ -5858,6 +5858,9 @@ function clientSettings({
|
|
|
5858
5858
|
return { values, fromFile, providers, custom };
|
|
5859
5859
|
}
|
|
5860
5860
|
|
|
5861
|
+
// src/lib/Quota/tui/sidebar.tsx
|
|
5862
|
+
import { bg, bold, fg, StyledText } from "@opentui/core";
|
|
5863
|
+
|
|
5861
5864
|
// src/lib/Quota/view/columns.ts
|
|
5862
5865
|
var GRAPHEMES = new Intl.Segmenter("en", { granularity: "grapheme" });
|
|
5863
5866
|
var WIDE = /^[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]/u;
|
|
@@ -6495,78 +6498,92 @@ var MARKED_ROLES = new Set([
|
|
|
6495
6498
|
"label",
|
|
6496
6499
|
"statusName"
|
|
6497
6500
|
]);
|
|
6498
|
-
function
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
},
|
|
6513
|
-
children: segment.text
|
|
6514
|
-
}))
|
|
6515
|
-
]
|
|
6516
|
-
});
|
|
6501
|
+
function segmentForeground(theme, settings, segment, marked) {
|
|
6502
|
+
return marked && MARKED_ROLES.has(segment.role) ? theme.text.action.primary.selected : segmentColor(theme, settings, segment);
|
|
6503
|
+
}
|
|
6504
|
+
function styledLine(line, host, marked) {
|
|
6505
|
+
const theme = host.theme();
|
|
6506
|
+
const settings = host.display();
|
|
6507
|
+
return new StyledText(line.segments.flatMap((segment) => {
|
|
6508
|
+
let chunk = fg(segmentForeground(theme, settings, segment, marked))(segment.text);
|
|
6509
|
+
if (segment.bold === true)
|
|
6510
|
+
chunk = bold(chunk);
|
|
6511
|
+
if (marked)
|
|
6512
|
+
chunk = bg(theme.background.raised.high)(chunk);
|
|
6513
|
+
return chunk;
|
|
6514
|
+
}));
|
|
6517
6515
|
}
|
|
6518
6516
|
function SidebarPanel(props) {
|
|
6519
6517
|
const host = props.host;
|
|
6520
6518
|
const stop = host.quota.watch(props.sessionID);
|
|
6521
6519
|
onCleanup(stop);
|
|
6522
|
-
const [snapshotRevision, setSnapshotRevision] = createSignal(0);
|
|
6523
|
-
onCleanup(host.quota.subscribe(() => setSnapshotRevision((revision) => revision + 1)));
|
|
6524
|
-
onMount(() => {
|
|
6525
|
-
host.quota.refresh("poll", props.sessionID);
|
|
6526
|
-
});
|
|
6527
6520
|
onCleanup(host.editing.sidebarShown());
|
|
6528
6521
|
const open = () => host.editing.panelOpen() ?? props.open();
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
const clock = setInterval(() => setNowMs(Date.now()), 60000);
|
|
6532
|
-
onCleanup(() => clearInterval(clock));
|
|
6533
|
-
const display = () => host.display();
|
|
6534
|
-
const snapshot = () => {
|
|
6535
|
-
snapshotRevision();
|
|
6536
|
-
return host.quota.snapshot(props.sessionID);
|
|
6537
|
-
};
|
|
6538
|
-
const panel = createMemo(() => sidebarPanel(snapshot(), display(), { nowMs: nowMs(), width: width(), open: open() }));
|
|
6522
|
+
let width = DEFAULT_SIDEBAR_WIDTH;
|
|
6523
|
+
let nowMs = Date.now();
|
|
6539
6524
|
const marked = () => host.editing.marked(open() ? "sidebar" : "collapsed");
|
|
6525
|
+
let heading;
|
|
6526
|
+
let body;
|
|
6527
|
+
const render = () => {
|
|
6528
|
+
const snapshot = host.quota.snapshot(props.sessionID);
|
|
6529
|
+
const panel = sidebarPanel(snapshot, host.display(), { nowMs, width, open: open() });
|
|
6530
|
+
if (heading)
|
|
6531
|
+
heading.content = new StyledText([bold(panel.title)]);
|
|
6532
|
+
if (!body)
|
|
6533
|
+
return;
|
|
6534
|
+
if (!snapshot) {
|
|
6535
|
+
body.content = "Loading quota\u2026";
|
|
6536
|
+
return;
|
|
6537
|
+
}
|
|
6538
|
+
body.content = new StyledText(panel.lines.flatMap((line, index) => [
|
|
6539
|
+
...styledLine(line, host, line.id !== "" && line.id === marked()).chunks,
|
|
6540
|
+
...index === panel.lines.length - 1 ? [] : [fg(host.theme().text.base)(`
|
|
6541
|
+
`)]
|
|
6542
|
+
]));
|
|
6543
|
+
};
|
|
6544
|
+
onCleanup(host.quota.subscribe(render));
|
|
6545
|
+
const clock = setInterval(() => {
|
|
6546
|
+
nowMs = Date.now();
|
|
6547
|
+
render();
|
|
6548
|
+
}, 60000);
|
|
6549
|
+
onCleanup(() => clearInterval(clock));
|
|
6550
|
+
onMount(() => {
|
|
6551
|
+
render();
|
|
6552
|
+
host.quota.refresh("poll", props.sessionID);
|
|
6553
|
+
});
|
|
6540
6554
|
return /* @__PURE__ */ jsx(Show, {
|
|
6541
|
-
when: display().sidebar.show,
|
|
6555
|
+
when: host.display().sidebar.show,
|
|
6542
6556
|
children: /* @__PURE__ */ jsxs("box", {
|
|
6543
6557
|
flexDirection: "column",
|
|
6544
6558
|
onSizeChange: function() {
|
|
6545
6559
|
const measured = this.width;
|
|
6546
6560
|
if (measured > 0)
|
|
6547
|
-
queueMicrotask(() =>
|
|
6561
|
+
queueMicrotask(() => {
|
|
6562
|
+
width = measured;
|
|
6563
|
+
render();
|
|
6564
|
+
});
|
|
6548
6565
|
},
|
|
6549
6566
|
children: [
|
|
6550
6567
|
/* @__PURE__ */ jsx("text", {
|
|
6551
|
-
|
|
6568
|
+
ref: (node) => {
|
|
6569
|
+
heading = node;
|
|
6570
|
+
},
|
|
6571
|
+
fg: roleColor(host.theme(), host.display(), "title"),
|
|
6552
6572
|
wrapMode: "none",
|
|
6553
6573
|
selectable: false,
|
|
6554
|
-
onMouseDown: () =>
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
}
|
|
6574
|
+
onMouseDown: () => {
|
|
6575
|
+
props.setOpen(!open());
|
|
6576
|
+
queueMicrotask(render);
|
|
6577
|
+
},
|
|
6578
|
+
children: "Usage Meter"
|
|
6558
6579
|
}),
|
|
6559
|
-
/* @__PURE__ */ jsx(
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
line,
|
|
6567
|
-
host,
|
|
6568
|
-
marked: line.id !== "" && line.id === marked()
|
|
6569
|
-
}))
|
|
6580
|
+
/* @__PURE__ */ jsx("text", {
|
|
6581
|
+
ref: (node) => {
|
|
6582
|
+
body = node;
|
|
6583
|
+
},
|
|
6584
|
+
wrapMode: "none",
|
|
6585
|
+
selectable: false,
|
|
6586
|
+
content: "Loading..."
|
|
6570
6587
|
})
|
|
6571
6588
|
]
|
|
6572
6589
|
})
|
|
@@ -6942,8 +6959,8 @@ function TodoSidebar(props) {
|
|
|
6942
6959
|
const line = (todo) => `${TodoTracker.marker(todo.status)} (${todo.priority}) ${todo.content}`;
|
|
6943
6960
|
const plainContent = (items) => items.map(line).join(`
|
|
6944
6961
|
`);
|
|
6945
|
-
const content = (items) => new
|
|
6946
|
-
|
|
6962
|
+
const content = (items) => new StyledText2(items.flatMap((todo, index) => [
|
|
6963
|
+
fg2(color(todo.status))(`${line(todo)}${index === items.length - 1 ? "" : `
|
|
6947
6964
|
`}`)
|
|
6948
6965
|
]));
|
|
6949
6966
|
let heading;
|