@sc-voice/tools 3.22.0 → 3.23.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sc-voice/tools",
3
- "version": "3.22.0",
3
+ "version": "3.23.0",
4
4
  "description": "Utilities for SC-Voice",
5
5
  "main": "index.mjs",
6
6
  "files": [
@@ -31,6 +31,8 @@ export class ColorConsole {
31
31
  fyiColor2 = BRIGHT_BLACK,
32
32
  okColor1 = BRIGHT_GREEN,
33
33
  okColor2 = GREEN,
34
+ tagColor1 = BRIGHT_MAGENTA,
35
+ tagColor2 = MAGENTA,
34
36
  valueColor = CYAN,
35
37
  dateFormat = new Intl.DateTimeFormat(undefined, {
36
38
  dateStyle: 'short',
@@ -47,6 +49,8 @@ export class ColorConsole {
47
49
  fyiColor2,
48
50
  okColor1,
49
51
  okColor2,
52
+ tagColor1,
53
+ tagColor2,
50
54
  precision,
51
55
  valueColor,
52
56
  write,
@@ -97,9 +101,21 @@ export class ColorConsole {
97
101
  let { valueColor } = this;
98
102
  let label = '';
99
103
  let endColor = NO_COLOR;
104
+ let eol;
100
105
  return things.reduce((a, thing) => {
101
106
  let newLabel = '';
102
107
  let v = this.valueOf(thing);
108
+ let aLast = a.at(-1);
109
+ if (typeof aLast === 'string' && aLast.endsWith('\n' + endColor)) {
110
+ if (aLast === textColor + '\n' + endColor) {
111
+ a.pop();
112
+ } else {
113
+ const iLast = aLast.lastIndexOf('\n');
114
+ a.pop();
115
+ a.push(aLast.substring(0, iLast) + aLast.substring(iLast + 1));
116
+ }
117
+ v = '\n' + v;
118
+ }
103
119
  switch (typeof thing) {
104
120
  case 'object': {
105
121
  if (
@@ -168,4 +184,16 @@ export class ColorConsole {
168
184
  bad2(...rest) {
169
185
  this.write(...this.color(this.badColor2, ...rest));
170
186
  }
187
+
188
+ tag(...rest) {
189
+ return this.tag2(...rest);
190
+ }
191
+
192
+ tag1(...rest) {
193
+ this.write(...this.color(this.tagColor1, ...rest));
194
+ }
195
+
196
+ tag2(...rest) {
197
+ this.write(...this.color(this.tagColor2, ...rest));
198
+ }
171
199
  }