@dimina-kit/devtools 0.4.0-dev.20260616085026 → 0.4.0-dev.20260618090552

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 (41) hide show
  1. package/README.md +25 -24
  2. package/dist/main/index.bundle.js +219 -14
  3. package/dist/main/ipc/bridge-router.js +44 -1
  4. package/dist/main/runtime/devtools-backend.d.ts +1 -1
  5. package/dist/main/runtime/devtools-backend.js +1 -1
  6. package/dist/main/runtime/miniapp-runtime.d.ts +2 -2
  7. package/dist/main/services/console-forward/index.js +8 -1
  8. package/dist/main/services/elements-forward/index.js +31 -7
  9. package/dist/main/services/layout/index.d.ts +12 -0
  10. package/dist/main/services/layout/index.js +14 -2
  11. package/dist/main/services/projects/types.d.ts +1 -1
  12. package/dist/main/services/projects/types.js +1 -1
  13. package/dist/main/services/service-console/console-api.d.ts +78 -0
  14. package/dist/main/services/service-console/console-api.js +104 -0
  15. package/dist/main/services/service-console/index.d.ts +47 -0
  16. package/dist/main/services/service-console/index.js +139 -0
  17. package/dist/main/services/update/update-manager.d.ts +1 -1
  18. package/dist/main/services/update/update-manager.js +1 -1
  19. package/dist/main/services/views/view-manager.d.ts +7 -0
  20. package/dist/main/services/views/view-manager.js +62 -2
  21. package/dist/main/services/workbench-context.d.ts +7 -6
  22. package/dist/native-host/render/render.js +6 -6
  23. package/dist/renderer/assets/index-DmgWoK8N.js +50 -0
  24. package/dist/renderer/assets/{input-B8NDCYv3.js → input-DiCxYlqY.js} +2 -2
  25. package/dist/renderer/assets/{ipc-transport-DhrajiC5.js → ipc-transport-DSBmaWpJ.js} +1 -1
  26. package/dist/renderer/assets/ipc-transport-DZxf2YoM.css +1 -0
  27. package/dist/renderer/assets/{popover-CI5uE9ZZ.js → popover-CyL_uffj.js} +2 -2
  28. package/dist/renderer/assets/{select-tInleY0z.js → select-BSwvDMtA.js} +2 -2
  29. package/dist/renderer/assets/settings-Ch8XbFxf.js +2 -0
  30. package/dist/renderer/assets/{settings-api-BSKzKiWd.js → settings-api-e9ILe2JO.js} +2 -2
  31. package/dist/renderer/assets/{workbenchSettings-BGxjl25x.js → workbenchSettings-DZsHf1g_.js} +2 -2
  32. package/dist/renderer/entries/main/index.html +6 -6
  33. package/dist/renderer/entries/popover/index.html +5 -5
  34. package/dist/renderer/entries/settings/index.html +11 -5
  35. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  36. package/dist/service-host/preload.cjs +13 -15
  37. package/dist/service-host/sourcemap-rewrite.cjs +21 -12
  38. package/package.json +4 -4
  39. package/dist/renderer/assets/index-BYV0bEvB.js +0 -50
  40. package/dist/renderer/assets/ipc-transport-9agi76dX.css +0 -1
  41. package/dist/renderer/assets/settings-CZJOHt8b.js +0 -2
