@lvce-editor/renderer-process 30.37.0 → 30.38.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.
|
@@ -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)
|
|
@@ -5608,7 +5739,7 @@ const ViewletActivityBar = {
|
|
|
5608
5739
|
const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
|
|
5609
5740
|
const send = (method, uid, ...args) => {
|
|
5610
5741
|
if (method === executeViewletCommand$1) {
|
|
5611
|
-
const rpc = get$
|
|
5742
|
+
const rpc = get$7(uid);
|
|
5612
5743
|
if (rpc) {
|
|
5613
5744
|
rpc.send(method, uid, ...args);
|
|
5614
5745
|
return;
|
|
@@ -5803,7 +5934,7 @@ const applyUidWorkaround = element => {
|
|
|
5803
5934
|
if (!editor) {
|
|
5804
5935
|
throw new Error('no editor found');
|
|
5805
5936
|
}
|
|
5806
|
-
const editorUid = get$
|
|
5937
|
+
const editorUid = get$8(editor);
|
|
5807
5938
|
set$8(element, editorUid);
|
|
5808
5939
|
};
|
|
5809
5940
|
|
|
@@ -7777,7 +7908,7 @@ const handleClickAction$1 = target => {
|
|
|
7777
7908
|
console.info('[panel] action command not found');
|
|
7778
7909
|
return;
|
|
7779
7910
|
}
|
|
7780
|
-
const childUid = get$
|
|
7911
|
+
const childUid = get$8(target);
|
|
7781
7912
|
handleClickAction$2(childUid, index, command);
|
|
7782
7913
|
};
|
|
7783
7914
|
const handleHeaderClick$1 = event => {
|
|
@@ -7903,7 +8034,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
|
|
|
7903
8034
|
const {
|
|
7904
8035
|
$PanelActions
|
|
7905
8036
|
} = state;
|
|
7906
|
-
const instance = get$
|
|
8037
|
+
const instance = get$a(childUid);
|
|
7907
8038
|
if (!instance) {
|
|
7908
8039
|
throw new Error(`child instance not found`);
|
|
7909
8040
|
}
|
|
@@ -8335,7 +8466,7 @@ const handleMouseDown$1 = event => {
|
|
|
8335
8466
|
if (!terminal) {
|
|
8336
8467
|
return;
|
|
8337
8468
|
}
|
|
8338
|
-
const terminalUid = get$
|
|
8469
|
+
const terminalUid = get$8(terminal);
|
|
8339
8470
|
if (!terminalUid) {
|
|
8340
8471
|
return;
|
|
8341
8472
|
}
|
|
@@ -8984,7 +9115,7 @@ const create$2 = (id, uid = id) => {
|
|
|
8984
9115
|
if (!module) {
|
|
8985
9116
|
throw new Error(`module not found: ${id}`);
|
|
8986
9117
|
}
|
|
8987
|
-
const existing = get$
|
|
9118
|
+
const existing = get$a(id);
|
|
8988
9119
|
if (existing?.state.$Viewlet.isConnected) {
|
|
8989
9120
|
existing.state.$Viewlet.remove();
|
|
8990
9121
|
}
|
|
@@ -9006,7 +9137,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
|
|
|
9006
9137
|
if (!module) {
|
|
9007
9138
|
throw new Error(`module not found: ${id}`);
|
|
9008
9139
|
}
|
|
9009
|
-
const existing = get$
|
|
9140
|
+
const existing = get$a(id);
|
|
9010
9141
|
if (existing?.state.$Viewlet.isConnected) {
|
|
9011
9142
|
existing.state.$Viewlet.remove();
|
|
9012
9143
|
}
|
|
@@ -9038,7 +9169,7 @@ const loadModule = async id => {
|
|
|
9038
9169
|
};
|
|
9039
9170
|
const invoke = (viewletId, method, ...args) => {
|
|
9040
9171
|
string(method);
|
|
9041
|
-
const instance = get$
|
|
9172
|
+
const instance = get$a(viewletId);
|
|
9042
9173
|
if (!instance?.factory) {
|
|
9043
9174
|
if (viewletId && method !== 'setActionsDom') {
|
|
9044
9175
|
warn$1(`cannot execute ${method} viewlet instance ${viewletId} not found`);
|
|
@@ -9056,7 +9187,7 @@ const focus$1 = viewletId => {
|
|
|
9056
9187
|
// eslint-disable-next-line no-console
|
|
9057
9188
|
console.trace(`focus ${viewletId}`);
|
|
9058
9189
|
}
|
|
9059
|
-
const instance = get$
|
|
9190
|
+
const instance = get$a(viewletId);
|
|
9060
9191
|
if (instance.factory?.setFocused) {
|
|
9061
9192
|
instance.factory.setFocused(instance.state, true);
|
|
9062
9193
|
} else if (instance?.factory?.focus) {
|
|
@@ -9072,7 +9203,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
9072
9203
|
// eslint-disable-next-line no-console
|
|
9073
9204
|
console.trace(`focusByName ${viewletId} ${name}`);
|
|
9074
9205
|
}
|
|
9075
|
-
const instance = get$
|
|
9206
|
+
const instance = get$a(viewletId);
|
|
9076
9207
|
if (!instance) {
|
|
9077
9208
|
return;
|
|
9078
9209
|
}
|
|
@@ -9087,7 +9218,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
9087
9218
|
};
|
|
9088
9219
|
const setElementProperty = (viewletId, name, key, value) => {
|
|
9089
9220
|
const selector = `[name="${name}"]`;
|
|
9090
|
-
const instance = get$
|
|
9221
|
+
const instance = get$a(viewletId);
|
|
9091
9222
|
if (!instance) {
|
|
9092
9223
|
return;
|
|
9093
9224
|
}
|
|
@@ -9116,7 +9247,7 @@ const setCheckboxValue = (viewletId, name, value) => {
|
|
|
9116
9247
|
};
|
|
9117
9248
|
const setSelectionByName = (viewletId, name, start, end) => {
|
|
9118
9249
|
const selector = `[name="${name}"]`;
|
|
9119
|
-
const instance = get$
|
|
9250
|
+
const instance = get$a(viewletId);
|
|
9120
9251
|
if (!instance) {
|
|
9121
9252
|
return;
|
|
9122
9253
|
}
|
|
@@ -9131,7 +9262,7 @@ const setSelectionByName = (viewletId, name, start, end) => {
|
|
|
9131
9262
|
$Element.selectionEnd = end;
|
|
9132
9263
|
};
|
|
9133
9264
|
const setUid = (viewletId, uid) => {
|
|
9134
|
-
const instance = get$
|
|
9265
|
+
const instance = get$a(viewletId);
|
|
9135
9266
|
if (!instance) {
|
|
9136
9267
|
return;
|
|
9137
9268
|
}
|
|
@@ -9149,7 +9280,7 @@ const resetFocusCallback = () => {
|
|
|
9149
9280
|
focusCallback.selector = '';
|
|
9150
9281
|
};
|
|
9151
9282
|
const focusSelector = (viewletId, selector) => {
|
|
9152
|
-
const instance = get$
|
|
9283
|
+
const instance = get$a(viewletId);
|
|
9153
9284
|
if (!instance) {
|
|
9154
9285
|
return;
|
|
9155
9286
|
}
|
|
@@ -9181,7 +9312,7 @@ const focusSelectorAfterRender = (viewletId, selector) => {
|
|
|
9181
9312
|
* @deprecated
|
|
9182
9313
|
*/
|
|
9183
9314
|
const refresh = (viewletId, viewletContext) => {
|
|
9184
|
-
const instance = get$
|
|
9315
|
+
const instance = get$a(viewletId);
|
|
9185
9316
|
if (instance) {
|
|
9186
9317
|
instance.factory.refresh(instance.state, viewletContext);
|
|
9187
9318
|
} else {
|
|
@@ -9200,7 +9331,7 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
|
|
|
9200
9331
|
if (isSpecial(viewletId)) {
|
|
9201
9332
|
$Placeholder.id = viewletId;
|
|
9202
9333
|
}
|
|
9203
|
-
const parentInstance = get$
|
|
9334
|
+
const parentInstance = get$a(parentId);
|
|
9204
9335
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9205
9336
|
$Parent.append($Placeholder);
|
|
9206
9337
|
set$a(viewletId, {
|
|
@@ -9216,7 +9347,7 @@ const getDragData = () => {
|
|
|
9216
9347
|
return getCurrent();
|
|
9217
9348
|
};
|
|
9218
9349
|
const setDom = (viewletId, dom) => {
|
|
9219
|
-
const instance = get$
|
|
9350
|
+
const instance = get$a(viewletId);
|
|
9220
9351
|
if (!instance) {
|
|
9221
9352
|
return;
|
|
9222
9353
|
}
|
|
@@ -9229,7 +9360,7 @@ const setDom = (viewletId, dom) => {
|
|
|
9229
9360
|
renderInto($Viewlet, dom, Events);
|
|
9230
9361
|
};
|
|
9231
9362
|
const setDom2 = (viewletId, dom) => {
|
|
9232
|
-
const instance = get$
|
|
9363
|
+
const instance = get$a(viewletId);
|
|
9233
9364
|
if (!instance) {
|
|
9234
9365
|
return;
|
|
9235
9366
|
}
|
|
@@ -9242,7 +9373,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9242
9373
|
let uid;
|
|
9243
9374
|
if ($Viewlet) {
|
|
9244
9375
|
try {
|
|
9245
|
-
uid = get$
|
|
9376
|
+
uid = get$8($Viewlet);
|
|
9246
9377
|
} catch {}
|
|
9247
9378
|
}
|
|
9248
9379
|
// TODO optimize rendering with virtual DOM diffing
|
|
@@ -9260,7 +9391,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9260
9391
|
});
|
|
9261
9392
|
};
|
|
9262
9393
|
const setPatches = (uid, patches) => {
|
|
9263
|
-
const instance = get$
|
|
9394
|
+
const instance = get$a(uid);
|
|
9264
9395
|
if (!instance) {
|
|
9265
9396
|
return;
|
|
9266
9397
|
}
|
|
@@ -9332,7 +9463,7 @@ const dispose$3 = id => {
|
|
|
9332
9463
|
try {
|
|
9333
9464
|
number(id);
|
|
9334
9465
|
unregisterView(id);
|
|
9335
|
-
const instance = get$
|
|
9466
|
+
const instance = get$a(id);
|
|
9336
9467
|
if (!instance) {
|
|
9337
9468
|
warn$1(`viewlet instance ${id} not found and cannot be disposed`);
|
|
9338
9469
|
return;
|
|
@@ -9351,7 +9482,7 @@ const dispose$3 = id => {
|
|
|
9351
9482
|
};
|
|
9352
9483
|
const handleError$1 = (id, parentId, message) => {
|
|
9353
9484
|
info(`[viewlet-error] ${id}: ${message}`);
|
|
9354
|
-
const instance = get$
|
|
9485
|
+
const instance = get$a(id);
|
|
9355
9486
|
if (instance?.state.$Viewlet.isConnected) {
|
|
9356
9487
|
instance.state.$Viewlet.remove();
|
|
9357
9488
|
}
|
|
@@ -9363,7 +9494,7 @@ const handleError$1 = (id, parentId, message) => {
|
|
|
9363
9494
|
instance.state.$Viewlet.textContent = String(message);
|
|
9364
9495
|
}
|
|
9365
9496
|
// TODO error should bubble up to until highest possible component
|
|
9366
|
-
const parentInstance = get$
|
|
9497
|
+
const parentInstance = get$a(parentId);
|
|
9367
9498
|
if (parentInstance?.factory?.handleError) {
|
|
9368
9499
|
parentInstance.factory.handleError(instance.state, message);
|
|
9369
9500
|
}
|
|
@@ -9377,9 +9508,9 @@ const appendViewlet = (parentId, childId, focus) => {
|
|
|
9377
9508
|
// TODO
|
|
9378
9509
|
return;
|
|
9379
9510
|
}
|
|
9380
|
-
const parentInstanceState = get$
|
|
9511
|
+
const parentInstanceState = get$a(parentId); // TODO must ensure that parent is already created
|
|
9381
9512
|
const parentModule = parentInstanceState.factory;
|
|
9382
|
-
const childInstance = get$
|
|
9513
|
+
const childInstance = get$a(childId);
|
|
9383
9514
|
if (!childInstance) {
|
|
9384
9515
|
throw new Error(`child instance ${childId} must be defined to be appended to parent ${parentId}`);
|
|
9385
9516
|
}
|
|
@@ -9403,7 +9534,7 @@ const prependChild = ($Parent, $Child) => {
|
|
|
9403
9534
|
const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
9404
9535
|
for (let i = childIndex - 1; i >= 0; i--) {
|
|
9405
9536
|
const beforeId = referenceNodes[i];
|
|
9406
|
-
const beforeInstance = get$
|
|
9537
|
+
const beforeInstance = get$a(beforeId);
|
|
9407
9538
|
if (beforeInstance) {
|
|
9408
9539
|
const $ReferenceNode = beforeInstance.state.$Viewlet;
|
|
9409
9540
|
$ReferenceNode.after($Child);
|
|
@@ -9415,7 +9546,7 @@ const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
|
9415
9546
|
const appendBeforeNextReference = (referenceNodes, childIndex, $Child) => {
|
|
9416
9547
|
for (let i = childIndex + 1; i < referenceNodes.length; i++) {
|
|
9417
9548
|
const afterId = referenceNodes[i];
|
|
9418
|
-
const afterInstance = get$
|
|
9549
|
+
const afterInstance = get$a(afterId);
|
|
9419
9550
|
if (afterInstance) {
|
|
9420
9551
|
const $ReferenceNode = afterInstance.state.$Viewlet;
|
|
9421
9552
|
$ReferenceNode.before($Child);
|
|
@@ -9445,12 +9576,12 @@ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
|
|
|
9445
9576
|
const append = (parentId, childId, referenceNodes) => {
|
|
9446
9577
|
number(parentId);
|
|
9447
9578
|
number(childId);
|
|
9448
|
-
const parentInstance = get$
|
|
9579
|
+
const parentInstance = get$a(parentId);
|
|
9449
9580
|
if (!parentInstance) {
|
|
9450
9581
|
throw new Error(`cannot append child: instance ${parentId} not found`);
|
|
9451
9582
|
}
|
|
9452
9583
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9453
|
-
const childInstance = get$
|
|
9584
|
+
const childInstance = get$a(childId);
|
|
9454
9585
|
if (!childInstance) {
|
|
9455
9586
|
throw new Error(`cannot append child: child instance not found ${childId}`);
|
|
9456
9587
|
}
|
|
@@ -9469,11 +9600,11 @@ const append = (parentId, childId, referenceNodes) => {
|
|
|
9469
9600
|
applyLateFocusMaybe();
|
|
9470
9601
|
};
|
|
9471
9602
|
const replaceChildren = (parentId, childIds) => {
|
|
9472
|
-
const parentInstance = get$
|
|
9603
|
+
const parentInstance = get$a(parentId);
|
|
9473
9604
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9474
9605
|
const $Fragment = document.createDocumentFragment();
|
|
9475
9606
|
for (const childId of childIds) {
|
|
9476
|
-
const childInstance = get$
|
|
9607
|
+
const childInstance = get$a(childId);
|
|
9477
9608
|
const $Child = childInstance.state.$Viewlet;
|
|
9478
9609
|
$Fragment.append($Child);
|
|
9479
9610
|
}
|
|
@@ -9488,7 +9619,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9488
9619
|
selector
|
|
9489
9620
|
} = focusCallback;
|
|
9490
9621
|
resetFocusCallback();
|
|
9491
|
-
const instance = get$
|
|
9622
|
+
const instance = get$a(id);
|
|
9492
9623
|
if (instance) {
|
|
9493
9624
|
const {
|
|
9494
9625
|
$Viewlet
|
|
@@ -9501,7 +9632,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9501
9632
|
};
|
|
9502
9633
|
const appendToBody = childId => {
|
|
9503
9634
|
const $Parent = document.body;
|
|
9504
|
-
const childInstance = get$
|
|
9635
|
+
const childInstance = get$a(childId);
|
|
9505
9636
|
const $Child = childInstance.state.$Viewlet;
|
|
9506
9637
|
$Parent.append($Child);
|
|
9507
9638
|
applyLateFocusMaybe();
|
|
@@ -9514,7 +9645,7 @@ const executeCommands = commands => {
|
|
|
9514
9645
|
}
|
|
9515
9646
|
};
|
|
9516
9647
|
const show = id => {
|
|
9517
|
-
const instance = get$
|
|
9648
|
+
const instance = get$a(id);
|
|
9518
9649
|
const $Viewlet = instance.state.$Viewlet;
|
|
9519
9650
|
const $Workbench = document.getElementById('Workbench');
|
|
9520
9651
|
// @ts-expect-error
|
|
@@ -9524,7 +9655,7 @@ const show = id => {
|
|
|
9524
9655
|
}
|
|
9525
9656
|
};
|
|
9526
9657
|
const setBounds$1 = (id, left, top, width, height) => {
|
|
9527
|
-
const instance = get$
|
|
9658
|
+
const instance = get$a(id);
|
|
9528
9659
|
if (!instance) {
|
|
9529
9660
|
return;
|
|
9530
9661
|
}
|
|
@@ -9532,7 +9663,7 @@ const setBounds$1 = (id, left, top, width, height) => {
|
|
|
9532
9663
|
setBounds$a($Viewlet, left, top, width, height);
|
|
9533
9664
|
};
|
|
9534
9665
|
const setProperty = (id, selector, property, value) => {
|
|
9535
|
-
const instance = get$
|
|
9666
|
+
const instance = get$a(id);
|
|
9536
9667
|
if (!instance) {
|
|
9537
9668
|
return;
|
|
9538
9669
|
}
|
|
@@ -9544,7 +9675,7 @@ const setProperty = (id, selector, property, value) => {
|
|
|
9544
9675
|
$Element[property] = value;
|
|
9545
9676
|
};
|
|
9546
9677
|
const renderCanvas = (id, selector, canvasClassName, width, height, rectangles, revision) => {
|
|
9547
|
-
const instance = get$
|
|
9678
|
+
const instance = get$a(id);
|
|
9548
9679
|
if (!instance) {
|
|
9549
9680
|
return;
|
|
9550
9681
|
}
|
|
@@ -9797,7 +9928,7 @@ const queryAudio = (uid, elementLocator) => {
|
|
|
9797
9928
|
// @ts-ignore
|
|
9798
9929
|
return remoteAudio;
|
|
9799
9930
|
}
|
|
9800
|
-
const $Viewlet = get$
|
|
9931
|
+
const $Viewlet = get$a(uid);
|
|
9801
9932
|
const remoteAudio = $Viewlet.querySelector(elementLocator);
|
|
9802
9933
|
if (!remoteAudio) {
|
|
9803
9934
|
console.error('[webrtc] audio element not found');
|
|
@@ -9974,6 +10105,7 @@ const commandMap = {
|
|
|
9974
10105
|
'DirectView.getFocusedUid': getFocusedViewUid,
|
|
9975
10106
|
'DirectView.getUid': getViewUid,
|
|
9976
10107
|
'Download.downloadFile': downloadFile,
|
|
10108
|
+
'DropData.get': get$6,
|
|
9977
10109
|
'FileHandles.get': get$5,
|
|
9978
10110
|
'FilePicker.showDirectoryPicker': showDirectoryPicker,
|
|
9979
10111
|
'FilePicker.showFilePicker': showFilePicker,
|