@dimina-kit/devtools 0.4.0-dev.20260703101348 → 0.4.0-dev.20260706125036

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 (45) hide show
  1. package/dist/main/app/app.d.ts +4 -1
  2. package/dist/main/app/app.js +26 -0
  3. package/dist/main/index.bundle.js +194 -8
  4. package/dist/main/ipc/popover.js +10 -1
  5. package/dist/main/ipc/session.js +17 -1
  6. package/dist/main/services/compile-standby.d.ts +26 -0
  7. package/dist/main/services/compile-standby.js +57 -0
  8. package/dist/main/services/notifications/renderer-notifier.d.ts +5 -1
  9. package/dist/main/services/notifications/renderer-notifier.js +6 -0
  10. package/dist/main/services/projects/local-provider.js +4 -0
  11. package/dist/main/services/projects/project-repository.d.ts +7 -1
  12. package/dist/main/services/projects/project-repository.js +24 -0
  13. package/dist/main/services/projects/types.d.ts +25 -1
  14. package/dist/main/services/render-inspect/index.js +4 -4
  15. package/dist/main/services/views/view-manager.d.ts +15 -1
  16. package/dist/main/services/views/view-manager.js +12 -4
  17. package/dist/main/services/workbench-context.js +5 -0
  18. package/dist/main/services/workspace/workspace-service.d.ts +5 -1
  19. package/dist/main/services/workspace/workspace-service.js +15 -4
  20. package/dist/native-host/render/render.js +42 -52
  21. package/dist/native-host/service/service.js +2 -2
  22. package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
  23. package/dist/preload/windows/simulator.cjs.map +1 -1
  24. package/dist/renderer/assets/index-BMqyDx71.js +49 -0
  25. package/dist/renderer/assets/{input-CTb_le7F.js → input-CDAEwpBO.js} +2 -2
  26. package/dist/renderer/assets/ipc-transport-B7eFOR68.css +1 -0
  27. package/dist/renderer/assets/{ipc-transport-Ck5Xa8Tu.js → ipc-transport-_G1k5V1p.js} +2 -2
  28. package/dist/renderer/assets/popover-DEdjK14m.js +2 -0
  29. package/dist/renderer/assets/{select-ozSk5Pt6.js → select-DpKPCh3y.js} +2 -2
  30. package/dist/renderer/assets/{settings-CNwGOI22.js → settings-M5q2elUr.js} +2 -2
  31. package/dist/renderer/assets/{settings-api-DMbMp1Eq.js → settings-api-CDlZoHiO.js} +2 -2
  32. package/dist/renderer/assets/{workbenchSettings-Cr4EHo5w.js → workbenchSettings-CT_H1WhV.js} +2 -2
  33. package/dist/renderer/entries/main/index.html +6 -6
  34. package/dist/renderer/entries/popover/index.html +5 -5
  35. package/dist/renderer/entries/settings/index.html +5 -5
  36. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  37. package/dist/shared/ipc-channels.d.ts +6 -0
  38. package/dist/shared/ipc-channels.js +6 -0
  39. package/dist/shared/ipc-schemas.d.ts +29 -0
  40. package/dist/shared/ipc-schemas.js +34 -0
  41. package/dist/shared/types.d.ts +28 -0
  42. package/package.json +6 -6
  43. package/dist/renderer/assets/index-BwzPwCmM.js +0 -49
  44. package/dist/renderer/assets/ipc-transport-BPWIV5hA.css +0 -1
  45. package/dist/renderer/assets/popover-B1Zu2UQu.js +0 -2
