stain 0.0.1 → 1.0.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/README.md CHANGED
@@ -1,4 +1,12 @@
1
- # Stain - ANSI Styling
1
+ <h1>
2
+ Stain - ANSI Styling
3
+ <a href="https://mibecode.com">
4
+ <img align="right" title="&#8805;95% Human Code" alt="&#8805;95% Human Code" src="https://mibecode.com/badge.svg" />
5
+ </a>
6
+ <img align="right" alt="empty space" src="https://mibecode.com/4px.svg" />
7
+ <img align="right" alt="NPM Version" src="https://img.shields.io/npm/v/stain?color=white" />
8
+ </h1>
9
+
2
10
 
3
11
  Stain the pane without the pain of remembering if it's `bgRed`, `redBg`, or ordering for that matter
4
12
 
@@ -7,3 +15,313 @@ Stain the pane without the pain of remembering if it's `bgRed`, `redBg`, or orde
7
15
  + Nest-able: `stain.red.bold('bold' + stain.normal.blue(' normal ') + 'bold')`
8
16
  + Fast-ish: ~180,000,000/sec (`NO_COLOR`), ~6,500,000/sec (`simpleEscape`), ~5,000,000/sec (default)
9
17
  + [TypeScript](https://www.typescriptlang.org)'ed with zero dependencies
18
+
19
+ <br />
20
+
21
+ ### ▎USAGE
22
+
23
+
24
+ <img width="auto" height="672" alt="usage" src="https://raw.githubusercontent.com/fetchTe/stain/master/docs/usage.png" />
25
+
26
+
27
+ <blockquote >
28
+ <details>
29
+ <summary><b>Code</b></summary>
30
+
31
+ ```ts
32
+ import stain, { createStain } from 'stain';
33
+
34
+ // chain it & stain it
35
+ console.log(stain.cyan('cyan fg'));
36
+ console.log(stain.iblue('intense blue fg'));
37
+ console.log(stain.bold.ired('bold intense red fg'));
38
+
39
+ // apply a background color simply by adding '.bg' property after the color
40
+ console.log(stain.icyan.bg.black('intense cyan bg with black fg'));
41
+ // order of operations makes no difference
42
+ console.log(stain.black.icyan.bg('intense cyan bg with black fg'));
43
+ // last prop/chain always wins
44
+ console.log(stain.blue.bg.red.black.icyan.bg('intense cyan bg with black fg'));
45
+
46
+ // chain anything & everything till to your heart's content
47
+ console.log(stain.blue.black.bg.yellow.underline('yellow fg with black bg and underlined'));
48
+ console.log(stain.blue.black.bg.yellow.underline.inverse('yellow bg with black fg and underlined'));
49
+ console.log(stain.even.this.works.yellow.bold('bold yellow fg'));
50
+
51
+ // nesting works
52
+ console.log(stain.purple.bold('bold-purple ' + stain.cyan.normal('normal-cyan') + ' bold-purple'));
53
+
54
+ // xterm/256-color 'stain.x<number>' notation
55
+ console.log(stain.x123('a lovely cornflower blue'));
56
+
57
+ // create your own xterm/256-color palette with easy pasy to remember names
58
+ const customStain = createStain({
59
+ xterm: true,
60
+ colors: {
61
+ warn: 226, // yellow
62
+ error: 196, // red
63
+ },
64
+ });
65
+
66
+ console.log(customStain.warn('yellow/xterm=226 fg'));
67
+ console.log(customStain.error('red/xterm=196 fg'));
68
+ console.log(customStain.warn.error.bg('yellow/xterm=226 fg with red/xterm=196 bg'));
69
+ console.log(customStain.warn.bg.error('red/xterm=196 fg with yellow/xterm=226 bg'));
70
+ ```
71
+
72
+ </details>
73
+ </blockquote>
74
+
75
+ <!--
76
+
77
+ <blockquote >
78
+ <details>
79
+ <summary><b>Colorized Output/Image</b></summary>
80
+ <img alt="quickstart-Screenshot_20250718_123526" src="https://github.com/user-attachments/assets/80efe964-9ed9-4b3a-80b4-5a749b396a8e" />
81
+ </details>
82
+ </blockquote>
83
+ -->
84
+
85
+
86
+ ### ▎INSTALL
87
+
88
+ ```sh
89
+ # pick your poison
90
+ npm install stain
91
+ bun add stain
92
+ pnpm add stain
93
+ yarn add stain
94
+ ```
95
+
96
+ <br />
97
+
98
+ ## API
99
+
100
+
101
+ ### ▎ `stain(?<options>)`
102
+
103
+ ```ts
104
+ import stain from 'stain';
105
+
106
+ console.log(stain.cyan('The Main Stain'));
107
+ ```
108
+ > Pre-initialized with `xterm` enabled
109
+
110
+
111
+ <br />
112
+
113
+ ### ▎ `createStain(?<options>)`
114
+
115
+ ```ts
116
+ import { createStain } from 'stain';
117
+
118
+ const myStain = createStain({
119
+ noColor: !!process.env['CI'],
120
+ xterm: true,
121
+ colors: {
122
+ peach: 216,
123
+ navy: 18,
124
+ },
125
+ format: (...args) => args.join(' | '),
126
+ });
127
+
128
+ process.stdout.write(`
129
+ ${myStain.x216('peach fg')}
130
+ ${myStain.peach('peach fg')}
131
+ ${myStain.x18.bg('navy bg')}
132
+ ${myStain.navy.bg('navy bg')}
133
+ `);
134
+ // styled format output: 'multiple | args | format'
135
+ process.stdout.write(myStain.green('multiple', 'args', 'format'));
136
+ ```
137
+
138
+ <br />
139
+
140
+
141
+ ### ▎ OPTIONS
142
+
143
+ ```ts
144
+ type StainOptions = {
145
+ /**
146
+ * Custom color mapping to 8-bit/256-color codes (0-255) (e.g: {error: 196})
147
+ * @default undefined
148
+ */
149
+ colors?: Record<string, number>;
150
+ /**
151
+ * Custom format function
152
+ * @default simplified `util.format` with with `JSON.stringify` fallback
153
+ * @see {@link https://nodejs.org/api/util.html#utilformatformat-args}
154
+ */
155
+ format?: (...args: any[]) => string;
156
+ /**
157
+ * Disable ANSI color/styling (~50-250x faster)
158
+ * @default false (unless the `NO_COLOR` environment/CLI variable is set)
159
+ */
160
+ noColor?: boolean;
161
+ /**
162
+ * Use a simpler ANSI escape function without nesting support (~1.5-4x faster)
163
+ * @default false
164
+ */
165
+ simpleEscape?: boolean;
166
+ /**
167
+ * Enable 8-bit/256-color support via `x<number>` notation
168
+ * @default false (for `createStain`)
169
+ * @default true (for default `stain` export)
170
+ * @see {@link https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit}
171
+ */
172
+ xterm?: boolean;
173
+ };
174
+ ```
175
+
176
+ <br />
177
+
178
+ ### ▎ FLUENT METHODS
179
+
180
+ | | Options |
181
+ |----------------------------|:--------------------------------|
182
+ | <stamp>**Background**</stamp> | append `.bg` to any foreground (e.g: `stain.white.bg`, `stain.iblue.bg`) |
183
+ | <stamp>**[4-bit](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit) Color**</stamp> | ` black`, ` red`, ` green`, ` yellow`, ` blue`, ` purple`, ` cyan`, ` white` |
184
+ | <stamp>**[4-bit](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit) Color Intense**</stamp> | `iblack`, `ired`, `igreen`, `iyellow`, `iblue`, `ipurple`, `icyan`, `iwhite` |
185
+ | <stamp>**[8-bit](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) Color**</stamp> | `x0` through `x255` (e.g: `stain.x122`, `stain.x50`, `stain.x150.bg`) |
186
+ | <stamp>**Font**</stamp> | `bold`, `dim`, `normal`, `underline` |
187
+ | <stamp>**Other**</stamp> | `inverse`, `reset` |
188
+
189
+
190
+ <blockquote >
191
+ <details>
192
+ <summary><b>8-bit Color Grid</b></summary>
193
+ <img alt="8bit-256-xterm" src="https://raw.githubusercontent.com/fetchTe/stain/master/docs/8bit-256-xterm.png" />
194
+ </details>
195
+ </blockquote>
196
+
197
+
198
+ <br />
199
+
200
+ #### ▎ EXAMPLES
201
+ ```ts
202
+ // bold - makes text bold
203
+ console.log(' ' + stain.bold('stain.bold'));
204
+ // dim - makes text dim
205
+ console.log(' ' + stain.dim('stain.dim'));
206
+ console.log(' ' + stain.dim.white('stain.dim.white (tends to work better than gray)'));
207
+ // underline - underlines text
208
+ console.log(' ' + stain.red.underline('stain.red.underline'));
209
+ // inverse - inverts the foreground and background colors
210
+ console.log(' ' + stain.red.black.bg('stain.red.black.bg'));
211
+ console.log(' ' + stain.red.black.bg.inverse('stain.red.black.bg.inverse'));
212
+ // normal - resets bold and dim styles
213
+ console.log(' ' + stain.cyan.bold(`stain.cyan.bold ${stain.normal(' stain.normal ')} stain.cyan.bold`));
214
+ console.log(' ' + stain.cyan.dim(`stain.cyan.dim ${stain.normal(' stain.normal ')} stain.cyan.dim`));
215
+ // reset - resets all active styles, returning to the terminal default
216
+ console.log(' ' + stain.underline.yellow.bold(`stain.underline.yellow.bold${stain.reset(' reset ')}stain.underline.yellow.bold`));
217
+ ```
218
+ > <img alt="examples" src="https://raw.githubusercontent.com/fetchTe/stain/master/docs/examples.png" /> <br />
219
+
220
+ <br />
221
+
222
+ #### ▎ ALL FONT STYLES
223
+
224
+ <img alt="all-font-color-styles" src="https://raw.githubusercontent.com/fetchTe/stain/master/docs/all-font-color-styles.png" />
225
+
226
+ <!--
227
+
228
+ #### ▎ ALL ANSI STAINS
229
+ -->
230
+
231
+
232
+
233
+ <br />
234
+
235
+ ## Development/Contributing
236
+ > Required build dependencies: [Bun](https://bun.sh) and [Make](https://www.gnu.org/software/make/manual/make.html) <br />
237
+
238
+
239
+ ### ▎PULL REQUEST STEPS
240
+
241
+ 1. Clone repository
242
+ 2. Create and switch to a new branch for your work
243
+ 3. Make and commit changes
244
+ 4. Run `make release` to clean, setup, build, lint, and test
245
+ 5. If everything checks out, push branch to repository and submit pull request
246
+ <br />
247
+
248
+ ### ▎MAKEFILE REFERENCE
249
+
250
+ ```
251
+ # USAGE
252
+ make [flags...] <target>
253
+
254
+ # TARGET
255
+ -------------------
256
+ run executes entry-point (./src/index.ts) via 'bun run'
257
+ release clean, setup, build, lint, test, aok (everything but the kitchen sink)
258
+ -------------------
259
+ build builds the .{js,d.ts} (skips: lint, test, and .min.* build)
260
+ build_cjs builds the .cjs export
261
+ build_esm builds the .js (esm) export
262
+ build_declarations builds typescript .d.{ts,mts,cts} declarations
263
+ -------------------
264
+ install installs dependencies via bun
265
+ update updates dependencies
266
+ update_dry lists dependencies that would be updated via 'make update'
267
+ -------------------
268
+ lint lints via tsc & eslint
269
+ lint_eslint lints via eslint
270
+ lint_eslint_fix lints and auto-fixes via eslint --fix
271
+ lint_tsc lints via tsc
272
+ lint_watch lints via eslint & tsc with fs.watch to continuously lint on change
273
+ -------------------
274
+ test runs bun test(s)
275
+ test_watch runs bun test(s) in watch mode
276
+ test_update runs bun test --update-snapshots
277
+ -------------------
278
+ help displays (this) help screen
279
+
280
+ # FLAGS
281
+ -------------------
282
+ BUN [? ] bun build flag(s) (e.g: make BUN="--banner='// bake until golden brown'")
283
+ -------------------
284
+ CJS [?1] builds the cjs (common js) target on 'make release'
285
+ EXE [?js|mjs] default esm build extension
286
+ TAR [?0] build target env (-1=bun, 0=node, 1=dom, 2=dom+iife, 3=dom+iife+userscript)
287
+ MIN [?1] builds minified (*.min.{mjs,cjs,js}) targets on 'make release'
288
+ -------------------
289
+ BAIL [?1] fail fast (bail) on the first test or lint error
290
+ ENV [?DEV|PROD|TEST] sets the 'ENV' & 'IS_*' static build variables (else auto-set)
291
+ TEST [?0] sets the 'IS_TEST' static build variable (always 1 if test target)
292
+ WATCH [?0] sets the '--watch' flag for bun/tsc (e.g: WATCH=1 make test)
293
+ -------------------
294
+ DEBUG [?0] enables verbose logging and sets the 'IS_DEBUG' static build variable
295
+ QUIET [?0] disables pretty-printed/log target (INIT/DONE) info
296
+ NO_COLOR [?0] disables color logging/ANSI codes
297
+ ```
298
+
299
+ <br />
300
+
301
+
302
+
303
+ ## License
304
+
305
+ ```
306
+ MIT License
307
+
308
+ Copyright (c) 2025 te <legal@fetchTe.com>
309
+
310
+ Permission is hereby granted, free of charge, to any person obtaining a copy
311
+ of this software and associated documentation files (the "Software"), to deal
312
+ in the Software without restriction, including without limitation the rights
313
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
314
+ copies of the Software, and to permit persons to whom the Software is
315
+ furnished to do so, subject to the following conditions:
316
+
317
+ The above copyright notice and this permission notice shall be included in all
318
+ copies or substantial portions of the Software.
319
+
320
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
321
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
322
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
323
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
324
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
325
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
326
+ SOFTWARE.
327
+ ```
package/dist/index.cjs CHANGED
@@ -338,7 +338,7 @@ function createStain(opts = {}) {
338
338
  return colorProxy();
339
339
  }
340
340
  var stain = /* @__PURE__ */ (() => createStain({ xterm: true }))();
341
- var src_default2 = createStain;
341
+ var src_default2 = stain;
342
342
 
343
- //# debugId=1BB7AE79D4CF5C0D64756E2164756E21
343
+ //# debugId=F63994EEE794F26A64756E2164756E21
344
344
  //# sourceMappingURL=index.cjs.map
@@ -5,9 +5,9 @@
5
5
  "// node_modules/globables/dist/index.js\nvar GLOBAL_THIS = /* @__PURE__ */ (() => typeof globalThis === \"object\" ? globalThis : (() => {\n (function(Object2) {\n function get() {\n const e = this || self;\n e.globalThis = e, delete Object2.prototype._T_;\n }\n typeof globalThis != \"object\" && (this ? get() : (Object2.defineProperty(Object2.prototype, \"_T_\", { configurable: true, get }), _T_));\n })(Object);\n return typeof globalThis === \"object\" ? globalThis : {};\n})())();\nvar ARGV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof scriptArgs !== \"undefined\" ? scriptArgs : [] : (_d = (GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) ? (_c = (_a = GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) == null ? undefined : _a.args) != null ? _c : ((_b = process[\"args\"]) == null ? undefined : _b.length) ? process[\"args\"] : process[\"argv\"] : process[\"argv\"]) != null ? _d : [];\n})();\nvar ENV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof ((_a = GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"std\"]) == null ? undefined : _a.getenviron) === \"function\" ? (_d = (_c = (_b = GLOBAL_THIS[\"std\"]).getenviron) == null ? undefined : _c.call(_b)) != null ? _d : {} : {} : !(GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) ? process[\"env\"] : (() => {\n var _a2, _b2, _c2, _d2, _e, _f;\n try {\n return (_f = (_c2 = (_b2 = (_a2 = GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) == null ? undefined : _a2.env) == null ? undefined : _b2.toObject) == null ? undefined : _c2.call(_b2)) != null ? _f : ((_d2 = process[\"env\"]) == null ? undefined : _d2.toObject) ? (_e = process[\"env\"]) == null ? undefined : _e.toObject() : process[\"env\"];\n } catch (_err) {}\n return {};\n })();\n})();\n\n// src/index.ts\nvar hasArgv = (keys, argv = ARGV) => !argv?.length ? false : !![keys].flat().filter(Boolean).find((key) => new RegExp(`(^|[^\\\\S])(?:--|-)${key}(=|\\\\s|$)`, \"i\").test(argv.join(\" \")));\nvar quoteNorm = (val) => /^['\"]/.test(val) ? val?.replace(/^(['\"])(.*)(['\"])$/, (m, q1, body, q2) => q1 === q2 ? quoteNorm(body) : m) : val;\nvar isFlag = (val) => /^-+\\w/.test(val ?? \"\") && Number.isNaN(Number(val));\nvar isTerm = (val) => val?.trim() === \"--\";\nvar toArgvArray = (key, strict = false, _keys = Array.isArray(key) ? key : [key]) => strict ? _keys : _keys.map((item) => [\n item,\n item.replaceAll(...item.includes(\"_\") ? [\"_\", \"-\"] : [\"-\", \"_\"])\n]).flat();\nvar cliReap = (argv = ARGV, env = ENV, gthis = GLOBAL_THIS, strict = false) => {\n const slice = argv[0] === \"node\" ? 2 : argv[1] === \"run\" ? 3 : isFlag(argv[0]) ? 0 : 1;\n const cur = argv.map(String).slice(slice);\n const cmd = argv.map(String).slice(0, slice);\n const end = !!cur.find(isTerm);\n const getArgv = (keys, optValue = false) => {\n const keyList = toArgvArray(keys, strict);\n for (let i = 0;i < cur.length; i++) {\n const token = cur[i];\n if (isTerm(token)) {\n break;\n }\n if (!token || !isFlag(token)) {\n continue;\n }\n const hasEq = /=/.test(token);\n const part = keyList.map((key) => {\n const [k, ...parts] = token.replace(isFlag(key) ? /(?!)/ : /^\\s*?-+/, \"\").split(hasEq && optValue ? `${key}=` : new RegExp(`^${key}$`, strict ? \"\" : \"i\"));\n return !k?.length ? parts.join(key) : k === key ? key : null;\n }).find((v) => v !== null) ?? 0;\n if (part === 0) {\n continue;\n }\n if (!optValue) {\n cur.splice(i, 1);\n return true;\n }\n if (hasEq) {\n cur.splice(i, 1);\n return quoteNorm(part);\n }\n const next = cur[i + 1];\n if (next !== undefined && !isTerm(next) && !isFlag(next)) {\n cur.splice(i, 2);\n return quoteNorm(next);\n }\n }\n return null;\n };\n const getEnv = (keys) => toArgvArray(keys, strict).map((key) => (key in env) ? env[key] : (key in gthis) ? gthis[key] : null).filter(Boolean)[0] ?? null;\n const getFlag = (keys) => getArgv(keys, false) !== null ? true : null;\n const getOpt = (keys) => getArgv(keys, true);\n const getAny = (keys, defaultValue) => getOpt(keys) ?? getFlag(keys) ?? getEnv(keys) ?? (defaultValue !== undefined ? defaultValue : null);\n const getPos = () => {\n const result = [];\n for (let i = 0;i < cur.length; i++) {\n const token = cur[i];\n if (!token) {\n continue;\n }\n if (isTerm(token)) {\n return [...result, ...cur.slice(i + 1)];\n }\n if (isFlag(token)) {\n continue;\n }\n result.push(token);\n }\n return result;\n };\n return {\n any: getAny,\n cmd: () => cmd,\n cur: () => cur,\n end: () => end,\n env: getEnv,\n flag: getFlag,\n opt: getOpt,\n pos: getPos\n };\n};\nvar cliReapStrict = (argv = ARGV, procEnv = ENV, gthis = GLOBAL_THIS) => cliReap(argv, procEnv, gthis, true);\nvar src_default = cliReap;\nexport {\n quoteNorm,\n isFlag,\n hasArgv,\n src_default as default,\n cliReapStrict,\n cliReap,\n ENV,\n ARGV\n};\n\n//# debugId=D346F45C437553B064756E2164756E21\n//# sourceMappingURL=index.js.map\n",
6
6
  "// src/index.ts\nvar GLOBAL_THIS = /* @__PURE__ */ (() => typeof globalThis === \"object\" ? globalThis : (() => {\n !(function(Object2) {\n function get() {\n const e = this || self;\n e.globalThis = e, delete Object2.prototype._T_;\n }\n \"object\" != typeof globalThis && (this ? get() : (Object2.defineProperty(Object2.prototype, \"_T_\", { configurable: true, get }), _T_));\n })(Object);\n return typeof globalThis === \"object\" ? globalThis : {};\n})())();\nvar ARGV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof scriptArgs !== \"undefined\" ? scriptArgs : [] : (_d = (GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) ? (_c = (_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) == null ? void 0 : _a.args) != null ? _c : ((_b = process[\"args\"]) == null ? void 0 : _b.length) ? process[\"args\"] : process[\"argv\"] : process[\"argv\"]) != null ? _d : [];\n})();\nvar ARGS = ARGV;\nvar ENV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof ((_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"std\"]) == null ? void 0 : _a.getenviron) === \"function\" ? (_d = (_c = (_b = GLOBAL_THIS[\"std\"]).getenviron) == null ? void 0 : _c.call(_b)) != null ? _d : {} : {} : !(GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) ? process[\"env\"] : (() => {\n var _a2, _b2, _c2, _d2, _e, _f;\n try {\n return (_f = (_c2 = (_b2 = (_a2 = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) == null ? void 0 : _a2.env) == null ? void 0 : _b2.toObject) == null ? void 0 : _c2.call(_b2)) != null ? _f : ((_d2 = process[\"env\"]) == null ? void 0 : _d2.toObject) ? (_e = process[\"env\"]) == null ? void 0 : _e.toObject() : process[\"env\"];\n } catch (_err) {\n }\n return {};\n })();\n})();\nexport {\n ARGS,\n ARGV,\n ENV,\n GLOBAL_THIS\n};\n//# sourceMappingURL=index.js.map\n",
7
7
  "import cliReap from 'cli-reap';\nimport {\n ENV,\n GLOBAL_THIS,\n} from 'globables';\n\nexport const ESC = '\\x1B';\nexport const RESET = '\\x1B[0m';\n\nexport const COLOR_DEF = {\n black: 30,\n iblack: 90,\n red: 31,\n ired: 91,\n green: 32,\n igreen: 92,\n yellow: 33,\n iyellow: 93,\n blue: 34,\n iblue: 94,\n purple: 35,\n ipurple: 95,\n cyan: 36,\n icyan: 96,\n white: 37,\n iwhite: 97,\n};\nexport const XTERM_DEF = Object.fromEntries(\n Array(256).fill(0).map((_v, i) => [`x${i}`, i] as [string, number]),\n);\nexport const COLOR_ALL = {...COLOR_DEF, ...XTERM_DEF};\n\n\n/**\n * color support level\n * @default 3\n * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}\n */\ntype ColorSpace = 0 | 1;\n\n\n/**\n * COLOR_SPACE - covers all reasonable and most un-reasonable cases\n * @implements nodejs.org/api/cli.html#force_color1-2-3\n * 0=no-color, 1=16, 2=256, 3=true-color\n */\nexport const COLOR_SPACE: ColorSpace = /* @__PURE__ */ (() => {\n try {\n const reap = cliReap();\n const forceColor = reap.any('FORCE_COLOR');\n // force colors\n if (forceColor === '' || (forceColor && !isNaN(Number(forceColor)) && Number(forceColor) > 0)) {\n return 1;\n }\n // no proc\n if (typeof process === 'undefined') { return 0; }\n\n // no color var\n if (reap.any('NO_COLOR') !== null\n || reap.any('NODE_DISABLE_COLORS') !== null\n || (/-mono|dumb/i).test(ENV['TERM'] ?? '')) { return 0; }\n\n // no tty\n if (!(!!process.stdout?.isTTY\n || (!!ENV['PM2_HOME'] && !!ENV['pm_id'])\n || ((GLOBAL_THIS as never)?.['Deno']\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ? (GLOBAL_THIS as any)?.['Deno']?.isatty(1)\n : !!process.stdout?.isTTY))) { return 0; }\n\n // cli\n if ((/^(false|never|no|0)$/i).test(`${reap.opt('color') ?? ''}`.trim())) {\n return 0;\n }\n return 1;\n } catch (_err) { /* ignore */ }\n // catch/error/fallthrough; plays it safe with no colors\n return 0;\n})();\n\n",
8
- "import {\n COLOR_SPACE,\n ESC,\n RESET,\n COLOR_DEF,\n XTERM_DEF,\n COLOR_ALL,\n} from './constants.ts';\n\ntype EmptyObject = Record<never, never>;\ntype StrNum = string | number;\n\n// fg=foreground\n// bg=background\n// ft=font\n// ue=underline\n// ie=inverse\n// re=reset\n// pr=previous (internal state)\ntype StyleKeys = 'fg' | 'bg' | 'ft' | 'ue' | 'ie' | 're' | 'pr';\ntype AnsiCodeTuple = [on: number, off: number, isCustom?: number];\ntype StyleState = Partial<Record<StyleKeys, AnsiCodeTuple>>;\ntype StainBase = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';\nexport type StainAnsi = StainBase | `i${StainBase}`;\n\n// generate xterms: x0 to x255\ntype XtermKeysFactory<N extends number, Acc extends string[] = []> =\n Acc['length'] extends N\n ? Acc[number]\n : XtermKeysFactory<N, [...Acc, `x${Acc['length']}`]>;\nexport type StainXterm = XtermKeysFactory<256>;\n\nexport type Stain<\n C extends Record<string, number> = EmptyObject,\n X extends boolean = false,\n> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((...args: any[])=> string) &\n {\n bg: Stain<C, X>;\n bold: Stain<C, X>;\n dim: Stain<C, X>;\n normal: Stain<C, X>;\n reset: Stain<C, X>;\n underline: Stain<C, X>;\n inverse: Stain<C, X>;\n } &\n // built-in named colors\n { [K in StainAnsi]: Stain<C, X> } &\n // xterm colors if enabled\n (X extends true ? { [K in StainXterm]: Stain<C, X> } : EmptyObject) &\n // custom colors from opts.colors\n (keyof C extends never ? EmptyObject : { [K in keyof C]: Stain<C, X> });\n\nexport type StainOpts<C extends Record<string, number> = EmptyObject> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n format?: (...args: any[])=> string;\n noColor?: boolean;\n xterm?: boolean;\n colors?: C;\n simpleEscape?: boolean;\n};\n\n\n/**\n * ansi escape-er\n * @note -> without handlin/escapin nesting it simplifies to: `\\x1b[${open}m${str}\\x1b[${close}m`\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} fontReplace\n * @return {[type]}\n */\nconst escStain = (str: string, open: StrNum, close: StrNum, fontReplace?: StrNum) => {\n str = typeof str !== 'string' ? String(str) : str; // just in case\n const openStr = ESC + `[${open}m`;\n const closeStr = ESC + `[${close}m`;\n const closeLen = closeStr.length;\n const parts: string[] = [];\n let cursor = 0;\n let seqCount = 0; // count of close sequences for alternating styles\n let resetCount = 0;\n while (true) {\n const idxClose = str.indexOf(closeStr, cursor);\n // next global reset unless it is the reset style\n const idxReset = open === 0 ? -1 : str.indexOf(RESET, cursor);\n let idx = -1;\n let isReset = false;\n // which comes first, cur close sequence or a global reset\n if (idxClose >= 0) {\n if (idxReset >= 0 && idxReset < idxClose) {\n idx = idxReset;\n isReset = true;\n } else {\n idx = idxClose;\n }\n } else if (idxReset >= 0) {\n idx = idxReset;\n isReset = true;\n } else {\n break;\n }\n parts.push(str.substring(cursor, idx));\n\n if (isReset) {\n parts.push(RESET);\n resetCount++;\n // after every second reset restore style\n // e.g: stain.red(`text ${stain.reset('reset')} text`)\n if (resetCount % 2 === 0) { parts.push(openStr); }\n cursor = idx + RESET.length;\n continue;\n }\n\n // a closing sequence; need to determine the correct replacement\n const segment = str.substring(cursor, idx);\n const openInSeg = segment.split(openStr).length;\n const closeInSeg = segment.split(closeStr).length;\n\n let rep = openStr;\n // this roundabout logic is for font styles nesting\n // e.g: stain.bold(`bold ${stain.normal('norm')} bold`)\n if (fontReplace !== undefined && openInSeg <= closeInSeg) {\n // use seqCount to treat the first closeStr as an 'opener' and the second as the 'closer'\n seqCount++;\n const on = ESC + `[${fontReplace}m`; // outer style's open code\n const off = ESC + `[${close}m`; // inner style's open/close code\n rep = (seqCount % 2 === 1) ? on + off : off + on;\n }\n\n parts.push(rep);\n cursor = idx + closeLen;\n }\n parts.push(str.substring(cursor));\n return openStr + parts.join('') + closeStr;\n};\n\n/**\n * simple escape that doesn't handle nested ansi; 1.5-4x+ faster depending on style complexity\n * nested example: stain.red.bold('Bold ' + stain.green.normal('normal') + ' Bold')\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} _fontReplace\n * @return {[type]}\n */\nconst escStainSimple = (str: string, open: StrNum, close: StrNum, _fontReplace?: StrNum) =>\n `${ESC}[${open}m` + (typeof str !== 'string' ? String(str) : str) + `${ESC}[${close}m`;\n\n\n/**\n * a nice node typed color api, that isn't \"slow\" at\n * @perf ~6million iter/s - NO_COLOR=~186million iter/s\n */\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts?: StainOpts<C> & { xterm?: false }\n): Stain<C, false>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> & { xterm: true }\n): Stain<C, true>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> = {},\n): Stain<C, boolean> {\n const {\n colors,\n xterm,\n format = (...args) => args.length > 1\n ? args.join(' ')\n : typeof args[0] !== 'string' ? JSON.stringify(args[0]) : args[0],\n noColor = COLOR_SPACE === 0,\n simpleEscape = false,\n } = opts;\n\n const colorAll: Record<string, number> = colors\n ? {...(xterm ? COLOR_ALL : COLOR_DEF), ...colors}\n : (xterm ? COLOR_ALL : COLOR_DEF);\n\n // provies the same api, but doesn't add color, and much, much, much, faster\n if (noColor) {\n // wrapped to avoid poluting the proto on passed in format\n const ncFormat = opts?.format ? (...args: unknown[]) => format(...args) : format;\n for (const prop of Object.keys(colorAll)\n .concat(['bg', 'bold', 'dim', 'normal', 'reset', 'underline'])) {\n // @ts-expect-error not typable\n ncFormat[prop] = ncFormat;\n }\n return ncFormat as Stain<C, boolean>;\n }\n const escFn = simpleEscape ? escStainSimple : escStain;\n // xterm look-up map to determin if xterm\n // @see {@link https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit}\n const color256: Record<string, number> = colors\n ? (xterm ? {...XTERM_DEF, ...colors} : colors)\n : (xterm ? XTERM_DEF : {});\n\n // our main stain\n const colorProxy = (cur: StyleState = {}) =>\n new Proxy((text: string) => text, {\n get: (_target, prop: string) => {\n const nxt = {...cur};\n const fg = nxt.fg;\n if (colorAll[prop] !== undefined) { // xterm logic\n // keeps track of previous for bg logic\n nxt.pr = [\n fg?.[0] ?? colorAll[prop],\n 39,\n fg?.[2] ?? (color256[prop] !== undefined ? 1 : 0),\n ];\n nxt.fg = [colorAll[prop], 39, color256[prop] !== undefined ? 1 : 0];\n } else if (prop === 'bg' && fg) { // bg/fg logic\n nxt.bg = [fg[0] + (fg[2] || fg[1] === 49 ? 0 : 10), 49, fg[2]] as AnsiCodeTuple;\n // @ts-expect-error to make this type easier we ignore undefined\n if (nxt.pr?.[1] === 39) { nxt.fg = fg[0] === nxt.pr[0] ? undefined : [...nxt.pr]; }\n } else { // font style logic\n const fo = prop === 'bold' ? 1 : prop === 'dim' ? 2 : prop === 'normal' ? 22 : null;\n if (fo) {\n nxt.ft = [fo, 22, 0];\n } else if (prop === 'underline') {\n nxt.ue = [4, 24, 0];\n } else if (prop === 'inverse') {\n nxt.ie = [7, 27, 0];\n } else if (prop === 'reset') {\n nxt.re = [0, 0, 0];\n }\n }\n return colorProxy(nxt);\n },\n apply: (_target, _thisArg, args: string[]) => {\n let res = format(...args);\n // a loop here will dec perf by 6x\n if (cur.re) { return escFn(res, 0, 0); }\n if (cur.fg) { res = escFn(res, (cur.fg[2] ? '38;5;' : '') + cur.fg[0], cur.fg[1]); }\n if (cur.bg) { res = escFn(res, (cur.bg[2] ? '48;5;' : '') + cur.bg[0], cur.bg[1]); }\n if (cur.ft) { res = escFn(res, cur.ft[0], cur.ft[1], cur.ft[0]); }\n if (cur.ue) { res = escFn(res, cur.ue[0], cur.ue[1]); }\n if (cur.ie) { res = escFn(res, cur.ie[0], cur.ie[1]); }\n return res;\n },\n });\n return colorProxy() as Stain<C, boolean>;\n}\n\nconst stain = /* @__PURE__ */ (() => createStain({ xterm: true }))();\n\nexport default createStain;\nexport {\n stain,\n createStain,\n};\n"
8
+ "import {\n COLOR_ALL,\n COLOR_DEF,\n COLOR_SPACE,\n ESC,\n RESET,\n XTERM_DEF,\n} from './constants.ts';\n\ntype EmptyObject = Record<never, never>;\ntype StrNum = string | number;\n\n// fg=foreground\n// bg=background\n// ft=font\n// ue=underline\n// ie=inverse\n// re=reset\n// pr=previous (internal state)\ntype StyleKeys = 'fg' | 'bg' | 'ft' | 'ue' | 'ie' | 're' | 'pr';\ntype AnsiCodeTuple = [on: number, off: number, isCustom?: number];\ntype StyleState = Partial<Record<StyleKeys, AnsiCodeTuple>>;\ntype StainBase = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';\nexport type StainAnsi = StainBase | `i${StainBase}`;\n\n// generate xterms: x0 to x255\ntype XtermKeysFactory<N extends number, Acc extends string[] = []> =\n Acc['length'] extends N\n ? Acc[number]\n : XtermKeysFactory<N, [...Acc, `x${Acc['length']}`]>;\nexport type StainXterm = XtermKeysFactory<256>;\n\nexport type Stain<\n C extends Record<string, number> = EmptyObject,\n X extends boolean = false,\n> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((...args: any[])=> string) &\n {\n bg: Stain<C, X>;\n bold: Stain<C, X>;\n dim: Stain<C, X>;\n normal: Stain<C, X>;\n reset: Stain<C, X>;\n underline: Stain<C, X>;\n inverse: Stain<C, X>;\n } &\n // built-in named colors\n { [K in StainAnsi]: Stain<C, X> } &\n // xterm colors if enabled\n (X extends true ? { [K in StainXterm]: Stain<C, X> } : EmptyObject) &\n // custom colors from opts.colors\n (keyof C extends never ? EmptyObject : { [K in keyof C]: Stain<C, X> });\n\nexport type StainOpts<C extends Record<string, number> = EmptyObject> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n format?: (...args: any[])=> string;\n noColor?: boolean;\n xterm?: boolean;\n colors?: C;\n simpleEscape?: boolean;\n};\n\n\n/**\n * ansi escape-er\n * @note -> without handlin/escapin nesting it simplifies to: `\\x1b[${open}m${str}\\x1b[${close}m`\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} fontReplace\n * @return {[type]}\n */\nconst escStain = (str: string, open: StrNum, close: StrNum, fontReplace?: StrNum) => {\n str = typeof str !== 'string' ? String(str) : str; // just in case\n const openStr = ESC + `[${open}m`;\n const closeStr = ESC + `[${close}m`;\n const closeLen = closeStr.length;\n const parts: string[] = [];\n let cursor = 0;\n let seqCount = 0; // count of close sequences for alternating styles\n let resetCount = 0;\n while (true) {\n const idxClose = str.indexOf(closeStr, cursor);\n // next global reset unless it is the reset style\n const idxReset = open === 0 ? -1 : str.indexOf(RESET, cursor);\n let idx = -1;\n let isReset = false;\n // which comes first, cur close sequence or a global reset\n if (idxClose >= 0) {\n if (idxReset >= 0 && idxReset < idxClose) {\n idx = idxReset;\n isReset = true;\n } else {\n idx = idxClose;\n }\n } else if (idxReset >= 0) {\n idx = idxReset;\n isReset = true;\n } else {\n break;\n }\n parts.push(str.substring(cursor, idx));\n\n if (isReset) {\n parts.push(RESET);\n resetCount++;\n // after every second reset restore style\n // e.g: stain.red(`text ${stain.reset('reset')} text`)\n if (resetCount % 2 === 0) { parts.push(openStr); }\n cursor = idx + RESET.length;\n continue;\n }\n\n // a closing sequence; need to determine the correct replacement\n const segment = str.substring(cursor, idx);\n const openInSeg = segment.split(openStr).length;\n const closeInSeg = segment.split(closeStr).length;\n\n let rep = openStr;\n // this roundabout logic is for font styles nesting\n // e.g: stain.bold(`bold ${stain.normal('norm')} bold`)\n if (fontReplace !== undefined && openInSeg <= closeInSeg) {\n // use seqCount to treat the first closeStr as an 'opener' and the second as the 'closer'\n seqCount++;\n const on = ESC + `[${fontReplace}m`; // outer style's open code\n const off = ESC + `[${close}m`; // inner style's open/close code\n rep = (seqCount % 2 === 1) ? on + off : off + on;\n }\n\n parts.push(rep);\n cursor = idx + closeLen;\n }\n parts.push(str.substring(cursor));\n return openStr + parts.join('') + closeStr;\n};\n\n/**\n * simple escape that doesn't handle nested ansi; 1.5-4x+ faster depending on style complexity\n * nested example: stain.red.bold('Bold ' + stain.green.normal('normal') + ' Bold')\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} _fontReplace\n * @return {[type]}\n */\nconst escStainSimple = (str: string, open: StrNum, close: StrNum, _fontReplace?: StrNum) =>\n `${ESC}[${open}m` + (typeof str !== 'string' ? String(str) : str) + `${ESC}[${close}m`;\n\n\n/**\n * a nice node typed color api, that isn't \"slow\" at\n * @perf ~6million iter/s - NO_COLOR=~186million iter/s\n */\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts?: StainOpts<C> & { xterm?: false }\n): Stain<C, false>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> & { xterm: true }\n): Stain<C, true>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> = {},\n): Stain<C, boolean> {\n const {\n colors,\n xterm,\n format = (...args) => args.length > 1\n ? args.join(' ')\n : typeof args[0] !== 'string' ? JSON.stringify(args[0]) : args[0],\n noColor = COLOR_SPACE === 0,\n simpleEscape = false,\n } = opts;\n\n const colorAll: Record<string, number> = colors\n ? {...(xterm ? COLOR_ALL : COLOR_DEF), ...colors}\n : (xterm ? COLOR_ALL : COLOR_DEF);\n\n // provies the same api, but doesn't add color, and much, much, much, faster\n if (noColor) {\n // wrapped to avoid poluting the proto on passed in format\n const ncFormat = opts?.format ? (...args: unknown[]) => format(...args) : format;\n for (const prop of Object.keys(colorAll)\n .concat(['bg', 'bold', 'dim', 'normal', 'reset', 'underline'])) {\n // @ts-expect-error not typable\n ncFormat[prop] = ncFormat;\n }\n return ncFormat as Stain<C, boolean>;\n }\n const escFn = simpleEscape ? escStainSimple : escStain;\n // xterm look-up map to determin if xterm\n // @see {@link https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit}\n const color256: Record<string, number> = colors\n ? (xterm ? {...XTERM_DEF, ...colors} : colors)\n : (xterm ? XTERM_DEF : {});\n\n // our main stain\n const colorProxy = (cur: StyleState = {}) =>\n new Proxy((text: string) => text, {\n get: (_target, prop: string) => {\n const nxt = {...cur};\n const fg = nxt.fg;\n if (colorAll[prop] !== undefined) { // xterm logic\n // keeps track of previous for bg logic\n nxt.pr = [\n fg?.[0] ?? colorAll[prop],\n 39,\n fg?.[2] ?? (color256[prop] !== undefined ? 1 : 0),\n ];\n nxt.fg = [colorAll[prop], 39, color256[prop] !== undefined ? 1 : 0];\n } else if (prop === 'bg' && fg) { // bg/fg logic\n nxt.bg = [fg[0] + (fg[2] || fg[1] === 49 ? 0 : 10), 49, fg[2]] as AnsiCodeTuple;\n // @ts-expect-error to make this type easier we ignore undefined\n if (nxt.pr?.[1] === 39) { nxt.fg = fg[0] === nxt.pr[0] ? undefined : [...nxt.pr]; }\n } else { // font style logic\n const fo = prop === 'bold' ? 1 : prop === 'dim' ? 2 : prop === 'normal' ? 22 : null;\n if (fo) {\n nxt.ft = [fo, 22, 0];\n } else if (prop === 'underline') {\n nxt.ue = [4, 24, 0];\n } else if (prop === 'inverse') {\n nxt.ie = [7, 27, 0];\n } else if (prop === 'reset') {\n nxt.re = [0, 0, 0];\n }\n }\n return colorProxy(nxt);\n },\n apply: (_target, _thisArg, args: string[]) => {\n let res = format(...args);\n // a loop here will dec perf by 6x\n if (cur.re) { return escFn(res, 0, 0); }\n if (cur.fg) { res = escFn(res, (cur.fg[2] ? '38;5;' : '') + cur.fg[0], cur.fg[1]); }\n if (cur.bg) { res = escFn(res, (cur.bg[2] ? '48;5;' : '') + cur.bg[0], cur.bg[1]); }\n if (cur.ft) { res = escFn(res, cur.ft[0], cur.ft[1], cur.ft[0]); }\n if (cur.ue) { res = escFn(res, cur.ue[0], cur.ue[1]); }\n if (cur.ie) { res = escFn(res, cur.ie[0], cur.ie[1]); }\n return res;\n },\n });\n return colorProxy() as Stain<C, boolean>;\n}\n\nconst stain = /* @__PURE__ */ (() => createStain({ xterm: true }))();\n\nexport default stain;\nexport {\n stain,\n createStain,\n};\n"
9
9
  ],
10
10
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;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,UAAU,MAAM,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACnF,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACjE,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACtD,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACtD,OAAO;AAAA;AAAA,EAEX,CAAC;AAAA,EACH,OAAO,WAAW;AAAA;AAGpB,IAAM,yBAAyB,MAAM,YAAY,EAAE,OAAO,KAAK,CAAC,GAAG;AAEnE,IAAe;",
11
- "debugId": "1BB7AE79D4CF5C0D64756E2164756E21",
11
+ "debugId": "F63994EEE794F26A64756E2164756E21",
12
12
  "names": []
13
13
  }
