nhb-toolbox 4.20.11 → 4.20.16

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/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ All notable changes to the package will be documented here.
6
6
 
7
7
  ---
8
8
 
9
+ ## [4.20.16] - 2025-09-01
10
+
11
+ - **Added** new method `string()` in `LogStyler` (also in `Stylog`) and **made** `applyStyles()` method _public_.
12
+
9
13
  ## [4.20.11] - 2025-09-01
10
14
 
11
15
  - **Added** new _Symbol_ methods in `Chronos`: `Symbol.isConcatSpreadable` and `Symbol.match`.
@@ -110,58 +110,108 @@ class LogStyler {
110
110
  return new LogStyler([...this.#styles, style]);
111
111
  }
112
112
  /**
113
- * * Internal method to apply collected styles to the given input.
114
- * @remarks Supports both ANSI (Node.js) and CSS (Browser).
113
+ * * Returns styled tuple `[format, cssList]` for Browser.
115
114
  *
116
- * @param input Value to style (any type).
117
- * @param stringify Whether to stringify the input using `JSON.stringify()`. Defaults to `false`.
118
- * @returns Styled string for Node.js, or a tuple `[format, cssList]` for Browser.
115
+ * @remarks
116
+ * - This method is specifically designed for browser environments and returns a tuple containing the formatted string with `%c` placeholder and an array of CSS styles (`string[]`).
117
+ * - Use this when you need direct access to the CSS styling for custom browser output.
118
+ * - If you want to format with ANSI escape codes, consider using {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#stringinput-stringify string} method.
119
+ *
120
+ * @param input - Value to style (any type).
121
+ * @param stringify - Whether to apply `JSON.stringify()` before styling. Defaults to `false`.
122
+ * @returns Tuple `[format, cssList]` where:
123
+ * - `format`: String with `%c` placeholder for CSS styling
124
+ * - `cssList`: Array of CSS style strings
125
+ *
126
+ * @example
127
+ * // Basic usage in browser
128
+ * const styler = new LogStyler(['red', 'bold']);
129
+ * const [format, cssList] = styler.applyStyles('Error message');
130
+ * // format: "%cError message"
131
+ * // cssList: ["color: #FF0000", "font-weight: bold"]
132
+ *
133
+ * @example
134
+ * // Custom browser output handling
135
+ * const styled = new LogStyler(['blue', 'bgYellow', 'italic']);
136
+ * const [format, styles] = styled.applyStyles('Warning', true);
137
+ *
138
+ * // Use with custom logging function
139
+ * function customLog(formatted: string, styles: string[]) {
140
+ * const styleString = styles.join('; ');
141
+ * console.log(formatted, styleString);
142
+ * }
143
+ * customLog(format, styles);
144
+ *
145
+ * @example
146
+ * // With object stringification
147
+ * const dataOutput = new LogStyler(['green']).applyStyles({ id: 123 }, true);
148
+ * // format: "%c{\"id\":123}"
149
+ * // cssList: ["color: #008000"]
119
150
  */
120
- #applyStyles(input, stringify = false) {
151
+ applyStyles(input, stringify = false) {
121
152
  const stringified = stringify === true ? JSON.stringify(input) : input;
122
- if ((0, specials_1.isBrowser)()) {
123
- // Browser CSS
124
- const cssList = [];
125
- for (const style of this.#styles) {
126
- if (isTextStyle(style)) {
127
- cssList.push(CSS_TEXT_STYLES[style]);
128
- }
129
- else if (isBGColor(style)) {
130
- const color = css_colors_1.CSS_COLORS[extractColorName(style)];
131
- cssList.push(`background: ${color}`);
132
- }
133
- else {
134
- const color = css_colors_1.CSS_COLORS[style];
135
- cssList.push(`color: ${color}`);
136
- }
153
+ const cssList = [];
154
+ for (const style of this.#styles) {
155
+ if (isTextStyle(style)) {
156
+ cssList.push(CSS_TEXT_STYLES[style]);
157
+ }
158
+ else if (isBGColor(style)) {
159
+ const color = css_colors_1.CSS_COLORS[extractColorName(style)];
160
+ cssList.push(`background: ${color}`);
161
+ }
162
+ else {
163
+ const color = css_colors_1.CSS_COLORS[style];
164
+ cssList.push(`color: ${color}`);
137
165
  }
138
- return [`%c${stringified}`, cssList];
139
166
  }
140
- else {
141
- // Node ANSI
142
- let openSeq = '';
143
- let closeSeq = '';
144
- for (const style of this.#styles) {
145
- if (isTextStyle(style)) {
146
- const [open, close] = ANSI_TEXT_STYLES[style];
147
- openSeq += open;
148
- closeSeq = close + closeSeq;
149
- }
150
- else if (isBGColor(style)) {
151
- const hex = css_colors_1.CSS_COLORS[extractColorName(style)];
152
- const [open, close] = hexToAnsi(hex, true);
153
- openSeq += open;
154
- closeSeq = close + closeSeq;
155
- }
156
- else {
157
- const hex = css_colors_1.CSS_COLORS[style];
158
- const [open, close] = hexToAnsi(hex, false);
159
- openSeq += open;
160
- closeSeq = close + closeSeq;
161
- }
167
+ return [`%c${stringified}`, cssList];
168
+ }
169
+ /**
170
+ * * Returns the input as a styled string with ANSI escape codes.
171
+ *
172
+ * @remarks
173
+ * - This method returns ANSI-formatted strings suitable for environments that support ANSI escape codes (terminals, modern browser consoles, etc.).
174
+ * - For unsupported browsers, consider using the {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#loginput-stringify log} method to print directly or {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#applystylesinput-stringify applyStyles} to get styled tuple `[format, cssList]` for Browser.
175
+ *
176
+ * @param input - Value to style (any type).
177
+ * @param stringify - Whether to apply `JSON.stringify()` before styling. Defaults to `false`.
178
+ * @returns The styled string with ANSI escape codes.
179
+ *
180
+ * @example
181
+ * const styled = new LogStyler(['red', 'bold']);
182
+ * const errorMessage = styled.string('Error occurred, using LogStyler');
183
+ * // Or with Stylog
184
+ * const errorMessage = Stylog.red.bold.string('Error occurred, using Stylog');
185
+ * // Returns: "\x1b[31m\x1b[1mError occurred\xx1b[22m\x1b[39m"
186
+ *
187
+ * @example
188
+ * // Use in console (terminal or modern browser consoles)
189
+ * console.error(errorMessage);
190
+ * console.info(Stylog.red.bold.string('I support ANSI!'));
191
+ */
192
+ string(input, stringify = false) {
193
+ const stringified = stringify === true ? JSON.stringify(input) : input;
194
+ let openSeq = '', closeSeq = '';
195
+ for (const style of this.#styles) {
196
+ if (isTextStyle(style)) {
197
+ const [open, close] = ANSI_TEXT_STYLES[style];
198
+ openSeq += open;
199
+ closeSeq = close + closeSeq;
200
+ }
201
+ else if (isBGColor(style)) {
202
+ const hex = css_colors_1.CSS_COLORS[extractColorName(style)];
203
+ const [open, close] = hexToAnsi(hex, true);
204
+ openSeq += open;
205
+ closeSeq = close + closeSeq;
206
+ }
207
+ else {
208
+ const hex = css_colors_1.CSS_COLORS[style];
209
+ const [open, close] = hexToAnsi(hex, false);
210
+ openSeq += open;
211
+ closeSeq = close + closeSeq;
162
212
  }
163
- return openSeq + stringified + closeSeq;
164
213
  }
214
+ return openSeq + stringified + closeSeq;
165
215
  }
166
216
  /**
167
217
  * * Print styled input to the console.
@@ -171,11 +221,11 @@ class LogStyler {
171
221
  */
172
222
  log(input, stringify = false) {
173
223
  if ((0, specials_1.isBrowser)()) {
174
- const [fmt, cssList] = this.#applyStyles(input, stringify);
224
+ const [fmt, cssList] = this.applyStyles(input, stringify);
175
225
  console.log(fmt, cssList.join(';'));
176
226
  }
177
227
  else {
178
- console.log(this.#applyStyles(input, stringify));
228
+ console.log(this.string(input, stringify));
179
229
  }
180
230
  }
181
231
  }
@@ -62,6 +62,70 @@ export declare class LogStyler {
62
62
  * @returns A new `LogStyler` instance with the additional style applied.
63
63
  */
64
64
  style(style: Styles): LogStyler;
65
+ /**
66
+ * * Returns styled tuple `[format, cssList]` for Browser.
67
+ *
68
+ * @remarks
69
+ * - This method is specifically designed for browser environments and returns a tuple containing the formatted string with `%c` placeholder and an array of CSS styles (`string[]`).
70
+ * - Use this when you need direct access to the CSS styling for custom browser output.
71
+ * - If you want to format with ANSI escape codes, consider using {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#stringinput-stringify string} method.
72
+ *
73
+ * @param input - Value to style (any type).
74
+ * @param stringify - Whether to apply `JSON.stringify()` before styling. Defaults to `false`.
75
+ * @returns Tuple `[format, cssList]` where:
76
+ * - `format`: String with `%c` placeholder for CSS styling
77
+ * - `cssList`: Array of CSS style strings
78
+ *
79
+ * @example
80
+ * // Basic usage in browser
81
+ * const styler = new LogStyler(['red', 'bold']);
82
+ * const [format, cssList] = styler.applyStyles('Error message');
83
+ * // format: "%cError message"
84
+ * // cssList: ["color: #FF0000", "font-weight: bold"]
85
+ *
86
+ * @example
87
+ * // Custom browser output handling
88
+ * const styled = new LogStyler(['blue', 'bgYellow', 'italic']);
89
+ * const [format, styles] = styled.applyStyles('Warning', true);
90
+ *
91
+ * // Use with custom logging function
92
+ * function customLog(formatted: string, styles: string[]) {
93
+ * const styleString = styles.join('; ');
94
+ * console.log(formatted, styleString);
95
+ * }
96
+ * customLog(format, styles);
97
+ *
98
+ * @example
99
+ * // With object stringification
100
+ * const dataOutput = new LogStyler(['green']).applyStyles({ id: 123 }, true);
101
+ * // format: "%c{\"id\":123}"
102
+ * // cssList: ["color: #008000"]
103
+ */
104
+ applyStyles(input: any, stringify?: boolean): [string, string[]];
105
+ /**
106
+ * * Returns the input as a styled string with ANSI escape codes.
107
+ *
108
+ * @remarks
109
+ * - This method returns ANSI-formatted strings suitable for environments that support ANSI escape codes (terminals, modern browser consoles, etc.).
110
+ * - For unsupported browsers, consider using the {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#loginput-stringify log} method to print directly or {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#applystylesinput-stringify applyStyles} to get styled tuple `[format, cssList]` for Browser.
111
+ *
112
+ * @param input - Value to style (any type).
113
+ * @param stringify - Whether to apply `JSON.stringify()` before styling. Defaults to `false`.
114
+ * @returns The styled string with ANSI escape codes.
115
+ *
116
+ * @example
117
+ * const styled = new LogStyler(['red', 'bold']);
118
+ * const errorMessage = styled.string('Error occurred, using LogStyler');
119
+ * // Or with Stylog
120
+ * const errorMessage = Stylog.red.bold.string('Error occurred, using Stylog');
121
+ * // Returns: "\x1b[31m\x1b[1mError occurred\xx1b[22m\x1b[39m"
122
+ *
123
+ * @example
124
+ * // Use in console (terminal or modern browser consoles)
125
+ * console.error(errorMessage);
126
+ * console.info(Stylog.red.bold.string('I support ANSI!'));
127
+ */
128
+ string(input: any, stringify?: boolean): string;
65
129
  /**
66
130
  * * Print styled input to the console.
67
131
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stylog.d.ts","sourceRoot":"","sources":["../../../src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OAsBG;IACI,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,UAAQ,GAAG,MAAM;IAyBpD;;;;;OAKG;IACI,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,UAAQ,GAAG,IAAI;CAQ/C;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;KACpC,CAAC,IAAI,MAAM,GAAG,WAAW;CAC1B,CAAC;AA6BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,MAAM,EAAE,WAAgD,CAAC"}
@@ -103,58 +103,108 @@ export class LogStyler {
103
103
  return new LogStyler([...this.#styles, style]);
104
104
  }
105
105
  /**
106
- * * Internal method to apply collected styles to the given input.
107
- * @remarks Supports both ANSI (Node.js) and CSS (Browser).
106
+ * * Returns styled tuple `[format, cssList]` for Browser.
108
107
  *
109
- * @param input Value to style (any type).
110
- * @param stringify Whether to stringify the input using `JSON.stringify()`. Defaults to `false`.
111
- * @returns Styled string for Node.js, or a tuple `[format, cssList]` for Browser.
108
+ * @remarks
109
+ * - This method is specifically designed for browser environments and returns a tuple containing the formatted string with `%c` placeholder and an array of CSS styles (`string[]`).
110
+ * - Use this when you need direct access to the CSS styling for custom browser output.
111
+ * - If you want to format with ANSI escape codes, consider using {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#stringinput-stringify string} method.
112
+ *
113
+ * @param input - Value to style (any type).
114
+ * @param stringify - Whether to apply `JSON.stringify()` before styling. Defaults to `false`.
115
+ * @returns Tuple `[format, cssList]` where:
116
+ * - `format`: String with `%c` placeholder for CSS styling
117
+ * - `cssList`: Array of CSS style strings
118
+ *
119
+ * @example
120
+ * // Basic usage in browser
121
+ * const styler = new LogStyler(['red', 'bold']);
122
+ * const [format, cssList] = styler.applyStyles('Error message');
123
+ * // format: "%cError message"
124
+ * // cssList: ["color: #FF0000", "font-weight: bold"]
125
+ *
126
+ * @example
127
+ * // Custom browser output handling
128
+ * const styled = new LogStyler(['blue', 'bgYellow', 'italic']);
129
+ * const [format, styles] = styled.applyStyles('Warning', true);
130
+ *
131
+ * // Use with custom logging function
132
+ * function customLog(formatted: string, styles: string[]) {
133
+ * const styleString = styles.join('; ');
134
+ * console.log(formatted, styleString);
135
+ * }
136
+ * customLog(format, styles);
137
+ *
138
+ * @example
139
+ * // With object stringification
140
+ * const dataOutput = new LogStyler(['green']).applyStyles({ id: 123 }, true);
141
+ * // format: "%c{\"id\":123}"
142
+ * // cssList: ["color: #008000"]
112
143
  */
113
- #applyStyles(input, stringify = false) {
144
+ applyStyles(input, stringify = false) {
114
145
  const stringified = stringify === true ? JSON.stringify(input) : input;
115
- if (isBrowser()) {
116
- // Browser CSS
117
- const cssList = [];
118
- for (const style of this.#styles) {
119
- if (isTextStyle(style)) {
120
- cssList.push(CSS_TEXT_STYLES[style]);
121
- }
122
- else if (isBGColor(style)) {
123
- const color = CSS_COLORS[extractColorName(style)];
124
- cssList.push(`background: ${color}`);
125
- }
126
- else {
127
- const color = CSS_COLORS[style];
128
- cssList.push(`color: ${color}`);
129
- }
146
+ const cssList = [];
147
+ for (const style of this.#styles) {
148
+ if (isTextStyle(style)) {
149
+ cssList.push(CSS_TEXT_STYLES[style]);
150
+ }
151
+ else if (isBGColor(style)) {
152
+ const color = CSS_COLORS[extractColorName(style)];
153
+ cssList.push(`background: ${color}`);
154
+ }
155
+ else {
156
+ const color = CSS_COLORS[style];
157
+ cssList.push(`color: ${color}`);
130
158
  }
131
- return [`%c${stringified}`, cssList];
132
159
  }
133
- else {
134
- // Node ANSI
135
- let openSeq = '';
136
- let closeSeq = '';
137
- for (const style of this.#styles) {
138
- if (isTextStyle(style)) {
139
- const [open, close] = ANSI_TEXT_STYLES[style];
140
- openSeq += open;
141
- closeSeq = close + closeSeq;
142
- }
143
- else if (isBGColor(style)) {
144
- const hex = CSS_COLORS[extractColorName(style)];
145
- const [open, close] = hexToAnsi(hex, true);
146
- openSeq += open;
147
- closeSeq = close + closeSeq;
148
- }
149
- else {
150
- const hex = CSS_COLORS[style];
151
- const [open, close] = hexToAnsi(hex, false);
152
- openSeq += open;
153
- closeSeq = close + closeSeq;
154
- }
160
+ return [`%c${stringified}`, cssList];
161
+ }
162
+ /**
163
+ * * Returns the input as a styled string with ANSI escape codes.
164
+ *
165
+ * @remarks
166
+ * - This method returns ANSI-formatted strings suitable for environments that support ANSI escape codes (terminals, modern browser consoles, etc.).
167
+ * - For unsupported browsers, consider using the {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#loginput-stringify log} method to print directly or {@link https://toolbox.nazmul-nhb.dev/docs/classes/LogStyler#applystylesinput-stringify applyStyles} to get styled tuple `[format, cssList]` for Browser.
168
+ *
169
+ * @param input - Value to style (any type).
170
+ * @param stringify - Whether to apply `JSON.stringify()` before styling. Defaults to `false`.
171
+ * @returns The styled string with ANSI escape codes.
172
+ *
173
+ * @example
174
+ * const styled = new LogStyler(['red', 'bold']);
175
+ * const errorMessage = styled.string('Error occurred, using LogStyler');
176
+ * // Or with Stylog
177
+ * const errorMessage = Stylog.red.bold.string('Error occurred, using Stylog');
178
+ * // Returns: "\x1b[31m\x1b[1mError occurred\xx1b[22m\x1b[39m"
179
+ *
180
+ * @example
181
+ * // Use in console (terminal or modern browser consoles)
182
+ * console.error(errorMessage);
183
+ * console.info(Stylog.red.bold.string('I support ANSI!'));
184
+ */
185
+ string(input, stringify = false) {
186
+ const stringified = stringify === true ? JSON.stringify(input) : input;
187
+ let openSeq = '', closeSeq = '';
188
+ for (const style of this.#styles) {
189
+ if (isTextStyle(style)) {
190
+ const [open, close] = ANSI_TEXT_STYLES[style];
191
+ openSeq += open;
192
+ closeSeq = close + closeSeq;
193
+ }
194
+ else if (isBGColor(style)) {
195
+ const hex = CSS_COLORS[extractColorName(style)];
196
+ const [open, close] = hexToAnsi(hex, true);
197
+ openSeq += open;
198
+ closeSeq = close + closeSeq;
199
+ }
200
+ else {
201
+ const hex = CSS_COLORS[style];
202
+ const [open, close] = hexToAnsi(hex, false);
203
+ openSeq += open;
204
+ closeSeq = close + closeSeq;
155
205
  }
156
- return openSeq + stringified + closeSeq;
157
206
  }
207
+ return openSeq + stringified + closeSeq;
158
208
  }
159
209
  /**
160
210
  * * Print styled input to the console.
@@ -164,11 +214,11 @@ export class LogStyler {
164
214
  */
165
215
  log(input, stringify = false) {
166
216
  if (isBrowser()) {
167
- const [fmt, cssList] = this.#applyStyles(input, stringify);
217
+ const [fmt, cssList] = this.applyStyles(input, stringify);
168
218
  console.log(fmt, cssList.join(';'));
169
219
  }
170
220
  else {
171
- console.log(this.#applyStyles(input, stringify));
221
+ console.log(this.string(input, stringify));
172
222
  }
173
223
  }
174
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhb-toolbox",
3
- "version": "4.20.11",
3
+ "version": "4.20.16",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",