@gzeoneth/gov-tracker 0.2.1-beta.03fa52b → 0.2.1-beta.11b2e86
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/README.md +18 -18
- package/dist/cli/cli.js +32 -0
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/tui/App.d.ts +11 -0
- package/dist/cli/tui/App.d.ts.map +1 -0
- package/dist/cli/tui/App.js +123 -0
- package/dist/cli/tui/App.js.map +1 -0
- package/dist/cli/tui/components/CopyableText.d.ts +23 -0
- package/dist/cli/tui/components/CopyableText.d.ts.map +1 -0
- package/dist/cli/tui/components/CopyableText.js +49 -0
- package/dist/cli/tui/components/CopyableText.js.map +1 -0
- package/dist/cli/tui/components/Header.d.ts +20 -0
- package/dist/cli/tui/components/Header.d.ts.map +1 -0
- package/dist/cli/tui/components/Header.js +47 -0
- package/dist/cli/tui/components/Header.js.map +1 -0
- package/dist/cli/tui/components/KeyHelp.d.ts +19 -0
- package/dist/cli/tui/components/KeyHelp.d.ts.map +1 -0
- package/dist/cli/tui/components/KeyHelp.js +60 -0
- package/dist/cli/tui/components/KeyHelp.js.map +1 -0
- package/dist/cli/tui/components/ProposalRow.d.ts +11 -0
- package/dist/cli/tui/components/ProposalRow.d.ts.map +1 -0
- package/dist/cli/tui/components/ProposalRow.js +92 -0
- package/dist/cli/tui/components/ProposalRow.js.map +1 -0
- package/dist/cli/tui/components/ScrollIndicator.d.ts +19 -0
- package/dist/cli/tui/components/ScrollIndicator.d.ts.map +1 -0
- package/dist/cli/tui/components/ScrollIndicator.js +50 -0
- package/dist/cli/tui/components/ScrollIndicator.js.map +1 -0
- package/dist/cli/tui/components/SearchBar.d.ts +12 -0
- package/dist/cli/tui/components/SearchBar.d.ts.map +1 -0
- package/dist/cli/tui/components/SearchBar.js +36 -0
- package/dist/cli/tui/components/SearchBar.js.map +1 -0
- package/dist/cli/tui/components/Spinner.d.ts +10 -0
- package/dist/cli/tui/components/Spinner.d.ts.map +1 -0
- package/dist/cli/tui/components/Spinner.js +24 -0
- package/dist/cli/tui/components/Spinner.js.map +1 -0
- package/dist/cli/tui/components/StageProgress.d.ts +12 -0
- package/dist/cli/tui/components/StageProgress.d.ts.map +1 -0
- package/dist/cli/tui/components/StageProgress.js +41 -0
- package/dist/cli/tui/components/StageProgress.js.map +1 -0
- package/dist/cli/tui/components/StageRow.d.ts +12 -0
- package/dist/cli/tui/components/StageRow.d.ts.map +1 -0
- package/dist/cli/tui/components/StageRow.js +80 -0
- package/dist/cli/tui/components/StageRow.js.map +1 -0
- package/dist/cli/tui/components/StatusBadge.d.ts +12 -0
- package/dist/cli/tui/components/StatusBadge.d.ts.map +1 -0
- package/dist/cli/tui/components/StatusBadge.js +27 -0
- package/dist/cli/tui/components/StatusBadge.js.map +1 -0
- package/dist/cli/tui/components/ViewLayout.d.ts +22 -0
- package/dist/cli/tui/components/ViewLayout.d.ts.map +1 -0
- package/dist/cli/tui/components/ViewLayout.js +24 -0
- package/dist/cli/tui/components/ViewLayout.js.map +1 -0
- package/dist/cli/tui/components/VotingStats.d.ts +11 -0
- package/dist/cli/tui/components/VotingStats.d.ts.map +1 -0
- package/dist/cli/tui/components/VotingStats.js +87 -0
- package/dist/cli/tui/components/VotingStats.js.map +1 -0
- package/dist/cli/tui/hooks/index.d.ts +11 -0
- package/dist/cli/tui/hooks/index.d.ts.map +1 -0
- package/dist/cli/tui/hooks/index.js +18 -0
- package/dist/cli/tui/hooks/index.js.map +1 -0
- package/dist/cli/tui/hooks/useCache.d.ts +12 -0
- package/dist/cli/tui/hooks/useCache.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useCache.js +52 -0
- package/dist/cli/tui/hooks/useCache.js.map +1 -0
- package/dist/cli/tui/hooks/useElectionData.d.ts +22 -0
- package/dist/cli/tui/hooks/useElectionData.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useElectionData.js +133 -0
- package/dist/cli/tui/hooks/useElectionData.js.map +1 -0
- package/dist/cli/tui/hooks/useNavigation.d.ts +39 -0
- package/dist/cli/tui/hooks/useNavigation.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useNavigation.js +173 -0
- package/dist/cli/tui/hooks/useNavigation.js.map +1 -0
- package/dist/cli/tui/hooks/useProposals.d.ts +10 -0
- package/dist/cli/tui/hooks/useProposals.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useProposals.js +201 -0
- package/dist/cli/tui/hooks/useProposals.js.map +1 -0
- package/dist/cli/tui/hooks/useScrollableInput.d.ts +14 -0
- package/dist/cli/tui/hooks/useScrollableInput.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useScrollableInput.js +44 -0
- package/dist/cli/tui/hooks/useScrollableInput.js.map +1 -0
- package/dist/cli/tui/hooks/useStageCalldata.d.ts +17 -0
- package/dist/cli/tui/hooks/useStageCalldata.d.ts.map +1 -0
- package/dist/cli/tui/hooks/useStageCalldata.js +77 -0
- package/dist/cli/tui/hooks/useStageCalldata.js.map +1 -0
- package/dist/cli/tui/index.d.ts +13 -0
- package/dist/cli/tui/index.d.ts.map +1 -0
- package/dist/cli/tui/index.js +96 -0
- package/dist/cli/tui/index.js.map +1 -0
- package/dist/cli/tui/ink-wrapper.d.ts +43 -0
- package/dist/cli/tui/ink-wrapper.d.ts.map +1 -0
- package/dist/cli/tui/ink-wrapper.js +41 -0
- package/dist/cli/tui/ink-wrapper.js.map +1 -0
- package/dist/cli/tui/types.d.ts +38 -0
- package/dist/cli/tui/types.d.ts.map +1 -0
- package/dist/cli/tui/types.js +6 -0
- package/dist/cli/tui/types.js.map +1 -0
- package/dist/cli/tui/utils/calldata-formatter.d.ts +7 -0
- package/dist/cli/tui/utils/calldata-formatter.d.ts.map +1 -0
- package/dist/cli/tui/utils/calldata-formatter.js +14 -0
- package/dist/cli/tui/utils/calldata-formatter.js.map +1 -0
- package/dist/cli/tui/utils/clipboard.d.ts +7 -0
- package/dist/cli/tui/utils/clipboard.d.ts.map +1 -0
- package/dist/cli/tui/utils/clipboard.js +46 -0
- package/dist/cli/tui/utils/clipboard.js.map +1 -0
- package/dist/cli/tui/utils/index.d.ts +16 -0
- package/dist/cli/tui/utils/index.d.ts.map +1 -0
- package/dist/cli/tui/utils/index.js +52 -0
- package/dist/cli/tui/utils/index.js.map +1 -0
- package/dist/cli/tui/utils/markdown-parser.d.ts +11 -0
- package/dist/cli/tui/utils/markdown-parser.d.ts.map +1 -0
- package/dist/cli/tui/utils/markdown-parser.js +77 -0
- package/dist/cli/tui/utils/markdown-parser.js.map +1 -0
- package/dist/cli/tui/utils/navigation.d.ts +17 -0
- package/dist/cli/tui/utils/navigation.d.ts.map +1 -0
- package/dist/cli/tui/utils/navigation.js +75 -0
- package/dist/cli/tui/utils/navigation.js.map +1 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.d.ts +9 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.d.ts.map +1 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.js +21 -0
- package/dist/cli/tui/utils/proposal-detail-helpers.js.map +1 -0
- package/dist/cli/tui/utils/shortcuts.d.ts +17 -0
- package/dist/cli/tui/utils/shortcuts.d.ts.map +1 -0
- package/dist/cli/tui/utils/shortcuts.js +100 -0
- package/dist/cli/tui/utils/shortcuts.js.map +1 -0
- package/dist/cli/tui/utils/stage-formatter.d.ts +7 -0
- package/dist/cli/tui/utils/stage-formatter.d.ts.map +1 -0
- package/dist/cli/tui/utils/stage-formatter.js +14 -0
- package/dist/cli/tui/utils/stage-formatter.js.map +1 -0
- package/dist/cli/tui/utils/stage-status.d.ts +10 -0
- package/dist/cli/tui/utils/stage-status.d.ts.map +1 -0
- package/dist/cli/tui/utils/stage-status.js +64 -0
- package/dist/cli/tui/utils/stage-status.js.map +1 -0
- package/dist/cli/tui/utils/terminal.d.ts +18 -0
- package/dist/cli/tui/utils/terminal.d.ts.map +1 -0
- package/dist/cli/tui/utils/terminal.js +26 -0
- package/dist/cli/tui/utils/terminal.js.map +1 -0
- package/dist/cli/tui/utils/text.d.ts +7 -0
- package/dist/cli/tui/utils/text.d.ts.map +1 -0
- package/dist/cli/tui/utils/text.js +12 -0
- package/dist/cli/tui/utils/text.js.map +1 -0
- package/dist/cli/tui/utils/time.d.ts +19 -0
- package/dist/cli/tui/utils/time.d.ts.map +1 -0
- package/dist/cli/tui/utils/time.js +43 -0
- package/dist/cli/tui/utils/time.js.map +1 -0
- package/dist/cli/tui/views/CalldataView.d.ts +12 -0
- package/dist/cli/tui/views/CalldataView.d.ts.map +1 -0
- package/dist/cli/tui/views/CalldataView.js +110 -0
- package/dist/cli/tui/views/CalldataView.js.map +1 -0
- package/dist/cli/tui/views/DescriptionView.d.ts +12 -0
- package/dist/cli/tui/views/DescriptionView.d.ts.map +1 -0
- package/dist/cli/tui/views/DescriptionView.js +75 -0
- package/dist/cli/tui/views/DescriptionView.js.map +1 -0
- package/dist/cli/tui/views/ElectionView.d.ts +11 -0
- package/dist/cli/tui/views/ElectionView.d.ts.map +1 -0
- package/dist/cli/tui/views/ElectionView.js +193 -0
- package/dist/cli/tui/views/ElectionView.js.map +1 -0
- package/dist/cli/tui/views/HelpView.d.ts +10 -0
- package/dist/cli/tui/views/HelpView.d.ts.map +1 -0
- package/dist/cli/tui/views/HelpView.js +75 -0
- package/dist/cli/tui/views/HelpView.js.map +1 -0
- package/dist/cli/tui/views/ProposalDetail.d.ts +12 -0
- package/dist/cli/tui/views/ProposalDetail.d.ts.map +1 -0
- package/dist/cli/tui/views/ProposalDetail.js +103 -0
- package/dist/cli/tui/views/ProposalDetail.js.map +1 -0
- package/dist/cli/tui/views/ProposalList.d.ts +15 -0
- package/dist/cli/tui/views/ProposalList.d.ts.map +1 -0
- package/dist/cli/tui/views/ProposalList.js +154 -0
- package/dist/cli/tui/views/ProposalList.js.map +1 -0
- package/dist/cli/tui/views/SimulationView.d.ts +12 -0
- package/dist/cli/tui/views/SimulationView.d.ts.map +1 -0
- package/dist/cli/tui/views/SimulationView.js +110 -0
- package/dist/cli/tui/views/SimulationView.js.map +1 -0
- package/dist/cli/tui/views/StageView.d.ts +12 -0
- package/dist/cli/tui/views/StageView.d.ts.map +1 -0
- package/dist/cli/tui/views/StageView.js +109 -0
- package/dist/cli/tui/views/StageView.js.map +1 -0
- package/dist/cli/tui/views/registry.d.ts +18 -0
- package/dist/cli/tui/views/registry.d.ts.map +1 -0
- package/dist/cli/tui/views/registry.js +34 -0
- package/dist/cli/tui/views/registry.js.map +1 -0
- package/dist/constants.d.ts +14 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +16 -11
- package/dist/constants.js.map +1 -1
- package/dist/data/bundled-cache.json +225 -225
- package/dist/election/status.d.ts.map +1 -1
- package/dist/election/status.js +4 -1
- package/dist/election/status.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tracker/checkpoint-helpers.d.ts +0 -1
- package/dist/tracker/checkpoint-helpers.d.ts.map +1 -1
- package/dist/tracker/checkpoint-helpers.js +1 -2
- package/dist/tracker/checkpoint-helpers.js.map +1 -1
- package/dist/types/election.d.ts +1 -1
- package/dist/types/election.d.ts.map +1 -1
- package/dist/utils/rpc-utils.d.ts.map +1 -1
- package/dist/utils/rpc-utils.js +2 -1
- package/dist/utils/rpc-utils.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TUI Module Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Interactive terminal UI for browsing governance proposals from cache.
|
|
6
|
+
* Requires: ink@3.x, react@17.x (CommonJS compatible versions)
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.runTui = runTui;
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const ink_wrapper_js_1 = require("./ink-wrapper.js");
|
|
45
|
+
function checkTtySupport() {
|
|
46
|
+
if (!process.stdin.isTTY) {
|
|
47
|
+
console.error("Error: TUI requires an interactive terminal (TTY).");
|
|
48
|
+
console.error("");
|
|
49
|
+
console.error("The TUI cannot run in:");
|
|
50
|
+
console.error(" - Piped input (e.g., echo 'q' | gov-tracker ui)");
|
|
51
|
+
console.error(" - CI/CD environments without TTY allocation");
|
|
52
|
+
console.error(" - Non-interactive shells");
|
|
53
|
+
console.error("");
|
|
54
|
+
console.error("For non-interactive use, try: gov-tracker status");
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function runTui(options) {
|
|
59
|
+
checkTtySupport();
|
|
60
|
+
(0, ink_wrapper_js_1.checkTuiDependencies)();
|
|
61
|
+
// Set up file logging if logFile is specified
|
|
62
|
+
let logStream = null;
|
|
63
|
+
let originalStderrWrite = null;
|
|
64
|
+
if (options.logFile) {
|
|
65
|
+
logStream = fs.createWriteStream(options.logFile, { flags: "a" });
|
|
66
|
+
logStream.write(`\n--- TUI Session Started: ${new Date().toISOString()} ---\n`);
|
|
67
|
+
// Redirect stderr (where debug writes) to file
|
|
68
|
+
originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
69
|
+
process.stderr.write = ((chunk) => {
|
|
70
|
+
// Write to log file
|
|
71
|
+
logStream?.write(chunk);
|
|
72
|
+
// Don't write debug output to terminal (it would corrupt TUI)
|
|
73
|
+
// Only return true to indicate successful write
|
|
74
|
+
return true;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const { App } = await Promise.resolve().then(() => __importStar(require("./App.js")));
|
|
78
|
+
try {
|
|
79
|
+
const { waitUntilExit } = (0, ink_wrapper_js_1.render)(ink_wrapper_js_1.React.createElement(App, {
|
|
80
|
+
cachePath: options.cachePath,
|
|
81
|
+
verbose: options.verbose,
|
|
82
|
+
}), { fullScreen: true });
|
|
83
|
+
await waitUntilExit();
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
// Restore stderr and close log file
|
|
87
|
+
if (originalStderrWrite) {
|
|
88
|
+
process.stderr.write = originalStderrWrite;
|
|
89
|
+
}
|
|
90
|
+
if (logStream) {
|
|
91
|
+
logStream.write(`--- TUI Session Ended: ${new Date().toISOString()} ---\n`);
|
|
92
|
+
logStream.end();
|
|
93
|
+
}
|
|
94
|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,CAAC,CAAC;QAEhF,+CAA+C;QAC/C,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChE,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAA0B,EAAE,EAAE;YACrD,oBAAoB;YACpB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YACxB,8DAA8D;YAC9D,gDAAgD;YAChD,OAAO,IAAI,CAAC;QACd,CAAC,CAAgC,CAAC;IACpC,CAAC;IAED,MAAM,EAAE,GAAG,EAAE,GAAG,wDAAa,UAAU,GAAC,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,uBAAM,EAC9B,sBAAK,CAAC,aAAa,CAAC,GAAG,EAAE;YACvB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,EACF,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;QAEF,MAAM,aAAa,EAAE,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,oCAAoC;QACpC,IAAI,mBAAmB,EAAE,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,mBAAmB,CAAC;QAC7C,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,CAAC,KAAK,CAAC,0BAA0B,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAC5E,SAAS,CAAC,GAAG,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ink wrapper to handle module resolution
|
|
3
|
+
*
|
|
4
|
+
* This module provides type-safe wrappers for ink components
|
|
5
|
+
* that work with the project's CommonJS module resolution.
|
|
6
|
+
*/
|
|
7
|
+
declare let React: any;
|
|
8
|
+
export declare function checkTuiDependencies(): void;
|
|
9
|
+
export { React };
|
|
10
|
+
export declare const useState: typeof import("react").useState;
|
|
11
|
+
export declare const useCallback: typeof import("react").useCallback;
|
|
12
|
+
export declare const useMemo: typeof import("react").useMemo;
|
|
13
|
+
export declare const useEffect: typeof import("react").useEffect;
|
|
14
|
+
export declare const render: any;
|
|
15
|
+
export declare const Box: any;
|
|
16
|
+
export declare const Text: any;
|
|
17
|
+
export declare const useInput: (callback: (input: string, key: KeyInput) => void, options?: {
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
}) => void;
|
|
20
|
+
export declare const useApp: () => {
|
|
21
|
+
exit: (error?: Error) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const useStdout: () => {
|
|
24
|
+
stdout: NodeJS.WriteStream;
|
|
25
|
+
write: (data: string) => void;
|
|
26
|
+
};
|
|
27
|
+
export interface KeyInput {
|
|
28
|
+
upArrow: boolean;
|
|
29
|
+
downArrow: boolean;
|
|
30
|
+
leftArrow: boolean;
|
|
31
|
+
rightArrow: boolean;
|
|
32
|
+
pageUp: boolean;
|
|
33
|
+
pageDown: boolean;
|
|
34
|
+
return: boolean;
|
|
35
|
+
escape: boolean;
|
|
36
|
+
tab: boolean;
|
|
37
|
+
backspace: boolean;
|
|
38
|
+
delete: boolean;
|
|
39
|
+
ctrl: boolean;
|
|
40
|
+
meta: boolean;
|
|
41
|
+
shift: boolean;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ink-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ink-wrapper.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/ink-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,QAAA,IAAI,KAAK,EAAE,GAAG,CAAC;AAWf,wBAAgB,oBAAoB,IAAI,IAAI,CAM3C;AAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,eAAO,MAAM,QAAQ,EAAsB,cAAc,OAAO,EAAE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}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Ink wrapper to handle module resolution
|
|
4
|
+
*
|
|
5
|
+
* This module provides type-safe wrappers for ink components
|
|
6
|
+
* that work with the project's CommonJS module resolution.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.useStdout = exports.useApp = exports.useInput = exports.Text = exports.Box = exports.render = exports.useEffect = exports.useMemo = exports.useCallback = exports.useState = exports.React = void 0;
|
|
10
|
+
exports.checkTuiDependencies = checkTuiDependencies;
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
let ink;
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
let React;
|
|
15
|
+
try {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
17
|
+
ink = require("ink");
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
19
|
+
exports.React = React = require("react");
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Dependencies loaded lazily - will be checked at runtime
|
|
23
|
+
}
|
|
24
|
+
function checkTuiDependencies() {
|
|
25
|
+
if (!ink || !React) {
|
|
26
|
+
console.error("Error: TUI requires 'ink' and 'react' packages.");
|
|
27
|
+
console.error("Install them with: yarn add ink@^3.2.0 react@^17.0.2");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.useState = React?.useState;
|
|
32
|
+
exports.useCallback = React?.useCallback;
|
|
33
|
+
exports.useMemo = React?.useMemo;
|
|
34
|
+
exports.useEffect = React?.useEffect;
|
|
35
|
+
exports.render = ink?.render;
|
|
36
|
+
exports.Box = ink?.Box;
|
|
37
|
+
exports.Text = ink?.Text;
|
|
38
|
+
exports.useInput = ink?.useInput;
|
|
39
|
+
exports.useApp = ink?.useApp;
|
|
40
|
+
exports.useStdout = ink?.useStdout;
|
|
41
|
+
//# sourceMappingURL=ink-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ink-wrapper.js","sourceRoot":"","sources":["../../../src/cli/tui/ink-wrapper.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAgBH,oDAMC;AApBD,8DAA8D;AAC9D,IAAI,GAAQ,CAAC;AACb,8DAA8D;AAC9D,IAAI,KAAU,CAAC;AAEf,IAAI,CAAC;IACH,iEAAiE;IACjE,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACrB,iEAAiE;IACjE,gBAAA,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAAC,MAAM,CAAC;IACP,0DAA0D;AAC5D,CAAC;AAED,SAAgB,oBAAoB;IAClC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACjE,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAGY,QAAA,QAAQ,GAAG,KAAK,EAAE,QAA2C,CAAC;AAC9D,QAAA,WAAW,GAAG,KAAK,EAAE,WAAiD,CAAC;AACvE,QAAA,OAAO,GAAG,KAAK,EAAE,OAAyC,CAAC;AAC3D,QAAA,SAAS,GAAG,KAAK,EAAE,SAA6C,CAAC;AACjE,QAAA,MAAM,GAAG,GAAG,EAAE,MAAM,CAAC;AACrB,QAAA,GAAG,GAAG,GAAG,EAAE,GAAG,CAAC;AACf,QAAA,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC;AACjB,QAAA,QAAQ,GAAG,GAAG,EAAE,QAGpB,CAAC;AACG,QAAA,MAAM,GAAG,GAAG,EAAE,MAAiD,CAAC;AAChE,QAAA,SAAS,GAAG,GAAG,EAAE,SAG7B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI-specific types
|
|
3
|
+
*/
|
|
4
|
+
import type { TrackingCheckpoint, TrackerStats, StageType } from "../../types/index.js";
|
|
5
|
+
export type ViewType = "list" | "detail" | "calldata" | "stage" | "simulation" | "description" | "election" | "help";
|
|
6
|
+
export type FilterType = "all" | "active" | "complete" | "timelocks";
|
|
7
|
+
export type SortType = "newest" | "oldest" | "progress" | "status";
|
|
8
|
+
export interface ProposalListItem {
|
|
9
|
+
key: string;
|
|
10
|
+
title: string;
|
|
11
|
+
type: "governor" | "timelock" | "election";
|
|
12
|
+
proposalType?: string;
|
|
13
|
+
status: "active" | "complete" | "failed";
|
|
14
|
+
stageProgress: string;
|
|
15
|
+
currentStage: StageType | null;
|
|
16
|
+
hasExecutable: boolean;
|
|
17
|
+
createdAt: number | null;
|
|
18
|
+
checkpoint: TrackingCheckpoint;
|
|
19
|
+
}
|
|
20
|
+
export interface NavigationState {
|
|
21
|
+
view: ViewType;
|
|
22
|
+
previousView: ViewType | null;
|
|
23
|
+
filter: FilterType;
|
|
24
|
+
sort: SortType;
|
|
25
|
+
selectedIndex: number;
|
|
26
|
+
selectedProposal: ProposalListItem | null;
|
|
27
|
+
selectedStageIndex: number;
|
|
28
|
+
calldataActionIndex: number;
|
|
29
|
+
scrollOffset: number;
|
|
30
|
+
searchQuery: string;
|
|
31
|
+
isSearching: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface CacheData {
|
|
34
|
+
checkpoints: Map<string, TrackingCheckpoint>;
|
|
35
|
+
elections: Map<number, TrackingCheckpoint>;
|
|
36
|
+
stats: TrackerStats;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB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AC,CAAC;IAC7C,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC3C,KAAK,EAAE,YAAY,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cli/tui/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calldata formatting utilities for TUI display
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from core SDK formatters for backward compatibility.
|
|
5
|
+
*/
|
|
6
|
+
export { type FormattedLine, formatDecodedCalldata, filterVisibleLines, getAllFoldableKeys, toggleFoldKey, } from "../../../utils/formatters.js";
|
|
7
|
+
//# sourceMappingURL=calldata-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calldata-formatter.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/calldata-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Calldata formatting utilities for TUI display
|
|
4
|
+
*
|
|
5
|
+
* Re-exports from core SDK formatters for backward compatibility.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.toggleFoldKey = exports.getAllFoldableKeys = exports.filterVisibleLines = exports.formatDecodedCalldata = void 0;
|
|
9
|
+
var formatters_js_1 = require("../../../utils/formatters.js");
|
|
10
|
+
Object.defineProperty(exports, "formatDecodedCalldata", { enumerable: true, get: function () { return formatters_js_1.formatDecodedCalldata; } });
|
|
11
|
+
Object.defineProperty(exports, "filterVisibleLines", { enumerable: true, get: function () { return formatters_js_1.filterVisibleLines; } });
|
|
12
|
+
Object.defineProperty(exports, "getAllFoldableKeys", { enumerable: true, get: function () { return formatters_js_1.getAllFoldableKeys; } });
|
|
13
|
+
Object.defineProperty(exports, "toggleFoldKey", { enumerable: true, get: function () { return formatters_js_1.toggleFoldKey; } });
|
|
14
|
+
//# sourceMappingURL=calldata-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calldata-formatter.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/calldata-formatter.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,8DAMsC;AAJpC,sHAAA,qBAAqB,OAAA;AACrB,mHAAA,kBAAkB,OAAA;AAClB,mHAAA,kBAAkB,OAAA;AAClB,8GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard utilities for TUI
|
|
3
|
+
* Uses native OS clipboard commands via safe execFile
|
|
4
|
+
*/
|
|
5
|
+
export declare function copyToClipboard(text: string): boolean;
|
|
6
|
+
export declare function formatForCopy(value: string, type: "hash" | "address" | "id"): string;
|
|
7
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/clipboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAuBrD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAUpF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Clipboard utilities for TUI
|
|
4
|
+
* Uses native OS clipboard commands via safe execFile
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.copyToClipboard = copyToClipboard;
|
|
8
|
+
exports.formatForCopy = formatForCopy;
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
function copyToClipboard(text) {
|
|
11
|
+
try {
|
|
12
|
+
const platform = process.platform;
|
|
13
|
+
if (platform === "darwin") {
|
|
14
|
+
(0, child_process_1.execFileSync)("pbcopy", [], { input: text });
|
|
15
|
+
}
|
|
16
|
+
else if (platform === "linux") {
|
|
17
|
+
// Try xclip first, then xsel
|
|
18
|
+
try {
|
|
19
|
+
(0, child_process_1.execFileSync)("xclip", ["-selection", "clipboard"], { input: text });
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
(0, child_process_1.execFileSync)("xsel", ["--clipboard", "--input"], { input: text });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (platform === "win32") {
|
|
26
|
+
(0, child_process_1.execFileSync)("clip", [], { input: text });
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function formatForCopy(value, type) {
|
|
38
|
+
// Remove any display formatting
|
|
39
|
+
const cleaned = value.replace(/\s+/g, "").trim();
|
|
40
|
+
// Ensure proper prefix for addresses and hashes
|
|
41
|
+
if ((type === "hash" || type === "address") && !cleaned.startsWith("0x")) {
|
|
42
|
+
return `0x${cleaned}`;
|
|
43
|
+
}
|
|
44
|
+
return cleaned;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=clipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/clipboard.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,0CAuBC;AAED,sCAUC;AArCD,iDAA6C;AAE7C,SAAgB,eAAe,CAAC,IAAY;I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CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { wrapText, truncate } from "./text.js";
|
|
2
|
+
export { getTerminalSize, getVisibleRows } from "./terminal.js";
|
|
3
|
+
export type { TerminalSize } from "./terminal.js";
|
|
4
|
+
export { copyToClipboard, formatForCopy } from "./clipboard.js";
|
|
5
|
+
export { formatDecodedCalldata, filterVisibleLines, getAllFoldableKeys, toggleFoldKey, } from "./calldata-formatter.js";
|
|
6
|
+
export type { FormattedLine } from "./calldata-formatter.js";
|
|
7
|
+
export { CHAIN_TO_CHAIN_ID, safeStringify, formatValue, formatStageData, } from "./stage-formatter.js";
|
|
8
|
+
export type { StageDataItem } from "./stage-formatter.js";
|
|
9
|
+
export { parseMarkdown } from "./markdown-parser.js";
|
|
10
|
+
export type { MarkdownLine, MarkdownLineType } from "./markdown-parser.js";
|
|
11
|
+
export { formatDate, getTxHash, getProposalIdDisplay, getStages, buildBreadcrumb, } from "./proposal-detail-helpers.js";
|
|
12
|
+
export { clamp, cycleArray, getNavigationAction, applyNavigation, parseProgress, SORT_LABELS, SORT_LABELS_SHORT, } from "./navigation.js";
|
|
13
|
+
export type { NavigationAction } from "./navigation.js";
|
|
14
|
+
export { STAGE_TYPES, getStatusIcon, getStatusColor, ELECTION_PHASE_COLORS, ELECTION_PHASE_ICONS, } from "./stage-status.js";
|
|
15
|
+
export { MS_PER_MINUTE, MS_PER_HOUR, MS_PER_DAY, formatDurationMs, formatElapsedMs, formatDurationSec, } from "./time.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,eAAe,GAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDurationSec = exports.formatElapsedMs = exports.formatDurationMs = exports.MS_PER_DAY = exports.MS_PER_HOUR = exports.MS_PER_MINUTE = exports.ELECTION_PHASE_ICONS = exports.ELECTION_PHASE_COLORS = exports.getStatusColor = exports.getStatusIcon = exports.STAGE_TYPES = exports.SORT_LABELS_SHORT = exports.SORT_LABELS = exports.parseProgress = exports.applyNavigation = exports.getNavigationAction = exports.cycleArray = exports.clamp = exports.buildBreadcrumb = exports.getStages = exports.getProposalIdDisplay = exports.getTxHash = exports.formatDate = exports.parseMarkdown = exports.formatStageData = exports.formatValue = exports.safeStringify = exports.CHAIN_TO_CHAIN_ID = exports.toggleFoldKey = exports.getAllFoldableKeys = exports.filterVisibleLines = exports.formatDecodedCalldata = exports.formatForCopy = exports.copyToClipboard = exports.getVisibleRows = exports.getTerminalSize = exports.truncate = exports.wrapText = void 0;
|
|
4
|
+
var text_js_1 = require("./text.js");
|
|
5
|
+
Object.defineProperty(exports, "wrapText", { enumerable: true, get: function () { return text_js_1.wrapText; } });
|
|
6
|
+
Object.defineProperty(exports, "truncate", { enumerable: true, get: function () { return text_js_1.truncate; } });
|
|
7
|
+
var terminal_js_1 = require("./terminal.js");
|
|
8
|
+
Object.defineProperty(exports, "getTerminalSize", { enumerable: true, get: function () { return terminal_js_1.getTerminalSize; } });
|
|
9
|
+
Object.defineProperty(exports, "getVisibleRows", { enumerable: true, get: function () { return terminal_js_1.getVisibleRows; } });
|
|
10
|
+
var clipboard_js_1 = require("./clipboard.js");
|
|
11
|
+
Object.defineProperty(exports, "copyToClipboard", { enumerable: true, get: function () { return clipboard_js_1.copyToClipboard; } });
|
|
12
|
+
Object.defineProperty(exports, "formatForCopy", { enumerable: true, get: function () { return clipboard_js_1.formatForCopy; } });
|
|
13
|
+
var calldata_formatter_js_1 = require("./calldata-formatter.js");
|
|
14
|
+
Object.defineProperty(exports, "formatDecodedCalldata", { enumerable: true, get: function () { return calldata_formatter_js_1.formatDecodedCalldata; } });
|
|
15
|
+
Object.defineProperty(exports, "filterVisibleLines", { enumerable: true, get: function () { return calldata_formatter_js_1.filterVisibleLines; } });
|
|
16
|
+
Object.defineProperty(exports, "getAllFoldableKeys", { enumerable: true, get: function () { return calldata_formatter_js_1.getAllFoldableKeys; } });
|
|
17
|
+
Object.defineProperty(exports, "toggleFoldKey", { enumerable: true, get: function () { return calldata_formatter_js_1.toggleFoldKey; } });
|
|
18
|
+
var stage_formatter_js_1 = require("./stage-formatter.js");
|
|
19
|
+
Object.defineProperty(exports, "CHAIN_TO_CHAIN_ID", { enumerable: true, get: function () { return stage_formatter_js_1.CHAIN_TO_CHAIN_ID; } });
|
|
20
|
+
Object.defineProperty(exports, "safeStringify", { enumerable: true, get: function () { return stage_formatter_js_1.safeStringify; } });
|
|
21
|
+
Object.defineProperty(exports, "formatValue", { enumerable: true, get: function () { return stage_formatter_js_1.formatValue; } });
|
|
22
|
+
Object.defineProperty(exports, "formatStageData", { enumerable: true, get: function () { return stage_formatter_js_1.formatStageData; } });
|
|
23
|
+
var markdown_parser_js_1 = require("./markdown-parser.js");
|
|
24
|
+
Object.defineProperty(exports, "parseMarkdown", { enumerable: true, get: function () { return markdown_parser_js_1.parseMarkdown; } });
|
|
25
|
+
var proposal_detail_helpers_js_1 = require("./proposal-detail-helpers.js");
|
|
26
|
+
Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return proposal_detail_helpers_js_1.formatDate; } });
|
|
27
|
+
Object.defineProperty(exports, "getTxHash", { enumerable: true, get: function () { return proposal_detail_helpers_js_1.getTxHash; } });
|
|
28
|
+
Object.defineProperty(exports, "getProposalIdDisplay", { enumerable: true, get: function () { return proposal_detail_helpers_js_1.getProposalIdDisplay; } });
|
|
29
|
+
Object.defineProperty(exports, "getStages", { enumerable: true, get: function () { return proposal_detail_helpers_js_1.getStages; } });
|
|
30
|
+
Object.defineProperty(exports, "buildBreadcrumb", { enumerable: true, get: function () { return proposal_detail_helpers_js_1.buildBreadcrumb; } });
|
|
31
|
+
var navigation_js_1 = require("./navigation.js");
|
|
32
|
+
Object.defineProperty(exports, "clamp", { enumerable: true, get: function () { return navigation_js_1.clamp; } });
|
|
33
|
+
Object.defineProperty(exports, "cycleArray", { enumerable: true, get: function () { return navigation_js_1.cycleArray; } });
|
|
34
|
+
Object.defineProperty(exports, "getNavigationAction", { enumerable: true, get: function () { return navigation_js_1.getNavigationAction; } });
|
|
35
|
+
Object.defineProperty(exports, "applyNavigation", { enumerable: true, get: function () { return navigation_js_1.applyNavigation; } });
|
|
36
|
+
Object.defineProperty(exports, "parseProgress", { enumerable: true, get: function () { return navigation_js_1.parseProgress; } });
|
|
37
|
+
Object.defineProperty(exports, "SORT_LABELS", { enumerable: true, get: function () { return navigation_js_1.SORT_LABELS; } });
|
|
38
|
+
Object.defineProperty(exports, "SORT_LABELS_SHORT", { enumerable: true, get: function () { return navigation_js_1.SORT_LABELS_SHORT; } });
|
|
39
|
+
var stage_status_js_1 = require("./stage-status.js");
|
|
40
|
+
Object.defineProperty(exports, "STAGE_TYPES", { enumerable: true, get: function () { return stage_status_js_1.STAGE_TYPES; } });
|
|
41
|
+
Object.defineProperty(exports, "getStatusIcon", { enumerable: true, get: function () { return stage_status_js_1.getStatusIcon; } });
|
|
42
|
+
Object.defineProperty(exports, "getStatusColor", { enumerable: true, get: function () { return stage_status_js_1.getStatusColor; } });
|
|
43
|
+
Object.defineProperty(exports, "ELECTION_PHASE_COLORS", { enumerable: true, get: function () { return stage_status_js_1.ELECTION_PHASE_COLORS; } });
|
|
44
|
+
Object.defineProperty(exports, "ELECTION_PHASE_ICONS", { enumerable: true, get: function () { return stage_status_js_1.ELECTION_PHASE_ICONS; } });
|
|
45
|
+
var time_js_1 = require("./time.js");
|
|
46
|
+
Object.defineProperty(exports, "MS_PER_MINUTE", { enumerable: true, get: function () { return time_js_1.MS_PER_MINUTE; } });
|
|
47
|
+
Object.defineProperty(exports, "MS_PER_HOUR", { enumerable: true, get: function () { return time_js_1.MS_PER_HOUR; } });
|
|
48
|
+
Object.defineProperty(exports, "MS_PER_DAY", { enumerable: true, get: function () { return time_js_1.MS_PER_DAY; } });
|
|
49
|
+
Object.defineProperty(exports, "formatDurationMs", { enumerable: true, get: function () { return time_js_1.formatDurationMs; } });
|
|
50
|
+
Object.defineProperty(exports, "formatElapsedMs", { enumerable: true, get: function () { return time_js_1.formatElapsedMs; } });
|
|
51
|
+
Object.defineProperty(exports, "formatDurationSec", { enumerable: true, get: function () { return time_js_1.formatDurationSec; } });
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/index.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAAtC,mGAAA,QAAQ,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAC3B,6CAAgE;AAAvD,8GAAA,eAAe,OAAA;AAAE,6GAAA,cAAc,OAAA;AAExC,+CAAgE;AAAvD,+GAAA,eAAe,OAAA;AAAE,6GAAA,aAAa,OAAA;AACvC,iEAKiC;AAJ/B,8HAAA,qBAAqB,OAAA;AACrB,2HAAA,kBAAkB,OAAA;AAClB,2HAAA,kBAAkB,OAAA;AAClB,sHAAA,aAAa,OAAA;AAGf,2DAK8B;AAJ5B,uHAAA,iBAAiB,OAAA;AACjB,mHAAA,aAAa,OAAA;AACb,iHAAA,WAAW,OAAA;AACX,qHAAA,eAAe,OAAA;AAGjB,2DAAqD;AAA5C,mHAAA,aAAa,OAAA;AAEtB,2EAMsC;AALpC,wHAAA,UAAU,OAAA;AACV,uHAAA,SAAS,OAAA;AACT,kIAAA,oBAAoB,OAAA;AACpB,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AAEjB,iDAQyB;AAPvB,sGAAA,KAAK,OAAA;AACL,2GAAA,UAAU,OAAA;AACV,oHAAA,mBAAmB,OAAA;AACnB,gHAAA,eAAe,OAAA;AACf,8GAAA,aAAa,OAAA;AACb,4GAAA,WAAW,OAAA;AACX,kHAAA,iBAAiB,OAAA;AAGnB,qDAM2B;AALzB,8GAAA,WAAW,OAAA;AACX,gHAAA,aAAa,OAAA;AACb,iHAAA,cAAc,OAAA;AACd,wHAAA,qBAAqB,OAAA;AACrB,uHAAA,oBAAoB,OAAA;AAEtB,qCAOmB;AANjB,wGAAA,aAAa,OAAA;AACb,sGAAA,WAAW,OAAA;AACX,qGAAA,UAAU,OAAA;AACV,2GAAA,gBAAgB,OAAA;AAChB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal markdown parsing for TUI display
|
|
3
|
+
*/
|
|
4
|
+
export type MarkdownLineType = "normal" | "h1" | "h2" | "h3" | "bullet" | "separator";
|
|
5
|
+
export interface MarkdownLine {
|
|
6
|
+
text: string;
|
|
7
|
+
type: MarkdownLineType;
|
|
8
|
+
indent: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseMarkdown(text: string, width: number): MarkdownLine[];
|
|
11
|
+
//# sourceMappingURL=markdown-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-parser.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/markdown-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AA4BD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,CAuDzE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal markdown parsing for TUI display
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseMarkdown = parseMarkdown;
|
|
7
|
+
function wrapText(text, width, type, indent, result) {
|
|
8
|
+
const safeWidth = Math.max(10, width);
|
|
9
|
+
const words = text.split(/\s+/);
|
|
10
|
+
let line = "";
|
|
11
|
+
let lineIndent = indent;
|
|
12
|
+
for (const word of words) {
|
|
13
|
+
if (!line) {
|
|
14
|
+
line = word;
|
|
15
|
+
}
|
|
16
|
+
else if (line.length + 1 + word.length <= safeWidth) {
|
|
17
|
+
line += " " + word;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
result.push({ text: line, type, indent: lineIndent });
|
|
21
|
+
line = word;
|
|
22
|
+
if (type === "bullet" && lineIndent === 2)
|
|
23
|
+
lineIndent = 4;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (line)
|
|
27
|
+
result.push({ text: line, type, indent: lineIndent });
|
|
28
|
+
}
|
|
29
|
+
function parseMarkdown(text, width) {
|
|
30
|
+
const result = [];
|
|
31
|
+
const safeWidth = Math.max(20, width);
|
|
32
|
+
for (const rawLine of text.split("\n")) {
|
|
33
|
+
const line = rawLine.trim();
|
|
34
|
+
if (!line) {
|
|
35
|
+
result.push({ text: "", type: "normal", indent: 0 });
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (/^[-*_]{3,}$/.test(line)) {
|
|
39
|
+
result.push({ text: "─".repeat(Math.min(safeWidth - 4, 60)), type: "separator", indent: 0 });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (line.startsWith("### ")) {
|
|
43
|
+
result.push({ text: line.slice(4), type: "h3", indent: 0 });
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (line.startsWith("## ")) {
|
|
47
|
+
result.push({ text: line.slice(3), type: "h2", indent: 0 });
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (line.startsWith("# ")) {
|
|
51
|
+
result.push({ text: line.slice(2), type: "h1", indent: 0 });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (/^[-*+] /.test(line)) {
|
|
55
|
+
wrapText(line.slice(2), safeWidth - 6, "bullet", 2, result);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const numMatch = line.match(/^(\d+)\. /);
|
|
59
|
+
if (numMatch) {
|
|
60
|
+
const content = line.slice(numMatch[0].length);
|
|
61
|
+
result.push({
|
|
62
|
+
text: `${numMatch[1]}. ${content.slice(0, safeWidth - 6)}`,
|
|
63
|
+
type: "bullet",
|
|
64
|
+
indent: 0,
|
|
65
|
+
});
|
|
66
|
+
if (content.length > safeWidth - 6)
|
|
67
|
+
wrapText(content.slice(safeWidth - 6), safeWidth - 6, "normal", 3, result);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (line.startsWith("```"))
|
|
71
|
+
continue;
|
|
72
|
+
const processed = line.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
73
|
+
wrapText(processed, safeWidth - 4, "normal", 0, result);
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=markdown-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../../../src/cli/tui/utils/markdown-parser.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAoCH,sCAuDC;AAjFD,SAAS,QAAQ,CACf,IAAY,EACZ,KAAa,EACb,IAAsB,EACtB,MAAc,EACd,MAAsB;IAEtB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,UAAU,GAAG,MAAM,CAAC;IAExB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAA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CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,EAAE;gBAC1D,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,CAAC;aACV,CAAC,CAAC;YACH,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,GAAG,CAAC;gBAChC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;YAC7E,SAAS;QACX,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,SAAS;QAErC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAC/D,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared navigation utilities for TUI views
|
|
3
|
+
*/
|
|
4
|
+
import type { KeyInput } from "../ink-wrapper.js";
|
|
5
|
+
import type { SortType } from "../types.js";
|
|
6
|
+
export type NavigationAction = "up" | "down" | "pageUp" | "pageDown" | "top" | "bottom" | null;
|
|
7
|
+
export declare const SORT_LABELS: Record<SortType, string>;
|
|
8
|
+
export declare const SORT_LABELS_SHORT: Record<SortType, string>;
|
|
9
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
10
|
+
export declare function getNavigationAction(input: string, key: KeyInput): NavigationAction;
|
|
11
|
+
export declare function applyNavigation(current: number, action: NavigationAction, max: number): number;
|
|
12
|
+
export declare function cycleArray<T>(array: readonly T[], current: T): T;
|
|
13
|
+
export declare function parseProgress(stageProgress: string): {
|
|
14
|
+
current: number;
|
|
15
|
+
total: number;
|
|
16
|
+
} | null;
|
|
17
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../src/cli/tui/utils/navigation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE/F,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAKhD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAKtD,CAAC;AAIF,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,gBAAgB,CAQlF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAiB9F;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAGhE;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAO9F"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared navigation utilities for TUI views
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SORT_LABELS_SHORT = exports.SORT_LABELS = void 0;
|
|
7
|
+
exports.clamp = clamp;
|
|
8
|
+
exports.getNavigationAction = getNavigationAction;
|
|
9
|
+
exports.applyNavigation = applyNavigation;
|
|
10
|
+
exports.cycleArray = cycleArray;
|
|
11
|
+
exports.parseProgress = parseProgress;
|
|
12
|
+
exports.SORT_LABELS = {
|
|
13
|
+
newest: "Newest",
|
|
14
|
+
oldest: "Oldest",
|
|
15
|
+
progress: "Progress",
|
|
16
|
+
status: "Status",
|
|
17
|
+
};
|
|
18
|
+
exports.SORT_LABELS_SHORT = {
|
|
19
|
+
newest: "↓New",
|
|
20
|
+
oldest: "↑Old",
|
|
21
|
+
progress: "↓Prog",
|
|
22
|
+
status: "Status",
|
|
23
|
+
};
|
|
24
|
+
const PAGE_SIZE = 10;
|
|
25
|
+
function clamp(value, min, max) {
|
|
26
|
+
return Math.max(min, Math.min(max, value));
|
|
27
|
+
}
|
|
28
|
+
function getNavigationAction(input, key) {
|
|
29
|
+
if (key.upArrow || input === "k")
|
|
30
|
+
return "up";
|
|
31
|
+
if (key.downArrow || input === "j")
|
|
32
|
+
return "down";
|
|
33
|
+
if (key.pageUp || (key.ctrl && input === "u"))
|
|
34
|
+
return "pageUp";
|
|
35
|
+
if (key.pageDown || (key.ctrl && input === "d"))
|
|
36
|
+
return "pageDown";
|
|
37
|
+
if (input === "g")
|
|
38
|
+
return "top";
|
|
39
|
+
if (input === "G")
|
|
40
|
+
return "bottom";
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function applyNavigation(current, action, max) {
|
|
44
|
+
switch (action) {
|
|
45
|
+
case "up":
|
|
46
|
+
return clamp(current - 1, 0, max);
|
|
47
|
+
case "down":
|
|
48
|
+
return clamp(current + 1, 0, max);
|
|
49
|
+
case "pageUp":
|
|
50
|
+
return clamp(current - PAGE_SIZE, 0, max);
|
|
51
|
+
case "pageDown":
|
|
52
|
+
return clamp(current + PAGE_SIZE, 0, max);
|
|
53
|
+
case "top":
|
|
54
|
+
return 0;
|
|
55
|
+
case "bottom":
|
|
56
|
+
return max;
|
|
57
|
+
default:
|
|
58
|
+
return current;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function cycleArray(array, current) {
|
|
62
|
+
const nextIndex = (array.indexOf(current) + 1) % array.length;
|
|
63
|
+
return array[nextIndex];
|
|
64
|
+
}
|
|
65
|
+
function parseProgress(stageProgress) {
|
|
66
|
+
const match = stageProgress.match(/(\d+)\/(\d+)/);
|
|
67
|
+
if (!match)
|
|
68
|
+
return null;
|
|
69
|
+
const current = parseInt(match[1], 10);
|
|
70
|
+
const total = parseInt(match[2], 10);
|
|
71
|
+
if (total <= 0 || current < 0)
|
|
72
|
+
return null;
|
|
73
|
+
return { current, total };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=navigation.js.map
|