@gridland/core 0.2.31 → 0.2.32

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/browser.js CHANGED
@@ -27472,16 +27472,6 @@ function singleton(key, factory) {
27472
27472
  }
27473
27473
  return bag[key];
27474
27474
  }
27475
- function destroySingleton(key) {
27476
- const bag = globalThis[singletonCacheSymbol];
27477
- if (bag && key in bag) {
27478
- delete bag[key];
27479
- }
27480
- }
27481
- function hasSingleton(key) {
27482
- const bag = globalThis[singletonCacheSymbol];
27483
- return bag && key in bag;
27484
- }
27485
27475
 
27486
27476
  // ../../opentui/packages/core/src/lib/env.ts
27487
27477
  var envRegistry = singleton("env-registry", () => ({}));
@@ -40522,302 +40512,6 @@ var MarkdownRenderable = class extends Renderable3 {
40522
40512
  }
40523
40513
  };
40524
40514
 
40525
- // ../../opentui/packages/core/src/zig-registry.ts
40526
- var LogLevel2 = /* @__PURE__ */ ((LogLevel4) => {
40527
- LogLevel4[LogLevel4["Error"] = 0] = "Error";
40528
- LogLevel4[LogLevel4["Warn"] = 1] = "Warn";
40529
- LogLevel4[LogLevel4["Info"] = 2] = "Info";
40530
- LogLevel4[LogLevel4["Debug"] = 3] = "Debug";
40531
- return LogLevel4;
40532
- })(LogLevel2 || {});
40533
- var _renderLib;
40534
- function registerRenderLib(lib) {
40535
- _renderLib = lib;
40536
- }
40537
- function resolveRenderLib() {
40538
- if (!_renderLib) {
40539
- throw new Error("No RenderLib registered. In Bun, import '@opentui/core' or '@opentui/core/native' (which loads zig.ts). In browsers, call registerRenderLib() with a browser implementation.");
40540
- }
40541
- return _renderLib;
40542
- }
40543
- function hasRenderLib() {
40544
- return _renderLib !== void 0;
40545
- }
40546
- if (typeof globalThis.Bun !== "undefined") {
40547
- const zigPath = "./zig";
40548
- try {
40549
- await import(zigPath);
40550
- } catch {
40551
- }
40552
- }
40553
-
40554
- // ../web/src/shims/console.ts
40555
- var Console = globalThis.console.constructor;
40556
- var console_default = globalThis.console;
40557
-
40558
- // ../web/src/shims/node-stream.ts
40559
- var Writable = class {
40560
- write(_chunk) {
40561
- return true;
40562
- }
40563
- end() {
40564
- }
40565
- };
40566
-
40567
- // ../../opentui/packages/core/src/lib/output.capture.ts
40568
- var Capture = class extends EventEmitter {
40569
- // TODO: Cache could rather be a buffer to avoid join()?
40570
- output = [];
40571
- constructor() {
40572
- super();
40573
- }
40574
- get size() {
40575
- return this.output.length;
40576
- }
40577
- write(stream, data) {
40578
- this.output.push({ stream, output: data });
40579
- this.emit("write", stream, data);
40580
- }
40581
- claimOutput() {
40582
- const output = this.output.map((o) => o.output).join("");
40583
- this.clear();
40584
- return output;
40585
- }
40586
- clear() {
40587
- this.output = [];
40588
- }
40589
- };
40590
- var CapturedWritableStream = class extends Writable {
40591
- constructor(stream, capture2) {
40592
- super();
40593
- this.stream = stream;
40594
- this.capture = capture2;
40595
- }
40596
- isTTY = true;
40597
- columns = process.stdout.columns || 80;
40598
- rows = process.stdout.rows || 24;
40599
- _write(chunk, encoding, callback) {
40600
- const data = chunk.toString();
40601
- this.capture.write(this.stream, data);
40602
- callback();
40603
- }
40604
- getColorDepth() {
40605
- return process.stdout.getColorDepth?.() || 8;
40606
- }
40607
- };
40608
-
40609
- // ../../opentui/packages/core/src/console.ts
40610
- function getCallerInfo() {
40611
- const err = new Error();
40612
- const stackLines = err.stack?.split("\n").slice(5) || [];
40613
- if (!stackLines.length) return null;
40614
- const callerLine = stackLines[0].trim();
40615
- const regex = /at\s+(?:([\w$.<>]+)\s+\()?((?:\/|[A-Za-z]:\\)[^:]+):(\d+):(\d+)\)?/;
40616
- const match = callerLine.match(regex);
40617
- if (!match) return null;
40618
- const functionName = match[1] || "<anonymous>";
40619
- const fullPath = match[2];
40620
- const fileName = fullPath.split(/[\\/]/).pop() || "<unknown>";
40621
- const lineNumber = parseInt(match[3], 10) || 0;
40622
- const columnNumber = parseInt(match[4], 10) || 0;
40623
- return { functionName, fullPath, fileName, lineNumber, columnNumber };
40624
- }
40625
- var capture = singleton("ConsoleCapture", () => new Capture());
40626
- registerEnvVar({
40627
- name: "OTUI_USE_CONSOLE",
40628
- description: "Whether to use the console. Will not capture console output if set to false.",
40629
- type: "boolean",
40630
- default: true
40631
- });
40632
- registerEnvVar({
40633
- name: "SHOW_CONSOLE",
40634
- description: "Show the console at startup if set to true.",
40635
- type: "boolean",
40636
- default: false
40637
- });
40638
- var TerminalConsoleCache = class extends EventEmitter {
40639
- _cachedLogs = [];
40640
- MAX_CACHE_SIZE = 1e3;
40641
- _collectCallerInfo = false;
40642
- _cachingEnabled = true;
40643
- _originalConsole = null;
40644
- get cachedLogs() {
40645
- return this._cachedLogs;
40646
- }
40647
- constructor() {
40648
- super();
40649
- }
40650
- activate() {
40651
- if (!this._originalConsole) {
40652
- this._originalConsole = global.console;
40653
- }
40654
- this.setupConsoleCapture();
40655
- this.overrideConsoleMethods();
40656
- }
40657
- setupConsoleCapture() {
40658
- if (!env.OTUI_USE_CONSOLE) return;
40659
- const mockStdout = new CapturedWritableStream("stdout", capture);
40660
- const mockStderr = new CapturedWritableStream("stderr", capture);
40661
- global.console = new Console({
40662
- stdout: mockStdout,
40663
- stderr: mockStderr,
40664
- colorMode: true,
40665
- inspectOptions: {
40666
- compact: false,
40667
- breakLength: 80,
40668
- depth: 2
40669
- }
40670
- });
40671
- }
40672
- overrideConsoleMethods() {
40673
- console.log = (...args) => {
40674
- this.appendToConsole("LOG" /* LOG */, ...args);
40675
- };
40676
- console.info = (...args) => {
40677
- this.appendToConsole("INFO" /* INFO */, ...args);
40678
- };
40679
- console.warn = (...args) => {
40680
- this.appendToConsole("WARN" /* WARN */, ...args);
40681
- };
40682
- console.error = (...args) => {
40683
- this.appendToConsole("ERROR" /* ERROR */, ...args);
40684
- };
40685
- console.debug = (...args) => {
40686
- this.appendToConsole("DEBUG" /* DEBUG */, ...args);
40687
- };
40688
- }
40689
- setCollectCallerInfo(enabled) {
40690
- this._collectCallerInfo = enabled;
40691
- }
40692
- clearConsole() {
40693
- this._cachedLogs = [];
40694
- }
40695
- setCachingEnabled(enabled) {
40696
- this._cachingEnabled = enabled;
40697
- }
40698
- deactivate() {
40699
- this.restoreOriginalConsole();
40700
- }
40701
- restoreOriginalConsole() {
40702
- if (this._originalConsole) {
40703
- global.console = this._originalConsole;
40704
- }
40705
- this.setupConsoleCapture();
40706
- }
40707
- addLogEntry(level, ...args) {
40708
- const callerInfo = this._collectCallerInfo ? getCallerInfo() : null;
40709
- const logEntry = [/* @__PURE__ */ new Date(), level, args, callerInfo];
40710
- if (this._cachingEnabled) {
40711
- if (this._cachedLogs.length >= this.MAX_CACHE_SIZE) {
40712
- this._cachedLogs.shift();
40713
- }
40714
- this._cachedLogs.push(logEntry);
40715
- }
40716
- return logEntry;
40717
- }
40718
- appendToConsole(level, ...args) {
40719
- if (this._cachedLogs.length >= this.MAX_CACHE_SIZE) {
40720
- this._cachedLogs.shift();
40721
- }
40722
- const entry = this.addLogEntry(level, ...args);
40723
- this.emit("entry", entry);
40724
- }
40725
- destroy() {
40726
- this.deactivate();
40727
- }
40728
- };
40729
- var terminalConsoleCache = singleton("TerminalConsoleCache", () => {
40730
- const terminalConsoleCache2 = new TerminalConsoleCache();
40731
- process.on("exit", () => {
40732
- terminalConsoleCache2.destroy();
40733
- });
40734
- return terminalConsoleCache2;
40735
- });
40736
- var DEFAULT_CONSOLE_OPTIONS = {
40737
- position: "bottom" /* BOTTOM */,
40738
- sizePercent: 30,
40739
- zIndex: Infinity,
40740
- colorInfo: "#00FFFF",
40741
- // Cyan
40742
- colorWarn: "#FFFF00",
40743
- // Yellow
40744
- colorError: "#FF0000",
40745
- // Red
40746
- colorDebug: "#808080",
40747
- // Gray
40748
- colorDefault: "#FFFFFF",
40749
- // White
40750
- backgroundColor: RGBA.fromValues(0.1, 0.1, 0.1, 0.7),
40751
- startInDebugMode: false,
40752
- title: "Console",
40753
- titleBarColor: RGBA.fromValues(0.05, 0.05, 0.05, 0.7),
40754
- titleBarTextColor: "#FFFFFF",
40755
- cursorColor: "#00A0FF",
40756
- maxStoredLogs: 2e3,
40757
- maxDisplayLines: 3e3,
40758
- onCopySelection: void 0,
40759
- keyBindings: void 0,
40760
- keyAliasMap: void 0,
40761
- selectionColor: RGBA.fromValues(0.3, 0.5, 0.8, 0.5),
40762
- copyButtonColor: "#00A0FF"
40763
- };
40764
-
40765
- // ../../opentui/packages/core/src/renderer.ts
40766
- registerEnvVar({
40767
- name: "OTUI_DUMP_CAPTURES",
40768
- description: "Dump captured output when the renderer exits.",
40769
- type: "boolean",
40770
- default: false
40771
- });
40772
- registerEnvVar({
40773
- name: "OTUI_NO_NATIVE_RENDER",
40774
- description: "Disable native rendering. This will not actually output ansi and is useful for debugging.",
40775
- type: "boolean",
40776
- default: false
40777
- });
40778
- registerEnvVar({
40779
- name: "OTUI_USE_ALTERNATE_SCREEN",
40780
- description: "Whether to use the console. Will not capture console output if set to false.",
40781
- type: "boolean",
40782
- default: true
40783
- });
40784
- registerEnvVar({
40785
- name: "OTUI_OVERRIDE_STDOUT",
40786
- description: "Override the stdout stream. This is useful for debugging.",
40787
- type: "boolean",
40788
- default: true
40789
- });
40790
- registerEnvVar({
40791
- name: "OTUI_DEBUG",
40792
- description: "Enable debug mode to capture all raw input for debugging purposes.",
40793
- type: "boolean",
40794
- default: false
40795
- });
40796
- registerEnvVar({
40797
- name: "OTUI_SHOW_STATS",
40798
- description: "Show the debug overlay at startup.",
40799
- type: "boolean",
40800
- default: false
40801
- });
40802
- var rendererTracker = singleton("RendererTracker", () => {
40803
- const renderers = /* @__PURE__ */ new Set();
40804
- return {
40805
- addRenderer: (renderer) => {
40806
- renderers.add(renderer);
40807
- },
40808
- removeRenderer: (renderer) => {
40809
- renderers.delete(renderer);
40810
- if (renderers.size === 0) {
40811
- process.stdin.pause();
40812
- if (hasSingleton("tree-sitter-client")) {
40813
- getTreeSitterClient().destroy();
40814
- destroySingleton("tree-sitter-client");
40815
- }
40816
- }
40817
- }
40818
- };
40819
- });
40820
-
40821
40515
  // ../web/src/shims/timeline-stub.ts