package/dist/index.d.cts CHANGED
@@ -36,6 +36,6 @@ declare function createStain<C extends Record<string, number> = EmptyObject>(opt
36
36
  xterm: true;
37
37
  }): Stain<C, true>;
38
38
  declare const stain: Stain<EmptyObject, true>;
39
- export default createStain;
39
+ export default stain;
40
40
  export { stain, createStain, };
41
41
  //# sourceMappingURL=index.d.ts.map
package/dist/index.d.mts CHANGED
@@ -36,6 +36,6 @@ declare function createStain<C extends Record<string, number> = EmptyObject>(opt
36
36
  xterm: true;
37
37
  }): Stain<C, true>;
38
38
  declare const stain: Stain<EmptyObject, true>;
39
- export default createStain;
39
+ export default stain;
40
40
  export { stain, createStain, };
41
41
  //# sourceMappingURL=index.d.ts.map
package/dist/index.d.ts CHANGED
@@ -36,6 +36,6 @@ declare function createStain<C extends Record<string, number> = EmptyObject>(opt
36
36
  xterm: true;
37
37
  }): Stain<C, true>;
38
38
  declare const stain: Stain<EmptyObject, true>;
39
- export default createStain;
39
+ export default stain;
40
40
  export { stain, createStain, };
41
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,KAAK,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAaxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC7F,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;AAGpD,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,EAAE,IAC/D,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,GACnB,GAAG,CAAC,MAAM,CAAC,GACX,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AACzD,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,MAAM,KAAK,CACf,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,EAC9C,CAAC,SAAS,OAAO,GAAG,KAAK,IAGzB,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAI,MAAM,CAAC,GAC3B;IACE,EAAE,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAA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EAAE,SAAS,CAAC,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACnC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAmFlB,QAAA,MAAM,KAAK,0BAAyD,CAAC;AAErE,eAAe,KAAK,CAAC;AACrB,OAAO,EACL,KAAK,EACL,WAAW,GACZ,CAAC"}
package/dist/index.js CHANGED
@@ -301,12 +301,12 @@ function createStain(opts = {}) {
301
301
  return colorProxy();
302
302
  }
