@nsshunt/stsui 1.10.10 → 1.10.11

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,24 @@
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);
1
+ var M = Object.defineProperty;
2
+ var W = (r, t, e) => t in r ? M(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var o = (r, t, e) => (W(r, typeof t != "symbol" ? t + "" : t, e), e), j = (r, t, e) => {
4
+ if (!t.has(r))
5
+ throw TypeError("Cannot " + e);
6
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))
7
+ var h = (r, t, e) => (j(r, t, "read from private field"), e ? e.call(r) : t.get(r)), c = (r, t, e) => {
8
+ if (t.has(r))
9
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";
10
+ t instanceof WeakSet ? t.add(r) : t.set(r, e);
11
+ }, g = (r, t, e, i) => (j(r, t, "write to private field"), i ? i.call(r, e) : t.set(r, e), e);
12
+ var u = (r, t, e) => (j(r, t, "access private method"), e);
13
+ import b from "blessed";
14
14
  import "colors";
15
- import { v4 as z } from "uuid";
16
- const F = {};
17
- class K {
15
+ import { v4 as $ } from "uuid";
16
+ class z {
18
17
  // 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,
18
+ constructor(t, e) {
19
+ o(this, "listb", null);
20
+ const i = {
21
+ parent: t,
23
22
  left: 0,
24
23
  right: 0,
25
24
  height: 1,
@@ -43,19 +42,19 @@ class K {
43
42
  }
44
43
  }
45
44
  };
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
45
+ e.top === !0 ? i.top = 0 : i.bottom = 0, i.commands = {}, e.menuitems.forEach((s) => {
46
+ i.commands && (i.commands[s.text] = {
47
+ keys: [s.key],
48
+ callback: s.cb
50
49
  });
51
- }), this.listb = w.listbar(e);
50
+ }), this.listb = b.listbar(i);
52
51
  }
53
52
  get listbar() {
54
53
  return this.listb;
55
54
  }
56
55
  }
