@lvce-editor/renderer-process 30.85.1 → 30.85.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 +165 -147
- package/package.json +1 -1
|
@@ -1546,7 +1546,10 @@ const createRuntimeName = (name, parentName) => {
|
|
|
1546
1546
|
metadataById.set(id, metadata);
|
|
1547
1547
|
return metadata;
|
|
1548
1548
|
};
|
|
1549
|
-
const track = (worker,
|
|
1549
|
+
const track = (worker, {
|
|
1550
|
+
startedIn = state$q.generation,
|
|
1551
|
+
trackedWorker
|
|
1552
|
+
} = {}) => {
|
|
1550
1553
|
if (startedIn !== state$q.generation) {
|
|
1551
1554
|
worker.terminate();
|
|
1552
1555
|
throw new Error('Worker launch canceled by application restart');
|
|
@@ -1591,7 +1594,10 @@ const terminateAll = () => {
|
|
|
1591
1594
|
};
|
|
1592
1595
|
const trackRpc = (rpc, generation, trackedWorker) => {
|
|
1593
1596
|
const worker = rpc.ipc?._rawIpc;
|
|
1594
|
-
if (worker) track(worker,
|
|
1597
|
+
if (worker) track(worker, {
|
|
1598
|
+
startedIn: generation,
|
|
1599
|
+
trackedWorker
|
|
1600
|
+
});
|
|
1595
1601
|
};
|
|
1596
1602
|
|
|
1597
1603
|
const success = value => {
|
|
@@ -1654,8 +1660,8 @@ const getConfiguredWorkerUrl = key => {
|
|
|
1654
1660
|
};
|
|
1655
1661
|
|
|
1656
1662
|
/**
|
|
1657
|
-
|
|
1658
|
-
|
|
1663
|
+
@returns {number}
|
|
1664
|
+
*/
|
|
1659
1665
|
const getPlatform = () => {
|
|
1660
1666
|
const configuredPlatform = getConfiguredWorkerUrl('platform');
|
|
1661
1667
|
if (configuredPlatform === 'electron') {
|
|
@@ -2054,7 +2060,7 @@ const initialize = () => {
|
|
|
2054
2060
|
} catch {
|
|
2055
2061
|
savedLayout = null;
|
|
2056
2062
|
}
|
|
2057
|
-
if (savedLayout?.aiNativeLayout !== true
|
|
2063
|
+
if (!isChatRoute && savedLayout?.aiNativeLayout !== true) return;
|
|
2058
2064
|
let settings;
|
|
2059
2065
|
try {
|
|
2060
2066
|
settings = JSON.parse(localStorage.getItem('settings') || 'null');
|
|
@@ -2108,7 +2114,7 @@ const set$e = (uid, speed) => {
|
|
|
2108
2114
|
const apply = (uid, args) => {
|
|
2109
2115
|
const view = views.get(uid);
|
|
2110
2116
|
const indices = view?.commands.get(args[0]);
|
|
2111
|
-
if (!view || view.speed === 1
|
|
2117
|
+
if (!view || !indices || view.speed === 1) return args;
|
|
2112
2118
|
const scaled = [...args];
|
|
2113
2119
|
for (const index of indices) scaled[index] *= view.speed;
|
|
2114
2120
|
return scaled;
|
|
@@ -2268,10 +2274,7 @@ const mergeCustom = (custom, relevantStack) => {
|
|
|
2268
2274
|
return relevantStack;
|
|
2269
2275
|
}
|
|
2270
2276
|
const firstLine = custom[0];
|
|
2271
|
-
if (RE_PATH_1$1.test(firstLine)) {
|
|
2272
|
-
return [` at ${firstLine}`, ...relevantStack];
|
|
2273
|
-
}
|
|
2274
|
-
if (RE_PATH_2$1.test(firstLine)) {
|
|
2277
|
+
if (RE_PATH_1$1.test(firstLine) || RE_PATH_2$1.test(firstLine)) {
|
|
2275
2278
|
return [` at ${firstLine}`, ...relevantStack];
|
|
2276
2279
|
}
|
|
2277
2280
|
if (isFirefoxStackLine(firstLine)) {
|
|
@@ -2384,10 +2387,10 @@ const getFirefoxStackMatch = line => {
|
|
|
2384
2387
|
};
|
|
2385
2388
|
|
|
2386
2389
|
/**
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2390
|
+
|
|
2391
|
+
@param {readonly string[]} lines
|
|
2392
|
+
@returns
|
|
2393
|
+
*/
|
|
2391
2394
|
const getFile = lines => {
|
|
2392
2395
|
for (const line of lines) {
|
|
2393
2396
|
if (RE_PATH_1.test(line) || RE_PATH_2.test(line) || getFirefoxStackMatch(line)) {
|
|
@@ -2511,10 +2514,11 @@ const getRegistration = target => {
|
|
|
2511
2514
|
};
|
|
2512
2515
|
const suppressInput = event => {
|
|
2513
2516
|
const registration = getRegistration(event.target);
|
|
2514
|
-
if (registration?.keymap.modes[registration.mode]?.captureText) {
|
|
2515
|
-
|
|
2516
|
-
event.stopImmediatePropagation();
|
|
2517
|
+
if (!registration?.keymap.modes[registration.mode]?.captureText) {
|
|
2518
|
+
return;
|
|
2517
2519
|
}
|
|
2520
|
+
event.preventDefault();
|
|
2521
|
+
event.stopImmediatePropagation();
|
|
2518
2522
|
};
|
|
2519
2523
|
const validate = keymap => {
|
|
2520
2524
|
if (!Object.hasOwn(keymap.modes, keymap.initialMode)) throw new Error('Unknown initial editor keymap mode');
|
|
@@ -4889,10 +4893,10 @@ const getFirstEvent = (eventTarget, eventMap) => {
|
|
|
4889
4893
|
};
|
|
4890
4894
|
|
|
4891
4895
|
/**
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
+
|
|
4897
|
+
@param {Worker} worker
|
|
4898
|
+
@returns
|
|
4899
|
+
*/
|
|
4896
4900
|
const getFirstWorkerEvent = worker => {
|
|
4897
4901
|
return getFirstEvent(worker, {
|
|
4898
4902
|
error: Error$3,
|
|
@@ -4983,7 +4987,9 @@ const create$y = async ({
|
|
|
4983
4987
|
name: trackedWorker.runtimeName,
|
|
4984
4988
|
type: Module
|
|
4985
4989
|
});
|
|
4986
|
-
track(worker,
|
|
4990
|
+
track(worker, {
|
|
4991
|
+
trackedWorker
|
|
4992
|
+
});
|
|
4987
4993
|
try {
|
|
4988
4994
|
// @ts-expect-error
|
|
4989
4995
|
const {
|
|
@@ -5162,7 +5168,10 @@ const create$v = async ({
|
|
|
5162
5168
|
}
|
|
5163
5169
|
const worker = rpc.ipc?._rawIpc;
|
|
5164
5170
|
if (worker) {
|
|
5165
|
-
track(worker,
|
|
5171
|
+
track(worker, {
|
|
5172
|
+
startedIn: generation,
|
|
5173
|
+
trackedWorker
|
|
5174
|
+
});
|
|
5166
5175
|
} else {
|
|
5167
5176
|
discard(trackedWorker);
|
|
5168
5177
|
}
|
|
@@ -5241,10 +5250,11 @@ const create$t = async ({
|
|
|
5241
5250
|
};
|
|
5242
5251
|
const dispose$m = id => {
|
|
5243
5252
|
const worker = remove$3(id);
|
|
5244
|
-
if (worker) {
|
|
5245
|
-
|
|
5246
|
-
worker.terminate();
|
|
5253
|
+
if (!worker) {
|
|
5254
|
+
return;
|
|
5247
5255
|
}
|
|
5256
|
+
remove$6(worker);
|
|
5257
|
+
worker.terminate();
|
|
5248
5258
|
};
|
|
5249
5259
|
|
|
5250
5260
|
const launchEditorWorker = async port => {
|
|
@@ -5377,10 +5387,16 @@ const configure = options => {
|
|
|
5377
5387
|
const cache = options?.cache;
|
|
5378
5388
|
state$g.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
|
|
5379
5389
|
};
|
|
5380
|
-
const render = (nodes,
|
|
5390
|
+
const render = (nodes, {
|
|
5391
|
+
eventMap = {},
|
|
5392
|
+
newEventMap = {}
|
|
5393
|
+
} = {}) => {
|
|
5381
5394
|
return state$g.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
|
|
5382
5395
|
};
|
|
5383
|
-
const renderInto = (parent, nodes,
|
|
5396
|
+
const renderInto = (parent, nodes, {
|
|
5397
|
+
eventMap = {},
|
|
5398
|
+
newEventMap = {}
|
|
5399
|
+
} = {}) => {
|
|
5384
5400
|
if (state$g.renderer) {
|
|
5385
5401
|
state$g.renderer.renderInto(parent, nodes, eventMap, newEventMap);
|
|
5386
5402
|
return;
|
|
@@ -5420,10 +5436,7 @@ const dispose$k = viewletId => {
|
|
|
5420
5436
|
|
|
5421
5437
|
// The route's composer can arrive after the initial workbench frame.
|
|
5422
5438
|
const focus$d = viewletId => {
|
|
5423
|
-
if (state$f.handled || !/(?:^|\/)chat\/?$/.test(location.pathname)) {
|
|
5424
|
-
return;
|
|
5425
|
-
}
|
|
5426
|
-
if (!get$b(viewletId)?.state.$Viewlet.querySelector(selector)) {
|
|
5439
|
+
if (state$f.handled || !/(?:^|\/)chat\/?$/.test(location.pathname) || !get$b(viewletId)?.state.$Viewlet.querySelector(selector)) {
|
|
5427
5440
|
return;
|
|
5428
5441
|
}
|
|
5429
5442
|
state$f.handled = true;
|
|
@@ -5474,11 +5487,12 @@ const focus$d = viewletId => {
|
|
|
5474
5487
|
childList: true,
|
|
5475
5488
|
subtree: true
|
|
5476
5489
|
});
|
|
5477
|
-
if (observed
|
|
5478
|
-
|
|
5479
|
-
sizes.observe(input);
|
|
5480
|
-
observed = input;
|
|
5490
|
+
if (observed === input) {
|
|
5491
|
+
return;
|
|
5481
5492
|
}
|
|
5493
|
+
sizes.disconnect();
|
|
5494
|
+
sizes.observe(input);
|
|
5495
|
+
observed = input;
|
|
5482
5496
|
};
|
|
5483
5497
|
requestAnimationFrame(() => requestAnimationFrame(tryFocus));
|
|
5484
5498
|
};
|
|
@@ -5663,8 +5677,7 @@ const dispose$j = uid => {
|
|
|
5663
5677
|
// The owner controls the lifetime; events can target the component owning a widget.
|
|
5664
5678
|
const register = (uid, targetUid, listeners) => {
|
|
5665
5679
|
dispose$j(uid);
|
|
5666
|
-
|
|
5667
|
-
if (!root) {
|
|
5680
|
+
if (!get$b(uid)?.state.$Viewlet) {
|
|
5668
5681
|
return;
|
|
5669
5682
|
}
|
|
5670
5683
|
let active = true;
|
|
@@ -5695,15 +5708,22 @@ const register = (uid, targetUid, listeners) => {
|
|
|
5695
5708
|
};
|
|
5696
5709
|
const handleEvent = event => {
|
|
5697
5710
|
if (event.type === 'focusout') {
|
|
5711
|
+
// setDom2 replaces the root element, so resolve the current root at event time
|
|
5712
|
+
// instead of binding to the element that existed when listeners were registered.
|
|
5713
|
+
const currentRoot = get$b(uid)?.state.$Viewlet;
|
|
5714
|
+
if (!currentRoot || !(event.target instanceof Node) || !currentRoot.contains(event.target)) {
|
|
5715
|
+
return;
|
|
5716
|
+
}
|
|
5698
5717
|
// DOM replacement can briefly clear focus before a following focus command.
|
|
5699
5718
|
queueMicrotask(() => notify(document.activeElement));
|
|
5700
5719
|
} else {
|
|
5701
5720
|
notify(event.target);
|
|
5702
5721
|
}
|
|
5703
5722
|
};
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5723
|
+
// Focusout is captured on the document so that the listener survives root replacement.
|
|
5724
|
+
const capture = event === 'focusout';
|
|
5725
|
+
document.addEventListener(event, handleEvent, capture);
|
|
5726
|
+
removals.push(() => document.removeEventListener(event, handleEvent, capture));
|
|
5707
5727
|
}
|
|
5708
5728
|
cleanups.set(uid, () => {
|
|
5709
5729
|
active = false;
|
|
@@ -5851,11 +5871,11 @@ const setXAndY = ($Element, x, y) => {
|
|
|
5851
5871
|
};
|
|
5852
5872
|
|
|
5853
5873
|
/**
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5874
|
+
|
|
5875
|
+
@param {HTMLElement} $Element
|
|
5876
|
+
@param {number} x
|
|
5877
|
+
@param {number} y
|
|
5878
|
+
*/
|
|
5859
5879
|
const setXAndYTransform = ($Element, x, y) => {
|
|
5860
5880
|
$Element.style.translate = `${x}px ${y}px`;
|
|
5861
5881
|
};
|
|
@@ -5865,7 +5885,7 @@ const setHeight = ($Element, height) => {
|
|
|
5865
5885
|
|
|
5866
5886
|
const getCombinedErrorMessage = (error, message) => {
|
|
5867
5887
|
// DOMException.toString is different from what is displayed in console
|
|
5868
|
-
if (error && error instanceof DOMException
|
|
5888
|
+
if (error && message && error instanceof DOMException) {
|
|
5869
5889
|
return `${message} DOMException: ${error.message}`;
|
|
5870
5890
|
}
|
|
5871
5891
|
if (message) {
|
|
@@ -5959,11 +5979,13 @@ const remove$1 = $Element => {
|
|
|
5959
5979
|
state$a.widgetSet.delete($Element);
|
|
5960
5980
|
$Element.remove();
|
|
5961
5981
|
// TODO state.$Widgets should always be defined at this point
|
|
5962
|
-
if (state$a.widgetSet.size === 0 && state$a.$Widgets) {
|
|
5963
|
-
|
|
5964
|
-
state$a.$Widgets.remove();
|
|
5965
|
-
state$a.$Widgets = undefined;
|
|
5982
|
+
if (!(state$a.widgetSet.size === 0 && state$a.$Widgets)) {
|
|
5983
|
+
return;
|
|
5966
5984
|
}
|
|
5985
|
+
|
|
5986
|
+
// @ts-expect-error
|
|
5987
|
+
state$a.$Widgets.remove();
|
|
5988
|
+
state$a.$Widgets = undefined;
|
|
5967
5989
|
};
|
|
5968
5990
|
|
|
5969
5991
|
const handleImageLoad = event => {
|
|
@@ -6038,15 +6060,15 @@ const ImagePreview$1 = {
|
|
|
6038
6060
|
};
|
|
6039
6061
|
|
|
6040
6062
|
/**
|
|
6041
|
-
|
|
6042
|
-
|
|
6063
|
+
@param {Event} event
|
|
6064
|
+
*/
|
|
6043
6065
|
const preventDefault = event => {
|
|
6044
6066
|
event.preventDefault();
|
|
6045
6067
|
};
|
|
6046
6068
|
|
|
6047
6069
|
/**
|
|
6048
|
-
|
|
6049
|
-
|
|
6070
|
+
@param {Event} event
|
|
6071
|
+
*/
|
|
6050
6072
|
const stopPropagation = event => {
|
|
6051
6073
|
event.stopPropagation();
|
|
6052
6074
|
};
|
|
@@ -6433,7 +6455,9 @@ const setDom$8 = (state, dom) => {
|
|
|
6433
6455
|
const {
|
|
6434
6456
|
$Viewlet
|
|
6435
6457
|
} = state;
|
|
6436
|
-
renderInto($Viewlet, dom,
|
|
6458
|
+
renderInto($Viewlet, dom, {
|
|
6459
|
+
eventMap: ViewletDebugConsoleEvents
|
|
6460
|
+
});
|
|
6437
6461
|
};
|
|
6438
6462
|
|
|
6439
6463
|
const ViewletDebugConsole = {
|
|
@@ -6943,10 +6967,7 @@ const dispose$f = state => {
|
|
|
6943
6967
|
remove$1(state.$Viewlet);
|
|
6944
6968
|
};
|
|
6945
6969
|
const focus$b = (state, key, source) => {
|
|
6946
|
-
if (!key) {
|
|
6947
|
-
return;
|
|
6948
|
-
}
|
|
6949
|
-
if (source !== Script) {
|
|
6970
|
+
if (!key || source !== Script) {
|
|
6950
6971
|
return;
|
|
6951
6972
|
}
|
|
6952
6973
|
const {
|
|
@@ -7333,8 +7354,8 @@ const ViewletEditorHover = {
|
|
|
7333
7354
|
const LeftClick = 0;
|
|
7334
7355
|
|
|
7335
7356
|
/**
|
|
7336
|
-
|
|
7337
|
-
|
|
7357
|
+
@param {PointerEvent} event
|
|
7358
|
+
*/
|
|
7338
7359
|
const handlePointerMove = event => {
|
|
7339
7360
|
const {
|
|
7340
7361
|
clientX,
|
|
@@ -7346,8 +7367,8 @@ const handlePointerMove = event => {
|
|
|
7346
7367
|
};
|
|
7347
7368
|
|
|
7348
7369
|
/**
|
|
7349
|
-
|
|
7350
|
-
|
|
7370
|
+
@param {PointerEvent} event
|
|
7371
|
+
*/
|
|
7351
7372
|
const handlePointerUp = event => {
|
|
7352
7373
|
const {
|
|
7353
7374
|
button,
|
|
@@ -7370,8 +7391,8 @@ const handlePointerCaptureLost$1 = event => {
|
|
|
7370
7391
|
};
|
|
7371
7392
|
|
|
7372
7393
|
/**
|
|
7373
|
-
|
|
7374
|
-
|
|
7394
|
+
@param {PointerEvent} event
|
|
7395
|
+
*/
|
|
7375
7396
|
const handlePointerDown$1 = event => {
|
|
7376
7397
|
const {
|
|
7377
7398
|
button,
|
|
@@ -7392,8 +7413,8 @@ const handlePointerDown$1 = event => {
|
|
|
7392
7413
|
};
|
|
7393
7414
|
|
|
7394
7415
|
/**
|
|
7395
|
-
|
|
7396
|
-
|
|
7416
|
+
@param {WheelEvent} event
|
|
7417
|
+
*/
|
|
7397
7418
|
const handleWheel = event => {
|
|
7398
7419
|
const {
|
|
7399
7420
|
clientX,
|
|
@@ -7406,9 +7427,8 @@ const handleWheel = event => {
|
|
|
7406
7427
|
};
|
|
7407
7428
|
|
|
7408
7429
|
/**
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
*/
|
|
7430
|
+
@param {MouseEvent} event
|
|
7431
|
+
*/
|
|
7412
7432
|
const handleContextMenu$2 = event => {
|
|
7413
7433
|
preventDefault(event);
|
|
7414
7434
|
const {
|
|
@@ -7798,10 +7818,7 @@ const create$c = () => {
|
|
|
7798
7818
|
};
|
|
7799
7819
|
};
|
|
7800
7820
|
const focus$8 = (state, key, source) => {
|
|
7801
|
-
if (!key) {
|
|
7802
|
-
return;
|
|
7803
|
-
}
|
|
7804
|
-
if (source !== Script) {
|
|
7821
|
+
if (!key || source !== Script) {
|
|
7805
7822
|
return;
|
|
7806
7823
|
}
|
|
7807
7824
|
const {
|
|
@@ -8054,7 +8071,7 @@ const getKeyBindingIdentifier = event => {
|
|
|
8054
8071
|
const modifierControl = ctrlKey || metaKey ? CtrlCmd : 0;
|
|
8055
8072
|
const modifierShift = shiftKey ? Shift : 0;
|
|
8056
8073
|
const modifierAlt = altKey ? Alt : 0;
|
|
8057
|
-
const normalizedKey = shiftKey && key.length === 1 && !/[a-z0-9]/i.test(key)
|
|
8074
|
+
const normalizedKey = shiftKey && code && key.length === 1 && !/[a-z0-9]/i.test(key) ? code : normalizeKey(key, code);
|
|
8058
8075
|
const keyCode = getKeyCode(normalizedKey);
|
|
8059
8076
|
const identifier = modifierControl | modifierShift | modifierAlt | keyCode;
|
|
8060
8077
|
return identifier;
|
|
@@ -8101,8 +8118,7 @@ const isEditableTarget = target => {
|
|
|
8101
8118
|
return Boolean(target.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'));
|
|
8102
8119
|
};
|
|
8103
8120
|
const handleKeyDown$2 = event => {
|
|
8104
|
-
if (handleKeyDown$5(event))
|
|
8105
|
-
if (isNativeButtonActivation(event) || isTerminalTextInput(event)) {
|
|
8121
|
+
if (handleKeyDown$5(event) || isNativeButtonActivation(event) || isTerminalTextInput(event)) {
|
|
8106
8122
|
return;
|
|
8107
8123
|
}
|
|
8108
8124
|
const {
|
|
@@ -8112,7 +8128,7 @@ const handleKeyDown$2 = event => {
|
|
|
8112
8128
|
metaKey,
|
|
8113
8129
|
shiftKey
|
|
8114
8130
|
} = event;
|
|
8115
|
-
if ((ctrlKey || metaKey) &&
|
|
8131
|
+
if (!altKey && !shiftKey && (ctrlKey || metaKey) && key.toLowerCase() === 'a' && event.target instanceof HTMLInputElement && event.target.name === 'simple-browser-address') {
|
|
8116
8132
|
return;
|
|
8117
8133
|
}
|
|
8118
8134
|
if (key === '.' && !altKey && !ctrlKey && !metaKey && !shiftKey && isEditableTarget(event.target)) {
|
|
@@ -8316,8 +8332,8 @@ const EditorCodeGenerator = 'EditorCodeGenerator';
|
|
|
8316
8332
|
|
|
8317
8333
|
const state$9 = {
|
|
8318
8334
|
/**
|
|
8319
|
-
|
|
8320
|
-
|
|
8335
|
+
@type {HTMLElement|undefined}
|
|
8336
|
+
*/
|
|
8321
8337
|
$PreviousFocusElement: undefined};
|
|
8322
8338
|
const setElement = $Element => {
|
|
8323
8339
|
state$9.$PreviousFocusElement = $Element;
|
|
@@ -8445,8 +8461,8 @@ const handleHeaderClick$1 = event => {
|
|
|
8445
8461
|
};
|
|
8446
8462
|
|
|
8447
8463
|
/**
|
|
8448
|
-
|
|
8449
|
-
|
|
8464
|
+
@enum {string}
|
|
8465
|
+
*/
|
|
8450
8466
|
const UiStrings = {
|
|
8451
8467
|
Close: 'Close',
|
|
8452
8468
|
Maximize: 'Maximize'
|
|
@@ -8529,10 +8545,11 @@ const dispose$7 = state => {
|
|
|
8529
8545
|
state.$PanelTabs.remove();
|
|
8530
8546
|
state.$PanelTabs = undefined;
|
|
8531
8547
|
}
|
|
8532
|
-
if (state.$PanelHeader) {
|
|
8533
|
-
|
|
8534
|
-
state.$PanelHeader = undefined;
|
|
8548
|
+
if (!state.$PanelHeader) {
|
|
8549
|
+
return;
|
|
8535
8550
|
}
|
|
8551
|
+
state.$PanelHeader.remove();
|
|
8552
|
+
state.$PanelHeader = undefined;
|
|
8536
8553
|
};
|
|
8537
8554
|
const setSelectedIndex = (state, oldIndex, newIndex) => {
|
|
8538
8555
|
const {
|
|
@@ -8542,11 +8559,12 @@ const setSelectedIndex = (state, oldIndex, newIndex) => {
|
|
|
8542
8559
|
const $PanelTab = $PanelTabs.children[oldIndex];
|
|
8543
8560
|
$PanelTab.removeAttribute(AriaSelected);
|
|
8544
8561
|
}
|
|
8545
|
-
if (newIndex
|
|
8546
|
-
|
|
8547
|
-
$PanelTab.ariaSelected = true;
|
|
8548
|
-
$PanelTabs.setAttribute(AriaActiveDescendant, $PanelTab.id);
|
|
8562
|
+
if (newIndex === -1) {
|
|
8563
|
+
return;
|
|
8549
8564
|
}
|
|
8565
|
+
const $PanelTab = $PanelTabs.children[newIndex];
|
|
8566
|
+
$PanelTab.ariaSelected = true;
|
|
8567
|
+
$PanelTabs.setAttribute(AriaActiveDescendant, $PanelTab.id);
|
|
8550
8568
|
};
|
|
8551
8569
|
const setActionsDom$1 = (state, actions, childUid) => {
|
|
8552
8570
|
const {
|
|
@@ -9152,9 +9170,8 @@ const handleMouseDown$1 = event => {
|
|
|
9152
9170
|
// }
|
|
9153
9171
|
|
|
9154
9172
|
/**
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
*/
|
|
9173
|
+
@param {MouseEvent} event
|
|
9174
|
+
*/
|
|
9158
9175
|
const handleMouseEnter = event => {
|
|
9159
9176
|
const {
|
|
9160
9177
|
clientX,
|
|
@@ -9218,15 +9235,16 @@ const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
|
|
|
9218
9235
|
// @ts-expect-error
|
|
9219
9236
|
$Menu.children[oldFocusedIndex].classList.remove('MenuItemFocused');
|
|
9220
9237
|
}
|
|
9221
|
-
if (newFocusedIndex
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
$New.focus();
|
|
9238
|
+
if (newFocusedIndex === -1) {
|
|
9239
|
+
return;
|
|
9240
|
+
}
|
|
9241
|
+
// @ts-expect-error
|
|
9242
|
+
const $New = $Menu.children[newFocusedIndex];
|
|
9243
|
+
if ($New.classList.contains('MenuItemSeparator')) {
|
|
9244
|
+
return;
|
|
9229
9245
|
}
|
|
9246
|
+
$New.classList.add('MenuItemFocused');
|
|
9247
|
+
$New.focus();
|
|
9230
9248
|
};
|
|
9231
9249
|
|
|
9232
9250
|
// TODO replace function that recycles menu DOM nodes
|
|
@@ -9235,10 +9253,11 @@ const handleBackDropMouseDown = event => {
|
|
|
9235
9253
|
preventDefault(event);
|
|
9236
9254
|
stopPropagation(event);
|
|
9237
9255
|
send$1(/* Menu.hide */'Menu.hide');
|
|
9238
|
-
if (state$7.$BackDrop) {
|
|
9239
|
-
|
|
9240
|
-
state$7.$BackDrop = undefined;
|
|
9256
|
+
if (!state$7.$BackDrop) {
|
|
9257
|
+
return;
|
|
9241
9258
|
}
|
|
9259
|
+
remove$1(state$7.$BackDrop);
|
|
9260
|
+
state$7.$BackDrop = undefined;
|
|
9242
9261
|
};
|
|
9243
9262
|
const handleContextMenu$1 = event => {
|
|
9244
9263
|
preventDefault(event);
|
|
@@ -9267,10 +9286,11 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
|
|
|
9267
9286
|
// @ts-expect-error
|
|
9268
9287
|
state$7.$$Menus.push($Menu);
|
|
9269
9288
|
append$1($Menu);
|
|
9270
|
-
if (level
|
|
9271
|
-
|
|
9272
|
-
await invoke$1('Focus.setFocus', FocusMenu);
|
|
9289
|
+
if (level !== 0) {
|
|
9290
|
+
return;
|
|
9273
9291
|
}
|
|
9292
|
+
focus$6($Menu);
|
|
9293
|
+
await invoke$1('Focus.setFocus', FocusMenu);
|
|
9274
9294
|
};
|
|
9275
9295
|
const hideSubmenu = level => {
|
|
9276
9296
|
const $$ChildMenus = state$7.$$Menus.slice(level);
|
|
@@ -9278,10 +9298,11 @@ const hideSubmenu = level => {
|
|
|
9278
9298
|
remove$1($ChildMenu);
|
|
9279
9299
|
}
|
|
9280
9300
|
state$7.$$Menus = state$7.$$Menus.slice(0, level);
|
|
9281
|
-
if (state$7.$$Menus.length === 0 && state$7.$BackDrop) {
|
|
9282
|
-
|
|
9283
|
-
state$7.$BackDrop = undefined;
|
|
9301
|
+
if (!(state$7.$$Menus.length === 0 && state$7.$BackDrop)) {
|
|
9302
|
+
return;
|
|
9284
9303
|
}
|
|
9304
|
+
remove$1(state$7.$BackDrop);
|
|
9305
|
+
state$7.$BackDrop = undefined;
|
|
9285
9306
|
};
|
|
9286
9307
|
|
|
9287
9308
|
// export const showSubMenu = (level, items, parentIndex) => {
|
|
@@ -9561,10 +9582,11 @@ const setFocusedIndex = (state, unFocusIndex, focusIndex, oldIsMenuOpen, newIsMe
|
|
|
9561
9582
|
const {
|
|
9562
9583
|
$Viewlet
|
|
9563
9584
|
} = state;
|
|
9564
|
-
if (focusIndex
|
|
9565
|
-
|
|
9566
|
-
$Viewlet.setAttribute(AriaActiveDescendant, activeId);
|
|
9585
|
+
if (focusIndex === -1) {
|
|
9586
|
+
return;
|
|
9567
9587
|
}
|
|
9588
|
+
$Viewlet.focus();
|
|
9589
|
+
$Viewlet.setAttribute(AriaActiveDescendant, activeId);
|
|
9568
9590
|
};
|
|
9569
9591
|
|
|
9570
9592
|
// TODO the focus variable is confusing: false means keep focus in menubar, true means focus the menu
|
|
@@ -9705,7 +9727,7 @@ const updateMenu = ($$Menus, change) => {
|
|
|
9705
9727
|
setBounds$a($Menu, getMenuX(x), y, width, height);
|
|
9706
9728
|
renderInto($Menu, dom);
|
|
9707
9729
|
const isOpeningSubMenu = $$Menus.length < newLength;
|
|
9708
|
-
if (level === newLength - 1
|
|
9730
|
+
if (isOpeningSubMenu || level === newLength - 1) {
|
|
9709
9731
|
if (focusedIndex === -1) {
|
|
9710
9732
|
$Menu.focus();
|
|
9711
9733
|
} else {
|
|
@@ -9776,9 +9798,8 @@ const ViewletTitleBar = {
|
|
|
9776
9798
|
};
|
|
9777
9799
|
|
|
9778
9800
|
/**
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
*/
|
|
9801
|
+
@param {MouseEvent} event
|
|
9802
|
+
*/
|
|
9782
9803
|
const handleTitleBarButtonsClick = event => {
|
|
9783
9804
|
const {
|
|
9784
9805
|
target
|
|
@@ -10239,8 +10260,8 @@ const focusSelectorAfterRender = (viewletId, selector) => {
|
|
|
10239
10260
|
};
|
|
10240
10261
|
|
|
10241
10262
|
/**
|
|
10242
|
-
|
|
10243
|
-
|
|
10263
|
+
@deprecated
|
|
10264
|
+
*/
|
|
10244
10265
|
const refresh = (viewletId, viewletContext) => {
|
|
10245
10266
|
const instance = get$b(viewletId);
|
|
10246
10267
|
if (instance) {
|
|
@@ -10409,7 +10430,9 @@ const setDom = (viewletId, dom) => {
|
|
|
10409
10430
|
const {
|
|
10410
10431
|
$Viewlet
|
|
10411
10432
|
} = instance.state;
|
|
10412
|
-
renderInto($Viewlet, dom,
|
|
10433
|
+
renderInto($Viewlet, dom, {
|
|
10434
|
+
eventMap: Events
|
|
10435
|
+
});
|
|
10413
10436
|
};
|
|
10414
10437
|
const setDom2 = (viewletId, dom) => {
|
|
10415
10438
|
restoreComponentDom(viewletId);
|
|
@@ -10482,10 +10505,11 @@ const waitForElement = selector => {
|
|
|
10482
10505
|
} = withResolvers();
|
|
10483
10506
|
const observer = new MutationObserver(() => {
|
|
10484
10507
|
const element = document.querySelector(selector);
|
|
10485
|
-
if (element) {
|
|
10486
|
-
|
|
10487
|
-
resolve(element);
|
|
10508
|
+
if (!element) {
|
|
10509
|
+
return;
|
|
10488
10510
|
}
|
|
10511
|
+
observer.disconnect();
|
|
10512
|
+
resolve(element);
|
|
10489
10513
|
});
|
|
10490
10514
|
observer.observe(document.body, {
|
|
10491
10515
|
childList: true,
|
|
@@ -10584,8 +10608,8 @@ const handleError = (id, parentId, message) => {
|
|
|
10584
10608
|
};
|
|
10585
10609
|
|
|
10586
10610
|
/**
|
|
10587
|
-
|
|
10588
|
-
|
|
10611
|
+
@deprecated
|
|
10612
|
+
*/
|
|
10589
10613
|
const appendViewlet = (parentId, childId, focus) => {
|
|
10590
10614
|
if (parentId === 'Widget') {
|
|
10591
10615
|
// TODO
|
|
@@ -10647,10 +10671,7 @@ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
|
|
|
10647
10671
|
$Parent.append($Child);
|
|
10648
10672
|
return false;
|
|
10649
10673
|
}
|
|
10650
|
-
if (appendAfterPreviousReference(referenceNodes, childIndex, $Child)) {
|
|
10651
|
-
return true;
|
|
10652
|
-
}
|
|
10653
|
-
if (appendBeforeNextReference(referenceNodes, childIndex, $Child)) {
|
|
10674
|
+
if (appendAfterPreviousReference(referenceNodes, childIndex, $Child) || appendBeforeNextReference(referenceNodes, childIndex, $Child)) {
|
|
10654
10675
|
return true;
|
|
10655
10676
|
}
|
|
10656
10677
|
$Parent.append($Child);
|
|
@@ -10703,15 +10724,8 @@ const applyLateFocusMaybe = () => {
|
|
|
10703
10724
|
} = focusCallback;
|
|
10704
10725
|
resetFocusCallback();
|
|
10705
10726
|
const instance = get$b(id);
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
$Viewlet
|
|
10709
|
-
} = instance.state;
|
|
10710
|
-
const $Element = $Viewlet.querySelector(selector);
|
|
10711
|
-
if ($Element) {
|
|
10712
|
-
$Element.focus();
|
|
10713
|
-
}
|
|
10714
|
-
}
|
|
10727
|
+
const $Element = instance?.state.$Viewlet.querySelector(selector);
|
|
10728
|
+
$Element?.focus();
|
|
10715
10729
|
};
|
|
10716
10730
|
const appendToBody = childId => {
|
|
10717
10731
|
const $Parent = document.body;
|
|
@@ -11073,7 +11087,7 @@ const resolveFile = async (item, formats, includeElectronFilePaths) => {
|
|
|
11073
11087
|
const includeFileSystemHandle = formats.has('fileSystemHandle');
|
|
11074
11088
|
const fileSystemHandle = includeFileSystemHandle ? await item.fileSystemHandle : undefined;
|
|
11075
11089
|
const electronFilePath = includeElectronFilePaths && globalThis.electronGlobals && item.file ? await getFilePathElectron(item.file) : undefined;
|
|
11076
|
-
if ((!includeFile || !item.file)
|
|
11090
|
+
if (!fileSystemHandle && electronFilePath === undefined && (!includeFile || !item.file)) {
|
|
11077
11091
|
return undefined;
|
|
11078
11092
|
}
|
|
11079
11093
|
return {
|
|
@@ -12163,7 +12177,7 @@ const press = options => {
|
|
|
12163
12177
|
return;
|
|
12164
12178
|
}
|
|
12165
12179
|
const input = getXtermInput(options);
|
|
12166
|
-
if (isXtermTextArea(element)
|
|
12180
|
+
if (input && isXtermTextArea(element)) {
|
|
12167
12181
|
element.value = input;
|
|
12168
12182
|
element.dispatchEvent(new InputEvent('input', {
|
|
12169
12183
|
bubbles: true,
|
|
@@ -12588,7 +12602,7 @@ const set$2 = href => {
|
|
|
12588
12602
|
}
|
|
12589
12603
|
const url = new URL(href);
|
|
12590
12604
|
const isImageData = /^data:image\/(?:png;base64,|svg\+xml,)/u.test(href);
|
|
12591
|
-
if (url.protocol !== 'https:'
|
|
12605
|
+
if (!isImageData && url.protocol !== 'https:') {
|
|
12592
12606
|
throw new Error('Favicon URL must use HTTPS or PNG/SVG image data');
|
|
12593
12607
|
}
|
|
12594
12608
|
if (!state$1.icon) {
|
|
@@ -12691,8 +12705,8 @@ const appendOnly = async uid => {
|
|
|
12691
12705
|
};
|
|
12692
12706
|
|
|
12693
12707
|
/**
|
|
12694
|
-
|
|
12695
|
-
|
|
12708
|
+
@deprecated use loadOnly and appendOnly instead
|
|
12709
|
+
*/
|
|
12696
12710
|
const load = async uid => {
|
|
12697
12711
|
const $Iframe = get$4(uid);
|
|
12698
12712
|
const promise = waitForFrameToLoad($Iframe);
|
|
@@ -12703,11 +12717,10 @@ const load = async uid => {
|
|
|
12703
12717
|
|
|
12704
12718
|
// TODO rename to sendMessage
|
|
12705
12719
|
const setPort = (uid, port, origin, portType) => {
|
|
12706
|
-
const $Iframe = get$4(uid);
|
|
12707
12720
|
// TODO use jsonrpc invoke
|
|
12708
12721
|
const {
|
|
12709
12722
|
contentWindow
|
|
12710
|
-
} = $
|
|
12723
|
+
} = get$4(uid);
|
|
12711
12724
|
if (!contentWindow) {
|
|
12712
12725
|
throw new Error(`content window not found`);
|
|
12713
12726
|
}
|
|
@@ -13194,6 +13207,9 @@ const handleUnhandledError = (message, filename, lineno, colno, error) => {
|
|
|
13194
13207
|
};
|
|
13195
13208
|
|
|
13196
13209
|
const handleWindowMessage = event => {
|
|
13210
|
+
if (event.origin !== location.origin) {
|
|
13211
|
+
return;
|
|
13212
|
+
}
|
|
13197
13213
|
// eslint-disable-next-line no-console
|
|
13198
13214
|
console.log({
|
|
13199
13215
|
event
|
|
@@ -13234,7 +13250,9 @@ const main = async () => {
|
|
|
13234
13250
|
setIpc(ViewletEventRouter);
|
|
13235
13251
|
};
|
|
13236
13252
|
|
|
13237
|
-
/**
|
|
13253
|
+
/**
|
|
13254
|
+
Dispatches an embedding application's shortcut in order with native editor input.
|
|
13255
|
+
*/
|
|
13238
13256
|
const executeShortcut = (command, ...args) => runShortcut(() => invoke$1(command, ...args));
|
|
13239
13257
|
|
|
13240
13258
|
const ready = main();
|
|
@@ -13419,7 +13437,7 @@ const restore = (state, snapshot) => {
|
|
|
13419
13437
|
data,
|
|
13420
13438
|
rows
|
|
13421
13439
|
} = snapshot;
|
|
13422
|
-
if (!Number.isSafeInteger(columns) || !Number.isSafeInteger(rows) || columns < 2 || columns > 500 || rows < 1 || rows > 200
|
|
13440
|
+
if (typeof data !== 'string' || !Number.isSafeInteger(columns) || !Number.isSafeInteger(rows) || columns < 2 || columns > 500 || rows < 1 || rows > 200) {
|
|
13423
13441
|
throw new Error('Invalid terminal snapshot');
|
|
13424
13442
|
}
|
|
13425
13443
|
const {
|