@lvce-editor/renderer-process 30.63.1 → 30.63.2

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.
@@ -4703,16 +4703,18 @@ const pendingBatches = new Map();
4703
4703
  const state$9 = {
4704
4704
  nextTransactionId: 1
4705
4705
  };
4706
- const queue = (uid, commands) => {
4706
+ const queue = (uid, commands, focusVersion = 0) => {
4707
4707
  const transactionId = state$9.nextTransactionId++;
4708
4708
  pendingBatches.set(transactionId, {
4709
4709
  commands,
4710
4710
  committed: false,
4711
+ focusVersion,
4711
4712
  uid
4712
4713
  });
4713
4714
  return transactionId;
4714
4715
  };
4715
- const take = (uid, transactionId) => {
4716
+ const focusCommands = new Set(['Viewlet.focus', 'Viewlet.focusElementByName', 'Viewlet.focusSelector', 'Viewlet.focusSelectorAfterRender']);
4717
+ const take = (uid, transactionId, focusVersion = 0) => {
4716
4718
  const batch = pendingBatches.get(transactionId);
4717
4719
  if (!batch) {
4718
4720
  throw new Error(`pending viewlet command transaction not found: ${transactionId}`);
@@ -4729,7 +4731,11 @@ const take = (uid, transactionId) => {
4729
4731
  if (!pendingBatch.committed) {
4730
4732
  break;
4731
4733
  }
4732
- commands.push(...pendingBatch.commands);
4734
+ for (const command of pendingBatch.commands) {
4735
+ if (pendingBatch.focusVersion === focusVersion || !focusCommands.has(command[0])) {
4736
+ commands.push(command);
4737
+ }
4738
+ }
4733
4739
  pendingBatches.delete(pendingTransactionId);
4734
4740
  }
4735
4741
  return commands;
@@ -9592,11 +9598,25 @@ const attachWindowEvents = () => {
9592
9598
  const sendMultiple = commands => {
9593
9599
  executeCommands(commands);
9594
9600
  };
9601
+ const queuedFocus = {
9602
+ listening: false,
9603
+ version: 0
9604
+ };
9605
+ const getFocusVersion = () => {
9606
+ if (!queuedFocus.listening) {
9607
+ // One observer for this document's lifetime, without retaining focused elements.
9608
+ document.addEventListener('focusin', () => queuedFocus.version++, {
9609
+ capture: true
9610
+ });
9611
+ queuedFocus.listening = true;
9612
+ }
9613
+ return queuedFocus.version;
9614
+ };
9595
9615
  const queueCommands = (uid, commands) => {
9596
- return queue(uid, commands);
9616
+ return queue(uid, commands, getFocusVersion());
9597
9617
  };
9598
9618
  const commitPending = (uid, transactionId) => {
9599
- executeCommands(take(uid, transactionId));
9619
+ executeCommands(take(uid, transactionId, getFocusVersion()));
9600
9620
  };
9601
9621
  const dispose$4 = id => {
9602
9622
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.63.1",
3
+ "version": "30.63.2",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"