303
303
  var stain = /* @__PURE__ */ (() => createStain({ xterm: true }))();
304
- var src_default2 = createStain;
304
+ var src_default2 = stain;
305
305
  export {
306
306
  stain,
307
307
  src_default2 as default,
308
308
  createStain
309
309
  };
310
310
 
311
- //# debugId=923294455343402064756E2164756E21
311
+ //# debugId=4ADFA3652E740A5A64756E2164756E21
312
312
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -5,9 +5,9 @@
5
5
  "// node_modules/globables/dist/index.js\nvar GLOBAL_THIS = /* @__PURE__ */ (() => typeof globalThis === \"object\" ? globalThis : (() => {\n (function(Object2) {\n function get() {\n const e = this || self;\n e.globalThis = e, delete Object2.prototype._T_;\n }\n typeof globalThis != \"object\" && (this ? get() : (Object2.defineProperty(Object2.prototype, \"_T_\", { configurable: true, get }), _T_));\n })(Object);\n return typeof globalThis === \"object\" ? globalThis : {};\n})())();\nvar ARGV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof scriptArgs !== \"undefined\" ? scriptArgs : [] : (_d = (GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) ? (_c = (_a = GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) == null ? undefined : _a.args) != null ? _c : ((_b = process[\"args\"]) == null ? undefined : _b.length) ? process[\"args\"] : process[\"argv\"] : process[\"argv\"]) != null ? _d : [];\n})();\nvar ENV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof ((_a = GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"std\"]) == null ? undefined : _a.getenviron) === \"function\" ? (_d = (_c = (_b = GLOBAL_THIS[\"std\"]).getenviron) == null ? undefined : _c.call(_b)) != null ? _d : {} : {} : !(GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) ? process[\"env\"] : (() => {\n var _a2, _b2, _c2, _d2, _e, _f;\n try {\n return (_f = (_c2 = (_b2 = (_a2 = GLOBAL_THIS == null ? undefined : GLOBAL_THIS[\"Deno\"]) == null ? undefined : _a2.env) == null ? undefined : _b2.toObject) == null ? undefined : _c2.call(_b2)) != null ? _f : ((_d2 = process[\"env\"]) == null ? undefined : _d2.toObject) ? (_e = process[\"env\"]) == null ? undefined : _e.toObject() : process[\"env\"];\n } catch (_err) {}\n return {};\n })();\n})();\n\n// src/index.ts\nvar hasArgv = (keys, argv = ARGV) => !argv?.length ? false : !![keys].flat().filter(Boolean).find((key) => new RegExp(`(^|[^\\\\S])(?:--|-)${key}(=|\\\\s|$)`, \"i\").test(argv.join(\" \")));\nvar quoteNorm = (val) => /^['\"]/.test(val) ? val?.replace(/^(['\"])(.*)(['\"])$/, (m, q1, body, q2) => q1 === q2 ? quoteNorm(body) : m) : val;\nvar isFlag = (val) => /^-+\\w/.test(val ?? \"\") && Number.isNaN(Number(val));\nvar isTerm = (val) => val?.trim() === \"--\";\nvar toArgvArray = (key, strict = false, _keys = Array.isArray(key) ? key : [key]) => strict ? _keys : _keys.map((item) => [\n item,\n item.replaceAll(...item.includes(\"_\") ? [\"_\", \"-\"] : [\"-\", \"_\"])\n]).flat();\nvar cliReap = (argv = ARGV, env = ENV, gthis = GLOBAL_THIS, strict = false) => {\n const slice = argv[0] === \"node\" ? 2 : argv[1] === \"run\" ? 3 : isFlag(argv[0]) ? 0 : 1;\n const cur = argv.map(String).slice(slice);\n const cmd = argv.map(String).slice(0, slice);\n const end = !!cur.find(isTerm);\n const getArgv = (keys, optValue = false) => {\n const keyList = toArgvArray(keys, strict);\n for (let i = 0;i < cur.length; i++) {\n const token = cur[i];\n if (isTerm(token)) {\n break;\n }\n if (!token || !isFlag(token)) {\n continue;\n }\n const hasEq = /=/.test(token);\n const part = keyList.map((key) => {\n const [k, ...parts] = token.replace(isFlag(key) ? /(?!)/ : /^\\s*?-+/, \"\").split(hasEq && optValue ? `${key}=` : new RegExp(`^${key}$`, strict ? \"\" : \"i\"));\n return !k?.length ? parts.join(key) : k === key ? key : null;\n }).find((v) => v !== null) ?? 0;\n if (part === 0) {\n continue;\n }\n if (!optValue) {\n cur.splice(i, 1);\n return true;\n }\n if (hasEq) {\n cur.splice(i, 1);\n return quoteNorm(part);\n }\n const next = cur[i + 1];\n if (next !== undefined && !isTerm(next) && !isFlag(next)) {\n cur.splice(i, 2);\n return quoteNorm(next);\n }\n }\n return null;\n };\n const getEnv = (keys) => toArgvArray(keys, strict).map((key) => (key in env) ? env[key] : (key in gthis) ? gthis[key] : null).filter(Boolean)[0] ?? null;\n const getFlag = (keys) => getArgv(keys, false) !== null ? true : null;\n const getOpt = (keys) => getArgv(keys, true);\n const getAny = (keys, defaultValue) => getOpt(keys) ?? getFlag(keys) ?? getEnv(keys) ?? (defaultValue !== undefined ? defaultValue : null);\n const getPos = () => {\n const result = [];\n for (let i = 0;i < cur.length; i++) {\n const token = cur[i];\n if (!token) {\n continue;\n }\n if (isTerm(token)) {\n return [...result, ...cur.slice(i + 1)];\n }\n if (isFlag(token)) {\n continue;\n }\n result.push(token);\n }\n return result;\n };\n return {\n any: getAny,\n cmd: () => cmd,\n cur: () => cur,\n end: () => end,\n env: getEnv,\n flag: getFlag,\n opt: getOpt,\n pos: getPos\n };\n};\nvar cliReapStrict = (argv = ARGV, procEnv = ENV, gthis = GLOBAL_THIS) => cliReap(argv, procEnv, gthis, true);\nvar src_default = cliReap;\nexport {\n quoteNorm,\n isFlag,\n hasArgv,\n src_default as default,\n cliReapStrict,\n cliReap,\n ENV,\n ARGV\n};\n\n//# debugId=D346F45C437553B064756E2164756E21\n//# sourceMappingURL=index.js.map\n",
