@dimina-kit/devtools 0.4.0-dev.20260907055341 → 0.5.0-dev.20260908120530

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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/main/app/window-runtime-services.d.ts +12 -12
  3. package/dist/main/app/window-runtime-services.js +34 -15
  4. package/dist/main/index.bundle.js +6307 -6050
  5. package/dist/main/services/elements-forward/index.d.ts +2 -2
  6. package/dist/main/services/elements-forward/index.js +6 -6
  7. package/dist/main/services/network-forward/body-cache.d.ts +2 -0
  8. package/dist/main/services/network-forward/body-cache.js +4 -0
  9. package/dist/main/services/network-forward/global-body-gate.d.ts +1 -1
  10. package/dist/main/services/network-forward/global-body-gate.js +4 -4
  11. package/dist/main/services/network-forward/http.d.ts +47 -0
  12. package/dist/main/services/network-forward/http.js +162 -0
  13. package/dist/main/services/network-forward/index.d.ts +19 -13
  14. package/dist/main/services/network-forward/index.js +220 -134
  15. package/dist/main/services/network-forward/request-ids.d.ts +5 -0
  16. package/dist/main/services/network-forward/request-ids.js +5 -0
  17. package/dist/main/services/safe-area/index.d.ts +7 -9
  18. package/dist/main/services/safe-area/index.js +7 -14
  19. package/dist/main/services/views/native-simulator-view.js +7 -8
  20. package/dist/main/services/workbench-context.d.ts +3 -3
  21. package/dist/main/services/workbench-context.js +7 -1
  22. package/dist/native-host/render/render.js +525 -482
  23. package/dist/native-host/service/service.js +2 -2
  24. package/dist/preload/shared/api-compat.js +63 -41
  25. package/dist/preload/windows/main.cjs +15 -1
  26. package/dist/preload/windows/main.cjs.map +2 -2
  27. package/dist/preload/windows/simulator.cjs +55 -134
  28. package/dist/preload/windows/simulator.cjs.map +4 -4
  29. package/dist/preload/windows/simulator.js +55 -134
  30. package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
  31. package/dist/renderer/entries/workbench/index.html +1 -1
  32. package/dist/shared/types.d.ts +2 -0
  33. package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
  34. package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
  35. package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
  36. package/dist/simulator/simulator.html +2 -2
  37. package/package.json +12 -12
  38. package/dist/renderer/assets/workbench-BLJ0wKsg.js +0 -5
  39. package/dist/shared/request-core.d.ts +0 -2
  40. package/dist/shared/request-core.js +0 -2
  41. package/dist/simulator/assets/device-shell-pxnZZp10.js +0 -431
  42. package/dist/simulator/assets/simulator-Dwp7lnvu.js +0 -10
  43. package/dist/simulator/assets/simulator-ui-B2ddJB1R.js +0 -2
@@ -0,0 +1,5 @@
1
+ /** Body caches own simulator-CDP and main-process HTTP ids, never native backend ids. */
2
+ export declare const VIRTUAL_REQUEST_ID_PREFIX = "dimina:sim:";
3
+ export declare const NATIVE_HTTP_REQUEST_ID_PREFIX = "dimina:http:";
4
+ export declare const BODY_REQUEST_ID_PREFIXES: readonly ["dimina:sim:", "dimina:http:"];
5
+ //# sourceMappingURL=request-ids.d.ts.map
@@ -0,0 +1,5 @@
1
+ /** Body caches own simulator-CDP and main-process HTTP ids, never native backend ids. */
2
+ export const VIRTUAL_REQUEST_ID_PREFIX = 'dimina:sim:';
3
+ export const NATIVE_HTTP_REQUEST_ID_PREFIX = 'dimina:http:';
4
+ export const BODY_REQUEST_ID_PREFIXES = [VIRTUAL_REQUEST_ID_PREFIX, NATIVE_HTTP_REQUEST_ID_PREFIX];
5
+ //# sourceMappingURL=request-ids.js.map
@@ -3,24 +3,22 @@ import type { ConnectionRegistry } from '@dimina-kit/electron-deck/main';
3
3
  import type { NativeDeviceInfo } from '../../../shared/ipc-channels.js';
