recomposable 1.1.0 → 1.1.1

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/lib/state.js DELETED
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- const MODE = { LIST: 'LIST', LOGS: 'LOGS' };
4
-
5
- function createState(config) {
6
- return {
7
- mode: MODE.LIST,
8
- groups: [], // [{ file, label, services: string[], error: string|null }]
9
- flatList: [], // [{ groupIdx, serviceIdx, service, file }]
10
- cursor: 0,
11
- statuses: new Map(), // "file::service" -> { state, health }
12
- rebuilding: new Map(), // "file::service" -> childProcess
13
- restarting: new Map(), // "file::service" -> childProcess
14
- stopping: new Map(), // "file::service" -> childProcess
15
- starting: new Map(), // "file::service" -> childProcess
16
- containerStats: new Map(), // statusKey -> { cpuPercent, memUsageBytes }
17
- containerStatsHistory: new Map(), // statusKey -> { cpu: number[], mem: number[], idx, count }
18
- logChild: null,
19
- scrollOffset: 0,
20
- noCache: false,
21
- showBottomLogs: true,
22
- bottomLogLines: new Map(), // statusKey -> { action, service, lines: [] }
23
- bottomLogTails: new Map(), // statusKey -> childProcess (log tail after restart)
24
- selectedLogKey: null, // statusKey of cursor-selected container for log tailing
25
- logCounts: new Map(), // statusKey -> Map<pattern, count>
26
- logLines: [], // buffered log lines for full log view
27
- logScrollOffset: 0, // lines from bottom (0 = at bottom)
28
- logAutoScroll: true, // auto-scroll to bottom on new data
29
- logSearchQuery: '',
30
- logSearchActive: false, // true when typing search query
31
- logSearchMatches: [], // array of line indices
32
- logSearchMatchIdx: -1, // current match position
33
- bottomSearchQuery: '',
34
- bottomSearchActive: false, // true when typing search in bottom panel
35
- config,
36
- };
37
- }
38
-
39
- function statusKey(file, service) {
40
- return `${file}::${service}`;
41
- }
42
-
43
- function buildFlatList(groups) {
44
- const list = [];
45
- for (let gi = 0; gi < groups.length; gi++) {
46
- const g = groups[gi];
47
- for (let si = 0; si < g.services.length; si++) {
48
- list.push({ groupIdx: gi, serviceIdx: si, service: g.services[si], file: g.file });
49
- }
50
- }
51
- return list;
52
- }
53
-
54
- function moveCursor(state, delta) {
55
- if (state.flatList.length === 0) return;
56
- state.cursor = Math.max(0, Math.min(state.flatList.length - 1, state.cursor + delta));
57
- }
58
-
59
- function selectedEntry(state) {
60
- return state.flatList[state.cursor] || null;
61
- }
62
-
63
- module.exports = { MODE, createState, statusKey, buildFlatList, moveCursor, selectedEntry };