@nsshunt/stsui 1.10.15 → 1.10.16

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,15 +1,15 @@
1
1
  var W = Object.defineProperty;
2
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), O = (r, o, t) => {
3
+ var i = (r, o, t) => ($(r, typeof o != "symbol" ? o + "" : o, t), t), T = (r, o, t) => {
4
4
  if (!o.has(r))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var h = (r, o, t) => (O(r, o, "read from private field"), t ? t.call(r) : o.get(r)), u = (r, o, t) => {
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
8
  if (o.has(r))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  o instanceof WeakSet ? o.add(r) : o.set(r, t);
11
- }, p = (r, o, t, e) => (O(r, o, "write to private field"), e ? e.call(r, t) : o.set(r, t), t);
12
- var f = (r, o, t) => (O(r, o, "access private method"), 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
13
  import z from "node:events";
14
14
  import w from "blessed";
15
15
  import "colors";
@@ -54,7 +54,7 @@ class K {
54
54
  return this.listb;
55
55
  }
56
56
  }
57
- var l, C, k, S, U, B, D, I, E, b, x;
57
+ var l, C, k, S, U, D, R, I, B, b, m;
58
58
  class Q extends z {
59
59
  /**
60
60
  *
@@ -65,6 +65,11 @@ class Q extends z {
65
65
  */
66
66
  constructor(t, e = null) {
67
67
  super();
68
+ /*
69
+ ClickEx(panel: any) {
70
+ //@@ override in sub-class
71
+ }
72
+ */
68
73
  /**
69
74
  *
70
75
  * Setup all panels
@@ -98,22 +103,22 @@ class Q extends z {
98
103
  return null;
99
104
  let e = this.screen.height;
100
105
  this.uidata.menu !== null && (e -= this.uidata.menu.length);
101
- 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);
102
- let R = 0;
106
+ const a = this.screen.width, s = this.uidata.grid.rows, d = this.uidata.grid.cols, c = t.pos, x = Math.floor(a / d), n = Math.floor(e / s);
107
+ let v = 0;
103
108
  if (this.uidata.menu !== null) {
104
109
  for (const [, H] of Object.entries(this.uidata.menu))
105
110
  if (H.top === !0) {
106
- R = 1;
111
+ v = 1;
107
112
  break;
108
113
  }
109
114
  }
110
115
  const y = {
111
- top: c.row * n + R,
112
- left: c.col * m,
113
- width: m * c.colSpan,
116
+ top: c.row * n + v,
117
+ left: c.col * x,
118
+ width: x * c.colSpan,
114
119
  height: n * c.rowSpan
115
120
  };
116
- return c.col + c.colSpan === d && (y.width = a - c.col * m), c.row + c.rowSpan === s && (y.height = e - c.row * n), y;
121
+ return c.col + c.colSpan === d && (y.width = a - c.col * x), c.row + c.rowSpan === s && (y.height = e - c.row * n), y;
117
122
  });
118
123
  u(this, U, (t, e) => {
119
124
  const a = h(this, S).call(this, t);
@@ -128,13 +133,22 @@ class Q extends z {
128
133
  /**
129
134
  * ReSize the grid layout
130
135
  */
131
- u(this, B, () => {
136
+ u(this, D, () => {
132
137
  for (const [, t] of Object.entries(this.uiBoxes))
133
138
  h(this, U).call(this, t.box.get("panel"), t);
134
139
  });
135
- u(this, D, (t, e, a, s) => {
140
+ u(this, R, (t, e, a, s) => {
136
141
  t.pos = { row: e, col: a, rowSpan: 1, colSpan: 1 }, h(this, U).call(this, t, s), s.boxHeader.setContent(t.panelHeader);
137
142
  });
143
+ /*
144
+ ExitEx() {
145
+ //@@ override in sub-class
146
+ }
147
+
148
+ EscapeEx() {
149
+ //@@ override in sub-class
150
+ }
151
+ */
138
152
  // https://www.npmjs.com/package/blessed
139
153
  // data:= { title: <str>,
140
154
  // grid: { rows: <int>, cols: <int> },
@@ -151,15 +165,15 @@ class Q extends z {
151
165
  return;
152
166
  const t = this.uidata;
153
167
  if (this.screen.title = t.title, this.screen.on("resize", () => {
154
- h(this, B).call(this), this.Render();
168
+ h(this, D).call(this), this.Render();
155
169
  }), t.menu !== null)
156
170
  for (let e = 0; e < t.menu.length; e++)
157
171
  new K(this.screen, t.menu[e]);
158
172
  this.screen.key(["C-c"], () => {
159
- this.DestroyUI(), this.ExitEx();
173
+ this.DestroyUI(), this.emit("exit");
160
174
  }), this.screen.key(["escape"], () => {
161
- this.EscapeEx();
162
- }), f(this, I, E).call(this), p(this, k, w.box({
175
+ this.emit("escape");
176
+ }), f(this, I, B).call(this), p(this, k, w.box({
163
177
  parent: this.screen,
164
178
  bottom: 0,
165
179
  right: 0,
@@ -219,29 +233,29 @@ class Q extends z {
219
233
  this.screenHeaderText = t, this.screenHeader && this.screenHeader.setContent(`[ ${t} ]`);
220
234
  });
221
235
  i(this, "IncRows", () => {
222
- this.screen && this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight && (this.uidata.grid.rows++, this.CheckCursor(), f(this, b, x).call(this));
236
+ this.screen && this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight && (this.uidata.grid.rows++, this.CheckCursor(), f(this, b, m).call(this));
223
237
  });
224
238
  i(this, "DecRows", () => {
225
- this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), f(this, b, x).call(this));
239
+ this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), f(this, b, m).call(this));
226
240
  });
227
241
  i(this, "IncCols", () => {
228
- this.screen && this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth && (this.uidata.grid.cols++, this.CheckCursor(), f(this, b, x).call(this));
242
+ this.screen && this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth && (this.uidata.grid.cols++, this.CheckCursor(), f(this, b, m).call(this));
229
243
  });
230
244
  i(this, "DecCols", () => {
231
- this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), f(this, b, x).call(this));
245
+ this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), f(this, b, m).call(this));
232
246
  });
233
247
  i(this, "CheckCursor", () => {
234
248
  h(this, l) > this.TotalPanelNumber - this.ScreenCells && (p(this, l, this.TotalPanelNumber - this.ScreenCells), h(this, l) < 0 && p(this, l, 0)), this.UpdateCursorInfo();
235
249
  });
236
250
  i(this, "NextPage", () => {
237
251
  const t = this.TotalPanelNumber - this.ScreenCells;
238
- 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));
252
+ h(this, l) < t && (p(this, l, h(this, l) + this.ScreenCells), h(this, l) > t && p(this, l, t), f(this, b, m).call(this));
239
253
  });
240
254
  i(this, "PrevPage", () => {
241
- 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));
255
+ h(this, l) > 0 && (p(this, l, h(this, l) - this.ScreenCells), h(this, l) < 0 && p(this, l, 0), f(this, b, m).call(this));
242
256
  });
