@nsshunt/stsui 1.10.10 → 1.10.12

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.
@@ -1,25 +1,13 @@
1
- var W = Object.defineProperty;
2
- var $ = (r, o, t) => o in r ? W(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
- var i = (r, o, t) => ($(r, typeof o != "symbol" ? o + "" : o, t), t), T = (r, o, t) => {
4
- if (!o.has(r))
5
- throw TypeError("Cannot " + t);
6
- };
7
- var h = (r, o, t) => (T(r, o, "read from private field"), t ? t.call(r) : o.get(r)), u = (r, o, t) => {
8
- if (o.has(r))
9
- throw TypeError("Cannot add the same private member more than once");
10
- o instanceof WeakSet ? o.add(r) : o.set(r, t);
11
- }, p = (r, o, t, e) => (T(r, o, "write to private field"), e ? e.call(r, t) : o.set(r, t), t);
12
- var f = (r, o, t) => (T(r, o, "access private method"), t);
13
- import w from "blessed";
1
+ import a from "blessed";
14
2
  import "colors";
15
- import { v4 as z } from "uuid";
16
- const F = {};
17
- class K {
3
+ import { v4 as y } from "uuid";
4
+ const C = {};
5
+ class k {
6
+ listb = null;
18
7
  // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }
19
- constructor(o, t) {
20
- i(this, "listb", null);
21
- const e = {
22
- parent: o,
8
+ constructor(t, s) {
9
+ const i = {
10
+ parent: t,
23
11
  left: 0,
24
12
  right: 0,
25
13
  height: 1,
@@ -43,19 +31,35 @@ class K {
43
31
  }
44
32
  }
45
33
  };
46
- t.top === !0 ? e.top = 0 : e.bottom = 0, e.commands = {}, t.menuitems.forEach((a) => {
47
- e.commands && (e.commands[a.text] = {
48
- keys: [a.key],
49
- callback: a.cb
34
+ s.top === !0 ? i.top = 0 : i.bottom = 0, i.commands = {}, s.menuitems.forEach((e) => {
35
+ i.commands && (i.commands[e.text] = {
36
+ keys: [e.key],
37
+ callback: e.cb
50
38
  });
51
- }), this.listb = w.listbar(e);
39
+ }), this.listb = a.listbar(i);
52
40
  }
53
41
  get listbar() {
54
42
  return this.listb;
55
43
  }
56
44
  }
57
- var l, C, k, S, U, D, R, I, B, b, x;
58
- class L extends F {
45
+ class H extends C {
46
+ //export class STSUIFrame {
47
+ uiBoxes = {};
48
+ // { box: <<blessed box>>, boxHeader: <<blessed box>> }
49
+ screen = null;
50
+ #t = 0;
51
+ // panel index with the complete model data.
52
+ #s = null;
53
+ screenHeaderText = "...";
54
+ minRows = 1;
55
+ minCols = 1;
56
+ minWidth = 40;
57
+ minHeight = 7;
58
+ #i = null;
59
+ sortInfo = null;
60
+ // Current sort mode UI box control
61
+ screenHeader = null;
62
+ uidata;
59
63
  /**
60
64
  *
61
65
  * @param {*} data The screen layout data. Schema: { title: <str>,
@@ -63,296 +67,284 @@ class L extends F {
63
67
  * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> },
64
68
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
65
69
  */
66
- constructor(t, e = null) {
67
- super();
68
- /**
69
- *
70
- * Setup all panels
71
- */
72
- u(this, I);
73
- u(this, b);
74
- i(this, "uiBoxes", {});
75
- // { box: <<blessed box>>, boxHeader: <<blessed box>> }
76
- i(this, "screen", null);
77
- u(this, l, 0);
78
- // panel index with the complete model data.
79
- u(this, C, null);
80
- i(this, "screenHeaderText", "...");
81
- i(this, "minRows", 1);
82
- i(this, "minCols", 1);
83
- i(this, "minWidth", 40);
84
- i(this, "minHeight", 7);
85
- u(this, k, null);
86
- i(this, "sortInfo", null);
87
- // Current sort mode UI box control
88
- i(this, "screenHeader", null);
89
- i(this, "uidata");
90
- /**
91
- *
92
- * @param {number} position The index (0 based) for the panel item to be calculated
93
- * @returns object with top, left, width and height correctly set
94
- */
95
- u(this, S, (t) => {
96
- if (!this.screen || !t.pos)
97
- return null;
98
- let e = this.screen.height;
99
- this.uidata.menu !== null && (e -= this.uidata.menu.length);
100
- const a = this.screen.width, s = this.uidata.grid.rows, d = this.uidata.grid.cols, c = t.pos, m = Math.floor(a / d), n = Math.floor(e / s);
101
- let v = 0;
102
- if (this.uidata.menu !== null) {
103
- for (const [, H] of Object.entries(this.uidata.menu))
104
- if (H.top === !0) {
105
- v = 1;
106
- break;
107
- }
70
+ constructor(t, s = null) {
71
+ super(), this.uidata = t, this.#s = s, this.SetupUI();
72
+ }
73
+ /**
74
+ *
75
+ * @param {number} position The index (0 based) for the panel item to be calculated
76
+ * @returns object with top, left, width and height correctly set
77
+ */
78
+ #o = (t) => {
79
+ if (!this.screen || !t.pos)
80
+ return null;
81
+ let s = this.screen.height;
82
+ this.uidata.menu !== null && (s -= this.uidata.menu.length);
83
+ const i = this.screen.width, e = this.uidata.grid.rows, r = this.uidata.grid.cols, n = t.pos, l = Math.floor(i / r), o = Math.floor(s / e);
84
+ let f = 0;
85
+ if (this.uidata.menu !== null) {
86
+ for (const [, c] of Object.entries(this.uidata.menu))
87
+ if (c.top === !0) {
88
+ f = 1;
89
+ break;
90
+ }
91
+ }
92
+ const d = {
93
+ top: n.row * o + f,
94
+ left: n.col * l,
95
+ width: l * n.colSpan,
96
+ height: o * n.rowSpan
97
+ };
98
+ return n.col + n.colSpan === r && (d.width = i - n.col * l), n.row + n.rowSpan === e && (d.height = s - n.row * o), d;
99
+ };
100
+ #n = (t, s) => {
101
+ const i = this.#o(t);
102
+ if (i && (s.box.top = i.top, s.box.left = i.left, s.box.width = i.width, s.box.height = i.height, s.boxHeader.top = i.top, s.boxHeader.left = i.left + 2, typeof t.widgets < "u" && t.widgets !== null)) {
103
+ for (const [, e] of Object.entries(t.widgets))
104
+ if (e.widget === "log") {
105
+ const r = s.box.get(e.widget);
106
+ r.position.top >= s.box.height - 4 ? r.position.top = s.box.height - 4 : e.options.top && (r.position.top = e.options.top);
107
+ }
108
+ }
109
+ };
110
+ /**
111
+ * ReSize the grid layout
112
+ */
113
+ #h = () => {
114
+ for (const [, t] of Object.entries(this.uiBoxes))
115
+ this.#n(t.box.get("panel"), t);
116
+ };
117
+ #a = (t, s, i, e) => {
118
+ t.pos = { row: s, col: i, rowSpan: 1, colSpan: 1 }, this.#n(t, e), e.boxHeader.setContent(t.panelHeader);
119
+ };
120
+ ClickEx(t) {
121
+ }
122
+ /**
123
+ *
124
+ * Setup all panels
125
+ */
126
+ #r() {
127
+ if (!this.screen)
128
+ return;
129
+ const t = Object.keys(this.uidata.panels), s = Object.keys(this.uiBoxes);
130
+ for (let e = 0; e < s.length; e++)
131
+ if (typeof this.uidata.panels[s[e]] > "u") {
132
+ let r = this.uiBoxes[s[e]];
133
+ typeof r < "u" && (this.screen.remove(r.boxHeader), this.screen.remove(r.box), r = null, delete this.uiBoxes[s[e]]);
108
134
  }
109
- const y = {
110
- top: c.row * n + v,
111
- left: c.col * m,
112
- width: m * c.colSpan,
113
- height: n * c.rowSpan
114
- };
115
- return c.col + c.colSpan === d && (y.width = a - c.col * m), c.row + c.rowSpan === s && (y.height = e - c.row * n), y;
116
- });
117
- u(this, U, (t, e) => {
118
- const a = h(this, S).call(this, t);
119
- if (a && (e.box.top = a.top, e.box.left = a.left, e.box.width = a.width, e.box.height = a.height, e.boxHeader.top = a.top, e.boxHeader.left = a.left + 2, typeof t.widgets < "u" && t.widgets !== null)) {
120
- for (const [, s] of Object.entries(t.widgets))
121
- if (s.widget === "log") {
122
- const d = e.box.get(s.widget);
123
- d.position.top >= e.box.height - 4 ? d.position.top = e.box.height - 4 : s.options.top && (d.position.top = s.options.top);
124
- }
135
+ const i = {};
136
+ for (let e = 0; e < this.uidata.grid.cols * this.uidata.grid.rows; e++) {
137
+ const r = this.#t + e, n = e % this.uidata.grid.cols, l = Math.floor(e / this.uidata.grid.cols), o = this.uidata.panels[t[r]];
138
+ if (typeof o < "u") {
139
+ if (typeof this.uiBoxes[o.id] > "u") {
140
+ if (o.pos = { row: l, col: n, rowSpan: 1, colSpan: 1 }, !this.#o(o))
141
+ return;
142
+ const { top: d, left: c, width: x, height: m } = this.#o(o), h = a.box({
143
+ parent: this.screen,
144
+ top: d,
145
+ left: c,
146
+ width: x,
147
+ height: m,
148
+ style: {
149
+ bg: "#101010",
150
+ fg: "white"
151
+ },
152
+ border: {
153
+ type: "line"
154
+ },
155
+ keys: !1,
156
+ // Do not allow default key handling for this box
157
+ tags: !0
158
+ // Allow style in-line tags such as bolt, italics, etc.
159
+ }), b = a.box({
160
+ parent: this.screen,
161
+ top: d,
162
+ left: c + 2,
163
+ width: "shrink",
164
+ height: 1,
165
+ style: {
166
+ bg: "gray",
167
+ fg: "white"
168
+ },
169
+ keys: !1,
170
+ // Do not allow default key handling for this box
171
+ mouse: !1,
172
+ content: o.panelHeader,
173
+ tags: !0
174
+ // Allow style in-line tags such as bolt, italics, etc.
175
+ });
176
+ if (this.uiBoxes[o.id] = { box: h, boxHeader: b }, b.setIndex(-1), h.on("click", () => {
177
+ this.ClickEx(h.get("panel"));
178
+ }), typeof o.widgets < "u" && o.widgets !== null)
179
+ for (const [, g] of Object.entries(o.widgets)) {
180
+ const u = { ...g.options };
181
+ u.top && u.top >= h.height - 3 && (u.top = h.height - 4);
182
+ const p = a[g.widget].call(this, u);
183
+ p.set("id", y()), h.append(p), h.set(g.widget, p);
184
+ }
185
+ h.set("panel", o), this.uiBoxes[o.id].box = h, i[o.id] = !0;
186
+ } else
187
+ this.#a(o, l, n, this.uiBoxes[o.id]), i[o.id] = !0;
188
+ this.#s && this.#s(this.uiBoxes[o.id].box, o);
125
189
  }
126
- });
127
- /**
128
- * ReSize the grid layout
129
- */
130
- u(this, D, () => {
131
- for (const [, t] of Object.entries(this.uiBoxes))
132
- h(this, U).call(this, t.box.get("panel"), t);
133
- });
134
- u(this, R, (t, e, a, s) => {
135
- t.pos = { row: e, col: a, rowSpan: 1, colSpan: 1 }, h(this, U).call(this, t, s), s.boxHeader.setContent(t.panelHeader);
136
- });
137
- // https://www.npmjs.com/package/blessed
138
- // data:= { title: <str>,
139
- // grid: { rows: <int>, cols: <int> },
140
- // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]
141
- // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }
142
- /**
143
- *
144
- * @param {*} data UI Data
145
- */
146
- i(this, "SetupUI", () => {
147
- if (this.DestroyUI(), this.screen === null && (this.screen = w.screen({
148
- smartCSR: !0
149
- })), !this.screen)
150
- return;
151
- const t = this.uidata;
152
- if (this.screen.title = t.title, this.screen.on("resize", () => {
153
- h(this, D).call(this), this.Render();
154
- }), t.menu !== null)
155
- for (let e = 0; e < t.menu.length; e++)
156
- new K(this.screen, t.menu[e]);
157
- this.screen.key(["C-c"], () => {
158
- this.DestroyUI(), this.emit("exit");
159
- }), this.screen.key(["escape"], () => {
160
- this.emit("escape");
161
- }), f(this, I, B).call(this), p(this, k, w.box({
162
- parent: this.screen,
163
- bottom: 0,
164
- right: 0,
165
- width: "shrink",
166
- height: 1,
167
- style: {
168
- bg: "gray",
169
- fg: "white"
170
- },
171
- keys: !1,
172
- // Do not allow default key handling for this box
173
- mouse: !1,
174
- content: "",
175
- tags: !0
176
- // Allow style in-line tags such as bolt, italics, etc.
177
- })), this.sortInfo = w.box({
178
- parent: this.screen,
179
- top: 0,
180
- right: 0,
181
- width: "shrink",
182
- height: 1,
183
- style: {
184
- bg: "gray",
185
- fg: "white"
186
- },
187
- keys: !1,
188
- // Do not allow default key handling for this box
189
- mouse: !1,
190
- content: "",
191
- tags: !0
192
- // Allow style in-line tags such as bolt, italics, etc.
193
- }), this.screenHeader = w.box({
194
- parent: this.screen,
195
- top: 0,
196
- left: "center",
197
- width: "shrink",
198
- height: 1,
199
- style: {
200
- bg: "gray",
201
- fg: "white"
202
- },
203
- keys: !1,
204
- // Do not allow default key handling for this box
205
- mouse: !1,
206
- content: "[ ... ]",
207
- tags: !0
208
- // Allow style in-line tags such as bolt, italics, etc.
209
- }), this.UpdateCursorInfo(), this.UpdateSortInfo("Default"), this.UpdateScreenHeader(this.screenHeaderText), this.Render();
210
- });
211
- i(this, "UpdateCursorInfo", () => {
212
- h(this, k) && h(this, k).setContent(`Cursor: ${h(this, l)} / ${this.TotalPanelNumber}`);
213
- });
214
- i(this, "UpdateSortInfo", (t) => {
215
- this.sortInfo && this.sortInfo.setContent(`Sort: ${t}`);
216
- });
217
- i(this, "UpdateScreenHeader", (t) => {
218
- this.screenHeaderText = t, this.screenHeader && this.screenHeader.setContent(`[ ${t} ]`);
219
- });
220
- i(this, "IncRows", () => {
221
- this.screen && this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight && (this.uidata.grid.rows++, this.CheckCursor(), f(this, b, x).call(this));
222
- });
223
- i(this, "DecRows", () => {
224
- this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), f(this, b, x).call(this));
225
- });
226
- i(this, "IncCols", () => {
227
- this.screen && this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth && (this.uidata.grid.cols++, this.CheckCursor(), f(this, b, x).call(this));
228
- });
229
- i(this, "DecCols", () => {
230
- this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), f(this, b, x).call(this));
231
- });
232
- i(this, "CheckCursor", () => {
233
- h(this, l) > this.TotalPanelNumber - this.ScreenCells && (p(this, l, this.TotalPanelNumber - this.ScreenCells), h(this, l) < 0 && p(this, l, 0)), this.UpdateCursorInfo();
234
- });
235
- i(this, "NextPage", () => {
236
- const t = this.TotalPanelNumber - this.ScreenCells;
237
- h(this, l) < t && (p(this, l, h(this, l) + this.ScreenCells), h(this, l) > t && p(this, l, t), f(this, b, x).call(this));
238
- });
239
- i(this, "PrevPage", () => {
240
- h(this, l) > 0 && (p(this, l, h(this, l) - this.ScreenCells), h(this, l) < 0 && p(this, l, 0), f(this, b, x).call(this));
241
- });
242
- i(this, "Exit", () => {
243
- this.DestroyUI(), this.emit("exit");
244
- });
245
- /**
246
- *
247
- */
248
- i(this, "DestroyUI", () => {
249
- this.screen !== null && (this.uiBoxes = {}, this.screen.destroy(), this.screen = null);
250
- });
251
- /**
252
- * Render the screen.
253
- */
254
- i(this, "Render", () => {
255
- this.screen && this.screen.render();
256
- });
257
- this.uidata = t, p(this, C, e), this.SetupUI();
190
+ }
191
+ for (const [e] of Object.entries(this.uiBoxes))
192
+ typeof i[e] > "u" ? (this.uiBoxes[e].box.hide(), this.uiBoxes[e].boxHeader.hide()) : (this.uiBoxes[e].box.show(), this.uiBoxes[e].boxHeader.show());
258
193
  }
