@lvce-editor/renderer-process 28.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 +203 -189
- package/package.json +1 -1
|
@@ -76,10 +76,8 @@ const readText = async () => {
|
|
|
76
76
|
const normalizeItems = async items => {
|
|
77
77
|
const normalized = [];
|
|
78
78
|
for (const clipboardItem of items) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
79
|
+
const webTypes = clipboardItem.types.filter(type => type.startsWith('web '));
|
|
80
|
+
for (const type of webTypes) {
|
|
83
81
|
const blob = await clipboardItem.getType(type);
|
|
84
82
|
normalized.push({
|
|
85
83
|
blob,
|
|
@@ -98,11 +96,11 @@ const writeText = async text => {
|
|
|
98
96
|
string(text);
|
|
99
97
|
await navigator.clipboard.writeText(text);
|
|
100
98
|
};
|
|
101
|
-
const
|
|
99
|
+
const toClipboardItem = options => {
|
|
102
100
|
return new ClipboardItem(options);
|
|
103
101
|
};
|
|
104
102
|
const write$1 = async itemOptions => {
|
|
105
|
-
const items = itemOptions.map(
|
|
103
|
+
const items = itemOptions.map(toClipboardItem);
|
|
106
104
|
await navigator.clipboard.write(items);
|
|
107
105
|
};
|
|
108
106
|
const writeImage = async blob => {
|
|
@@ -184,7 +182,7 @@ const uidSymbol = Symbol('uid');
|
|
|
184
182
|
|
|
185
183
|
const getUidTarget = $Element => {
|
|
186
184
|
while ($Element) {
|
|
187
|
-
if ($Element
|
|
185
|
+
if (Object.getOwnPropertyDescriptor($Element, uidSymbol)?.value) {
|
|
188
186
|
return $Element;
|
|
189
187
|
}
|
|
190
188
|
$Element = $Element.parentNode;
|
|
@@ -193,14 +191,18 @@ const getUidTarget = $Element => {
|
|
|
193
191
|
};
|
|
194
192
|
|
|
195
193
|
const setComponentUid = ($Element, uid) => {
|
|
196
|
-
$Element
|
|
194
|
+
Object.defineProperty($Element, uidSymbol, {
|
|
195
|
+
configurable: true,
|
|
196
|
+
value: uid,
|
|
197
|
+
writable: true
|
|
198
|
+
});
|
|
197
199
|
};
|
|
198
200
|
const getComponentUid = $Element => {
|
|
199
201
|
const $Target = getUidTarget($Element);
|
|
200
202
|
if (!$Target) {
|
|
201
203
|
return 0;
|
|
202
204
|
}
|
|
203
|
-
return $Target
|
|
205
|
+
return Object.getOwnPropertyDescriptor($Target, uidSymbol)?.value;
|
|
204
206
|
};
|
|
205
207
|
const getComponentUidFromEvent = event => {
|
|
206
208
|
const {
|
|
@@ -227,10 +229,10 @@ const setDragImage = (dataTransfer, label) => {
|
|
|
227
229
|
dragImage.textContent = label;
|
|
228
230
|
document.body.append(dragImage);
|
|
229
231
|
dataTransfer.setDragImage(dragImage, -10, -10);
|
|
230
|
-
const
|
|
232
|
+
const handleTimeout = () => {
|
|
231
233
|
dragImage.remove();
|
|
232
234
|
};
|
|
233
|
-
setTimeout(
|
|
235
|
+
setTimeout(handleTimeout, 0);
|
|
234
236
|
};
|
|
235
237
|
|
|
236
238
|
const applyDragInfoMaybe = event => {
|
|
@@ -451,10 +453,7 @@ const getEventListenerArg = (param, event) => {
|
|
|
451
453
|
};
|
|
452
454
|
|
|
453
455
|
const getEventListenerArgs = (params, event) => {
|
|
454
|
-
const serialized =
|
|
455
|
-
for (const param of params) {
|
|
456
|
-
serialized.push(getEventListenerArg(param, event));
|
|
457
|
-
}
|
|
456
|
+
const serialized = Array.from(params, param => getEventListenerArg(param, event));
|
|
458
457
|
return serialized;
|
|
459
458
|
};
|
|
460
459
|
|
|
@@ -1257,13 +1256,13 @@ const attachEvent = ($Node, eventMap, key, value, newEventMap) => {
|
|
|
1257
1256
|
if (previous) {
|
|
1258
1257
|
$Node.removeEventListener(keyLower, previous.listener, previous.options);
|
|
1259
1258
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1259
|
+
const fn = newEventMap?.[value];
|
|
1260
|
+
if (fn) {
|
|
1262
1261
|
const options = getOptions(fn);
|
|
1263
1262
|
// TODO support event listener options
|
|
1264
|
-
$Node.addEventListener(keyLower,
|
|
1263
|
+
$Node.addEventListener(keyLower, fn, options);
|
|
1265
1264
|
listenersByEvent.set(keyLower, {
|
|
1266
|
-
listener:
|
|
1265
|
+
listener: fn,
|
|
1267
1266
|
options
|
|
1268
1267
|
});
|
|
1269
1268
|
attachedListeners.set($Node, listenersByEvent);
|
|
@@ -1681,7 +1680,7 @@ const getActiveElementInside = $Viewlet => {
|
|
|
1681
1680
|
};
|
|
1682
1681
|
|
|
1683
1682
|
const queryInputs = $Viewlet => {
|
|
1684
|
-
return [...$Viewlet.querySelectorAll('input, textarea, select')];
|
|
1683
|
+
return [...$Viewlet.querySelectorAll(':scope input, :scope textarea, :scope select')];
|
|
1685
1684
|
};
|
|
1686
1685
|
|
|
1687
1686
|
const focusElement = $Element => {
|
|
@@ -1707,7 +1706,7 @@ const createHiddenContainer = (activeElement, focused) => {
|
|
|
1707
1706
|
return $Hidden;
|
|
1708
1707
|
};
|
|
1709
1708
|
const restoreFocusedElement = ($Hidden, $New, focused) => {
|
|
1710
|
-
const $NewFocused = $New.querySelector(`[name="${focused}"]`);
|
|
1709
|
+
const $NewFocused = $New.querySelector(`[name="${CSS.escape(focused)}"]`);
|
|
1711
1710
|
if (!$NewFocused) {
|
|
1712
1711
|
return;
|
|
1713
1712
|
}
|
|
@@ -1742,7 +1741,7 @@ const restoreFocus = ($Viewlet, isRootTree, isTreeFocused, focused) => {
|
|
|
1742
1741
|
return;
|
|
1743
1742
|
}
|
|
1744
1743
|
if (isTreeFocused) {
|
|
1745
|
-
const $Tree = $Viewlet.querySelector('[role="tree"]');
|
|
1744
|
+
const $Tree = $Viewlet.querySelector(':scope [role="tree"]');
|
|
1746
1745
|
if ($Tree) {
|
|
1747
1746
|
// @ts-ignore
|
|
1748
1747
|
focusElement($Tree);
|
|
@@ -1752,7 +1751,7 @@ const restoreFocus = ($Viewlet, isRootTree, isTreeFocused, focused) => {
|
|
|
1752
1751
|
if (!focused) {
|
|
1753
1752
|
return;
|
|
1754
1753
|
}
|
|
1755
|
-
const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
|
|
1754
|
+
const $Focused = $Viewlet.querySelector(`[name="${CSS.escape(focused)}"]`);
|
|
1756
1755
|
if ($Focused) {
|
|
1757
1756
|
// @ts-ignore
|
|
1758
1757
|
focusElement($Focused);
|
|
@@ -1817,9 +1816,9 @@ const addFileHandle = fileHandle => {
|
|
|
1817
1816
|
const getTitleBarHeight = () => {
|
|
1818
1817
|
if (
|
|
1819
1818
|
// @ts-expect-error
|
|
1820
|
-
navigator.windowControlsOverlay?.getTitlebarAreaRect) {
|
|
1819
|
+
globalThis.navigator.windowControlsOverlay?.getTitlebarAreaRect) {
|
|
1821
1820
|
// @ts-expect-error
|
|
1822
|
-
const titleBarRect = navigator.windowControlsOverlay.getTitlebarAreaRect();
|
|
1821
|
+
const titleBarRect = globalThis.navigator.windowControlsOverlay.getTitlebarAreaRect();
|
|
1823
1822
|
return titleBarRect.height;
|
|
1824
1823
|
}
|
|
1825
1824
|
return 0;
|
|
@@ -1839,16 +1838,7 @@ const getHref = () => {
|
|
|
1839
1838
|
return location.href;
|
|
1840
1839
|
};
|
|
1841
1840
|
const matchesPathName = (a, b) => {
|
|
1842
|
-
|
|
1843
|
-
return true;
|
|
1844
|
-
}
|
|
1845
|
-
if (a === '/' && b === '') {
|
|
1846
|
-
return true;
|
|
1847
|
-
}
|
|
1848
|
-
if (a === '' && b === '/') {
|
|
1849
|
-
return true;
|
|
1850
|
-
}
|
|
1851
|
-
return false;
|
|
1841
|
+
return a === b || a === '/' && b === '' || a === '' && b === '/';
|
|
1852
1842
|
};
|
|
1853
1843
|
|
|
1854
1844
|
// TODO should do nothing if it is already at this path
|
|
@@ -1899,23 +1889,7 @@ const Message$2 = 'message';
|
|
|
1899
1889
|
const Error$3 = 'error';
|
|
1900
1890
|
|
|
1901
1891
|
const withResolvers = () => {
|
|
1902
|
-
|
|
1903
|
-
* @type {any}
|
|
1904
|
-
*/
|
|
1905
|
-
let _resolve;
|
|
1906
|
-
/**
|
|
1907
|
-
* @type {any}
|
|
1908
|
-
*/
|
|
1909
|
-
let _reject;
|
|
1910
|
-
const promise = new Promise((resolve, reject) => {
|
|
1911
|
-
_resolve = resolve;
|
|
1912
|
-
_reject = reject;
|
|
1913
|
-
});
|
|
1914
|
-
return {
|
|
1915
|
-
promise,
|
|
1916
|
-
reject: _reject,
|
|
1917
|
-
resolve: _resolve
|
|
1918
|
-
};
|
|
1892
|
+
return Promise.withResolvers();
|
|
1919
1893
|
};
|
|
1920
1894
|
|
|
1921
1895
|
const getFirstEvent$1 = (eventTarget, eventMap) => {
|
|
@@ -2077,7 +2051,7 @@ const getData$1 = event => {
|
|
|
2077
2051
|
};
|
|
2078
2052
|
const wrap = worker => {
|
|
2079
2053
|
let handleMessage;
|
|
2080
|
-
|
|
2054
|
+
const wrapped = {
|
|
2081
2055
|
get onmessage() {
|
|
2082
2056
|
return handleMessage;
|
|
2083
2057
|
},
|
|
@@ -2087,7 +2061,7 @@ const wrap = worker => {
|
|
|
2087
2061
|
const data = getData$1(event);
|
|
2088
2062
|
listener({
|
|
2089
2063
|
data,
|
|
2090
|
-
target:
|
|
2064
|
+
target: wrapped
|
|
2091
2065
|
});
|
|
2092
2066
|
};
|
|
2093
2067
|
} else {
|
|
@@ -2103,6 +2077,7 @@ const wrap = worker => {
|
|
|
2103
2077
|
worker.postMessage(message, transfer);
|
|
2104
2078
|
}
|
|
2105
2079
|
};
|
|
2080
|
+
return wrapped;
|
|
2106
2081
|
};
|
|
2107
2082
|
|
|
2108
2083
|
const IpcParentWithModuleWorker$2 = {
|
|
@@ -2120,7 +2095,10 @@ const create$J = async ({
|
|
|
2120
2095
|
}) => {
|
|
2121
2096
|
string(url);
|
|
2122
2097
|
const portPromise = await new Promise(resolve => {
|
|
2123
|
-
globalThis
|
|
2098
|
+
Object.defineProperty(globalThis, 'acceptPort', {
|
|
2099
|
+
configurable: true,
|
|
2100
|
+
value: resolve
|
|
2101
|
+
});
|
|
2124
2102
|
});
|
|
2125
2103
|
await import(url);
|
|
2126
2104
|
const port = await portPromise;
|
|
@@ -2141,7 +2119,10 @@ const IpcParentWithMessagePort$2 = {
|
|
|
2141
2119
|
|
|
2142
2120
|
const create$I = async url => {
|
|
2143
2121
|
const referencePort = await new Promise(resolve => {
|
|
2144
|
-
globalThis
|
|
2122
|
+
Object.defineProperty(globalThis, 'acceptReferencePort', {
|
|
2123
|
+
configurable: true,
|
|
2124
|
+
value: resolve
|
|
2125
|
+
});
|
|
2145
2126
|
import(url);
|
|
2146
2127
|
});
|
|
2147
2128
|
delete globalThis.acceptReferencePort;
|
|
@@ -3542,7 +3523,7 @@ const create$Widgets = () => {
|
|
|
3542
3523
|
return $Widgets;
|
|
3543
3524
|
};
|
|
3544
3525
|
const append$1 = $Element => {
|
|
3545
|
-
// TODO should not call append in the first place if it is already in
|
|
3526
|
+
// TODO should not call append in the first place if it is already in DOM
|
|
3546
3527
|
if (state$6.widgetSet.has($Element)) {
|
|
3547
3528
|
return;
|
|
3548
3529
|
}
|
|
@@ -3680,7 +3661,7 @@ const Menu = 'menu';
|
|
|
3680
3661
|
const None$1 = 'none';
|
|
3681
3662
|
const Status = 'status';
|
|
3682
3663
|
const TabList = 'tablist';
|
|
3683
|
-
const
|
|
3664
|
+
const Toolbar = 'toolbar';
|
|
3684
3665
|
|
|
3685
3666
|
const create$BackDrop = () => {
|
|
3686
3667
|
const $BackDrop = document.createElement('div');
|
|
@@ -3730,7 +3711,7 @@ const stopPropagation = event => {
|
|
|
3730
3711
|
event.stopPropagation();
|
|
3731
3712
|
};
|
|
3732
3713
|
|
|
3733
|
-
// TODO this module should be called
|
|
3714
|
+
// TODO this module should be called DOM or DOM utils
|
|
3734
3715
|
|
|
3735
3716
|
// TODO this module makes for weird code splitting chunks,
|
|
3736
3717
|
// maybe duplicate the code per file for better chunks
|
|
@@ -3832,8 +3813,8 @@ const FocusOutput = 28;
|
|
|
3832
3813
|
// TODO using .style.top, .style.left causes chrome devtools to show many layout shift -> maybe use transform instead
|
|
3833
3814
|
|
|
3834
3815
|
// TODO when cycling through items, recalculate style is much slower
|
|
3835
|
-
// than in
|
|
3836
|
-
// paint is also faster in
|
|
3816
|
+
// than in VS Code (1.49ms vs 0.33ms)
|
|
3817
|
+
// paint is also faster in VS Code (0.32ms vs 0.14ms)
|
|
3837
3818
|
|
|
3838
3819
|
// TODO focus on menu is not announced to screenreader
|
|
3839
3820
|
|
|
@@ -3972,7 +3953,7 @@ const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
|
|
|
3972
3953
|
}
|
|
3973
3954
|
};
|
|
3974
3955
|
|
|
3975
|
-
// TODO replace function that recycles menu
|
|
3956
|
+
// TODO replace function that recycles menu DOM nodes
|
|
3976
3957
|
|
|
3977
3958
|
const handleBackDropMouseDown = event => {
|
|
3978
3959
|
preventDefault(event);
|
|
@@ -3986,7 +3967,7 @@ const handleBackDropMouseDown = event => {
|
|
|
3986
3967
|
const handleContextMenu$7 = event => {
|
|
3987
3968
|
preventDefault(event);
|
|
3988
3969
|
};
|
|
3989
|
-
const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mouseBlocking = false) => {
|
|
3970
|
+
const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [], mouseBlocking = false) => {
|
|
3990
3971
|
if (mouseBlocking) {
|
|
3991
3972
|
const $BackDrop = create$BackDrop();
|
|
3992
3973
|
$BackDrop.onmousedown = handleBackDropMouseDown;
|
|
@@ -4015,7 +3996,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mous
|
|
|
4015
3996
|
send('Focus.setFocus', FocusMenu);
|
|
4016
3997
|
}
|
|
4017
3998
|
};
|
|
4018
|
-
const
|
|
3999
|
+
const hideSubmenu = level => {
|
|
4019
4000
|
const $$ChildMenus = state$3.$$Menus.slice(level);
|
|
4020
4001
|
for (const $ChildMenu of $$ChildMenus) {
|
|
4021
4002
|
remove$1($ChildMenu);
|
|
@@ -4061,7 +4042,6 @@ const showControlled = ({
|
|
|
4061
4042
|
x,
|
|
4062
4043
|
y
|
|
4063
4044
|
}) => {
|
|
4064
|
-
// @ts-expect-error
|
|
4065
4045
|
showMenu(x, y, width, height, items, level);
|
|
4066
4046
|
// TODO menu should not necessarily know about parent (titleBarMenuBar)
|
|
4067
4047
|
// it should be the other way around
|
|
@@ -4098,7 +4078,7 @@ const openUrl = url => {
|
|
|
4098
4078
|
window.open(url);
|
|
4099
4079
|
};
|
|
4100
4080
|
const redirectToUrl = url => {
|
|
4101
|
-
window.location.
|
|
4081
|
+
window.location.assign(url);
|
|
4102
4082
|
};
|
|
4103
4083
|
|
|
4104
4084
|
const isElectronUserAgentSpecificMemoryError = error => {
|
|
@@ -4111,9 +4091,9 @@ const isElectronUserAgentSpecificMemoryError = error => {
|
|
|
4111
4091
|
const measureUserAgentSpecificMemory = async () => {
|
|
4112
4092
|
try {
|
|
4113
4093
|
// @ts-expect-error
|
|
4114
|
-
if (performance?.measureUserAgentSpecificMemory) {
|
|
4094
|
+
if (globalThis.performance?.measureUserAgentSpecificMemory) {
|
|
4115
4095
|
// @ts-expect-error
|
|
4116
|
-
const memory = await performance.measureUserAgentSpecificMemory();
|
|
4096
|
+
const memory = await globalThis.performance.measureUserAgentSpecificMemory();
|
|
4117
4097
|
return memory;
|
|
4118
4098
|
}
|
|
4119
4099
|
} catch (error) {
|
|
@@ -4158,7 +4138,7 @@ const getCombinedErrorMessage = (error, message) => {
|
|
|
4158
4138
|
if (message) {
|
|
4159
4139
|
return `${message}: ${error}`;
|
|
4160
4140
|
}
|
|
4161
|
-
return
|
|
4141
|
+
return String(error);
|
|
4162
4142
|
};
|
|
4163
4143
|
|
|
4164
4144
|
const mergeStacks = (parent, child) => {
|
|
@@ -4180,7 +4160,8 @@ const getErrorStack = error => {
|
|
|
4180
4160
|
return error.stack;
|
|
4181
4161
|
}
|
|
4182
4162
|
if (error && error.lineNumber && error.columnNumber && error.fileName) {
|
|
4183
|
-
const
|
|
4163
|
+
const testError = new Error();
|
|
4164
|
+
const normalStackLooksLike = testError.stack;
|
|
4184
4165
|
// @ts-ignore
|
|
4185
4166
|
if (/^[$\w]+@.*/.test(normalStackLooksLike)) {
|
|
4186
4167
|
// firefox stack trace
|
|
@@ -4336,7 +4317,7 @@ const selectorToString = parsedSelector => {
|
|
|
4336
4317
|
result = part.selector;
|
|
4337
4318
|
continue;
|
|
4338
4319
|
}
|
|
4339
|
-
result
|
|
4320
|
+
result += ` >> ${part.selector}`;
|
|
4340
4321
|
continue;
|
|
4341
4322
|
}
|
|
4342
4323
|
if (part.type === 'text') {
|
|
@@ -4344,14 +4325,14 @@ const selectorToString = parsedSelector => {
|
|
|
4344
4325
|
result = `text=${part.text}`;
|
|
4345
4326
|
continue;
|
|
4346
4327
|
}
|
|
4347
|
-
result
|
|
4328
|
+
result += ` text=${part.text}`;
|
|
4348
4329
|
continue;
|
|
4349
4330
|
}
|
|
4350
4331
|
if (part.type === 'has-text') {
|
|
4351
|
-
result
|
|
4332
|
+
result += ` "${part.text}"`;
|
|
4352
4333
|
continue;
|
|
4353
4334
|
}
|
|
4354
|
-
result
|
|
4335
|
+
result += `:nth(${part.index})`;
|
|
4355
4336
|
}
|
|
4356
4337
|
return result;
|
|
4357
4338
|
};
|
|
@@ -4546,7 +4527,7 @@ const press = options => {
|
|
|
4546
4527
|
keyUp(element, options);
|
|
4547
4528
|
};
|
|
4548
4529
|
|
|
4549
|
-
const
|
|
4530
|
+
const KeyboardActions = {
|
|
4550
4531
|
__proto__: null,
|
|
4551
4532
|
press
|
|
4552
4533
|
};
|
|
@@ -4683,6 +4664,16 @@ const showOverlay = (state, background, text, actions = []) => {
|
|
|
4683
4664
|
$TestOverlay.append(span, ...$actions);
|
|
4684
4665
|
document.body.append($TestOverlay);
|
|
4685
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
|
+
};
|
|
4686
4677
|
const performAction = async (locator, fnName, options) => {
|
|
4687
4678
|
object(locator);
|
|
4688
4679
|
string(fnName);
|
|
@@ -4694,8 +4685,8 @@ const performAction = async (locator, fnName, options) => {
|
|
|
4694
4685
|
}
|
|
4695
4686
|
fn(element, options);
|
|
4696
4687
|
};
|
|
4697
|
-
const
|
|
4698
|
-
const fn =
|
|
4688
|
+
const performKeyboardAction = (fnName, options) => {
|
|
4689
|
+
const fn = KeyboardActions[fnName];
|
|
4699
4690
|
fn(options);
|
|
4700
4691
|
};
|
|
4701
4692
|
const checkSingleElementCondition = async (locator, fnName, options) => {
|
|
@@ -4769,7 +4760,8 @@ const transferToWebView = objectId => {
|
|
|
4769
4760
|
// TODO allow specifying transfer origin from renderer worker
|
|
4770
4761
|
// TODO allow specifing method from renderer worker
|
|
4771
4762
|
const port = acquire(objectId);
|
|
4772
|
-
const
|
|
4763
|
+
const targetUrl = new URL($Iframe.src || location.href, location.href);
|
|
4764
|
+
const targetOrigin = targetUrl.origin;
|
|
4773
4765
|
contentWindow.postMessage({
|
|
4774
4766
|
jsonrpc: '2.0',
|
|
4775
4767
|
method: 'handlePort',
|
|
@@ -4801,7 +4793,7 @@ const getIdentifiers = () => {
|
|
|
4801
4793
|
return state$2.identifiers;
|
|
4802
4794
|
};
|
|
4803
4795
|
|
|
4804
|
-
// TODO store keybindings as
|
|
4796
|
+
// TODO store keybindings as JSON somewhere
|
|
4805
4797
|
|
|
4806
4798
|
// TODO sort keybindings by `when` priority -> focus.editorCompletions: 10, focus.editor:9 etc.
|
|
4807
4799
|
|
|
@@ -4809,7 +4801,7 @@ const getIdentifiers = () => {
|
|
|
4809
4801
|
// could remove some context logic and have less user configuration when these are default
|
|
4810
4802
|
// e.g. arrow down focuses next, arrow up always focuses previous item (like in aria spec)
|
|
4811
4803
|
|
|
4812
|
-
// TODO
|
|
4804
|
+
// TODO UI should only have keys -> commands get resolved inside renderer worker
|
|
4813
4805
|
// TODO should toggle terminal, not only open
|
|
4814
4806
|
|
|
4815
4807
|
const setIdentifiers = identifiers => {
|
|
@@ -5229,7 +5221,7 @@ const setOffsetX = (state, offsetX) => {
|
|
|
5229
5221
|
const {
|
|
5230
5222
|
$Viewlet
|
|
5231
5223
|
} = state;
|
|
5232
|
-
const $ColorPickerSliderThumb = $Viewlet.querySelector('.ColorPickerSliderThumb');
|
|
5224
|
+
const $ColorPickerSliderThumb = $Viewlet.querySelector(':scope .ColorPickerSliderThumb');
|
|
5233
5225
|
setXAndYTransform($ColorPickerSliderThumb, offsetX, 0);
|
|
5234
5226
|
applyUidWorkaround($Viewlet);
|
|
5235
5227
|
};
|
|
@@ -5319,14 +5311,14 @@ const setValue$2 = (state, value) => {
|
|
|
5319
5311
|
const {
|
|
5320
5312
|
$Viewlet
|
|
5321
5313
|
} = state;
|
|
5322
|
-
const $Input = $Viewlet.querySelector('input');
|
|
5314
|
+
const $Input = $Viewlet.querySelector(':scope input');
|
|
5323
5315
|
$Input.value = value;
|
|
5324
5316
|
};
|
|
5325
5317
|
const focus$c = state => {
|
|
5326
5318
|
const {
|
|
5327
5319
|
$Viewlet
|
|
5328
5320
|
} = state;
|
|
5329
|
-
const $Input = $Viewlet.querySelector('input');
|
|
5321
|
+
const $Input = $Viewlet.querySelector(':scope input');
|
|
5330
5322
|
$Input.focus();
|
|
5331
5323
|
};
|
|
5332
5324
|
|
|
@@ -5355,7 +5347,7 @@ const create$p = icon => {
|
|
|
5355
5347
|
};
|
|
5356
5348
|
|
|
5357
5349
|
const create$Button = (label, icon) => {
|
|
5358
|
-
// TODO icon div might not be needed (unnecessary
|
|
5350
|
+
// TODO icon div might not be needed (unnecessary HTML element)
|
|
5359
5351
|
const $Icon = create$p(icon);
|
|
5360
5352
|
const $Button = document.createElement('button');
|
|
5361
5353
|
$Button.className = 'IconButton';
|
|
@@ -5559,7 +5551,7 @@ const setIframe$3 = (state, src, sandbox = []) => {
|
|
|
5559
5551
|
const {
|
|
5560
5552
|
$Viewlet
|
|
5561
5553
|
} = state;
|
|
5562
|
-
const $Parent = $Viewlet.querySelector('.E2eTestIframeWrapper');
|
|
5554
|
+
const $Parent = $Viewlet.querySelector(':scope .E2eTestIframeWrapper');
|
|
5563
5555
|
const $Iframe = document.createElement('iframe');
|
|
5564
5556
|
for (const element of sandbox) {
|
|
5565
5557
|
$Iframe.sandbox.add(element);
|
|
@@ -5572,7 +5564,7 @@ const setPreviewTransform = (state, transform) => {
|
|
|
5572
5564
|
const {
|
|
5573
5565
|
$Viewlet
|
|
5574
5566
|
} = state;
|
|
5575
|
-
const $Parent = $Viewlet.querySelector('.E2eTestIframeWrapper');
|
|
5567
|
+
const $Parent = $Viewlet.querySelector(':scope .E2eTestIframeWrapper');
|
|
5576
5568
|
$Parent.style.transform = transform;
|
|
5577
5569
|
};
|
|
5578
5570
|
// export const setPort = (state, portId, origin) => {
|
|
@@ -5935,7 +5927,7 @@ const handleError$5 = (state, error) => {
|
|
|
5935
5927
|
const {
|
|
5936
5928
|
$Viewlet
|
|
5937
5929
|
} = state;
|
|
5938
|
-
$Viewlet.textContent =
|
|
5930
|
+
$Viewlet.textContent = String(error);
|
|
5939
5931
|
};
|
|
5940
5932
|
const setBounds$8 = (state, x, y, width, height) => {
|
|
5941
5933
|
const {
|
|
@@ -6018,7 +6010,7 @@ const ViewletEditorCompletionDetails = {
|
|
|
6018
6010
|
setDom: setDom$7
|
|
6019
6011
|
};
|
|
6020
6012
|
|
|
6021
|
-
// TODO not sure whether created
|
|
6013
|
+
// TODO not sure whether created DOM node
|
|
6022
6014
|
// should stay in state or be removed
|
|
6023
6015
|
// one option would result in less memory usage
|
|
6024
6016
|
// the other option would result in less garbage collection
|
|
@@ -6235,7 +6227,7 @@ const setTransform = (state, transform) => {
|
|
|
6235
6227
|
const {
|
|
6236
6228
|
$Viewlet
|
|
6237
6229
|
} = state;
|
|
6238
|
-
const $ImageWrapper = $Viewlet.querySelector('.ImageContent');
|
|
6230
|
+
const $ImageWrapper = $Viewlet.querySelector(':scope .ImageContent');
|
|
6239
6231
|
$ImageWrapper.style.transform = transform;
|
|
6240
6232
|
};
|
|
6241
6233
|
const setDragging = (state, isDragging) => {
|
|
@@ -6598,7 +6590,7 @@ const setValue$1 = (state, value) => {
|
|
|
6598
6590
|
const {
|
|
6599
6591
|
$Viewlet
|
|
6600
6592
|
} = state;
|
|
6601
|
-
const $InputBox = $Viewlet.querySelector('.MultilineInputBox');
|
|
6593
|
+
const $InputBox = $Viewlet.querySelector(':scope .MultilineInputBox');
|
|
6602
6594
|
if (!$InputBox) {
|
|
6603
6595
|
return;
|
|
6604
6596
|
}
|
|
@@ -6661,7 +6653,7 @@ const setFocusedIndex$1 = (state, oldFocusedIndex, newFocusedIndex) => {
|
|
|
6661
6653
|
const {
|
|
6662
6654
|
$Viewlet
|
|
6663
6655
|
} = state;
|
|
6664
|
-
const $Locations = $Viewlet.
|
|
6656
|
+
const $Locations = $Viewlet.querySelector(':scope .LocationList');
|
|
6665
6657
|
if (oldFocusedIndex === -1) {
|
|
6666
6658
|
$Locations.classList.remove('FocusOutline');
|
|
6667
6659
|
} else {
|
|
@@ -6771,7 +6763,7 @@ const setValue = (state, value) => {
|
|
|
6771
6763
|
const {
|
|
6772
6764
|
$Viewlet
|
|
6773
6765
|
} = state;
|
|
6774
|
-
const $InputBox = $Viewlet.querySelector('input');
|
|
6766
|
+
const $InputBox = $Viewlet.querySelector(':scope input');
|
|
6775
6767
|
$InputBox.value = value;
|
|
6776
6768
|
};
|
|
6777
6769
|
const setColumnWidths = (state, columnWidth1, columnWidth2, columnWidth3) => {
|
|
@@ -6779,7 +6771,7 @@ const setColumnWidths = (state, columnWidth1, columnWidth2, columnWidth3) => {
|
|
|
6779
6771
|
const {
|
|
6780
6772
|
$Viewlet
|
|
6781
6773
|
} = state;
|
|
6782
|
-
const $$Resizers = $Viewlet.querySelectorAll('.Resizer');
|
|
6774
|
+
const $$Resizers = $Viewlet.querySelectorAll(':scope .Resizer');
|
|
6783
6775
|
const $Resizer1 = $$Resizers[0];
|
|
6784
6776
|
const $Resizer2 = $$Resizers[1];
|
|
6785
6777
|
$Resizer1.style.left = `${paddingLeft + columnWidth1}px`;
|
|
@@ -6926,9 +6918,9 @@ const handleKeyUp = handleKeyUp$1;
|
|
|
6926
6918
|
|
|
6927
6919
|
const create$c = () => {
|
|
6928
6920
|
// TODO use aria role splitter once supported https://github.com/w3c/aria/issues/1348
|
|
6929
|
-
const $
|
|
6930
|
-
$
|
|
6931
|
-
$
|
|
6921
|
+
const $SashSidebar = document.createElement('div');
|
|
6922
|
+
$SashSidebar.className = 'Viewlet Sash SashVertical';
|
|
6923
|
+
$SashSidebar.id = 'SashSideBar';
|
|
6932
6924
|
|
|
6933
6925
|
// TODO use aria role splitter once supported https://github.com/w3c/aria/issues/1348
|
|
6934
6926
|
const $SashPanel = document.createElement('div');
|
|
@@ -6938,19 +6930,19 @@ const create$c = () => {
|
|
|
6938
6930
|
$Viewlet.id = 'Workbench';
|
|
6939
6931
|
$Viewlet.className = 'Viewlet Layout Workbench';
|
|
6940
6932
|
$Viewlet.role = Application;
|
|
6941
|
-
$Viewlet.append($
|
|
6933
|
+
$Viewlet.append($SashSidebar, $SashPanel);
|
|
6942
6934
|
return {
|
|
6943
6935
|
$SashPanel,
|
|
6944
|
-
$
|
|
6936
|
+
$SashSidebar,
|
|
6945
6937
|
$Viewlet
|
|
6946
6938
|
};
|
|
6947
6939
|
};
|
|
6948
6940
|
const attachEvents$2 = state => {
|
|
6949
6941
|
const {
|
|
6950
6942
|
$SashPanel,
|
|
6951
|
-
$
|
|
6943
|
+
$SashSidebar
|
|
6952
6944
|
} = state;
|
|
6953
|
-
attachEvents$6($
|
|
6945
|
+
attachEvents$6($SashSidebar, {
|
|
6954
6946
|
[DoubleClick]: handleSashDoubleClick,
|
|
6955
6947
|
[PointerDown]: handleSashPointerDown
|
|
6956
6948
|
});
|
|
@@ -6966,13 +6958,13 @@ const attachEvents$2 = state => {
|
|
|
6966
6958
|
[Resize]: handleResize
|
|
6967
6959
|
});
|
|
6968
6960
|
};
|
|
6969
|
-
const setSashes = (state,
|
|
6961
|
+
const setSashes = (state, sashSidebar, sashPanel) => {
|
|
6970
6962
|
const {
|
|
6971
6963
|
$SashPanel,
|
|
6972
|
-
$
|
|
6964
|
+
$SashSidebar
|
|
6973
6965
|
} = state;
|
|
6974
|
-
setBounds$a($
|
|
6975
|
-
$
|
|
6966
|
+
setBounds$a($SashSidebar, sashSidebar.x, sashSidebar.y, sashSidebar.width, sashSidebar.height);
|
|
6967
|
+
$SashSidebar.classList.toggle('SashActive', sashSidebar.active);
|
|
6976
6968
|
setBounds$a($SashPanel, sashPanel.x, sashPanel.y, sashPanel.width, sashPanel.height);
|
|
6977
6969
|
$SashPanel.classList.toggle('SashActive', sashPanel.active);
|
|
6978
6970
|
};
|
|
@@ -7013,7 +7005,7 @@ const Panel = 'Panel';
|
|
|
7013
7005
|
const References = 'References';
|
|
7014
7006
|
const RunAndDebug = 'Run And Debug';
|
|
7015
7007
|
const ScreenCapture = 'ScreenCapture';
|
|
7016
|
-
const
|
|
7008
|
+
const Sidebar$1 = 'SideBar';
|
|
7017
7009
|
const SimpleBrowser = 'SimpleBrowser';
|
|
7018
7010
|
const SourceControl = 'Source Control';
|
|
7019
7011
|
const StatusBar$1 = 'StatusBar';
|
|
@@ -7151,16 +7143,16 @@ const create$a = () => {
|
|
|
7151
7143
|
const $ButtonMaximize = create$Button(UiStrings.Maximize, 'ChevronUp');
|
|
7152
7144
|
// TODO use event delegation
|
|
7153
7145
|
|
|
7154
|
-
const $
|
|
7155
|
-
$
|
|
7156
|
-
$
|
|
7157
|
-
$
|
|
7146
|
+
const $PanelToolbar = document.createElement('div');
|
|
7147
|
+
$PanelToolbar.className = 'PanelToolBar';
|
|
7148
|
+
$PanelToolbar.role = Toolbar;
|
|
7149
|
+
$PanelToolbar.append($ButtonMaximize, $ButtonClose);
|
|
7158
7150
|
const $PanelActions = document.createElement('div');
|
|
7159
7151
|
$PanelActions.className = 'Actions';
|
|
7160
7152
|
$PanelActions.role = 'toolbar';
|
|
7161
7153
|
const $PanelHeader = document.createElement('div');
|
|
7162
7154
|
$PanelHeader.className = 'PanelHeader';
|
|
7163
|
-
$PanelHeader.append($PanelTabs, $PanelActions, $
|
|
7155
|
+
$PanelHeader.append($PanelTabs, $PanelActions, $PanelToolbar);
|
|
7164
7156
|
// const $PanelContent = document.createElement('div')
|
|
7165
7157
|
// $PanelContent.id = 'PanelContent'
|
|
7166
7158
|
const $Viewlet = document.createElement('div');
|
|
@@ -7276,7 +7268,7 @@ const ViewletRunAndDebug = {
|
|
|
7276
7268
|
__proto__: null
|
|
7277
7269
|
};
|
|
7278
7270
|
|
|
7279
|
-
const
|
|
7271
|
+
const handleLoadedMetadata = event => {
|
|
7280
7272
|
// TODO should send event to renderer worker, renderer worker should invoke play method
|
|
7281
7273
|
const {
|
|
7282
7274
|
target
|
|
@@ -7298,7 +7290,7 @@ const setScreenCapture = (state, id) => {
|
|
|
7298
7290
|
const $Video = document.createElement('video');
|
|
7299
7291
|
const screenCapture = get$2(id);
|
|
7300
7292
|
$Video.srcObject = screenCapture;
|
|
7301
|
-
$Video.onloadedmetadata =
|
|
7293
|
+
$Video.onloadedmetadata = handleLoadedMetadata;
|
|
7302
7294
|
$Viewlet.append($Video);
|
|
7303
7295
|
};
|
|
7304
7296
|
|
|
@@ -7308,7 +7300,7 @@ const ViewletScreenCapture = {
|
|
|
7308
7300
|
setScreenCapture
|
|
7309
7301
|
};
|
|
7310
7302
|
|
|
7311
|
-
const
|
|
7303
|
+
const Sidebar = 'Side Bar';
|
|
7312
7304
|
const StatusBar = 'Status Bar';
|
|
7313
7305
|
|
|
7314
7306
|
const handleClickAction = (target, uid) => {
|
|
@@ -7328,44 +7320,44 @@ const handleHeaderClick = event => {
|
|
|
7328
7320
|
};
|
|
7329
7321
|
|
|
7330
7322
|
const create$8 = () => {
|
|
7331
|
-
const $
|
|
7332
|
-
$
|
|
7333
|
-
const $
|
|
7334
|
-
$
|
|
7335
|
-
$
|
|
7323
|
+
const $SidebarTitleAreaTitle = document.createElement('h2');
|
|
7324
|
+
$SidebarTitleAreaTitle.className = 'SideBarTitleAreaTitle';
|
|
7325
|
+
const $SidebarTitleArea = document.createElement('div');
|
|
7326
|
+
$SidebarTitleArea.className = 'SideBarTitleArea';
|
|
7327
|
+
$SidebarTitleArea.append($SidebarTitleAreaTitle);
|
|
7336
7328
|
const $Viewlet = document.createElement('div');
|
|
7337
7329
|
$Viewlet.id = 'SideBar';
|
|
7338
7330
|
$Viewlet.className = 'Viewlet SideBar';
|
|
7339
7331
|
$Viewlet.role = Complementary;
|
|
7340
|
-
$Viewlet.ariaRoleDescription =
|
|
7341
|
-
$Viewlet.append($
|
|
7332
|
+
$Viewlet.ariaRoleDescription = Sidebar;
|
|
7333
|
+
$Viewlet.append($SidebarTitleArea);
|
|
7342
7334
|
return {
|
|
7343
7335
|
$Actions: undefined,
|
|
7344
|
-
$
|
|
7345
|
-
$
|
|
7346
|
-
$
|
|
7347
|
-
$
|
|
7336
|
+
$Sidebar: $Viewlet,
|
|
7337
|
+
$SidebarContent: undefined,
|
|
7338
|
+
$SidebarTitleArea,
|
|
7339
|
+
$SidebarTitleAreaTitle,
|
|
7348
7340
|
$Viewlet
|
|
7349
7341
|
};
|
|
7350
7342
|
};
|
|
7351
7343
|
const attachEvents = state => {
|
|
7352
7344
|
const {
|
|
7353
|
-
$
|
|
7345
|
+
$SidebarTitleArea
|
|
7354
7346
|
} = state;
|
|
7355
|
-
attachEvents$6($
|
|
7347
|
+
attachEvents$6($SidebarTitleArea, {
|
|
7356
7348
|
[Click]: handleHeaderClick
|
|
7357
7349
|
});
|
|
7358
7350
|
};
|
|
7359
7351
|
const dispose$5 = state => {
|
|
7360
7352
|
object(state);
|
|
7361
|
-
state.$
|
|
7353
|
+
state.$Sidebar.replaceChildren();
|
|
7362
7354
|
};
|
|
7363
7355
|
const setTitle = (state, name) => {
|
|
7364
7356
|
const {
|
|
7365
|
-
$
|
|
7357
|
+
$SidebarTitleAreaTitle
|
|
7366
7358
|
} = state;
|
|
7367
|
-
$
|
|
7368
|
-
$
|
|
7359
|
+
$SidebarTitleAreaTitle.title = name;
|
|
7360
|
+
$SidebarTitleAreaTitle.textContent = name;
|
|
7369
7361
|
};
|
|
7370
7362
|
const setActionsDom = (state, actions, parentId, eventMap = {}) => {
|
|
7371
7363
|
if (actions.length === 0) {
|
|
@@ -7373,14 +7365,14 @@ const setActionsDom = (state, actions, parentId, eventMap = {}) => {
|
|
|
7373
7365
|
}
|
|
7374
7366
|
const {
|
|
7375
7367
|
$Actions,
|
|
7376
|
-
$
|
|
7368
|
+
$SidebarTitleArea
|
|
7377
7369
|
} = state;
|
|
7378
7370
|
const $Parent = document.createElement('div');
|
|
7379
7371
|
const $NewViewlet = rememberFocus$1($Parent, actions, {}, parentId);
|
|
7380
7372
|
if ($Actions) {
|
|
7381
7373
|
$Actions.replaceWith($NewViewlet);
|
|
7382
7374
|
} else {
|
|
7383
|
-
$
|
|
7375
|
+
$SidebarTitleArea.append($NewViewlet);
|
|
7384
7376
|
}
|
|
7385
7377
|
state.$Actions = $NewViewlet;
|
|
7386
7378
|
};
|
|
@@ -7388,7 +7380,7 @@ const focus$5 = async () => {
|
|
|
7388
7380
|
// await
|
|
7389
7381
|
};
|
|
7390
7382
|
|
|
7391
|
-
const
|
|
7383
|
+
const ViewletSidebar = {
|
|
7392
7384
|
__proto__: null,
|
|
7393
7385
|
attachEvents,
|
|
7394
7386
|
create: create$8,
|
|
@@ -7580,7 +7572,7 @@ const focus$4 = state => {
|
|
|
7580
7572
|
const {
|
|
7581
7573
|
$Viewlet
|
|
7582
7574
|
} = state;
|
|
7583
|
-
$Viewlet.querySelector('input').focus();
|
|
7575
|
+
$Viewlet.querySelector(':scope input').focus();
|
|
7584
7576
|
};
|
|
7585
7577
|
|
|
7586
7578
|
const ViewletSourceControl = {
|
|
@@ -8170,7 +8162,7 @@ const setIframe = (state, src, sandbox = [], srcDoc = '', csp = '', credentialle
|
|
|
8170
8162
|
const {
|
|
8171
8163
|
$Viewlet
|
|
8172
8164
|
} = state;
|
|
8173
|
-
const $Parent = $Viewlet.querySelector('.WebViewWrapper');
|
|
8165
|
+
const $Parent = $Viewlet.querySelector(':scope .WebViewWrapper');
|
|
8174
8166
|
if (!$Parent) {
|
|
8175
8167
|
throw new Error('webview wrapper not found');
|
|
8176
8168
|
}
|
|
@@ -8258,7 +8250,7 @@ const moduleLoaders = {
|
|
|
8258
8250
|
[References]: () => ViewletReferences,
|
|
8259
8251
|
[RunAndDebug]: () => ViewletRunAndDebug,
|
|
8260
8252
|
[ScreenCapture]: () => ViewletScreenCapture,
|
|
8261
|
-
[
|
|
8253
|
+
[Sidebar$1]: () => ViewletSidebar,
|
|
8262
8254
|
[SimpleBrowser]: () => ViewletSimpleBrowser,
|
|
8263
8255
|
[SourceControl]: () => ViewletSourceControl,
|
|
8264
8256
|
[StatusBar$1]: () => ViewletStatusBar,
|
|
@@ -8284,7 +8276,7 @@ const load$1 = moduleId => {
|
|
|
8284
8276
|
|
|
8285
8277
|
const state$1 = {
|
|
8286
8278
|
currentPanelView: undefined,
|
|
8287
|
-
|
|
8279
|
+
currentSidebarView: undefined,
|
|
8288
8280
|
modules: Object.create(null)
|
|
8289
8281
|
};
|
|
8290
8282
|
|
|
@@ -8418,7 +8410,7 @@ const setInputValues = (viewletId, items) => {
|
|
|
8418
8410
|
setElementProperty(viewletId, name, 'value', value);
|
|
8419
8411
|
}
|
|
8420
8412
|
};
|
|
8421
|
-
const
|
|
8413
|
+
const setCheckboxValue = (viewletId, name, value) => {
|
|
8422
8414
|
setElementProperty(viewletId, name, 'checked', value);
|
|
8423
8415
|
};
|
|
8424
8416
|
const setSelectionByName = (viewletId, name, start, end) => {
|
|
@@ -8447,11 +8439,14 @@ const setUid = (viewletId, uid) => {
|
|
|
8447
8439
|
} = instance.state;
|
|
8448
8440
|
set$3($Viewlet, uid);
|
|
8449
8441
|
};
|
|
8450
|
-
const
|
|
8442
|
+
const focusCallback = {
|
|
8451
8443
|
id: 0,
|
|
8452
8444
|
selector: ''
|
|
8453
8445
|
};
|
|
8454
|
-
|
|
8446
|
+
const resetFocusCallback = () => {
|
|
8447
|
+
focusCallback.id = 0;
|
|
8448
|
+
focusCallback.selector = '';
|
|
8449
|
+
};
|
|
8455
8450
|
const focusSelector = (viewletId, selector) => {
|
|
8456
8451
|
const instance = get$a(viewletId);
|
|
8457
8452
|
if (!instance) {
|
|
@@ -8468,10 +8463,8 @@ const focusSelector = (viewletId, selector) => {
|
|
|
8468
8463
|
if ($Element.isConnected) {
|
|
8469
8464
|
$Element.focus();
|
|
8470
8465
|
} else {
|
|
8471
|
-
focusCallback =
|
|
8472
|
-
|
|
8473
|
-
selector
|
|
8474
|
-
};
|
|
8466
|
+
focusCallback.id = viewletId;
|
|
8467
|
+
focusCallback.selector = selector;
|
|
8475
8468
|
}
|
|
8476
8469
|
}
|
|
8477
8470
|
};
|
|
@@ -8493,18 +8486,18 @@ const isSpecial = id => {
|
|
|
8493
8486
|
return specialIds.has(id);
|
|
8494
8487
|
};
|
|
8495
8488
|
const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
|
|
8496
|
-
const $
|
|
8497
|
-
$
|
|
8498
|
-
setBounds$a($
|
|
8489
|
+
const $Placeholder = document.createElement('div');
|
|
8490
|
+
$Placeholder.className = `Viewlet ${viewletId}`;
|
|
8491
|
+
setBounds$a($Placeholder, left, top, width, height);
|
|
8499
8492
|
if (isSpecial(viewletId)) {
|
|
8500
|
-
$
|
|
8493
|
+
$Placeholder.id = viewletId;
|
|
8501
8494
|
}
|
|
8502
8495
|
const parentInstance = get$a(parentId);
|
|
8503
8496
|
const $Parent = parentInstance.state.$Viewlet;
|
|
8504
|
-
$Parent.append($
|
|
8497
|
+
$Parent.append($Placeholder);
|
|
8505
8498
|
set$9(viewletId, {
|
|
8506
8499
|
state: {
|
|
8507
|
-
$Viewlet: $
|
|
8500
|
+
$Viewlet: $Placeholder
|
|
8508
8501
|
}
|
|
8509
8502
|
});
|
|
8510
8503
|
};
|
|
@@ -8541,7 +8534,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
8541
8534
|
uid = get($Viewlet);
|
|
8542
8535
|
} catch {}
|
|
8543
8536
|
}
|
|
8544
|
-
// TODO optimize rendering with virtual
|
|
8537
|
+
// TODO optimize rendering with virtual DOM diffing
|
|
8545
8538
|
const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
|
|
8546
8539
|
if (uid) {
|
|
8547
8540
|
// @ts-ignore
|
|
@@ -8648,7 +8641,7 @@ const handleError$1 = (id, parentId, message) => {
|
|
|
8648
8641
|
return;
|
|
8649
8642
|
}
|
|
8650
8643
|
if (instance?.state.$Viewlet) {
|
|
8651
|
-
instance.state.$Viewlet.textContent =
|
|
8644
|
+
instance.state.$Viewlet.textContent = String(message);
|
|
8652
8645
|
}
|
|
8653
8646
|
// TODO error should bubble up to until highest possible component
|
|
8654
8647
|
const parentInstance = get$a(parentId);
|
|
@@ -8767,22 +8760,22 @@ const replaceChildren = (parentId, childIds) => {
|
|
|
8767
8760
|
$Parent.replaceChildren($Fragment);
|
|
8768
8761
|
};
|
|
8769
8762
|
const applyLateFocusMaybe = () => {
|
|
8770
|
-
if (focusCallback
|
|
8763
|
+
if (!focusCallback.id) {
|
|
8764
|
+
return;
|
|
8765
|
+
}
|
|
8766
|
+
const {
|
|
8767
|
+
id,
|
|
8768
|
+
selector
|
|
8769
|
+
} = focusCallback;
|
|
8770
|
+
resetFocusCallback();
|
|
8771
|
+
const instance = get$a(id);
|
|
8772
|
+
if (instance) {
|
|
8771
8773
|
const {
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
if (instance) {
|
|
8778
|
-
const {
|
|
8779
|
-
$Viewlet
|
|
8780
|
-
} = instance.state;
|
|
8781
|
-
const $Element = $Viewlet.querySelector(selector);
|
|
8782
|
-
if ($Element) {
|
|
8783
|
-
$Element.focus();
|
|
8784
|
-
focusCallback = emptyFocusCallback;
|
|
8785
|
-
}
|
|
8774
|
+
$Viewlet
|
|
8775
|
+
} = instance.state;
|
|
8776
|
+
const $Element = $Viewlet.querySelector(selector);
|
|
8777
|
+
if ($Element) {
|
|
8778
|
+
$Element.focus();
|
|
8786
8779
|
}
|
|
8787
8780
|
}
|
|
8788
8781
|
};
|
|
@@ -8853,7 +8846,7 @@ const commandHandlers = {
|
|
|
8853
8846
|
'Viewlet.replaceChildren': replaceChildren,
|
|
8854
8847
|
'Viewlet.send': invoke,
|
|
8855
8848
|
'Viewlet.setBounds': setBounds$1,
|
|
8856
|
-
'Viewlet.setCheckBoxValue':
|
|
8849
|
+
'Viewlet.setCheckBoxValue': setCheckboxValue,
|
|
8857
8850
|
'Viewlet.setCss': addCssStyleSheet,
|
|
8858
8851
|
'Viewlet.setDom': setDom,
|
|
8859
8852
|
'Viewlet.setDom2': setDom2,
|
|
@@ -8941,15 +8934,16 @@ const set$1 = title => {
|
|
|
8941
8934
|
|
|
8942
8935
|
// workaround for not being setPointerCapture() not working on
|
|
8943
8936
|
// synthetic events
|
|
8937
|
+
const originalPointerCapture = {};
|
|
8944
8938
|
const mock = () => {
|
|
8945
|
-
|
|
8946
|
-
|
|
8939
|
+
originalPointerCapture.setPointerCapture = Element.prototype.setPointerCapture;
|
|
8940
|
+
originalPointerCapture.releasePointerCapture = Element.prototype.releasePointerCapture;
|
|
8947
8941
|
Element.prototype.setPointerCapture = () => {};
|
|
8948
8942
|
Element.prototype.releasePointerCapture = () => {};
|
|
8949
8943
|
};
|
|
8950
8944
|
const unmock = () => {
|
|
8951
|
-
Element.prototype.setPointerCapture =
|
|
8952
|
-
Element.prototype.releasePointerCapture =
|
|
8945
|
+
Element.prototype.setPointerCapture = originalPointerCapture.setPointerCapture;
|
|
8946
|
+
Element.prototype.releasePointerCapture = originalPointerCapture.releasePointerCapture;
|
|
8953
8947
|
};
|
|
8954
8948
|
|
|
8955
8949
|
const isFile = value => {
|
|
@@ -8986,7 +8980,7 @@ const waitForFrameToLoad = $Frame => {
|
|
|
8986
8980
|
promise,
|
|
8987
8981
|
resolve
|
|
8988
8982
|
} = withResolvers();
|
|
8989
|
-
$Frame.addEventListener('load', resolve, {
|
|
8983
|
+
$Frame.addEventListener('load', () => resolve(), {
|
|
8990
8984
|
once: true
|
|
8991
8985
|
});
|
|
8992
8986
|
return promise;
|
|
@@ -9086,7 +9080,7 @@ const commandMap = {
|
|
|
9086
9080
|
'MeasureTextHeight.measureTextHeight': measureTextHeight,
|
|
9087
9081
|
'Menu.focusIndex': focusIndex,
|
|
9088
9082
|
'Menu.hide': hide,
|
|
9089
|
-
'Menu.hideSubMenu':
|
|
9083
|
+
'Menu.hideSubMenu': hideSubmenu,
|
|
9090
9084
|
'Menu.showControlled': showControlled,
|
|
9091
9085
|
'Menu.showMenu': showMenu,
|
|
9092
9086
|
'Meta.setThemeColor': setThemeColor,
|
|
@@ -9108,8 +9102,9 @@ const commandMap = {
|
|
|
9108
9102
|
'TestFrameWork.checkSingleElementCondition': checkSingleElementCondition,
|
|
9109
9103
|
'TestFrameWork.performAction': performAction,
|
|
9110
9104
|
'TestFrameWork.performAction2': performAction2,
|
|
9111
|
-
'TestFrameWork.performKeyBoardAction':
|
|
9105
|
+
'TestFrameWork.performKeyBoardAction': performKeyboardAction,
|
|
9112
9106
|
'TestFrameWork.showOverlay': showOverlay,
|
|
9107
|
+
'TestFrameWork.showTestResults': showTestResults,
|
|
9113
9108
|
'TestFrameWork.transfer': transfer,
|
|
9114
9109
|
'TestFrameWork.transferToWebView': transferToWebView,
|
|
9115
9110
|
'Viewlet.addKeyBindings': addKeyBindings,
|
|
@@ -9300,9 +9295,8 @@ const RE_AT = /^\s+at/;
|
|
|
9300
9295
|
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
9301
9296
|
const RE_OBJECT_AS = /^\s*at Object\.\w+ \[as ([\w.]+)]/;
|
|
9302
9297
|
const RE_OBJECT = /^\s*at Object\.(\w+)/;
|
|
9303
|
-
const RE_PATH_1$1 = /\((
|
|
9304
|
-
const RE_PATH_2$1 = /at (
|
|
9305
|
-
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+)$/;
|
|
9306
9300
|
const RE_RESTORE_JSON_RPC_ERROR = /^\s*at restoreJsonRpcError/;
|
|
9307
9301
|
const RE_UNWRAP_JSON_RPC_RESULT = /^\s*at unwrapJsonRpcResult/;
|
|
9308
9302
|
const RE_HANDLE_JSON_RPC_MESSAGE = /^\s*at handleJsonRpcMessage/;
|
|
@@ -9315,8 +9309,14 @@ const isInternalLine = line => {
|
|
|
9315
9309
|
const isRelevantLine = line => {
|
|
9316
9310
|
return !isInternalLine(line);
|
|
9317
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
|
+
};
|
|
9318
9318
|
const isNormalStackLine = line => {
|
|
9319
|
-
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);
|
|
9320
9320
|
};
|
|
9321
9321
|
const isApplicationUsefulLine = (line, index) => {
|
|
9322
9322
|
if (index === 0) {
|
|
@@ -9359,7 +9359,7 @@ const mergeCustom = (custom, relevantStack) => {
|
|
|
9359
9359
|
if (RE_PATH_2$1.test(firstLine)) {
|
|
9360
9360
|
return [` at ${firstLine}`, ...relevantStack];
|
|
9361
9361
|
}
|
|
9362
|
-
if (
|
|
9362
|
+
if (isFirefoxStackLine(firstLine)) {
|
|
9363
9363
|
return [firstLine, ...relevantStack];
|
|
9364
9364
|
}
|
|
9365
9365
|
return relevantStack;
|
|
@@ -9386,9 +9386,9 @@ const getIsFirefox = () => {
|
|
|
9386
9386
|
}
|
|
9387
9387
|
if (
|
|
9388
9388
|
// @ts-expect-error
|
|
9389
|
-
navigator.userAgentData?.brands) {
|
|
9389
|
+
globalThis.navigator.userAgentData?.brands) {
|
|
9390
9390
|
// @ts-expect-error
|
|
9391
|
-
return navigator.userAgentData.brands.includes('Firefox');
|
|
9391
|
+
return globalThis.navigator.userAgentData.brands.includes('Firefox');
|
|
9392
9392
|
}
|
|
9393
9393
|
return navigator.userAgent.toLowerCase().includes('firefox');
|
|
9394
9394
|
};
|
|
@@ -9435,9 +9435,23 @@ const prepareErrorMessageWithCodeFrame = error => {
|
|
|
9435
9435
|
stderr: error.stderr
|
|
9436
9436
|
};
|
|
9437
9437
|
};
|
|
9438
|
-
const RE_PATH_1 = /\((
|
|
9439
|
-
const RE_PATH_2 = /at (
|
|
9440
|
-
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
|
+
};
|
|
9441
9455
|
|
|
9442
9456
|
/**
|
|
9443
9457
|
*
|
|
@@ -9446,7 +9460,7 @@ const RE_PATH_3 = /@(.*):(\d+):(\d+)$/; // Firefox
|
|
|
9446
9460
|
*/
|
|
9447
9461
|
const getFile = lines => {
|
|
9448
9462
|
for (const line of lines) {
|
|
9449
|
-
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)) {
|
|
9450
9464
|
return line;
|
|
9451
9465
|
}
|
|
9452
9466
|
}
|
|
@@ -9461,7 +9475,7 @@ const prepareErrorMessageWithoutCodeFrame = async error => {
|
|
|
9461
9475
|
match = file.match(RE_PATH_2);
|
|
9462
9476
|
}
|
|
9463
9477
|
if (!match) {
|
|
9464
|
-
match = file
|
|
9478
|
+
match = getFirefoxStackMatch(file);
|
|
9465
9479
|
}
|
|
9466
9480
|
if (!match) {
|
|
9467
9481
|
return error;
|
|
@@ -9550,7 +9564,7 @@ const handleError = async (error, notify = true, prefix = '') => {
|
|
|
9550
9564
|
};
|
|
9551
9565
|
|
|
9552
9566
|
const isChromeExtensionError = error => {
|
|
9553
|
-
return
|
|
9567
|
+
return String(error) === 'Script error.';
|
|
9554
9568
|
};
|
|
9555
9569
|
|
|
9556
9570
|
const handleUnhandledRejection = event => {
|
|
@@ -9832,7 +9846,7 @@ const create = () => {
|
|
|
9832
9846
|
const $Viewlet = document.createElement('div');
|
|
9833
9847
|
const term = new Dl();
|
|
9834
9848
|
term.open($Viewlet);
|
|
9835
|
-
term.write('Hello from \
|
|
9849
|
+
term.write('Hello from \u{1B}[1;3;31mxterm.js\u{1B}[0m $ ');
|
|
9836
9850
|
return {
|
|
9837
9851
|
$Viewlet
|
|
9838
9852
|
};
|