@@ -8,6 +8,7 @@ import { OPEN_IN_EDITOR_SCHEME, decodeOpenInEditorUrl, resourceUrlToProjectRelat
8
8
  import { createSafeAreaController } from '../safe-area/index.js';
9
9
  import { buildCustomizeTabsScript } from './devtools-tabs.js';
10
10
  import { installElementsForward } from '../elements-forward/index.js';
11
+ import { installServiceConsoleForward } from '../service-console/index.js';
11
12
  import * as layout from '../layout/index.js';
12
13
  import { handleCustomApiBridgeRequest, } from '../simulator/custom-apis.js';
13
14
  import { configureMiniappSession, miniappPartition } from './miniapp-partition.js';
@@ -72,6 +73,10 @@ export function createViewManager(ctx) {
72
73
  // CDP traffic at the active render guest). Installed in
73
74
  // `attachNativeSimulatorDevtoolsHost`, stopped on detach / host destroyed.
74
75
  let stopElementsForward = null;
76
+ // Disposer for the service-layer console capture (CDP `consoleAPICalled` on the
77
+ // service host wc → console fan-out). Installed when the DevTools is pointed at
78
+ // a service host, stopped when that source is closed / swapped.
79
+ let stopServiceConsole = null;
75
80
  let nativeDevtoolsRetryTimer = null;
76
81
  let nativeDevtoolsRetryToken = 0;
77
82
  // Renderer-driven overlay bounds for the simulator DevTools view — the SOLE
@@ -152,6 +157,9 @@ export function createViewManager(ctx) {
152
157
  if (!simulatorViewAdded) {
153
158
  ctx.windows.mainWindow.contentView.addChildView(simulatorView);
154
159
  simulatorViewAdded = true;
160
+ // Re-attaching this base overlay moved it to the top of the z-stack; keep
161
+ // any open settings/popover above it.
162
+ raiseTopOverlays();
155
163
  }
156
164
  simulatorView.setBounds(bounds);
157
165
  }
@@ -264,6 +272,10 @@ export function createViewManager(ctx) {
264
272
  function notifyHostToolbarHeight(height) {
265
273
  hostToolbarLastHeight = height;
266
274
  ctx.notify.hostToolbarHeightChanged(height);
275
+ if (settingsViewAdded)
276
+ applySettingsBounds();
277
+ if (popoverView)
278
+ applyPopoverBounds();
267
279
  }
268
280
  function setHostToolbarHeight(extent) {
269
281
  // While the host pins a fixed height, drop advertiser reports entirely —
@@ -357,17 +369,20 @@ export function createViewManager(ctx) {
357
369
  return hostToolbarPort.send(channel, payload);
358
370
  },
359
371
  };
372
+ function overlayHeaderHeight() {
373
+ return HEADER_H + hostToolbarLastHeight;
374
+ }
360
375
  function applySettingsBounds() {
361
376
  if (!settingsView || ctx.windows.mainWindow.isDestroyed())
362
377
  return;
363
378
  const [w = 0, h = 0] = ctx.windows.mainWindow.getContentSize();
364
- settingsView.setBounds(layout.computeSettingsBounds(w, h, HEADER_H));
379
+ settingsView.setBounds(layout.computeSettingsBounds(w, h, overlayHeaderHeight()));
365
380
  }
366
381
  function applyPopoverBounds() {
367
382
  if (!popoverView || ctx.windows.mainWindow.isDestroyed())
368
383
  return;
369
384
  const [w = 0, h = 0] = ctx.windows.mainWindow.getContentSize();
370
- popoverView.setBounds(layout.computePopoverBounds(w, h, HEADER_H));
385
+ popoverView.setBounds(layout.computePopoverBounds(w, h, overlayHeaderHeight()));
371
386
  }
372
387
  function clearNativeDevtoolsRetry() {
373
388
  nativeDevtoolsRetryToken++;
@@ -379,6 +394,11 @@ export function createViewManager(ctx) {
379
394
  function closeNativeDevtoolsSource() {
380
395
  const source = nativeDevtoolsSourceWc;
381
396
  nativeDevtoolsSourceWc = null;
397
+ try {
398
+ stopServiceConsole?.();
399
+ }
400
+ catch { /* already stopped */ }
401
+ stopServiceConsole = null;
382
402
  if (!source || source.isDestroyed())
383
403
  return;
384
404
  try {
@@ -550,6 +570,19 @@ export function createViewManager(ctx) {
550
570
  // Re-applied on every re-point so a service-host pool swap (fresh
551
571
  // openDevTools) re-asserts the custom tab bar.
552
572
  customizeDevtoolsTabs(simulatorView.webContents);
573
+ // Capture service-layer console via CDP (NOT a preload monkeypatch, which
574
+ // would clobber native source attribution) and feed it to the console
575
+ // fan-out (automation `App.logAdded`). Bound to THIS service wc; replaced
576
+ // on the next re-point via closeNativeDevtoolsSource.
577
+ try {
578
+ stopServiceConsole?.();
579
+ }
580
+ catch { /* already stopped */ }
581
+ stopServiceConsole = installServiceConsoleForward({
582
+ serviceWc: next,
583
+ connections: ctx.connections,
584
+ emit: (entry) => ctx.consoleForwarder?.emit(entry),
585
+ }).stop;
553
586
  return true;
554
587
  }
555
588
  catch {
@@ -1031,6 +1064,11 @@ export function createViewManager(ctx) {
1031
1064
  // Overlay loads mainPreloadPath, so the same navigation rules as the
1032
1065
  // main window apply — see navigation-hardening.ts.
1033
1066
  applyNavigationHardening(settingsView.webContents, ctx.rendererDir);
1067
+ // Transparent backing: the settings view now spans the whole content area
1068
+ // (computeSettingsBounds) and its renderer paints a transparent backdrop +
1069
+ // an opaque right-side panel, so the underlying editor/simulator show
1070
+ // through and a backdrop click closes the overlay (mirrors the popover).
1071
+ settingsView.setBackgroundColor('#00000000');
1034
1072
  await settingsView.webContents.loadFile(path.join(ctx.rendererDir, 'entries/settings/index.html'));
1035
1073
  }
1036
1074
  if (!settingsViewAdded) {
@@ -1048,6 +1086,25 @@ export function createViewManager(ctx) {
1048
1086
  settingsViewAdded = false;
1049
1087
  }
1050
1088
  }
1089
+ // Keep the TOP-tier overlays (settings, popover) above the BASE-tier native
1090
+ // overlays (the native simulator WCV + the console/DevTools WCV). Native
1091
+ // overlays are z-ordered by `addChildView` insertion order — the last-added
1092
+ // sits on top — so RE-attaching a base overlay while a top overlay is open
1093
+ // (e.g. the simulator re-shows on a tab switch, or the console bounds
1094
+ // republish re-adds it) would move the base ABOVE the open settings/popover
1095
+ // and occlude it. Whenever a base overlay is (re)added, re-append the open top
1096
+ // overlays so they stay on top. Settings is re-appended before popover so a
1097
+ // simultaneously-open popover ends up topmost. A no-op when neither is open
1098
+ // (pinned by the z-order guard test).
1099
+ function raiseTopOverlays() {
1100
+ if (ctx.windows.mainWindow.isDestroyed())
1101
+ return;
1102
+ const cv = ctx.windows.mainWindow.contentView;
1103
+ if (settingsView && settingsViewAdded)
1104
+ cv.addChildView(settingsView);
1105
+ if (popoverView)
1106
+ cv.addChildView(popoverView);
1107
+ }
1051
1108
  function showPopover(data) {
1052
1109
  hidePopover();
1053
1110
  const popover = new WebContentsView({
@@ -1134,6 +1191,9 @@ export function createViewManager(ctx) {
1134
1191
  if (!nativeSimulatorViewAdded) {
1135
1192
  ctx.windows.mainWindow.contentView.addChildView(nativeSimulatorView);
1136
1193
  nativeSimulatorViewAdded = true;
1194
+ // Re-attaching this base overlay moved it to the top of the z-stack; keep
1195
+ // any open settings/popover above it.
1196
+ raiseTopOverlays();
1137
1197
  }
1138
1198
  nativeSimulatorView.setBounds(p.bounds);
1139
1199
  const simWc = nativeSimulatorView.webContents;
@@ -137,12 +137,13 @@ export interface WorkbenchContext {
137
137
  */
138
138
  storageApi?: StorageApi;
139
139
  /**
140
- * Native-host console sink. The render-host / service-host guest preloads
141
- * monkeypatch `console.*` and post each entry to main as a `consoleLog`
142
- * container message; bridge-router routes those here. Owned by the
143
- * `ConsoleForwarder` (set in `installBridgeRouter`), whose `emit` fans every
144
- * entry out to subscribers (automation WS) AND mirrors render-layer entries
145
- * into the service host's own console for the embedded DevTools.
140
+ * Native-host console sink. Render-layer entries arrive from
141
+ * render-host/preload.cjs (`console.*` monkeypatch `consoleLog` message);
142
+ * service-layer entries arrive from CDP `Runtime.consoleAPICalled`
143
+ * (services/service-console) so native source attribution is preserved.
144
+ * Owned by the `ConsoleForwarder` (set in `installBridgeRouter`), whose `emit`
145
+ * fans every entry out to subscribers (automation WS) AND mirrors render-layer
146
+ * entries into the service host's own console for the embedded DevTools.
146
147
  */
147
148
  guestConsole?: {
148
149
  emit(entry: unknown): void;
@@ -364,7 +364,7 @@ var T = new class e {
364
364
  }
365
365
  }();
366
366
  //#endregion
367
- //#region ../../node_modules/.pnpm/@vue+shared@3.5.37/node_modules/@vue/shared/dist/shared.esm-bundler.js
367
+ //#region ../../node_modules/.pnpm/@vue+shared@3.5.38/node_modules/@vue/shared/dist/shared.esm-bundler.js
368
368
  // @__NO_SIDE_EFFECTS__
369
369
  function le(e) {
370
370
  let t = /* @__PURE__ */ Object.create(null);
@@ -459,7 +459,7 @@ function ut(e) {
459
459
  return e == null ? "initial" : typeof e == "string" ? e === "" ? " " : e : ((typeof e != "number" || !Number.isFinite(e)) && process.env.NODE_ENV !== "production" && console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:", e), String(e));
460
460
  }
461
461
  //#endregion
462
- //#region ../../node_modules/.pnpm/@vue+reactivity@3.5.37/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
462
+ //#region ../../node_modules/.pnpm/@vue+reactivity@3.5.38/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
463
463
  function dt(e, ...t) {
464
464
  console.warn(`[Vue warn] ${e}`, ...t);
465
465
  }
@@ -1289,7 +1289,7 @@ function Zn(e, t = Infinity, n) {
1289
1289
  return e;
1290
1290
  }
1291
1291
  //#endregion
1292
- //#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.37/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
1292
+ //#region ../../node_modules/.pnpm/@vue+runtime-core@3.5.38/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
1293
1293
  var Qn = [];
1294
1294
  function $n(e) {
1295
1295
  Qn.push(e);
@@ -3959,10 +3959,10 @@ function bc() {
3959
3959
  }
3960
3960
  window.devtoolsFormatters ? window.devtoolsFormatters.push(i) : window.devtoolsFormatters = [i];
3961
3961
  }
3962
- var xc = "3.5.37", Sc = process.env.NODE_ENV === "production" ? de : z;
3962
+ var xc = "3.5.38", Sc = process.env.NODE_ENV === "production" ? de : z;
3963
3963
  process.env.NODE_ENV, process.env.NODE_ENV;
3964
3964
  //#endregion
3965
- //#region ../../node_modules/.pnpm/@vue+runtime-dom@3.5.37/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
3965
+ //#region ../../node_modules/.pnpm/@vue+runtime-dom@3.5.38/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
3966
3966
  var Cc = void 0, wc = typeof window < "u" && window.trustedTypes;
3967
3967
  if (wc) try {
3968
3968
  Cc = /* @__PURE__ */ wc.createPolicy("vue", { createHTML: (e) => e });
@@ -4313,7 +4313,7 @@ function wl(e) {
4313
4313
  return process.env.NODE_ENV !== "production" && window.ShadowRoot && e instanceof window.ShadowRoot && e.mode === "closed" && Sc("mounting on a ShadowRoot with `{mode: \"closed\"}` may lead to unpredictable bugs"), e;
4314
4314
  }
4315
4315
  //#endregion
4316
- //#region ../../node_modules/.pnpm/vue@3.5.37_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.js
4316
+ //#region ../../node_modules/.pnpm/vue@3.5.38_typescript@6.0.3/node_modules/vue/dist/vue.runtime.esm-bundler.js
4317
4317
  function Tl() {
4318
4318
  bc();
4319
4319
  }