@nsshunt/stsui 1.11.65 → 1.11.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
@@ -84,10 +84,10 @@ var STSUIFrame = class extends node_events.default {
84
84
  screenHeader = null;
85
85
  uidata;
86
86
  /**
87
- *
87
+ *
88
88
  * @param {*} data The screen layout data. Schema: { title: <str>,
89
- * grid: { rows: <int>, cols: <int> },
90
- * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> },
89
+ * grid: { rows: <int>, cols: <int> },
90
+ * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> },
91
91
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
92
92
  */
93
93
  constructor(data, renderPanelFn = null) {
@@ -100,7 +100,7 @@ var STSUIFrame = class extends node_events.default {
100
100
  return blessed.default;
101
101
  }
102
102
  /**
103
- *
103
+ *
104
104
  * @param {number} position The index (0 based) for the panel item to be calculated
105
105
  * @returns object with top, left, width and height correctly set
106
106
  */
@@ -190,7 +190,7 @@ var STSUIFrame = class extends node_events.default {
190
190
  }
191
191
  };
192
192
  /**
193
- *
193
+ *
194
194
  * Setup all panels
195
195
  */
196
196
  #SetupPanels() {
@@ -317,7 +317,7 @@ var STSUIFrame = class extends node_events.default {
317
317
  this.Render();
318
318
  }
319
319
  /**
320
- *
320
+ *
321
321
  * @param {*} data UI Data
322
322
  */
323
323
  SetupUI = () => {
@@ -469,7 +469,7 @@ var STSUIFrame = class extends node_events.default {
469
469
  this.emit("exit");
470
470
  };
471
471
  /**
472
- *
472
+ *
473
473
  */
474
474
  DestroyUI = () => {
475
475
  if (this.screen !== null) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["#renderPanelFn","#CalcBoxPos","#UpdateUIBoxPos","#cursor","#UpdatePanelPosition","#SetupPanels","#ReSize","#cursorInfo","#UpdateUI"],"sources":["../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["import blessed from 'blessed';\nimport * as stsBlessed from './index.js'\n\nexport interface menuitem {\n\ttext: string,\n\tkey: string,\n\tcb(): void\n}\n\nexport interface MenuBarOptions {\n\ttop: boolean\n\tmenuitems: menuitem[]\n}\n\nexport class MenuBar\n{\n private listb:stsBlessed.listbar | null = null;\n\n // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }\n constructor(screen: stsBlessed.screen, options: MenuBarOptions) {\n const compoptions: stsBlessed.elementOptions = {\n parent: screen,\n left: 0,\n right: 0,\n height: 1,\n width: 'shrink',\n mouse: true,\n keys: true,\n autoCommandKeys: true,\n scrollable: true,\n style: {\n fg: 'yellow',\n bg: 'blue',\n\n item: {\n hover: {\n fg: 'white',\n bg: 'green',\n }\n },\n selected: {\n fg: 'black',\n bg: 'yellow',\n }\n }\n }\n if (options.top === true) {\n compoptions.top = 0;\n } else {\n compoptions.bottom = 0;\n }\n\n compoptions.commands = { };\n options.menuitems.forEach((menuItem) => {\n if (compoptions.commands) {\n compoptions.commands[menuItem.text] = {\n keys: [ menuItem.key ],\n callback: menuItem.cb\n }\n }\n })\n\n this.listb = blessed.listbar(compoptions);\n }\n\n get listbar()\n {\n return this.listb;\n }\n}\n","import EventEmitter from 'node:events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport * as stsBlessed from './index.js'\nimport * as MenuBar from './menubar.js'\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface IWidgetEvent {\n cb(panel: panel, widget: stsBlessed.element, parent: stsBlessed.element): void\n}\n\nexport interface IWidgetEvents {\n [eventId: string]: IWidgetEvent\n}\n\nexport interface widget {\n widget: string // Name of the blessed widget\n id: string // unique ID for this widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n children?: widgets\n events?: IWidgetEvents\n}\n\nexport interface widgets {\n [widgetId: 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 | null\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 get blessed() {\n return blessed;\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n /*\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n */\n\n CreateWidget = (widgetName: string, widgetoptions: stsBlessed.elementOptions): stsBlessed.element => {\n const widget: stsBlessed.element = blessed[widgetName].call(this, widgetoptions);\n return widget;\n }\n\n CreateWidgetEx(widgetName: string, widgetoptions: stsBlessed.elementOptions): stsBlessed.element {\n const widget: stsBlessed.element = blessed[widgetName].call(this, widgetoptions);\n return widget;\n }\n\n SetupWidgets = (box: stsBlessed.element | null, panel: panel, parent: stsBlessed.element, blessedWidgets: widgets) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(blessedWidgets)) {\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 = { ...blessedWidgetDetails.options };\n\n if (box) {\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 }\n \n const widget: stsBlessed.element = blessed[blessedWidgetDetails.widget].call(this, widgetoptions);\n widget.set('id', blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(blessedWidgetDetails.events)) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit('widgetsetup', box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n this.SetupWidgets(null, panel, widget, blessedWidgetDetails.children);\n }\n }\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n\n this.emit('preremovebox', uiBox.box, uiBox.box.get('panel') as panel);\n\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n\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 bold, 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.get('panel') as panel);\n });\n\n box.on('destroy', () => {\n this.emit('destroy', box, panel);\n });\n\n box.on('remove', () => {\n this.emit('remove', box, panel);\n });\n\n box.on('detach', () => {\n this.emit('detach', box, panel);\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[id] or box._panel.widgets.id\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n this.emit('boxsetup', box, panel);\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n /*\n const SetupWidgets = (parent: stsBlessed.element, blessedWidgets: widgets) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(blessedWidgets)) {\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 = { ...blessedWidgetDetails.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[blessedWidgetDetails.widget].call(this, widgetoptions);\n widget.set('id', blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(blessedWidgetDetails.events)) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit('widgetsetup', box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n SetupWidgets(widget, blessedWidgetDetails.children);\n }\n }\n }\n */\n this.SetupWidgets(box, panel, box, panel.widgets);\n this.emit('widgetsetupcomplete', box, panel, panel.widgets);\n }\n\n touched[panel.id] = true;\n \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 const box = this.uiBoxes[key].box;\n const panel = box.get('panel') as panel;\n if (typeof touched[key] === 'undefined') {\n box.hide();\n this.uiBoxes[key].boxHeader.hide();\n this.emit('boxhide', this.uiBoxes[key].box, panel, panel.widgets);\n } else {\n box.show();\n this.uiBoxes[key].boxHeader.show();\n this.emit('boxshow', this.uiBoxes[key].box, panel, panel.widgets);\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n /*\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n */\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n this.emit('exit');\n //this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n this.emit('escape');\n //this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n this.emit('exit');\n //this.ExitEx();\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n\n get mainScreen(): stsBlessed.screen | null {\n return this.screen;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAa,UAAb,MACA;CACI,QAA0C;CAG1C,YAAY,QAA2B,SAAyB;EAC5D,MAAM,cAAyC;GAC3C,QAAQ;GACR,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,OAAO;G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AAE;GACjB,KAAK,OAAO,QAAQ;GACpB,KAAK,SAAS;EAClB;CACJ;;;;CAKA,eAAqB;EACjB,IAAI,KAAK,QACL,KAAK,OAAO,OAAO;CAE3B;CAEA,IAAI,aAAuC;EACvC,OAAO,KAAK;CAChB;AACJ"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["import blessed from \"blessed\";\nimport * as stsBlessed from \"./index.js\";\n\nexport interface menuitem {\n text: string;\n key: string;\n cb(): void;\n}\n\nexport interface MenuBarOptions {\n top: boolean;\n menuitems: menuitem[];\n}\n\nexport class MenuBar {\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 return this.listb;\n }\n}\n","import EventEmitter from \"node:events\";\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from \"blessed\";\n\nimport * as stsBlessed from \"./index.js\";\nimport * as MenuBar from \"./menubar.js\";\n\nexport type menuOptions = MenuBar.MenuBarOptions[];\n\nexport interface IWidgetEvent {\n cb(\n panel: panel,\n widget: stsBlessed.element,\n parent: stsBlessed.element\n ): void;\n}\n\nexport interface IWidgetEvents {\n [eventId: string]: IWidgetEvent;\n}\n\nexport interface widget {\n widget: string; // Name of the blessed widget\n id: string; // unique ID for this widget\n options: stsBlessed.elementOptions; // blessed widget options - used in the constructor of the blessed widget\n children?: widgets;\n events?: IWidgetEvents;\n}\n\nexport interface widgets {\n [widgetId: 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 | null;\n}\n\nexport interface panels {\n [panelId: string]: panel;\n}\n\nexport interface gridData {\n title: string;\n grid: { rows: number; cols: number };\n menu: menuOptions;\n panels: panels;\n}\n\nexport interface renderPanelCb {\n (box: stsBlessed.box, panel: panel): void;\n}\n\nexport interface boxPos {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface uiBox {\n box: stsBlessed.box; // blessed box\n boxHeader: stsBlessed.listbar; // blessed box\n}\n\nexport interface uiBoxes {\n [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 get blessed() {\n return blessed;\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(\n value.widget\n ) 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 = (\n panel: panel,\n row: number,\n col: number,\n uiBox: uiBox\n ): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n };\n\n /*\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n */\n\n CreateWidget = (\n widgetName: string,\n widgetoptions: stsBlessed.elementOptions\n ): stsBlessed.element => {\n const widget: stsBlessed.element = blessed[widgetName].call(\n this,\n widgetoptions\n );\n return widget;\n };\n\n CreateWidgetEx(\n widgetName: string,\n widgetoptions: stsBlessed.elementOptions\n ): stsBlessed.element {\n const widget: stsBlessed.element = blessed[widgetName].call(\n this,\n widgetoptions\n );\n return widget;\n }\n\n SetupWidgets = (\n box: stsBlessed.element | null,\n panel: panel,\n parent: stsBlessed.element,\n blessedWidgets: widgets\n ) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(\n blessedWidgets\n )) {\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 = { ...blessedWidgetDetails.options };\n\n if (box) {\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 }\n\n const widget: stsBlessed.element = blessed[\n blessedWidgetDetails.widget\n ].call(this, widgetoptions);\n widget.set(\"id\", blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(\n blessedWidgetDetails.events\n )) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit(\"widgetsetup\", box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n this.SetupWidgets(\n null,\n panel,\n widget,\n blessedWidgetDetails.children\n );\n }\n }\n };\n\n /**\n *\n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i = 0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === \"undefined\") {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== \"undefined\") {\n this.emit(\n \"preremovebox\",\n uiBox.box,\n uiBox.box.get(\"panel\") as panel\n );\n\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = {};\n\n for (\n let i = 0;\n i < this.uidata.grid.cols * this.uidata.grid.rows;\n i++\n ) {\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(\n panel\n ) 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 bg: \"#101010\", // was gray\n fg: \"white\",\n },\n border: {\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 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 bold, 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.get(\"panel\") as panel);\n });\n\n box.on(\"destroy\", () => {\n this.emit(\"destroy\", box, panel);\n });\n\n box.on(\"remove\", () => {\n this.emit(\"remove\", box, panel);\n });\n\n box.on(\"detach\", () => {\n this.emit(\"detach\", box, panel);\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[id] or box._panel.widgets.id\n box.set(\"panel\", panel);\n\n this.uiBoxes[panel.id].box = box;\n\n this.emit(\"boxsetup\", box, panel);\n\n if (\n typeof panel.widgets !== \"undefined\" &&\n panel.widgets !== null\n ) {\n /*\n const SetupWidgets = (parent: stsBlessed.element, blessedWidgets: widgets) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(blessedWidgets)) {\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 = { ...blessedWidgetDetails.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[blessedWidgetDetails.widget].call(this, widgetoptions);\n widget.set('id', blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(blessedWidgetDetails.events)) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit('widgetsetup', box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n SetupWidgets(widget, blessedWidgetDetails.children);\n }\n }\n }\n */\n this.SetupWidgets(box, panel, box, panel.widgets);\n this.emit(\n \"widgetsetupcomplete\",\n box,\n panel,\n panel.widgets\n );\n }\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(\n panel,\n row,\n col,\n this.uiBoxes[panel.id]\n );\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 const box = this.uiBoxes[key].box;\n const panel = box.get(\"panel\") as panel;\n if (typeof touched[key] === \"undefined\") {\n box.hide();\n this.uiBoxes[key].boxHeader.hide();\n this.emit(\n \"boxhide\",\n this.uiBoxes[key].box,\n panel,\n panel.widgets\n );\n } else {\n box.show();\n this.uiBoxes[key].boxHeader.show();\n this.emit(\n \"boxshow\",\n this.uiBoxes[key].box,\n panel,\n panel.widgets\n );\n }\n }\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n /*\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n */\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> },\n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n *\n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true,\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on(\"resize\", () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key([\"C-c\"], (): void => {\n this.DestroyUI();\n this.emit(\"exit\");\n //this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key([\"escape\"], (): void => {\n this.emit(\"escape\");\n //this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: \"shrink\",\n height: 1,\n style: {\n 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 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.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: \"center\",\n width: \"shrink\",\n height: 1,\n style: {\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(\n `Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`\n );\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 (\n this.screen &&\n this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight\n ) {\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 (\n this.screen &&\n this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth\n ) {\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 get mainScreen(): stsBlessed.screen | null {\n return this.screen;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAa,UAAb,MAAqB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K,MAAM;CAEpB;;;;CAKA,kBAAwB;EAEpB,IAAI,KAAK,WAAW,MAAM;GACtB,KAAK,UAAU,CAAC;GAChB,KAAK,OAAO,QAAQ;GACpB,KAAK,SAAS;EAClB;CACJ;;;;CAKA,eAAqB;EACjB,IAAI,KAAK,QACL,KAAK,OAAO,OAAO;CAE3B;CAEA,IAAI,aAAuC;EACvC,OAAO,KAAK;CAChB;AACJ"}
package/dist/index.mjs CHANGED
@@ -59,10 +59,10 @@ var STSUIFrame = class extends EventEmitter {
59
59
  screenHeader = null;
60
60
  uidata;
61
61
  /**
62
- *
62
+ *
63
63
  * @param {*} data The screen layout data. Schema: { title: <str>,
64
- * grid: { rows: <int>, cols: <int> },
65
- * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> },
64
+ * grid: { rows: <int>, cols: <int> },
65
+ * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> },
66
66
  * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
67
67
  */
68
68
  constructor(data, renderPanelFn = null) {
@@ -75,7 +75,7 @@ var STSUIFrame = class extends EventEmitter {
75
75
  return blessed;
76
76
  }
77
77
  /**
78
- *
78
+ *
79
79
  * @param {number} position The index (0 based) for the panel item to be calculated
80
80
  * @returns object with top, left, width and height correctly set
81
81
  */
@@ -165,7 +165,7 @@ var STSUIFrame = class extends EventEmitter {
165
165
  }
166
166
  };
167
167
  /**
168
- *
168
+ *
169
169
  * Setup all panels
170
170
  */
171
171
  #SetupPanels() {
@@ -292,7 +292,7 @@ var STSUIFrame = class extends EventEmitter {
292
292
  this.Render();
293
293
  }
294
294
  /**
295
- *
295
+ *
296
296
  * @param {*} data UI Data
297
297
  */
298
298
  SetupUI = () => {
@@ -444,7 +444,7 @@ var STSUIFrame = class extends EventEmitter {
444
444
  this.emit("exit");
445
445
  };
446
446
  /**
447
- *
447
+ *
448
448
  */
449
449
  DestroyUI = () => {
450
450
  if (this.screen !== null) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["#renderPanelFn","#CalcBoxPos","#UpdateUIBoxPos","#cursor","#UpdatePanelPosition","#SetupPanels","#ReSize","#cursorInfo","#UpdateUI"],"sources":["../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["import blessed from 'blessed';\nimport * as stsBlessed from './index.js'\n\nexport interface menuitem {\n\ttext: string,\n\tkey: string,\n\tcb(): void\n}\n\nexport interface MenuBarOptions {\n\ttop: boolean\n\tmenuitems: menuitem[]\n}\n\nexport class MenuBar\n{\n private listb:stsBlessed.listbar | null = null;\n\n // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }\n constructor(screen: stsBlessed.screen, options: MenuBarOptions) {\n const compoptions: stsBlessed.elementOptions = {\n parent: screen,\n left: 0,\n right: 0,\n height: 1,\n width: 'shrink',\n mouse: true,\n keys: true,\n autoCommandKeys: true,\n scrollable: true,\n style: {\n fg: 'yellow',\n bg: 'blue',\n\n item: {\n hover: {\n fg: 'white',\n bg: 'green',\n }\n },\n selected: {\n fg: 'black',\n bg: 'yellow',\n }\n }\n }\n if (options.top === true) {\n compoptions.top = 0;\n } else {\n compoptions.bottom = 0;\n }\n\n compoptions.commands = { };\n options.menuitems.forEach((menuItem) => {\n if (compoptions.commands) {\n compoptions.commands[menuItem.text] = {\n keys: [ menuItem.key ],\n callback: menuItem.cb\n }\n }\n })\n\n this.listb = blessed.listbar(compoptions);\n }\n\n get listbar()\n {\n return this.listb;\n }\n}\n","import EventEmitter from 'node:events'\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from 'blessed';\n\nimport * as stsBlessed from './index.js'\nimport * as MenuBar from './menubar.js'\n\nexport type menuOptions = MenuBar.MenuBarOptions[]\n\nexport interface IWidgetEvent {\n cb(panel: panel, widget: stsBlessed.element, parent: stsBlessed.element): void\n}\n\nexport interface IWidgetEvents {\n [eventId: string]: IWidgetEvent\n}\n\nexport interface widget {\n widget: string // Name of the blessed widget\n id: string // unique ID for this widget\n options: stsBlessed.elementOptions // blessed widget options - used in the constructor of the blessed widget\n children?: widgets\n events?: IWidgetEvents\n}\n\nexport interface widgets {\n [widgetId: 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 | null\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 get blessed() {\n return blessed;\n }\n\n /**\n * \n * @param {number} position The index (0 based) for the panel item to be calculated\n * @returns object with top, left, width and height correctly set\n */\n #CalcBoxPos = (panel: panel): boxPos | null => {\n // Calculate the position and dimensions for this UI element\n\n if (!this.screen) return null;\n if (!panel.pos) return null;\n\n let screenHeight = this.screen.height;\n if (this.uidata.menu !== null) {\n screenHeight -= this.uidata.menu.length; // Allow for any menu items\n }\n const screenWidth = this.screen.width;\n\n const rows = this.uidata.grid.rows;\n const cols = this.uidata.grid.cols;\n\n const pos = panel.pos;\n\n const colWidth = Math.floor(screenWidth / cols);\n const rowHeight = Math.floor(screenHeight / rows);\n\n // Allow for a top offset if a top menu is present\n let topoffset = 0;\n if (this.uidata.menu !== null) {\n for (const [, value] of Object.entries(this.uidata.menu)) {\n if (value.top === true) {\n topoffset = 1;\n break;\n }\n }\n }\n\n const boxPos: boxPos = {\n top: (pos.row * rowHeight) + topoffset,\n left: pos.col * colWidth,\n width: colWidth * pos.colSpan,\n height: rowHeight * pos.rowSpan\n }\n\n // Now check if this panel is on the far right and if so adjust for a perfect fit\n\n if ((pos.col + pos.colSpan) === cols) {\n //if (pos.col === (cols - 1)) {\n boxPos.width = screenWidth - (pos.col * colWidth);\n }\n\n // Now check if this panel is on the bottom and if so adjust for a perfect fit\n if ((pos.row + pos.rowSpan) === rows) {\n boxPos.height = screenHeight - (pos.row * rowHeight);\n }\n\n return boxPos;\n }\n\n #UpdateUIBoxPos = (panel: panel, uiBox: uiBox): void => {\n const pos: boxPos | null = this.#CalcBoxPos(panel);\n if (!pos) {\n return;\n }\n\n uiBox.box.top = pos.top;\n uiBox.box.left = pos.left;\n uiBox.box.width = pos.width;\n uiBox.box.height = pos.height;\n\n uiBox.boxHeader.top = pos.top;\n uiBox.boxHeader.left = pos.left + 2;\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n for (const [, value] of Object.entries(panel.widgets)) {\n if (value.widget === 'log') {\n const widget = uiBox.box.get(value.widget) as stsBlessed.element;\n if (widget.position.top >= (uiBox.box.height - 4)) {\n widget.position.top = uiBox.box.height - 4;\n } else {\n if (value.options.top) {\n widget.position.top = value.options.top;\n }\n }\n }\n }\n }\n };\n\n /**\n * ReSize the grid layout\n */\n #ReSize = (): void => {\n for (const [, value] of Object.entries(this.uiBoxes)) {\n this.#UpdateUIBoxPos(value.box.get('panel') as panel, value);\n }\n }\n\n #UpdatePanelPosition = (panel: panel, row: number, col: number, uiBox: uiBox): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n }\n\n /*\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n */\n\n CreateWidget = (widgetName: string, widgetoptions: stsBlessed.elementOptions): stsBlessed.element => {\n const widget: stsBlessed.element = blessed[widgetName].call(this, widgetoptions);\n return widget;\n }\n\n CreateWidgetEx(widgetName: string, widgetoptions: stsBlessed.elementOptions): stsBlessed.element {\n const widget: stsBlessed.element = blessed[widgetName].call(this, widgetoptions);\n return widget;\n }\n\n SetupWidgets = (box: stsBlessed.element | null, panel: panel, parent: stsBlessed.element, blessedWidgets: widgets) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(blessedWidgets)) {\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 = { ...blessedWidgetDetails.options };\n\n if (box) {\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 }\n \n const widget: stsBlessed.element = blessed[blessedWidgetDetails.widget].call(this, widgetoptions);\n widget.set('id', blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(blessedWidgetDetails.events)) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit('widgetsetup', box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n this.SetupWidgets(null, panel, widget, blessedWidgetDetails.children);\n }\n }\n }\n\n /**\n * \n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i=0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === 'undefined') {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== 'undefined') {\n\n this.emit('preremovebox', uiBox.box, uiBox.box.get('panel') as panel);\n\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n\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 bold, 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.get('panel') as panel);\n });\n\n box.on('destroy', () => {\n this.emit('destroy', box, panel);\n });\n\n box.on('remove', () => {\n this.emit('remove', box, panel);\n });\n\n box.on('detach', () => {\n this.emit('detach', box, panel);\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[id] or box._panel.widgets.id\n box.set('panel', panel);\n\n this.uiBoxes[panel.id].box = box;\n\n this.emit('boxsetup', box, panel);\n\n if (typeof panel.widgets !== 'undefined' && panel.widgets !== null) {\n /*\n const SetupWidgets = (parent: stsBlessed.element, blessedWidgets: widgets) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(blessedWidgets)) {\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 = { ...blessedWidgetDetails.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[blessedWidgetDetails.widget].call(this, widgetoptions);\n widget.set('id', blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(blessedWidgetDetails.events)) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit('widgetsetup', box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n SetupWidgets(widget, blessedWidgetDetails.children);\n }\n }\n }\n */\n this.SetupWidgets(box, panel, box, panel.widgets);\n this.emit('widgetsetupcomplete', box, panel, panel.widgets);\n }\n\n touched[panel.id] = true;\n \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 const box = this.uiBoxes[key].box;\n const panel = box.get('panel') as panel;\n if (typeof touched[key] === 'undefined') {\n box.hide();\n this.uiBoxes[key].boxHeader.hide();\n this.emit('boxhide', this.uiBoxes[key].box, panel, panel.widgets);\n } else {\n box.show();\n this.uiBoxes[key].boxHeader.show();\n this.emit('boxshow', this.uiBoxes[key].box, panel, panel.widgets);\n }\n }\n\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n /*\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n */\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> }, \n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n * \n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on('resize', () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key(['C-c'], (): void => {\n this.DestroyUI();\n this.emit('exit');\n //this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key(['escape'], (): void => {\n this.emit('escape');\n //this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.sortInfo = blessed.box({\n parent: this.screen,\n top: 0,\n right: 0,\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: '',\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n\n this.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: 'center',\n width: 'shrink',\n height: 1,\n style:\n {\n bg: 'gray'\n , fg: 'white'\n },\n keys: false, // Do not allow default key handling for this box\n mouse: false,\n content: `[ ... ]`,\n tags: true // Allow style in-line tags such as bolt, italics, etc.\n });\n\n this.UpdateCursorInfo();\n this.UpdateSortInfo('Default');\n this.UpdateScreenHeader(this.screenHeaderText);\n\n // Render the screen.\n this.Render();\n }\n\n UpdateCursorInfo = (): void => {\n if (this.#cursorInfo) {\n this.#cursorInfo.setContent(`Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`);\n }\n }\n\n UpdateSortInfo = (sortMode: string): void => {\n if (this.sortInfo) {\n this.sortInfo.setContent(`Sort: ${sortMode}`);\n }\n }\n\n UpdateScreenHeader = (screenHeaderText: string): void => {\n this.screenHeaderText = screenHeaderText;\n if (this.screenHeader) {\n this.screenHeader.setContent(`[ ${screenHeaderText} ]`);\n }\n }\n\n get rows(): number {\n return this.uidata.grid.rows;\n }\n\n get cols(): number {\n return this.uidata.grid.cols;\n }\n\n IncRows = (): void => {\n if (this.screen && (this.screen.height / (this.uidata.grid.rows+1) > this.minHeight)) {\n this.uidata.grid.rows++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecRows = (): void => {\n if (this.uidata.grid.rows > this.minRows) {\n this.uidata.grid.rows--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n IncCols = (): void => {\n if (this.screen && (this.screen.width / (this.uidata.grid.cols+1) > this.minWidth)) {\n this.uidata.grid.cols++;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n DecCols = (): void => {\n if (this.uidata.grid.cols > this.minCols) {\n this.uidata.grid.cols--;\n this.CheckCursor();\n this.#UpdateUI();\n }\n }\n\n get ScreenCells(): number {\n return this.uidata.grid.cols * this.uidata.grid.rows;\n }\n\n get TotalPanelNumber(): number {\n return Object.keys(this.uidata.panels).length;\n }\n\n CheckCursor = (): void => {\n if (this.#cursor > (this.TotalPanelNumber - this.ScreenCells)) {\n this.#cursor = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n }\n this.UpdateCursorInfo();\n }\n\n NextPage = (): void => {\n const endpos = this.TotalPanelNumber - this.ScreenCells;\n if (this.#cursor < endpos) {\n this.#cursor += this.ScreenCells;\n if (this.#cursor > endpos) {\n this.#cursor = endpos;\n }\n this.#UpdateUI();\n }\n }\n\n PrevPage = (): void => {\n if (this.#cursor > 0) {\n this.#cursor -= this.ScreenCells;\n if (this.#cursor < 0) {\n this.#cursor = 0;\n }\n this.#UpdateUI();\n }\n }\n\n #UpdateUI(): void {\n this.SetupUI();\n\n //@@ fix screen render - should not need to blow entire screen away ...\n //this.#SetupPanels();\n //this.UpdateCursorInfo();\n //this.Render();\n }\n\n Exit = (): void => {\n this.DestroyUI();\n this.emit('exit');\n //this.ExitEx();\n }\n\n /**\n * \n */\n DestroyUI = (): void => {\n // Destroy the screen and disable UI log processing\n if (this.screen !== null) {\n this.uiBoxes = { };\n this.screen.destroy();\n this.screen = null;\n }\n }\n\n /**\n * Render the screen.\n */\n Render = (): void => {\n if (this.screen) {\n this.screen.render();\n }\n }\n\n get mainScreen(): stsBlessed.screen | null {\n return this.screen;\n }\n}\n"],"mappings":";;;AAcA,IAAa,UAAb,MACA;CACI,QAA0C;CAG1C,YAAY,QAA2B,SAAyB;EAC5D,MAAM,cAAyC;GAC3C,QAAQ;GACR,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,OAAO;GACP,MAAM;GACN,iBAAiB;GACjB,YAAY;GACZ,OAAO;IACH,IAAI;IACJ,IAAI;IAEJ,MAAM,EACF,OAAO;KACH,IAAI;KACJ,IAAI;IACR,EACJ;IACA,UAAU;KACN,IAAI;KACJ,IAAI;IACR;GACJ;EACJ;EACA,IAAI,QAAQ,QAAQ,MAChB,YAAY,MAAM;OAElB,YAAY,S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K,SAAS;GACtC,KAAK,OAAO,KAAK;GACjB,KAAK,YAAY;GACjB,KAAKA,UAAU;EACnB;CACJ;CAEA,IAAI,cAAsB;EACtB,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK;CACpD;CAEA,IAAI,mBAA2B;EAC3B,OAAO,OAAO,KAAK,KAAK,OAAO,MAAM,EAAE;CAC3C;CAEA,oBAA0B;EACtB,IAAI,KAAKL,UAAW,KAAK,mBAAmB,KAAK,aAAc;GAC3D,KAAKA,UAAU,KAAK,mBAAmB,KAAK;GAC5C,IAAI,KAAKA,UAAU,GACf,KAAKA,UAAU;EAEvB;EACA,KAAK,iBAAiB;CAC1B;CAEA,iBAAuB;EACnB,MAAM,SAAS,KAAK,mBAAmB,KAAK;EAC5C,IAAI,KAAKA,UAAU,QAAQ;GACvB,KAAKA,WAAW,KAAK;GACrB,IAAI,KAAKA,UAAU,QACf,KAAKA,UAAU;GAEnB,KAAKK,UAAU;EACnB;CACJ;CAEA,iBAAuB;EACnB,IAAI,KAAKL,UAAU,GAAG;GAClB,KAAKA,WAAW,KAAK;GACrB,IAAI,KAAKA,UAAU,GACf,KAAKA,UAAU;GAEnB,KAAKK,UAAU;EACnB;CACJ;CAEA,YAAkB;EACd,KAAK,QAAQ;CAMjB;CAEA,aAAmB;EACf,KAAK,UAAU;EACf,KAAK,KAAK,MAAM;CAEpB;;;;CAKA,kBAAwB;EAEpB,IAAI,KAAK,WAAW,MAAM;GACtB,KAAK,UAAU,CAAE;GACjB,KAAK,OAAO,QAAQ;GACpB,KAAK,SAAS;EAClB;CACJ;;;;CAKA,eAAqB;EACjB,IAAI,KAAK,QACL,KAAK,OAAO,OAAO;CAE3B;CAEA,IAAI,aAAuC;EACvC,OAAO,KAAK;CAChB;AACJ"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/menubar.ts","../src/stsuiframe.ts"],"sourcesContent":["import blessed from \"blessed\";\nimport * as stsBlessed from \"./index.js\";\n\nexport interface menuitem {\n text: string;\n key: string;\n cb(): void;\n}\n\nexport interface MenuBarOptions {\n top: boolean;\n menuitems: menuitem[];\n}\n\nexport class MenuBar {\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 return this.listb;\n }\n}\n","import EventEmitter from \"node:events\";\n\n// https://github.com/yaronn/blessed-contrib\n//var contrib = require('blessed-contrib');\nimport blessed from \"blessed\";\n\nimport * as stsBlessed from \"./index.js\";\nimport * as MenuBar from \"./menubar.js\";\n\nexport type menuOptions = MenuBar.MenuBarOptions[];\n\nexport interface IWidgetEvent {\n cb(\n panel: panel,\n widget: stsBlessed.element,\n parent: stsBlessed.element\n ): void;\n}\n\nexport interface IWidgetEvents {\n [eventId: string]: IWidgetEvent;\n}\n\nexport interface widget {\n widget: string; // Name of the blessed widget\n id: string; // unique ID for this widget\n options: stsBlessed.elementOptions; // blessed widget options - used in the constructor of the blessed widget\n children?: widgets;\n events?: IWidgetEvents;\n}\n\nexport interface widgets {\n [widgetId: 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 | null;\n}\n\nexport interface panels {\n [panelId: string]: panel;\n}\n\nexport interface gridData {\n title: string;\n grid: { rows: number; cols: number };\n menu: menuOptions;\n panels: panels;\n}\n\nexport interface renderPanelCb {\n (box: stsBlessed.box, panel: panel): void;\n}\n\nexport interface boxPos {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface uiBox {\n box: stsBlessed.box; // blessed box\n boxHeader: stsBlessed.listbar; // blessed box\n}\n\nexport interface uiBoxes {\n [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 get blessed() {\n return blessed;\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(\n value.widget\n ) 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 = (\n panel: panel,\n row: number,\n col: number,\n uiBox: uiBox\n ): void => {\n // Update the panel position within the current screen view\n panel.pos = { row: row, col: col, rowSpan: 1, colSpan: 1 };\n this.#UpdateUIBoxPos(panel, uiBox);\n uiBox.boxHeader.setContent(panel.panelHeader);\n };\n\n /*\n ClickEx(panel: any) {\n //@@ override in sub-class\n }\n */\n\n CreateWidget = (\n widgetName: string,\n widgetoptions: stsBlessed.elementOptions\n ): stsBlessed.element => {\n const widget: stsBlessed.element = blessed[widgetName].call(\n this,\n widgetoptions\n );\n return widget;\n };\n\n CreateWidgetEx(\n widgetName: string,\n widgetoptions: stsBlessed.elementOptions\n ): stsBlessed.element {\n const widget: stsBlessed.element = blessed[widgetName].call(\n this,\n widgetoptions\n );\n return widget;\n }\n\n SetupWidgets = (\n box: stsBlessed.element | null,\n panel: panel,\n parent: stsBlessed.element,\n blessedWidgets: widgets\n ) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(\n blessedWidgets\n )) {\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 = { ...blessedWidgetDetails.options };\n\n if (box) {\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 }\n\n const widget: stsBlessed.element = blessed[\n blessedWidgetDetails.widget\n ].call(this, widgetoptions);\n widget.set(\"id\", blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(\n blessedWidgetDetails.events\n )) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit(\"widgetsetup\", box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n this.SetupWidgets(\n null,\n panel,\n widget,\n blessedWidgetDetails.children\n );\n }\n }\n };\n\n /**\n *\n * Setup all panels\n */\n #SetupPanels(): void {\n if (!this.screen) {\n return;\n }\n\n const panelKeys = Object.keys(this.uidata.panels);\n\n // Check for deleted panels\n const uiBoxIds = Object.keys(this.uiBoxes);\n for (let i = 0; i < uiBoxIds.length; i++) {\n if (typeof this.uidata.panels[uiBoxIds[i]] === \"undefined\") {\n let uiBox: uiBox | null = this.uiBoxes[uiBoxIds[i]];\n if (typeof uiBox !== \"undefined\") {\n this.emit(\n \"preremovebox\",\n uiBox.box,\n uiBox.box.get(\"panel\") as panel\n );\n\n this.screen.remove(uiBox.boxHeader);\n this.screen.remove(uiBox.box);\n\n uiBox = null;\n delete this.uiBoxes[uiBoxIds[i]];\n }\n }\n }\n\n const touched: Record<string, boolean> = {};\n\n for (\n let i = 0;\n i < this.uidata.grid.cols * this.uidata.grid.rows;\n i++\n ) {\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(\n panel\n ) 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 bg: \"#101010\", // was gray\n fg: \"white\",\n },\n border: {\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 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 bold, 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.get(\"panel\") as panel);\n });\n\n box.on(\"destroy\", () => {\n this.emit(\"destroy\", box, panel);\n });\n\n box.on(\"remove\", () => {\n this.emit(\"remove\", box, panel);\n });\n\n box.on(\"detach\", () => {\n this.emit(\"detach\", box, panel);\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[id] or box._panel.widgets.id\n box.set(\"panel\", panel);\n\n this.uiBoxes[panel.id].box = box;\n\n this.emit(\"boxsetup\", box, panel);\n\n if (\n typeof panel.widgets !== \"undefined\" &&\n panel.widgets !== null\n ) {\n /*\n const SetupWidgets = (parent: stsBlessed.element, blessedWidgets: widgets) => {\n for (const [blessedWidgetKey, blessedWidgetDetails] of Object.entries(blessedWidgets)) {\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 = { ...blessedWidgetDetails.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[blessedWidgetDetails.widget].call(this, widgetoptions);\n widget.set('id', blessedWidgetDetails.id);\n\n parent.append(widget);\n parent.set(blessedWidgetDetails.widget, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n parent.set(`__blessedWidgetKey__${blessedWidgetKey}`, widget); // Set the user data for this widget. This allows the handlebars template access via the name from the box object.\n\n if (blessedWidgetDetails.events) {\n for (const [eventName, eventDetails] of Object.entries(blessedWidgetDetails.events)) {\n widget.on(eventName, () => {\n eventDetails.cb(panel, widget, parent);\n });\n }\n }\n\n this.emit('widgetsetup', box, panel, widget);\n\n if (blessedWidgetDetails.children) {\n SetupWidgets(widget, blessedWidgetDetails.children);\n }\n }\n }\n */\n this.SetupWidgets(box, panel, box, panel.widgets);\n this.emit(\n \"widgetsetupcomplete\",\n box,\n panel,\n panel.widgets\n );\n }\n\n touched[panel.id] = true;\n } else {\n //@@ need to hide previous positions\n //@@ and show ones that are visible\n this.#UpdatePanelPosition(\n panel,\n row,\n col,\n this.uiBoxes[panel.id]\n );\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 const box = this.uiBoxes[key].box;\n const panel = box.get(\"panel\") as panel;\n if (typeof touched[key] === \"undefined\") {\n box.hide();\n this.uiBoxes[key].boxHeader.hide();\n this.emit(\n \"boxhide\",\n this.uiBoxes[key].box,\n panel,\n panel.widgets\n );\n } else {\n box.show();\n this.uiBoxes[key].boxHeader.show();\n this.emit(\n \"boxshow\",\n this.uiBoxes[key].box,\n panel,\n panel.widgets\n );\n }\n }\n }\n\n get gridData(): gridData {\n return this.uidata;\n }\n\n set gridData(gridData: gridData) {\n this.uidata = gridData;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n get gridDataPanels(): panels {\n return this.uidata.panels;\n }\n\n set gridDataPanels(gridDataPanels: panels) {\n this.uidata.panels = gridDataPanels;\n this.#SetupPanels();\n this.UpdateCursorInfo();\n this.Render();\n }\n\n /*\n ExitEx() {\n //@@ override in sub-class\n }\n\n EscapeEx() {\n //@@ override in sub-class\n }\n */\n\n // https://www.npmjs.com/package/blessed\n\n // data:= { title: <str>,\n // grid: { rows: <int>, cols: <int> },\n // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]\n // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }\n /**\n *\n * @param {*} data UI Data\n */\n SetupUI = (): void => {\n this.DestroyUI();\n\n if (this.screen === null) {\n // Create a screen object.\n this.screen = blessed.screen({\n smartCSR: true,\n });\n }\n\n if (!this.screen) {\n return;\n }\n\n const data = this.uidata;\n this.screen.title = data.title;\n this.screen.on(\"resize\", () => {\n this.#ReSize();\n this.Render();\n });\n\n if (data.menu !== null) {\n for (let i = 0; i < data.menu.length; i++) {\n new MenuBar.MenuBar(this.screen, data.menu[i]);\n }\n }\n\n // Allow the serrvice to terminate by pressing Control-C.\n this.screen.key([\"C-c\"], (): void => {\n this.DestroyUI();\n this.emit(\"exit\");\n //this.ExitEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.screen.key([\"escape\"], (): void => {\n this.emit(\"escape\");\n //this.EscapeEx();\n // Cleanly shutdown the main process. Exit code success (> 0 is exit in error state)\n //setTimeout(() => process.kill(process.pid), 0);\n });\n\n this.#SetupPanels();\n\n this.#cursorInfo = blessed.box({\n parent: this.screen,\n bottom: 0,\n right: 0,\n width: \"shrink\",\n height: 1,\n style: {\n 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 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.screenHeader = blessed.box({\n parent: this.screen,\n top: 0,\n left: \"center\",\n width: \"shrink\",\n height: 1,\n style: {\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(\n `Cursor: ${this.#cursor} / ${this.TotalPanelNumber}`\n );\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 (\n this.screen &&\n this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight\n ) {\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 (\n this.screen &&\n this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth\n ) {\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 get mainScreen(): stsBlessed.screen | null {\n return this.screen;\n }\n}\n"],"mappings":";;;AAcA,IAAa,UAAb,MAAqB;CACjB,QAA2C;CAG3C,YAAY,QAA2B,SAAyB;EAC5D,MAAM,cAAyC;GAC3C,QAAQ;GACR,MAAM;GACN,OAAO;GACP,QAAQ;GACR,OAAO;GACP,OAAO;GACP,MAAM;GACN,iBAAiB;GACjB,YAAY;GACZ,OAAO;IACH,IAAI;IACJ,IAAI;IAEJ,MAAM,EACF,OAAO;KACH,IAAI;KACJ,IAAI;IACR,EACJ;IACA,UAAU;KACN,IAAI;KACJ,IAAI;IACR;GACJ;EACJ;EACA,IAAI,QAAQ,QAAQ,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AS;GACtC,KAAK,OAAO,KAAK;GACjB,KAAK,YAAY;GACjB,KAAK,UAAU;EACnB;CACJ;CAEA,IAAI,cAAsB;EACtB,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK;CACpD;CAEA,IAAI,mBAA2B;EAC3B,OAAO,OAAO,KAAK,KAAK,OAAO,MAAM,CAAC,CAAC;CAC3C;CAEA,oBAA0B;EACtB,IAAI,KAAK,UAAU,KAAK,mBAAmB,KAAK,aAAa;GACzD,KAAK,UAAU,KAAK,mBAAmB,KAAK;GAC5C,IAAI,KAAK,UAAU,GACf,KAAK,UAAU;EAEvB;EACA,KAAK,iBAAiB;CAC1B;CAEA,iBAAuB;EACnB,MAAM,SAAS,KAAK,mBAAmB,KAAK;EAC5C,IAAI,KAAK,UAAU,QAAQ;GACvB,KAAK,WAAW,KAAK;GACrB,IAAI,KAAK,UAAU,QACf,KAAK,UAAU;GAEnB,KAAK,UAAU;EACnB;CACJ;CAEA,iBAAuB;EACnB,IAAI,KAAK,UAAU,GAAG;GAClB,KAAK,WAAW,KAAK;GACrB,IAAI,KAAK,UAAU,GACf,KAAK,UAAU;GAEnB,KAAK,UAAU;EACnB;CACJ;CAEA,YAAkB;EACd,KAAK,QAAQ;CAMjB;CAEA,aAAmB;EACf,KAAK,UAAU;EACf,KAAK,KAAK,MAAM;CAEpB;;;;CAKA,kBAAwB;EAEpB,IAAI,KAAK,WAAW,MAAM;GACtB,KAAK,UAAU,CAAC;GAChB,KAAK,OAAO,QAAQ;GACpB,KAAK,SAAS;EAClB;CACJ;;;;CAKA,eAAqB;EACjB,IAAI,KAAK,QACL,KAAK,OAAO,OAAO;CAE3B;CAEA,IAAI,aAAuC;EACvC,OAAO,KAAK;CAChB;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsui",
3
- "version": "1.11.65",
3
+ "version": "1.11.67",
4
4
  "description": "STS UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -41,14 +41,15 @@
41
41
  },
42
42
  "homepage": "https://github.com/nsshunt/stsui#readme",
43
43
  "devDependencies": {
44
- "@types/node": "^25.9.3",
45
- "@typescript-eslint/eslint-plugin": "^8.61.0",
46
- "@typescript-eslint/parser": "^8.61.0",
47
- "eslint": "^10.4.1",
48
- "globals": "^17.6.0",
44
+ "@types/node": "^26.3.0",
45
+ "@typescript-eslint/eslint-plugin": "^8.68.0",
46
+ "@typescript-eslint/parser": "^8.68.0",
47
+ "eslint": "^10.9.1",
48
+ "eslint-config-prettier": "^10.1.8",
49
+ "globals": "^17.11.0",
49
50
  "typescript": "^6.0.3",
50
- "vite": "^8.0.16",
51
- "vitest": "^4.1.8"
51
+ "vite": "^8.2.2",
52
+ "vitest": "^4.1.11"
52
53
  },
53
54
  "dependencies": {
54
55
  "blessed": "^0.1.81"
package/types/index.d.ts CHANGED
@@ -77,6 +77,6 @@ export interface elementOptions {
77
77
  style?: style;
78
78
  commands?: Record<string, command>;
79
79
  }
80
- export * from './stsuiframe.js';
81
- export * from './menubar.js';
80
+ export * from "./stsuiframe.js";
81
+ export * from "./menubar.js";
82
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAA;AAWjC,MAAM,WAAW,OAAO;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IAEd,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IAC9B,IAAI,IAAI,IAAI,CAAA;IACZ,IAAI,IAAI,IAAI,CAAA;IACZ,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA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AAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE;QACR,KAAK,EAAE,KAAK,CAAC;KAChB,CAAC;IACF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1,4 +1,4 @@
1
- import * as stsBlessed from './index.js';
1
+ import * as stsBlessed from "./index.js";
2
2
  export interface menuitem {
3
3
  text: string;
4
4
  key: string;
@@ -1 +1 @@
1
- {"version":3,"file":"menubar.d.ts","sourceRoot":"","sources":["../src/menubar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AAExC,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,IAAI,IAAI,CAAA;CACV;AAED,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,OAAO,CAAA;IACZ,SAAS,EAAE,QAAQ,EAAE,CAAA;CACrB;AAED,qBAAa,OAAO;IAEhB,OAAO,CAAC,KAAK,CAAkC;gBAGnC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc;IA8C9D,IAAI,OAAO,8BAGV;CACJ"}
1
+ {"version":3,"file":"menubar.d.ts","sourceRoot":"","sources":["../src/menubar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,IAAI,IAAI,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,OAAO,CAAC;IACb,SAAS,EAAE,QAAQ,EAAE,CAAC;CACzB;AAED,qBAAa,OAAO;IAChB,OAAO,CAAC,KAAK,CAAmC;gBAGpC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc;IA8C9D,IAAI,OAAO,8BAEV;CACJ"}
@@ -1,6 +1,6 @@
1
- import EventEmitter from 'node:events';
2
- import * as stsBlessed from './index.js';
3
- import * as MenuBar from './menubar.js';
1
+ import EventEmitter from "node:events";
2
+ import * as stsBlessed from "./index.js";
3
+ import * as MenuBar from "./menubar.js";
4
4
  export type menuOptions = MenuBar.MenuBarOptions[];
5
5
  export interface IWidgetEvent {
6
6
  cb(panel: panel, widget: stsBlessed.element, parent: stsBlessed.element): void;
@@ -1 +1 @@
1
- {"version":3,"file":"stsuiframe.d.ts","sourceRoot":"","sources":["../src/stsuiframe.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAA;AAMtC,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAA;AAElD,MAAM,WAAW,YAAY;IACzB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,GAAG,IAAI,CAAA;CACjF;AAED,MAAM,WAAW,aAAa;IAC1B,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAA;CAClC;AAED,MAAM,WAAW,MAAM;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,UAAU,CAAC,cAAc,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE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,IAAI,QAAO,IAAI,CAIb;IAEF;;OAEG;IACH,SAAS,QAAO,IAAI,CAOlB;IAEF;;OAEG;IACH,MAAM,QAAO,IAAI,CAIf;IAEF,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,CAEzC;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"stsuiframe.test.d.ts","sourceRoot":"","sources":["../src/stsuiframe.test.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"stsuiframe.test.d.ts","sourceRoot":"","sources":["../src/stsuiframe.test.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC"}