@buoy-gg/js-top 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 (118) hide show
  1. package/README.md +12 -71
  2. package/lib/commonjs/index.js +1 -99
  3. package/lib/commonjs/js-top/components/BusySparkline.js +1 -56
  4. package/lib/commonjs/js-top/components/JsTopHudOverlay.js +1 -79
  5. package/lib/commonjs/js-top/components/JsTopModal.js +1 -349
  6. package/lib/commonjs/js-top/components/TaskDetailView.js +1 -330
  7. package/lib/commonjs/js-top/components/TaskTable.js +1 -360
  8. package/lib/commonjs/js-top/engine/JsTopController.js +1 -350
  9. package/lib/commonjs/js-top/engine/aggregator.js +1 -148
  10. package/lib/commonjs/js-top/engine/busyProbe.js +1 -101
  11. package/lib/commonjs/js-top/engine/frameStack.js +1 -133
  12. package/lib/commonjs/js-top/engine/longtasks.js +1 -141
  13. package/lib/commonjs/js-top/engine/now.js +1 -38
  14. package/lib/commonjs/js-top/engine/originRegistry.js +1 -402
  15. package/lib/commonjs/js-top/engine/patches/bridge.js +1 -60
  16. package/lib/commonjs/js-top/engine/patches/microtasks.js +1 -27
  17. package/lib/commonjs/js-top/engine/patches/promises.js +1 -65
  18. package/lib/commonjs/js-top/engine/patches/timers.js +1 -66
  19. package/lib/commonjs/js-top/engine/state.js +1 -63
  20. package/lib/commonjs/js-top/engine/symbolicate.js +1 -95
  21. package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js +1 -74
  22. package/lib/commonjs/js-top/types/index.js +1 -46
  23. package/lib/commonjs/js-top/utils/preferences.js +1 -31
  24. package/lib/commonjs/preset.js +1 -75
  25. package/lib/module/index.js +1 -49
  26. package/lib/module/js-top/components/BusySparkline.js +1 -52
  27. package/lib/module/js-top/components/JsTopHudOverlay.js +1 -75
  28. package/lib/module/js-top/components/JsTopModal.js +1 -345
  29. package/lib/module/js-top/components/TaskDetailView.js +1 -326
  30. package/lib/module/js-top/components/TaskTable.js +1 -353
  31. package/lib/module/js-top/engine/JsTopController.js +1 -347
  32. package/lib/module/js-top/engine/aggregator.js +1 -136
  33. package/lib/module/js-top/engine/busyProbe.js +1 -94
  34. package/lib/module/js-top/engine/frameStack.js +1 -126
  35. package/lib/module/js-top/engine/longtasks.js +1 -133
  36. package/lib/module/js-top/engine/now.js +1 -33
  37. package/lib/module/js-top/engine/originRegistry.js +1 -388
  38. package/lib/module/js-top/engine/patches/bridge.js +1 -56
  39. package/lib/module/js-top/engine/patches/microtasks.js +1 -23
  40. package/lib/module/js-top/engine/patches/promises.js +1 -62
  41. package/lib/module/js-top/engine/patches/timers.js +1 -62
  42. package/lib/module/js-top/engine/state.js +1 -54
  43. package/lib/module/js-top/engine/symbolicate.js +1 -91
  44. package/lib/module/js-top/sync/jsTopSyncAdapter.js +1 -70
  45. package/lib/module/js-top/types/index.js +1 -42
  46. package/lib/module/js-top/utils/preferences.js +1 -26
  47. package/lib/module/preset.js +1 -71
  48. package/lib/web/index.mjs +2 -3
  49. package/package.json +2 -2
  50. package/lib/commonjs/index.js.map +0 -1
  51. package/lib/commonjs/js-top/components/BusySparkline.js.map +0 -1
  52. package/lib/commonjs/js-top/components/JsTopHudOverlay.js.map +0 -1
  53. package/lib/commonjs/js-top/components/JsTopModal.js.map +0 -1
  54. package/lib/commonjs/js-top/components/TaskDetailView.js.map +0 -1
  55. package/lib/commonjs/js-top/components/TaskTable.js.map +0 -1
  56. package/lib/commonjs/js-top/engine/JsTopController.js.map +0 -1
  57. package/lib/commonjs/js-top/engine/aggregator.js.map +0 -1
  58. package/lib/commonjs/js-top/engine/busyProbe.js.map +0 -1
  59. package/lib/commonjs/js-top/engine/frameStack.js.map +0 -1
  60. package/lib/commonjs/js-top/engine/longtasks.js.map +0 -1
  61. package/lib/commonjs/js-top/engine/now.js.map +0 -1
  62. package/lib/commonjs/js-top/engine/originRegistry.js.map +0 -1
  63. package/lib/commonjs/js-top/engine/patches/bridge.js.map +0 -1
  64. package/lib/commonjs/js-top/engine/patches/microtasks.js.map +0 -1
  65. package/lib/commonjs/js-top/engine/patches/promises.js.map +0 -1
  66. package/lib/commonjs/js-top/engine/patches/timers.js.map +0 -1
  67. package/lib/commonjs/js-top/engine/state.js.map +0 -1
  68. package/lib/commonjs/js-top/engine/symbolicate.js.map +0 -1
  69. package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js.map +0 -1
  70. package/lib/commonjs/js-top/types/index.js.map +0 -1
  71. package/lib/commonjs/js-top/utils/preferences.js.map +0 -1
  72. package/lib/commonjs/preset.js.map +0 -1
  73. package/lib/module/index.js.map +0 -1
  74. package/lib/module/js-top/components/BusySparkline.js.map +0 -1
  75. package/lib/module/js-top/components/JsTopHudOverlay.js.map +0 -1
  76. package/lib/module/js-top/components/JsTopModal.js.map +0 -1
  77. package/lib/module/js-top/components/TaskDetailView.js.map +0 -1
  78. package/lib/module/js-top/components/TaskTable.js.map +0 -1
  79. package/lib/module/js-top/engine/JsTopController.js.map +0 -1
  80. package/lib/module/js-top/engine/aggregator.js.map +0 -1
  81. package/lib/module/js-top/engine/busyProbe.js.map +0 -1
  82. package/lib/module/js-top/engine/frameStack.js.map +0 -1
  83. package/lib/module/js-top/engine/longtasks.js.map +0 -1
  84. package/lib/module/js-top/engine/now.js.map +0 -1
  85. package/lib/module/js-top/engine/originRegistry.js.map +0 -1
  86. package/lib/module/js-top/engine/patches/bridge.js.map +0 -1
  87. package/lib/module/js-top/engine/patches/microtasks.js.map +0 -1
  88. package/lib/module/js-top/engine/patches/promises.js.map +0 -1
  89. package/lib/module/js-top/engine/patches/timers.js.map +0 -1
  90. package/lib/module/js-top/engine/state.js.map +0 -1
  91. package/lib/module/js-top/engine/symbolicate.js.map +0 -1
  92. package/lib/module/js-top/sync/jsTopSyncAdapter.js.map +0 -1
  93. package/lib/module/js-top/types/index.js.map +0 -1
  94. package/lib/module/js-top/utils/preferences.js.map +0 -1
  95. package/lib/module/preset.js.map +0 -1
  96. package/lib/typescript/index.d.ts.map +0 -1
  97. package/lib/typescript/js-top/components/BusySparkline.d.ts.map +0 -1
  98. package/lib/typescript/js-top/components/JsTopHudOverlay.d.ts.map +0 -1
  99. package/lib/typescript/js-top/components/JsTopModal.d.ts.map +0 -1
  100. package/lib/typescript/js-top/components/TaskDetailView.d.ts.map +0 -1
  101. package/lib/typescript/js-top/components/TaskTable.d.ts.map +0 -1
  102. package/lib/typescript/js-top/engine/JsTopController.d.ts.map +0 -1
  103. package/lib/typescript/js-top/engine/aggregator.d.ts.map +0 -1
  104. package/lib/typescript/js-top/engine/busyProbe.d.ts.map +0 -1
  105. package/lib/typescript/js-top/engine/frameStack.d.ts.map +0 -1
  106. package/lib/typescript/js-top/engine/longtasks.d.ts.map +0 -1
  107. package/lib/typescript/js-top/engine/now.d.ts.map +0 -1
  108. package/lib/typescript/js-top/engine/originRegistry.d.ts.map +0 -1
  109. package/lib/typescript/js-top/engine/patches/bridge.d.ts.map +0 -1
  110. package/lib/typescript/js-top/engine/patches/microtasks.d.ts.map +0 -1
  111. package/lib/typescript/js-top/engine/patches/promises.d.ts.map +0 -1
  112. package/lib/typescript/js-top/engine/patches/timers.d.ts.map +0 -1
  113. package/lib/typescript/js-top/engine/state.d.ts.map +0 -1
  114. package/lib/typescript/js-top/engine/symbolicate.d.ts.map +0 -1
  115. package/lib/typescript/js-top/sync/jsTopSyncAdapter.d.ts.map +0 -1
  116. package/lib/typescript/js-top/types/index.d.ts.map +0 -1
  117. package/lib/typescript/js-top/utils/preferences.d.ts.map +0 -1
  118. package/lib/typescript/preset.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,86 +1,27 @@
