@dimina-kit/devtools 0.4.0-dev.20260706064107 → 0.4.0-dev.20260706131625

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.
@@ -3705,12 +3705,15 @@ function createViewManager(ctx) {
3705
3705
  function reapplyToolbarDependentOverlays() {
3706
3706
  overlayPanels.reapplyPresentOverlays();
3707
3707
  }
3708
- function disposeAll() {
3708
+ function disposeProjectViews() {
3709
3709
  nativeSimulator.detachSimulator();
3710
3710
  workbench.detachWorkbench();
3711
- hostToolbar.dispose();
3712
3711
  safeArea.dispose();
3713
3712
  }
3713
+ function disposeAll() {
3714
+ disposeProjectViews();
3715
+ hostToolbar.dispose();
3716
+ }
3714
3717
  return {
3715
3718
  attachNativeSimulator: nativeSimulator.attachNativeSimulator,
3716
3719
  softReloadNativeSimulator: nativeSimulator.softReloadNativeSimulator,
@@ -3721,6 +3724,7 @@ function createViewManager(ctx) {
3721
3724
  showPopover: overlayPanels.showPopover,
3722
3725
  hidePopover: overlayPanels.hidePopover,
3723
3726
  repositionAll: () => overlayPanels.reapplyPresentOverlays(),
3727
+ disposeProjectViews,
3724
3728
  disposeAll,
3725
3729
  getSimulatorWebContentsId: nativeSimulator.getSimulatorWebContentsId,
3726
3730
  getSimulatorWebContents: nativeSimulator.getSimulatorWebContents,
@@ -4210,7 +4214,7 @@ function createWorkspaceService(ctx) {
4210
4214
  await disposeSession();
4211
4215
  if (currentProjectPath !== "") lastClosedProjectPath = currentProjectPath;
4212
4216
  currentProjectPath = "";
4213
- ctx.views.disposeAll();
4217
+ ctx.views.disposeProjectViews();
4214
4218
  } finally {
4215
4219
  closing = false;
4216
4220
  release();
@@ -4376,6 +4380,7 @@ function createWorkbenchContext(opts) {
4376
4380
  ctx.simulatorApis = createSimulatorApiRegistry();
4377
4381
  ctx.windows = createWindowService(opts.mainWindow);
4378
4382
  ctx.views = createViewManager(ctx);
4383
+ ctx.registry.add(() => ctx.views.disposeAll());
4379
4384
  ctx.notify = createRendererNotifier(ctx);
4380
4385
  ctx.openSettings = () => openSettingsWindow(ctx);
4381
4386
  ctx.projectsProvider = opts.projectsProvider ?? createLocalProjectsProvider();
@@ -121,7 +121,21 @@ export interface ViewManager {
121
121
  hidePopover(): void;
122
122
  /** Re-apply layout for every currently visible overlay (on window resize). */
123
123
  repositionAll(): void;
124
- /** Destroy all overlay webContents and null out the cached views. */
124
+ /**
125
+ * Destroy the PROJECT-scoped views: the simulator (with its devtools host
126
+ * and settings/popover overlays), the embedded workbench editor, and the
127
+ * per-guest safe-area sessions. Deliberately does NOT touch the host
128
+ * toolbar — its webContents lifecycle belongs to the HOST, so it survives
129
+ * closing a project. This is what `workspace.closeProject()` calls.
130
+ */
131
+ disposeProjectViews(): void;
132
+ /**
133
+ * Destroy ALL managed views: everything `disposeProjectViews()` covers PLUS
134
+ * the host toolbar (its view, port channel, and the ref-counted
135
+ * session-runtime preload registration). App/window teardown only — the
136
+ * context's DisposableRegistry runs this so the toolbar's session-level
137
+ * resources are released exactly once, at the end of the manager's life.
138
+ */
125
139
  disposeAll(): void;
126
140
  /** Return the webContents ID of the currently attached simulator. */
127
141
  getSimulatorWebContentsId(): number | null;
@@ -45,17 +45,24 @@ export function createViewManager(ctx) {
45
45
  function reapplyToolbarDependentOverlays() {
46
46
  overlayPanels.reapplyPresentOverlays();
47
47
  }
48
- function disposeAll() {
48
+ function disposeProjectViews() {
49
49
  // Aggregate simulator detach first (native simulator + devtools host +
50
- // settings/popover), then the workbench, the host toolbar, and the
51
- // per-guest safe-area sessions.
50
+ // settings/popover), then the workbench, then the per-guest safe-area
51
+ // sessions. The host toolbar is exempt: it is HOST-scoped (the host loads
52
+ // and drives it; the height-replay machinery exists precisely for the
53
+ // close-project → reopen flow), so a project's teardown must not kill it.
52
54
  nativeSimulator.detachSimulator();
53
55
  // Embedded workbench editor view (no-op when the host never opted in;
54
56
  // also removes the devtools-theme sync listener).
55
57
  workbench.detachWorkbench();
56
- hostToolbar.dispose();
57
58
  safeArea.dispose();
58
59
  }
60
+ function disposeAll() {
61
+ disposeProjectViews();
62
+ // Host-scoped teardown: the toolbar view, its port channel, and the
63
+ // ref-counted session-runtime preload registration.
64
+ hostToolbar.dispose();
65
+ }
59
66
  return {
60
67
  attachNativeSimulator: nativeSimulator.attachNativeSimulator,
61
68
  softReloadNativeSimulator: nativeSimulator.softReloadNativeSimulator,
@@ -66,6 +73,7 @@ export function createViewManager(ctx) {
66
73
  showPopover: overlayPanels.showPopover,
67
74
  hidePopover: overlayPanels.hidePopover,
68
75
  repositionAll: () => overlayPanels.reapplyPresentOverlays(),
76
+ disposeProjectViews,
69
77
  disposeAll,
70
78
  getSimulatorWebContentsId: nativeSimulator.getSimulatorWebContentsId,
71
79
  getSimulatorWebContents: nativeSimulator.getSimulatorWebContents,
@@ -30,6 +30,11 @@ export function createWorkbenchContext(opts) {
30
30
  ctx.simulatorApis = createSimulatorApiRegistry();
31
31
  ctx.windows = createWindowService(opts.mainWindow);
32
32
  ctx.views = createViewManager(ctx);
33
+ // Full view teardown belongs to the CONTEXT's life, not a project's:
34
+ // closeProject only disposes project-scoped views, so this registration is
35
+ // the one place that releases the HOST-scoped toolbar (its view and the
36
+ // ref-counted session-runtime preload) when the app/context winds down.
37
+ ctx.registry.add(() => ctx.views.disposeAll());
33
38
  ctx.notify = createRendererNotifier(ctx);
34
39
  // Lazy closure (not a bound snapshot): reads ctx.windows/notify/rendererDir
35
40
  // at call time through the live context, which structurally satisfies the
@@ -273,9 +273,9 @@ export function createWorkspaceService(ctx) {
273
273
  },
274
274
  async closeProject() {
275
275
  // Claim a request seq and take ownership immediately (close has no veto),
276
- // then serialize against a concurrent openProject: disposeAll() must not
277
- // run while an open is mid-teardown/commit (it would tear down the views
278
- // the open is building).
276
+ // then serialize against a concurrent openProject: disposeProjectViews()
277
+ // must not run while an open is mid-teardown/commit (it would tear down
278
+ // the views the open is building).
279
279
  const mySeq = opLock.nextSeq();
280
280
  opLock.takeOwnership(mySeq);
281
281
  const release = await opLock.acquire();
@@ -300,7 +300,10 @@ export function createWorkspaceService(ctx) {
300
300
  if (currentProjectPath !== '')
301
301
  lastClosedProjectPath = currentProjectPath;
302
302
  currentProjectPath = '';
303
- ctx.views.disposeAll();
303
+ // Project-scoped views only. The host toolbar is HOST-scoped and must
304
+ // survive closing a project — its full teardown (disposeAll) runs from
305
+ // the context registry at app teardown instead.
306
+ ctx.views.disposeProjectViews();
304
307
  }
305
308
  finally {
306
309
  closing = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimina-kit/devtools",
3
- "version": "0.4.0-dev.20260706064107",
3
+ "version": "0.4.0-dev.20260706131625",
4
4
  "description": "Dimina DevTools - modular developer tools for mini app debugging",
5
5
  "keywords": [
6
6
  "dimina",
@@ -85,9 +85,9 @@
85
85
  "chrome-remote-interface": "^0.34.0",
86
86
  "ws": "^8.20.0",
87
87
  "zod": "^4.3.6",
88
- "@dimina-kit/electron-deck": "0.1.0-dev.20260706064107",
89
- "@dimina-kit/view-anchor": "0.1.0-dev.20260706064107",
90
- "@dimina-kit/devkit": "0.1.2-dev.20260706064107"
88
+ "@dimina-kit/devkit": "0.1.2-dev.20260706131625",
89
+ "@dimina-kit/electron-deck": "0.1.0-dev.20260706131625",
90
+ "@dimina-kit/view-anchor": "0.1.0-dev.20260706131625"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@playwright/test": "^1.59.1",