@lvce-editor/renderer-process 29.0.0 → 29.1.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.
- package/dist/rendererProcessMain.js +61 -57
- package/package.json +1 -1
|
@@ -1838,16 +1838,7 @@ const getHref = () => {
|
|
|
1838
1838
|
return location.href;
|
|
1839
1839
|
};
|
|
1840
1840
|
const matchesPathName = (a, b) => {
|
|
1841
|
-
|
|
1842
|
-
return true;
|
|
1843
|
-
}
|
|
1844
|
-
if (a === '/' && b === '') {
|
|
1845
|
-
return true;
|
|
1846
|
-
}
|
|
1847
|
-
if (a === '' && b === '/') {
|
|
1848
|
-
return true;
|
|
1849
|
-
}
|
|
1850
|
-
return false;
|
|
1841
|
+
return a === b || a === '/' && b === '' || a === '' && b === '/';
|
|
1851
1842
|
};
|
|
1852
1843
|
|
|
1853
1844
|
// TODO should do nothing if it is already at this path
|
|
@@ -1898,23 +1889,7 @@ const Message$2 = 'message';
|
|
|
1898
1889
|
const Error$3 = 'error';
|
|
1899
1890
|
|
|
1900
1891
|
const withResolvers = () => {
|
|
1901
|
-
|
|
1902
|
-
* @type {any}
|
|
1903
|
-
*/
|
|
1904
|
-
let _resolve;
|
|
1905
|
-
/**
|
|
1906
|
-
* @type {any}
|
|
1907
|
-
*/
|
|
1908
|
-
let _reject;
|
|
1909
|
-
const promise = new Promise((resolve, reject) => {
|
|
1910
|
-
_resolve = resolve;
|
|
1911
|
-
_reject = reject;
|
|
1912
|
-
});
|
|
1913
|
-
return {
|
|
1914
|
-
promise,
|
|
1915
|
-
reject: _reject,
|
|
1916
|
-
resolve: _resolve
|
|
1917
|
-
};
|
|
1892
|
+
return Promise.withResolvers();
|
|
1918
1893
|
};
|
|
1919
1894
|
|
|
1920
1895
|
const getFirstEvent$1 = (eventTarget, eventMap) => {
|
|
@@ -4342,7 +4317,7 @@ const selectorToString = parsedSelector => {
|
|
|
4342
4317
|
result = part.selector;
|
|
4343
4318
|
continue;
|
|
4344
4319
|
}
|
|
4345
|
-
result
|
|
4320
|
+
result += ` >> ${part.selector}`;
|
|
4346
4321
|
continue;
|
|
4347
4322
|
}
|
|
4348
4323
|
if (part.type === 'text') {
|
|
@@ -4350,14 +4325,14 @@ const selectorToString = parsedSelector => {
|
|
|
4350
4325
|
result = `text=${part.text}`;
|
|
4351
4326
|
continue;
|
|
4352
4327
|
}
|
|
4353
|
-
result
|
|
4328
|
+
result += ` text=${part.text}`;
|
|
4354
4329
|
continue;
|
|
4355
4330
|
}
|
|
4356
4331
|
if (part.type === 'has-text') {
|
|
4357
|
-
result
|
|
4332
|
+
result += ` "${part.text}"`;
|
|
4358
4333
|
continue;
|
|
4359
4334
|
}
|
|
4360
|
-
result
|
|
4335
|
+
result += `:nth(${part.index})`;
|
|
4361
4336
|
}
|
|
4362
4337
|
return result;
|
|
4363
4338
|
};
|
|
@@ -4689,6 +4664,16 @@ const showOverlay = (state, background, text, actions = []) => {
|
|
|
4689
4664
|
$TestOverlay.append(span, ...$actions);
|
|
4690
4665
|
document.body.append($TestOverlay);
|
|
4691
4666
|
};
|
|
4667
|
+
const showTestResults = text => {
|
|
4668
|
+
const existing = document.querySelector('.TestResults');
|
|
4669
|
+
const $TestResults = existing || document.createElement('div');
|
|
4670
|
+
$TestResults.className = 'TestResults';
|
|
4671
|
+
$TestResults.hidden = true;
|
|
4672
|
+
$TestResults.textContent = text;
|
|
4673
|
+
if (!existing) {
|
|
4674
|
+
document.body.append($TestResults);
|
|
4675
|
+
}
|
|
4676
|
+
};
|
|
4692
4677
|
const performAction = async (locator, fnName, options) => {
|
|
4693
4678
|
object(locator);
|
|
4694
4679
|
string(fnName);
|
|
@@ -8454,11 +8439,14 @@ const setUid = (viewletId, uid) => {
|
|
|
8454
8439
|
} = instance.state;
|
|
8455
8440
|
set$3($Viewlet, uid);
|
|
8456
8441
|
};
|
|
8457
|
-
const
|
|
8442
|
+
const focusCallback = {
|
|
8458
8443
|
id: 0,
|
|
8459
8444
|
selector: ''
|
|
8460
8445
|
};
|
|
8461
|
-
|
|
8446
|
+
const resetFocusCallback = () => {
|
|
8447
|
+
focusCallback.id = 0;
|
|
8448
|
+
focusCallback.selector = '';
|
|
8449
|
+
};
|
|
8462
8450
|
const focusSelector = (viewletId, selector) => {
|
|
8463
8451
|
const instance = get$a(viewletId);
|
|
8464
8452
|
if (!instance) {
|
|
@@ -8475,10 +8463,8 @@ const focusSelector = (viewletId, selector) => {
|
|
|
8475
8463
|
if ($Element.isConnected) {
|
|
8476
8464
|
$Element.focus();
|
|
8477
8465
|
} else {
|
|
8478
|
-
focusCallback =
|
|
8479
|
-
|
|
8480
|
-
selector
|
|
8481
|
-
};
|
|
8466
|
+
focusCallback.id = viewletId;
|
|
8467
|
+
focusCallback.selector = selector;
|
|
8482
8468
|
}
|
|
8483
8469
|
}
|
|
8484
8470
|
};
|
|
@@ -8774,14 +8760,14 @@ const replaceChildren = (parentId, childIds) => {
|
|
|
8774
8760
|
$Parent.replaceChildren($Fragment);
|
|
8775
8761
|
};
|
|
8776
8762
|
const applyLateFocusMaybe = () => {
|
|
8777
|
-
if (focusCallback
|
|
8763
|
+
if (!focusCallback.id) {
|
|
8778
8764
|
return;
|
|
8779
8765
|
}
|
|
8780
8766
|
const {
|
|
8781
8767
|
id,
|
|
8782
8768
|
selector
|
|
8783
8769
|
} = focusCallback;
|
|
8784
|
-
|
|
8770
|
+
resetFocusCallback();
|
|
8785
8771
|
const instance = get$a(id);
|
|
8786
8772
|
if (instance) {
|
|
8787
8773
|
const {
|
|
@@ -8790,7 +8776,6 @@ const applyLateFocusMaybe = () => {
|
|
|
8790
8776
|
const $Element = $Viewlet.querySelector(selector);
|
|
8791
8777
|
if ($Element) {
|
|
8792
8778
|
$Element.focus();
|
|
8793
|
-
focusCallback = emptyFocusCallback;
|
|
8794
8779
|
}
|
|
8795
8780
|
}
|
|
8796
8781
|
};
|
|
@@ -8949,17 +8934,16 @@ const set$1 = title => {
|
|
|
8949
8934
|
|
|
8950
8935
|
// workaround for not being setPointerCapture() not working on
|
|
8951
8936
|
// synthetic events
|
|
8952
|
-
|
|
8953
|
-
let originalReleasePointerCapture;
|
|
8937
|
+
const originalPointerCapture = {};
|
|
8954
8938
|
const mock = () => {
|
|
8955
|
-
|
|
8956
|
-
|
|
8939
|
+
originalPointerCapture.setPointerCapture = Element.prototype.setPointerCapture;
|
|
8940
|
+
originalPointerCapture.releasePointerCapture = Element.prototype.releasePointerCapture;
|
|
8957
8941
|
Element.prototype.setPointerCapture = () => {};
|
|
8958
8942
|
Element.prototype.releasePointerCapture = () => {};
|
|
8959
8943
|
};
|
|
8960
8944
|
const unmock = () => {
|
|
8961
|
-
Element.prototype.setPointerCapture =
|
|
8962
|
-
Element.prototype.releasePointerCapture =
|
|
8945
|
+
Element.prototype.setPointerCapture = originalPointerCapture.setPointerCapture;
|
|
8946
|
+
Element.prototype.releasePointerCapture = originalPointerCapture.releasePointerCapture;
|
|
8963
8947
|
};
|
|
8964
8948
|
|
|
8965
8949
|
const isFile = value => {
|
|
@@ -8996,7 +8980,7 @@ const waitForFrameToLoad = $Frame => {
|
|
|
8996
8980
|
promise,
|
|
8997
8981
|
resolve
|
|
8998
8982
|
} = withResolvers();
|
|
8999
|
-
$Frame.addEventListener('load', resolve, {
|
|
8983
|
+
$Frame.addEventListener('load', () => resolve(), {
|
|
9000
8984
|
once: true
|
|
9001
8985
|
});
|
|
9002
8986
|
return promise;
|
|
@@ -9120,6 +9104,7 @@ const commandMap = {
|
|
|
9120
9104
|
'TestFrameWork.performAction2': performAction2,
|
|
9121
9105
|
'TestFrameWork.performKeyBoardAction': performKeyboardAction,
|
|
9122
9106
|
'TestFrameWork.showOverlay': showOverlay,
|
|
9107
|
+
'TestFrameWork.showTestResults': showTestResults,
|
|
9123
9108
|
'TestFrameWork.transfer': transfer,
|
|
9124
9109
|
'TestFrameWork.transferToWebView': transferToWebView,
|
|
9125
9110
|
'Viewlet.addKeyBindings': addKeyBindings,
|
|
@@ -9310,9 +9295,8 @@ const RE_AT = /^\s+at/;
|
|
|
9310
9295
|
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
9311
9296
|
const RE_OBJECT_AS = /^\s*at Object\.\w+ \[as ([\w.]+)]/;
|
|
9312
9297
|
const RE_OBJECT = /^\s*at Object\.(\w+)/;
|
|
9313
|
-
const RE_PATH_1$1 = /\((
|
|
9314
|
-
const RE_PATH_2$1 = /at (
|
|
9315
|
-
const RE_PATH_3$1 = /@(.*):(\d+):(\d+)$/; // Firefox
|
|
9298
|
+
const RE_PATH_1$1 = /\(([^()]*):(\d+):(\d+)\)$/;
|
|
9299
|
+
const RE_PATH_2$1 = /at ([^\n]*):(\d+):(\d+)$/;
|
|
9316
9300
|
const RE_RESTORE_JSON_RPC_ERROR = /^\s*at restoreJsonRpcError/;
|
|
9317
9301
|
const RE_UNWRAP_JSON_RPC_RESULT = /^\s*at unwrapJsonRpcResult/;
|
|
9318
9302
|
const RE_HANDLE_JSON_RPC_MESSAGE = /^\s*at handleJsonRpcMessage/;
|
|
@@ -9325,8 +9309,14 @@ const isInternalLine = line => {
|
|
|
9325
9309
|
const isRelevantLine = line => {
|
|
9326
9310
|
return !isInternalLine(line);
|
|
9327
9311
|
};
|
|
9312
|
+
const isFirefoxStackLine = line => {
|
|
9313
|
+
const atIndex = line.indexOf('@');
|
|
9314
|
+
const columnIndex = line.lastIndexOf(':');
|
|
9315
|
+
const lineIndex = line.lastIndexOf(':', columnIndex - 1);
|
|
9316
|
+
return Boolean(atIndex !== -1 && lineIndex > atIndex && columnIndex > lineIndex && line.slice(lineIndex + 1, columnIndex) && line.slice(columnIndex + 1));
|
|
9317
|
+
};
|
|
9328
9318
|
const isNormalStackLine = line => {
|
|
9329
|
-
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line) || RE_PATH_2$1.test(line) ||
|
|
9319
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line) || RE_PATH_2$1.test(line) || isFirefoxStackLine(line);
|
|
9330
9320
|
};
|
|
9331
9321
|
const isApplicationUsefulLine = (line, index) => {
|
|
9332
9322
|
if (index === 0) {
|
|
@@ -9369,7 +9359,7 @@ const mergeCustom = (custom, relevantStack) => {
|
|
|
9369
9359
|
if (RE_PATH_2$1.test(firstLine)) {
|
|
9370
9360
|
return [` at ${firstLine}`, ...relevantStack];
|
|
9371
9361
|
}
|
|
9372
|
-
if (
|
|
9362
|
+
if (isFirefoxStackLine(firstLine)) {
|
|
9373
9363
|
return [firstLine, ...relevantStack];
|
|
9374
9364
|
}
|
|
9375
9365
|
return relevantStack;
|
|
@@ -9445,9 +9435,23 @@ const prepareErrorMessageWithCodeFrame = error => {
|
|
|
9445
9435
|
stderr: error.stderr
|
|
9446
9436
|
};
|
|
9447
9437
|
};
|
|
9448
|
-
const RE_PATH_1 = /\((
|
|
9449
|
-
const RE_PATH_2 = /at (
|
|
9450
|
-
const
|
|
9438
|
+
const RE_PATH_1 = /\(([^()]*):(\d+):(\d+)\)$/;
|
|
9439
|
+
const RE_PATH_2 = /at ([^\n]*):(\d+):(\d+)$/;
|
|
9440
|
+
const getFirefoxStackMatch = line => {
|
|
9441
|
+
const atIndex = line.indexOf('@');
|
|
9442
|
+
const columnIndex = line.lastIndexOf(':');
|
|
9443
|
+
const lineIndex = line.lastIndexOf(':', columnIndex - 1);
|
|
9444
|
+
if (atIndex === -1 || lineIndex <= atIndex || columnIndex <= lineIndex) {
|
|
9445
|
+
return undefined;
|
|
9446
|
+
}
|
|
9447
|
+
const path = line.slice(atIndex + 1, lineIndex);
|
|
9448
|
+
const lineNumber = line.slice(lineIndex + 1, columnIndex);
|
|
9449
|
+
const column = line.slice(columnIndex + 1);
|
|
9450
|
+
if (!path || !lineNumber || !column) {
|
|
9451
|
+
return undefined;
|
|
9452
|
+
}
|
|
9453
|
+
return [line, path, lineNumber, column];
|
|
9454
|
+
};
|
|
9451
9455
|
|
|
9452
9456
|
/**
|
|
9453
9457
|
*
|
|
@@ -9456,7 +9460,7 @@ const RE_PATH_3 = /@(.*):(\d+):(\d+)$/; // Firefox
|
|
|
9456
9460
|
*/
|
|
9457
9461
|
const getFile = lines => {
|
|
9458
9462
|
for (const line of lines) {
|
|
9459
|
-
if (RE_PATH_1.test(line) || RE_PATH_2.test(line) ||
|
|
9463
|
+
if (RE_PATH_1.test(line) || RE_PATH_2.test(line) || getFirefoxStackMatch(line)) {
|
|
9460
9464
|
return line;
|
|
9461
9465
|
}
|
|
9462
9466
|
}
|
|
@@ -9471,7 +9475,7 @@ const prepareErrorMessageWithoutCodeFrame = async error => {
|
|
|
9471
9475
|
match = file.match(RE_PATH_2);
|
|
9472
9476
|
}
|
|
9473
9477
|
if (!match) {
|
|
9474
|
-
match = file
|
|
9478
|
+
match = getFirefoxStackMatch(file);
|
|
9475
9479
|
}
|
|
9476
9480
|
if (!match) {
|
|
9477
9481
|
return error;
|