@nsshunt/stsui 1.10.11 → 1.10.12

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