@lvce-editor/renderer-process 30.37.0 → 30.38.1
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.
|
@@ -1198,6 +1198,61 @@ const createIdGenerator = () => {
|
|
|
1198
1198
|
};
|
|
1199
1199
|
const create$1 = createIdGenerator();
|
|
1200
1200
|
|
|
1201
|
+
const state$3 = Object.create(null);
|
|
1202
|
+
const retainString = (item, index) => {
|
|
1203
|
+
const value = new Promise(resolve => {
|
|
1204
|
+
item.getAsString(resolve);
|
|
1205
|
+
});
|
|
1206
|
+
return {
|
|
1207
|
+
index,
|
|
1208
|
+
kind: 'string',
|
|
1209
|
+
type: item.type,
|
|
1210
|
+
value
|
|
1211
|
+
};
|
|
1212
|
+
};
|
|
1213
|
+
const retainFileSystemHandle = async item => {
|
|
1214
|
+
// getAsFileSystemHandle must be invoked while the drag data store is readable.
|
|
1215
|
+
const {
|
|
1216
|
+
getAsFileSystemHandle
|
|
1217
|
+
} = item;
|
|
1218
|
+
if (typeof getAsFileSystemHandle !== 'function') {
|
|
1219
|
+
return undefined;
|
|
1220
|
+
}
|
|
1221
|
+
try {
|
|
1222
|
+
return await getAsFileSystemHandle.call(item);
|
|
1223
|
+
} catch {
|
|
1224
|
+
return undefined;
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
const retainFile = (item, index) => {
|
|
1228
|
+
return {
|
|
1229
|
+
file: item.getAsFile(),
|
|
1230
|
+
fileSystemHandle: retainFileSystemHandle(item),
|
|
1231
|
+
index,
|
|
1232
|
+
kind: 'file',
|
|
1233
|
+
type: item.type
|
|
1234
|
+
};
|
|
1235
|
+
};
|
|
1236
|
+
const retainItems = dataTransfer => {
|
|
1237
|
+
if (!dataTransfer) {
|
|
1238
|
+
return [];
|
|
1239
|
+
}
|
|
1240
|
+
const items = [];
|
|
1241
|
+
for (const [index, item] of [...dataTransfer.items].entries()) {
|
|
1242
|
+
if (item.kind === 'string') {
|
|
1243
|
+
items.push(retainString(item, index));
|
|
1244
|
+
} else if (item.kind === 'file') {
|
|
1245
|
+
items.push(retainFile(item, index));
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
return items;
|
|
1249
|
+
};
|
|
1250
|
+
const add$2 = dataTransfer => {
|
|
1251
|
+
const id = create$1();
|
|
1252
|
+
state$3[id] = retainItems(dataTransfer);
|
|
1253
|
+
return id;
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1201
1256
|
const state$2 = Object.create(null);
|
|
1202
1257
|
const add$1 = promise => {
|
|
1203
1258
|
const id = create$1();
|
|
@@ -1344,6 +1399,11 @@ const getEventListenerArg = (param, event) => {
|
|
|
1344
1399
|
return event.deltaY;
|
|
1345
1400
|
case 'event.detail':
|
|
1346
1401
|
return event.detail;
|
|
1402
|
+
case 'event.dropId':
|
|
1403
|
+
if (event.type !== 'drop') {
|
|
1404
|
+
throw new Error('event.dropId is only available for drop events');
|
|
1405
|
+
}
|
|
1406
|
+
return add$2(event.dataTransfer || null);
|
|
1347
1407
|
case 'event.inputType':
|
|
1348
1408
|
return event.inputType;
|
|
1349
1409
|
case 'event.isTrusted':
|
|
@@ -118,29 +118,29 @@ const confirm = message => {
|
|
|
118
118
|
return window.confirm(message);
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
const state$
|
|
121
|
+
const state$e = {
|
|
122
122
|
styleSheets: Object.create(null),
|
|
123
123
|
texts: Object.create(null)
|
|
124
124
|
};
|
|
125
125
|
const set$b = (id, sheet) => {
|
|
126
|
-
state$
|
|
126
|
+
state$e.styleSheets[id] = sheet;
|
|
127
127
|
};
|
|
128
|
-
const get$
|
|
129
|
-
return state$
|
|
128
|
+
const get$b = id => {
|
|
129
|
+
return state$e.styleSheets[id];
|
|
130
130
|
};
|
|
131
131
|
const setText$2 = (id, text) => {
|
|
132
|
-
state$
|
|
132
|
+
state$e.texts[id] = text;
|
|
133
133
|
};
|
|
134
134
|
const getText = id => {
|
|
135
|
-
return state$
|
|
135
|
+
return state$e.texts[id];
|
|
136
136
|
};
|
|
137
137
|
const remove$5 = id => {
|
|
138
|
-
delete state$
|
|
139
|
-
delete state$
|
|
138
|
+
delete state$e.styleSheets[id];
|
|
139
|
+
delete state$e.texts[id];
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
const addCssStyleSheet = (id, text) => {
|
|
143
|
-
const existing = get$
|
|
143
|
+
const existing = get$b(id);
|
|
144
144
|
if (existing) {
|
|
145
145
|
existing.replaceSync(text);
|
|
146
146
|
setText$2(id, text);
|
|
@@ -153,7 +153,7 @@ const addCssStyleSheet = (id, text) => {
|
|
|
153
153
|
document.adoptedStyleSheets.push(sheet);
|
|
154
154
|
};
|
|
155
155
|
const patchCssStyleSheet = (id, start, deleteCount, replacement) => {
|
|
156
|
-
const sheet = get$
|
|
156
|
+
const sheet = get$b(id);
|
|
157
157
|
const text = getText(id);
|
|
158
158
|
if (!sheet || typeof text !== 'string') {
|
|
159
159
|
throw new Error(`stylesheet ${id} must be initialized before it can be patched`);
|
|
@@ -172,7 +172,7 @@ const patchCssStyleSheet = (id, start, deleteCount, replacement) => {
|
|
|
172
172
|
setText$2(id, newText);
|
|
173
173
|
};
|
|
174
174
|
const removeCssStyleSheet = id => {
|
|
175
|
-
const sheet = get$
|
|
175
|
+
const sheet = get$b(id);
|
|
176
176
|
if (!sheet) {
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
@@ -331,6 +331,69 @@ const createIdGenerator = () => {
|
|
|
331
331
|
};
|
|
332
332
|
const create$J = createIdGenerator();
|
|
333
333
|
|
|
334
|
+
const state$d = Object.create(null);
|
|
335
|
+
const retainString = (item, index) => {
|
|
336
|
+
const value = new Promise(resolve => {
|
|
337
|
+
item.getAsString(resolve);
|
|
338
|
+
});
|
|
339
|
+
return {
|
|
340
|
+
index,
|
|
341
|
+
kind: 'string',
|
|
342
|
+
type: item.type,
|
|
343
|
+
value
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
const retainFileSystemHandle = async item => {
|
|
347
|
+
// getAsFileSystemHandle must be invoked while the drag data store is readable.
|
|
348
|
+
const {
|
|
349
|
+
getAsFileSystemHandle
|
|
350
|
+
} = item;
|
|
351
|
+
if (typeof getAsFileSystemHandle !== 'function') {
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
try {
|
|
355
|
+
return await getAsFileSystemHandle.call(item);
|
|
356
|
+
} catch {
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
const retainFile = (item, index) => {
|
|
361
|
+
return {
|
|
362
|
+
file: item.getAsFile(),
|
|
363
|
+
fileSystemHandle: retainFileSystemHandle(item),
|
|
364
|
+
index,
|
|
365
|
+
kind: 'file',
|
|
366
|
+
type: item.type
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
const retainItems = dataTransfer => {
|
|
370
|
+
if (!dataTransfer) {
|
|
371
|
+
return [];
|
|
372
|
+
}
|
|
373
|
+
const items = [];
|
|
374
|
+
for (const [index, item] of [...dataTransfer.items].entries()) {
|
|
375
|
+
if (item.kind === 'string') {
|
|
376
|
+
items.push(retainString(item, index));
|
|
377
|
+
} else if (item.kind === 'file') {
|
|
378
|
+
items.push(retainFile(item, index));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return items;
|
|
382
|
+
};
|
|
383
|
+
const add$2 = dataTransfer => {
|
|
384
|
+
const id = create$J();
|
|
385
|
+
state$d[id] = retainItems(dataTransfer);
|
|
386
|
+
return id;
|
|
387
|
+
};
|
|
388
|
+
const acquire$2 = id => {
|
|
389
|
+
const items = state$d[id];
|
|
390
|
+
if (!items) {
|
|
391
|
+
throw new Error(`Drop data not found: ${id}`);
|
|
392
|
+
}
|
|
393
|
+
delete state$d[id];
|
|
394
|
+
return items;
|
|
395
|
+
};
|
|
396
|
+
|
|
334
397
|
const state$c = Object.create(null);
|
|
335
398
|
const acquire$1 = id => {
|
|
336
399
|
const promise = state$c[id];
|
|
@@ -491,6 +554,11 @@ const getEventListenerArg = (param, event) => {
|
|
|
491
554
|
return event.deltaY;
|
|
492
555
|
case 'event.detail':
|
|
493
556
|
return event.detail;
|
|
557
|
+
case 'event.dropId':
|
|
558
|
+
if (event.type !== 'drop') {
|
|
559
|
+
throw new Error('event.dropId is only available for drop events');
|
|
560
|
+
}
|
|
561
|
+
return add$2(event.dataTransfer || null);
|
|
494
562
|
case 'event.inputType':
|
|
495
563
|
return event.inputType;
|
|
496
564
|
case 'event.isTrusted':
|
|
@@ -1271,7 +1339,7 @@ const {
|
|
|
1271
1339
|
} = ElementTagMap;
|
|
1272
1340
|
|
|
1273
1341
|
const instances = Object.create(null);
|
|
1274
|
-
const get$
|
|
1342
|
+
const get$a = viewletId => {
|
|
1275
1343
|
return instances[viewletId];
|
|
1276
1344
|
};
|
|
1277
1345
|
const set$a = (viewletId, instance) => {
|
|
@@ -1306,7 +1374,7 @@ const has$1 = listener => {
|
|
|
1306
1374
|
const set$9 = (listener, value) => {
|
|
1307
1375
|
cache.set(listener, value);
|
|
1308
1376
|
};
|
|
1309
|
-
const get$
|
|
1377
|
+
const get$9 = listener => {
|
|
1310
1378
|
return cache.get(listener);
|
|
1311
1379
|
};
|
|
1312
1380
|
|
|
@@ -1328,7 +1396,7 @@ const getWrappedListener = (listener, returnValue) => {
|
|
|
1328
1396
|
nameAnonymousFunction$1(wrapped, listener.name);
|
|
1329
1397
|
set$9(listener, wrapped);
|
|
1330
1398
|
}
|
|
1331
|
-
return get$
|
|
1399
|
+
return get$9(listener);
|
|
1332
1400
|
};
|
|
1333
1401
|
|
|
1334
1402
|
const attachedListeners = new WeakMap();
|
|
@@ -1562,7 +1630,7 @@ const renderDomElement = (element, eventMap, newEventMap) => {
|
|
|
1562
1630
|
return $Element;
|
|
1563
1631
|
};
|
|
1564
1632
|
const renderReferenceNode = (element, eventMap, newEventMap) => {
|
|
1565
|
-
const instance = get$
|
|
1633
|
+
const instance = get$a(element.uid);
|
|
1566
1634
|
if (!instance || !instance.state) {
|
|
1567
1635
|
return document.createTextNode('Reference node not found');
|
|
1568
1636
|
}
|
|
@@ -1708,7 +1776,7 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
|
|
|
1708
1776
|
return true;
|
|
1709
1777
|
};
|
|
1710
1778
|
const handleSetReferenceNodeUid = (state, patch) => {
|
|
1711
|
-
const instance = get$
|
|
1779
|
+
const instance = get$a(patch.uid);
|
|
1712
1780
|
if (!instance || !instance.state) {
|
|
1713
1781
|
console.error('Cannot set reference node uid: instance not found', {
|
|
1714
1782
|
uid: patch.uid
|
|
@@ -1925,12 +1993,12 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
|
|
|
1925
1993
|
};
|
|
1926
1994
|
|
|
1927
1995
|
const set$8 = setComponentUid;
|
|
1928
|
-
const get$
|
|
1996
|
+
const get$8 = getComponentUid;
|
|
1929
1997
|
const fromEvent = getComponentUidFromEvent;
|
|
1930
1998
|
|
|
1931
1999
|
const rpcs = new Map();
|
|
1932
2000
|
const viewRpcIds = new Map();
|
|
1933
|
-
const get$
|
|
2001
|
+
const get$7 = uid => {
|
|
1934
2002
|
const rpcId = viewRpcIds.get(uid);
|
|
1935
2003
|
return rpcId === undefined ? undefined : rpcs.get(rpcId);
|
|
1936
2004
|
};
|
|
@@ -1947,7 +2015,7 @@ const getViewUid = rpcId => {
|
|
|
1947
2015
|
return matchingUid;
|
|
1948
2016
|
};
|
|
1949
2017
|
const getFocusedViewUid = (rpcId, element = document.activeElement) => {
|
|
1950
|
-
const uid = element ? get$
|
|
2018
|
+
const uid = element ? get$8(element) : 0;
|
|
1951
2019
|
if (!uid || viewRpcIds.get(uid) !== rpcId) {
|
|
1952
2020
|
throw new Error(`focused direct view not found: ${rpcId}`);
|
|
1953
2021
|
}
|
|
@@ -1993,6 +2061,69 @@ const getFilePathElectron = async file => {
|
|
|
1993
2061
|
return filePath;
|
|
1994
2062
|
};
|
|
1995
2063
|
|
|
2064
|
+
const validFormats = new Set(['file', 'fileSystemHandle', 'string']);
|
|
2065
|
+
const validateOptions = options => {
|
|
2066
|
+
if (!options || !Array.isArray(options.formats) || typeof options.includeElectronFilePaths !== 'boolean') {
|
|
2067
|
+
throw new TypeError('Invalid drop data options');
|
|
2068
|
+
}
|
|
2069
|
+
for (const format of options.formats) {
|
|
2070
|
+
if (!validFormats.has(format)) {
|
|
2071
|
+
throw new TypeError(`Invalid drop data format: ${format}`);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
const resolveString = async item => {
|
|
2076
|
+
return {
|
|
2077
|
+
index: item.index,
|
|
2078
|
+
kind: 'string',
|
|
2079
|
+
type: item.type,
|
|
2080
|
+
value: await item.value
|
|
2081
|
+
};
|
|
2082
|
+
};
|
|
2083
|
+
const resolveFile = async (item, formats, includeElectronFilePaths) => {
|
|
2084
|
+
const includeFile = formats.has('file');
|
|
2085
|
+
const includeFileSystemHandle = formats.has('fileSystemHandle');
|
|
2086
|
+
const fileSystemHandle = includeFileSystemHandle ? await item.fileSystemHandle : undefined;
|
|
2087
|
+
const electronFilePath = includeElectronFilePaths && globalThis.electronGlobals && item.file ? await getFilePathElectron(item.file) : undefined;
|
|
2088
|
+
if ((!includeFile || !item.file) && !fileSystemHandle && electronFilePath === undefined) {
|
|
2089
|
+
return undefined;
|
|
2090
|
+
}
|
|
2091
|
+
return {
|
|
2092
|
+
...(electronFilePath !== undefined && {
|
|
2093
|
+
electronFilePath
|
|
2094
|
+
}),
|
|
2095
|
+
...(includeFile && item.file && {
|
|
2096
|
+
file: item.file
|
|
2097
|
+
}),
|
|
2098
|
+
...(fileSystemHandle && {
|
|
2099
|
+
fileSystemHandle
|
|
2100
|
+
}),
|
|
2101
|
+
index: item.index,
|
|
2102
|
+
kind: 'file',
|
|
2103
|
+
name: fileSystemHandle?.name || item.file?.name || '',
|
|
2104
|
+
type: item.type
|
|
2105
|
+
};
|
|
2106
|
+
};
|
|
2107
|
+
const get$6 = async (dropId, options) => {
|
|
2108
|
+
validateOptions(options);
|
|
2109
|
+
const retainedItems = acquire$2(dropId);
|
|
2110
|
+
const formats = new Set(options.formats);
|
|
2111
|
+
const items = [];
|
|
2112
|
+
for (const retainedItem of retainedItems) {
|
|
2113
|
+
if (retainedItem.kind === 'string') {
|
|
2114
|
+
if (formats.has('string')) {
|
|
2115
|
+
items.push(await resolveString(retainedItem));
|
|
2116
|
+
}
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2119
|
+
const item = await resolveFile(retainedItem, formats, options.includeElectronFilePaths);
|
|
2120
|
+
if (item) {
|
|
2121
|
+
items.push(item);
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
return items;
|
|
2125
|
+
};
|
|
2126
|
+
|
|
1996
2127
|
const isFileSystemFileHandle = value => {
|
|
1997
2128
|
if (!value || typeof value !== 'object') {
|
|
1998
2129
|
return false;
|
|
@@ -4493,7 +4624,7 @@ const showControlled = ({
|
|
|
4493
4624
|
showMenu(x, y, width, height, items, level);
|
|
4494
4625
|
const $Menu = state$5.$$Menus.at(-1);
|
|
4495
4626
|
if ($Parent && $Menu) {
|
|
4496
|
-
const uid = get$
|
|
4627
|
+
const uid = get$8($Parent);
|
|
4497
4628
|
set$8($Menu, uid);
|
|
4498
4629
|
}
|
|
4499
4630
|
// TODO menu should not necessarily know about parent (titleBarMenuBar)
|
|
@@ -4663,6 +4794,8 @@ const start = async (id, options) => {
|
|
|
4663
4794
|
|
|
4664
4795
|
const getEventClass = eventType => {
|
|
4665
4796
|
switch (eventType) {
|
|
4797
|
+
case ContextMenu:
|
|
4798
|
+
return MouseEvent;
|
|
4666
4799
|
case PointerDown:
|
|
4667
4800
|
case PointerMove:
|
|
4668
4801
|
case PointerUp:
|
|
@@ -5608,7 +5741,7 @@ const ViewletActivityBar = {
|
|
|
5608
5741
|
const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
|
|
5609
5742
|
const send = (method, uid, ...args) => {
|
|
5610
5743
|
if (method === executeViewletCommand$1) {
|
|
5611
|
-
const rpc = get$
|
|
5744
|
+
const rpc = get$7(uid);
|
|
5612
5745
|
if (rpc) {
|
|
5613
5746
|
rpc.send(method, uid, ...args);
|
|
5614
5747
|
return;
|
|
@@ -5803,7 +5936,7 @@ const applyUidWorkaround = element => {
|
|
|
5803
5936
|
if (!editor) {
|
|
5804
5937
|
throw new Error('no editor found');
|
|
5805
5938
|
}
|
|
5806
|
-
const editorUid = get$
|
|
5939
|
+
const editorUid = get$8(editor);
|
|
5807
5940
|
set$8(element, editorUid);
|
|
5808
5941
|
};
|
|
5809
5942
|
|
|
@@ -7777,7 +7910,7 @@ const handleClickAction$1 = target => {
|
|
|
7777
7910
|
console.info('[panel] action command not found');
|
|
7778
7911
|
return;
|
|
7779
7912
|
}
|
|
7780
|
-
const childUid = get$
|
|
7913
|
+
const childUid = get$8(target);
|
|
7781
7914
|
handleClickAction$2(childUid, index, command);
|
|
7782
7915
|
};
|
|
7783
7916
|
const handleHeaderClick$1 = event => {
|
|
@@ -7903,7 +8036,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
|
|
|
7903
8036
|
const {
|
|
7904
8037
|
$PanelActions
|
|
7905
8038
|
} = state;
|
|
7906
|
-
const instance = get$
|
|
8039
|
+
const instance = get$a(childUid);
|
|
7907
8040
|
if (!instance) {
|
|
7908
8041
|
throw new Error(`child instance not found`);
|
|
7909
8042
|
}
|
|
@@ -8335,7 +8468,7 @@ const handleMouseDown$1 = event => {
|
|
|
8335
8468
|
if (!terminal) {
|
|
8336
8469
|
return;
|
|
8337
8470
|
}
|
|
8338
|
-
const terminalUid = get$
|
|
8471
|
+
const terminalUid = get$8(terminal);
|
|
8339
8472
|
if (!terminalUid) {
|
|
8340
8473
|
return;
|
|
8341
8474
|
}
|
|
@@ -8984,7 +9117,7 @@ const create$2 = (id, uid = id) => {
|
|
|
8984
9117
|
if (!module) {
|
|
8985
9118
|
throw new Error(`module not found: ${id}`);
|
|
8986
9119
|
}
|
|
8987
|
-
const existing = get$
|
|
9120
|
+
const existing = get$a(id);
|
|
8988
9121
|
if (existing?.state.$Viewlet.isConnected) {
|
|
8989
9122
|
existing.state.$Viewlet.remove();
|
|
8990
9123
|
}
|
|
@@ -9006,7 +9139,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
|
|
|
9006
9139
|
if (!module) {
|
|
9007
9140
|
throw new Error(`module not found: ${id}`);
|
|
9008
9141
|
}
|
|
9009
|
-
const existing = get$
|
|
9142
|
+
const existing = get$a(id);
|
|
9010
9143
|
if (existing?.state.$Viewlet.isConnected) {
|
|
9011
9144
|
existing.state.$Viewlet.remove();
|
|
9012
9145
|
}
|
|
@@ -9038,7 +9171,7 @@ const loadModule = async id => {
|
|
|
9038
9171
|
};
|
|
9039
9172
|
const invoke = (viewletId, method, ...args) => {
|
|
9040
9173
|
string(method);
|
|
9041
|
-
const instance = get$
|
|
9174
|
+
const instance = get$a(viewletId);
|
|
9042
9175
|
if (!instance?.factory) {
|
|
9043
9176
|
if (viewletId && method !== 'setActionsDom') {
|
|
9044
9177
|
warn$1(`cannot execute ${method} viewlet instance ${viewletId} not found`);
|
|
@@ -9056,7 +9189,7 @@ const focus$1 = viewletId => {
|
|
|
9056
9189
|
// eslint-disable-next-line no-console
|
|
9057
9190
|
console.trace(`focus ${viewletId}`);
|
|
9058
9191
|
}
|
|
9059
|
-
const instance = get$
|
|
9192
|
+
const instance = get$a(viewletId);
|
|
9060
9193
|
if (instance.factory?.setFocused) {
|
|
9061
9194
|
instance.factory.setFocused(instance.state, true);
|
|
9062
9195
|
} else if (instance?.factory?.focus) {
|
|
@@ -9072,7 +9205,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
9072
9205
|
// eslint-disable-next-line no-console
|
|
9073
9206
|
console.trace(`focusByName ${viewletId} ${name}`);
|
|
9074
9207
|
}
|
|
9075
|
-
const instance = get$
|
|
9208
|
+
const instance = get$a(viewletId);
|
|
9076
9209
|
if (!instance) {
|
|
9077
9210
|
return;
|
|
9078
9211
|
}
|
|
@@ -9087,7 +9220,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
9087
9220
|
};
|
|
9088
9221
|
const setElementProperty = (viewletId, name, key, value) => {
|
|
9089
9222
|
const selector = `[name="${name}"]`;
|
|
9090
|
-
const instance = get$
|
|
9223
|
+
const instance = get$a(viewletId);
|
|
9091
9224
|
if (!instance) {
|
|
9092
9225
|
return;
|
|
9093
9226
|
}
|
|
@@ -9116,7 +9249,7 @@ const setCheckboxValue = (viewletId, name, value) => {
|
|
|
9116
9249
|
};
|
|
9117
9250
|
const setSelectionByName = (viewletId, name, start, end) => {
|
|
9118
9251
|
const selector = `[name="${name}"]`;
|
|
9119
|
-
const instance = get$
|
|
9252
|
+
const instance = get$a(viewletId);
|
|
9120
9253
|
if (!instance) {
|
|
9121
9254
|
return;
|
|
9122
9255
|
}
|
|
@@ -9131,7 +9264,7 @@ const setSelectionByName = (viewletId, name, start, end) => {
|
|
|
9131
9264
|
$Element.selectionEnd = end;
|
|
9132
9265
|
};
|
|
9133
9266
|
const setUid = (viewletId, uid) => {
|
|
9134
|
-
const instance = get$
|
|
9267
|
+
const instance = get$a(viewletId);
|
|
9135
9268
|
if (!instance) {
|
|
9136
9269
|
return;
|
|
9137
9270
|
}
|
|
@@ -9149,7 +9282,7 @@ const resetFocusCallback = () => {
|
|
|
9149
9282
|
focusCallback.selector = '';
|
|
9150
9283
|
};
|
|
9151
9284
|
const focusSelector = (viewletId, selector) => {
|
|
9152
|
-
const instance = get$
|
|
9285
|
+
const instance = get$a(viewletId);
|
|
9153
9286
|
if (!instance) {
|
|
9154
9287
|
return;
|
|
9155
9288
|
}
|
|
@@ -9181,7 +9314,7 @@ const focusSelectorAfterRender = (viewletId, selector) => {
|
|
|
9181
9314
|
* @deprecated
|
|
9182
9315
|
*/
|
|
9183
9316
|
const refresh = (viewletId, viewletContext) => {
|
|
9184
|
-
const instance = get$
|
|
9317
|
+
const instance = get$a(viewletId);
|
|
9185
9318
|
if (instance) {
|
|
9186
9319
|
instance.factory.refresh(instance.state, viewletContext);
|
|
9187
9320
|
} else {
|
|
@@ -9200,7 +9333,7 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
|
|
|
9200
9333
|
if (isSpecial(viewletId)) {
|
|
9201
9334
|
$Placeholder.id = viewletId;
|
|
9202
9335
|
}
|
|
9203
|
-
const parentInstance = get$
|
|
9336
|
+
const parentInstance = get$a(parentId);
|
|
9204
9337
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9205
9338
|
$Parent.append($Placeholder);
|
|
9206
9339
|
set$a(viewletId, {
|
|
@@ -9216,7 +9349,7 @@ const getDragData = () => {
|
|
|
9216
9349
|
return getCurrent();
|
|
9217
9350
|
};
|
|
9218
9351
|
const setDom = (viewletId, dom) => {
|
|
9219
|
-
const instance = get$
|
|
9352
|
+
const instance = get$a(viewletId);
|
|
9220
9353
|
if (!instance) {
|
|
9221
9354
|
return;
|
|
9222
9355
|
}
|
|
@@ -9229,7 +9362,7 @@ const setDom = (viewletId, dom) => {
|
|
|
9229
9362
|
renderInto($Viewlet, dom, Events);
|
|
9230
9363
|
};
|
|
9231
9364
|
const setDom2 = (viewletId, dom) => {
|
|
9232
|
-
const instance = get$
|
|
9365
|
+
const instance = get$a(viewletId);
|
|
9233
9366
|
if (!instance) {
|
|
9234
9367
|
return;
|
|
9235
9368
|
}
|
|
@@ -9242,7 +9375,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9242
9375
|
let uid;
|
|
9243
9376
|
if ($Viewlet) {
|
|
9244
9377
|
try {
|
|
9245
|
-
uid = get$
|
|
9378
|
+
uid = get$8($Viewlet);
|
|
9246
9379
|
} catch {}
|
|
9247
9380
|
}
|
|
9248
9381
|
// TODO optimize rendering with virtual DOM diffing
|
|
@@ -9260,7 +9393,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9260
9393
|
});
|
|
9261
9394
|
};
|
|
9262
9395
|
const setPatches = (uid, patches) => {
|
|
9263
|
-
const instance = get$
|
|
9396
|
+
const instance = get$a(uid);
|
|
9264
9397
|
if (!instance) {
|
|
9265
9398
|
return;
|
|
9266
9399
|
}
|
|
@@ -9332,7 +9465,7 @@ const dispose$3 = id => {
|
|
|
9332
9465
|
try {
|
|
9333
9466
|
number(id);
|
|
9334
9467
|
unregisterView(id);
|
|
9335
|
-
const instance = get$
|
|
9468
|
+
const instance = get$a(id);
|
|
9336
9469
|
if (!instance) {
|
|
9337
9470
|
warn$1(`viewlet instance ${id} not found and cannot be disposed`);
|
|
9338
9471
|
return;
|
|
@@ -9351,7 +9484,7 @@ const dispose$3 = id => {
|
|
|
9351
9484
|
};
|
|
9352
9485
|
const handleError$1 = (id, parentId, message) => {
|
|
9353
9486
|
info(`[viewlet-error] ${id}: ${message}`);
|
|
9354
|
-
const instance = get$
|
|
9487
|
+
const instance = get$a(id);
|
|
9355
9488
|
if (instance?.state.$Viewlet.isConnected) {
|
|
9356
9489
|
instance.state.$Viewlet.remove();
|
|
9357
9490
|
}
|
|
@@ -9363,7 +9496,7 @@ const handleError$1 = (id, parentId, message) => {
|
|
|
9363
9496
|
instance.state.$Viewlet.textContent = String(message);
|
|
9364
9497
|
}
|
|
9365
9498
|
// TODO error should bubble up to until highest possible component
|
|
9366
|
-
const parentInstance = get$
|
|
9499
|
+
const parentInstance = get$a(parentId);
|
|
9367
9500
|
if (parentInstance?.factory?.handleError) {
|
|
9368
9501
|
parentInstance.factory.handleError(instance.state, message);
|
|
9369
9502
|
}
|
|
@@ -9377,9 +9510,9 @@ const appendViewlet = (parentId, childId, focus) => {
|
|
|
9377
9510
|
// TODO
|
|
9378
9511
|
return;
|
|
9379
9512
|
}
|
|
9380
|
-
const parentInstanceState = get$
|
|
9513
|
+
const parentInstanceState = get$a(parentId); // TODO must ensure that parent is already created
|
|
9381
9514
|
const parentModule = parentInstanceState.factory;
|
|
9382
|
-
const childInstance = get$
|
|
9515
|
+
const childInstance = get$a(childId);
|
|
9383
9516
|
if (!childInstance) {
|
|
9384
9517
|
throw new Error(`child instance ${childId} must be defined to be appended to parent ${parentId}`);
|
|
9385
9518
|
}
|
|
@@ -9403,7 +9536,7 @@ const prependChild = ($Parent, $Child) => {
|
|
|
9403
9536
|
const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
9404
9537
|
for (let i = childIndex - 1; i >= 0; i--) {
|
|
9405
9538
|
const beforeId = referenceNodes[i];
|
|
9406
|
-
const beforeInstance = get$
|
|
9539
|
+
const beforeInstance = get$a(beforeId);
|
|
9407
9540
|
if (beforeInstance) {
|
|
9408
9541
|
const $ReferenceNode = beforeInstance.state.$Viewlet;
|
|
9409
9542
|
$ReferenceNode.after($Child);
|
|
@@ -9415,7 +9548,7 @@ const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
|
9415
9548
|
const appendBeforeNextReference = (referenceNodes, childIndex, $Child) => {
|
|
9416
9549
|
for (let i = childIndex + 1; i < referenceNodes.length; i++) {
|
|
9417
9550
|
const afterId = referenceNodes[i];
|
|
9418
|
-
const afterInstance = get$
|
|
9551
|
+
const afterInstance = get$a(afterId);
|
|
9419
9552
|
if (afterInstance) {
|
|
9420
9553
|
const $ReferenceNode = afterInstance.state.$Viewlet;
|
|
9421
9554
|
$ReferenceNode.before($Child);
|
|
@@ -9445,12 +9578,12 @@ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
|
|
|
9445
9578
|
const append = (parentId, childId, referenceNodes) => {
|
|
9446
9579
|
number(parentId);
|
|
9447
9580
|
number(childId);
|
|
9448
|
-
const parentInstance = get$
|
|
9581
|
+
const parentInstance = get$a(parentId);
|
|
9449
9582
|
if (!parentInstance) {
|
|
9450
9583
|
throw new Error(`cannot append child: instance ${parentId} not found`);
|
|
9451
9584
|
}
|
|
9452
9585
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9453
|
-
const childInstance = get$
|
|
9586
|
+
const childInstance = get$a(childId);
|
|
9454
9587
|
if (!childInstance) {
|
|
9455
9588
|
throw new Error(`cannot append child: child instance not found ${childId}`);
|
|
9456
9589
|
}
|
|
@@ -9469,11 +9602,11 @@ const append = (parentId, childId, referenceNodes) => {
|
|
|
9469
9602
|
applyLateFocusMaybe();
|
|
9470
9603
|
};
|
|
9471
9604
|
const replaceChildren = (parentId, childIds) => {
|
|
9472
|
-
const parentInstance = get$
|
|
9605
|
+
const parentInstance = get$a(parentId);
|
|
9473
9606
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9474
9607
|
const $Fragment = document.createDocumentFragment();
|
|
9475
9608
|
for (const childId of childIds) {
|
|
9476
|
-
const childInstance = get$
|
|
9609
|
+
const childInstance = get$a(childId);
|
|
9477
9610
|
const $Child = childInstance.state.$Viewlet;
|
|
9478
9611
|
$Fragment.append($Child);
|
|
9479
9612
|
}
|
|
@@ -9488,7 +9621,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9488
9621
|
selector
|
|
9489
9622
|
} = focusCallback;
|
|
9490
9623
|
resetFocusCallback();
|
|
9491
|
-
const instance = get$
|
|
9624
|
+
const instance = get$a(id);
|
|
9492
9625
|
if (instance) {
|
|
9493
9626
|
const {
|
|
9494
9627
|
$Viewlet
|
|
@@ -9501,7 +9634,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9501
9634
|
};
|
|
9502
9635
|
const appendToBody = childId => {
|
|
9503
9636
|
const $Parent = document.body;
|
|
9504
|
-
const childInstance = get$
|
|
9637
|
+
const childInstance = get$a(childId);
|
|
9505
9638
|
const $Child = childInstance.state.$Viewlet;
|
|
9506
9639
|
$Parent.append($Child);
|
|
9507
9640
|
applyLateFocusMaybe();
|
|
@@ -9514,7 +9647,7 @@ const executeCommands = commands => {
|
|
|
9514
9647
|
}
|
|
9515
9648
|
};
|
|
9516
9649
|
const show = id => {
|
|
9517
|
-
const instance = get$
|
|
9650
|
+
const instance = get$a(id);
|
|
9518
9651
|
const $Viewlet = instance.state.$Viewlet;
|
|
9519
9652
|
const $Workbench = document.getElementById('Workbench');
|
|
9520
9653
|
// @ts-expect-error
|
|
@@ -9524,7 +9657,7 @@ const show = id => {
|
|
|
9524
9657
|
}
|
|
9525
9658
|
};
|
|
9526
9659
|
const setBounds$1 = (id, left, top, width, height) => {
|
|
9527
|
-
const instance = get$
|
|
9660
|
+
const instance = get$a(id);
|
|
9528
9661
|
if (!instance) {
|
|
9529
9662
|
return;
|
|
9530
9663
|
}
|
|
@@ -9532,7 +9665,7 @@ const setBounds$1 = (id, left, top, width, height) => {
|
|
|
9532
9665
|
setBounds$a($Viewlet, left, top, width, height);
|
|
9533
9666
|
};
|
|
9534
9667
|
const setProperty = (id, selector, property, value) => {
|
|
9535
|
-
const instance = get$
|
|
9668
|
+
const instance = get$a(id);
|
|
9536
9669
|
if (!instance) {
|
|
9537
9670
|
return;
|
|
9538
9671
|
}
|
|
@@ -9544,7 +9677,7 @@ const setProperty = (id, selector, property, value) => {
|
|
|
9544
9677
|
$Element[property] = value;
|
|
9545
9678
|
};
|
|
9546
9679
|
const renderCanvas = (id, selector, canvasClassName, width, height, rectangles, revision) => {
|
|
9547
|
-
const instance = get$
|
|
9680
|
+
const instance = get$a(id);
|
|
9548
9681
|
if (!instance) {
|
|
9549
9682
|
return;
|
|
9550
9683
|
}
|
|
@@ -9797,7 +9930,7 @@ const queryAudio = (uid, elementLocator) => {
|
|
|
9797
9930
|
// @ts-ignore
|
|
9798
9931
|
return remoteAudio;
|
|
9799
9932
|
}
|
|
9800
|
-
const $Viewlet = get$
|
|
9933
|
+
const $Viewlet = get$a(uid);
|
|
9801
9934
|
const remoteAudio = $Viewlet.querySelector(elementLocator);
|
|
9802
9935
|
if (!remoteAudio) {
|
|
9803
9936
|
console.error('[webrtc] audio element not found');
|
|
@@ -9974,6 +10107,7 @@ const commandMap = {
|
|
|
9974
10107
|
'DirectView.getFocusedUid': getFocusedViewUid,
|
|
9975
10108
|
'DirectView.getUid': getViewUid,
|
|
9976
10109
|
'Download.downloadFile': downloadFile,
|
|
10110
|
+
'DropData.get': get$6,
|
|
9977
10111
|
'FileHandles.get': get$5,
|
|
9978
10112
|
'FilePicker.showDirectoryPicker': showDirectoryPicker,
|
|
9979
10113
|
'FilePicker.showFilePicker': showFilePicker,
|