259
194
  get gridData() {
260
195
  return this.uidata;
261
196
  }
262
197
  set gridData(t) {
263
- this.uidata = t, f(this, I, B).call(this), this.UpdateCursorInfo(), this.Render();
198
+ this.uidata = t, this.#r(), this.UpdateCursorInfo(), this.Render();
264
199
  }
265
200
  get gridDataPanels() {
266
201
  return this.uidata.panels;
267
202
  }
268
203
  set gridDataPanels(t) {
269
- this.uidata.panels = t, f(this, I, B).call(this), this.UpdateCursorInfo(), this.Render();
204
+ this.uidata.panels = t, this.#r(), this.UpdateCursorInfo(), this.Render();
270
205
  }
206
+ ExitEx() {
207
+ }
208
+ EscapeEx() {
209
+ }
210
+ // https://www.npmjs.com/package/blessed
211
+ // data:= { title: <str>,
212
+ // grid: { rows: <int>, cols: <int> },
213
+ // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]
214
+ // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }
215
+ /**
216
+ *
217
+ * @param {*} data UI Data
218
+ */
219
+ SetupUI = () => {
220
+ if (this.DestroyUI(), this.screen === null && (this.screen = a.screen({
221
+ smartCSR: !0
222
+ })), !this.screen)
223
+ return;
224
+ const t = this.uidata;
225
+ if (this.screen.title = t.title, this.screen.on("resize", () => {
226
+ this.#h(), this.Render();
227
+ }), t.menu !== null)
228
+ for (let s = 0; s < t.menu.length; s++)
229
+ new k(this.screen, t.menu[s]);
230
+ this.screen.key(["C-c"], () => {
231
+ this.DestroyUI(), this.ExitEx();
232
+ }), this.screen.key(["escape"], () => {
233
+ this.EscapeEx();
234
+ }), this.#r(), this.#i = a.box({
235
+ parent: this.screen,
236
+ bottom: 0,
237
+ right: 0,
238
+ width: "shrink",
239
+ height: 1,
240
+ style: {
241
+ bg: "gray",
242
+ fg: "white"
243
+ },
244
+ keys: !1,
245
+ // Do not allow default key handling for this box
246
+ mouse: !1,
247
+ content: "",
248
+ tags: !0
249
+ // Allow style in-line tags such as bolt, italics, etc.
250
+ }), this.sortInfo = a.box({
251
+ parent: this.screen,
252
+ top: 0,
253
+ right: 0,
254
+ width: "shrink",
255
+ height: 1,
256
+ style: {
257
+ bg: "gray",
258
+ fg: "white"
259
+ },
260
+ keys: !1,
261
+ // Do not allow default key handling for this box
262
+ mouse: !1,
263
+ content: "",
264
+ tags: !0
265
+ // Allow style in-line tags such as bolt, italics, etc.
266
+ }), this.screenHeader = a.box({
267
+ parent: this.screen,
268
+ top: 0,
269
+ left: "center",
270
+ width: "shrink",
271
+ height: 1,
272
+ style: {
273
+ bg: "gray",
274
+ fg: "white"
275
+ },
276
+ keys: !1,
277
+ // Do not allow default key handling for this box
278
+ mouse: !1,
279
+ content: "[ ... ]",
280
+ tags: !0
281
+ // Allow style in-line tags such as bolt, italics, etc.
282
+ }), this.UpdateCursorInfo(), this.UpdateSortInfo("Default"), this.UpdateScreenHeader(this.screenHeaderText), this.Render();
283
+ };
284
+ UpdateCursorInfo = () => {
285
+ this.#i && this.#i.setContent(`Cursor: ${this.#t} / ${this.TotalPanelNumber}`);
286
+ };
287
+ UpdateSortInfo = (t) => {
288
+ this.sortInfo && this.sortInfo.setContent(`Sort: ${t}`);
289
+ };
290
+ UpdateScreenHeader = (t) => {
291
+ this.screenHeaderText = t, this.screenHeader && this.screenHeader.setContent(`[ ${t} ]`);
292
+ };
271
293
  get rows() {
272
294
  return this.uidata.grid.rows;
273
295
  }
