@dimina-kit/devtools 0.1.0-dev.20260422094158
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/LICENSE +21 -0
- package/README.md +562 -0
- package/dist/main/api.d.ts +21 -0
- package/dist/main/api.d.ts.map +1 -0
- package/dist/main/api.js +22 -0
- package/dist/main/api.js.map +1 -0
- package/dist/main/app/app.d.ts +15 -0
- package/dist/main/app/app.d.ts.map +1 -0
- package/dist/main/app/app.js +192 -0
- package/dist/main/app/app.js.map +1 -0
- package/dist/main/app/bootstrap.d.ts +14 -0
- package/dist/main/app/bootstrap.d.ts.map +1 -0
- package/dist/main/app/bootstrap.js +41 -0
- package/dist/main/app/bootstrap.js.map +1 -0
- package/dist/main/app/launch.d.ts +10 -0
- package/dist/main/app/launch.d.ts.map +1 -0
- package/dist/main/app/launch.js +28 -0
- package/dist/main/app/launch.js.map +1 -0
- package/dist/main/app/lifecycle.d.ts +2 -0
- package/dist/main/app/lifecycle.d.ts.map +1 -0
- package/dist/main/app/lifecycle.js +11 -0
- package/dist/main/app/lifecycle.js.map +1 -0
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.d.ts.map +1 -0
- package/dist/main/index.js +3 -0
- package/dist/main/index.js.map +1 -0
- package/dist/main/ipc/app.d.ts +3 -0
- package/dist/main/ipc/app.d.ts.map +1 -0
- package/dist/main/ipc/app.js +14 -0
- package/dist/main/ipc/app.js.map +1 -0
- package/dist/main/ipc/index.d.ts +9 -0
- package/dist/main/ipc/index.d.ts.map +1 -0
- package/dist/main/ipc/index.js +9 -0
- package/dist/main/ipc/index.js.map +1 -0
- package/dist/main/ipc/panels.d.ts +3 -0
- package/dist/main/ipc/panels.d.ts.map +1 -0
- package/dist/main/ipc/panels.js +39 -0
- package/dist/main/ipc/panels.js.map +1 -0
- package/dist/main/ipc/popover.d.ts +3 -0
- package/dist/main/ipc/popover.d.ts.map +1 -0
- package/dist/main/ipc/popover.js +13 -0
- package/dist/main/ipc/popover.js.map +1 -0
- package/dist/main/ipc/projects.d.ts +3 -0
- package/dist/main/ipc/projects.d.ts.map +1 -0
- package/dist/main/ipc/projects.js +15 -0
- package/dist/main/ipc/projects.js.map +1 -0
- package/dist/main/ipc/session.d.ts +3 -0
- package/dist/main/ipc/session.d.ts.map +1 -0
- package/dist/main/ipc/session.js +10 -0
- package/dist/main/ipc/session.js.map +1 -0
- package/dist/main/ipc/settings.d.ts +3 -0
- package/dist/main/ipc/settings.d.ts.map +1 -0
- package/dist/main/ipc/settings.js +61 -0
- package/dist/main/ipc/settings.js.map +1 -0
- package/dist/main/ipc/simulator.d.ts +3 -0
- package/dist/main/ipc/simulator.d.ts.map +1 -0
- package/dist/main/ipc/simulator.js +26 -0
- package/dist/main/ipc/simulator.js.map +1 -0
- package/dist/main/ipc/toolbar.d.ts +3 -0
- package/dist/main/ipc/toolbar.d.ts.map +1 -0
- package/dist/main/ipc/toolbar.js +10 -0
- package/dist/main/ipc/toolbar.js.map +1 -0
- package/dist/main/menu/index.d.ts +3 -0
- package/dist/main/menu/index.d.ts.map +1 -0
- package/dist/main/menu/index.js +65 -0
- package/dist/main/menu/index.js.map +1 -0
- package/dist/main/services/automation/exec.d.ts +9 -0
- package/dist/main/services/automation/exec.d.ts.map +1 -0
- package/dist/main/services/automation/exec.js +33 -0
- package/dist/main/services/automation/exec.js.map +1 -0
- package/dist/main/services/automation/handlers/app.d.ts +3 -0
- package/dist/main/services/automation/handlers/app.d.ts.map +1 -0
- package/dist/main/services/automation/handlers/app.js +132 -0
- package/dist/main/services/automation/handlers/app.js.map +1 -0
- package/dist/main/services/automation/handlers/element.d.ts +3 -0
- package/dist/main/services/automation/handlers/element.d.ts.map +1 -0
- package/dist/main/services/automation/handlers/element.js +151 -0
- package/dist/main/services/automation/handlers/element.js.map +1 -0
- package/dist/main/services/automation/handlers/page.d.ts +3 -0
- package/dist/main/services/automation/handlers/page.d.ts.map +1 -0
- package/dist/main/services/automation/handlers/page.js +66 -0
- package/dist/main/services/automation/handlers/page.js.map +1 -0
- package/dist/main/services/automation/handlers/tool.d.ts +3 -0
- package/dist/main/services/automation/handlers/tool.d.ts.map +1 -0
- package/dist/main/services/automation/handlers/tool.js +8 -0
- package/dist/main/services/automation/handlers/tool.js.map +1 -0
- package/dist/main/services/automation/index.d.ts +18 -0
- package/dist/main/services/automation/index.d.ts.map +1 -0
- package/dist/main/services/automation/index.js +95 -0
- package/dist/main/services/automation/index.js.map +1 -0
- package/dist/main/services/automation/registry.d.ts +6 -0
- package/dist/main/services/automation/registry.d.ts.map +1 -0
- package/dist/main/services/automation/registry.js +20 -0
- package/dist/main/services/automation/registry.js.map +1 -0
- package/dist/main/services/automation/shared.d.ts +24 -0
- package/dist/main/services/automation/shared.d.ts.map +1 -0
- package/dist/main/services/automation/shared.js +2 -0
- package/dist/main/services/automation/shared.js.map +1 -0
- package/dist/main/services/default-adapter.d.ts +3 -0
- package/dist/main/services/default-adapter.d.ts.map +1 -0
- package/dist/main/services/default-adapter.js +17 -0
- package/dist/main/services/default-adapter.js.map +1 -0
- package/dist/main/services/layout/index.d.ts +27 -0
- package/dist/main/services/layout/index.d.ts.map +1 -0
- package/dist/main/services/layout/index.js +49 -0
- package/dist/main/services/layout/index.js.map +1 -0
- package/dist/main/services/mcp/index.d.ts +15 -0
- package/dist/main/services/mcp/index.d.ts.map +1 -0
- package/dist/main/services/mcp/index.js +15 -0
- package/dist/main/services/mcp/index.js.map +1 -0
- package/dist/main/services/mcp/server.d.ts +10 -0
- package/dist/main/services/mcp/server.d.ts.map +1 -0
- package/dist/main/services/mcp/server.js +76 -0
- package/dist/main/services/mcp/server.js.map +1 -0
- package/dist/main/services/mcp/target-manager.d.ts +43 -0
- package/dist/main/services/mcp/target-manager.d.ts.map +1 -0
- package/dist/main/services/mcp/target-manager.js +165 -0
- package/dist/main/services/mcp/target-manager.js.map +1 -0
- package/dist/main/services/mcp/tool-registry.d.ts +14 -0
- package/dist/main/services/mcp/tool-registry.d.ts.map +1 -0
- package/dist/main/services/mcp/tool-registry.js +84 -0
- package/dist/main/services/mcp/tool-registry.js.map +1 -0
- package/dist/main/services/mcp/tools/context-tools.d.ts +15 -0
- package/dist/main/services/mcp/tools/context-tools.d.ts.map +1 -0
- package/dist/main/services/mcp/tools/context-tools.js +244 -0
- package/dist/main/services/mcp/tools/context-tools.js.map +1 -0
- package/dist/main/services/mcp/tools/simulator-tools.d.ts +14 -0
- package/dist/main/services/mcp/tools/simulator-tools.d.ts.map +1 -0
- package/dist/main/services/mcp/tools/simulator-tools.js +143 -0
- package/dist/main/services/mcp/tools/simulator-tools.js.map +1 -0
- package/dist/main/services/mcp/tools/workbench-tools.d.ts +7 -0
- package/dist/main/services/mcp/tools/workbench-tools.d.ts.map +1 -0
- package/dist/main/services/mcp/tools/workbench-tools.js +13 -0
- package/dist/main/services/mcp/tools/workbench-tools.js.map +1 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +80 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts.map +1 -0
- package/dist/main/services/notifications/renderer-notifier.js +70 -0
- package/dist/main/services/notifications/renderer-notifier.js.map +1 -0
- package/dist/main/services/projects/index.d.ts +2 -0
- package/dist/main/services/projects/index.d.ts.map +1 -0
- package/dist/main/services/projects/index.js +6 -0
- package/dist/main/services/projects/index.js.map +1 -0
- package/dist/main/services/projects/project-repository.d.ts +28 -0
- package/dist/main/services/projects/project-repository.d.ts.map +1 -0
- package/dist/main/services/projects/project-repository.js +145 -0
- package/dist/main/services/projects/project-repository.js.map +1 -0
- package/dist/main/services/settings/index.d.ts +16 -0
- package/dist/main/services/settings/index.d.ts.map +1 -0
- package/dist/main/services/settings/index.js +46 -0
- package/dist/main/services/settings/index.js.map +1 -0
- package/dist/main/services/simulator/dir.d.ts +2 -0
- package/dist/main/services/simulator/dir.d.ts.map +1 -0
- package/dist/main/services/simulator/dir.js +5 -0
- package/dist/main/services/simulator/dir.js.map +1 -0
- package/dist/main/services/simulator/referer.d.ts +10 -0
- package/dist/main/services/simulator/referer.d.ts.map +1 -0
- package/dist/main/services/simulator/referer.js +20 -0
- package/dist/main/services/simulator/referer.js.map +1 -0
- package/dist/main/services/views/view-manager.d.ts +84 -0
- package/dist/main/services/views/view-manager.d.ts.map +1 -0
- package/dist/main/services/views/view-manager.js +254 -0
- package/dist/main/services/views/view-manager.js.map +1 -0
- package/dist/main/services/workbench-context.d.ts +59 -0
- package/dist/main/services/workbench-context.d.ts.map +1 -0
- package/dist/main/services/workbench-context.js +33 -0
- package/dist/main/services/workbench-context.js.map +1 -0
- package/dist/main/services/workspace/index.d.ts +2 -0
- package/dist/main/services/workspace/index.d.ts.map +1 -0
- package/dist/main/services/workspace/index.js +2 -0
- package/dist/main/services/workspace/index.js.map +1 -0
- package/dist/main/services/workspace/workspace-service.d.ts +49 -0
- package/dist/main/services/workspace/workspace-service.d.ts.map +1 -0
- package/dist/main/services/workspace/workspace-service.js +90 -0
- package/dist/main/services/workspace/workspace-service.js.map +1 -0
- package/dist/main/utils/logger.d.ts +15 -0
- package/dist/main/utils/logger.d.ts.map +1 -0
- package/dist/main/utils/logger.js +48 -0
- package/dist/main/utils/logger.js.map +1 -0
- package/dist/main/utils/paths.d.ts +6 -0
- package/dist/main/utils/paths.d.ts.map +1 -0
- package/dist/main/utils/paths.js +15 -0
- package/dist/main/utils/paths.js.map +1 -0
- package/dist/main/utils/theme.d.ts +10 -0
- package/dist/main/utils/theme.d.ts.map +1 -0
- package/dist/main/utils/theme.js +13 -0
- package/dist/main/utils/theme.js.map +1 -0
- package/dist/main/windows/main-window/create.d.ts +11 -0
- package/dist/main/windows/main-window/create.d.ts.map +1 -0
- package/dist/main/windows/main-window/create.js +67 -0
- package/dist/main/windows/main-window/create.js.map +1 -0
- package/dist/main/windows/main-window/events.d.ts +9 -0
- package/dist/main/windows/main-window/events.d.ts.map +1 -0
- package/dist/main/windows/main-window/events.js +18 -0
- package/dist/main/windows/main-window/events.js.map +1 -0
- package/dist/main/windows/main-window/index.d.ts +5 -0
- package/dist/main/windows/main-window/index.d.ts.map +1 -0
- package/dist/main/windows/main-window/index.js +3 -0
- package/dist/main/windows/main-window/index.js.map +1 -0
- package/dist/main/windows/settings-window/create.d.ts +3 -0
- package/dist/main/windows/settings-window/create.d.ts.map +1 -0
- package/dist/main/windows/settings-window/create.js +18 -0
- package/dist/main/windows/settings-window/create.js.map +1 -0
- package/dist/main/windows/settings-window/events.d.ts +3 -0
- package/dist/main/windows/settings-window/events.d.ts.map +1 -0
- package/dist/main/windows/settings-window/events.js +6 -0
- package/dist/main/windows/settings-window/events.js.map +1 -0
- package/dist/main/windows/settings-window/index.d.ts +3 -0
- package/dist/main/windows/settings-window/index.d.ts.map +1 -0
- package/dist/main/windows/settings-window/index.js +3 -0
- package/dist/main/windows/settings-window/index.js.map +1 -0
- package/dist/preload/instrumentation/app-data.d.ts +3 -0
- package/dist/preload/instrumentation/app-data.d.ts.map +1 -0
- package/dist/preload/instrumentation/app-data.js +103 -0
- package/dist/preload/instrumentation/app-data.js.map +1 -0
- package/dist/preload/instrumentation/console.d.ts +2 -0
- package/dist/preload/instrumentation/console.d.ts.map +1 -0
- package/dist/preload/instrumentation/console.js +54 -0
- package/dist/preload/instrumentation/console.js.map +1 -0
- package/dist/preload/instrumentation/disposable.d.ts +11 -0
- package/dist/preload/instrumentation/disposable.d.ts.map +1 -0
- package/dist/preload/instrumentation/disposable.js +15 -0
- package/dist/preload/instrumentation/disposable.js.map +1 -0
- package/dist/preload/instrumentation/index.d.ts +5 -0
- package/dist/preload/instrumentation/index.d.ts.map +1 -0
- package/dist/preload/instrumentation/index.js +5 -0
- package/dist/preload/instrumentation/index.js.map +1 -0
- package/dist/preload/instrumentation/storage.d.ts +2 -0
- package/dist/preload/instrumentation/storage.d.ts.map +1 -0
- package/dist/preload/instrumentation/storage.js +106 -0
- package/dist/preload/instrumentation/storage.js.map +1 -0
- package/dist/preload/instrumentation/wxml-extract.d.ts +11 -0
- package/dist/preload/instrumentation/wxml-extract.d.ts.map +1 -0
- package/dist/preload/instrumentation/wxml-extract.js +173 -0
- package/dist/preload/instrumentation/wxml-extract.js.map +1 -0
- package/dist/preload/instrumentation/wxml.d.ts +5 -0
- package/dist/preload/instrumentation/wxml.d.ts.map +1 -0
- package/dist/preload/instrumentation/wxml.js +223 -0
- package/dist/preload/instrumentation/wxml.js.map +1 -0
- package/dist/preload/runtime/bridge.d.ts +36 -0
- package/dist/preload/runtime/bridge.d.ts.map +1 -0
- package/dist/preload/runtime/bridge.js +151 -0
- package/dist/preload/runtime/bridge.js.map +1 -0
- package/dist/preload/runtime/host.d.ts +3 -0
- package/dist/preload/runtime/host.d.ts.map +1 -0
- package/dist/preload/runtime/host.js +28 -0
- package/dist/preload/runtime/host.js.map +1 -0
- package/dist/preload/shared/api-compat.d.ts +2 -0
- package/dist/preload/shared/api-compat.d.ts.map +1 -0
- package/dist/preload/shared/api-compat.js +196 -0
- package/dist/preload/shared/api-compat.js.map +1 -0
- package/dist/preload/shared/constants.d.ts +16 -0
- package/dist/preload/shared/constants.d.ts.map +1 -0
- package/dist/preload/shared/constants.js +16 -0
- package/dist/preload/shared/constants.js.map +1 -0
- package/dist/preload/shared/types.d.ts +34 -0
- package/dist/preload/shared/types.d.ts.map +1 -0
- package/dist/preload/shared/types.js +8 -0
- package/dist/preload/shared/types.js.map +1 -0
- package/dist/preload/windows/main.d.ts +7 -0
- package/dist/preload/windows/main.d.ts.map +1 -0
- package/dist/preload/windows/main.js +7 -0
- package/dist/preload/windows/main.js.map +1 -0
- package/dist/preload/windows/simulator.js +969 -0
- package/dist/preload/windows/simulator.js.map +7 -0
- package/dist/renderer/assets/index-kcmIQPCg.js +2 -0
- package/dist/renderer/assets/index-kcmIQPCg.js.map +1 -0
- package/dist/renderer/assets/input-B7sz4y1r.js +2 -0
- package/dist/renderer/assets/input-B7sz4y1r.js.map +1 -0
- package/dist/renderer/assets/ipc-transport-C9-PPTGn.css +1 -0
- package/dist/renderer/assets/ipc-transport-L_WD9x12.js +9 -0
- package/dist/renderer/assets/ipc-transport-L_WD9x12.js.map +1 -0
- package/dist/renderer/assets/popover-CzMIs2j4.js +2 -0
- package/dist/renderer/assets/popover-CzMIs2j4.js.map +1 -0
- package/dist/renderer/assets/select-BBXJVe8R.js +2 -0
- package/dist/renderer/assets/select-BBXJVe8R.js.map +1 -0
- package/dist/renderer/assets/settings-Db1pvrBJ.js +2 -0
- package/dist/renderer/assets/settings-Db1pvrBJ.js.map +1 -0
- package/dist/renderer/assets/settings-api-DJ1M-CNt.js +2 -0
- package/dist/renderer/assets/settings-api-DJ1M-CNt.js.map +1 -0
- package/dist/renderer/assets/workbenchSettings-BnQsvWkQ.js +8 -0
- package/dist/renderer/assets/workbenchSettings-BnQsvWkQ.js.map +1 -0
- package/dist/renderer/entries/main/index.html +15 -0
- package/dist/renderer/entries/popover/index.html +18 -0
- package/dist/renderer/entries/settings/index.html +15 -0
- package/dist/renderer/entries/workbench-settings/index.html +15 -0
- package/dist/shared/constants.d.ts +10 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +10 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/ipc-channels.d.ts +89 -0
- package/dist/shared/ipc-channels.d.ts.map +1 -0
- package/dist/shared/ipc-channels.js +102 -0
- package/dist/shared/ipc-channels.js.map +1 -0
- package/dist/shared/types.d.ts +89 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +2 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/simulator/assets/simulator-C1eHXnuq.js +9 -0
- package/dist/simulator/assets/simulator-C1eHXnuq.js.map +1 -0
- package/dist/simulator/simulator.html +164 -0
- package/package.json +204 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dir.js","sourceRoot":"","sources":["../../../../src/main/services/simulator/dir.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAE9D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WeChat-style page-frame referer for HTTPS requests proxied from the simulator session.
|
|
3
|
+
* Format: https://servicewechat.com/{appId}/{version}/page-frame.html
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildServicewechatPageFrameReferer(appId: string, version?: string): string;
|
|
6
|
+
/** Called when a project session is active so protocol.handle can force Referer. */
|
|
7
|
+
export declare function setSimulatorServicewechatReferer(appId: string, version?: string): void;
|
|
8
|
+
export declare function clearSimulatorServicewechatReferer(): void;
|
|
9
|
+
export declare function getSimulatorServicewechatReferer(): string | null;
|
|
10
|
+
//# sourceMappingURL=referer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referer.d.ts","sourceRoot":"","sources":["../../../../src/main/services/simulator/referer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,MAAwB,GAChC,MAAM,CAER;AAED,oFAAoF;AACpF,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAKtF;AAED,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD;AAED,wBAAgB,gCAAgC,IAAI,MAAM,GAAG,IAAI,CAEhE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WeChat-style page-frame referer for HTTPS requests proxied from the simulator session.
|
|
3
|
+
* Format: https://servicewechat.com/{appId}/{version}/page-frame.html
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_VERSION = 'develop';
|
|
6
|
+
let cachedRefererUrl = null;
|
|
7
|
+
export function buildServicewechatPageFrameReferer(appId, version = DEFAULT_VERSION) {
|
|
8
|
+
return `https://servicewechat.com/${appId}/${version}/page-frame.html`;
|
|
9
|
+
}
|
|
10
|
+
/** Called when a project session is active so protocol.handle can force Referer. */
|
|
11
|
+
export function setSimulatorServicewechatReferer(appId, version) {
|
|
12
|
+
cachedRefererUrl = buildServicewechatPageFrameReferer(appId, version && version.length > 0 ? version : DEFAULT_VERSION);
|
|
13
|
+
}
|
|
14
|
+
export function clearSimulatorServicewechatReferer() {
|
|
15
|
+
cachedRefererUrl = null;
|
|
16
|
+
}
|
|
17
|
+
export function getSimulatorServicewechatReferer() {
|
|
18
|
+
return cachedRefererUrl;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=referer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referer.js","sourceRoot":"","sources":["../../../../src/main/services/simulator/referer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,eAAe,GAAG,SAAS,CAAA;AAEjC,IAAI,gBAAgB,GAAkB,IAAI,CAAA;AAE1C,MAAM,UAAU,kCAAkC,CAChD,KAAa,EACb,UAAkB,eAAe;IAEjC,OAAO,6BAA6B,KAAK,IAAI,OAAO,kBAAkB,CAAA;AACxE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,gCAAgC,CAAC,KAAa,EAAE,OAAgB;IAC9E,gBAAgB,GAAG,kCAAkC,CACnD,KAAK,EACL,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAC1D,CAAA;AACH,CAAC;AAED,MAAM,UAAU,kCAAkC;IAChD,gBAAgB,GAAG,IAAI,CAAA;AACzB,CAAC;AAED,MAAM,UAAU,gCAAgC;IAC9C,OAAO,gBAAgB,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { WebContents } from 'electron';
|
|
2
|
+
import { type WorkbenchContext } from '../workbench-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Context surface used by the ViewManager. We only need a small slice of the
|
|
5
|
+
* full WorkbenchContext here; typing it this way documents the actual dependency.
|
|
6
|
+
*/
|
|
7
|
+
export interface ViewManagerContext {
|
|
8
|
+
mainWindow: WorkbenchContext['mainWindow'];
|
|
9
|
+
rendererDir: string;
|
|
10
|
+
panels: string[];
|
|
11
|
+
notify: WorkbenchContext['notify'];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Unified lifecycle manager for Electron WebContentsView overlays.
|
|
15
|
+
*
|
|
16
|
+
* Owns creation / attachment / detachment / positioning / destruction of
|
|
17
|
+
* every overlay view hung off the main window's contentView (simulator,
|
|
18
|
+
* settings, popover). All `new WebContentsView`, `addChildView`,
|
|
19
|
+
* `removeChildView`, `webContents.destroy()` and overlay `setBounds` calls
|
|
20
|
+
* should live here — IPC handlers just call into the manager.
|
|
21
|
+
*
|
|
22
|
+
* The main window's own renderer (added in `windows/main-window/create.ts`)
|
|
23
|
+
* is the main content root and is not an overlay, so it is not managed here.
|
|
24
|
+
*/
|
|
25
|
+
export interface ViewManager {
|
|
26
|
+
/**
|
|
27
|
+
* Create a DevTools view for the given simulator webContents and add it to
|
|
28
|
+
* the main window contentView (only when the `devtools` tab is the default
|
|
29
|
+
* tab; otherwise the view is created but not added yet).
|
|
30
|
+
*/
|
|
31
|
+
attachSimulator(simWcId: number, simWidth: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Destroy and null out the simulator view (e.g. on simulator detach).
|
|
34
|
+
* Also destroys the cached settings view and hides the popover —
|
|
35
|
+
* preserves the aggregate `detachAllViews` behaviour of the previous
|
|
36
|
+
* `windows/views.ts` module, which every detach call relied on.
|
|
37
|
+
*/
|
|
38
|
+
detachSimulator(): void;
|
|
39
|
+
/** Reveal the existing DevTools view (idempotent). */
|
|
40
|
+
showSimulator(simWidth: number): void;
|
|
41
|
+
/** Remove (but do not destroy) the simulator view from the contentView. */
|
|
42
|
+
hideSimulator(): void;
|
|
43
|
+
/** Lazy-create and show the settings overlay view. */
|
|
44
|
+
showSettings(): Promise<void>;
|
|
45
|
+
/** Remove the settings overlay view (kept around for next open). */
|
|
46
|
+
hideSettings(): void;
|
|
47
|
+
/** Create and show the popover overlay with the given init payload. */
|
|
48
|
+
showPopover(data: unknown): void;
|
|
49
|
+
/** Destroy the popover overlay and notify the renderer. */
|
|
50
|
+
hidePopover(): void;
|
|
51
|
+
/** Re-apply layout for every currently visible overlay (on window resize). */
|
|
52
|
+
repositionAll(): void;
|
|
53
|
+
/** Destroy all overlay webContents and null out the cached views. */
|
|
54
|
+
disposeAll(): void;
|
|
55
|
+
/** Log current child-view count of the main contentView. */
|
|
56
|
+
logChildViews(label: string): void;
|
|
57
|
+
/** Reposition only the simulator overlay (for simulator width changes). */
|
|
58
|
+
positionSimulator(simWidth: number): void;
|
|
59
|
+
/** Reposition only the settings overlay. */
|
|
60
|
+
positionSettings(): void;
|
|
61
|
+
/** Return the webContents ID of the currently attached simulator. */
|
|
62
|
+
getSimulatorWebContentsId(): number | null;
|
|
63
|
+
/** Return the last known simulator width. */
|
|
64
|
+
getLastSimWidth(): number;
|
|
65
|
+
/** Whether the simulator overlay is currently added to the contentView. */
|
|
66
|
+
isSimulatorAdded(): boolean;
|
|
67
|
+
/** Whether a DevTools view exists (created but maybe not added). */
|
|
68
|
+
hasSimulatorView(): boolean;
|
|
69
|
+
/** Return the settings overlay's WebContents (for renderer-notifier). */
|
|
70
|
+
getSettingsWebContents(): WebContents | null;
|
|
71
|
+
/** Update lastSimWidth; reposition simulator + settings if they are added. */
|
|
72
|
+
resize(simWidth: number): void;
|
|
73
|
+
/** Show or hide the simulator overlay based on visibility flag. */
|
|
74
|
+
setVisible(visible: boolean, simWidth: number): void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build a ViewManager bound to the given context. The returned object is the
|
|
78
|
+
* only component allowed to instantiate or add/remove overlay WebContentsViews.
|
|
79
|
+
*
|
|
80
|
+
* All view-related mutable state lives inside this closure and is not exposed
|
|
81
|
+
* on the context object.
|
|
82
|
+
*/
|
|
83
|
+
export declare function createViewManager(ctx: ViewManagerContext): ViewManager;
|
|
84
|
+
//# sourceMappingURL=view-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-manager.d.ts","sourceRoot":"","sources":["../../../../src/main/services/views/view-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAI3C,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE9E;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC1C,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACnC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAE1B;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACxD;;;;;OAKG;IACH,eAAe,IAAI,IAAI,CAAA;IACvB,sDAAsD;IACtD,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,2EAA2E;IAC3E,aAAa,IAAI,IAAI,CAAA;IAGrB,sDAAsD;IACtD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,oEAAoE;IACpE,YAAY,IAAI,IAAI,CAAA;IAGpB,uEAAuE;IACvE,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IAChC,2DAA2D;IAC3D,WAAW,IAAI,IAAI,CAAA;IAGnB,8EAA8E;IAC9E,aAAa,IAAI,IAAI,CAAA;IACrB,qEAAqE;IACrE,UAAU,IAAI,IAAI,CAAA;IAGlB,4DAA4D;IAC5D,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAGlC,2EAA2E;IAC3E,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACzC,4CAA4C;IAC5C,gBAAgB,IAAI,IAAI,CAAA;IAGxB,qEAAqE;IACrE,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAAA;IAC1C,6CAA6C;IAC7C,eAAe,IAAI,MAAM,CAAA;IACzB,2EAA2E;IAC3E,gBAAgB,IAAI,OAAO,CAAA;IAC3B,oEAAoE;IACpE,gBAAgB,IAAI,OAAO,CAAA;IAC3B,yEAAyE;IACzE,sBAAsB,IAAI,WAAW,GAAG,IAAI,CAAA;IAG5C,8EAA8E;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,mEAAmE;IACnE,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,GAAG,WAAW,CAgQtE"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { WebContentsView, webContents } from 'electron';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import * as layout from '../layout/index.js';
|
|
4
|
+
import { getDefaultTab } from '../workbench-context.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build a ViewManager bound to the given context. The returned object is the
|
|
7
|
+
* only component allowed to instantiate or add/remove overlay WebContentsViews.
|
|
8
|
+
*
|
|
9
|
+
* All view-related mutable state lives inside this closure and is not exposed
|
|
10
|
+
* on the context object.
|
|
11
|
+
*/
|
|
12
|
+
export function createViewManager(ctx) {
|
|
13
|
+
// ── Private mutable state ───────────────────────────────────────────────
|
|
14
|
+
let simulatorView = null;
|
|
15
|
+
let simulatorViewAdded = false;
|
|
16
|
+
let settingsView = null;
|
|
17
|
+
let settingsViewAdded = false;
|
|
18
|
+
let popoverView = null;
|
|
19
|
+
let lastSimWidth = 375;
|
|
20
|
+
let simulatorWebContentsId = null;
|
|
21
|
+
// ── Internal helpers ────────────────────────────────────────────────────
|
|
22
|
+
function destroyViewInternal(view) {
|
|
23
|
+
if (!view)
|
|
24
|
+
return;
|
|
25
|
+
if (!ctx.mainWindow.isDestroyed()) {
|
|
26
|
+
try {
|
|
27
|
+
ctx.mainWindow.contentView.removeChildView(view);
|
|
28
|
+
}
|
|
29
|
+
catch { /* already removed */ }
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
if (!view.webContents.isDestroyed()) {
|
|
33
|
+
view.webContents.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch { /* ignore */ }
|
|
37
|
+
}
|
|
38
|
+
function applySimulatorBounds(simWidth) {
|
|
39
|
+
if (!simulatorView || ctx.mainWindow.isDestroyed())
|
|
40
|
+
return;
|
|
41
|
+
const [w = 0, h = 0] = ctx.mainWindow.getContentSize();
|
|
42
|
+
simulatorView.setBounds(layout.computeSimulatorBounds(w, h, simWidth));
|
|
43
|
+
}
|
|
44
|
+
function applySettingsBounds() {
|
|
45
|
+
if (!settingsView || ctx.mainWindow.isDestroyed())
|
|
46
|
+
return;
|
|
47
|
+
const [w = 0, h = 0] = ctx.mainWindow.getContentSize();
|
|
48
|
+
settingsView.setBounds(layout.computeSettingsBounds(w, h));
|
|
49
|
+
}
|
|
50
|
+
function applyPopoverBounds() {
|
|
51
|
+
if (!popoverView || ctx.mainWindow.isDestroyed())
|
|
52
|
+
return;
|
|
53
|
+
const [w = 0, h = 0] = ctx.mainWindow.getContentSize();
|
|
54
|
+
popoverView.setBounds(layout.computePopoverBounds(w, h));
|
|
55
|
+
}
|
|
56
|
+
// ── ViewManager methods ─────────────────────────────────────────────────
|
|
57
|
+
function attachSimulator(simWcId, simWidth) {
|
|
58
|
+
const sim = webContents.fromId(simWcId);
|
|
59
|
+
if (!sim) {
|
|
60
|
+
console.error('[workbench] attachSimulator — simWc not found for id', simWcId);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
lastSimWidth = simWidth;
|
|
64
|
+
simulatorWebContentsId = simWcId;
|
|
65
|
+
// Destroy old simulatorView to prevent WebContentsView leak
|
|
66
|
+
if (simulatorView) {
|
|
67
|
+
hideSimulator();
|
|
68
|
+
try {
|
|
69
|
+
if (!simulatorView.webContents.isDestroyed()) {
|
|
70
|
+
simulatorView.webContents.close();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch { /* ignore */ }
|
|
74
|
+
simulatorView = null;
|
|
75
|
+
}
|
|
76
|
+
simulatorView = new WebContentsView();
|
|
77
|
+
sim.setDevToolsWebContents(simulatorView.webContents);
|
|
78
|
+
sim.openDevTools();
|
|
79
|
+
// Default DevTools to Console panel (Chrome DevTools defaults to Elements).
|
|
80
|
+
// The DevTools UI renders inside simulatorView.webContents; we click the
|
|
81
|
+
// Console tab once its header is laid out, and persist the choice via
|
|
82
|
+
// localStorage so subsequent reloads honor it.
|
|
83
|
+
const devtoolsWc = simulatorView.webContents;
|
|
84
|
+
devtoolsWc.once('dom-ready', () => {
|
|
85
|
+
devtoolsWc.executeJavaScript(`
|
|
86
|
+
(function() {
|
|
87
|
+
try { localStorage.setItem('panel-selectedTab', '"console"') } catch {}
|
|
88
|
+
let tries = 0
|
|
89
|
+
const timer = setInterval(() => {
|
|
90
|
+
tries++
|
|
91
|
+
const tabs = document.querySelectorAll('[role="tab"], .tabbed-pane-header-tab')
|
|
92
|
+
for (const tab of tabs) {
|
|
93
|
+
const label = (tab.getAttribute('aria-label') || tab.textContent || '').trim().toLowerCase()
|
|
94
|
+
if (label === 'console' || label.startsWith('console')) {
|
|
95
|
+
tab.click()
|
|
96
|
+
clearInterval(timer)
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (tries > 40) clearInterval(timer)
|
|
101
|
+
}, 100)
|
|
102
|
+
})()
|
|
103
|
+
`).catch(() => { });
|
|
104
|
+
});
|
|
105
|
+
if (getDefaultTab(ctx) === 'simulator') {
|
|
106
|
+
ctx.mainWindow.contentView.addChildView(simulatorView);
|
|
107
|
+
simulatorViewAdded = true;
|
|
108
|
+
applySimulatorBounds(simWidth);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function detachSimulator() {
|
|
112
|
+
hidePopover();
|
|
113
|
+
// Drop the settings view too — the previous detachAllViews() did.
|
|
114
|
+
destroyViewInternal(settingsView);
|
|
115
|
+
settingsView = null;
|
|
116
|
+
settingsViewAdded = false;
|
|
117
|
+
destroyViewInternal(simulatorView);
|
|
118
|
+
simulatorView = null;
|
|
119
|
+
simulatorViewAdded = false;
|
|
120
|
+
simulatorWebContentsId = null;
|
|
121
|
+
}
|
|
122
|
+
function showSimulator(simWidth) {
|
|
123
|
+
lastSimWidth = simWidth;
|
|
124
|
+
if (!simulatorView)
|
|
125
|
+
return;
|
|
126
|
+
if (!simulatorViewAdded) {
|
|
127
|
+
ctx.mainWindow.contentView.addChildView(simulatorView);
|
|
128
|
+
simulatorViewAdded = true;
|
|
129
|
+
}
|
|
130
|
+
applySimulatorBounds(simWidth);
|
|
131
|
+
}
|
|
132
|
+
function hideSimulator() {
|
|
133
|
+
if (simulatorView && simulatorViewAdded) {
|
|
134
|
+
try {
|
|
135
|
+
ctx.mainWindow.contentView.removeChildView(simulatorView);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.error('[workbench] hideSimulator error', e);
|
|
139
|
+
}
|
|
140
|
+
simulatorViewAdded = false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function showSettings() {
|
|
144
|
+
if (!settingsView) {
|
|
145
|
+
settingsView = new WebContentsView({
|
|
146
|
+
webPreferences: { nodeIntegration: true, contextIsolation: false },
|
|
147
|
+
});
|
|
148
|
+
await settingsView.webContents.loadFile(path.join(ctx.rendererDir, 'entries/settings/index.html'));
|
|
149
|
+
}
|
|
150
|
+
if (!settingsViewAdded) {
|
|
151
|
+
ctx.mainWindow.contentView.addChildView(settingsView);
|
|
152
|
+
settingsViewAdded = true;
|
|
153
|
+
}
|
|
154
|
+
applySettingsBounds();
|
|
155
|
+
}
|
|
156
|
+
function hideSettings() {
|
|
157
|
+
if (settingsView && settingsViewAdded) {
|
|
158
|
+
try {
|
|
159
|
+
ctx.mainWindow.contentView.removeChildView(settingsView);
|
|
160
|
+
}
|
|
161
|
+
catch { /* ignore */ }
|
|
162
|
+
settingsViewAdded = false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function showPopover(data) {
|
|
166
|
+
hidePopover();
|
|
167
|
+
const popover = new WebContentsView({
|
|
168
|
+
webPreferences: { nodeIntegration: true, contextIsolation: false },
|
|
169
|
+
});
|
|
170
|
+
popoverView = popover;
|
|
171
|
+
popover.setBackgroundColor('#00000000');
|
|
172
|
+
ctx.mainWindow.contentView.addChildView(popover);
|
|
173
|
+
applyPopoverBounds();
|
|
174
|
+
popover.webContents.once('did-finish-load', () => {
|
|
175
|
+
ctx.notify.popoverInit(popover, data);
|
|
176
|
+
});
|
|
177
|
+
popover.webContents.loadFile(path.join(ctx.rendererDir, 'entries/popover/index.html'));
|
|
178
|
+
}
|
|
179
|
+
function hidePopover() {
|
|
180
|
+
if (popoverView) {
|
|
181
|
+
destroyViewInternal(popoverView);
|
|
182
|
+
popoverView = null;
|
|
183
|
+
ctx.notify.popoverClosed();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function repositionAll() {
|
|
187
|
+
if (simulatorView && simulatorViewAdded)
|
|
188
|
+
applySimulatorBounds(lastSimWidth);
|
|
189
|
+
if (settingsView && settingsViewAdded)
|
|
190
|
+
applySettingsBounds();
|
|
191
|
+
if (popoverView)
|
|
192
|
+
applyPopoverBounds();
|
|
193
|
+
}
|
|
194
|
+
function disposeAll() {
|
|
195
|
+
detachSimulator();
|
|
196
|
+
}
|
|
197
|
+
function logChildViews(_label) {
|
|
198
|
+
// Debug helper — intentionally a no-op in production. Kept on the
|
|
199
|
+
// ViewManager interface so call sites and tests stay stable.
|
|
200
|
+
}
|
|
201
|
+
function positionSimulator(simWidth) {
|
|
202
|
+
applySimulatorBounds(simWidth);
|
|
203
|
+
}
|
|
204
|
+
function positionSettings() {
|
|
205
|
+
applySettingsBounds();
|
|
206
|
+
}
|
|
207
|
+
function resize(simWidth) {
|
|
208
|
+
lastSimWidth = simWidth;
|
|
209
|
+
if (simulatorViewAdded)
|
|
210
|
+
applySimulatorBounds(simWidth);
|
|
211
|
+
if (settingsViewAdded)
|
|
212
|
+
applySettingsBounds();
|
|
213
|
+
}
|
|
214
|
+
function setVisible(visible, simWidth) {
|
|
215
|
+
lastSimWidth = simWidth;
|
|
216
|
+
if (!simulatorView)
|
|
217
|
+
return;
|
|
218
|
+
if (visible && !simulatorViewAdded) {
|
|
219
|
+
showSimulator(simWidth);
|
|
220
|
+
}
|
|
221
|
+
else if (!visible) {
|
|
222
|
+
hideSimulator();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
attachSimulator,
|
|
227
|
+
detachSimulator,
|
|
228
|
+
showSimulator,
|
|
229
|
+
hideSimulator,
|
|
230
|
+
showSettings,
|
|
231
|
+
hideSettings,
|
|
232
|
+
showPopover,
|
|
233
|
+
hidePopover,
|
|
234
|
+
repositionAll,
|
|
235
|
+
disposeAll,
|
|
236
|
+
logChildViews,
|
|
237
|
+
positionSimulator,
|
|
238
|
+
positionSettings,
|
|
239
|
+
getSimulatorWebContentsId: () => simulatorWebContentsId,
|
|
240
|
+
getLastSimWidth: () => lastSimWidth,
|
|
241
|
+
isSimulatorAdded: () => simulatorViewAdded,
|
|
242
|
+
hasSimulatorView: () => simulatorView !== null,
|
|
243
|
+
getSettingsWebContents: () => {
|
|
244
|
+
if (!settingsView)
|
|
245
|
+
return null;
|
|
246
|
+
if (settingsView.webContents.isDestroyed())
|
|
247
|
+
return null;
|
|
248
|
+
return settingsView.webContents;
|
|
249
|
+
},
|
|
250
|
+
resize,
|
|
251
|
+
setVisible,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=view-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-manager.js","sourceRoot":"","sources":["../../../../src/main/services/views/view-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAA;AA4F9E;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAuB;IACvD,2EAA2E;IAC3E,IAAI,aAAa,GAA2B,IAAI,CAAA;IAChD,IAAI,kBAAkB,GAAG,KAAK,CAAA;IAC9B,IAAI,YAAY,GAA2B,IAAI,CAAA;IAC/C,IAAI,iBAAiB,GAAG,KAAK,CAAA;IAC7B,IAAI,WAAW,GAA2B,IAAI,CAAA;IAC9C,IAAI,YAAY,GAAG,GAAG,CAAA;IACtB,IAAI,sBAAsB,GAAkB,IAAI,CAAA;IAEhD,2EAA2E;IAE3E,SAAS,mBAAmB,CAAC,IAA4B;QACvD,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAClD,CAAC;YAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;gBACpC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;YAC1B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,gBAAgB,EAAE,GAAG,EAAE,CAAC,aAAa,KAAK,IAAI;QAC9C,sBAAsB,EAAE,GAAG,EAAE;YAC3B,IAAI,CAAC,YAAY;gBAAE,OAAO,IAAI,CAAA;YAC9B,IAAI,YAAY,CAAC,WAAW,CAAC,WAAW,EAAE;gBAAE,OAAO,IAAI,CAAA;YACvD,OAAO,YAAY,CAAC,WAAW,CAAA;QACjC,CAAC;QACD,MAAM;QACN,UAAU;KACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BrowserWindow } from 'electron';
|
|
2
|
+
import type { CompilationAdapter } from '../../shared/types.js';
|
|
3
|
+
import { type RendererNotifier } from './notifications/renderer-notifier.js';
|
|
4
|
+
import { type ViewManager } from './views/view-manager.js';
|
|
5
|
+
import { type WorkspaceService } from './workspace/workspace-service.js';
|
|
6
|
+
/**
|
|
7
|
+
* Shared mutable state for the workbench application.
|
|
8
|
+
* Passed to each IPC module so they can read/write shared state without closures.
|
|
9
|
+
*/
|
|
10
|
+
export interface WorkbenchContext {
|
|
11
|
+
mainWindow: BrowserWindow;
|
|
12
|
+
adapter: CompilationAdapter;
|
|
13
|
+
/** Absolute path to the preload script loaded into the simulator webview */
|
|
14
|
+
preloadPath: string;
|
|
15
|
+
/** Absolute path to the renderer dist directory */
|
|
16
|
+
rendererDir: string;
|
|
17
|
+
workbenchSettingsWindow: BrowserWindow | null;
|
|
18
|
+
/** Built-in panel IDs to display (default: all) */
|
|
19
|
+
panels: string[];
|
|
20
|
+
/** Custom API namespace names (e.g. ['qd']) passed to the simulator */
|
|
21
|
+
apiNamespaces: string[];
|
|
22
|
+
/** Branding name shown in title bar and getBranding IPC */
|
|
23
|
+
appName: string;
|
|
24
|
+
/** Host-injected provider for toolbar actions (overrides default empty list) */
|
|
25
|
+
toolbarActions?: () => Promise<Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
}>> | Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
}>;
|
|
32
|
+
/** Host-injected provider for branding info (overrides default appName) */
|
|
33
|
+
brandingProvider?: () => Promise<{
|
|
34
|
+
appName: string;
|
|
35
|
+
}> | {
|
|
36
|
+
appName: string;
|
|
37
|
+
};
|
|
38
|
+
/** Unified lifecycle manager for all overlay WebContentsViews */
|
|
39
|
+
views: ViewManager;
|
|
40
|
+
/** Unified main → renderer event dispatcher */
|
|
41
|
+
notify: RendererNotifier;
|
|
42
|
+
/** Single source of truth for project + session + per-project settings */
|
|
43
|
+
workspace: WorkspaceService;
|
|
44
|
+
}
|
|
45
|
+
export interface CreateContextOptions {
|
|
46
|
+
mainWindow: BrowserWindow;
|
|
47
|
+
adapter?: CompilationAdapter;
|
|
48
|
+
preloadPath: string;
|
|
49
|
+
rendererDir: string;
|
|
50
|
+
panels?: string[];
|
|
51
|
+
apiNamespaces?: string[];
|
|
52
|
+
appName?: string;
|
|
53
|
+
toolbarActions?: WorkbenchContext['toolbarActions'];
|
|
54
|
+
brandingProvider?: WorkbenchContext['brandingProvider'];
|
|
55
|
+
}
|
|
56
|
+
export declare function hasBuiltinPanel(ctx: Pick<WorkbenchContext, 'panels'>, panelId: string): boolean;
|
|
57
|
+
export declare function getDefaultTab(ctx: Pick<WorkbenchContext, 'panels'>): string;
|
|
58
|
+
export declare function createWorkbenchContext(opts: CreateContextOptions): WorkbenchContext;
|
|
59
|
+
//# sourceMappingURL=workbench-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workbench-context.d.ts","sourceRoot":"","sources":["../../../src/main/services/workbench-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAE/D,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAqB,KAAK,WAAW,EAA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C,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;IACnD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;CACxD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAE/F;AAED,wBAAgB,aAAa,CAC3B,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GACpC,MAAM,CAIR;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,gBAAgB,CAmBnF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defaultAdapter } from './default-adapter.js';
|
|
2
|
+
import { createRendererNotifier, } from './notifications/renderer-notifier.js';
|
|
3
|
+
import { createViewManager } from './views/view-manager.js';
|
|
4
|
+
import { createWorkspaceService, } from './workspace/workspace-service.js';
|
|
5
|
+
export function hasBuiltinPanel(ctx, panelId) {
|
|
6
|
+
return ctx.panels.includes(panelId);
|
|
7
|
+
}
|
|
8
|
+
export function getDefaultTab(ctx) {
|
|
9
|
+
if (hasBuiltinPanel(ctx, 'console'))
|
|
10
|
+
return 'simulator';
|
|
11
|
+
if (ctx.panels.length > 0)
|
|
12
|
+
return ctx.panels[0];
|
|
13
|
+
return 'simulator';
|
|
14
|
+
}
|
|
15
|
+
export function createWorkbenchContext(opts) {
|
|
16
|
+
const ctx = {
|
|
17
|
+
mainWindow: opts.mainWindow,
|
|
18
|
+
adapter: opts.adapter ?? defaultAdapter,
|
|
19
|
+
preloadPath: opts.preloadPath,
|
|
20
|
+
rendererDir: opts.rendererDir,
|
|
21
|
+
panels: opts.panels ?? ['wxml', 'console', 'appdata', 'storage'],
|
|
22
|
+
apiNamespaces: opts.apiNamespaces ?? [],
|
|
23
|
+
appName: opts.appName ?? 'Dimina DevTools',
|
|
24
|
+
toolbarActions: opts.toolbarActions,
|
|
25
|
+
brandingProvider: opts.brandingProvider,
|
|
26
|
+
workbenchSettingsWindow: null,
|
|
27
|
+
};
|
|
28
|
+
ctx.views = createViewManager(ctx);
|
|
29
|
+
ctx.notify = createRendererNotifier(ctx);
|
|
30
|
+
ctx.workspace = createWorkspaceService(ctx);
|
|
31
|
+
return ctx;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=workbench-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workbench-context.js","sourceRoot":"","sources":["../../../src/main/services/workbench-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EACL,sBAAsB,GAEvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAoB,MAAM,yBAAyB,CAAA;AAC7E,OAAO,EACL,sBAAsB,GAEvB,MAAM,kCAAkC,CAAA;AAsDzC,MAAM,UAAU,eAAe,CAAC,GAAqC,EAAE,OAAe;IACpF,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,GAAqC;IAErC,IAAI,eAAe,CAAC,GAAG,EAAE,SAAS,CAAC;QAAE,OAAO,WAAW,CAAA;IACvD,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAA;IAChD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAA0B;IAC/D,MAAM,GAAG,GAAG;QACV,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,cAAc;QACvC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;QAChE,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE;QACvC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,iBAAiB;QAC1C,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QAEvC,uBAAuB,EAAE,IAAI;KACV,CAAA;IAErB,GAAG,CAAC,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;IAClC,GAAG,CAAC,MAAM,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAA;IACxC,GAAG,CAAC,SAAS,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC3C,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/main/services/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/main/services/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAGvB,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CompileConfig } from '../../../shared/types.js';
|
|
2
|
+
import type { WorkbenchContext } from '../workbench-context.js';
|
|
3
|
+
import type { Project, ProjectPages, ProjectSettings } from '../projects/project-repository.js';
|
|
4
|
+
/**
|
|
5
|
+
* Result returned to the renderer after `project:open` finishes.
|
|
6
|
+
* Mirrors the previous inline shape in ipc/session.ts so no
|
|
7
|
+
* renderer-side change is required.
|
|
8
|
+
*/
|
|
9
|
+
export interface OpenProjectResult {
|
|
10
|
+
success: boolean;
|
|
11
|
+
port?: number;
|
|
12
|
+
appInfo?: unknown;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The single source of truth for project + session + project-settings.
|
|
17
|
+
*
|
|
18
|
+
* Responsibilities:
|
|
19
|
+
* - list / add / remove projects (delegates to the repository module for fs)
|
|
20
|
+
* - open / close the active project session (drives the adapter, owns
|
|
21
|
+
* session and project-path state in a private closure)
|
|
22
|
+
* - read / write per-project compile + project.config.json settings
|
|
23
|
+
*
|
|
24
|
+
* IPC handlers, menu items and other callers must go through this service
|
|
25
|
+
* rather than touching the repository or adapter directly.
|
|
26
|
+
*/
|
|
27
|
+
export interface WorkspaceService {
|
|
28
|
+
listProjects(): Project[];
|
|
29
|
+
addProject(dirPath: string): Project;
|
|
30
|
+
removeProject(dirPath: string): void;
|
|
31
|
+
validateProjectDir(dirPath: string): string | null;
|
|
32
|
+
openProject(projectPath: string): Promise<OpenProjectResult>;
|
|
33
|
+
closeProject(): Promise<void>;
|
|
34
|
+
getSession(): {
|
|
35
|
+
close: () => Promise<void>;
|
|
36
|
+
port: number;
|
|
37
|
+
appInfo: unknown;
|
|
38
|
+
} | null;
|
|
39
|
+
getProjectPath(): string;
|
|
40
|
+
hasActiveSession(): boolean;
|
|
41
|
+
getProjectPages(projectPath: string): ProjectPages;
|
|
42
|
+
getCompileConfig(projectPath: string): CompileConfig;
|
|
43
|
+
saveCompileConfig(projectPath: string, config: CompileConfig): void;
|
|
44
|
+
getProjectSettings(projectPath: string): ProjectSettings;
|
|
45
|
+
updateProjectSettings(projectPath: string, patch: Partial<ProjectSettings>): void;
|
|
46
|
+
}
|
|
47
|
+
/** Build a workspace service bound to the given workbench context. */
|
|
48
|
+
export declare function createWorkspaceService(ctx: WorkbenchContext): WorkspaceService;
|
|
49
|
+
//# sourceMappingURL=workspace-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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