@buoy-gg/console 4.0.2

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.
Files changed (151) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +55 -0
  3. package/lib/commonjs/components/ConsoleIcon.js +47 -0
  4. package/lib/commonjs/components/ConsoleIcon.js.map +1 -0
  5. package/lib/commonjs/components/ConsoleLogList.js +145 -0
  6. package/lib/commonjs/components/ConsoleLogList.js.map +1 -0
  7. package/lib/commonjs/components/ConsoleModal.js +48 -0
  8. package/lib/commonjs/components/ConsoleModal.js.map +1 -0
  9. package/lib/commonjs/components/ConsoleRoot.js +28 -0
  10. package/lib/commonjs/components/ConsoleRoot.js.map +1 -0
  11. package/lib/commonjs/devtools/ConsoleBody.js +235 -0
  12. package/lib/commonjs/devtools/ConsoleBody.js.map +1 -0
  13. package/lib/commonjs/devtools/ConsoleHeader.js +146 -0
  14. package/lib/commonjs/devtools/ConsoleHeader.js.map +1 -0
  15. package/lib/commonjs/devtools/ConsoleMessageRow.js +338 -0
  16. package/lib/commonjs/devtools/ConsoleMessageRow.js.map +1 -0
  17. package/lib/commonjs/devtools/ConsoleValue.js +254 -0
  18. package/lib/commonjs/devtools/ConsoleValue.js.map +1 -0
  19. package/lib/commonjs/devtools/ConsoleView.js +51 -0
  20. package/lib/commonjs/devtools/ConsoleView.js.map +1 -0
  21. package/lib/commonjs/devtools/consoleFilter.js +125 -0
  22. package/lib/commonjs/devtools/consoleFilter.js.map +1 -0
  23. package/lib/commonjs/devtools/consoleFormat.js +313 -0
  24. package/lib/commonjs/devtools/consoleFormat.js.map +1 -0
  25. package/lib/commonjs/devtools/origin.js +191 -0
  26. package/lib/commonjs/devtools/origin.js.map +1 -0
  27. package/lib/commonjs/devtools/theme.js +143 -0
  28. package/lib/commonjs/devtools/theme.js.map +1 -0
  29. package/lib/commonjs/devtools/useConsoleController.js +82 -0
  30. package/lib/commonjs/devtools/useConsoleController.js.map +1 -0
  31. package/lib/commonjs/devtools/useConsoleMessages.js +241 -0
  32. package/lib/commonjs/devtools/useConsoleMessages.js.map +1 -0
  33. package/lib/commonjs/hooks/useConsoleLogs.js +23 -0
  34. package/lib/commonjs/hooks/useConsoleLogs.js.map +1 -0
  35. package/lib/commonjs/index.js +175 -0
  36. package/lib/commonjs/index.js.map +1 -0
  37. package/lib/commonjs/package.json +1 -0
  38. package/lib/commonjs/preset.js +45 -0
  39. package/lib/commonjs/preset.js.map +1 -0
  40. package/lib/commonjs/store/consoleLogStore.js +298 -0
  41. package/lib/commonjs/store/consoleLogStore.js.map +1 -0
  42. package/lib/commonjs/store/sanitize.js +64 -0
  43. package/lib/commonjs/store/sanitize.js.map +1 -0
  44. package/lib/commonjs/sync/consoleSyncAdapter.js +47 -0
  45. package/lib/commonjs/sync/consoleSyncAdapter.js.map +1 -0
  46. package/lib/module/components/ConsoleIcon.js +42 -0
  47. package/lib/module/components/ConsoleIcon.js.map +1 -0
  48. package/lib/module/components/ConsoleLogList.js +140 -0
  49. package/lib/module/components/ConsoleLogList.js.map +1 -0
  50. package/lib/module/components/ConsoleModal.js +44 -0
  51. package/lib/module/components/ConsoleModal.js.map +1 -0
  52. package/lib/module/components/ConsoleRoot.js +25 -0
  53. package/lib/module/components/ConsoleRoot.js.map +1 -0
  54. package/lib/module/devtools/ConsoleBody.js +230 -0
  55. package/lib/module/devtools/ConsoleBody.js.map +1 -0
  56. package/lib/module/devtools/ConsoleHeader.js +141 -0
  57. package/lib/module/devtools/ConsoleHeader.js.map +1 -0
  58. package/lib/module/devtools/ConsoleMessageRow.js +333 -0
  59. package/lib/module/devtools/ConsoleMessageRow.js.map +1 -0
  60. package/lib/module/devtools/ConsoleValue.js +249 -0
  61. package/lib/module/devtools/ConsoleValue.js.map +1 -0
  62. package/lib/module/devtools/ConsoleView.js +46 -0
  63. package/lib/module/devtools/ConsoleView.js.map +1 -0
  64. package/lib/module/devtools/consoleFilter.js +119 -0
  65. package/lib/module/devtools/consoleFilter.js.map +1 -0
  66. package/lib/module/devtools/consoleFormat.js +309 -0
  67. package/lib/module/devtools/consoleFormat.js.map +1 -0
  68. package/lib/module/devtools/origin.js +183 -0
  69. package/lib/module/devtools/origin.js.map +1 -0
  70. package/lib/module/devtools/theme.js +140 -0
  71. package/lib/module/devtools/theme.js.map +1 -0
  72. package/lib/module/devtools/useConsoleController.js +79 -0
  73. package/lib/module/devtools/useConsoleController.js.map +1 -0
  74. package/lib/module/devtools/useConsoleMessages.js +238 -0
  75. package/lib/module/devtools/useConsoleMessages.js.map +1 -0
  76. package/lib/module/hooks/useConsoleLogs.js +19 -0
  77. package/lib/module/hooks/useConsoleLogs.js.map +1 -0
  78. package/lib/module/index.js +52 -0
  79. package/lib/module/index.js.map +1 -0
  80. package/lib/module/preset.js +40 -0
  81. package/lib/module/preset.js.map +1 -0
  82. package/lib/module/store/consoleLogStore.js +284 -0
  83. package/lib/module/store/consoleLogStore.js.map +1 -0
  84. package/lib/module/store/sanitize.js +60 -0
  85. package/lib/module/store/sanitize.js.map +1 -0
  86. package/lib/module/sync/consoleSyncAdapter.js +43 -0
  87. package/lib/module/sync/consoleSyncAdapter.js.map +1 -0
  88. package/lib/typescript/components/ConsoleIcon.d.ts +14 -0
  89. package/lib/typescript/components/ConsoleIcon.d.ts.map +1 -0
  90. package/lib/typescript/components/ConsoleLogList.d.ts +8 -0
  91. package/lib/typescript/components/ConsoleLogList.d.ts.map +1 -0
  92. package/lib/typescript/components/ConsoleModal.d.ts +18 -0
  93. package/lib/typescript/components/ConsoleModal.d.ts.map +1 -0
  94. package/lib/typescript/components/ConsoleRoot.d.ts +14 -0
  95. package/lib/typescript/components/ConsoleRoot.d.ts.map +1 -0
  96. package/lib/typescript/devtools/ConsoleBody.d.ts +11 -0
  97. package/lib/typescript/devtools/ConsoleBody.d.ts.map +1 -0
  98. package/lib/typescript/devtools/ConsoleHeader.d.ts +17 -0
  99. package/lib/typescript/devtools/ConsoleHeader.d.ts.map +1 -0
  100. package/lib/typescript/devtools/ConsoleMessageRow.d.ts +20 -0
  101. package/lib/typescript/devtools/ConsoleMessageRow.d.ts.map +1 -0
  102. package/lib/typescript/devtools/ConsoleValue.d.ts +21 -0
  103. package/lib/typescript/devtools/ConsoleValue.d.ts.map +1 -0
  104. package/lib/typescript/devtools/ConsoleView.d.ts +10 -0
  105. package/lib/typescript/devtools/ConsoleView.d.ts.map +1 -0
  106. package/lib/typescript/devtools/consoleFilter.d.ts +31 -0
  107. package/lib/typescript/devtools/consoleFilter.d.ts.map +1 -0
  108. package/lib/typescript/devtools/consoleFormat.d.ts +29 -0
  109. package/lib/typescript/devtools/consoleFormat.d.ts.map +1 -0
  110. package/lib/typescript/devtools/origin.d.ts +39 -0
  111. package/lib/typescript/devtools/origin.d.ts.map +1 -0
  112. package/lib/typescript/devtools/theme.d.ts +57 -0
  113. package/lib/typescript/devtools/theme.d.ts.map +1 -0
  114. package/lib/typescript/devtools/useConsoleController.d.ts +35 -0
  115. package/lib/typescript/devtools/useConsoleController.d.ts.map +1 -0
  116. package/lib/typescript/devtools/useConsoleMessages.d.ts +74 -0
  117. package/lib/typescript/devtools/useConsoleMessages.d.ts.map +1 -0
  118. package/lib/typescript/hooks/useConsoleLogs.d.ts +11 -0
  119. package/lib/typescript/hooks/useConsoleLogs.d.ts.map +1 -0
  120. package/lib/typescript/index.d.ts +26 -0
  121. package/lib/typescript/index.d.ts.map +1 -0
  122. package/lib/typescript/preset.d.ts +38 -0
  123. package/lib/typescript/preset.d.ts.map +1 -0
  124. package/lib/typescript/store/consoleLogStore.d.ts +71 -0
  125. package/lib/typescript/store/consoleLogStore.d.ts.map +1 -0
  126. package/lib/typescript/store/sanitize.d.ts +11 -0
  127. package/lib/typescript/store/sanitize.d.ts.map +1 -0
  128. package/lib/typescript/sync/consoleSyncAdapter.d.ts +30 -0
  129. package/lib/typescript/sync/consoleSyncAdapter.d.ts.map +1 -0
  130. package/package.json +56 -0
  131. package/src/components/ConsoleIcon.tsx +49 -0
  132. package/src/components/ConsoleLogList.tsx +133 -0
  133. package/src/components/ConsoleModal.tsx +48 -0
  134. package/src/components/ConsoleRoot.tsx +25 -0
  135. package/src/devtools/ConsoleBody.tsx +225 -0
  136. package/src/devtools/ConsoleHeader.tsx +149 -0
  137. package/src/devtools/ConsoleMessageRow.tsx +345 -0
  138. package/src/devtools/ConsoleValue.tsx +265 -0
  139. package/src/devtools/ConsoleView.tsx +41 -0
  140. package/src/devtools/consoleFilter.ts +123 -0
  141. package/src/devtools/consoleFormat.ts +314 -0
  142. package/src/devtools/origin.ts +190 -0
  143. package/src/devtools/theme.ts +137 -0
  144. package/src/devtools/useConsoleController.ts +104 -0
  145. package/src/devtools/useConsoleMessages.ts +337 -0
  146. package/src/hooks/useConsoleLogs.ts +26 -0
  147. package/src/index.tsx +69 -0
  148. package/src/preset.tsx +35 -0
  149. package/src/store/consoleLogStore.ts +346 -0
  150. package/src/store/sanitize.ts +58 -0
  151. package/src/sync/consoleSyncAdapter.ts +49 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * consoleFormat — port of DevTools `panels/console/ConsoleFormat.ts`.