40822
40516
  var Timeline = class {
40823
40517
  isPlaying = false;
@@ -42186,7 +41880,7 @@ var Justify2 = /* @__PURE__ */ (function(Justify3) {
42186
41880
  Justify3[Justify3["SpaceEvenly"] = 5] = "SpaceEvenly";
42187
41881
  return Justify3;
42188
41882
  })({});
42189
- var LogLevel3 = /* @__PURE__ */ (function(LogLevel4) {
41883
+ var LogLevel2 = /* @__PURE__ */ (function(LogLevel4) {
42190
41884
  LogLevel4[LogLevel4["Error"] = 0] = "Error";
42191
41885
  LogLevel4[LogLevel4["Warn"] = 1] = "Warn";
42192
41886
  LogLevel4[LogLevel4["Info"] = 2] = "Info";
@@ -42280,12 +41974,12 @@ var constants2 = {
42280
41974
  JUSTIFY_SPACE_BETWEEN: Justify2.SpaceBetween,
42281
41975
  JUSTIFY_SPACE_AROUND: Justify2.SpaceAround,
42282
41976
  JUSTIFY_SPACE_EVENLY: Justify2.SpaceEvenly,
42283
- LOG_LEVEL_ERROR: LogLevel3.Error,
42284
- LOG_LEVEL_WARN: LogLevel3.Warn,
42285
- LOG_LEVEL_INFO: LogLevel3.Info,
42286
- LOG_LEVEL_DEBUG: LogLevel3.Debug,
42287
- LOG_LEVEL_VERBOSE: LogLevel3.Verbose,
42288
- LOG_LEVEL_FATAL: LogLevel3.Fatal,
41977
+ LOG_LEVEL_ERROR: LogLevel2.Error,
41978
+ LOG_LEVEL_WARN: LogLevel2.Warn,
41979
+ LOG_LEVEL_INFO: LogLevel2.Info,
41980
+ LOG_LEVEL_DEBUG: LogLevel2.Debug,
41981
+ LOG_LEVEL_VERBOSE: LogLevel2.Verbose,
41982
+ LOG_LEVEL_FATAL: LogLevel2.Fatal,
42289
41983
  MEASURE_MODE_UNDEFINED: MeasureMode3.Undefined,
42290
41984
  MEASURE_MODE_EXACTLY: MeasureMode3.Exactly,
42291
41985
  MEASURE_MODE_AT_MOST: MeasureMode3.AtMost,
@@ -43055,6 +42749,35 @@ var VRenderable = class extends Renderable3 {
43055
42749
  }
43056
42750
  };
43057
42751
 
42752
+ // ../../opentui/packages/core/src/zig-registry.ts
42753
+ var LogLevel3 = /* @__PURE__ */ ((LogLevel4) => {
42754
+ LogLevel4[LogLevel4["Error"] = 0] = "Error";
42755
+ LogLevel4[LogLevel4["Warn"] = 1] = "Warn";
42756
+ LogLevel4[LogLevel4["Info"] = 2] = "Info";
42757
+ LogLevel4[LogLevel4["Debug"] = 3] = "Debug";
42758
+ return LogLevel4;
42759
+ })(LogLevel3 || {});
42760
+ var _renderLib;
42761
+ function registerRenderLib(lib) {
42762
+ _renderLib = lib;
42763
+ }
42764
+ function resolveRenderLib() {
42765
+ if (!_renderLib) {
42766
+ throw new Error("No RenderLib registered. In Bun, import '@opentui/core' or '@opentui/core/native' (which loads zig.ts). In browsers, call registerRenderLib() with a browser implementation.");
42767
+ }
42768
+ return _renderLib;
42769
+ }
42770
+ function hasRenderLib() {
42771
+ return _renderLib !== void 0;
42772
+ }
42773
+ if (typeof globalThis.Bun !== "undefined") {
42774
+ const zigPath = "./zig";
42775
+ try {
42776
+ await import(zigPath);
42777
+ } catch {
42778
+ }
42779
+ }
42780
+
43058
42781
  // ../../opentui/packages/react/src/components/text.ts
43059
42782
  var textNodeKeys = ["span", "b", "strong", "i", "em", "u", "br", "a"];
43060
42783
  var SpanRenderable = class extends TextNodeRenderable {
@@ -43768,7 +43491,7 @@ export {
43768
43491
  LayoutEvents,
43769
43492
  LineNumberRenderable,
43770
43493
  LinearScrollAccel,
43771
- LogLevel2 as LogLevel,
43494
+ LogLevel3 as LogLevel,
43772
43495
  MacOSScrollAccel,
43773
43496
  MarkdownRenderable,
43774
43497
  MouseParser,