take4-console 0.15.0

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.
Files changed (131) hide show
  1. package/CHANGELOG.md +287 -0
  2. package/LICENSE +21 -0
  3. package/README.md +986 -0
  4. package/dist/Screen/InterfaceBuilder.d.mts +43 -0
  5. package/dist/Screen/InterfaceBuilder.d.mts.map +1 -0
  6. package/dist/Screen/InterfaceBuilder.mjs +355 -0
  7. package/dist/Screen/InterfaceBuilder.mjs.map +1 -0
  8. package/dist/Screen/Pos.d.mts +52 -0
  9. package/dist/Screen/Pos.d.mts.map +1 -0
  10. package/dist/Screen/Pos.mjs +105 -0
  11. package/dist/Screen/Pos.mjs.map +1 -0
  12. package/dist/Screen/Region.d.mts +31 -0
  13. package/dist/Screen/Region.d.mts.map +1 -0
  14. package/dist/Screen/Region.mjs +73 -0
  15. package/dist/Screen/Region.mjs.map +1 -0
  16. package/dist/Screen/RegistryHolder.d.mts +6 -0
  17. package/dist/Screen/RegistryHolder.d.mts.map +1 -0
  18. package/dist/Screen/RegistryHolder.mjs +14 -0
  19. package/dist/Screen/RegistryHolder.mjs.map +1 -0
  20. package/dist/Screen/Screen.d.mts +25 -0
  21. package/dist/Screen/Screen.d.mts.map +1 -0
  22. package/dist/Screen/Screen.mjs +100 -0
  23. package/dist/Screen/Screen.mjs.map +1 -0
  24. package/dist/Screen/Size.d.mts +23 -0
  25. package/dist/Screen/Size.d.mts.map +1 -0
  26. package/dist/Screen/Size.mjs +48 -0
  27. package/dist/Screen/Size.mjs.map +1 -0
  28. package/dist/Screen/StyleRegistry.d.mts +32 -0
  29. package/dist/Screen/StyleRegistry.d.mts.map +1 -0
  30. package/dist/Screen/StyleRegistry.mjs +80 -0
  31. package/dist/Screen/StyleRegistry.mjs.map +1 -0
  32. package/dist/Screen/Window.d.mts +121 -0
  33. package/dist/Screen/Window.d.mts.map +1 -0
  34. package/dist/Screen/Window.mjs +407 -0
  35. package/dist/Screen/Window.mjs.map +1 -0
  36. package/dist/Screen/WindowManager.d.mts +86 -0
  37. package/dist/Screen/WindowManager.d.mts.map +1 -0
  38. package/dist/Screen/WindowManager.mjs +399 -0
  39. package/dist/Screen/WindowManager.mjs.map +1 -0
  40. package/dist/Screen/controls/BarChart.d.mts +29 -0
  41. package/dist/Screen/controls/BarChart.d.mts.map +1 -0
  42. package/dist/Screen/controls/BarChart.mjs +90 -0
  43. package/dist/Screen/controls/BarChart.mjs.map +1 -0
  44. package/dist/Screen/controls/Button.d.mts +16 -0
  45. package/dist/Screen/controls/Button.d.mts.map +1 -0
  46. package/dist/Screen/controls/Button.mjs +34 -0
  47. package/dist/Screen/controls/Button.mjs.map +1 -0
  48. package/dist/Screen/controls/Checkbox.d.mts +23 -0
  49. package/dist/Screen/controls/Checkbox.d.mts.map +1 -0
  50. package/dist/Screen/controls/Checkbox.mjs +55 -0
  51. package/dist/Screen/controls/Checkbox.mjs.map +1 -0
  52. package/dist/Screen/controls/LineChart.d.mts +29 -0
  53. package/dist/Screen/controls/LineChart.d.mts.map +1 -0
  54. package/dist/Screen/controls/LineChart.mjs +172 -0
  55. package/dist/Screen/controls/LineChart.mjs.map +1 -0
  56. package/dist/Screen/controls/ListBox.d.mts +34 -0
  57. package/dist/Screen/controls/ListBox.d.mts.map +1 -0
  58. package/dist/Screen/controls/ListBox.mjs +138 -0
  59. package/dist/Screen/controls/ListBox.mjs.map +1 -0
  60. package/dist/Screen/controls/ProgressBar.d.mts +26 -0
  61. package/dist/Screen/controls/ProgressBar.d.mts.map +1 -0
  62. package/dist/Screen/controls/ProgressBar.mjs +70 -0
  63. package/dist/Screen/controls/ProgressBar.mjs.map +1 -0
  64. package/dist/Screen/controls/ProgressBarV.d.mts +22 -0
  65. package/dist/Screen/controls/ProgressBarV.d.mts.map +1 -0
  66. package/dist/Screen/controls/ProgressBarV.mjs +61 -0
  67. package/dist/Screen/controls/ProgressBarV.mjs.map +1 -0
  68. package/dist/Screen/controls/Radio.d.mts +23 -0
  69. package/dist/Screen/controls/Radio.d.mts.map +1 -0
  70. package/dist/Screen/controls/Radio.mjs +55 -0
  71. package/dist/Screen/controls/Radio.mjs.map +1 -0
  72. package/dist/Screen/controls/Sparkline.d.mts +29 -0
  73. package/dist/Screen/controls/Sparkline.d.mts.map +1 -0
  74. package/dist/Screen/controls/Sparkline.mjs +82 -0
  75. package/dist/Screen/controls/Sparkline.mjs.map +1 -0
  76. package/dist/Screen/controls/Spinner.d.mts +37 -0
  77. package/dist/Screen/controls/Spinner.d.mts.map +1 -0
  78. package/dist/Screen/controls/Spinner.mjs +87 -0
  79. package/dist/Screen/controls/Spinner.mjs.map +1 -0
  80. package/dist/Screen/controls/StatusLED.d.mts +22 -0
  81. package/dist/Screen/controls/StatusLED.d.mts.map +1 -0
  82. package/dist/Screen/controls/StatusLED.mjs +51 -0
  83. package/dist/Screen/controls/StatusLED.mjs.map +1 -0
  84. package/dist/Screen/controls/Tabs.d.mts +42 -0
  85. package/dist/Screen/controls/Tabs.d.mts.map +1 -0
  86. package/dist/Screen/controls/Tabs.mjs +126 -0
  87. package/dist/Screen/controls/Tabs.mjs.map +1 -0
  88. package/dist/Screen/controls/TextArea.d.mts +41 -0
  89. package/dist/Screen/controls/TextArea.d.mts.map +1 -0
  90. package/dist/Screen/controls/TextArea.mjs +197 -0
  91. package/dist/Screen/controls/TextArea.mjs.map +1 -0
  92. package/dist/Screen/controls/TextBox.d.mts +35 -0
  93. package/dist/Screen/controls/TextBox.d.mts.map +1 -0
  94. package/dist/Screen/controls/TextBox.mjs +135 -0
  95. package/dist/Screen/controls/TextBox.mjs.map +1 -0
  96. package/dist/Screen/types.d.mts +399 -0
  97. package/dist/Screen/types.d.mts.map +1 -0
  98. package/dist/Screen/types.mjs +22 -0
  99. package/dist/Screen/types.mjs.map +1 -0
  100. package/dist/index.d.mts +26 -0
  101. package/dist/index.d.mts.map +1 -0
  102. package/dist/index.mjs +41 -0
  103. package/dist/index.mjs.map +1 -0
  104. package/package.json +72 -0
  105. package/src/Screen/InterfaceBuilder.mts +403 -0
  106. package/src/Screen/Pos.mts +119 -0
  107. package/src/Screen/Region.mts +88 -0
  108. package/src/Screen/RegistryHolder.mts +16 -0
  109. package/src/Screen/Screen.mts +103 -0
  110. package/src/Screen/Size.mts +55 -0
  111. package/src/Screen/StyleRegistry.mts +95 -0
  112. package/src/Screen/Window.mts +439 -0
  113. package/src/Screen/WindowManager.mts +472 -0
  114. package/src/Screen/controls/BarChart.mts +109 -0
  115. package/src/Screen/controls/Button.mts +40 -0
  116. package/src/Screen/controls/Checkbox.mts +66 -0
  117. package/src/Screen/controls/LineChart.mts +202 -0
  118. package/src/Screen/controls/ListBox.mts +154 -0
  119. package/src/Screen/controls/ProgressBar.mts +88 -0
  120. package/src/Screen/controls/ProgressBarV.mts +77 -0
  121. package/src/Screen/controls/Radio.mts +66 -0
  122. package/src/Screen/controls/Sparkline.mts +101 -0
  123. package/src/Screen/controls/Spinner.mts +102 -0
  124. package/src/Screen/controls/StatusLED.mts +65 -0
  125. package/src/Screen/controls/Tabs.mts +140 -0
  126. package/src/Screen/controls/TextArea.mts +194 -0
  127. package/src/Screen/controls/TextBox.mts +139 -0
  128. package/src/Screen/types.mts +416 -0
  129. package/src/demo.mts +171 -0
  130. package/src/index.mts +105 -0
  131. package/src/layout.yaml +236 -0
