@lvce-editor/renderer-process 30.36.2 → 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)
|
|
@@ -5416,6 +5547,62 @@ const take = (uid, transactionId) => {
|
|
|
5416
5547
|
|
|
5417
5548
|
const rememberFocus = rememberFocus$1;
|
|
5418
5549
|
|
|
5550
|
+
const getColor = ($Parent, className) => {
|
|
5551
|
+
const $Probe = document.createElement('span');
|
|
5552
|
+
$Probe.className = className;
|
|
5553
|
+
$Probe.hidden = true;
|
|
5554
|
+
$Parent.append($Probe);
|
|
5555
|
+
const color = getComputedStyle($Probe).color;
|
|
5556
|
+
$Probe.remove();
|
|
5557
|
+
return color;
|
|
5558
|
+
};
|
|
5559
|
+
const getColors = ($Parent, rectangles) => {
|
|
5560
|
+
const colors = new Map();
|
|
5561
|
+
for (const rectangle of rectangles) {
|
|
5562
|
+
if (!colors.has(rectangle.className)) {
|
|
5563
|
+
colors.set(rectangle.className, getColor($Parent, rectangle.className));
|
|
5564
|
+
}
|
|
5565
|
+
}
|
|
5566
|
+
return colors;
|
|
5567
|
+
};
|
|
5568
|
+
const getOrCreateCanvas = ($Parent, className) => {
|
|
5569
|
+
const existing = $Parent.querySelector(`:scope > canvas.${className}`);
|
|
5570
|
+
if (existing) {
|
|
5571
|
+
return existing;
|
|
5572
|
+
}
|
|
5573
|
+
const $Canvas = document.createElement('canvas');
|
|
5574
|
+
$Canvas.className = className;
|
|
5575
|
+
$Canvas.ariaHidden = 'true';
|
|
5576
|
+
$Parent.append($Canvas);
|
|
5577
|
+
return $Canvas;
|
|
5578
|
+
};
|
|
5579
|
+
const renderCanvas$1 = ($Viewlet, selector, canvasClassName, width, height, rectangles, revision) => {
|
|
5580
|
+
const $Parent = $Viewlet.matches(selector) ? $Viewlet : $Viewlet.querySelector(selector);
|
|
5581
|
+
if (!$Parent) {
|
|
5582
|
+
return;
|
|
5583
|
+
}
|
|
5584
|
+
const $Canvas = getOrCreateCanvas($Parent, canvasClassName);
|
|
5585
|
+
const devicePixelRatio = globalThis.devicePixelRatio || 1;
|
|
5586
|
+
$Canvas.width = Math.round(width * devicePixelRatio);
|
|
5587
|
+
$Canvas.height = Math.round(height * devicePixelRatio);
|
|
5588
|
+
$Canvas.style.width = `${width}px`;
|
|
5589
|
+
$Canvas.style.height = `${height}px`;
|
|
5590
|
+
$Canvas.dataset.renderRevision = revision;
|
|
5591
|
+
$Canvas.dataset.rectangleCount = String(rectangles.length);
|
|
5592
|
+
const context = $Canvas.getContext('2d');
|
|
5593
|
+
if (!context) {
|
|
5594
|
+
return;
|
|
5595
|
+
}
|
|
5596
|
+
context.resetTransform();
|
|
5597
|
+
context.clearRect(0, 0, $Canvas.width, $Canvas.height);
|
|
5598
|
+
context.scale(devicePixelRatio, devicePixelRatio);
|
|
5599
|
+
const colors = getColors($Parent, rectangles);
|
|
5600
|
+
for (const rectangle of rectangles) {
|
|
5601
|
+
context.fillStyle = colors.get(rectangle.className) || 'currentColor';
|
|
5602
|
+
context.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
|
|
5603
|
+
}
|
|
5604
|
+
};
|
|
5605
|
+
|
|
5419
5606
|
const handleImageLoad = event => {
|
|
5420
5607
|
const $ImagePreviewImage = event.target;
|
|
5421
5608
|
const $ImagePreviewCaption = $ImagePreviewImage.nextSibling;
|
|
@@ -5552,7 +5739,7 @@ const ViewletActivityBar = {
|
|
|
5552
5739
|
const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
|
|
5553
5740
|
const send = (method, uid, ...args) => {
|
|
5554
5741
|
if (method === executeViewletCommand$1) {
|
|
5555
|
-
const rpc = get$
|
|
5742
|
+
const rpc = get$7(uid);
|
|
5556
5743
|
if (rpc) {
|
|
5557
5744
|
rpc.send(method, uid, ...args);
|
|
5558
5745
|
return;
|
|
@@ -5747,7 +5934,7 @@ const applyUidWorkaround = element => {
|
|
|
5747
5934
|
if (!editor) {
|
|
5748
5935
|
throw new Error('no editor found');
|
|
5749
5936
|
}
|
|
5750
|
-
const editorUid = get$
|
|
5937
|
+
const editorUid = get$8(editor);
|
|
5751
5938
|
set$8(element, editorUid);
|
|
5752
5939
|
};
|
|
5753
5940
|
|
|
@@ -7721,7 +7908,7 @@ const handleClickAction$1 = target => {
|
|
|
7721
7908
|
console.info('[panel] action command not found');
|
|
7722
7909
|
return;
|
|
7723
7910
|
}
|
|
7724
|
-
const childUid = get$
|
|
7911
|
+
const childUid = get$8(target);
|
|
7725
7912
|
handleClickAction$2(childUid, index, command);
|
|
7726
7913
|
};
|
|
7727
7914
|
const handleHeaderClick$1 = event => {
|
|
@@ -7847,7 +8034,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
|
|
|
7847
8034
|
const {
|
|
7848
8035
|
$PanelActions
|
|
7849
8036
|
} = state;
|
|
7850
|
-
const instance = get$
|
|
8037
|
+
const instance = get$a(childUid);
|
|
7851
8038
|
if (!instance) {
|
|
7852
8039
|
throw new Error(`child instance not found`);
|
|
7853
8040
|
}
|
|
@@ -8279,7 +8466,7 @@ const handleMouseDown$1 = event => {
|
|
|
8279
8466
|
if (!terminal) {
|
|
8280
8467
|
return;
|
|
8281
8468
|
}
|
|
8282
|
-
const terminalUid = get$
|
|
8469
|
+
const terminalUid = get$8(terminal);
|
|
8283
8470
|
if (!terminalUid) {
|
|
8284
8471
|
return;
|
|
8285
8472
|
}
|
|
@@ -8928,7 +9115,7 @@ const create$2 = (id, uid = id) => {
|
|
|
8928
9115
|
if (!module) {
|
|
8929
9116
|
throw new Error(`module not found: ${id}`);
|
|
8930
9117
|
}
|
|
8931
|
-
const existing = get$
|
|
9118
|
+
const existing = get$a(id);
|
|
8932
9119
|
if (existing?.state.$Viewlet.isConnected) {
|
|
8933
9120
|
existing.state.$Viewlet.remove();
|
|
8934
9121
|
}
|
|
@@ -8950,7 +9137,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
|
|
|
8950
9137
|
if (!module) {
|
|
8951
9138
|
throw new Error(`module not found: ${id}`);
|
|
8952
9139
|
}
|
|
8953
|
-
const existing = get$
|
|
9140
|
+
const existing = get$a(id);
|
|
8954
9141
|
if (existing?.state.$Viewlet.isConnected) {
|
|
8955
9142
|
existing.state.$Viewlet.remove();
|
|
8956
9143
|
}
|
|
@@ -8982,7 +9169,7 @@ const loadModule = async id => {
|
|
|
8982
9169
|
};
|
|
8983
9170
|
const invoke = (viewletId, method, ...args) => {
|
|
8984
9171
|
string(method);
|
|
8985
|
-
const instance = get$
|
|
9172
|
+
const instance = get$a(viewletId);
|
|
8986
9173
|
if (!instance?.factory) {
|
|
8987
9174
|
if (viewletId && method !== 'setActionsDom') {
|
|
8988
9175
|
warn$1(`cannot execute ${method} viewlet instance ${viewletId} not found`);
|
|
@@ -9000,7 +9187,7 @@ const focus$1 = viewletId => {
|
|
|
9000
9187
|
// eslint-disable-next-line no-console
|
|
9001
9188
|
console.trace(`focus ${viewletId}`);
|
|
9002
9189
|
}
|
|
9003
|
-
const instance = get$
|
|
9190
|
+
const instance = get$a(viewletId);
|
|
9004
9191
|
if (instance.factory?.setFocused) {
|
|
9005
9192
|
instance.factory.setFocused(instance.state, true);
|
|
9006
9193
|
} else if (instance?.factory?.focus) {
|
|
@@ -9016,7 +9203,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
9016
9203
|
// eslint-disable-next-line no-console
|
|
9017
9204
|
console.trace(`focusByName ${viewletId} ${name}`);
|
|
9018
9205
|
}
|
|
9019
|
-
const instance = get$
|
|
9206
|
+
const instance = get$a(viewletId);
|
|
9020
9207
|
if (!instance) {
|
|
9021
9208
|
return;
|
|
9022
9209
|
}
|
|
@@ -9031,7 +9218,7 @@ const focusElementByName = (viewletId, name) => {
|
|
|
9031
9218
|
};
|
|
9032
9219
|
const setElementProperty = (viewletId, name, key, value) => {
|
|
9033
9220
|
const selector = `[name="${name}"]`;
|
|
9034
|
-
const instance = get$
|
|
9221
|
+
const instance = get$a(viewletId);
|
|
9035
9222
|
if (!instance) {
|
|
9036
9223
|
return;
|
|
9037
9224
|
}
|
|
@@ -9060,7 +9247,7 @@ const setCheckboxValue = (viewletId, name, value) => {
|
|
|
9060
9247
|
};
|
|
9061
9248
|
const setSelectionByName = (viewletId, name, start, end) => {
|
|
9062
9249
|
const selector = `[name="${name}"]`;
|
|
9063
|
-
const instance = get$
|
|
9250
|
+
const instance = get$a(viewletId);
|
|
9064
9251
|
if (!instance) {
|
|
9065
9252
|
return;
|
|
9066
9253
|
}
|
|
@@ -9075,7 +9262,7 @@ const setSelectionByName = (viewletId, name, start, end) => {
|
|
|
9075
9262
|
$Element.selectionEnd = end;
|
|
9076
9263
|
};
|
|
9077
9264
|
const setUid = (viewletId, uid) => {
|
|
9078
|
-
const instance = get$
|
|
9265
|
+
const instance = get$a(viewletId);
|
|
9079
9266
|
if (!instance) {
|
|
9080
9267
|
return;
|
|
9081
9268
|
}
|
|
@@ -9093,7 +9280,7 @@ const resetFocusCallback = () => {
|
|
|
9093
9280
|
focusCallback.selector = '';
|
|
9094
9281
|
};
|
|
9095
9282
|
const focusSelector = (viewletId, selector) => {
|
|
9096
|
-
const instance = get$
|
|
9283
|
+
const instance = get$a(viewletId);
|
|
9097
9284
|
if (!instance) {
|
|
9098
9285
|
return;
|
|
9099
9286
|
}
|
|
@@ -9125,7 +9312,7 @@ const focusSelectorAfterRender = (viewletId, selector) => {
|
|
|
9125
9312
|
* @deprecated
|
|
9126
9313
|
*/
|
|
9127
9314
|
const refresh = (viewletId, viewletContext) => {
|
|
9128
|
-
const instance = get$
|
|
9315
|
+
const instance = get$a(viewletId);
|
|
9129
9316
|
if (instance) {
|
|
9130
9317
|
instance.factory.refresh(instance.state, viewletContext);
|
|
9131
9318
|
} else {
|
|
@@ -9144,7 +9331,7 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
|
|
|
9144
9331
|
if (isSpecial(viewletId)) {
|
|
9145
9332
|
$Placeholder.id = viewletId;
|
|
9146
9333
|
}
|
|
9147
|
-
const parentInstance = get$
|
|
9334
|
+
const parentInstance = get$a(parentId);
|
|
9148
9335
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9149
9336
|
$Parent.append($Placeholder);
|
|
9150
9337
|
set$a(viewletId, {
|
|
@@ -9160,7 +9347,7 @@ const getDragData = () => {
|
|
|
9160
9347
|
return getCurrent();
|
|
9161
9348
|
};
|
|
9162
9349
|
const setDom = (viewletId, dom) => {
|
|
9163
|
-
const instance = get$
|
|
9350
|
+
const instance = get$a(viewletId);
|
|
9164
9351
|
if (!instance) {
|
|
9165
9352
|
return;
|
|
9166
9353
|
}
|
|
@@ -9173,7 +9360,7 @@ const setDom = (viewletId, dom) => {
|
|
|
9173
9360
|
renderInto($Viewlet, dom, Events);
|
|
9174
9361
|
};
|
|
9175
9362
|
const setDom2 = (viewletId, dom) => {
|
|
9176
|
-
const instance = get$
|
|
9363
|
+
const instance = get$a(viewletId);
|
|
9177
9364
|
if (!instance) {
|
|
9178
9365
|
return;
|
|
9179
9366
|
}
|
|
@@ -9186,7 +9373,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9186
9373
|
let uid;
|
|
9187
9374
|
if ($Viewlet) {
|
|
9188
9375
|
try {
|
|
9189
|
-
uid = get$
|
|
9376
|
+
uid = get$8($Viewlet);
|
|
9190
9377
|
} catch {}
|
|
9191
9378
|
}
|
|
9192
9379
|
// TODO optimize rendering with virtual DOM diffing
|
|
@@ -9204,7 +9391,7 @@ const setDom2 = (viewletId, dom) => {
|
|
|
9204
9391
|
});
|
|
9205
9392
|
};
|
|
9206
9393
|
const setPatches = (uid, patches) => {
|
|
9207
|
-
const instance = get$
|
|
9394
|
+
const instance = get$a(uid);
|
|
9208
9395
|
if (!instance) {
|
|
9209
9396
|
return;
|
|
9210
9397
|
}
|
|
@@ -9276,7 +9463,7 @@ const dispose$3 = id => {
|
|
|
9276
9463
|
try {
|
|
9277
9464
|
number(id);
|
|
9278
9465
|
unregisterView(id);
|
|
9279
|
-
const instance = get$
|
|
9466
|
+
const instance = get$a(id);
|
|
9280
9467
|
if (!instance) {
|
|
9281
9468
|
warn$1(`viewlet instance ${id} not found and cannot be disposed`);
|
|
9282
9469
|
return;
|
|
@@ -9295,7 +9482,7 @@ const dispose$3 = id => {
|
|
|
9295
9482
|
};
|
|
9296
9483
|
const handleError$1 = (id, parentId, message) => {
|
|
9297
9484
|
info(`[viewlet-error] ${id}: ${message}`);
|
|
9298
|
-
const instance = get$
|
|
9485
|
+
const instance = get$a(id);
|
|
9299
9486
|
if (instance?.state.$Viewlet.isConnected) {
|
|
9300
9487
|
instance.state.$Viewlet.remove();
|
|
9301
9488
|
}
|
|
@@ -9307,7 +9494,7 @@ const handleError$1 = (id, parentId, message) => {
|
|
|
9307
9494
|
instance.state.$Viewlet.textContent = String(message);
|
|
9308
9495
|
}
|
|
9309
9496
|
// TODO error should bubble up to until highest possible component
|
|
9310
|
-
const parentInstance = get$
|
|
9497
|
+
const parentInstance = get$a(parentId);
|
|
9311
9498
|
if (parentInstance?.factory?.handleError) {
|
|
9312
9499
|
parentInstance.factory.handleError(instance.state, message);
|
|
9313
9500
|
}
|
|
@@ -9321,9 +9508,9 @@ const appendViewlet = (parentId, childId, focus) => {
|
|
|
9321
9508
|
// TODO
|
|
9322
9509
|
return;
|
|
9323
9510
|
}
|
|
9324
|
-
const parentInstanceState = get$
|
|
9511
|
+
const parentInstanceState = get$a(parentId); // TODO must ensure that parent is already created
|
|
9325
9512
|
const parentModule = parentInstanceState.factory;
|
|
9326
|
-
const childInstance = get$
|
|
9513
|
+
const childInstance = get$a(childId);
|
|
9327
9514
|
if (!childInstance) {
|
|
9328
9515
|
throw new Error(`child instance ${childId} must be defined to be appended to parent ${parentId}`);
|
|
9329
9516
|
}
|
|
@@ -9347,7 +9534,7 @@ const prependChild = ($Parent, $Child) => {
|
|
|
9347
9534
|
const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
9348
9535
|
for (let i = childIndex - 1; i >= 0; i--) {
|
|
9349
9536
|
const beforeId = referenceNodes[i];
|
|
9350
|
-
const beforeInstance = get$
|
|
9537
|
+
const beforeInstance = get$a(beforeId);
|
|
9351
9538
|
if (beforeInstance) {
|
|
9352
9539
|
const $ReferenceNode = beforeInstance.state.$Viewlet;
|
|
9353
9540
|
$ReferenceNode.after($Child);
|
|
@@ -9359,7 +9546,7 @@ const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
|
|
|
9359
9546
|
const appendBeforeNextReference = (referenceNodes, childIndex, $Child) => {
|
|
9360
9547
|
for (let i = childIndex + 1; i < referenceNodes.length; i++) {
|
|
9361
9548
|
const afterId = referenceNodes[i];
|
|
9362
|
-
const afterInstance = get$
|
|
9549
|
+
const afterInstance = get$a(afterId);
|
|
9363
9550
|
if (afterInstance) {
|
|
9364
9551
|
const $ReferenceNode = afterInstance.state.$Viewlet;
|
|
9365
9552
|
$ReferenceNode.before($Child);
|
|
@@ -9389,12 +9576,12 @@ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
|
|
|
9389
9576
|
const append = (parentId, childId, referenceNodes) => {
|
|
9390
9577
|
number(parentId);
|
|
9391
9578
|
number(childId);
|
|
9392
|
-
const parentInstance = get$
|
|
9579
|
+
const parentInstance = get$a(parentId);
|
|
9393
9580
|
if (!parentInstance) {
|
|
9394
9581
|
throw new Error(`cannot append child: instance ${parentId} not found`);
|
|
9395
9582
|
}
|
|
9396
9583
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9397
|
-
const childInstance = get$
|
|
9584
|
+
const childInstance = get$a(childId);
|
|
9398
9585
|
if (!childInstance) {
|
|
9399
9586
|
throw new Error(`cannot append child: child instance not found ${childId}`);
|
|
9400
9587
|
}
|
|
@@ -9413,11 +9600,11 @@ const append = (parentId, childId, referenceNodes) => {
|
|
|
9413
9600
|
applyLateFocusMaybe();
|
|
9414
9601
|
};
|
|
9415
9602
|
const replaceChildren = (parentId, childIds) => {
|
|
9416
|
-
const parentInstance = get$
|
|
9603
|
+
const parentInstance = get$a(parentId);
|
|
9417
9604
|
const $Parent = parentInstance.state.$Viewlet;
|
|
9418
9605
|
const $Fragment = document.createDocumentFragment();
|
|
9419
9606
|
for (const childId of childIds) {
|
|
9420
|
-
const childInstance = get$
|
|
9607
|
+
const childInstance = get$a(childId);
|
|
9421
9608
|
const $Child = childInstance.state.$Viewlet;
|
|
9422
9609
|
$Fragment.append($Child);
|
|
9423
9610
|
}
|
|
@@ -9432,7 +9619,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9432
9619
|
selector
|
|
9433
9620
|
} = focusCallback;
|
|
9434
9621
|
resetFocusCallback();
|
|
9435
|
-
const instance = get$
|
|
9622
|
+
const instance = get$a(id);
|
|
9436
9623
|
if (instance) {
|
|
9437
9624
|
const {
|
|
9438
9625
|
$Viewlet
|
|
@@ -9445,7 +9632,7 @@ const applyLateFocusMaybe = () => {
|
|
|
9445
9632
|
};
|
|
9446
9633
|
const appendToBody = childId => {
|
|
9447
9634
|
const $Parent = document.body;
|
|
9448
|
-
const childInstance = get$
|
|
9635
|
+
const childInstance = get$a(childId);
|
|
9449
9636
|
const $Child = childInstance.state.$Viewlet;
|
|
9450
9637
|
$Parent.append($Child);
|
|
9451
9638
|
applyLateFocusMaybe();
|
|
@@ -9458,7 +9645,7 @@ const executeCommands = commands => {
|
|
|
9458
9645
|
}
|
|
9459
9646
|
};
|
|
9460
9647
|
const show = id => {
|
|
9461
|
-
const instance = get$
|
|
9648
|
+
const instance = get$a(id);
|
|
9462
9649
|
const $Viewlet = instance.state.$Viewlet;
|
|
9463
9650
|
const $Workbench = document.getElementById('Workbench');
|
|
9464
9651
|
// @ts-expect-error
|
|
@@ -9468,7 +9655,7 @@ const show = id => {
|
|
|
9468
9655
|
}
|
|
9469
9656
|
};
|
|
9470
9657
|
const setBounds$1 = (id, left, top, width, height) => {
|
|
9471
|
-
const instance = get$
|
|
9658
|
+
const instance = get$a(id);
|
|
9472
9659
|
if (!instance) {
|
|
9473
9660
|
return;
|
|
9474
9661
|
}
|
|
@@ -9476,7 +9663,7 @@ const setBounds$1 = (id, left, top, width, height) => {
|
|
|
9476
9663
|
setBounds$a($Viewlet, left, top, width, height);
|
|
9477
9664
|
};
|
|
9478
9665
|
const setProperty = (id, selector, property, value) => {
|
|
9479
|
-
const instance = get$
|
|
9666
|
+
const instance = get$a(id);
|
|
9480
9667
|
if (!instance) {
|
|
9481
9668
|
return;
|
|
9482
9669
|
}
|
|
@@ -9487,6 +9674,13 @@ const setProperty = (id, selector, property, value) => {
|
|
|
9487
9674
|
}
|
|
9488
9675
|
$Element[property] = value;
|
|
9489
9676
|
};
|
|
9677
|
+
const renderCanvas = (id, selector, canvasClassName, width, height, rectangles, revision) => {
|
|
9678
|
+
const instance = get$a(id);
|
|
9679
|
+
if (!instance) {
|
|
9680
|
+
return;
|
|
9681
|
+
}
|
|
9682
|
+
renderCanvas$1(instance.state.$Viewlet, selector, canvasClassName, width, height, rectangles, revision);
|
|
9683
|
+
};
|
|
9490
9684
|
const commandHandlers = {
|
|
9491
9685
|
'Css.addCssStyleSheet': addCssStyleSheet,
|
|
9492
9686
|
'Viewlet.addCss': addCssStyleSheet,
|
|
@@ -9510,6 +9704,7 @@ const commandHandlers = {
|
|
|
9510
9704
|
'Viewlet.patchCss': patchCssStyleSheet,
|
|
9511
9705
|
'Viewlet.registerEventListeners': registerEventListeners,
|
|
9512
9706
|
'Viewlet.removeKeyBindings': removeKeyBindings,
|
|
9707
|
+
'Viewlet.renderCanvas': renderCanvas,
|
|
9513
9708
|
'Viewlet.replaceChildren': replaceChildren,
|
|
9514
9709
|
'Viewlet.send': invoke,
|
|
9515
9710
|
'Viewlet.setBounds': setBounds$1,
|
|
@@ -9733,7 +9928,7 @@ const queryAudio = (uid, elementLocator) => {
|
|
|
9733
9928
|
// @ts-ignore
|
|
9734
9929
|
return remoteAudio;
|
|
9735
9930
|
}
|
|
9736
|
-
const $Viewlet = get$
|
|
9931
|
+
const $Viewlet = get$a(uid);
|
|
9737
9932
|
const remoteAudio = $Viewlet.querySelector(elementLocator);
|
|
9738
9933
|
if (!remoteAudio) {
|
|
9739
9934
|
console.error('[webrtc] audio element not found');
|
|
@@ -9910,6 +10105,7 @@ const commandMap = {
|
|
|
9910
10105
|
'DirectView.getFocusedUid': getFocusedViewUid,
|
|
9911
10106
|
'DirectView.getUid': getViewUid,
|
|
9912
10107
|
'Download.downloadFile': downloadFile,
|
|
10108
|
+
'DropData.get': get$6,
|
|
9913
10109
|
'FileHandles.get': get$5,
|
|
9914
10110
|
'FilePicker.showDirectoryPicker': showDirectoryPicker,
|
|
9915
10111
|
'FilePicker.showFilePicker': showFilePicker,
|