6
6
  "// src/index.ts\nvar GLOBAL_THIS = /* @__PURE__ */ (() => typeof globalThis === \"object\" ? globalThis : (() => {\n !(function(Object2) {\n function get() {\n const e = this || self;\n e.globalThis = e, delete Object2.prototype._T_;\n }\n \"object\" != typeof globalThis && (this ? get() : (Object2.defineProperty(Object2.prototype, \"_T_\", { configurable: true, get }), _T_));\n })(Object);\n return typeof globalThis === \"object\" ? globalThis : {};\n})())();\nvar ARGV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof scriptArgs !== \"undefined\" ? scriptArgs : [] : (_d = (GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) ? (_c = (_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) == null ? void 0 : _a.args) != null ? _c : ((_b = process[\"args\"]) == null ? void 0 : _b.length) ? process[\"args\"] : process[\"argv\"] : process[\"argv\"]) != null ? _d : [];\n})();\nvar ARGS = ARGV;\nvar ENV = /* @__PURE__ */ (() => {\n var _a, _b, _c, _d;\n return typeof process === \"undefined\" ? typeof ((_a = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"std\"]) == null ? void 0 : _a.getenviron) === \"function\" ? (_d = (_c = (_b = GLOBAL_THIS[\"std\"]).getenviron) == null ? void 0 : _c.call(_b)) != null ? _d : {} : {} : !(GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) ? process[\"env\"] : (() => {\n var _a2, _b2, _c2, _d2, _e, _f;\n try {\n return (_f = (_c2 = (_b2 = (_a2 = GLOBAL_THIS == null ? void 0 : GLOBAL_THIS[\"Deno\"]) == null ? void 0 : _a2.env) == null ? void 0 : _b2.toObject) == null ? void 0 : _c2.call(_b2)) != null ? _f : ((_d2 = process[\"env\"]) == null ? void 0 : _d2.toObject) ? (_e = process[\"env\"]) == null ? void 0 : _e.toObject() : process[\"env\"];\n } catch (_err) {\n }\n return {};\n })();\n})();\nexport {\n ARGS,\n ARGV,\n ENV,\n GLOBAL_THIS\n};\n//# sourceMappingURL=index.js.map\n",
