@dimina-kit/devtools 0.4.0 → 0.5.0
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.
- package/README.md +51 -660
- package/dist/main/api.d.ts +2 -1
- package/dist/main/app/app.d.ts +41 -12
- package/dist/main/app/app.js +299 -514
- package/dist/main/app/bootstrap.d.ts +8 -5
- package/dist/main/app/bootstrap.js +15 -15
- package/dist/main/app/editor-view.d.ts +21 -0
- package/dist/main/app/editor-view.js +71 -0
- package/dist/main/app/global-mirrors.d.ts +23 -0
- package/dist/main/app/global-mirrors.js +37 -0
- package/dist/main/app/host-sidebar-default.d.ts +19 -0
- package/dist/main/app/host-sidebar-default.js +44 -0
- package/dist/main/app/lifecycle.d.ts +12 -1
- package/dist/main/app/lifecycle.js +27 -1
- package/dist/main/app/menu-setup.d.ts +13 -0
- package/dist/main/app/menu-setup.js +49 -0
- package/dist/main/app/native-overview.d.ts +1 -1
- package/dist/main/app/open-project-ipc.d.ts +13 -0
- package/dist/main/app/open-project-ipc.js +21 -0
- package/dist/main/app/project-list-surface.d.ts +31 -0
- package/dist/main/app/project-list-surface.js +20 -0
- package/dist/main/app/project-window.d.ts +36 -0
- package/dist/main/app/project-window.js +93 -0
- package/dist/main/app/servers.d.ts +17 -0
- package/dist/main/app/servers.js +60 -0
- package/dist/main/app/ui-extension-targets.d.ts +42 -0
- package/dist/main/app/ui-extension-targets.js +101 -0
- package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
- package/dist/main/app/window-close-reveal.harness.js +65 -0
- package/dist/main/app/window-events.d.ts +15 -0
- package/dist/main/app/window-events.js +45 -0
- package/dist/main/app/window-runtime-services.d.ts +41 -0
- package/dist/main/app/window-runtime-services.js +197 -0
- package/dist/main/app/workbench-modules.d.ts +24 -0
- package/dist/main/app/workbench-modules.js +51 -0
- package/dist/main/app/workbench-window.d.ts +85 -0
- package/dist/main/app/workbench-window.js +310 -0
- package/dist/main/index.bundle.js +11712 -9986
- package/dist/main/index.js +49 -1
- package/dist/main/ipc/app-lifecycle.d.ts +1 -31
- package/dist/main/ipc/app-lifecycle.js +1 -53
- package/dist/main/ipc/app.d.ts +4 -1
- package/dist/main/ipc/app.js +4 -3
- package/dist/main/ipc/bridge-router.d.ts +19 -116
- package/dist/main/ipc/bridge-router.js +28 -2128
- package/dist/main/ipc/device-picker.d.ts +16 -0
- package/dist/main/ipc/device-picker.js +27 -0
- package/dist/main/ipc/index.d.ts +5 -0
- package/dist/main/ipc/index.js +5 -0
- package/dist/main/ipc/internal-devtools.d.ts +16 -0
- package/dist/main/ipc/internal-devtools.js +10 -0
- package/dist/main/ipc/page-scroll.d.ts +1 -13
- package/dist/main/ipc/page-scroll.js +1 -16
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +26 -19
- package/dist/main/ipc/project-create.d.ts +16 -0
- package/dist/main/ipc/project-create.js +27 -0
- package/dist/main/ipc/project-fs.d.ts +38 -3
- package/dist/main/ipc/project-fs.js +53 -22
- package/dist/main/ipc/projects.d.ts +3 -3
- package/dist/main/ipc/projects.js +47 -11
- package/dist/main/ipc/session-listener-bag.d.ts +1 -40
- package/dist/main/ipc/session-listener-bag.js +1 -39
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +26 -26
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +17 -19
- package/dist/main/ipc/simulator-module.d.ts +9 -3
- package/dist/main/ipc/simulator-module.js +13 -10
- package/dist/main/ipc/simulator.d.ts +4 -1
- package/dist/main/ipc/simulator.js +12 -18
- package/dist/main/ipc/tooltip.d.ts +14 -0
- package/dist/main/ipc/tooltip.js +29 -0
- package/dist/main/ipc/views.d.ts +19 -2
- package/dist/main/ipc/views.js +76 -8
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
- package/dist/main/runtime/devtools-backend.js +60 -4
- package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
- package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
- package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
- package/dist/main/services/app-services.d.ts +62 -0
- package/dist/main/services/app-services.js +64 -0
- package/dist/main/services/automation/connection-target.d.ts +36 -0
- package/dist/main/services/automation/connection-target.js +29 -0
- package/dist/main/services/automation/console-bridge.d.ts +28 -0
- package/dist/main/services/automation/console-bridge.js +91 -0
- package/dist/main/services/automation/handlers/app.js +4 -4
- package/dist/main/services/automation/handlers/element.js +55 -21
- package/dist/main/services/automation/index.d.ts +12 -1
- package/dist/main/services/automation/index.js +54 -133
- package/dist/main/services/cdp-session/index.d.ts +87 -0
- package/dist/main/services/cdp-session/index.js +173 -0
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +1 -46
- package/dist/main/services/console-forward/index.js +1 -185
- package/dist/main/services/console-forward/internal-log.d.ts +2 -0
- package/dist/main/services/console-forward/internal-log.js +2 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/default-adapter.js +1 -1
- package/dist/main/services/diagnostics/index.d.ts +1 -48
- package/dist/main/services/diagnostics/index.js +1 -60
- package/dist/main/services/dimina-resource-server.d.ts +1 -6
- package/dist/main/services/dimina-resource-server.js +1 -98
- package/dist/main/services/elements-forward/index.d.ts +132 -15
- package/dist/main/services/elements-forward/index.js +155 -304
- package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
- package/dist/main/services/fs-bridge-protocol.js +34 -0
- package/dist/main/services/fs-watch-sse.d.ts +40 -0
- package/dist/main/services/fs-watch-sse.js +113 -0
- package/dist/main/services/http-json.d.ts +9 -0
- package/dist/main/services/http-json.js +6 -0
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/mcp/connection-owner.d.ts +38 -0
- package/dist/main/services/mcp/connection-owner.js +79 -0
- package/dist/main/services/mcp/index.d.ts +3 -1
- package/dist/main/services/mcp/index.js +4 -3
- package/dist/main/services/mcp/opened-project.d.ts +88 -0
- package/dist/main/services/mcp/opened-project.js +60 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +29 -4
- package/dist/main/services/mcp/target-manager.d.ts +71 -23
- package/dist/main/services/mcp/target-manager.js +269 -138
- package/dist/main/services/mcp/target-selection.d.ts +47 -0
- package/dist/main/services/mcp/target-selection.js +71 -0
- package/dist/main/services/mcp/tools/context-tools.js +20 -5
- package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
- package/dist/main/services/mcp/tools/project-tools.js +133 -0
- package/dist/main/services/module.d.ts +13 -5
- package/dist/main/services/network-forward/body-cache.d.ts +72 -0
- package/dist/main/services/network-forward/body-cache.js +179 -0
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +135 -15
- package/dist/main/services/network-forward/index.js +854 -224
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/network-forward/websocket.d.ts +36 -0
- package/dist/main/services/network-forward/websocket.js +120 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
- package/dist/main/services/notifications/renderer-notifier.js +45 -8
- package/dist/main/services/projects/create-project-service.js +19 -5
- package/dist/main/services/projects/local-provider.js +8 -4
- package/dist/main/services/projects/project-repository.d.ts +59 -7
- package/dist/main/services/projects/project-repository.js +285 -51
- package/dist/main/services/projects/types.d.ts +44 -34
- package/dist/main/services/render-inspect/index.d.ts +12 -2
- package/dist/main/services/render-inspect/index.js +21 -102
- package/dist/main/services/safe-area/index.d.ts +21 -6
- package/dist/main/services/safe-area/index.js +92 -46
- package/dist/main/services/service-host-pool/pool.d.ts +1 -196
- package/dist/main/services/service-host-pool/pool.js +1 -363
- package/dist/main/services/settings/index.d.ts +7 -1
- package/dist/main/services/settings/index.js +22 -2
- package/dist/main/services/simulator/custom-apis.d.ts +1 -42
- package/dist/main/services/simulator/custom-apis.js +1 -46
- package/dist/main/services/simulator/referer.d.ts +1 -9
- package/dist/main/services/simulator/referer.js +1 -19
- package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
- package/dist/main/services/simulator/ui-extensions.js +176 -0
- package/dist/main/services/simulator-appdata/index.d.ts +6 -0
- package/dist/main/services/simulator-appdata/index.js +21 -2
- package/dist/main/services/simulator-current-page/index.d.ts +5 -3
- package/dist/main/services/simulator-current-page/index.js +8 -1
- package/dist/main/services/simulator-storage/index.d.ts +34 -5
- package/dist/main/services/simulator-storage/index.js +73 -71
- package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
- package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
- package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
- package/dist/main/services/simulator-storage/window-scope.js +20 -0
- package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
- package/dist/main/services/simulator-temp-files/disk.js +1 -237
- package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
- package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
- package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
- package/dist/main/services/simulator-temp-files/index.js +1 -181
- package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
- package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
- package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
- package/dist/main/services/simulator-temp-files/resolver.js +1 -21
- package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
- package/dist/main/services/simulator-temp-files/store.js +1 -23
- package/dist/main/services/update/github-release-checker.js +22 -3
- package/dist/main/services/update/update-manager.d.ts +21 -4
- package/dist/main/services/update/update-manager.js +55 -11
- package/dist/main/services/views/clear-console-filter.d.ts +44 -0
- package/dist/main/services/views/clear-console-filter.js +86 -0
- package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
- package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
- package/dist/main/services/views/console-filter.d.ts +94 -0
- package/dist/main/services/views/console-filter.js +190 -0
- package/dist/main/services/views/devtools-tabs.d.ts +24 -4
- package/dist/main/services/views/devtools-tabs.js +40 -21
- package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-dialog-port-channel.js +15 -0
- package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
- package/dist/main/services/views/host-dialog-view.d.ts +95 -0
- package/dist/main/services/views/host-dialog-view.js +147 -0
- package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
- package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
- package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
- package/dist/main/services/views/host-sidebar-view.js +44 -0
- package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
- package/dist/main/services/views/host-slot-port-channel.js +289 -0
- package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
- package/dist/main/services/views/host-slot-session-runtime.js +50 -0
- package/dist/main/services/views/host-slot-view.d.ts +109 -0
- package/dist/main/services/views/host-slot-view.js +147 -0
- package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
- package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
- package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
- package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
- package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
- package/dist/main/services/views/host-toolbar-view.js +30 -237
- package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
- package/dist/main/services/views/managed-web-contents-view.js +143 -0
- package/dist/main/services/views/miniapp-partition.d.ts +1 -89
- package/dist/main/services/views/miniapp-partition.js +1 -158
- package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
- package/dist/main/services/views/native-simulator-view.d.ts +6 -0
- package/dist/main/services/views/native-simulator-view.js +47 -40
- package/dist/main/services/views/native-view-tree.d.ts +25 -0
- package/dist/main/services/views/native-view-tree.js +69 -0
- package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
- package/dist/main/services/views/overlay-panels-view.js +257 -108
- package/dist/main/services/views/placement-reconciler.d.ts +18 -18
- package/dist/main/services/views/placement-reconciler.js +91 -29
- package/dist/main/services/views/placement-test-driver.d.ts +27 -0
- package/dist/main/services/views/placement-test-driver.js +29 -0
- package/dist/main/services/views/refresh-styles.d.ts +10 -0
- package/dist/main/services/views/refresh-styles.js +57 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
- package/dist/main/services/views/simulator-session-policy.js +1 -98
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
- package/dist/main/services/views/view-manager.d.ts +69 -88
- package/dist/main/services/views/view-manager.js +62 -7
- package/dist/main/services/views/workbench-view.d.ts +2 -0
- package/dist/main/services/views/workbench-view.js +104 -17
- package/dist/main/services/window-contexts/context-router.d.ts +36 -0
- package/dist/main/services/window-contexts/context-router.js +55 -0
- package/dist/main/services/workbench-coi-host.d.ts +52 -0
- package/dist/main/services/workbench-coi-host.js +227 -0
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +126 -126
- package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
- package/dist/main/services/workbench-coi-shutdown.js +69 -0
- package/dist/main/services/workbench-coi-static.d.ts +23 -0
- package/dist/main/services/workbench-coi-static.js +87 -0
- package/dist/main/services/workbench-context.d.ts +88 -8
- package/dist/main/services/workbench-context.js +54 -6
- package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
- package/dist/main/services/workspace/compile-log-buffer.js +41 -0
- package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
- package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
- package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
- package/dist/main/services/workspace/compile-mode-store.js +71 -0
- package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
- package/dist/main/services/workspace/open-project-guards.js +42 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
- package/dist/main/services/workspace/rebuild-status.js +36 -0
- package/dist/main/services/workspace/session-status-store.d.ts +47 -0
- package/dist/main/services/workspace/session-status-store.js +73 -0
- package/dist/main/services/workspace/status-tap.d.ts +20 -0
- package/dist/main/services/workspace/status-tap.js +32 -0
- package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
- package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
- package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
- package/dist/main/services/workspace/workspace-referer.js +26 -0
- package/dist/main/services/workspace/workspace-service.d.ts +7 -5
- package/dist/main/services/workspace/workspace-service.js +96 -135
- package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
- package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
- package/dist/main/utils/ipc-context-source.d.ts +40 -0
- package/dist/main/utils/ipc-context-source.js +23 -0
- package/dist/main/utils/ipc-registry.d.ts +46 -21
- package/dist/main/utils/ipc-registry.js +166 -76
- package/dist/main/utils/paths.d.ts +18 -0
- package/dist/main/utils/paths.js +18 -0
- package/dist/main/utils/sender-policy.d.ts +10 -1
- package/dist/main/utils/sender-policy.js +42 -4
- package/dist/main/utils/theme.d.ts +18 -8
- package/dist/main/utils/theme.js +19 -9
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/main/windows/main-window/create.d.ts +16 -0
- package/dist/main/windows/main-window/create.js +19 -11
- package/dist/main/windows/main-window/events.d.ts +1 -1
- package/dist/main/windows/main-window/events.js +26 -13
- package/dist/main/windows/main-window/index.d.ts +1 -1
- package/dist/main/windows/main-window/index.js +1 -1
- package/dist/main/windows/service-host-window/create.d.ts +1 -92
- package/dist/main/windows/service-host-window/create.js +1 -154
- package/dist/native-host/common/common.js +173 -53
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +8278 -3659
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/index.d.ts +2 -0
- package/dist/preload/index.js +1 -0
- package/dist/preload/instrumentation/app-data.d.ts +2 -2
- package/dist/preload/instrumentation/app-data.js +1 -1
- package/dist/preload/instrumentation/wxml.js +1 -1
- package/dist/preload/runtime/bridge.d.ts +3 -3
- package/dist/preload/runtime/bridge.js +2 -2
- package/dist/preload/runtime/clipboard.d.ts +6 -0
- package/dist/preload/runtime/clipboard.js +12 -0
- package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
- package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
- package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
- package/dist/preload/runtime/host-dialog-port.js +53 -0
- package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-dialog-runtime.js +36 -0
- package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
- package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
- package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
- package/dist/preload/runtime/host-sidebar-port.js +53 -0
- package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
- package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
- package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
- package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
- package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
- package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
- package/dist/preload/runtime/host-toolbar-port.js +11 -95
- package/dist/preload/runtime/native-host.d.ts +14 -0
- package/dist/preload/runtime/native-host.js +5 -8
- package/dist/preload/runtime/node-bindings.d.ts +18 -0
- package/dist/preload/runtime/node-bindings.js +44 -0
- package/dist/preload/runtime/temp-files.js +9 -2
- package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
- package/dist/preload/runtime/wait-for-slot-root.js +80 -0
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
- package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
- package/dist/preload/windows/host-dialog-runtime.js +13 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
- package/dist/preload/windows/host-sidebar-runtime.js +13 -0
- package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +4922 -1246
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/main.css +428 -0
- package/dist/preload/windows/main.css.map +7 -0
- package/dist/preload/windows/simulator.cjs +376 -322
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +376 -322
- package/dist/render-host/pageFrame.html +4 -4
- package/dist/render-host/preload.cjs +30 -0
- package/dist/render-host/render-inspect.js +184 -115
- package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
- package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
- package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
- package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
- package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
- package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
- package/dist/renderer/assets/dist-B5HADirS.js +2 -0
- package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
- package/dist/renderer/assets/index-CEL_XFge.js +2 -0
- package/dist/renderer/assets/input-CAObw95L.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
- package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
- package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
- package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
- package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
- package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
- package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
- package/dist/renderer/assets/search-BMvuYF48.js +2 -0
- package/dist/renderer/assets/select-nFP95TxM.js +2 -0
- package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
- package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
- package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
- package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
- package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
- package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
- package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
- package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
- package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
- package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
- package/dist/renderer/entries/device-picker/index.html +28 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
- package/dist/renderer/entries/main/index.html +16 -7
- package/dist/renderer/entries/popover/index.html +16 -6
- package/dist/renderer/entries/project-create-dialog/index.html +27 -0
- package/dist/renderer/entries/settings/index.html +10 -5
- package/dist/renderer/entries/tooltip/index.html +21 -0
- package/dist/renderer/entries/update-dialog/index.html +25 -0
- package/dist/renderer/entries/workbench/index.html +49 -0
- package/dist/renderer/entries/workbench-settings/index.html +12 -5
- package/dist/service-host/appdata-set-data.cjs +39 -0
- package/dist/service-host/host-env-update.cjs +23 -0
- package/dist/service-host/preload.cjs +54 -48
- package/dist/service-host/service-message-queue.cjs +71 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
- package/dist/service-host/sync-impls/menu-button.js +5 -3
- package/dist/service-host/sync-impls/system-info.js +31 -9
- package/dist/shared/bridge-channels.d.ts +1 -416
- package/dist/shared/bridge-channels.js +1 -89
- package/dist/shared/compile-mode-state.d.ts +73 -0
- package/dist/shared/compile-mode-state.js +100 -0
- package/dist/shared/compile-modes.d.ts +152 -0
- package/dist/shared/compile-modes.js +237 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/dmb-resource-url.d.ts +2 -0
- package/dist/shared/dmb-resource-url.js +2 -0
- package/dist/shared/ipc-channels-overlays.d.ts +162 -0
- package/dist/shared/ipc-channels-overlays.js +203 -0
- package/dist/shared/ipc-channels.d.ts +24 -154
- package/dist/shared/ipc-channels.js +48 -96
- package/dist/shared/ipc-schemas.d.ts +143 -54
- package/dist/shared/ipc-schemas.js +137 -45
- package/dist/shared/node-bindings.d.ts +2 -0
- package/dist/shared/node-bindings.js +2 -0
- package/dist/shared/project-window-types.d.ts +42 -0
- package/dist/shared/project-window-types.js +2 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/simulator-ui.d.ts +61 -0
- package/dist/shared/simulator-ui.js +12 -0
- package/dist/shared/types.d.ts +126 -41
- package/dist/shared/view-ids.d.ts +10 -0
- package/dist/shared/view-ids.js +23 -0
- package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
- package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +4 -3
- package/dist/simulator/temp-files.d.ts +35 -0
- package/dist/simulator/temp-files.js +121 -0
- package/dist/simulator/types.d.ts +50 -0
- package/dist/simulator/types.js +2 -0
- package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
- package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
- package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
- package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
- package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
- package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
- package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +23 -13
- package/dist/main/services/views/destroy-child-view.d.ts +0 -9
- package/dist/main/services/views/destroy-child-view.js +0 -23
- package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
- package/dist/preload/instrumentation/wxml-extract.js +0 -382
- package/dist/preload/shared/sid-registry.d.ts +0 -11
- package/dist/preload/shared/sid-registry.js +0 -38
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BMqyDx71.js +0 -49
- package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
- package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
- package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
- package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
- package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
- package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
- package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
- package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
- package/dist/shared/appdata-accumulator.d.ts +0 -95
- package/dist/shared/appdata-accumulator.js +0 -218
- package/dist/shared/request-core.d.ts +0 -84
- package/dist/shared/request-core.js +0 -168
- package/dist/shared/simulator-api-metadata.d.ts +0 -26
- package/dist/shared/simulator-api-metadata.js +0 -59
- package/dist/shared/vpath.d.ts +0 -42
- package/dist/shared/vpath.js +0 -105
- package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
- package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
- package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
- package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
- package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
- package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MiniappRuntime — the stable, host-facing contract surface
|
|
3
|
-
*
|
|
2
|
+
* MiniappRuntime — the stable, host-facing contract surface documented in
|
|
3
|
+
* host-migration.md's public-contract section.
|
|
4
4
|
*
|
|
5
5
|
* HAND-WRITTEN, not derived from `WorkbenchContext`. A `Pick`-style projection
|
|
6
6
|
* would drag every nested internal service type (ViewManager,
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* - `workspace.openProject` stays writable (no `readonly`) for backward
|
|
19
19
|
* compat: hosts MAY still gate permissions by reassigning it. The preferred
|
|
20
20
|
* path is now the declarative `WorkbenchAppConfig.onBeforeOpenProject` hook
|
|
21
|
-
* (runs before any side effect, throw to veto) — see host-migration.md
|
|
21
|
+
* (runs before any side effect, throw to veto) — see host-migration.md's
|
|
22
|
+
* `onBeforeOpenProject` hook section.
|
|
22
23
|
*
|
|
23
24
|
* `asMiniappRuntime(ctx)` is an identity return — the contract is a typed
|
|
24
25
|
* VIEW onto the live context, not a snapshot/projection. That is what makes
|
|
@@ -72,6 +73,25 @@ export interface DiminaHostToolbarPageBridge {
|
|
|
72
73
|
send: (channel: string, payload: unknown) => void;
|
|
73
74
|
onMessage: (channel: string, handler: (payload: unknown) => void) => () => void;
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The page-side bridge injected into the host-sidebar WCV as
|
|
78
|
+
* `window.diminaHostSidebar` (see src/preload/runtime/host-sidebar-port.ts).
|
|
79
|
+
* Shape identical to `DiminaHostToolbarPageBridge` — the port-channel
|
|
80
|
+
* envelope and queueing/guard behaviour don't vary by slot.
|
|
81
|
+
*/
|
|
82
|
+
export interface DiminaHostSidebarPageBridge {
|
|
83
|
+
send: (channel: string, payload: unknown) => void;
|
|
84
|
+
onMessage: (channel: string, handler: (payload: unknown) => void) => () => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The page-side bridge injected into the host-dialog WCV as
|
|
88
|
+
* `window.diminaHostDialog` (see src/preload/runtime/host-dialog-port.ts).
|
|
89
|
+
* Shape identical to `DiminaHostToolbarPageBridge`.
|
|
90
|
+
*/
|
|
91
|
+
export interface DiminaHostDialogPageBridge {
|
|
92
|
+
send: (channel: string, payload: unknown) => void;
|
|
93
|
+
onMessage: (channel: string, handler: (payload: unknown) => void) => () => void;
|
|
94
|
+
}
|
|
75
95
|
declare global {
|
|
76
96
|
interface Window {
|
|
77
97
|
/**
|
|
@@ -80,51 +100,68 @@ declare global {
|
|
|
80
100
|
* else, so page code must runtime-guard before use.
|
|
81
101
|
*/
|
|
82
102
|
diminaHostToolbar?: DiminaHostToolbarPageBridge;
|
|
103
|
+
/**
|
|
104
|
+
* Present ONLY inside the host-sidebar WebContentsView's main frame
|
|
105
|
+
* (guarded injection — see host-sidebar-runtime.ts); optional everywhere
|
|
106
|
+
* else, so page code must runtime-guard before use.
|
|
107
|
+
*/
|
|
108
|
+
diminaHostSidebar?: DiminaHostSidebarPageBridge;
|
|
109
|
+
/**
|
|
110
|
+
* Present ONLY inside the host-dialog WebContentsView's main frame
|
|
111
|
+
* (guarded injection — see host-dialog-runtime.ts); optional everywhere
|
|
112
|
+
* else, so page code must runtime-guard before use.
|
|
113
|
+
*/
|
|
114
|
+
diminaHostDialog?: DiminaHostDialogPageBridge;
|
|
83
115
|
}
|
|
84
116
|
}
|
|
85
117
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* hatch (that would put
|
|
118
|
+
* Shared message-channel surface for every downstream-controllable host slot
|
|
119
|
+
* (toolbar/sidebar/dialog) — `send`/`onMessage`/`onReady` plus preload and
|
|
120
|
+
* content loading, with no `webContents` escape hatch (that would put
|
|
121
|
+
* Electron types on the contract). Each slot extends this with its own
|
|
122
|
+
* extent/visibility members.
|
|
89
123
|
*/
|
|
90
|
-
export interface
|
|
124
|
+
export interface MiniappHostSlotChannel {
|
|
91
125
|
/**
|
|
92
|
-
* The host's own `webPreferences.preload` for
|
|
93
|
-
* additive — never replaces the framework's session-resident
|
|
126
|
+
* The host's own `webPreferences.preload` for this slot's view (purely
|
|
127
|
+
* additive — never replaces the framework's session-resident size
|
|
94
128
|
* advertiser). Must be set before the view is (re)created; `null` (default)
|
|
95
129
|
* means "no host preload".
|
|
96
130
|
*/
|
|
97
131
|
setPreloadPath: (path: string | null) => void;
|
|
98
|
-
/** Load a local file into the
|
|
132
|
+
/** Load a local file into the slot's view (lazy-creates the view). */
|
|
99
133
|
loadFile: (path: string) => Promise<void>;
|
|
100
|
-
/** Load a URL into the
|
|
134
|
+
/** Load a URL into the slot's view (lazy-creates the view). */
|
|
101
135
|
loadURL: (url: string) => Promise<void>;
|
|
102
136
|
/**
|
|
103
|
-
* Post `{ channel, payload }` to the
|
|
137
|
+
* Post `{ channel, payload }` to the slot's page. Gated and non-queueing:
|
|
104
138
|
* returns false (delivering nothing, creating no view) while there is no
|
|
105
|
-
* live
|
|
106
|
-
*
|
|
139
|
+
* live webContents or the current load's MessagePort handshake hasn't
|
|
140
|
+
* completed; true once the envelope went out.
|
|
107
141
|
*/
|
|
108
142
|
send: (channel: string, payload: unknown) => boolean;
|
|
109
143
|
/**
|
|
110
|
-
* Register a host-side handler for messages the
|
|
111
|
-
* `window.
|
|
112
|
-
*
|
|
144
|
+
* Register a host-side handler for messages the slot's page sends via
|
|
145
|
+
* `window.dimina*.send(channel, payload)`. May be called before the view
|
|
146
|
+
* exists; survives page reloads. `dispose()` detaches (idempotent).
|
|
113
147
|
*/
|
|
114
148
|
onMessage: (channel: string, handler: (payload: unknown) => void) => {
|
|
115
149
|
dispose: () => void;
|
|
116
150
|
};
|
|
117
151
|
/**
|
|
118
152
|
* Observe handshake readiness. Fires the handler once per load generation,
|
|
119
|
-
* exactly when the
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
153
|
+
* exactly when the slot page's MessagePort handshake completes (i.e. when
|
|
154
|
+
* `send` flips to true). Registering while the channel is already ready
|
|
155
|
+
* fires once asynchronously on a microtask (missed-signal guard); a
|
|
156
|
+
* reload / re-handshake fires registered handlers again. `dispose()`
|
|
123
157
|
* detaches (idempotent).
|
|
124
158
|
*/
|
|
125
159
|
onReady: (handler: () => void) => {
|
|
126
160
|
dispose: () => void;
|
|
127
161
|
};
|
|
162
|
+
}
|
|
163
|
+
/** Host-facing control surface for the toolbar WebContentsView. */
|
|
164
|
+
export interface MiniappHostToolbar extends MiniappHostSlotChannel {
|
|
128
165
|
/**
|
|
129
166
|
* Pin (`{ fixed }`) or unpin (`'auto'`) the toolbar strip height. `'auto'`
|
|
130
167
|
* (default) lets the in-page height advertiser drive the placeholder.
|
|
@@ -135,6 +172,36 @@ export interface MiniappHostToolbar {
|
|
|
135
172
|
fixed: number;
|
|
136
173
|
}) => void;
|
|
137
174
|
}
|
|
175
|
+
/** Host-facing control surface for the sidebar WebContentsView. */
|
|
176
|
+
export interface MiniappHostSidebar extends MiniappHostSlotChannel {
|
|
177
|
+
/**
|
|
178
|
+
* Pin (`{ fixed }`) or unpin (`'auto'`) the sidebar strip width. `'auto'`
|
|
179
|
+
* (default) lets the in-page width advertiser drive the placeholder.
|
|
180
|
+
* `{ fixed }` values must be finite and non-negative — anything else throws
|
|
181
|
+
* a `TypeError` synchronously and leaves the standing mode untouched.
|
|
182
|
+
*/
|
|
183
|
+
setWidthMode: (mode: 'auto' | {
|
|
184
|
+
fixed: number;
|
|
185
|
+
}) => void;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Host-facing control surface for the by-demand, dual-axis-autosized dialog
|
|
189
|
+
* WebContentsView. Unlike the persistent toolbar/sidebar strips, the dialog
|
|
190
|
+
* is shown/hidden explicitly — there is no extent-mode setter (both axes
|
|
191
|
+
* always self-size from the page's own measured content).
|
|
192
|
+
*/
|
|
193
|
+
export interface MiniappHostDialog extends MiniappHostSlotChannel {
|
|
194
|
+
/**
|
|
195
|
+
* Show the dialog, centered in the main window using its self-advertised
|
|
196
|
+
* size on both axes. Creates the view's placement if needed; does not
|
|
197
|
+
* (re)load content — the host must `loadURL`/`loadFile` first.
|
|
198
|
+
*/
|
|
199
|
+
show: () => void;
|
|
200
|
+
/** Hide the dialog (kept alive, content preserved) without destroying the view. */
|
|
201
|
+
hide: () => void;
|
|
202
|
+
/** Whether the dialog is currently shown. */
|
|
203
|
+
isVisible: () => boolean;
|
|
204
|
+
}
|
|
138
205
|
/**
|
|
139
206
|
* The audited workspace surface: project list membership, session lifecycle,
|
|
140
207
|
* and minimal session state. Thumbnails / per-project settings / providers
|
|
@@ -176,9 +243,11 @@ export interface MiniappWorkspace {
|
|
|
176
243
|
* plumbing is a deliberate semver decision, not an accident of projection.
|
|
177
244
|
*/
|
|
178
245
|
export interface MiniappRuntime {
|
|
179
|
-
/** View layer — only the host-owned
|
|
246
|
+
/** View layer — only the host-owned slot controls are public. */
|
|
180
247
|
views: {
|
|
181
248
|
readonly hostToolbar: MiniappHostToolbar;
|
|
249
|
+
readonly hostSidebar: MiniappHostSidebar;
|
|
250
|
+
readonly hostDialog: MiniappHostDialog;
|
|
182
251
|
};
|
|
183
252
|
/** Project + session workspace (see {@link MiniappWorkspace}). */
|
|
184
253
|
workspace: MiniappWorkspace;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BrowserWindow } from 'electron';
|
|
2
|
+
import { type Disposable } from '@dimina-kit/electron-deck/main';
|
|
3
|
+
import type { ProjectsProvider, ProjectTemplate } from './projects/types.js';
|
|
4
|
+
import { type SimulatorApiRegistry } from './simulator/custom-apis.js';
|
|
5
|
+
/**
|
|
6
|
+
* The services that belong to the whole application rather than to one window.
|
|
7
|
+
*
|
|
8
|
+
* They are all registered or configured ONCE by the host (through
|
|
9
|
+
* `WorkbenchAppConfig` and the `WorkbenchAppInstance` registration methods),
|
|
10
|
+
* so every window context reads the same instance. Anything whose owner is a
|
|
11
|
+
* single window — views, connections, the CDP broker, the workspace — stays on
|
|
12
|
+
* `WorkbenchContext` instead.
|
|
13
|
+
*/
|
|
14
|
+
export interface AppServices {
|
|
15
|
+
/** Backing store for the project list. One list, shown by every window. */
|
|
16
|
+
projectsProvider: ProjectsProvider;
|
|
17
|
+
/** Built-in templates merged with the host's, per `builtinTemplates`. */
|
|
18
|
+
projectTemplates: ProjectTemplate[];
|
|
19
|
+
/**
|
|
20
|
+
* Reference-counted `webContents.id` → live registration count for
|
|
21
|
+
* host-owned BrowserWindows registered as trusted senders. A host window is
|
|
22
|
+
* registered against the app, not against whichever window happened to be
|
|
23
|
+
* open at the time, so the map is shared and every context's sender policy
|
|
24
|
+
* consults the same entries.
|
|
25
|
+
*/
|
|
26
|
+
trustedWindowSenderIds: Map<number, number>;
|
|
27
|
+
/**
|
|
28
|
+
* Simulator custom APIs registered by the host. The host registers each
|
|
29
|
+
* handler once (in `onSetup`), so the registry is app-wide: a window opened
|
|
30
|
+
* later must answer the same `wx.*` calls as the one that was open during
|
|
31
|
+
* registration.
|
|
32
|
+
*/
|
|
33
|
+
simulatorApis: SimulatorApiRegistry;
|
|
34
|
+
}
|
|
35
|
+
export interface CreateAppServicesOptions {
|
|
36
|
+
projectsProvider?: ProjectsProvider;
|
|
37
|
+
projectTemplates?: ProjectTemplate[];
|
|
38
|
+
builtinTemplates?: 'all' | 'none' | readonly string[];
|
|
39
|
+
}
|
|
40
|
+
export declare function createAppServices(opts?: CreateAppServicesOptions): AppServices;
|
|
41
|
+
/**
|
|
42
|
+
* Adds `win.webContents` to the trusted-sender set and returns a Disposable
|
|
43
|
+
* that removes it again.
|
|
44
|
+
*
|
|
45
|
+
* Trust is reference-counted: registering the SAME window N times keeps it
|
|
46
|
+
* trusted until every one of the N returned Disposables has been disposed.
|
|
47
|
+
* Each register bumps the count, each dispose decrements it, and the window is
|
|
48
|
+
* un-trusted only when the count reaches zero.
|
|
49
|
+
*
|
|
50
|
+
* The window's `closed` event short-circuits the ref-count: it deletes the
|
|
51
|
+
* map entry outright (the window is dead, so it must be un-trusted
|
|
52
|
+
* immediately regardless of how many Disposables are still outstanding).
|
|
53
|
+
* After `closed`, disposing any leftover Disposable is a safe no-op — the
|
|
54
|
+
* map entry is already gone, so the decrement finds `undefined` and bails
|
|
55
|
+
* without driving the count negative or resurrecting trust.
|
|
56
|
+
*
|
|
57
|
+
* Each returned Disposable is itself idempotent (`removed` flag), and its
|
|
58
|
+
* `closed` listener removes itself once fired so a long-lived app doesn't
|
|
59
|
+
* accumulate dead listeners on closed windows.
|
|
60
|
+
*/
|
|
61
|
+
export declare function registerTrustedWindow(services: Pick<AppServices, 'trustedWindowSenderIds'>, win: BrowserWindow): Disposable;
|
|
62
|
+
//# sourceMappingURL=app-services.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { toDisposable } from '@dimina-kit/electron-deck/main';
|
|
2
|
+
import { createLocalProjectsProvider } from './projects/local-provider.js';
|
|
3
|
+
import { resolveTemplates } from './projects/templates.js';
|
|
4
|
+
import { BUILTIN_TEMPLATES } from './projects/builtin-templates.js';
|
|
5
|
+
import { createSimulatorApiRegistry, } from './simulator/custom-apis.js';
|
|
6
|
+
export function createAppServices(opts = {}) {
|
|
7
|
+
return {
|
|
8
|
+
projectsProvider: opts.projectsProvider ?? createLocalProjectsProvider(),
|
|
9
|
+
projectTemplates: resolveTemplates(BUILTIN_TEMPLATES, opts.projectTemplates ?? [], opts.builtinTemplates ?? 'all'),
|
|
10
|
+
trustedWindowSenderIds: new Map(),
|
|
11
|
+
simulatorApis: createSimulatorApiRegistry(),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds `win.webContents` to the trusted-sender set and returns a Disposable
|
|
16
|
+
* that removes it again.
|
|
17
|
+
*
|
|
18
|
+
* Trust is reference-counted: registering the SAME window N times keeps it
|
|
19
|
+
* trusted until every one of the N returned Disposables has been disposed.
|
|
20
|
+
* Each register bumps the count, each dispose decrements it, and the window is
|
|
21
|
+
* un-trusted only when the count reaches zero.
|
|
22
|
+
*
|
|
23
|
+
* The window's `closed` event short-circuits the ref-count: it deletes the
|
|
24
|
+
* map entry outright (the window is dead, so it must be un-trusted
|
|
25
|
+
* immediately regardless of how many Disposables are still outstanding).
|
|
26
|
+
* After `closed`, disposing any leftover Disposable is a safe no-op — the
|
|
27
|
+
* map entry is already gone, so the decrement finds `undefined` and bails
|
|
28
|
+
* without driving the count negative or resurrecting trust.
|
|
29
|
+
*
|
|
30
|
+
* Each returned Disposable is itself idempotent (`removed` flag), and its
|
|
31
|
+
* `closed` listener removes itself once fired so a long-lived app doesn't
|
|
32
|
+
* accumulate dead listeners on closed windows.
|
|
33
|
+
*/
|
|
34
|
+
export function registerTrustedWindow(services, win) {
|
|
35
|
+
const senderId = win.webContents.id;
|
|
36
|
+
const counts = services.trustedWindowSenderIds;
|
|
37
|
+
counts.set(senderId, (counts.get(senderId) ?? 0) + 1);
|
|
38
|
+
let removed = false;
|
|
39
|
+
const onClosed = () => {
|
|
40
|
+
// The window is gone: zero the ref-count for this sender id outright,
|
|
41
|
+
// regardless of any other outstanding registrations for the same window.
|
|
42
|
+
counts.delete(senderId);
|
|
43
|
+
win.removeListener('closed', onClosed);
|
|
44
|
+
};
|
|
45
|
+
function remove() {
|
|
46
|
+
if (removed)
|
|
47
|
+
return;
|
|
48
|
+
removed = true;
|
|
49
|
+
win.removeListener('closed', onClosed);
|
|
50
|
+
const count = counts.get(senderId);
|
|
51
|
+
// `undefined` → the entry was already cleared (e.g. by `closed` or by a
|
|
52
|
+
// prior sibling's decrement that hit zero). Nothing to do — never go
|
|
53
|
+
// negative, never resurrect trust.
|
|
54
|
+
if (count === undefined)
|
|
55
|
+
return;
|
|
56
|
+
if (count <= 1)
|
|
57
|
+
counts.delete(senderId);
|
|
58
|
+
else
|
|
59
|
+
counts.set(senderId, count - 1);
|
|
60
|
+
}
|
|
61
|
+
win.once('closed', onClosed);
|
|
62
|
+
return toDisposable(remove);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=app-services.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { WindowService } from '../window-service.js';
|
|
2
|
+
import type { WorkspaceService } from '../workspace/workspace-service.js';
|
|
3
|
+
/** The slice of a window context that decides where a connection's commands go. */
|
|
4
|
+
export interface TargetContext {
|
|
5
|
+
windows: Pick<WindowService, 'mainWindow'>;
|
|
6
|
+
workspace: Pick<WorkspaceService, 'hasActiveSession'>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The project window one automation connection acts on.
|
|
10
|
+
*
|
|
11
|
+
* The active context follows window focus, so resolving it afresh per message
|
|
12
|
+
* would let a click on another project's window redirect a script that is
|
|
13
|
+
* already driving one — the script does nothing wrong and its commands land
|
|
14
|
+
* somewhere else. A connection therefore PINS the first context it reaches
|
|
15
|
+
* that has a session and keeps it for the rest of its life. Which window a
|
|
16
|
+
* connection drives is decided by what it reached first, never by what the
|
|
17
|
+
* user is looking at.
|
|
18
|
+
*
|
|
19
|
+
* Nothing is pinned before a project window exists: a client may connect at
|
|
20
|
+
* boot and open a project afterwards, so until a context with a session shows
|
|
21
|
+
* up every use resolves the active one (the project list, which drives
|
|
22
|
+
* nothing). Pinning the list window would tie the connection to a window that
|
|
23
|
+
* can never run a command.
|
|
24
|
+
*/
|
|
25
|
+
export interface ConnectionTarget<T extends TargetContext> {
|
|
26
|
+
/**
|
|
27
|
+
* The context to run a command against. Throws once the pinned window is
|
|
28
|
+
* gone, so a connection whose project was closed fails loudly instead of
|
|
29
|
+
* sliding onto whichever project happens to be open now.
|
|
30
|
+
*/
|
|
31
|
+
resolve(): T;
|
|
32
|
+
/** The same target, but null instead of a throw once its window is gone. */
|
|
33
|
+
peek(): T | null;
|
|
34
|
+
}
|
|
35
|
+
export declare function createConnectionTarget<T extends TargetContext>(getCtx: () => T): ConnectionTarget<T>;
|
|
36
|
+
//# sourceMappingURL=connection-target.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function createConnectionTarget(getCtx) {
|
|
2
|
+
let pinned = null;
|
|
3
|
+
// The window, not the session, is what a connection is pinned to: closing
|
|
4
|
+
// the project inside a window (`Tool.close`) leaves that window able to open
|
|
5
|
+
// another, while destroying the window ends the connection's target for good.
|
|
6
|
+
const isGone = (ctx) => {
|
|
7
|
+
const win = ctx.windows.mainWindow;
|
|
8
|
+
return !win || win.isDestroyed();
|
|
9
|
+
};
|
|
10
|
+
const current = () => {
|
|
11
|
+
if (pinned)
|
|
12
|
+
return isGone(pinned) ? null : pinned;
|
|
13
|
+
const ctx = getCtx();
|
|
14
|
+
if (ctx.workspace.hasActiveSession())
|
|
15
|
+
pinned = ctx;
|
|
16
|
+
return ctx;
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
peek: current,
|
|
20
|
+
resolve() {
|
|
21
|
+
const ctx = current();
|
|
22
|
+
if (!ctx) {
|
|
23
|
+
throw new Error('The project window this connection was driving has been closed. Reconnect to drive another project.');
|
|
24
|
+
}
|
|
25
|
+
return ctx;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=connection-target.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WebContents } from 'electron';
|
|
2
|
+
import type { ConnectionRegistry } from '@dimina-kit/electron-deck/main';
|
|
3
|
+
import type { ConsoleForwarder } from '../console-forward/index.js';
|
|
4
|
+
import type { RpcEvent } from './shared.js';
|
|
5
|
+
/** The slice of a window context the two console taps read. */
|
|
6
|
+
export interface ConsoleTargetContext {
|
|
7
|
+
consoleForwarder?: ConsoleForwarder;
|
|
8
|
+
connections: ConnectionRegistry;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The `App.logAdded` stream of ONE automation connection, taken from the same
|
|
12
|
+
* window that connection's commands reach.
|
|
13
|
+
*
|
|
14
|
+
* Two taps, because the two architectures deliver guest console differently:
|
|
15
|
+
* - native-host: the render/service preloads post to main, bridge-router
|
|
16
|
+
* routes into the window's always-on ConsoleForwarder, and we subscribe.
|
|
17
|
+
* - default dimina-fe: the page/service console flows through the simulator
|
|
18
|
+
* guest's `ipc-message-host` channel, so we listen on that webContents.
|
|
19
|
+
* Both are re-pointed by `sync()`, which is what keeps the log stream and the
|
|
20
|
+
* command stream on the same window as the target and its simulator change.
|
|
21
|
+
*/
|
|
22
|
+
export interface ConsoleBridge {
|
|
23
|
+
/** Re-point both taps at the connection's current target. */
|
|
24
|
+
sync(): void;
|
|
25
|
+
dispose(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function createConsoleBridge<T extends ConsoleTargetContext>(target: () => T | null, simulatorOf: (ctx: T) => WebContents | null, emit: (event: RpcEvent) => void): ConsoleBridge;
|
|
28
|
+
//# sourceMappingURL=console-bridge.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { SimulatorChannel } from '../../../shared/ipc-channels.js';
|
|
2
|
+
/**
|
|
3
|
+
* How often an idle connection re-checks its target for a console to attach
|
|
4
|
+
* to. A connection that never sends a message (a script that only listens for
|
|
5
|
+
* logs) has no other moment to notice its window's simulator appearing or
|
|
6
|
+
* being replaced by a rebuild.
|
|
7
|
+
*/
|
|
8
|
+
const SYNC_INTERVAL_MS = 1000;
|
|
9
|
+
export function createConsoleBridge(target, simulatorOf, emit) {
|
|
10
|
+
let subscribedForwarder = null;
|
|
11
|
+
let forwarderSub;
|
|
12
|
+
let attachedSim = null;
|
|
13
|
+
let simHandler = null;
|
|
14
|
+
// The destroyed-teardown is owned by the sim's connection rather than a
|
|
15
|
+
// bespoke `sim.once('destroyed')`, so it cannot accumulate across re-attaches.
|
|
16
|
+
let simDestroyedDisposer = null;
|
|
17
|
+
function logAdded(entry) {
|
|
18
|
+
const e = entry ?? {};
|
|
19
|
+
emit({ method: 'App.logAdded', params: { type: e.level || 'log', args: e.args || [] } });
|
|
20
|
+
}
|
|
21
|
+
// Keyed on the forwarder itself, not the context: a window is wired with its
|
|
22
|
+
// forwarder after the context exists, so a context-identity check would miss
|
|
23
|
+
// the forwarder arriving on a context we already looked at.
|
|
24
|
+
function syncForwarder(ctx) {
|
|
25
|
+
const forwarder = ctx?.consoleForwarder ?? null;
|
|
26
|
+
if (forwarder === subscribedForwarder)
|
|
27
|
+
return;
|
|
28
|
+
forwarderSub?.dispose();
|
|
29
|
+
subscribedForwarder = forwarder;
|
|
30
|
+
forwarderSub = forwarder?.subscribe((entry) => logAdded(entry));
|
|
31
|
+
}
|
|
32
|
+
function detachSim() {
|
|
33
|
+
if (attachedSim && simHandler) {
|
|
34
|
+
try {
|
|
35
|
+
if (!attachedSim.isDestroyed()) {
|
|
36
|
+
;
|
|
37
|
+
attachedSim.removeListener('ipc-message-host', simHandler);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch { /* noop */ }
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
simDestroyedDisposer?.dispose();
|
|
44
|
+
}
|
|
45
|
+
catch { /* noop */ }
|
|
46
|
+
attachedSim = null;
|
|
47
|
+
simHandler = null;
|
|
48
|
+
simDestroyedDisposer = null;
|
|
49
|
+
}
|
|
50
|
+
function syncSim(ctx) {
|
|
51
|
+
const sim = ctx ? simulatorOf(ctx) : null;
|
|
52
|
+
const next = sim && !sim.isDestroyed() ? sim : null;
|
|
53
|
+
if (next === attachedSim)
|
|
54
|
+
return;
|
|
55
|
+
detachSim();
|
|
56
|
+
if (!next || !ctx)
|
|
57
|
+
return;
|
|
58
|
+
const onIpcMessageHost = (_event, channel, data) => {
|
|
59
|
+
if (channel !== SimulatorChannel.Console)
|
|
60
|
+
return;
|
|
61
|
+
logAdded(data);
|
|
62
|
+
};
|
|
63
|
+
attachedSim = next;
|
|
64
|
+
simHandler = onIpcMessageHost;
|
|
65
|
+
next.on('ipc-message-host', onIpcMessageHost);
|
|
66
|
+
simDestroyedDisposer = ctx.connections.acquire(next).own(() => {
|
|
67
|
+
// Dead webContents: drop the refs (removeListener on it would throw) and
|
|
68
|
+
// let the next sync attach to the replacement.
|
|
69
|
+
attachedSim = null;
|
|
70
|
+
simHandler = null;
|
|
71
|
+
simDestroyedDisposer = null;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function sync() {
|
|
75
|
+
const ctx = target();
|
|
76
|
+
syncForwarder(ctx);
|
|
77
|
+
syncSim(ctx);
|
|
78
|
+
}
|
|
79
|
+
const timer = setInterval(sync, SYNC_INTERVAL_MS);
|
|
80
|
+
return {
|
|
81
|
+
sync,
|
|
82
|
+
dispose() {
|
|
83
|
+
clearInterval(timer);
|
|
84
|
+
detachSim();
|
|
85
|
+
forwarderSub?.dispose();
|
|
86
|
+
forwarderSub = undefined;
|
|
87
|
+
subscribedForwarder = null;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=console-bridge.js.map
|
|
@@ -11,10 +11,10 @@ async function readRoute(ctx) {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Native-host: derive the visible page's `{ pagePath, query }` from the active
|
|
14
|
-
* render guest.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* render guest. This is the source for `App.getCurrentPage` and the fallback for
|
|
15
|
+
* `App.getPageStack` before DeviceShell reports its full ordered stack through
|
|
16
|
+
* the bridge. The render-host preload encodes `pagePath` (+ per-page query) in
|
|
17
|
+
* the guest's own `location.search`.
|
|
18
18
|
*/
|
|
19
19
|
async function readNativeActivePage(ctx) {
|
|
20
20
|
const renderWc = getActivePageWc(ctx);
|
|
@@ -20,27 +20,61 @@ elementHandlers['Element.triggerEvent'] = async (ctx, params) => {
|
|
|
20
20
|
`);
|
|
21
21
|
return {};
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Touch events must carry real touch points: the gesture layer reads coordinates
|
|
25
|
+
* off `touches` / `changedTouches` to decide tap vs. move-cancel, so an event with
|
|
26
|
+
* empty lists reaches it as a touch that happened nowhere. The protocol lets the
|
|
27
|
+
* caller omit points entirely (`touchstart()` with no args), in which case the
|
|
28
|
+
* element's centre — read from live layout, not a fixed offset — stands in for
|
|
29
|
+
* where a finger would land.
|
|
30
|
+
*/
|
|
31
|
+
function touchHandler(type) {
|
|
32
|
+
// A finished touch is no longer among the active `touches`, only in `changedTouches`.
|
|
33
|
+
const fallbackTouches = type === 'touchend' ? '[]' : '[{}]';
|
|
34
|
+
return async (ctx, params) => {
|
|
35
|
+
const ref = getElementRef(params);
|
|
36
|
+
const touches = params.touches ?? null;
|
|
37
|
+
// The protocol spells it `changeTouches`; the DOM event field is `changedTouches`.
|
|
38
|
+
const changed = params.changeTouches ?? null;
|
|
39
|
+
await evalInElement(ctx, ref, `
|
|
40
|
+
if (!el) throw new Error('Element not found')
|
|
41
|
+
const rect = el.getBoundingClientRect()
|
|
42
|
+
const centreX = rect.left + rect.width / 2
|
|
43
|
+
const centreY = rect.top + rect.height / 2
|
|
44
|
+
const make = (p, i) => {
|
|
45
|
+
const clientX = p.clientX != null ? p.clientX : (p.pageX != null ? p.pageX - scrollX : centreX)
|
|
46
|
+
const clientY = p.clientY != null ? p.clientY : (p.pageY != null ? p.pageY - scrollY : centreY)
|
|
47
|
+
return new Touch({
|
|
48
|
+
identifier: p.identifier != null ? p.identifier : i,
|
|
49
|
+
target: el,
|
|
50
|
+
clientX,
|
|
51
|
+
clientY,
|
|
52
|
+
pageX: p.pageX != null ? p.pageX : clientX + scrollX,
|
|
53
|
+
pageY: p.pageY != null ? p.pageY : clientY + scrollY,
|
|
54
|
+
screenX: clientX,
|
|
55
|
+
screenY: clientY,
|
|
56
|
+
force: 1,
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
const raw = ${JSON.stringify(touches)}
|
|
60
|
+
const rawChanged = ${JSON.stringify(changed)}
|
|
61
|
+
const active = (raw || ${fallbackTouches}).map(make)
|
|
62
|
+
const changedList = (rawChanged || raw || [{}]).map(make)
|
|
63
|
+
el.dispatchEvent(new TouchEvent('${type}', {
|
|
64
|
+
bubbles: true,
|
|
65
|
+
cancelable: true,
|
|
66
|
+
composed: true,
|
|
67
|
+
touches: active,
|
|
68
|
+
targetTouches: active,
|
|
69
|
+
changedTouches: changedList,
|
|
70
|
+
}))
|
|
71
|
+
`);
|
|
72
|
+
return {};
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
elementHandlers['Element.touchstart'] = touchHandler('touchstart');
|
|
76
|
+
elementHandlers['Element.touchmove'] = touchHandler('touchmove');
|
|
77
|
+
elementHandlers['Element.touchend'] = touchHandler('touchend');
|
|
44
78
|
elementHandlers['Element.getDOMProperties'] = async (ctx, params) => {
|
|
45
79
|
const ref = getElementRef(params);
|
|
46
80
|
const names = params.names;
|
|
@@ -9,11 +9,22 @@
|
|
|
9
9
|
* This server handles these messages by delegating to the workbench context
|
|
10
10
|
* (simulator webContents, IPC handlers, etc.) without modifying dimina upstream.
|
|
11
11
|
*/
|
|
12
|
+
import { type IpcInput } from '../../utils/ipc-context-source.js';
|
|
12
13
|
import type { WorkbenchContext } from '../workbench-context.js';
|
|
13
14
|
export interface AutomationServer {
|
|
14
15
|
close: () => void;
|
|
15
16
|
port: number;
|
|
16
17
|
}
|
|
17
18
|
export declare function getAutomationPort(): number | null;
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* `getCtx` rather than a context: the server binds its port at boot, before any
|
|
21
|
+
* project window exists, so there is nothing to capture yet. Each connection
|
|
22
|
+
* then pins the first project window it reaches and keeps driving that one —
|
|
23
|
+
* `getCtx` is how it finds that window, not a per-message lookup.
|
|
24
|
+
*
|
|
25
|
+
* `senders` covers every live window instead, because the port channel is asked
|
|
26
|
+
* by renderers `getCtx` never names: the project list and background project
|
|
27
|
+
* windows all start automation clients of their own.
|
|
28
|
+
*/
|
|
29
|
+
export declare function startAutomationServer(getCtx: () => WorkbenchContext, senders: IpcInput<WorkbenchContext>, port?: number): Promise<AutomationServer>;
|
|
19
30
|
//# sourceMappingURL=index.d.ts.map
|