@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.
- package/README.md +12 -71
- package/lib/commonjs/index.js +1 -99
- package/lib/commonjs/js-top/components/BusySparkline.js +1 -56
- package/lib/commonjs/js-top/components/JsTopHudOverlay.js +1 -79
- package/lib/commonjs/js-top/components/JsTopModal.js +1 -349
- package/lib/commonjs/js-top/components/TaskDetailView.js +1 -330
- package/lib/commonjs/js-top/components/TaskTable.js +1 -360
- package/lib/commonjs/js-top/engine/JsTopController.js +1 -350
- package/lib/commonjs/js-top/engine/aggregator.js +1 -148
- package/lib/commonjs/js-top/engine/busyProbe.js +1 -101
- package/lib/commonjs/js-top/engine/frameStack.js +1 -133
- package/lib/commonjs/js-top/engine/longtasks.js +1 -141
- package/lib/commonjs/js-top/engine/now.js +1 -38
- package/lib/commonjs/js-top/engine/originRegistry.js +1 -402
- package/lib/commonjs/js-top/engine/patches/bridge.js +1 -60
- package/lib/commonjs/js-top/engine/patches/microtasks.js +1 -27
- package/lib/commonjs/js-top/engine/patches/promises.js +1 -65
- package/lib/commonjs/js-top/engine/patches/timers.js +1 -66
- package/lib/commonjs/js-top/engine/state.js +1 -63
- package/lib/commonjs/js-top/engine/symbolicate.js +1 -95
- package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js +1 -74
- package/lib/commonjs/js-top/types/index.js +1 -46
- package/lib/commonjs/js-top/utils/preferences.js +1 -31
- package/lib/commonjs/preset.js +1 -75
- package/lib/module/index.js +1 -49
- package/lib/module/js-top/components/BusySparkline.js +1 -52
- package/lib/module/js-top/components/JsTopHudOverlay.js +1 -75
- package/lib/module/js-top/components/JsTopModal.js +1 -345
- package/lib/module/js-top/components/TaskDetailView.js +1 -326
- package/lib/module/js-top/components/TaskTable.js +1 -353
- package/lib/module/js-top/engine/JsTopController.js +1 -347
- package/lib/module/js-top/engine/aggregator.js +1 -136
- package/lib/module/js-top/engine/busyProbe.js +1 -94
- package/lib/module/js-top/engine/frameStack.js +1 -126
- package/lib/module/js-top/engine/longtasks.js +1 -133
- package/lib/module/js-top/engine/now.js +1 -33
- package/lib/module/js-top/engine/originRegistry.js +1 -388
- package/lib/module/js-top/engine/patches/bridge.js +1 -56
- package/lib/module/js-top/engine/patches/microtasks.js +1 -23
- package/lib/module/js-top/engine/patches/promises.js +1 -62
- package/lib/module/js-top/engine/patches/timers.js +1 -62
- package/lib/module/js-top/engine/state.js +1 -54
- package/lib/module/js-top/engine/symbolicate.js +1 -91
- package/lib/module/js-top/sync/jsTopSyncAdapter.js +1 -70
- package/lib/module/js-top/types/index.js +1 -42
- package/lib/module/js-top/utils/preferences.js +1 -26
- package/lib/module/preset.js +1 -71
- package/lib/web/index.mjs +2 -3
- package/package.json +2 -2
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/js-top/components/BusySparkline.js.map +0 -1
- package/lib/commonjs/js-top/components/JsTopHudOverlay.js.map +0 -1
- package/lib/commonjs/js-top/components/JsTopModal.js.map +0 -1
- package/lib/commonjs/js-top/components/TaskDetailView.js.map +0 -1
- package/lib/commonjs/js-top/components/TaskTable.js.map +0 -1
- package/lib/commonjs/js-top/engine/JsTopController.js.map +0 -1
- package/lib/commonjs/js-top/engine/aggregator.js.map +0 -1
- package/lib/commonjs/js-top/engine/busyProbe.js.map +0 -1
- package/lib/commonjs/js-top/engine/frameStack.js.map +0 -1
- package/lib/commonjs/js-top/engine/longtasks.js.map +0 -1
- package/lib/commonjs/js-top/engine/now.js.map +0 -1
- package/lib/commonjs/js-top/engine/originRegistry.js.map +0 -1
- package/lib/commonjs/js-top/engine/patches/bridge.js.map +0 -1
- package/lib/commonjs/js-top/engine/patches/microtasks.js.map +0 -1
- package/lib/commonjs/js-top/engine/patches/promises.js.map +0 -1
- package/lib/commonjs/js-top/engine/patches/timers.js.map +0 -1
- package/lib/commonjs/js-top/engine/state.js.map +0 -1
- package/lib/commonjs/js-top/engine/symbolicate.js.map +0 -1
- package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js.map +0 -1
- package/lib/commonjs/js-top/types/index.js.map +0 -1
- package/lib/commonjs/js-top/utils/preferences.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/js-top/components/BusySparkline.js.map +0 -1
- package/lib/module/js-top/components/JsTopHudOverlay.js.map +0 -1
- package/lib/module/js-top/components/JsTopModal.js.map +0 -1
- package/lib/module/js-top/components/TaskDetailView.js.map +0 -1
- package/lib/module/js-top/components/TaskTable.js.map +0 -1
- package/lib/module/js-top/engine/JsTopController.js.map +0 -1
- package/lib/module/js-top/engine/aggregator.js.map +0 -1
- package/lib/module/js-top/engine/busyProbe.js.map +0 -1
- package/lib/module/js-top/engine/frameStack.js.map +0 -1
- package/lib/module/js-top/engine/longtasks.js.map +0 -1
- package/lib/module/js-top/engine/now.js.map +0 -1
- package/lib/module/js-top/engine/originRegistry.js.map +0 -1
- package/lib/module/js-top/engine/patches/bridge.js.map +0 -1
- package/lib/module/js-top/engine/patches/microtasks.js.map +0 -1
- package/lib/module/js-top/engine/patches/promises.js.map +0 -1
- package/lib/module/js-top/engine/patches/timers.js.map +0 -1
- package/lib/module/js-top/engine/state.js.map +0 -1
- package/lib/module/js-top/engine/symbolicate.js.map +0 -1
- package/lib/module/js-top/sync/jsTopSyncAdapter.js.map +0 -1
- package/lib/module/js-top/types/index.js.map +0 -1
- package/lib/module/js-top/utils/preferences.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/js-top/components/BusySparkline.d.ts.map +0 -1
- package/lib/typescript/js-top/components/JsTopHudOverlay.d.ts.map +0 -1
- package/lib/typescript/js-top/components/JsTopModal.d.ts.map +0 -1
- package/lib/typescript/js-top/components/TaskDetailView.d.ts.map +0 -1
- package/lib/typescript/js-top/components/TaskTable.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/JsTopController.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/aggregator.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/busyProbe.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/frameStack.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/longtasks.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/now.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/originRegistry.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/patches/bridge.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/patches/microtasks.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/patches/promises.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/patches/timers.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/state.d.ts.map +0 -1
- package/lib/typescript/js-top/engine/symbolicate.d.ts.map +0 -1
- package/lib/typescript/js-top/sync/jsTopSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/js-top/types/index.d.ts.map +0 -1
- package/lib/typescript/js-top/utils/preferences.d.ts.map +0 -1
- 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
|
-
|
|
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
|
-
-
|
|
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> · <a href="https://buoy.gg">buoy.gg</a> · <a href="https://github.com/Buoy-gg/buoy">All tools</a>
|
|
27
8
|
|
|
28
|
-
|
|
9
|
+
[](https://www.npmjs.com/package/@buoy-gg/js-top) [](https://www.npmjs.com/package/@buoy-gg/js-top)
|
|
29
10
|
|
|
30
|
-
|
|
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
|
-
|
|
13
|
+
</div>
|
|
35
14
|
|
|
36
|
-
|
|
15
|
+
## Install
|
|
37
16
|
|
|
38
17
|
```bash
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>
|
package/lib/commonjs/index.js
CHANGED
|
@@ -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}});
|