@scania/tegel-lite 0.0.3-rules-beta.6 → 0.0.3-rules-beta.7

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.
@@ -109,7 +109,7 @@ function askYesNo(rl, question) {
109
109
  */
110
110
  function showCheckboxList(items) {
111
111
  return new Promise((resolve) => {
112
- const selected = items.map(() => true); // All selected by default
112
+ const selected = items.map(() => false); // Nothing selected by default
113
113
  let cursor = 0;
114
114
 
115
115
  const { stdin, stdout } = process;
@@ -142,14 +142,14 @@ function showCheckboxList(items) {
142
142
  function rerender() {
143
143
  if (rendered) {
144
144
  // Move up to overwrite previous output
145
- // items.length + 1 (empty line) + 1 (help text) + 1 (trailing newline)
146
- const lineCount = items.length + 3;
147
- readline.moveCursor(stdout, 0, -lineCount);
148
- readline.clearScreenDown(stdout);
145
+ // render() produces items.length (items) + 1 (empty line) + 1 (help text) = items.length + 2 lines
146
+ const lineCount = items.length + 2;
147
+ // Use ANSI escape codes in single write for atomic update
148
+ stdout.write(`\x1B[${lineCount}A\x1B[J${render()}\n`);
149
+ } else {
150
+ stdout.write(render());
151
+ stdout.write('\n');
149
152
  }
150
-
151
- stdout.write(render());
152
- stdout.write('\n');
153
153
  rendered = true;
154
154
  }
155
155
 
@@ -182,8 +182,8 @@ function showCheckboxList(items) {
182
182
  return;
183
183
  }
184
184
 
185
- // Space → toggle current item
186
- if (key.name === 'space') {
185
+ // Space → toggle current item (check both key.name and key.sequence for compatibility)
186
+ if (key.name === 'space' || key.sequence === ' ') {
187
187
  selected[cursor] = !selected[cursor];
188
188
  }
189
189
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scania/tegel-lite",
3
- "version": "0.0.3-rules-beta.6",
3
+ "version": "0.0.3-rules-beta.7",
4
4
  "description": "Styles-only library for Tegel Design System (Beta)",
5
5
  "type": "module",
6
6
  "keywords": [