@dimina-kit/devtools 0.4.0-dev.20260824071518 → 0.4.0-dev.20260828161241

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 (160) hide show
  1. package/dist/main/api.d.ts +1 -1
  2. package/dist/main/app/app.js +59 -2
  3. package/dist/main/index.bundle.js +986 -245
  4. package/dist/main/ipc/index.d.ts +2 -0
  5. package/dist/main/ipc/index.js +2 -0
  6. package/dist/main/ipc/popover.js +1 -1
  7. package/dist/main/ipc/project-create.d.ts +15 -0
  8. package/dist/main/ipc/project-create.js +26 -0
  9. package/dist/main/ipc/projects.d.ts +1 -1
  10. package/dist/main/ipc/projects.js +36 -1
  11. package/dist/main/ipc/settings.js +2 -1
  12. package/dist/main/ipc/simulator-module.d.ts +4 -3
  13. package/dist/main/ipc/simulator-module.js +4 -5
  14. package/dist/main/ipc/tooltip.js +1 -1
  15. package/dist/main/ipc/views.d.ts +15 -1
  16. package/dist/main/ipc/views.js +61 -4
  17. package/dist/main/runtime/miniapp-runtime.d.ts +87 -19
  18. package/dist/main/services/notifications/renderer-notifier.d.ts +30 -1
  19. package/dist/main/services/notifications/renderer-notifier.js +23 -1
  20. package/dist/main/services/projects/create-project-service.js +9 -2
  21. package/dist/main/services/projects/local-provider.js +6 -0
  22. package/dist/main/services/projects/project-repository.d.ts +29 -1
  23. package/dist/main/services/projects/project-repository.js +151 -17
  24. package/dist/main/services/projects/types.d.ts +13 -2
  25. package/dist/main/services/update/update-manager.d.ts +17 -3
  26. package/dist/main/services/update/update-manager.js +25 -6
  27. package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
  28. package/dist/main/services/views/host-dialog-port-channel.js +15 -0
  29. package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
  30. package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
  31. package/dist/main/services/views/host-dialog-view.d.ts +95 -0
  32. package/dist/main/services/views/host-dialog-view.js +147 -0
  33. package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
  34. package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
  35. package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
  36. package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
  37. package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
  38. package/dist/main/services/views/host-sidebar-view.js +44 -0
  39. package/dist/main/services/views/host-slot-port-channel.d.ts +107 -0
  40. package/dist/main/services/views/host-slot-port-channel.js +261 -0
  41. package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
  42. package/dist/main/services/views/host-slot-session-runtime.js +50 -0
  43. package/dist/main/services/views/host-slot-view.d.ts +109 -0
  44. package/dist/main/services/views/host-slot-view.js +147 -0
  45. package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
  46. package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
  47. package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
  48. package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
  49. package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
  50. package/dist/main/services/views/host-toolbar-view.js +30 -224
  51. package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
  52. package/dist/main/services/views/managed-web-contents-view.js +123 -0
  53. package/dist/main/services/views/overlay-panels-view.d.ts +23 -0
  54. package/dist/main/services/views/overlay-panels-view.js +93 -4
  55. package/dist/main/services/views/placement-reconciler.d.ts +14 -2
  56. package/dist/main/services/views/placement-reconciler.js +27 -0
  57. package/dist/main/services/views/placement-test-driver.d.ts +1 -0
  58. package/dist/main/services/views/placement-test-driver.js +3 -0
  59. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +3 -1
  60. package/dist/main/services/views/view-manager.d.ts +10 -78
  61. package/dist/main/services/views/view-manager.js +34 -3
  62. package/dist/main/services/workbench-context.d.ts +18 -4
  63. package/dist/main/services/workbench-context.js +1 -0
  64. package/dist/main/services/workspace/workspace-service.d.ts +2 -0
  65. package/dist/main/services/workspace/workspace-service.js +14 -0
  66. package/dist/main/utils/paths.d.ts +4 -0
  67. package/dist/main/utils/paths.js +4 -0
  68. package/dist/main/utils/sender-policy.js +10 -0
  69. package/dist/native-host/common/common.js +65 -62
  70. package/dist/native-host/render/render.js +2230 -2052
  71. package/dist/native-host/service/service.js +2 -2
  72. package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
  73. package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
  74. package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
  75. package/dist/preload/runtime/host-dialog-port.js +53 -0
  76. package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
  77. package/dist/preload/runtime/host-dialog-runtime.js +36 -0
  78. package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
  79. package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
  80. package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
  81. package/dist/preload/runtime/host-sidebar-port.js +53 -0
  82. package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
  83. package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
  84. package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
  85. package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
  86. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
  87. package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
  88. package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
  89. package/dist/preload/runtime/host-toolbar-port.js +11 -95
  90. package/dist/preload/runtime/wait-for-slot-root.d.ts +20 -0
  91. package/dist/preload/runtime/wait-for-slot-root.js +52 -0
  92. package/dist/preload/windows/host-dialog-runtime.cjs +353 -0
  93. package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
  94. package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
  95. package/dist/preload/windows/host-dialog-runtime.js +13 -0
  96. package/dist/preload/windows/host-sidebar-runtime.cjs +354 -0
  97. package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
  98. package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
  99. package/dist/preload/windows/host-sidebar-runtime.js +13 -0
  100. package/dist/preload/windows/host-toolbar-runtime.cjs +134 -51
  101. package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
  102. package/dist/preload/windows/simulator.cjs.map +1 -1
  103. package/dist/renderer/assets/button-D5Q2wkXq.js +2 -0
  104. package/dist/renderer/assets/constants-D7DfVqMp.js +2 -0
  105. package/dist/renderer/assets/constants-D8zsejFq.js +2 -0
  106. package/dist/renderer/assets/createLucideIcon-Bqi8hpdi.js +2 -0
  107. package/dist/renderer/assets/dialog-e1TecTOY.js +46 -0
  108. package/dist/renderer/assets/dist-DKWdE1TK.js +2 -0
  109. package/dist/renderer/assets/hostSidebarDefault-B3yLfy8j.js +2 -0
  110. package/dist/renderer/assets/index-CsPD68N_.js +5 -0
  111. package/dist/renderer/assets/input-Ct3alvkq.js +2 -0
  112. package/dist/renderer/assets/ipc-channels-overlays-LsDzGAtV.js +2 -0
  113. package/dist/renderer/assets/jsx-runtime-2vXHouwr.css +1 -0
  114. package/dist/renderer/assets/jsx-runtime-DGLHmmOq.js +9 -0
  115. package/dist/renderer/assets/popover-Dix5cm_b.js +2 -0
  116. package/dist/renderer/assets/project-api-k7Oq9iaq.js +2 -0
  117. package/dist/renderer/assets/projectCreateDialog-Bbjz75bP.js +2 -0
  118. package/dist/renderer/assets/select-acGb0AmJ.js +2 -0
  119. package/dist/renderer/assets/settings-CQrTMr43.js +2 -0
  120. package/dist/renderer/assets/settings-api-CrUQ9rYV.js +2 -0
  121. package/dist/renderer/assets/settings-tab-bar-Cw1kVIf2.js +2 -0
  122. package/dist/renderer/assets/tooltip-B_-_YVbw.js +2 -0
  123. package/dist/renderer/assets/types-CsEKtFyr.js +2 -0
  124. package/dist/renderer/assets/updateDialog-NsF8223A.js +2 -0
  125. package/dist/renderer/assets/utils-kfQov6Pa.js +2 -0
  126. package/dist/renderer/assets/view-api-CLn3rcQE.js +2 -0
  127. package/dist/renderer/assets/{workbenchSettings-oq_EyfKf.js → workbenchSettings-CV4LVA9b.js} +3 -3
  128. package/dist/renderer/entries/host-sidebar-default/index.html +21 -0
  129. package/dist/renderer/entries/main/index.html +17 -8
  130. package/dist/renderer/entries/popover/index.html +10 -7
  131. package/dist/renderer/entries/project-create-dialog/index.html +27 -0
  132. package/dist/renderer/entries/settings/index.html +10 -7
  133. package/dist/renderer/entries/tooltip/index.html +5 -4
  134. package/dist/renderer/entries/update-dialog/index.html +25 -0
  135. package/dist/renderer/entries/workbench-settings/index.html +11 -7
  136. package/dist/service-host/preload.cjs +10 -0
  137. package/dist/shared/constants.d.ts +22 -0
  138. package/dist/shared/constants.js +22 -0
  139. package/dist/shared/ipc-channels-overlays.d.ts +156 -0
  140. package/dist/shared/ipc-channels-overlays.js +186 -0
  141. package/dist/shared/ipc-channels.d.ts +4 -77
  142. package/dist/shared/ipc-channels.js +4 -98
  143. package/dist/shared/ipc-schemas.d.ts +44 -0
  144. package/dist/shared/ipc-schemas.js +55 -0
  145. package/dist/shared/types.d.ts +71 -0
  146. package/dist/shared/view-ids.d.ts +7 -0
  147. package/dist/shared/view-ids.js +10 -0
  148. package/package.json +8 -8
  149. package/dist/renderer/assets/constants-Bdz0LHdy.js +0 -2
  150. package/dist/renderer/assets/index-CtznrmHR.js +0 -49
  151. package/dist/renderer/assets/input-Dmm6nob5.js +0 -2
  152. package/dist/renderer/assets/ipc-transport-BOg0gR9W.js +0 -9
  153. package/dist/renderer/assets/ipc-transport-DgQhZaE9.css +0 -1
  154. package/dist/renderer/assets/popover-Cd1FEGOX.js +0 -2
  155. package/dist/renderer/assets/select-BaYox7If.js +0 -2
  156. package/dist/renderer/assets/settings-BXvwuFaz.js +0 -2
  157. package/dist/renderer/assets/settings-api-Bo9GbYqs.js +0 -2
  158. package/dist/renderer/assets/settings-tab-bar-Beia6lMr.js +0 -2
  159. package/dist/renderer/assets/tooltip-DfQqK3Sk.js +0 -2
  160. package/dist/renderer/assets/view-api-nn69je7A.js +0 -2
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Reverse size-advertiser preload for the host-controllable dialog
3
+ * WebContentsView. Runs in that WCV's OWN renderer (the dialog content's
4
+ * preload). Unlike the toolbar/sidebar (single-axis persistent strips), the
5
+ * dialog self-sizes on BOTH axes — it has no renderer placeholder to anchor
6
+ * against, so main centers it in the main window purely from what this
7
+ * advertiser reports. Two independent `createSizeAdvertiser` instances (one
8
+ * per axis) share the same root and the same outbound channel
9
+ * (`HostDialogAdvertiseSize` carries `{ axis, extent }` for either axis); main
10
+ * re-centers using whichever axes it has measured so far (see
11
+ * `host-dialog-view.ts`'s `reportMeasuredExtent` / default-size fallback).
12
+ */
13
+ /**
14
+ * Attach both axis advertisers to the dialog content's shrink-to-fit root
15
+ * (`[data-host-dialog-root]`), waiting for it if necessary — the root may be
16
+ * mounted asynchronously by a framework rather than present in the initial
17
+ * HTML. That element MUST be shrink-to-fit on BOTH axes — same footgun as
18
+ * the toolbar/sidebar (`createSizeAdvertiser`'s single-axis-ownership
19
+ * requirement), just doubled.
20
+ */
21
+ export declare function installHostDialogAdvertiserWhenReady(): void;
22
+ //# sourceMappingURL=host-dialog-advertiser.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Reverse size-advertiser preload for the host-controllable dialog
3
+ * WebContentsView. Runs in that WCV's OWN renderer (the dialog content's
4
+ * preload). Unlike the toolbar/sidebar (single-axis persistent strips), the
5
+ * dialog self-sizes on BOTH axes — it has no renderer placeholder to anchor
6
+ * against, so main centers it in the main window purely from what this
7
+ * advertiser reports. Two independent `createSizeAdvertiser` instances (one
8
+ * per axis) share the same root and the same outbound channel
9
+ * (`HostDialogAdvertiseSize` carries `{ axis, extent }` for either axis); main
10
+ * re-centers using whichever axes it has measured so far (see
11
+ * `host-dialog-view.ts`'s `reportMeasuredExtent` / default-size fallback).
12
+ */
13
+ import { ipcRenderer } from 'electron';
14
+ import { createSizeAdvertiser } from '@dimina-kit/view-anchor';
15
+ import { ViewChannel } from '../../shared/ipc-channels-overlays.js';
16
+ import { whenSlotRootReady } from './wait-for-slot-root.js';
17
+ /**
18
+ * Attach both axis advertisers to the dialog content's shrink-to-fit root
19
+ * (`[data-host-dialog-root]`), waiting for it if necessary — the root may be
20
+ * mounted asynchronously by a framework rather than present in the initial
21
+ * HTML. That element MUST be shrink-to-fit on BOTH axes — same footgun as
22
+ * the toolbar/sidebar (`createSizeAdvertiser`'s single-axis-ownership
23
+ * requirement), just doubled.
24
+ */
25
+ export function installHostDialogAdvertiserWhenReady() {
26
+ whenSlotRootReady('[data-host-dialog-root]', '[host-dialog-advertiser] no `[data-host-dialog-root]` element found — ' +
27
+ 'not advertising a size yet. The dialog content must wrap itself in a ' +
28
+ 'shrink-to-fit `[data-host-dialog-root]` element so its size is the ' +
29
+ 'content size, not the host-given view size.', (root) => {
30
+ const publish = (size) => {
31
+ ipcRenderer.send(ViewChannel.HostDialogAdvertiseSize, size);
32
+ };
33
+ createSizeAdvertiser(root, { axis: 'block', publish });
34
+ createSizeAdvertiser(root, { axis: 'inline', publish });
35
+ });
36
+ }
37
+ //# sourceMappingURL=host-dialog-advertiser.js.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Preload side of the host-dialog gated narrow channel.
3
+ *
4
+ * ── PUBLIC SURFACE EVOLUTION RULE ───────────────────────────────────────────
5
+ * `window.diminaHostDialog` is a published page-facing API, typed by the
6
+ * exported `DiminaHostDialogPageBridge` (src/main/runtime/miniapp-runtime.ts)
7
+ * — arbitrary host dialog pages compile against it. Members may only be
8
+ * ADDED, never changed: any semantic change to an existing member (signature,
9
+ * return shape, queueing/throw behavior) ships under a NEW name instead.
10
+ * Exception: security fixes / compliance corrections may change existing
11
+ * member semantics, and MUST be called out in the release's version notes.
12
+ * Keep the exported bridge type in lockstep with what is exposed here.
13
+ *
14
+ * Receives the per-load MessagePort main transfers on `did-finish-load`
15
+ * (`ViewChannel.HostDialogPort`, `event.ports[0]`) and bridges it to the page
16
+ * as `window.diminaHostDialog` — EXACTLY `{ send, onMessage }`, functions
17
+ * only. The raw MessagePort never crosses into the main world: the page only
18
+ * ever talks through these two functions, so the `{ channel, payload }`
19
+ * envelope stays the single waist (same posture as the main side's
20
+ * host-dialog-port-channel.ts).
21
+ *
22
+ * Ordering reality this module absorbs — identical to the toolbar's port
23
+ * bridge (see host-toolbar-port.ts for the full rationale): pre-handshake
24
+ * sends queue and bounded-drop, handlers register before the port exists and
25
+ * re-attach across same-load re-handshakes, inbound dispatch drops malformed
26
+ * envelopes without throwing.
27
+ *
28
+ * Shared implementation: see `host-slot-port-bridge.ts` (the toolbar/sidebar/
29
+ * dialog port bridges are otherwise identical; only the constants below
30
+ * differ).
31
+ */
32
+ /**
33
+ * Cap on pre-handshake queued sends. Same rationale and value as
34
+ * `HOST_TOOLBAR_PENDING_LIMIT` — overflow drops the NEWEST envelope, one
35
+ * console.warn per load.
36
+ */
37
+ export declare const HOST_DIALOG_PENDING_LIMIT = 128;
38
+ /**
39
+ * Subscribe the handshake channel and expose the page bridge. Call ONLY from
40
+ * a passing dialog-runtime guard (`activateHostDialogRuntime`) — a failing
41
+ * guard must leave zero footprint (no bridge key, no IPC listener).
42
+ */
43
+ export declare function installHostDialogPortBridge(): void;
44
+ //# sourceMappingURL=host-dialog-port.d.ts.map
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Preload side of the host-dialog gated narrow channel.
3
+ *
4
+ * ── PUBLIC SURFACE EVOLUTION RULE ───────────────────────────────────────────
5
+ * `window.diminaHostDialog` is a published page-facing API, typed by the
6
+ * exported `DiminaHostDialogPageBridge` (src/main/runtime/miniapp-runtime.ts)
7
+ * — arbitrary host dialog pages compile against it. Members may only be
8
+ * ADDED, never changed: any semantic change to an existing member (signature,
9
+ * return shape, queueing/throw behavior) ships under a NEW name instead.
10
+ * Exception: security fixes / compliance corrections may change existing
11
+ * member semantics, and MUST be called out in the release's version notes.
12
+ * Keep the exported bridge type in lockstep with what is exposed here.
13
+ *
14
+ * Receives the per-load MessagePort main transfers on `did-finish-load`
15
+ * (`ViewChannel.HostDialogPort`, `event.ports[0]`) and bridges it to the page
16
+ * as `window.diminaHostDialog` — EXACTLY `{ send, onMessage }`, functions
17
+ * only. The raw MessagePort never crosses into the main world: the page only
18
+ * ever talks through these two functions, so the `{ channel, payload }`
19
+ * envelope stays the single waist (same posture as the main side's
20
+ * host-dialog-port-channel.ts).
21
+ *
22
+ * Ordering reality this module absorbs — identical to the toolbar's port
23
+ * bridge (see host-toolbar-port.ts for the full rationale): pre-handshake
24
+ * sends queue and bounded-drop, handlers register before the port exists and
25
+ * re-attach across same-load re-handshakes, inbound dispatch drops malformed
26
+ * envelopes without throwing.
27
+ *
28
+ * Shared implementation: see `host-slot-port-bridge.ts` (the toolbar/sidebar/
29
+ * dialog port bridges are otherwise identical; only the constants below
30
+ * differ).
31
+ */
32
+ import { ViewChannel } from '../../shared/ipc-channels-overlays.js';
33
+ import { createHostSlotPortBridge } from './host-slot-port-bridge.js';
34
+ /**
35
+ * Cap on pre-handshake queued sends. Same rationale and value as
36
+ * `HOST_TOOLBAR_PENDING_LIMIT` — overflow drops the NEWEST envelope, one
37
+ * console.warn per load.
38
+ */
39
+ export const HOST_DIALOG_PENDING_LIMIT = 128;
40
+ /**
41
+ * Subscribe the handshake channel and expose the page bridge. Call ONLY from
42
+ * a passing dialog-runtime guard (`activateHostDialogRuntime`) — a failing
43
+ * guard must leave zero footprint (no bridge key, no IPC listener).
44
+ */
45
+ export function installHostDialogPortBridge() {
46
+ createHostSlotPortBridge({
47
+ bridgeKey: 'diminaHostDialog',
48
+ channel: ViewChannel.HostDialogPort,
49
+ pendingLimit: HOST_DIALOG_PENDING_LIMIT,
50
+ label: 'host-dialog',
51
+ });
52
+ }
53
+ //# sourceMappingURL=host-dialog-port.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Session-resident host-dialog framework runtime: GUARD + ACTIVATION.
3
+ *
4
+ * Same registration and guard shape as host-toolbar-runtime.ts (see that
5
+ * module for the full rationale): registered once per process on
6
+ * `session.defaultSession`, so it runs in EVERY defaultSession renderer;
7
+ * this guard keeps it inert everywhere except the host-dialog WCV's main
8
+ * frame, identified by `HOST_DIALOG_RUNTIME_MARKER` in that process' argv.
9
+ */
10
+ /**
11
+ * Pure guard predicate: should the dialog runtime activate in a renderer with
12
+ * this `argv` / `isMainFrame`? True only for the MAIN frame of a process whose
13
+ * argv carries the `'--dimina-host-dialog'` marker.
14
+ */
15
+ export declare function shouldActivateHostDialogRuntime(argv: readonly string[], isMainFrame: boolean): boolean;
16
+ /**
17
+ * Run the guard; only when it passes, install the dual-axis size advertiser
18
+ * (`installHostDialogAdvertiserWhenReady`) and the narrow-channel page
19
+ * bridge (`installHostDialogPortBridge` — `window.diminaHostDialog` +
20
+ * the MessagePort handshake listener). Returns whether the runtime
21
+ * activated. A failed guard installs NOTHING (zero footprint in non-dialog
22
+ * windows and subframes: no advertiser, no bridge key, no IPC listener).
23
+ */
24
+ export declare function activateHostDialogRuntime(env: {
25
+ argv: readonly string[];
26
+ isMainFrame: boolean;
27
+ }): boolean;
28
+ //# sourceMappingURL=host-dialog-runtime.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Session-resident host-dialog framework runtime: GUARD + ACTIVATION.
3
+ *
4
+ * Same registration and guard shape as host-toolbar-runtime.ts (see that
5
+ * module for the full rationale): registered once per process on
6
+ * `session.defaultSession`, so it runs in EVERY defaultSession renderer;
7
+ * this guard keeps it inert everywhere except the host-dialog WCV's main
8
+ * frame, identified by `HOST_DIALOG_RUNTIME_MARKER` in that process' argv.
9
+ */
10
+ import { HOST_DIALOG_RUNTIME_MARKER } from '../../shared/constants.js';
11
+ import { installHostDialogAdvertiserWhenReady } from './host-dialog-advertiser.js';
12
+ import { installHostDialogPortBridge } from './host-dialog-port.js';
13
+ /**
14
+ * Pure guard predicate: should the dialog runtime activate in a renderer with
15
+ * this `argv` / `isMainFrame`? True only for the MAIN frame of a process whose
16
+ * argv carries the `'--dimina-host-dialog'` marker.
17
+ */
18
+ export function shouldActivateHostDialogRuntime(argv, isMainFrame) {
19
+ return isMainFrame && argv.includes(HOST_DIALOG_RUNTIME_MARKER);
20
+ }
21
+ /**
22
+ * Run the guard; only when it passes, install the dual-axis size advertiser
23
+ * (`installHostDialogAdvertiserWhenReady`) and the narrow-channel page
24
+ * bridge (`installHostDialogPortBridge` — `window.diminaHostDialog` +
25
+ * the MessagePort handshake listener). Returns whether the runtime
26
+ * activated. A failed guard installs NOTHING (zero footprint in non-dialog
27
+ * windows and subframes: no advertiser, no bridge key, no IPC listener).
28
+ */
29
+ export function activateHostDialogRuntime(env) {
30
+ if (!shouldActivateHostDialogRuntime(env.argv, env.isMainFrame))
31
+ return false;
32
+ installHostDialogAdvertiserWhenReady();
33
+ installHostDialogPortBridge();
34
+ return true;
35
+ }
36
+ //# sourceMappingURL=host-dialog-runtime.js.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Reverse size-advertiser preload for the host-controllable sidebar
3
+ * WebContentsView. Runs in that WCV's OWN renderer (the sidebar content's
4
+ * preload), measures the sidebar's intrinsic inline (width) extent and sends it
5
+ * to the main process. Main pushes the value back to the main-window renderer as
6
+ * `HostSidebarWidthChanged`, which resizes the sidebar placeholder, re-measures
7
+ * the forward anchor, and re-overlays this WCV — closing the dynamic-width loop
8
+ * (see `@dimina-kit/view-anchor` `createSizeAdvertiser`).
9
+ */
10
+ /**
11
+ * Attach the advertiser to the sidebar content's shrink-to-fit root
12
+ * (`[data-host-sidebar-root]`), waiting for it if necessary — the root may be
13
+ * mounted asynchronously by a framework (e.g. React) rather than present in
14
+ * the initial HTML. That element MUST be shrink-to-fit on the inline axis —
15
+ * its width must reflect the content, not the host-applied view width, or the
16
+ * cross-process loop never converges (`createSizeAdvertiser`'s footgun).
17
+ */
18
+ export declare function installHostSidebarAdvertiserWhenReady(): void;
19
+ //# sourceMappingURL=host-sidebar-advertiser.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Reverse size-advertiser preload for the host-controllable sidebar
3
+ * WebContentsView. Runs in that WCV's OWN renderer (the sidebar content's
4
+ * preload), measures the sidebar's intrinsic inline (width) extent and sends it
5
+ * to the main process. Main pushes the value back to the main-window renderer as
6
+ * `HostSidebarWidthChanged`, which resizes the sidebar placeholder, re-measures
7
+ * the forward anchor, and re-overlays this WCV — closing the dynamic-width loop
8
+ * (see `@dimina-kit/view-anchor` `createSizeAdvertiser`).
9
+ */
10
+ import { ipcRenderer } from 'electron';
11
+ import { createSizeAdvertiser } from '@dimina-kit/view-anchor';
12
+ import { ViewChannel } from '../../shared/ipc-channels-overlays.js';
13
+ import { whenSlotRootReady } from './wait-for-slot-root.js';
14
+ /**
15
+ * Attach the advertiser to the sidebar content's shrink-to-fit root
16
+ * (`[data-host-sidebar-root]`), waiting for it if necessary — the root may be
17
+ * mounted asynchronously by a framework (e.g. React) rather than present in
18
+ * the initial HTML. That element MUST be shrink-to-fit on the inline axis —
19
+ * its width must reflect the content, not the host-applied view width, or the
20
+ * cross-process loop never converges (`createSizeAdvertiser`'s footgun).
21
+ */
22
+ export function installHostSidebarAdvertiserWhenReady() {
23
+ whenSlotRootReady('[data-host-sidebar-root]', '[host-sidebar-advertiser] no `[data-host-sidebar-root]` element found — ' +
24
+ 'not advertising a width yet. The sidebar content must wrap itself in a ' +
25
+ 'shrink-to-fit `[data-host-sidebar-root]` element so its inline size is ' +
26
+ 'the content width, not the host-given view size.', (root) => {
27
+ createSizeAdvertiser(root, {
28
+ axis: 'inline',
29
+ publish: (size) => {
30
+ ipcRenderer.send(ViewChannel.HostSidebarAdvertiseWidth, size);
31
+ },
32
+ });
33
+ });
34
+ }
35
+ //# sourceMappingURL=host-sidebar-advertiser.js.map
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Preload side of the host-sidebar gated narrow channel.
3
+ *
4
+ * ── PUBLIC SURFACE EVOLUTION RULE ───────────────────────────────────────────
5
+ * `window.diminaHostSidebar` is a published page-facing API, typed by the
6
+ * exported `DiminaHostSidebarPageBridge` (src/main/runtime/miniapp-runtime.ts)
7
+ * — arbitrary host sidebar pages compile against it. Members may only be
8
+ * ADDED, never changed: any semantic change to an existing member (signature,
9
+ * return shape, queueing/throw behavior) ships under a NEW name instead.
10
+ * Exception: security fixes / compliance corrections may change existing
11
+ * member semantics, and MUST be called out in the release's version notes.
12
+ * Keep the exported bridge type in lockstep with what is exposed here.
13
+ *
14
+ * Receives the per-load MessagePort main transfers on `did-finish-load`
15
+ * (`ViewChannel.HostSidebarPort`, `event.ports[0]`) and bridges it to the page
16
+ * as `window.diminaHostSidebar` — EXACTLY `{ send, onMessage }`, functions
17
+ * only. The raw MessagePort never crosses into the main world: the page only
18
+ * ever talks through these two functions, so the `{ channel, payload }`
19
+ * envelope stays the single waist (same posture as the main side's
20
+ * host-sidebar-port-channel.ts).
21
+ *
22
+ * Ordering reality this module absorbs — identical to the toolbar's port
23
+ * bridge (see host-toolbar-port.ts for the full rationale): pre-handshake
24
+ * sends queue and bounded-drop, handlers register before the port exists and
25
+ * re-attach across same-load re-handshakes, inbound dispatch drops malformed
26
+ * envelopes without throwing.
27
+ *
28
+ * Shared implementation: see `host-slot-port-bridge.ts` (the toolbar/sidebar/
29
+ * dialog port bridges are otherwise identical; only the constants below
30
+ * differ).
31
+ */
32
+ /**
33
+ * Cap on pre-handshake queued sends. Same rationale and value as
34
+ * `HOST_TOOLBAR_PENDING_LIMIT` — overflow drops the NEWEST envelope, one
35
+ * console.warn per load.
36
+ */
37
+ export declare const HOST_SIDEBAR_PENDING_LIMIT = 128;
38
+ /**
39
+ * Subscribe the handshake channel and expose the page bridge. Call ONLY from
40
+ * a passing sidebar-runtime guard (`activateHostSidebarRuntime`) — a failing
41
+ * guard must leave zero footprint (no bridge key, no IPC listener).
42
+ */
43
+ export declare function installHostSidebarPortBridge(): void;
44
+ //# sourceMappingURL=host-sidebar-port.d.ts.map
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Preload side of the host-sidebar gated narrow channel.
3
+ *
4
+ * ── PUBLIC SURFACE EVOLUTION RULE ───────────────────────────────────────────
5
+ * `window.diminaHostSidebar` is a published page-facing API, typed by the
6
+ * exported `DiminaHostSidebarPageBridge` (src/main/runtime/miniapp-runtime.ts)
7
+ * — arbitrary host sidebar pages compile against it. Members may only be
8
+ * ADDED, never changed: any semantic change to an existing member (signature,
9
+ * return shape, queueing/throw behavior) ships under a NEW name instead.
10
+ * Exception: security fixes / compliance corrections may change existing
11
+ * member semantics, and MUST be called out in the release's version notes.
12
+ * Keep the exported bridge type in lockstep with what is exposed here.
13
+ *
14
+ * Receives the per-load MessagePort main transfers on `did-finish-load`
15
+ * (`ViewChannel.HostSidebarPort`, `event.ports[0]`) and bridges it to the page
16
+ * as `window.diminaHostSidebar` — EXACTLY `{ send, onMessage }`, functions
17
+ * only. The raw MessagePort never crosses into the main world: the page only
18
+ * ever talks through these two functions, so the `{ channel, payload }`
19
+ * envelope stays the single waist (same posture as the main side's
20
+ * host-sidebar-port-channel.ts).
21
+ *
22
+ * Ordering reality this module absorbs — identical to the toolbar's port
23
+ * bridge (see host-toolbar-port.ts for the full rationale): pre-handshake
24
+ * sends queue and bounded-drop, handlers register before the port exists and
25
+ * re-attach across same-load re-handshakes, inbound dispatch drops malformed
26
+ * envelopes without throwing.
27
+ *
28
+ * Shared implementation: see `host-slot-port-bridge.ts` (the toolbar/sidebar/
29
+ * dialog port bridges are otherwise identical; only the constants below
30
+ * differ).
31
+ */
32
+ import { ViewChannel } from '../../shared/ipc-channels-overlays.js';
33
+ import { createHostSlotPortBridge } from './host-slot-port-bridge.js';
34
+ /**
35
+ * Cap on pre-handshake queued sends. Same rationale and value as
36
+ * `HOST_TOOLBAR_PENDING_LIMIT` — overflow drops the NEWEST envelope, one
37
+ * console.warn per load.
38
+ */
39
+ export const HOST_SIDEBAR_PENDING_LIMIT = 128;
40
+ /**
41
+ * Subscribe the handshake channel and expose the page bridge. Call ONLY from
42
+ * a passing sidebar-runtime guard (`activateHostSidebarRuntime`) — a failing
43
+ * guard must leave zero footprint (no bridge key, no IPC listener).
44
+ */
45
+ export function installHostSidebarPortBridge() {
46
+ createHostSlotPortBridge({
47
+ bridgeKey: 'diminaHostSidebar',
48
+ channel: ViewChannel.HostSidebarPort,
49
+ pendingLimit: HOST_SIDEBAR_PENDING_LIMIT,
50
+ label: 'host-sidebar',
51
+ });
52
+ }
53
+ //# sourceMappingURL=host-sidebar-port.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Session-resident host-sidebar framework runtime: GUARD + ACTIVATION.
3
+ *
4
+ * Same registration and guard shape as host-toolbar-runtime.ts (see that
5
+ * module for the full rationale): registered once per process on
6
+ * `session.defaultSession`, so it runs in EVERY defaultSession renderer;
7
+ * this guard keeps it inert everywhere except the host-sidebar WCV's main
8
+ * frame, identified by `HOST_SIDEBAR_RUNTIME_MARKER` in that process' argv.
9
+ */
10
+ /**
11
+ * Pure guard predicate: should the sidebar runtime activate in a renderer with
12
+ * this `argv` / `isMainFrame`? True only for the MAIN frame of a process whose
13
+ * argv carries the `'--dimina-host-sidebar'` marker.
14
+ */
15
+ export declare function shouldActivateHostSidebarRuntime(argv: readonly string[], isMainFrame: boolean): boolean;
16
+ /**
17
+ * Run the guard; only when it passes, install the width advertiser
18
+ * (`installHostSidebarAdvertiserWhenReady`) and the narrow-channel page
19
+ * bridge (`installHostSidebarPortBridge` — `window.diminaHostSidebar` +
20
+ * the MessagePort handshake listener). Returns whether the runtime
21
+ * activated. A failed guard installs NOTHING (zero footprint in non-sidebar
22
+ * windows and subframes: no advertiser, no bridge key, no IPC listener).
23
+ */
24
+ export declare function activateHostSidebarRuntime(env: {
25
+ argv: readonly string[];
26
+ isMainFrame: boolean;
27
+ }): boolean;
28
+ //# sourceMappingURL=host-sidebar-runtime.d.ts.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Session-resident host-sidebar framework runtime: GUARD + ACTIVATION.
3
+ *
4
+ * Same registration and guard shape as host-toolbar-runtime.ts (see that
5
+ * module for the full rationale): registered once per process on
6
+ * `session.defaultSession`, so it runs in EVERY defaultSession renderer;
7
+ * this guard keeps it inert everywhere except the host-sidebar WCV's main
8
+ * frame, identified by `HOST_SIDEBAR_RUNTIME_MARKER` in that process' argv.
9
+ */
10
+ import { HOST_SIDEBAR_RUNTIME_MARKER } from '../../shared/constants.js';
11
+ import { installHostSidebarAdvertiserWhenReady } from './host-sidebar-advertiser.js';
12
+ import { installHostSidebarPortBridge } from './host-sidebar-port.js';
13
+ /**
14
+ * Pure guard predicate: should the sidebar runtime activate in a renderer with
15
+ * this `argv` / `isMainFrame`? True only for the MAIN frame of a process whose
16
+ * argv carries the `'--dimina-host-sidebar'` marker.
17
+ */
18
+ export function shouldActivateHostSidebarRuntime(argv, isMainFrame) {
19
+ return isMainFrame && argv.includes(HOST_SIDEBAR_RUNTIME_MARKER);
20
+ }
21
+ /**
22
+ * Run the guard; only when it passes, install the width advertiser
23
+ * (`installHostSidebarAdvertiserWhenReady`) and the narrow-channel page
24
+ * bridge (`installHostSidebarPortBridge` — `window.diminaHostSidebar` +
25
+ * the MessagePort handshake listener). Returns whether the runtime
26
+ * activated. A failed guard installs NOTHING (zero footprint in non-sidebar
27
+ * windows and subframes: no advertiser, no bridge key, no IPC listener).
28
+ */
29
+ export function activateHostSidebarRuntime(env) {
30
+ if (!shouldActivateHostSidebarRuntime(env.argv, env.isMainFrame))
31
+ return false;
32
+ installHostSidebarAdvertiserWhenReady();
33
+ installHostSidebarPortBridge();
34
+ return true;
35
+ }
36
+ //# sourceMappingURL=host-sidebar-runtime.js.map
@@ -0,0 +1,18 @@
1
+ export interface HostSlotPortBridgeOptions {
2
+ /** contextBridge key the page-facing API is exposed under, e.g. 'diminaHostToolbar'. */
3
+ bridgeKey: string;
4
+ /** main → renderer per-load handshake channel, e.g. ViewChannel.HostToolbarPort. */
5
+ channel: string;
6
+ /** Cap on pre-handshake queued sends; overflow drops the NEWEST envelope. */
7
+ pendingLimit: number;
8
+ /** Slot label used in the overflow console.warn, e.g. 'host-toolbar'. */
9
+ label: string;
10
+ }
11
+ /**
12
+ * Subscribe the handshake channel and expose the page bridge. Call ONLY from
13
+ * a passing per-slot runtime guard — a failing guard must leave zero
14
+ * footprint (no bridge key, no IPC listener), so this factory itself does no
15
+ * guard checking; the caller decides whether to call it at all.
16
+ */
17
+ export declare function createHostSlotPortBridge(opts: HostSlotPortBridgeOptions): void;
18
+ //# sourceMappingURL=host-slot-port-bridge.d.ts.map
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Shared implementation behind every host-slot page bridge (toolbar/sidebar/
3
+ * dialog): the MessagePort handshake, pending-queue-with-bounded-overflow,
4
+ * handler registry and `{ send, onMessage }` contextBridge exposure are
5
+ * IDENTICAL across slots — only the bridge key, handshake channel, queue cap
6
+ * and overflow-warning label differ. Each slot's own `host-*-port.ts` stays
7
+ * the frozen public surface (see its own "PUBLIC SURFACE EVOLUTION RULE"
8
+ * doc-comment) and calls this factory with its own constants; this module has
9
+ * no public-surface contract of its own.
10
+ */
11
+ import { contextBridge, ipcRenderer } from 'electron';
12
+ /**
13
+ * Subscribe the handshake channel and expose the page bridge. Call ONLY from
14
+ * a passing per-slot runtime guard — a failing guard must leave zero
15
+ * footprint (no bridge key, no IPC listener), so this factory itself does no
16
+ * guard checking; the caller decides whether to call it at all.
17
+ */
18
+ export function createHostSlotPortBridge(opts) {
19
+ const { bridgeKey, channel, pendingLimit, label } = opts;
20
+ let activePort = null;
21
+ const pending = [];
22
+ // One overflow warning per load (this installer runs once per document) —
23
+ // a runaway page send-loop must not get per-drop console spam.
24
+ let warnedPendingOverflow = false;
25
+ const handlers = [];
26
+ // Entry-waist channel validation, parity with the main side's `onMessage`
27
+ // guard (same TypeError, message names `channel`). Runs BEFORE any state is
28
+ // touched (no queue slot, no registry entry), in both port states — a page
29
+ // author's typo throws at the call site instead of vanishing into main's
30
+ // silent inbound drop.
31
+ function assertValidChannel(method, ch) {
32
+ if (typeof ch !== 'string' || ch === '') {
33
+ throw new TypeError(`${bridgeKey}.${method}: channel must be a non-empty string`);
34
+ }
35
+ }
36
+ const dispatch = (data) => {
37
+ // Defensive symmetry with main: drop anything that is not an object
38
+ // envelope with a string channel — never throw in the dispatcher.
39
+ if (typeof data !== 'object' || data === null)
40
+ return;
41
+ const { channel: ch, payload } = data;
42
+ if (typeof ch !== 'string')
43
+ return;
44
+ for (const entry of [...handlers]) {
45
+ if (entry.channel === ch)
46
+ entry.handler(payload);
47
+ }
48
+ };
49
+ const onPortMessage = (event) => {
50
+ dispatch(event.data);
51
+ };
52
+ ipcRenderer.on(channel, (event) => {
53
+ const port = event.ports[0];
54
+ if (!port)
55
+ return;
56
+ // Same-load duplicate handshake: the LATER port wins. Main closed (or is
57
+ // about to close) its end of the old pair — detach and stop writing to it.
58
+ if (activePort) {
59
+ try {
60
+ activePort.removeEventListener('message', onPortMessage);
61
+ activePort.close();
62
+ }
63
+ catch {
64
+ /* already dead */
65
+ }
66
+ }
67
+ activePort = port;
68
+ // addEventListener (not onmessage) keeps the handler removable on
69
+ // re-handshake; it REQUIRES start() or inbound never delivers.
70
+ port.addEventListener('message', onPortMessage);
71
+ port.start();
72
+ // Flush sends issued before the port arrived, in order.
73
+ while (pending.length > 0) {
74
+ const envelope = pending.shift();
75
+ port.postMessage(envelope);
76
+ }
77
+ });
78
+ // EXACTLY { send, onMessage } — functions only; the port stays in the
79
+ // isolated world.
80
+ contextBridge.exposeInMainWorld(bridgeKey, {
81
+ send(ch, payload) {
82
+ assertValidChannel('send', ch);
83
+ const envelope = { channel: ch, payload };
84
+ if (activePort) {
85
+ activePort.postMessage(envelope);
86
+ return;
87
+ }
88
+ // Bounded queue: drop the NEWEST send on overflow (FIFO first-comers
89
+ // survive), warn once per load, never throw into page code.
90
+ if (pending.length >= pendingLimit) {
91
+ if (!warnedPendingOverflow) {
92
+ warnedPendingOverflow = true;
93
+ console.warn(`[dimina-devtools] ${label} pending queue full (${pendingLimit}); ` +
94
+ 'dropping further pre-handshake send() calls until the port arrives');
95
+ }
96
+ return;
97
+ }
98
+ pending.push(envelope);
99
+ },
100
+ onMessage(ch, handler) {
101
+ assertValidChannel('onMessage', ch);
102
+ const entry = { channel: ch, handler };
103
+ handlers.push(entry);
104
+ return () => {
105
+ const i = handlers.indexOf(entry);
106
+ if (i >= 0)
107
+ handlers.splice(i, 1);
108
+ };
109
+ },
110
+ });
111
+ }
112
+ //# sourceMappingURL=host-slot-port-bridge.js.map
@@ -9,19 +9,11 @@
9
9
  */
