@three-flatland/devtools 0.1.0-alpha.3 → 1.0.0-alpha.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.
Files changed (172) hide show
  1. package/README.md +1 -1
  2. package/dist/buffers-modal.d.ts +16 -52
  3. package/dist/buffers-modal.d.ts.map +1 -0
  4. package/dist/buffers-modal.js +459 -464
  5. package/dist/buffers-modal.js.map +1 -1
  6. package/dist/buffers-view.d.ts +22 -34
  7. package/dist/buffers-view.d.ts.map +1 -0
  8. package/dist/buffers-view.js +252 -240
  9. package/dist/buffers-view.js.map +1 -1
  10. package/dist/create-pane.d.ts +38 -37
  11. package/dist/create-pane.d.ts.map +1 -0
  12. package/dist/create-pane.js +197 -166
  13. package/dist/create-pane.js.map +1 -1
  14. package/dist/dashboard/app.tsx +2 -0
  15. package/dist/dashboard/export.ts +1 -3
  16. package/dist/dashboard/frame-cursor.ts +81 -0
  17. package/dist/dashboard/hooks.ts +10 -2
  18. package/dist/dashboard/index.html +61 -0
  19. package/dist/dashboard/panels/batches.tsx +5 -18
  20. package/dist/dashboard/panels/buffers.tsx +52 -26
  21. package/dist/dashboard/panels/env.tsx +5 -6
  22. package/dist/dashboard/panels/protocol-log.tsx +146 -58
  23. package/dist/dashboard/panels/registry.tsx +55 -69
  24. package/dist/dashboard/panels/scrubber.tsx +100 -0
  25. package/dist/dashboard/panels/stats.tsx +60 -32
  26. package/dist/dashboard/protocol-store.ts +25 -8
  27. package/dist/dashboard/vendor/hooks.module.d.ts +146 -0
  28. package/dist/dashboard/vendor/jsx-runtime.d.ts +55 -0
  29. package/dist/dashboard/vendor/jsx.d.ts +3123 -0
  30. package/dist/dashboard/vendor/preact.module.d.ts +397 -0
  31. package/dist/devtools-client.d.ts +312 -300
  32. package/dist/devtools-client.d.ts.map +1 -0
  33. package/dist/devtools-client.js +866 -838
  34. package/dist/devtools-client.js.map +1 -1
  35. package/dist/index.d.ts +6 -8
  36. package/dist/index.js +5 -12
  37. package/dist/perf-trace.d.ts +6 -4
  38. package/dist/perf-trace.d.ts.map +1 -0
  39. package/dist/perf-trace.js +80 -66
  40. package/dist/perf-trace.js.map +1 -1
  41. package/dist/plugins.d.ts +6 -6
  42. package/dist/plugins.d.ts.map +1 -0
  43. package/dist/plugins.js +5 -5
  44. package/dist/plugins.js.map +1 -1
  45. package/dist/provider-switcher.d.ts +8 -15
  46. package/dist/provider-switcher.d.ts.map +1 -0
  47. package/dist/provider-switcher.js +68 -68
  48. package/dist/provider-switcher.js.map +1 -1
  49. package/dist/react/devtools-provider.d.ts +11 -10
  50. package/dist/react/devtools-provider.d.ts.map +1 -0
  51. package/dist/react/devtools-provider.js +60 -32
  52. package/dist/react/devtools-provider.js.map +1 -1
  53. package/dist/react/use-fps-graph.d.ts +7 -7
  54. package/dist/react/use-fps-graph.d.ts.map +1 -0
  55. package/dist/react/use-fps-graph.js +27 -21
  56. package/dist/react/use-fps-graph.js.map +1 -1
  57. package/dist/react/use-pane-button.d.ts +4 -4
  58. package/dist/react/use-pane-button.d.ts.map +1 -0
  59. package/dist/react/use-pane-button.js +35 -30
  60. package/dist/react/use-pane-button.js.map +1 -1
  61. package/dist/react/use-pane-folder.d.ts +5 -4
  62. package/dist/react/use-pane-folder.d.ts.map +1 -0
  63. package/dist/react/use-pane-folder.js +33 -20
  64. package/dist/react/use-pane-folder.js.map +1 -1
  65. package/dist/react/use-pane-input.d.ts +31 -30
  66. package/dist/react/use-pane-input.d.ts.map +1 -0
  67. package/dist/react/use-pane-input.js +46 -42
  68. package/dist/react/use-pane-input.js.map +1 -1
  69. package/dist/react/use-pane-radio-grid.d.ts +20 -20
  70. package/dist/react/use-pane-radio-grid.d.ts.map +1 -0
  71. package/dist/react/use-pane-radio-grid.js +72 -50
  72. package/dist/react/use-pane-radio-grid.js.map +1 -1
  73. package/dist/react/use-pane.d.ts +4 -4
  74. package/dist/react/use-pane.d.ts.map +1 -0
  75. package/dist/react/use-pane.js +52 -17
  76. package/dist/react/use-pane.js.map +1 -1
  77. package/dist/react.d.ts +10 -12
  78. package/dist/react.js +2 -12
  79. package/dist/registry-view.d.ts +8 -21
  80. package/dist/registry-view.d.ts.map +1 -0
  81. package/dist/registry-view.js +357 -338
  82. package/dist/registry-view.js.map +1 -1
  83. package/dist/relay.d.ts +16 -0
  84. package/dist/relay.d.ts.map +1 -0
  85. package/dist/relay.js +189 -0
  86. package/dist/relay.js.map +1 -0
  87. package/dist/remote.d.ts +10 -0
  88. package/dist/remote.d.ts.map +1 -0
  89. package/dist/remote.js +28 -0
  90. package/dist/remote.js.map +1 -0
  91. package/dist/stats-graph.d.ts +23 -31
  92. package/dist/stats-graph.d.ts.map +1 -0
  93. package/dist/stats-graph.js +323 -264
  94. package/dist/stats-graph.js.map +1 -1
  95. package/dist/stats-row.d.ts +8 -21
  96. package/dist/stats-row.d.ts.map +1 -0
  97. package/dist/stats-row.js +99 -101
  98. package/dist/stats-row.js.map +1 -1
  99. package/dist/theme.d.ts +3 -1
  100. package/dist/theme.d.ts.map +1 -0
  101. package/dist/theme.js +43 -54
  102. package/dist/theme.js.map +1 -1
  103. package/dist/vite-plugin.d.ts +7 -6
  104. package/dist/vite-plugin.d.ts.map +1 -0
  105. package/dist/vite-plugin.js +87 -78
  106. package/dist/vite-plugin.js.map +1 -1
  107. package/package.json +33 -29
  108. package/dist/buffers-modal.cjs +0 -491
  109. package/dist/buffers-modal.cjs.map +0 -1
  110. package/dist/buffers-modal.d.cts +0 -62
  111. package/dist/buffers-view.cjs +0 -269
  112. package/dist/buffers-view.cjs.map +0 -1
  113. package/dist/buffers-view.d.cts +0 -39
  114. package/dist/create-pane.cjs +0 -203
  115. package/dist/create-pane.cjs.map +0 -1
  116. package/dist/create-pane.d.cts +0 -66
  117. package/dist/devtools-client.cjs +0 -870
  118. package/dist/devtools-client.cjs.map +0 -1
  119. package/dist/devtools-client.d.cts +0 -362
  120. package/dist/index.cjs +0 -42
  121. package/dist/index.cjs.map +0 -1
  122. package/dist/index.d.cts +0 -8
  123. package/dist/index.js.map +0 -1
  124. package/dist/perf-trace.cjs +0 -103
  125. package/dist/perf-trace.cjs.map +0 -1
  126. package/dist/perf-trace.d.cts +0 -27
  127. package/dist/plugins.cjs +0 -44
  128. package/dist/plugins.cjs.map +0 -1
  129. package/dist/plugins.d.cts +0 -7
  130. package/dist/provider-switcher.cjs +0 -95
  131. package/dist/provider-switcher.cjs.map +0 -1
  132. package/dist/provider-switcher.d.cts +0 -18
  133. package/dist/react/devtools-provider.cjs +0 -59
  134. package/dist/react/devtools-provider.cjs.map +0 -1
  135. package/dist/react/devtools-provider.d.cts +0 -39
  136. package/dist/react/use-fps-graph.cjs +0 -49
  137. package/dist/react/use-fps-graph.cjs.map +0 -1
  138. package/dist/react/use-fps-graph.d.cts +0 -15
  139. package/dist/react/use-pane-button.cjs +0 -58
  140. package/dist/react/use-pane-button.cjs.map +0 -1
  141. package/dist/react/use-pane-button.d.cts +0 -10
  142. package/dist/react/use-pane-folder.cjs +0 -48
  143. package/dist/react/use-pane-folder.cjs.map +0 -1
  144. package/dist/react/use-pane-folder.d.cts +0 -15
  145. package/dist/react/use-pane-input.cjs +0 -70
  146. package/dist/react/use-pane-input.cjs.map +0 -1
  147. package/dist/react/use-pane-input.d.cts +0 -44
  148. package/dist/react/use-pane-radio-grid.cjs +0 -78
  149. package/dist/react/use-pane-radio-grid.cjs.map +0 -1
  150. package/dist/react/use-pane-radio-grid.d.cts +0 -35
  151. package/dist/react/use-pane.cjs +0 -45
  152. package/dist/react/use-pane.cjs.map +0 -1
  153. package/dist/react/use-pane.d.cts +0 -40
  154. package/dist/react.cjs +0 -50
  155. package/dist/react.cjs.map +0 -1
  156. package/dist/react.d.cts +0 -12
  157. package/dist/react.js.map +0 -1
  158. package/dist/registry-view.cjs +0 -371
  159. package/dist/registry-view.cjs.map +0 -1
  160. package/dist/registry-view.d.cts +0 -24
  161. package/dist/stats-graph.cjs +0 -297
  162. package/dist/stats-graph.cjs.map +0 -1
  163. package/dist/stats-graph.d.cts +0 -40
  164. package/dist/stats-row.cjs +0 -153
  165. package/dist/stats-row.cjs.map +0 -1
  166. package/dist/stats-row.d.cts +0 -24
  167. package/dist/theme.cjs +0 -260
  168. package/dist/theme.cjs.map +0 -1
  169. package/dist/theme.d.cts +0 -10
  170. package/dist/vite-plugin.cjs +0 -113
  171. package/dist/vite-plugin.cjs.map +0 -1
  172. package/dist/vite-plugin.d.cts +0 -9