4
4
  import { type CdpSessionBroker } from '../cdp-session/index.js';
5
5
  /** What the guest's own page contributes to the inset policy: whether the
6
- * shell draws a tabBar under it, and whether it draws a navigation bar over
7
- * the notch for it. */
6
+ * shell draws a navigation bar over the notch for it. */
8
7
  export interface GuestPageInsetPolicy {
9
- isTabPage: boolean;
10
8
  isCustomNav: boolean;
11
9
  }
12
10
  /**
13
- * Read a guest's inset policy off its render-host URL (`isTab`, `navStyle`
14
- * both written by `buildRenderHostDocumentUrl`). An unparseable URL degrades to
15
- * the default-nav, non-tab policy rather than failing the attach.
11
+ * Read a guest's inset policy off its render-host URL (`navStyle`, written by
12
+ * `buildRenderHostDocumentUrl`). An unparseable URL degrades to the default-nav
13
+ * policy rather than failing the attach.
16
14
  */
17
15
  export declare function parseGuestPageInsetPolicy(src: string): GuestPageInsetPolicy;
18
16
  export interface SafeAreaController {
19
17
  /** Attach the debugger to a freshly-attached render-host guest and push the
20
18
  * current device's insets. `page` selects the top policy (real inset only for
21
- * a custom-nav page) and the bottom policy (0 for tab pages, the real inset
22
- * for full-bleed non-tab pages). No-op (warn) if the guest is already claimed
23
- * by an external CDP client — env then stays 0. */
19
+ * a custom-nav page); the bottom inset always comes from the device. No-op
20
+ * (warn) if the guest is already claimed by an external CDP client — env
21
+ * then stays 0. */
24
22
  applyToGuest(guestWc: WebContents, device: NativeDeviceInfo | null, page: GuestPageInsetPolicy): void;
25
23
  /** Re-push insets to every still-attached guest after a device change (each
26
24
  * guest keeps the page policy it attached with). */
@@ -1,19 +1,16 @@
1
1
  import { createCdpSessionBroker } from '../cdp-session/index.js';
2
2
  /**
3
- * Read a guest's inset policy off its render-host URL (`isTab`, `navStyle`
4
- * both written by `buildRenderHostDocumentUrl`). An unparseable URL degrades to
5
- * the default-nav, non-tab policy rather than failing the attach.
3
+ * Read a guest's inset policy off its render-host URL (`navStyle`, written by
4
+ * `buildRenderHostDocumentUrl`). An unparseable URL degrades to the default-nav
5
+ * policy rather than failing the attach.
6
6
  */
7
7
  export function parseGuestPageInsetPolicy(src) {
8
8
  try {
9
9
  const params = new URL(src).searchParams;
10
- return {
11
- isTabPage: params.get('isTab') === '1',
12
- isCustomNav: params.get('navStyle') === 'custom',
13
- };
10
+ return { isCustomNav: params.get('navStyle') === 'custom' };
14
11
  }
15
12
  catch {
16
- return { isTabPage: false, isCustomNav: false };
13
+ return { isCustomNav: false };
17
14
  }
18
15
  }
