@dimina-kit/devtools 0.4.0-dev.20260615070430 → 0.4.0-dev.20260616024534

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +0 -82
  2. package/dist/main/api.d.ts +1 -1
  3. package/dist/main/app/app.d.ts +0 -4
  4. package/dist/main/app/app.js +11 -6
  5. package/dist/main/app/lifecycle.d.ts +1 -0
  6. package/dist/main/app/lifecycle.js +10 -0
  7. package/dist/main/index.bundle.js +111 -143
  8. package/dist/main/ipc/app.d.ts +1 -3
  9. package/dist/main/ipc/app.js +0 -80
  10. package/dist/main/runtime/miniapp-runtime.d.ts +4 -2
  11. package/dist/main/services/notifications/renderer-notifier.d.ts +0 -4
  12. package/dist/main/services/notifications/renderer-notifier.js +1 -7
  13. package/dist/main/services/safe-area/index.d.ts +6 -4
  14. package/dist/main/services/safe-area/index.js +20 -14
  15. package/dist/main/services/simulator-storage/index.js +4 -2
  16. package/dist/main/services/views/view-manager.js +40 -8
  17. package/dist/main/services/workbench-context.d.ts +10 -13
  18. package/dist/main/services/workbench-context.js +1 -4
  19. package/dist/main/services/workspace/workspace-service.js +13 -0
  20. package/dist/main/utils/theme.d.ts +15 -0
  21. package/dist/main/utils/theme.js +34 -1
  22. package/dist/main/windows/main-window/create.d.ts +6 -0
  23. package/dist/main/windows/main-window/create.js +5 -1
  24. package/dist/preload/runtime/native-host.d.ts +3 -0
  25. package/dist/preload/runtime/native-host.js +2 -0
  26. package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
  27. package/dist/preload/windows/main.cjs +3 -3
  28. package/dist/preload/windows/main.cjs.map +2 -2
  29. package/dist/preload/windows/simulator.cjs +1 -0
  30. package/dist/preload/windows/simulator.cjs.map +2 -2
  31. package/dist/preload/windows/simulator.js +1 -0
  32. package/dist/renderer/assets/index-BFwsvw4p.js +50 -0
  33. package/dist/renderer/assets/{input-J1MQ5fra.js → input-hGF71bn3.js} +2 -2
  34. package/dist/renderer/assets/{ipc-transport-21qDpt9Y.js → ipc-transport-BKWkvwKK.js} +2 -2
  35. package/dist/renderer/assets/ipc-transport-Cg1q1gwD.css +1 -0
  36. package/dist/renderer/assets/{popover-ChIUUEdj.js → popover-NNQNyjgI.js} +2 -2
  37. package/dist/renderer/assets/select-Bb1AKeSq.js +2 -0
  38. package/dist/renderer/assets/{settings-CGea5k_R.js → settings-7uwimev-.js} +2 -2
  39. package/dist/renderer/assets/settings-api-DkrPHroq.js +2 -0
  40. package/dist/renderer/assets/{workbenchSettings-CFrdVOiP.js → workbenchSettings-EaMYvKHG.js} +2 -2
  41. package/dist/renderer/entries/main/index.html +6 -6
  42. package/dist/renderer/entries/popover/index.html +5 -5
  43. package/dist/renderer/entries/settings/index.html +5 -5
  44. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  45. package/dist/shared/ipc-channels.d.ts +1 -7
  46. package/dist/shared/ipc-channels.js +7 -6
  47. package/dist/shared/ipc-schemas.d.ts +0 -1
  48. package/dist/shared/ipc-schemas.js +0 -1
  49. package/dist/shared/types.d.ts +17 -61
  50. package/dist/simulator/assets/device-shell-BWX7Yopg.js +2 -0
  51. package/dist/simulator/assets/{device-shell-DsdcNEkt.css → device-shell-BiFE9Otv.css} +1 -1
  52. package/dist/simulator/assets/{simulator-mini-app-CYtW6bMd.js → simulator-mini-app-BfNuDF3R.js} +2 -2
  53. package/dist/simulator/assets/{simulator-cV1PERi6.js → simulator-sf-D0mhw.js} +3 -3
  54. package/dist/simulator/simulator.html +1 -1
  55. package/package.json +4 -4
  56. package/dist/renderer/assets/index-Bx4XqFQ2.js +0 -50
  57. package/dist/renderer/assets/ipc-transport-CVp38I_M.css +0 -1
  58. package/dist/renderer/assets/select-BgWAbMot.js +0 -2
  59. package/dist/renderer/assets/settings-api-Dit4oL6S.js +0 -2
  60. package/dist/simulator/assets/device-shell-BEnc2k-W.js +0 -2