7
7
  "import cliReap from 'cli-reap';\nimport {\n ENV,\n GLOBAL_THIS,\n} from 'globables';\n\nexport const ESC = '\\x1B';\nexport const RESET = '\\x1B[0m';\n\nexport const COLOR_DEF = {\n black: 30,\n iblack: 90,\n red: 31,\n ired: 91,\n green: 32,\n igreen: 92,\n yellow: 33,\n iyellow: 93,\n blue: 34,\n iblue: 94,\n purple: 35,\n ipurple: 95,\n cyan: 36,\n icyan: 96,\n white: 37,\n iwhite: 97,\n};\nexport const XTERM_DEF = Object.fromEntries(\n Array(256).fill(0).map((_v, i) => [`x${i}`, i] as [string, number]),\n);\nexport const COLOR_ALL = {...COLOR_DEF, ...XTERM_DEF};\n\n\n/**\n * color support level\n * @default 3\n * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}\n */\ntype ColorSpace = 0 | 1;\n\n\n/**\n * COLOR_SPACE - covers all reasonable and most un-reasonable cases\n * @implements nodejs.org/api/cli.html#force_color1-2-3\n * 0=no-color, 1=16, 2=256, 3=true-color\n */\nexport const COLOR_SPACE: ColorSpace = /* @__PURE__ */ (() => {\n try {\n const reap = cliReap();\n const forceColor = reap.any('FORCE_COLOR');\n // force colors\n if (forceColor === '' || (forceColor && !isNaN(Number(forceColor)) && Number(forceColor) > 0)) {\n return 1;\n }\n // no proc\n if (typeof process === 'undefined') { return 0; }\n\n // no color var\n if (reap.any('NO_COLOR') !== null\n || reap.any('NODE_DISABLE_COLORS') !== null\n || (/-mono|dumb/i).test(ENV['TERM'] ?? '')) { return 0; }\n\n // no tty\n if (!(!!process.stdout?.isTTY\n || (!!ENV['PM2_HOME'] && !!ENV['pm_id'])\n || ((GLOBAL_THIS as never)?.['Deno']\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ? (GLOBAL_THIS as any)?.['Deno']?.isatty(1)\n : !!process.stdout?.isTTY))) { return 0; }\n\n // cli\n if ((/^(false|never|no|0)$/i).test(`${reap.opt('color') ?? ''}`.trim())) {\n return 0;\n }\n return 1;\n } catch (_err) { /* ignore */ }\n // catch/error/fallthrough; plays it safe with no colors\n return 0;\n})();\n\n",