274
296
  get cols() {
275
297
  return this.uidata.grid.cols;
276
298
  }
299
+ IncRows = () => {
300
+ this.screen && this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight && (this.uidata.grid.rows++, this.CheckCursor(), this.#e());
301
+ };
302
+ DecRows = () => {
303
+ this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), this.#e());
304
+ };
305
+ IncCols = () => {
306
+ this.screen && this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth && (this.uidata.grid.cols++, this.CheckCursor(), this.#e());
307
+ };
308
+ DecCols = () => {
309
+ this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), this.#e());
310
+ };
277
311
  get ScreenCells() {
278
312
  return this.uidata.grid.cols * this.uidata.grid.rows;
279
313
  }
280
314
  get TotalPanelNumber() {
281
315
  return Object.keys(this.uidata.panels).length;
282
316
  }
283
- }
284
- l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U = new WeakMap(), D = new WeakMap(), R = new WeakMap(), I = new WeakSet(), B = function() {
285
- if (!this.screen)
286
- return;
287
- const t = Object.keys(this.uidata.panels), e = Object.keys(this.uiBoxes);
288
- for (let s = 0; s < e.length; s++)
289
- if (typeof this.uidata.panels[e[s]] > "u") {
290
- let d = this.uiBoxes[e[s]];
291
- typeof d < "u" && (this.screen.remove(d.boxHeader), this.screen.remove(d.box), d = null, delete this.uiBoxes[e[s]]);
292
- }
293
- const a = {};
294
- for (let s = 0; s < this.uidata.grid.cols * this.uidata.grid.rows; s++) {
295
- const d = h(this, l) + s, c = s % this.uidata.grid.cols, m = Math.floor(s / this.uidata.grid.cols), n = this.uidata.panels[t[d]];
296
- if (typeof n < "u") {
297
- if (typeof this.uiBoxes[n.id] > "u") {
298
- if (n.pos = { row: m, col: c, rowSpan: 1, colSpan: 1 }, !h(this, S).call(this, n))
299
- return;
300
- const { top: y, left: H, width: E, height: M } = h(this, S).call(this, n), g = w.box({
301
- parent: this.screen,
302
- top: y,
303
- left: H,
304
- width: E,
305
- height: M,
306
- style: {
307
- bg: "#101010",
308
- fg: "white"
309
- },
310
- border: {
311
- type: "line"
312
- },
313
- keys: !1,
314
- // Do not allow default key handling for this box
315
- tags: !0
316
- // Allow style in-line tags such as bolt, italics, etc.
317
- }), N = w.box({
318
- parent: this.screen,
319
- top: y,
320
- left: H + 2,
321
- width: "shrink",
322
- height: 1,
323
- style: {
324
- bg: "gray",
325
- fg: "white"
326
- },
327
- keys: !1,
328
- // Do not allow default key handling for this box
329
- mouse: !1,
330
- content: n.panelHeader,
331
- tags: !0
332
- // Allow style in-line tags such as bolt, italics, etc.
333
- });
334
- if (this.uiBoxes[n.id] = { box: g, boxHeader: N }, N.setIndex(-1), g.on("click", () => {
335
- this.emit("click", g.get("panel"));
336
- }), typeof n.widgets < "u" && n.widgets !== null)
337
- for (const [, j] of Object.entries(n.widgets)) {
338
- const P = { ...j.options };
339
- P.top && P.top >= g.height - 3 && (P.top = g.height - 4);
340
- const O = w[j.widget].call(this, P);
341
- O.set("id", z()), g.append(O), g.set(j.widget, O);
342
- }
343
- g.set("panel", n), this.uiBoxes[n.id].box = g, a[n.id] = !0;
344
- } else
345
- h(this, R).call(this, n, m, c, this.uiBoxes[n.id]), a[n.id] = !0;
346
- h(this, C) && h(this, C).call(this, this.uiBoxes[n.id].box, n);
347
- }
317
+ CheckCursor = () => {
318
+ this.#t > this.TotalPanelNumber - this.ScreenCells && (this.#t = this.TotalPanelNumber - this.ScreenCells, this.#t < 0 && (this.#t = 0)), this.UpdateCursorInfo();
319
+ };
320
+ NextPage = () => {
321
+ const t = this.TotalPanelNumber - this.ScreenCells;
322
+ this.#t < t && (this.#t += this.ScreenCells, this.#t > t && (this.#t = t), this.#e());
323
+ };
324
+ PrevPage = () => {
325
+ this.#t > 0 && (this.#t -= this.ScreenCells, this.#t < 0 && (this.#t = 0), this.#e());
326
+ };
327
+ #e() {
328
+ this.SetupUI();
348
329
  }
349
- for (const [s] of Object.entries(this.uiBoxes))
350
- typeof a[s] > "u" ? (this.uiBoxes[s].box.hide(), this.uiBoxes[s].boxHeader.hide()) : (this.uiBoxes[s].box.show(), this.uiBoxes[s].boxHeader.show());
351
- }, b = new WeakSet(), x = function() {
352
- this.SetupUI();
353
- };
330
+ Exit = () => {
331
+ this.DestroyUI(), this.ExitEx();
332
+ };
333
+ /**
334
+ *
335
+ */
336
+ DestroyUI = () => {
337
+ this.screen !== null && (this.uiBoxes = {}, this.screen.destroy(), this.screen = null);
338
+ };
339
+ /**
340
+ * Render the screen.
341
+ */
342
+ Render = () => {
343
+ this.screen && this.screen.render();
344
+ };
345
+ }
354
346
  export {
355
- K as MenuBar,
356
- L as STSUIFrame
347
+ k as MenuBar,
348
+ H as STSUIFrame
357
349
  };
