@dimina-kit/devtools 0.3.2-dev.20260525152421 → 0.3.2-dev.20260610082053

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 (295) hide show
  1. package/README.md +43 -40
  2. package/dist/main/api.d.ts +0 -1
  3. package/dist/main/api.js +5 -1
  4. package/dist/main/app/app.d.ts +15 -5
  5. package/dist/main/app/app.js +247 -110
  6. package/dist/main/app/bootstrap.d.ts +16 -0
  7. package/dist/main/app/bootstrap.js +20 -0
  8. package/dist/main/app/launch.d.ts +8 -4
  9. package/dist/main/app/launch.js +9 -4
  10. package/dist/main/index.bundle.js +6607 -2102
  11. package/dist/main/index.js +9 -1
  12. package/dist/main/ipc/app.d.ts +1 -1
  13. package/dist/main/ipc/bridge-router.d.ts +61 -0
  14. package/dist/main/ipc/bridge-router.js +1300 -0
  15. package/dist/main/ipc/panels.d.ts +1 -1
  16. package/dist/main/ipc/panels.js +6 -2
  17. package/dist/main/ipc/popover.d.ts +1 -1
  18. package/dist/main/ipc/project-fs.d.ts +57 -0
  19. package/dist/main/ipc/project-fs.js +448 -0
  20. package/dist/main/ipc/projects.d.ts +1 -1
  21. package/dist/main/ipc/session.d.ts +1 -1
  22. package/dist/main/ipc/settings.d.ts +1 -1
  23. package/dist/main/ipc/simulator-module.d.ts +6 -0
  24. package/dist/main/ipc/simulator-module.js +11 -1
  25. package/dist/main/ipc/simulator.d.ts +2 -2
  26. package/dist/main/ipc/simulator.js +49 -5
  27. package/dist/main/ipc/toolbar.d.ts +1 -1
  28. package/dist/main/ipc/views.d.ts +19 -0
  29. package/dist/main/ipc/views.js +65 -0
  30. package/dist/main/runtime/devtools-backend.d.ts +17 -0
  31. package/dist/main/runtime/devtools-backend.js +49 -0
  32. package/dist/main/runtime/miniapp-runtime.d.ts +39 -0
  33. package/dist/main/runtime/miniapp-runtime.js +17 -0
  34. package/dist/main/services/automation/exec.d.ts +27 -2
  35. package/dist/main/services/automation/exec.js +37 -3
  36. package/dist/main/services/automation/handlers/app.js +127 -11
  37. package/dist/main/services/automation/handlers/page.js +36 -19
  38. package/dist/main/services/automation/index.js +40 -13
  39. package/dist/main/services/automation/wait-active-page.d.ts +56 -0
  40. package/dist/main/services/automation/wait-active-page.js +71 -0
  41. package/dist/main/services/console-forward/index.d.ts +36 -0
  42. package/dist/main/services/console-forward/index.js +81 -0
  43. package/dist/main/services/dimina-resource-server.d.ts +7 -0
  44. package/dist/main/services/dimina-resource-server.js +99 -0
  45. package/dist/main/services/elements-forward/index.d.ts +66 -0
  46. package/dist/main/services/elements-forward/index.js +583 -0
  47. package/dist/main/services/layout/index.d.ts +23 -1
  48. package/dist/main/services/layout/index.js +28 -3
  49. package/dist/main/services/mcp/index.d.ts +1 -0
  50. package/dist/main/services/mcp/index.js +3 -0
  51. package/dist/main/services/mcp/server.d.ts +1 -1
  52. package/dist/main/services/mcp/server.js +1 -1
  53. package/dist/main/services/mcp/target-manager.d.ts +35 -0
  54. package/dist/main/services/mcp/target-manager.js +63 -1
  55. package/dist/main/services/mcp/tools/context-tools.js +15 -1
  56. package/dist/main/services/module.d.ts +1 -1
  57. package/dist/main/services/network-forward/index.d.ts +190 -0
  58. package/dist/main/services/network-forward/index.js +765 -0
  59. package/dist/main/services/notifications/renderer-notifier.d.ts +11 -0
  60. package/dist/main/services/notifications/renderer-notifier.js +7 -1
  61. package/dist/main/services/render-inspect/index.d.ts +41 -0
  62. package/dist/main/services/render-inspect/index.js +88 -0
  63. package/dist/main/services/safe-area/index.d.ts +17 -0
  64. package/dist/main/services/safe-area/index.js +59 -0
  65. package/dist/main/services/service-host-pool/pool.d.ts +197 -0
  66. package/dist/main/services/service-host-pool/pool.js +364 -0
  67. package/dist/main/services/simulator/custom-apis.d.ts +34 -0
  68. package/dist/main/services/simulator/custom-apis.js +22 -0
  69. package/dist/main/services/simulator-appdata/index.d.ts +35 -0
  70. package/dist/main/services/simulator-appdata/index.js +71 -0
  71. package/dist/main/services/simulator-current-page/index.d.ts +24 -0
  72. package/dist/main/services/simulator-current-page/index.js +19 -0
  73. package/dist/main/services/simulator-storage/index.d.ts +37 -2
  74. package/dist/main/services/simulator-storage/index.js +209 -32
  75. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +40 -0
  76. package/dist/main/services/simulator-storage/service-storage-ops.js +67 -0
  77. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -1
  78. package/dist/main/services/simulator-temp-files/index.d.ts +1 -1
  79. package/dist/main/services/simulator-temp-files/index.js +1 -1
  80. package/dist/main/services/simulator-temp-files/request-handler.js +1 -1
  81. package/dist/main/services/simulator-wxml/index.d.ts +29 -0
  82. package/dist/main/services/simulator-wxml/index.js +28 -0
  83. package/dist/main/services/update/update-manager.d.ts +10 -0
  84. package/dist/main/services/update/update-manager.js +16 -3
  85. package/dist/main/services/views/devtools-tabs.d.ts +47 -0
  86. package/dist/main/services/views/devtools-tabs.js +95 -0
  87. package/dist/main/services/views/view-manager.d.ts +142 -4
  88. package/dist/main/services/views/view-manager.js +909 -17
  89. package/dist/main/services/workbench-context.d.ts +66 -1
  90. package/dist/main/services/workbench-context.js +6 -1
  91. package/dist/main/services/workspace/workspace-service.d.ts +8 -0
  92. package/dist/main/services/workspace/workspace-service.js +12 -0
  93. package/dist/main/utils/ipc-registry.d.ts +11 -2
  94. package/dist/main/utils/ipc-registry.js +63 -3
  95. package/dist/main/utils/paths.d.ts +15 -0
  96. package/dist/main/utils/paths.js +19 -0
  97. package/dist/main/utils/sender-policy.d.ts +9 -3
  98. package/dist/main/utils/sender-policy.js +18 -4
  99. package/dist/main/utils/theme.d.ts +1 -1
  100. package/dist/main/utils/theme.js +1 -1
  101. package/dist/main/windows/main-window/create.d.ts +0 -6
  102. package/dist/main/windows/main-window/create.js +11 -59
  103. package/dist/main/windows/main-window/events.d.ts +1 -1
  104. package/dist/main/windows/main-window/events.js +1 -1
  105. package/dist/main/windows/service-host-window/create.d.ts +52 -0
  106. package/dist/main/windows/service-host-window/create.js +112 -0
  107. package/dist/native-host/common/common.js +368 -0
  108. package/dist/native-host/container/pageFrame.css +1 -0
  109. package/dist/native-host/render/render.js +9334 -0
  110. package/dist/native-host/service/service.js +6 -0
  111. package/dist/preload/index.d.ts +2 -0
  112. package/dist/preload/index.js +6 -0
  113. package/dist/preload/instrumentation/app-data.d.ts +18 -20
  114. package/dist/preload/instrumentation/app-data.js +23 -160
  115. package/dist/preload/instrumentation/wxml-extract.d.ts +1 -1
  116. package/dist/preload/instrumentation/wxml-extract.js +1 -1
  117. package/dist/preload/runtime/bridge.d.ts +3 -8
  118. package/dist/preload/runtime/bridge.js +2 -32
  119. package/dist/preload/runtime/custom-apis.js +20 -17
  120. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +27 -0
  121. package/dist/preload/runtime/host-toolbar-advertiser.js +55 -0
  122. package/dist/preload/runtime/main-api-runner.d.ts +9 -0
  123. package/dist/preload/runtime/main-api-runner.js +85 -0
  124. package/dist/preload/runtime/native-host.d.ts +43 -0
  125. package/dist/preload/runtime/native-host.js +83 -0
  126. package/dist/preload/shared/expose.d.ts +10 -5
  127. package/dist/preload/shared/expose.js +29 -11
  128. package/dist/preload/shared/sid-registry.d.ts +11 -0
  129. package/dist/preload/shared/sid-registry.js +38 -0
  130. package/dist/preload/windows/host-toolbar.cjs +161 -0
  131. package/dist/preload/windows/host-toolbar.cjs.map +7 -0
  132. package/dist/preload/windows/host-toolbar.d.ts +2 -0
  133. package/dist/preload/windows/host-toolbar.js +12 -0
  134. package/dist/preload/windows/main.cjs +1939 -0
  135. package/dist/preload/windows/main.cjs.map +4 -4
  136. package/dist/preload/windows/simulator.cjs +925 -0
  137. package/dist/preload/windows/simulator.cjs.map +7 -0
  138. package/dist/preload/windows/simulator.js +243 -573
  139. package/dist/render-host/pageFrame.html +29 -0
  140. package/dist/render-host/preload.cjs +154 -0
  141. package/dist/render-host/render-inspect.js +295 -0
  142. package/dist/renderer/assets/abap-DiwvWnMr.js +2 -0
  143. package/dist/renderer/assets/apex-CmtZjKlf.js +2 -0
  144. package/dist/renderer/assets/azcli-DL2My_i-.js +2 -0
  145. package/dist/renderer/assets/bat-B-nC98wG.js +2 -0
  146. package/dist/renderer/assets/bicep-Ju5MwOgh.js +3 -0
  147. package/dist/renderer/assets/cameligo-8Eu1TyBr.js +2 -0
  148. package/dist/renderer/assets/chunk-DPI0Y_ll.js +1 -0
  149. package/dist/renderer/assets/clojure-u-RpMkH3.js +2 -0
  150. package/dist/renderer/assets/codicon-ngg6Pgfi.ttf +0 -0
  151. package/dist/renderer/assets/coffee-CdA7bbTe.js +2 -0
  152. package/dist/renderer/assets/constants-CLAQX6VZ.js +2 -0
  153. package/dist/renderer/assets/cpp-CzNFP8ks.js +2 -0
  154. package/dist/renderer/assets/csharp-j1LThmcE.js +2 -0
  155. package/dist/renderer/assets/csp-CLRC61y6.js +2 -0
  156. package/dist/renderer/assets/css-r6rC_7P2.js +4 -0
  157. package/dist/renderer/assets/css.worker-DyDu5ynT.js +90 -0
  158. package/dist/renderer/assets/cssMode-BCBgxrnA.js +2 -0
  159. package/dist/renderer/assets/cypher-CW08XVUh.js +2 -0
  160. package/dist/renderer/assets/dart-Cs9aL5T_.js +2 -0
  161. package/dist/renderer/assets/dockerfile-BWM0M184.js +2 -0
  162. package/dist/renderer/assets/ecl-MJJuer5P.js +2 -0
  163. package/dist/renderer/assets/editor-CWI9TnMM.css +1 -0
  164. package/dist/renderer/assets/editor.api2-BTaYmRq7.js +873 -0
  165. package/dist/renderer/assets/editor.worker-Dpt_xPrs.js +27 -0
  166. package/dist/renderer/assets/elixir-D2AIuXqn.js +2 -0
  167. package/dist/renderer/assets/flow9-B2H24giC.js +2 -0
  168. package/dist/renderer/assets/freemarker2-DGDGzimW.js +4 -0
  169. package/dist/renderer/assets/fsharp-CMk2OIJN.js +2 -0
  170. package/dist/renderer/assets/go-BrMkuJg0.js +2 -0
  171. package/dist/renderer/assets/graphql-PSR1UKGv.js +2 -0
  172. package/dist/renderer/assets/handlebars-bOHhw3EG.js +2 -0
  173. package/dist/renderer/assets/hcl-DAQrbDOW.js +2 -0
  174. package/dist/renderer/assets/html-BMyuX0_c.js +2 -0
  175. package/dist/renderer/assets/html.worker-IWNXhnIC.js +503 -0
  176. package/dist/renderer/assets/htmlMode-DR4kXJ7l.js +2 -0
  177. package/dist/renderer/assets/index-CcJKzatF.js +50 -0
  178. package/dist/renderer/assets/ini-0TG5BxW0.js +2 -0
  179. package/dist/renderer/assets/input-QGx6FFX1.js +2 -0
  180. package/dist/renderer/assets/ipc-transport-BT4QYQqu.css +1 -0
  181. package/dist/renderer/assets/{ipc-transport-BzPzxPwf.js → ipc-transport-DvZvwK-Z.js} +5 -5
  182. package/dist/renderer/assets/java-rgorz17v.js +2 -0
  183. package/dist/renderer/assets/javascript-Bu-tl1P7.js +2 -0
  184. package/dist/renderer/assets/json.worker-c4h5s80L.js +59 -0
  185. package/dist/renderer/assets/jsonMode-MQV_ffLR.js +8 -0
  186. package/dist/renderer/assets/julia-C8VMdHm8.js +2 -0
  187. package/dist/renderer/assets/kotlin-AhhC4Qhm.js +2 -0
  188. package/dist/renderer/assets/less-Cgca25AP.js +3 -0
  189. package/dist/renderer/assets/lexon-D0GHdBaw.js +2 -0
  190. package/dist/renderer/assets/liquid-ClkfOvhB.js +2 -0
  191. package/dist/renderer/assets/lspLanguageFeatures-Bke_4Ie9.js +5 -0
  192. package/dist/renderer/assets/lua-DmRsNG-P.js +2 -0
  193. package/dist/renderer/assets/m3-BgL5dNKT.js +2 -0
  194. package/dist/renderer/assets/markdown-BuJfycGS.js +2 -0
  195. package/dist/renderer/assets/mdx-RZdUskPu.js +2 -0
  196. package/dist/renderer/assets/mips-C9m_93PR.js +2 -0
  197. package/dist/renderer/assets/monaco.contribution-B7rUMaEv.js +3 -0
  198. package/dist/renderer/assets/msdax-CpFHC9OI.js +2 -0
  199. package/dist/renderer/assets/mysql-qFvltsqN.js +2 -0
  200. package/dist/renderer/assets/objective-c-Bnmr858J.js +2 -0
  201. package/dist/renderer/assets/pascal-WP0_D5AO.js +2 -0
  202. package/dist/renderer/assets/pascaligo-Blom4Rij.js +2 -0
  203. package/dist/renderer/assets/perl-B-vk8g64.js +2 -0
  204. package/dist/renderer/assets/pgsql-Cgvz6v67.js +2 -0
  205. package/dist/renderer/assets/php-8a3Lrw9m.js +2 -0
  206. package/dist/renderer/assets/pla-DuFqEZ8V.js +2 -0
  207. package/dist/renderer/assets/popover-BOH1If1J.js +2 -0
  208. package/dist/renderer/assets/postiats-DkLtSgkp.js +2 -0
  209. package/dist/renderer/assets/powerquery-BJ1aNepW.js +2 -0
  210. package/dist/renderer/assets/powershell-rE98k687.js +2 -0
  211. package/dist/renderer/assets/protobuf-CUheFacr.js +3 -0
  212. package/dist/renderer/assets/pug-LDcAMD8w.js +2 -0
  213. package/dist/renderer/assets/python-Cobrm_-8.js +2 -0
  214. package/dist/renderer/assets/qsharp-DUKSQoR1.js +2 -0
  215. package/dist/renderer/assets/r-D-QApv87.js +2 -0
  216. package/dist/renderer/assets/razor-BEUIQFNJ.js +2 -0
  217. package/dist/renderer/assets/redis-SXdDyWR9.js +2 -0
  218. package/dist/renderer/assets/redshift-Y6lsCryn.js +2 -0
  219. package/dist/renderer/assets/restructuredtext-edObr9a8.js +2 -0
  220. package/dist/renderer/assets/ruby-CNnUfF-8.js +2 -0
  221. package/dist/renderer/assets/rust-IHUZWzBr.js +2 -0
  222. package/dist/renderer/assets/sb-DrUvY44N.js +2 -0
  223. package/dist/renderer/assets/scala-B4hbXGLM.js +2 -0
  224. package/dist/renderer/assets/scheme-BGrd12j3.js +2 -0
  225. package/dist/renderer/assets/scss-x5G1ES4U.js +4 -0
  226. package/dist/renderer/assets/select-C7JQ8G5N.js +2 -0
  227. package/dist/renderer/assets/settings-DpAbTJyF.js +2 -0
  228. package/dist/renderer/assets/{settings-api-BXCw9vOZ.js → settings-api-RD2IZF53.js} +2 -2
  229. package/dist/renderer/assets/shell-DOehe2Y8.js +2 -0
  230. package/dist/renderer/assets/solidity-BeRvcwWV.js +2 -0
  231. package/dist/renderer/assets/sophia-DZbkUNjy.js +2 -0
  232. package/dist/renderer/assets/sparql-B7_oi5-h.js +2 -0
  233. package/dist/renderer/assets/sql-CTlsFWVE.js +2 -0
  234. package/dist/renderer/assets/st-DJVEJdPE.js +2 -0
  235. package/dist/renderer/assets/swift-CwhT3fYa.js +2 -0
  236. package/dist/renderer/assets/systemverilog-BQN63pkN.js +2 -0
  237. package/dist/renderer/assets/tcl-DqwfpskA.js +2 -0
  238. package/dist/renderer/assets/ts.worker-BwM5Ha3L.js +67720 -0
  239. package/dist/renderer/assets/tsMode-BHa7dl9v.js +12 -0
  240. package/dist/renderer/assets/twig-BiyenUgc.js +2 -0
  241. package/dist/renderer/assets/typescript-15aT0Yj8.js +2 -0
  242. package/dist/renderer/assets/typespec-CWOJribt.js +2 -0
  243. package/dist/renderer/assets/vb-Cq5F87m3.js +2 -0
  244. package/dist/renderer/assets/wgsl-BAvW2lVr.js +299 -0
  245. package/dist/renderer/assets/workbenchSettings-CNJX4Qna.js +8 -0
  246. package/dist/renderer/assets/workers-CRBS0W-v.js +2 -0
  247. package/dist/renderer/assets/xml-bR2Zh-HV.js +2 -0
  248. package/dist/renderer/assets/yaml-Bdk54Qrb.js +2 -0
  249. package/dist/renderer/entries/main/index.html +29 -6
  250. package/dist/renderer/entries/popover/index.html +7 -6
  251. package/dist/renderer/entries/settings/index.html +6 -5
  252. package/dist/renderer/entries/workbench-settings/index.html +6 -5
  253. package/dist/service-host/preload.cjs +254 -0
  254. package/dist/service-host/service.html +10 -0
  255. package/dist/service-host/sourcemap-rewrite.cjs +58 -0
  256. package/dist/service-host/sync-api-patch.js +20 -0
  257. package/dist/service-host/sync-impls/menu-button.js +16 -0
  258. package/dist/service-host/sync-impls/storage.js +50 -0
  259. package/dist/service-host/sync-impls/system-info.js +54 -0
  260. package/dist/shared/appdata-accumulator.d.ts +95 -0
  261. package/dist/shared/appdata-accumulator.js +213 -0
  262. package/dist/shared/bridge-channels.d.ts +364 -0
  263. package/dist/shared/bridge-channels.js +54 -0
  264. package/dist/shared/constants.d.ts +0 -4
  265. package/dist/shared/constants.js +0 -4
  266. package/dist/shared/ipc-channels.d.ts +108 -1
  267. package/dist/shared/ipc-channels.js +127 -10
  268. package/dist/shared/ipc-schemas.d.ts +65 -2
  269. package/dist/shared/ipc-schemas.js +79 -3
  270. package/dist/shared/open-in-editor.d.ts +71 -0
  271. package/dist/shared/open-in-editor.js +138 -0
  272. package/dist/shared/simulator-api-metadata.d.ts +21 -0
  273. package/dist/shared/simulator-api-metadata.js +23 -0
  274. package/dist/shared/types.d.ts +2 -2
  275. package/dist/shared/vpath.d.ts +42 -0
  276. package/dist/shared/vpath.js +105 -0
  277. package/dist/simulator/assets/device-shell-DsdcNEkt.css +1 -0
  278. package/dist/simulator/assets/device-shell-vwYSOVrh.js +2 -0
  279. package/dist/simulator/assets/jsx-runtime-P6ZegaOf.js +2 -0
  280. package/dist/simulator/assets/simulator-DddliUL5.js +10 -0
  281. package/dist/simulator/assets/simulator-mini-app-BDNu5n26.js +2 -0
  282. package/dist/simulator/device-shell/menu-button-geometry.js +8 -0
  283. package/dist/simulator/simulator.html +2 -112
  284. package/package.json +9 -9
  285. package/dist/main/utils/disposable.d.ts +0 -18
  286. package/dist/main/utils/disposable.js +0 -67
  287. package/dist/renderer/assets/constants-DI382mTP.js +0 -2
  288. package/dist/renderer/assets/index-4lkyF644.js +0 -46
  289. package/dist/renderer/assets/input-D4byFOLS.js +0 -2
  290. package/dist/renderer/assets/ipc-transport-DqbRdZNO.css +0 -1
  291. package/dist/renderer/assets/popover-cxKrg_os.js +0 -2
  292. package/dist/renderer/assets/select-BgSkkdHW.js +0 -2
  293. package/dist/renderer/assets/settings-oD2K1jdT.js +0 -2
  294. package/dist/renderer/assets/workbenchSettings-CTNBpTft.js +0 -8
  295. package/dist/simulator/assets/simulator-CVOFTpSj.js +0 -9
