ansimax 1.2.8 → 1.3.1

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/dist/index.mjs CHANGED
@@ -1162,13 +1162,13 @@ var animateGradient = (text, stops, opts = {}) => {
1162
1162
  const elapsed = Date.now() - startTime;
1163
1163
  let phase = elapsed / safeDuration2 % 1;
1164
1164
  if (direction === "reverse") phase = 1 - phase;
1165
- const frame = gradient(text, stops, { preserveAnsi, easing, phase });
1165
+ const frame2 = gradient(text, stops, { preserveAnsi, easing, phase });
1166
1166
  if (onFrame) {
1167
- onFrame(frame, phase);
1167
+ onFrame(frame2, phase);
1168
1168
  } else {
1169
1169
  try {
1170
1170
  if (process?.stdout?.write) {
1171
- process.stdout.write("\r" + frame);
1171
+ process.stdout.write("\r" + frame2);
1172
1172
  }
1173
1173
  } catch {
1174
1174
  }
@@ -1458,9 +1458,9 @@ var safeWrite = (data) => {
1458
1458
  } catch {
1459
1459
  }
1460
1460
  };
1461
- var fireFrame = (hooks, frame) => {
1461
+ var fireFrame = (hooks, frame2) => {
1462
1462
  try {
1463
- hooks?.onFrame?.(frame);
1463
+ hooks?.onFrame?.(frame2);
1464
1464
  } catch {
1465
1465
  }
1466
1466
  };
@@ -1492,7 +1492,7 @@ var typewriter = async (text, opts = {}) => {
1492
1492
  registerCrashHandlers();
1493
1493
  hideCursorSafe();
1494
1494
  let aborted = false;
1495
- let frame = 0;
1495
+ let frame2 = 0;
1496
1496
  try {
1497
1497
  for (const ch of text) {
1498
1498
  if (isAborted(signal)) {
@@ -1500,7 +1500,7 @@ var typewriter = async (text, opts = {}) => {
1500
1500
  break;
1501
1501
  }
1502
1502
  await safeWriteAsync(colorFn ? colorFn(ch) : ch);
1503
- fireFrame(hooks, frame++);
1503
+ fireFrame(hooks, frame2++);
1504
1504
  await sleep(ch === " " ? speed * 0.3 : speed, { signal });
1505
1505
  }
1506
1506
  } finally {
@@ -1671,7 +1671,7 @@ var pulse = async (text, opts = {}) => {
1671
1671
  registerCrashHandlers();
1672
1672
  hideCursorSafe();
1673
1673
  let aborted = false;
1674
- let frame = 0;
1674
+ let frame2 = 0;
1675
1675
  try {
1676
1676
  for (let t = 0; t < cycles; t++) {
1677
1677
  if (isAborted(signal)) {
@@ -1681,7 +1681,7 @@ var pulse = async (text, opts = {}) => {
1681
1681
  await safeWriteAsync(
1682
1682
  cursor.save() + fgRgb(c1.r, c1.g, c1.b) + text + reset() + cursor.restore()
1683
1683
  );
1684
- fireFrame(hooks, frame++);
1684
+ fireFrame(hooks, frame2++);
1685
1685
  await sleep(halfInterval, { signal });
1686
1686
  if (isAborted(signal)) {
1687
1687
  aborted = true;
@@ -1690,7 +1690,7 @@ var pulse = async (text, opts = {}) => {
1690
1690
  await safeWriteAsync(
1691
1691
  cursor.save() + fgRgb(c2.r, c2.g, c2.b) + text + reset() + cursor.restore()
1692
1692
  );
1693
- fireFrame(hooks, frame++);
1693
+ fireFrame(hooks, frame2++);
1694
1694
  await sleep(halfInterval, { signal });
1695
1695
  }
1696
1696
  if (!aborted) {
@@ -2835,7 +2835,7 @@ var spin = (text = "Loading", opts = {}) => {
2835
2835
  }
2836
2836
  };
2837
2837
  }
2838
- let frame = 0;
2838
+ let frame2 = 0;
2839
2839
  let stopped = false;
2840
2840
  let timer = null;
2841
2841
  const animInterval = Math.max(FRAME_MS, safeInterval);
@@ -2844,8 +2844,8 @@ var spin = (text = "Loading", opts = {}) => {
2844
2844
  const render = () => {
2845
2845
  if (stopped) return;
2846
2846
  const elapsed = Date.now() - startTime;
2847
- frame = Math.floor(elapsed / animInterval) % frames2.length;
2848
- const f = frames2[frame] ?? "";
2847
+ frame2 = Math.floor(elapsed / animInterval) % frames2.length;
2848
+ const f = frames2[frame2] ?? "";
2849
2849
  const colored = applyColor(f, hex);
2850
2850
  const line = padToTerminalWidth(`${safePrefix}${colored} ${safeText}${safeSuffix}`);
2851
2851
  const buf = createOutputBuffer().push("\r").push(screen.clearLine()).push(line).toString();
@@ -3058,7 +3058,7 @@ var custom = (frames2, text = "", opts = {}) => {
3058
3058
  }
3059
3059
  registerCrashHandlers2();
3060
3060
  acquireCursor();
3061
- let frame = 0;
3061
+ let frame2 = 0;
3062
3062
  let stopped = false;
3063
3063
  let timer = null;
3064
3064
  const safeInterval = Math.max(FRAME_MS, interval);
@@ -3066,8 +3066,8 @@ var custom = (frames2, text = "", opts = {}) => {
3066
3066
  const render = () => {
3067
3067
  if (stopped) return;
3068
3068
  const elapsed = Date.now() - startTime;
3069
- frame = Math.floor(elapsed / safeInterval) % frames2.length;
3070
- const f = frames2[frame] ?? "";
3069
+ frame2 = Math.floor(elapsed / safeInterval) % frames2.length;
3070
+ const f = frames2[frame2] ?? "";
3071
3071
  write("\r" + screen.clearLine() + applyColor(f, hex) + " " + text);
3072
3072
  };
3073
3073
  render();
@@ -3175,7 +3175,7 @@ var multi = (opts = {}) => {
3175
3175
  registerCrashHandlers2();
3176
3176
  let nextId = 0;
3177
3177
  const items = /* @__PURE__ */ new Map();
3178
- let frame = 0;
3178
+ let frame2 = 0;
3179
3179
  let timer = null;
3180
3180
  let lastLineCount = 0;
3181
3181
  const render = () => {
@@ -3189,13 +3189,13 @@ var multi = (opts = {}) => {
3189
3189
  let glyph;
3190
3190
  if (item.state === "success") glyph = applyColor("\u2713", "#00ff88");
3191
3191
  else if (item.state === "fail") glyph = applyColor("\u2717", "#ff6b6b");
3192
- else glyph = applyColor(frames2[frame % frames2.length] ?? "", item.color ?? null);
3192
+ else glyph = applyColor(frames2[frame2 % frames2.length] ?? "", item.color ?? null);
3193
3193
  const text = item.finalText ?? item.text;
3194
3194
  buf.pushln(padToTerminalWidth(`${glyph} ${text}`));
3195
3195
  }
3196
3196
  write(buf.toString());
3197
3197
  lastLineCount = itemsArr.length;
3198
- frame++;
3198
+ frame2++;
3199
3199
  };
3200
3200
  const start = () => {
3201
3201
  if (timer) return;
@@ -3356,9 +3356,9 @@ var registerCrashHandlers3 = () => {
3356
3356
  if (isTestEnv3()) return;
3357
3357
  installCrashHandlersImpl3();
3358
3358
  };
3359
- var lineCount = (frame) => {
3360
- if (typeof frame !== "string" || frame.length === 0) return 0;
3361
- const normalized = frame.replace(/\r\n/g, "\n").replace(/\r/g, "");
3359
+ var lineCount = (frame2) => {
3360
+ if (typeof frame2 !== "string" || frame2.length === 0) return 0;
3361
+ const normalized = frame2.replace(/\r\n/g, "\n").replace(/\r/g, "");
3362
3362
  return normalized.split("\n").length;
3363
3363
  };
3364
3364
  var clearLines = (n) => {
@@ -3369,7 +3369,7 @@ var clearLines = (n) => {
3369
3369
  }
3370
3370
  };
3371
3371
  var isColorless2 = () => supportsColor() === "none";
3372
- var defaultOnFrame = (frame) => isColorless2() ? stripAnsi(frame) : frame;
3372
+ var defaultOnFrame = (frame2) => isColorless2() ? stripAnsi(frame2) : frame2;
3373
3373
  var play = (frames2, opts = {}) => {
3374
3374
  if (!Array.isArray(frames2)) {
3375
3375
  const resolved = Promise.resolve();
@@ -3430,13 +3430,13 @@ var play = (frames2, opts = {}) => {
3430
3430
  const done = new Promise((r) => {
3431
3431
  resolveDone = r;
3432
3432
  });
3433
- const renderFrame = (frame, idx) => {
3433
+ const renderFrame = (frame2, idx) => {
3434
3434
  if (lastLines > 0) clearLines(lastLines);
3435
3435
  let rendered;
3436
3436
  try {
3437
- rendered = userOnFrame(frame, idx);
3437
+ rendered = userOnFrame(frame2, idx);
3438
3438
  } catch {
3439
- rendered = frame;
3439
+ rendered = frame2;
3440
3440
  }
3441
3441
  const safe = ensureString4(rendered);
3442
3442
  try {
@@ -3565,13 +3565,13 @@ var live = (opts = {}) => {
3565
3565
  let abortHandler = null;
3566
3566
  const render = () => {
3567
3567
  if (lastLines > 0) clearLines(lastLines);
3568
- const frame = isColorless2() ? stripAnsi(currentFrame) : currentFrame;
3568
+ const frame2 = isColorless2() ? stripAnsi(currentFrame) : currentFrame;
3569
3569
  try {
3570
- write(frame);
3570
+ write(frame2);
3571
3571
  } catch {
3572
3572
  }
3573
- lastLines = lineCount(frame);
3574
- if (!frame.endsWith("\n")) writeln();
3573
+ lastLines = lineCount(frame2);
3574
+ if (!frame2.endsWith("\n")) writeln();
3575
3575
  };
3576
3576
  const start = () => {
3577
3577
  if (running) return;
@@ -5428,6 +5428,335 @@ var images = {
5428
5428
  clearAnsiCache
5429
5429
  };
5430
5430
 
5431
+ // src/panels/index.ts
5432
+ var _splitBlock = (block) => {
5433
+ if (typeof block !== "string" || block.length === 0) {
5434
+ return { lines: [""], maxWidth: 0 };
5435
+ }
5436
+ const lines = block.split("\n");
5437
+ let maxWidth = 0;
5438
+ for (const line of lines) {
5439
+ const w = visibleLen(line);
5440
+ if (w > maxWidth) maxWidth = w;
5441
+ }
5442
+ return { lines, maxWidth };
5443
+ };
5444
+ var _padLinesRight = (lines, targetWidth) => {
5445
+ return lines.map((line) => padEnd(line, targetWidth, " "));
5446
+ };
5447
+ var _padLinesAligned = (lines, targetWidth, align) => {
5448
+ return lines.map((line) => {
5449
+ const w = visibleLen(line);
5450
+ const space = Math.max(0, targetWidth - w);
5451
+ if (space === 0) return line;
5452
+ if (align === "end") return " ".repeat(space) + line;
5453
+ if (align === "center") {
5454
+ const left = Math.floor(space / 2);
5455
+ const right = space - left;
5456
+ return " ".repeat(left) + line + " ".repeat(right);
5457
+ }
5458
+ return line + " ".repeat(space);
5459
+ });
5460
+ };
5461
+ var _alignVertical = (lines, targetLines, width, align) => {
5462
+ const current = lines.length;
5463
+ if (current >= targetLines) return lines.slice(0, targetLines);
5464
+ const diff = targetLines - current;
5465
+ const empty = " ".repeat(width);
5466
+ if (align === "end") {
5467
+ return [...Array(diff).fill(empty), ...lines];
5468
+ }
5469
+ if (align === "center") {
5470
+ const above = Math.floor(diff / 2);
5471
+ const below = diff - above;
5472
+ return [...Array(above).fill(empty), ...lines, ...Array(below).fill(empty)];
5473
+ }
5474
+ return [...lines, ...Array(diff).fill(empty)];
5475
+ };
5476
+ var vsplit = (blocks, opts = {}) => {
5477
+ if (!Array.isArray(blocks) || blocks.length === 0) return "";
5478
+ const { gap = 1, align = "start", widths = null } = opts;
5479
+ const safeGap = Math.max(0, Math.floor(gap));
5480
+ const splits = blocks.map((b) => _splitBlock(b));
5481
+ const colWidths = splits.map((s, i) => {
5482
+ if (widths && Array.isArray(widths) && widths[i] != null) {
5483
+ return Math.max(0, Math.floor(widths[i]));
5484
+ }
5485
+ return s.maxWidth;
5486
+ });
5487
+ const targetLines = splits.reduce((m, s) => Math.max(m, s.lines.length), 0);
5488
+ const normalized = splits.map((s, i) => {
5489
+ const w = colWidths[i];
5490
+ const padded = _padLinesRight(s.lines, w);
5491
+ return _alignVertical(padded, targetLines, w, align);
5492
+ });
5493
+ const gapStr = " ".repeat(safeGap);
5494
+ const result = [];
5495
+ for (let r = 0; r < targetLines; r++) {
5496
+ const row = normalized.map((block) => block[r] ?? "").join(gapStr);
5497
+ result.push(row);
5498
+ }
5499
+ return result.join("\n");
5500
+ };
5501
+ var hsplit = (blocks, opts = {}) => {
5502
+ if (!Array.isArray(blocks) || blocks.length === 0) return "";
5503
+ const { gap = 0, align = "start" } = opts;
5504
+ const safeGap = Math.max(0, Math.floor(gap));
5505
+ const splits = blocks.map((b) => _splitBlock(b));
5506
+ const maxWidth = splits.reduce((m, s) => Math.max(m, s.maxWidth), 0);
5507
+ const aligned = splits.map((s) => _padLinesAligned(s.lines, maxWidth, align));
5508
+ const gapLines = safeGap > 0 ? Array(safeGap).fill(" ".repeat(maxWidth)) : [];
5509
+ const parts = [];
5510
+ for (let i = 0; i < aligned.length; i++) {
5511
+ parts.push(...aligned[i]);
5512
+ if (i < aligned.length - 1 && gapLines.length > 0) {
5513
+ parts.push(...gapLines);
5514
+ }
5515
+ }
5516
+ return parts.join("\n");
5517
+ };
5518
+ var center2 = (block, opts) => {
5519
+ if (!opts || typeof opts !== "object") return block;
5520
+ const width = Math.max(0, Math.floor(opts.width ?? 0));
5521
+ if (width === 0) return block;
5522
+ const { lines, maxWidth } = _splitBlock(block);
5523
+ const hCentered = lines.map((line) => {
5524
+ const w = visibleLen(line);
5525
+ const space = Math.max(0, width - w);
5526
+ if (space === 0) return line.slice(0, width);
5527
+ const left = Math.floor(space / 2);
5528
+ const right = space - left;
5529
+ return " ".repeat(left) + line + " ".repeat(right);
5530
+ });
5531
+ if (opts.height != null) {
5532
+ const targetH = Math.max(1, Math.floor(opts.height));
5533
+ return _alignVertical(hCentered, targetH, width, opts.align ?? "center").join("\n");
5534
+ }
5535
+ void maxWidth;
5536
+ return hCentered.join("\n");
5537
+ };
5538
+ var frame = (block, opts = {}) => {
5539
+ const {
5540
+ padding = 0,
5541
+ paddingY,
5542
+ paddingX,
5543
+ topChar = "\u2500",
5544
+ bottomChar,
5545
+ title
5546
+ } = opts;
5547
+ const safePadY = Math.max(0, Math.floor(paddingY ?? padding));
5548
+ const safePadX = Math.max(0, Math.floor(paddingX ?? padding));
5549
+ const safeTop = typeof topChar === "string" && topChar.length > 0 ? topChar.charAt(0) : "\u2500";
5550
+ const safeBot = typeof bottomChar === "string" && bottomChar.length > 0 ? bottomChar.charAt(0) : safeTop;
5551
+ const { lines, maxWidth } = _splitBlock(block);
5552
+ const contentInnerW = maxWidth + 2 * safePadX;
5553
+ let innerW = contentInnerW;
5554
+ let titleStr = "";
5555
+ let titleW = 0;
5556
+ if (typeof title === "string" && title.length > 0) {
5557
+ titleStr = ` ${title} `;
5558
+ titleW = visibleLen(titleStr);
5559
+ const titleNeededW = titleW + 2;
5560
+ if (titleNeededW > innerW) {
5561
+ innerW = titleNeededW;
5562
+ }
5563
+ }
5564
+ let topLine;
5565
+ if (titleStr.length > 0 && titleW < innerW) {
5566
+ const before = Math.floor((innerW - titleW) / 2);
5567
+ const after = innerW - titleW - before;
5568
+ topLine = safeTop.repeat(before) + titleStr + safeTop.repeat(after);
5569
+ } else {
5570
+ topLine = safeTop.repeat(innerW);
5571
+ }
5572
+ const bottomLine = safeBot.repeat(innerW);
5573
+ const padX = " ".repeat(safePadX);
5574
+ const padded = lines.map((line) => {
5575
+ const w = visibleLen(line);
5576
+ const tail = " ".repeat(Math.max(0, innerW - safePadX - w - safePadX));
5577
+ return padX + line + tail + padX;
5578
+ });
5579
+ const blank = " ".repeat(innerW);
5580
+ const out = [];
5581
+ out.push(topLine);
5582
+ for (let i = 0; i < safePadY; i++) out.push(blank);
5583
+ out.push(...padded);
5584
+ for (let i = 0; i < safePadY; i++) out.push(blank);
5585
+ out.push(bottomLine);
5586
+ return out.join("\n");
5587
+ };
5588
+ var panels = {
5589
+ vsplit,
5590
+ hsplit,
5591
+ // v1.3.1
5592
+ center: center2,
5593
+ frame
5594
+ };
5595
+
5596
+ // src/json/index.ts
5597
+ var COLORS = {
5598
+ key: FG.cyan,
5599
+ string: FG.green,
5600
+ number: FG.yellow,
5601
+ boolean: FG.magenta,
5602
+ null: FG.brightBlack,
5603
+ bracket: FG.white,
5604
+ comment: FG.brightBlack
5605
+ };
5606
+ var _c = (text, code, useColor) => useColor ? sgr(code) + text + reset() : text;
5607
+ var _truncString = (s, maxLength) => {
5608
+ if (!Number.isFinite(maxLength) || s.length <= maxLength) return s;
5609
+ if (maxLength <= 3) return s.slice(0, maxLength);
5610
+ return s.slice(0, maxLength - 3) + "...";
5611
+ };
5612
+ var _formatPrimitive = (value, opts) => {
5613
+ const { useColor, maxStringLength } = opts;
5614
+ if (value === null) {
5615
+ return _c("null", COLORS.null, useColor);
5616
+ }
5617
+ if (value === void 0) {
5618
+ return _c("undefined", COLORS.null, useColor);
5619
+ }
5620
+ if (typeof value === "string") {
5621
+ const truncated = _truncString(value, maxStringLength);
5622
+ const quoted = JSON.stringify(truncated);
5623
+ return _c(quoted, COLORS.string, useColor);
5624
+ }
5625
+ if (typeof value === "number") {
5626
+ if (Number.isNaN(value)) return _c("NaN", COLORS.number, useColor);
5627
+ if (!Number.isFinite(value)) {
5628
+ return _c(value > 0 ? "Infinity" : "-Infinity", COLORS.number, useColor);
5629
+ }
5630
+ return _c(String(value), COLORS.number, useColor);
5631
+ }
5632
+ if (typeof value === "boolean") {
5633
+ return _c(String(value), COLORS.boolean, useColor);
5634
+ }
5635
+ if (typeof value === "bigint") {
5636
+ return _c(`${value}n`, COLORS.number, useColor);
5637
+ }
5638
+ if (typeof value === "function") {
5639
+ const name = value.name || "anonymous";
5640
+ return _c(`[Function: ${name}]`, COLORS.comment, useColor);
5641
+ }
5642
+ if (typeof value === "symbol") {
5643
+ return _c(value.toString(), COLORS.comment, useColor);
5644
+ }
5645
+ return _c(String(value), COLORS.comment, useColor);
5646
+ };
5647
+ var _renderValue = (value, depth, config) => {
5648
+ const {
5649
+ indent,
5650
+ maxDepth,
5651
+ maxItems,
5652
+ maxStringLength,
5653
+ useColor,
5654
+ seen,
5655
+ sortKeys,
5656
+ inlineArrayMaxLength
5657
+ } = config;
5658
+ if (value === null || typeof value !== "object") {
5659
+ return _formatPrimitive(value, { useColor, maxStringLength });
5660
+ }
5661
+ if (seen.has(value)) {
5662
+ return _c("[Circular]", COLORS.comment, useColor);
5663
+ }
5664
+ seen.add(value);
5665
+ if (depth >= maxDepth) {
5666
+ if (Array.isArray(value)) {
5667
+ return _c("[", COLORS.bracket, useColor) + _c("...", COLORS.comment, useColor) + _c("]", COLORS.bracket, useColor);
5668
+ }
5669
+ return _c("{", COLORS.bracket, useColor) + _c("...", COLORS.comment, useColor) + _c("}", COLORS.bracket, useColor);
5670
+ }
5671
+ const pad = " ".repeat(indent * (depth + 1));
5672
+ const closePad = " ".repeat(indent * depth);
5673
+ if (Array.isArray(value)) {
5674
+ if (value.length === 0) {
5675
+ return _c("[]", COLORS.bracket, useColor);
5676
+ }
5677
+ if (inlineArrayMaxLength > 0) {
5678
+ const allPrimitive = value.every((v) => v === null || typeof v !== "object");
5679
+ if (allPrimitive) {
5680
+ const displayCount2 = Math.min(value.length, maxItems);
5681
+ const inlineItems = [];
5682
+ for (let i = 0; i < displayCount2; i++) {
5683
+ inlineItems.push(_formatPrimitive(value[i], { useColor, maxStringLength }));
5684
+ }
5685
+ if (value.length > maxItems) {
5686
+ const remaining = value.length - maxItems;
5687
+ inlineItems.push(_c(`... (${remaining} more)`, COLORS.comment, useColor));
5688
+ }
5689
+ const candidate = _c("[", COLORS.bracket, useColor) + inlineItems.join(", ") + _c("]", COLORS.bracket, useColor);
5690
+ const visibleLen2 = candidate.replace(/\x1b\[[0-9;]*m/g, "").length;
5691
+ if (visibleLen2 <= inlineArrayMaxLength) {
5692
+ return candidate;
5693
+ }
5694
+ }
5695
+ }
5696
+ const items = [];
5697
+ const displayCount = Math.min(value.length, maxItems);
5698
+ for (let i = 0; i < displayCount; i++) {
5699
+ const rendered = _renderValue(value[i], depth + 1, config);
5700
+ items.push(pad + rendered);
5701
+ }
5702
+ if (value.length > maxItems) {
5703
+ const remaining = value.length - maxItems;
5704
+ items.push(pad + _c(`... (${remaining} more)`, COLORS.comment, useColor));
5705
+ }
5706
+ return _c("[", COLORS.bracket, useColor) + "\n" + items.join(",\n") + "\n" + closePad + _c("]", COLORS.bracket, useColor);
5707
+ }
5708
+ let keys = Object.keys(value);
5709
+ if (keys.length === 0) {
5710
+ return _c("{}", COLORS.bracket, useColor);
5711
+ }
5712
+ if (sortKeys) {
5713
+ keys = [...keys].sort((a, b) => a.localeCompare(b));
5714
+ }
5715
+ const entries = [];
5716
+ for (const key of keys) {
5717
+ const keyStr = JSON.stringify(key);
5718
+ const renderedKey = _c(keyStr, COLORS.key, useColor);
5719
+ const renderedVal = _renderValue(
5720
+ value[key],
5721
+ depth + 1,
5722
+ config
5723
+ );
5724
+ entries.push(`${pad}${renderedKey}: ${renderedVal}`);
5725
+ }
5726
+ return _c("{", COLORS.bracket, useColor) + "\n" + entries.join(",\n") + "\n" + closePad + _c("}", COLORS.bracket, useColor);
5727
+ };
5728
+ var pretty = (value, opts = {}) => {
5729
+ const {
5730
+ indent = 2,
5731
+ colors = true,
5732
+ maxDepth = Infinity,
5733
+ maxItems = Infinity,
5734
+ maxStringLength = Infinity,
5735
+ // v1.3.1
5736
+ sortKeys = false,
5737
+ inlineArrayMaxLength = 60
5738
+ } = opts;
5739
+ const safeIndent = Math.max(0, Math.floor(Number(indent) || 0));
5740
+ const safeMaxDepth = Number.isFinite(maxDepth) ? Math.max(0, Math.floor(maxDepth)) : Infinity;
5741
+ const safeMaxItems = Number.isFinite(maxItems) ? Math.max(0, Math.floor(maxItems)) : Infinity;
5742
+ const safeMaxStrLen = Number.isFinite(maxStringLength) ? Math.max(0, Math.floor(maxStringLength)) : Infinity;
5743
+ const safeInlineMax = Number.isFinite(inlineArrayMaxLength) ? Math.max(0, Math.floor(inlineArrayMaxLength)) : 60;
5744
+ const useColor = colors && !isNoColor();
5745
+ return _renderValue(value, 0, {
5746
+ indent: safeIndent,
5747
+ maxDepth: safeMaxDepth,
5748
+ maxItems: safeMaxItems,
5749
+ maxStringLength: safeMaxStrLen,
5750
+ useColor,
5751
+ seen: /* @__PURE__ */ new WeakSet(),
5752
+ sortKeys: Boolean(sortKeys),
5753
+ inlineArrayMaxLength: safeInlineMax
5754
+ });
5755
+ };
5756
+ var json = {
5757
+ pretty
5758
+ };
5759
+
5431
5760
  // src/configure.ts
5432
5761
  var DEFAULTS = Object.freeze({
5433
5762
  colorMode: "auto",
@@ -5671,6 +6000,7 @@ export {
5671
6000
  canAnimate,
5672
6001
  cancelTerminalFrame,
5673
6002
  center,
6003
+ center2 as centerBlock,
5674
6004
  chain,
5675
6005
  charWidth,
5676
6006
  clamp,
@@ -5701,6 +6031,7 @@ export {
5701
6031
  findInTree,
5702
6032
  flipHorizontal,
5703
6033
  flipVertical,
6034
+ frame,
5704
6035
  frames,
5705
6036
  fromImage,
5706
6037
  getConfig,
@@ -5716,9 +6047,12 @@ export {
5716
6047
  hasFont,
5717
6048
  hexToRgb,
5718
6049
  hideCursor,
6050
+ hsplit,
5719
6051
  images,
5720
6052
  isHexColor,
5721
6053
  isNoColor,
6054
+ json,
6055
+ pretty as jsonPretty,
5722
6056
  lerp,
5723
6057
  lerpColor,
5724
6058
  link,
@@ -5736,6 +6070,7 @@ export {
5736
6070
  padBoth,
5737
6071
  padEnd,
5738
6072
  padStart,
6073
+ panels,
5739
6074
  parseFiglet,
5740
6075
  pauseListeners,
5741
6076
  presetNames,
@@ -5781,6 +6116,7 @@ export {
5781
6116
  trees,
5782
6117
  truncateAnsi,
5783
6118
  visibleLen,
6119
+ vsplit,
5784
6120
  walkTree,
5785
6121
  withConfig,
5786
6122
  wordWrap,
@@ -118,7 +118,7 @@ async function main() {
118
118
  console.log(components.section('🏷️ Badges & Status', { width: 60 }));
119
119
  console.log();
120
120
  console.log(' ',
121
- components.badge('VERSION', 'v1.2.8'),
121
+ components.badge('VERSION', 'v1.3.1'),
122
122
  components.badge('BUILD', 'passing'),
123
123
  components.badge('LICENSE', 'Apache 2.0'));
124
124
  console.log();
@@ -117,7 +117,7 @@ console.log();
117
117
  console.log(components.section('🏷️ Badges & Status', { width: 60 }));
118
118
  console.log();
119
119
  console.log(' ',
120
- components.badge('VERSION', 'v1.2.8'),
120
+ components.badge('VERSION', 'v1.3.1'),
121
121
  components.badge('BUILD', 'passing'),
122
122
  components.badge('LICENSE', 'Apache 2.0'));
123
123
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ansimax",
3
- "version": "1.2.8",
3
+ "version": "1.3.1",
4
4
  "description": "Zero-dependency CLI rendering library: colors, gradients, animations, ASCII art, pixel art, components, and themes \u2014 all in TypeScript.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",