@@ -1,103 +0,0 @@
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 perf_trace_exports = {};
20
- __export(perf_trace_exports, {
21
- tracePerf: () => tracePerf
22
- });
23
- module.exports = __toCommonJS(perf_trace_exports);
24
- const TRACK_NAME = "devtools";
25
- const TRACK_GROUP = "three-flatland";
26
- const COLOR_BY_TYPE = {
27
- data: "primary",
28
- ping: "secondary-light",
29
- "subscribe:ack": "tertiary",
30
- subscribe: "tertiary-light",
31
- ack: "secondary",
32
- unsubscribe: "tertiary-dark",
33
- "provider:announce": "primary-light",
34
- "provider:query": "primary-light",
35
- "provider:gone": "error"
36
- };
37
- function tracePerf(msg) {
38
- if (msg === void 0) return;
39
- if (typeof performance === "undefined" || typeof performance.measure !== "function") return;
40
- const ts = msg.ts;
41
- if (typeof ts !== "number" || ts <= 0) return;
42
- try {
43
- const start = ts - performance.timeOrigin;
44
- const end = performance.now();
45
- if (end < start) return;
46
- const bytes = estimatePayloadBytes(msg.payload);
47
- performance.measure(`bus:${msg.type}`, {
48
- start,
49
- end,
50
- detail: {
51
- devtools: {
52
- dataType: "track-entry",
53
- track: TRACK_NAME,
54
- trackGroup: TRACK_GROUP,
55
- color: COLOR_BY_TYPE[msg.type] ?? "primary",
56
- // Chrome's User Timings extension surfaces `properties` as a
57
- // key/value table in the entry detail panel — perfect for
58
- // per-message bandwidth at-a-glance.
59
- properties: bytes > 0 ? [
60
- ["type", msg.type],
61
- ["bytes", formatBytes(bytes)]
62
- ] : [["type", msg.type]]
63
- }
64
- }
65
- });
66
- } catch {
67
- }
68
- }
69
- function estimatePayloadBytes(payload) {
70
- if (payload === null || typeof payload !== "object") return 0;
71
- let total = 0;
72
- const features = payload.features;
73
- if (features !== void 0) {
74
- for (const f of Object.values(features)) {
75
- total += sumTypedArrays(f);
76
- }
77
- }
78
- return total;
79
- }
80
- function sumTypedArrays(node) {
81
- if (node === null || typeof node !== "object") return 0;
82
- let total = 0;
83
- for (const v of Object.values(node)) {
84
- if (v && typeof v === "object" && v.byteLength !== void 0 && ArrayBuffer.isView(v)) {
85
- total += v.byteLength;
86
- continue;
87
- }
88
- if (v && typeof v === "object") {
89
- total += sumTypedArrays(v);
90
- }
91
- }
92
- return total;
93
- }
94
- function formatBytes(n) {
95
- if (n < 1024) return `${n} B`;
96
- if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
97
- return `${(n / (1024 * 1024)).toFixed(2)} MB`;
98
- }
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- tracePerf
102
- });
103
- //# sourceMappingURL=perf-trace.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/perf-trace.ts"],"sourcesContent":["/**\n * Log inbound bus messages as User Timing spans on the shared\n * **Devtools** track under the **three-flatland** group in Chrome's\n * Performance panel. Each span covers the window from when the sender\n * stamped the message to when the handler received it — end-to-end\n * `BroadcastChannel` delivery latency.\n *\n * Convention matches `packages/three-flatland/src/debug/perf-track.ts`:\n * - track group: `three-flatland`\n * - track: `Devtools`\n * - entry name: `bus:<type>` (`bus:data`, `bus:ping`, `bus:subscribe:ack`, …)\n *\n * Older Chromes silently ignore the `detail.devtools` payload and the\n * spans show up on the default Timings track instead.\n *\n * Usage: call `tracePerf(msg)` at the top of the receive handler\n * (both the discovery and data routers). Safe in non-performance\n * environments — every call is wrapped in a capability check and a\n * try/catch so a failed measurement never takes down the client.\n */\n\nconst TRACK_NAME = 'devtools'\nconst TRACK_GROUP = 'three-flatland'\n\nconst COLOR_BY_TYPE: Record<string, string> = {\n data: 'primary',\n ping: 'secondary-light',\n 'subscribe:ack': 'tertiary',\n subscribe: 'tertiary-light',\n ack: 'secondary',\n unsubscribe: 'tertiary-dark',\n 'provider:announce': 'primary-light',\n 'provider:query': 'primary-light',\n 'provider:gone': 'error',\n}\n\nexport function tracePerf(msg: { ts: number; type: string; payload?: unknown } | undefined): void {\n if (msg === undefined) return\n if (typeof performance === 'undefined' || typeof performance.measure !== 'function') return\n const ts = msg.ts\n if (typeof ts !== 'number' || ts <= 0) return\n try {\n // `msg.ts` is `Date.now()` (wall clock). Convert to the\n // `performance.now()` origin by subtracting `timeOrigin`. Skip if\n // clocks disagree enough to make the span go backwards.\n const start = ts - performance.timeOrigin\n const end = performance.now()\n if (end < start) return\n\n // Compute the heavy-data byte count from the message we just got.\n // Walks typed-array fields only (ignoring object/scalar overhead,\n // which is dominated by the typed arrays for `data` packets).\n const bytes = estimatePayloadBytes(msg.payload)\n\n performance.measure(`bus:${msg.type}`, {\n start,\n end,\n detail: {\n devtools: {\n dataType: 'track-entry',\n track: TRACK_NAME,\n trackGroup: TRACK_GROUP,\n color: COLOR_BY_TYPE[msg.type] ?? 'primary',\n // Chrome's User Timings extension surfaces `properties` as a\n // key/value table in the entry detail panel — perfect for\n // per-message bandwidth at-a-glance.\n properties: bytes > 0\n ? [\n ['type', msg.type],\n ['bytes', formatBytes(bytes)],\n ]\n : [['type', msg.type]],\n },\n },\n })\n } catch {\n // DevTools may reject the extension payload in older Chromes;\n // ignore.\n }\n}\n\n/**\n * Walk a structured-cloned payload and sum the `byteLength` of every\n * typed array we encounter (one level deep into `features.*` for data\n * packets, one level into `entries[*]` for registry/buffers payloads).\n * Doesn't recurse into arbitrary nested objects — anything past these\n * known shapes contributes 0, which is fine because real bandwidth\n * lives in the typed arrays.\n */\nfunction estimatePayloadBytes(payload: unknown): number {\n if (payload === null || typeof payload !== 'object') return 0\n let total = 0\n // Direct `features` shape on data packets.\n const features = (payload as { features?: Record<string, unknown> }).features\n if (features !== undefined) {\n for (const f of Object.values(features)) {\n total += sumTypedArrays(f)\n }\n }\n return total\n}\n\nfunction sumTypedArrays(node: unknown): number {\n if (node === null || typeof node !== 'object') return 0\n let total = 0\n for (const v of Object.values(node)) {\n if (v && typeof v === 'object' && (v as { byteLength?: number }).byteLength !== undefined && ArrayBuffer.isView(v as ArrayBufferView)) {\n total += (v as ArrayBufferView).byteLength\n continue\n }\n if (v && typeof v === 'object') {\n total += sumTypedArrays(v)\n }\n }\n return total\n}\n\nfunction formatBytes(n: number): string {\n if (n < 1024) return `${n} B`\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`\n return `${(n / (1024 * 1024)).toFixed(2)} MB`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBA,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,MAAM,gBAAwC;AAAA,EAC5C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,KAAK;AAAA,EACL,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;AAEO,SAAS,UAAU,KAAwE;AAChG,MAAI,QAAQ,OAAW;AACvB,MAAI,OAAO,gBAAgB,eAAe,OAAO,YAAY,YAAY,WAAY;AACrF,QAAM,KAAK,IAAI;AACf,MAAI,OAAO,OAAO,YAAY,MAAM,EAAG;AACvC,MAAI;AAIF,UAAM,QAAQ,KAAK,YAAY;AAC/B,UAAM,MAAM,YAAY,IAAI;AAC5B,QAAI,MAAM,MAAO;AAKjB,UAAM,QAAQ,qBAAqB,IAAI,OAAO;AAE9C,gBAAY,QAAQ,OAAO,IAAI,IAAI,IAAI;AAAA,MACrC;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,QACN,UAAU;AAAA,UACR,UAAU;AAAA,UACV,OAAO;AAAA,UACP,YAAY;AAAA,UACZ,OAAO,cAAc,IAAI,IAAI,KAAK;AAAA;AAAA;AAAA;AAAA,UAIlC,YAAY,QAAQ,IAChB;AAAA,YACE,CAAC,QAAQ,IAAI,IAAI;AAAA,YACjB,CAAC,SAAS,YAAY,KAAK,CAAC;AAAA,UAC9B,IACA,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC;AAAA,QACzB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,QAAQ;AAAA,EAGR;AACF;AAUA,SAAS,qBAAqB,SAA0B;AACtD,MAAI,YAAY,QAAQ,OAAO,YAAY,SAAU,QAAO;AAC5D,MAAI,QAAQ;AAEZ,QAAM,WAAY,QAAmD;AACrE,MAAI,aAAa,QAAW;AAC1B,eAAW,KAAK,OAAO,OAAO,QAAQ,GAAG;AACvC,eAAS,eAAe,CAAC;AAAA,IAC3B;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,eAAe,MAAuB;AAC7C,MAAI,SAAS,QAAQ,OAAO,SAAS,SAAU,QAAO;AACtD,MAAI,QAAQ;AACZ,aAAW,KAAK,OAAO,OAAO,IAAI,GAAG;AACnC,QAAI,KAAK,OAAO,MAAM,YAAa,EAA8B,eAAe,UAAa,YAAY,OAAO,CAAoB,GAAG;AACrI,eAAU,EAAsB;AAChC;AAAA,IACF;AACA,QAAI,KAAK,OAAO,MAAM,UAAU;AAC9B,eAAS,eAAe,CAAC;AAAA,IAC3B;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,YAAY,GAAmB;AACtC,MAAI,IAAI,KAAM,QAAO,GAAG,CAAC;AACzB,MAAI,IAAI,OAAO,KAAM,QAAO,IAAI,IAAI,MAAM,QAAQ,CAAC,CAAC;AACpD,SAAO,IAAI,KAAK,OAAO,OAAO,QAAQ,CAAC,CAAC;AAC1C;","names":[]}
@@ -1,27 +0,0 @@
1
- /**
2
- * Log inbound bus messages as User Timing spans on the shared
3
- * **Devtools** track under the **three-flatland** group in Chrome's
4
- * Performance panel. Each span covers the window from when the sender
5
- * stamped the message to when the handler received it — end-to-end
6
- * `BroadcastChannel` delivery latency.
7
- *
8
- * Convention matches `packages/three-flatland/src/debug/perf-track.ts`:
9
- * - track group: `three-flatland`
10
- * - track: `Devtools`
11
- * - entry name: `bus:<type>` (`bus:data`, `bus:ping`, `bus:subscribe:ack`, …)
12
- *
13
- * Older Chromes silently ignore the `detail.devtools` payload and the
14
- * spans show up on the default Timings track instead.
15
- *
16
- * Usage: call `tracePerf(msg)` at the top of the receive handler
17
- * (both the discovery and data routers). Safe in non-performance
18
- * environments — every call is wrapped in a capability check and a
19
- * try/catch so a failed measurement never takes down the client.
20
- */
21
- declare function tracePerf(msg: {
22
- ts: number;
23
- type: string;
24
- payload?: unknown;
25
- } | undefined): void;
26
-
27
- export { tracePerf };
package/dist/plugins.cjs DELETED
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var plugins_exports = {};
30
- __export(plugins_exports, {
31
- EssentialsPlugin: () => EssentialsPlugin,
32
- registerPlugins: () => registerPlugins
33
- });
34
- module.exports = __toCommonJS(plugins_exports);
35
- var EssentialsPlugin = __toESM(require("@tweakpane/plugin-essentials"), 1);
36
- function registerPlugins(pane) {
37
- pane.registerPlugin(EssentialsPlugin);
38
- }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- EssentialsPlugin,
42
- registerPlugins
43
- });
44
- //# sourceMappingURL=plugins.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/plugins.ts"],"sourcesContent":["import type { Pane } from 'tweakpane'\nimport * as EssentialsPlugin from '@tweakpane/plugin-essentials'\n\nexport function registerPlugins(pane: Pane): void {\n pane.registerPlugin(EssentialsPlugin)\n}\n\nexport { EssentialsPlugin }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAAkC;AAE3B,SAAS,gBAAgB,MAAkB;AAChD,OAAK,eAAe,gBAAgB;AACtC;","names":[]}
@@ -1,7 +0,0 @@
1
- import { Pane } from 'tweakpane';
2
- import * as pluginEssentials from '@tweakpane/plugin-essentials';
3
- export { pluginEssentials as EssentialsPlugin };
4
-
5
- declare function registerPlugins(pane: Pane): void;
6
-
7
- export { registerPlugins };
@@ -1,95 +0,0 @@
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 provider_switcher_exports = {};
20
- __export(provider_switcher_exports, {
21
- addProviderSwitcher: () => addProviderSwitcher
22
- });
23
- module.exports = __toCommonJS(provider_switcher_exports);
24
- function addProviderSwitcher(parent, client) {
25
- const blade = parent.addBlade({ view: "separator" });
26
- const bladeEl = blade.element;
27
- bladeEl.innerHTML = "";
28
- bladeEl.className = "tp-cntv";
29
- bladeEl.style.cssText = "display:none";
30
- const row = document.createElement("div");
31
- row.style.cssText = [
32
- "display:grid",
33
- "grid-template-columns:auto 1fr auto",
34
- "align-items:center",
35
- "gap:6px",
36
- "height:calc(var(--cnt-usz, 20px) * 1.1)",
37
- "padding:0 6px",
38
- "font-size:12px",
39
- "line-height:1",
40
- "color:var(--tp-label-foreground-color)",
41
- "font-variant-numeric:tabular-nums",
42
- "user-select:none",
43
- "-webkit-user-select:none"
44
- ].join(";");
45
- const arrowStyle = "cursor:pointer;padding:0 4px;opacity:0.8;font-family:ui-monospace,monospace;";
46
- const prevBtn = document.createElement("span");
47
- prevBtn.textContent = "\u25C0";
48
- prevBtn.style.cssText = arrowStyle;
49
- prevBtn.setAttribute("role", "button");
50
- prevBtn.setAttribute("aria-label", "Previous provider");
51
- const label = document.createElement("span");
52
- label.style.cssText = "text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap";
53
- const nextBtn = document.createElement("span");
54
- nextBtn.textContent = "\u25B6";
55
- nextBtn.style.cssText = arrowStyle;
56
- nextBtn.setAttribute("role", "button");
57
- nextBtn.setAttribute("aria-label", "Next provider");
58
- row.appendChild(prevBtn);
59
- row.appendChild(label);
60
- row.appendChild(nextBtn);
61
- bladeEl.appendChild(row);
62
- function step(delta) {
63
- const providers = client.state.providers;
64
- if (providers.length < 2) return;
65
- const selected = client.state.selectedProviderId;
66
- const idx = Math.max(0, providers.findIndex((p) => p.id === selected));
67
- const next = providers[(idx + delta + providers.length) % providers.length];
68
- client.selectProvider(next.id);
69
- }
70
- prevBtn.addEventListener("click", () => step(-1));
71
- nextBtn.addEventListener("click", () => step(1));
72
- const unsubscribe = client.addListener((s) => {
73
- bladeEl.style.display = s.providers.length >= 2 ? "" : "none";
74
- const current = s.providers.find((p) => p.id === s.selectedProviderId);
75
- if (current) {
76
- label.textContent = `${current.kind}:${current.name}`;
77
- label.title = `${current.kind}:${current.name} (${current.id.slice(0, 8)})`;
78
- } else {
79
- label.textContent = "\u2014";
80
- label.title = "";
81
- }
82
- });
83
- return {
84
- element: bladeEl,
85
- dispose() {
86
- unsubscribe();
87
- blade.dispose();
88
- }
89
- };
90
- }
91
- // Annotate the CommonJS export names for ESM import in node:
92
- 0 && (module.exports = {
93
- addProviderSwitcher
94
- });
95
- //# sourceMappingURL=provider-switcher.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/provider-switcher.ts"],"sourcesContent":["/**\n * Provider switcher — a single-row blade with ◀ / ▶ arrows + the\n * selected provider's name. Hidden while only one provider is known\n * (the common case); shown automatically whenever two or more appear\n * on the discovery bus.\n */\n\nimport type { FolderApi, Pane } from 'tweakpane'\n\nimport type { DevtoolsClient } from './devtools-client.js'\n\nexport interface ProviderSwitcherHandle {\n readonly element: HTMLElement\n dispose(): void\n}\n\nexport function addProviderSwitcher(\n parent: Pane | FolderApi,\n client: DevtoolsClient,\n): ProviderSwitcherHandle {\n // Separator-blade shim so the rack ordering stays correct; we swap\n // its innards for our own layout (same pattern as stats-graph / row).\n const blade = parent.addBlade({ view: 'separator' }) as unknown as {\n element: HTMLElement\n dispose(): void\n }\n const bladeEl = blade.element\n bladeEl.innerHTML = ''\n bladeEl.className = 'tp-cntv'\n bladeEl.style.cssText = 'display:none' // Hidden until >= 2 providers\n\n const row = document.createElement('div')\n row.style.cssText = [\n 'display:grid',\n 'grid-template-columns:auto 1fr auto',\n 'align-items:center',\n 'gap:6px',\n 'height:calc(var(--cnt-usz, 20px) * 1.1)',\n 'padding:0 6px',\n 'font-size:12px',\n 'line-height:1',\n 'color:var(--tp-label-foreground-color)',\n 'font-variant-numeric:tabular-nums',\n 'user-select:none',\n '-webkit-user-select:none',\n ].join(';')\n\n const arrowStyle =\n 'cursor:pointer;padding:0 4px;opacity:0.8;font-family:ui-monospace,monospace;'\n const prevBtn = document.createElement('span')\n prevBtn.textContent = '◀'\n prevBtn.style.cssText = arrowStyle\n prevBtn.setAttribute('role', 'button')\n prevBtn.setAttribute('aria-label', 'Previous provider')\n\n const label = document.createElement('span')\n label.style.cssText = 'text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap'\n\n const nextBtn = document.createElement('span')\n nextBtn.textContent = '▶'\n nextBtn.style.cssText = arrowStyle\n nextBtn.setAttribute('role', 'button')\n nextBtn.setAttribute('aria-label', 'Next provider')\n\n row.appendChild(prevBtn)\n row.appendChild(label)\n row.appendChild(nextBtn)\n bladeEl.appendChild(row)\n\n function step(delta: number): void {\n const providers = client.state.providers\n if (providers.length < 2) return\n const selected = client.state.selectedProviderId\n const idx = Math.max(0, providers.findIndex((p) => p.id === selected))\n const next = providers[(idx + delta + providers.length) % providers.length]!\n client.selectProvider(next.id)\n }\n\n prevBtn.addEventListener('click', () => step(-1))\n nextBtn.addEventListener('click', () => step(1))\n\n const unsubscribe = client.addListener((s) => {\n // Visibility: only when multi-provider.\n bladeEl.style.display = s.providers.length >= 2 ? '' : 'none'\n const current = s.providers.find((p) => p.id === s.selectedProviderId)\n if (current) {\n // Prefix with kind so the user can tell flatland's system provider\n // apart from a user provider with the same display name.\n label.textContent = `${current.kind}:${current.name}`\n label.title = `${current.kind}:${current.name} (${current.id.slice(0, 8)})`\n } else {\n label.textContent = '—'\n label.title = ''\n }\n })\n\n return {\n element: bladeEl,\n dispose() {\n unsubscribe()\n blade.dispose()\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,oBACd,QACA,QACwB;AAGxB,QAAM,QAAQ,OAAO,SAAS,EAAE,MAAM,YAAY,CAAC;AAInD,QAAM,UAAU,MAAM;AACtB,UAAQ,YAAY;AACpB,UAAQ,YAAY;AACpB,UAAQ,MAAM,UAAU;AAExB,QAAM,MAAM,SAAS,cAAc,KAAK;AACxC,MAAI,MAAM,UAAU;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,GAAG;AAEV,QAAM,aACJ;AACF,QAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,UAAQ,cAAc;AACtB,UAAQ,MAAM,UAAU;AACxB,UAAQ,aAAa,QAAQ,QAAQ;AACrC,UAAQ,aAAa,cAAc,mBAAmB;AAEtD,QAAM,QAAQ,SAAS,cAAc,MAAM;AAC3C,QAAM,MAAM,UAAU;AAEtB,QAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,UAAQ,cAAc;AACtB,UAAQ,MAAM,UAAU;AACxB,UAAQ,aAAa,QAAQ,QAAQ;AACrC,UAAQ,aAAa,cAAc,eAAe;AAElD,MAAI,YAAY,OAAO;AACvB,MAAI,YAAY,KAAK;AACrB,MAAI,YAAY,OAAO;AACvB,UAAQ,YAAY,GAAG;AAEvB,WAAS,KAAK,OAAqB;AACjC,UAAM,YAAY,OAAO,MAAM;AAC/B,QAAI,UAAU,SAAS,EAAG;AAC1B,UAAM,WAAW,OAAO,MAAM;AAC9B,UAAM,MAAM,KAAK,IAAI,GAAG,UAAU,UAAU,CAAC,MAAM,EAAE,OAAO,QAAQ,CAAC;AACrE,UAAM,OAAO,WAAW,MAAM,QAAQ,UAAU,UAAU,UAAU,MAAM;AAC1E,WAAO,eAAe,KAAK,EAAE;AAAA,EAC/B;AAEA,UAAQ,iBAAiB,SAAS,MAAM,KAAK,EAAE,CAAC;AAChD,UAAQ,iBAAiB,SAAS,MAAM,KAAK,CAAC,CAAC;AAE/C,QAAM,cAAc,OAAO,YAAY,CAAC,MAAM;AAE5C,YAAQ,MAAM,UAAU,EAAE,UAAU,UAAU,IAAI,KAAK;AACvD,UAAM,UAAU,EAAE,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,kBAAkB;AACrE,QAAI,SAAS;AAGX,YAAM,cAAc,GAAG,QAAQ,IAAI,IAAI,QAAQ,IAAI;AACnD,YAAM,QAAQ,GAAG,QAAQ,IAAI,IAAI,QAAQ,IAAI,KAAK,QAAQ,GAAG,MAAM,GAAG,CAAC,CAAC;AAAA,IAC1E,OAAO;AACL,YAAM,cAAc;AACpB,YAAM,QAAQ;AAAA,IAChB;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,UAAU;AACR,kBAAY;AACZ,YAAM,QAAQ;AAAA,IAChB;AAAA,EACF;AACF;","names":[]}
@@ -1,18 +0,0 @@
1
- import { Pane, FolderApi } from 'tweakpane';
2
- import { DevtoolsClient } from './devtools-client.cjs';
3
- import 'three-flatland/debug-protocol';
4
-
5
- /**
6
- * Provider switcher — a single-row blade with ◀ / ▶ arrows + the
7
- * selected provider's name. Hidden while only one provider is known
8
- * (the common case); shown automatically whenever two or more appear
9
- * on the discovery bus.
10
- */
11
-
12
- interface ProviderSwitcherHandle {
13
- readonly element: HTMLElement;
14
- dispose(): void;
15
- }
16
- declare function addProviderSwitcher(parent: Pane | FolderApi, client: DevtoolsClient): ProviderSwitcherHandle;
17
-
18
- export { type ProviderSwitcherHandle, addProviderSwitcher };
@@ -1,59 +0,0 @@
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 devtools_provider_exports = {};
20
- __export(devtools_provider_exports, {
21
- DevtoolsProvider: () => DevtoolsProvider
22
- });
23
- module.exports = __toCommonJS(devtools_provider_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_react = require("react");
26
- var import_fiber = require("@react-three/fiber");
27
- var import_three_flatland = require("three-flatland");
28
- function DevtoolsProvider(props) {
29
- if (process.env.NODE_ENV === "production" && process.env.FL_DEVTOOLS !== "true") return null;
30
- if (!(0, import_three_flatland.isDevtoolsActive)()) return null;
31
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DevtoolsProviderActive, { ...props });
32
- }
33
- function DevtoolsProviderActive({
34
- name,
35
- id,
36
- discoveryChannelName
37
- }) {
38
- const handleRef = (0, import_react.useRef)(null);
39
- (0, import_fiber.useFrame)((state) => {
40
- const h = handleRef.current;
41
- if (!h || h.disposed) return;
42
- h.endFrame(state.gl);
43
- h.beginFrame(performance.now(), state.gl);
44
- });
45
- (0, import_react.useEffect)(() => {
46
- const handle = (0, import_three_flatland.createDevtoolsProvider)({ name, id, discoveryChannelName });
47
- handleRef.current = handle;
48
- return () => {
49
- handle.dispose();
50
- if (handleRef.current === handle) handleRef.current = null;
51
- };
52
- }, [name, id, discoveryChannelName]);
53
- return null;
54
- }
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- DevtoolsProvider
58
- });
59
- //# sourceMappingURL=devtools-provider.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react/devtools-provider.tsx"],"sourcesContent":["import { useEffect, useRef, type ReactElement } from 'react'\nimport { useFrame } from '@react-three/fiber'\nimport {\n createDevtoolsProvider,\n isDevtoolsActive,\n type DevtoolsProviderHandle,\n} from 'three-flatland'\n\n// Types the build-time `process.env` reads without requiring @types/node (shadows the global where present; erased at compile).\ndeclare const process: { env: { NODE_ENV?: string; FL_DEVTOOLS?: string } }\n\nexport interface DevtoolsProviderProps {\n /** Display name shown in the consumer's provider switcher. */\n name?: string\n /** Optional explicit provider id (defaults to a fresh uuid). */\n id?: string\n /** Override the discovery channel name (advanced). */\n discoveryChannelName?: string\n}\n\n/**\n * Mount inside `<Canvas>` to publish stats / registry / buffer feeds.\n * Drop it next to your scene — no children, no wrapping:\n *\n * ```tsx\n * <Canvas>\n * <DevtoolsProvider name=\"basic-sprite\" />\n * <Scene />\n * </Canvas>\n * ```\n *\n * Passive sampler — does NOT take over rendering. Registers a\n * default-phase `useFrame` and snaps `endFrame → beginFrame` once per\n * tick, leaving R3F's auto-render (and any explicit render useFrame\n * like Flatland's `flatland.render(gl)`) completely alone. The\n * `cpuMs` value reported is the inter-tick interval — equivalent to\n * frame time at 60fps, slightly looser than Flatland's internal\n * tight-bracket measurement when stressed (Flatland's number isolates\n * just its `render()` work; ours covers the whole rAF interval).\n *\n * **Safe to leave in production.** The outer component short-circuits\n * when the devtools build gate is false (build-time, terser folds the\n * branch away) or when `isDevtoolsActive()` is false (runtime toggle). In\n * those cases the inner component never mounts, no `useFrame` is\n * registered, and R3F's normal auto-render path is untouched.\n */\nexport function DevtoolsProvider(\n props: DevtoolsProviderProps,\n): ReactElement | null {\n if (process.env.NODE_ENV === 'production' && process.env.FL_DEVTOOLS !== 'true') return null\n if (!isDevtoolsActive()) return null\n return <DevtoolsProviderActive {...props} />\n}\n\nfunction DevtoolsProviderActive({\n name,\n id,\n discoveryChannelName,\n}: DevtoolsProviderProps): null {\n // Provider creation lives in `useEffect` only — never in render. R3F's\n // concurrent-rendering + StrictMode double-render can throw away renders\n // before commit, and any side effect we performed in render (like\n // opening BroadcastChannels) would leak as an orphan. Keeping the only\n // construction site inside the committed effect guarantees one live\n // provider per mounted component instance.\n const handleRef = useRef<DevtoolsProviderHandle | null>(null)\n\n useFrame((state) => {\n const h = handleRef.current\n if (!h || h.disposed) return\n // Default-phase `useFrame` runs every rAF tick BEFORE R3F's\n // auto-render (or whatever render useFrame the example registered).\n // We close the previous tick's window and open the next one, so\n // `cpuMs` measures the full inter-tick interval. We deliberately\n // do NOT use `phase: 'render'` — that would steal R3F's render\n // slot and prevent users from driving their own render path\n // (Flatland's `flatland.render(gl)`, custom passes, etc.).\n h.endFrame(state.gl as never)\n h.beginFrame(performance.now(), state.gl as never)\n })\n\n useEffect(() => {\n const handle = createDevtoolsProvider({ name, id, discoveryChannelName })\n handleRef.current = handle\n return () => {\n handle.dispose()\n if (handleRef.current === handle) handleRef.current = null\n }\n }, [name, id, discoveryChannelName])\n\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDS;AAnDT,mBAAqD;AACrD,mBAAyB;AACzB,4BAIO;AAwCA,SAAS,iBACd,OACqB;AACrB,MAAI,QAAQ,IAAI,aAAa,gBAAgB,QAAQ,IAAI,gBAAgB,OAAQ,QAAO;AACxF,MAAI,KAAC,wCAAiB,EAAG,QAAO;AAChC,SAAO,4CAAC,0BAAwB,GAAG,OAAO;AAC5C;AAEA,SAAS,uBAAuB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAAgC;AAO9B,QAAM,gBAAY,qBAAsC,IAAI;AAE5D,6BAAS,CAAC,UAAU;AAClB,UAAM,IAAI,UAAU;AACpB,QAAI,CAAC,KAAK,EAAE,SAAU;AAQtB,MAAE,SAAS,MAAM,EAAW;AAC5B,MAAE,WAAW,YAAY,IAAI,GAAG,MAAM,EAAW;AAAA,EACnD,CAAC;AAED,8BAAU,MAAM;AACd,UAAM,aAAS,8CAAuB,EAAE,MAAM,IAAI,qBAAqB,CAAC;AACxE,cAAU,UAAU;AACpB,WAAO,MAAM;AACX,aAAO,QAAQ;AACf,UAAI,UAAU,YAAY,OAAQ,WAAU,UAAU;AAAA,IACxD;AAAA,EACF,GAAG,CAAC,MAAM,IAAI,oBAAoB,CAAC;AAEnC,SAAO;AACT;","names":[]}
@@ -1,39 +0,0 @@
1
- import { ReactElement } from 'react';
2
-
3
- interface DevtoolsProviderProps {
4
- /** Display name shown in the consumer's provider switcher. */
5
- name?: string;
6
- /** Optional explicit provider id (defaults to a fresh uuid). */
7
- id?: string;
8
- /** Override the discovery channel name (advanced). */
9
- discoveryChannelName?: string;
10
- }
11
- /**
12
- * Mount inside `<Canvas>` to publish stats / registry / buffer feeds.
13
- * Drop it next to your scene — no children, no wrapping:
14
- *
15
- * ```tsx
16
- * <Canvas>
17
- * <DevtoolsProvider name="basic-sprite" />
18
- * <Scene />
19
- * </Canvas>
20
- * ```
21
- *
22
- * Passive sampler — does NOT take over rendering. Registers a
23
- * default-phase `useFrame` and snaps `endFrame → beginFrame` once per
24
- * tick, leaving R3F's auto-render (and any explicit render useFrame
25
- * like Flatland's `flatland.render(gl)`) completely alone. The
26
- * `cpuMs` value reported is the inter-tick interval — equivalent to
27
- * frame time at 60fps, slightly looser than Flatland's internal
28
- * tight-bracket measurement when stressed (Flatland's number isolates
29
- * just its `render()` work; ours covers the whole rAF interval).
30
- *
31
- * **Safe to leave in production.** The outer component short-circuits
32
- * when the devtools build gate is false (build-time, terser folds the
33
- * branch away) or when `isDevtoolsActive()` is false (runtime toggle). In
34
- * those cases the inner component never mounts, no `useFrame` is
35
- * registered, and R3F's normal auto-render path is untouched.
36
- */
37
- declare function DevtoolsProvider(props: DevtoolsProviderProps): ReactElement | null;
38
-
39
- export { DevtoolsProvider, type DevtoolsProviderProps };
@@ -1,49 +0,0 @@
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_fps_graph_exports = {};
20
- __export(use_fps_graph_exports, {
21
- useFpsGraph: () => useFpsGraph
22
- });
23
- module.exports = __toCommonJS(use_fps_graph_exports);
24
- var import_react = require("react");
25
- function useFpsGraph(parent) {
26
- const graphRef = (0, import_react.useRef)(null);
27
- (0, import_react.useEffect)(() => {
28
- if (!parent) return;
29
- const graph = parent.addBlade({
30
- view: "fpsgraph",
31
- label: "fps",
32
- rows: 2
33
- });
34
- graphRef.current = graph;
35
- return () => {
36
- graph.dispose();
37
- graphRef.current = null;
38
- };
39
- }, [parent]);
40
- return {
41
- begin: () => graphRef.current?.begin(),
42
- end: () => graphRef.current?.end()
43
- };
44
- }
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- useFpsGraph
48
- });
49
- //# sourceMappingURL=use-fps-graph.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react/use-fps-graph.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport type { FpsGraphBladeApi } from '@tweakpane/plugin-essentials'\nimport type { PaneParent } from './use-pane-input.js'\n\nexport interface FpsGraphHandle {\n begin: () => void\n end: () => void\n}\n\n/**\n * Add an FPS graph blade. Returns { begin, end } for use inside useFrame.\n * If the pane was created with `fps: true` (default), you can skip this hook\n * and use paneBundle.fpsGraph directly.\n */\nexport function useFpsGraph(parent: PaneParent | null): FpsGraphHandle {\n const graphRef = useRef<FpsGraphBladeApi | null>(null)\n\n useEffect(() => {\n if (!parent) return\n\n const graph = parent.addBlade({\n view: 'fpsgraph',\n label: 'fps',\n rows: 2,\n }) as FpsGraphBladeApi\n\n graphRef.current = graph\n\n return () => {\n graph.dispose()\n graphRef.current = null\n }\n }, [parent])\n\n return {\n begin: () => graphRef.current?.begin(),\n end: () => graphRef.current?.end(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAc3B,SAAS,YAAY,QAA2C;AACrE,QAAM,eAAW,qBAAgC,IAAI;AAErD,8BAAU,MAAM;AACd,QAAI,CAAC,OAAQ;AAEb,UAAM,QAAQ,OAAO,SAAS;AAAA,MAC5B,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,IACR,CAAC;AAED,aAAS,UAAU;AAEnB,WAAO,MAAM;AACX,YAAM,QAAQ;AACd,eAAS,UAAU;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AAAA,IACL,OAAO,MAAM,SAAS,SAAS,MAAM;AAAA,IACrC,KAAK,MAAM,SAAS,SAAS,IAAI;AAAA,EACnC;AACF;","names":[]}
@@ -1,15 +0,0 @@
1
- import { PaneParent } from './use-pane-input.cjs';
2
- import 'tweakpane';
3
-
4
- interface FpsGraphHandle {
5
- begin: () => void;
6
- end: () => void;
7
- }
8
- /**
9
- * Add an FPS graph blade. Returns { begin, end } for use inside useFrame.
10
- * If the pane was created with `fps: true` (default), you can skip this hook
11
- * and use paneBundle.fpsGraph directly.
12
- */
13
- declare function useFpsGraph(parent: PaneParent | null): FpsGraphHandle;
14
-
15
- export { type FpsGraphHandle, useFpsGraph };
@@ -1,58 +0,0 @@
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_button_exports = {};
20
- __export(use_pane_button_exports, {
21
- usePaneButton: () => usePaneButton
22
- });
23
- module.exports = __toCommonJS(use_pane_button_exports);
24
- var import_react = require("react");
25
- function usePaneButton(parent, title, onClick) {
26
- const callbackRef = (0, import_react.useRef)(onClick);
27
- callbackRef.current = onClick;
28
- const buttonRef = (0, import_react.useRef)(null);
29
- const mountedRef = (0, import_react.useRef)(false);
30
- if (parent && buttonRef.current === null) {
31
- const button = parent.addButton({ title });
32
- button.on("click", () => callbackRef.current());
33
- buttonRef.current = button;
34
- }
35
- (0, import_react.useEffect)(() => {
36
- mountedRef.current = true;
37
- if (parent && buttonRef.current === null) {
38
- const button = parent.addButton({ title });
39
- button.on("click", () => callbackRef.current());
40
- buttonRef.current = button;
41
- }
42
- return () => {
43
- const button = buttonRef.current;
44
- setTimeout(() => {
45
- if (!mountedRef.current && button) {
46
- button.dispose();
47
- if (buttonRef.current === button) buttonRef.current = null;
48
- }
49
- }, 0);
50
- mountedRef.current = false;
51
- };
52
- }, [parent]);
53
- }
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- usePaneButton
57
- });
58
- //# sourceMappingURL=use-pane-button.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react/use-pane-button.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport type { PaneParent } from './use-pane-input.js'\n\n/**\n * Add a button to a Tweakpane parent. Uses a ref for the callback to avoid stale closures.\n * Uses deferred disposal to survive React strict mode.\n */\nexport function usePaneButton(\n parent: PaneParent | null,\n title: string,\n onClick: () => void,\n): void {\n const callbackRef = useRef(onClick)\n callbackRef.current = onClick\n const buttonRef = useRef<{ dispose(): void } | null>(null)\n const mountedRef = useRef(false)\n\n if (parent && buttonRef.current === null) {\n const button = parent.addButton({ title })\n button.on('click', () => callbackRef.current())\n buttonRef.current = button\n }\n\n useEffect(() => {\n mountedRef.current = true\n\n if (parent && buttonRef.current === null) {\n const button = parent.addButton({ title })\n button.on('click', () => callbackRef.current())\n buttonRef.current = button\n }\n\n return () => {\n const button = buttonRef.current\n setTimeout(() => {\n if (!mountedRef.current && button) {\n button.dispose()\n if (buttonRef.current === button) buttonRef.current = null\n }\n }, 0)\n mountedRef.current = false\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [parent])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAO3B,SAAS,cACd,QACA,OACA,SACM;AACN,QAAM,kBAAc,qBAAO,OAAO;AAClC,cAAY,UAAU;AACtB,QAAM,gBAAY,qBAAmC,IAAI;AACzD,QAAM,iBAAa,qBAAO,KAAK;AAE/B,MAAI,UAAU,UAAU,YAAY,MAAM;AACxC,UAAM,SAAS,OAAO,UAAU,EAAE,MAAM,CAAC;AACzC,WAAO,GAAG,SAAS,MAAM,YAAY,QAAQ,CAAC;AAC9C,cAAU,UAAU;AAAA,EACtB;AAEA,8BAAU,MAAM;AACd,eAAW,UAAU;AAErB,QAAI,UAAU,UAAU,YAAY,MAAM;AACxC,YAAM,SAAS,OAAO,UAAU,EAAE,MAAM,CAAC;AACzC,aAAO,GAAG,SAAS,MAAM,YAAY,QAAQ,CAAC;AAC9C,gBAAU,UAAU;AAAA,IACtB;AAEA,WAAO,MAAM;AACX,YAAM,SAAS,UAAU;AACzB,iBAAW,MAAM;AACf,YAAI,CAAC,WAAW,WAAW,QAAQ;AACjC,iBAAO,QAAQ;AACf,cAAI,UAAU,YAAY,OAAQ,WAAU,UAAU;AAAA,QACxD;AAAA,MACF,GAAG,CAAC;AACJ,iBAAW,UAAU;AAAA,IACvB;AAAA,EAEF,GAAG,CAAC,MAAM,CAAC;AACb;","names":[]}
@@ -1,10 +0,0 @@
1
- import { PaneParent } from './use-pane-input.cjs';
2
- import 'tweakpane';
3
-
4
- /**
5
- * Add a button to a Tweakpane parent. Uses a ref for the callback to avoid stale closures.
6
- * Uses deferred disposal to survive React strict mode.
7
- */
8
- declare function usePaneButton(parent: PaneParent | null, title: string, onClick: () => void): void;
9
-
10
- export { usePaneButton };
@@ -1,48 +0,0 @@
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_folder_exports = {};
20
- __export(use_pane_folder_exports, {
21
- usePaneFolder: () => usePaneFolder
22
- });
23
- module.exports = __toCommonJS(use_pane_folder_exports);
24
- var import_react = require("react");
25
- function usePaneFolder(parent, title, options = {}) {
26
- const [folder, setFolder] = (0, import_react.useState)(null);
27
- const getOptions = (0, import_react.useEffectEvent)(() => options);
28
- (0, import_react.useLayoutEffect)(() => {
29
- if (!parent) {
30
- setFolder(null);
31
- return;
32
- }
33
- const f = parent.addFolder({ expanded: false, ...getOptions(), title });
34
- setFolder(f);
35
- return () => {
36
- try {
37
- f.dispose();
38
- } catch {
39
- }
40
- };
41
- }, [parent, title]);
42
- return folder;
43
- }
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- usePaneFolder
47
- });
48
- //# sourceMappingURL=use-pane-folder.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react/use-pane-folder.ts"],"sourcesContent":["import { useEffectEvent, useLayoutEffect, useState } from 'react'\nimport type { FolderApi, FolderParams } from 'tweakpane'\nimport type { PaneParent } from './use-pane-input.js'\n\n/**\n * Create a Tweakpane folder underneath `parent`. Disposes on unmount and\n * recreates when `parent` (or `title`) changes — e.g., when `usePane`\n * tears down and rebuilds its bundle on a StrictMode remount.\n *\n * Returns `null` on the first render before the layout effect commits,\n * then the FolderApi on the next render. The two renders happen\n * synchronously before paint, so consumers don't see a flicker.\n */\nexport function usePaneFolder(\n parent: PaneParent | null,\n title: string,\n options: Partial<FolderParams> = {},\n): FolderApi | null {\n const [folder, setFolder] = useState<FolderApi | null>(null)\n\n // Read the latest `options` at (re)create time without making them a\n // dependency — useEffectEvent captures current props non-reactively, so\n // changing options doesn't tear down and rebuild the folder.\n const getOptions = useEffectEvent(() => options)\n\n useLayoutEffect(() => {\n if (!parent) {\n setFolder(null)\n return\n }\n const f = parent.addFolder({ expanded: false, ...getOptions(), title })\n setFolder(f)\n return () => {\n try {\n f.dispose()\n } catch {\n // Parent may have been disposed first (cascade), in which case\n // the folder is already gone. Ignore.\n }\n }\n }, [parent, title])\n\n return folder\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0D;AAanD,SAAS,cACd,QACA,OACA,UAAiC,CAAC,GAChB;AAClB,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAA2B,IAAI;AAK3D,QAAM,iBAAa,6BAAe,MAAM,OAAO;AAE/C,oCAAgB,MAAM;AACpB,QAAI,CAAC,QAAQ;AACX,gBAAU,IAAI;AACd;AAAA,IACF;AACA,UAAM,IAAI,OAAO,UAAU,EAAE,UAAU,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;AACtE,cAAU,CAAC;AACX,WAAO,MAAM;AACX,UAAI;AACF,UAAE,QAAQ;AAAA,MACZ,QAAQ;AAAA,MAGR;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,KAAK,CAAC;AAElB,SAAO;AACT;","names":[]}