8
- "import {\n COLOR_SPACE,\n ESC,\n RESET,\n COLOR_DEF,\n XTERM_DEF,\n COLOR_ALL,\n} from './constants.ts';\n\ntype EmptyObject = Record<never, never>;\ntype StrNum = string | number;\n\n// fg=foreground\n// bg=background\n// ft=font\n// ue=underline\n// ie=inverse\n// re=reset\n// pr=previous (internal state)\ntype StyleKeys = 'fg' | 'bg' | 'ft' | 'ue' | 'ie' | 're' | 'pr';\ntype AnsiCodeTuple = [on: number, off: number, isCustom?: number];\ntype StyleState = Partial<Record<StyleKeys, AnsiCodeTuple>>;\ntype StainBase = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';\nexport type StainAnsi = StainBase | `i${StainBase}`;\n\n// generate xterms: x0 to x255\ntype XtermKeysFactory<N extends number, Acc extends string[] = []> =\n Acc['length'] extends N\n ? Acc[number]\n : XtermKeysFactory<N, [...Acc, `x${Acc['length']}`]>;\nexport type StainXterm = XtermKeysFactory<256>;\n\nexport type Stain<\n C extends Record<string, number> = EmptyObject,\n X extends boolean = false,\n> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((...args: any[])=> string) &\n {\n bg: Stain<C, X>;\n bold: Stain<C, X>;\n dim: Stain<C, X>;\n normal: Stain<C, X>;\n reset: Stain<C, X>;\n underline: Stain<C, X>;\n inverse: Stain<C, X>;\n } &\n // built-in named colors\n { [K in StainAnsi]: Stain<C, X> } &\n // xterm colors if enabled\n (X extends true ? { [K in StainXterm]: Stain<C, X> } : EmptyObject) &\n // custom colors from opts.colors\n (keyof C extends never ? EmptyObject : { [K in keyof C]: Stain<C, X> });\n\nexport type StainOpts<C extends Record<string, number> = EmptyObject> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n format?: (...args: any[])=> string;\n noColor?: boolean;\n xterm?: boolean;\n colors?: C;\n simpleEscape?: boolean;\n};\n\n\n/**\n * ansi escape-er\n * @note -> without handlin/escapin nesting it simplifies to: `\\x1b[${open}m${str}\\x1b[${close}m`\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} fontReplace\n * @return {[type]}\n */\nconst escStain = (str: string, open: StrNum, close: StrNum, fontReplace?: StrNum) => {\n str = typeof str !== 'string' ? String(str) : str; // just in case\n const openStr = ESC + `[${open}m`;\n const closeStr = ESC + `[${close}m`;\n const closeLen = closeStr.length;\n const parts: string[] = [];\n let cursor = 0;\n let seqCount = 0; // count of close sequences for alternating styles\n let resetCount = 0;\n while (true) {\n const idxClose = str.indexOf(closeStr, cursor);\n // next global reset unless it is the reset style\n const idxReset = open === 0 ? -1 : str.indexOf(RESET, cursor);\n let idx = -1;\n let isReset = false;\n // which comes first, cur close sequence or a global reset\n if (idxClose >= 0) {\n if (idxReset >= 0 && idxReset < idxClose) {\n idx = idxReset;\n isReset = true;\n } else {\n idx = idxClose;\n }\n } else if (idxReset >= 0) {\n idx = idxReset;\n isReset = true;\n } else {\n break;\n }\n parts.push(str.substring(cursor, idx));\n\n if (isReset) {\n parts.push(RESET);\n resetCount++;\n // after every second reset restore style\n // e.g: stain.red(`text ${stain.reset('reset')} text`)\n if (resetCount % 2 === 0) { parts.push(openStr); }\n cursor = idx + RESET.length;\n continue;\n }\n\n // a closing sequence; need to determine the correct replacement\n const segment = str.substring(cursor, idx);\n const openInSeg = segment.split(openStr).length;\n const closeInSeg = segment.split(closeStr).length;\n\n let rep = openStr;\n // this roundabout logic is for font styles nesting\n // e.g: stain.bold(`bold ${stain.normal('norm')} bold`)\n if (fontReplace !== undefined && openInSeg <= closeInSeg) {\n // use seqCount to treat the first closeStr as an 'opener' and the second as the 'closer'\n seqCount++;\n const on = ESC + `[${fontReplace}m`; // outer style's open code\n const off = ESC + `[${close}m`; // inner style's open/close code\n rep = (seqCount % 2 === 1) ? on + off : off + on;\n }\n\n parts.push(rep);\n cursor = idx + closeLen;\n }\n parts.push(str.substring(cursor));\n return openStr + parts.join('') + closeStr;\n};\n\n/**\n * simple escape that doesn't handle nested ansi; 1.5-4x+ faster depending on style complexity\n * nested example: stain.red.bold('Bold ' + stain.green.normal('normal') + ' Bold')\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} _fontReplace\n * @return {[type]}\n */\nconst escStainSimple = (str: string, open: StrNum, close: StrNum, _fontReplace?: StrNum) =>\n `${ESC}[${open}m` + (typeof str !== 'string' ? String(str) : str) + `${ESC}[${close}m`;\n\n\n/**\n * a nice node typed color api, that isn't \"slow\" at\n * @perf ~6million iter/s - NO_COLOR=~186million iter/s\n */\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts?: StainOpts<C> & { xterm?: false }\n): Stain<C, false>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> & { xterm: true }\n): Stain<C, true>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> = {},\n): Stain<C, boolean> {\n const {\n colors,\n xterm,\n format = (...args) => args.length > 1\n ? args.join(' ')\n : typeof args[0] !== 'string' ? JSON.stringify(args[0]) : args[0],\n noColor = COLOR_SPACE === 0,\n simpleEscape = false,\n } = opts;\n\n const colorAll: Record<string, number> = colors\n ? {...(xterm ? COLOR_ALL : COLOR_DEF), ...colors}\n : (xterm ? COLOR_ALL : COLOR_DEF);\n\n // provies the same api, but doesn't add color, and much, much, much, faster\n if (noColor) {\n // wrapped to avoid poluting the proto on passed in format\n const ncFormat = opts?.format ? (...args: unknown[]) => format(...args) : format;\n for (const prop of Object.keys(colorAll)\n .concat(['bg', 'bold', 'dim', 'normal', 'reset', 'underline'])) {\n // @ts-expect-error not typable\n ncFormat[prop] = ncFormat;\n }\n return ncFormat as Stain<C, boolean>;\n }\n const escFn = simpleEscape ? escStainSimple : escStain;\n // xterm look-up map to determin if xterm\n // @see {@link https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit}\n const color256: Record<string, number> = colors\n ? (xterm ? {...XTERM_DEF, ...colors} : colors)\n : (xterm ? XTERM_DEF : {});\n\n // our main stain\n const colorProxy = (cur: StyleState = {}) =>\n new Proxy((text: string) => text, {\n get: (_target, prop: string) => {\n const nxt = {...cur};\n const fg = nxt.fg;\n if (colorAll[prop] !== undefined) { // xterm logic\n // keeps track of previous for bg logic\n nxt.pr = [\n fg?.[0] ?? colorAll[prop],\n 39,\n fg?.[2] ?? (color256[prop] !== undefined ? 1 : 0),\n ];\n nxt.fg = [colorAll[prop], 39, color256[prop] !== undefined ? 1 : 0];\n } else if (prop === 'bg' && fg) { // bg/fg logic\n nxt.bg = [fg[0] + (fg[2] || fg[1] === 49 ? 0 : 10), 49, fg[2]] as AnsiCodeTuple;\n // @ts-expect-error to make this type easier we ignore undefined\n if (nxt.pr?.[1] === 39) { nxt.fg = fg[0] === nxt.pr[0] ? undefined : [...nxt.pr]; }\n } else { // font style logic\n const fo = prop === 'bold' ? 1 : prop === 'dim' ? 2 : prop === 'normal' ? 22 : null;\n if (fo) {\n nxt.ft = [fo, 22, 0];\n } else if (prop === 'underline') {\n nxt.ue = [4, 24, 0];\n } else if (prop === 'inverse') {\n nxt.ie = [7, 27, 0];\n } else if (prop === 'reset') {\n nxt.re = [0, 0, 0];\n }\n }\n return colorProxy(nxt);\n },\n apply: (_target, _thisArg, args: string[]) => {\n let res = format(...args);\n // a loop here will dec perf by 6x\n if (cur.re) { return escFn(res, 0, 0); }\n if (cur.fg) { res = escFn(res, (cur.fg[2] ? '38;5;' : '') + cur.fg[0], cur.fg[1]); }\n if (cur.bg) { res = escFn(res, (cur.bg[2] ? '48;5;' : '') + cur.bg[0], cur.bg[1]); }\n if (cur.ft) { res = escFn(res, cur.ft[0], cur.ft[1], cur.ft[0]); }\n if (cur.ue) { res = escFn(res, cur.ue[0], cur.ue[1]); }\n if (cur.ie) { res = escFn(res, cur.ie[0], cur.ie[1]); }\n return res;\n },\n });\n return colorProxy() as Stain<C, boolean>;\n}\n\nconst stain = /* @__PURE__ */ (() => createStain({ xterm: true }))();\n\nexport default createStain;\nexport {\n stain,\n createStain,\n};\n"
8
+ "import {\n COLOR_ALL,\n COLOR_DEF,\n COLOR_SPACE,\n ESC,\n RESET,\n XTERM_DEF,\n} from './constants.ts';\n\ntype EmptyObject = Record<never, never>;\ntype StrNum = string | number;\n\n// fg=foreground\n// bg=background\n// ft=font\n// ue=underline\n// ie=inverse\n// re=reset\n// pr=previous (internal state)\ntype StyleKeys = 'fg' | 'bg' | 'ft' | 'ue' | 'ie' | 're' | 'pr';\ntype AnsiCodeTuple = [on: number, off: number, isCustom?: number];\ntype StyleState = Partial<Record<StyleKeys, AnsiCodeTuple>>;\ntype StainBase = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';\nexport type StainAnsi = StainBase | `i${StainBase}`;\n\n// generate xterms: x0 to x255\ntype XtermKeysFactory<N extends number, Acc extends string[] = []> =\n Acc['length'] extends N\n ? Acc[number]\n : XtermKeysFactory<N, [...Acc, `x${Acc['length']}`]>;\nexport type StainXterm = XtermKeysFactory<256>;\n\nexport type Stain<\n C extends Record<string, number> = EmptyObject,\n X extends boolean = false,\n> =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((...args: any[])=> string) &\n {\n bg: Stain<C, X>;\n bold: Stain<C, X>;\n dim: Stain<C, X>;\n normal: Stain<C, X>;\n reset: Stain<C, X>;\n underline: Stain<C, X>;\n inverse: Stain<C, X>;\n } &\n // built-in named colors\n { [K in StainAnsi]: Stain<C, X> } &\n // xterm colors if enabled\n (X extends true ? { [K in StainXterm]: Stain<C, X> } : EmptyObject) &\n // custom colors from opts.colors\n (keyof C extends never ? EmptyObject : { [K in keyof C]: Stain<C, X> });\n\nexport type StainOpts<C extends Record<string, number> = EmptyObject> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n format?: (...args: any[])=> string;\n noColor?: boolean;\n xterm?: boolean;\n colors?: C;\n simpleEscape?: boolean;\n};\n\n\n/**\n * ansi escape-er\n * @note -> without handlin/escapin nesting it simplifies to: `\\x1b[${open}m${str}\\x1b[${close}m`\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} fontReplace\n * @return {[type]}\n */\nconst escStain = (str: string, open: StrNum, close: StrNum, fontReplace?: StrNum) => {\n str = typeof str !== 'string' ? String(str) : str; // just in case\n const openStr = ESC + `[${open}m`;\n const closeStr = ESC + `[${close}m`;\n const closeLen = closeStr.length;\n const parts: string[] = [];\n let cursor = 0;\n let seqCount = 0; // count of close sequences for alternating styles\n let resetCount = 0;\n while (true) {\n const idxClose = str.indexOf(closeStr, cursor);\n // next global reset unless it is the reset style\n const idxReset = open === 0 ? -1 : str.indexOf(RESET, cursor);\n let idx = -1;\n let isReset = false;\n // which comes first, cur close sequence or a global reset\n if (idxClose >= 0) {\n if (idxReset >= 0 && idxReset < idxClose) {\n idx = idxReset;\n isReset = true;\n } else {\n idx = idxClose;\n }\n } else if (idxReset >= 0) {\n idx = idxReset;\n isReset = true;\n } else {\n break;\n }\n parts.push(str.substring(cursor, idx));\n\n if (isReset) {\n parts.push(RESET);\n resetCount++;\n // after every second reset restore style\n // e.g: stain.red(`text ${stain.reset('reset')} text`)\n if (resetCount % 2 === 0) { parts.push(openStr); }\n cursor = idx + RESET.length;\n continue;\n }\n\n // a closing sequence; need to determine the correct replacement\n const segment = str.substring(cursor, idx);\n const openInSeg = segment.split(openStr).length;\n const closeInSeg = segment.split(closeStr).length;\n\n let rep = openStr;\n // this roundabout logic is for font styles nesting\n // e.g: stain.bold(`bold ${stain.normal('norm')} bold`)\n if (fontReplace !== undefined && openInSeg <= closeInSeg) {\n // use seqCount to treat the first closeStr as an 'opener' and the second as the 'closer'\n seqCount++;\n const on = ESC + `[${fontReplace}m`; // outer style's open code\n const off = ESC + `[${close}m`; // inner style's open/close code\n rep = (seqCount % 2 === 1) ? on + off : off + on;\n }\n\n parts.push(rep);\n cursor = idx + closeLen;\n }\n parts.push(str.substring(cursor));\n return openStr + parts.join('') + closeStr;\n};\n\n/**\n * simple escape that doesn't handle nested ansi; 1.5-4x+ faster depending on style complexity\n * nested example: stain.red.bold('Bold ' + stain.green.normal('normal') + ' Bold')\n * @param {string} str\n * @param {StrNum} open\n * @param {StrNum} close\n * @param {StrNum} _fontReplace\n * @return {[type]}\n */\nconst escStainSimple = (str: string, open: StrNum, close: StrNum, _fontReplace?: StrNum) =>\n `${ESC}[${open}m` + (typeof str !== 'string' ? String(str) : str) + `${ESC}[${close}m`;\n\n\n/**\n * a nice node typed color api, that isn't \"slow\" at\n * @perf ~6million iter/s - NO_COLOR=~186million iter/s\n */\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts?: StainOpts<C> & { xterm?: false }\n): Stain<C, false>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> & { xterm: true }\n): Stain<C, true>;\nfunction createStain<C extends Record<string, number> = EmptyObject>(\n opts: StainOpts<C> = {},\n): Stain<C, boolean> {\n const {\n colors,\n xterm,\n format = (...args) => args.length > 1\n ? args.join(' ')\n : typeof args[0] !== 'string' ? JSON.stringify(args[0]) : args[0],\n noColor = COLOR_SPACE === 0,\n simpleEscape = false,\n } = opts;\n\n const colorAll: Record<string, number> = colors\n ? {...(xterm ? COLOR_ALL : COLOR_DEF), ...colors}\n : (xterm ? COLOR_ALL : COLOR_DEF);\n\n // provies the same api, but doesn't add color, and much, much, much, faster\n if (noColor) {\n // wrapped to avoid poluting the proto on passed in format\n const ncFormat = opts?.format ? (...args: unknown[]) => format(...args) : format;\n for (const prop of Object.keys(colorAll)\n .concat(['bg', 'bold', 'dim', 'normal', 'reset', 'underline'])) {\n // @ts-expect-error not typable\n ncFormat[prop] = ncFormat;\n }\n return ncFormat as Stain<C, boolean>;\n }\n const escFn = simpleEscape ? escStainSimple : escStain;\n // xterm look-up map to determin if xterm\n // @see {@link https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit}\n const color256: Record<string, number> = colors\n ? (xterm ? {...XTERM_DEF, ...colors} : colors)\n : (xterm ? XTERM_DEF : {});\n\n // our main stain\n const colorProxy = (cur: StyleState = {}) =>\n new Proxy((text: string) => text, {\n get: (_target, prop: string) => {\n const nxt = {...cur};\n const fg = nxt.fg;\n if (colorAll[prop] !== undefined) { // xterm logic\n // keeps track of previous for bg logic\n nxt.pr = [\n fg?.[0] ?? colorAll[prop],\n 39,\n fg?.[2] ?? (color256[prop] !== undefined ? 1 : 0),\n ];\n nxt.fg = [colorAll[prop], 39, color256[prop] !== undefined ? 1 : 0];\n } else if (prop === 'bg' && fg) { // bg/fg logic\n nxt.bg = [fg[0] + (fg[2] || fg[1] === 49 ? 0 : 10), 49, fg[2]] as AnsiCodeTuple;\n // @ts-expect-error to make this type easier we ignore undefined\n if (nxt.pr?.[1] === 39) { nxt.fg = fg[0] === nxt.pr[0] ? undefined : [...nxt.pr]; }\n } else { // font style logic\n const fo = prop === 'bold' ? 1 : prop === 'dim' ? 2 : prop === 'normal' ? 22 : null;\n if (fo) {\n nxt.ft = [fo, 22, 0];\n } else if (prop === 'underline') {\n nxt.ue = [4, 24, 0];\n } else if (prop === 'inverse') {\n nxt.ie = [7, 27, 0];\n } else if (prop === 'reset') {\n nxt.re = [0, 0, 0];\n }\n }\n return colorProxy(nxt);\n },\n apply: (_target, _thisArg, args: string[]) => {\n let res = format(...args);\n // a loop here will dec perf by 6x\n if (cur.re) { return escFn(res, 0, 0); }\n if (cur.fg) { res = escFn(res, (cur.fg[2] ? '38;5;' : '') + cur.fg[0], cur.fg[1]); }\n if (cur.bg) { res = escFn(res, (cur.bg[2] ? '48;5;' : '') + cur.bg[0], cur.bg[1]); }\n if (cur.ft) { res = escFn(res, cur.ft[0], cur.ft[1], cur.ft[0]); }\n if (cur.ue) { res = escFn(res, cur.ue[0], cur.ue[1]); }\n if (cur.ie) { res = escFn(res, cur.ie[0], cur.ie[1]); }\n return res;\n },\n });\n return colorProxy() as Stain<C, boolean>;\n}\n\nconst stain = /* @__PURE__ */ (() => createStain({ xterm: true }))();\n\nexport default stain;\nexport {\n stain,\n createStain,\n};\n"
9
9
  ],
