@lvce-editor/renderer-process 30.34.1 → 30.35.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 +111 -86
- package/package.json +1 -1
|
@@ -211,6 +211,42 @@ const showState = async () => {
|
|
|
211
211
|
info(state);
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
+
const rpcs = new Map();
|
|
215
|
+
const viewRpcIds = new Map();
|
|
216
|
+
const get$9 = uid => {
|
|
217
|
+
const rpcId = viewRpcIds.get(uid);
|
|
218
|
+
return rpcId === undefined ? undefined : rpcs.get(rpcId);
|
|
219
|
+
};
|
|
220
|
+
const getViewUid = rpcId => {
|
|
221
|
+
let matchingUid;
|
|
222
|
+
for (const [uid, registeredRpcId] of viewRpcIds) {
|
|
223
|
+
if (registeredRpcId === rpcId) {
|
|
224
|
+
matchingUid = uid;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (matchingUid === undefined) {
|
|
228
|
+
throw new Error(`direct view not found: ${rpcId}`);
|
|
229
|
+
}
|
|
230
|
+
return matchingUid;
|
|
231
|
+
};
|
|
232
|
+
const registerRpc = (rpcId, rpc) => {
|
|
233
|
+
const previous = rpcs.get(rpcId);
|
|
234
|
+
if (previous && previous !== rpc) {
|
|
235
|
+
previous.dispose();
|
|
236
|
+
}
|
|
237
|
+
rpcs.set(rpcId, rpc);
|
|
238
|
+
};
|
|
239
|
+
const registerView = (uid, rpcId) => {
|
|
240
|
+
if (rpcId === undefined) {
|
|
241
|
+
viewRpcIds.delete(uid);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
viewRpcIds.set(uid, rpcId);
|
|
245
|
+
};
|
|
246
|
+
const unregisterView = uid => {
|
|
247
|
+
viewRpcIds.delete(uid);
|
|
248
|
+
};
|
|
249
|
+
|
|
214
250
|
const downloadFile = (fileName, url) => {
|
|
215
251
|
const a = document.createElement('a');
|
|
216
252
|
a.href = url;
|
|
@@ -1277,7 +1313,7 @@ const {
|
|
|
1277
1313
|
} = ElementTagMap;
|
|
1278
1314
|
|
|
1279
1315
|
const instances = Object.create(null);
|
|
1280
|
-
const get$
|
|
1316
|
+
const get$8 = viewletId => {
|
|
1281
1317
|
return instances[viewletId];
|
|
1282
1318
|
};
|
|
1283
1319
|
const set$a = (viewletId, instance) => {
|
|
@@ -1312,7 +1348,7 @@ const has$1 = listener => {
|
|
|
1312
1348
|
const set$9 = (listener, value) => {
|
|
1313
1349
|
cache.set(listener, value);
|
|
1314
1350
|
};
|
|
1315
|
-
const get$
|
|
1351
|
+
const get$7 = listener => {
|
|
1316
1352
|
return cache.get(listener);
|
|
1317
1353
|
};
|
|
1318
1354
|
|
|
@@ -1334,7 +1370,7 @@ const getWrappedListener = (listener, returnValue) => {
|
|
|
1334
1370
|
nameAnonymousFunction$1(wrapped, listener.name);
|
|
1335
1371
|
set$9(listener, wrapped);
|
|
1336
1372
|
}
|
|
1337
|
-
return get$
|
|
1373
|
+
return get$7(listener);
|
|
1338
1374
|
};
|
|
1339
1375
|
|
|
1340
1376
|
const attachedListeners = new WeakMap();
|
|
@@ -1568,7 +1604,7 @@ const renderDomElement = (element, eventMap, newEventMap) => {
|
|
|
1568
1604
|
return $Element;
|
|
1569
1605
|
};
|
|
1570
1606
|
const renderReferenceNode = (element, eventMap, newEventMap) => {
|
|
1571
|
-
const instance = get$
|
|
1607
|
+
const instance = get$8(element.uid);
|
|
1572
1608
|
if (!instance || !instance.state) {
|
|
1573
1609
|
return document.createTextNode('Reference node not found');
|
|
1574
1610
|
}
|
|
@@ -1714,7 +1750,7 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
|
|
|
1714
1750
|
return true;
|
|
1715
1751
|
};
|
|
1716
1752
|
const handleSetReferenceNodeUid = (state, patch) => {
|
|
1717
|
-
const instance = get$
|
|
1753
|
+
const instance = get$8(patch.uid);
|
|
1718
1754
|
if (!instance || !instance.state) {
|
|
1719
1755
|
console.error('Cannot set reference node uid: instance not found', {
|
|
1720
1756
|
uid: patch.uid
|
|
@@ -1930,7 +1966,7 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
|
|
|
1930
1966
|
}
|
|
1931
1967
|
};
|
|
1932
1968
|
|
|
1933
|
-
const get$
|
|
1969
|
+
const get$6 = ids => {
|
|
1934
1970
|
return getFileHandles$1(ids);
|
|
1935
1971
|
};
|
|
1936
1972
|
|
|
@@ -2857,7 +2893,7 @@ const execute = (command, ...args) => {
|
|
|
2857
2893
|
|
|
2858
2894
|
const Two$1 = '2.0';
|
|
2859
2895
|
const callbacks = Object.create(null);
|
|
2860
|
-
const get$
|
|
2896
|
+
const get$5 = id => {
|
|
2861
2897
|
return callbacks[id];
|
|
2862
2898
|
};
|
|
2863
2899
|
const remove$4 = id => {
|
|
@@ -3047,7 +3083,7 @@ const warn = (...args) => {
|
|
|
3047
3083
|
console.warn(...args);
|
|
3048
3084
|
};
|
|
3049
3085
|
const resolve = (id, response) => {
|
|
3050
|
-
const fn = get$
|
|
3086
|
+
const fn = get$5(id);
|
|
3051
3087
|
if (!fn) {
|
|
3052
3088
|
console.log(response);
|
|
3053
3089
|
warn(`callback ${id} may already be disposed`);
|
|
@@ -3523,7 +3559,7 @@ const ipcs = Object.create(null);
|
|
|
3523
3559
|
const set$7 = (name, ipc) => {
|
|
3524
3560
|
ipcs[name] = ipc;
|
|
3525
3561
|
};
|
|
3526
|
-
const get$
|
|
3562
|
+
const get$4 = name => {
|
|
3527
3563
|
return ipcs[name];
|
|
3528
3564
|
};
|
|
3529
3565
|
const remove$2 = name => {
|
|
@@ -3757,7 +3793,7 @@ const create$u = async ({
|
|
|
3757
3793
|
}
|
|
3758
3794
|
// TODO rename method
|
|
3759
3795
|
// TODO avoid cyclic dependency
|
|
3760
|
-
const port = get$
|
|
3796
|
+
const port = get$4(options.name);
|
|
3761
3797
|
remove$2(options.name);
|
|
3762
3798
|
await invokeAndTransfer('Transferrable.transfer', options.id, port);
|
|
3763
3799
|
return;
|
|
@@ -4021,7 +4057,7 @@ const create$BackDrop = () => {
|
|
|
4021
4057
|
};
|
|
4022
4058
|
|
|
4023
4059
|
const set$5 = setComponentUid;
|
|
4024
|
-
const get$
|
|
4060
|
+
const get$3 = getComponentUid;
|
|
4025
4061
|
const fromEvent = getComponentUidFromEvent;
|
|
4026
4062
|
|
|
4027
4063
|
const AriaOwns = 'aria-owns';
|
|
@@ -4400,7 +4436,7 @@ const showControlled = ({
|
|
|
4400
4436
|
showMenu(x, y, width, height, items, level);
|
|
4401
4437
|
const $Menu = state$5.$$Menus.at(-1);
|
|
4402
4438
|
if ($Parent && $Menu) {
|
|
4403
|
-
const uid = get$
|
|
4439
|
+
const uid = get$3($Parent);
|
|
4404
4440
|
set$5($Menu, uid);
|
|
4405
4441
|
}
|
|
4406
4442
|
// TODO menu should not necessarily know about parent (titleBarMenuBar)
|
|
@@ -4487,7 +4523,7 @@ const prompt = (message, defaultValue) => {
|
|
|
4487
4523
|
};
|
|
4488
4524
|
|
|
4489
4525
|
const screenCaptures = Object.create(null);
|
|
4490
|
-
const get$
|
|
4526
|
+
const get$2 = id => {
|
|
4491
4527
|
return screenCaptures[id];
|
|
4492
4528
|
};
|
|
4493
4529
|
const set$4 = (id, captureStream) => {
|
|
@@ -4553,9 +4589,9 @@ class VError extends Error {
|
|
|
4553
4589
|
}
|
|
4554
4590
|
}
|
|
4555
4591
|
|
|
4556
|
-
const get$
|
|
4592
|
+
const get$1 = id => {
|
|
4557
4593
|
number(id);
|
|
4558
|
-
return get$
|
|
4594
|
+
return get$2(id);
|
|
4559
4595
|
};
|
|
4560
4596
|
const start = async (id, options) => {
|
|
4561
4597
|
try {
|
|
@@ -5212,7 +5248,7 @@ const webViews = Object.create(null);
|
|
|
5212
5248
|
const set$3 = (id, webView) => {
|
|
5213
5249
|
webViews[id] = webView;
|
|
5214
5250
|
};
|
|
5215
|
-
const get
|
|
5251
|
+
const get = id => {
|
|
5216
5252
|
return webViews[id];
|
|
5217
5253
|
};
|
|
5218
5254
|
const remove = id => {
|
|
@@ -5232,7 +5268,7 @@ const acquire = objectId => {
|
|
|
5232
5268
|
// TODO transfer port directly instead of storing
|
|
5233
5269
|
// it for a short time in state
|
|
5234
5270
|
const transferToWebView = objectId => {
|
|
5235
|
-
const $Iframe = get
|
|
5271
|
+
const $Iframe = get(1);
|
|
5236
5272
|
if (!$Iframe) {
|
|
5237
5273
|
throw new Error(`webview not found`);
|
|
5238
5274
|
}
|
|
@@ -5261,30 +5297,6 @@ const attachEvents$7 = ($Node, eventMap) => {
|
|
|
5261
5297
|
}
|
|
5262
5298
|
};
|
|
5263
5299
|
|
|
5264
|
-
const rpcs = new Map();
|
|
5265
|
-
const viewRpcIds = new Map();
|
|
5266
|
-
const get = uid => {
|
|
5267
|
-
const rpcId = viewRpcIds.get(uid);
|
|
5268
|
-
return rpcId === undefined ? undefined : rpcs.get(rpcId);
|
|
5269
|
-
};
|
|
5270
|
-
const registerRpc = (rpcId, rpc) => {
|
|
5271
|
-
const previous = rpcs.get(rpcId);
|
|
5272
|
-
if (previous && previous !== rpc) {
|
|
5273
|
-
previous.dispose();
|
|
5274
|
-
}
|
|
5275
|
-
rpcs.set(rpcId, rpc);
|
|
5276
|
-
};
|
|
5277
|
-
const registerView = (uid, rpcId) => {
|
|
5278
|
-
if (rpcId === undefined) {
|
|
5279
|
-
viewRpcIds.delete(uid);
|
|
5280
|
-
return;
|
|
5281
|
-
}
|
|
5282
|
-
viewRpcIds.set(uid, rpcId);
|
|
5283
|
-
};
|
|
5284
|
-
const unregisterView = uid => {
|
|
5285
|
-
viewRpcIds.delete(uid);
|
|
5286
|
-
};
|
|
5287
|
-
|
|
5288
5300
|
const state$4 = {
|
|
5289
5301
|
currentDragInfo: undefined
|
|
5290
5302
|
};
|
|
@@ -5483,7 +5495,7 @@ const ViewletActivityBar = {
|
|
|
5483
5495
|
const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
|
|
5484
5496
|
const send = (method, uid, ...args) => {
|
|
5485
5497
|
if (method === executeViewletCommand$1) {
|
|
5486
|
-
const rpc = get(uid);
|
|
5498
|
+
const rpc = get$9(uid);
|
|
5487
5499
|
if (rpc) {
|
|
5488
5500
|
rpc.send(method, uid, ...args);
|
|
5489
5501
|
return;
|
|
@@ -5678,7 +5690,7 @@ const applyUidWorkaround = element => {
|
|
|
5678
5690
|
if (!editor) {
|
|
5679
5691
|
throw new Error('no editor found');
|
|
5680
5692
|
}
|
|
5681
|
-
const editorUid = get$
|
|
5693
|
+
const editorUid = get$3(editor);
|
|
5682
5694
|
set$5(element, editorUid);
|
|
5683
5695
|
};
|
|
5684
5696
|
|
|
@@ -7652,7 +7664,7 @@ const handleClickAction$1 = target => {
|
|
|
7652
7664
|
console.info('[panel] action command not found');
|
|
7653
7665
|
return;
|
|
7654
7666
|
}
|
|
7655
|
-
const childUid = get$
|
|
7667
|
+
const childUid = get$3(target);
|
|
7656
7668
|
handleClickAction$2(childUid, index, command);
|
|
7657
7669
|
};
|
|
7658
7670
|
const handleHeaderClick$1 = event => {
|
|
@@ -7778,7 +7790,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
|
|
|
7778
7790
|
const {
|
|
7779
7791
|
$PanelActions
|
|
7780
7792
|
} = state;
|
|
7781
|
-
const instance = get$
|
|
7793
|
+
const instance = get$8(childUid);
|
|
7782
7794
|
if (!instance) {
|
|
7783
7795
|
throw new Error(`child instance not found`);
|
|
7784
7796
|
}
|
|
@@ -7831,7 +7843,7 @@ const setScreenCapture = (state, id) => {
|
|
|
7831
7843
|
$Viewlet
|
|
7832
7844
|
} = state;
|
|
7833
7845
|
const $Video = document.createElement('video');
|
|
7834
|
-
const screenCapture = get$
|
|
7846
|
+
const screenCapture = get$1(id);
|
|
7835
7847
|
$Video.srcObject = screenCapture;
|
|
7836
7848
|
$Video.onloadedmetadata = handleLoadedMetadata;
|
|
7837
7849
|
$Viewlet.append($Video);
|
|
@@ -8210,7 +8222,7 @@ const handleMouseDown$1 = event => {
|
|
|
8210
8222
|
if (!terminal) {
|
|
8211
8223
|
return;
|
|
8212
8224
|
}
|
|
8213
|
-
const terminalUid = get$
|
|
8225
|
+
const terminalUid = get$3(terminal);
|
|
8214
8226
|
if (!terminalUid) {
|
|
8215
8227
|
return;
|
|
8216
8228
|
}
|
|
@@ -8774,7 +8786,7 @@ const setPort$1 = (state, portId, origin) => {
|
|
|
8774
8786
|
});
|
|
8775
8787
|
};
|
|
8776
8788
|
const setPosition = (state, id, x, y, width, height) => {
|
|
8777
|
-
const $Iframe = get
|
|
8789
|
+
const $Iframe = get(id);
|
|
8778
8790
|
if (!$Iframe) {
|
|
8779
8791
|
return;
|
|
8780
8792
|
}
|
|
@@ -8859,7 +8871,7 @@ const create$2 = (id, uid = id) => {
|
|
|
8859
8871
|
if (!module) {
|
|
8860
8872
|
throw new Error(`module not found: ${id}`);
|
|
8861
8873
|
}
|
|
8862
|
-
const existing = get$
|
|
8874
|
+
const existing = get$8(id);
|
|
8863
8875
|
if (existing?.state.$Viewlet.isConnected) {
|
|
8864
8876
|
existing.state.$Viewlet.remove();
|
|
8865
8877
|
}
|
|
@@ -8881,7 +8893,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
|
|
|
8881
8893
|
if (!module) {
|
|
8882
8894
|
throw new Error(`module not found: ${id}`);
|
|
8883
8895
|
}
|
|
8884
|
-
const existing = get$
|
|
8896
|
+
const existing = get$8(id);
|
|
8885
8897
|
if (existing?.state.$Viewlet.isConnected) {
|
|
8886
8898
|
existing.state.$Viewlet.remove();
|
|
8887
8899
|
}
|
|
@@ -8913,7 +8925,7 @@ const loadModule = async id => {
|
|
|
8913
8925
|
};
|
|
8914
8926
|
const invoke = (viewletId, method, ...args) => {
|
|
8915
8927
|
string(method);
|
|
8916
|
-
const instance = get$
|
|
8928
|
+
const instance = get$8(viewletId);
|
|
8917
8929
|
if (!instance?.factory) {
|
|
8918
8930
|
if (viewletId && method !== 'setActionsDom') {
|
|
8919
8931
|
warn$1(`cannot execute ${method} viewlet instance ${viewletId} not found`);
|
|
@@ -8931,7 +8943,7 @@ const focus$1 = viewletId => {
|
|
|
8931
8943
|
// eslint-disable-next-line no-console
|
|
8932
8944
|
console.trace(`focus ${viewletId}`);
|
|
8933
8945
|
}
|
|
8934
|
-
const instance = get$
|
|
8946
|
+
const instance = get$8(viewletId);
|
|
8935
8947
|
if (instance.factory?.setFocused) {
|
|
8936
8948
|
instance.factory.setFocused(instance.state, true);
|
|
8937
8949
|
} else if (instance?.factory?.focus) {
|
|
@@ -8947,7 +8959,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
8947
8959
|
// eslint-disable-next-line no-console
|
|
8948
8960
|
console.trace(`focusByName ${viewletId} ${name}`);
|
|
8949
8961
|
}
|
|
8950
|
-
const instance = get$
|
|
8962
|
+
const instance = get$8(viewletId);
|
|
8951
8963
|
if (!instance) {
|
|
8952
8964
|
return;
|
|
8953
8965
|
}
|
|
@@ -8962,7 +8974,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
8962
8974
|
};
|
|
8963
8975
|
const setElementProperty = (viewletId, name, key, value) => {
|
|
8964
8976
|
const selector = `[name="${name}"]`;
|
|
8965
|
-
const instance = get$
|
|
8977
|
+
const instance = get$8(viewletId);
|
|
8966
8978
|
if (!instance) {
|
|
8967
8979
|
return;
|
|
8968
8980
|
}
|
|
@@ -8991,7 +9003,7 @@ const setCheckboxValue = (viewletId, name, value) => {
|
|
|
8991
9003
|
};
|
|
8992
9004
|
const setSelectionByName = (viewletId, name, start, end) => {
|
|
8993
9005
|
const selector = `[name="${name}"]`;
|
|
8994
|
-
const instance = get$
|
|
9006
|
+
const instance = get$8(viewletId);
|
|
8995
9007
|
if (!instance) {
|
|
8996
9008
|
return;
|
|
8997
9009
|
}
|
|
@@ -9006,7 +9018,7 @@ const setSelectionByName = (viewletId, name, start, end) => {
|
|
|
9006
9018
|
$Element.selectionEnd = end;
|
|
9007
9019
|
};
|
|
9008
9020
|
const setUid = (viewletId, uid) => {
|
|
9009
|
-
const instance = get$
|
|
9021
|
+
const instance = get$8(viewletId);
|
|
9010
9022
|
if (!instance) {
|
|
9011
9023
|
return;
|
|
9012
9024
|
}
|
|
@@ -9024,7 +9036,7 @@ const resetFocusCallback = () => {
|
|
|
9024
9036
|
focusCallback.selector = '';
|
|
9025
9037
|
};
|
|
9026
9038
|
const focusSelector = (viewletId, selector) => {
|
|
9027
|
-
const instance = get$
|
|
9039
|
+
const instance = get$8(viewletId);
|
|
9028
9040
|
if (!instance) {
|
|
9029
9041
|
return;
|
|
9030
9042
|
}
|
|
@@ -9056,7 +9068,7 @@ const focusSelectorAfterRender = (viewletId, selector) => {
|
|
|
9056
9068
|
* @deprecated
|
|
9057
9069
|
*/
|
|
9058
9070
|
const refresh = (viewletId, viewletContext) => {
|
|
9059
|
-
const instance = get$
|
|
9071
|
+
const instance = get$8(viewletId);
|
|
9060
9072
|
if (instance) {
|
|
9061
9073
|
instance.factory.refresh(instance.state, viewletContext);
|
|
9062
9074
|
} else {
|
|
@@ -9075,7 +9087,7 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
|
|
|
9075
9087
|
if (isSpecial(viewletId)) {
|
|
9076
9088
|
$Placeholder.id = viewletId;
|
|
9077
9089
|
}
|
|
9078
|
-
const parentInstance = get$
|
|
9090
|
+
const parentInstance = get$8(parentId);
|
|
9079
9091
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9080
9092
|
$Parent.append($Placeholder);
|
|
9081
9093
|
set$a(viewletId, {
|
|
@@ -9091,7 +9103,7 @@ const getDragData = () => {
|
|
|
9091
9103
|
return getCurrent();
|
|
9092
9104
|
};
|
|
9093
9105
|
const setDom = (viewletId, dom) => {
|
|
9094
|
-
const instance = get$
|
|
9106
|
+
const instance = get$8(viewletId);
|
|
9095
9107
|
if (!instance) {
|
|
9096
9108
|
return;
|
|
9097
9109
|
}
|
|
@@ -9104,7 +9116,7 @@ const setDom = (viewletId, dom) => {
|
|
|
9104
9116
|
renderInto($Viewlet, dom, Events);
|
|
9105
9117
|
};
|
|
9106
9118
|
const setDom2 = (viewletId, dom) => {
|
|
9107
|
-
const instance = get$
|
|
9119
|
+
const instance = get$8(viewletId);
|
|
9108
9120
|
if (!instance) {
|
|
9109
9121
|
return;
|
|
9110
9122
|
}
|
|
@@ -9117,7 +9129,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9117
9129
|
let uid;
|
|
9118
9130
|
if ($Viewlet) {
|
|
9119
9131
|
try {
|
|
9120
|
-
uid = get$
|
|
9132
|
+
uid = get$3($Viewlet);
|
|
9121
9133
|
} catch {}
|
|
9122
9134
|
}
|
|
9123
9135
|
// TODO optimize rendering with virtual DOM diffing
|
|
@@ -9135,7 +9147,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9135
9147
|
});
|
|
9136
9148
|
};
|
|
9137
9149
|
const setPatches = (uid, patches) => {
|
|
9138
|
-
const instance = get$
|
|
9150
|
+
const instance = get$8(uid);
|
|
9139
9151
|
if (!instance) {
|
|
9140
9152
|
return;
|
|
9141
9153
|
}
|
|
@@ -9207,7 +9219,7 @@ const dispose$3 = id => {
|
|
|
9207
9219
|
try {
|
|
9208
9220
|
number(id);
|
|
9209
9221
|
unregisterView(id);
|
|
9210
|
-
const instance = get$
|
|
9222
|
+
const instance = get$8(id);
|
|
9211
9223
|
if (!instance) {
|
|
9212
9224
|
warn$1(`viewlet instance ${id} not found and cannot be disposed`);
|
|
9213
9225
|
return;
|
|
@@ -9226,7 +9238,7 @@ const dispose$3 = id => {
|
|
|
9226
9238
|
};
|
|
9227
9239
|
const handleError$1 = (id, parentId, message) => {
|
|
9228
9240
|
info(`[viewlet-error] ${id}: ${message}`);
|
|
9229
|
-
const instance = get$
|
|
9241
|
+
const instance = get$8(id);
|
|
9230
9242
|
if (instance?.state.$Viewlet.isConnected) {
|
|
9231
9243
|
instance.state.$Viewlet.remove();
|
|
9232
9244
|
}
|
|
@@ -9238,7 +9250,7 @@ const handleError$1 = (id, parentId, message) => {
|
|
|
9238
9250
|
instance.state.$Viewlet.textContent = String(message);
|
|
9239
9251
|
}
|
|
9240
9252
|
// TODO error should bubble up to until highest possible component
|
|
9241
|
-
const parentInstance = get$
|
|
9253
|
+
const parentInstance = get$8(parentId);
|
|
9242
9254
|
if (parentInstance?.factory?.handleError) {
|
|
9243
9255
|
parentInstance.factory.handleError(instance.state, message);
|
|
9244
9256
|
}
|
|
@@ -9252,9 +9264,9 @@ const appendViewlet = (parentId, childId, focus) => {
|
|
|
9252
9264
|
// TODO
|
|
9253
9265
|
return;
|
|
9254
9266
|
}
|
|
9255
|
-
const parentInstanceState = get$
|
|
9267
|
+
const parentInstanceState = get$8(parentId); // TODO must ensure that parent is already created
|
|
9256
9268
|
const parentModule = parentInstanceState.factory;
|
|
9257
|
-
const childInstance = get$
|
|
9269
|
+
const childInstance = get$8(childId);
|
|
9258
9270
|
if (!childInstance) {
|
|
9259
9271
|
throw new Error(`child instance ${childId} must be defined to be appended to parent ${parentId}`);
|
|
9260
9272
|
}
|
|
@@ -9278,7 +9290,7 @@ const prependChild = ($Parent, $Child) => {
|
|
|
9278
9290
|
const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
9279
9291
|
for (let i = childIndex - 1; i >= 0; i--) {
|
|
9280
9292
|
const beforeId = referenceNodes[i];
|
|
9281
|
-
const beforeInstance = get$
|
|
9293
|
+
const beforeInstance = get$8(beforeId);
|
|
9282
9294
|
if (beforeInstance) {
|
|
9283
9295
|
const $ReferenceNode = beforeInstance.state.$Viewlet;
|
|
9284
9296
|
$ReferenceNode.after($Child);
|
|
@@ -9290,7 +9302,7 @@ const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
|
9290
9302
|
const appendBeforeNextReference = (referenceNodes, childIndex, $Child) => {
|
|
9291
9303
|
for (let i = childIndex + 1; i < referenceNodes.length; i++) {
|
|
9292
9304
|
const afterId = referenceNodes[i];
|
|
9293
|
-
const afterInstance = get$
|
|
9305
|
+
const afterInstance = get$8(afterId);
|
|
9294
9306
|
if (afterInstance) {
|
|
9295
9307
|
const $ReferenceNode = afterInstance.state.$Viewlet;
|
|
9296
9308
|
$ReferenceNode.before($Child);
|
|
@@ -9320,12 +9332,12 @@ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
|
|
|
9320
9332
|
const append = (parentId, childId, referenceNodes) => {
|
|
9321
9333
|
number(parentId);
|
|
9322
9334
|
number(childId);
|
|
9323
|
-
const parentInstance = get$
|
|
9335
|
+
const parentInstance = get$8(parentId);
|
|
9324
9336
|
if (!parentInstance) {
|
|
9325
9337
|
throw new Error(`cannot append child: instance ${parentId} not found`);
|
|
9326
9338
|
}
|
|
9327
9339
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9328
|
-
const childInstance = get$
|
|
9340
|
+
const childInstance = get$8(childId);
|
|
9329
9341
|
if (!childInstance) {
|
|
9330
9342
|
throw new Error(`cannot append child: child instance not found ${childId}`);
|
|
9331
9343
|
}
|
|
@@ -9344,11 +9356,11 @@ const append = (parentId, childId, referenceNodes) => {
|
|
|
9344
9356
|
applyLateFocusMaybe();
|
|
9345
9357
|
};
|
|
9346
9358
|
const replaceChildren = (parentId, childIds) => {
|
|
9347
|
-
const parentInstance = get$
|
|
9359
|
+
const parentInstance = get$8(parentId);
|
|
9348
9360
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9349
9361
|
const $Fragment = document.createDocumentFragment();
|
|
9350
9362
|
for (const childId of childIds) {
|
|
9351
|
-
const childInstance = get$
|
|
9363
|
+
const childInstance = get$8(childId);
|
|
9352
9364
|
const $Child = childInstance.state.$Viewlet;
|
|
9353
9365
|
$Fragment.append($Child);
|
|
9354
9366
|
}
|
|
@@ -9363,7 +9375,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9363
9375
|
selector
|
|
9364
9376
|
} = focusCallback;
|
|
9365
9377
|
resetFocusCallback();
|
|
9366
|
-
const instance = get$
|
|
9378
|
+
const instance = get$8(id);
|
|
9367
9379
|
if (instance) {
|
|
9368
9380
|
const {
|
|
9369
9381
|
$Viewlet
|
|
@@ -9376,7 +9388,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9376
9388
|
};
|
|
9377
9389
|
const appendToBody = childId => {
|
|
9378
9390
|
const $Parent = document.body;
|
|
9379
|
-
const childInstance = get$
|
|
9391
|
+
const childInstance = get$8(childId);
|
|
9380
9392
|
const $Child = childInstance.state.$Viewlet;
|
|
9381
9393
|
$Parent.append($Child);
|
|
9382
9394
|
applyLateFocusMaybe();
|
|
@@ -9389,7 +9401,7 @@ const executeCommands = commands => {
|
|
|
9389
9401
|
}
|
|
9390
9402
|
};
|
|
9391
9403
|
const show = id => {
|
|
9392
|
-
const instance = get$
|
|
9404
|
+
const instance = get$8(id);
|
|
9393
9405
|
const $Viewlet = instance.state.$Viewlet;
|
|
9394
9406
|
const $Workbench = document.getElementById('Workbench');
|
|
9395
9407
|
// @ts-expect-error
|
|
@@ -9399,7 +9411,7 @@ const show = id => {
|
|
|
9399
9411
|
}
|
|
9400
9412
|
};
|
|
9401
9413
|
const setBounds$1 = (id, left, top, width, height) => {
|
|
9402
|
-
const instance = get$
|
|
9414
|
+
const instance = get$8(id);
|
|
9403
9415
|
if (!instance) {
|
|
9404
9416
|
return;
|
|
9405
9417
|
}
|
|
@@ -9407,7 +9419,7 @@ const setBounds$1 = (id, left, top, width, height) => {
|
|
|
9407
9419
|
setBounds$a($Viewlet, left, top, width, height);
|
|
9408
9420
|
};
|
|
9409
9421
|
const setProperty = (id, selector, property, value) => {
|
|
9410
|
-
const instance = get$
|
|
9422
|
+
const instance = get$8(id);
|
|
9411
9423
|
if (!instance) {
|
|
9412
9424
|
return;
|
|
9413
9425
|
}
|
|
@@ -9572,9 +9584,13 @@ const getFilePathElectron = async file => {
|
|
|
9572
9584
|
return filePath;
|
|
9573
9585
|
};
|
|
9574
9586
|
|
|
9587
|
+
const forwardRendererWorkerCommand = (method, ...params) => {
|
|
9588
|
+
send$1(method, ...params);
|
|
9589
|
+
};
|
|
9575
9590
|
const handleMessagePort = async (port, rpcId) => {
|
|
9576
9591
|
const rpc = await create$x({
|
|
9577
9592
|
commandMap: {
|
|
9593
|
+
'Viewlet.forwardRendererWorkerCommand': forwardRendererWorkerCommand,
|
|
9578
9594
|
'Viewlet.queueCommands': queueCommands
|
|
9579
9595
|
},
|
|
9580
9596
|
messagePort: port
|
|
@@ -9619,12 +9635,12 @@ const create$1 = async (uid, src, sandbox, csp, credentialless, permissionPolicy
|
|
|
9619
9635
|
// TODO make make waitForFrameToLoad a separate command
|
|
9620
9636
|
};
|
|
9621
9637
|
const loadOnly = async uid => {
|
|
9622
|
-
const $Iframe = get
|
|
9638
|
+
const $Iframe = get(uid);
|
|
9623
9639
|
const promise = waitForFrameToLoad($Iframe);
|
|
9624
9640
|
await promise;
|
|
9625
9641
|
};
|
|
9626
9642
|
const appendOnly = async uid => {
|
|
9627
|
-
const $Iframe = get
|
|
9643
|
+
const $Iframe = get(uid);
|
|
9628
9644
|
const parent = document.getElementById('Workbench');
|
|
9629
9645
|
parent.append($Iframe);
|
|
9630
9646
|
};
|
|
@@ -9633,7 +9649,7 @@ const appendOnly = async uid => {
|
|
|
9633
9649
|
* @deprecated use loadOnly and appendOnly instead
|
|
9634
9650
|
*/
|
|
9635
9651
|
const load = async uid => {
|
|
9636
|
-
const $Iframe = get
|
|
9652
|
+
const $Iframe = get(uid);
|
|
9637
9653
|
const promise = waitForFrameToLoad($Iframe);
|
|
9638
9654
|
const parent = document.getElementById('Workbench');
|
|
9639
9655
|
parent.append($Iframe);
|
|
@@ -9642,7 +9658,7 @@ const load = async uid => {
|
|
|
9642
9658
|
|
|
9643
9659
|
// TODO rename to sendMessage
|
|
9644
9660
|
const setPort = (uid, port, origin, portType) => {
|
|
9645
|
-
const $Iframe = get
|
|
9661
|
+
const $Iframe = get(uid);
|
|
9646
9662
|
// TODO use jsonrpc invoke
|
|
9647
9663
|
const {
|
|
9648
9664
|
contentWindow
|
|
@@ -9657,7 +9673,7 @@ const setPort = (uid, port, origin, portType) => {
|
|
|
9657
9673
|
}, origin, [port]);
|
|
9658
9674
|
};
|
|
9659
9675
|
const dispose$2 = uid => {
|
|
9660
|
-
const $Iframe = get
|
|
9676
|
+
const $Iframe = get(uid);
|
|
9661
9677
|
$Iframe.remove();
|
|
9662
9678
|
remove(uid);
|
|
9663
9679
|
};
|
|
@@ -9675,7 +9691,7 @@ const queryAudio = (uid, elementLocator) => {
|
|
|
9675
9691
|
// @ts-ignore
|
|
9676
9692
|
return remoteAudio;
|
|
9677
9693
|
}
|
|
9678
|
-
const $Viewlet = get$
|
|
9694
|
+
const $Viewlet = get$8(uid);
|
|
9679
9695
|
const remoteAudio = $Viewlet.querySelector(elementLocator);
|
|
9680
9696
|
if (!remoteAudio) {
|
|
9681
9697
|
console.error('[webrtc] audio element not found');
|
|
@@ -9849,8 +9865,9 @@ const commandMap = {
|
|
|
9849
9865
|
'Css.addCssStyleSheet': addCssStyleSheet,
|
|
9850
9866
|
'Css.getSelectionText': getSelectionText,
|
|
9851
9867
|
'Developer.showState': showState,
|
|
9868
|
+
'DirectView.getUid': getViewUid,
|
|
9852
9869
|
'Download.downloadFile': downloadFile,
|
|
9853
|
-
'FileHandles.get': get$
|
|
9870
|
+
'FileHandles.get': get$6,
|
|
9854
9871
|
'FilePicker.showDirectoryPicker': showDirectoryPicker,
|
|
9855
9872
|
'FilePicker.showFilePicker': showFilePicker,
|
|
9856
9873
|
'FilePicker.showSaveFilePicker': showSaveFilePicker,
|
|
@@ -10482,6 +10499,10 @@ const mountTerminal = async (state, uid) => {
|
|
|
10482
10499
|
state.disposables = [inputDisposable, resizeDisposable];
|
|
10483
10500
|
fitAddon.fit();
|
|
10484
10501
|
flushPendingData(state);
|
|
10502
|
+
if (state.pendingFocus) {
|
|
10503
|
+
state.pendingFocus = false;
|
|
10504
|
+
terminal.focus();
|
|
10505
|
+
}
|
|
10485
10506
|
};
|
|
10486
10507
|
const create = () => {
|
|
10487
10508
|
const $Viewlet = document.createElement('div');
|
|
@@ -10494,6 +10515,7 @@ const create = () => {
|
|
|
10494
10515
|
mountPromise: undefined,
|
|
10495
10516
|
mouseDownListener: undefined,
|
|
10496
10517
|
pendingData: [],
|
|
10518
|
+
pendingFocus: false,
|
|
10497
10519
|
resizeObserver: undefined,
|
|
10498
10520
|
terminal: undefined
|
|
10499
10521
|
};
|
|
@@ -10525,8 +10547,10 @@ const focus = state => {
|
|
|
10525
10547
|
terminal
|
|
10526
10548
|
} = state;
|
|
10527
10549
|
if (!terminal) {
|
|
10550
|
+
state.pendingFocus = true;
|
|
10528
10551
|
return;
|
|
10529
10552
|
}
|
|
10553
|
+
state.pendingFocus = false;
|
|
10530
10554
|
terminal.focus();
|
|
10531
10555
|
};
|
|
10532
10556
|
const handleMouseDown = state => {
|
|
@@ -10552,6 +10576,7 @@ const dispose = state => {
|
|
|
10552
10576
|
}
|
|
10553
10577
|
state.disposables = [];
|
|
10554
10578
|
state.pendingData.length = 0;
|
|
10579
|
+
state.pendingFocus = false;
|
|
10555
10580
|
state.resizeObserver?.disconnect();
|
|
10556
10581
|
state.resizeObserver = undefined;
|
|
10557
10582
|
state.terminal?.dispose();
|