@@ -365,7 +365,14 @@ var WorkbenchSettingsChannel = {
365
365
  SetTheme: "workbenchSettings:setTheme",
366
366
  GetCdpStatus: "workbenchSettings:getCdpStatus",
367
367
  GetMcpStatus: "workbenchSettings:getMcpStatus",
368
- Init: "workbenchSettings:init"
368
+ Init: "workbenchSettings:init",
369
+ // Main → renderer push: the active color scheme flipped (OS change or in-app
370
+ // SetTheme). Payload is `isDark: boolean`. The app's CSS reacts to
371
+ // `prefers-color-scheme` automatically; this exists for the few JS consumers
372
+ // (Monaco's theme) that can't observe that media change — Electron does NOT
373
+ // dispatch the renderer's `matchMedia('(prefers-color-scheme)')` change event
374
+ // for programmatic `nativeTheme.themeSource` assignments.
375
+ ThemeChanged: "workbenchSettings:themeChanged"
369
376
  };
370
377
  var ProjectChannel = {
371
378
  Open: "project:open",
@@ -467,13 +474,7 @@ var WindowChannel = {
467
474
  NavigateBack: "window:navigateBack"
468
475
  };
469
476
  var AppChannel = {
470
- GetBranding: "app:getBranding",
471
- GetHeaderAvatar: "app:getHeaderAvatar",
472
- InvokeHeaderAvatar: "app:invokeHeaderAvatar",
473
- HeaderAvatarChanged: "app:headerAvatarChanged",
474
- GetHeaderActions: "app:getHeaderActions",
475
- InvokeHeaderAction: "app:invokeHeaderAction",
476
- HeaderActionsChanged: "app:headerActionsChanged"
477
+ GetBranding: "app:getBranding"
477
478
  };
478
479
  var AutomationChannel = {
479
480
  GetPort: "automation:port"
@@ -760,7 +761,7 @@ function registerProjectFsIpc(ctx) {
760
761
  }
761
762
 
762
763
  // src/main/app/app.ts
763
- import { app as app14, BrowserWindow as BrowserWindow8, nativeImage, session as session4 } from "electron";
764
+ import { app as app15, BrowserWindow as BrowserWindow8, nativeImage, session as session4 } from "electron";
764
765
  import fs10 from "fs";
765
766
  import path21 from "path";
766
767
 
@@ -801,12 +802,21 @@ import { toDisposable } from "@dimina-kit/electron-deck/main";
801
802
  function themeBg() {
802
803
  return nativeTheme2.shouldUseDarkColors ? "#1a1a1a" : "#fafafa";
803
804
  }
805
+ function simDeskBg() {
806
+ return nativeTheme2.shouldUseDarkColors ? "#121212" : "#e8e8e8";
807
+ }
804
808
  function installThemeBackgroundSync() {
805
809
  const apply = () => {
806
810
  const bg = themeBg();
811
+ const isDark = nativeTheme2.shouldUseDarkColors;
807
812
  for (const win of BrowserWindow.getAllWindows()) {
808
- if (!win.isDestroyed()) {
813
+ if (win.isDestroyed()) continue;
814
+ try {
809
815
  win.setBackgroundColor(bg);
816
+ if (!win.webContents.isDestroyed()) {
817
+ win.webContents.send(WorkbenchSettingsChannel.ThemeChanged, isDark);
818
+ }
819
+ } catch {
810
820
  }
811
821
  }
812
822
  };
@@ -878,7 +888,9 @@ function createMainWindow(opts) {
878
888
  if (process.env.NODE_ENV === "test") {
879
889
  mainWindow.showInactive();
880
890
  } else {
881
- mainWindow.show();
891
+ if (opts.autoShow !== false) {
892
+ mainWindow.show();
893
+ }
882
894
  if (!app3.isPackaged && process.env.DIMINA_DEVTOOLS_MAIN_INSPECTOR === "1") {
883
895
  mainWindow.webContents.openDevTools({ mode: "detach" });
884
896
  }
@@ -933,6 +945,23 @@ function wireMainWindowEvents(win, state = {}) {
933
945
  return registry;
934
946
  }
935
947
 
948
+ // src/main/app/lifecycle.ts
949
+ import { app as app4, globalShortcut as globalShortcut2 } from "electron";
950
+ var appIsQuitting = false;
951
+ function isAppQuitting() {
952
+ return appIsQuitting;
953
+ }
954
+ function registerAppLifecycle() {
955
+ app4.on("window-all-closed", () => {
956
+ globalShortcut2.unregisterAll();
957
+ app4.quit();
958
+ });
959
+ app4.on("before-quit", () => {
960
+ appIsQuitting = true;
961
+ globalShortcut2.unregisterAll();
962
+ });
963
+ }
964
+
936
965
  // src/main/services/workbench-context.ts
937
966
  import {
938
967
  createConnectionRegistry,
@@ -956,12 +985,12 @@ function createWorkbenchSenderPolicy(ctx) {
956
985
 
957
986
  // src/main/services/default-adapter.ts
958
987
  import path6 from "path";
959
- import { app as app4 } from "electron";
988
+ import { app as app5 } from "electron";
960
989
  var defaultAdapter = {
961
990
  async openProject(opts) {
962
991
  const diminaKit = await import("@dimina-kit/devkit");
963
992
  const openProjectOpts = {
964
- outputDir: path6.join(app4.getPath("userData"), "dimina-fe-output"),
993
+ outputDir: path6.join(app5.getPath("userData"), "dimina-fe-output"),
965
994
  ...opts,
966
995
  simulatorDir
967
996
  };
@@ -1001,12 +1030,6 @@ function createRendererNotifier(ctx) {
1001
1030
  hostToolbarHeightChanged(height) {
1002
1031
  sendToMain(ViewChannel.HostToolbarHeightChanged, height);
1003
1032
  },
1004
- headerAvatarChanged() {
1005
- sendToMain(AppChannel.HeaderAvatarChanged);
1006
- },
1007
- headerActionsChanged() {
1008
- sendToMain(AppChannel.HeaderActionsChanged);
1009
- },
1010
1033
  editorOpenFile(payload) {
1011
1034
  sendToMain(EditorChannel.OpenFile, payload);
1012
1035
  },
@@ -1030,7 +1053,7 @@ function createRendererNotifier(ctx) {
1030
1053
  }
1031
1054
 
1032
1055
  // src/main/services/views/view-manager.ts
1033
- import { ipcMain as ipcMain2, shell as shell2, WebContentsView as WebContentsView2, webContents } from "electron";
1056
+ import { ipcMain as ipcMain2, nativeTheme as nativeTheme3, shell as shell2, WebContentsView as WebContentsView2, webContents } from "electron";
1034
1057
  import path7 from "path";
1035
1058
 
1036
1059
  // src/shared/open-in-editor.ts
@@ -1087,22 +1110,23 @@ function resourceUrlToProjectRelativePath(resourceUrl, expectedOrigin) {
1087
1110
  }
1088
1111
 
1089
1112
  // src/main/services/safe-area/index.ts
1090
- function guestInsets(device) {
1113
+ function guestInsets(device, isTabPage2) {
1091
1114
  const top = device?.safeAreaInsets.top ?? 0;
1092
- return { top, topMax: top, right: 0, rightMax: 0, bottom: 0, bottomMax: 0, left: 0, leftMax: 0 };
1115
+ const bottom = isTabPage2 ? 0 : device?.safeAreaInsets.bottom ?? 0;
1116
+ return { top, topMax: top, right: 0, rightMax: 0, bottom, bottomMax: bottom, left: 0, leftMax: 0 };
1093
1117
  }
1094
1118
  function createSafeAreaController(options = {}) {
1095
- const attached = /* @__PURE__ */ new Set();
1096
- function override(wc, device) {
1119
+ const attached = /* @__PURE__ */ new Map();
1120
+ function override(wc, device, isTabPage2) {
1097
1121
  if (wc.isDestroyed()) return;
1098
- void wc.debugger.sendCommand("Emulation.setSafeAreaInsetsOverride", { insets: guestInsets(device) }).catch((err) => {
1122
+ void wc.debugger.sendCommand("Emulation.setSafeAreaInsetsOverride", { insets: guestInsets(device, isTabPage2) }).catch((err) => {
1099
1123
  console.warn("[safe-area] setSafeAreaInsetsOverride failed:", err instanceof Error ? err.message : err);
1100
1124
  });
1101
1125
  }
1102
1126
  return {
1103
- applyToGuest: (wc, device) => {
1127
+ applyToGuest: (wc, device, isTabPage2) => {
1104
1128
  if (!wc || wc.isDestroyed() || attached.has(wc)) {
1105
- if (wc && !wc.isDestroyed() && attached.has(wc)) override(wc, device);
1129
+ if (wc && !wc.isDestroyed() && attached.has(wc)) override(wc, device, isTabPage2);
1106
1130
  return;
1107
1131
  }
1108
1132
  try {
@@ -1111,19 +1135,19 @@ function createSafeAreaController(options = {}) {
1111
1135
  console.warn("[safe-area] debugger.attach failed; env(safe-area-inset-*) stays 0:", err instanceof Error ? err.message : err);
1112
1136
  return;
1113
1137
  }
1114
- attached.add(wc);
1138
+ attached.set(wc, isTabPage2);
1115
1139
  if (options.connections) {
1116
1140
  options.connections.acquire(wc).own(() => attached.delete(wc));
1117
1141
  } else {
1118
1142
  wc.once("destroyed", () => attached.delete(wc));
1119
1143
  }
1120
- override(wc, device);
1144
+ override(wc, device, isTabPage2);
1121
1145
  },
1122
1146
  reapplyAll: (device) => {
1123
- for (const wc of attached) override(wc, device);
1147
+ for (const [wc, isTabPage2] of attached) override(wc, device, isTabPage2);
1124
1148
  },
1125
1149
  dispose: () => {
1126
- for (const wc of attached) {
1150
+ for (const wc of attached.keys()) {
1127
1151
  try {
1128
1152
  if (!wc.isDestroyed()) wc.debugger.detach();
1129
1153
  } catch {
@@ -2325,22 +2349,38 @@ function createViewManager(ctx) {
2325
2349
  }
2326
2350
  });
2327
2351
  nativeSimulatorView = view;
2328
- view.setBackgroundColor("#121212");
2352
+ view.setBackgroundColor(simDeskBg());
2329
2353
  const simWc = view.webContents;
2354
+ const syncDeskBg = () => {
2355
+ try {
2356
+ if (!simWc.isDestroyed()) view.setBackgroundColor(simDeskBg());
2357
+ } catch {
2358
+ }
2359
+ };
2360
+ nativeTheme3.on("updated", syncDeskBg);
2361
+ ctx.connections.acquire(simWc).own(() => nativeTheme3.removeListener("updated", syncDeskBg));
2330
2362
  attachNativeCustomApiBridge(simWc);
2363
+ const pendingGuestIsTab = [];
2331
2364
  simWc.on("will-attach-webview", (_event, webPreferences, params) => {
2332
2365
  ;
2333
2366
  webPreferences.partition = partition;
2334
2367
  params.partition = partition;
2335
2368
  webPreferences.contextIsolation = false;
2336
2369
  webPreferences.sandbox = false;
2370
+ let isTab = false;
2371
+ try {
2372
+ isTab = new URL(params.src).searchParams.get("isTab") === "1";
2373
+ } catch {
2374
+ }
2375
+ pendingGuestIsTab.push(isTab);
2337
2376
  });
2338
2377
  simWc.on("did-attach-webview", (_event, guestWc) => {
2339
2378
  try {
2340
2379
  guestWc.setZoomFactor(currentZoomFactor);
2341
2380
  } catch {
2342
2381
  }
2343
- safeArea.applyToGuest(guestWc, ctx.bridge?.getDevice() ?? null);
2382
+ const isTabGuest = pendingGuestIsTab.shift() ?? false;
2383
+ safeArea.applyToGuest(guestWc, ctx.bridge?.getDevice() ?? null, isTabGuest);
2344
2384
  guestWc.setWindowOpenHandler(({ url }) => handleWindowOpenExternal(url));
2345
2385
  guestWc.on("will-navigate", (e, url) => {
2346
2386
  try {
@@ -2686,12 +2726,12 @@ async function openSettingsWindow(deps) {
2686
2726
  import { z as z2 } from "zod";
2687
2727
 
2688
2728
  // src/main/services/projects/project-repository.ts
2689
- import { app as app5 } from "electron";
2729
+ import { app as app6 } from "electron";
2690
2730
  import path9 from "path";
2691
2731
  import fs4 from "fs";
2692
2732
  var log2 = createLogger("projects");
2693
2733
  function getProjectsFile() {
2694
- return path9.join(app5.getPath("userData"), "dimina-projects.json");
2734
+ return path9.join(app6.getPath("userData"), "dimina-projects.json");
2695
2735
  }
2696
2736
  function load() {
2697
2737
  try {
@@ -2906,6 +2946,13 @@ function createWorkspaceService(ctx) {
2906
2946
  },
2907
2947
  validateProjectDir: async (dirPath) => provider.validateProjectDir ? provider.validateProjectDir(dirPath) : null,
2908
2948
  async openProject(projectPath) {
2949
+ if (ctx.onBeforeOpenProject) {
2950
+ try {
2951
+ await ctx.onBeforeOpenProject(projectPath);
2952
+ } catch (err) {
2953
+ return { success: false, error: err instanceof Error ? err.message : String(err) };
2954
+ }
2955
+ }
2909
2956
  clearSimulatorServicewechatReferer();
2910
2957
  logGeneration++;
2911
2958
  await disposeSession();
@@ -3025,9 +3072,9 @@ function createWorkspaceService(ctx) {
3025
3072
  import { createHash } from "crypto";
3026
3073
  import fs5 from "fs";
3027
3074
  import path10 from "path";
3028
- import { app as app6 } from "electron";
3075
+ import { app as app7 } from "electron";
3029
3076
  function getThumbnailDir() {
3030
- return path10.join(app6.getPath("userData"), "thumbnails");
3077
+ return path10.join(app7.getPath("userData"), "thumbnails");
3031
3078
  }
3032
3079
  function hashProjectPath(projectPath) {
3033
3080
  return createHash("sha256").update(projectPath).digest("hex").slice(0, 16);
@@ -3119,11 +3166,7 @@ function createWorkbenchContext(opts) {
3119
3166
  rendererDir: opts.rendererDir,
3120
3167
  apiNamespaces: opts.apiNamespaces ?? [],
3121
3168
  appName: opts.appName ?? "Dimina DevTools",
3122
- brandingProvider: opts.brandingProvider,
3123
- headerAvatarProvider: opts.headerAvatarProvider,
3124
- headerAvatarActionHandler: opts.headerAvatarActionHandler,
3125
- headerActionsProvider: opts.headerActionsProvider,
3126
- headerActionHandler: opts.headerActionHandler
3169
+ brandingProvider: opts.brandingProvider
3127
3170
  };
3128
3171
  ctx.registry = new DisposableRegistry3();
3129
3172
  ctx.connections = createConnectionRegistry();
@@ -3140,6 +3183,7 @@ function createWorkbenchContext(opts) {
3140
3183
  opts.builtinTemplates ?? "all"
3141
3184
  );
3142
3185
  ctx.customCreateProjectDialog = opts.customCreateProjectDialog;
3186
+ ctx.onBeforeOpenProject = opts.onBeforeOpenProject;
3143
3187
  ctx.workspace = createWorkspaceService(ctx);
3144
3188
  ctx.senderPolicy = createWorkbenchSenderPolicy(ctx);
3145
3189
  return ctx;
@@ -3223,70 +3267,10 @@ function installAppMenu(ctx) {
3223
3267
  }
3224
3268
 
3225
3269
  // src/main/ipc/app.ts
3226
- function readString(value) {
3227
- if (typeof value !== "string") return void 0;
3228
- const trimmed = value.trim();
3229
- return trimmed.length > 0 ? trimmed : void 0;
3230
- }
3231
- function normalizeHeaderAvatar(value) {
3232
- if (!value || typeof value !== "object") return null;
3233
- const raw = value;
3234
- const avatar = {};
3235
- const displayName = readString(raw.displayName);
3236
- const displayInitial = readString(raw.displayInitial);
3237
- const avatarUrl = readString(raw.avatarUrl);
3238
- const tooltip = readString(raw.tooltip);
3239
- if (displayName) avatar.displayName = displayName;
3240
- if (displayInitial) avatar.displayInitial = displayInitial;
3241
- if (avatarUrl) avatar.avatarUrl = avatarUrl;
3242
- if (tooltip) avatar.tooltip = tooltip;
3243
- return avatar.displayName || avatar.displayInitial || avatar.avatarUrl ? avatar : null;
3244
- }
3245
- function readPlacement(value) {
3246
- return value === "left" || value === "center" || value === "right" ? value : void 0;
3247
- }
3248
- function normalizeHeaderAction(value) {
3249
- if (!value || typeof value !== "object") return null;
3250
- const raw = value;
3251
- const id = readString(raw.id);
3252
- const label = readString(raw.label);
3253
- if (!id || !label) return null;
3254
- const action = { id, label };
3255
- const tooltip = readString(raw.tooltip);
3256
- const placement = readPlacement(raw.placement);
3257
- if (tooltip) action.tooltip = tooltip;
3258
- if (placement) action.placement = placement;
3259
- if (typeof raw.disabled === "boolean") action.disabled = raw.disabled;
3260
- return action;
3261
- }
3262
- function normalizeHeaderActions(value) {
3263
- if (!Array.isArray(value)) return [];
3264
- const actions = [];
3265
- const seen = /* @__PURE__ */ new Set();
3266
- for (const item of value) {
3267
- const action = normalizeHeaderAction(item);
3268
- if (!action || seen.has(action.id)) continue;
3269
- seen.add(action.id);
3270
- actions.push(action);
3271
- }
3272
- return actions.slice(0, 8);
3273
- }
3274
3270
  function registerAppIpc(ctx) {
3275
3271
  return new IpcRegistry(ctx.senderPolicy).handle(AppChannel.GetBranding, async () => {
3276
3272
  if (ctx.brandingProvider) return ctx.brandingProvider();
3277
3273
  return { appName: ctx.appName };
3278
- }).handle(AppChannel.GetHeaderAvatar, async () => {
3279
- if (!ctx.headerAvatarProvider) return null;
3280
- return normalizeHeaderAvatar(await ctx.headerAvatarProvider());
3281
- }).handle(AppChannel.InvokeHeaderAvatar, async () => {
3282
- await ctx.headerAvatarActionHandler?.();
3283
- }).handle(AppChannel.GetHeaderActions, async () => {
3284
- if (!ctx.headerActionsProvider) return [];
3285
- return normalizeHeaderActions(await ctx.headerActionsProvider());
3286
- }).handle(AppChannel.InvokeHeaderAction, async (_event, id) => {
3287
- const actionId = readString(id);
3288
- if (!actionId) return;
3289
- await ctx.headerActionHandler?.(actionId);
3290
3274
  });
3291
3275
  }
3292
3276
 
@@ -3334,7 +3318,6 @@ var SimulatorSetDeviceInfoSchema = z3.tuple([
3334
3318
  screenWidth: z3.number().int().min(100).max(4e3),
3335
3319
  screenHeight: z3.number().int().min(100).max(4e3),
3336
3320
  statusBarHeight: z3.number().finite().min(0).max(400),
3337
- safeAreaBottom: z3.number().finite().min(0).max(400),
3338
3321
  notchType: z3.enum(["none", "notch", "dynamic-island"]),
3339
3322
  safeAreaInsets: z3.object({
3340
3323
  top: z3.number().finite().min(0).max(400),
@@ -3507,7 +3490,7 @@ var popoverModule = {
3507
3490
  };
3508
3491
 
3509
3492
  // src/main/ipc/projects.ts
3510
- import { app as app7, dialog } from "electron";
3493
+ import { app as app8, dialog } from "electron";
3511
3494
  import path13 from "path";
3512
3495
 
3513
3496
  // src/main/services/projects/create-project-service.ts
@@ -3661,7 +3644,7 @@ function registerProjectsIpc(ctx) {
3661
3644
  }
3662
3645
  function safeAppPath(name) {
3663
3646
  try {
3664
- return app7.getPath(name);
3647
+ return app8.getPath(name);
3665
3648
  } catch {
3666
3649
  return null;
3667
3650
  }
@@ -3715,7 +3698,7 @@ var sessionModule = {
3715
3698
  };
3716
3699
 
3717
3700
  // src/main/ipc/settings.ts
3718
- import { app as app8 } from "electron";
3701
+ import { app as app9 } from "electron";
3719
3702
 
3720
3703
  // src/main/services/mcp/status.ts
3721
3704
  var status = { running: false, port: null, error: null };
@@ -3754,8 +3737,8 @@ function registerSettingsIpc(ctx) {
3754
3737
  applyTheme(theme);
3755
3738
  }).handle(WorkbenchSettingsChannel.GetCdpStatus, () => {
3756
3739
  const settings = loadWorkbenchSettings();
3757
- const switchValue = app8.commandLine.getSwitchValue("remote-debugging-port");
3758
- const implicitDevDefault = !app8.isPackaged && !settings.cdp.enabled && switchValue === String(DEFAULT_CDP_PORT);
3740
+ const switchValue = app9.commandLine.getSwitchValue("remote-debugging-port");
3741
+ const implicitDevDefault = !app9.isPackaged && !settings.cdp.enabled && switchValue === String(DEFAULT_CDP_PORT);
3759
3742
  return {
3760
3743
  configured: settings.cdp.enabled,
3761
3744
  port: settings.cdp.port,
@@ -3816,7 +3799,7 @@ var settingsModule = {
3816
3799
  import { DisposableRegistry as DisposableRegistry6 } from "@dimina-kit/electron-deck/main";
3817
3800
 
3818
3801
  // src/main/ipc/bridge-router.ts
3819
- import { app as app11, ipcMain as ipcMain3, protocol as protocol2, session as electronSession, webContents as webContents2 } from "electron";
3802
+ import { app as app12, ipcMain as ipcMain3, protocol as protocol2, session as electronSession, webContents as webContents2 } from "electron";
3820
3803
  import path16 from "node:path";
3821
3804
  import { pathToFileURL as pathToFileURL3 } from "node:url";
3822
3805
 
@@ -3924,7 +3907,7 @@ function setCorsHeaders(res) {
3924
3907
  }
3925
3908
 
3926
3909
  // src/main/windows/service-host-window/create.ts
3927
- import { app as app9, BrowserWindow as BrowserWindow4 } from "electron";
3910
+ import { app as app10, BrowserWindow as BrowserWindow4 } from "electron";
3928
3911
  import path15 from "node:path";
3929
3912
  import { pathToFileURL as pathToFileURL2 } from "node:url";
3930
3913
  var SERVICE_HOST_PARTITION = SHARED_MINIAPP_PARTITION;
@@ -3965,7 +3948,7 @@ function navigateServiceHost(win, url) {
3965
3948
  () => void 0,
3966
3949
  () => void 0
3967
3950
  );
3968
- if (!app9.isPackaged && process.env.NODE_ENV !== "test") {
3951
+ if (!app10.isPackaged && process.env.NODE_ENV !== "test") {
3969
3952
  const w = win;
3970
3953
  if (w.__diminaDevToolsHook) {
3971
3954
  try {
@@ -4362,7 +4345,7 @@ function createConsoleForwarder(bridge) {
4362
4345
  }
4363
4346
 
4364
4347
  // src/main/services/simulator-storage/index.ts
4365
- import { app as app10, webContents as wcStatic } from "electron";
4348
+ import { app as app11, webContents as wcStatic } from "electron";
4366
4349
  import { DisposableRegistry as DisposableRegistry5 } from "@dimina-kit/electron-deck/main";
4367
4350
 
4368
4351
  // src/main/services/simulator-storage/service-storage-ops.ts
@@ -4732,9 +4715,9 @@ function setupSimulatorStorage(host, options) {
4732
4715
  }
4733
4716
  }
4734
4717
  };
4735
- app10.on("web-contents-created", onWcCreated);
4718
+ app11.on("web-contents-created", onWcCreated);
4736
4719
  registry.add(() => {
4737
- app10.removeListener("web-contents-created", onWcCreated);
4720
+ app11.removeListener("web-contents-created", onWcCreated);
4738
4721
  });
4739
4722
  registry.add(async () => {
4740
4723
  const subs = Array.from(wcSubs.values());
@@ -5908,7 +5891,7 @@ function makeHostEnv(snapshot) {
5908
5891
  windowWidth: 390,
5909
5892
  windowHeight: 844,
5910
5893
  statusBarHeight: 24,
5911
- language: app11.getLocale(),
5894
+ language: app12.getLocale(),
5912
5895
  theme: "light",
5913
5896
  ...snapshot
5914
5897
  };
@@ -8705,7 +8688,7 @@ function setupSimulatorSessionPolicy() {
8705
8688
  }
8706
8689
 
8707
8690
  // src/main/services/update/update-manager.ts
8708
- import { app as app12, shell as shell3 } from "electron";
8691
+ import { app as app13, shell as shell3 } from "electron";
8709
8692
  var UpdateManager = class {
8710
8693
  checker;
8711
8694
  mainWindow;
@@ -8728,7 +8711,7 @@ var UpdateManager = class {
8728
8711
  constructor(opts) {
8729
8712
  this.checker = opts.checker;
8730
8713
  this.mainWindow = opts.mainWindow;
8731
- this.getCurrentVersion = opts.getCurrentVersion ?? (() => app12.getVersion());
8714
+ this.getCurrentVersion = opts.getCurrentVersion ?? (() => app13.getVersion());
8732
8715
  this.ipc = new IpcRegistry(opts.senderPolicy);
8733
8716
  this.registerIpc();
8734
8717
  this.startPeriodicCheck(opts.checkInterval ?? 60 * 60 * 1e3, opts.initialDelay ?? 5e3);
@@ -8769,7 +8752,7 @@ var UpdateManager = class {
8769
8752
  install() {
8770
8753
  if (this.downloadedPath) {
8771
8754
  shell3.openPath(this.downloadedPath);
8772
- app12.quit();
8755
+ app13.quit();
8773
8756
  }
8774
8757
  }
8775
8758
  /**
@@ -8803,7 +8786,7 @@ var UpdateManager = class {
8803
8786
  };
8804
8787
 
8805
8788
  // src/main/services/update/github-release-checker.ts
8806
- import { app as app13 } from "electron";
8789
+ import { app as app14 } from "electron";
8807
8790
 
8808
8791
  // src/main/app/app.ts
8809
8792
  import { toDisposable as toDisposable8 } from "@dimina-kit/electron-deck/main";
@@ -8878,7 +8861,8 @@ function createConfiguredMainWindow(config, rendererDir2) {
8878
8861
  width: config.window?.width,
8879
8862
  height: config.window?.height,
8880
8863
  minWidth: config.window?.minWidth,
8881
- minHeight: config.window?.minHeight
8864
+ minHeight: config.window?.minHeight,
8865
+ autoShow: config.window?.autoShow
8882
8866
  });
8883
8867
  if (config.icon) {
8884
8868
  const icon = nativeImage.createFromPath(config.icon);
@@ -8895,10 +8879,6 @@ function createContext(config, mainWindow, rendererDir2) {
8895
8879
  appName: config.appName,
8896
8880
  apiNamespaces: config.apiNamespaces,
8897
8881
  brandingProvider: config.brandingProvider,
8898
- headerAvatarProvider: config.headerAvatarProvider,
8899
- headerAvatarActionHandler: config.headerAvatarActionHandler,
8900
- headerActionsProvider: config.headerActionsProvider,
8901
- headerActionHandler: config.headerActionHandler,
8902
8882
  // The host-supplied ProjectsProvider / template types in `shared/types`
8903
8883
  // are structurally compatible with the main-process equivalents —
8904
8884
  // these casts are safe; we re-narrow at the workspace-service /
@@ -8906,7 +8886,8 @@ function createContext(config, mainWindow, rendererDir2) {
8906
8886
  projectsProvider: config.projectsProvider,
8907
8887
  projectTemplates: config.projectTemplates,
8908
8888
  builtinTemplates: config.builtinTemplates,
8909
- customCreateProjectDialog: config.customCreateProjectDialog
8889
+ customCreateProjectDialog: config.customCreateProjectDialog,
8890
+ onBeforeOpenProject: config.onBeforeOpenProject
8910
8891
  });
8911
8892
  }
8912
8893
  function registerBuiltinModules(config, context) {
@@ -8951,7 +8932,7 @@ async function setupAutomation(instance) {
8951
8932
  function setupMcp() {
8952
8933
  const settings = loadWorkbenchSettings();
8953
8934
  if (!settings.mcp.enabled) return null;
8954
- const cdpPortSwitch = app14.commandLine.getSwitchValue("remote-debugging-port");
8935
+ const cdpPortSwitch = app15.commandLine.getSwitchValue("remote-debugging-port");
8955
8936
  const cdpPort2 = cdpPortSwitch ? parseInt(cdpPortSwitch, 10) : settings.cdp.port;
8956
8937
  return startMcpServer(cdpPort2, settings.mcp.port);
8957
8938
  }
@@ -8962,6 +8943,7 @@ function wireAppWindowEvents(config, instance) {
8962
8943
  context,
8963
8944
  onResize: () => context.views.repositionAll(),
8964
8945
  onClose: async (e) => {
8946
+ if (isAppQuitting()) return;
8965
8947
  if (!context.workspace.hasActiveSession()) return;
8966
8948
  e.preventDefault();
8967
8949
  if (closing) return;
@@ -8979,7 +8961,7 @@ function wireAppWindowEvents(config, instance) {
8979
8961
  });
8980
8962
  }
8981
8963
  function enableDevRendererAutoReload(rendererDir2) {
8982
- if (app14.isPackaged) {
8964
+ if (app15.isPackaged) {
8983
8965
  return toDisposable8(() => {
8984
8966
  });
8985
8967
  }
@@ -9002,7 +8984,7 @@ function enableDevRendererAutoReload(rendererDir2) {
9002
8984
  }
9003
8985
  function runDevtoolsBootstrap(config = {}) {
9004
8986
  try {
9005
- app14.setName(config.appName ?? "Dimina DevTools");
8987
+ app15.setName(config.appName ?? "Dimina DevTools");
9006
8988
  } catch {
9007
8989
  }
9008
8990
  setupCdpPort();
@@ -9010,7 +8992,7 @@ function runDevtoolsBootstrap(config = {}) {
9010
8992
  registerDifileScheme();
9011
8993
  }
9012
8994
  async function createDevtoolsRuntime(config = {}) {
9013
- await app14.whenReady();
8995
+ await app15.whenReady();
9014
8996
  applyTheme(loadWorkbenchSettings().theme);
9015
8997
  const rendererDir2 = config.rendererDir ?? rendererDir;
9016
8998
  const mainWindow = createConfiguredMainWindow(config, rendererDir2);
@@ -9035,8 +9017,6 @@ async function createDevtoolsRuntime(config = {}) {
9035
9017
  // teardown, so a single dispose leaves no dead entry behind.
9036
9018
  registerTrustedWindow: (win) => context.registry.add(registerTrustedWindow(context, win)),
9037
9019
  registerSimulatorApi: (name, handler) => context.registry.add(toDisposable8(context.simulatorApis.register(name, handler))),
9038
- refreshHeaderAvatar: () => context.notify.headerAvatarChanged(),
9039
- refreshHeaderActions: () => context.notify.headerActionsChanged(),
9040
9020
  dispose: () => disposeContext(context)
9041
9021
  };
9042
9022
  if (config.onSetup) {
@@ -9161,18 +9141,6 @@ async function createDevtoolsRuntime(config = {}) {
9161
9141
  return instance;
9162
9142
  }
9163
9143
 
9164
- // src/main/app/lifecycle.ts
9165
- import { app as app15, globalShortcut as globalShortcut2 } from "electron";
9166
- function registerAppLifecycle() {
9167
- app15.on("window-all-closed", () => {
9168
- globalShortcut2.unregisterAll();
9169
- app15.quit();
9170
- });
9171
- app15.on("before-quit", () => {
9172
- globalShortcut2.unregisterAll();
9173
- });
9174
- }
9175
-
9176
9144
  // src/main/runtime/devtools-backend.ts
9177
9145
  function createDevtoolsBackend(config = {}) {
9178
9146
  let instance = null;
@@ -1,6 +1,4 @@
1
1
  import type { WorkbenchContext } from '../services/workbench-context.js';
2
2
  import type { Disposable } from '@dimina-kit/electron-deck/main';
3
- type AppIpcContext = Pick<WorkbenchContext, 'brandingProvider' | 'appName' | 'headerAvatarProvider' | 'headerAvatarActionHandler' | 'headerActionsProvider' | 'headerActionHandler' | 'senderPolicy'>;
4
- export declare function registerAppIpc(ctx: AppIpcContext): Disposable;
5
- export {};
3
+ export declare function registerAppIpc(ctx: Pick<WorkbenchContext, 'brandingProvider' | 'appName' | 'senderPolicy'>): Disposable;
6
4
  //# sourceMappingURL=app.d.ts.map