@edv4h/usketch-plugin-debug-hud 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { debugHudPlugin } from "./plugin.js";
1
+ export { createDebugHudPlugin } from "./plugin.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { debugHudPlugin } from "./plugin.js";
1
+ export { createDebugHudPlugin } from "./plugin.js";
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
package/dist/plugin.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { UsketchPlugin } from "@edv4h/usketch-shared";
2
- export declare const debugHudPlugin: UsketchPlugin;
2
+ export declare function createDebugHudPlugin(): UsketchPlugin;
3
3
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAqBzF,eAAO,MAAM,cAAc,EAAE,aAuE5B,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAqBzF,wBAAgB,oBAAoB,IAAI,aAAa,CAoEpD"}
package/dist/plugin.js CHANGED
@@ -16,51 +16,49 @@ function formatEventLabel(event, data) {
16
16
  }
17
17
  return event;
18
18
  }
19
- export const debugHudPlugin = {
20
- id: "debug-hud",
21
- name: "Debug HUD",
22
- setup(ctx) {
23
- const fpsCounter = new FpsCounter();
24
- const eventLogger = new EventLogger();
25
- const pointerTracker = new PointerTracker();
26
- const visibility = createVisibilityStore(VISIBILITY_STORAGE_KEY);
27
- // Start FPS counter
28
- fpsCounter.start();
29
- // Monkey-patch emit to capture events. Push is skipped while the HUD is hidden
30
- // so the drag path stays free of EventLogger work when no UI is observing it.
31
- const originalEmit = ctx.events.emit.bind(ctx.events);
32
- ctx.events.emit = (event, data) => {
33
- if (visibility.get() && !EXCLUDED_EVENTS.has(event)) {
34
- const label = formatEventLabel(event, data);
35
- eventLogger.push({ event: label, timestamp: Date.now() });
36
- }
37
- originalEmit(event, data);
38
- };
39
- // Track pointer coordinates
40
- const unsubPointer = ctx.events.on("canvas:pointermove", (data) => {
41
- pointerTracker.update(data.worldPoint, data.screenPoint);
42
- });
43
- // Pick up sync status tracker from window (set by app.tsx)
44
- const syncStatus = globalThis.__usketchSyncStatus;
45
- // Register the fixed layer — always renders, visibility toggled inside component
46
- ctx.layers.register({
47
- id: "debug-hud",
48
- order: 9999,
49
- fixed: true,
50
- render: (renderCtx) => (_jsx(DebugHud, { store: ctx.store, fpsCounter: fpsCounter, eventLogger: eventLogger, pointerTracker: pointerTracker, commands: ctx.commands, tools: ctx.tools, layers: ctx.layers, shapes: ctx.shapes, syncStatus: syncStatus, events: ctx.events, ctx: renderCtx, visibility: visibility })),
51
- });
52
- // Store teardown in closure — no module-level state
53
- this.teardown = () => {
54
- fpsCounter.stop();
55
- pointerTracker.dispose();
56
- eventLogger.dispose();
57
- ctx.events.emit = originalEmit;
58
- unsubPointer();
59
- ctx.layers.unregister("debug-hud");
60
- };
61
- },
62
- teardown() {
63
- // overwritten by setup()
64
- },
65
- };
19
+ export function createDebugHudPlugin() {
20
+ return {
21
+ id: "debug-hud",
22
+ name: "Debug HUD",
23
+ setup(ctx) {
24
+ const fpsCounter = new FpsCounter();
25
+ const eventLogger = new EventLogger();
26
+ const pointerTracker = new PointerTracker();
27
+ const visibility = createVisibilityStore(VISIBILITY_STORAGE_KEY);
28
+ // Start FPS counter
29
+ fpsCounter.start();
30
+ // Monkey-patch emit to capture events. Push is skipped while the HUD is hidden
31
+ // so the drag path stays free of EventLogger work when no UI is observing it.
32
+ const originalEmit = ctx.events.emit.bind(ctx.events);
33
+ ctx.events.emit = (event, data) => {
34
+ if (visibility.get() && !EXCLUDED_EVENTS.has(event)) {
35
+ const label = formatEventLabel(event, data);
36
+ eventLogger.push({ event: label, timestamp: Date.now() });
37
+ }
38
+ originalEmit(event, data);
39
+ };
40
+ // Track pointer coordinates
41
+ const unsubPointer = ctx.events.on("canvas:pointermove", (data) => {
42
+ pointerTracker.update(data.worldPoint, data.screenPoint);
43
+ });
44
+ // Pick up sync status tracker from window (set by app.tsx)
45
+ const syncStatus = globalThis.__usketchSyncStatus;
46
+ // Register the fixed layer — always renders, visibility toggled inside component
47
+ ctx.layers.register({
48
+ id: "debug-hud",
49
+ order: 9999,
50
+ fixed: true,
51
+ render: (renderCtx) => (_jsx(DebugHud, { store: ctx.store, fpsCounter: fpsCounter, eventLogger: eventLogger, pointerTracker: pointerTracker, commands: ctx.commands, tools: ctx.tools, layers: ctx.layers, shapes: ctx.shapes, syncStatus: syncStatus, events: ctx.events, ctx: renderCtx, visibility: visibility })),
52
+ });
53
+ return () => {
54
+ fpsCounter.stop();
55
+ pointerTracker.dispose();
56
+ eventLogger.dispose();
57
+ ctx.events.emit = originalEmit;
58
+ unsubPointer();
59
+ ctx.layers.unregister("debug-hud");
60
+ };
61
+ },
62
+ };
63
+ }
66
64
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,yCAAyC;AACzC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAExD,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAE3D,SAAS,gBAAgB,CAAC,KAAa,EAAE,IAAa;IACrD,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC3D,MAAM,GAAG,GAAG,IAA+B,CAAC;IAC5C,IAAI,IAAI,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,GAAG,KAAK,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC5C,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,WAAW;IAEjB,KAAK,CAAC,GAAG;QACR,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;QAC5C,MAAM,UAAU,GAAG,qBAAqB,CAAC,sBAAsB,CAAC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v4h/usketch-plugin-debug-hud",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@edv4h/usketch-shared": "2.0.0"
15
+ "@edv4h/usketch-shared": "3.0.0"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "react": ">=19"