1
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/buoy/latest/docs/tools/js-top">Docs</a> ·
7
- <a href="https://buoy.gg">buoy.gg</a>
8
- </p>
9
- </div>
10
-
11
- ---
12
2
 
13
- JS Top ranks measured callback time. For example, a task table might look like this (illustrative values):
3
+ # @buoy-gg/js-top
14
4
 
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
- ```
5
+ A live task manager for the React Native JS thread. It ranks which timers, Promise chains and callbacks are using your JS FPS.
22
6
 
23
- - **Pure JavaScript.** No native module, no debugger, no dev client — works in **Expo Go** and even release builds.
24
- - **Capture lifecycle.** 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 probe that estimates 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.
7
+ <a href="https://buoy.gg/buoy/latest/docs/tools/js-top"><b>JS Top guide</b></a> &nbsp;·&nbsp; <a href="https://buoy.gg">buoy.gg</a> &nbsp;·&nbsp; <a href="https://github.com/Buoy-gg/buoy">All tools</a>
27
8
 
28
- ## Install
9
+ [![npm version](https://img.shields.io/npm/v/@buoy-gg/js-top?style=flat-square&labelColor=10302a&color=2a9d78)](https://www.npmjs.com/package/@buoy-gg/js-top) [![npm downloads](https://img.shields.io/npm/dm/@buoy-gg/js-top?style=flat-square&labelColor=10302a&color=2a9d78&label=downloads%2Fmonth)](https://www.npmjs.com/package/@buoy-gg/js-top)
29
10
 
30
- ```bash
31
- npm install @buoy-gg/core @buoy-gg/js-top
32
- ```
11
+ <a href="https://buoy.gg/buoy/latest/docs/tools/js-top"><img src="https://raw.githubusercontent.com/Buoy-gg/buoy/main/.github/readme/tools/js-top.png" alt="Watch the JS Top film on buoy.gg" width="640" /></a>
33
12
 
34
- ## Before you start
13
+ </div>
35
14
 
36
- Use a development build with `@buoy-gg/core` and a Free or Pro Buoy account key. From your app’s directory, sign in:
15
+ ## Install
37
16
 
38
17
  ```bash