10
10
  /**
11
11
  * Attach the advertiser to the toolbar content's shrink-to-fit root
12
- * (`[data-host-toolbar-root]`). That element MUST be shrink-to-fit on the block
13
- * axis its height must reflect the content, not the host-applied view height,
14
- * or the cross-process loop never converges (`createSizeAdvertiser`'s footgun).
15
- * If the element is missing we warn and no-op rather than measure `<body>`,
16
- * whose block size IS the view size and would advertise nonsense.
17
- *
18
- * Returns a disposer that tears the advertiser down.
19
- */
20
- export declare function installHostToolbarAdvertiser(): () => void;
21
- /**
22
- * Install once the DOM is ready (the root element must exist before we query).
23
- * Self-gating: if the document is already past `loading`, install synchronously;
24
- * otherwise wait for `DOMContentLoaded`.
12
+ * (`[data-host-toolbar-root]`), waiting for it if necessary the root may be
13
+ * mounted asynchronously by a framework rather than present in the initial
14
+ * HTML. That element MUST be shrink-to-fit on the block axis — its height
15
+ * must reflect the content, not the host-applied view height, or the
16
+ * cross-process loop never converges (`createSizeAdvertiser`'s footgun).
25
17
  */
26
18
  export declare function installHostToolbarAdvertiserWhenReady(): void;
27
19
  //# sourceMappingURL=host-toolbar-advertiser.d.ts.map