@lvce-editor/renderer-process 30.46.0 → 30.46.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.
- package/dist/rendererProcessMain.js +46 -24
- package/package.json +1 -1
|
@@ -5450,6 +5450,41 @@ const SingleElementConditions = {
|
|
|
5450
5450
|
toHaveValue
|
|
5451
5451
|
};
|
|
5452
5452
|
|
|
5453
|
+
const conditionTimeout = 2000;
|
|
5454
|
+
const mutationTimeout = 100;
|
|
5455
|
+
const waitForMutation = maxDelay => {
|
|
5456
|
+
return new Promise(resolve => {
|
|
5457
|
+
const observer = new MutationObserver(() => {
|
|
5458
|
+
clearTimeout(timeout);
|
|
5459
|
+
observer.disconnect();
|
|
5460
|
+
resolve();
|
|
5461
|
+
});
|
|
5462
|
+
const timeout = setTimeout(() => {
|
|
5463
|
+
observer.disconnect();
|
|
5464
|
+
resolve();
|
|
5465
|
+
}, maxDelay);
|
|
5466
|
+
observer.observe(document.body, {
|
|
5467
|
+
attributes: true,
|
|
5468
|
+
characterData: true,
|
|
5469
|
+
childList: true,
|
|
5470
|
+
subtree: true
|
|
5471
|
+
});
|
|
5472
|
+
});
|
|
5473
|
+
};
|
|
5474
|
+
const waitForCondition = async check => {
|
|
5475
|
+
const endTime = performance.now() + conditionTimeout;
|
|
5476
|
+
while (performance.now() < endTime) {
|
|
5477
|
+
if (check()) {
|
|
5478
|
+
return {
|
|
5479
|
+
error: false
|
|
5480
|
+
};
|
|
5481
|
+
}
|
|
5482
|
+
await waitForMutation(mutationTimeout);
|
|
5483
|
+
}
|
|
5484
|
+
return {
|
|
5485
|
+
error: true
|
|
5486
|
+
};
|
|
5487
|
+
};
|
|
5453
5488
|
const create$Overlay = () => {
|
|
5454
5489
|
const $TestOverlay = document.createElement('div');
|
|
5455
5490
|
$TestOverlay.id = 'TestOverlay';
|
|
@@ -5523,32 +5558,18 @@ const performKeyboardAction = (fnName, options) => {
|
|
|
5523
5558
|
const checkSingleElementCondition = async (locator, fnName, options) => {
|
|
5524
5559
|
const fn = SingleElementConditions[fnName];
|
|
5525
5560
|
const parsedSelector = getParsedSelector(locator);
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
return {
|
|
5531
|
-
error: false
|
|
5532
|
-
};
|
|
5533
|
-
}
|
|
5534
|
-
}
|
|
5535
|
-
return {
|
|
5536
|
-
error: true
|
|
5537
|
-
};
|
|
5561
|
+
return waitForCondition(() => {
|
|
5562
|
+
const element = querySelectorOne(parsedSelector);
|
|
5563
|
+
return Boolean(element && fn(element, options));
|
|
5564
|
+
});
|
|
5538
5565
|
};
|
|
5539
5566
|
const checkMultiElementCondition = async (locator, fnName, options) => {
|
|
5540
5567
|
const fn = MultiElementConditions[fnName];
|
|
5541
5568
|
const parsedSelector = getParsedSelector(locator);
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
error: false
|
|
5547
|
-
};
|
|
5548
|
-
}
|
|
5549
|
-
return {
|
|
5550
|
-
error: true
|
|
5551
|
-
};
|
|
5569
|
+
return waitForCondition(() => {
|
|
5570
|
+
const elements = querySelector(parsedSelector);
|
|
5571
|
+
return fn(elements, options);
|
|
5572
|
+
});
|
|
5552
5573
|
};
|
|
5553
5574
|
const checkConditionError = (fnName, ...params) => {
|
|
5554
5575
|
const fn = ConditionValues[fnName];
|
|
@@ -8970,7 +8991,7 @@ const addMenu = ($$Menus, change, uid) => {
|
|
|
8970
8991
|
const dom = change[2];
|
|
8971
8992
|
const $Menu = create$Menu();
|
|
8972
8993
|
set$8($Menu, uid);
|
|
8973
|
-
$Menu.
|
|
8994
|
+
$Menu.onmousemove = handleMenuMouseOver;
|
|
8974
8995
|
$Menu.onclick = handleMenuClick;
|
|
8975
8996
|
const {
|
|
8976
8997
|
focusedIndex,
|
|
@@ -9014,7 +9035,8 @@ const updateMenu = ($$Menus, change) => {
|
|
|
9014
9035
|
const $Menu = $$Menus[level];
|
|
9015
9036
|
setBounds$a($Menu, x, y, width, height);
|
|
9016
9037
|
renderInto($Menu, dom);
|
|
9017
|
-
|
|
9038
|
+
const isOpeningSubMenu = $$Menus.length < newLength;
|
|
9039
|
+
if (level === newLength - 1 || isOpeningSubMenu) {
|
|
9018
9040
|
if (focusedIndex === -1) {
|
|
9019
9041
|
$Menu.focus();
|
|
9020
9042
|
} else {
|