@lvce-editor/renderer-process 30.43.4 → 30.44.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.
@@ -5611,7 +5611,6 @@ const setIdentifiers = identifiers => {
5611
5611
  setIdentifiers$1(identifiers);
5612
5612
  };
5613
5613
 
5614
- const appliedBatches = new Map();
5615
5614
  const pendingBatches = new Map();
5616
5615
  const state$2 = {
5617
5616
  nextTransactionId: 1
@@ -5620,6 +5619,7 @@ const queue = (uid, commands) => {
5620
5619
  const transactionId = state$2.nextTransactionId++;
5621
5620
  pendingBatches.set(transactionId, {
5622
5621
  commands,
5622
+ committed: false,
5623
5623
  uid
5624
5624
  });
5625
5625
  return transactionId;
@@ -5627,30 +5627,22 @@ const queue = (uid, commands) => {
5627
5627
  const take = (uid, transactionId) => {
5628
5628
  const batch = pendingBatches.get(transactionId);
5629
5629
  if (!batch) {
5630
- const appliedUid = appliedBatches.get(transactionId);
5631
- if (appliedUid !== undefined) {
5632
- if (appliedUid !== uid) {
5633
- throw new Error(`pending viewlet command transaction ${transactionId} belongs to ${appliedUid}, not ${uid}`);
5634
- }
5635
- appliedBatches.delete(transactionId);
5636
- return [];
5637
- }
5638
5630
  throw new Error(`pending viewlet command transaction not found: ${transactionId}`);
5639
5631
  }
5640
5632
  if (batch.uid !== uid) {
5641
5633
  throw new Error(`pending viewlet command transaction ${transactionId} belongs to ${batch.uid}, not ${uid}`);
5642
5634
  }
5635
+ batch.committed = true;
5643
5636
  const commands = [];
5644
5637
  for (const [pendingTransactionId, pendingBatch] of pendingBatches) {
5645
5638
  if (pendingBatch.uid !== uid) {
5646
5639
  continue;
5647
5640
  }
5648
- commands.push(...pendingBatch.commands);
5649
- pendingBatches.delete(pendingTransactionId);
5650
- if (pendingTransactionId === transactionId) {
5641
+ if (!pendingBatch.committed) {
5651
5642
  break;
5652
5643
  }
5653
- appliedBatches.set(pendingTransactionId, uid);
5644
+ commands.push(...pendingBatch.commands);
5645
+ pendingBatches.delete(pendingTransactionId);
5654
5646
  }
5655
5647
  return commands;
5656
5648
  };
@@ -8303,6 +8295,12 @@ const ViewletSidebar = {
8303
8295
  const handleInput$3 = value => {
8304
8296
  send$1('SimpleBrowser.handleInput', value);
8305
8297
  };
8298
+ const acceptSuggestion = value => {
8299
+ send$1('SimpleBrowser.acceptSuggestion', value);
8300
+ };
8301
+ const closeSuggestions = () => {
8302
+ send$1('SimpleBrowser.closeSuggestions');
8303
+ };
8306
8304
  const forward = () => {
8307
8305
  send$1('SimpleBrowser.forward');
8308
8306
  };
@@ -8328,6 +8326,14 @@ const handleInput$2 = event => {
8328
8326
  } = target;
8329
8327
  handleInput$3(value);
8330
8328
  };
8329
+ const handleClickSuggestion = event => {
8330
+ const suggestion = event.target.closest?.('.SimpleBrowserSuggestion');
8331
+ const value = suggestion?.dataset.value;
8332
+ if (typeof value !== 'string') {
8333
+ return;
8334
+ }
8335
+ acceptSuggestion(value);
8336
+ };
8331
8337
  const handleFocus$1 = event => {
8332
8338
  const {
8333
8339
  target
@@ -8342,6 +8348,9 @@ const handleBlur$1 = event => {
8342
8348
  target
8343
8349
  } = event;
8344
8350
  target.setSelectionRange(0, 0);
8351
+ if (!event.relatedTarget?.closest?.('.SimpleBrowserSuggestions')) {
8352
+ closeSuggestions();
8353
+ }
8345
8354
  };
8346
8355
  const handleClickForward = () => {
8347
8356
  forward();
@@ -8372,6 +8381,7 @@ const ViewletSimpleBrowserEvents = {
8372
8381
  handleClickForward,
8373
8382
  handleClickOpenExternal,
8374
8383
  handleClickReload,
8384
+ handleClickSuggestion,
8375
8385
  handleFocus: handleFocus$1,
8376
8386
  handleInput: handleInput$2
8377
8387
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.43.4",
3
+ "version": "30.44.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"