@buoy-gg/console 7.0.41 → 7.0.42

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 (108) hide show
  1. package/README.md +11 -69
  2. package/lib/commonjs/components/ConsoleIcon.js +1 -19
  3. package/lib/commonjs/components/ConsoleLogList.js +1 -152
  4. package/lib/commonjs/components/ConsoleModal.js +1 -48
  5. package/lib/commonjs/components/ConsoleRoot.js +1 -37
  6. package/lib/commonjs/devtools/ConsoleBody.js +1 -234
  7. package/lib/commonjs/devtools/ConsoleHeader.js +1 -114
  8. package/lib/commonjs/devtools/ConsoleMessageRow.js +1 -356
  9. package/lib/commonjs/devtools/ConsoleValue.js +1 -254
  10. package/lib/commonjs/devtools/ConsoleView.js +1 -54
  11. package/lib/commonjs/devtools/consoleFilter.js +1 -125
  12. package/lib/commonjs/devtools/consoleFormat.js +1 -313
  13. package/lib/commonjs/devtools/origin.js +1 -191
  14. package/lib/commonjs/devtools/theme.js +1 -152
  15. package/lib/commonjs/devtools/useConsoleController.js +1 -82
  16. package/lib/commonjs/devtools/useConsoleMessages.js +1 -241
  17. package/lib/commonjs/hooks/useConsoleLogs.js +1 -23
  18. package/lib/commonjs/index.js +1 -181
  19. package/lib/commonjs/preset.js +1 -63
  20. package/lib/commonjs/store/consoleLogStore.js +6 -589
  21. package/lib/commonjs/store/sanitize.js +1 -83
  22. package/lib/commonjs/sync/consoleSyncAdapter.js +1 -86
  23. package/lib/module/components/ConsoleIcon.js +1 -12
  24. package/lib/module/components/ConsoleLogList.js +1 -147
  25. package/lib/module/components/ConsoleModal.js +1 -44
  26. package/lib/module/components/ConsoleRoot.js +1 -33
  27. package/lib/module/devtools/ConsoleBody.js +1 -229
  28. package/lib/module/devtools/ConsoleHeader.js +1 -109
  29. package/lib/module/devtools/ConsoleMessageRow.js +1 -352
  30. package/lib/module/devtools/ConsoleValue.js +1 -249
  31. package/lib/module/devtools/ConsoleView.js +1 -49
  32. package/lib/module/devtools/consoleFilter.js +1 -119
  33. package/lib/module/devtools/consoleFormat.js +1 -309
  34. package/lib/module/devtools/origin.js +1 -183
  35. package/lib/module/devtools/theme.js +1 -143
  36. package/lib/module/devtools/useConsoleController.js +1 -79
  37. package/lib/module/devtools/useConsoleMessages.js +1 -238
  38. package/lib/module/hooks/useConsoleLogs.js +1 -19
  39. package/lib/module/index.js +1 -52
  40. package/lib/module/preset.js +1 -61
  41. package/lib/module/store/consoleLogStore.js +6 -575
  42. package/lib/module/store/sanitize.js +1 -77
  43. package/lib/module/sync/consoleSyncAdapter.js +1 -82
  44. package/lib/web/index.mjs +11 -12
  45. package/package.json +2 -2
  46. package/lib/commonjs/components/ConsoleIcon.js.map +0 -1
  47. package/lib/commonjs/components/ConsoleLogList.js.map +0 -1
  48. package/lib/commonjs/components/ConsoleModal.js.map +0 -1
  49. package/lib/commonjs/components/ConsoleRoot.js.map +0 -1
  50. package/lib/commonjs/devtools/ConsoleBody.js.map +0 -1
  51. package/lib/commonjs/devtools/ConsoleHeader.js.map +0 -1
  52. package/lib/commonjs/devtools/ConsoleMessageRow.js.map +0 -1
  53. package/lib/commonjs/devtools/ConsoleValue.js.map +0 -1
  54. package/lib/commonjs/devtools/ConsoleView.js.map +0 -1
  55. package/lib/commonjs/devtools/consoleFilter.js.map +0 -1
  56. package/lib/commonjs/devtools/consoleFormat.js.map +0 -1
  57. package/lib/commonjs/devtools/origin.js.map +0 -1
  58. package/lib/commonjs/devtools/theme.js.map +0 -1
  59. package/lib/commonjs/devtools/useConsoleController.js.map +0 -1
  60. package/lib/commonjs/devtools/useConsoleMessages.js.map +0 -1
  61. package/lib/commonjs/hooks/useConsoleLogs.js.map +0 -1
  62. package/lib/commonjs/index.js.map +0 -1
  63. package/lib/commonjs/preset.js.map +0 -1
  64. package/lib/commonjs/store/consoleLogStore.js.map +0 -1
  65. package/lib/commonjs/store/sanitize.js.map +0 -1
  66. package/lib/commonjs/sync/consoleSyncAdapter.js.map +0 -1
  67. package/lib/module/components/ConsoleIcon.js.map +0 -1
  68. package/lib/module/components/ConsoleLogList.js.map +0 -1
  69. package/lib/module/components/ConsoleModal.js.map +0 -1
  70. package/lib/module/components/ConsoleRoot.js.map +0 -1
  71. package/lib/module/devtools/ConsoleBody.js.map +0 -1
  72. package/lib/module/devtools/ConsoleHeader.js.map +0 -1
  73. package/lib/module/devtools/ConsoleMessageRow.js.map +0 -1
  74. package/lib/module/devtools/ConsoleValue.js.map +0 -1
  75. package/lib/module/devtools/ConsoleView.js.map +0 -1
  76. package/lib/module/devtools/consoleFilter.js.map +0 -1
  77. package/lib/module/devtools/consoleFormat.js.map +0 -1
  78. package/lib/module/devtools/origin.js.map +0 -1
  79. package/lib/module/devtools/theme.js.map +0 -1
  80. package/lib/module/devtools/useConsoleController.js.map +0 -1
  81. package/lib/module/devtools/useConsoleMessages.js.map +0 -1
  82. package/lib/module/hooks/useConsoleLogs.js.map +0 -1
  83. package/lib/module/index.js.map +0 -1
  84. package/lib/module/preset.js.map +0 -1
  85. package/lib/module/store/consoleLogStore.js.map +0 -1
  86. package/lib/module/store/sanitize.js.map +0 -1
  87. package/lib/module/sync/consoleSyncAdapter.js.map +0 -1
  88. package/lib/typescript/components/ConsoleIcon.d.ts.map +0 -1
  89. package/lib/typescript/components/ConsoleLogList.d.ts.map +0 -1
  90. package/lib/typescript/components/ConsoleModal.d.ts.map +0 -1
  91. package/lib/typescript/components/ConsoleRoot.d.ts.map +0 -1
  92. package/lib/typescript/devtools/ConsoleBody.d.ts.map +0 -1
  93. package/lib/typescript/devtools/ConsoleHeader.d.ts.map +0 -1
  94. package/lib/typescript/devtools/ConsoleMessageRow.d.ts.map +0 -1
  95. package/lib/typescript/devtools/ConsoleValue.d.ts.map +0 -1
  96. package/lib/typescript/devtools/ConsoleView.d.ts.map +0 -1
  97. package/lib/typescript/devtools/consoleFilter.d.ts.map +0 -1
  98. package/lib/typescript/devtools/consoleFormat.d.ts.map +0 -1
  99. package/lib/typescript/devtools/origin.d.ts.map +0 -1
  100. package/lib/typescript/devtools/theme.d.ts.map +0 -1
  101. package/lib/typescript/devtools/useConsoleController.d.ts.map +0 -1
  102. package/lib/typescript/devtools/useConsoleMessages.d.ts.map +0 -1
  103. package/lib/typescript/hooks/useConsoleLogs.d.ts.map +0 -1
  104. package/lib/typescript/index.d.ts.map +0 -1
  105. package/lib/typescript/preset.d.ts.map +0 -1
  106. package/lib/typescript/store/consoleLogStore.d.ts.map +0 -1
  107. package/lib/typescript/store/sanitize.d.ts.map +0 -1
  108. package/lib/typescript/sync/consoleSyncAdapter.d.ts.map +0 -1