57
- var l, C, k, S, U, D, R, I, B, b, x;
58
- class L extends F {
56
+ var a, y, C, k, I, B, E, S, P, p, w;
57
+ class G {
59
58
  /**
60
59
  *
61
60
  * @param {*} data The screen layout data. Schema: { title: <str>,
@@ -64,75 +63,74 @@ class L extends F {
64
63
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
65
64
  */
66
65
  constructor(t, e = null) {
67
- super();
68
66
  /**
69
67
  *
70
68
  * Setup all panels
71
69
  */
72
- u(this, I);
73
- u(this, b);
74
- i(this, "uiBoxes", {});
70
+ c(this, S);
71
+ c(this, p);
72
+ o(this, "uiBoxes", {});
75
73
  // { box: <<blessed box>>, boxHeader: <<blessed box>> }
76
- i(this, "screen", null);
77
- u(this, l, 0);
74
+ o(this, "screen", null);
75
+ c(this, a, 0);
78
76
  // 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);
77
+ c(this, y, null);
78
+ o(this, "screenHeaderText", "...");
79
+ o(this, "minRows", 1);
80
+ o(this, "minCols", 1);
81
+ o(this, "minWidth", 40);
82
+ o(this, "minHeight", 7);
83
+ c(this, C, null);
84
+ o(this, "sortInfo", null);
87
85
  // Current sort mode UI box control
88
- i(this, "screenHeader", null);
89
- i(this, "uidata");
86
+ o(this, "screenHeader", null);
87
+ o(this, "uidata");
90
88
  /**
91
89
  *
92
90
  * @param {number} position The index (0 based) for the panel item to be calculated
93
91
  * @returns object with top, left, width and height correctly set
94
92
  */
95
- u(this, S, (t) => {
93
+ c(this, k, (t) => {
96
94
  if (!this.screen || !t.pos)
97
95
  return null;
98
96
  let e = this.screen.height;
99
97
  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;
98
+ const i = this.screen.width, s = this.uidata.grid.rows, l = this.uidata.grid.cols, d = t.pos, x = Math.floor(i / l), n = Math.floor(e / s);
99
+ let D = 0;
102
100
  if (this.uidata.menu !== null) {
103
- for (const [, H] of Object.entries(this.uidata.menu))
104
- if (H.top === !0) {
105
- v = 1;
101
+ for (const [, U] of Object.entries(this.uidata.menu))
102
+ if (U.top === !0) {
103
+ D = 1;
106
104
  break;
107
105
  }
108
106
  }
109
- const y = {
110
- top: c.row * n + v,
111
- left: c.col * m,
112
- width: m * c.colSpan,
113
- height: n * c.rowSpan
107
+ const m = {
108
+ top: d.row * n + D,
109
+ left: d.col * x,
110
+ width: x * d.colSpan,
111
+ height: n * d.rowSpan
114
112
  };
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;
113
+ return d.col + d.colSpan === l && (m.width = i - d.col * x), d.row + d.rowSpan === s && (m.height = e - d.row * n), m;
116
114
  });
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)) {
115
+ c(this, I, (t, e) => {
116
+ const i = h(this, k).call(this, t);
117
+ if (i && (e.box.top = i.top, e.box.left = i.left, e.box.width = i.width, e.box.height = i.height, e.boxHeader.top = i.top, e.boxHeader.left = i.left + 2, typeof t.widgets < "u" && t.widgets !== null)) {
120
118
  for (const [, s] of Object.entries(t.widgets))
121
119
  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);
120
+ const l = e.box.get(s.widget);
121
+ l.position.top >= e.box.height - 4 ? l.position.top = e.box.height - 4 : s.options.top && (l.position.top = s.options.top);
124
122
  }
125
123
  }
126
124
  });
127
125
  /**
128
126
  * ReSize the grid layout
129
127
  */
130
- u(this, D, () => {
128
+ c(this, B, () => {
131
129
  for (const [, t] of Object.entries(this.uiBoxes))
132
- h(this, U).call(this, t.box.get("panel"), t);
130
+ h(this, I).call(this, t.box.get("panel"), t);
133
131
  });
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);
132
+ c(this, E, (t, e, i, s) => {
133
+ t.pos = { row: e, col: i, rowSpan: 1, colSpan: 1 }, h(this, I).call(this, t, s), s.boxHeader.setContent(t.panelHeader);
136
134
  });
137
135
  // https://www.npmjs.com/package/blessed
138
136
  // data:= { title: <str>,
@@ -143,22 +141,22 @@ class L extends F {
143
141
  *
144
142
  * @param {*} data UI Data
145
143
  */
146
- i(this, "SetupUI", () => {
147
- if (this.DestroyUI(), this.screen === null && (this.screen = w.screen({
144
+ o(this, "SetupUI", () => {
145
+ if (this.DestroyUI(), this.screen === null && (this.screen = b.screen({
148
146
  smartCSR: !0
149
147
  })), !this.screen)
150
148
  return;
151
149
  const t = this.uidata;
152
150
  if (this.screen.title = t.title, this.screen.on("resize", () => {
153
- h(this, D).call(this), this.Render();
151
+ h(this, B).call(this), this.Render();
154
152
  }), t.menu !== null)
155
153
  for (let e = 0; e < t.menu.length; e++)
156
- new K(this.screen, t.menu[e]);
154
+ new z(this.screen, t.menu[e]);
157
155
  this.screen.key(["C-c"], () => {
158
- this.DestroyUI(), this.emit("exit");
156
+ this.DestroyUI(), this.ExitEx();
159
157
  }), this.screen.key(["escape"], () => {
160
- this.emit("escape");
161
- }), f(this, I, B).call(this), p(this, k, w.box({
158
+ this.EscapeEx();
159
+ }), u(this, S, P).call(this), g(this, C, b.box({
162
160
  parent: this.screen,
163
161
  bottom: 0,
164
162
  right: 0,
@@ -174,7 +172,7 @@ class L extends F {
174
172
  content: "",
175
173
  tags: !0
176
174
  // Allow style in-line tags such as bolt, italics, etc.
177
- })), this.sortInfo = w.box({
175
+ })), this.sortInfo = b.box({
178
176
  parent: this.screen,
179
177
  top: 0,
180
178
  right: 0,
@@ -190,7 +188,7 @@ class L extends F {
190
188
  content: "",
191
189
  tags: !0
192
190
  // Allow style in-line tags such as bolt, italics, etc.
193
- }), this.screenHeader = w.box({
191
+ }), this.screenHeader = b.box({
194
192
  parent: this.screen,
195
193
  top: 0,
196
194
  left: "center",
@@ -208,65 +206,71 @@ class L extends F {
208
206
  // Allow style in-line tags such as bolt, italics, etc.
209
207
  }), this.UpdateCursorInfo(), this.UpdateSortInfo("Default"), this.UpdateScreenHeader(this.screenHeaderText), this.Render();
210
208
  });
211
- i(this, "UpdateCursorInfo", () => {
212
- h(this, k) && h(this, k).setContent(`Cursor: ${h(this, l)} / ${this.TotalPanelNumber}`);
209
+ o(this, "UpdateCursorInfo", () => {
210
+ h(this, C) && h(this, C).setContent(`Cursor: ${h(this, a)} / ${this.TotalPanelNumber}`);
213
211
  });
214
- i(this, "UpdateSortInfo", (t) => {
212
+ o(this, "UpdateSortInfo", (t) => {
215
213
  this.sortInfo && this.sortInfo.setContent(`Sort: ${t}`);
216
214
  });
217
- i(this, "UpdateScreenHeader", (t) => {
215
+ o(this, "UpdateScreenHeader", (t) => {
218
216
  this.screenHeaderText = t, this.screenHeader && this.screenHeader.setContent(`[ ${t} ]`);
219
217
  });
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));
218
+ o(this, "IncRows", () => {
219
+ this.screen && this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight && (this.uidata.grid.rows++, this.CheckCursor(), u(this, p, w).call(this));
222
220
  });
223
- i(this, "DecRows", () => {
224
- this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), f(this, b, x).call(this));
221
+ o(this, "DecRows", () => {
222
+ this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), u(this, p, w).call(this));
225
223
  });
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));
224
+ o(this, "IncCols", () => {
225
+ this.screen && this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth && (this.uidata.grid.cols++, this.CheckCursor(), u(this, p, w).call(this));
228
226
  });
229
- i(this, "DecCols", () => {
230
- this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), f(this, b, x).call(this));
227
+ o(this, "DecCols", () => {
228
+ this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), u(this, p, w).call(this));
231
229
  });
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();
230
+ o(this, "CheckCursor", () => {
231
+ h(this, a) > this.TotalPanelNumber - this.ScreenCells && (g(this, a, this.TotalPanelNumber - this.ScreenCells), h(this, a) < 0 && g(this, a, 0)), this.UpdateCursorInfo();
234
232
  });
235
- i(this, "NextPage", () => {
233
+ o(this, "NextPage", () => {
236
234
  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));
235
+ h(this, a) < t && (g(this, a, h(this, a) + this.ScreenCells), h(this, a) > t && g(this, a, t), u(this, p, w).call(this));
238
236
  });
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));
237
+ o(this, "PrevPage", () => {
238
+ h(this, a) > 0 && (g(this, a, h(this, a) - this.ScreenCells), h(this, a) < 0 && g(this, a, 0), u(this, p, w).call(this));
241
239
  });
242
- i(this, "Exit", () => {
243
- this.DestroyUI(), this.emit("exit");
240
+ o(this, "Exit", () => {
241
+ this.DestroyUI(), this.ExitEx();
244
242
  });
245
243
  /**
246
244
  *
247
245
  */
248
- i(this, "DestroyUI", () => {
246
+ o(this, "DestroyUI", () => {
249
247
  this.screen !== null && (this.uiBoxes = {}, this.screen.destroy(), this.screen = null);
250
248
  });
251
249
  /**
252
250
  * Render the screen.
253
251
  */
254
- i(this, "Render", () => {
252
+ o(this, "Render", () => {
255
253
  this.screen && this.screen.render();
256
254
  });
257
- this.uidata = t, p(this, C, e), this.SetupUI();
255
+ this.uidata = t, g(this, y, e), this.SetupUI();
256
+ }
257
+ ClickEx(t) {
258
258
  }
259
259
  get gridData() {
260
260
  return this.uidata;
261
261
  }
262
262
  set gridData(t) {
263
- this.uidata = t, f(this, I, B).call(this), this.UpdateCursorInfo(), this.Render();
263
+ this.uidata = t, u(this, S, P).call(this), this.UpdateCursorInfo(), this.Render();
264
264
  }
265
265
  get gridDataPanels() {
266
266
  return this.uidata.panels;
267
267
  }
268
268
  set gridDataPanels(t) {
269
- this.uidata.panels = t, f(this, I, B).call(this), this.UpdateCursorInfo(), this.Render();
269
+ this.uidata.panels = t, u(this, S, P).call(this), this.UpdateCursorInfo(), this.Render();
270
+ }
271
+ ExitEx() {
272
+ }
273
+ EscapeEx() {
270
274
  }
271
275
  get rows() {
272
276
  return this.uidata.grid.rows;
@@ -281,28 +285,28 @@ class L extends F {
281
285
  return Object.keys(this.uidata.panels).length;
282
286
  }
283
287
  }
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() {
288
+ a = new WeakMap(), y = new WeakMap(), C = new WeakMap(), k = new WeakMap(), I = new WeakMap(), B = new WeakMap(), E = new WeakMap(), S = new WeakSet(), P = function() {
285
289
  if (!this.screen)
286
290
  return;
287
291
  const t = Object.keys(this.uidata.panels), e = Object.keys(this.uiBoxes);
288
292
  for (let s = 0; s < e.length; s++)
289
293
  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]]);
294
+ let l = this.uiBoxes[e[s]];
295
+ typeof l < "u" && (this.screen.remove(l.boxHeader), this.screen.remove(l.box), l = null, delete this.uiBoxes[e[s]]);
292
296
  }
293
- const a = {};
297
+ const i = {};
294
298
  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]];
299
+ const l = h(this, a) + s, d = s % this.uidata.grid.cols, x = Math.floor(s / this.uidata.grid.cols), n = this.uidata.panels[t[l]];
296
300
  if (typeof n < "u") {
297
301
  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))
302
+ if (n.pos = { row: x, col: d, rowSpan: 1, colSpan: 1 }, !h(this, k).call(this, n))
299
303
  return;
300
- const { top: y, left: H, width: E, height: M } = h(this, S).call(this, n), g = w.box({
304
+ const { top: m, left: U, width: T, height: N } = h(this, k).call(this, n), f = b.box({
301
305
  parent: this.screen,
302
- top: y,
303
- left: H,
304
- width: E,
305
- height: M,
306
+ top: m,
307
+ left: U,
308
+ width: T,
309
+ height: N,
306
310
  style: {
307
311
  bg: "#101010",
308
312
  fg: "white"
@@ -314,10 +318,10 @@ l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U =
314
318
  // Do not allow default key handling for this box
315
319
  tags: !0
316
320
  // Allow style in-line tags such as bolt, italics, etc.
317
- }), N = w.box({
321
+ }), O = b.box({
318
322
  parent: this.screen,
319
- top: y,
320
- left: H + 2,
323
+ top: m,
324
+ left: U + 2,
321
325
  width: "shrink",
322
326
  height: 1,
323
327
  style: {
@@ -331,28 +335,28 @@ l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U =
331
335
  tags: !0
332
336
  // Allow style in-line tags such as bolt, italics, etc.
333
337
  });
334
- if (this.uiBoxes[n.id] = { box: g, boxHeader: N }, N.setIndex(-1), g.on("click", () => {
335
- this.emit("click", g.get("panel"));
338
+ if (this.uiBoxes[n.id] = { box: f, boxHeader: O }, O.setIndex(-1), f.on("click", () => {
339
+ this.ClickEx(f.get("panel"));
336
340
  }), 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);
341
+ for (const [, R] of Object.entries(n.widgets)) {
342
+ const H = { ...R.options };
343
+ H.top && H.top >= f.height - 3 && (H.top = f.height - 4);
344
+ const v = b[R.widget].call(this, H);
345
+ v.set("id", $()), f.append(v), f.set(R.widget, v);
342
346
  }
343
- g.set("panel", n), this.uiBoxes[n.id].box = g, a[n.id] = !0;
347
+ f.set("panel", n), this.uiBoxes[n.id].box = f, i[n.id] = !0;
344
348
  } 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);
349
+ h(this, E).call(this, n, x, d, this.uiBoxes[n.id]), i[n.id] = !0;
350
+ h(this, y) && h(this, y).call(this, this.uiBoxes[n.id].box, n);
347
351
  }
348
352
  }
349
353
  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() {
354
+ typeof i[s] > "u" ? (this.uiBoxes[s].box.hide(), this.uiBoxes[s].boxHeader.hide()) : (this.uiBoxes[s].box.show(), this.uiBoxes[s].boxHeader.show());
355
+ }, p = new WeakSet(), w = function() {
352
356
  this.SetupUI();
353
357
  };
354
358
  export {
355
- K as MenuBar,
356
- L as STSUIFrame
359
+ z as MenuBar,
360
+ G as STSUIFrame
357
361
  };
358
362
  //# 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;A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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":["../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["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\n//export class STSUIFrame extends EventEmitter {\nexport 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":["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":";;;;;;;;;;;;;;;AAcO,MAAMA,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,QAAQ,KAChBE,EAAY,MAAM,IAElBA,EAAY,SAAS,GAGzBA,EAAY,WAAW,IACfF,EAAA,UAAU,QAAQ,CAACG,MAAa;AACpC,MAAID,EAAY,aACAA,EAAA,SAASC,EAAS,I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AgB,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,GAqPA/C,IAAA,eAAA+B,IAAkB,WAAA;AACd,OAAK,QAAQ;AAMjB;"}
@@ -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(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,y,m,C,U,P,B,S,D,p,x;"use strict";var z=Object.defineProperty;var K=(i,e,l)=>e in i?z(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l;var r=(i,e,l)=>(K(i,typeof e!="symbol"?e+"":e,l),l),O=(i,e,l)=>{if(!e.has(i))throw TypeError("Cannot "+l)};var a=(i,e,l)=>(O(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)=>(O(i,e,"write to private field"),H?H.call(i,l):e.set(i,l),l);var g=(i,e,l)=>(O(i,e,"access private method"),l);class M{constructor(t,o){r(this,"listb",null);const n={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"}}};o.top===!0?n.top=0:n.bottom=0,n.commands={},o.menuitems.forEach(s=>{n.commands&&(n.commands[s.text]={keys:[s.key],callback:s.cb})}),this.listb=e.listbar(n)}get listbar(){return this.listb}}class W{constructor(t,o=null){f(this,S);f(this,p);r(this,"uiBoxes",{});r(this,"screen",null);f(this,d,0);f(this,y,null);r(this,"screenHeaderText","...");r(this,"minRows",1);r(this,"minCols",1);r(this,"minWidth",40);r(this,"minHeight",7);f(this,m,null);r(this,"sortInfo",null);r(this,"screenHeader",null);r(this,"uidata");f(this,C,t=>{if(!this.screen||!t.pos)return null;let o=this.screen.height;this.uidata.menu!==null&&(o-=this.uidata.menu.length);const n=this.screen.width,s=this.uidata.grid.rows,u=this.uidata.grid.cols,c=t.pos,k=Math.floor(n/u),h=Math.floor(o/s);let R=0;if(this.uidata.menu!==null){for(const[,E]of Object.entries(this.uidata.menu))if(E.top===!0){R=1;break}}const I={top:c.row*h+R,left:c.col*k,width:k*c.colSpan,height:h*c.rowSpan};return c.col+c.colSpan===u&&(I.width=n-c.col*k),c.row+c.rowSpan===s&&(I.height=o-c.row*h),I});f(this,U,(t,o)=>{const n=a(this,C).call(this,t);if(n&&(o.box.top=n.top,o.box.left=n.left,o.box.width=n.width,o.box.height=n.height,o.boxHeader.top=n.top,o.boxHeader.left=n.left+2,typeof t.widgets<"u"&&t.widgets!==null)){for(const[,s]of Object.entries(t.widgets))if(s.widget==="log"){const u=o.box.get(s.widget);u.position.top>=o.box.height-4?u.position.top=o.box.height-4:s.options.top&&(u.position.top=s.options.top)}}});f(this,P,()=>{for(const[,t]of Object.entries(this.uiBoxes))a(this,U).call(this,t.box.get("panel"),t)});f(this,B,(t,o,n,s)=>{t.pos={row:o,col:n,rowSpan:1,colSpan:1},a(this,U).call(this,t,s),s.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",()=>{a(this,P).call(this),this.Render()}),t.menu!==null)for(let o=0;o<t.menu.length;o++)new M(this.screen,t.menu[o]);this.screen.key(["C-c"],()=>{this.DestroyUI(),this.ExitEx()}),this.screen.key(["escape"],()=>{this.EscapeEx()}),g(this,S,D).call(this),w(this,m,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",()=>{a(this,m)&&a(this,m).setContent(`Cursor: ${a(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",()=>{a(this,d)>this.TotalPanelNumber-this.ScreenCells&&(w(this,d,this.TotalPanelNumber-this.ScreenCells),a(this,d)<0&&w(this,d,0)),this.UpdateCursorInfo()});r(this,"NextPage",()=>{const t=this.TotalPanelNumber-this.ScreenCells;a(this,d)<t&&(w(this,d,a(this,d)+this.ScreenCells),a(this,d)>t&&w(this,d,t),g(this,p,x).call(this))});r(this,"PrevPage",()=>{a(this,d)>0&&(w(this,d,a(this,d)-this.ScreenCells),a(this,d)<0&&w(this,d,0),g(this,p,x).call(this))});r(this,"Exit",()=>{this.DestroyUI(),this.ExitEx()});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,y,o),this.SetupUI()}ClickEx(t){}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()}ExitEx(){}EscapeEx(){}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,y=new WeakMap,m=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),o=Object.keys(this.uiBoxes);for(let s=0;s<o.length;s++)if(typeof this.uidata.panels[o[s]]>"u"){let u=this.uiBoxes[o[s]];typeof u<"u"&&(this.screen.remove(u.boxHeader),this.screen.remove(u.box),u=null,delete this.uiBoxes[o[s]])}const n={};for(let s=0;s<this.uidata.grid.cols*this.uidata.grid.rows;s++){const u=a(this,d)+s,c=s%this.uidata.grid.cols,k=Math.floor(s/this.uidata.grid.cols),h=this.uidata.panels[t[u]];if(typeof h<"u"){if(typeof this.uiBoxes[h.id]>"u"){if(h.pos={row:k,col:c,rowSpan:1,colSpan:1},!a(this,C).call(this,h))return;const{top:I,left:E,width:q,height:F}=a(this,C).call(this,h),b=e.box({parent:this.screen,top:I,left:E,width:q,height:F,style:{bg:"#101010",fg:"white"},border:{type:"line"},keys:!1,tags:!0}),N=e.box({parent:this.screen,top:I,left:E+2,width:"shrink",height:1,style:{bg:"gray",fg:"white"},keys:!1,mouse:!1,content:h.panelHeader,tags:!0});if(this.uiBoxes[h.id]={box:b,boxHeader:N},N.setIndex(-1),b.on("click",()=>{this.ClickEx(b.get("panel"))}),typeof h.widgets<"u"&&h.widgets!==null)for(const[,j]of Object.entries(h.widgets)){const T={...j.options};T.top&&T.top>=b.height-3&&(T.top=b.height-4);const v=e[j.widget].call(this,T);v.set("id",H.v4()),b.append(v),b.set(j.widget,v)}b.set("panel",h),this.uiBoxes[h.id].box=b,n[h.id]=!0}else a(this,B).call(this,h,k,c,this.uiBoxes[h.id]),n[h.id]=!0;a(this,y)&&a(this,y).call(this,this.uiBoxes[h.id].box,h)}}for(const[s]of Object.entries(this.uiBoxes))typeof n[s]>"u"?(this.uiBoxes[s].box.hide(),this.uiBoxes[s].boxHeader.hide()):(this.uiBoxes[s].box.show(),this.uiBoxes[s].boxHeader.show())},p=new WeakSet,x=function(){this.SetupUI()},i.MenuBar=M,i.STSUIFrame=W,Object.defineProperty(i,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,CACb,CAII,YAAYC,EAA2BC,EAAyB,CAHxDC,EAAA,aAAkC,MAItC,MAAMC,EAAyC,CAC3C,OAAQH,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,GAChBE,EAAY,IA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M,MAAM,EAAE,KAAK,KAAM+B,CAAa,EAC1E1B,EAAA,IAAI,KAAM2B,EAAAA,GAAQ,CAAA,EACzBH,EAAI,OAAOxB,CAAM,EACbwB,EAAA,IAAI7B,EAAM,OAAQK,CAAM,EAOhCwB,EAAA,IAAI,QAAStC,CAAK,EAEtB,KAAK,QAAQA,EAAM,EAAE,EAAE,IAAMsC,EAErBN,EAAAhC,EAAM,EAAE,EAAI,QAIfa,EAAA,KAAAG,GAAA,UAAqBhB,EAAOiB,EAAKC,EAAK,KAAK,QAAQlB,EAAM,EAAE,GAExDgC,EAAAhC,EAAM,EAAE,EAAI,GAKpBa,EAAA,KAAKhB,IACLgB,EAAA,KAAKhB,GAAL,UAAoB,KAAK,QAAQG,EAAM,EAAE,EAAE,IAAKA,IAK5D,SAAW,CAAC0C,CAAK,IAAK,OAAO,QAAQ,KAAK,OAAO,EACzC,OAAOV,EAAQU,CAAG,EAAM,KACxB,KAAK,QAAQA,CAAG,EAAE,IAAI,KAAK,EAC3B,KAAK,QAAQA,CAAG,EAAE,UAAU,KAAK,IAEjC,KAAK,QAAQA,CAAG,EAAE,IAAI,KAAK,EAC3B,KAAK,QAAQA,CAAG,EAAE,UAAU,KAAK,EAI7C,EA2OA/C,EAAA,YAAA+B,EAAkB,UAAA,CACd,KAAK,QAAQ,CAMjB"}
1
+ {"version":3,"file":"stsconfig.umd.js","sources":["../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["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\n//export class STSUIFrame extends EventEmitter {\nexport 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":["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":"25BAcO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CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsui",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "description": "",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.mjs",
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- import EventEmitter from 'events';
3
1
  import 'colors';
4
2
  import * as stsBlessed from './index';
5
3
  import * as MenuBar from './menubar';
@@ -51,7 +49,7 @@ export interface uiBox {
51
49
  export interface uiBoxes {
52
50
  [key: string]: uiBox;
53
51
  }
54
- export declare class STSUIFrame extends EventEmitter {
52
+ export declare class STSUIFrame {
55
53
  #private;
56
54
  private uiBoxes;
57
55
  private screen;
@@ -71,10 +69,13 @@ export declare class STSUIFrame extends EventEmitter {
71
69
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
72
70
  */
73
71
  constructor(data: gridData, renderPanelFn?: renderPanelCb | null);
72
+ ClickEx(panel: any): void;
74
73
  get gridData(): gridData;
75
74
  set gridData(gridData: gridData);
76
75
  get gridDataPanels(): panels;
77
76
  set gridDataPanels(gridDataPanels: panels);
77
+ ExitEx(): void;
78
+ EscapeEx(): void;
78
79
  /**
79
80
  *
80
81
  * @param {*} data UI Data
@@ -1 +1 @@
1
- {"version":3,"file":"stsuiframe.d.ts","sourceRoot":"","sources":["../src/stsuiframe.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAA;AAMjC,OAAO,QAAQ,CAAC;AAIhB,OAAO,KAAK,UAAU,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AAEpC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAA;AAElD,MAAM,WAAW,MAAM;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,UAAU,CAAC,cAAc,CAAA;CACrC;AAED,MAAM,WAAW,OAAO;IACpB,CAAC,UAAU,EAAE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