19
16
  function guestInsets(device, page) {
@@ -21,13 +18,9 @@ function guestInsets(device, page) {
21
18
  // default-nav page already starts below the shell nav bar, which covers the
22
19
  // notch itself.
23
20
  const top = page.isCustomNav ? (device?.safeAreaInsets.top ?? 0) : 0;
24
- // A tab page's content sits above the shell-drawn tabBar (which fills the
25
- // bottom safe area), so it never borders the bottom unsafe zone. A non-tab
26
- // page is full-bleed to the device bottom, so surface the real inset for its
27
- // own `env(safe-area-inset-bottom)` opt-in.
28
- const bottom = page.isTabPage ? 0 : (device?.safeAreaInsets.bottom ?? 0);
21
+ const bottom = device?.safeAreaInsets.bottom ?? 0;
29
22
  // Left/right come straight from the device (e.g. a landscape Dynamic Island
30
- // rotates into a side notch) — unlike top/bottom they don't depend on page
23
+ // rotates into a side notch) — unlike top they don't depend on page
31
24
  // type, since neither shell chrome nor the tabBar reserves horizontal space.
32
25
  const right = device?.safeAreaInsets.right ?? 0;
33
26
  const left = device?.safeAreaInsets.left ?? 0;
@@ -231,8 +231,8 @@ export function createNativeSimulatorView(ctx, reconciler, deps) {
231
231
  // them with contextIsolation/sandbox off so the render runtime + its preload
232
232
  // share the page realm. (A top-level WebContentsView can host these guests; a
233
233
  // `<webview>` guest cannot — that's the whole point of Option A.)
234
- // Inset policy (`isTab`, `navStyle`) of each attaching guest, captured from
235
- // its render-host URL in will-attach (where `params.src` carries the full
234
+ // Inset policy (`navStyle`) of each attaching guest, captured from its
235
+ // render-host URL in will-attach (where `params.src` carries the full
236
236
  // URL) and consumed FIFO in the matching did-attach — `guestWc.getURL()` is
237
237
  // still empty there.
238
238
  // Per-attach scope: a fresh simWc + handlers are built on every (re)attach.
@@ -261,12 +261,11 @@ export function createNativeSimulatorView(ctx, reconciler, deps) {
261
261
  }
262
262
  catch { /* guest not ready; setNativeSimulatorViewBounds re-applies */ }
263
263
  // Simulate this device's CSS env(safe-area-inset-*) on the fresh guest
264
- // before it paints, so notch-aware page layout resolves correctly. Both
265
- // the top and the bottom inset depend on the page (see services/safe-area):
266
- // only a custom-nav page borders the unsafe top zone, and only a non-tab
267
- // page borders the bottom one. The policy was captured from the
268
- // render-host URL in will-attach (FIFO).
269
- const guestPage = pendingGuestPages.shift() ?? { isTabPage: false, isCustomNav: false };
264
+ // before it paints, so notch-aware page layout resolves correctly. Only
265
+ // the top inset depends on the page (see services/safe-area): only a
266
+ // custom-nav page borders the unsafe top zone. The policy was captured
267
+ // from the render-host URL in will-attach (FIFO).
268
+ const guestPage = pendingGuestPages.shift() ?? { isCustomNav: false };
270
269
  safeArea.applyToGuest(guestWc, ctx.bridge?.getDevice() ?? null, guestPage);
271
270
  // Page-level resource loads (images/fonts/page fetch) run in THIS guest's
272
271
  // network stack, never the simulator's — without this, only wx.request
@@ -148,9 +148,9 @@ export interface WorkbenchContext extends RuntimeContext {
148
148
  * `instance.registerSimulatorApi`; read by the simulator IPC handlers.
149
149
  *
150
150
  * Supplied by {@link AppServices} when the caller has one, and therefore
151
- * shared across contexts: the host registers each handler once, so a window
152
- * opened afterwards must still answer those `wx.*` calls. A context built
153
- * without app services (focused unit tests) gets its own registry.
151
+ * registrations are shared across contexts. The invocation facade supplies
152
+ * THIS window's project path, independently of focus, without changing the
153
+ * app-owned handlers or their lifetime.
154
154
  */
155
155
  simulatorApis: SimulatorApiRegistry;
156
156
  /**
@@ -52,7 +52,13 @@ export function createWorkbenchContext(opts) {
52
52
  ctx.registry.add(() => ctx.cdpSessionBroker.dispose());
53
53
  ctx.trustedWindowSenderIds =
54
54
  opts.appServices?.trustedWindowSenderIds ?? new Map();
55
- ctx.simulatorApis = opts.appServices?.simulatorApis ?? createSimulatorApiRegistry();
55
+ const simulatorApis = opts.appServices?.simulatorApis ?? createSimulatorApiRegistry();
56
+ ctx.simulatorApis = {
57
+ ...simulatorApis,
58
+ invoke: (name, params) => simulatorApis.invoke(name, params, {
59
+ projectPath: ctx.workspace.hasActiveSession() ? ctx.workspace.getProjectPath() : null,
60
+ }),
61
+ };
56
62
  ctx.simulatorUiExtensions = createSimulatorUiExtensionRegistry();
57
63
  ctx.registry.add(() => ctx.simulatorUiExtensions.clear());
58
64
  ctx.windows = createWindowService(opts.mainWindow);