@zkmake/three-meter 0.11.5 → 0.11.6
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/dist/index.d.ts +1 -5
- package/dist/index.js +2 -3
- package/dist/{mount-perf-hud-MTPYNhG9.d.ts → mount-perf-hud-C7CzkVqM.d.ts} +2 -14
- package/dist/{mount-perf-hud-Cu7Jjwmm.js → mount-perf-hud-DezuAiPb.js} +19 -34
- package/dist/mount-perf-hud-DezuAiPb.js.map +1 -0
- package/dist/{performance-monitor-BqnoiLEs.js → performance-monitor-CKAI0-Dp.js} +6 -11
- package/dist/{performance-monitor-BqnoiLEs.js.map → performance-monitor-CKAI0-Dp.js.map} +1 -1
- package/dist/{performance-monitor-BoY_-GTt.d.ts → performance-monitor-CrYmNIdv.d.ts} +1 -5
- package/dist/react.d.ts +2 -8
- package/dist/react.js +5 -8
- package/dist/react.js.map +1 -1
- package/dist/ui.d.ts +2 -8
- package/dist/ui.js +1 -2
- package/package.json +1 -1
- package/dist/mount-perf-hud-Cu7Jjwmm.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as GpuTiming, c as RenderBackend, d as Sample, f as SceneCost, i as FrameStats, l as RenderCounts, n as CostEntry, o as PerfRenderer, p as TimingMetric, r as Environment, s as PerformanceMonitorOptions, t as PerformanceMonitor, u as ResourceCounts } from "./performance-monitor-
|
|
2
|
-
//#region src/core/ring-buffer.d.ts
|
|
1
|
+
import { a as GpuTiming, c as RenderBackend, d as Sample, f as SceneCost, i as FrameStats, l as RenderCounts, n as CostEntry, o as PerfRenderer, p as TimingMetric, r as Environment, s as PerformanceMonitorOptions, t as PerformanceMonitor, u as ResourceCounts } from "./performance-monitor-CrYmNIdv.js";
|
|
3
2
|
/**
|
|
4
3
|
* Fixed-capacity numeric ring buffer. Backs the per-frame timing history the
|
|
5
4
|
* view reads to draw sparklines. Push is O(1); `toArray()` returns values in
|
|
@@ -16,8 +15,6 @@ declare class RingBuffer {
|
|
|
16
15
|
toArray(): number[];
|
|
17
16
|
clear(): void;
|
|
18
17
|
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/core/wrap-animation-loop.d.ts
|
|
21
18
|
type AnimationLoop<Args extends unknown[]> = (...args: Args) => void;
|
|
22
19
|
/**
|
|
23
20
|
* Wrap a `renderer.setAnimationLoop` callback so each tick is one frame:
|
|
@@ -31,6 +28,5 @@ type AnimationLoop<Args extends unknown[]> = (...args: Args) => void;
|
|
|
31
28
|
* ```
|
|
32
29
|
*/
|
|
33
30
|
declare function wrapAnimationLoop<Args extends unknown[]>(monitor: PerformanceMonitor, loop: AnimationLoop<Args>): AnimationLoop<Args>;
|
|
34
|
-
//#endregion
|
|
35
31
|
export { type CostEntry, type Environment, type FrameStats, type GpuTiming, type PerfRenderer, PerformanceMonitor, type PerformanceMonitorOptions, type RenderBackend, type RenderCounts, type ResourceCounts, RingBuffer, type Sample, type SceneCost, type TimingMetric, wrapAnimationLoop };
|
|
36
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as RingBuffer, t as PerformanceMonitor } from "./performance-monitor-
|
|
2
|
-
|
|
1
|
+
import { n as RingBuffer, t as PerformanceMonitor } from "./performance-monitor-CKAI0-Dp.js";
|
|
2
|
+
// src/core/wrap-animation-loop.ts
|
|
3
3
|
/**
|
|
4
4
|
* Wrap a `renderer.setAnimationLoop` callback so each tick is one frame:
|
|
5
5
|
* `begin()` before your code, `end()` after it returns. CPU time is your
|
|
@@ -21,7 +21,6 @@ function wrapAnimationLoop(monitor, loop) {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { PerformanceMonitor, RingBuffer, wrapAnimationLoop };
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { p as TimingMetric, t as PerformanceMonitor } from "./performance-monitor-
|
|
2
|
-
//#region src/ui/budgets.d.ts
|
|
1
|
+
import { p as TimingMetric, t as PerformanceMonitor } from "./performance-monitor-CrYmNIdv.js";
|
|
3
2
|
/**
|
|
4
3
|
* Budgets: the value each metric should stay within. A reading past its
|
|
5
4
|
* budget turns amber in the card, and the FPS / CPU / GPU graphs draw the
|
|
@@ -27,8 +26,6 @@ type ResolvedBudgets = {
|
|
|
27
26
|
};
|
|
28
27
|
/** `detectedHz` is the monitor's refresh reading; an explicit `targetFps` wins over it. */
|
|
29
28
|
declare const resolveBudgets: (budgets: Budgets | false | undefined, detectedHz?: number | null) => ResolvedBudgets;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/ui/dock-panel.d.ts
|
|
32
29
|
declare const EDGES: readonly ["left", "right", "top", "bottom"];
|
|
33
30
|
type ScreenEdge = (typeof EDGES)[number];
|
|
34
31
|
type Placement = {
|
|
@@ -60,8 +57,6 @@ type DockHandle = {
|
|
|
60
57
|
* snap to the nearest edge when the handle drops.
|
|
61
58
|
*/
|
|
62
59
|
declare const dockPanel: (element: HTMLElement, options?: DockPanelOptions) => DockHandle;
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/ui/theme.d.ts
|
|
65
60
|
/**
|
|
66
61
|
* Dark, light, or follow the OS. One instance per HUD: the floating host and
|
|
67
62
|
* the card inside it both paint `resolved` onto `data-theme`, and the
|
|
@@ -106,8 +101,6 @@ declare class HudTheme {
|
|
|
106
101
|
private unwatch;
|
|
107
102
|
private notify;
|
|
108
103
|
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/ui/hud-settings.d.ts
|
|
111
104
|
type HudSelection = {
|
|
112
105
|
dim: boolean;
|
|
113
106
|
graphs: ReadonlySet<TimingMetric>;
|
|
@@ -151,8 +144,6 @@ declare class HudSettings {
|
|
|
151
144
|
private load;
|
|
152
145
|
private persistAndNotify;
|
|
153
146
|
}
|
|
154
|
-
//#endregion
|
|
155
|
-
//#region src/ui/performance-view.d.ts
|
|
156
147
|
type PerformanceViewMode = "full" | "compact";
|
|
157
148
|
type PerformanceViewOptions = {
|
|
158
149
|
monitor: PerformanceMonitor;
|
|
@@ -266,8 +257,6 @@ declare class PerformanceView {
|
|
|
266
257
|
private applyModeClass;
|
|
267
258
|
private resizeCanvases;
|
|
268
259
|
}
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region src/ui/mount-perf-hud.d.ts
|
|
271
260
|
type MountPerfHudOptions = {
|
|
272
261
|
/** Start compact (the card) or full (the checkbox list). Default `compact`. */
|
|
273
262
|
mode?: PerformanceViewMode;
|
|
@@ -319,6 +308,5 @@ type PerfHudHandle = {
|
|
|
319
308
|
dispose: () => void;
|
|
320
309
|
};
|
|
321
310
|
declare const mountPerfHud: (monitor: PerformanceMonitor, options?: MountPerfHudOptions) => PerfHudHandle;
|
|
322
|
-
//#endregion
|
|
323
311
|
export { dockPanel as C, resolveBudgets as D, ResolvedBudgets as E, ScreenEdge as S, Budgets as T, DefaultPlacement as _, PerformanceViewMode as a, DockPanelOptions as b, HudDefaults as c, HudSettingsOptions as d, HudTheme as f, isThemeMode as g, ThemeMode as h, PerformanceView as i, HudSelection as l, THEME_MODES as m, PerfHudHandle as n, PerformanceViewOptions as o, ResolvedTheme as p, mountPerfHud as r, DEFAULT_STORAGE_KEY as s, MountPerfHudOptions as t, HudSettings as u, DockAlign as v, BudgetKey as w, Placement as x, DockHandle as y };
|
|
324
|
-
//# sourceMappingURL=mount-perf-hud-
|
|
312
|
+
//# sourceMappingURL=mount-perf-hud-C7CzkVqM.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ui/budgets.ts
|
|
2
2
|
const DEFAULT_TARGET_FPS = 60;
|
|
3
3
|
const FLOORS = /* @__PURE__ */ new Set([
|
|
4
4
|
"fps",
|
|
@@ -38,8 +38,7 @@ const isOverBudget = (resolved, key, value) => {
|
|
|
38
38
|
if (limit === void 0 || value === null) return false;
|
|
39
39
|
return isFloor(key) ? value < limit : value > limit;
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
//#region src/ui/theme.ts
|
|
41
|
+
// src/ui/theme.ts
|
|
43
42
|
const THEME_MODES = [
|
|
44
43
|
"dark",
|
|
45
44
|
"light",
|
|
@@ -125,8 +124,7 @@ var HudTheme = class {
|
|
|
125
124
|
const applyTheme = (element, theme) => {
|
|
126
125
|
element.dataset.theme = theme.resolved;
|
|
127
126
|
};
|
|
128
|
-
|
|
129
|
-
//#region src/ui/hud-settings.ts
|
|
127
|
+
// src/ui/hud-settings.ts
|
|
130
128
|
const DEFAULT_STORAGE_KEY = "three-meter";
|
|
131
129
|
const DEFAULT_DIM = false;
|
|
132
130
|
const DEFAULT_INFO = false;
|
|
@@ -242,8 +240,7 @@ var HudSettings = class {
|
|
|
242
240
|
for (const listener of this.listeners) listener();
|
|
243
241
|
}
|
|
244
242
|
};
|
|
245
|
-
|
|
246
|
-
//#region src/ui/dock-panel.ts
|
|
243
|
+
// src/ui/dock-panel.ts
|
|
247
244
|
/**
|
|
248
245
|
* Dock a fixed-position panel to a screen edge. Dragging the handle snaps it
|
|
249
246
|
* to the nearest edge on drop; the edge and the offset along it persist under
|
|
@@ -458,8 +455,7 @@ const dockPanel = (element, options = {}) => {
|
|
|
458
455
|
refresh: apply
|
|
459
456
|
};
|
|
460
457
|
};
|
|
461
|
-
|
|
462
|
-
//#region src/ui/icons.ts
|
|
458
|
+
// src/ui/icons.ts
|
|
463
459
|
const ICON_MARKUP = {
|
|
464
460
|
eye: "<path d=\"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>",
|
|
465
461
|
eyeOff: "<path d=\"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\"/><path d=\"M14.084 14.158a3 3 0 0 1-4.242-4.242\"/><path d=\"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\"/><path d=\"m2 2 20 20\"/>",
|
|
@@ -503,8 +499,7 @@ const createIcon = (name, className) => {
|
|
|
503
499
|
svg.innerHTML = ICON_MARKUP[name];
|
|
504
500
|
return svg;
|
|
505
501
|
};
|
|
506
|
-
|
|
507
|
-
//#region src/ui/styles.ts
|
|
502
|
+
// src/ui/styles.ts
|
|
508
503
|
/**
|
|
509
504
|
* The HUD stylesheet as a string, so the package works without a bundler and
|
|
510
505
|
* injects itself once per document. `.perf-monitor` is the metrics card,
|
|
@@ -1245,8 +1240,7 @@ const injectStyles = (target = document) => {
|
|
|
1245
1240
|
style.textContent = PERF_HUD_STYLES;
|
|
1246
1241
|
target.head.append(style);
|
|
1247
1242
|
};
|
|
1248
|
-
|
|
1249
|
-
//#region src/ui/dev-panel.ts
|
|
1243
|
+
// src/ui/dev-panel.ts
|
|
1250
1244
|
/**
|
|
1251
1245
|
* The frame every zkmake dev panel shares, so they look and handle alike: a fixed host docked to a
|
|
1252
1246
|
* screen edge, a card with a brand label on top and the panel's content under it, and three discs
|
|
@@ -1294,6 +1288,7 @@ const mountDevPanel = (options) => {
|
|
|
1294
1288
|
const host = document.createElement("div");
|
|
1295
1289
|
host.className = "perf-hud";
|
|
1296
1290
|
host.dataset.edge = "left";
|
|
1291
|
+
host.setAttribute("role", "group");
|
|
1297
1292
|
host.setAttribute("aria-label", options.label);
|
|
1298
1293
|
const hotspot = document.createElement("div");
|
|
1299
1294
|
hotspot.className = "perf-hud__hotspot";
|
|
@@ -1393,12 +1388,10 @@ const mountDevPanel = (options) => {
|
|
|
1393
1388
|
}
|
|
1394
1389
|
};
|
|
1395
1390
|
};
|
|
1396
|
-
|
|
1397
|
-
//#region package.json
|
|
1391
|
+
// package.json
|
|
1398
1392
|
var name = "@zkmake/three-meter";
|
|
1399
|
-
var version = "0.11.
|
|
1400
|
-
|
|
1401
|
-
//#region src/ui/clipboard.ts
|
|
1393
|
+
var version = "0.11.6";
|
|
1394
|
+
// src/ui/clipboard.ts
|
|
1402
1395
|
/**
|
|
1403
1396
|
* Copy text from a click handler. The async Clipboard API needs a secure
|
|
1404
1397
|
* context and the `clipboard-write` permission; a dev server opened over a LAN
|
|
@@ -1432,8 +1425,7 @@ const copyText = async (text) => {
|
|
|
1432
1425
|
return copyWithSelection(text);
|
|
1433
1426
|
}
|
|
1434
1427
|
};
|
|
1435
|
-
|
|
1436
|
-
//#region src/ui/format.ts
|
|
1428
|
+
// src/ui/format.ts
|
|
1437
1429
|
/**
|
|
1438
1430
|
* Number formatting for the card. Counts stay exact with thousands separators
|
|
1439
1431
|
* while they fit the compact grid's 6ch value column (`99,999`), then switch
|
|
@@ -1447,8 +1439,7 @@ const compact = new Intl.NumberFormat("en-US", {
|
|
|
1447
1439
|
notation: "compact"
|
|
1448
1440
|
});
|
|
1449
1441
|
const formatCount = (value) => Math.abs(value) < COMPACT_FROM ? exact.format(value) : compact.format(value);
|
|
1450
|
-
|
|
1451
|
-
//#region src/ui/hider.ts
|
|
1442
|
+
// src/ui/hider.ts
|
|
1452
1443
|
var Hider = class {
|
|
1453
1444
|
groups = /* @__PURE__ */ new Map();
|
|
1454
1445
|
/** Each hidden object's `visible` from before the first group hid it. */
|
|
@@ -1486,8 +1477,7 @@ var Hider = class {
|
|
|
1486
1477
|
return false;
|
|
1487
1478
|
}
|
|
1488
1479
|
};
|
|
1489
|
-
|
|
1490
|
-
//#region src/ui/metric-help.ts
|
|
1480
|
+
// src/ui/metric-help.ts
|
|
1491
1481
|
/**
|
|
1492
1482
|
* One plain-language line per metric: what it is, and what a bad reading
|
|
1493
1483
|
* means. Shown as the label's tooltip and, with "explain metrics" on, under
|
|
@@ -1511,8 +1501,7 @@ const METRIC_HELP = {
|
|
|
1511
1501
|
textures: "Textures held in GPU memory. Should level off; a steady climb is a leak, so dispose() what you remove.",
|
|
1512
1502
|
triangles: "Triangles drawn this frame. Mostly GPU cost: use lower-poly models or level of detail to cut it."
|
|
1513
1503
|
};
|
|
1514
|
-
|
|
1515
|
-
//#region src/ui/report.ts
|
|
1504
|
+
// src/ui/report.ts
|
|
1516
1505
|
/**
|
|
1517
1506
|
* A plain-text snapshot of the monitor for bug reports: versions, backend and
|
|
1518
1507
|
* GPU, the current sample, stutter stats, the scene's top meshes and the page. Fenced as a `text`
|
|
@@ -1594,8 +1583,7 @@ const formatReport = (monitor) => renderReport({
|
|
|
1594
1583
|
sample: monitor.getSample(),
|
|
1595
1584
|
stats: monitor.getFrameStats()
|
|
1596
1585
|
});
|
|
1597
|
-
|
|
1598
|
-
//#region src/ui/sparkline.ts
|
|
1586
|
+
// src/ui/sparkline.ts
|
|
1599
1587
|
function drawSparkline(ctx, width, height, values, style, guide) {
|
|
1600
1588
|
ctx.clearRect(0, 0, width, height);
|
|
1601
1589
|
if (values.length < 2) return;
|
|
@@ -1627,8 +1615,7 @@ function drawSparkline(ctx, width, height, values, style, guide) {
|
|
|
1627
1615
|
ctx.restore();
|
|
1628
1616
|
}
|
|
1629
1617
|
}
|
|
1630
|
-
|
|
1631
|
-
//#region src/ui/performance-view.ts
|
|
1618
|
+
// src/ui/performance-view.ts
|
|
1632
1619
|
const TIMINGS = [
|
|
1633
1620
|
{
|
|
1634
1621
|
format: (value) => Math.round(value).toString(),
|
|
@@ -2496,8 +2483,7 @@ var PerformanceView = class {
|
|
|
2496
2483
|
sizeAll(this.hudGraphs.values());
|
|
2497
2484
|
}
|
|
2498
2485
|
};
|
|
2499
|
-
|
|
2500
|
-
//#region src/ui/mount-perf-hud.ts
|
|
2486
|
+
// src/ui/mount-perf-hud.ts
|
|
2501
2487
|
const mountPerfHud = (monitor, options = {}) => {
|
|
2502
2488
|
const storageKey = options.storageKey === void 0 ? DEFAULT_STORAGE_KEY : options.storageKey;
|
|
2503
2489
|
const settings = options.settings ?? new HudSettings({ storageKey });
|
|
@@ -2555,7 +2541,6 @@ const mountPerfHud = (monitor, options = {}) => {
|
|
|
2555
2541
|
view
|
|
2556
2542
|
};
|
|
2557
2543
|
};
|
|
2558
|
-
//#endregion
|
|
2559
2544
|
export { PERF_HUD_STYLES as a, DEFAULT_STORAGE_KEY as c, THEME_MODES as d, isThemeMode as f, mountDevPanel as i, HudSettings as l, PerformanceView as n, injectStyles as o, resolveBudgets as p, formatReport as r, dockPanel as s, mountPerfHud as t, HudTheme as u };
|
|
2560
2545
|
|
|
2561
|
-
//# sourceMappingURL=mount-perf-hud-
|
|
2546
|
+
//# sourceMappingURL=mount-perf-hud-DezuAiPb.js.map
|