358
350
  //# sourceMappingURL=stsconfig.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"stsconfig.mjs","sources":["../__vite-browser-external","../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["export default {}","import blessed from 'blessed';\nimport * as stsBlessed from './index'\n\nexport interface menuitem {\n\ttext: string,\n\tkey: string,\n\tcb(): void\n}\n\nexport interface MenuBarOptions {\n\ttop: boolean\n\tmenuitems: menuitem[]\n}\n\nexport class MenuBar\n{\n private listb:stsBlessed.listbar | null = null;\n\n // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }\n constructor(screen: stsBlessed.screen, options: MenuBarOptions) {\n const compoptions: stsBlessed.elementOptions = {\n parent: screen,\n left: 0,\n right: 0,\n height: 1,\n width: 'shrink',\n mouse: true,\n keys: true,\n autoCommandKeys: true,\n scrollable: true,\n style: {\n fg: 'yellow',\n bg: 'blue',\n\n item: {\n hover: {\n fg: 'white',\n bg: 'green',\n }\n },\n selected: {\n fg: 'black',\n bg: 'yellow',\n }\n }\n }\n if (options.top === true) {\n compoptions.top = 0;\n } else {\n compoptions.bottom = 0;\n }\n\n compoptions.commands = { };\n options.menuitems.forEach((menuItem) => {\n if (compoptions.commands) {\n compoptions.commands[menuItem.text] = {\n keys: [ menuItem.key ],\n callback: menuItem.cb\n }\n }\n })\n\n this.listb = blessed.listbar(compoptions);\n }\n\n get listbar()\n {\n return this.listb;\n }\n}\n","import EventEmitter from 'events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = { };\n\n for (let i=0; i < (this.uidata.grid.cols * this.uidata.grid.rows); i++) {\n const gridPos = this.#cursor + i;\n const col = i % this.uidata.grid.cols;\n const row = Math.floor(i / this.uidata.grid.cols);\n\n // Get the panel for this position within the grid\n const panel: panel = this.uidata.panels[panelKeys[gridPos]];\n if (typeof panel !== 'undefined') {\n if (typeof this.uiBoxes[panel.id] === 'undefined') {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n\n const calculatedBoxPos = this.#CalcBoxPos(panel);\n if (!calculatedBoxPos) {\n return\n }\n const { top, left, width, height } = this.#CalcBoxPos(panel) as boxPos;\n\n // Create the UI box\n const box: stsBlessed.box = blessed.box({\n parent: this.screen,\n top: top,\n left: left,\n width: width,\n height: height,\n style:\n {\n bg: '#101010' // was gray\n ,fg: 'white'\n },\n border:\n {\n type: 'line'\n },\n keys: false, // Do not allow default key handling for this box\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n const boxHeader: stsBlessed.listbar = blessed.box({\n parent: this.screen,\n top: top,\n left: left+2,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: panel.panelHeader,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.uiBoxes[panel.id] = { box: box, boxHeader: boxHeader };\n\n boxHeader.setIndex(-1);\n\n // https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback\n box.on('click', () => {\n //this.emit('click', box.data.panel);\n this.emit('click', box.get('panel') as panel);\n });\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n // Create a fresh copy of the options for this widget instance.\n // If this is not done, all widgets will use the same options object and will not be able\n // to update screen elements individually.\n const widgetoptions = {...value.options};\n\n // Ensure that we always show at least 2 lines of log data even if this means we position over the top of\n // elements above this position.\n if (widgetoptions.top && (widgetoptions.top >= (box.height - 3))) {\n widgetoptions.top = box.height - 4;\n }\n const widget: stsBlessed.element = blessed[value.widget].call(this, widgetoptions);\n widget.set('id', uuidv4());\n box.append(widget);\n box.set(value.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n }\n }\n\n // The entire panel is accessible using the _panel property.\n // This is so that the model is accessible from within the handlebars templates.\n // Access to a named widget can be done using box._panel.widgets[name] or box._panel.widgets.name\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(panel, row, col, this.uiBoxes[panel.id]);\n\n touched[panel.id] = true;\n //this.#uiBox[panel.id].box.show();\n }\n\n // Render the uiBox with the renderPanelFn using the panel as the utility including the model\n if (this.#renderPanelFn) {\n this.#renderPanelFn(this.uiBoxes[panel.id].box, panel);\n }\n }\n }\n\n for (const [key, ] of Object.entries(this.uiBoxes)) {\n if (typeof touched[key] === 'undefined') {\n this.uiBoxes[key].box.hide();\n this.uiBoxes[key].boxHeader.hide();\n } else {\n this.uiBoxes[key].box.show();\n this.uiBoxes[key].boxHeader.show();\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n this.emit('exit');\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n this.emit('escape');\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n this.emit('exit');\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n}\n"],"names":["EventEmitter","MenuBar","screen","options","__publicField","compoptions","menuItem","blessed","STSUIFrame","data","renderPanelFn","__privateAdd","_SetupPanels","_UpdateUI","_cursor","_renderPanelFn","_cursorInfo","_CalcBoxPos","panel","screenHeight","screenWidth","rows","cols","pos","colWidth","rowHeight","topoffset","value","boxPos","_UpdateUIBoxPos","uiBox","__privateGet","widget","_ReSize","_UpdatePanelPosition","row","col","i","MenuBar.MenuBar","__privateMethod","SetupPanels_fn","__privateSet","sortMode","screenHeaderText","UpdateUI_fn","endpos","gridData","gridDataPanels","panelKeys","uiBoxIds","touched","gridPos","top","left","width","height","box","boxHeader","widgetoptions","uuidv4","key"],"mappings":";;;;;;;;;;;;;;;AAAA,MAAeA,IAAA,CAAA;ACcR,MAAMC,EACb;AAAA;AAAA,EAII,YAAYC,GAA2BC,GAAyB;AAHxD,IAAAC,EAAA,eAAkC;AAItC,UAAMC,IAAyC;AAAA,MAC3C,QAAQH;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,OAAO;AAAA,QACH,IAAI;AAAA,QACJ,IAAI;AAAA,QAEJ,MAAM;AAAA,UACF,OAAO;AAAA,YACH,IAAI;AAAA,YACJ,IAAI;AAAA,UACR;AAAA,QACJ;AAAA,QACA,UAAU;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,QACR;AAAA,MACJ;AAAA,IAAA;AAEA,IAAAC,EAAQ,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AAA,CAAG,EAAAS,CAAK,KAAK,OAAO,QAAQT,EAAM,OAAO,GAAG;AAInD,kBAAMwC,IAAgB,EAAC,GAAG/B,EAAM,QAAO;AAIvC,YAAI+B,EAAc,OAAQA,EAAc,OAAQF,EAAI,SAAS,MAC3CE,EAAA,MAAMF,EAAI,SAAS;AAErC,kBAAMxB,IAA6BzB,EAAQoB,EAAM,MAAM,EAAE,KAAK,MAAM+B,CAAa;AAC1E,YAAA1B,EAAA,IAAI,MAAM2B,EAAQ,CAAA,GACzBH,EAAI,OAAOxB,CAAM,GACbwB,EAAA,IAAI7B,EAAM,QAAQK,CAAM;AAAA;AAOhC,QAAAwB,EAAA,IAAI,SAAStC,CAAK,GAEtB,KAAK,QAAQA,EAAM,EAAE,EAAE,MAAMsC,GAErBN,EAAAhC,EAAM,EAAE,IAAI;AAAA;AAIf,QAAAa,EAAA,MAAAG,GAAA,WAAqBhB,GAAOiB,GAAKC,GAAK,KAAK,QAAQlB,EAAM,EAAE,IAExDgC,EAAAhC,EAAM,EAAE,IAAI;AAKxB,MAAIa,EAAA,MAAKhB,MACLgB,EAAA,MAAKhB,GAAL,WAAoB,KAAK,QAAQG,EAAM,EAAE,EAAE,KAAKA;AAAA;AAAA;AAK5D,aAAW,CAAC0C,CAAK,KAAK,OAAO,QAAQ,KAAK,OAAO;AAC7C,IAAI,OAAOV,EAAQU,CAAG,IAAM,OACxB,KAAK,QAAQA,CAAG,EAAE,IAAI,KAAK,GAC3B,KAAK,QAAQA,CAAG,EAAE,UAAU,KAAK,MAEjC,KAAK,QAAQA,CAAG,EAAE,IAAI,KAAK,GAC3B,KAAK,QAAQA,CAAG,EAAE,UAAU,KAAK;AAI7C,GA2OA/C,IAAA,eAAA+B,IAAkB,WAAA;AACd,OAAK,QAAQ;AAMjB;"}
