@buoy-gg/js-top 7.0.3

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 (168) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +56 -0
  3. package/lib/commonjs/index.js +97 -0
  4. package/lib/commonjs/index.js.map +1 -0
  5. package/lib/commonjs/js-top/components/BusySparkline.js +56 -0
  6. package/lib/commonjs/js-top/components/BusySparkline.js.map +1 -0
  7. package/lib/commonjs/js-top/components/JsTopHudOverlay.js +79 -0
  8. package/lib/commonjs/js-top/components/JsTopHudOverlay.js.map +1 -0
  9. package/lib/commonjs/js-top/components/JsTopModal.js +347 -0
  10. package/lib/commonjs/js-top/components/JsTopModal.js.map +1 -0
  11. package/lib/commonjs/js-top/components/TaskDetailView.js +329 -0
  12. package/lib/commonjs/js-top/components/TaskDetailView.js.map +1 -0
  13. package/lib/commonjs/js-top/components/TaskTable.js +360 -0
  14. package/lib/commonjs/js-top/components/TaskTable.js.map +1 -0
  15. package/lib/commonjs/js-top/engine/JsTopController.js +350 -0
  16. package/lib/commonjs/js-top/engine/JsTopController.js.map +1 -0
  17. package/lib/commonjs/js-top/engine/aggregator.js +148 -0
  18. package/lib/commonjs/js-top/engine/aggregator.js.map +1 -0
  19. package/lib/commonjs/js-top/engine/busyProbe.js +101 -0
  20. package/lib/commonjs/js-top/engine/busyProbe.js.map +1 -0
  21. package/lib/commonjs/js-top/engine/frameStack.js +133 -0
  22. package/lib/commonjs/js-top/engine/frameStack.js.map +1 -0
  23. package/lib/commonjs/js-top/engine/longtasks.js +141 -0
  24. package/lib/commonjs/js-top/engine/longtasks.js.map +1 -0
  25. package/lib/commonjs/js-top/engine/now.js +38 -0
  26. package/lib/commonjs/js-top/engine/now.js.map +1 -0
  27. package/lib/commonjs/js-top/engine/originRegistry.js +402 -0
  28. package/lib/commonjs/js-top/engine/originRegistry.js.map +1 -0
  29. package/lib/commonjs/js-top/engine/patches/bridge.js +60 -0
  30. package/lib/commonjs/js-top/engine/patches/bridge.js.map +1 -0
  31. package/lib/commonjs/js-top/engine/patches/microtasks.js +27 -0
  32. package/lib/commonjs/js-top/engine/patches/microtasks.js.map +1 -0
  33. package/lib/commonjs/js-top/engine/patches/promises.js +65 -0
  34. package/lib/commonjs/js-top/engine/patches/promises.js.map +1 -0
  35. package/lib/commonjs/js-top/engine/patches/timers.js +66 -0
  36. package/lib/commonjs/js-top/engine/patches/timers.js.map +1 -0
  37. package/lib/commonjs/js-top/engine/state.js +63 -0
  38. package/lib/commonjs/js-top/engine/state.js.map +1 -0
  39. package/lib/commonjs/js-top/engine/symbolicate.js +95 -0
  40. package/lib/commonjs/js-top/engine/symbolicate.js.map +1 -0
  41. package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js +74 -0
  42. package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js.map +1 -0
  43. package/lib/commonjs/js-top/types/index.js +46 -0
  44. package/lib/commonjs/js-top/types/index.js.map +1 -0
  45. package/lib/commonjs/js-top/utils/preferences.js +39 -0
  46. package/lib/commonjs/js-top/utils/preferences.js.map +1 -0
  47. package/lib/commonjs/package.json +1 -0
  48. package/lib/commonjs/preset.js +75 -0
  49. package/lib/commonjs/preset.js.map +1 -0
  50. package/lib/module/index.js +47 -0
  51. package/lib/module/index.js.map +1 -0
  52. package/lib/module/js-top/components/BusySparkline.js +52 -0
  53. package/lib/module/js-top/components/BusySparkline.js.map +1 -0
  54. package/lib/module/js-top/components/JsTopHudOverlay.js +75 -0
  55. package/lib/module/js-top/components/JsTopHudOverlay.js.map +1 -0
  56. package/lib/module/js-top/components/JsTopModal.js +343 -0
  57. package/lib/module/js-top/components/JsTopModal.js.map +1 -0
  58. package/lib/module/js-top/components/TaskDetailView.js +325 -0
  59. package/lib/module/js-top/components/TaskDetailView.js.map +1 -0
  60. package/lib/module/js-top/components/TaskTable.js +353 -0
  61. package/lib/module/js-top/components/TaskTable.js.map +1 -0
  62. package/lib/module/js-top/engine/JsTopController.js +347 -0
  63. package/lib/module/js-top/engine/JsTopController.js.map +1 -0
  64. package/lib/module/js-top/engine/aggregator.js +136 -0
  65. package/lib/module/js-top/engine/aggregator.js.map +1 -0
  66. package/lib/module/js-top/engine/busyProbe.js +94 -0
  67. package/lib/module/js-top/engine/busyProbe.js.map +1 -0
  68. package/lib/module/js-top/engine/frameStack.js +126 -0
  69. package/lib/module/js-top/engine/frameStack.js.map +1 -0
  70. package/lib/module/js-top/engine/longtasks.js +133 -0
  71. package/lib/module/js-top/engine/longtasks.js.map +1 -0
  72. package/lib/module/js-top/engine/now.js +33 -0
  73. package/lib/module/js-top/engine/now.js.map +1 -0
  74. package/lib/module/js-top/engine/originRegistry.js +388 -0
  75. package/lib/module/js-top/engine/originRegistry.js.map +1 -0
  76. package/lib/module/js-top/engine/patches/bridge.js +56 -0
  77. package/lib/module/js-top/engine/patches/bridge.js.map +1 -0
  78. package/lib/module/js-top/engine/patches/microtasks.js +23 -0
  79. package/lib/module/js-top/engine/patches/microtasks.js.map +1 -0
  80. package/lib/module/js-top/engine/patches/promises.js +62 -0
  81. package/lib/module/js-top/engine/patches/promises.js.map +1 -0
  82. package/lib/module/js-top/engine/patches/timers.js +62 -0
  83. package/lib/module/js-top/engine/patches/timers.js.map +1 -0
  84. package/lib/module/js-top/engine/state.js +54 -0
  85. package/lib/module/js-top/engine/state.js.map +1 -0
  86. package/lib/module/js-top/engine/symbolicate.js +91 -0
  87. package/lib/module/js-top/engine/symbolicate.js.map +1 -0
  88. package/lib/module/js-top/sync/jsTopSyncAdapter.js +70 -0
  89. package/lib/module/js-top/sync/jsTopSyncAdapter.js.map +1 -0
  90. package/lib/module/js-top/types/index.js +42 -0
  91. package/lib/module/js-top/types/index.js.map +1 -0
  92. package/lib/module/js-top/utils/preferences.js +34 -0
  93. package/lib/module/js-top/utils/preferences.js.map +1 -0
  94. package/lib/module/preset.js +71 -0
  95. package/lib/module/preset.js.map +1 -0
  96. package/lib/typescript/index.d.ts +21 -0
  97. package/lib/typescript/index.d.ts.map +1 -0
  98. package/lib/typescript/js-top/components/BusySparkline.d.ts +8 -0
  99. package/lib/typescript/js-top/components/BusySparkline.d.ts.map +1 -0
  100. package/lib/typescript/js-top/components/JsTopHudOverlay.d.ts +8 -0
  101. package/lib/typescript/js-top/components/JsTopHudOverlay.d.ts.map +1 -0
  102. package/lib/typescript/js-top/components/JsTopModal.d.ts +39 -0
  103. package/lib/typescript/js-top/components/JsTopModal.d.ts.map +1 -0
  104. package/lib/typescript/js-top/components/TaskDetailView.d.ts +15 -0
  105. package/lib/typescript/js-top/components/TaskDetailView.d.ts.map +1 -0
  106. package/lib/typescript/js-top/components/TaskTable.d.ts +38 -0
  107. package/lib/typescript/js-top/components/TaskTable.d.ts.map +1 -0
  108. package/lib/typescript/js-top/engine/JsTopController.d.ts +78 -0
  109. package/lib/typescript/js-top/engine/JsTopController.d.ts.map +1 -0
  110. package/lib/typescript/js-top/engine/__tests__/engine.test.d.ts +9 -0
  111. package/lib/typescript/js-top/engine/__tests__/engine.test.d.ts.map +1 -0
  112. package/lib/typescript/js-top/engine/aggregator.d.ts +33 -0
  113. package/lib/typescript/js-top/engine/aggregator.d.ts.map +1 -0
  114. package/lib/typescript/js-top/engine/busyProbe.d.ts +25 -0
  115. package/lib/typescript/js-top/engine/busyProbe.d.ts.map +1 -0
  116. package/lib/typescript/js-top/engine/frameStack.d.ts +44 -0
  117. package/lib/typescript/js-top/engine/frameStack.d.ts.map +1 -0
  118. package/lib/typescript/js-top/engine/longtasks.d.ts +37 -0
  119. package/lib/typescript/js-top/engine/longtasks.d.ts.map +1 -0
  120. package/lib/typescript/js-top/engine/now.d.ts +9 -0
  121. package/lib/typescript/js-top/engine/now.d.ts.map +1 -0
  122. package/lib/typescript/js-top/engine/originRegistry.d.ts +82 -0
  123. package/lib/typescript/js-top/engine/originRegistry.d.ts.map +1 -0
  124. package/lib/typescript/js-top/engine/patches/bridge.d.ts +17 -0
  125. package/lib/typescript/js-top/engine/patches/bridge.d.ts.map +1 -0
  126. package/lib/typescript/js-top/engine/patches/microtasks.d.ts +6 -0
  127. package/lib/typescript/js-top/engine/patches/microtasks.d.ts.map +1 -0
  128. package/lib/typescript/js-top/engine/patches/promises.d.ts +18 -0
  129. package/lib/typescript/js-top/engine/patches/promises.d.ts.map +1 -0
  130. package/lib/typescript/js-top/engine/patches/timers.d.ts +11 -0
  131. package/lib/typescript/js-top/engine/patches/timers.d.ts.map +1 -0
  132. package/lib/typescript/js-top/engine/state.d.ts +35 -0
  133. package/lib/typescript/js-top/engine/state.d.ts.map +1 -0
  134. package/lib/typescript/js-top/engine/symbolicate.d.ts +16 -0
  135. package/lib/typescript/js-top/engine/symbolicate.d.ts.map +1 -0
  136. package/lib/typescript/js-top/sync/jsTopSyncAdapter.d.ts +43 -0
  137. package/lib/typescript/js-top/sync/jsTopSyncAdapter.d.ts.map +1 -0
  138. package/lib/typescript/js-top/types/index.d.ts +130 -0
  139. package/lib/typescript/js-top/types/index.d.ts.map +1 -0
  140. package/lib/typescript/js-top/utils/preferences.d.ts +13 -0
  141. package/lib/typescript/js-top/utils/preferences.d.ts.map +1 -0
  142. package/lib/typescript/preset.d.ts +49 -0
  143. package/lib/typescript/preset.d.ts.map +1 -0
  144. package/package.json +67 -0
  145. package/src/index.tsx +69 -0
  146. package/src/js-top/components/BusySparkline.tsx +59 -0
  147. package/src/js-top/components/JsTopHudOverlay.tsx +78 -0
  148. package/src/js-top/components/JsTopModal.tsx +421 -0
  149. package/src/js-top/components/TaskDetailView.tsx +349 -0
  150. package/src/js-top/components/TaskTable.tsx +365 -0
  151. package/src/js-top/engine/JsTopController.ts +401 -0
  152. package/src/js-top/engine/__tests__/engine.test.ts +337 -0
  153. package/src/js-top/engine/aggregator.ts +148 -0
  154. package/src/js-top/engine/busyProbe.ts +100 -0
  155. package/src/js-top/engine/frameStack.ts +142 -0
  156. package/src/js-top/engine/longtasks.ts +137 -0
  157. package/src/js-top/engine/now.ts +33 -0
  158. package/src/js-top/engine/originRegistry.ts +495 -0
  159. package/src/js-top/engine/patches/bridge.ts +69 -0
  160. package/src/js-top/engine/patches/microtasks.ts +25 -0
  161. package/src/js-top/engine/patches/promises.ts +57 -0
  162. package/src/js-top/engine/patches/timers.ts +80 -0
  163. package/src/js-top/engine/state.ts +66 -0
  164. package/src/js-top/engine/symbolicate.ts +109 -0
  165. package/src/js-top/sync/jsTopSyncAdapter.ts +72 -0
  166. package/src/js-top/types/index.ts +144 -0
  167. package/src/js-top/utils/preferences.ts +35 -0
  168. package/src/preset.tsx +67 -0