10
10
  "mappings": ";AACA,IAAI,+BAA+B,MAAM,OAAO,eAAe,WAAW,cAAc,MAAM;AAAA,GAC3F,QAAQ,CAAC,SAAS;AAAA,IACjB,SAAS,GAAG,GAAG;AAAA,MACb,MAAM,IAAI,QAAQ;AAAA,MAClB,EAAE,aAAa,GAAG,OAAO,QAAQ,UAAU;AAAA;AAAA,IAE7C,OAAO,cAAc,aAAa,OAAO,IAAI,KAAK,QAAQ,eAAe,QAAQ,WAAW,OAAO,EAAE,cAAc,MAAM,IAAI,CAAC,GAAG;AAAA,KAChI,MAAM;AAAA,EACT,OAAO,OAAO,eAAe,WAAW,aAAa,CAAC;AAAA,GACrD,GAAG;AACN,IAAI,wBAAwB,MAAM;AAAA,EAChC,IAAI,IAAI,IAAI,IAAI;AAAA,EAChB,OAAO,OAAO,YAAY,cAAc,OAAO,eAAe,cAAc,aAAa,CAAC,KAAK,MAAM,eAAe,OAAO,YAAY,YAAY,YAAY,MAAM,KAAK,eAAe,OAAO,YAAY,YAAY,YAAY,OAAO,YAAY,GAAG,SAAS,OAAO,OAAO,KAAK,QAAQ,YAAY,OAAO,YAAY,GAAG,UAAU,QAAQ,UAAU,QAAQ,UAAU,QAAQ,YAAY,OAAO,KAAK,CAAC;AAAA,GAC9Y;AACH,IAAI,uBAAuB,MAAM;AAAA,EAC/B,IAAI,IAAI,IAAI,IAAI;AAAA,EAChB,OAAO,OAAO,YAAY,cAAc,SAAS,KAAK,eAAe,OAAO,YAAY,YAAY,WAAW,OAAO,YAAY,GAAG,gBAAgB,cAAc,MAAM,MAAM,KAAK,YAAY,QAAQ,eAAe,OAAO,YAAY,GAAG,KAAK,EAAE,MAAM,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,eAAe,OAAO,YAAY,YAAY,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G,KAAK,UAAU,MAAM,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACnF,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,MAAM,IAAI,GAAG,KAAK,UAAU,MAAM,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACnF,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACjE,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACtD,IAAI,IAAI,IAAI;AAAA,QAAE,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE;AAAA,MAAG;AAAA,MACtD,OAAO;AAAA;AAAA,EAEX,CAAC;AAAA,EACH,OAAO,WAAW;AAAA;AAGpB,IAAM,yBAAyB,MAAM,YAAY,EAAE,OAAO,KAAK,CAAC,GAAG;AAEnE,IAAe;",
11
- "debugId": "923294455343402064756E2164756E21",
11
+ "debugId": "4ADFA3652E740A5A64756E2164756E21",
12
12
  "names": []
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stain",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "description": "Fluent, flexible, and fast ANSI styling that adds color to your terminal",
5
5
  "homepage": "https://github.com/fetchTe/stain",
6
6
  "license": "MIT",
