@lvce-editor/renderer-process 30.65.3 → 30.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1472,11 +1472,12 @@ const getGeneration = () => state$m.generation;
1472
1472
  const createRuntimeName = name => {
1473
1473
  state$m.nextId++;
1474
1474
  const id = `worker-${state$m.nextId}`;
1475
+ const runtimeId = `worker-${String(state$m.nextId).padStart(2, '0')}`;
1475
1476
  return {
1476
1477
  id,
1477
1478
  name,
1478
1479
  // Platform detection in workers relies on a trailing (Electron) or (Web).
1479
- runtimeName: `[${id}] ${name}`
1480
+ runtimeName: `[${runtimeId}] ${name}`
1480
1481
  };
1481
1482
  };
1482
1483
  const track = (worker, startedIn = state$m.generation, trackedWorker) => {
@@ -11456,6 +11457,28 @@ const unmaximize = () => {};
11456
11457
  const close = () => {
11457
11458
  // window.close()
11458
11459
  };
11460
+
11461
+ // User confirmation has no deadline; the main process persists session state only after approval.
11462
+ const canClose = async () => {
11463
+ if (!(await invoke$1('Main.hasDirtyTabs'))) {
11464
+ return true;
11465
+ }
11466
+ const choice = await invoke$1('ConfirmPrompt.prompt3', 'Do you want to save your changes before closing?', {
11467
+ cancelMessage: 'Cancel',
11468
+ confirmMessage: 'Save',
11469
+ discardMessage: "Don't Save",
11470
+ discardPrompt: 'Discard your unsaved changes?',
11471
+ title: 'Save Changes'
11472
+ });
11473
+ if (choice === 'discard') {
11474
+ return true;
11475
+ }
11476
+ if (choice !== 'save') {
11477
+ return false;
11478
+ }
11479
+ await invoke$1('Main.saveAll');
11480
+ return !(await invoke$1('Main.hasDirtyTabs'));
11481
+ };
11459
11482
  const prepareClose = async () => {
11460
11483
  await invoke$1('SaveState.handleVisibilityChange', 'hidden');
11461
11484
  };
@@ -11989,6 +12012,7 @@ const commandMap = {
11989
12012
  'WebView.load': load,
11990
12013
  'WebView.loadOnly': loadOnly,
11991
12014
  'WebView.setPort': setPort,
12015
+ 'Window.canClose': canClose,
11992
12016
  'Window.captureBrowserAddress': captureBrowserAddress,
11993
12017
  'Window.close': close,
11994
12018
  'Window.focusBrowserAddress': focusBrowserAddress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.65.3",
3
+ "version": "30.67.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"