poe-code 5.0.2 → 5.0.3
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.js +17 -27
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/dist/providers/poe-agent.js.map +1 -1
- package/package.json +1 -1
- package/packages/toolcraft-design/dist/explorer/reducer.js +1 -1
- package/packages/toolcraft-design/dist/explorer/render/detail.js +15 -19
package/dist/index.js
CHANGED
|
@@ -11447,50 +11447,39 @@ function renderDetail(state, screen, layout) {
|
|
|
11447
11447
|
const row = state.rows.find((r) => r.id === state.detail.rowId) ?? null;
|
|
11448
11448
|
const pane = state.paneDefinitions[1];
|
|
11449
11449
|
const title2 = pane?.titleForRow?.(row ?? void 0) ?? pane?.title ?? "Preview";
|
|
11450
|
-
|
|
11451
|
-
drawPaneFrame(
|
|
11452
|
-
screen,
|
|
11453
|
-
rect,
|
|
11454
|
-
title2,
|
|
11455
|
-
state.focused === "detail" ? styles.borderFocused : styles.border,
|
|
11456
|
-
{ focused: state.focused === "detail", indicator: scrollIndicator(state) }
|
|
11457
|
-
);
|
|
11458
|
-
renderDetailBody(state, screen, paneBodyRect(rect), row);
|
|
11459
|
-
return;
|
|
11460
|
-
}
|
|
11450
|
+
const { start, max } = renderDetailBody(state, screen, paneBodyRect(rect), row);
|
|
11461
11451
|
drawPaneFrame(
|
|
11462
11452
|
screen,
|
|
11463
11453
|
rect,
|
|
11464
11454
|
title2,
|
|
11465
11455
|
state.focused === "detail" ? styles.borderFocused : styles.border,
|
|
11466
|
-
{ focused: state.focused === "detail", indicator: scrollIndicator(state) }
|
|
11456
|
+
{ focused: state.focused === "detail", indicator: scrollIndicator(state, start, max) }
|
|
11467
11457
|
);
|
|
11468
|
-
renderDetailBody(state, screen, paneBodyRect(rect), row);
|
|
11469
11458
|
}
|
|
11470
11459
|
function renderDetailBody(state, screen, rect, row) {
|
|
11471
11460
|
const styles = getExplorerStyles();
|
|
11472
11461
|
const items = state.detail.items;
|
|
11473
11462
|
if (rect.width <= 0 || rect.height <= 0) {
|
|
11474
|
-
return;
|
|
11463
|
+
return { start: 0, max: 0 };
|
|
11475
11464
|
}
|
|
11476
11465
|
if (items === null) {
|
|
11477
11466
|
writeLine2(screen, rect, 0, row === null ? state.emptyHint : "Loading detail...", styles.muted);
|
|
11478
|
-
return;
|
|
11467
|
+
return { start: 0, max: 0 };
|
|
11479
11468
|
}
|
|
11480
11469
|
if (items.length === 0) {
|
|
11481
11470
|
writeLine2(screen, rect, 0, state.emptyHint, styles.muted);
|
|
11482
|
-
return;
|
|
11471
|
+
return { start: 0, max: 0 };
|
|
11483
11472
|
}
|
|
11484
11473
|
if (items.length === 1 && items[0]?.title === void 0) {
|
|
11485
|
-
renderBlob(screen, rect, renderItemMarkdown(items[0], rect, row), state.detail.scroll);
|
|
11486
|
-
return;
|
|
11474
|
+
return renderBlob(screen, rect, renderItemMarkdown(items[0], rect, row), state.detail.scroll);
|
|
11487
11475
|
}
|
|
11488
|
-
renderListMode(state, screen, rect, items, row);
|
|
11476
|
+
return renderListMode(state, screen, rect, items, row);
|
|
11489
11477
|
}
|
|
11490
11478
|
function renderListMode(state, screen, rect, items, row) {
|
|
11491
11479
|
const styles = getExplorerStyles();
|
|
11492
11480
|
let y = 0;
|
|
11493
|
-
const
|
|
11481
|
+
const max = Math.max(0, items.length - 1);
|
|
11482
|
+
const start = clamp3(state.detail.scroll, 0, max);
|
|
11494
11483
|
for (let index = start; index < items.length && y < rect.height; index += 1) {
|
|
11495
11484
|
const item = items[index];
|
|
11496
11485
|
const cursor2 = index === state.detail.cursor;
|
|
@@ -11521,6 +11510,7 @@ function renderListMode(state, screen, rect, items, row) {
|
|
|
11521
11510
|
y += 1;
|
|
11522
11511
|
}
|
|
11523
11512
|
}
|
|
11513
|
+
return { start, max };
|
|
11524
11514
|
}
|
|
11525
11515
|
function renderBlob(screen, rect, text5, scroll) {
|
|
11526
11516
|
const allLines = [[]];
|
|
@@ -11528,7 +11518,8 @@ function renderBlob(screen, rect, text5, scroll) {
|
|
|
11528
11518
|
if (cell2.ch === "\n") allLines.push([]);
|
|
11529
11519
|
else allLines.at(-1).push(cell2);
|
|
11530
11520
|
}
|
|
11531
|
-
const
|
|
11521
|
+
const max = Math.max(0, allLines.length - rect.height);
|
|
11522
|
+
const start = clamp3(scroll, 0, max);
|
|
11532
11523
|
const lines = allLines.slice(start);
|
|
11533
11524
|
for (let row = 0; row < rect.height; row += 1) {
|
|
11534
11525
|
let x = rect.x;
|
|
@@ -11538,6 +11529,7 @@ function renderBlob(screen, rect, text5, scroll) {
|
|
|
11538
11529
|
x += cell2.width;
|
|
11539
11530
|
}
|
|
11540
11531
|
}
|
|
11532
|
+
return { start, max };
|
|
11541
11533
|
}
|
|
11542
11534
|
function renderItemMarkdown(item, rect, row) {
|
|
11543
11535
|
const content = renderItem(item, rect, row);
|
|
@@ -11577,11 +11569,9 @@ function writeLine2(screen, rect, row, text5, style = {}) {
|
|
|
11577
11569
|
function clamp3(value, min, max) {
|
|
11578
11570
|
return Math.min(max, Math.max(min, value));
|
|
11579
11571
|
}
|
|
11580
|
-
function scrollIndicator(state) {
|
|
11572
|
+
function scrollIndicator(state, start, max) {
|
|
11581
11573
|
if (state.detail.loading) return "\u280B";
|
|
11582
|
-
|
|
11583
|
-
const total2 = Math.max(1, content.split("\n").length);
|
|
11584
|
-
return `${Math.min(100, Math.round(state.detail.scroll / Math.max(1, total2 - 1) * 100))}%`;
|
|
11574
|
+
return `${max === 0 ? 0 : Math.round(start / max * 100)}%`;
|
|
11585
11575
|
}
|
|
11586
11576
|
function contentHash(content) {
|
|
11587
11577
|
let hash = 2166136261;
|
|
@@ -12949,7 +12939,7 @@ function detailContentLineCount(item) {
|
|
|
12949
12939
|
return (item.renderedContent ?? "").split("\n").length;
|
|
12950
12940
|
}
|
|
12951
12941
|
function detailBodyHeight(state) {
|
|
12952
|
-
if (state.layout === "too-narrow" || state.layout === "narrow-list-only") {
|
|
12942
|
+
if (state.layout === "too-narrow" || state.layout === "narrow-list-only" && state.focused !== "detail") {
|
|
12953
12943
|
return 0;
|
|
12954
12944
|
}
|
|
12955
12945
|
const rows = normalizeSize6(state.size.rows);
|
|
@@ -154221,7 +154211,7 @@ var init_package2 = __esm({
|
|
|
154221
154211
|
"package.json"() {
|
|
154222
154212
|
package_default2 = {
|
|
154223
154213
|
name: "poe-code",
|
|
154224
|
-
version: "5.0.
|
|
154214
|
+
version: "5.0.3",
|
|
154225
154215
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
154226
154216
|
license: "MIT",
|
|
154227
154217
|
type: "module",
|