@@ -91,7 +91,7 @@ export function createRenderInspector(options = {}) {
91
91
  if (!(await ensureInjected(wc)))
92
92
  return null;
93
93
  try {
94
- const result = await wc.executeJavaScript('window.__diminaRenderInspect ? window.__diminaRenderInspect.getWxml() : null');
94
+ const result = (await wc.executeJavaScript('window.__diminaRenderInspect ? window.__diminaRenderInspect.getWxml() : null'));
95
95
  return result ?? null;
96
96
  }
97
97
  catch {
@@ -105,7 +105,7 @@ export function createRenderInspector(options = {}) {
105
105
  return null;
106
106
  let inspection;
107
107
  try {
108
- const result = await wc.executeJavaScript(`window.__diminaRenderInspect ? window.__diminaRenderInspect.highlightElement(${JSON.stringify(sid)}) : null`);
108
+ const result = (await wc.executeJavaScript(`window.__diminaRenderInspect ? window.__diminaRenderInspect.highlightElement(${JSON.stringify(sid)}) : null`));
109
109
  inspection = result ?? null;
110
110
  }
111
111
  catch {
@@ -149,11 +149,11 @@ export function createRenderInspector(options = {}) {
149
149
  return;
150
150
  const expression = `window.__diminaRenderInspect && window.__diminaRenderInspect.elementFor(${JSON.stringify(sid)})`;
151
151
  try {
152
- const evaluated = await wc.debugger.sendCommand('Runtime.evaluate', {
152
+ const evaluated = (await wc.debugger.sendCommand('Runtime.evaluate', {
153
153
  expression,
154
154
  returnByValue: false,
155
155
  objectGroup: HOVER_OBJECT_GROUP,
156
- });
156
+ }));
157
157
  const objectId = evaluated?.result?.objectId;
158
158
  if (!objectId)
159
159
  return;
@@ -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
@@ -1,4 +1,4 @@
1
- import type { AppInfo, CompileConfig, ProjectSession } from '../../../shared/types.js';
1
+ import type { AppInfo, CompileConfig, LaunchConfig, ProjectSession } from '../../../shared/types.js';
2
2
  import type { WorkbenchContext } from '../workbench-context.js';
3
3
  import type { Project, ProjectPages, ProjectSettings } from '../projects/project-repository.js';
4
4
  /**
@@ -57,6 +57,10 @@ export interface WorkspaceService {
57
57
  saveCompileConfig(projectPath: string, config: CompileConfig): Promise<void>;
58
58
  getProjectSettings(projectPath: string): ProjectSettings;
59
59
  updateProjectSettings(projectPath: string, patch: Partial<ProjectSettings>): void;
60
+ getLaunchConfigs(projectPath: string): Promise<LaunchConfig[]>;
61
+ saveLaunchConfigs(projectPath: string, configs: LaunchConfig[]): Promise<void>;
62
+ getActiveLaunchConfigId(projectPath: string): Promise<string | null>;
63
+ saveActiveLaunchConfigId(projectPath: string, id: string | null): Promise<void>;
60
64
  }
61
65
  /** Build a workspace service bound to the given workbench context. */
62
66
  export declare function createWorkspaceService(ctx: WorkbenchContext): WorkspaceService;
@@ -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;
@@ -383,6 +386,14 @@ export function createWorkspaceService(ctx) {
383
386
  // own `project.config.json`, not the registry — keep direct repo calls.
384
387
  getProjectSettings: (projectPath) => repo.getProjectSettings(projectPath),
385
388
  updateProjectSettings: (projectPath, patch) => repo.updateProjectSettings(projectPath, patch),
389
+ getLaunchConfigs: async (p) => (provider.getLaunchConfigs ? await provider.getLaunchConfigs(p) : []),
390
+ saveLaunchConfigs: async (p, c) => { if (provider.saveLaunchConfigs)
391
+ await provider.saveLaunchConfigs(p, c); },
392
+ getActiveLaunchConfigId: async (p) => provider.getActiveLaunchConfigId ? await provider.getActiveLaunchConfigId(p) : null,
393
+ saveActiveLaunchConfigId: async (p, id) => {
394
+ if (provider.saveActiveLaunchConfigId)
395
+ await provider.saveActiveLaunchConfigId(p, id);
396
+ },
386
397
  };
387
398
  }
388
399
  //# sourceMappingURL=workspace-service.js.map
@@ -1768,7 +1768,13 @@ var yi = /* @__PURE__ */ new WeakMap(), bi = /* @__PURE__ */ Symbol("_vte"), xi
1768
1768
  r ? (o !== "svg" && wi(r) ? o = "svg" : o !== "mathml" && Ti(r) && (o = "mathml"), i && i.isCE && (i.ce._teleportTargets || (i.ce._teleportTargets = /* @__PURE__ */ new Set())).add(r), n || (b(e, r, a), ji(e, !1))) : process.env.NODE_ENV !== "production" && !n && z("Invalid Teleport target on mount:", r, `(${typeof r})`);
1769
1769
  }, S = (e) => {
1770
1770
  let t = () => {
1771
- yi.get(e) === t && (yi.delete(e), Si(e.props) && (b(e, _(e.el) || n, e.anchor), ji(e, !0)), x(e));
1771
+ if (yi.get(e) === t) {
1772
+ if (yi.delete(e), Si(e.props)) {
1773
+ let t = _(e.el) || n;
1774
+ b(e, t, e.anchor), ji(e, !0);
1775
+ }
1776
+ x(e);
1777
+ }
1772
1778
  };
1773
1779
  yi.set(e, t), Ko(t, a);
1774
1780
  };
@@ -2913,7 +2919,10 @@ function Jo(e, t) {
2913
2919
  }
2914
2920
  }
2915
2921
  }, C = (e, t, n, r, i, a, o, s, c = 0) => {
2916
- for (let l = c; l < e.length; l++) h(null, e[l] = s ? Vs(e[l]) : Bs(e[l]), t, n, r, i, a, o, s);
2922
+ for (let l = c; l < e.length; l++) {
2923
+ let c = e[l] = s ? Vs(e[l]) : Bs(e[l]);
2924
+ h(null, c, t, n, r, i, a, o, s);
2925
+ }
2917
2926
  }, ne = (e, t, n, r, i, o, s) => {
2918
2927
  let c = t.el = e.el;
2919
2928
  process.env.NODE_ENV !== "production" && (c.__vnode = t);
@@ -2936,8 +2945,8 @@ function Jo(e, t) {
2936
2945
  }, r);
2937
2946
  }, re = (e, t, n, r, i, a, o) => {
2938
2947
  for (let s = 0; s < t.length; s++) {
2939
- let c = e[s], l = t[s];
2940
- h(c, l, c.el && (c.type === W || !Os(c, l) || c.shapeFlag & 198) ? d(c.el) : n, null, r, i, a, o, !0);
2948
+ let c = e[s], l = t[s], u = c.el && (c.type === W || !Os(c, l) || c.shapeFlag & 198) ? d(c.el) : n;
2949
+ h(c, l, u, null, r, i, a, o, !0);
2941
2950
  }
2942
2951
  }, w = (e, t, n, r, i) => {
2943
2952
  if (t !== n) {
@@ -6485,7 +6494,10 @@ var Ru = {
6485
6494
  let e = c();
6486
6495
  if (t.value.style = o.indicatorStyle, v.default && v.default()[0].children.length > 0) {
6487
6496
  let e = r.value.querySelector(":first-child");
6488
- e && (m.value = window.getComputedStyle(e).lineHeight || "34px", t.value.style.height = m.value);
6497
+ if (e) {
6498
+ let n = window.getComputedStyle(e);
6499
+ m.value = n.lineHeight || "34px", t.value.style.height = m.value;
6500
+ }
6489
6501
  }
6490
6502
  x = t.value.offsetHeight;
6491
6503
  let s = (e - x) / 2;
@@ -7331,19 +7343,25 @@ var Ru = {
7331
7343
  function be() {
7332
7344
  C &&= (cancelAnimationFrame(C), void 0);
7333
7345
  let e = p.value.getBoundingClientRect();
7334
- t.vertical ? Q("transition", {
7335
- info: n,
7336
- detail: {
7337
- dx: 0,
7338
- dy: te - e.y
7339
- }
7340
- }) : Q("transition", {
7341
- info: n,
7342
- detail: {
7343
- dx: ee - e.x,
7344
- dy: 0
7345
- }
7346
- });
7346
+ if (t.vertical) {
7347
+ let t = te - e.y;
7348
+ Q("transition", {
7349
+ info: n,
7350
+ detail: {
7351
+ dx: 0,
7352
+ dy: t
7353
+ }
7354
+ });
7355
+ } else {
7356
+ let t = ee - e.x;
7357
+ Q("transition", {
7358
+ info: n,
7359
+ detail: {
7360
+ dx: t,
7361
+ dy: 0
7362
+ }
7363
+ });
7364
+ }
7347
7365
  }
7348
7366
  function N() {
7349
7367
  xe(), t.autoplay && i.value > T.value && (ne = setInterval(() => {
@@ -8933,7 +8951,7 @@ var Jp = new class {
8933
8951
  }
8934
8952
  getCanvasImage(e) {
8935
8953
  let t = this.getCanvasResource(e);
8936
- return t || (t = new Image(), t.crossOrigin = "anonymous", this.setCanvasResource(e, t)), t;
8954
+ return t || (t = new Image(), this.setCanvasResource(e, t)), t;
8937
8955
  }
8938
8956
  executeCanvasOperation(e, t, n) {
8939
8957
  switch (t.op) {
@@ -8981,23 +8999,6 @@ var Jp = new class {
8981
8999
  }, e.src = t.src;
8982
9000
  break;
8983
9001
  }
8984
- case "getImageData": {
8985
- let e = this.getCanvasResource(t.contextId);
8986
- if (e) {
8987
- let r = e.getImageData(t.x, t.y, t.width, t.height);
8988
- this.triggerCallback(n, t.callback, {
8989
- data: Array.from(r.data),
8990
- width: r.width,
8991
- height: r.height
8992
- });
8993
- }
8994
- break;
8995
- }
8996
- case "toDataURL": {
8997
- let r = t.mimeType || "image/png", i = t.quality === void 0 ? e.canvas.toDataURL(r) : e.canvas.toDataURL(r, t.quality);
8998
- this.triggerCallback(n, t.callback, i);
8999
- break;
9000
- }
9001
9002
  default: console.warn("[system]", "[render]", `Unsupported canvas node operation: ${t.op}`);
9002
9003
  }
9003
9004
  }
@@ -9228,22 +9229,11 @@ var Jp = new class {
9228
9229
  this.ensureCanvasResolution(d);
9229
9230
  let n = a || d.width, f = o || d.height, p = document.createElement("canvas");
9230
9231
  p.width = s || n, p.height = c || f, p.getContext("2d").drawImage(d, r, i, n, f, 0, 0, p.width, p.height);
9231
- let m = l === "jpg" || l === "jpeg" ? "image/jpeg" : "image/png", h = p.toDataURL(m, u);
9232
- T.invoke({
9233
- type: "invokeAPI",
9234
- target: "container",
9235
- body: {
9236
- name: "saveCanvasTempFile",
9237
- bridgeId: e,
9238
- params: {
9239
- dataURL: h,
9240
- fileType: l,
9241
- success: t.success,
9242
- fail: t.fail,
9243
- complete: t.complete
9244
- }
9245
- }
9246
- });
9232
+ let m = l === "jpg" || l === "jpeg" ? "image/jpeg" : "image/png", h = {
9233
+ errMsg: "canvasToTempFilePath:ok",
9234
+ tempFilePath: p.toDataURL(m, u)
9235
+ };
9236
+ this.triggerCallback(e, t.success, [h], h), this.triggerCallback(e, t.complete, [h], h);
9247
9237
  } catch (n) {
9248
9238
  this.triggerCanvasFailure(e, t, `canvasToTempFilePath:fail ${n.message}`);
9249
9239
  }