3
+ *
4
+ * Implements the WHATWG console Formatter: %s/%d/%i/%f/%o/%O/%c/%_ substitutions
5
+ * plus ANSI SGR (\x1B[…m) styling. Where DevTools works over V8 RemoteObjects we
6
+ * work over raw JS values; the substitution/ANSI logic is otherwise 1:1.
7
+ *
8
+ * Output is a flat list of tokens the row renderer consumes:
9
+ * - { type: 'string', value, style? } — text, optionally styled by %c / ANSI
10
+ * - { type: 'value', value, mode } — an object/array substitution (%o/%O)
11
+ * or a trailing non-string argument
12
+ */
13
+ import type { TextStyle } from "react-native";
14
+ export type FormatToken = {
15
+ type: "string";
16
+ value: string;
17
+ style?: TextStyle;
18
+ } | {
19
+ type: "value";
20
+ value: unknown;
21
+ mode: "optimal" | "generic";
22
+ };
23
+ /**
24
+ * Format a console call's arguments into renderable tokens, mirroring how the
25
+ * DevTools console renders a message: if the first arg is a format string it
26
+ * drives substitution, then any leftover args are appended (space-separated).
27
+ */
28
+ export declare function formatConsoleMessage(args: unknown[]): FormatToken[];
29
+ //# sourceMappingURL=consoleFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consoleFormat.d.ts","sourceRoot":"","sources":["../../../src/devtools/consoleFormat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,CAAC;AA2QnE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAuBnE"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * origin — attributes a console call to *where it came from*, and provides the
3
+ * lnav-style colored connecting bracket helpers.
4
+ *
5
+ * Three independent signals (captured in the store at log time):
6
+ * - **component** — nearest owning React component (React.captureOwnerStack,
7
+ * dev only; null outside render / in async callbacks)
8
+ * - **function** — the enclosing function of the call site (JS stack)
9
+ * - **callSite** — the exact `file:line` of the call site (JS stack)
10
+ *
11
+ * The view groups consecutive same-source rows and draws a colored bracket
12
+ * gutter (┌ │ └ ─) exactly like lnav's per-file gutter.
13
+ */
14
+ export type GroupDimension = "component" | "callsite" | "function" | "off";
15
+ export interface LogOrigin {
16
+ component?: string;
17
+ functionName?: string;
18
+ callSite?: string;
19
+ file?: string;
20
+ line?: number;
21
+ }
22
+ /** Derive the origin of a log from its captured JS stack + React owner stack. */
23
+ export declare function parseOrigin(stack?: string, ownerStack?: string): LogOrigin | undefined;
24
+ /**
25
+ * Stable key used to group consecutive rows (null = ungrouped).
26
+ *
27
+ * Each dimension falls back to the next-best signal so a row is never lumped
28
+ * into a single catch-all bucket: a handler-fired log (no React owner) still
29
+ * differentiates by its function / call site under "Component".
30
+ */
31
+ export declare function sourceKey(origin: LogOrigin | undefined, dim: GroupDimension): string | null;
32
+ /** Human label shown next to the row. */
33
+ export declare function sourceLabel(origin: LogOrigin | undefined, dim: GroupDimension): string;
34
+ /** Stable, readable color for a source key (bright enough for a dark surface). */
35
+ export declare function colorForKey(key: string): string;
36
+ export type Bracket = "top" | "mid" | "bottom" | "single";
37
+ /** lnav gutter glyph: ┌ run-start · │ run-middle · └ run-end · ─ single. */
38
+ export declare function bracketGlyph(bracket: Bracket): string;
39
+ //# sourceMappingURL=origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/devtools/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,CAAC;AAE3E,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAiFD,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAgBtF;AAID;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAS3F;AAED,yCAAyC;AACzC,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,CAgBtF;AAUD,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE1D,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAWrD"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Console palette — a dark theme matched to Buoy's shared design tokens
3
+ * (`macOSColors` in @buoy-gg/shared-ui) so the console reads as part of the
4
+ * tool suite, tuned for contrast per WCAG AA:
5
+ * - body text #F5F5F7 on #0A0A0C ≈ 17:1
6
+ * - secondary #A1A1A6 on #0A0A0C ≈ 7:1
7
+ * - links #40CCFF on #0A0A0C ≈ 9:1
8
+ * - dividers / nesting guides lightened to ~#3A3A40 so lines are clearly
9
+ * visible against the near-black surface.
10
+ * The light values (the exact DevTools light tokens) are kept for a future
11
+ * toggle.
12
+ */
13
+ /**
14
+ * Monospace font. On the desktop dashboard (react-native-web) the generic
15
+ * `"monospace"` resolves to a thin, poorly-hinted browser default that's hard
16
+ * to read at small sizes — so we use a curated mono stack there. Native (mobile)
17
+ * keeps its system monospace, which already renders well.
18
+ */
19
+ export declare const monoFont: string;
20
+ export interface ConsoleColors {
21
+ baseContainer: string;
22
+ surfaceError: string;
23
+ surfaceYellow: string;
24
+ divider: string;
25
+ inputBackground: string;
26
+ menuBackground: string;
27
+ onSurface: string;
28
+ onSurfaceYellow: string;
29
+ onErrorContainer: string;
30
+ tokenSubtle: string;
31
+ primary: string;
32
+ valueNumber: string;
33
+ valueString: string;
34
+ valueBigint: string;
35
+ valueNode: string;
36
+ valueNullish: string;
37
+ valuePreview: string;
38
+ }
39
+ /** Light theme (active) — resolved DevTools light-theme tokens. */
40
+ export declare const lightTheme: ConsoleColors;
41
+ /** Dark theme (active) — matched to Buoy macOSColors, contrast-tuned. */
42
+ export declare const darkTheme: ConsoleColors;
43
+ /** The active console palette. */
44
+ export declare const consoleTheme: ConsoleColors;
45
+ /** ANSI 16-color palette (dark theme), from consoleView.css `--console-color-*`. */
46
+ export declare const ansiColors: Record<string, string>;
47
+ export type ConsoleLevel = "verbose" | "info" | "warning" | "error";
48
+ export interface LevelStyle {
49
+ /** Row background (undefined = base container). */
50
+ background?: string;
51
+ /** Message text color. */
52
+ text: string;
53
+ /** Material icon name analog (rendered as a glyph). */
54
+ icon?: "warning" | "error";
55
+ }
56
+ export declare const levelStyles: Record<ConsoleLevel, LevelStyle>;
57
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/devtools/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,MAIJ,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,mEAAmE;AACnE,eAAO,MAAM,UAAU,EAAE,aAkBxB,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,SAAS,EAAE,aAkBvB,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,YAAY,EAAE,aAAyB,CAAC;AAErD,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiB7C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,UAAU,CAaxD,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * useConsoleController — owns all Console view state so the header and the body
3
+ * can be composed separately (the shared ModalHeader pattern: controls live in
4
+ * the modal header's `customContent`, the list/sub-views live in the body).
5
+ */
6
+ import { type Dispatch, type SetStateAction } from "react";
7
+ import { type DisplayRow, type LayoutMode } from "./useConsoleMessages";
8
+ import { type LevelsMask } from "./consoleFilter";
9
+ /** Which screen the modal body shows (list, or the back-navigable filters page). */
10
+ export type ConsoleViewState = "list" | "filters";
11
+ export interface ConsoleController {
12
+ query: string;
13
+ setQuery: Dispatch<SetStateAction<string>>;
14
+ searchActive: boolean;
15
+ setSearchActive: Dispatch<SetStateAction<boolean>>;
16
+ levelsMask: LevelsMask;
17
+ setLevelsMask: Dispatch<SetStateAction<LevelsMask>>;
18
+ showTimestamps: boolean;
19
+ setShowTimestamps: Dispatch<SetStateAction<boolean>>;
20
+ layoutMode: LayoutMode;
21
+ setLayoutMode: Dispatch<SetStateAction<LayoutMode>>;
22
+ view: ConsoleViewState;
23
+ setView: Dispatch<SetStateAction<ConsoleViewState>>;
24
+ rows: DisplayRow[];
25
+ hiddenCount: number;
26
+ onToggleGroup: (groupId: number, currentlyCollapsed: boolean) => void;
27
+ onToggleCluster: (key: string) => void;
28
+ clear: () => void;
29
+ /** Level menu summary ("Default levels" / "Errors only" / …). */
30
+ levelSummary: string;
31
+ /** Whether the level mask differs from all/default (drives the active tint). */
32
+ isLevelCustom: boolean;
33
+ }
34
+ export declare function useConsoleController(): ConsoleController;
35
+ //# sourceMappingURL=useConsoleController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConsoleController.d.ts","sourceRoot":"","sources":["../../../src/devtools/useConsoleController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAGzB,oFAAoF;AACpF,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IACpD,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACpD,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,KAAK,IAAI,CAAC;IACtE,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAyDxD"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * useConsoleMessages — derives the displayed row model from raw captured
3
+ * entries, mirroring DevTools `ConsoleView.updateMessageList`:
4
+ *
5
+ * - level + text filtering (consoleFilter)
6
+ * - consecutive-identical collapse into a repeat-count badge (when timestamps
7
+ * are off, matching `tryToCollapseMessages`)
8
+ * - console.group / groupCollapsed nesting + collapse/expand
9
+ *
10
+ * Returns the visible rows plus the count of messages hidden by filters
11
+ * ("N hidden"), and per-level totals for the toolbar.
12
+ */
13
+ import { type ConsoleLogEntry, type ConsoleLevel } from "../store/consoleLogStore";
14
+ import { type LevelsMask } from "./consoleFilter";
15
+ import { type GroupDimension } from "./origin";
16
+ /** How the origin gutter is laid out. */
17
+ export type LayoutMode = "chrono" | "swimlane" | "cluster";
18
+ /** One swimlane gutter cell. */
19
+ export interface LaneCell {
20
+ glyph: string;
21
+ color?: string;
22
+ }
23
+ export interface DisplayRow {
24
+ key: string;
25
+ entry: ConsoleLogEntry;
26
+ /** Group-nesting indentation level. */
27
+ depth: number;
28
+ /** >1 when consecutive identical messages were collapsed. */
29
+ repeatCount: number;
30
+ /** True for console.group / groupCollapsed header rows. */
31
+ isGroupHeader: boolean;
32
+ /** For headers: the group id (the start entry's id). */
33
+ groupId?: number;
34
+ /** For headers: whether the group is currently collapsed. */
35
+ groupCollapsed?: boolean;
36
+ /** The grouping key for this row's origin (per the active dimension). */
37
+ sourceKey?: string | null;
38
+ /** lnav-style single-column gutter glyph (┌ │ └ ─) — chrono/cluster modes. */
39
+ bracketGlyph?: string;
40
+ /** Multi-column swimlane gutter cells — swimlane mode. */
41
+ lanes?: LaneCell[];
42
+ /** Color for this row's origin bracket + label. */
43
+ originColor?: string;
44
+ /** Human label for the row's origin (component / function / call site). */
45
+ originLabel?: string;
46
+ /** Set on the synthetic header of a collapsed/large cluster (Grouped mode). */
47
+ clusterHeader?: {
48
+ key: string;
49
+ count: number;
50
+ expanded: boolean;
51
+ };
52
+ }
53
+ export interface ConsoleMessagesResult {
54
+ rows: DisplayRow[];
55
+ hiddenCount: number;
56
+ levelCounts: Record<ConsoleLevel, number>;
57
+ totalCount: number;
58
+ }
59
+ interface BuildOptions {
60
+ levelsMask: LevelsMask;
61
+ query: string;
62
+ showTimestamps: boolean;
63
+ /** groupId → user-overridden collapsed state. */
64
+ collapsedOverrides: Record<number, boolean>;
65
+ /** Which origin dimension to group/color rows by. */
66
+ groupDimension: GroupDimension;
67
+ /** Gutter layout: chronological brackets, swimlanes, or clustered. */
68
+ layoutMode: LayoutMode;
69
+ /** Grouped mode: which large clusters the user has expanded (key → true). */
70
+ clusterExpanded: Record<string, boolean>;
71
+ }
72
+ export declare function useConsoleMessages(opts: BuildOptions): ConsoleMessagesResult;
73
+ export {};
74
+ //# sourceMappingURL=useConsoleMessages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConsoleMessages.d.ts","sourceRoot":"","sources":["../../../src/devtools/useConsoleMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAKL,KAAK,cAAc,EAEpB,MAAM,UAAU,CAAC;AAElB,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3D,gCAAgC;AAChC,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,eAAe,CAAC;IACvB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,aAAa,EAAE,OAAO,CAAC;IACvB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,aAAa,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;CACnE;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,iDAAiD;IACjD,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,qDAAqD;IACrD,cAAc,EAAE,cAAc,CAAC;IAC/B,sEAAsE;IACtE,UAAU,EAAE,UAAU,CAAC;IACvB,6EAA6E;IAC7E,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAwOD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,qBAAqB,CAe5E"}
@@ -0,0 +1,11 @@
1
+ import { type ConsoleLogEntry } from "../store/consoleLogStore";
2
+ export interface UseConsoleLogsResult {
3
+ logs: ConsoleLogEntry[];
4
+ }
5
+ /**
6
+ * Subscribe to captured console logs. Installs the console interceptor on mount
7
+ * (idempotent) and re-renders whenever a new entry is captured or the buffer is
8
+ * cleared.
9
+ */
10
+ export declare function useConsoleLogs(): UseConsoleLogsResult;
11
+ //# sourceMappingURL=useConsoleLogs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useConsoleLogs.d.ts","sourceRoot":"","sources":["../../../src/hooks/useConsoleLogs.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,CAQrD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @buoy-gg/console
3
+ *
4
+ * Captures global `console.*` output and renders it as a Buoy devtool.
5
+ *
6
+ * This is the BASIC version: direct console patching + a flat list, used to
7
+ * verify the capture pipeline end to end. Next step is a 1:1 port of Chrome
8
+ * DevTools' console view.
9
+ */
10
+ export { consoleToolPreset, createConsoleTool } from "./preset";
11
+ export { ConsoleRoot } from "./components/ConsoleRoot";
12
+ export { ConsoleModal } from "./components/ConsoleModal";
13
+ export { ConsoleIcon, CONSOLE_ICON_COLOR } from "./components/ConsoleIcon";
14
+ export { ConsoleView } from "./devtools/ConsoleView";
15
+ export { ConsoleMessageRow } from "./devtools/ConsoleMessageRow";
16
+ export { ConsoleValue } from "./devtools/ConsoleValue";
17
+ export { useConsoleMessages } from "./devtools/useConsoleMessages";
18
+ export type { DisplayRow, ConsoleMessagesResult } from "./devtools/useConsoleMessages";
19
+ export { consoleTheme, levelStyles } from "./devtools/theme";
20
+ export { ConsoleLogList } from "./components/ConsoleLogList";
21
+ export { useConsoleLogs } from "./hooks/useConsoleLogs";
22
+ export type { UseConsoleLogsResult } from "./hooks/useConsoleLogs";
23
+ export { consoleSyncAdapter } from "./sync/consoleSyncAdapter";
24
+ export { installConsoleCapture, uninstallConsoleCapture, clearEntries, getEntries, subscribe, replaceEntries, onClear, initConsolePersistence, getPreserveLog, setPreserveLog, subscribePreserveLog, } from "./store/consoleLogStore";
25
+ export type { ConsoleLogEntry, ConsoleLevel, ConsoleMethod, } from "./store/consoleLogStore";
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKhE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAKvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAKnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAK/D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,cAAc,EACd,OAAO,EACP,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,eAAe,EACf,YAAY,EACZ,aAAa,GACd,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Pre-configured Console tool for FloatingDevTools.
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * import { consoleToolPreset } from '@buoy-gg/console';
7
+ *
8
+ * <FloatingDevTools apps={[consoleToolPreset]} />
9
+ * ```
10
+ */
11
+ import { ConsoleModal } from "./components/ConsoleModal";
12
+ export declare const consoleToolPreset: {
13
+ id: string;
14
+ name: string;
15
+ description: string;
16
+ slot: "both";
17
+ icon: ({ size, color }: {
18
+ size: number;
19
+ color?: string;
20
+ }) => import("react").JSX.Element;
21
+ component: typeof ConsoleModal;
22
+ };
23
+ /** Create a custom Console tool configuration. */
24
+ export declare function createConsoleTool(options?: {
25
+ name?: string;
26
+ description?: string;
27
+ }): {
28
+ name: string;
29
+ description: string;
30
+ id: string;
31
+ slot: "both";
32
+ icon: ({ size, color }: {
33
+ size: number;
34
+ color?: string;
35
+ }) => import("react").JSX.Element;
36
+ component: typeof ConsoleModal;
37
+ };
38
+ //# sourceMappingURL=preset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/preset.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,eAAO,MAAM,iBAAiB;;;;;4BAKJ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;CAIzD,CAAC;AAEF,kDAAkD;AAClD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;4BAR7B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;EAezD"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * consoleLogStore
3
+ *
4
+ * Intercepts the global `console` methods and keeps a bounded ring buffer of
5
+ * captured entries, modeled after Chrome DevTools' ConsoleMessage. Direct
6
+ * console patching is the capture path (works identically on Expo, RN CLI, and
7
+ * web). The DevTools-style view layer (filtering, formatting, grouping) is built
8
+ * on top of these raw entries.
9
+ *
10
+ * By default the buffer is in-memory only, so a JS reload starts fresh — just
11
+ * like the Metro/Chrome console. A "Preserve log" toggle persists the buffer to
12
+ * storage and restores it on the next launch (Chrome's "Preserve log").
13
+ */
14
+ import { type LogOrigin } from "../devtools/origin";
15
+ /** The console method that produced an entry. */
16
+ export type ConsoleMethod = "log" | "info" | "warn" | "error" | "debug" | "trace" | "dir" | "table" | "assert" | "group" | "groupCollapsed" | "groupEnd";
17
+ /** DevTools log levels (Protocol.Log.LogEntryLevel). */
18
+ export type ConsoleLevel = "verbose" | "info" | "warning" | "error";
19
+ export interface ConsoleLogEntry {
20
+ /** Monotonic id, unique per captured entry. */
21
+ id: number;
22
+ /** The console method that produced this entry. */
23
+ method: ConsoleMethod;
24
+ /** DevTools level, derived from the method. */
25
+ level: ConsoleLevel;
26
+ /** The raw arguments passed to the console method. */
27
+ args: unknown[];
28
+ /** Pre-rendered single-line text (used for filtering + the simple list). */
29
+ message: string;
30
+ /** Capture time in ms since epoch. */
31
+ timestamp: number;
32
+ /** Captured JS stack (error/warn/trace only), newest frame first. */
33
+ stack?: string;
34
+ /** Where the log came from (component / function / call site). */
35
+ origin?: LogOrigin;
36
+ }
37
+ type Listener = () => void;
38
+ /**
39
+ * Patch the global console methods. Idempotent — safe to call more than once.
40
+ * Each patched method still forwards to the original so normal logging keeps
41
+ * working (Metro terminal, Chrome, native logcat/Xcode).
42
+ */
43
+ export declare function installConsoleCapture(): void;
44
+ /** Restore the original console methods. */
45
+ export declare function uninstallConsoleCapture(): void;
46
+ /** Subscribe to changes. Returns an unsubscribe function. */
47
+ export declare function subscribe(listener: Listener): () => void;
48
+ /** Current snapshot (stable reference between mutations for useSyncExternalStore). */
49
+ export declare function getEntries(): ConsoleLogEntry[];
50
+ /** Clear all captured entries. Fires onClear listeners (e.g. to forward the
51
+ * clear to a remote device when running in mirror mode). */
52
+ export declare function clearEntries(): void;
53
+ /** Replace the whole entry list from a remote snapshot. */
54
+ export declare function replaceEntries(next: ConsoleLogEntry[]): void;
55
+ /** Register a listener fired when clearEntries() is called. Returns an
56
+ * unsubscribe function. Used by the dashboard to forward clears to the device. */
57
+ export declare function onClear(listener: Listener): () => void;
58
+ /**
59
+ * Load the persisted preserve-log flag and, if enabled, restore the saved
60
+ * buffer. If disabled, drop any saved buffer so the session starts fresh.
61
+ * Idempotent — safe to call from ConsoleRoot on every mount.
62
+ */
63
+ export declare function initConsolePersistence(): Promise<void>;
64
+ /** Whether logs persist across reload. */
65
+ export declare function getPreserveLog(): boolean;
66
+ /** Toggle preserve-log. Persists the flag; saves or drops the buffer. */
67
+ export declare function setPreserveLog(next: boolean): void;
68
+ /** Subscribe to preserve-log changes. Returns an unsubscribe function. */
69
+ export declare function subscribePreserveLog(listener: Listener): () => void;
70
+ export {};
71
+ //# sourceMappingURL=consoleLogStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consoleLogStore.d.ts","sourceRoot":"","sources":["../../../src/store/consoleLogStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,iDAAiD;AACjD,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,OAAO,GACP,gBAAgB,GAChB,UAAU,CAAC;AAEf,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,MAAM,EAAE,aAAa,CAAC;IACtB,+CAA+C;IAC/C,KAAK,EAAE,YAAY,CAAC;IACpB,sDAAsD;IACtD,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAwCD,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAyE3B;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAgB5C;AAED,4CAA4C;AAC5C,wBAAgB,uBAAuB,IAAI,IAAI,CAQ9C;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAKxD;AAED,sFAAsF;AACtF,wBAAgB,UAAU,IAAI,eAAe,EAAE,CAE9C;AAED;4DAC4D;AAC5D,wBAAgB,YAAY,IAAI,IAAI,CAMnC;AAOD,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,IAAI,CAG5D;AAED;kFACkF;AAClF,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAKtD;AA+CD;;;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4B5D;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAOlD;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAKnE"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * sanitizeArgs — deep-convert captured console arguments into JSON-safe values.
3
+ *
4
+ * Captured `args` can hold Errors, functions, bigints, symbols, and circular
5
+ * references. Both the external-sync snapshot (device → desktop) and the
6
+ * preserve-log persistence need plain JSON, so this produces a structural copy
7
+ * (objects/arrays preserved so they stay expandable) with cycles broken.
8
+ */
9
+ /** Deep-sanitize an array of console arguments into JSON-safe values. */
10
+ export declare function sanitizeArgs(args: unknown[]): unknown[];
11
+ //# sourceMappingURL=sanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/store/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8CH,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAGvD"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * consoleSyncAdapter — streams captured console entries from the device to the
3
+ * desktop dashboard via @buoy-gg/external-sync.
4
+ *
5
+ * Structurally matches external-sync's `ToolSyncAdapter` WITHOUT importing the
6
+ * package (so console has no hard dependency on external-sync, matching how the
7
+ * other tools' adapters are written). Auto-discovery in @buoy-gg/core picks it
8
+ * up by the export name and announces the "console" capability.
9
+ *
10
+ * Snapshots MUST be JSON-serializable. Captured `args` can hold Errors,
11
+ * functions, bigints, and circular references, so we deep-sanitize them into
12
+ * plain JSON values (objects/arrays preserved so they stay expandable on the
13
+ * dashboard).
14
+ */
15
+ import { type ConsoleLogEntry } from "../store/consoleLogStore";
16
+ interface ConsoleSnapshot {
17
+ entries: ConsoleLogEntry[];
18
+ }
19
+ export declare const consoleSyncAdapter: {
20
+ version: number;
21
+ getSnapshot(): ConsoleSnapshot;
22
+ subscribe(onChange: () => void): () => void;
23
+ actions: {
24
+ clearEntries(): {
25
+ cleared: true;
26
+ };
27
+ };
28
+ };
29
+ export {};
30
+ //# sourceMappingURL=consoleSyncAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consoleSyncAdapter.d.ts","sourceRoot":"","sources":["../../../src/sync/consoleSyncAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAGlC,UAAU,eAAe;IACvB,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB;;mBAGd,eAAe;wBAQV,MAAM,IAAI,GAAG,MAAM,IAAI;;wBAKzB;YAAE,OAAO,EAAE,IAAI,CAAA;SAAE;;CAKpC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@buoy-gg/console",
3
+ "version": "4.0.2",
4
+ "description": "console package",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index.tsx",
9
+ "source": "src/index.tsx",
10
+ "files": [
11
+ "src",
12
+ "lib"
13
+ ],
14
+ "sideEffects": false,
15
+ "dependencies": {
16
+ "@buoy-gg/shared-ui": "4.0.2"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "*",
20
+ "react-native": "*"
21
+ },
22
+ "devDependencies": {
23
+ "@types/react": "^19.1.0",
24
+ "@types/react-native": "^0.73.0",
25
+ "typescript": "~5.8.3"
26
+ },
27
+ "react-native-builder-bob": {
28
+ "source": "src",
29
+ "output": "lib",
30
+ "targets": [
31
+ "commonjs",
32
+ "module",
33
+ "typescript"
34
+ ]
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/LovesWorking/react-native-buoy.git",
39
+ "directory": "packages/console"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/LovesWorking/react-native-buoy/issues"
43
+ },
44
+ "homepage": "https://github.com/LovesWorking/react-native-buoy/tree/main/packages/console#readme",
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "tag": "latest"
48
+ },
49
+ "scripts": {
50
+ "build": "bob build",
51
+ "typecheck": "tsc --noEmit",
52
+ "clean": "rimraf lib",
53
+ "test": "pnpm run typecheck",
54
+ "postinstall": "echo \"Run pnpm build to compile this package\""
55
+ }
56
+ }
@@ -0,0 +1,49 @@
1
+ import React from "react";
2
+ import { View, Text, StyleSheet } from "react-native";
3
+
4
+ /** Tool accent color (terminal green). */
5
+ export const CONSOLE_ICON_COLOR = "#10B981";
6
+
7
+ interface ConsoleIconProps {
8
+ size: number;
9
+ color?: string;
10
+ }
11
+
12
+ /**
13
+ * Dependency-free terminal glyph: a rounded window outline with a `>_` prompt.
14
+ * Rendered in the floating menu and the modal header.
15
+ */
16
+ export function ConsoleIcon({ size, color = CONSOLE_ICON_COLOR }: ConsoleIconProps) {
17
+ return (
18
+ <View
19
+ style={[
20
+ styles.frame,
21
+ {
22
+ width: size,
23
+ height: size,
24
+ borderRadius: size * 0.2,
25
+ borderColor: color,
26
+ },
27
+ ]}
28
+ >
29
+ <Text
30
+ style={{
31
+ color,
32
+ fontSize: size * 0.46,
33
+ fontWeight: "700",
34
+ fontFamily: "monospace",
35
+ }}
36
+ >
37
+ {">_"}
38
+ </Text>
39
+ </View>
40
+ );
41
+ }
42
+
43
+ const styles = StyleSheet.create({
44
+ frame: {
45
+ borderWidth: 1.5,
46
+ alignItems: "center",
47
+ justifyContent: "center",
48
+ },
49
+ });