package/src/index.mts ADDED
@@ -0,0 +1,105 @@
1
+ // ── take4-console ─────────────────────────────────────────────────────────────
2
+ //
3
+ // Public library barrel. This file is the package's entry point and re-exports
4
+ // every class, type, and constant that library consumers are expected to use.
5
+ //
6
+ // Consumer usage:
7
+ //
8
+ // import { Screen, Window, Pos, Size, Button } from 'take4-console';
9
+ // import type { ButtonOptions, StyleId } from 'take4-console';
10
+ //
11
+
12
+ // ── Core ──────────────────────────────────────────────────────────────────────
13
+ export { Screen } from './Screen/Screen.mjs';
14
+ export { Window } from './Screen/Window.mjs';
15
+ export { Region } from './Screen/Region.mjs';
16
+ export { StyleRegistry } from './Screen/StyleRegistry.mjs';
17
+ export { WindowManager } from './Screen/WindowManager.mjs';
18
+
19
+ // ── Geometry ──────────────────────────────────────────────────────────────────
20
+ export { Pos } from './Screen/Pos.mjs';
21
+ export { Pct, pct } from './Screen/Pos.mjs';
22
+ export { Size } from './Screen/Size.mjs';
23
+
24
+ // ── Interactive controls ──────────────────────────────────────────────────────
25
+ export { Button } from './Screen/controls/Button.mjs';
26
+ export { TextBox } from './Screen/controls/TextBox.mjs';
27
+ export { TextArea } from './Screen/controls/TextArea.mjs';
28
+ export { Checkbox } from './Screen/controls/Checkbox.mjs';
29
+ export { Radio } from './Screen/controls/Radio.mjs';
30
+ export { ListBox } from './Screen/controls/ListBox.mjs';
31
+ export { Tabs } from './Screen/controls/Tabs.mjs';
32
+
33
+ // ── Read-only display controls ────────────────────────────────────────────────
34
+ export { StatusLED } from './Screen/controls/StatusLED.mjs';
35
+ export { ProgressBar } from './Screen/controls/ProgressBar.mjs';
36
+ export { ProgressBarV } from './Screen/controls/ProgressBarV.mjs';
37
+ export { LineChart } from './Screen/controls/LineChart.mjs';
38
+ export { BarChart } from './Screen/controls/BarChart.mjs';
39
+ export { Sparkline } from './Screen/controls/Sparkline.mjs';
40
+ export { Spinner } from './Screen/controls/Spinner.mjs';
41
+
42
+ // ── YAML layout builder ───────────────────────────────────────────────────────
43
+ export { InterfaceBuilder } from './Screen/InterfaceBuilder.mjs';
44
+
45
+ // ── Built-in style name constants ─────────────────────────────────────────────
46
+ export {
47
+ BUILTIN_WINDOW_BG,
48
+ BUILTIN_BORDER,
49
+ BUILTIN_BORDER_FOCUSED,
50
+ BUILTIN_BORDER_DISABLED,
51
+ BUILTIN_TEXT,
52
+ BUILTIN_TEXT_FOCUSED,
53
+ BUILTIN_TEXT_DISABLED,
54
+ BUILTIN_TEXT_PLACEHOLDER,
55
+ BUILTIN_TEXT_CHECKED,
56
+ BUILTIN_CURSOR,
57
+ } from './Screen/types.mjs';
58
+
59
+ // ── Public type exports ───────────────────────────────────────────────────────
60
+ export type {
61
+ // Primitive types
62
+ Color,
63
+ StyleId,
64
+ Cell,
65
+ CellAttributes,
66
+ TerminalSize,
67
+ AxisSpec,
68
+ DimSpec,
69
+
70
+ // Window / border
71
+ BorderStyle,
72
+ WindowBorder,
73
+ WindowProperties,
74
+ WriteTextOptions,
75
+
76
+ // Control properties
77
+ ButtonProperties,
78
+ TextBoxProperties,
79
+ TextAreaProperties,
80
+ CheckboxProperties,
81
+ RadioProperties,
82
+ StatusLEDProperties,
83
+ ProgressBarProperties,
84
+ ProgressBarVProperties,
85
+ LineChartProperties,
86
+ BarChartProperties,
87
+ ListBoxProperties,
88
+ TabsProperties,
89
+ SparklineProperties,
90
+ SpinnerProperties,
91
+
92
+ // Focus & input
93
+ Focusable,
94
+ TerminalMouseEvent,
95
+ WindowManagerOptions,
96
+
97
+ // InterfaceBuilder YAML schema
98
+ YamlAxisValue,
99
+ YamlPosSpec,
100
+ YamlSizeSpec,
101
+ YamlWindowType,
102
+ YamlStyleDef,
103
+ YamlWindowDef,
104
+ YamlLayout,
105
+ } from './Screen/types.mjs';
@@ -0,0 +1,236 @@
1
+ windows:
2
+ - id: header
3
+ pos: topLeft
4
+ size: { fillWidth: 1 }
5
+ background: 24
6
+ children:
7
+ - id: headerSpinner
8
+ type: spinner
9
+ pos: { x: -1, y: 0 }
10
+ spinnerStyle: braille
11
+ label: "LIVE"
12
+ chartColor: 231
13
+
14
+ - id: statusBar
15
+ pos: { preset: bottom }
16
+ size: { fillWidth: 1 }
17
+ background: 24
18
+
19
+ - id: dialog
20
+ pos: center
21
+ size: { width: "90%", height: "92%" }
22
+ background: 236
23
+ border:
24
+ top: true
25
+ right: true
26
+ bottom: true
27
+ left: true
28
+ style: rounded
29
+ color: 240
30
+ content: " Controls demo"
31
+ children:
32
+
33
+ # ── Top-left: text inputs + checkboxes ───────────────────────────────────
34
+ - id: leftPanel
35
+ pos: { x: 1, y: 2 }
36
+ size: { width: "46%", height: "43%" }
37
+ background: 235
38
+ border: { top: true, right: true, bottom: true, left: true, style: single, color: 238 }
39
+ content: "Personal info"
40
+ children:
41
+ - id: tbUsername
42
+ type: textbox
43
+ pos: { x: 0, y: 2 }
44
+ size: { fillWidth: 3 }
45
+ value: "jan_kowalski"
46
+ placeholder: "username"
47
+ focused: true
48
+ - id: tbEmail
49
+ type: textbox
50
+ pos: { x: 0, y: 5 }
51
+ size: { fillWidth: 3 }
52
+ value: "jan@example.com"
53
+ placeholder: "e-mail"
54
+ - id: cb1
55
+ type: checkbox
56
+ pos: { x: 1, y: 9 }
57
+ label: "Enable notifications"
58
+ checked: true
59
+ - id: cb2
60
+ type: checkbox
61
+ pos: { x: 1, y: 10 }
62
+ label: "Dark mode"
63
+ checked: true
64
+ - id: cb3
65
+ type: checkbox
66
+ pos: { x: 1, y: 11 }
67
+ label: "Beta features"
68
+ - id: cb4
69
+ type: checkbox
70
+ pos: { x: 1, y: 12 }
71
+ label: "Telemetry (disabled)"
72
+ disabled: true
73
+
74
+ # ── Top-right: language radios + service status LEDs ─────────────────────
75
+ - id: rightPanel
76
+ pos: { x: "50%", y: 2 }
77
+ size: { width: "48%", height: "43%" }
78
+ background: 235
79
+ border: { top: true, right: true, bottom: true, left: true, style: single, color: 238 }
80
+ content: "Preferences"
81
+ children:
82
+ - id: r1
83
+ type: radio
84
+ pos: { x: 1, y: 2 }
85
+ label: "English"
86
+ checked: true
87
+ - id: r2
88
+ type: radio
89
+ pos: { x: 1, y: 3 }
90
+ label: "Polski"
91
+ focused: true
92
+ - id: r3
93
+ type: radio
94
+ pos: { x: 1, y: 4 }
95
+ label: "Deutsch"
96
+ - id: r4
97
+ type: radio
98
+ pos: { x: 1, y: 5 }
99
+ label: "Français (disabled)"
100
+ disabled: true
101
+ - id: ledApi
102
+ type: statusled
103
+ pos: { x: 1, y: 8 }
104
+ state: ok
105
+ label: "API Server"
106
+ - id: ledDb
107
+ type: statusled
108
+ pos: { x: 1, y: 9 }
109
+ state: ok
110
+ label: "Database"
111
+ - id: ledCache
112
+ type: statusled
113
+ pos: { x: 1, y: 10 }
114
+ state: warn
115
+ label: "Cache"
116
+ - id: ledWorker
117
+ type: statusled
118
+ pos: { x: 1, y: 11 }
119
+ state: error
120
+ label: "Worker"
121
+
122
+ # ── Bottom-left: resource progress bars ──────────────────────────────────
123
+ - id: monitorPanel
124
+ pos: { x: 1, y: "46%" }
125
+ size: { width: "46%", height: "43%" }
126
+ background: 235
127
+ border: { top: true, right: true, bottom: true, left: true, style: single, color: 238 }
128
+ content: "Resources"
129
+ children:
130
+ - id: pbCpu
131
+ type: progressbar
132
+ pos: { x: 0, y: 2 }
133
+ size: { width: "78%", height: 1 }
134
+ barValue: 73
135
+ max: 100
136
+ fillColor: 75
137
+ - id: pbMem
138
+ type: progressbar
139
+ pos: { x: 0, y: 4 }
140
+ size: { width: "78%", height: 1 }
141
+ barValue: 45
142
+ max: 100
143
+ fillColor: 82
144
+ - id: pbDisk
145
+ type: progressbar
146
+ pos: { x: 0, y: 6 }
147
+ size: { width: "78%", height: 1 }
148
+ barValue: 88
149
+ max: 100
150
+ fillColor: 214
151
+ - id: pbvLoad
152
+ type: progressbarv
153
+ pos: { x: -4, y: 1 }
154
+ size: { width: 3, height: "82%" }
155
+ barValue: 68
156
+ max: 100
157
+ fillColor: 75
158
+
159
+ # ── Bottom-right-left: tabbed charts / trends ────────────────────────────
160
+ - id: chartsPanel
161
+ type: tabs
162
+ pos: { x: "50%", y: "46%" }
163
+ size: { width: "30%", height: "43%" }
164
+ background: 235
165
+ border: { top: true, right: true, bottom: true, left: true, style: single, color: 238 }
166
+ titles: ["Charts", "Trends"]
167
+ activeIndex: 0
168
+ children:
169
+ # ── Tab 0: line + bar charts side by side ────────────────────────────
170
+ - id: lineChart
171
+ type: linechart
172
+ tab: 0
173
+ pos: { x: 0, y: 1 }
174
+ size: { width: "58%", height: "85%" }
175
+ - id: barChart
176
+ type: barchart
177
+ tab: 0
178
+ pos: { x: "60%", y: 1 }
179
+ size: { width: "38%", height: "85%" }
180
+ barWidth: 2
181
+
182
+ # ── Tab 1: three stacked sparklines ──────────────────────────────────
183
+ - id: sparkCpu
184
+ type: sparkline
185
+ tab: 1
186
+ pos: { x: 6, y: 2 }
187
+ size: { width: "85%", height: 1 }
188
+ chartColor: 75
189
+ - id: sparkMem
190
+ type: sparkline
191
+ tab: 1
192
+ pos: { x: 6, y: 3 }
193
+ size: { width: "85%", height: 1 }
194
+ chartColor: 82
195
+ - id: sparkDsk
196
+ type: sparkline
197
+ tab: 1
198
+ pos: { x: 6, y: 4 }
199
+ size: { width: "85%", height: 1 }
200
+ chartColor: 214
201
+
202
+ # ── Bottom-right-right: permanently visible event log (ListBox) ───────────
203
+ - id: eventsPanel
204
+ pos: { x: "81%", y: "46%" }
205
+ size: { width: "17%", height: "43%" }
206
+ background: 235
207
+ border: { top: true, right: true, bottom: true, left: true, style: single, color: 238 }
208
+ content: "Events"
209
+ children:
210
+ - id: eventsList
211
+ type: listbox
212
+ pos: { x: 0, y: 1 }
213
+ size: { width: "100%", height: "85%" }
214
+ items:
215
+ - "[12:04:21] user logged in"
216
+ - "[12:04:33] cache warmed"
217
+ - "[12:05:01] metric collected"
218
+ - "[12:05:18] job completed"
219
+
220
+ # ── Buttons ───────────────────────────────────────────────────────────────
221
+ - id: btnDisabled
222
+ type: button
223
+ pos: { x: 1, y: -4 }
224
+ size: { width: 11, height: 3 }
225
+ label: "Delete"
226
+ disabled: true
227
+ - id: btnCancel
228
+ type: button
229
+ pos: { x: -15, y: -4 }
230
+ size: { width: 11, height: 3 }
231
+ label: "Cancel"
232
+ - id: btnSave
233
+ type: button
234
+ pos: { x: -27, y: -4 }
235
+ size: { width: 11, height: 3 }
236
+ label: " Save"