39
- npx --package=@buoy-gg/core buoy login
40
- ```
41
-
42
- For Expo, initialize Buoy before rendering the menu:
43
-
44
- ```tsx
45
- import { Buoy } from "@buoy-gg/core";
46
-
47
- Buoy.init({ licenseKey: process.env.EXPO_PUBLIC_BUOY_KEY });
48
- ```
49
-
50
- The login command writes the Expo key to `.env.local`. For React Native CLI, pass the key from your app’s environment configuration; React Native does not load `.env.local` automatically. Mount `FloatingDevTools` inside the same providers as your screens and restart the development server after installation. The [Quick Start](https://buoy.gg/buoy/latest/docs/quick-start) shows the complete root component setup.
51
-
52
- After setup, open JS Top, run a known timer-driven interaction, and inspect the task table. Explicit registration:
53
-
54
- ```tsx
55
- import { FloatingDevTools } from "@buoy-gg/core";
56
- import { jsTopPreset, jsTopModalPreset } from "@buoy-gg/js-top";
57
-
58
- <FloatingDevTools apps={[jsTopModalPreset, jsTopPreset]} />
18
+ npm install @buoy-gg/core @buoy-gg/js-top
59
19
  ```
60
20
 
61
- ## How it works
62
-
63
- You can't sample a blocked JS thread from JS — so JS Top doesn't sample. It wraps supported scheduling entry points (`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` while limiting stack-capture work.
64
-
65
- 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). Work outside wrapped paths, including some async/await continuations and native entry points, can remain unattributed.
66
-
67
- ## Desktop & AI
21
+ JS Top is pure JavaScript with no native module. It only runs while the tool is open or Buoy Desktop is watching.
68
22
 
69
- To connect a React Native app to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) or MCP, install `@buoy-gg/external-sync` and follow the [Desktop connection guide](https://buoy.gg/buoy/latest/docs/desktop). Sign in to Desktop separately. [MCP setup](https://buoy.gg/buoy/latest/docs/mcp) also requires a process account and Pro access. Available remote actions depend on the tool and app integration.
23
+ The [JS Top guide](https://buoy.gg/buoy/latest/docs/tools/js-top) covers setup, what it captures and its limits. New to Buoy? Start with the [Quick start](https://buoy.gg/buoy/latest/docs/quick-start).
70
24
 
71
- ## Remote capabilities
72
-
73
- - The desktop dashboard mirrors the device's task table live, and adds a dev-only **per-function Hermes sampler** (attaches to Metro's inspector).
74
- - Via the Buoy MCP server, your AI agent can call `get_js_thread_top` — "why is JS FPS low?" becomes one tool call.
75
-
76
- ## Account and plan requirements
77
-
78
- Use a Free or Pro Buoy account. History limits and paid features vary by tool; see [pricing](https://buoy.gg/pricing). Production access requires Pro where supported. Development-only hooks and actions remain unavailable in release builds.
79
-
80
- ## License
81
-
82
- Part of [React Buoy](https://buoy.gg). See buoy.gg for licensing.
83
-
84
- ## Web support (unreleased)
25
+ ---
85
26
 
86
- Register this package’s /web namespace in FloatingDevTools modules to use its shared panels and actions in a browser app. The browser build is available in this checkout and has not been published yet. See the [web setup guide](https://buoy.gg/buoy/latest/docs/web-preview) for registration, dependencies, and browser boundaries.
27
+ <sub>Part of <a href="https://buoy.gg">Buoy</a>, developer tools that live inside your app. Proprietary software. © Buoy LLC. <a href="https://buoy.gg/terms">Terms</a></sub>
@@ -1,99 +1 @@
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
- if (typeof window !== "undefined") {
93
- (0, _timers.installTimerPatches)();
94
- (0, _microtasks.installMicrotaskPatches)();
95
- }
96
- } catch {
97
- // Never let instrumentation break an app at import time.
98
- }
99
- //# sourceMappingURL=index.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"JS_TOP_DISABLED_COLOR",{enumerable:true,get:function(){return _preset.JS_TOP_DISABLED_COLOR}});Object.defineProperty(exports,"JS_TOP_ENABLED_COLOR",{enumerable:true,get:function(){return _preset.JS_TOP_ENABLED_COLOR}});Object.defineProperty(exports,"JsTopController",{enumerable:true,get:function(){return _JsTopController.JsTopController}});Object.defineProperty(exports,"JsTopHudOverlay",{enumerable:true,get:function(){return _JsTopHudOverlay.JsTopHudOverlay}});Object.defineProperty(exports,"JsTopModal",{enumerable:true,get:function(){return _JsTopModal.JsTopModal}});Object.defineProperty(exports,"jsTopModalPreset",{enumerable:true,get:function(){return _preset.jsTopModalPreset}});Object.defineProperty(exports,"jsTopPreset",{enumerable:true,get:function(){return _preset.jsTopPreset}});Object.defineProperty(exports,"jsTopSyncAdapter",{enumerable:true,get:function(){return _jsTopSyncAdapter.jsTopSyncAdapter}});var _JsTopController=require("./js-top/engine/JsTopController");var _promises=require("./js-top/engine/patches/promises");var _bridge=require("./js-top/engine/patches/bridge");var _timers=require("./js-top/engine/patches/timers");var _microtasks=require("./js-top/engine/patches/microtasks");var _longtasks=require("./js-top/engine/longtasks");var _jsTopSyncAdapter=require("./js-top/sync/jsTopSyncAdapter");var _JsTopModal=require("./js-top/components/JsTopModal");var _JsTopHudOverlay=require("./js-top/components/JsTopHudOverlay");var _preset=require("./preset");_JsTopController.JsTopController.registerTierInstaller(_promises.installPromisePatches);_JsTopController.JsTopController.registerTierInstaller(_bridge.installBridgePatch);_JsTopController.JsTopController.registerTierInstaller(_longtasks.installLongtaskObserver);_JsTopController.JsTopController.registerLongtaskProvider(_longtasks.getLongtasks);_JsTopController.JsTopController.registerFreezeStatsProvider(_longtasks.getFreezeStats);_JsTopController.JsTopController.registerClearHook(_longtasks.clearLongtasks);try{if(typeof window!=="undefined"){(0,_timers.installTimerPatches)();(0,_microtasks.installMicrotaskPatches)()}}catch{}
@@ -1,56 +1 @@
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
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BusySparkline=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const MAX_POINTS=60;function barColor(e){if(e>=80)return _sharedUi.macOSColors.semantic.error;if(e>=40)return _sharedUi.macOSColors.semantic.warning;return _sharedUi.macOSColors.semantic.success}const BusySparkline=exports.BusySparkline=(0,_react.memo)(function e({history:t}){const i=t.slice(-MAX_POINTS);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.row,pointerEvents:"none",children:i.map((r,a)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.bar,{height:Math.max(2,r/100*28),backgroundColor:barColor(r)}]},`b${a}`))})});const styles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"flex-end",gap:1,height:28,alignSelf:"stretch"},bar:{flex:1,maxWidth:6,borderRadius:1,opacity:.9}});
@@ -1,79 +1 @@
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: _sharedUi.night.color.buttonSurface,
61
- borderWidth: 1,
62
- borderColor: _sharedUi.night.color.border,
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.night.color.textSecondary,
75
- fontSize: 10,
76
- flexShrink: 1
77
- }
78
- });
79
- //# sourceMappingURL=JsTopHudOverlay.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsTopHudOverlay=JsTopHudOverlay;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _JsTopController=require("../engine/JsTopController");var _jsxRuntime=require("react/jsx-runtime");function busyColor(e){if(e>=80)return _sharedUi.macOSColors.semantic.error;if(e>=40)return _sharedUi.macOSColors.semantic.warning;return _sharedUi.macOSColors.semantic.success}function JsTopHudOverlay(){const[e,n]=(0,_react.useState)(()=>_JsTopController.JsTopController.isEnabled());const[r,t]=(0,_react.useState)(null);(0,_react.useEffect)(()=>_JsTopController.JsTopController.subscribeEnabled(n),[]);(0,_react.useEffect)(()=>{if(!e){t(null);return}return _JsTopController.JsTopController.subscribe(t)},[e]);if(!e||!r)return null;const o=r.rows.find(s=>s.api!=="unattributed");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.pill,pointerEvents:"none",children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.busy,{color:busyColor(r.busyPct)}],children:[r.busyPct.toFixed(0),"%"]}),o&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.label,numberOfLines:1,children:o.label})]})}const styles=_reactNative.StyleSheet.create({pill:{position:"absolute",top:60,left:8,flexDirection:"row",alignItems:"center",gap:6,backgroundColor:_sharedUi.night.color.buttonSurface,borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:6,paddingHorizontal:8,paddingVertical:4,maxWidth:220},busy:{fontSize:11,fontWeight:"700",fontVariant:["tabular-nums"]},label:{color:_sharedUi.night.color.textSecondary,fontSize:10,flexShrink:1}});