@@ -1,9 +0,0 @@
1
- export declare const getMeta: () => {
2
- readonly name: string;
3
- readonly version: string;
4
- readonly repo: string;
5
- readonly description: string;
6
- readonly compressed: true;
7
- readonly btime: string;
8
- };
9
- //# sourceMappingURL=_macro_.d.ts.map
@@ -1,9 +0,0 @@
1
- export declare const getMeta: () => {
2
- readonly name: string;
3
- readonly version: string;
4
- readonly repo: string;
5
- readonly description: string;
6
- readonly compressed: true;
7
- readonly btime: string;
8
- };
9
- //# sourceMappingURL=_macro_.d.ts.map
package/dist/_macro_.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare const getMeta: () => {
2
- readonly name: string;
3
- readonly version: string;
4
- readonly repo: string;
5
- readonly description: string;
6
- readonly compressed: true;
7
- readonly btime: string;
8
- };
9
- //# sourceMappingURL=_macro_.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_macro_.d.ts","sourceRoot":"","sources":["../src/_macro_.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO;;;;;;;CAOT,CAAC"}
@@ -1 +0,0 @@
1
- var{defineProperty:v,getOwnPropertyNames:u,getOwnPropertyDescriptor:i}=Object,l=Object.prototype.hasOwnProperty;var y=new WeakMap,_=(z)=>{var J=y.get(z),Q;if(J)return J;if(J=v({},"__esModule",{value:!0}),z&&typeof z==="object"||typeof z==="function")u(z).map((Y)=>!l.call(J,Y)&&v(J,Y,{get:()=>z[Y],enumerable:!(Q=i(z,Y))||Q.enumerable}));return y.set(z,J),J};var p=(z,J)=>{for(var Q in J)v(z,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(Y)=>J[Q]=()=>Y})};var r={};p(r,{stain:()=>e,default:()=>zz,createStain:()=>O});module.exports=_(r);var h=(()=>typeof globalThis==="object"?globalThis:(()=>{return function(z){function J(){let Q=this||self;Q.globalThis=Q,delete z.prototype._T_}typeof globalThis!="object"&&(this?J():(z.defineProperty(z.prototype,"_T_",{configurable:!0,get:J}),_T_))}(Object),typeof globalThis==="object"?globalThis:{}})())(),a=(()=>{var z,J,Q,Y;return typeof process==="undefined"?typeof scriptArgs!=="undefined"?scriptArgs:[]:(Y=(h==null?void 0:h.Deno)?(Q=(z=h==null?void 0:h.Deno)==null?void 0:z.args)!=null?Q:((J=process.args)==null?void 0:J.length)?process.args:process.argv:process.argv)!=null?Y:[]})(),c=(()=>{var z,J,Q,Y;return typeof process==="undefined"?typeof((z=h==null?void 0:h.std)==null?void 0:z.getenviron)==="function"?(Y=(Q=(J=h.std).getenviron)==null?void 0:Q.call(J))!=null?Y:{}:{}:!(h==null?void 0:h.Deno)?process.env:(()=>{var M,Z,D,w,P,N;try{return(N=(D=(Z=(M=h==null?void 0:h.Deno)==null?void 0:M.env)==null?void 0:Z.toObject)==null?void 0:D.call(Z))!=null?N:((w=process.env)==null?void 0:w.toObject)?(P=process.env)==null?void 0:P.toObject():process.env}catch(W){}return{}})()})();var x=(z)=>/^['"]/.test(z)?z?.replace(/^(['"])(.*)(['"])$/,(J,Q,Y,M)=>Q===M?x(Y):J):z,m=(z)=>/^-+\w/.test(z??"")&&Number.isNaN(Number(z)),f=(z)=>z?.trim()==="--",k=(z,J=!1,Q=Array.isArray(z)?z:[z])=>J?Q:Q.map((Y)=>[Y,Y.replaceAll(...Y.includes("_")?["_","-"]:["-","_"])]).flat(),o=(z=a,J=c,Q=h,Y=!1)=>{let M=z[0]==="node"?2:z[1]==="run"?3:m(z[0])?0:1,Z=z.map(String).slice(M),D=z.map(String).slice(0,M),w=!!Z.find(f),P=(K,U=!1)=>{let F=k(K,Y);for(let V=0;V<Z.length;V++){let C=Z[V];if(f(C))break;if(!C||!m(C))continue;let I=/=/.test(C),b=F.map((B)=>{let[S,...n]=C.replace(m(B)?/(?!)/:/^\s*?-+/,"").split(I&&U?`${B}=`:new RegExp(`^${B}$`,Y?"":"i"));return!S?.length?n.join(B):S===B?B:null}).find((B)=>B!==null)??0;if(b===0)continue;if(!U)return Z.splice(V,1),!0;if(I)return Z.splice(V,1),x(b);let G=Z[V+1];if(G!==void 0&&!f(G)&&!m(G))return Z.splice(V,2),x(G)}return null},N=(K)=>k(K,Y).map((U)=>(U in J)?J[U]:(U in Q)?Q[U]:null).filter(Boolean)[0]??null,W=(K)=>P(K,!1)!==null?!0:null,q=(K)=>P(K,!0);return{any:(K,U)=>q(K)??W(K)??N(K)??(U!==void 0?U:null),cmd:()=>D,cur:()=>Z,end:()=>w,env:N,flag:W,opt:q,pos:()=>{let K=[];for(let U=0;U<Z.length;U++){let F=Z[U];if(!F)continue;if(f(F))return[...K,...Z.slice(U+1)];if(m(F))continue;K.push(F)}return K}}};var L=o;var j=(()=>typeof globalThis==="object"?globalThis:(()=>{return function(z){function J(){let Q=this||self;Q.globalThis=Q,delete z.prototype._T_}typeof globalThis!="object"&&(this?J():(z.defineProperty(z.prototype,"_T_",{configurable:!0,get:J}),_T_))}(Object),typeof globalThis==="object"?globalThis:{}})())();var E=(()=>{var z,J,Q,Y;return typeof process==="undefined"?typeof((z=j==null?void 0:j.std)==null?void 0:z.getenviron)==="function"?(Y=(Q=(J=j.std).getenviron)==null?void 0:Q.call(J))!=null?Y:{}:{}:!(j==null?void 0:j.Deno)?process.env:(()=>{var M,Z,D,w,P,N;try{return(N=(D=(Z=(M=j==null?void 0:j.Deno)==null?void 0:M.env)==null?void 0:Z.toObject)==null?void 0:D.call(Z))!=null?N:((w=process.env)==null?void 0:w.toObject)?(P=process.env)==null?void 0:P.toObject():process.env}catch(W){}return{}})()})();var H="\x1B",T="\x1B[0m",d={black:30,iblack:90,red:31,ired:91,green:32,igreen:92,yellow:33,iyellow:93,blue:34,iblue:94,purple:35,ipurple:95,cyan:36,icyan:96,white:37,iwhite:97},R=Object.fromEntries(Array(256).fill(0).map((z,J)=>[`x${J}`,J])),A={...d,...R},g=(()=>{try{let z=L(),J=z.any("FORCE_COLOR");if(J===""||J&&!isNaN(Number(J))&&Number(J)>0)return 1;if(typeof process==="undefined")return 0;if(z.any("NO_COLOR")!==null||z.any("NODE_DISABLE_COLORS")!==null||/-mono|dumb/i.test(E.TERM??""))return 0;if(!(!!process.stdout?.isTTY||!!E.PM2_HOME&&!!E.pm_id||(j?.Deno?j?.Deno?.isatty(1):!!process.stdout?.isTTY)))return 0;if(/^(false|never|no|0)$/i.test(`${z.opt("color")??""}`.trim()))return 0;return 1}catch(z){}return 0})();var s=(z,J,Q,Y)=>{z=typeof z!=="string"?String(z):z;let M=H+`[${J}m`,Z=H+`[${Q}m`,D=Z.length,w=[],P=0,N=0,W=0;while(!0){let q=z.indexOf(Z,P),X=J===0?-1:z.indexOf(T,P),$=-1,K=!1;if(q>=0)if(X>=0&&X<q)$=X,K=!0;else $=q;else if(X>=0)$=X,K=!0;else break;if(w.push(z.substring(P,$)),K){if(w.push(T),W++,W%2===0)w.push(M);P=$+T.length;continue}let U=z.substring(P,$),F=U.split(M).length,V=U.split(Z).length,C=M;if(Y!==void 0&&F<=V){N++;let I=H+`[${Y}m`,b=H+`[${Q}m`;C=N%2===1?I+b:b+I}w.push(C),P=$+D}return w.push(z.substring(P)),M+w.join("")+Z},t=(z,J,Q,Y)=>`${H}[${J}m`+(typeof z!=="string"?String(z):z)+`${H}[${Q}m`;function O(z={}){let{colors:J,xterm:Q,format:Y=(...W)=>W.length>1?W.join(" "):typeof W[0]!=="string"?JSON.stringify(W[0]):W[0],noColor:M=g===0,simpleEscape:Z=!1}=z,D=J?{...Q?A:d,...J}:Q?A:d;if(M){let W=z?.format?(...q)=>Y(...q):Y;for(let q of Object.keys(D).concat(["bg","bold","dim","normal","reset","underline"]))W[q]=W;return W}let w=Z?t:s,P=J?Q?{...R,...J}:J:Q?R:{},N=(W={})=>new Proxy((q)=>q,{get:(q,X)=>{let $={...W},K=$.fg;if(D[X]!==void 0)$.pr=[K?.[0]??D[X],39,K?.[2]??(P[X]!==void 0?1:0)],$.fg=[D[X],39,P[X]!==void 0?1:0];else if(X==="bg"&&K){if($.bg=[K[0]+(K[2]||K[1]===49?0:10),49,K[2]],$.pr?.[1]===39)$.fg=K[0]===$.pr[0]?void 0:[...$.pr]}else{let U=X==="bold"?1:X==="dim"?2:X==="normal"?22:null;if(U)$.ft=[U,22,0];else if(X==="underline")$.ue=[4,24,0];else if(X==="inverse")$.ie=[7,27,0];else if(X==="reset")$.re=[0,0,0]}return N($)},apply:(q,X,$)=>{let K=Y(...$);if(W.re)return w(K,0,0);if(W.fg)K=w(K,(W.fg[2]?"38;5;":"")+W.fg[0],W.fg[1]);if(W.bg)K=w(K,(W.bg[2]?"48;5;":"")+W.bg[0],W.bg[1]);if(W.ft)K=w(K,W.ft[0],W.ft[1],W.ft[0]);if(W.ue)K=w(K,W.ue[0],W.ue[1]);if(W.ie)K=w(K,W.ie[0],W.ie[1]);return K}});return N()}var e=(()=>O({xterm:!0}))(),zz=O;
package/dist/index.min.js DELETED
@@ -1 +0,0 @@
1
- var h=(()=>typeof globalThis==="object"?globalThis:(()=>{return function(z){function K(){let W=this||self;W.globalThis=W,delete z.prototype._T_}typeof globalThis!="object"&&(this?K():(z.defineProperty(z.prototype,"_T_",{configurable:!0,get:K}),_T_))}(Object),typeof globalThis==="object"?globalThis:{}})())(),g=(()=>{var z,K,W,Y;return typeof process==="undefined"?typeof scriptArgs!=="undefined"?scriptArgs:[]:(Y=(h==null?void 0:h.Deno)?(W=(z=h==null?void 0:h.Deno)==null?void 0:z.args)!=null?W:((K=process.args)==null?void 0:K.length)?process.args:process.argv:process.argv)!=null?Y:[]})(),n=(()=>{var z,K,W,Y;return typeof process==="undefined"?typeof((z=h==null?void 0:h.std)==null?void 0:z.getenviron)==="function"?(Y=(W=(K=h.std).getenviron)==null?void 0:W.call(K))!=null?Y:{}:{}:!(h==null?void 0:h.Deno)?process.env:(()=>{var M,Z,D,w,P,N;try{return(N=(D=(Z=(M=h==null?void 0:h.Deno)==null?void 0:M.env)==null?void 0:Z.toObject)==null?void 0:D.call(Z))!=null?N:((w=process.env)==null?void 0:w.toObject)?(P=process.env)==null?void 0:P.toObject():process.env}catch(Q){}return{}})()})();var v=(z)=>/^['"]/.test(z)?z?.replace(/^(['"])(.*)(['"])$/,(K,W,Y,M)=>W===M?v(Y):K):z,m=(z)=>/^-+\w/.test(z??"")&&Number.isNaN(Number(z)),f=(z)=>z?.trim()==="--",O=(z,K=!1,W=Array.isArray(z)?z:[z])=>K?W:W.map((Y)=>[Y,Y.replaceAll(...Y.includes("_")?["_","-"]:["-","_"])]).flat(),u=(z=g,K=n,W=h,Y=!1)=>{let M=z[0]==="node"?2:z[1]==="run"?3:m(z[0])?0:1,Z=z.map(String).slice(M),D=z.map(String).slice(0,M),w=!!Z.find(f),P=(J,U=!1)=>{let F=O(J,Y);for(let V=0;V<Z.length;V++){let C=Z[V];if(f(C))break;if(!C||!m(C))continue;let I=/=/.test(C),b=F.map((B)=>{let[A,...L]=C.replace(m(B)?/(?!)/:/^\s*?-+/,"").split(I&&U?`${B}=`:new RegExp(`^${B}$`,Y?"":"i"));return!A?.length?L.join(B):A===B?B:null}).find((B)=>B!==null)??0;if(b===0)continue;if(!U)return Z.splice(V,1),!0;if(I)return Z.splice(V,1),v(b);let G=Z[V+1];if(G!==void 0&&!f(G)&&!m(G))return Z.splice(V,2),v(G)}return null},N=(J)=>O(J,Y).map((U)=>(U in K)?K[U]:(U in W)?W[U]:null).filter(Boolean)[0]??null,Q=(J)=>P(J,!1)!==null?!0:null,q=(J)=>P(J,!0);return{any:(J,U)=>q(J)??Q(J)??N(J)??(U!==void 0?U:null),cmd:()=>D,cur:()=>Z,end:()=>w,env:N,flag:Q,opt:q,pos:()=>{let J=[];for(let U=0;U<Z.length;U++){let F=Z[U];if(!F)continue;if(f(F))return[...J,...Z.slice(U+1)];if(m(F))continue;J.push(F)}return J}}};var S=u;var j=(()=>typeof globalThis==="object"?globalThis:(()=>{return function(z){function K(){let W=this||self;W.globalThis=W,delete z.prototype._T_}typeof globalThis!="object"&&(this?K():(z.defineProperty(z.prototype,"_T_",{configurable:!0,get:K}),_T_))}(Object),typeof globalThis==="object"?globalThis:{}})())();var E=(()=>{var z,K,W,Y;return typeof process==="undefined"?typeof((z=j==null?void 0:j.std)==null?void 0:z.getenviron)==="function"?(Y=(W=(K=j.std).getenviron)==null?void 0:W.call(K))!=null?Y:{}:{}:!(j==null?void 0:j.Deno)?process.env:(()=>{var M,Z,D,w,P,N;try{return(N=(D=(Z=(M=j==null?void 0:j.Deno)==null?void 0:M.env)==null?void 0:Z.toObject)==null?void 0:D.call(Z))!=null?N:((w=process.env)==null?void 0:w.toObject)?(P=process.env)==null?void 0:P.toObject():process.env}catch(Q){}return{}})()})();var H="\x1B",T="\x1B[0m",d={black:30,iblack:90,red:31,ired:91,green:32,igreen:92,yellow:33,iyellow:93,blue:34,iblue:94,purple:35,ipurple:95,cyan:36,icyan:96,white:37,iwhite:97},R=Object.fromEntries(Array(256).fill(0).map((z,K)=>[`x${K}`,K])),x={...d,...R},y=(()=>{try{let z=S(),K=z.any("FORCE_COLOR");if(K===""||K&&!isNaN(Number(K))&&Number(K)>0)return 1;if(typeof process==="undefined")return 0;if(z.any("NO_COLOR")!==null||z.any("NODE_DISABLE_COLORS")!==null||/-mono|dumb/i.test(E.TERM??""))return 0;if(!(!!process.stdout?.isTTY||!!E.PM2_HOME&&!!E.pm_id||(j?.Deno?j?.Deno?.isatty(1):!!process.stdout?.isTTY)))return 0;if(/^(false|never|no|0)$/i.test(`${z.opt("color")??""}`.trim()))return 0;return 1}catch(z){}return 0})();var i=(z,K,W,Y)=>{z=typeof z!=="string"?String(z):z;let M=H+`[${K}m`,Z=H+`[${W}m`,D=Z.length,w=[],P=0,N=0,Q=0;while(!0){let q=z.indexOf(Z,P),X=K===0?-1:z.indexOf(T,P),$=-1,J=!1;if(q>=0)if(X>=0&&X<q)$=X,J=!0;else $=q;else if(X>=0)$=X,J=!0;else break;if(w.push(z.substring(P,$)),J){if(w.push(T),Q++,Q%2===0)w.push(M);P=$+T.length;continue}let U=z.substring(P,$),F=U.split(M).length,V=U.split(Z).length,C=M;if(Y!==void 0&&F<=V){N++;let I=H+`[${Y}m`,b=H+`[${W}m`;C=N%2===1?I+b:b+I}w.push(C),P=$+D}return w.push(z.substring(P)),M+w.join("")+Z},l=(z,K,W,Y)=>`${H}[${K}m`+(typeof z!=="string"?String(z):z)+`${H}[${W}m`;function k(z={}){let{colors:K,xterm:W,format:Y=(...Q)=>Q.length>1?Q.join(" "):typeof Q[0]!=="string"?JSON.stringify(Q[0]):Q[0],noColor:M=y===0,simpleEscape:Z=!1}=z,D=K?{...W?x:d,...K}:W?x:d;if(M){let Q=z?.format?(...q)=>Y(...q):Y;for(let q of Object.keys(D).concat(["bg","bold","dim","normal","reset","underline"]))Q[q]=Q;return Q}let w=Z?l:i,P=K?W?{...R,...K}:K:W?R:{},N=(Q={})=>new Proxy((q)=>q,{get:(q,X)=>{let $={...Q},J=$.fg;if(D[X]!==void 0)$.pr=[J?.[0]??D[X],39,J?.[2]??(P[X]!==void 0?1:0)],$.fg=[D[X],39,P[X]!==void 0?1:0];else if(X==="bg"&&J){if($.bg=[J[0]+(J[2]||J[1]===49?0:10),49,J[2]],$.pr?.[1]===39)$.fg=J[0]===$.pr[0]?void 0:[...$.pr]}else{let U=X==="bold"?1:X==="dim"?2:X==="normal"?22:null;if(U)$.ft=[U,22,0];else if(X==="underline")$.ue=[4,24,0];else if(X==="inverse")$.ie=[7,27,0];else if(X==="reset")$.re=[0,0,0]}return N($)},apply:(q,X,$)=>{let J=Y(...$);if(Q.re)return w(J,0,0);if(Q.fg)J=w(J,(Q.fg[2]?"38;5;":"")+Q.fg[0],Q.fg[1]);if(Q.bg)J=w(J,(Q.bg[2]?"48;5;":"")+Q.bg[0],Q.bg[1]);if(Q.ft)J=w(J,Q.ft[0],Q.ft[1],Q.ft[0]);if(Q.ue)J=w(J,Q.ue[0],Q.ue[1]);if(Q.ie)J=w(J,Q.ie[0],Q.ie[1]);return J}});return N()}var t=(()=>k({xterm:!0}))(),r=k;export{t as stain,r as default,k as createStain};
@@ -1,13 +0,0 @@
1
- export type EmptyObject = Record<never, never>;
2
- /**
3
- * color support level with cache control (negative=disable caching)
4
- * @NOTE negatives == positive, but a neg disables caching to force a plugin to always re-run
5
- * @nsole param:5
6
- * @default 3
7
- * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}
8
- */
9
- export type ColorSpace = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3;
10
- type StainBaseColors = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';
11
- export type StainColors = StainBaseColors | `i${StainBaseColors}`;
12
- export {};
13
- //# sourceMappingURL=index.d.ts.map
@@ -1,13 +0,0 @@
1
- export type EmptyObject = Record<never, never>;
2
- /**
3
- * color support level with cache control (negative=disable caching)
4
- * @NOTE negatives == positive, but a neg disables caching to force a plugin to always re-run
5
- * @nsole param:5
6
- * @default 3
7
- * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}
8
- */
9
- export type ColorSpace = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3;
10
- type StainBaseColors = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';
11
- export type StainColors = StainBaseColors | `i${StainBaseColors}`;
12
- export {};
13
- //# sourceMappingURL=index.d.ts.map
@@ -1,13 +0,0 @@
1
- export type EmptyObject = Record<never, never>;
2
- /**
3
- * color support level with cache control (negative=disable caching)
4
- * @NOTE negatives == positive, but a neg disables caching to force a plugin to always re-run
5
- * @nsole param:5
6
- * @default 3
7
- * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}
8
- */
9
- export type ColorSpace = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3;
10
- type StainBaseColors = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';
11
- export type StainColors = StainBaseColors | `i${StainBaseColors}`;
12
- export {};
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testBin/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AA8L3D,KAAK,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AACnG,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
@@ -1,13 +0,0 @@
1
- export type EmptyObject = Record<never, never>;
2
- /**
3
- * color support level with cache control (negative=disable caching)
4
- * @NOTE negatives == positive, but a neg disables caching to force a plugin to always re-run
5
- * @nsole param:5
6
- * @default 3
7
- * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}
8
- */
9
- export type ColorSpace = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3;
10
- type StainBaseColors = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';
11
- export type StainColors = StainBaseColors | `i${StainBaseColors}`;
12
- export {};
13
- //# sourceMappingURL=tmp.d.ts.map
@@ -1,13 +0,0 @@
1
- export type EmptyObject = Record<never, never>;
2
- /**
3
- * color support level with cache control (negative=disable caching)
4
- * @NOTE negatives == positive, but a neg disables caching to force a plugin to always re-run
5
- * @nsole param:5
6
- * @default 3
7
- * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}
8
- */
9
- export type ColorSpace = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3;
10
- type StainBaseColors = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';
11
- export type StainColors = StainBaseColors | `i${StainBaseColors}`;
12
- export {};
13
- //# sourceMappingURL=tmp.d.ts.map
@@ -1,13 +0,0 @@
1
- export type EmptyObject = Record<never, never>;
2
- /**
3
- * color support level with cache control (negative=disable caching)
4
- * @NOTE negatives == positive, but a neg disables caching to force a plugin to always re-run
5
- * @nsole param:5
6
- * @default 3
7
- * @see {@link https://nodejs.org/api/cli.html#force_color1-2-3|Node.js FORCE_COLOR docs}
8
- */
9
- export type ColorSpace = -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3;
10
- type StainBaseColors = 'black' | 'blue' | 'cyan' | 'green' | 'purple' | 'red' | 'white' | 'yellow';
11
- export type StainColors = StainBaseColors | `i${StainBaseColors}`;
12
- export {};
13
- //# sourceMappingURL=tmp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tmp.d.ts","sourceRoot":"","sources":["../../src/testBin/tmp.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AA8L3D,KAAK,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AACnG,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}