package/LICENSE ADDED
@@ -0,0 +1,58 @@
1
+ PROPRIETARY SOFTWARE LICENSE
2
+
3
+ Copyright (c) 2024-present Buoy. All rights reserved.
4
+
5
+ This software and its source code are proprietary and confidential.
6
+
7
+ NOTICE: This is NOT open source software. This software is licensed,
8
+ not sold, and is protected by copyright laws and international treaties.
9
+
10
+ TERMS AND CONDITIONS:
11
+
12
+ 1. LICENSE GRANT
13
+ Subject to the terms of this Agreement and payment of applicable fees,
14
+ Buoy grants you a limited, non-exclusive, non-transferable license
15
+ to use the compiled software packages in your applications.
16
+
17
+ 2. RESTRICTIONS
18
+ You may NOT:
19
+ - Copy, modify, or distribute the source code
20
+ - Reverse engineer, decompile, or disassemble the software
21
+ - Remove or alter any proprietary notices or labels
22
+ - Sublicense, rent, lease, or lend the software
23
+ - Use the software to create competing products
24
+ - Share access credentials with unauthorized parties
25
+
26
+ 3. OWNERSHIP
27
+ React Buoy retains all right, title, and interest in the software,
28
+ including all intellectual property rights. This license does not
29
+ grant you any rights to trademarks or service marks.
30
+
31
+ 4. TERMINATION
32
+ This license is effective until terminated. Your rights under this
33
+ license will terminate automatically without notice if you fail to
34
+ comply with any of its terms. Upon termination, you must cease all
35
+ use and destroy all copies of the software.
36
+
37
+ 5. DISCLAIMER OF WARRANTIES
38
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
39
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
40
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
41
+
42
+ 6. LIMITATION OF LIABILITY
43
+ IN NO EVENT SHALL BUOY BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
44
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN
45
+ CONNECTION WITH THIS LICENSE OR THE USE OF THE SOFTWARE.
46
+
47
+ 7. GOVERNING LAW
48
+ This Agreement shall be governed by and construed in accordance with
49
+ the laws of the United States, without regard to its conflict of
50
+ law provisions.
51
+
52
+ For licensing inquiries and subscription information:
53
+ - Website: https://buoy.gg
54
+ - Email: AustinLovesWorking@gmail.com
55
+
56
+ Unauthorized reproduction or distribution of this software, or any
57
+ portion of it, may result in severe civil and criminal penalties,
58
+ and will be prosecuted to the maximum extent possible under the law.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ <div align="center">
2
+ <h1>@buoy-gg/js-top</h1>
3
+ <p><b>A live Task Manager for the React Native JS thread.</b></p>
4
+ <p>See which timers, Promise chains, and callbacks are eating your JS FPS — ranked in real time, like Activity Monitor for your app's JS thread.</p>
5
+ <p>
6
+ <a href="https://buoy.gg/tools/js-top">Docs</a> ·
7
+ <a href="https://buoy.gg">buoy.gg</a>
8
+ </p>
9
+ </div>
10
+
11
+ ---
12
+
13
+ Every React Native developer has watched JS FPS tank and asked: **what is using it all?** JS Top answers live:
14
+
15
+ ```
16
+ # TASK ORIGIN 5S MS %BUSY CALLS AVG MAX
17
+ 1 setInterval ← startPolling 1240 41.2 50 24.8 31.0
18
+ 2 Promise.then ← processTodos 610 20.3 10 61.0 75.2
19
+ 3 requestAnimationFrame ← rafLoop 402 13.4 300 1.3 4.1
20
+ 4 unattributed (events / React) 255 8.5 – – –
21
+ ```
22
+
23
+ - **Pure JavaScript.** No native module, no debugger, no dev client — works in **Expo Go** and even release builds.
24
+ - **Zero overhead when closed.** The engine only runs while the tool is open (or a Buoy Desktop dashboard is watching).
25
+ - **Honest accounting.** Exclusive-time bookkeeping (nested callbacks never double-count), a calibrated busy probe for true thread occupancy, and an explicit *unattributed* row for work no JS wrapper can see.
26
+ - **Blocking-task attribution.** Every 50ms+ freeze (via React Native's `longtask` observer) is matched to the callback that overlapped it.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ npm install @buoy-gg/js-top
32
+ ```
33
+
34
+ With Buoy auto-discovery, that's it — JS TOP appears in your floating menu. Explicit registration:
35
+
36
+ ```tsx
37
+ import { FloatingDevTools } from "@buoy-gg/core";
38
+ import { jsTopPreset, jsTopModalPreset } from "@buoy-gg/js-top";
39
+
40
+ <FloatingDevTools apps={[jsTopModalPreset, jsTopPreset]} />
41
+ ```
42
+
43
+ ## How it works
44
+
45
+ You can't sample a blocked JS thread from JS — so JS Top doesn't sample. It wraps every entry point work can take onto the thread (`setTimeout` / `setInterval` / `setImmediate` / `requestAnimationFrame` / `queueMicrotask` / Promise reactions / legacy-bridge call-ins) and deterministically times each callback, attributing cost to **where the callback was scheduled from** — with lazy stack capture so hot origins get named `setInterval ← startPolling` without per-call overhead.
46
+
47
+ On the New Architecture, touch/React-commit work enters through paths pure JS can't wrap; that time shows as *unattributed* (the in-tool banner explains). Timers, rAF, microtasks and Promise chains are always fully attributed.
48
+
49
+ ## Buoy Desktop + AI
50
+
51
+ - The desktop dashboard mirrors the device's task table live, and adds a dev-only **per-function Hermes sampler** (attaches to Metro's inspector).
52
+ - Via the Buoy MCP server, your AI agent can call `get_js_thread_top` — "why is JS FPS low?" becomes one tool call.
53
+
54
+ ## License
55
+
56
+ Part of [React Buoy](https://buoy.gg). See buoy.gg for licensing.
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "JS_TOP_DISABLED_COLOR", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _preset.JS_TOP_DISABLED_COLOR;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "JS_TOP_ENABLED_COLOR", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _preset.JS_TOP_ENABLED_COLOR;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "JsTopController", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _JsTopController.JsTopController;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "JsTopHudOverlay", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _JsTopHudOverlay.JsTopHudOverlay;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "JsTopModal", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _JsTopModal.JsTopModal;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "jsTopModalPreset", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _preset.jsTopModalPreset;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "jsTopPreset", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _preset.jsTopPreset;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "jsTopSyncAdapter", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _jsTopSyncAdapter.jsTopSyncAdapter;
52
+ }
53
+ });
54
+ var _JsTopController = require("./js-top/engine/JsTopController");
55
+ var _promises = require("./js-top/engine/patches/promises");
56
+ var _bridge = require("./js-top/engine/patches/bridge");
57
+ var _timers = require("./js-top/engine/patches/timers");
58
+ var _microtasks = require("./js-top/engine/patches/microtasks");
59
+ var _longtasks = require("./js-top/engine/longtasks");
60
+ var _jsTopSyncAdapter = require("./js-top/sync/jsTopSyncAdapter");
61
+ var _JsTopModal = require("./js-top/components/JsTopModal");
62
+ var _JsTopHudOverlay = require("./js-top/components/JsTopHudOverlay");
63
+ var _preset = require("./preset");
64
+ /**
65
+ * @buoy-gg/js-top — live Task Manager for the React Native JS thread.
66
+ *
67
+ * Pure JS (Expo Go + release compatible): wraps timers / rAF / microtasks /
68
+ * Promise reactions / legacy-bridge call-ins and books exclusive time per
69
+ * scheduling origin; a calibrated busy probe measures true thread occupancy
70
+ * so unattributable work is surfaced honestly instead of hidden.
71
+ *
72
+ * Coverage tiers beyond the core (promises, bridge, longtask correlation)
73
+ * are registered here at module scope — the controller installs them lazily
74
+ * on first engine start, so importing this package costs nothing until a
75
+ * viewer opens the tool.
76
+ */
77
+
78
+ _JsTopController.JsTopController.registerTierInstaller(_promises.installPromisePatches);
79
+ _JsTopController.JsTopController.registerTierInstaller(_bridge.installBridgePatch);
80
+ _JsTopController.JsTopController.registerTierInstaller(_longtasks.installLongtaskObserver);
81
+ _JsTopController.JsTopController.registerLongtaskProvider(_longtasks.getLongtasks);
82
+ _JsTopController.JsTopController.registerFreezeStatsProvider(_longtasks.getFreezeStats);
83
+ _JsTopController.JsTopController.registerClearHook(_longtasks.clearLongtasks);
84
+
85
+ // Timer/microtask patches install at import so callbacks scheduled at APP
86
+ // BOOT — the classic forgotten setInterval, the tool's #1 target — are
87
+ // wrapped and attributable the moment any viewer opens the tool. Wrappers
88
+ // resolve their origin lazily and cost one boolean per fire while the
89
+ // engine is off. (Promise/bridge patches are more invasive and stay lazy —
90
+ // they install on first engine start and cover work scheduled after it.)
91
+ try {
92
+ (0, _timers.installTimerPatches)();
93
+ (0, _microtasks.installMicrotaskPatches)();
94
+ } catch {
95
+ // Never let instrumentation break an app at import time.
96
+ }
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_JsTopController","require","_promises","_bridge","_timers","_microtasks","_longtasks","_jsTopSyncAdapter","_JsTopModal","_JsTopHudOverlay","_preset","JsTopController","registerTierInstaller","installPromisePatches","installBridgePatch","installLongtaskObserver","registerLongtaskProvider","getLongtasks","registerFreezeStatsProvider","getFreezeStats","registerClearHook","clearLongtasks","installTimerPatches","installMicrotaskPatches"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AA4BA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcAU,gCAAe,CAACC,qBAAqB,CAACC,+BAAqB,CAAC;AAC5DF,gCAAe,CAACC,qBAAqB,CAACE,0BAAkB,CAAC;AACzDH,gCAAe,CAACC,qBAAqB,CAACG,kCAAuB,CAAC;AAC9DJ,gCAAe,CAACK,wBAAwB,CAACC,uBAAY,CAAC;AACtDN,gCAAe,CAACO,2BAA2B,CAACC,yBAAc,CAAC;AAC3DR,gCAAe,CAACS,iBAAiB,CAACC,yBAAc,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;EACF,IAAAC,2BAAmB,EAAC,CAAC;EACrB,IAAAC,mCAAuB,EAAC,CAAC;AAC3B,CAAC,CAAC,MAAM;EACN;AAAA","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BusySparkline = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ /**
12
+ * Busy% history sparkline — plain View bars (no SVG dependency), tinted by
13
+ * severity. Renders at most the trailing 60 buckets (15s).
14
+ */
15
+
16
+ const MAX_POINTS = 60;
17
+ function barColor(pct) {
18
+ if (pct >= 80) return _sharedUi.macOSColors.semantic.error;
19
+ if (pct >= 40) return _sharedUi.macOSColors.semantic.warning;
20
+ return _sharedUi.macOSColors.semantic.success;
21
+ }
22
+ const BusySparkline = exports.BusySparkline = /*#__PURE__*/(0, _react.memo)(function BusySparkline({
23
+ history
24
+ }) {
25
+ const points = history.slice(-MAX_POINTS);
26
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
27
+ style: styles.row,
28
+ pointerEvents: "none",
29
+ children: points.map((pct, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View
30
+ // Bars are positional by nature (a scrolling time axis); the array
31
+ // is fixed-length and rewritten wholesale each tick, so positional
32
+ // keys are correct here — this is not a prepend-list.
33
+ , {
34
+ style: [styles.bar, {
35
+ height: Math.max(2, pct / 100 * 28),
36
+ backgroundColor: barColor(pct)
37
+ }]
38
+ }, `b${i}`))
39
+ });
40
+ });
41
+ const styles = _reactNative.StyleSheet.create({
42
+ row: {
43
+ flexDirection: "row",
44
+ alignItems: "flex-end",
45
+ gap: 1,
46
+ height: 28,
47
+ alignSelf: "stretch"
48
+ },
49
+ bar: {
50
+ flex: 1,
51
+ maxWidth: 6,
52
+ borderRadius: 1,
53
+ opacity: 0.9
54
+ }
55
+ });
56
+ //# sourceMappingURL=BusySparkline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_sharedUi","_jsxRuntime","MAX_POINTS","barColor","pct","macOSColors","semantic","error","warning","success","BusySparkline","exports","memo","history","points","slice","jsx","View","style","styles","row","pointerEvents","children","map","i","bar","height","Math","max","backgroundColor","StyleSheet","create","flexDirection","alignItems","gap","alignSelf","flex","maxWidth","borderRadius","opacity"],"sourceRoot":"../../../../src","sources":["js-top/components/BusySparkline.tsx"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAiD,IAAAG,WAAA,GAAAH,OAAA;AAPjD;AACA;AACA;AACA;;AAMA,MAAMI,UAAU,GAAG,EAAE;A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CAAC;IACXC,YAAY,EAAE,CAAC;IACfC,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.JsTopHudOverlay = JsTopHudOverlay;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _JsTopController = require("../engine/JsTopController");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ /**
13
+ * Minimal floating HUD pill: busy% + the current top offender. Rendered by
14
+ * FloatingDevTools (guarded require) when the JS TOP toggle chip is on —
15
+ * same auto-mount pattern as the perf-monitor overlay. Display-only in v1
16
+ * (no drag; sits under the status bar on the left).
17
+ */
18
+
19
+ function busyColor(pct) {
20
+ if (pct >= 80) return _sharedUi.macOSColors.semantic.error;
21
+ if (pct >= 40) return _sharedUi.macOSColors.semantic.warning;
22
+ return _sharedUi.macOSColors.semantic.success;
23
+ }
24
+ function JsTopHudOverlay() {
25
+ const [enabled, setEnabled] = (0, _react.useState)(() => _JsTopController.JsTopController.isEnabled());
26
+ const [snapshot, setSnapshot] = (0, _react.useState)(null);
27
+ (0, _react.useEffect)(() => _JsTopController.JsTopController.subscribeEnabled(setEnabled), []);
28
+ (0, _react.useEffect)(() => {
29
+ if (!enabled) {
30
+ setSnapshot(null);
31
+ return;
32
+ }
33
+ return _JsTopController.JsTopController.subscribe(setSnapshot);
34
+ }, [enabled]);
35
+ if (!enabled || !snapshot) return null;
36
+ const top = snapshot.rows.find(r => r.api !== "unattributed");
37
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
38
+ style: styles.pill,
39
+ pointerEvents: "none",
40
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
41
+ style: [styles.busy, {
42
+ color: busyColor(snapshot.busyPct)
43
+ }],
44
+ children: [snapshot.busyPct.toFixed(0), "%"]
45
+ }), top && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
46
+ style: styles.label,
47
+ numberOfLines: 1,
48
+ children: top.label
49
+ })]
50
+ });
51
+ }
52
+ const styles = _reactNative.StyleSheet.create({
53
+ pill: {
54
+ position: "absolute",
55
+ top: 60,
56
+ left: 8,
57
+ flexDirection: "row",
58
+ alignItems: "center",
59
+ gap: 6,
60
+ backgroundColor: "rgba(10,10,12,0.85)",
61
+ borderWidth: 1,
62
+ borderColor: _sharedUi.macOSColors.border.default,
63
+ borderRadius: 6,
64
+ paddingHorizontal: 8,
65
+ paddingVertical: 4,
66
+ maxWidth: 220
67
+ },
68
+ busy: {
69
+ fontSize: 11,
70
+ fontWeight: "700",
71
+ fontVariant: ["tabular-nums"]
72
+ },
73
+ label: {
74
+ color: _sharedUi.macOSColors.text.secondary ?? _sharedUi.macOSColors.text.primary,
75
+ fontSize: 10,
76
+ flexShrink: 1
77
+ }
78
+ });
79
+ //# sourceMappingURL=JsTopHudOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_sharedUi","_JsTopController","_jsxRuntime","busyColor","pct","macOSColors","semantic","error","warning","success","JsTopHudOverlay","enabled","setEnabled","useState","JsTopController","isEnabled","snapshot","setSnapshot","useEffect","subscribeEnabled","subscribe","top","rows","find","r","api","jsxs","View","style","styles","pill","pointerEvents","children","Text","busy","color","busyPct","toFixed","jsx","label","numberOfLines","StyleSheet","create","position","left","flexDirection","alignItems","gap","backgroundColor","borderWidth","borderColor","border","default","borderRadius","paddingHorizontal","paddingVertical","maxWidth","fontSize","fontWeight","fontVariant","text","secondary","primary","flexShrink"],"sourceRoot":"../../../../src","sources":["js-top/components/JsTopHudOverlay.tsx"],"mappings":";;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAH,OAAA;AAA4D,I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