@dimina-kit/devtools 0.4.0-dev.20260803105710 → 0.4.0-dev.20260828092243
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/dist/main/api.d.ts +1 -1
- package/dist/main/app/app.js +66 -2
- package/dist/main/index.bundle.js +1454 -540
- package/dist/main/ipc/index.d.ts +3 -0
- package/dist/main/ipc/index.js +3 -0
- package/dist/main/ipc/popover.js +1 -1
- package/dist/main/ipc/project-create.d.ts +15 -0
- package/dist/main/ipc/project-create.js +26 -0
- package/dist/main/ipc/projects.d.ts +1 -1
- package/dist/main/ipc/projects.js +11 -0
- package/dist/main/ipc/session.js +11 -0
- package/dist/main/ipc/settings.js +2 -1
- package/dist/main/ipc/simulator-module.d.ts +4 -3
- package/dist/main/ipc/simulator-module.js +4 -5
- package/dist/main/ipc/tooltip.d.ts +13 -0
- package/dist/main/ipc/tooltip.js +28 -0
- package/dist/main/ipc/views.d.ts +15 -1
- package/dist/main/ipc/views.js +61 -4
- package/dist/main/runtime/miniapp-runtime.d.ts +87 -19
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +2 -1
- package/dist/main/services/notifications/renderer-notifier.d.ts +32 -1
- package/dist/main/services/notifications/renderer-notifier.js +29 -1
- package/dist/main/services/projects/project-repository.d.ts +4 -1
- package/dist/main/services/projects/project-repository.js +63 -5
- 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/update/update-manager.d.ts +17 -3
- package/dist/main/services/update/update-manager.js +25 -6
- 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 +79 -130
- package/dist/main/services/views/console-filter.js +140 -183
- 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/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 +107 -0
- package/dist/main/services/views/host-slot-port-channel.js +261 -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 +123 -0
- package/dist/main/services/views/native-simulator-devtools-host.js +64 -45
- package/dist/main/services/views/native-simulator-view.js +6 -24
- 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 +50 -4
- package/dist/main/services/views/overlay-panels-view.js +226 -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/view-manager-devtools-host-test-fixtures.js +3 -1
- package/dist/main/services/views/view-manager.d.ts +14 -86
- package/dist/main/services/views/view-manager.js +41 -4
- package/dist/main/services/views/workbench-view.js +27 -20
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +32 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +21 -8
- package/dist/main/services/workspace/rebuild-status.js +24 -8
- package/dist/main/utils/paths.d.ts +4 -0
- package/dist/main/utils/paths.js +4 -0
- package/dist/main/utils/sender-policy.d.ts +1 -1
- package/dist/main/utils/sender-policy.js +16 -1
- package/dist/main/utils/theme.d.ts +7 -2
- package/dist/main/utils/theme.js +8 -3
- package/dist/native-host/common/common.js +65 -62
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +3226 -2898
- package/dist/native-host/service/service.js +2 -2
- 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/wait-for-slot-root.d.ts +20 -0
- package/dist/preload/runtime/wait-for-slot-root.js +52 -0
- package/dist/preload/windows/host-dialog-runtime.cjs +353 -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 +354 -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 +134 -51
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +3176 -14
- 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 +5 -2
- package/dist/preload/windows/simulator.cjs.map +2 -2
- package/dist/preload/windows/simulator.js +5 -2
- package/dist/renderer/assets/button-DsNqZm7o.js +2 -0
- package/dist/renderer/assets/constants-D7DfVqMp.js +2 -0
- package/dist/renderer/assets/constants-D8zsejFq.js +2 -0
- package/dist/renderer/assets/createLucideIcon-CYJeT1ji.js +2 -0
- package/dist/renderer/assets/dialog-pT4qWmka.js +46 -0
- package/dist/renderer/assets/dist-o70xmpc1.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-NvGZlE9O.js +2 -0
- package/dist/renderer/assets/index-zErhG3ta.js +5 -0
- package/dist/renderer/assets/input-4QxTXMZN.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-Blr5TNoB.js +2 -0
- package/dist/renderer/assets/jsx-runtime-B-3rq1y5.css +1 -0
- package/dist/renderer/assets/jsx-runtime-CqVdW3eg.js +9 -0
- package/dist/renderer/assets/popover-CJiSWwuE.js +2 -0
- package/dist/renderer/assets/project-api-DZ1Zi6EC.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-DMWNhw_1.js +2 -0
- package/dist/renderer/assets/select-C86pNcsu.js +2 -0
- package/dist/renderer/assets/settings-BoI8mLT1.js +2 -0
- package/dist/renderer/assets/settings-api-Bs_g4NHs.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-DHLLygqv.js +2 -0
- package/dist/renderer/assets/tooltip-BhAyY0T4.js +2 -0
- package/dist/renderer/assets/types-YYjkvane.js +2 -0
- package/dist/renderer/assets/updateDialog-DPum3wx1.js +2 -0
- package/dist/renderer/assets/utils-kfQov6Pa.js +2 -0
- package/dist/renderer/assets/view-api-DFhb2R8-.js +2 -0
- package/dist/renderer/assets/workbenchSettings-DrajRQUk.js +8 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +21 -0
- package/dist/renderer/entries/main/index.html +15 -7
- package/dist/renderer/entries/popover/index.html +10 -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-settings/index.html +11 -5
- package/dist/service-host/preload.cjs +10 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +1 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/ipc-channels-overlays.d.ts +156 -0
- package/dist/shared/ipc-channels-overlays.js +186 -0
- package/dist/shared/ipc-channels.d.ts +1 -67
- package/dist/shared/ipc-channels.js +9 -81
- package/dist/shared/ipc-schemas.d.ts +52 -0
- package/dist/shared/ipc-schemas.js +64 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/types.d.ts +17 -0
- package/dist/shared/view-ids.d.ts +9 -0
- package/dist/shared/view-ids.js +21 -0
- package/dist/simulator/assets/device-shell-CmtM1QxP.js +2 -0
- package/dist/simulator/assets/device-shell-iFZo1igL.css +1 -0
- package/dist/simulator/assets/{simulator-COIE6R49.js → simulator-CIobn3Mh.js} +6 -6
- package/dist/simulator/assets/{simulator-mini-app-BLn7XV8e.js → simulator-mini-app-CRe6n9br.js} +2 -2
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-C_cP602X.js +2 -0
- package/dist/simulator/simulator.html +3 -2
- package/dist/vscode-workbench/assets/__vite-browser-external-Bc1vizTf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-oHcwN53f.js → dist-CMfmHflW.js} +3 -3
- package/dist/vscode-workbench/assets/{iconv-lite-umd-CLMLpdGm.js → iconv-lite-umd-Bx8CgaZq.js} +1 -1
- package/dist/vscode-workbench/assets/{index-BE3UJdoH.js → index-CdG6YWhW.js} +436 -436
- package/dist/vscode-workbench/assets/{jschardet-BICW8PLJ.js → jschardet-M0qgd2lN.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +9 -8
- 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/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BBg3YI5b.js +0 -49
- package/dist/renderer/assets/input-xdmfv-eH.js +0 -2
- package/dist/renderer/assets/ipc-transport-B3EpmfNS.js +0 -9
- package/dist/renderer/assets/ipc-transport-Blac3sOj.css +0 -1
- package/dist/renderer/assets/popover-B88e2hkg.js +0 -2
- package/dist/renderer/assets/select-CD9CJyhI.js +0 -2
- package/dist/renderer/assets/settings-44hf0QtO.js +0 -2
- package/dist/renderer/assets/settings-api-pJKPuP1M.js +0 -2
- package/dist/renderer/assets/workbenchSettings-DKD5U1Ql.js +0 -8
- package/dist/simulator/assets/device-shell-Cw7c-IkG.js +0 -2
- package/dist/simulator/assets/device-shell-DbC5ccs8.css +0 -1
- package/dist/simulator/assets/jsx-runtime-DkKmJyBb.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -18
- package/dist/vscode-workbench/assets/__vite-browser-external-BON7qP59.js +0 -1
|
@@ -13,9 +13,36 @@ interface SnapshotSink {
|
|
|
13
13
|
views: DesiredView<DevtoolsExtra>[];
|
|
14
14
|
}): void;
|
|
15
15
|
}
|
|
16
|
+
interface OverlaySink {
|
|
17
|
+
showSettings(): Promise<void>;
|
|
18
|
+
showPopover(data: unknown): void;
|
|
19
|
+
showTooltip(data: {
|
|
20
|
+
anchor: Rect;
|
|
21
|
+
text: string;
|
|
22
|
+
}): void;
|
|
23
|
+
getSettingsWebContentsId(): number | null;
|
|
24
|
+
getPopoverWebContentsId(): number | null;
|
|
25
|
+
getTooltipWebContentsId(): number | null;
|
|
26
|
+
markOverlayReady(webContentsId: number): void;
|
|
27
|
+
applyTooltipMeasurement(webContentsId: number, measurement: {
|
|
28
|
+
requestId: number;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}): void;
|
|
32
|
+
}
|
|
16
33
|
export declare function hostToolbarBounds(mgr: SnapshotSink, rect: Rect): void;
|
|
34
|
+
export declare function hostSidebarBounds(mgr: SnapshotSink, rect: Rect): void;
|
|
17
35
|
export declare function simulatorDevtoolsBounds(mgr: SnapshotSink, rect: Rect): void;
|
|
18
36
|
export declare function workbenchBounds(mgr: SnapshotSink, rect: Rect): void;
|
|
37
|
+
export declare function showSettingsReady(mgr: OverlaySink): Promise<void>;
|
|
38
|
+
export declare function showPopoverReady(mgr: OverlaySink, data: unknown): void;
|
|
39
|
+
export declare function showTooltipReady(mgr: OverlaySink, data: {
|
|
40
|
+
anchor: Rect;
|
|
41
|
+
text: string;
|
|
42
|
+
}, size?: {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
}): void;
|
|
19
46
|
export declare function simulatorBounds(mgr: SnapshotSink, params: Rect & {
|
|
20
47
|
zoom: number;
|
|
21
48
|
}): void;
|
|
@@ -12,6 +12,7 @@ import { VIEW_ID, VIEW_LAYER } from '../../../shared/view-ids.js';
|
|
|
12
12
|
// pushes on one manager never look stale.
|
|
13
13
|
let globalEpoch = 0;
|
|
14
14
|
const desiredByMgr = new WeakMap();
|
|
15
|
+
const tooltipRequestByMgr = new WeakMap();
|
|
15
16
|
function toPlacement(r) {
|
|
16
17
|
return r.width > 0 && r.height > 0 ? { visible: true, bounds: r } : { visible: false };
|
|
17
18
|
}
|
|
@@ -27,12 +28,40 @@ function pushView(mgr, view, generation = 1) {
|
|
|
27
28
|
export function hostToolbarBounds(mgr, rect) {
|
|
28
29
|
pushView(mgr, { viewId: VIEW_ID.hostToolbar, placement: toPlacement(rect), layer: VIEW_LAYER.hostToolbar });
|
|
29
30
|
}
|
|
31
|
+
export function hostSidebarBounds(mgr, rect) {
|
|
32
|
+
pushView(mgr, { viewId: VIEW_ID.hostSidebar, placement: toPlacement(rect), layer: VIEW_LAYER.hostSidebar });
|
|
33
|
+
}
|
|
30
34
|
export function simulatorDevtoolsBounds(mgr, rect) {
|
|
31
35
|
pushView(mgr, { viewId: VIEW_ID.simulatorDevtools, placement: toPlacement(rect), layer: VIEW_LAYER.base });
|
|
32
36
|
}
|
|
33
37
|
export function workbenchBounds(mgr, rect) {
|
|
34
38
|
pushView(mgr, { viewId: VIEW_ID.workbench, placement: toPlacement(rect), layer: VIEW_LAYER.base });
|
|
35
39
|
}
|
|
40
|
+
export async function showSettingsReady(mgr) {
|
|
41
|
+
const shown = mgr.showSettings();
|
|
42
|
+
const webContentsId = mgr.getSettingsWebContentsId();
|
|
43
|
+
if (webContentsId === null)
|
|
44
|
+
throw new Error('settings view was not created');
|
|
45
|
+
mgr.markOverlayReady(webContentsId);
|
|
46
|
+
await shown;
|
|
47
|
+
}
|
|
48
|
+
export function showPopoverReady(mgr, data) {
|
|
49
|
+
mgr.showPopover(data);
|
|
50
|
+
const webContentsId = mgr.getPopoverWebContentsId();
|
|
51
|
+
if (webContentsId === null)
|
|
52
|
+
throw new Error('popover view was not created');
|
|
53
|
+
mgr.markOverlayReady(webContentsId);
|
|
54
|
+
}
|
|
55
|
+
export function showTooltipReady(mgr, data, size = { width: 80, height: 28 }) {
|
|
56
|
+
mgr.showTooltip(data);
|
|
57
|
+
const webContentsId = mgr.getTooltipWebContentsId();
|
|
58
|
+
if (webContentsId === null)
|
|
59
|
+
throw new Error('tooltip view was not created');
|
|
60
|
+
mgr.markOverlayReady(webContentsId);
|
|
61
|
+
const requestId = (tooltipRequestByMgr.get(mgr) ?? 0) + 1;
|
|
62
|
+
tooltipRequestByMgr.set(mgr, requestId);
|
|
63
|
+
mgr.applyTooltipMeasurement(webContentsId, { requestId, ...size });
|
|
64
|
+
}
|
|
36
65
|
export function simulatorBounds(mgr, params) {
|
|
37
66
|
const { zoom, ...rect } = params;
|
|
38
67
|
pushView(mgr, { viewId: VIEW_ID.simulator, placement: toPlacement(rect), layer: VIEW_LAYER.base, extra: { zoom } });
|
|
@@ -95,7 +95,9 @@ export function electronModuleMock() {
|
|
|
95
95
|
export function pathsModuleMock() {
|
|
96
96
|
return {
|
|
97
97
|
mainPreloadPath: '/stub/preload.js',
|
|
98
|
-
|
|
98
|
+
hostToolbarRuntimePreloadPath: '/stub/host-toolbar-preload.js',
|
|
99
|
+
hostSidebarRuntimePreloadPath: '/stub/host-sidebar-preload.js',
|
|
100
|
+
hostDialogRuntimePreloadPath: '/stub/host-dialog-preload.js',
|
|
99
101
|
cjsSiblingPreloadPath: (p) => p.replace(/\.js$/, '.cjs'),
|
|
100
102
|
devtoolsPackageRoot: '/stub/devtools-pkg-root',
|
|
101
103
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { WebContents } from 'electron';
|
|
2
2
|
import type { NativeDeviceInfo } from '../../../shared/ipc-channels.js';
|
|
3
3
|
import { type WorkbenchContext } from '../workbench-context.js';
|
|
4
|
-
import type { HostToolbarMessageSubscription } from './host-toolbar-port-channel.js';
|
|
5
4
|
import type { PlacementSnapshot } from '@dimina-kit/electron-deck/layout';
|
|
6
5
|
import type { DevtoolsExtra } from '../../../shared/view-ids.js';
|
|
6
|
+
import { type HostToolbarControl } from './host-toolbar-view.js';
|
|
7
|
+
import { type HostSidebarViewManagerMembers } from './host-sidebar-view.js';
|
|
8
|
+
import { type HostDialogViewManagerMembers } from './host-dialog-view.js';
|
|
9
|
+
import { type OverlayPanelsView, type TooltipShowPayload } from './overlay-panels-view.js';
|
|
10
|
+
export type { TooltipShowPayload };
|
|
7
11
|
export { resolveProjectEditorTarget, type ProjectEditorTarget, } from './resolve-project-editor-target.js';
|
|
8
12
|
/**
|
|
9
13
|
* Context surface used by the ViewManager. We only need a small slice of the
|
|
@@ -89,7 +93,7 @@ export interface ViewManagerContext {
|
|
|
89
93
|
* panels) and shares a single injected placement reconciler; this file wires
|
|
90
94
|
* them together and exposes their combined method surface.
|
|
91
95
|
*/
|
|
92
|
-
export interface ViewManager {
|
|
96
|
+
export interface ViewManager extends Pick<OverlayPanelsView, 'showSettings' | 'hideSettings' | 'showPopover' | 'hidePopover' | 'prepareTooltip' | 'showTooltip' | 'hideTooltip' | 'markOverlayReady' | 'applyTooltipMeasurement' | 'showProjectCreateDialog' | 'hideProjectCreateDialog' | 'showUpdateDialog' | 'hideUpdateDialog' | 'notifyUpdateDownloadProgress' | 'getProjectCreateDialogWebContentsId' | 'getUpdateDialogWebContentsId'>, HostSidebarViewManagerMembers, HostDialogViewManagerMembers {
|
|
93
97
|
/**
|
|
94
98
|
* NATIVE-HOST ONLY. Create the simulator itself as a top-level
|
|
95
99
|
* WebContentsView (not a renderer `<webview>` guest) loading `simulatorUrl`,
|
|
@@ -132,14 +136,6 @@ export interface ViewManager {
|
|
|
132
136
|
* `windows/views.ts` module, which every detach call relied on.
|
|
133
137
|
*/
|
|
134
138
|
detachSimulator(): void;
|
|
135
|
-
/** Lazy-create and show the settings overlay view. */
|
|
136
|
-
showSettings(): Promise<void>;
|
|
137
|
-
/** Remove the settings overlay view (kept around for next open). */
|
|
138
|
-
hideSettings(): void;
|
|
139
|
-
/** Create and show the popover overlay with the given init payload. */
|
|
140
|
-
showPopover(data: unknown): void;
|
|
141
|
-
/** Destroy the popover overlay and notify the renderer. */
|
|
142
|
-
hidePopover(): void;
|
|
143
139
|
/** Re-apply layout for every currently visible overlay (on window resize). */
|
|
144
140
|
repositionAll(): void;
|
|
145
141
|
/**
|
|
@@ -170,6 +166,8 @@ export interface ViewManager {
|
|
|
170
166
|
getSettingsWebContentsId(): number | null;
|
|
171
167
|
/** Return the webContents ID of the popover overlay if alive, else null. */
|
|
172
168
|
getPopoverWebContentsId(): number | null;
|
|
169
|
+
/** Return the webContents ID of the tooltip overlay if alive, else null. */
|
|
170
|
+
getTooltipWebContentsId(): number | null;
|
|
173
171
|
/**
|
|
174
172
|
* Return the webContents ID of the host-toolbar overlay if alive, else null.
|
|
175
173
|
* The host-toolbar WCV is the one overlay whose OWN renderer drives an IPC
|
|
@@ -206,6 +204,12 @@ export interface ViewManager {
|
|
|
206
204
|
* view tree.
|
|
207
205
|
*/
|
|
208
206
|
setPlacementSnapshot(snapshot: PlacementSnapshot<DevtoolsExtra>): void;
|
|
207
|
+
/**
|
|
208
|
+
* Hand out a fresh generation seed for a renderer bootstrap. See
|
|
209
|
+
* `PlacementReconciler.allocateGeneration`'s doc-comment for why this
|
|
210
|
+
* replaces a wall-clock (`Date.now()`) seed.
|
|
211
|
+
*/
|
|
212
|
+
allocatePlacementGeneration(): number;
|
|
209
213
|
/**
|
|
210
214
|
* Lazily create the workbench WebContentsView, load `<url>index.html`, and
|
|
211
215
|
* add it to the contentView. `url` is the COI server's base URL (trailing
|
|
@@ -265,82 +269,6 @@ export interface ViewManager {
|
|
|
265
269
|
*/
|
|
266
270
|
readonly hostToolbar: HostToolbarControl;
|
|
267
271
|
}
|
|
268
|
-
/**
|
|
269
|
-
* Height mode for the host-toolbar placeholder strip. `'auto'` (default): the
|
|
270
|
-
* session-resident advertiser's reports drive the height. `{ fixed }`: the
|
|
271
|
-
* host pins the height; advertiser reports are ignored until `'auto'` again.
|
|
272
|
-
*/
|
|
273
|
-
export type HostToolbarHeightMode = 'auto' | {
|
|
274
|
-
fixed: number;
|
|
275
|
-
};
|
|
276
|
-
/**
|
|
277
|
-
* The control object the downstream host uses to own the toolbar
|
|
278
|
-
* WebContentsView. Lazily backed by the view-manager's `hostToolbarView`.
|
|
279
|
-
*/
|
|
280
|
-
export interface HostToolbarControl {
|
|
281
|
-
/** Load a URL into the toolbar view (lazy-creates the view). */
|
|
282
|
-
loadURL(url: string): Promise<void>;
|
|
283
|
-
/** Load a local file into the toolbar view (lazy-creates the view). */
|
|
284
|
-
loadFile(path: string): Promise<void>;
|
|
285
|
-
/** The toolbar view's live WebContents, or null if not yet created/destroyed. */
|
|
286
|
-
readonly webContents: WebContents | null;
|
|
287
|
-
/** Remove the toolbar view from the contentView and reset it (kept alive). */
|
|
288
|
-
hide(): void;
|
|
289
|
-
/**
|
|
290
|
-
* The HOST's own `webPreferences.preload` for the toolbar view (purely
|
|
291
|
-
* additive). The framework's height-advertiser runtime does NOT ride
|
|
292
|
-
* `webPreferences.preload` — it is session-resident (registered on
|
|
293
|
-
* `session.defaultSession`, self-guarded by the `--dimina-host-toolbar`
|
|
294
|
-
* marker + `isMainFrame`), so a host preload set here coexists with it and
|
|
295
|
-
* never replaces it. Must be set before the view is (re)created (first
|
|
296
|
-
* `loadURL`/`loadFile`, or the next one after the host closed the
|
|
297
|
-
* webContents); `null` (default) means "no host preload" — it does not and
|
|
298
|
-
* cannot restore any built-in preload.
|
|
299
|
-
*/
|
|
300
|
-
setPreloadPath(path: string | null): void;
|
|
301
|
-
/**
|
|
302
|
-
* Register a host-side handler for messages the toolbar PAGE sends via
|
|
303
|
-
* `window.diminaHostToolbar.send(channel, payload)`. Control-level: may be
|
|
304
|
-
* called before the view exists and survives page reloads / wc rebuilds
|
|
305
|
-
* (each per-load MessagePort handshake re-attaches the registry to the new
|
|
306
|
-
* port). Throws on an empty / non-string channel. `dispose()` detaches
|
|
307
|
-
* (idempotent).
|
|
308
|
-
*/
|
|
309
|
-
onMessage(channel: string, handler: (payload: unknown) => void): HostToolbarMessageSubscription;
|
|
310
|
-
/**
|
|
311
|
-
* Observe handshake readiness — the push counterpart to polling `send()`
|
|
312
|
-
* for `true`. Fires the handler once per load generation, exactly when
|
|
313
|
-
* that load's MessagePort handshake completes; registering while the
|
|
314
|
-
* channel is ALREADY ready fires once asynchronously on a microtask
|
|
315
|
-
* (missed-signal race guard, re-validated at fire time). A reload /
|
|
316
|
-
* re-handshake fires registered handlers again; a host-initiated
|
|
317
|
-
* `loadURL`/`loadFile` invalidates readiness at initiation, so handlers
|
|
318
|
-
* registered in that window wait for the NEW document's handshake.
|
|
319
|
-
* `dispose()` detaches (idempotent); `disposeAll` sweeps everything.
|
|
320
|
-
*/
|
|
321
|
-
onReady(handler: () => void): HostToolbarMessageSubscription;
|
|
322
|
-
/**
|
|
323
|
-
* Post `{ channel, payload }` to the toolbar page (received via
|
|
324
|
-
* `window.diminaHostToolbar.onMessage(channel, handler)`). Gated and
|
|
325
|
-
* non-queueing: returns false — delivering nothing, creating no view —
|
|
326
|
-
* while there is no live toolbar webContents, the current load's
|
|
327
|
-
* MessagePort handshake hasn't completed, or a document-replacing
|
|
328
|
-
* navigation is in flight (`loadURL`/`loadFile` was issued, or the page
|
|
329
|
-
* itself started a main-frame cross-document navigation, and the new
|
|
330
|
-
* document hasn't handshaked yet); true once the envelope went out.
|
|
331
|
-
* No manual `getHostToolbarWebContentsId` gating needed: the false/true
|
|
332
|
-
* result IS the readiness signal.
|
|
333
|
-
*/
|
|
334
|
-
send(channel: string, payload: unknown): boolean;
|
|
335
|
-
/**
|
|
336
|
-
* Pin or unpin the toolbar strip height. `{ fixed }` notifies the renderer
|
|
337
|
-
* placeholder with that height immediately (so a preload-less/static toolbar
|
|
338
|
-
* is visible without any advertiser report) and ignores subsequent advertiser
|
|
339
|
-
* reports. `'auto'` (default) re-enables advertiser-driven height starting
|
|
340
|
-
* from the NEXT report — it does not synthesize/replay a stale height.
|
|
341
|
-
*/
|
|
342
|
-
setHeightMode(mode: HostToolbarHeightMode): void;
|
|
343
|
-
}
|
|
344
272
|
/**
|
|
345
273
|
* Build a ViewManager bound to the given context. The returned object is the
|
|
346
274
|
* only component allowed to instantiate or add/remove overlay WebContentsViews.
|
|
@@ -3,7 +3,9 @@ import { createPlacementReconciler } from './placement-reconciler.js';
|
|
|
3
3
|
import { createWorkbenchView } from './workbench-view.js';
|
|
4
4
|
import { createDevtoolsHost } from './native-simulator-devtools-host.js';
|
|
5
5
|
import { createHostToolbarView } from './host-toolbar-view.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createHostSidebarView } from './host-sidebar-view.js';
|
|
7
|
+
import { createHostDialogView } from './host-dialog-view.js';
|
|
8
|
+
import { createOverlayPanelsView, } from './overlay-panels-view.js';
|
|
7
9
|
import { createNativeSimulatorView } from './native-simulator-view.js';
|
|
8
10
|
export { resolveProjectEditorTarget, } from './resolve-project-editor-target.js';
|
|
9
11
|
/**
|
|
@@ -34,6 +36,11 @@ export function createViewManager(ctx) {
|
|
|
34
36
|
const hostToolbar = createHostToolbarView(ctx, reconciler, {
|
|
35
37
|
reapplyPresentOverlays: () => reapplyToolbarDependentOverlays(),
|
|
36
38
|
});
|
|
39
|
+
// Sidebar and dialog are host-scoped like the toolbar (survive project
|
|
40
|
+
// close/reopen) but carry no height-cycle dependency on the overlay panels,
|
|
41
|
+
// so unlike hostToolbar they need no thunk into this scope.
|
|
42
|
+
const hostSidebar = createHostSidebarView(ctx, reconciler);
|
|
43
|
+
const hostDialog = createHostDialogView(ctx, reconciler);
|
|
37
44
|
const overlayPanels = createOverlayPanelsView(ctx, reconciler, {
|
|
38
45
|
getHostToolbarHeight: hostToolbar.getHostToolbarHeight,
|
|
39
46
|
});
|
|
@@ -63,9 +70,15 @@ export function createViewManager(ctx) {
|
|
|
63
70
|
// a release/cap replay to rebuild.
|
|
64
71
|
workbench.cancelWorkbenchAttachHold();
|
|
65
72
|
disposeProjectViews();
|
|
66
|
-
// Host-scoped teardown: the toolbar
|
|
67
|
-
// ref-counted session-runtime preload
|
|
73
|
+
// Host-scoped teardown: the toolbar/sidebar/dialog views, their port
|
|
74
|
+
// channels, and their ref-counted session-runtime preload registrations.
|
|
68
75
|
hostToolbar.dispose();
|
|
76
|
+
hostSidebar.dispose();
|
|
77
|
+
hostDialog.dispose();
|
|
78
|
+
// Devtools-owned overlay-panel dialogs (project-create/update) — never
|
|
79
|
+
// torn down by disposeProjectViews(), they'd otherwise outlive every
|
|
80
|
+
// other view once the app tears down.
|
|
81
|
+
overlayPanels.destroyDialogs();
|
|
69
82
|
}
|
|
70
83
|
return {
|
|
71
84
|
attachNativeSimulator: nativeSimulator.attachNativeSimulator,
|
|
@@ -77,7 +90,22 @@ export function createViewManager(ctx) {
|
|
|
77
90
|
hideSettings: overlayPanels.hideSettings,
|
|
78
91
|
showPopover: overlayPanels.showPopover,
|
|
79
92
|
hidePopover: overlayPanels.hidePopover,
|
|
80
|
-
|
|
93
|
+
prepareTooltip: overlayPanels.prepareTooltip,
|
|
94
|
+
showTooltip: overlayPanels.showTooltip,
|
|
95
|
+
hideTooltip: overlayPanels.hideTooltip,
|
|
96
|
+
markOverlayReady: overlayPanels.markOverlayReady,
|
|
97
|
+
applyTooltipMeasurement: overlayPanels.applyTooltipMeasurement,
|
|
98
|
+
showProjectCreateDialog: overlayPanels.showProjectCreateDialog,
|
|
99
|
+
hideProjectCreateDialog: overlayPanels.hideProjectCreateDialog,
|
|
100
|
+
showUpdateDialog: overlayPanels.showUpdateDialog,
|
|
101
|
+
hideUpdateDialog: overlayPanels.hideUpdateDialog,
|
|
102
|
+
notifyUpdateDownloadProgress: overlayPanels.notifyUpdateDownloadProgress,
|
|
103
|
+
getProjectCreateDialogWebContentsId: overlayPanels.getProjectCreateDialogWebContentsId,
|
|
104
|
+
getUpdateDialogWebContentsId: overlayPanels.getUpdateDialogWebContentsId,
|
|
105
|
+
repositionAll: () => {
|
|
106
|
+
overlayPanels.reapplyPresentOverlays();
|
|
107
|
+
hostDialog.reposition();
|
|
108
|
+
},
|
|
81
109
|
disposeProjectViews,
|
|
82
110
|
disposeAll,
|
|
83
111
|
getSimulatorWebContentsId: nativeSimulator.getSimulatorWebContentsId,
|
|
@@ -86,10 +114,12 @@ export function createViewManager(ctx) {
|
|
|
86
114
|
getSettingsWebContents: overlayPanels.getSettingsWebContents,
|
|
87
115
|
getSettingsWebContentsId: overlayPanels.getSettingsWebContentsId,
|
|
88
116
|
getPopoverWebContentsId: overlayPanels.getPopoverWebContentsId,
|
|
117
|
+
getTooltipWebContentsId: overlayPanels.getTooltipWebContentsId,
|
|
89
118
|
getHostToolbarWebContentsId: hostToolbar.getHostToolbarWebContentsId,
|
|
90
119
|
getHostToolbarHeight: hostToolbar.getHostToolbarHeight,
|
|
91
120
|
resize: () => overlayPanels.applySettingsBoundsIfPresent(),
|
|
92
121
|
setPlacementSnapshot: reconciler.setPlacementSnapshot,
|
|
122
|
+
allocatePlacementGeneration: reconciler.allocateGeneration,
|
|
93
123
|
attachWorkbench: workbench.attachWorkbench,
|
|
94
124
|
setWorkbenchSource: workbench.setWorkbenchSource,
|
|
95
125
|
detachWorkbench: workbench.detachWorkbench,
|
|
@@ -98,6 +128,13 @@ export function createViewManager(ctx) {
|
|
|
98
128
|
cancelWorkbenchAttachHold: workbench.cancelWorkbenchAttachHold,
|
|
99
129
|
setHostToolbarHeight: hostToolbar.setHostToolbarHeight,
|
|
100
130
|
hostToolbar: hostToolbar.control,
|
|
131
|
+
getHostSidebarWebContentsId: hostSidebar.getHostSidebarWebContentsId,
|
|
132
|
+
getHostSidebarWidth: hostSidebar.getHostSidebarWidth,
|
|
133
|
+
setHostSidebarWidth: hostSidebar.setHostSidebarWidth,
|
|
134
|
+
hostSidebar: hostSidebar.control,
|
|
135
|
+
getHostDialogWebContentsId: hostDialog.getHostDialogWebContentsId,
|
|
136
|
+
reportHostDialogMeasuredExtent: hostDialog.reportMeasuredExtent,
|
|
137
|
+
hostDialog: hostDialog.control,
|
|
101
138
|
};
|
|
102
139
|
}
|
|
103
140
|
//# sourceMappingURL=view-manager.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { nativeTheme, WebContentsView } from 'electron';
|
|
2
2
|
import { handleWindowOpenExternal } from '../../windows/navigation-hardening.js';
|
|
3
|
+
import { themeBg } from '../../utils/theme.js';
|
|
3
4
|
import { VIEW_ID } from '../../../shared/view-ids.js';
|
|
4
|
-
import { destroyChildView } from './destroy-child-view.js';
|
|
5
5
|
/**
|
|
6
6
|
* Upper bound on how long a hold may defer the workbench attach. A hung or
|
|
7
7
|
* very slow first compile (or a lost release on some open path) degrades to a
|
|
@@ -45,6 +45,14 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
45
45
|
if (!workbenchView || workbenchView.webContents.isDestroyed())
|
|
46
46
|
return;
|
|
47
47
|
const wc = workbenchView.webContents;
|
|
48
|
+
// Keep the WCV surface in sync with the active color scheme: the workbench
|
|
49
|
+
// page can only recolor its own inner #workbench, never the html/body
|
|
50
|
+
// backdrop, so the native surface must follow the theme flip too.
|
|
51
|
+
try {
|
|
52
|
+
if (typeof workbenchView.setBackgroundColor === 'function')
|
|
53
|
+
workbenchView.setBackgroundColor(themeBg());
|
|
54
|
+
}
|
|
55
|
+
catch { /* view/wc gone mid-flip */ }
|
|
48
56
|
if (typeof wc.executeJavaScript !== 'function')
|
|
49
57
|
return;
|
|
50
58
|
const script = `window.__WB_SET_THEME && window.__WB_SET_THEME(${JSON.stringify(workbenchThemeScheme())})`;
|
|
@@ -61,6 +69,17 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
61
69
|
},
|
|
62
70
|
});
|
|
63
71
|
workbenchView = view;
|
|
72
|
+
// Paint the WCV surface the themed window background (themeBg(): dark
|
|
73
|
+
// #1a1a1a / light #fafafa) so the boot screen ("booting workbench…") and
|
|
74
|
+
// any layout gap never flash a mismatched white strip before the workbench
|
|
75
|
+
// CSS loads. The workbench is a plain WebContentsView (not a BrowserWindow),
|
|
76
|
+
// so the process-wide installThemeBackgroundSync() never reaches it — match
|
|
77
|
+
// the main window's own backgroundColor here, and re-sync on every theme
|
|
78
|
+
// flip below.
|
|
79
|
+
try {
|
|
80
|
+
view.setBackgroundColor(themeBg());
|
|
81
|
+
}
|
|
82
|
+
catch { /* view not ready for a bg yet */ }
|
|
64
83
|
// Track devtools theme flips for the lifetime of the workbench view only —
|
|
65
84
|
// registered here (not at construction) so test electron mocks that omit
|
|
66
85
|
// `nativeTheme` and never open the editor stay unaffected. Removed in
|
|
@@ -76,9 +95,13 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
76
95
|
view.webContents.setWindowOpenHandler(({ url: target }) => handleWindowOpenExternal(target));
|
|
77
96
|
}
|
|
78
97
|
catch { /* stub may lack it */ }
|
|
79
|
-
ctx.windows.mainWindow.contentView.addChildView(view);
|
|
80
98
|
// Hand the workbench the current devtools scheme as a URL query so its very
|
|
81
99
|
// first paint already matches (the runtime setter only exists post-init).
|
|
100
|
+
// The project identity deliberately does NOT ride this URL: the attach can
|
|
101
|
+
// happen before the open commits a session (the gate self-releases after
|
|
102
|
+
// ATTACH_HOLD_CAP_MS on a slow compile, and the release fires just ahead of
|
|
103
|
+
// the commit), so the page polls it from the COI server's `/__project`
|
|
104
|
+
// instead — see workbench-coi-server.ts.
|
|
82
105
|
const loadUrl = `${url}index.html?theme=${workbenchThemeScheme()}`;
|
|
83
106
|
await view.webContents.loadURL(loadUrl).catch((err) => {
|
|
84
107
|
console.error('[workbench] attachWorkbench — loadURL failed', err);
|
|
@@ -140,17 +163,9 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
140
163
|
nativeTheme.removeListener('updated', pushWorkbenchTheme);
|
|
141
164
|
workbenchThemeSyncBound = false;
|
|
142
165
|
}
|
|
143
|
-
|
|
166
|
+
reconciler.destroyView(VIEW_ID.workbench, workbenchView);
|
|
144
167
|
workbenchView = null;
|
|
145
|
-
if (attachHeld) {
|
|
146
|
-
// A held detach is a project-switch teardown: the renderer published the
|
|
147
|
-
// incoming project's placement before the open started, so that desired
|
|
148
|
-
// is the ONLY thing the release replay can rebuild the view from — keep
|
|
149
|
-
// it (gateHidden hides it while held) and just forget the destroyed
|
|
150
|
-
// instance so the rebuilt view is treated as a fresh attach.
|
|
151
|
-
reconciler.forgetActual(VIEW_ID.workbench);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
168
|
+
if (!attachHeld) {
|
|
154
169
|
reconciler.deleteBaseDesired(VIEW_ID.workbench);
|
|
155
170
|
}
|
|
156
171
|
reconciler.reconcileNow();
|
|
@@ -232,14 +247,6 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
232
247
|
reconciler.registerView(VIEW_ID.workbench, {
|
|
233
248
|
getView: () => workbenchView,
|
|
234
249
|
gateHidden: () => !workbenchView && (!workbenchUrl || attachHeld),
|
|
235
|
-
beforeAttach: () => {
|
|
236
|
-
if (!workbenchView && workbenchUrl && !attachHeld) {
|
|
237
|
-
// Lazy-load the workbench; attachWorkbench adds it to the contentView.
|
|
238
|
-
void attachWorkbench(workbenchUrl);
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
return false;
|
|
242
|
-
},
|
|
243
250
|
ensureLazy: (desired) => {
|
|
244
251
|
if (desired?.placement.visible && !workbenchView && workbenchUrl && !attachHeld)
|
|
245
252
|
void attachWorkbench(workbenchUrl);
|
|
@@ -21,6 +21,17 @@ export interface WorkbenchCoiServerOptions {
|
|
|
21
21
|
* for none (built-in `wx*` associations only).
|
|
22
22
|
*/
|
|
23
23
|
getFileTypes?: () => unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Reads the active project's identity — `appId` (null until the open commits
|
|
26
|
+
* a session) plus its root path — served at `/__project` as the workspace id
|
|
27
|
+
* the editor names its VS Code workspace after. Read per-request, because the
|
|
28
|
+
* editor page can load BEFORE the project commits (see `/__project` below).
|
|
29
|
+
* Omit when the host has no project identity to offer.
|
|
30
|
+
*/
|
|
31
|
+
getProjectIdentity?: () => {
|
|
32
|
+
appId: string | null;
|
|
33
|
+
projectPath: string;
|
|
34
|
+
};
|
|
24
35
|
}
|
|
25
36
|
export declare function startWorkbenchCoiServer(options: WorkbenchCoiServerOptions): Promise<WorkbenchCoiServer>;
|
|
26
37
|
//# sourceMappingURL=workbench-coi-server.d.ts.map
|
|
@@ -39,6 +39,7 @@ import path from 'node:path';
|
|
|
39
39
|
import { readFileBufferWithin, writeFileWithin, statWithin, readdirWithin, mkdirWithin, deleteWithin, renameWithin, SKIP_DIRS, } from '../ipc/project-fs.js';
|
|
40
40
|
import { handleFsWatchRequest } from './fs-watch-sse.js';
|
|
41
41
|
import { jsonRes } from './http-json.js';
|
|
42
|
+
import { miniappPartitionKey } from './views/miniapp-partition.js';
|
|
42
43
|
/** Max `/__fs/write` body; enough to save large source files without OOM. */
|
|
43
44
|
const MAX_FS_WRITE_BYTES = 32 * 1024 * 1024;
|
|
44
45
|
const MIME = {
|
|
@@ -337,6 +338,21 @@ async function readContributedExtensions(extensionsDir) {
|
|
|
337
338
|
}
|
|
338
339
|
return out;
|
|
339
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* The `/__project` workspace id: the miniapp partition key of the active
|
|
343
|
+
* project, or null when there is no committed project identity yet.
|
|
344
|
+
*
|
|
345
|
+
* Reuses `miniappPartitionKey` (the same derivation the per-project Electron
|
|
346
|
+
* session partition uses) so the editor's storage bucket and the runtime's
|
|
347
|
+
* storage partition are named off the same project identity: the `appId`,
|
|
348
|
+
* disambiguated by the project path because `appId` comes from the manifest and
|
|
349
|
+
* two checkouts can declare the same one.
|
|
350
|
+
*/
|
|
351
|
+
function workspaceIdOf(identity) {
|
|
352
|
+
if (!identity?.appId)
|
|
353
|
+
return null;
|
|
354
|
+
return miniappPartitionKey(identity.appId, identity.projectPath || null);
|
|
355
|
+
}
|
|
340
356
|
export async function startWorkbenchCoiServer(options) {
|
|
341
357
|
const root = path.resolve(options.rootDir);
|
|
342
358
|
const contribRoot = options.extensionsDir ? path.resolve(options.extensionsDir) : null;
|
|
@@ -362,6 +378,22 @@ export async function startWorkbenchCoiServer(options) {
|
|
|
362
378
|
jsonRes(res, 200, options.getFileTypes?.() ?? {});
|
|
363
379
|
return;
|
|
364
380
|
}
|
|
381
|
+
// Identity of the active project, as the id the editor names its VS Code
|
|
382
|
+
// workspace after. Every project is mirrored at the same constant
|
|
383
|
+
// `file:///workspace` root, and VS Code keys WORKSPACE-scope storage (open
|
|
384
|
+
// editors, view state, explorer expansion) off the workspace identity — so
|
|
385
|
+
// without a distinct id per project, one project's tabs are restored into
|
|
386
|
+
// the next, stranded behind "the file was not found".
|
|
387
|
+
//
|
|
388
|
+
// Served here rather than baked into the editor's load URL because the
|
|
389
|
+
// editor view can attach BEFORE the open commits its session (its attach
|
|
390
|
+
// gate self-releases on a slow compile), when there is no identity to hand
|
|
391
|
+
// it; `null` then tells the page to keep polling, the same way its disk
|
|
392
|
+
// mirror already polls `/__fs` for the project root to appear.
|
|
393
|
+
if (url.pathname === '/__project') {
|
|
394
|
+
jsonRes(res, 200, { workspaceId: workspaceIdOf(options.getProjectIdentity?.()) });
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
365
397
|
// Host-contributed web extensions: manifest + static files (same-origin so
|
|
366
398
|
// they satisfy the workbench's COEP require-corp).
|
|
367
399
|
if (url.pathname.startsWith('/__contrib/')) {
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Decide and emit the post-rebuild status for one
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
2
|
+
* Decide and emit the post-rebuild status for one completed rebuild.
|
|
3
|
+
*
|
|
4
|
+
* Explicit rebuild (`info.explicit` — the 重新编译 button, via
|
|
5
|
+
* `session.rebuild()`): the renderer's own relaunch drives a hard re-attach
|
|
6
|
+
* once the rebuild IPC resolves, and that re-attach is the run's ONLY
|
|
7
|
+
* reflection. Emitting `hotReload: true` here as well would race a soft
|
|
8
|
+
* reload against it — the two arrive through different channels with no
|
|
9
|
+
* ordering guarantee, so the soft reload can land AFTER the hard re-attach
|
|
10
|
+
* and drag the simulator back to the drifted page. The style fast path is a
|
|
11
|
+
* soft-update path too and is skipped for the same reason.
|
|
12
|
+
*
|
|
13
|
+
* Watcher rebuild (explicit absent/false) — style-only fast path: hot-swap the
|
|
14
|
+
* render-host stylesheets in place instead of respawning the DeviceShell —
|
|
15
|
+
* page stack / form state / scroll / focus survive (no jitter, no focus
|
|
16
|
+
* steal); `hotReload: false` keeps the renderer from bumping its reload token
|
|
17
|
+
* (the respawn signal). Falls through to the full reload when the swap can't
|
|
18
|
+
* run (no live render guest yet) so an edit is never dropped.
|
|
19
|
+
*
|
|
20
|
+
* `getProjectPages` never throws; empty pages are withheld so the renderer
|
|
21
|
+
* keeps its previous launch dropdown.
|
|
10
22
|
*/
|
|
11
23
|
export declare function reportRebuildStatus(info: {
|
|
12
24
|
styleOnly?: boolean;
|
|
25
|
+
explicit?: boolean;
|
|
13
26
|
} | undefined, deps: {
|
|
14
27
|
projectPath: string;
|
|
15
28
|
repo: {
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Decide and emit the post-rebuild status for one
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
2
|
+
* Decide and emit the post-rebuild status for one completed rebuild.
|
|
3
|
+
*
|
|
4
|
+
* Explicit rebuild (`info.explicit` — the 重新编译 button, via
|
|
5
|
+
* `session.rebuild()`): the renderer's own relaunch drives a hard re-attach
|
|
6
|
+
* once the rebuild IPC resolves, and that re-attach is the run's ONLY
|
|
7
|
+
* reflection. Emitting `hotReload: true` here as well would race a soft
|
|
8
|
+
* reload against it — the two arrive through different channels with no
|
|
9
|
+
* ordering guarantee, so the soft reload can land AFTER the hard re-attach
|
|
10
|
+
* and drag the simulator back to the drifted page. The style fast path is a
|
|
11
|
+
* soft-update path too and is skipped for the same reason.
|
|
12
|
+
*
|
|
13
|
+
* Watcher rebuild (explicit absent/false) — style-only fast path: hot-swap the
|
|
14
|
+
* render-host stylesheets in place instead of respawning the DeviceShell —
|
|
15
|
+
* page stack / form state / scroll / focus survive (no jitter, no focus
|
|
16
|
+
* steal); `hotReload: false` keeps the renderer from bumping its reload token
|
|
17
|
+
* (the respawn signal). Falls through to the full reload when the swap can't
|
|
18
|
+
* run (no live render guest yet) so an edit is never dropped.
|
|
19
|
+
*
|
|
20
|
+
* `getProjectPages` never throws; empty pages are withheld so the renderer
|
|
21
|
+
* keeps its previous launch dropdown.
|
|
10
22
|
*/
|
|
11
23
|
export function reportRebuildStatus(info, deps) {
|
|
12
24
|
const { pages } = deps.repo.getProjectPages(deps.projectPath);
|
|
13
25
|
const pageList = pages.length ? pages : undefined;
|
|
26
|
+
if (info?.explicit) {
|
|
27
|
+
deps.sendStatus('ready', '编译完成', false, pageList);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
14
30
|
if (info?.styleOnly && deps.autoReload && deps.refreshSimulatorStyles()) {
|
|
15
31
|
deps.sendStatus('ready', '样式已热更新', false, pageList);
|
|
16
32
|
return;
|
|
@@ -31,6 +31,10 @@ export declare const mainPreloadPath: string;
|
|
|
31
31
|
* npm/pnpm node_modules and ASAR packaging alike get an absolute, correct path.
|
|
32
32
|
*/
|
|
33
33
|
export declare const hostToolbarRuntimePreloadPath: string;
|
|
34
|
+
/** Session-registered sidebar-runtime preload bundle, mirroring {@link hostToolbarRuntimePreloadPath}. */
|
|
35
|
+
export declare const hostSidebarRuntimePreloadPath: string;
|
|
36
|
+
/** Session-registered dialog-runtime preload bundle, mirroring {@link hostToolbarRuntimePreloadPath}. */
|
|
37
|
+
export declare const hostDialogRuntimePreloadPath: string;
|
|
34
38
|
export declare const simulatorDir: string;
|
|
35
39
|
/**
|
|
36
40
|
* DevTools builds its own copy of every native mini-app runtime asset. Pin the
|
package/dist/main/utils/paths.js
CHANGED
|
@@ -59,6 +59,10 @@ export const mainPreloadPath = path.join(devtoolsPackageRoot, 'dist/preload/wind
|
|
|
59
59
|
* npm/pnpm node_modules and ASAR packaging alike get an absolute, correct path.
|
|
60
60
|
*/
|
|
61
61
|
export const hostToolbarRuntimePreloadPath = path.join(devtoolsPackageRoot, 'dist/preload/windows/host-toolbar-runtime.cjs');
|
|
62
|
+
/** Session-registered sidebar-runtime preload bundle, mirroring {@link hostToolbarRuntimePreloadPath}. */
|
|
63
|
+
export const hostSidebarRuntimePreloadPath = path.join(devtoolsPackageRoot, 'dist/preload/windows/host-sidebar-runtime.cjs');
|
|
64
|
+
/** Session-registered dialog-runtime preload bundle, mirroring {@link hostToolbarRuntimePreloadPath}. */
|
|
65
|
+
export const hostDialogRuntimePreloadPath = path.join(devtoolsPackageRoot, 'dist/preload/windows/host-dialog-runtime.cjs');
|
|
62
66
|
export const simulatorDir = path.join(devtoolsPackageRoot, 'dist/simulator');
|
|
63
67
|
/**
|
|
64
68
|
* DevTools builds its own copy of every native mini-app runtime asset. Pin the
|
|
@@ -8,7 +8,7 @@ import type { SenderPolicy } from './ipc-registry.js';
|
|
|
8
8
|
* - the main window's renderer
|
|
9
9
|
* - the optional workbench settings BrowserWindow's renderer (when open)
|
|
10
10
|
* - the settings overlay view (when open)
|
|
11
|
-
* - the popover overlay
|
|
11
|
+
* - the popover and tooltip overlay views (when open)
|
|
12
12
|
*
|
|
13
13
|
* The simulator webview is intentionally NOT on this list. Anything it
|
|
14
14
|
* needs from main (currently just the custom-apis bridge — see
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - the main window's renderer
|
|
7
7
|
* - the optional workbench settings BrowserWindow's renderer (when open)
|
|
8
8
|
* - the settings overlay view (when open)
|
|
9
|
-
* - the popover overlay
|
|
9
|
+
* - the popover and tooltip overlay views (when open)
|
|
10
10
|
*
|
|
11
11
|
* The simulator webview is intentionally NOT on this list. Anything it
|
|
12
12
|
* needs from main (currently just the custom-apis bridge — see
|
|
@@ -49,6 +49,21 @@ export function createWorkbenchSenderPolicy(ctx) {
|
|
|
49
49
|
const popoverViewId = ctx.views.getPopoverWebContentsId();
|
|
50
50
|
if (popoverViewId != null && sender.id === popoverViewId)
|
|
51
51
|
return true;
|
|
52
|
+
// Tooltip overlay view. It loads only the bundled local renderer and needs
|
|
53
|
+
// the shared overlay-ready + intrinsic-measurement channels.
|
|
54
|
+
const tooltipViewId = ctx.views.getTooltipWebContentsId();
|
|
55
|
+
if (tooltipViewId != null && sender.id === tooltipViewId)
|
|
56
|
+
return true;
|
|
57
|
+
// Project-create-dialog overlay view. Devtools-owned bundled renderer
|
|
58
|
+
// (the WCV that replaced the Radix DOM-portal dialog), same trust level
|
|
59
|
+
// as settings/popover/tooltip.
|
|
60
|
+
const projectCreateDialogViewId = ctx.views.getProjectCreateDialogWebContentsId();
|
|
61
|
+
if (projectCreateDialogViewId != null && sender.id === projectCreateDialogViewId)
|
|
62
|
+
return true;
|
|
63
|
+
// Update-available overlay view. Same devtools-owned trust level.
|
|
64
|
+
const updateDialogViewId = ctx.views.getUpdateDialogWebContentsId();
|
|
65
|
+
if (updateDialogViewId != null && sender.id === updateDialogViewId)
|
|
66
|
+
return true;
|
|
52
67
|
// The host-toolbar overlay is DELIBERATELY NOT trusted here. The host loads
|
|
53
68
|
// arbitrary content into it, so granting it the global white-list would open
|
|
54
69
|
// all ~72 IpcRegistry channels to that content. Its one channel (the reverse
|