@dimina-kit/devtools 0.4.0 → 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 (507) hide show
  1. package/README.md +51 -660
  2. package/dist/main/api.d.ts +2 -1
  3. package/dist/main/app/app.d.ts +41 -12
  4. package/dist/main/app/app.js +299 -514
  5. package/dist/main/app/bootstrap.d.ts +8 -5
  6. package/dist/main/app/bootstrap.js +15 -15
  7. package/dist/main/app/editor-view.d.ts +21 -0
  8. package/dist/main/app/editor-view.js +71 -0
  9. package/dist/main/app/global-mirrors.d.ts +23 -0
  10. package/dist/main/app/global-mirrors.js +37 -0
  11. package/dist/main/app/host-sidebar-default.d.ts +19 -0
  12. package/dist/main/app/host-sidebar-default.js +44 -0
  13. package/dist/main/app/lifecycle.d.ts +12 -1
  14. package/dist/main/app/lifecycle.js +27 -1
  15. package/dist/main/app/menu-setup.d.ts +13 -0
  16. package/dist/main/app/menu-setup.js +49 -0
  17. package/dist/main/app/native-overview.d.ts +1 -1
  18. package/dist/main/app/open-project-ipc.d.ts +13 -0
  19. package/dist/main/app/open-project-ipc.js +21 -0
  20. package/dist/main/app/project-list-surface.d.ts +31 -0
  21. package/dist/main/app/project-list-surface.js +20 -0
  22. package/dist/main/app/project-window.d.ts +36 -0
  23. package/dist/main/app/project-window.js +93 -0
  24. package/dist/main/app/servers.d.ts +17 -0
  25. package/dist/main/app/servers.js +60 -0
  26. package/dist/main/app/ui-extension-targets.d.ts +42 -0
  27. package/dist/main/app/ui-extension-targets.js +101 -0
  28. package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
  29. package/dist/main/app/window-close-reveal.harness.js +65 -0
  30. package/dist/main/app/window-events.d.ts +15 -0
  31. package/dist/main/app/window-events.js +45 -0
  32. package/dist/main/app/window-runtime-services.d.ts +41 -0
  33. package/dist/main/app/window-runtime-services.js +197 -0
  34. package/dist/main/app/workbench-modules.d.ts +24 -0
  35. package/dist/main/app/workbench-modules.js +51 -0
  36. package/dist/main/app/workbench-window.d.ts +85 -0
  37. package/dist/main/app/workbench-window.js +310 -0
  38. package/dist/main/index.bundle.js +11712 -9986
  39. package/dist/main/index.js +49 -1
  40. package/dist/main/ipc/app-lifecycle.d.ts +1 -31
  41. package/dist/main/ipc/app-lifecycle.js +1 -53
  42. package/dist/main/ipc/app.d.ts +4 -1
  43. package/dist/main/ipc/app.js +4 -3
  44. package/dist/main/ipc/bridge-router.d.ts +19 -116
  45. package/dist/main/ipc/bridge-router.js +28 -2128
  46. package/dist/main/ipc/device-picker.d.ts +16 -0
  47. package/dist/main/ipc/device-picker.js +27 -0
  48. package/dist/main/ipc/index.d.ts +5 -0
  49. package/dist/main/ipc/index.js +5 -0
  50. package/dist/main/ipc/internal-devtools.d.ts +16 -0
  51. package/dist/main/ipc/internal-devtools.js +10 -0
  52. package/dist/main/ipc/page-scroll.d.ts +1 -13
  53. package/dist/main/ipc/page-scroll.js +1 -16
  54. package/dist/main/ipc/popover.d.ts +4 -1
  55. package/dist/main/ipc/popover.js +26 -19
  56. package/dist/main/ipc/project-create.d.ts +16 -0
  57. package/dist/main/ipc/project-create.js +27 -0
  58. package/dist/main/ipc/project-fs.d.ts +38 -3
  59. package/dist/main/ipc/project-fs.js +53 -22
  60. package/dist/main/ipc/projects.d.ts +3 -3
  61. package/dist/main/ipc/projects.js +47 -11
  62. package/dist/main/ipc/session-listener-bag.d.ts +1 -40
  63. package/dist/main/ipc/session-listener-bag.js +1 -39
  64. package/dist/main/ipc/session.d.ts +4 -1
  65. package/dist/main/ipc/session.js +26 -26
  66. package/dist/main/ipc/settings.d.ts +4 -1
  67. package/dist/main/ipc/settings.js +17 -19
  68. package/dist/main/ipc/simulator-module.d.ts +9 -3
  69. package/dist/main/ipc/simulator-module.js +13 -10
  70. package/dist/main/ipc/simulator.d.ts +4 -1
  71. package/dist/main/ipc/simulator.js +12 -18
  72. package/dist/main/ipc/tooltip.d.ts +14 -0
  73. package/dist/main/ipc/tooltip.js +29 -0
  74. package/dist/main/ipc/views.d.ts +19 -2
  75. package/dist/main/ipc/views.js +76 -8
  76. package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
  77. package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
  78. package/dist/main/runtime/devtools-backend.js +60 -4
  79. package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
  80. package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
  81. package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
  82. package/dist/main/services/app-services.d.ts +62 -0
  83. package/dist/main/services/app-services.js +64 -0
  84. package/dist/main/services/automation/connection-target.d.ts +36 -0
  85. package/dist/main/services/automation/connection-target.js +29 -0
  86. package/dist/main/services/automation/console-bridge.d.ts +28 -0
  87. package/dist/main/services/automation/console-bridge.js +91 -0
  88. package/dist/main/services/automation/handlers/app.js +4 -4
  89. package/dist/main/services/automation/handlers/element.js +55 -21
  90. package/dist/main/services/automation/index.d.ts +12 -1
  91. package/dist/main/services/automation/index.js +54 -133
  92. package/dist/main/services/cdp-session/index.d.ts +87 -0
  93. package/dist/main/services/cdp-session/index.js +173 -0
  94. package/dist/main/services/compile-standby.js +4 -0
  95. package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
  96. package/dist/main/services/console-forward/cdp-inject.js +30 -0
  97. package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
  98. package/dist/main/services/console-forward/global-console-mirror.js +71 -0
  99. package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
  100. package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
  101. package/dist/main/services/console-forward/index.d.ts +1 -46
  102. package/dist/main/services/console-forward/index.js +1 -185
  103. package/dist/main/services/console-forward/internal-log.d.ts +2 -0
  104. package/dist/main/services/console-forward/internal-log.js +2 -0
  105. package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
  106. package/dist/main/services/console-forward/open-gated-relay.js +55 -0
  107. package/dist/main/services/default-adapter.js +1 -1
  108. package/dist/main/services/diagnostics/index.d.ts +1 -48
  109. package/dist/main/services/diagnostics/index.js +1 -60
  110. package/dist/main/services/dimina-resource-server.d.ts +1 -6
  111. package/dist/main/services/dimina-resource-server.js +1 -98
  112. package/dist/main/services/elements-forward/index.d.ts +132 -15
  113. package/dist/main/services/elements-forward/index.js +155 -304
  114. package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
  115. package/dist/main/services/fs-bridge-protocol.js +34 -0
  116. package/dist/main/services/fs-watch-sse.d.ts +40 -0
  117. package/dist/main/services/fs-watch-sse.js +113 -0
  118. package/dist/main/services/http-json.d.ts +9 -0
  119. package/dist/main/services/http-json.js +6 -0
  120. package/dist/main/services/layout/index.d.ts +11 -0
  121. package/dist/main/services/layout/index.js +23 -0
  122. package/dist/main/services/mcp/connection-owner.d.ts +38 -0
  123. package/dist/main/services/mcp/connection-owner.js +79 -0
  124. package/dist/main/services/mcp/index.d.ts +3 -1
  125. package/dist/main/services/mcp/index.js +4 -3
  126. package/dist/main/services/mcp/opened-project.d.ts +88 -0
  127. package/dist/main/services/mcp/opened-project.js +60 -0
  128. package/dist/main/services/mcp/server.d.ts +2 -1
  129. package/dist/main/services/mcp/server.js +29 -4
  130. package/dist/main/services/mcp/target-manager.d.ts +71 -23
  131. package/dist/main/services/mcp/target-manager.js +269 -138
  132. package/dist/main/services/mcp/target-selection.d.ts +47 -0
  133. package/dist/main/services/mcp/target-selection.js +71 -0
  134. package/dist/main/services/mcp/tools/context-tools.js +20 -5
  135. package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
  136. package/dist/main/services/mcp/tools/project-tools.js +133 -0
  137. package/dist/main/services/module.d.ts +13 -5
  138. package/dist/main/services/network-forward/body-cache.d.ts +72 -0
  139. package/dist/main/services/network-forward/body-cache.js +179 -0
  140. package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
  141. package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
  142. package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
  143. package/dist/main/services/network-forward/global-body-gate.js +93 -0
  144. package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
  145. package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
  146. package/dist/main/services/network-forward/http.d.ts +47 -0
  147. package/dist/main/services/network-forward/http.js +162 -0
  148. package/dist/main/services/network-forward/index.d.ts +135 -15
  149. package/dist/main/services/network-forward/index.js +854 -224
  150. package/dist/main/services/network-forward/request-ids.d.ts +5 -0
  151. package/dist/main/services/network-forward/request-ids.js +5 -0
  152. package/dist/main/services/network-forward/user-facing.d.ts +21 -0
  153. package/dist/main/services/network-forward/user-facing.js +50 -0
  154. package/dist/main/services/network-forward/websocket.d.ts +36 -0
  155. package/dist/main/services/network-forward/websocket.js +120 -0
  156. package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
  157. package/dist/main/services/notifications/renderer-notifier.js +45 -8
  158. package/dist/main/services/projects/create-project-service.js +19 -5
  159. package/dist/main/services/projects/local-provider.js +8 -4
  160. package/dist/main/services/projects/project-repository.d.ts +59 -7
  161. package/dist/main/services/projects/project-repository.js +285 -51
  162. package/dist/main/services/projects/types.d.ts +44 -34
  163. package/dist/main/services/render-inspect/index.d.ts +12 -2
  164. package/dist/main/services/render-inspect/index.js +21 -102
  165. package/dist/main/services/safe-area/index.d.ts +21 -6
  166. package/dist/main/services/safe-area/index.js +92 -46
  167. package/dist/main/services/service-host-pool/pool.d.ts +1 -196
  168. package/dist/main/services/service-host-pool/pool.js +1 -363
  169. package/dist/main/services/settings/index.d.ts +7 -1
  170. package/dist/main/services/settings/index.js +22 -2
  171. package/dist/main/services/simulator/custom-apis.d.ts +1 -42
  172. package/dist/main/services/simulator/custom-apis.js +1 -46
  173. package/dist/main/services/simulator/referer.d.ts +1 -9
  174. package/dist/main/services/simulator/referer.js +1 -19
  175. package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
  176. package/dist/main/services/simulator/ui-extensions.js +176 -0
  177. package/dist/main/services/simulator-appdata/index.d.ts +6 -0
  178. package/dist/main/services/simulator-appdata/index.js +21 -2
  179. package/dist/main/services/simulator-current-page/index.d.ts +5 -3
  180. package/dist/main/services/simulator-current-page/index.js +8 -1
  181. package/dist/main/services/simulator-storage/index.d.ts +34 -5
  182. package/dist/main/services/simulator-storage/index.js +73 -71
  183. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
  184. package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
  185. package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
  186. package/dist/main/services/simulator-storage/window-scope.js +20 -0
  187. package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
  188. package/dist/main/services/simulator-temp-files/disk.js +1 -237
  189. package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
  190. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
  191. package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
  192. package/dist/main/services/simulator-temp-files/index.js +1 -181
  193. package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
  194. package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
  195. package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
  196. package/dist/main/services/simulator-temp-files/resolver.js +1 -21
  197. package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
  198. package/dist/main/services/simulator-temp-files/store.js +1 -23
  199. package/dist/main/services/update/github-release-checker.js +22 -3
  200. package/dist/main/services/update/update-manager.d.ts +21 -4
  201. package/dist/main/services/update/update-manager.js +55 -11
  202. package/dist/main/services/views/clear-console-filter.d.ts +44 -0
  203. package/dist/main/services/views/clear-console-filter.js +86 -0
  204. package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
  205. package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
  206. package/dist/main/services/views/console-filter.d.ts +94 -0
  207. package/dist/main/services/views/console-filter.js +190 -0
  208. package/dist/main/services/views/devtools-tabs.d.ts +24 -4
  209. package/dist/main/services/views/devtools-tabs.js +40 -21
  210. package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
  211. package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
  212. package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
  213. package/dist/main/services/views/host-dialog-port-channel.js +15 -0
  214. package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
  215. package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
  216. package/dist/main/services/views/host-dialog-view.d.ts +95 -0
  217. package/dist/main/services/views/host-dialog-view.js +147 -0
  218. package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
  219. package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
  220. package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
  221. package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
  222. package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
  223. package/dist/main/services/views/host-sidebar-view.js +44 -0
  224. package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
  225. package/dist/main/services/views/host-slot-port-channel.js +289 -0
  226. package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
  227. package/dist/main/services/views/host-slot-session-runtime.js +50 -0
  228. package/dist/main/services/views/host-slot-view.d.ts +109 -0
  229. package/dist/main/services/views/host-slot-view.js +147 -0
  230. package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
  231. package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
  232. package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
  233. package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
  234. package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
  235. package/dist/main/services/views/host-toolbar-view.js +30 -237
  236. package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
  237. package/dist/main/services/views/managed-web-contents-view.js +143 -0
  238. package/dist/main/services/views/miniapp-partition.d.ts +1 -89
  239. package/dist/main/services/views/miniapp-partition.js +1 -158
  240. package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
  241. package/dist/main/services/views/native-simulator-view.d.ts +6 -0
  242. package/dist/main/services/views/native-simulator-view.js +47 -40
  243. package/dist/main/services/views/native-view-tree.d.ts +25 -0
  244. package/dist/main/services/views/native-view-tree.js +69 -0
  245. package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
  246. package/dist/main/services/views/overlay-panels-view.js +257 -108
  247. package/dist/main/services/views/placement-reconciler.d.ts +18 -18
  248. package/dist/main/services/views/placement-reconciler.js +91 -29
  249. package/dist/main/services/views/placement-test-driver.d.ts +27 -0
  250. package/dist/main/services/views/placement-test-driver.js +29 -0
  251. package/dist/main/services/views/refresh-styles.d.ts +10 -0
  252. package/dist/main/services/views/refresh-styles.js +57 -0
  253. package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
  254. package/dist/main/services/views/simulator-session-policy.js +1 -98
  255. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
  256. package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
  257. package/dist/main/services/views/view-manager.d.ts +69 -88
  258. package/dist/main/services/views/view-manager.js +62 -7
  259. package/dist/main/services/views/workbench-view.d.ts +2 -0
  260. package/dist/main/services/views/workbench-view.js +104 -17
  261. package/dist/main/services/window-contexts/context-router.d.ts +36 -0
  262. package/dist/main/services/window-contexts/context-router.js +55 -0
  263. package/dist/main/services/workbench-coi-host.d.ts +52 -0
  264. package/dist/main/services/workbench-coi-host.js +227 -0
  265. package/dist/main/services/workbench-coi-server.d.ts +11 -0
  266. package/dist/main/services/workbench-coi-server.js +126 -126
  267. package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
  268. package/dist/main/services/workbench-coi-shutdown.js +69 -0
  269. package/dist/main/services/workbench-coi-static.d.ts +23 -0
  270. package/dist/main/services/workbench-coi-static.js +87 -0
  271. package/dist/main/services/workbench-context.d.ts +88 -8
  272. package/dist/main/services/workbench-context.js +54 -6
  273. package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
  274. package/dist/main/services/workspace/compile-log-buffer.js +41 -0
  275. package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
  276. package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
  277. package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
  278. package/dist/main/services/workspace/compile-mode-store.js +71 -0
  279. package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
  280. package/dist/main/services/workspace/open-project-guards.js +42 -0
  281. package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
  282. package/dist/main/services/workspace/rebuild-status.js +36 -0
  283. package/dist/main/services/workspace/session-status-store.d.ts +47 -0
  284. package/dist/main/services/workspace/session-status-store.js +73 -0
  285. package/dist/main/services/workspace/status-tap.d.ts +20 -0
  286. package/dist/main/services/workspace/status-tap.js +32 -0
  287. package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
  288. package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
  289. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
  290. package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
  291. package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
  292. package/dist/main/services/workspace/workspace-referer.js +26 -0
  293. package/dist/main/services/workspace/workspace-service.d.ts +7 -5
  294. package/dist/main/services/workspace/workspace-service.js +96 -135
  295. package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
  296. package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
  297. package/dist/main/utils/ipc-context-source.d.ts +40 -0
  298. package/dist/main/utils/ipc-context-source.js +23 -0
  299. package/dist/main/utils/ipc-registry.d.ts +46 -21
  300. package/dist/main/utils/ipc-registry.js +166 -76
  301. package/dist/main/utils/paths.d.ts +18 -0
  302. package/dist/main/utils/paths.js +18 -0
  303. package/dist/main/utils/sender-policy.d.ts +10 -1
  304. package/dist/main/utils/sender-policy.js +42 -4
  305. package/dist/main/utils/theme.d.ts +18 -8
  306. package/dist/main/utils/theme.js +19 -9
  307. package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
  308. package/dist/main/windows/internal-devtools-window/index.js +160 -0
  309. package/dist/main/windows/main-window/create.d.ts +16 -0
  310. package/dist/main/windows/main-window/create.js +19 -11
  311. package/dist/main/windows/main-window/events.d.ts +1 -1
  312. package/dist/main/windows/main-window/events.js +26 -13
  313. package/dist/main/windows/main-window/index.d.ts +1 -1
  314. package/dist/main/windows/main-window/index.js +1 -1
  315. package/dist/main/windows/service-host-window/create.d.ts +1 -92
  316. package/dist/main/windows/service-host-window/create.js +1 -154
  317. package/dist/native-host/common/common.js +173 -53
  318. package/dist/native-host/container/pageFrame.css +1 -1
  319. package/dist/native-host/render/render.js +8278 -3659
  320. package/dist/native-host/service/service.js +2 -2
  321. package/dist/preload/index.d.ts +2 -0
  322. package/dist/preload/index.js +1 -0
  323. package/dist/preload/instrumentation/app-data.d.ts +2 -2
  324. package/dist/preload/instrumentation/app-data.js +1 -1
  325. package/dist/preload/instrumentation/wxml.js +1 -1
  326. package/dist/preload/runtime/bridge.d.ts +3 -3
  327. package/dist/preload/runtime/bridge.js +2 -2
  328. package/dist/preload/runtime/clipboard.d.ts +6 -0
  329. package/dist/preload/runtime/clipboard.js +12 -0
  330. package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
  331. package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
  332. package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
  333. package/dist/preload/runtime/host-dialog-port.js +53 -0
  334. package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
  335. package/dist/preload/runtime/host-dialog-runtime.js +36 -0
  336. package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
  337. package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
  338. package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
  339. package/dist/preload/runtime/host-sidebar-port.js +53 -0
  340. package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
  341. package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
  342. package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
  343. package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
  344. package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
  345. package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
  346. package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
  347. package/dist/preload/runtime/host-toolbar-port.js +11 -95
  348. package/dist/preload/runtime/native-host.d.ts +14 -0
  349. package/dist/preload/runtime/native-host.js +5 -8
  350. package/dist/preload/runtime/node-bindings.d.ts +18 -0
  351. package/dist/preload/runtime/node-bindings.js +44 -0
  352. package/dist/preload/runtime/temp-files.js +9 -2
  353. package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
  354. package/dist/preload/runtime/wait-for-slot-root.js +80 -0
  355. package/dist/preload/shared/api-compat.js +63 -41
  356. package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
  357. package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
  358. package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
  359. package/dist/preload/windows/host-dialog-runtime.js +13 -0
  360. package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
  361. package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
  362. package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
  363. package/dist/preload/windows/host-sidebar-runtime.js +13 -0
  364. package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
  365. package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
  366. package/dist/preload/windows/main.cjs +4922 -1246
  367. package/dist/preload/windows/main.cjs.map +4 -4
  368. package/dist/preload/windows/main.css +428 -0
  369. package/dist/preload/windows/main.css.map +7 -0
  370. package/dist/preload/windows/simulator.cjs +376 -322
  371. package/dist/preload/windows/simulator.cjs.map +4 -4
  372. package/dist/preload/windows/simulator.js +376 -322
  373. package/dist/render-host/pageFrame.html +4 -4
  374. package/dist/render-host/preload.cjs +30 -0
  375. package/dist/render-host/render-inspect.js +184 -115
  376. package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
  377. package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
  378. package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
  379. package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
  380. package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
  381. package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
  382. package/dist/renderer/assets/dist-B5HADirS.js +2 -0
  383. package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
  384. package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
  385. package/dist/renderer/assets/index-CEL_XFge.js +2 -0
  386. package/dist/renderer/assets/input-CAObw95L.js +2 -0
  387. package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
  388. package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
  389. package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
  390. package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
  391. package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
  392. package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
  393. package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
  394. package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
  395. package/dist/renderer/assets/search-BMvuYF48.js +2 -0
  396. package/dist/renderer/assets/select-nFP95TxM.js +2 -0
  397. package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
  398. package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
  399. package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
  400. package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
  401. package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
  402. package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
  403. package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
  404. package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
  405. package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
  406. package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
  407. package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
  408. package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
  409. package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
  410. package/dist/renderer/entries/device-picker/index.html +28 -0
  411. package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
  412. package/dist/renderer/entries/main/index.html +16 -7
  413. package/dist/renderer/entries/popover/index.html +16 -6
  414. package/dist/renderer/entries/project-create-dialog/index.html +27 -0
  415. package/dist/renderer/entries/settings/index.html +10 -5
  416. package/dist/renderer/entries/tooltip/index.html +21 -0
  417. package/dist/renderer/entries/update-dialog/index.html +25 -0
  418. package/dist/renderer/entries/workbench/index.html +49 -0
  419. package/dist/renderer/entries/workbench-settings/index.html +12 -5
  420. package/dist/service-host/appdata-set-data.cjs +39 -0
  421. package/dist/service-host/host-env-update.cjs +23 -0
  422. package/dist/service-host/preload.cjs +54 -48
  423. package/dist/service-host/service-message-queue.cjs +71 -0
  424. package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
  425. package/dist/service-host/sync-impls/menu-button.js +5 -3
  426. package/dist/service-host/sync-impls/system-info.js +31 -9
  427. package/dist/shared/bridge-channels.d.ts +1 -416
  428. package/dist/shared/bridge-channels.js +1 -89
  429. package/dist/shared/compile-mode-state.d.ts +73 -0
  430. package/dist/shared/compile-mode-state.js +100 -0
  431. package/dist/shared/compile-modes.d.ts +152 -0
  432. package/dist/shared/compile-modes.js +237 -0
  433. package/dist/shared/constants.d.ts +22 -0
  434. package/dist/shared/constants.js +22 -0
  435. package/dist/shared/dmb-resource-url.d.ts +2 -0
  436. package/dist/shared/dmb-resource-url.js +2 -0
  437. package/dist/shared/ipc-channels-overlays.d.ts +162 -0
  438. package/dist/shared/ipc-channels-overlays.js +203 -0
  439. package/dist/shared/ipc-channels.d.ts +24 -154
  440. package/dist/shared/ipc-channels.js +48 -96
  441. package/dist/shared/ipc-schemas.d.ts +143 -54
  442. package/dist/shared/ipc-schemas.js +137 -45
  443. package/dist/shared/node-bindings.d.ts +2 -0
  444. package/dist/shared/node-bindings.js +2 -0
  445. package/dist/shared/project-window-types.d.ts +42 -0
  446. package/dist/shared/project-window-types.js +2 -0
  447. package/dist/shared/simulator-route.d.ts +8 -0
  448. package/dist/shared/simulator-route.js +15 -0
  449. package/dist/shared/simulator-ui.d.ts +61 -0
  450. package/dist/shared/simulator-ui.js +12 -0
  451. package/dist/shared/types.d.ts +126 -41
  452. package/dist/shared/view-ids.d.ts +10 -0
  453. package/dist/shared/view-ids.js +23 -0
  454. package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
  455. package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
  456. package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
  457. package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
  458. package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
  459. package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
  460. package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
  461. package/dist/simulator/simulator.html +4 -3
  462. package/dist/simulator/temp-files.d.ts +35 -0
  463. package/dist/simulator/temp-files.js +121 -0
  464. package/dist/simulator/types.d.ts +50 -0
  465. package/dist/simulator/types.js +2 -0
  466. package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
  467. package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
  468. package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
  469. package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
  470. package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
  471. package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
  472. package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
  473. package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
  474. package/dist/vscode-workbench/index.html +21 -1
  475. package/package.json +23 -13
  476. package/dist/main/services/views/destroy-child-view.d.ts +0 -9
  477. package/dist/main/services/views/destroy-child-view.js +0 -23
  478. package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
  479. package/dist/preload/instrumentation/wxml-extract.js +0 -382
  480. package/dist/preload/shared/sid-registry.d.ts +0 -11
  481. package/dist/preload/shared/sid-registry.js +0 -38
  482. package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
  483. package/dist/renderer/assets/index-BMqyDx71.js +0 -49
  484. package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
  485. package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
  486. package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
  487. package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
  488. package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
  489. package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
  490. package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
  491. package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
  492. package/dist/shared/appdata-accumulator.d.ts +0 -95
  493. package/dist/shared/appdata-accumulator.js +0 -218
  494. package/dist/shared/request-core.d.ts +0 -84
  495. package/dist/shared/request-core.js +0 -168
  496. package/dist/shared/simulator-api-metadata.d.ts +0 -26
  497. package/dist/shared/simulator-api-metadata.js +0 -59
  498. package/dist/shared/vpath.d.ts +0 -42
  499. package/dist/shared/vpath.js +0 -105
  500. package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
  501. package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
  502. package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
  503. package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
  504. package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
  505. package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
  506. package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
  507. package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
