@three-flatland/devtools 0.1.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/buffers-modal.cjs +491 -0
- package/dist/buffers-modal.cjs.map +1 -0
- package/dist/buffers-modal.d.cts +62 -0
- package/dist/buffers-modal.d.ts +62 -0
- package/dist/buffers-modal.js +467 -0
- package/dist/buffers-modal.js.map +1 -0
- package/dist/buffers-view.cjs +269 -0
- package/dist/buffers-view.cjs.map +1 -0
- package/dist/buffers-view.d.cts +39 -0
- package/dist/buffers-view.d.ts +39 -0
- package/dist/buffers-view.js +245 -0
- package/dist/buffers-view.js.map +1 -0
- package/dist/create-pane.cjs +203 -0
- package/dist/create-pane.cjs.map +1 -0
- package/dist/create-pane.d.cts +66 -0
- package/dist/create-pane.d.ts +66 -0
- package/dist/create-pane.js +178 -0
- package/dist/create-pane.js.map +1 -0
- package/dist/dashboard/app.tsx +42 -0
- package/dist/dashboard/client.ts +21 -0
- package/dist/dashboard/export.ts +84 -0
- package/dist/dashboard/hooks.ts +75 -0
- package/dist/dashboard/index.html +1149 -0
- package/dist/dashboard/index.tsx +18 -0
- package/dist/dashboard/panels/batches.tsx +282 -0
- package/dist/dashboard/panels/buffers.tsx +425 -0
- package/dist/dashboard/panels/env.tsx +85 -0
- package/dist/dashboard/panels/header-stats.tsx +30 -0
- package/dist/dashboard/panels/producer-select.tsx +81 -0
- package/dist/dashboard/panels/protocol-log.tsx +743 -0
- package/dist/dashboard/panels/registry.tsx +642 -0
- package/dist/dashboard/panels/stats.tsx +431 -0
- package/dist/dashboard/protocol-store.ts +312 -0
- package/dist/dashboard/tsconfig.json +19 -0
- package/dist/dashboard/vendor/hooks.module.js +1 -0
- package/dist/dashboard/vendor/jsx-runtime.js +22 -0
- package/dist/dashboard/vendor/preact.module.js +12 -0
- package/dist/devtools-client.cjs +870 -0
- package/dist/devtools-client.cjs.map +1 -0
- package/dist/devtools-client.d.cts +362 -0
- package/dist/devtools-client.d.ts +362 -0
- package/dist/devtools-client.js +852 -0
- package/dist/devtools-client.js.map +1 -0
- package/dist/index.cjs +42 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/perf-trace.cjs +103 -0
- package/dist/perf-trace.cjs.map +1 -0
- package/dist/perf-trace.d.cts +27 -0
- package/dist/perf-trace.d.ts +27 -0
- package/dist/perf-trace.js +79 -0
- package/dist/perf-trace.js.map +1 -0
- package/dist/plugins.cjs +44 -0
- package/dist/plugins.cjs.map +1 -0
- package/dist/plugins.d.cts +7 -0
- package/dist/plugins.d.ts +7 -0
- package/dist/plugins.js +9 -0
- package/dist/plugins.js.map +1 -0
- package/dist/provider-switcher.cjs +95 -0
- package/dist/provider-switcher.cjs.map +1 -0
- package/dist/provider-switcher.d.cts +18 -0
- package/dist/provider-switcher.d.ts +18 -0
- package/dist/provider-switcher.js +71 -0
- package/dist/provider-switcher.js.map +1 -0
- package/dist/react/devtools-provider.cjs +59 -0
- package/dist/react/devtools-provider.cjs.map +1 -0
- package/dist/react/devtools-provider.d.cts +39 -0
- package/dist/react/devtools-provider.d.ts +39 -0
- package/dist/react/devtools-provider.js +38 -0
- package/dist/react/devtools-provider.js.map +1 -0
- package/dist/react/use-fps-graph.cjs +49 -0
- package/dist/react/use-fps-graph.cjs.map +1 -0
- package/dist/react/use-fps-graph.d.cts +15 -0
- package/dist/react/use-fps-graph.d.ts +15 -0
- package/dist/react/use-fps-graph.js +25 -0
- package/dist/react/use-fps-graph.js.map +1 -0
- package/dist/react/use-pane-button.cjs +58 -0
- package/dist/react/use-pane-button.cjs.map +1 -0
- package/dist/react/use-pane-button.d.cts +10 -0
- package/dist/react/use-pane-button.d.ts +10 -0
- package/dist/react/use-pane-button.js +34 -0
- package/dist/react/use-pane-button.js.map +1 -0
- package/dist/react/use-pane-folder.cjs +48 -0
- package/dist/react/use-pane-folder.cjs.map +1 -0
- package/dist/react/use-pane-folder.d.cts +15 -0
- package/dist/react/use-pane-folder.d.ts +15 -0
- package/dist/react/use-pane-folder.js +24 -0
- package/dist/react/use-pane-folder.js.map +1 -0
- package/dist/react/use-pane-input.cjs +70 -0
- package/dist/react/use-pane-input.cjs.map +1 -0
- package/dist/react/use-pane-input.d.cts +44 -0
- package/dist/react/use-pane-input.d.ts +44 -0
- package/dist/react/use-pane-input.js +46 -0
- package/dist/react/use-pane-input.js.map +1 -0
- package/dist/react/use-pane-radio-grid.cjs +78 -0
- package/dist/react/use-pane-radio-grid.cjs.map +1 -0
- package/dist/react/use-pane-radio-grid.d.cts +35 -0
- package/dist/react/use-pane-radio-grid.d.ts +35 -0
- package/dist/react/use-pane-radio-grid.js +54 -0
- package/dist/react/use-pane-radio-grid.js.map +1 -0
- package/dist/react/use-pane.cjs +45 -0
- package/dist/react/use-pane.cjs.map +1 -0
- package/dist/react/use-pane.d.cts +40 -0
- package/dist/react/use-pane.d.ts +40 -0
- package/dist/react/use-pane.js +21 -0
- package/dist/react/use-pane.js.map +1 -0
- package/dist/react.cjs +50 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +12 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.js +19 -0
- package/dist/react.js.map +1 -0
- package/dist/registry-view.cjs +371 -0
- package/dist/registry-view.cjs.map +1 -0
- package/dist/registry-view.d.cts +24 -0
- package/dist/registry-view.d.ts +24 -0
- package/dist/registry-view.js +347 -0
- package/dist/registry-view.js.map +1 -0
- package/dist/stats-graph.cjs +297 -0
- package/dist/stats-graph.cjs.map +1 -0
- package/dist/stats-graph.d.cts +40 -0
- package/dist/stats-graph.d.ts +40 -0
- package/dist/stats-graph.js +273 -0
- package/dist/stats-graph.js.map +1 -0
- package/dist/stats-row.cjs +153 -0
- package/dist/stats-row.cjs.map +1 -0
- package/dist/stats-row.d.cts +24 -0
- package/dist/stats-row.d.ts +24 -0
- package/dist/stats-row.js +129 -0
- package/dist/stats-row.js.map +1 -0
- package/dist/theme.cjs +260 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +10 -0
- package/dist/theme.d.ts +10 -0
- package/dist/theme.js +235 -0
- package/dist/theme.js.map +1 -0
- package/dist/vite-plugin.cjs +113 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.cts +9 -0
- package/dist/vite-plugin.d.ts +9 -0
- package/dist/vite-plugin.js +88 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var use_pane_exports = {};
|
|
20
|
+
__export(use_pane_exports, {
|
|
21
|
+
usePane: () => usePane
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_pane_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_create_pane = require("../create-pane.js");
|
|
26
|
+
function usePane(options = {}) {
|
|
27
|
+
const [bundle, setBundle] = (0, import_react.useState)(() => (0, import_create_pane.createPane)(options));
|
|
28
|
+
const getOptions = (0, import_react.useEffectEvent)(() => options);
|
|
29
|
+
(0, import_react.useEffect)(() => {
|
|
30
|
+
if (bundle.disposed) {
|
|
31
|
+
setBundle((0, import_create_pane.createPane)(getOptions()));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
(0, import_create_pane.claimPane)(bundle);
|
|
35
|
+
return () => {
|
|
36
|
+
bundle.pane.dispose();
|
|
37
|
+
};
|
|
38
|
+
}, [bundle]);
|
|
39
|
+
return bundle;
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
usePane
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=use-pane.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/use-pane.ts"],"sourcesContent":["import { useEffect, useEffectEvent, useState } from 'react'\nimport { claimPane, createPane } from '../create-pane.js'\nimport type { CreatePaneOptions, PaneBundle } from '../create-pane.js'\n\n/**\n * Create a themed Tweakpane instance. Disposes on unmount, recreates on\n * remount. Returns a `PaneBundle` whose identity changes if React tears\n * the component down and rebuilds it (StrictMode, parent remount,\n * Suspense). Child hooks that depend on the pane (`usePaneFolder`,\n * `usePaneInput`) re-bind when this happens.\n *\n * Lifecycle:\n * - Render: lazy-creates the bundle into a ref so it's available\n * synchronously on first paint. Render runs twice in StrictMode but\n * the ref guard prevents double-creation. Orphans from aborted\n * concurrent renders are reclaimed by `createPane`'s unclaimed-slot\n * mechanism.\n * - Effect: claims the bundle so unrelated `createPane` calls won't\n * dispose it; cleanup disposes the pane unconditionally.\n * - Effect re-mount (StrictMode or true remount): the bundle in the\n * ref is now `disposed`, so we create a fresh one and `force()` a\n * re-render so consumers receive the new identity.\n *\n * Uses `driver: 'raf'` so the stats graph self-ticks via its own\n * `requestAnimationFrame` loop. This makes `usePane` work regardless\n * of whether it's called inside or outside R3F's `<Canvas>` context.\n *\n * @param options - Same {@link CreatePaneOptions} as `createPane`.\n * @returns A {@link PaneBundle}; its identity changes across teardown and\n * rebuild so dependent hooks (`usePaneFolder`, `usePaneInput`) re-bind.\n *\n * @example\n * ```tsx\n * const { pane } = usePane()\n * const folder = usePaneFolder(pane, 'Settings')\n * const [speed] = usePaneInput(folder, 'speed', 1, { min: 0, max: 10 })\n * ```\n */\nexport function usePane(options: CreatePaneOptions = {}): PaneBundle {\n // Lazy initializer creates the bundle once, synchronously on first\n // render, so it's available for first paint. StrictMode's double-invoke\n // is absorbed by createPane's unclaimed-slot orphan disposal.\n const [bundle, setBundle] = useState(() => createPane(options))\n\n // Latest options read non-reactively when a disposed bundle is rebuilt.\n const getOptions = useEffectEvent(() => options)\n\n useEffect(() => {\n if (bundle.disposed) {\n setBundle(createPane(getOptions()))\n return\n }\n claimPane(bundle)\n return () => {\n bundle.pane.dispose()\n }\n }, [bundle])\n\n return bundle\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoD;AACpD,yBAAsC;AAqC/B,SAAS,QAAQ,UAA6B,CAAC,GAAe;AAInE,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,UAAM,+BAAW,OAAO,CAAC;AAG9D,QAAM,iBAAa,6BAAe,MAAM,OAAO;AAE/C,8BAAU,MAAM;AACd,QAAI,OAAO,UAAU;AACnB,oBAAU,+BAAW,WAAW,CAAC,CAAC;AAClC;AAAA,IACF;AACA,sCAAU,MAAM;AAChB,WAAO,MAAM;AACX,aAAO,KAAK,QAAQ;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CreatePaneOptions, PaneBundle } from '../create-pane.cjs';
|
|
2
|
+
import 'tweakpane';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create a themed Tweakpane instance. Disposes on unmount, recreates on
|
|
6
|
+
* remount. Returns a `PaneBundle` whose identity changes if React tears
|
|
7
|
+
* the component down and rebuilds it (StrictMode, parent remount,
|
|
8
|
+
* Suspense). Child hooks that depend on the pane (`usePaneFolder`,
|
|
9
|
+
* `usePaneInput`) re-bind when this happens.
|
|
10
|
+
*
|
|
11
|
+
* Lifecycle:
|
|
12
|
+
* - Render: lazy-creates the bundle into a ref so it's available
|
|
13
|
+
* synchronously on first paint. Render runs twice in StrictMode but
|
|
14
|
+
* the ref guard prevents double-creation. Orphans from aborted
|
|
15
|
+
* concurrent renders are reclaimed by `createPane`'s unclaimed-slot
|
|
16
|
+
* mechanism.
|
|
17
|
+
* - Effect: claims the bundle so unrelated `createPane` calls won't
|
|
18
|
+
* dispose it; cleanup disposes the pane unconditionally.
|
|
19
|
+
* - Effect re-mount (StrictMode or true remount): the bundle in the
|
|
20
|
+
* ref is now `disposed`, so we create a fresh one and `force()` a
|
|
21
|
+
* re-render so consumers receive the new identity.
|
|
22
|
+
*
|
|
23
|
+
* Uses `driver: 'raf'` so the stats graph self-ticks via its own
|
|
24
|
+
* `requestAnimationFrame` loop. This makes `usePane` work regardless
|
|
25
|
+
* of whether it's called inside or outside R3F's `<Canvas>` context.
|
|
26
|
+
*
|
|
27
|
+
* @param options - Same {@link CreatePaneOptions} as `createPane`.
|
|
28
|
+
* @returns A {@link PaneBundle}; its identity changes across teardown and
|
|
29
|
+
* rebuild so dependent hooks (`usePaneFolder`, `usePaneInput`) re-bind.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const { pane } = usePane()
|
|
34
|
+
* const folder = usePaneFolder(pane, 'Settings')
|
|
35
|
+
* const [speed] = usePaneInput(folder, 'speed', 1, { min: 0, max: 10 })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function usePane(options?: CreatePaneOptions): PaneBundle;
|
|
39
|
+
|
|
40
|
+
export { usePane };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CreatePaneOptions, PaneBundle } from '../create-pane.js';
|
|
2
|
+
import 'tweakpane';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create a themed Tweakpane instance. Disposes on unmount, recreates on
|
|
6
|
+
* remount. Returns a `PaneBundle` whose identity changes if React tears
|
|
7
|
+
* the component down and rebuilds it (StrictMode, parent remount,
|
|
8
|
+
* Suspense). Child hooks that depend on the pane (`usePaneFolder`,
|
|
9
|
+
* `usePaneInput`) re-bind when this happens.
|
|
10
|
+
*
|
|
11
|
+
* Lifecycle:
|
|
12
|
+
* - Render: lazy-creates the bundle into a ref so it's available
|
|
13
|
+
* synchronously on first paint. Render runs twice in StrictMode but
|
|
14
|
+
* the ref guard prevents double-creation. Orphans from aborted
|
|
15
|
+
* concurrent renders are reclaimed by `createPane`'s unclaimed-slot
|
|
16
|
+
* mechanism.
|
|
17
|
+
* - Effect: claims the bundle so unrelated `createPane` calls won't
|
|
18
|
+
* dispose it; cleanup disposes the pane unconditionally.
|
|
19
|
+
* - Effect re-mount (StrictMode or true remount): the bundle in the
|
|
20
|
+
* ref is now `disposed`, so we create a fresh one and `force()` a
|
|
21
|
+
* re-render so consumers receive the new identity.
|
|
22
|
+
*
|
|
23
|
+
* Uses `driver: 'raf'` so the stats graph self-ticks via its own
|
|
24
|
+
* `requestAnimationFrame` loop. This makes `usePane` work regardless
|
|
25
|
+
* of whether it's called inside or outside R3F's `<Canvas>` context.
|
|
26
|
+
*
|
|
27
|
+
* @param options - Same {@link CreatePaneOptions} as `createPane`.
|
|
28
|
+
* @returns A {@link PaneBundle}; its identity changes across teardown and
|
|
29
|
+
* rebuild so dependent hooks (`usePaneFolder`, `usePaneInput`) re-bind.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const { pane } = usePane()
|
|
34
|
+
* const folder = usePaneFolder(pane, 'Settings')
|
|
35
|
+
* const [speed] = usePaneInput(folder, 'speed', 1, { min: 0, max: 10 })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function usePane(options?: CreatePaneOptions): PaneBundle;
|
|
39
|
+
|
|
40
|
+
export { usePane };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect, useEffectEvent, useState } from "react";
|
|
2
|
+
import { claimPane, createPane } from "../create-pane.js";
|
|
3
|
+
function usePane(options = {}) {
|
|
4
|
+
const [bundle, setBundle] = useState(() => createPane(options));
|
|
5
|
+
const getOptions = useEffectEvent(() => options);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (bundle.disposed) {
|
|
8
|
+
setBundle(createPane(getOptions()));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
claimPane(bundle);
|
|
12
|
+
return () => {
|
|
13
|
+
bundle.pane.dispose();
|
|
14
|
+
};
|
|
15
|
+
}, [bundle]);
|
|
16
|
+
return bundle;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
usePane
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=use-pane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/use-pane.ts"],"sourcesContent":["import { useEffect, useEffectEvent, useState } from 'react'\nimport { claimPane, createPane } from '../create-pane.js'\nimport type { CreatePaneOptions, PaneBundle } from '../create-pane.js'\n\n/**\n * Create a themed Tweakpane instance. Disposes on unmount, recreates on\n * remount. Returns a `PaneBundle` whose identity changes if React tears\n * the component down and rebuilds it (StrictMode, parent remount,\n * Suspense). Child hooks that depend on the pane (`usePaneFolder`,\n * `usePaneInput`) re-bind when this happens.\n *\n * Lifecycle:\n * - Render: lazy-creates the bundle into a ref so it's available\n * synchronously on first paint. Render runs twice in StrictMode but\n * the ref guard prevents double-creation. Orphans from aborted\n * concurrent renders are reclaimed by `createPane`'s unclaimed-slot\n * mechanism.\n * - Effect: claims the bundle so unrelated `createPane` calls won't\n * dispose it; cleanup disposes the pane unconditionally.\n * - Effect re-mount (StrictMode or true remount): the bundle in the\n * ref is now `disposed`, so we create a fresh one and `force()` a\n * re-render so consumers receive the new identity.\n *\n * Uses `driver: 'raf'` so the stats graph self-ticks via its own\n * `requestAnimationFrame` loop. This makes `usePane` work regardless\n * of whether it's called inside or outside R3F's `<Canvas>` context.\n *\n * @param options - Same {@link CreatePaneOptions} as `createPane`.\n * @returns A {@link PaneBundle}; its identity changes across teardown and\n * rebuild so dependent hooks (`usePaneFolder`, `usePaneInput`) re-bind.\n *\n * @example\n * ```tsx\n * const { pane } = usePane()\n * const folder = usePaneFolder(pane, 'Settings')\n * const [speed] = usePaneInput(folder, 'speed', 1, { min: 0, max: 10 })\n * ```\n */\nexport function usePane(options: CreatePaneOptions = {}): PaneBundle {\n // Lazy initializer creates the bundle once, synchronously on first\n // render, so it's available for first paint. StrictMode's double-invoke\n // is absorbed by createPane's unclaimed-slot orphan disposal.\n const [bundle, setBundle] = useState(() => createPane(options))\n\n // Latest options read non-reactively when a disposed bundle is rebuilt.\n const getOptions = useEffectEvent(() => options)\n\n useEffect(() => {\n if (bundle.disposed) {\n setBundle(createPane(getOptions()))\n return\n }\n claimPane(bundle)\n return () => {\n bundle.pane.dispose()\n }\n }, [bundle])\n\n return bundle\n}\n"],"mappings":"AAAA,SAAS,WAAW,gBAAgB,gBAAgB;AACpD,SAAS,WAAW,kBAAkB;AAqC/B,SAAS,QAAQ,UAA6B,CAAC,GAAe;AAInE,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,MAAM,WAAW,OAAO,CAAC;AAG9D,QAAM,aAAa,eAAe,MAAM,OAAO;AAE/C,YAAU,MAAM;AACd,QAAI,OAAO,UAAU;AACnB,gBAAU,WAAW,WAAW,CAAC,CAAC;AAClC;AAAA,IACF;AACA,cAAU,MAAM;AAChB,WAAO,MAAM;AACX,aAAO,KAAK,QAAQ;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AACT;","names":[]}
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var react_exports = {};
|
|
20
|
+
__export(react_exports, {
|
|
21
|
+
DevtoolsClient: () => import_devtools_client.DevtoolsClient,
|
|
22
|
+
DevtoolsProvider: () => import_devtools_provider.DevtoolsProvider,
|
|
23
|
+
useFpsGraph: () => import_use_fps_graph.useFpsGraph,
|
|
24
|
+
usePane: () => import_use_pane.usePane,
|
|
25
|
+
usePaneButton: () => import_use_pane_button.usePaneButton,
|
|
26
|
+
usePaneFolder: () => import_use_pane_folder.usePaneFolder,
|
|
27
|
+
usePaneInput: () => import_use_pane_input.usePaneInput,
|
|
28
|
+
usePaneRadioGrid: () => import_use_pane_radio_grid.usePaneRadioGrid
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(react_exports);
|
|
31
|
+
var import_use_pane = require("./react/use-pane.js");
|
|
32
|
+
var import_devtools_provider = require("./react/devtools-provider.js");
|
|
33
|
+
var import_use_pane_input = require("./react/use-pane-input.js");
|
|
34
|
+
var import_use_pane_folder = require("./react/use-pane-folder.js");
|
|
35
|
+
var import_use_pane_button = require("./react/use-pane-button.js");
|
|
36
|
+
var import_use_pane_radio_grid = require("./react/use-pane-radio-grid.js");
|
|
37
|
+
var import_use_fps_graph = require("./react/use-fps-graph.js");
|
|
38
|
+
var import_devtools_client = require("./devtools-client.js");
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
DevtoolsClient,
|
|
42
|
+
DevtoolsProvider,
|
|
43
|
+
useFpsGraph,
|
|
44
|
+
usePane,
|
|
45
|
+
usePaneButton,
|
|
46
|
+
usePaneFolder,
|
|
47
|
+
usePaneInput,
|
|
48
|
+
usePaneRadioGrid
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=react.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react.ts"],"sourcesContent":["export { usePane } from './react/use-pane.js'\nexport { DevtoolsProvider } from './react/devtools-provider.js'\nexport type { DevtoolsProviderProps } from './react/devtools-provider.js'\nexport { usePaneInput } from './react/use-pane-input.js'\nexport type { PaneParent, PaneInputOptions } from './react/use-pane-input.js'\nexport { usePaneFolder } from './react/use-pane-folder.js'\nexport { usePaneButton } from './react/use-pane-button.js'\nexport { usePaneRadioGrid } from './react/use-pane-radio-grid.js'\nexport type { PaneRadioGridCell, PaneRadioGridOptions } from './react/use-pane-radio-grid.js'\nexport { useFpsGraph } from './react/use-fps-graph.js'\nexport type { FpsGraphHandle } from './react/use-fps-graph.js'\nexport type { CreatePaneOptions, PaneBundle } from './create-pane.js'\n// Advanced: re-export the bus consumer so callers can spin up extra\n// consumers next to the one that `usePane` already manages.\nexport { DevtoolsClient } from './devtools-client.js'\nexport type {\n DevtoolsClientOptions,\n DevtoolsState,\n DevtoolsStateListener,\n} from './devtools-client.js'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAwB;AACxB,+BAAiC;AAEjC,4BAA6B;AAE7B,6BAA8B;AAC9B,6BAA8B;AAC9B,iCAAiC;AAEjC,2BAA4B;AAK5B,6BAA+B;","names":[]}
|
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { usePane } from './react/use-pane.cjs';
|
|
2
|
+
export { DevtoolsProvider, DevtoolsProviderProps } from './react/devtools-provider.cjs';
|
|
3
|
+
export { PaneInputOptions, PaneParent, usePaneInput } from './react/use-pane-input.cjs';
|
|
4
|
+
export { usePaneFolder } from './react/use-pane-folder.cjs';
|
|
5
|
+
export { usePaneButton } from './react/use-pane-button.cjs';
|
|
6
|
+
export { PaneRadioGridCell, PaneRadioGridOptions, usePaneRadioGrid } from './react/use-pane-radio-grid.cjs';
|
|
7
|
+
export { FpsGraphHandle, useFpsGraph } from './react/use-fps-graph.cjs';
|
|
8
|
+
export { CreatePaneOptions, PaneBundle } from './create-pane.cjs';
|
|
9
|
+
export { DevtoolsClient, DevtoolsClientOptions, DevtoolsState, DevtoolsStateListener } from './devtools-client.cjs';
|
|
10
|
+
import 'react';
|
|
11
|
+
import 'tweakpane';
|
|
12
|
+
import 'three-flatland/debug-protocol';
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { usePane } from './react/use-pane.js';
|
|
2
|
+
export { DevtoolsProvider, DevtoolsProviderProps } from './react/devtools-provider.js';
|
|
3
|
+
export { PaneInputOptions, PaneParent, usePaneInput } from './react/use-pane-input.js';
|
|
4
|
+
export { usePaneFolder } from './react/use-pane-folder.js';
|
|
5
|
+
export { usePaneButton } from './react/use-pane-button.js';
|
|
6
|
+
export { PaneRadioGridCell, PaneRadioGridOptions, usePaneRadioGrid } from './react/use-pane-radio-grid.js';
|
|
7
|
+
export { FpsGraphHandle, useFpsGraph } from './react/use-fps-graph.js';
|
|
8
|
+
export { CreatePaneOptions, PaneBundle } from './create-pane.js';
|
|
9
|
+
export { DevtoolsClient, DevtoolsClientOptions, DevtoolsState, DevtoolsStateListener } from './devtools-client.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import 'tweakpane';
|
|
12
|
+
import 'three-flatland/debug-protocol';
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { usePane } from "./react/use-pane.js";
|
|
2
|
+
import { DevtoolsProvider } from "./react/devtools-provider.js";
|
|
3
|
+
import { usePaneInput } from "./react/use-pane-input.js";
|
|
4
|
+
import { usePaneFolder } from "./react/use-pane-folder.js";
|
|
5
|
+
import { usePaneButton } from "./react/use-pane-button.js";
|
|
6
|
+
import { usePaneRadioGrid } from "./react/use-pane-radio-grid.js";
|
|
7
|
+
import { useFpsGraph } from "./react/use-fps-graph.js";
|
|
8
|
+
import { DevtoolsClient } from "./devtools-client.js";
|
|
9
|
+
export {
|
|
10
|
+
DevtoolsClient,
|
|
11
|
+
DevtoolsProvider,
|
|
12
|
+
useFpsGraph,
|
|
13
|
+
usePane,
|
|
14
|
+
usePaneButton,
|
|
15
|
+
usePaneFolder,
|
|
16
|
+
usePaneInput,
|
|
17
|
+
usePaneRadioGrid
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react.ts"],"sourcesContent":["export { usePane } from './react/use-pane.js'\nexport { DevtoolsProvider } from './react/devtools-provider.js'\nexport type { DevtoolsProviderProps } from './react/devtools-provider.js'\nexport { usePaneInput } from './react/use-pane-input.js'\nexport type { PaneParent, PaneInputOptions } from './react/use-pane-input.js'\nexport { usePaneFolder } from './react/use-pane-folder.js'\nexport { usePaneButton } from './react/use-pane-button.js'\nexport { usePaneRadioGrid } from './react/use-pane-radio-grid.js'\nexport type { PaneRadioGridCell, PaneRadioGridOptions } from './react/use-pane-radio-grid.js'\nexport { useFpsGraph } from './react/use-fps-graph.js'\nexport type { FpsGraphHandle } from './react/use-fps-graph.js'\nexport type { CreatePaneOptions, PaneBundle } from './create-pane.js'\n// Advanced: re-export the bus consumer so callers can spin up extra\n// consumers next to the one that `usePane` already manages.\nexport { DevtoolsClient } from './devtools-client.js'\nexport type {\n DevtoolsClientOptions,\n DevtoolsState,\n DevtoolsStateListener,\n} from './devtools-client.js'\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,wBAAwB;AAEjC,SAAS,oBAAoB;AAE7B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AAEjC,SAAS,mBAAmB;AAK5B,SAAS,sBAAsB;","names":[]}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var registry_view_exports = {};
|
|
20
|
+
__export(registry_view_exports, {
|
|
21
|
+
addRegistryView: () => addRegistryView
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(registry_view_exports);
|
|
24
|
+
const BAR_HEIGHT = 24;
|
|
25
|
+
const BAR_WIDTH = 240;
|
|
26
|
+
const FILL_BY_KIND = {
|
|
27
|
+
float: "#47cca9",
|
|
28
|
+
int: "#47cc6a",
|
|
29
|
+
uint: "#ffa347",
|
|
30
|
+
bits: "#d94c87",
|
|
31
|
+
float2: "#9d7aff",
|
|
32
|
+
float3: "#9d7aff",
|
|
33
|
+
float4: "#9d7aff"
|
|
34
|
+
};
|
|
35
|
+
function splitName(name) {
|
|
36
|
+
const dot = name.indexOf(".");
|
|
37
|
+
if (dot === -1) return { group: "ungrouped", short: name };
|
|
38
|
+
return { group: name.slice(0, dot), short: name.slice(dot + 1) };
|
|
39
|
+
}
|
|
40
|
+
function addRegistryView(parent, client) {
|
|
41
|
+
const blade = parent.addBlade({ view: "separator" });
|
|
42
|
+
const bladeEl = blade.element;
|
|
43
|
+
bladeEl.innerHTML = "";
|
|
44
|
+
bladeEl.className = "tp-cntv";
|
|
45
|
+
bladeEl.style.cssText = "display:none;flex-direction:column;background:rgba(0,0,0,0.3)";
|
|
46
|
+
const header = document.createElement("div");
|
|
47
|
+
header.style.cssText = [
|
|
48
|
+
"display:grid",
|
|
49
|
+
"grid-template-columns:2em 1fr 2em",
|
|
50
|
+
"align-items:center",
|
|
51
|
+
"padding:4px 6px 6px",
|
|
52
|
+
"font-size:11px",
|
|
53
|
+
"color:var(--tp-label-foreground-color)",
|
|
54
|
+
"user-select:none",
|
|
55
|
+
"-webkit-user-select:none",
|
|
56
|
+
"font-variant-numeric:tabular-nums",
|
|
57
|
+
"cursor:pointer"
|
|
58
|
+
].join(";");
|
|
59
|
+
const arrowStyle = "cursor:pointer;padding:0 4px;opacity:0.8;font-family:ui-monospace,monospace;text-align:center";
|
|
60
|
+
const prevBtn = document.createElement("span");
|
|
61
|
+
prevBtn.textContent = "\u25C0";
|
|
62
|
+
prevBtn.style.cssText = arrowStyle;
|
|
63
|
+
prevBtn.setAttribute("role", "button");
|
|
64
|
+
prevBtn.setAttribute("aria-label", "Previous registry group");
|
|
65
|
+
const groupLabel = document.createElement("span");
|
|
66
|
+
groupLabel.style.cssText = "font-weight:500;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none";
|
|
67
|
+
const nextBtn = document.createElement("span");
|
|
68
|
+
nextBtn.textContent = "\u25B6";
|
|
69
|
+
nextBtn.style.cssText = arrowStyle;
|
|
70
|
+
nextBtn.setAttribute("role", "button");
|
|
71
|
+
nextBtn.setAttribute("aria-label", "Next registry group");
|
|
72
|
+
header.appendChild(prevBtn);
|
|
73
|
+
header.appendChild(groupLabel);
|
|
74
|
+
header.appendChild(nextBtn);
|
|
75
|
+
const body = document.createElement("div");
|
|
76
|
+
body.style.cssText = "display:flex;flex-direction:column;gap:4px;padding:2px 6px 6px";
|
|
77
|
+
bladeEl.appendChild(header);
|
|
78
|
+
bladeEl.appendChild(body);
|
|
79
|
+
const groups = /* @__PURE__ */ new Map();
|
|
80
|
+
let activeGroup = null;
|
|
81
|
+
let collapsed = true;
|
|
82
|
+
body.style.display = "none";
|
|
83
|
+
function syncFilter() {
|
|
84
|
+
if (collapsed || activeGroup === null) {
|
|
85
|
+
client.setRegistry([]);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const g = groups.get(activeGroup);
|
|
89
|
+
if (!g) {
|
|
90
|
+
client.setRegistry([]);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const names = [];
|
|
94
|
+
for (const row of g.entries.values()) names.push(row.name);
|
|
95
|
+
client.setRegistry(names);
|
|
96
|
+
}
|
|
97
|
+
const toggleCollapse = (e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
collapsed = !collapsed;
|
|
100
|
+
body.style.display = collapsed ? "none" : "flex";
|
|
101
|
+
if (!collapsed && activeGroup !== null) {
|
|
102
|
+
const g = groups.get(activeGroup);
|
|
103
|
+
if (g) {
|
|
104
|
+
g.container.style.display = "flex";
|
|
105
|
+
for (const row of g.entries.values()) row.lastVersion = -1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
syncFilter();
|
|
109
|
+
};
|
|
110
|
+
header.addEventListener("click", toggleCollapse);
|
|
111
|
+
prevBtn.addEventListener("click", (e) => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
cycle(-1);
|
|
114
|
+
});
|
|
115
|
+
nextBtn.addEventListener("click", (e) => {
|
|
116
|
+
e.stopPropagation();
|
|
117
|
+
cycle(1);
|
|
118
|
+
});
|
|
119
|
+
function ensureGroup(name) {
|
|
120
|
+
let g = groups.get(name);
|
|
121
|
+
if (g) return g;
|
|
122
|
+
const container = document.createElement("div");
|
|
123
|
+
container.style.cssText = "display:none;flex-direction:column;gap:4px";
|
|
124
|
+
body.appendChild(container);
|
|
125
|
+
g = { group: name, container, entries: /* @__PURE__ */ new Map() };
|
|
126
|
+
groups.set(name, g);
|
|
127
|
+
return g;
|
|
128
|
+
}
|
|
129
|
+
function destroyGroup(name) {
|
|
130
|
+
const g = groups.get(name);
|
|
131
|
+
if (!g) return;
|
|
132
|
+
g.container.remove();
|
|
133
|
+
groups.delete(name);
|
|
134
|
+
if (activeGroup === name) activeGroup = null;
|
|
135
|
+
}
|
|
136
|
+
function ensureEntryRow(g, name, shortName) {
|
|
137
|
+
const existing = g.entries.get(shortName);
|
|
138
|
+
if (existing) return existing;
|
|
139
|
+
const row = document.createElement("div");
|
|
140
|
+
row.style.cssText = "display:flex;flex-direction:column;gap:2px";
|
|
141
|
+
const head = document.createElement("div");
|
|
142
|
+
head.style.cssText = [
|
|
143
|
+
"display:flex",
|
|
144
|
+
"align-items:baseline",
|
|
145
|
+
"gap:6px",
|
|
146
|
+
"font-size:10px",
|
|
147
|
+
"line-height:1.2",
|
|
148
|
+
"font-family:var(--tp-base-font-family, ui-monospace, monospace)",
|
|
149
|
+
"font-variant-numeric:tabular-nums",
|
|
150
|
+
"color:var(--tp-monitor-foreground-color)"
|
|
151
|
+
].join(";");
|
|
152
|
+
const nameLabel = document.createElement("span");
|
|
153
|
+
nameLabel.style.cssText = "flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--tp-label-foreground-color)";
|
|
154
|
+
nameLabel.textContent = shortName;
|
|
155
|
+
const valueLabel = document.createElement("span");
|
|
156
|
+
valueLabel.style.cssText = "opacity:0.75;white-space:nowrap";
|
|
157
|
+
head.appendChild(nameLabel);
|
|
158
|
+
head.appendChild(valueLabel);
|
|
159
|
+
const canvas = document.createElement("canvas");
|
|
160
|
+
canvas.width = BAR_WIDTH;
|
|
161
|
+
canvas.height = BAR_HEIGHT;
|
|
162
|
+
canvas.style.cssText = `width:100%;height:${BAR_HEIGHT}px;background:rgba(0,2,28,0.45);border-radius:2px`;
|
|
163
|
+
row.appendChild(head);
|
|
164
|
+
row.appendChild(canvas);
|
|
165
|
+
g.container.appendChild(row);
|
|
166
|
+
const entry = {
|
|
167
|
+
name,
|
|
168
|
+
shortName,
|
|
169
|
+
row,
|
|
170
|
+
nameLabel,
|
|
171
|
+
valueLabel,
|
|
172
|
+
canvas,
|
|
173
|
+
ctx: canvas.getContext("2d"),
|
|
174
|
+
lastVersion: -1
|
|
175
|
+
};
|
|
176
|
+
g.entries.set(shortName, entry);
|
|
177
|
+
return entry;
|
|
178
|
+
}
|
|
179
|
+
function destroyEntryRow(g, shortName) {
|
|
180
|
+
const row = g.entries.get(shortName);
|
|
181
|
+
if (!row) return;
|
|
182
|
+
row.row.remove();
|
|
183
|
+
g.entries.delete(shortName);
|
|
184
|
+
}
|
|
185
|
+
function setActiveGroup(name) {
|
|
186
|
+
activeGroup = name;
|
|
187
|
+
for (const [groupName, g] of groups) {
|
|
188
|
+
g.container.style.display = groupName === name && !collapsed ? "flex" : "none";
|
|
189
|
+
}
|
|
190
|
+
groupLabel.textContent = name ?? "\u2014";
|
|
191
|
+
if (name !== null) {
|
|
192
|
+
const g = groups.get(name);
|
|
193
|
+
if (g) for (const row of g.entries.values()) row.lastVersion = -1;
|
|
194
|
+
}
|
|
195
|
+
syncFilter();
|
|
196
|
+
}
|
|
197
|
+
function cycle(delta) {
|
|
198
|
+
const names = Array.from(groups.keys());
|
|
199
|
+
if (names.length === 0) return;
|
|
200
|
+
const idx = activeGroup !== null ? names.indexOf(activeGroup) : -1;
|
|
201
|
+
const next = names[(idx + delta + names.length) % names.length];
|
|
202
|
+
setActiveGroup(next);
|
|
203
|
+
}
|
|
204
|
+
function renderBars(row, kind, sample, isSigned) {
|
|
205
|
+
const ctx = row.ctx;
|
|
206
|
+
const w = row.canvas.width;
|
|
207
|
+
const h = row.canvas.height;
|
|
208
|
+
let min = Infinity;
|
|
209
|
+
let max = -Infinity;
|
|
210
|
+
let sum = 0;
|
|
211
|
+
const n = sample.length;
|
|
212
|
+
for (let i = 0; i < n; i++) {
|
|
213
|
+
const v = sample[i];
|
|
214
|
+
if (v < min) min = v;
|
|
215
|
+
if (v > max) max = v;
|
|
216
|
+
sum += v;
|
|
217
|
+
}
|
|
218
|
+
const mean = n > 0 ? sum / n : 0;
|
|
219
|
+
if (!ctx) return { min, max, mean };
|
|
220
|
+
ctx.clearRect(0, 0, w, h);
|
|
221
|
+
if (n === 0 || !Number.isFinite(min) || !Number.isFinite(max)) return { min, max: 0, mean };
|
|
222
|
+
const zeroY = isSigned ? h / 2 : h;
|
|
223
|
+
const scale = isSigned ? h / 2 / Math.max(Math.abs(min), Math.abs(max) || 1) : h / (max || 1);
|
|
224
|
+
ctx.fillStyle = FILL_BY_KIND[kind] ?? "#47cca9";
|
|
225
|
+
const bw = Math.max(1, w / n);
|
|
226
|
+
for (let i = 0; i < n; i++) {
|
|
227
|
+
const v = sample[i];
|
|
228
|
+
const x = Math.floor(i / n * w);
|
|
229
|
+
const bh = v * scale;
|
|
230
|
+
if (isSigned) {
|
|
231
|
+
if (bh >= 0) ctx.fillRect(x, zeroY - bh, Math.ceil(bw), bh);
|
|
232
|
+
else ctx.fillRect(x, zeroY, Math.ceil(bw), -bh);
|
|
233
|
+
} else {
|
|
234
|
+
ctx.fillRect(x, zeroY - bh, Math.ceil(bw), bh);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (isSigned) {
|
|
238
|
+
ctx.fillStyle = "rgba(240, 237, 216, 0.2)";
|
|
239
|
+
ctx.fillRect(0, zeroY, w, 1);
|
|
240
|
+
}
|
|
241
|
+
return { min, max, mean };
|
|
242
|
+
}
|
|
243
|
+
function renderBits(row, sample, count) {
|
|
244
|
+
const ctx = row.ctx;
|
|
245
|
+
const w = row.canvas.width;
|
|
246
|
+
const h = row.canvas.height;
|
|
247
|
+
if (!ctx) return { ones: 0, total: 0 };
|
|
248
|
+
ctx.clearRect(0, 0, w, h);
|
|
249
|
+
const totalBits = count * 32;
|
|
250
|
+
if (totalBits === 0) return { ones: 0, total: 0 };
|
|
251
|
+
let ones = 0;
|
|
252
|
+
const px = w / totalBits;
|
|
253
|
+
ctx.fillStyle = FILL_BY_KIND.bits;
|
|
254
|
+
for (let i = 0; i < count; i++) {
|
|
255
|
+
const word = sample[i] >>> 0;
|
|
256
|
+
for (let b = 0; b < 32; b++) {
|
|
257
|
+
if (word >>> b & 1) {
|
|
258
|
+
ones++;
|
|
259
|
+
const bitIdx = i * 32 + b;
|
|
260
|
+
const x = Math.floor(bitIdx * px);
|
|
261
|
+
ctx.fillRect(x, 2, Math.max(1, Math.ceil(px)), h - 4);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return { ones, total: totalBits };
|
|
266
|
+
}
|
|
267
|
+
function renderEntry(row, entry) {
|
|
268
|
+
if (row.lastVersion === entry.version) return;
|
|
269
|
+
row.lastVersion = entry.version;
|
|
270
|
+
row.nameLabel.title = `${entry.name} \xB7 ${entry.kind} \xB7 ${entry.count}`;
|
|
271
|
+
const kind = entry.kind;
|
|
272
|
+
if (kind === "bits") {
|
|
273
|
+
const { ones, total } = renderBits(row, entry.sample, entry.count);
|
|
274
|
+
row.valueLabel.textContent = `${ones} / ${total}`;
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (kind === "float2" || kind === "float3" || kind === "float4") {
|
|
278
|
+
const stride = kind === "float2" ? 2 : kind === "float3" ? 3 : 4;
|
|
279
|
+
const n = Math.floor(entry.sample.length / stride);
|
|
280
|
+
const mags = new Float32Array(n);
|
|
281
|
+
for (let i = 0; i < n; i++) {
|
|
282
|
+
let sq = 0;
|
|
283
|
+
for (let c = 0; c < stride; c++) {
|
|
284
|
+
const v = entry.sample[i * stride + c];
|
|
285
|
+
sq += v * v;
|
|
286
|
+
}
|
|
287
|
+
mags[i] = Math.sqrt(sq);
|
|
288
|
+
}
|
|
289
|
+
const stats2 = renderBars(row, kind, mags, false);
|
|
290
|
+
row.valueLabel.textContent = `${n}\xD7${stride} \u03BC=${stats2.mean.toFixed(2)}`;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const isSigned = kind === "int" || kind === "float";
|
|
294
|
+
const stats = renderBars(row, kind, entry.sample, isSigned);
|
|
295
|
+
const fmt = (v) => {
|
|
296
|
+
if (!Number.isFinite(v)) return "\u2014";
|
|
297
|
+
if (kind === "uint" || kind === "int") return Math.round(v).toString();
|
|
298
|
+
return v.toFixed(2);
|
|
299
|
+
};
|
|
300
|
+
row.valueLabel.textContent = `\u03BC=${fmt(stats.mean)} ${fmt(stats.min)}\u2013${fmt(stats.max)}`;
|
|
301
|
+
}
|
|
302
|
+
const unsubscribe = client.addListener((state) => {
|
|
303
|
+
const registry = state.registry;
|
|
304
|
+
const seen = /* @__PURE__ */ new Map();
|
|
305
|
+
for (const [name] of registry) {
|
|
306
|
+
const { group, short } = splitName(name);
|
|
307
|
+
let bucket = seen.get(group);
|
|
308
|
+
if (!bucket) {
|
|
309
|
+
bucket = /* @__PURE__ */ new Set();
|
|
310
|
+
seen.set(group, bucket);
|
|
311
|
+
}
|
|
312
|
+
bucket.add(short);
|
|
313
|
+
}
|
|
314
|
+
for (const [groupName, g] of groups) {
|
|
315
|
+
const bucket = seen.get(groupName);
|
|
316
|
+
if (!bucket) {
|
|
317
|
+
destroyGroup(groupName);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
for (const shortName of g.entries.keys()) {
|
|
321
|
+
if (!bucket.has(shortName)) destroyEntryRow(g, shortName);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
for (const [name] of registry) {
|
|
325
|
+
const { group, short } = splitName(name);
|
|
326
|
+
const g = ensureGroup(group);
|
|
327
|
+
ensureEntryRow(g, name, short);
|
|
328
|
+
}
|
|
329
|
+
if (groups.size === 0) {
|
|
330
|
+
activeGroup = null;
|
|
331
|
+
groupLabel.textContent = "\u2014";
|
|
332
|
+
} else if (activeGroup === null || !groups.has(activeGroup)) {
|
|
333
|
+
setActiveGroup(groups.keys().next().value);
|
|
334
|
+
} else {
|
|
335
|
+
groupLabel.textContent = activeGroup;
|
|
336
|
+
const g = groups.get(activeGroup);
|
|
337
|
+
g.container.style.display = collapsed ? "none" : "flex";
|
|
338
|
+
}
|
|
339
|
+
if (!collapsed && activeGroup !== null) {
|
|
340
|
+
const g = groups.get(activeGroup);
|
|
341
|
+
if (g) {
|
|
342
|
+
for (const [shortName, row] of g.entries) {
|
|
343
|
+
const entry = registry.get(`${activeGroup}.${shortName}`) ?? registry.get(shortName);
|
|
344
|
+
if (entry) renderEntry(row, entry);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const multi = groups.size > 1;
|
|
349
|
+
const arrowOpacity = multi ? "0.8" : "0.25";
|
|
350
|
+
const arrowPointer = multi ? "pointer" : "default";
|
|
351
|
+
prevBtn.style.opacity = arrowOpacity;
|
|
352
|
+
nextBtn.style.opacity = arrowOpacity;
|
|
353
|
+
prevBtn.style.cursor = arrowPointer;
|
|
354
|
+
nextBtn.style.cursor = arrowPointer;
|
|
355
|
+
bladeEl.style.display = registry.size > 0 ? "flex" : "none";
|
|
356
|
+
syncFilter();
|
|
357
|
+
});
|
|
358
|
+
return {
|
|
359
|
+
element: bladeEl,
|
|
360
|
+
dispose() {
|
|
361
|
+
unsubscribe();
|
|
362
|
+
groups.clear();
|
|
363
|
+
blade.dispose();
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
368
|
+
0 && (module.exports = {
|
|
369
|
+
addRegistryView
|
|
370
|
+
});
|
|
371
|
+
//# sourceMappingURL=registry-view.cjs.map
|