@@ -6,11 +6,53 @@
6
6
  * requires a single edit.
7
7
  */
8
8
  export declare const SimulatorChannel: {
9
- readonly Attach: "simulator:attach";
9
+ readonly AttachNative: "simulator:attach-native";
10
+ readonly SetNativeBounds: "simulator:set-native-bounds";
11
+ readonly SetDeviceInfo: "simulator:set-device-info";
10
12
  readonly Detach: "simulator:detach";
11
13
  readonly Resize: "simulator:resize";
12
14
  readonly SetVisible: "simulator:setVisible";
13
15
  readonly Console: "simulator:console";
16
+ readonly CurrentPage: "simulator:current-page";
17
+ };
18
+ /** iPhone bezel cutout family driving the device-shell notch visual. */
19
+ export type NotchType = 'none' | 'notch' | 'dynamic-island';
20
+ /** Per-device safe-area insets in CSS px (portrait). */
21
+ export interface SafeAreaInsets {
22
+ top: number;
23
+ right: number;
24
+ bottom: number;
25
+ left: number;
26
+ }
27
+ /**
28
+ * Logical device metrics pushed by the renderer device dropdown under
29
+ * native-host (`SimulatorChannel.SetDeviceInfo`). Mirrors a row of the renderer
30
+ * `DEVICES` table; main maps it onto a `HostEnvSnapshot` for the service-host
31
+ * window so `wx.getSystemInfoSync()` reflects the selected device, relays it to
32
+ * the simulator WCV (DeviceShell: bezel size + status bar + notch), and drives
33
+ * the CSS `env(safe-area-inset-*)` override on render-host guests.
34
+ */
35
+ export interface NativeDeviceInfo {
36
+ brand: string;
37
+ model: string;
38
+ system: string;
39
+ platform: string;
40
+ pixelRatio: number;
41
+ screenWidth: number;
42
+ screenHeight: number;
43
+ statusBarHeight: number;
44
+ safeAreaBottom: number;
45
+ notchType: NotchType;
46
+ safeAreaInsets: SafeAreaInsets;
47
+ }
48
+ export declare const ServiceHostChannel: {
49
+ /**
50
+ * NATIVE-HOST ONLY. Live-update the service-host window's host-env snapshot
51
+ * (device metrics) so subsequent `wx.getSystemInfoSync()` reflects a device
52
+ * change without a relaunch. The service-host preload mutates
53
+ * `__diminaSpawnContext.hostEnvSnapshot` in place (see `service-host/preload.cjs`).
54
+ */
55
+ readonly HostEnvUpdate: "service-host:host-env:update";
14
56
  };