1
+ {"version":3,"file":"stsconfig.mjs","sources":["../__vite-browser-external","../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["export default {}","import blessed from 'blessed';\nimport * as stsBlessed from './index'\n\nexport interface menuitem {\n\ttext: string,\n\tkey: string,\n\tcb(): void\n}\n\nexport interface MenuBarOptions {\n\ttop: boolean\n\tmenuitems: menuitem[]\n}\n\nexport class MenuBar\n{\n private listb:stsBlessed.listbar | null = null;\n\n // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }\n constructor(screen: stsBlessed.screen, options: MenuBarOptions) {\n const compoptions: stsBlessed.elementOptions = {\n parent: screen,\n left: 0,\n right: 0,\n height: 1,\n width: 'shrink',\n mouse: true,\n keys: true,\n autoCommandKeys: true,\n scrollable: true,\n style: {\n fg: 'yellow',\n bg: 'blue',\n\n item: {\n hover: {\n fg: 'white',\n bg: 'green',\n }\n },\n selected: {\n fg: 'black',\n bg: 'yellow',\n }\n }\n }\n if (options.top === true) {\n compoptions.top = 0;\n } else {\n compoptions.bottom = 0;\n }\n\n compoptions.commands = { };\n options.menuitems.forEach((menuItem) => {\n if (compoptions.commands) {\n compoptions.commands[menuItem.text] = {\n keys: [ menuItem.key ],\n callback: menuItem.cb\n }\n }\n })\n\n this.listb = blessed.listbar(compoptions);\n }\n\n get listbar()\n {\n return this.listb;\n }\n}\n","import EventEmitter from 'events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\nimport { createPublicKey } from 'crypto';\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n//export class STSUIFrame {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = { };\n\n for (let i=0; i < (this.uidata.grid.cols * this.uidata.grid.rows); i++) {\n const gridPos = this.#cursor + i;\n const col = i % this.uidata.grid.cols;\n const row = Math.floor(i / this.uidata.grid.cols);\n\n // Get the panel for this position within the grid\n const panel: panel = this.uidata.panels[panelKeys[gridPos]];\n if (typeof panel !== 'undefined') {\n if (typeof this.uiBoxes[panel.id] === 'undefined') {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n\n const calculatedBoxPos = this.#CalcBoxPos(panel);\n if (!calculatedBoxPos) {\n return\n }\n const { top, left, width, height } = this.#CalcBoxPos(panel) as boxPos;\n\n // Create the UI box\n const box: stsBlessed.box = blessed.box({\n parent: this.screen,\n top: top,\n left: left,\n width: width,\n height: height,\n style:\n {\n bg: '#101010' // was gray\n ,fg: 'white'\n },\n border:\n {\n type: 'line'\n },\n keys: false, // Do not allow default key handling for this box\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n const boxHeader: stsBlessed.listbar = blessed.box({\n parent: this.screen,\n top: top,\n left: left+2,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: panel.panelHeader,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.uiBoxes[panel.id] = { box: box, boxHeader: boxHeader };\n\n boxHeader.setIndex(-1);\n\n // https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback\n box.on('click', () => {\n //this.emit('click', box.data.panel);\n //this.emit('click', box.get('panel') as panel);\n this.ClickEx(box.get('panel') as panel);\n });\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n // Create a fresh copy of the options for this widget instance.\n // If this is not done, all widgets will use the same options object and will not be able\n // to update screen elements individually.\n const widgetoptions = {...value.options};\n\n // Ensure that we always show at least 2 lines of log data even if this means we position over the top of\n // elements above this position.\n if (widgetoptions.top && (widgetoptions.top >= (box.height - 3))) {\n widgetoptions.top = box.height - 4;\n }\n const widget: stsBlessed.element = blessed[value.widget].call(this, widgetoptions);\n widget.set('id', uuidv4());\n box.append(widget);\n box.set(value.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n }\n }\n\n // The entire panel is accessible using the _panel property.\n // This is so that the model is accessible from within the handlebars templates.\n // Access to a named widget can be done using box._panel.widgets[name] or box._panel.widgets.name\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(panel, row, col, this.uiBoxes[panel.id]);\n\n touched[panel.id] = true;\n //this.#uiBox[panel.id].box.show();\n }\n\n // Render the uiBox with the renderPanelFn using the panel as the utility including the model\n if (this.#renderPanelFn) {\n this.#renderPanelFn(this.uiBoxes[panel.id].box, panel);\n }\n }\n }\n\n for (const [key, ] of Object.entries(this.uiBoxes)) {\n if (typeof touched[key] === 'undefined') {\n this.uiBoxes[key].box.hide();\n this.uiBoxes[key].boxHeader.hide();\n } else {\n this.uiBoxes[key].box.show();\n this.uiBoxes[key].boxHeader.show();\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n //this.emit('escape');\n this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n}\n"],"names":["EventEmitter","MenuBar","screen","options","compoptions","menuItem","blessed","STSUIFrame","#cursor","#renderPanelFn","#cursorInfo","data","renderPanelFn","#CalcBoxPos","panel","screenHeight","screenWidth","rows","cols","pos","colWidth","rowHeight","topoffset","value","boxPos","#UpdateUIBoxPos","uiBox","widget","#ReSize","#UpdatePanelPosition","row","col","#SetupPanels","panelKeys","uiBoxIds","i","touched","gridPos","top","left","width","height","box","boxHeader","widgetoptions","uuidv4","key","gridData","gridDataPanels","MenuBar.MenuBar","sortMode","screenHeaderText","#UpdateUI","endpos"],"mappings":";;;AAAA,MAAeA,IAAA,CAAA;ACcR,MAAMC,EACb;AAAA,EACY,QAAkC;AAAA;AAAA,EAG1C,YAAYC,GAA2BC,GAAyB;AAC5D,UAAMC,IAAyC;AAAA,MAC3C,QAAQF;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,OAAO;AAAA,QACH,IAAI;AAAA,QACJ,IAAI;AAAA,QAEJ,MAAM;AAAA,UACF,OAAO;AAAA,YACH,IAAI;AAAA,YACJ,IAAI;AAAA,UACR;AAAA,QACJ;AAAA,QACA,UAAU;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,QACR;AAAA,MACJ;AAAA,IAAA;AAEA,IAAAC,EAAQ,QAAQ,KAChBC,EAAY,MAAM,IAElBA,EAAY,SAAS,GAGzBA,EAAY,WAAW,IACfD,EAAA,UAAU,QAAQ,CAACE,MAAa;AACpC,MAAID,EAAY,aACAA,EAAA,SAASC,EAAS,IAAI,IAAI;AAAA,QAClC,MAAM,CAAEA,EAAS,GAAI;AAAA,QACrB,UAAUA,EAAS;AAAA,MAAA;AAAA,IAE3B,CACH,GAEI,KAAA,QAAQC,EAAQ,QAAQF,CAAW;AAAA,EAC5C;AAAA,EAEA,IAAI,UACJ;AACI,WAAO,KAAK;AAAA,EAChB;AACJ;ACCO,MAAMG,UAAmBP,EAAa;AAAA;AAAA,EAEjC,UAAkB,CAAA;AAAA;AAAA,EAClB,SAAmC;A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,WAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK;AAAA,EACpD;AAAA,EAEA,IAAI,mBAA2B;AAC3B,WAAO,OAAO,KAAK,KAAK,OAAO,MAAM,EAAE;AAAA,EAC3C;AAAA,EAEA,cAAc,MAAY;AACtB,IAAI,KAAK5C,KAAW,KAAK,mBAAmB,KAAK,gBACxC,KAAAA,KAAU,KAAK,mBAAmB,KAAK,aACxC,KAAKA,KAAU,MACf,KAAKA,KAAU,KAGvB,KAAK,iBAAiB;AAAA,EAAA;AAAA,EAG1B,WAAW,MAAY;AACb,UAAA6C,IAAS,KAAK,mBAAmB,KAAK;AACxC,IAAA,KAAK7C,KAAU6C,MACf,KAAK7C,MAAW,KAAK,aACjB,KAAKA,KAAU6C,MACf,KAAK7C,KAAU6C,IAEnB,KAAKD,GAAU;AAAA,EACnB;AAAA,EAGJ,WAAW,MAAY;AACf,IAAA,KAAK5C,KAAU,MACf,KAAKA,MAAW,KAAK,aACjB,KAAKA,KAAU,MACf,KAAKA,KAAU,IAEnB,KAAK4C,GAAU;AAAA,EACnB;AAAA,EAGJA,KAAkB;AACd,SAAK,QAAQ;AAAA,EAMjB;AAAA,EAEA,OAAO,MAAY;AACf,SAAK,UAAU,GAEf,KAAK,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,YAAY,MAAY;AAEhB,IAAA,KAAK,WAAW,SAChB,KAAK,UAAU,IACf,KAAK,OAAO,WACZ,KAAK,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAMJ,SAAS,MAAY;AACjB,IAAI,KAAK,UACL,KAAK,OAAO;EAChB;AAER;"}
@@ -1,2 +1,2 @@
1
- (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("blessed"),require("colors"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","blessed","colors","uuid"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["@nsshunt/stsconfig"]={},i.blessed,null,i.uuid))})(this,function(i,e,l,H){var d,m,y,C,U,P,B,S,D,p,x;"use strict";var A=Object.defineProperty;var G=(i,e,l)=>e in i?A(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l;var r=(i,e,l)=>(G(i,typeof e!="symbol"?e+"":e,l),l),M=(i,e,l)=>{if(!e.has(i))throw TypeError("Cannot "+l)};var h=(i,e,l)=>(M(i,e,"read from private field"),l?l.call(i):e.get(i)),f=(i,e,l)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,l)},w=(i,e,l,H)=>(M(i,e,"write to private field"),H?H.call(i,l):e.set(i,l),l);var g=(i,e,l)=>(M(i,e,"access private method"),l);const $={};class N{constructor(E,t){r(this,"listb",null);const s={parent:E,left:0,right:0,height:1,width:"shrink",mouse:!0,keys:!0,autoCommandKeys:!0,scrollable:!0,style:{fg:"yellow",bg:"blue",item:{hover:{fg:"white",bg:"green"}},selected:{fg:"black",bg:"yellow"}}};t.top===!0?s.top=0:s.bottom=0,s.commands={},t.menuitems.forEach(a=>{s.commands&&(s.commands[a.text]={keys:[a.key],callback:a.cb})}),this.listb=e.listbar(s)}get listbar(){return this.listb}}class q extends ${constructor(t,s=null){super();f(this,S);f(this,p);r(this,"uiBoxes",{});r(this,"screen",null);f(this,d,0);f(this,m,null);r(this,"screenHeaderText","...");r(this,"minRows",1);r(this,"minCols",1);r(this,"minWidth",40);r(this,"minHeight",7);f(this,y,null);r(this,"sortInfo",null);r(this,"screenHeader",null);r(this,"uidata");f(this,C,t=>{if(!this.screen||!t.pos)return null;let s=this.screen.height;this.uidata.menu!==null&&(s-=this.uidata.menu.length);const a=this.screen.width,o=this.uidata.grid.rows,u=this.uidata.grid.cols,c=t.pos,k=Math.floor(a/u),n=Math.floor(s/o);let R=0;if(this.uidata.menu!==null){for(const[,T]of Object.entries(this.uidata.menu))if(T.top===!0){R=1;break}}const I={top:c.row*n+R,left:c.col*k,width:k*c.colSpan,height:n*c.rowSpan};return c.col+c.colSpan===u&&(I.width=a-c.col*k),c.row+c.rowSpan===o&&(I.height=s-c.row*n),I});f(this,U,(t,s)=>{const a=h(this,C).call(this,t);if(a&&(s.box.top=a.top,s.box.left=a.left,s.box.width=a.width,s.box.height=a.height,s.boxHeader.top=a.top,s.boxHeader.left=a.left+2,typeof t.widgets<"u"&&t.widgets!==null)){for(const[,o]of Object.entries(t.widgets))if(o.widget==="log"){const u=s.box.get(o.widget);u.position.top>=s.box.height-4?u.position.top=s.box.height-4:o.options.top&&(u.position.top=o.options.top)}}});f(this,P,()=>{for(const[,t]of Object.entries(this.uiBoxes))h(this,U).call(this,t.box.get("panel"),t)});f(this,B,(t,s,a,o)=>{t.pos={row:s,col:a,rowSpan:1,colSpan:1},h(this,U).call(this,t,o),o.boxHeader.setContent(t.panelHeader)});r(this,"SetupUI",()=>{if(this.DestroyUI(),this.screen===null&&(this.screen=e.screen({smartCSR:!0})),!this.screen)return;const t=this.uidata;if(this.screen.title=t.title,this.screen.on("resize",()=>{h(this,P).call(this),this.Render()}),t.menu!==null)for(let s=0;s<t.menu.length;s++)new N(this.screen,t.menu[s]);this.screen.key(["C-c"],()=>{this.DestroyUI(),this.emit("exit")}),this.screen.key(["escape"],()=>{this.emit("escape")}),g(this,S,D).call(this),w(this,y,e.box({parent:this.screen,bottom:0,right:0,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:"",tags:!0})),this.sortInfo=e.box({parent:this.screen,top:0,right:0,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:"",tags:!0}),this.screenHeader=e.box({parent:this.screen,top:0,left:"center",width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:"[ ... ]",tags:!0}),this.UpdateCursorInfo(),this.UpdateSortInfo("Default"),this.UpdateScreenHeader(this.screenHeaderText),this.Render()});r(this,"UpdateCursorInfo",()=>{h(this,y)&&h(this,y).setContent(`Cursor: ${h(this,d)} / ${this.TotalPanelNumber}`)});r(this,"UpdateSortInfo",t=>{this.sortInfo&&this.sortInfo.setContent(`Sort: ${t}`)});r(this,"UpdateScreenHeader",t=>{this.screenHeaderText=t,this.screenHeader&&this.screenHeader.setContent(`[ ${t} ]`)});r(this,"IncRows",()=>{this.screen&&this.screen.height/(this.uidata.grid.rows+1)>this.minHeight&&(this.uidata.grid.rows++,this.CheckCursor(),g(this,p,x).call(this))});r(this,"DecRows",()=>{this.uidata.grid.rows>this.minRows&&(this.uidata.grid.rows--,this.CheckCursor(),g(this,p,x).call(this))});r(this,"IncCols",()=>{this.screen&&this.screen.width/(this.uidata.grid.cols+1)>this.minWidth&&(this.uidata.grid.cols++,this.CheckCursor(),g(this,p,x).call(this))});r(this,"DecCols",()=>{this.uidata.grid.cols>this.minCols&&(this.uidata.grid.cols--,this.CheckCursor(),g(this,p,x).call(this))});r(this,"CheckCursor",()=>{h(this,d)>this.TotalPanelNumber-this.ScreenCells&&(w(this,d,this.TotalPanelNumber-this.ScreenCells),h(this,d)<0&&w(this,d,0)),this.UpdateCursorInfo()});r(this,"NextPage",()=>{const t=this.TotalPanelNumber-this.ScreenCells;h(this,d)<t&&(w(this,d,h(this,d)+this.ScreenCells),h(this,d)>t&&w(this,d,t),g(this,p,x).call(this))});r(this,"PrevPage",()=>{h(this,d)>0&&(w(this,d,h(this,d)-this.ScreenCells),h(this,d)<0&&w(this,d,0),g(this,p,x).call(this))});r(this,"Exit",()=>{this.DestroyUI(),this.emit("exit")});r(this,"DestroyUI",()=>{this.screen!==null&&(this.uiBoxes={},this.screen.destroy(),this.screen=null)});r(this,"Render",()=>{this.screen&&this.screen.render()});this.uidata=t,w(this,m,s),this.SetupUI()}get gridData(){return this.uidata}set gridData(t){this.uidata=t,g(this,S,D).call(this),this.UpdateCursorInfo(),this.Render()}get gridDataPanels(){return this.uidata.panels}set gridDataPanels(t){this.uidata.panels=t,g(this,S,D).call(this),this.UpdateCursorInfo(),this.Render()}get rows(){return this.uidata.grid.rows}get cols(){return this.uidata.grid.cols}get ScreenCells(){return this.uidata.grid.cols*this.uidata.grid.rows}get TotalPanelNumber(){return Object.keys(this.uidata.panels).length}}d=new WeakMap,m=new WeakMap,y=new WeakMap,C=new WeakMap,U=new WeakMap,P=new WeakMap,B=new WeakMap,S=new WeakSet,D=function(){if(!this.screen)return;const t=Object.keys(this.uidata.panels),s=Object.keys(this.uiBoxes);for(let o=0;o<s.length;o++)if(typeof this.uidata.panels[s[o]]>"u"){let u=this.uiBoxes[s[o]];typeof u<"u"&&(this.screen.remove(u.boxHeader),this.screen.remove(u.box),u=null,delete this.uiBoxes[s[o]])}const a={};for(let o=0;o<this.uidata.grid.cols*this.uidata.grid.rows;o++){const u=h(this,d)+o,c=o%this.uidata.grid.cols,k=Math.floor(o/this.uidata.grid.cols),n=this.uidata.panels[t[u]];if(typeof n<"u"){if(typeof this.uiBoxes[n.id]>"u"){if(n.pos={row:k,col:c,rowSpan:1,colSpan:1},!h(this,C).call(this,n))return;const{top:I,left:T,width:z,height:K}=h(this,C).call(this,n),b=e.box({parent:this.screen,top:I,left:T,width:z,height:K,style:{bg:"#101010",fg:"white"},border:{type:"line"},keys:!1,tags:!0}),W=e.box({parent:this.screen,top:I,left:T+2,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:n.panelHeader,tags:!0});if(this.uiBoxes[n.id]={box:b,boxHeader:W},W.setIndex(-1),b.on("click",()=>{this.emit("click",b.get("panel"))}),typeof n.widgets<"u"&&n.widgets!==null)for(const[,j]of Object.entries(n.widgets)){const v={...j.options};v.top&&v.top>=b.height-3&&(v.top=b.height-4);const O=e[j.widget].call(this,v);O.set("id",H.v4()),b.append(O),b.set(j.widget,O)}b.set("panel",n),this.uiBoxes[n.id].box=b,a[n.id]=!0}else h(this,B).call(this,n,k,c,this.uiBoxes[n.id]),a[n.id]=!0;h(this,m)&&h(this,m).call(this,this.uiBoxes[n.id].box,n)}}for(const[o]of Object.entries(this.uiBoxes))typeof a[o]>"u"?(this.uiBoxes[o].box.hide(),this.uiBoxes[o].boxHeader.hide()):(this.uiBoxes[o].box.show(),this.uiBoxes[o].boxHeader.show())},p=new WeakSet,x=function(){this.SetupUI()},i.MenuBar=N,i.STSUIFrame=q,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(a,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("blessed"),require("colors"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","blessed","colors","uuid"],h):(a=typeof globalThis<"u"?globalThis:a||self,h(a["@nsshunt/stsconfig"]={},a.blessed,null,a.uuid))})(this,function(a,h,U,y){"use strict";const m={};class w{listb=null;constructor(t,s){const i={parent:t,left:0,right:0,height:1,width:"shrink",mouse:!0,keys:!0,autoCommandKeys:!0,scrollable:!0,style:{fg:"yellow",bg:"blue",item:{hover:{fg:"white",bg:"green"}},selected:{fg:"black",bg:"yellow"}}};s.top===!0?i.top=0:i.bottom=0,i.commands={},s.menuitems.forEach(e=>{i.commands&&(i.commands[e.text]={keys:[e.key],callback:e.cb})}),this.listb=h.listbar(i)}get listbar(){return this.listb}}class C extends m{uiBoxes={};screen=null;#t=0;#s=null;screenHeaderText="...";minRows=1;minCols=1;minWidth=40;minHeight=7;#i=null;sortInfo=null;screenHeader=null;uidata;constructor(t,s=null){super(),this.uidata=t,this.#s=s,this.SetupUI()}#o=t=>{if(!this.screen||!t.pos)return null;let s=this.screen.height;this.uidata.menu!==null&&(s-=this.uidata.menu.length);const i=this.screen.width,e=this.uidata.grid.rows,r=this.uidata.grid.cols,n=t.pos,d=Math.floor(i/r),o=Math.floor(s/e);let g=0;if(this.uidata.menu!==null){for(const[,c]of Object.entries(this.uidata.menu))if(c.top===!0){g=1;break}}const u={top:n.row*o+g,left:n.col*d,width:d*n.colSpan,height:o*n.rowSpan};return n.col+n.colSpan===r&&(u.width=i-n.col*d),n.row+n.rowSpan===e&&(u.height=s-n.row*o),u};#n=(t,s)=>{const i=this.#o(t);if(i&&(s.box.top=i.top,s.box.left=i.left,s.box.width=i.width,s.box.height=i.height,s.boxHeader.top=i.top,s.boxHeader.left=i.left+2,typeof t.widgets<"u"&&t.widgets!==null)){for(const[,e]of Object.entries(t.widgets))if(e.widget==="log"){const r=s.box.get(e.widget);r.position.top>=s.box.height-4?r.position.top=s.box.height-4:e.options.top&&(r.position.top=e.options.top)}}};#h=()=>{for(const[,t]of Object.entries(this.uiBoxes))this.#n(t.box.get("panel"),t)};#a=(t,s,i,e)=>{t.pos={row:s,col:i,rowSpan:1,colSpan:1},this.#n(t,e),e.boxHeader.setContent(t.panelHeader)};ClickEx(t){}#r(){if(!this.screen)return;const t=Object.keys(this.uidata.panels),s=Object.keys(this.uiBoxes);for(let e=0;e<s.length;e++)if(typeof this.uidata.panels[s[e]]>"u"){let r=this.uiBoxes[s[e]];typeof r<"u"&&(this.screen.remove(r.boxHeader),this.screen.remove(r.box),r=null,delete this.uiBoxes[s[e]])}const i={};for(let e=0;e<this.uidata.grid.cols*this.uidata.grid.rows;e++){const r=this.#t+e,n=e%this.uidata.grid.cols,d=Math.floor(e/this.uidata.grid.cols),o=this.uidata.panels[t[r]];if(typeof o<"u"){if(typeof this.uiBoxes[o.id]>"u"){if(o.pos={row:d,col:n,rowSpan:1,colSpan:1},!this.#o(o))return;const{top:u,left:c,width:k,height:I}=this.#o(o),l=h.box({parent:this.screen,top:u,left:c,width:k,height:I,style:{bg:"#101010",fg:"white"},border:{type:"line"},keys:!1,tags:!0}),x=h.box({parent:this.screen,top:u,left:c+2,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:o.panelHeader,tags:!0});if(this.uiBoxes[o.id]={box:l,boxHeader:x},x.setIndex(-1),l.on("click",()=>{this.ClickEx(l.get("panel"))}),typeof o.widgets<"u"&&o.widgets!==null)for(const[,p]of Object.entries(o.widgets)){const f={...p.options};f.top&&f.top>=l.height-3&&(f.top=l.height-4);const b=h[p.widget].call(this,f);b.set("id",y.v4()),l.append(b),l.set(p.widget,b)}l.set("panel",o),this.uiBoxes[o.id].box=l,i[o.id]=!0}else this.#a(o,d,n,this.uiBoxes[o.id]),i[o.id]=!0;this.#s&&this.#s(this.uiBoxes[o.id].box,o)}}for(const[e]of Object.entries(this.uiBoxes))typeof i[e]>"u"?(this.uiBoxes[e].box.hide(),this.uiBoxes[e].boxHeader.hide()):(this.uiBoxes[e].box.show(),this.uiBoxes[e].boxHeader.show())}get gridData(){return this.uidata}set gridData(t){this.uidata=t,this.#r(),this.UpdateCursorInfo(),this.Render()}get gridDataPanels(){return this.uidata.panels}set gridDataPanels(t){this.uidata.panels=t,this.#r(),this.UpdateCursorInfo(),this.Render()}ExitEx(){}EscapeEx(){}SetupUI=()=>{if(this.DestroyUI(),this.screen===null&&(this.screen=h.screen({smartCSR:!0})),!this.screen)return;const t=this.uidata;if(this.screen.title=t.title,this.screen.on("resize",()=>{this.#h(),this.Render()}),t.menu!==null)for(let s=0;s<t.menu.length;s++)new w(this.screen,t.menu[s]);this.screen.key(["C-c"],()=>{this.DestroyUI(),this.ExitEx()}),this.screen.key(["escape"],()=>{this.EscapeEx()}),this.#r(),this.#i=h.box({parent:this.screen,bottom:0,right:0,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:"",tags:!0}),this.sortInfo=h.box({parent:this.screen,top:0,right:0,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:"",tags:!0}),this.screenHeader=h.box({parent:this.screen,top:0,left:"center",width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:"[ ... ]",tags:!0}),this.UpdateCursorInfo(),this.UpdateSortInfo("Default"),this.UpdateScreenHeader(this.screenHeaderText),this.Render()};UpdateCursorInfo=()=>{this.#i&&this.#i.setContent(`Cursor: ${this.#t} / ${this.TotalPanelNumber}`)};UpdateSortInfo=t=>{this.sortInfo&&this.sortInfo.setContent(`Sort: ${t}`)};UpdateScreenHeader=t=>{this.screenHeaderText=t,this.screenHeader&&this.screenHeader.setContent(`[ ${t} ]`)};get rows(){return this.uidata.grid.rows}get cols(){return this.uidata.grid.cols}IncRows=()=>{this.screen&&this.screen.height/(this.uidata.grid.rows+1)>this.minHeight&&(this.uidata.grid.rows++,this.CheckCursor(),this.#e())};DecRows=()=>{this.uidata.grid.rows>this.minRows&&(this.uidata.grid.rows--,this.CheckCursor(),this.#e())};IncCols=()=>{this.screen&&this.screen.width/(this.uidata.grid.cols+1)>this.minWidth&&(this.uidata.grid.cols++,this.CheckCursor(),this.#e())};DecCols=()=>{this.uidata.grid.cols>this.minCols&&(this.uidata.grid.cols--,this.CheckCursor(),this.#e())};get ScreenCells(){return this.uidata.grid.cols*this.uidata.grid.rows}get TotalPanelNumber(){return Object.keys(this.uidata.panels).length}CheckCursor=()=>{this.#t>this.TotalPanelNumber-this.ScreenCells&&(this.#t=this.TotalPanelNumber-this.ScreenCells,this.#t<0&&(this.#t=0)),this.UpdateCursorInfo()};NextPage=()=>{const t=this.TotalPanelNumber-this.ScreenCells;this.#t<t&&(this.#t+=this.ScreenCells,this.#t>t&&(this.#t=t),this.#e())};PrevPage=()=>{this.#t>0&&(this.#t-=this.ScreenCells,this.#t<0&&(this.#t=0),this.#e())};#e(){this.SetupUI()}Exit=()=>{this.DestroyUI(),this.ExitEx()};DestroyUI=()=>{this.screen!==null&&(this.uiBoxes={},this.screen.destroy(),this.screen=null)};Render=()=>{this.screen&&this.screen.render()}}a.MenuBar=w,a.STSUIFrame=C,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=stsconfig.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stsconfig.umd.js","sources":["../__vite-browser-external","../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["export default {}","import blessed from 'blessed';\nimport * as stsBlessed from './index'\n\nexport interface menuitem {\n\ttext: string,\n\tkey: string,\n\tcb(): void\n}\n\nexport interface MenuBarOptions {\n\ttop: boolean\n\tmenuitems: menuitem[]\n}\n\nexport class MenuBar\n{\n private listb:stsBlessed.listbar | null = null;\n\n // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }\n constructor(screen: stsBlessed.screen, options: MenuBarOptions) {\n const compoptions: stsBlessed.elementOptions = {\n parent: screen,\n left: 0,\n right: 0,\n height: 1,\n width: 'shrink',\n mouse: true,\n keys: true,\n autoCommandKeys: true,\n scrollable: true,\n style: {\n fg: 'yellow',\n bg: 'blue',\n\n item: {\n hover: {\n fg: 'white',\n bg: 'green',\n }\n },\n selected: {\n fg: 'black',\n bg: 'yellow',\n }\n }\n }\n if (options.top === true) {\n compoptions.top = 0;\n } else {\n compoptions.bottom = 0;\n }\n\n compoptions.commands = { };\n options.menuitems.forEach((menuItem) => {\n if (compoptions.commands) {\n compoptions.commands[menuItem.text] = {\n keys: [ menuItem.key ],\n callback: menuItem.cb\n }\n }\n })\n\n this.listb = blessed.listbar(compoptions);\n }\n\n get listbar()\n {\n return this.listb;\n }\n}\n","import EventEmitter from 'events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = { };\n\n for (let i=0; i < (this.uidata.grid.cols * this.uidata.grid.rows); i++) {\n const gridPos = this.#cursor + i;\n const col = i % this.uidata.grid.cols;\n const row = Math.floor(i / this.uidata.grid.cols);\n\n // Get the panel for this position within the grid\n const panel: panel = this.uidata.panels[panelKeys[gridPos]];\n if (typeof panel !== 'undefined') {\n if (typeof this.uiBoxes[panel.id] === 'undefined') {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n\n const calculatedBoxPos = this.#CalcBoxPos(panel);\n if (!calculatedBoxPos) {\n return\n }\n const { top, left, width, height } = this.#CalcBoxPos(panel) as boxPos;\n\n // Create the UI box\n const box: stsBlessed.box = blessed.box({\n parent: this.screen,\n top: top,\n left: left,\n width: width,\n height: height,\n style:\n {\n bg: '#101010' // was gray\n ,fg: 'white'\n },\n border:\n {\n type: 'line'\n },\n keys: false, // Do not allow default key handling for this box\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n const boxHeader: stsBlessed.listbar = blessed.box({\n parent: this.screen,\n top: top,\n left: left+2,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: panel.panelHeader,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.uiBoxes[panel.id] = { box: box, boxHeader: boxHeader };\n\n boxHeader.setIndex(-1);\n\n // https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback\n box.on('click', () => {\n //this.emit('click', box.data.panel);\n this.emit('click', box.get('panel') as panel);\n });\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n // Create a fresh copy of the options for this widget instance.\n // If this is not done, all widgets will use the same options object and will not be able\n // to update screen elements individually.\n const widgetoptions = {...value.options};\n\n // Ensure that we always show at least 2 lines of log data even if this means we position over the top of\n // elements above this position.\n if (widgetoptions.top && (widgetoptions.top >= (box.height - 3))) {\n widgetoptions.top = box.height - 4;\n }\n const widget: stsBlessed.element = blessed[value.widget].call(this, widgetoptions);\n widget.set('id', uuidv4());\n box.append(widget);\n box.set(value.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n }\n }\n\n // The entire panel is accessible using the _panel property.\n // This is so that the model is accessible from within the handlebars templates.\n // Access to a named widget can be done using box._panel.widgets[name] or box._panel.widgets.name\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(panel, row, col, this.uiBoxes[panel.id]);\n\n touched[panel.id] = true;\n //this.#uiBox[panel.id].box.show();\n }\n\n // Render the uiBox with the renderPanelFn using the panel as the utility including the model\n if (this.#renderPanelFn) {\n this.#renderPanelFn(this.uiBoxes[panel.id].box, panel);\n }\n }\n }\n\n for (const [key, ] of Object.entries(this.uiBoxes)) {\n if (typeof touched[key] === 'undefined') {\n this.uiBoxes[key].box.hide();\n this.uiBoxes[key].boxHeader.hide();\n } else {\n this.uiBoxes[key].box.show();\n this.uiBoxes[key].boxHeader.show();\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n this.emit('exit');\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n this.emit('escape');\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n this.emit('exit');\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n}\n"],"names":["EventEmitter","MenuBar","screen","options","__publicField","compoptions","menuItem","blessed","STSUIFrame","data","renderPanelFn","__privateAdd","_SetupPanels","_UpdateUI","_cursor","_renderPanelFn","_cursorInfo","_CalcBoxPos","panel","screenHeight","screenWidth","rows","cols","pos","colWidth","rowHeight","topoffset","value","boxPos","_UpdateUIBoxPos","uiBox","__privateGet","widget","_ReSize","_UpdatePanelPosition","row","col","i","MenuBar.MenuBar","__privateMethod","SetupPanels_fn","__privateSet","sortMode","screenHeaderText","UpdateUI_fn","endpos","gridData","gridDataPanels","panelKeys","uiBoxIds","touched","gridPos","top","left","width","height","box","boxHeader","widgetoptions","uuidv4","key"],"mappings":"25BAAe,MAAAA,EAAA,CAAA,ECcR,MAAMC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external","../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["export default {}","import blessed from 'blessed';\nimport * as stsBlessed from './index'\n\nexport interface menuitem {\n\ttext: string,\n\tkey: string,\n\tcb(): void\n}\n\nexport interface MenuBarOptions {\n\ttop: boolean\n\tmenuitems: menuitem[]\n}\n\nexport class MenuBar\n{\n private listb:stsBlessed.listbar | null = null;\n\n // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }\n constructor(screen: stsBlessed.screen, options: MenuBarOptions) {\n const compoptions: stsBlessed.elementOptions = {\n parent: screen,\n left: 0,\n right: 0,\n height: 1,\n width: 'shrink',\n mouse: true,\n keys: true,\n autoCommandKeys: true,\n scrollable: true,\n style: {\n fg: 'yellow',\n bg: 'blue',\n\n item: {\n hover: {\n fg: 'white',\n bg: 'green',\n }\n },\n selected: {\n fg: 'black',\n bg: 'yellow',\n }\n }\n }\n if (options.top === true) {\n compoptions.top = 0;\n } else {\n compoptions.bottom = 0;\n }\n\n compoptions.commands = { };\n options.menuitems.forEach((menuItem) => {\n if (compoptions.commands) {\n compoptions.commands[menuItem.text] = {\n keys: [ menuItem.key ],\n callback: menuItem.cb\n }\n }\n })\n\n this.listb = blessed.listbar(compoptions);\n }\n\n get listbar()\n {\n return this.listb;\n }\n}\n","import EventEmitter from 'events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\nimport { createPublicKey } from 'crypto';\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n//export class STSUIFrame {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = { };\n\n for (let i=0; i < (this.uidata.grid.cols * this.uidata.grid.rows); i++) {\n const gridPos = this.#cursor + i;\n const col = i % this.uidata.grid.cols;\n const row = Math.floor(i / this.uidata.grid.cols);\n\n // Get the panel for this position within the grid\n const panel: panel = this.uidata.panels[panelKeys[gridPos]];\n if (typeof panel !== 'undefined') {\n if (typeof this.uiBoxes[panel.id] === 'undefined') {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n\n const calculatedBoxPos = this.#CalcBoxPos(panel);\n if (!calculatedBoxPos) {\n return\n }\n const { top, left, width, height } = this.#CalcBoxPos(panel) as boxPos;\n\n // Create the UI box\n const box: stsBlessed.box = blessed.box({\n parent: this.screen,\n top: top,\n left: left,\n width: width,\n height: height,\n style:\n {\n bg: '#101010' // was gray\n ,fg: 'white'\n },\n border:\n {\n type: 'line'\n },\n keys: false, // Do not allow default key handling for this box\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n const boxHeader: stsBlessed.listbar = blessed.box({\n parent: this.screen,\n top: top,\n left: left+2,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: panel.panelHeader,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.uiBoxes[panel.id] = { box: box, boxHeader: boxHeader };\n\n boxHeader.setIndex(-1);\n\n // https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback\n box.on('click', () => {\n //this.emit('click', box.data.panel);\n //this.emit('click', box.get('panel') as panel);\n this.ClickEx(box.get('panel') as panel);\n });\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n // Create a fresh copy of the options for this widget instance.\n // If this is not done, all widgets will use the same options object and will not be able\n // to update screen elements individually.\n const widgetoptions = {...value.options};\n\n // Ensure that we always show at least 2 lines of log data even if this means we position over the top of\n // elements above this position.\n if (widgetoptions.top && (widgetoptions.top >= (box.height - 3))) {\n widgetoptions.top = box.height - 4;\n }\n const widget: stsBlessed.element = blessed[value.widget].call(this, widgetoptions);\n widget.set('id', uuidv4());\n box.append(widget);\n box.set(value.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n }\n }\n\n // The entire panel is accessible using the _panel property.\n // This is so that the model is accessible from within the handlebars templates.\n // Access to a named widget can be done using box._panel.widgets[name] or box._panel.widgets.name\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(panel, row, col, this.uiBoxes[panel.id]);\n\n touched[panel.id] = true;\n //this.#uiBox[panel.id].box.show();\n }\n\n // Render the uiBox with the renderPanelFn using the panel as the utility including the model\n if (this.#renderPanelFn) {\n this.#renderPanelFn(this.uiBoxes[panel.id].box, panel);\n }\n }\n }\n\n for (const [key, ] of Object.entries(this.uiBoxes)) {\n if (typeof touched[key] === 'undefined') {\n this.uiBoxes[key].box.hide();\n this.uiBoxes[key].boxHeader.hide();\n } else {\n this.uiBoxes[key].box.show();\n this.uiBoxes[key].boxHeader.show();\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n //this.emit('escape');\n this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n}\n"],"names":["EventEmitter","MenuBar","screen","options","compoptions","menuItem","blessed","STSUIFrame","#cursor","#renderPanelFn","#cursorInfo","data","renderPanelFn","#CalcBoxPos","panel","screenHeight","screenWidth","rows","cols","pos","colWidth","rowHeight","topoffset","value","boxPos","#UpdateUIBoxPos","uiBox","widget","#ReSize","#UpdatePanelPosition","row","col","#SetupPanels","panelKeys","uiBoxIds","i","touched","gridPos","top","left","width","height","box","boxHeader","widgetoptions","uuidv4","key","gridData","gridDataPanels","MenuBar.MenuBar","sortMode","screenHeaderText","#UpdateUI","endpos"],"mappings":"wVAAe,MAAAA,EAAA,CAAA,ECcR,MAAMC,CACb,CACY,MAAkC,KAG1C,YAAYC,EAA2BC,EAAyB,CAC5D,MAAMC,EAAyC,CAC3C,OAAQF,EACR,KAAM,EACN,MAAO,EACP,OAAQ,EACR,MAAO,SACP,MAAO,GACP,KAAM,GACN,gBAAiB,GACjB,WAAY,GACZ,MAAO,CACH,GAAI,SACJ,GAAI,OAEJ,KAAM,CACF,MAAO,CACH,GAAI,QACJ,GAAI,OACR,CACJ,EACA,SAAU,CACN,GAAI,QACJ,GAAI,QACR,CACJ,CAAA,EAEAC,EAAQ,MAAQ,GAChBC,EAAY,IAAM,EAElBA,EAAY,OAAS,EAGzBA,EAAY,SAAW,GACfD,EAAA,UAAU,QAASE,GAAa,CAChCD,EAAY,WACAA,EAAA,SAASC,EAAS,IAAI,EAAI,CAClC,KAAM,CAAEA,EAAS,GAAI,EACrB,SAAUA,EAAS,EAAA,EAE3B,CACH,EAEI,KAAA,MAAQC,EAAQ,QAAQF,CAAW,CAC5C,CAEA,IAAI,SACJ,CACI,OAAO,KAAK,KAChB,CACJ,CCCO,MAAMG,UAAmBP,CAAa,CAEjC,QAAkB,CAAA,EAClB,OAAmC,KAC3CQ,GAAU,EACVC,GAAuC,KAC/B,iBAAmB,MAEnB,QAAU,EACV,QAAU,EACV,SAAW,GACX,UAAY,EAEpBC,GAAqC,KAC7B,SAAkC,KAClC,aAAsC,KAEtC,OASR,YAAYC,EAAgBC,EAAsC,KA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,KAAAA,GAAU,KAAK,iBAAmB,KAAK,YACxC,KAAKA,GAAU,IACf,KAAKA,GAAU,IAGvB,KAAK,iBAAiB,CAAA,EAG1B,SAAW,IAAY,CACb,MAAA6C,EAAS,KAAK,iBAAmB,KAAK,YACxC,KAAK7C,GAAU6C,IACf,KAAK7C,IAAW,KAAK,YACjB,KAAKA,GAAU6C,IACf,KAAK7C,GAAU6C,GAEnB,KAAKD,GAAU,EACnB,EAGJ,SAAW,IAAY,CACf,KAAK5C,GAAU,IACf,KAAKA,IAAW,KAAK,YACjB,KAAKA,GAAU,IACf,KAAKA,GAAU,GAEnB,KAAK4C,GAAU,EACnB,EAGJA,IAAkB,CACd,KAAK,QAAQ,CAMjB,CAEA,KAAO,IAAY,CACf,KAAK,UAAU,EAEf,KAAK,OAAO,CAAA,EAMhB,UAAY,IAAY,CAEhB,KAAK,SAAW,OAChB,KAAK,QAAU,GACf,KAAK,OAAO,UACZ,KAAK,OAAS,KAClB,EAMJ,OAAS,IAAY,CACb,KAAK,QACL,KAAK,OAAO,QAChB,CAER"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsui",
3
- "version": "1.10.10",
3
+ "version": "1.10.12",
4
4
  "description": "",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.mjs",
@@ -71,10 +71,13 @@ export declare class STSUIFrame extends EventEmitter {
71
71
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
72
72
  */
73
73
  constructor(data: gridData, renderPanelFn?: renderPanelCb | null);
74
+ ClickEx(panel: any): void;
74
75
  get gridData(): gridData;
75
76
  set gridData(gridData: gridData);
76
77
  get gridDataPanels(): panels;
77
78
  set gridDataPanels(gridDataPanels: panels);
79
+ ExitEx(): void;
80
+ EscapeEx(): void;
78
81
  /**
79
82
  *
80
83
  * @param {*} data UI Data
@@ -1 +1 @@
1
- {"version":3,"file":"stsuiframe.d.ts","sourceRoot":"","sources":["../src/st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