243
257
  i(this, "Exit", () => {
244
- this.DestroyUI(), this.ExitEx();
258
+ this.DestroyUI(), this.emit("exit");
245
259
  });
246
260
  /**
247
261
  *
@@ -257,23 +271,17 @@ class Q extends z {
257
271
  });
258
272
  this.uidata = t, p(this, C, e), this.SetupUI();
259
273
  }
260
- ClickEx(t) {
261
- }
262
274
  get gridData() {
263
275
  return this.uidata;
264
276
  }
265
277
  set gridData(t) {
266
- this.uidata = t, f(this, I, E).call(this), this.UpdateCursorInfo(), this.Render();
278
+ this.uidata = t, f(this, I, B).call(this), this.UpdateCursorInfo(), this.Render();
267
279
  }
268
280
  get gridDataPanels() {
269
281
  return this.uidata.panels;
270
282
  }
271
283
  set gridDataPanels(t) {
272
- this.uidata.panels = t, f(this, I, E).call(this), this.UpdateCursorInfo(), this.Render();
273
- }
274
- ExitEx() {
275
- }
276
- EscapeEx() {
284
+ this.uidata.panels = t, f(this, I, B).call(this), this.UpdateCursorInfo(), this.Render();
277
285
  }
278
286
  get rows() {
279
287
  return this.uidata.grid.rows;
@@ -288,7 +296,7 @@ class Q extends z {
288
296
  return Object.keys(this.uidata.panels).length;
289
297
  }
290
298
  }
291
- l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U = new WeakMap(), B = new WeakMap(), D = new WeakMap(), I = new WeakSet(), E = function() {
299
+ 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() {
292
300
  if (!this.screen)
293
301
  return;
294
302
  const t = Object.keys(this.uidata.panels), e = Object.keys(this.uiBoxes);
@@ -299,16 +307,16 @@ l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U =
299
307
  }
300
308
  const a = {};
301
309
  for (let s = 0; s < this.uidata.grid.cols * this.uidata.grid.rows; s++) {
302
- 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]];
310
+ const d = h(this, l) + s, c = s % this.uidata.grid.cols, x = Math.floor(s / this.uidata.grid.cols), n = this.uidata.panels[t[d]];
303
311
  if (typeof n < "u") {
304
312
  if (typeof this.uiBoxes[n.id] > "u") {
305
- if (n.pos = { row: m, col: c, rowSpan: 1, colSpan: 1 }, !h(this, S).call(this, n))
313
+ if (n.pos = { row: x, col: c, rowSpan: 1, colSpan: 1 }, !h(this, S).call(this, n))
306
314
  return;
307
- const { top: y, left: H, width: N, height: M } = h(this, S).call(this, n), g = w.box({
315
+ const { top: y, left: H, width: E, height: M } = h(this, S).call(this, n), g = w.box({
308
316
  parent: this.screen,
309
317
  top: y,
310
318
  left: H,
311
- width: N,
319
+ width: E,
312
320
  height: M,
313
321
  style: {
314
322
  bg: "#101010",
@@ -321,7 +329,7 @@ l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U =
321
329
  // Do not allow default key handling for this box
322
330
  tags: !0
323
331
  // Allow style in-line tags such as bolt, italics, etc.
324
- }), T = w.box({
332
+ }), N = w.box({
325
333
  parent: this.screen,
326
334
  top: y,
327
335
  left: H + 2,
@@ -338,24 +346,24 @@ l = new WeakMap(), C = new WeakMap(), k = new WeakMap(), S = new WeakMap(), U =
338
346
  tags: !0
339
347
  // Allow style in-line tags such as bolt, italics, etc.
340
348
  });
341
- if (this.uiBoxes[n.id] = { box: g, boxHeader: T }, T.setIndex(-1), g.on("click", () => {
342
- this.ClickEx(g.get("panel"));
349
+ if (this.uiBoxes[n.id] = { box: g, boxHeader: N }, N.setIndex(-1), g.on("click", () => {
350
+ this.emit("click", g.get("panel"));
343
351
  }), typeof n.widgets < "u" && n.widgets !== null)
344
- for (const [, v] of Object.entries(n.widgets)) {
345
- const P = { ...v.options };
352
+ for (const [, j] of Object.entries(n.widgets)) {
353
+ const P = { ...j.options };
346
354
  P.top && P.top >= g.height - 3 && (P.top = g.height - 4);
347
- const j = w[v.widget].call(this, P);
348
- j.set("id", F()), g.append(j), g.set(v.widget, j);
355
+ const O = w[j.widget].call(this, P);
356
+ O.set("id", F()), g.append(O), g.set(j.widget, O);
349
357
  }
350
358
  g.set("panel", n), this.uiBoxes[n.id].box = g, a[n.id] = !0;
351
359
  } else
352
- h(this, D).call(this, n, m, c, this.uiBoxes[n.id]), a[n.id] = !0;
360
+ h(this, R).call(this, n, x, c, this.uiBoxes[n.id]), a[n.id] = !0;
353
361
  h(this, C) && h(this, C).call(this, this.uiBoxes[n.id].box, n);
354
362
  }
355
363
  }
356
364
  for (const [s] of Object.entries(this.uiBoxes))
357
365
  typeof a[s] > "u" ? (this.uiBoxes[s].box.hide(), this.uiBoxes[s].boxHeader.hide()) : (this.uiBoxes[s].box.show(), this.uiBoxes[s].boxHeader.show());
358
- }, b = new WeakSet(), x = function() {
366
+ }, b = new WeakSet(), m = function() {
359
367
  this.SetupUI();
360
368
  };
361
369
  export {
@@ -1 +1 @@
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 'node:events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\nimport { createPublicKey } from 'crypto';\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n//export class STSUIFrame {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = { };\n\n for (let i=0; i < (this.uidata.grid.cols * this.uidata.grid.rows); i++) {\n const gridPos = this.#cursor + i;\n const col = i % this.uidata.grid.cols;\n const row = Math.floor(i / this.uidata.grid.cols);\n\n // Get the panel for this position within the grid\n const panel: panel = this.uidata.panels[panelKeys[gridPos]];\n if (typeof panel !== 'undefined') {\n if (typeof this.uiBoxes[panel.id] === 'undefined') {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n\n const calculatedBoxPos = this.#CalcBoxPos(panel);\n if (!calculatedBoxPos) {\n return\n }\n const { top, left, width, height } = this.#CalcBoxPos(panel) as boxPos;\n\n // Create the UI box\n const box: stsBlessed.box = blessed.box({\n parent: this.screen,\n top: top,\n left: left,\n width: width,\n height: height,\n style:\n {\n bg: '#101010' // was gray\n ,fg: 'white'\n },\n border:\n {\n type: 'line'\n },\n keys: false, // Do not allow default key handling for this box\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n const boxHeader: stsBlessed.listbar = blessed.box({\n parent: this.screen,\n top: top,\n left: left+2,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: panel.panelHeader,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.uiBoxes[panel.id] = { box: box, boxHeader: boxHeader };\n\n boxHeader.setIndex(-1);\n\n // https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback\n box.on('click', () => {\n //this.emit('click', box.data.panel);\n //this.emit('click', box.get('panel') as panel);\n this.ClickEx(box.get('panel') as panel);\n });\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n // Create a fresh copy of the options for this widget instance.\n // If this is not done, all widgets will use the same options object and will not be able\n // to update screen elements individually.\n const widgetoptions = {...value.options};\n\n // Ensure that we always show at least 2 lines of log data even if this means we position over the top of\n // elements above this position.\n if (widgetoptions.top && (widgetoptions.top >= (box.height - 3))) {\n widgetoptions.top = box.height - 4;\n }\n const widget: stsBlessed.element = blessed[value.widget].call(this, widgetoptions);\n widget.set('id', uuidv4());\n box.append(widget);\n box.set(value.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n }\n }\n\n // The entire panel is accessible using the _panel property.\n // This is so that the model is accessible from within the handlebars templates.\n // Access to a named widget can be done using box._panel.widgets[name] or box._panel.widgets.name\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(panel, row, col, this.uiBoxes[panel.id]);\n\n touched[panel.id] = true;\n //this.#uiBox[panel.id].box.show();\n }\n\n // Render the uiBox with the renderPanelFn using the panel as the utility including the model\n if (this.#renderPanelFn) {\n this.#renderPanelFn(this.uiBoxes[panel.id].box, panel);\n }\n }\n }\n\n for (const [key, ] of Object.entries(this.uiBoxes)) {\n if (typeof touched[key] === 'undefined') {\n this.uiBoxes[key].box.hide();\n this.uiBoxes[key].boxHeader.hide();\n } else {\n this.uiBoxes[key].box.show();\n this.uiBoxes[key].boxHeader.show();\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n //this.emit('escape');\n this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n}\n"],"names":["MenuBar","screen","options","__publicField","compoptions","menuItem","blessed","STSUIFrame","EventEmitter","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,IAAI,IAAI;AAAA,QAClC,MAAM,CAAEA,EAAS,GAAI;AAAA,QACrB,UAAUA,EAAS;AAAA,MAAA;AAAA,IAE3B,CACH,G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,SAAS,MAC3CE,EAAA,MAAMF,EAAI,SAAS;AAErC,kBAAMxB,IAA6B1B,EAAQqB,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
+ {"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 'node:events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\nimport { createPublicKey } from 'crypto';\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n//export class STSUIFrame {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n /*\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\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 /*\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\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","EventEmitter","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,IAAI,IAAI;AAAA,QAClC,MAAM,CAAEA,EAAS,GAAI;AAAA,QACrB,UAAUA,EAAS;AAAA,MAAA;AAAA,IAE3B,CACH,GAEI,KAAA,QAAQC,EAAQ,QAAQF,CAAW;AAAA,EAC5C;AAAA,EAEA,IAAI,UACJ;AACI,WAAO,KAAK;AAAA,EAChB;AACJ;;ACCO,MAAMG,UAAmBC,EAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BzC,YAAYC,GAAgBC,IAAsC,MAAM;AAC9D;AAwHV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA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AAQA,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,GAuPA/C,IAAA,eAAA+B,IAAkB,WAAA;AACd,OAAK,QAAQ;AAMjB;"}
@@ -1,2 +1,2 @@
1
- (function(s,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("node:events"),require("blessed"),require("colors"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","node:events","blessed","colors","uuid"],i):(s=typeof globalThis<"u"?globalThis:s||self,i(s["@nsshunt/stsconfig"]={},s.events,s.blessed,null,s.uuid))})(this,function(s,i,r,T,W){var d,y,m,C,U,H,P,S,v,p,x;"use strict";var A=Object.defineProperty;var G=(s,i,r)=>i in s?A(s,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[i]=r;var n=(s,i,r)=>(G(s,typeof i!="symbol"?i+"":i,r),r),O=(s,i,r)=>{if(!i.has(s))throw TypeError("Cannot "+r)};var a=(s,i,r)=>(O(s,i,"read from private field"),r?r.call(s):i.get(s)),f=(s,i,r)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,r)},b=(s,i,r,T)=>(O(s,i,"write to private field"),T?T.call(s,r):i.set(s,r),r);var g=(s,i,r)=>(O(s,i,"access private method"),r);class M{constructor(N,t){n(this,"listb",null);const e={parent:N,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?e.top=0:e.bottom=0,e.commands={},t.menuitems.forEach(l=>{e.commands&&(e.commands[l.text]={keys:[l.key],callback:l.cb})}),this.listb=r.listbar(e)}get listbar(){return this.listb}}class $ extends i{constructor(t,e=null){super();f(this,S);f(this,p);n(this,"uiBoxes",{});n(this,"screen",null);f(this,d,0);f(this,y,null);n(this,"screenHeaderText","...");n(this,"minRows",1);n(this,"minCols",1);n(this,"minWidth",40);n(this,"minHeight",7);f(this,m,null);n(this,"sortInfo",null);n(this,"screenHeader",null);n(this,"uidata");f(this,C,t=>{if(!this.screen||!t.pos)return null;let e=this.screen.height;this.uidata.menu!==null&&(e-=this.uidata.menu.length);const l=this.screen.width,o=this.uidata.grid.rows,u=this.uidata.grid.cols,c=t.pos,k=Math.floor(l/u),h=Math.floor(e/o);let D=0;if(this.uidata.menu!==null){for(const[,B]of Object.entries(this.uidata.menu))if(B.top===!0){D=1;break}}const I={top:c.row*h+D,left:c.col*k,width:k*c.colSpan,height:h*c.rowSpan};return c.col+c.colSpan===u&&(I.width=l-c.col*k),c.row+c.rowSpan===o&&(I.height=e-c.row*h),I});f(this,U,(t,e)=>{const l=a(this,C).call(this,t);if(l&&(e.box.top=l.top,e.box.left=l.left,e.box.width=l.width,e.box.height=l.height,e.boxHeader.top=l.top,e.boxHeader.left=l.left+2,typeof t.widgets<"u"&&t.widgets!==null)){for(const[,o]of Object.entries(t.widgets))if(o.widget==="log"){const u=e.box.get(o.widget);u.position.top>=e.box.height-4?u.position.top=e.box.height-4:o.options.top&&(u.position.top=o.options.top)}}});f(this,H,()=>{for(const[,t]of Object.entries(this.uiBoxes))a(this,U).call(this,t.box.get("panel"),t)});f(this,P,(t,e,l,o)=>{t.pos={row:e,col:l,rowSpan:1,colSpan:1},a(this,U).call(this,t,o),o.boxHeader.setContent(t.panelHeader)});n(this,"SetupUI",()=>{if(this.DestroyUI(),this.screen===null&&(this.screen=r.screen({smartCSR:!0})),!this.screen)return;const t=this.uidata;if(this.screen.title=t.title,this.screen.on("resize",()=>{a(this,H).call(this),this.Render()}),t.menu!==null)for(let e=0;e<t.menu.length;e++)new M(this.screen,t.menu[e]);this.screen.key(["C-c"],()=>{this.DestroyUI(),this.ExitEx()}),this.screen.key(["escape"],()=>{this.EscapeEx()}),g(this,S,v).call(this),b(this,m,r.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=r.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=r.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()});n(this,"UpdateCursorInfo",()=>{a(this,m)&&a(this,m).setContent(`Cursor: ${a(this,d)} / ${this.TotalPanelNumber}`)});n(this,"UpdateSortInfo",t=>{this.sortInfo&&this.sortInfo.setContent(`Sort: ${t}`)});n(this,"UpdateScreenHeader",t=>{this.screenHeaderText=t,this.screenHeader&&this.screenHeader.setContent(`[ ${t} ]`)});n(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))});n(this,"DecRows",()=>{this.uidata.grid.rows>this.minRows&&(this.uidata.grid.rows--,this.CheckCursor(),g(this,p,x).call(this))});n(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))});n(this,"DecCols",()=>{this.uidata.grid.cols>this.minCols&&(this.uidata.grid.cols--,this.CheckCursor(),g(this,p,x).call(this))});n(this,"CheckCursor",()=>{a(this,d)>this.TotalPanelNumber-this.ScreenCells&&(b(this,d,this.TotalPanelNumber-this.ScreenCells),a(this,d)<0&&b(this,d,0)),this.UpdateCursorInfo()});n(this,"NextPage",()=>{const t=this.TotalPanelNumber-this.ScreenCells;a(this,d)<t&&(b(this,d,a(this,d)+this.ScreenCells),a(this,d)>t&&b(this,d,t),g(this,p,x).call(this))});n(this,"PrevPage",()=>{a(this,d)>0&&(b(this,d,a(this,d)-this.ScreenCells),a(this,d)<0&&b(this,d,0),g(this,p,x).call(this))});n(this,"Exit",()=>{this.DestroyUI(),this.ExitEx()});n(this,"DestroyUI",()=>{this.screen!==null&&(this.uiBoxes={},this.screen.destroy(),this.screen=null)});n(this,"Render",()=>{this.screen&&this.screen.render()});this.uidata=t,b(this,y,e),this.SetupUI()}ClickEx(t){}get gridData(){return this.uidata}set gridData(t){this.uidata=t,g(this,S,v).call(this),this.UpdateCursorInfo(),this.Render()}get gridDataPanels(){return this.uidata.panels}set gridDataPanels(t){this.uidata.panels=t,g(this,S,v).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,H=new WeakMap,P=new WeakMap,S=new WeakSet,v=function(){if(!this.screen)return;const t=Object.keys(this.uidata.panels),e=Object.keys(this.uiBoxes);for(let o=0;o<e.length;o++)if(typeof this.uidata.panels[e[o]]>"u"){let u=this.uiBoxes[e[o]];typeof u<"u"&&(this.screen.remove(u.boxHeader),this.screen.remove(u.box),u=null,delete this.uiBoxes[e[o]])}const l={};for(let o=0;o<this.uidata.grid.cols*this.uidata.grid.rows;o++){const u=a(this,d)+o,c=o%this.uidata.grid.cols,k=Math.floor(o/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:B,width:z,height:K}=a(this,C).call(this,h),w=r.box({parent:this.screen,top:I,left:B,width:z,height:K,style:{bg:"#101010",fg:"white"},border:{type:"line"},keys:!1,tags:!0}),q=r.box({parent:this.screen,top:I,left:B+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:w,boxHeader:q},q.setIndex(-1),w.on("click",()=>{this.ClickEx(w.get("panel"))}),typeof h.widgets<"u"&&h.widgets!==null)for(const[,R]of Object.entries(h.widgets)){const E={...R.options};E.top&&E.top>=w.height-3&&(E.top=w.height-4);const j=r[R.widget].call(this,E);j.set("id",W.v4()),w.append(j),w.set(R.widget,j)}w.set("panel",h),this.uiBoxes[h.id].box=w,l[h.id]=!0}else a(this,P).call(this,h,k,c,this.uiBoxes[h.id]),l[h.id]=!0;a(this,y)&&a(this,y).call(this,this.uiBoxes[h.id].box,h)}}for(const[o]of Object.entries(this.uiBoxes))typeof l[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()},s.MenuBar=M,s.STSUIFrame=$,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("node:events"),require("blessed"),require("colors"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","node:events","blessed","colors","uuid"],i):(s=typeof globalThis<"u"?globalThis:s||self,i(s["@nsshunt/stsconfig"]={},s.events,s.blessed,null,s.uuid))})(this,function(s,i,r,D,$){var l,m,y,C,U,H,P,S,T,p,x;"use strict";var A=Object.defineProperty;var G=(s,i,r)=>i in s?A(s,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[i]=r;var n=(s,i,r)=>(G(s,typeof i!="symbol"?i+"":i,r),r),M=(s,i,r)=>{if(!i.has(s))throw TypeError("Cannot "+r)};var a=(s,i,r)=>(M(s,i,"read from private field"),r?r.call(s):i.get(s)),f=(s,i,r)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,r)},b=(s,i,r,D)=>(M(s,i,"write to private field"),D?D.call(s,r):i.set(s,r),r);var g=(s,i,r)=>(M(s,i,"access private method"),r);class N{constructor(q,t){n(this,"listb",null);const e={parent:q,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?e.top=0:e.bottom=0,e.commands={},t.menuitems.forEach(d=>{e.commands&&(e.commands[d.text]={keys:[d.key],callback:d.cb})}),this.listb=r.listbar(e)}get listbar(){return this.listb}}class F extends i{constructor(t,e=null){super();f(this,S);f(this,p);n(this,"uiBoxes",{});n(this,"screen",null);f(this,l,0);f(this,m,null);n(this,"screenHeaderText","...");n(this,"minRows",1);n(this,"minCols",1);n(this,"minWidth",40);n(this,"minHeight",7);f(this,y,null);n(this,"sortInfo",null);n(this,"screenHeader",null);n(this,"uidata");f(this,C,t=>{if(!this.screen||!t.pos)return null;let e=this.screen.height;this.uidata.menu!==null&&(e-=this.uidata.menu.length);const d=this.screen.width,o=this.uidata.grid.rows,u=this.uidata.grid.cols,c=t.pos,k=Math.floor(d/u),h=Math.floor(e/o);let R=0;if(this.uidata.menu!==null){for(const[,B]of Object.entries(this.uidata.menu))if(B.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=d-c.col*k),c.row+c.rowSpan===o&&(I.height=e-c.row*h),I});f(this,U,(t,e)=>{const d=a(this,C).call(this,t);if(d&&(e.box.top=d.top,e.box.left=d.left,e.box.width=d.width,e.box.height=d.height,e.boxHeader.top=d.top,e.boxHeader.left=d.left+2,typeof t.widgets<"u"&&t.widgets!==null)){for(const[,o]of Object.entries(t.widgets))if(o.widget==="log"){const u=e.box.get(o.widget);u.position.top>=e.box.height-4?u.position.top=e.box.height-4:o.options.top&&(u.position.top=o.options.top)}}});f(this,H,()=>{for(const[,t]of Object.entries(this.uiBoxes))a(this,U).call(this,t.box.get("panel"),t)});f(this,P,(t,e,d,o)=>{t.pos={row:e,col:d,rowSpan:1,colSpan:1},a(this,U).call(this,t,o),o.boxHeader.setContent(t.panelHeader)});n(this,"SetupUI",()=>{if(this.DestroyUI(),this.screen===null&&(this.screen=r.screen({smartCSR:!0})),!this.screen)return;const t=this.uidata;if(this.screen.title=t.title,this.screen.on("resize",()=>{a(this,H).call(this),this.Render()}),t.menu!==null)for(let e=0;e<t.menu.length;e++)new N(this.screen,t.menu[e]);this.screen.key(["C-c"],()=>{this.DestroyUI(),this.emit("exit")}),this.screen.key(["escape"],()=>{this.emit("escape")}),g(this,S,T).call(this),b(this,y,r.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=r.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=r.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()});n(this,"UpdateCursorInfo",()=>{a(this,y)&&a(this,y).setContent(`Cursor: ${a(this,l)} / ${this.TotalPanelNumber}`)});n(this,"UpdateSortInfo",t=>{this.sortInfo&&this.sortInfo.setContent(`Sort: ${t}`)});n(this,"UpdateScreenHeader",t=>{this.screenHeaderText=t,this.screenHeader&&this.screenHeader.setContent(`[ ${t} ]`)});n(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))});n(this,"DecRows",()=>{this.uidata.grid.rows>this.minRows&&(this.uidata.grid.rows--,this.CheckCursor(),g(this,p,x).call(this))});n(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))});n(this,"DecCols",()=>{this.uidata.grid.cols>this.minCols&&(this.uidata.grid.cols--,this.CheckCursor(),g(this,p,x).call(this))});n(this,"CheckCursor",()=>{a(this,l)>this.TotalPanelNumber-this.ScreenCells&&(b(this,l,this.TotalPanelNumber-this.ScreenCells),a(this,l)<0&&b(this,l,0)),this.UpdateCursorInfo()});n(this,"NextPage",()=>{const t=this.TotalPanelNumber-this.ScreenCells;a(this,l)<t&&(b(this,l,a(this,l)+this.ScreenCells),a(this,l)>t&&b(this,l,t),g(this,p,x).call(this))});n(this,"PrevPage",()=>{a(this,l)>0&&(b(this,l,a(this,l)-this.ScreenCells),a(this,l)<0&&b(this,l,0),g(this,p,x).call(this))});n(this,"Exit",()=>{this.DestroyUI(),this.emit("exit")});n(this,"DestroyUI",()=>{this.screen!==null&&(this.uiBoxes={},this.screen.destroy(),this.screen=null)});n(this,"Render",()=>{this.screen&&this.screen.render()});this.uidata=t,b(this,m,e),this.SetupUI()}get gridData(){return this.uidata}set gridData(t){this.uidata=t,g(this,S,T).call(this),this.UpdateCursorInfo(),this.Render()}get gridDataPanels(){return this.uidata.panels}set gridDataPanels(t){this.uidata.panels=t,g(this,S,T).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}}l=new WeakMap,m=new WeakMap,y=new WeakMap,C=new WeakMap,U=new WeakMap,H=new WeakMap,P=new WeakMap,S=new WeakSet,T=function(){if(!this.screen)return;const t=Object.keys(this.uidata.panels),e=Object.keys(this.uiBoxes);for(let o=0;o<e.length;o++)if(typeof this.uidata.panels[e[o]]>"u"){let u=this.uiBoxes[e[o]];typeof u<"u"&&(this.screen.remove(u.boxHeader),this.screen.remove(u.box),u=null,delete this.uiBoxes[e[o]])}const d={};for(let o=0;o<this.uidata.grid.cols*this.uidata.grid.rows;o++){const u=a(this,l)+o,c=o%this.uidata.grid.cols,k=Math.floor(o/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:B,width:E,height:K}=a(this,C).call(this,h),w=r.box({parent:this.screen,top:I,left:B,width:E,height:K,style:{bg:"#101010",fg:"white"},border:{type:"line"},keys:!1,tags:!0}),W=r.box({parent:this.screen,top:I,left:B+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:w,boxHeader:W},W.setIndex(-1),w.on("click",()=>{this.emit("click",w.get("panel"))}),typeof h.widgets<"u"&&h.widgets!==null)for(const[,j]of Object.entries(h.widgets)){const v={...j.options};v.top&&v.top>=w.height-3&&(v.top=w.height-4);const O=r[j.widget].call(this,v);O.set("id",$.v4()),w.append(O),w.set(j.widget,O)}w.set("panel",h),this.uiBoxes[h.id].box=w,d[h.id]=!0}else a(this,P).call(this,h,k,c,this.uiBoxes[h.id]),d[h.id]=!0;a(this,m)&&a(this,m).call(this,this.uiBoxes[h.id].box,h)}}for(const[o]of Object.entries(this.uiBoxes))typeof d[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()},s.MenuBar=N,s.STSUIFrame=F,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=stsconfig.umd.js.map
@@ -1 +1 @@
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 'node:events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\nimport { createPublicKey } from 'crypto';\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n//export class STSUIFrame {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = { };\n\n for (let i=0; i < (this.uidata.grid.cols * this.uidata.grid.rows); i++) {\n const gridPos = this.#cursor + i;\n const col = i % this.uidata.grid.cols;\n const row = Math.floor(i / this.uidata.grid.cols);\n\n // Get the panel for this position within the grid\n const panel: panel = this.uidata.panels[panelKeys[gridPos]];\n if (typeof panel !== 'undefined') {\n if (typeof this.uiBoxes[panel.id] === 'undefined') {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n\n const calculatedBoxPos = this.#CalcBoxPos(panel);\n if (!calculatedBoxPos) {\n return\n }\n const { top, left, width, height } = this.#CalcBoxPos(panel) as boxPos;\n\n // Create the UI box\n const box: stsBlessed.box = blessed.box({\n parent: this.screen,\n top: top,\n left: left,\n width: width,\n height: height,\n style:\n {\n bg: '#101010' // was gray\n ,fg: 'white'\n },\n border:\n {\n type: 'line'\n },\n keys: false, // Do not allow default key handling for this box\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n const boxHeader: stsBlessed.listbar = blessed.box({\n parent: this.screen,\n top: top,\n left: left+2,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: panel.panelHeader,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.uiBoxes[panel.id] = { box: box, boxHeader: boxHeader };\n\n boxHeader.setIndex(-1);\n\n // https://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-inside-a-callback\n box.on('click', () => {\n //this.emit('click', box.data.panel);\n //this.emit('click', box.get('panel') as panel);\n this.ClickEx(box.get('panel') as panel);\n });\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n // Create a fresh copy of the options for this widget instance.\n // If this is not done, all widgets will use the same options object and will not be able\n // to update screen elements individually.\n const widgetoptions = {...value.options};\n\n // Ensure that we always show at least 2 lines of log data even if this means we position over the top of\n // elements above this position.\n if (widgetoptions.top && (widgetoptions.top >= (box.height - 3))) {\n widgetoptions.top = box.height - 4;\n }\n const widget: stsBlessed.element = blessed[value.widget].call(this, widgetoptions);\n widget.set('id', uuidv4());\n box.append(widget);\n box.set(value.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n }\n }\n\n // The entire panel is accessible using the _panel property.\n // This is so that the model is accessible from within the handlebars templates.\n // Access to a named widget can be done using box._panel.widgets[name] or box._panel.widgets.name\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(panel, row, col, this.uiBoxes[panel.id]);\n\n touched[panel.id] = true;\n //this.#uiBox[panel.id].box.show();\n }\n\n // Render the uiBox with the renderPanelFn using the panel as the utility including the model\n if (this.#renderPanelFn) {\n this.#renderPanelFn(this.uiBoxes[panel.id].box, panel);\n }\n }\n }\n\n for (const [key, ] of Object.entries(this.uiBoxes)) {\n if (typeof touched[key] === 'undefined') {\n this.uiBoxes[key].box.hide();\n this.uiBoxes[key].boxHeader.hide();\n } else {\n this.uiBoxes[key].box.show();\n this.uiBoxes[key].boxHeader.show();\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n //this.emit('escape');\n this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n //this.emit('exit');\n this.ExitEx();\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n}\n"],"names":["MenuBar","screen","options","__publicField","compoptions","menuItem","blessed","STSUIFrame","EventEmitter","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":"28BAcO,MAAMA,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,IAAM,EAElBA,EAAY,OAAS,EAGzBA,EAAY,SAAW,GACfF,EAAA,UAAU,QAASG,GAAa,CAChCD,EAAY,WACAA,EAAA,SAASC,EAAS,IAAI,EAAI,CAClC,KAAM,CAAEA,EAAS,GAAI,EACrB,S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AAM,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,EAqPA/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 'node:events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport 'colors';\n\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as stsBlessed from './index'\nimport * as MenuBar from './menubar'\nimport { createPublicKey } from 'crypto';\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface widget {\n widget: string // Name of the blessed widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n}\n\nexport interface widgets {\n [widgetName: string]: widget\n}\n\nexport interface panel {\n id: string,\n pos?: {\n row: number,\n col: number,\n rowSpan: number,\n colSpan: number\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any\n panelHeader: string,\n widgets: widgets\n}\n\nexport interface panels {\n [panelId: string]: panel\n}\n\nexport interface gridData {\n\ttitle: string\n\tgrid: { rows: number, cols: number },\n\tmenu: menuOptions,\n\tpanels: panels\n}\n\nexport interface renderPanelCb {\n\t(box: stsBlessed.box, panel: panel): void\n}\n\nexport interface boxPos {\n\ttop: number,\n\tleft: number,\n\twidth: number,\n\theight: number\n}\n\nexport interface uiBox {\n\tbox: stsBlessed.box, // blessed box\n\tboxHeader: stsBlessed.listbar // blessed box\n}\n\nexport interface uiBoxes {\n\t[key: string]: uiBox\n}\n\nexport class STSUIFrame extends EventEmitter {\n//export class STSUIFrame {\n private uiBoxes:uiBoxes = { }; // { box: <<blessed box>>, boxHeader: <<blessed box>> }\n private screen: stsBlessed.screen | null = null;\n #cursor = 0; // panel index with the complete model data.\n #renderPanelFn: renderPanelCb | null = null;\n private screenHeaderText = '...';\n\n private minRows = 1;\n private minCols = 1;\n private minWidth = 40;\n private minHeight = 7;\n\n #cursorInfo: stsBlessed.box | null = null;\n private sortInfo: stsBlessed.box | null = null; // Current sort mode UI box control\n private screenHeader: stsBlessed.box | null = null;\n\n private uidata: gridData;\n\n /**\n * \n * @param {*} data The screen layout data. Schema: { title: <str>,\n * grid: { rows: <int>, cols: <int> }, \n * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, \n * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }\n */\n constructor(data: gridData, renderPanelFn: renderPanelCb | null = null) {\n super();\n this.uidata = data;\n this.#renderPanelFn = renderPanelFn;\n this.SetupUI();\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n /*\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\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 /*\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\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","EventEmitter","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":"28BAcO,MAAMA,CACb,CAII,YAAYC,EAA2BC,EAAyB,CAHxDC,EAAA,aAAkC,MAItC,MAAMC,EAAyC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"",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.mjs",
@@ -71,13 +71,10 @@ export declare class STSUIFrame extends EventEmitter {
71
71
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
72
72
  */
73
73
  constructor(data: gridData, renderPanelFn?: renderPanelCb | null);
74
- ClickEx(panel: any): void;
75
74
  get gridData(): gridData;
76
75
  set gridData(gridData: gridData);
77
76
  get gridDataPanels(): panels;
78
77
  set gridDataPanels(gridDataPanels: panels);
79
- ExitEx(): void;
80
- EscapeEx(): void;
81
78
  /**
82
79
  *
83
80
  * @param {*} data UI Data
@@ -1 +1 @@
1
- {"version":3,"file":"stsuiframe.d.ts","sourceRoot":"","sources":["../src/stsuiframe.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,aAAa,CAAA;AAMtC,OAAO,QAAQ,CAAC;AAIhB,OAAO,KAAK,UAAU,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AAGpC,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,MAAM,GAAG,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,KAAK;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAA;KAClB,CAAC;IAEF,IAAI,EAAE,GAAG,CAAA;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,MAAM;IACnB,CAAC,OAAO,EAAE,MAAM,GAAG,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