15
57
  export declare const SimulatorCustomApiChannel: {
16
58
  readonly List: "simulator:custom-apis:list";
@@ -58,6 +100,17 @@ export declare const SimulatorElementChannel: {
58
100
  readonly Inspect: "simulator:element:inspect";
59
101
  readonly Clear: "simulator:element:clear";
60
102
  };
103
+ export declare const WorkbenchRuntimeChannel: {
104
+ readonly GetNativeHost: "workbench:runtime:native-host";
105
+ };
106
+ export declare const SimulatorWxmlChannel: {
107
+ readonly GetSnapshot: "simulator:wxml:snapshot";
108
+ readonly Event: "simulator:wxml:event";
109
+ };
110
+ export declare const SimulatorAppDataChannel: {
111
+ readonly GetSnapshot: "simulator:appdata:snapshot";
112
+ readonly Event: "simulator:appdata:event";
113
+ };
61
114
  export interface ElementInspection {
62
115
  sid: string;
63
116
  rect: {
@@ -96,6 +149,33 @@ export declare const ProjectChannel: {
96
149
  readonly CaptureThumbnail: "project:captureThumbnail";
97
150
  readonly GetThumbnail: "project:getThumbnail";
98
151
  };
152
+ export declare const ProjectFsChannel: {
153
+ readonly GetRoot: "project:fs:getRoot";
154
+ readonly ReadFile: "project:fs:readFile";
155
+ readonly WriteFile: "project:fs:writeFile";
156
+ /**
157
+ * Synchronous (blocking) write, used ONLY by the editor's `beforeunload`
158
+ * flush: a hard window/app close tears the renderer down before an async
159
+ * `WriteFile` IPC can round-trip, so the last in-debounce-window edit would
160
+ * be lost. `sendSync` blocks page teardown until the bytes hit disk. Runs the
161
+ * SAME sandbox as `WriteFile` (see project-fs `writeFileSync`).
162
+ */
163
+ readonly WriteFileSync: "project:fs:writeFileSync";
164
+ readonly ListFiles: "project:fs:listFiles";
165
+ };
166
+ export declare const EditorChannel: {
167
+ /** main → renderer: open `path` (project-relative POSIX) at `line`/`column`. */
168
+ readonly OpenFile: "editor:openFile";
169
+ };
170
+ /** Payload for `editor:openFile`. `line`/`column` are 1-based for Monaco. */
171
+ export interface EditorOpenFilePayload {
172
+ /** Project-relative POSIX path (the same key Monaco opens files by). */
173
+ path: string;
174
+ /** 1-based line to reveal; omitted/<=0 means open without moving the cursor. */
175
+ line?: number;
176
+ /** 1-based column to reveal; defaults to 1 when a line is given. */
177
+ column?: number;
178
+ }
99
179
  export declare const ProjectsChannel: {
100
180
  readonly List: "projects:list";
101
181
  readonly Add: "projects:add";
@@ -123,6 +203,33 @@ export declare const PanelChannel: {
123
203
  readonly Select: "panel:select";
124
204
  readonly SelectSimulator: "panel:selectSimulator";
125
205
  };
206
+ export declare const ViewChannel: {
207
+ /** Update the simulator DevTools view's bounds (or hide if w/h = 0). */
208
+ readonly SimulatorDevtoolsBounds: "view:simulator:devtools-bounds";
209
+ /**
210
+ * Host-controllable toolbar WebContentsView (sits ABOVE the devtools built-in
211
+ * header). Forward anchor: the main renderer reports the toolbar placeholder's
212
+ * bounds (or w/h=0 to hide). invoke.
213
+ */
214
+ readonly HostToolbarBounds: "view:host-toolbar:bounds";
215
+ /**
216
+ * Reverse size-advertiser: the host-toolbar WCV's OWN renderer advertises its
217
+ * intrinsic content height so main reserves exactly that much. Payload
218
+ * `{ axis: 'block', extent }`. fire-and-forget (send), NOT invoke.
219
+ */
220
+ readonly HostToolbarAdvertiseHeight: "view:host-toolbar:advertise-height";
221
+ /**
222
+ * main → main-window renderer: push the reserved host-toolbar height so the
223
+ * renderer placeholder div resizes (closing the dynamic-height loop).
224
+ */
225
+ readonly HostToolbarHeightChanged: "view:host-toolbar:height-changed";
226
+ };
227
+ export interface ViewBounds {
228
+ x: number;
229
+ y: number;
230
+ width: number;
231
+ height: number;
232
+ }
126
233
  export declare const PopoverChannel: {
127
234
  readonly Show: "popover:show";
128
235
  readonly Hide: "popover:hide";
@@ -7,29 +7,58 @@
7
7
  */
8
8
  // ── Simulator (preload → host / renderer ↔ main) ────────────────────────
9
9
  export const SimulatorChannel = {
10
- Attach: 'simulator:attach',
10
+ // Ask main to create the simulator as a top-level WebContentsView (so nested
11
+ // render-host <webview>s can attach). Native-host is the sole runtime.
12
+ AttachNative: 'simulator:attach-native',
13
+ // Renderer reports the device-bezel inner-screen rect (CSS px from content
14
+ // top-left) + zoom so main can overlay the simulator WCV on it.
15
+ SetNativeBounds: 'simulator:set-native-bounds',
16
+ // Renderer pushes the selected device's LOGICAL metrics (screen size,
17
+ // pixelRatio, statusBarHeight, …) when the device dropdown changes. Main
18
+ // maps it to a HostEnvSnapshot and live-updates the running service-host
19
+ // window — the authoritative `wx.getSystemInfoSync()` source — so the
20
+ // mini-app sees the selected device without a relaunch.
21
+ SetDeviceInfo: 'simulator:set-device-info',
11
22
  Detach: 'simulator:detach',
12
23
  Resize: 'simulator:resize',
13
24
  SetVisible: 'simulator:setVisible',
14
25
  Console: 'simulator:console',
26
+ // Main → renderer push of the visible top-of-stack page route whenever the
27
+ // mini-app navigates (navigateTo / switchTab / back). Payload: the page path
28
+ // string (same bare format as `getCurrentPagePath`), or '' when unknown.
29
+ CurrentPage: 'simulator:current-page',
30
+ };
31
+ // ── Service host (main → hidden service-host window) ─────────────────────
32
+ export const ServiceHostChannel = {
33
+ /**
34
+ * NATIVE-HOST ONLY. Live-update the service-host window's host-env snapshot
35
+ * (device metrics) so subsequent `wx.getSystemInfoSync()` reflects a device
36
+ * change without a relaunch. The service-host preload mutates
37
+ * `__diminaSpawnContext.hostEnvSnapshot` in place (see `service-host/preload.cjs`).
38
+ */
39
+ HostEnvUpdate: 'service-host:host-env:update',
15
40
  };
16
41
  // ── Custom simulator APIs (downstream-registered, main-process handlers) ──
17
42
  // list: simulator queries the names registered via instance.registerSimulatorApi().
18
43
  // invoke: simulator forwards an API call to the registry; result/reject propagates.
19
44
  //
20
45
  // These are ipcMain.handle channels invoked by the **main-window renderer**
21
- // only (trusted host). The simulator <webview> never reaches them directly —
22
- // it proxies through the host via the bridge channels below, so the
23
- // sender-policy can keep the webview off the IPC white-list.
46
+ // only (trusted host). The simulator guest never reaches them directly — it
47
+ // reaches the host via the bridge channels below, so the sender-policy can keep
48
+ // the simulator off the IPC white-list.
24
49
  export const SimulatorCustomApiChannel = {
25
50
  List: 'simulator:custom-apis:list',
26
51
  Invoke: 'simulator:custom-apis:invoke',
27
52
  };
28
- // ── Custom APIs bridge proxy (simulator <webview> ↔ main-window renderer) ──
29
- // Request: webview host via `ipcRenderer.sendToHost`,
30
- // payload = { id, op: 'list' } | { id, op: 'invoke', name, params }
31
- // Response: host webview via `<webview>.send`,
32
- // payload = { id, result } | { id, error }
53
+ // ── Custom APIs bridge (simulator host) ──
54
+ // payload = { id, op: 'list' } | { id, op: 'invoke', name, params } for Request,
55
+ // { id, result } | { id, error } for Response. Transport (in
56
+ // `src/preload/runtime/custom-apis.ts`): native-host the simulator is a
57
+ // top-level WebContentsView (no embedder), so Request goes via
58
+ // `ipcRenderer.send` → `ipcMain.on` dispatcher bound to that simWc (view-manager
59
+ // `attachNativeCustomApiBridge`) → Response via `simWc.send`. (The old
60
+ // renderer-proxied `<webview>` transport, `ipcRenderer.sendToHost` →
61
+ // `<webview>.send`, no longer exists — native-host is the sole runtime.)
33
62
  //
34
63
  // Request/response are correlated by `id` so multiple concurrent invokes can
35
64
  // be in flight at once.
@@ -38,7 +67,7 @@ export const SimulatorCustomApiBridgeChannel = {
38
67
  Response: 'simulator:custom-apis:bridge-response',
39
68
  };
40
69
  // ── Storage (CDP-backed; main process attaches the debugger to the
41
- // simulator <webview> and forwards DOMStorage events to the renderer) ──
70
+ // simulator guest and forwards DOMStorage events to the renderer) ──
42
71
  export const SimulatorStorageChannel = {
43
72
  GetSnapshot: 'simulator:storage:snapshot',
44
73
  GetActivePrefix: 'simulator:storage:activePrefix',
@@ -53,6 +82,28 @@ export const SimulatorElementChannel = {
53
82
  Inspect: 'simulator:element:inspect',
54
83
  Clear: 'simulator:element:clear',
55
84
  };
85
+ // ── Workbench runtime info (renderer reads once to pick panel data sources) ──
86
+ // Under native-host the page DOM / service logic live in separate webContents,
87
+ // so WXML + AppData are sourced from the main process instead of the simulator
88
+ // guest's miniappSnapshot transport. The renderer queries this flag once and
89
+ // branches usePanelData accordingly.
90
+ export const WorkbenchRuntimeChannel = {
91
+ GetNativeHost: 'workbench:runtime:native-host',
92
+ };
93
+ // ── WXML tree (native-host: main pulls the tree from the active render-host
94
+ // <webview> guest via render-inspect, and pushes/answers here — mirroring the
95
+ // Storage panel's main→renderer contract so the renderer panel is unchanged) ──
96
+ export const SimulatorWxmlChannel = {
97
+ GetSnapshot: 'simulator:wxml:snapshot',
98
+ Event: 'simulator:wxml:event',
99
+ };
100
+ // ── AppData (native-host: main taps the service→render setData stream in
101
+ // bridge-router and pushes the cumulative snapshot here — the service logic runs
102
+ // in the hidden service-host window, not a Worker in the simulator guest) ──
103
+ export const SimulatorAppDataChannel = {
104
+ GetSnapshot: 'simulator:appdata:snapshot',
105
+ Event: 'simulator:appdata:event',
106
+ };
56
107
  // ── Workbench settings ───────────────────────────────────────────────────
57
108
  export const WorkbenchSettingsChannel = {
58
109
  Get: 'workbenchSettings:get',
@@ -74,6 +125,39 @@ export const ProjectChannel = {
74
125
  CaptureThumbnail: 'project:captureThumbnail',
75
126
  GetThumbnail: 'project:getThumbnail',
76
127
  };
128
+ // ── Project file system (sandboxed to active project root) ────────────────
129
+ //
130
+ // Read/write access to the active project's files, used by the in-renderer
131
+ // Monaco editor. Every path is verified against the active project root in
132
+ // the main process (see `services/project-fs`). Replaces the OpenSumi
133
+ // editor's `editor:fs:*` bridge — same sandbox, callable from the main
134
+ // renderer instead of a separate WebContentsView.
135
+ export const ProjectFsChannel = {
136
+ GetRoot: 'project:fs:getRoot',
137
+ ReadFile: 'project:fs:readFile',
138
+ WriteFile: 'project:fs:writeFile',
139
+ /**
140
+ * Synchronous (blocking) write, used ONLY by the editor's `beforeunload`
141
+ * flush: a hard window/app close tears the renderer down before an async
142
+ * `WriteFile` IPC can round-trip, so the last in-debounce-window edit would
143
+ * be lost. `sendSync` blocks page teardown until the bytes hit disk. Runs the
144
+ * SAME sandbox as `WriteFile` (see project-fs `writeFileSync`).
145
+ */
146
+ WriteFileSync: 'project:fs:writeFileSync',
147
+ ListFiles: 'project:fs:listFiles',
148
+ };
149
+ // ── Editor (main → renderer) ──────────────────────────────────────────────
150
+ //
151
+ // Drives the in-renderer Monaco editor from the main process. Used by the
152
+ // "click a console file link → open the file at line:col" pipeline: the
153
+ // embedded DevTools front-end routes a source-link click through an open-
154
+ // resource handler → Electron `devtools-open-url` on the service host → main
155
+ // maps the resource URL to a project-relative path → this event opens it in
156
+ // Monaco. Payload: `EditorOpenFilePayload`.
157
+ export const EditorChannel = {
158
+ /** main → renderer: open `path` (project-relative POSIX) at `line`/`column`. */
159
+ OpenFile: 'editor:openFile',
160
+ };
77
161
  // ── Project list / workspace ─────────────────────────────────────────────
78
162
  export const ProjectsChannel = {
79
163
  List: 'projects:list',
@@ -99,6 +183,39 @@ export const PanelChannel = {
99
183
  Select: 'panel:select',
100
184
  SelectSimulator: 'panel:selectSimulator',
101
185
  };
186
+ // ── Embedded views (renderer → main) ─────────────────────────────────────
187
+ //
188
+ // The main window's React layout owns the *positions* of the editor +
189
+ // simulator-DevTools WebContentsView overlays — each visible placeholder
190
+ // `<div>` measures its client rect via ResizeObserver and pushes the
191
+ // rectangle to the main process. The view manager caches the latest
192
+ // payload per kind and applies it to the overlay; no payload means the
193
+ // overlay is hidden.
194
+ //
195
+ // Payload (after schema validation): `{ x, y, width, height }` in CSS
196
+ // pixels relative to the window's content area (origin = top-left,
197
+ // not including the OS chrome).
198
+ export const ViewChannel = {
199
+ /** Update the simulator DevTools view's bounds (or hide if w/h = 0). */
200
+ SimulatorDevtoolsBounds: 'view:simulator:devtools-bounds',
201
+ /**
202
+ * Host-controllable toolbar WebContentsView (sits ABOVE the devtools built-in
203
+ * header). Forward anchor: the main renderer reports the toolbar placeholder's
204
+ * bounds (or w/h=0 to hide). invoke.
205
+ */
206
+ HostToolbarBounds: 'view:host-toolbar:bounds',
207
+ /**
208
+ * Reverse size-advertiser: the host-toolbar WCV's OWN renderer advertises its
209
+ * intrinsic content height so main reserves exactly that much. Payload
210
+ * `{ axis: 'block', extent }`. fire-and-forget (send), NOT invoke.
211
+ */
212
+ HostToolbarAdvertiseHeight: 'view:host-toolbar:advertise-height',
213
+ /**
214
+ * main → main-window renderer: push the reserved host-toolbar height so the
215
+ * renderer placeholder div resizes (closing the dynamic-height loop).
216
+ */
217
+ HostToolbarHeightChanged: 'view:host-toolbar:height-changed',
218
+ };
102
219
  // ── Popover ──────────────────────────────────────────────────────────────
103
220
  export const PopoverChannel = {
104
221
  Show: 'popover:show',
@@ -25,10 +25,73 @@ export declare const ProjectSaveCompileConfigSchema: z.ZodTuple<[z.ZodString, z.
25
25
  }, z.core.$loose>], null>;
26
26
  /** popover:show — must be an object (not undefined/null/string). */
27
27
  export declare const PopoverShowSchema: z.ZodTuple<[z.ZodObject<{}, z.core.$loose>], null>;
28
- /** simulator:attach — webContents id (positive int) + simulator width. */
29
- export declare const SimulatorAttachSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
28
+ /**
29
+ * simulator:attach-native (native-host only) — the simulator URL to load into
30
+ * the top-level WebContentsView + simulator width. The URL is the dev-server
31
+ * `http://localhost:<port>/simulator.html?…` the renderer would otherwise put
32
+ * on the `<webview src>`; we validate it's an http(s) URL to keep the WCV off
33
+ * arbitrary origins (will-navigate hardening re-checks at navigation time).
34
+ */
35
+ export declare const SimulatorAttachNativeSchema: z.ZodTuple<[z.ZodString, z.ZodNumber], null>;
30
36
  /** simulator:resize — simulator width. */
31
37
  export declare const SimulatorResizeSchema: z.ZodTuple<[z.ZodNumber], null>;
38
+ /**
39
+ * simulator:set-native-bounds (native-host only) — the renderer-measured
40
+ * device-bezel inner-screen rect (CSS px, from `getBoundingClientRect()`, may
41
+ * be fractional/zero) plus the device zoom percent. Positioned 1:1 as the
42
+ * simulator WCV overlay bounds. Coordinates are plain finite numbers (x/y may
43
+ * be negative when scrolled off-screen); zoom is the ZOOM_OPTIONS percent.
44
+ */
45
+ export declare const SimulatorSetNativeBoundsSchema: z.ZodTuple<[z.ZodObject<{
46
+ x: z.ZodNumber;
47
+ y: z.ZodNumber;
48
+ width: z.ZodNumber;
49
+ height: z.ZodNumber;
50
+ zoom: z.ZodNumber;
51
+ }, z.core.$strip>], null>;
52
+ /**
53
+ * simulator:set-device-info (native-host only) — the selected device's logical
54
+ * metrics, mapped by main into the service-host window's HostEnvSnapshot. Sizes
55
+ * are bounded positive ints (logical device px); strings are bounded to keep the
56
+ * payload small. Matches `NativeDeviceInfo` in ipc-channels.ts.
57
+ */
58
+ export declare const SimulatorSetDeviceInfoSchema: z.ZodTuple<[z.ZodObject<{
59
+ brand: z.ZodString;
60
+ model: z.ZodString;
61
+ system: z.ZodString;
62
+ platform: z.ZodString;
63
+ pixelRatio: z.ZodNumber;
64
+ screenWidth: z.ZodNumber;
65
+ screenHeight: z.ZodNumber;
66
+ statusBarHeight: z.ZodNumber;
67
+ safeAreaBottom: z.ZodNumber;
68
+ notchType: z.ZodEnum<{
69
+ none: "none";
70
+ notch: "notch";
71
+ "dynamic-island": "dynamic-island";
72
+ }>;
73
+ safeAreaInsets: z.ZodObject<{
74
+ top: z.ZodNumber;
75
+ right: z.ZodNumber;
76
+ bottom: z.ZodNumber;
77
+ left: z.ZodNumber;
78
+ }, z.core.$strip>;
79
+ }, z.core.$strip>], null>;
80
+ export declare const ViewBoundsSchema: z.ZodTuple<[z.ZodObject<{
81
+ x: z.ZodNumber;
82
+ y: z.ZodNumber;
83
+ width: z.ZodNumber;
84
+ height: z.ZodNumber;
85
+ }, z.core.$strip>], null>;
86
+ /**
87
+ * host-toolbar reverse size-advertiser payload — the toolbar WCV renderer
88
+ * advertises its intrinsic content height on the block axis. Mirrors
89
+ * `@dimina-kit/view-anchor`'s `AdvertisedSize`.
90
+ */
91
+ export declare const HostToolbarAdvertiseHeightSchema: z.ZodTuple<[z.ZodObject<{
92
+ axis: z.ZodLiteral<"block">;
93
+ extent: z.ZodNumber;
94
+ }, z.core.$strip>], null>;
32
95
  /** simulator:setVisible — visible flag + simulator width. */
33
96
  export declare const SimulatorSetVisibleSchema: z.ZodTuple<[z.ZodBoolean, z.ZodNumber], null>;
34
97
  /**
@@ -50,13 +50,89 @@ export const PopoverShowSchema = z.tuple([z.looseObject({})]);
50
50
  * we still reject obvious garbage (negative, zero, absurdly large).
51
51
  */
52
52
  const SimWidth = z.number().int().min(100).max(2000);
53
- /** simulator:attach — webContents id (positive int) + simulator width. */
54
- export const SimulatorAttachSchema = z.tuple([
55
- z.number().int().positive(),
53
+ /**
54
+ * simulator:attach-native (native-host only) — the simulator URL to load into
55
+ * the top-level WebContentsView + simulator width. The URL is the dev-server
56
+ * `http://localhost:<port>/simulator.html?…` the renderer would otherwise put
57
+ * on the `<webview src>`; we validate it's an http(s) URL to keep the WCV off
58
+ * arbitrary origins (will-navigate hardening re-checks at navigation time).
59
+ */
60
+ export const SimulatorAttachNativeSchema = z.tuple([
61
+ z.string().url().refine((u) => u.startsWith('http://') || u.startsWith('https://'), {
62
+ message: 'simulator URL must be http(s)',
63
+ }),
56
64
  SimWidth,
57
65
  ]);
58
66
  /** simulator:resize — simulator width. */
59
67
  export const SimulatorResizeSchema = z.tuple([SimWidth]);
68
+ /**
69
+ * simulator:set-native-bounds (native-host only) — the renderer-measured
70
+ * device-bezel inner-screen rect (CSS px, from `getBoundingClientRect()`, may
71
+ * be fractional/zero) plus the device zoom percent. Positioned 1:1 as the
72
+ * simulator WCV overlay bounds. Coordinates are plain finite numbers (x/y may
73
+ * be negative when scrolled off-screen); zoom is the ZOOM_OPTIONS percent.
74
+ */
75
+ export const SimulatorSetNativeBoundsSchema = z.tuple([
76
+ z.object({
77
+ x: z.number().finite(),
78
+ y: z.number().finite(),
79
+ width: z.number().finite(),
80
+ height: z.number().finite(),
81
+ zoom: z.number().finite().positive(),
82
+ }),
83
+ ]);
84
+ /**
85
+ * simulator:set-device-info (native-host only) — the selected device's logical
86
+ * metrics, mapped by main into the service-host window's HostEnvSnapshot. Sizes
87
+ * are bounded positive ints (logical device px); strings are bounded to keep the
88
+ * payload small. Matches `NativeDeviceInfo` in ipc-channels.ts.
89
+ */
90
+ export const SimulatorSetDeviceInfoSchema = z.tuple([
91
+ z.object({
92
+ brand: z.string().max(64),
93
+ model: z.string().max(64),
94
+ system: z.string().max(64),
95
+ platform: z.string().max(32),
96
+ pixelRatio: z.number().finite().positive(),
97
+ screenWidth: z.number().int().min(100).max(4000),
98
+ screenHeight: z.number().int().min(100).max(4000),
99
+ statusBarHeight: z.number().finite().min(0).max(400),
100
+ safeAreaBottom: z.number().finite().min(0).max(400),
101
+ notchType: z.enum(['none', 'notch', 'dynamic-island']),
102
+ safeAreaInsets: z.object({
103
+ top: z.number().finite().min(0).max(400),
104
+ right: z.number().finite().min(0).max(400),
105
+ bottom: z.number().finite().min(0).max(400),
106
+ left: z.number().finite().min(0).max(400),
107
+ }),
108
+ }),
109
+ ]);
110
+ /**
111
+ * view:*:bounds — renderer-measured CSS pixel rectangle in window content
112
+ * coordinates. Width/height = 0 is the canonical "overlay hidden" signal.
113
+ * No upper bound is enforced (window can be very large); we only refuse
114
+ * negative/NaN values that would break setBounds.
115
+ */
116
+ const NonNegInt = z.number().int().min(0).max(100_000);
117
+ export const ViewBoundsSchema = z.tuple([
118
+ z.object({
119
+ x: NonNegInt,
120
+ y: NonNegInt,
121
+ width: NonNegInt,
122
+ height: NonNegInt,
123
+ }),
124
+ ]);
125
+ /**
126
+ * host-toolbar reverse size-advertiser payload — the toolbar WCV renderer
127
+ * advertises its intrinsic content height on the block axis. Mirrors
128
+ * `@dimina-kit/view-anchor`'s `AdvertisedSize`.
129
+ */
130
+ export const HostToolbarAdvertiseHeightSchema = z.tuple([
131
+ z.object({
132
+ axis: z.literal('block'),
133
+ extent: NonNegInt,
134
+ }),
135
+ ]);
60
136
  /** simulator:setVisible — visible flag + simulator width. */
61
137
  export const SimulatorSetVisibleSchema = z.tuple([z.boolean(), SimWidth]);
62
138
  /**
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Shared, pure helpers for the "click a console file link → open the built-in
3
+ * Monaco editor" pipeline (native-host).
4
+ *
5
+ * The right-panel console is the embedded Chromium DevTools front-end inspecting
6
+ * the service host. When a sourcemap maps a console frame back to source, the
7
+ * front-end can be made to route a source-link click through an "open resource
8
+ * handler" instead of its own Sources panel (the same hook IDEs use to integrate
9
+ * with Chrome DevTools). Our handler can't talk IPC directly from the closed
10
+ * DevTools realm, so it encodes the target as a sentinel URL and asks the
11
+ * front-end to "open" it; Electron surfaces that as a `devtools-open-url` event
12
+ * on the inspected webContents, which main decodes here.
13
+ *
14
+ * This module owns ONLY the pure string/URL logic (encode + decode + map a
15
+ * DevTools resource URL to a project-relative path). It has no electron / DOM /
16
+ * node deps so it is unit-testable and shared by main + the injected front-end
17
+ * snippet's expectations.
18
+ */
19
+ /**
20
+ * Sentinel scheme for the encoded "open in editor" request. A bare custom scheme
21
+ * (no `//authority`) keeps the encoded payload entirely in the URL's path/query,
22
+ * which `InspectorFrontendHost.openInNewTab` forwards verbatim to Electron's
23
+ * `devtools-open-url` event.
24
+ */
25
+ export declare const OPEN_IN_EDITOR_SCHEME = "dimina-open-in-editor";
26
+ /** A decoded open-in-editor request: a project source location. */
27
+ export interface OpenInEditorRequest {
28
+ /** The DevTools resource URL of the clicked source (the map `sources` entry, absolute). */
29
+ url: string;
30
+ /** 0-based line as reported by DevTools (may be undefined for a bare file link). */
31
+ line?: number;
32
+ /** 0-based column as reported by DevTools (may be undefined). */
33
+ column?: number;
34
+ }
35
+ /**
36
+ * Encode an open-in-editor request as a sentinel URL the DevTools front-end can
37
+ * hand to `InspectorFrontendHost.openInNewTab(...)`. All fields ride in the
38
+ * query string so no value is ever interpolated into a path segment.
39
+ */
40
+ export declare function encodeOpenInEditorUrl(req: OpenInEditorRequest): string;
41
+ /**
42
+ * Decode a sentinel URL produced by `encodeOpenInEditorUrl`. Returns null for
43
+ * any URL that is not our sentinel scheme (so a real "open in new tab" link the
44
+ * user clicked is left to Electron's default external-open path).
45
+ */
46
+ export declare function decodeOpenInEditorUrl(raw: string): OpenInEditorRequest | null;
47
+ /**
48
+ * Map a DevTools resource URL to a PROJECT-RELATIVE source path (POSIX, no
49
+ * leading slash) — the same key the in-renderer Monaco editor opens files by
50
+ * (`joinPosix(root, rel)` → `project:fs:readFile`).
51
+ *
52
+ * The compiler emits each `logic.js.map` with `sources` = the project-relative
53
+ * source path (e.g. `pages/home/home.js`, or `subpkg/pages/x/x.js` for a sub-
54
+ * package — both already rooted at the project). DevTools resolves those against
55
+ * the map URL on the dev server, producing
56
+ * `http://127.0.0.1:<port>/<appId>/<source-path>`. So recovering the project-
57
+ * relative path is exactly: strip the origin, then strip the FIRST path segment
58
+ * (the `<appId>` the dev server namespaces the bundle under). What remains is
59
+ * the source path the compiler recorded, which is the editor's open key — this
60
+ * holds for both the main package and sub-packages without needing the project's
61
+ * appId / root threaded in.
62
+ *
63
+ * @param resourceUrl The absolute URL DevTools reported for the clicked source.
64
+ * @param expectedOrigin Optional dev-server origin to gate on
65
+ * (`http://127.0.0.1:<port>`); when given, a URL from a different origin (a
66
+ * framework/`webpack://`/`node:` frame) returns null instead of mis-mapping.
67
+ * @returns the project-relative POSIX path, or null when the URL is not a
68
+ * mappable dev-server source.
69
+ */
70
+ export declare function resourceUrlToProjectRelativePath(resourceUrl: string, expectedOrigin?: string): string | null;
71
+ //# sourceMappingURL=open-in-editor.d.ts.map