@@ -1,114 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ConsoleHeader = ConsoleHeader;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * ConsoleHeader — the Console tool's header, built from the shared ModalHeader
14
- * pattern so it matches Network/Events 1:1. Controls live here: the
15
- * Timeline/Grouped TabSelector (or the search field when active), plus action
16
- * icons for search, level filter, clear, and settings. Tapping the level/filter
17
- * or settings icon swaps the body to a back-navigable sub-view.
18
- */
19
-
20
- const LAYOUT_TABS = [{
21
- key: "chrono",
22
- label: "Timeline"
23
- }, {
24
- key: "cluster",
25
- label: "Grouped"
26
- }];
27
- function ConsoleHeader({
28
- c,
29
- onBack
30
- }) {
31
- // Filters sub-view: a back chevron returns to the list.
32
- if (c.view === "filters") {
33
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
34
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
35
- onBack: () => c.setView("list")
36
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
37
- title: "Filters"
38
- })]
39
- });
40
- }
41
- const hasRows = c.rows.length > 0;
42
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
43
- children: [onBack ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
44
- onBack: onBack
45
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
46
- title: "",
47
- noMargin: true,
48
- children: c.searchActive ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Search, {
49
- value: c.query,
50
- onChangeText: c.setQuery
51
- // The ✕ only clears; submit is what closes the field.
52
- ,
53
- onCancel: () => c.setQuery(""),
54
- clearOnlyWhenText: true,
55
- placeholder: "Filter logs\u2026 /regex/ -exclude",
56
- iconSize: 14,
57
- inputProps: {
58
- onSubmitEditing: () => c.setSearchActive(false)
59
- }
60
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.TabSelector, {
61
- tabs: LAYOUT_TABS,
62
- activeTab: c.layoutMode,
63
- onTabChange: key => c.setLayoutMode(key)
64
- })
65
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions, {
66
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
67
- onPress: () => c.setSearchActive(a => !a),
68
- style: [styles.actionBtn, c.searchActive && styles.actionBtnActive],
69
- accessibilityLabel: "Search logs",
70
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Search, {
71
- size: 14,
72
- color: c.searchActive ? _sharedUi.night.color.accent : _sharedUi.night.color.textSecondary
73
- })
74
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
75
- onPress: () => c.setView("filters"),
76
- style: [styles.actionBtn, c.isLevelCustom && styles.actionBtnActive],
77
- accessibilityLabel: "Filters",
78
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Filter, {
79
- size: 14,
80
- color: c.isLevelCustom ? _sharedUi.night.color.accent : _sharedUi.night.color.textSecondary
81
- })
82
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
83
- onPress: c.clear,
84
- disabled: !hasRows,
85
- style: [styles.actionBtn, !hasRows && styles.actionBtnDisabled],
86
- accessibilityLabel: "Clear console",
87
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
88
- size: 14,
89
- color: hasRows ? _sharedUi.night.color.textSecondary : _sharedUi.night.color.textTertiary
90
- })
91
- })]
92
- })]
93
- });
94
- }
95
- const styles = _reactNative.StyleSheet.create({
96
- actionBtn: {
97
- width: 32,
98
- height: 32,
99
- borderRadius: 8,
100
- backgroundColor: _sharedUi.night.color.buttonSurface,
101
- borderWidth: 1,
102
- borderColor: _sharedUi.night.color.border,
103
- alignItems: "center",
104
- justifyContent: "center"
105
- },
106
- actionBtnActive: {
107
- backgroundColor: _sharedUi.night.color.accentSoft,
108
- borderColor: _sharedUi.night.color.accentBorderStrong
109
- },
110
- actionBtnDisabled: {
111
- opacity: 0.55
112
- }
113
- });
114
- //# sourceMappingURL=ConsoleHeader.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleHeader=ConsoleHeader;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const LAYOUT_TABS=[{key:"chrono",label:"Timeline"},{key:"cluster",label:"Grouped"}];function ConsoleHeader({c:e,onBack:o}){if(e.view==="filters"){return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>e.setView("list")}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Filters"})]})}const t=e.rows.length>0;return(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[o?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:o}):null,(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",noMargin:true,children:e.searchActive?(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Search,{value:e.query,onChangeText:e.setQuery,onCancel:()=>e.setQuery(""),clearOnlyWhenText:true,placeholder:"Filter logs\u2026 /regex/ -exclude",iconSize:14,inputProps:{onSubmitEditing:()=>e.setSearchActive(false)}}):(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{tabs:LAYOUT_TABS,activeTab:e.layoutMode,onTabChange:r=>e.setLayoutMode(r)})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>e.setSearchActive(r=>!r),style:[styles.actionBtn,e.searchActive&&styles.actionBtnActive],accessibilityLabel:"Search logs",children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:e.searchActive?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>e.setView("filters"),style:[styles.actionBtn,e.isLevelCustom&&styles.actionBtnActive],accessibilityLabel:"Filters",children:(0,_jsxRuntime.jsx)(_sharedUi.Filter,{size:14,color:e.isLevelCustom?_sharedUi.night.color.accent:_sharedUi.night.color.textSecondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:e.clear,disabled:!t,style:[styles.actionBtn,!t&&styles.actionBtnDisabled],accessibilityLabel:"Clear console",children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:t?_sharedUi.night.color.textSecondary:_sharedUi.night.color.textTertiary})})]})]})}const styles=_reactNative.StyleSheet.create({actionBtn:{width:32,height:32,borderRadius:8,backgroundColor:_sharedUi.night.color.buttonSurface,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",justifyContent:"center"},actionBtnActive:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},actionBtnDisabled:{opacity:.55}});
@@ -1,356 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ConsoleMessageRow = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _theme = require("./theme");
10
- var _consoleFormat = require("./consoleFormat");
11
- var _ConsoleValue = require("./ConsoleValue");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
- /**
15
- * ConsoleMessageRow — RN port of a single DevTools `.console-message-wrapper`.
16
- *
17
- * Anatomy (mirrors ConsoleViewMessage):
18
- * [nesting markers] [group triangle] [level icon] [timestamp] [content] [repeat badge]
19
- * Error/warning rows get the surface background + text colors; non-error/warning
20
- * rows get a hairline top divider. Group headers show a bold title with an
21
- * expand triangle; error/warn/trace rows can expand a captured stack trace.
22
- */
23
-
24
- function formatTimestamp(ts) {
25
- const d = new Date(ts);
26
- const pad = (n, len = 2) => String(n).padStart(len, "0");
27
- return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`;
28
- }
29
-
30
- /** Small filled level glyph (warning triangle / error cross), DevTools-style. */
31
- function LevelIcon({
32
- icon,
33
- color
34
- }) {
35
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
36
- style: [styles.levelIcon, {
37
- color
38
- }],
39
- children: icon === "warning" ? "⚠" : "⊘"
40
- });
41
- }
42
-
43
- /** The repeat-count bubble (dt-small-bubble). */
44
- function RepeatBadge({
45
- count,
46
- color
47
- }) {
48
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
49
- style: [styles.repeatBadge, {
50
- borderColor: color
51
- }],
52
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
53
- style: [styles.repeatBadgeText, {
54
- color
55
- }],
56
- children: count
57
- })
58
- });
59
- }
60
- // Memo with a precise comparator, justified by profiling (tool-bench
61
- // 2026-07-06): ~30 windowed rows re-rendered on every commit (172 row
62
- // renders in a 5s dwell) because buildDisplayRows recreates row OBJECTS
63
- // each emission — so default shallow compare can never bail. Entries are
64
- // immutable; the comparator lists every display-affecting row field.
65
- const ConsoleMessageRow = exports.ConsoleMessageRow = /*#__PURE__*/(0, _react.memo)(function ConsoleMessageRow({
66
- row,
67
- showTimestamps,
68
- onToggleGroup,
69
- onToggleCluster
70
- }) {
71
- const {
72
- entry
73
- } = row;
74
- const level = _theme.levelStyles[entry.level];
75
- const isErrorOrWarn = entry.level === "error" || entry.level === "warning";
76
- const textColor = level.text;
77
- // One "open" state per row: shows the stack trace (when there is one) AND
78
- // lifts the single-line clamp so long/structured messages stay reachable.
79
- const [expanded, setExpanded] = (0, _react.useState)(entry.method === "trace");
80
-
81
- // Collapsed/large cluster header (Grouped mode): tap to expand/collapse.
82
- if (row.clusterHeader) {
83
- const ch = row.clusterHeader;
84
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
85
- style: [styles.wrapper, styles.dividerTop],
86
- activeOpacity: 0.7,
87
- onPress: () => onToggleCluster(ch.key),
88
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
89
- style: styles.rowWrapper,
90
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
91
- style: [styles.originGutter, {
92
- color: row.originColor
93
- }],
94
- children: ch.expanded ? "▼" : "▶"
95
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
96
- style: styles.messageColumn,
97
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
98
- style: styles.messageLine,
99
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
100
- style: [styles.text, styles.clusterTitle, {
101
- color: row.originColor
102
- }],
103
- children: row.originLabel
104
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
105
- style: styles.clusterCount,
106
- children: [" \xB7 ", ch.count, " logs"]
107
- })]
108
- })
109
- })]
110
- })
111
- });
112
- }
113
- const tokens = (0, _consoleFormat.formatConsoleMessage)(entry.args);
114
- const hasStack = Boolean(entry.stack) && (isErrorOrWarn || entry.method === "trace");
115
- const content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
116
- style: [styles.contentWrap, !expanded && styles.contentWrapClamped],
117
- children: tokens.map((token, i) => token.type === "string" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
118
- style: [styles.text, {
119
- color: textColor
120
- }, row.isGroupHeader && styles.groupTitle, token.style],
121
- children: token.value
122
- }, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConsoleValue.ConsoleValue, {
123
- value: token.value,
124
- generic: token.mode === "generic"
125
- }, i))
126
- });
127
- const inner = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
128
- style: styles.messageColumn,
129
- children: [row.originLabel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
130
- style: [styles.originLabel, {
131
- color: row.originColor
132
- }],
133
- numberOfLines: 1,
134
- children: row.originLabel
135
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
136
- style: styles.messageLine,
137
- children: [row.isGroupHeader ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
138
- style: [styles.groupTriangle, {
139
- color: textColor
140
- }],
141
- children: row.groupCollapsed ? "▶" : "▼"
142
- }) : null, level.icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LevelIcon, {
143
- icon: level.icon,
144
- color: textColor
145
- }) : null, showTimestamps ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
146
- style: styles.timestamp,
147
- children: formatTimestamp(entry.timestamp)
148
- }) : null, hasStack ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
149
- style: [styles.stackTriangle, {
150
- color: textColor
151
- }],
152
- children: expanded ? "▼" : "▶"
153
- }) : null, content, row.repeatCount > 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RepeatBadge, {
154
- count: row.repeatCount,
155
- color: textColor
156
- }) : null]
157
- }), hasStack && expanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
158
- style: styles.stackTrace,
159
- children: (entry.stack ?? "").split("\n").filter(l => l.trim()).map((line, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
160
- style: styles.stackFrame,
161
- children: line.trim()
162
- }, i))
163
- }) : null]
164
- });
165
- const rowStyle = [styles.wrapper, level.background ? {
166
- backgroundColor: level.background
167
- } : styles.dividerTop];
168
-
169
- // Nesting indentation markers.
170
- const markers = Array.from({
171
- length: row.depth
172
- }, (_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
173
- style: styles.nestingMarker
174
- }, i));
175
-
176
- // Origin gutter: swimlane columns (multi-track) or a single bracket.
177
- const gutter = row.lanes ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
178
- style: styles.laneGutter,
179
- children: row.lanes.map((cell, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
180
- style: [styles.laneCell, cell.color ? {
181
- color: cell.color
182
- } : null],
183
- children: cell.glyph
184
- }, i))
185
- }) : row.bracketGlyph ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
186
- style: [styles.originGutter, {
187
- color: row.originColor
188
- }],
189
- children: row.bracketGlyph
190
- }) : null;
191
- const body = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
192
- style: styles.rowWrapper,
193
- children: [gutter, markers, inner]
194
- });
195
- const rowTestID = `buoy-console-row-${entry.id}`;
196
- const rowLabel = [row.originLabel, tokens.find(t => t.type === "string")?.value].filter(Boolean).join(" — ").slice(0, 80);
197
-
198
- // Group headers and stack-bearing rows are pressable.
199
- if (row.isGroupHeader && row.groupId !== undefined) {
200
- const gid = row.groupId;
201
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
202
- style: rowStyle,
203
- activeOpacity: 0.7,
204
- onPress: () => onToggleGroup(gid, Boolean(row.groupCollapsed)),
205
- testID: rowTestID,
206
- accessibilityLabel: rowLabel || "Console group",
207
- children: body
208
- });
209
- }
210
- // Every other row toggles expanded on tap — the collapsed line is clamped
211
- // to a single line, so the tap is the way to read a long/structured log.
212
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
213
- style: rowStyle,
214
- activeOpacity: 0.7,
215
- onPress: () => setExpanded(o => !o),
216
- testID: rowTestID,
217
- accessibilityLabel: rowLabel || "Console message",
218
- children: body
219
- });
220
- }, (prev, next) => prev.row.key === next.row.key &&
221
- // Reference check: swimlane gutter cells are rebuilt per emission, so
222
- // swimlane mode simply keeps its previous (correct) behavior.
223
- prev.row.lanes === next.row.lanes && prev.row.repeatCount === next.row.repeatCount && prev.row.groupCollapsed === next.row.groupCollapsed && prev.row.depth === next.row.depth && prev.row.bracketGlyph === next.row.bracketGlyph && prev.row.originLabel === next.row.originLabel && prev.row.clusterHeader?.count === next.row.clusterHeader?.count && prev.row.clusterHeader?.expanded === next.row.clusterHeader?.expanded && prev.showTimestamps === next.showTimestamps && prev.onToggleGroup === next.onToggleGroup && prev.onToggleCluster === next.onToggleCluster);
224
- const styles = _reactNative.StyleSheet.create({
225
- wrapper: {
226
- paddingVertical: 2,
227
- paddingRight: 8,
228
- minHeight: 18
229
- },
230
- dividerTop: {
231
- borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
232
- borderTopColor: _theme.consoleTheme.divider
233
- },
234
- rowWrapper: {
235
- flexDirection: "row",
236
- alignItems: "flex-start"
237
- },
238
- originGutter: {
239
- width: 11,
240
- fontFamily: _theme.monoFont,
241
- fontSize: 13,
242
- lineHeight: 18,
243
- textAlign: "center"
244
- },
245
- laneGutter: {
246
- flexDirection: "row"
247
- },
248
- laneCell: {
249
- width: 9,
250
- fontFamily: _theme.monoFont,
251
- fontSize: 13,
252
- lineHeight: 18,
253
- textAlign: "center"
254
- },
255
- originLabel: {
256
- fontFamily: _theme.monoFont,
257
- fontSize: 10,
258
- lineHeight: 16,
259
- marginBottom: 1,
260
- opacity: 0.9
261
- },
262
- nestingMarker: {
263
- width: 14,
264
- alignSelf: "stretch",
265
- borderRightWidth: _reactNative.StyleSheet.hairlineWidth,
266
- borderRightColor: _theme.consoleTheme.divider,
267
- marginLeft: 2
268
- },
269
- messageColumn: {
270
- flex: 1,
271
- flexDirection: "column",
272
- paddingLeft: 6
273
- },
274
- messageLine: {
275
- flexDirection: "row",
276
- flexWrap: "wrap",
277
- alignItems: "flex-start"
278
- },
279
- contentWrap: {
280
- flexDirection: "row",
281
- flexWrap: "wrap",
282
- alignItems: "flex-start",
283
- flexShrink: 1
284
- },
285
- // Collapsed rows clamp to one line; tap the row to expand.
286
- contentWrapClamped: {
287
- flexWrap: "nowrap",
288
- overflow: "hidden",
289
- maxHeight: 16
290
- },
291
- text: {
292
- fontFamily: _theme.monoFont,
293
- fontSize: 12,
294
- lineHeight: 16
295
- },
296
- groupTitle: {
297
- fontWeight: "bold"
298
- },
299
- clusterTitle: {
300
- fontWeight: "600"
301
- },
302
- clusterCount: {
303
- color: _theme.consoleTheme.tokenSubtle,
304
- fontFamily: _theme.monoFont,
305
- fontSize: 12,
306
- lineHeight: 16
307
- },
308
- groupTriangle: {
309
- fontSize: 9,
310
- lineHeight: 16,
311
- marginRight: 4
312
- },
313
- stackTriangle: {
314
- fontSize: 8,
315
- lineHeight: 16,
316
- marginRight: 4
317
- },
318
- levelIcon: {
319
- fontSize: 12,
320
- lineHeight: 16,
321
- marginRight: 5
322
- },
323
- timestamp: {
324
- color: _theme.consoleTheme.tokenSubtle,
325
- fontFamily: _theme.monoFont,
326
- fontSize: 11,
327
- lineHeight: 16,
328
- marginRight: 6
329
- },
330
- repeatBadge: {
331
- borderWidth: 1,
332
- borderRadius: 9,
333
- paddingHorizontal: 5,
334
- minWidth: 16,
335
- alignItems: "center",
336
- justifyContent: "center",
337
- marginLeft: 6,
338
- marginTop: 1
339
- },
340
- repeatBadgeText: {
341
- fontSize: 10,
342
- fontWeight: "700",
343
- lineHeight: 14
344
- },
345
- stackTrace: {
346
- marginTop: 2,
347
- marginLeft: 12
348
- },
349
- stackFrame: {
350
- color: _theme.consoleTheme.tokenSubtle,
351
- fontFamily: _theme.monoFont,
352
- fontSize: 11,
353
- lineHeight: 15
354
- }
355
- });
356
- //# sourceMappingURL=ConsoleMessageRow.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleMessageRow=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theme=require("./theme");var _consoleFormat=require("./consoleFormat");var _ConsoleValue=require("./ConsoleValue");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(o,e){if("function"==typeof WeakMap)var a=new WeakMap,g=new WeakMap;return(_interopRequireWildcard=function(r,n){if(!n&&r&&r.__esModule)return r;var i,d,l={__proto__:null,default:r};if(null===r||"object"!=typeof r&&"function"!=typeof r)return l;if(i=n?g:a){if(i.has(r))return i.get(r);i.set(r,l)}for(const s in r)"default"!==s&&{}.hasOwnProperty.call(r,s)&&((d=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,s))&&(d.get||d.set)?i(l,s,d):l[s]=r[s]);return l})(o,e)}function formatTimestamp(o){const e=new Date(o);const a=(g,r=2)=>String(g).padStart(r,"0");return`${a(e.getHours())}:${a(e.getMinutes())}:${a(e.getSeconds())}.${a(e.getMilliseconds(),3)}`}function LevelIcon({icon:o,color:e}){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.levelIcon,{color:e}],children:o==="warning"?"\u26A0":"\u2298"})}function RepeatBadge({count:o,color:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.repeatBadge,{borderColor:e}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.repeatBadgeText,{color:e}],children:o})})}const ConsoleMessageRow=exports.ConsoleMessageRow=(0,_react.memo)(function o({row:e,showTimestamps:a,onToggleGroup:g,onToggleCluster:r}){const{entry:n}=e;const i=_theme.levelStyles[n.level];const d=n.level==="error"||n.level==="warning";const l=i.text;const[s,x]=(0,_react.useState)(n.method==="trace");if(e.clusterHeader){const t=e.clusterHeader;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.wrapper,styles.dividerTop],activeOpacity:.7,onPress:()=>r(t.key),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originGutter,{color:e.originColor}],children:t.expanded?"\u25BC":"\u25B6"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.messageColumn,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.text,styles.clusterTitle,{color:e.originColor}],children:e.originLabel}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.clusterCount,children:[" \xB7 ",t.count," logs"]})]})})]})})}const u=(0,_consoleFormat.formatConsoleMessage)(n.args);const p=Boolean(n.stack)&&(d||n.method==="trace");const T=(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.contentWrap,!s&&styles.contentWrapClamped],children:u.map((t,c)=>t.type==="string"?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.text,{color:l},e.isGroupHeader&&styles.groupTitle,t.style],children:t.value},c):(0,_jsxRuntime.jsx)(_ConsoleValue.ConsoleValue,{value:t.value,generic:t.mode==="generic"},c))});const b=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageColumn,children:[e.originLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originLabel,{color:e.originColor}],numberOfLines:1,children:e.originLabel}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.messageLine,children:[e.isGroupHeader?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.groupTriangle,{color:l}],children:e.groupCollapsed?"\u25B6":"\u25BC"}):null,i.icon?(0,_jsxRuntime.jsx)(LevelIcon,{icon:i.icon,color:l}):null,a?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.timestamp,children:formatTimestamp(n.timestamp)}):null,p?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.stackTriangle,{color:l}],children:s?"\u25BC":"\u25B6"}):null,T,e.repeatCount>1?(0,_jsxRuntime.jsx)(RepeatBadge,{count:e.repeatCount,color:l}):null]}),p&&s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stackTrace,children:(n.stack??"").split("\n").filter(t=>t.trim()).map((t,c)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.stackFrame,children:t.trim()},c))}):null]});const h=[styles.wrapper,i.background?{backgroundColor:i.background}:styles.dividerTop];const w=Array.from({length:e.depth},(t,c)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.nestingMarker},c));const C=e.lanes?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.laneGutter,children:e.lanes.map((t,c)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.laneCell,t.color?{color:t.color}:null],children:t.glyph},c))}):e.bracketGlyph?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.originGutter,{color:e.originColor}],children:e.bracketGlyph}):null;const m=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowWrapper,children:[C,w,b]});const f=`buoy-console-row-${n.id}`;const y=[e.originLabel,u.find(t=>t.type==="string")?.value].filter(Boolean).join(" \u2014 ").slice(0,80);if(e.isGroupHeader&&e.groupId!==void 0){const t=e.groupId;return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:h,activeOpacity:.7,onPress:()=>g(t,Boolean(e.groupCollapsed)),testID:f,accessibilityLabel:y||"Console group",children:m})}return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:h,activeOpacity:.7,onPress:()=>x(t=>!t),testID:f,accessibilityLabel:y||"Console message",children:m})},(o,e)=>o.row.key===e.row.key&&o.row.lanes===e.row.lanes&&o.row.repeatCount===e.row.repeatCount&&o.row.groupCollapsed===e.row.groupCollapsed&&o.row.depth===e.row.depth&&o.row.bracketGlyph===e.row.bracketGlyph&&o.row.originLabel===e.row.originLabel&&o.row.clusterHeader?.count===e.row.clusterHeader?.count&&o.row.clusterHeader?.expanded===e.row.clusterHeader?.expanded&&o.showTimestamps===e.showTimestamps&&o.onToggleGroup===e.onToggleGroup&&o.onToggleCluster===e.onToggleCluster);const styles=_reactNative.StyleSheet.create({wrapper:{paddingVertical:2,paddingRight:8,minHeight:18},dividerTop:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:_theme.consoleTheme.divider},rowWrapper:{flexDirection:"row",alignItems:"flex-start"},originGutter:{width:11,fontFamily:_theme.monoFont,fontSize:13,lineHeight:18,textAlign:"center"},laneGutter:{flexDirection:"row"},laneCell:{width:9,fontFamily:_theme.monoFont,fontSize:13,lineHeight:18,textAlign:"center"},originLabel:{fontFamily:_theme.monoFont,fontSize:10,lineHeight:16,marginBottom:1,opacity:.9},nestingMarker:{width:14,alignSelf:"stretch",borderRightWidth:_reactNative.StyleSheet.hairlineWidth,borderRightColor:_theme.consoleTheme.divider,marginLeft:2},messageColumn:{flex:1,flexDirection:"column",paddingLeft:6},messageLine:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start"},contentWrap:{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-start",flexShrink:1},contentWrapClamped:{flexWrap:"nowrap",overflow:"hidden",maxHeight:16},text:{fontFamily:_theme.monoFont,fontSize:12,lineHeight:16},groupTitle:{fontWeight:"bold"},clusterTitle:{fontWeight:"600"},clusterCount:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:12,lineHeight:16},groupTriangle:{fontSize:9,lineHeight:16,marginRight:4},stackTriangle:{fontSize:8,lineHeight:16,marginRight:4},levelIcon:{fontSize:12,lineHeight:16,marginRight:5},timestamp:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:11,lineHeight:16,marginRight:6},repeatBadge:{borderWidth:1,borderRadius:9,paddingHorizontal:5,minWidth:16,alignItems:"center",justifyContent:"center",marginLeft:6,marginTop:1},repeatBadgeText:{fontSize:10,fontWeight:"700",lineHeight:14},stackTrace:{marginTop:2,marginLeft:12},stackFrame:{color:_theme.consoleTheme.tokenSubtle,fontFamily:_theme.monoFont,fontSize:11,lineHeight:15}});