@@ -12,18 +12,18 @@
12
12
  native-host render-host must load it too. build-native-host.mjs vendors it to
13
13
  ../native-host/container/ and rewrites this href (mirrors common.js/render.js).
14
14
  -->
15
- <link rel="stylesheet" href="../native-host/container/pageFrame.css" />
15
+ <link rel="stylesheet" href="/__sdk__/native-host/container/pageFrame.css" />
16
16
  <script>
17
17
  if (typeof globalThis.process === 'undefined') {
18
18
  globalThis.process = { env: { NODE_ENV: 'production' } };
19
19
  }
20
20
  </script>
21
21
  <script type="module">
22
- import { modDefine, modRequire } from '../native-host/common/common.js'
22
+ import { modDefine, modRequire } from '/__sdk__/native-host/common/common.js'
23
23
  window.modDefine = modDefine
24
24
  window.modRequire = modRequire
25
- await import('../native-host/render/render.js')
25
+ await import('/__sdk__/native-host/render/render.js')
26
26
  </script>
27
27
  </head>
28
- <body></body>
28
+ <body class="dd-page"></body>
29
29
  </html>
@@ -9,6 +9,7 @@ const CHANNELS = {
9
9
  const params = new URLSearchParams(globalThis.location && globalThis.location.search || '')
10
10
  const bridgeId = params.get('bridgeId')
11
11
  const pagePath = params.get('pagePath') || 'pages/index/index'
12
+ const bgColor = params.get('bgColor')
12
13
  const pendingMessages = []
13
14
  let onMessageFn = null
14
15
  let drainScheduled = false
@@ -17,6 +18,35 @@ if (!bridgeId) {
17
18
  throw new Error('[render-host] missing bridgeId in URL query')
18
19
  }
19
20
 
21
+ // WeChat parity: prime the page's OWN document with its configured
22
+ // `window.backgroundColor` before pageFrame.css / @dimina/render load. Without
23
+ // this the guest's document background is UA-default white until the page's
24
+ // own CSS paints, which is the white flash on every page transition. Applied
25
+ // as early as the preload can reach `document.documentElement` and again on
26
+ // DOMContentLoaded in case the element wasn't attached yet.
27
+ //
28
+ // `documentElement` only — never `body`. `body` carries the `.dd-page` class
29
+ // that `installPageFrameStyleScopes` (dimina/fe render runtime) gates the page's
30
+ // own `data-v-*` scope attributes on, which makes `body` the element that
31
+ // `page { ... }` rules from the app's wxss compile down to. An inline
32
+ // background-color there outranks any stylesheet rule, so it would silently
33
+ // override the app's own `page { background-color: ... }` with this
34
+ // window-config default.
35
+ //
36
+ // Upstream's `applyPageStyle()` (container-sdk webview.ts) is NOT a precedent
37
+ // for touching the guest's body: the `root` it colors is
38
+ // `.dimina-native-webview__root`, the container element OUTSIDE the guest
39
+ // iframe. Our equivalent of that layer is the host-side `<webview>` element's
40
+ // own CSS (see miniapp-frame.tsx), which stays as the first white-flash
41
+ // primer; this `documentElement` write is the second.
42
+ if (bgColor) {
43
+ const applyBackgroundColor = () => {
44
+ if (document.documentElement) document.documentElement.style.backgroundColor = bgColor
45
+ }
46
+ applyBackgroundColor()
47
+ globalThis.addEventListener('DOMContentLoaded', applyBackgroundColor)
48
+ }
49
+
20
50
  function reportError(stage, error) {
21
51
  const message = error && error.stack ? error.stack : String(error)
22
52
  console.error(`[render-host] ${stage}`, error)
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  (() => {
3
- // src/preload/shared/sid-registry.ts
3
+ // ../inspect/dist/sid-registry.js
4
4
  var SYNTHETIC_SID_PREFIX = "devtools-";
5
5
  var syntheticSidByEl = /* @__PURE__ */ new WeakMap();
6
6
  var elBySyntheticSid = /* @__PURE__ */ new Map();
7
7
  var nextSyntheticSid = 1;
8
8
  function registerSyntheticSid(el) {
9
9
  const existing = syntheticSidByEl.get(el);
10
- if (existing) return existing;
10
+ if (existing)
11
+ return existing;
11
12
  const synthetic = `${SYNTHETIC_SID_PREFIX}${nextSyntheticSid++}`;
12
13
  syntheticSidByEl.set(el, synthetic);
13
14
  elBySyntheticSid.set(synthetic, new WeakRef(el));
@@ -16,19 +17,27 @@
16
17
  function findElementBySid(doc, sid) {
17
18
  if (sid.startsWith(SYNTHETIC_SID_PREFIX)) {
18
19
  const ref = elBySyntheticSid.get(sid);
19
- if (!ref) return null;
20
+ if (!ref)
21
+ return null;
20
22
  const el = ref.deref();
21
23
  if (!el || !el.isConnected) {
22
24
  elBySyntheticSid.delete(sid);
23
25
  return null;
24
26
  }
25
- if (el.ownerDocument !== doc) return null;
27
+ if (el.ownerDocument !== doc)
28
+ return null;
26
29
  return el;
27
30
  }
28
- return doc.querySelector(`[data-sid="${CSS.escape(sid)}"]`);
31
+ return doc.querySelector(`[data-sid="${escapeForAttrSelector(sid)}"]`);
32
+ }
33
+ function escapeForAttrSelector(value) {
34
+ const impl = globalThis.CSS?.escape;
35
+ if (impl)
36
+ return impl(value);
37
+ return value.replace(/[\\"]/g, "\\$&");
29
38
  }
30
39
 
31
- // src/preload/instrumentation/wxml-extract.ts
40
+ // ../inspect/dist/wxml-extract.js
32
41
  var INTERNAL_CLASSES = /* @__PURE__ */ new Set([
33
42
  "dd-swiper-wrapper",
34
43
  "dd-swiper-slides",
@@ -50,58 +59,53 @@
50
59
  const components = parentType?.components;
51
60
  if (components) {
52
61
  for (const [regName, comp] of Object.entries(components)) {
53
- if (comp === instance.type) return normalizeRegisteredName(regName);
62
+ if (comp === instance.type)
63
+ return normalizeRegisteredName(regName);
54
64
  }
55
65
  }
56
66
  const appComponents = instance.appContext?.components;
57
- if (!appComponents) return null;
67
+ if (!appComponents)
68
+ return null;
58
69
  for (const [regName, comp] of Object.entries(appComponents)) {
59
- if (comp === instance.type) return normalizeRegisteredName(regName);
70
+ if (comp === instance.type)
71
+ return normalizeRegisteredName(regName);
60
72
  }
61
73
  return null;
62
74
  }
63
75
  function pascalToKebab(name) {
64
76
  return name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
65
77
  }
66
- function resolvePagePath(instance) {
67
- const proxy = instance.proxy;
68
- if (proxy?.__page__ !== true) return null;
69
- const provides = instance.provides;
70
- const path = provides?.path;
71
- if (typeof path !== "string" || !path) return null;
72
- return path.startsWith("/") ? path.slice(1) : path;
73
- }
74
- function resolveComponentPath(instance) {
75
- const provides = instance.provides;
76
- const path = provides?.path;
77
- if (typeof path !== "string" || !path) return null;
78
- const parent = instance.parent;
79
- const parentProvides = parent?.provides;
80
- if (path === parentProvides?.path) return null;
81
- return path.startsWith("/") ? path.slice(1) : path;
82
- }
83
78
  function resolveTagName(instance) {
84
79
  const type = instance.type;
85
- if (!type) return "unknown";
86
- const pagePath = resolvePagePath(instance);
87
- if (pagePath) return pagePath;
88
- const componentPath = resolveComponentPath(instance);
89
- if (componentPath) return componentPath;
90
- if (typeof type.__tagName === "string") return type.__tagName;
80
+ if (!type)
81
+ return "unknown";
82
+ const nameId = type.name || type.__name;
83
+ if (nameId && nameId.includes("/")) {
84
+ return nameId.startsWith("/") ? nameId.slice(1) : nameId;
85
+ }
86
+ if (typeof type.__tagName === "string")
87
+ return type.__tagName;
91
88
  const name = type.__name || type.name;
92
89
  if (!name) {
93
- if (type.__scopeId) return resolveTemplateNameFromParent(instance) || "template";
90
+ if (type.__scopeId)
91
+ return resolveTemplateNameFromParent(instance) || "template";
94
92
  return "unknown";
95
93
  }
96
- if (name === "dd-page") return "page";
97
- if (name.startsWith("dd-")) return name.slice(3);
98
- if (name.startsWith("Dd") && name.length > 2) return pascalToKebab(name.slice(2));
99
- if (/^[A-Z]/.test(name)) return pascalToKebab(name);
94
+ if (name === "dd-page")
95
+ return "page";
96
+ if (name.startsWith("dd-"))
97
+ return name.slice(3);
98
+ if (name.startsWith("Dd") && name.length > 2)
99
+ return pascalToKebab(name.slice(2));
100
+ if (/^[A-Z]/.test(name))
101
+ return pascalToKebab(name);
100
102
  return name;
101
103
  }
102
104
  function isSkippedProp(key, value) {
103
- if (typeof value === "function" || value === void 0) return true;
104
- if (key === "data" || key.startsWith("__")) return true;
105
+ if (typeof value === "function" || value === void 0)
106
+ return true;
107
+ if (key === "data" || key.startsWith("__"))
108
+ return true;
105
109
  return typeof value === "boolean" && !value;
106
110
  }
107
111
  function cleanClassAttr(value) {
@@ -111,10 +115,12 @@
111
115
  return typeof value === "object" ? JSON.stringify(value) : String(value);
112
116
  }
113
117
  function assignProp(out, key, value) {
114
- if (isSkippedProp(key, value)) return;
118
+ if (isSkippedProp(key, value))
119
+ return;
115
120
  if (key === "class" && typeof value === "string") {
116
121
  const cleaned = cleanClassAttr(value);
117
- if (cleaned) out[key] = cleaned;
122
+ if (cleaned)
123
+ out[key] = cleaned;
118
124
  return;
119
125
  }
120
126
  out[key] = stringifyPropValue(value);
@@ -122,7 +128,8 @@
122
128
  function extractProps(instance) {
123
129
  const out = {};
124
130
  for (const raw of [instance.props, instance.attrs]) {
125
- if (!raw) continue;
131
+ if (!raw)
132
+ continue;
126
133
  for (const [k, v] of Object.entries(raw)) {
127
134
  assignProp(out, k, v);
128
135
  }
@@ -131,37 +138,56 @@
131
138
  }
132
139
  function isInternalElement(vnode) {
133
140
  const props = vnode.props;
134
- if (!props) return false;
141
+ if (!props)
142
+ return false;
135
143
  const cls = String(props.class || "");
136
144
  return cls.split(/\s+/).some((c) => INTERNAL_CLASSES.has(c));
137
145
  }
138
146
  function getElementSid(instance) {
139
147
  const subTree = instance.subTree;
140
148
  const el = subTree?.el;
141
- if (!el?.getAttribute) return void 0;
149
+ if (!el?.getAttribute)
150
+ return void 0;
142
151
  const sid = el.getAttribute("data-sid");
143
- if (sid) return sid;
152
+ if (sid)
153
+ return sid;
144
154
  return registerSyntheticSid(el);
145
155
  }
156
+ function wrapperPathName(instance) {
157
+ for (const raw of [instance.props, instance.attrs]) {
158
+ const n = raw?.name;
159
+ if (typeof n === "string" && n.startsWith("/"))
160
+ return n;
161
+ }
162
+ return null;
163
+ }
146
164
  function isTransparentComponent(instance, tagName) {
147
- if (tagName === "unknown") return true;
148
- if (FRAMEWORK_TEMPLATE_RE.test(tagName)) return true;
165
+ if (tagName === "unknown")
166
+ return true;
167
+ if (FRAMEWORK_TEMPLATE_RE.test(tagName))
168
+ return true;
169
+ if (tagName === "wrapper" && wrapperPathName(instance))
170
+ return true;
149
171
  if (tagName === "template") {
150
172
  const props = instance.props;
151
173
  const is = props?.is;
152
- if (is && FRAMEWORK_TEMPLATE_RE.test(is)) return true;
174
+ if (is && FRAMEWORK_TEMPLATE_RE.test(is))
175
+ return true;
153
176
  if (!is) {
154
177
  const type = instance.type;
155
- if (type?.__scopeId && !type.components) return true;
178
+ if (type?.__scopeId && !type.components)
179
+ return true;
156
180
  }
157
181
  }
158
182
  return false;
159
183
  }
160
184
  function isCommentVNode(vnode) {
161
185
  const type = vnode.type;
162
- if (typeof type !== "symbol") return false;
186
+ if (typeof type !== "symbol")
187
+ return false;
163
188
  const desc = type.description;
164
- if (desc === "Comment" || desc === "v-cmt") return true;
189
+ if (desc === "Comment" || desc === "v-cmt")
190
+ return true;
165
191
  const children = typeof vnode.children === "string" ? vnode.children : "";
166
192
  return /^v-(if|else|else-if|for)$/.test(children);
167
193
  }
@@ -170,7 +196,8 @@
170
196
  }
171
197
  function childrenFromComponentVNode(component, depth) {
172
198
  const result = walkInstance(component, depth + 1);
173
- if (!result) return [];
199
+ if (!result)
200
+ return [];
174
201
  return Array.isArray(result) ? result : [result];
175
202
  }
176
203
  function childrenFromSuspenseVNode(suspense, depth) {
@@ -178,9 +205,11 @@
178
205
  return activeBranch ? extractChildrenFromVNode(activeBranch, depth + 1) : [];
179
206
  }
180
207
  function directTextChild(vnode) {
181
- if (typeof vnode.children !== "string" || !vnode.children.trim()) return null;
208
+ if (typeof vnode.children !== "string" || !vnode.children.trim())
209
+ return null;
182
210
  const vnodeType = vnode.type;
183
- if (typeof vnodeType !== "symbol" && typeof vnodeType !== "string") return null;
211
+ if (typeof vnodeType !== "symbol" && typeof vnodeType !== "string")
212
+ return null;
184
213
  return [textNode(vnode.children.trim())];
185
214
  }
186
215
  function textChildEntry(child) {
@@ -188,80 +217,89 @@
188
217
  return trimmed ? [textNode(trimmed)] : [];
189
218
  }
190
219
  function domTypedChildEntries(c, depth) {
191
- if (isInternalElement(c)) return extractChildrenFromVNode(c, depth + 1);
192
- if (typeof c.children === "string" && c.children.trim()) return [textNode(c.children.trim())];
220
+ if (isInternalElement(c))
221
+ return extractChildrenFromVNode(c, depth + 1);
222
+ if (typeof c.children === "string" && c.children.trim())
223
+ return [textNode(c.children.trim())];
193
224
  return extractChildrenFromVNode(c, depth + 1);
194
225
  }
195
226
  function extractChildEntry(child, depth) {
196
- if (!child) return [];
197
- if (typeof child === "string") return textChildEntry(child);
198
- if (typeof child !== "object") return [];
227
+ if (!child)
228
+ return [];
229
+ if (typeof child === "string")
230
+ return textChildEntry(child);
231
+ if (typeof child !== "object")
232
+ return [];
199
233
  const c = child;
200
- if (c.component) return childrenFromComponentVNode(c.component, depth);
201
- if (typeof c.type === "symbol") return extractChildrenFromVNode(c, depth + 1);
202
- if (typeof c.type === "string") return domTypedChildEntries(c, depth);
234
+ if (c.component)
235
+ return childrenFromComponentVNode(c.component, depth);
236
+ if (typeof c.type === "symbol")
237
+ return extractChildrenFromVNode(c, depth + 1);
238
+ if (typeof c.type === "string")
239
+ return domTypedChildEntries(c, depth);
203
240
  return extractChildrenFromVNode(c, depth + 1);
204
241
  }
205
242
  function extractChildrenFromVNode(vnode, depth) {
206
- if (!vnode || depth > 50) return [];
207
- if (isCommentVNode(vnode)) return [];
208
- if (vnode.component) return childrenFromComponentVNode(vnode.component, depth);
209
- if (vnode.suspense) return childrenFromSuspenseVNode(vnode.suspense, depth);
243
+ if (!vnode || depth > 50)
244
+ return [];
245
+ if (isCommentVNode(vnode))
246
+ return [];
247
+ if (vnode.component)
248
+ return childrenFromComponentVNode(vnode.component, depth);
249
+ if (vnode.suspense)
250
+ return childrenFromSuspenseVNode(vnode.suspense, depth);
210
251
  const directText = directTextChild(vnode);
211
- if (directText) return directText;
252
+ if (directText)
253
+ return directText;
212
254
  const kids = vnode.children;
213
- if (!Array.isArray(kids)) return [];
255
+ if (!Array.isArray(kids))
256
+ return [];
214
257
  const result = [];
215
258
  for (const child of kids) {
216
259
  result.push(...extractChildEntry(child, depth));
217
260
  }
218
261
  return result;
219
262
  }
220
- function unwrapCustomComponent(node) {
221
- if (node.tagName !== "wrapper") return node;
222
- const path = node.attrs?.name;
223
- if (typeof path !== "string" || !path.startsWith("/")) return node;
224
- const stripped = path.replace(/^\//, "");
225
- const withoutIndex = stripped.endsWith("/index") ? stripped.slice(0, -"/index".length) : stripped;
226
- const recovered = withoutIndex || stripped;
227
- if (!recovered || recovered === "index") return node;
228
- const nextAttrs = {};
229
- for (const [k, v] of Object.entries(node.attrs)) {
230
- if (k === "name") continue;
231
- nextAttrs[k] = v;
232
- }
233
- return { ...node, tagName: recovered, attrs: nextAttrs };
234
- }
235
263
  function wrapInShadowRoot(node) {
236
- if (!node.tagName.includes("/")) return node;
237
- if (node.children.length === 0) return node;
238
- if (node.children[0]?.tagName === "#shadow-root") return node;
264
+ if (!node.tagName.includes("/"))
265
+ return node;
266
+ if (node.children.length === 0)
267
+ return node;
268
+ if (node.children[0]?.tagName === "#shadow-root")
269
+ return node;
239
270
  return {
240
271
  ...node,
241
272
  children: [{ tagName: "#shadow-root", attrs: {}, children: node.children }]
242
273
  };
243
274
  }
244
275
  function walkInstance(instance, depth) {
245
- if (depth > 50) return null;
276
+ if (depth > 50)
277
+ return null;
246
278
  const tagName = resolveTagName(instance);
247
279
  const children = extractChildrenFromVNode(instance.subTree, depth);
248
- if (isTransparentComponent(instance, tagName)) return children.length > 0 ? children : null;
280
+ if (isTransparentComponent(instance, tagName))
281
+ return children.length > 0 ? children : null;
249
282
  const node = { tagName, attrs: extractProps(instance), children };
250
283
  const sid = getElementSid(instance);
251
- if (sid) node.sid = sid;
252
- return wrapInShadowRoot(unwrapCustomComponent(node));
284
+ if (sid)
285
+ node.sid = sid;
286
+ return wrapInShadowRoot(node);
253
287
  }
254
288
 
255
- // src/render-host/render-inspect.ts
256
- var WXML_MUTATION_DEBOUNCE_MS = 200;
257
- var g = globalThis;
258
- if (!g.__diminaRenderInspect) {
289
+ // ../inspect/dist/inspector.js
290
+ var DEFAULT_DEBOUNCE_MS = 200;
291
+ function createWxmlInspector(options = {}) {
292
+ const doc = options.document ?? globalThis.document;
293
+ const debounceMs = options.debounceMs ?? DEFAULT_DEBOUNCE_MS;
294
+ const onMutated = options.onMutated;
259
295
  const getVueApp = () => {
260
296
  try {
261
- const body = document.body;
297
+ const body = doc?.body;
262
298
  const app = body?.__vue_app__;
263
- if (!app) return null;
264
- if (app._instance) return app._instance;
299
+ if (!app)
300
+ return null;
301
+ if (app._instance)
302
+ return app._instance;
265
303
  const container = app._container;
266
304
  const vnode = container?._vnode;
267
305
  return vnode?.component ?? null;
@@ -271,21 +309,26 @@
271
309
  };
272
310
  const getWxml = () => {
273
311
  const instance = getVueApp();
274
- if (!instance) return null;
312
+ if (!instance)
313
+ return null;
275
314
  const tree = walkInstance(instance, 0);
276
- if (!tree) return null;
315
+ if (!tree)
316
+ return null;
277
317
  return Array.isArray(tree) ? { tagName: "#fragment", attrs: {}, children: tree } : tree;
278
318
  };
279
319
  const elementFor = (sid) => {
280
- if (!sid) return null;
281
- return findElementBySid(document, sid);
320
+ if (!sid)
321
+ return null;
322
+ return findElementBySid(doc, sid);
282
323
  };
283
324
  const highlightElement = (sid) => {
284
325
  const el = elementFor(sid);
285
- if (!el) return null;
326
+ if (!el)
327
+ return null;
286
328
  const rect = el.getBoundingClientRect();
287
329
  const style = el.ownerDocument.defaultView?.getComputedStyle(el);
288
- if (!style) return null;
330
+ if (!style)
331
+ return null;
289
332
  return {
290
333
  sid,
291
334
  rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
@@ -301,32 +344,35 @@
301
344
  }
302
345
  };
303
346
  };
304
- const unhighlightElement = () => {
305
- };
306
347
  let observer = null;
307
348
  let debounceTimer = null;
308
349
  const notifyMutated = () => {
309
350
  debounceTimer = null;
310
- g.DiminaRenderBridge?.invoke({ type: "wxmlChanged", target: "container", body: {} });
351
+ onMutated?.();
311
352
  };
312
- const setWxmlObserving = (on) => {
353
+ const setObserving = (on) => {
313
354
  if (on) {
314
- if (observer) return;
355
+ if (observer)
356
+ return;
315
357
  observer = new MutationObserver(() => {
316
- if (debounceTimer !== null) clearTimeout(debounceTimer);
317
- debounceTimer = setTimeout(notifyMutated, WXML_MUTATION_DEBOUNCE_MS);
358
+ if (debounceTimer !== null)
359
+ clearTimeout(debounceTimer);
360
+ debounceTimer = setTimeout(notifyMutated, debounceMs);
318
361
  });
319
362
  const begin = () => {
320
- if (!observer || !document.body) return;
321
- observer.observe(document.body, {
363
+ if (!observer || !doc.body)
364
+ return;
365
+ observer.observe(doc.body, {
322
366
  childList: true,
323
367
  subtree: true,
324
368
  attributes: true,
325
369
  characterData: true
326
370
  });
327
371
  };
328
- if (document.body) begin();
329
- else document.addEventListener("DOMContentLoaded", begin, { once: true });
372
+ if (doc.body)
373
+ begin();
374
+ else
375
+ doc.addEventListener("DOMContentLoaded", begin, { once: true });
330
376
  } else {
331
377
  if (debounceTimer !== null) {
332
378
  clearTimeout(debounceTimer);
@@ -336,6 +382,29 @@
336
382
  observer = null;
337
383
  }
338
384
  };
339
- g.__diminaRenderInspect = { getWxml, highlightElement, elementFor, unhighlightElement, setWxmlObserving };
385
+ return {
386
+ getWxml,
387
+ highlightElement,
388
+ elementFor,
389
+ setObserving,
390
+ dispose: () => setObserving(false)
391
+ };
392
+ }
393
+
394
+ // src/render-host/render-inspect.ts
395
+ var g = globalThis;
396
+ if (!g.__diminaRenderInspect) {
397
+ const inspector = createWxmlInspector({
398
+ onMutated: () => g.DiminaRenderBridge?.invoke({ type: "wxmlChanged", target: "container", body: {} })
399
+ });
400
+ const unhighlightElement = () => {
401
+ };
402
+ g.__diminaRenderInspect = {
403
+ getWxml: inspector.getWxml,
404
+ highlightElement: inspector.highlightElement,
405
+ elementFor: inspector.elementFor,
406
+ unhighlightElement,
407
+ setWxmlObserving: inspector.setObserving
408
+ };
340
409
  }
341
410
  })();
@@ -0,0 +1,2 @@
1
+ import{a as e,i as t,t as n}from"./jsx-runtime-DIw5wnYl.js";import{n as r,r as i}from"./utils-sEB5OZEQ.js";var a=e(t(),1),o=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,s=i,c=(e,t)=>n=>{if(t?.variants==null)return s(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let s=o(t)||o(a);return r[e][s]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return s(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...c}[t]):{...i,...c}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},l=Object.defineProperty,u=(e,t)=>l(e,`name`,{value:t,configurable:!0});function d(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}u(d,`setRef`);function f(...e){return t=>{let n=!1,r=e.map(e=>{let r=d(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():d(e[t],null)}}}}u(f,`composeRefs`);function p(...e){return a.useCallback(f(...e),e)}u(p,`useComposedRefs`);var m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0});function g(e){let t=a.forwardRef((t,n)=>{let{children:r,...i}=t,o=null,s=!1,c=[];T(r)&&typeof k==`function`&&(r=k(r._payload)),a.Children.forEach(r,e=>{if(C(e)){s=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;T(n)&&typeof k==`function`&&(n=k(n._payload)),o=b(t,n),c.push(o?.props?.children)}else c.push(e)}),o?o=a.cloneElement(o,void 0,c):!s&&a.Children.count(r)===1&&a.isValidElement(r)&&(o=r);let l=o?S(o):void 0,u=p(n,l);if(!o){if(r||r===0)throw Error(s?O(e):D(e));return r}let d=x(i,o.props??{});return o.type!==a.Fragment&&(d.ref=n?u:l),a.cloneElement(o,d)});return t.displayName=`${e}.Slot`,t}h(g,`createSlot`);var _=g(`Slot`),v=Symbol.for(`radix.slottable`);function y(e){let t=h(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=v,t}h(y,`createSlottable`);var b=h((e,t)=>{if(`child`in e.props){let t=e.props.child;return a.isValidElement(t)?a.cloneElement(t,void 0,e.props.children(t.props.children)):null}return a.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function x(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}h(x,`mergeProps`);function S(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}h(S,`getElementRef`);function C(e){return a.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===v}h(C,`isSlottable`);var w=Symbol.for(`react.lazy`);function T(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===w&&`_payload`in e&&E(e._payload)}h(T,`isLazyComponent`);function E(e){return typeof e==`object`&&!!e&&`then`in e}h(E,`isPromiseLike`);var D=h(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),O=h(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),k=a.use,A=n(),j=c(`inline-flex appearance-none items-center justify-center gap-1 whitespace-nowrap rounded-[var(--qd-radius-md)] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[var(--qd-primary)] disabled:pointer-events-none disabled:opacity-50 border-solid [border-width:var(--qd-border-width)] text-[color:var(--btn-fg)] bg-[var(--btn-bg)] border-[var(--btn-border)] [--qd-icon-size:1em]`,{variants:{variant:{default:`[--btn-fg:var(--qd-on-solid)] [--btn-bg:var(--qd-primary)] [--btn-border:transparent] hover:opacity-90`,soft:`[--btn-fg:var(--qd-primary)] [--btn-bg:var(--qd-primary-soft)] [--btn-border:transparent] hover:opacity-90`,secondary:`[--btn-fg:var(--qd-secondary-foreground)] [--btn-bg:var(--qd-secondary)] [--btn-border:transparent] hover:opacity-90`,outline:`[--btn-fg:var(--qd-foreground)] [--btn-bg:var(--qd-background)] [--btn-border:var(--qd-border)] hover:[background-color:var(--qd-muted)]`,ghost:`[--btn-fg:var(--qd-foreground)] [--btn-bg:transparent] [--btn-border:transparent] hover:[background-color:var(--qd-muted)]`,destructive:`[--btn-fg:var(--qd-on-solid)] [--btn-bg:var(--qd-destructive)] [--btn-border:transparent] hover:opacity-90`,link:`[--btn-fg:var(--qd-primary)] [--btn-bg:transparent] [--btn-border:transparent] underline-offset-4 hover:underline`,icon:`rounded [--btn-fg:var(--qd-muted-foreground)] [--btn-bg:transparent] [--btn-border:transparent] hover:[background-color:var(--qd-muted)] hover:[--btn-fg:var(--qd-foreground)]`,toolbar:`rounded [--btn-fg:var(--qd-muted-foreground)] [--btn-bg:transparent] [--btn-border:transparent] hover:[--btn-bg:var(--color-surface-3)] hover:[--btn-fg:var(--qd-foreground)] data-[active=true]:[--btn-bg:var(--color-surface-active)] data-[active=true]:[--btn-fg:var(--qd-foreground)]`,danger:`rounded-full [--btn-fg:var(--qd-muted-foreground)] [--btn-bg:transparent] [--btn-border:transparent] hover:[--btn-fg:var(--qd-destructive)] hover:[background-color:var(--qd-destructive-soft)]`,tab:`rounded text-text-muted hover:text-text hover:bg-surface-3`,"tab-active":`rounded text-text bg-surface-active`},size:{default:`h-[var(--qd-btn-h)] px-4 py-2 text-sm`,sm:`h-[calc(var(--qd-btn-h)-4px)] px-3 text-xs`,lg:`h-[calc(var(--qd-btn-h)+4px)] px-6 text-base`,icon:`size-[var(--qd-btn-h)] text-base`,xs:`h-5 px-2 text-[11px]`,"icon-sm":`h-6 w-6 p-0 text-[14px]`}},defaultVariants:{variant:`default`,size:`default`}}),M=a.forwardRef(function({className:e,variant:t,size:n,asChild:i=!1,type:a,...o},s){let c=i?_:`button`,l=i?a===void 0?o:{type:a,...o}:{type:a??`button`,...o};return(0,A.jsx)(c,{ref:s,"data-slot":`button`,className:r(j({variant:t,size:n}),e),...l})});export{M as t};
2
+ //# sourceMappingURL=button-CB2MWjHY.js.map
@@ -0,0 +1,2 @@
1
+ var e=9222,t=1001;export{t as n,e as t};
2
+ //# sourceMappingURL=constants-CkoGPQTS.js.map
@@ -0,0 +1,2 @@
1
+ var e=[100,85,75,50],t=`auto`,n=1500;export{n,e as r,t};
2
+ //# sourceMappingURL=constants-zQZ2-y21.js.map
@@ -0,0 +1,2 @@
1
+ import{a as e,i as t}from"./jsx-runtime-DIw5wnYl.js";var n=e(t()),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(0,n.createContext)({}),u=()=>(0,n.useContext)(l),d=(0,n.forwardRef)(({color:e,size:t,strokeWidth:i,absoluteStrokeWidth:a,className:o=``,children:l,iconNode:d,...f},p)=>{let{size:m=24,strokeWidth:h=2,absoluteStrokeWidth:g=!1,color:_=`currentColor`,className:v=``}=u()??{},y=a??g?Number(i??h)*24/Number(t??m):i??h;return(0,n.createElement)(`svg`,{ref:p,...s,width:t??m??s.width,height:t??m??s.height,stroke:e??_,strokeWidth:y,className:r(`lucide`,v,o),...!l&&!c(f)&&{"aria-hidden":`true`},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])}),f=(e,t)=>{let a=(0,n.forwardRef)(({className:a,...s},c)=>(0,n.createElement)(d,{ref:c,iconNode:t,className:r(`lucide-${i(o(e))}`,`lucide-${e}`,a),...s}));return a.displayName=o(e),a};export{f as t};
2
+ //# sourceMappingURL=createLucideIcon-cZ9FlZZw.js.map
@@ -0,0 +1,2 @@
1
+ import{a as e,i as t,n,t as r}from"./jsx-runtime-DIw5wnYl.js";import{f as i,k as a,l as o,r as s}from"./view-api-B-2zPBR5.js";import{n as c}from"./utils-sEB5OZEQ.js";import{t as l}from"./button-CB2MWjHY.js";import{t as u}from"./createLucideIcon-cZ9FlZZw.js";import{t as d}from"./search-BMvuYF48.js";import{c as f,d as p,l as m,n as ee,o as h,s as g,t as _,u as v}from"./dialog-pHzEA8Vx.js";import{d as y,s as b}from"./dist-DIFlRMKe.js";import{n as x,r as S,t as C}from"./presets-DMZOb9ay.js";import{t as w}from"./dist-B5HADirS.js";var T=u(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),E=e(t(),1),D=e(n(),1),O=1,k=.9,A=.8,j=.17,M=.1,N=.999,P=.9999,F=.99,I=/[\\\/_+.#"@\[\(\{&]/,L=/[\\\/_+.#"@\[\(\{&]/g,R=/[\s-]/,z=/[\s-]/g;function B(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?O:F;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=B(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=O:I.test(e.charAt(l-1))?(d*=A,p=e.slice(i,l-1).match(L),p&&i>0&&(d*=N**+p.length)):R.test(e.charAt(l-1))?(d*=k,m=e.slice(i,l-1).match(z),m&&i>0&&(d*=N**+m.length)):(d*=j,i>0&&(d*=N**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=P)),(d<M&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=B(e,t,n,r,l+1,a+2,o),f*M>d&&(d=f*M)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function te(e){return e.toLowerCase().replace(z,` `)}function ne(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,B(e,t,te(e),te(t),0,0,{})}var V=`[cmdk-group=""]`,H=`[cmdk-group-items=""]`,re=`[cmdk-group-heading=""]`,ie=`[cmdk-item=""]`,ae=`${ie}:not([aria-disabled="true"])`,U=`cmdk-item-select`,W=`data-value`,oe=(e,t,n)=>ne(e,t,n),se=E.createContext(void 0),G=()=>E.useContext(se),ce=E.createContext(void 0),K=()=>E.useContext(ce),le=E.createContext(void 0),ue=E.forwardRef((e,t)=>{let n=Y(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Y(()=>new Set),i=Y(()=>new Map),a=Y(()=>new Map),o=Y(()=>new Set),s=xe(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:ee=!1,vimBindings:h=!0,...g}=e,_=b(),v=b(),y=b(),x=E.useRef(null),S=Ce();J(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),J(()=>{S(6,j)},[]);let C=E.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),S(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(y);e?e.focus():(i=document.getElementById(_))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=M()?.id,C.emit()}),r||S(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=E.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),S(2,()=>{O(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{A(),O(),n.current.value||k(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();S(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:_,inputId:y,labelId:v,listInnerRef:x}),[]);function D(e,t){let r=s.current?.filter??oe;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(H);t?t.appendChild(e.parentElement===t?e:e.closest(`${H} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${H} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${V}[${W}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(W);C.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(V)?.querySelector(re))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return x.current?.querySelector(`${ie}[aria-selected="true"]`)}function N(){return Array.from(x.current?.querySelectorAll(ae)||[])}function P(e){let t=N()[e];t&&C.setState(`value`,t.getAttribute(W))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(W))}function I(e){let t=M()?.closest(V),n;for(;t&&!n;)t=e>0?ye(t,V):be(t,V),n=t?.querySelector(ae);n?C.setState(`value`,n.getAttribute(W)):F(e)}let L=()=>P(N().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return E.createElement(w.div,{ref:t,tabIndex:-1,...g,"cmdk-root":``,onKeyDown:e=>{var t;(t=g.onKeyDown)==null||t.call(g,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:h&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:h&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(U);t.dispatchEvent(e)}}}}},E.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Te},c),Z(e,e=>E.createElement(ce.Provider,{value:C},E.createElement(se.Provider,{value:T},e))))}),de=E.forwardRef((e,t)=>{let n=b(),r=E.useRef(null),i=E.useContext(le),a=G(),o=xe(e),s=o.current?.forceMount??i?.forceMount;J(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Se(n,r,[e.value,e.children,r],e.keywords),l=K(),u=X(e=>e.value&&e.value===c.current),d=X(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);E.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(U,f),()=>t.removeEventListener(U,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:ee,onSelect:h,forceMount:g,keywords:_,...v}=e;return E.createElement(w.div,{ref:y(r,t),...v,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),fe=E.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=b(),s=E.useRef(null),c=E.useRef(null),l=b(),u=G(),d=X(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);J(()=>u.group(o),[]),Se(o,s,[e.value,e.heading,c]);let f=E.useMemo(()=>({id:o,forceMount:i}),[i]);return E.createElement(w.div,{ref:y(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&E.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Z(e,e=>E.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},E.createElement(le.Provider,{value:f},e))))}),pe=E.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=E.useRef(null),a=X(e=>!e.search);return!n&&!a?null:E.createElement(w.div,{ref:y(i,t),...r,"cmdk-separator":``,role:`separator`})}),me=E.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=K(),o=X(e=>e.search),s=X(e=>e.selectedItemId),c=G();return E.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),E.createElement(w.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),he=E.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=E.useRef(null),o=E.useRef(null),s=X(e=>e.selectedItemId),c=G();return E.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),E.createElement(w.div,{ref:y(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Z(e,e=>E.createElement(`div`,{ref:y(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ge=E.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return E.createElement(p,{open:n,onOpenChange:r},E.createElement(v,{container:o},E.createElement(m,{"cmdk-overlay":``,className:i}),E.createElement(f,{"aria-label":e.label,"cmdk-dialog":``,className:a},E.createElement(ue,{ref:t,...s}))))}),_e=E.forwardRef((e,t)=>X(e=>e.filtered.count===0)?E.createElement(w.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ve=E.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return E.createElement(w.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Z(e,e=>E.createElement(`div`,{"aria-hidden":!0},e)))}),q=Object.assign(ue,{List:he,Item:de,Input:me,Group:fe,Separator:pe,Dialog:ge,Empty:_e,Loading:ve});function ye(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function be(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function xe(e){let t=E.useRef(e);return J(()=>{t.current=e}),t}var J=typeof window>`u`?E.useEffect:E.useLayoutEffect;function Y(e){let t=E.useRef();return t.current===void 0&&(t.current=e()),t}function X(e){let t=K(),n=()=>e(t.snapshot());return E.useSyncExternalStore(t.subscribe,n,n)}function Se(e,t,n,r=[]){let i=E.useRef(),a=G();return J(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(W,s),i.current=s}),i}var Ce=()=>{let[e,t]=E.useState(),n=Y(()=>new Map);return J(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function we(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Z({asChild:e,children:t},n){return e&&E.isValidElement(t)?E.cloneElement(we(t),{ref:t.ref},n(t.props.children)):n(t)}var Te={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},Q=r(),Ee=E.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(q,{ref:n,className:c(`flex h-full w-full flex-col overflow-hidden rounded-[var(--qd-radius-md)] bg-[var(--qd-background)] text-text`,e),...t}));Ee.displayName=q.displayName;var De=({children:e,title:t,trigger:n,commandProps:r,...i})=>(0,Q.jsxs)(_,{...i,children:[n?(0,Q.jsx)(g,{asChild:!0,children:n}):null,(0,Q.jsxs)(ee,{className:`overflow-hidden p-0 shadow-[var(--qd-shadow-lg)]`,children:[(0,Q.jsx)(h,{className:`sr-only`,children:t}),(0,Q.jsx)(Ee,{label:t,...r,className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-text-secondary [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:e})]})]}),$=E.forwardRef(({className:e,...t},n)=>(0,Q.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,Q.jsx)(d,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),(0,Q.jsx)(q.Input,{ref:n,className:c(`flex h-11 w-full rounded-[var(--qd-radius-md)] bg-transparent py-3 text-sm outline-none placeholder:text-text-secondary disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));$.displayName=q.Input.displayName;var Oe=E.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(q.List,{ref:n,className:c(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));Oe.displayName=q.List.displayName;var ke=E.forwardRef((e,t)=>(0,Q.jsx)(q.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));ke.displayName=q.Empty.displayName;var Ae=E.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(q.Group,{ref:n,className:c(`overflow-hidden p-1 text-text [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-text-secondary`,e),...t}));Ae.displayName=q.Group.displayName;var je=E.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(q.Separator,{ref:n,className:c(`-mx-1 h-px bg-border`,e),...t}));je.displayName=q.Separator.displayName;var Me=E.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(q.Item,{ref:n,className:c(`relative flex cursor-default gap-2 select-none items-center rounded-[var(--qd-radius-sm)] px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-[var(--qd-muted)] data-[selected=true]:text-text data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...t}));Me.displayName=q.Item.displayName;var Ne=({className:e,...t})=>(0,Q.jsx)(`span`,{className:c(`ml-auto text-xs tracking-widest text-text-muted`,e),...t});Ne.displayName=`CommandShortcut`;var Pe=[{os:`ios`,label:`iOS`},{os:`android`,label:`Android`},{os:`harmony`,label:`HarmonyOS`}],Fe=[{os:null,label:`全部`},...Pe],Ie=[{formFactor:`phone`,label:`手机`},{formFactor:`tablet`,label:`平板`}];function Le(e){let{width:t,height:n}=e.screen;return[e.name,e.system??``,`${t}x${n}`,`${t}×${n}`].join(` `)}function Re({device:e,devices:t,onSelect:n,onClose:r}){let[i,a]=(0,E.useState)(null),[o,s]=(0,E.useState)(null),l=(0,E.useRef)(null);(0,E.useEffect)(()=>{let e=l.current;e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`center`})},[]);let u=(0,E.useMemo)(()=>t.filter(e=>(!i||e.os===i)&&(!o||(e.formFactor??`phone`)===o)),[t,i,o]),d=(0,E.useMemo)(()=>Pe.map(e=>({...e,devices:u.filter(t=>t.os===e.os)})).filter(e=>e.devices.length>0),[u]);return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(De,{open:!0,onOpenChange:e=>{e||r()},title:`选择机型`,commandProps:{defaultValue:Le(e)},children:[(0,Q.jsx)($,{placeholder:`搜索机型:名称 / 系统 / 尺寸`,autoFocus:!0}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border-subtle px-3 py-2`,children:[Fe.map(e=>(0,Q.jsx)(ze,{label:e.label,active:i===e.os,onClick:()=>a(e.os)},e.label)),(0,Q.jsx)(`span`,{className:`mx-1 h-4 w-px bg-border-subtle`}),Ie.map(e=>(0,Q.jsx)(ze,{label:e.label,active:o===e.formFactor,onClick:()=>s(t=>t===e.formFactor?null:e.formFactor)},e.label))]}),(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(ke,{children:`没有匹配的机型`}),d.map(t=>(0,Q.jsx)(Ae,{heading:t.label,children:t.devices.map(t=>{let r=t.name===e.name;return(0,Q.jsxs)(Me,{ref:r?l:void 0,value:Le(t),"aria-label":t.name,"data-current":r||void 0,onSelect:()=>n(t.name),className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(T,{className:c(`size-3.5 shrink-0`,r?`opacity-100`:`opacity-0`)}),(0,Q.jsx)(`span`,{className:`truncate`,children:t.name}),t.formFactor===`tablet`&&(0,Q.jsx)(`span`,{className:`shrink-0 rounded-[var(--qd-radius-sm)] bg-[var(--qd-muted)] px-1.5 py-0.5 text-[10px] text-text-secondary`,children:`平板`})]}),(0,Q.jsxs)(`span`,{className:`shrink-0 text-xs text-text-secondary`,children:[t.screen.width,`×`,t.screen.height,` @`,t.pixelRatio,`x`,t.system?` · ${t.system}`:``]})]},t.name)})},t.os))]})]})})}function ze({label:e,active:t,onClick:n}){return(0,Q.jsx)(l,{variant:`toolbar`,size:`xs`,"aria-pressed":t,"data-active":t?`true`:`false`,onClick:n,children:e})}function Be(){let[e,t]=(0,E.useState)(null);if((0,E.useEffect)(()=>{let e=i(e=>t(e.deviceName));return o(),e},[]),e===null)return null;function n(e){t(null),a({deviceName:e})}function r(){t(null),s()}return(0,Q.jsx)(Re,{device:S(e)??C,devices:x,onSelect:n,onClose:r})}D.createRoot(document.getElementById(`root`)).render((0,Q.jsx)(Be,{}));
2
+ //# sourceMappingURL=devicePicker-H2eIO4e1.js.map