@lvce-editor/renderer-process 28.0.0 → 29.0.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.
@@ -76,10 +76,8 @@ const readText = async () => {
76
76
  const normalizeItems = async items => {
77
77
  const normalized = [];
78
78
  for (const clipboardItem of items) {
79
- for (const type of clipboardItem.types) {
80
- if (!type.startsWith('web ')) {
81
- continue;
82
- }
79
+ const webTypes = clipboardItem.types.filter(type => type.startsWith('web '));
80
+ for (const type of webTypes) {
83
81
  const blob = await clipboardItem.getType(type);
84
82
  normalized.push({
85
83
  blob,
@@ -98,11 +96,11 @@ const writeText = async text => {
98
96
  string(text);
99
97
  await navigator.clipboard.writeText(text);
100
98
  };
101
- const toClipBoardItem = options => {
99
+ const toClipboardItem = options => {
102
100
  return new ClipboardItem(options);
103
101
  };
104
102
  const write$1 = async itemOptions => {
105
- const items = itemOptions.map(toClipBoardItem);
103
+ const items = itemOptions.map(toClipboardItem);
106
104
  await navigator.clipboard.write(items);
107
105
  };
108
106
  const writeImage = async blob => {
@@ -184,7 +182,7 @@ const uidSymbol = Symbol('uid');
184
182
 
185
183
  const getUidTarget = $Element => {
186
184
  while ($Element) {
187
- if ($Element[uidSymbol]) {
185
+ if (Object.getOwnPropertyDescriptor($Element, uidSymbol)?.value) {
188
186
  return $Element;
189
187
  }
190
188
  $Element = $Element.parentNode;
@@ -193,14 +191,18 @@ const getUidTarget = $Element => {
193
191
  };
194
192
 
195
193
  const setComponentUid = ($Element, uid) => {
196
- $Element[uidSymbol] = uid;
194
+ Object.defineProperty($Element, uidSymbol, {
195
+ configurable: true,
196
+ value: uid,
197
+ writable: true
198
+ });
197
199
  };
198
200
  const getComponentUid = $Element => {
199
201
  const $Target = getUidTarget($Element);
200
202
  if (!$Target) {
201
203
  return 0;
202
204
  }
203
- return $Target[uidSymbol];
205
+ return Object.getOwnPropertyDescriptor($Target, uidSymbol)?.value;
204
206
  };
205
207
  const getComponentUidFromEvent = event => {
206
208
  const {
@@ -227,10 +229,10 @@ const setDragImage = (dataTransfer, label) => {
227
229
  dragImage.textContent = label;
228
230
  document.body.append(dragImage);
229
231
  dataTransfer.setDragImage(dragImage, -10, -10);
230
- const handleTimeOut = () => {
232
+ const handleTimeout = () => {
231
233
  dragImage.remove();
232
234
  };
233
- setTimeout(handleTimeOut, 0);
235
+ setTimeout(handleTimeout, 0);
234
236
  };
235
237
 
236
238
  const applyDragInfoMaybe = event => {
@@ -451,10 +453,7 @@ const getEventListenerArg = (param, event) => {
451
453
  };
452
454
 
453
455
  const getEventListenerArgs = (params, event) => {
454
- const serialized = [];
455
- for (const param of params) {
456
- serialized.push(getEventListenerArg(param, event));
457
- }
456
+ const serialized = Array.from(params, param => getEventListenerArg(param, event));
458
457
  return serialized;
459
458
  };
460
459
 
@@ -1257,13 +1256,13 @@ const attachEvent = ($Node, eventMap, key, value, newEventMap) => {
1257
1256
  if (previous) {
1258
1257
  $Node.removeEventListener(keyLower, previous.listener, previous.options);
1259
1258
  }
1260
- if (newEventMap && newEventMap[value]) {
1261
- const fn = newEventMap[value];
1259
+ const fn = newEventMap?.[value];
1260
+ if (fn) {
1262
1261
  const options = getOptions(fn);
1263
1262
  // TODO support event listener options
1264
- $Node.addEventListener(keyLower, newEventMap[value], options);
1263
+ $Node.addEventListener(keyLower, fn, options);
1265
1264
  listenersByEvent.set(keyLower, {
1266
- listener: newEventMap[value],
1265
+ listener: fn,
1267
1266
  options
1268
1267
  });
1269
1268
  attachedListeners.set($Node, listenersByEvent);
@@ -1681,7 +1680,7 @@ const getActiveElementInside = $Viewlet => {
1681
1680
  };
1682
1681
 
1683
1682
  const queryInputs = $Viewlet => {
1684
- return [...$Viewlet.querySelectorAll('input, textarea, select')];
1683
+ return [...$Viewlet.querySelectorAll(':scope input, :scope textarea, :scope select')];
1685
1684
  };
1686
1685
 
1687
1686
  const focusElement = $Element => {
@@ -1707,7 +1706,7 @@ const createHiddenContainer = (activeElement, focused) => {
1707
1706
  return $Hidden;
1708
1707
  };
1709
1708
  const restoreFocusedElement = ($Hidden, $New, focused) => {
1710
- const $NewFocused = $New.querySelector(`[name="${focused}"]`);
1709
+ const $NewFocused = $New.querySelector(`[name="${CSS.escape(focused)}"]`);
1711
1710
  if (!$NewFocused) {
1712
1711
  return;
1713
1712
  }
@@ -1742,7 +1741,7 @@ const restoreFocus = ($Viewlet, isRootTree, isTreeFocused, focused) => {
1742
1741
  return;
1743
1742
  }
1744
1743
  if (isTreeFocused) {
1745
- const $Tree = $Viewlet.querySelector('[role="tree"]');
1744
+ const $Tree = $Viewlet.querySelector(':scope [role="tree"]');
1746
1745
  if ($Tree) {
1747
1746
  // @ts-ignore
1748
1747
  focusElement($Tree);
@@ -1752,7 +1751,7 @@ const restoreFocus = ($Viewlet, isRootTree, isTreeFocused, focused) => {
1752
1751
  if (!focused) {
1753
1752
  return;
1754
1753
  }
1755
- const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
1754
+ const $Focused = $Viewlet.querySelector(`[name="${CSS.escape(focused)}"]`);
1756
1755
  if ($Focused) {
1757
1756
  // @ts-ignore
1758
1757
  focusElement($Focused);
@@ -1817,9 +1816,9 @@ const addFileHandle = fileHandle => {
1817
1816
  const getTitleBarHeight = () => {
1818
1817
  if (
1819
1818
  // @ts-expect-error
1820
- navigator.windowControlsOverlay?.getTitlebarAreaRect) {
1819
+ globalThis.navigator.windowControlsOverlay?.getTitlebarAreaRect) {
1821
1820
  // @ts-expect-error
1822
- const titleBarRect = navigator.windowControlsOverlay.getTitlebarAreaRect();
1821
+ const titleBarRect = globalThis.navigator.windowControlsOverlay.getTitlebarAreaRect();
1823
1822
  return titleBarRect.height;
1824
1823
  }
1825
1824
  return 0;
@@ -2077,7 +2076,7 @@ const getData$1 = event => {
2077
2076
  };
2078
2077
  const wrap = worker => {
2079
2078
  let handleMessage;
2080
- return {
2079
+ const wrapped = {
2081
2080
  get onmessage() {
2082
2081
  return handleMessage;
2083
2082
  },
@@ -2087,7 +2086,7 @@ const wrap = worker => {
2087
2086
  const data = getData$1(event);
2088
2087
  listener({
2089
2088
  data,
2090
- target: this
2089
+ target: wrapped
2091
2090
  });
2092
2091
  };
2093
2092
  } else {
@@ -2103,6 +2102,7 @@ const wrap = worker => {
2103
2102
  worker.postMessage(message, transfer);
2104
2103
  }
2105
2104
  };
2105
+ return wrapped;
2106
2106
  };
2107
2107
 
2108
2108
  const IpcParentWithModuleWorker$2 = {
@@ -2120,7 +2120,10 @@ const create$J = async ({
2120
2120
  }) => {
2121
2121
  string(url);
2122
2122
  const portPromise = await new Promise(resolve => {
2123
- globalThis.acceptPort = resolve;
2123
+ Object.defineProperty(globalThis, 'acceptPort', {
2124
+ configurable: true,
2125
+ value: resolve
2126
+ });
2124
2127
  });
2125
2128
  await import(url);
2126
2129
  const port = await portPromise;
@@ -2141,7 +2144,10 @@ const IpcParentWithMessagePort$2 = {
2141
2144
 
2142
2145
  const create$I = async url => {
2143
2146
  const referencePort = await new Promise(resolve => {
2144
- globalThis.acceptReferencePort = resolve;
2147
+ Object.defineProperty(globalThis, 'acceptReferencePort', {
2148
+ configurable: true,
2149
+ value: resolve
2150
+ });
2145
2151
  import(url);
2146
2152
  });
2147
2153
  delete globalThis.acceptReferencePort;
@@ -3542,7 +3548,7 @@ const create$Widgets = () => {
3542
3548
  return $Widgets;
3543
3549
  };
3544
3550
  const append$1 = $Element => {
3545
- // TODO should not call append in the first place if it is already in dom
3551
+ // TODO should not call append in the first place if it is already in DOM
3546
3552
  if (state$6.widgetSet.has($Element)) {
3547
3553
  return;
3548
3554
  }
@@ -3680,7 +3686,7 @@ const Menu = 'menu';
3680
3686
  const None$1 = 'none';
3681
3687
  const Status = 'status';
3682
3688
  const TabList = 'tablist';
3683
- const ToolBar = 'toolbar';
3689
+ const Toolbar = 'toolbar';
3684
3690
 
3685
3691
  const create$BackDrop = () => {
3686
3692
  const $BackDrop = document.createElement('div');
@@ -3730,7 +3736,7 @@ const stopPropagation = event => {
3730
3736
  event.stopPropagation();
3731
3737
  };
3732
3738
 
3733
- // TODO this module should be called dom or dom utils
3739
+ // TODO this module should be called DOM or DOM utils
3734
3740
 
3735
3741
  // TODO this module makes for weird code splitting chunks,
3736
3742
  // maybe duplicate the code per file for better chunks
@@ -3832,8 +3838,8 @@ const FocusOutput = 28;
3832
3838
  // TODO using .style.top, .style.left causes chrome devtools to show many layout shift -> maybe use transform instead
3833
3839
 
3834
3840
  // TODO when cycling through items, recalculate style is much slower
3835
- // than in vscode (1.49ms vs 0.33ms)
3836
- // paint is also faster in vscode (0.32ms vs 0.14ms)
3841
+ // than in VS Code (1.49ms vs 0.33ms)
3842
+ // paint is also faster in VS Code (0.32ms vs 0.14ms)
3837
3843
 
3838
3844
  // TODO focus on menu is not announced to screenreader
3839
3845
 
@@ -3972,7 +3978,7 @@ const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
3972
3978
  }
3973
3979
  };
3974
3980
 
3975
- // TODO replace function that recycles menu dom nodes
3981
+ // TODO replace function that recycles menu DOM nodes
3976
3982
 
3977
3983
  const handleBackDropMouseDown = event => {
3978
3984
  preventDefault(event);
@@ -3986,7 +3992,7 @@ const handleBackDropMouseDown = event => {
3986
3992
  const handleContextMenu$7 = event => {
3987
3993
  preventDefault(event);
3988
3994
  };
3989
- const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mouseBlocking = false) => {
3995
+ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [], mouseBlocking = false) => {
3990
3996
  if (mouseBlocking) {
3991
3997
  const $BackDrop = create$BackDrop();
3992
3998
  $BackDrop.onmousedown = handleBackDropMouseDown;
@@ -4015,7 +4021,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mous
4015
4021
  send('Focus.setFocus', FocusMenu);
4016
4022
  }
4017
4023
  };
4018
- const hideSubMenu = level => {
4024
+ const hideSubmenu = level => {
4019
4025
  const $$ChildMenus = state$3.$$Menus.slice(level);
4020
4026
  for (const $ChildMenu of $$ChildMenus) {
4021
4027
  remove$1($ChildMenu);
@@ -4061,7 +4067,6 @@ const showControlled = ({
4061
4067
  x,
4062
4068
  y
4063
4069
  }) => {
4064
- // @ts-expect-error
4065
4070
  showMenu(x, y, width, height, items, level);
4066
4071
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
4067
4072
  // it should be the other way around
@@ -4098,7 +4103,7 @@ const openUrl = url => {
4098
4103
  window.open(url);
4099
4104
  };
4100
4105
  const redirectToUrl = url => {
4101
- window.location.href = url;
4106
+ window.location.assign(url);
4102
4107
  };
4103
4108
 
4104
4109
  const isElectronUserAgentSpecificMemoryError = error => {
@@ -4111,9 +4116,9 @@ const isElectronUserAgentSpecificMemoryError = error => {
4111
4116
  const measureUserAgentSpecificMemory = async () => {
4112
4117
  try {
4113
4118
  // @ts-expect-error
4114
- if (performance?.measureUserAgentSpecificMemory) {
4119
+ if (globalThis.performance?.measureUserAgentSpecificMemory) {
4115
4120
  // @ts-expect-error
4116
- const memory = await performance.measureUserAgentSpecificMemory();
4121
+ const memory = await globalThis.performance.measureUserAgentSpecificMemory();
4117
4122
  return memory;
4118
4123
  }
4119
4124
  } catch (error) {
@@ -4158,7 +4163,7 @@ const getCombinedErrorMessage = (error, message) => {
4158
4163
  if (message) {
4159
4164
  return `${message}: ${error}`;
4160
4165
  }
4161
- return `${error}`;
4166
+ return String(error);
4162
4167
  };
4163
4168
 
4164
4169
  const mergeStacks = (parent, child) => {
@@ -4180,7 +4185,8 @@ const getErrorStack = error => {
4180
4185
  return error.stack;
4181
4186
  }
4182
4187
  if (error && error.lineNumber && error.columnNumber && error.fileName) {
4183
- const normalStackLooksLike = new Error().stack;
4188
+ const testError = new Error();
4189
+ const normalStackLooksLike = testError.stack;
4184
4190
  // @ts-ignore
4185
4191
  if (/^[$\w]+@.*/.test(normalStackLooksLike)) {
4186
4192
  // firefox stack trace
@@ -4546,7 +4552,7 @@ const press = options => {
4546
4552
  keyUp(element, options);
4547
4553
  };
4548
4554
 
4549
- const KeyBoardActions = {
4555
+ const KeyboardActions = {
4550
4556
  __proto__: null,
4551
4557
  press
4552
4558
  };
@@ -4694,8 +4700,8 @@ const performAction = async (locator, fnName, options) => {
4694
4700
  }
4695
4701
  fn(element, options);
4696
4702
  };
4697
- const performKeyBoardAction = (fnName, options) => {
4698
- const fn = KeyBoardActions[fnName];
4703
+ const performKeyboardAction = (fnName, options) => {
4704
+ const fn = KeyboardActions[fnName];
4699
4705
  fn(options);
4700
4706
  };
4701
4707
  const checkSingleElementCondition = async (locator, fnName, options) => {
@@ -4769,7 +4775,8 @@ const transferToWebView = objectId => {
4769
4775
  // TODO allow specifying transfer origin from renderer worker
4770
4776
  // TODO allow specifing method from renderer worker
4771
4777
  const port = acquire(objectId);
4772
- const targetOrigin = new URL($Iframe.src || location.href, location.href).origin;
4778
+ const targetUrl = new URL($Iframe.src || location.href, location.href);
4779
+ const targetOrigin = targetUrl.origin;
4773
4780
  contentWindow.postMessage({
4774
4781
  jsonrpc: '2.0',
4775
4782
  method: 'handlePort',
@@ -4801,7 +4808,7 @@ const getIdentifiers = () => {
4801
4808
  return state$2.identifiers;
4802
4809
  };
4803
4810
 
4804
- // TODO store keybindings as json somewhere
4811
+ // TODO store keybindings as JSON somewhere
4805
4812
 
4806
4813
  // TODO sort keybindings by `when` priority -> focus.editorCompletions: 10, focus.editor:9 etc.
4807
4814
 
@@ -4809,7 +4816,7 @@ const getIdentifiers = () => {
4809
4816
  // could remove some context logic and have less user configuration when these are default
4810
4817
  // e.g. arrow down focuses next, arrow up always focuses previous item (like in aria spec)
4811
4818
 
4812
- // TODO ui should only have keys -> commands get resolved inside renderer worker
4819
+ // TODO UI should only have keys -> commands get resolved inside renderer worker
4813
4820
  // TODO should toggle terminal, not only open
4814
4821
 
4815
4822
  const setIdentifiers = identifiers => {
@@ -5229,7 +5236,7 @@ const setOffsetX = (state, offsetX) => {
5229
5236
  const {
5230
5237
  $Viewlet
5231
5238
  } = state;
5232
- const $ColorPickerSliderThumb = $Viewlet.querySelector('.ColorPickerSliderThumb');
5239
+ const $ColorPickerSliderThumb = $Viewlet.querySelector(':scope .ColorPickerSliderThumb');
5233
5240
  setXAndYTransform($ColorPickerSliderThumb, offsetX, 0);
5234
5241
  applyUidWorkaround($Viewlet);
5235
5242
  };
@@ -5319,14 +5326,14 @@ const setValue$2 = (state, value) => {
5319
5326
  const {
5320
5327
  $Viewlet
5321
5328
  } = state;
5322
- const $Input = $Viewlet.querySelector('input');
5329
+ const $Input = $Viewlet.querySelector(':scope input');
5323
5330
  $Input.value = value;
5324
5331
  };
5325
5332
  const focus$c = state => {
5326
5333
  const {
5327
5334
  $Viewlet
5328
5335
  } = state;
5329
- const $Input = $Viewlet.querySelector('input');
5336
+ const $Input = $Viewlet.querySelector(':scope input');
5330
5337
  $Input.focus();
5331
5338
  };
5332
5339
 
@@ -5355,7 +5362,7 @@ const create$p = icon => {
5355
5362
  };
5356
5363
 
5357
5364
  const create$Button = (label, icon) => {
5358
- // TODO icon div might not be needed (unnecessary html element)
5365
+ // TODO icon div might not be needed (unnecessary HTML element)
5359
5366
  const $Icon = create$p(icon);
5360
5367
  const $Button = document.createElement('button');
5361
5368
  $Button.className = 'IconButton';
@@ -5559,7 +5566,7 @@ const setIframe$3 = (state, src, sandbox = []) => {
5559
5566
  const {
5560
5567
  $Viewlet
5561
5568
  } = state;
5562
- const $Parent = $Viewlet.querySelector('.E2eTestIframeWrapper');
5569
+ const $Parent = $Viewlet.querySelector(':scope .E2eTestIframeWrapper');
5563
5570
  const $Iframe = document.createElement('iframe');
5564
5571
  for (const element of sandbox) {
5565
5572
  $Iframe.sandbox.add(element);
@@ -5572,7 +5579,7 @@ const setPreviewTransform = (state, transform) => {
5572
5579
  const {
5573
5580
  $Viewlet
5574
5581
  } = state;
5575
- const $Parent = $Viewlet.querySelector('.E2eTestIframeWrapper');
5582
+ const $Parent = $Viewlet.querySelector(':scope .E2eTestIframeWrapper');
5576
5583
  $Parent.style.transform = transform;
5577
5584
  };
5578
5585
  // export const setPort = (state, portId, origin) => {
@@ -5935,7 +5942,7 @@ const handleError$5 = (state, error) => {
5935
5942
  const {
5936
5943
  $Viewlet
5937
5944
  } = state;
5938
- $Viewlet.textContent = `${error}`;
5945
+ $Viewlet.textContent = String(error);
5939
5946
  };
5940
5947
  const setBounds$8 = (state, x, y, width, height) => {
5941
5948
  const {
@@ -6018,7 +6025,7 @@ const ViewletEditorCompletionDetails = {
6018
6025
  setDom: setDom$7
6019
6026
  };
6020
6027
 
6021
- // TODO not sure whether created dom node
6028
+ // TODO not sure whether created DOM node
6022
6029
  // should stay in state or be removed
6023
6030
  // one option would result in less memory usage
6024
6031
  // the other option would result in less garbage collection
@@ -6235,7 +6242,7 @@ const setTransform = (state, transform) => {
6235
6242
  const {
6236
6243
  $Viewlet
6237
6244
  } = state;
6238
- const $ImageWrapper = $Viewlet.querySelector('.ImageContent');
6245
+ const $ImageWrapper = $Viewlet.querySelector(':scope .ImageContent');
6239
6246
  $ImageWrapper.style.transform = transform;
6240
6247
  };
6241
6248
  const setDragging = (state, isDragging) => {
@@ -6598,7 +6605,7 @@ const setValue$1 = (state, value) => {
6598
6605
  const {
6599
6606
  $Viewlet
6600
6607
  } = state;
6601
- const $InputBox = $Viewlet.querySelector('.MultilineInputBox');
6608
+ const $InputBox = $Viewlet.querySelector(':scope .MultilineInputBox');
6602
6609
  if (!$InputBox) {
6603
6610
  return;
6604
6611
  }
@@ -6661,7 +6668,7 @@ const setFocusedIndex$1 = (state, oldFocusedIndex, newFocusedIndex) => {
6661
6668
  const {
6662
6669
  $Viewlet
6663
6670
  } = state;
6664
- const $Locations = $Viewlet.children[1];
6671
+ const $Locations = $Viewlet.querySelector(':scope .LocationList');
6665
6672
  if (oldFocusedIndex === -1) {
6666
6673
  $Locations.classList.remove('FocusOutline');
6667
6674
  } else {
@@ -6771,7 +6778,7 @@ const setValue = (state, value) => {
6771
6778
  const {
6772
6779
  $Viewlet
6773
6780
  } = state;
6774
- const $InputBox = $Viewlet.querySelector('input');
6781
+ const $InputBox = $Viewlet.querySelector(':scope input');
6775
6782
  $InputBox.value = value;
6776
6783
  };
6777
6784
  const setColumnWidths = (state, columnWidth1, columnWidth2, columnWidth3) => {
@@ -6779,7 +6786,7 @@ const setColumnWidths = (state, columnWidth1, columnWidth2, columnWidth3) => {
6779
6786
  const {
6780
6787
  $Viewlet
6781
6788
  } = state;
6782
- const $$Resizers = $Viewlet.querySelectorAll('.Resizer');
6789
+ const $$Resizers = $Viewlet.querySelectorAll(':scope .Resizer');
6783
6790
  const $Resizer1 = $$Resizers[0];
6784
6791
  const $Resizer2 = $$Resizers[1];
6785
6792
  $Resizer1.style.left = `${paddingLeft + columnWidth1}px`;
@@ -6926,9 +6933,9 @@ const handleKeyUp = handleKeyUp$1;
6926
6933
 
6927
6934
  const create$c = () => {
6928
6935
  // TODO use aria role splitter once supported https://github.com/w3c/aria/issues/1348
6929
- const $SashSideBar = document.createElement('div');
6930
- $SashSideBar.className = 'Viewlet Sash SashVertical';
6931
- $SashSideBar.id = 'SashSideBar';
6936
+ const $SashSidebar = document.createElement('div');
6937
+ $SashSidebar.className = 'Viewlet Sash SashVertical';
6938
+ $SashSidebar.id = 'SashSideBar';
6932
6939
 
6933
6940
  // TODO use aria role splitter once supported https://github.com/w3c/aria/issues/1348
6934
6941
  const $SashPanel = document.createElement('div');
@@ -6938,19 +6945,19 @@ const create$c = () => {
6938
6945
  $Viewlet.id = 'Workbench';
6939
6946
  $Viewlet.className = 'Viewlet Layout Workbench';
6940
6947
  $Viewlet.role = Application;
6941
- $Viewlet.append($SashSideBar, $SashPanel);
6948
+ $Viewlet.append($SashSidebar, $SashPanel);
6942
6949
  return {
6943
6950
  $SashPanel,
6944
- $SashSideBar,
6951
+ $SashSidebar,
6945
6952
  $Viewlet
6946
6953
  };
6947
6954
  };
6948
6955
  const attachEvents$2 = state => {
6949
6956
  const {
6950
6957
  $SashPanel,
6951
- $SashSideBar
6958
+ $SashSidebar
6952
6959
  } = state;
6953
- attachEvents$6($SashSideBar, {
6960
+ attachEvents$6($SashSidebar, {
6954
6961
  [DoubleClick]: handleSashDoubleClick,
6955
6962
  [PointerDown]: handleSashPointerDown
6956
6963
  });
@@ -6966,13 +6973,13 @@ const attachEvents$2 = state => {
6966
6973
  [Resize]: handleResize
6967
6974
  });
6968
6975
  };
6969
- const setSashes = (state, sashSideBar, sashPanel) => {
6976
+ const setSashes = (state, sashSidebar, sashPanel) => {
6970
6977
  const {
6971
6978
  $SashPanel,
6972
- $SashSideBar
6979
+ $SashSidebar
6973
6980
  } = state;
6974
- setBounds$a($SashSideBar, sashSideBar.x, sashSideBar.y, sashSideBar.width, sashSideBar.height);
6975
- $SashSideBar.classList.toggle('SashActive', sashSideBar.active);
6981
+ setBounds$a($SashSidebar, sashSidebar.x, sashSidebar.y, sashSidebar.width, sashSidebar.height);
6982
+ $SashSidebar.classList.toggle('SashActive', sashSidebar.active);
6976
6983
  setBounds$a($SashPanel, sashPanel.x, sashPanel.y, sashPanel.width, sashPanel.height);
6977
6984
  $SashPanel.classList.toggle('SashActive', sashPanel.active);
6978
6985
  };
@@ -7013,7 +7020,7 @@ const Panel = 'Panel';
7013
7020
  const References = 'References';
7014
7021
  const RunAndDebug = 'Run And Debug';
7015
7022
  const ScreenCapture = 'ScreenCapture';
7016
- const SideBar$1 = 'SideBar';
7023
+ const Sidebar$1 = 'SideBar';
7017
7024
  const SimpleBrowser = 'SimpleBrowser';
7018
7025
  const SourceControl = 'Source Control';
7019
7026
  const StatusBar$1 = 'StatusBar';
@@ -7151,16 +7158,16 @@ const create$a = () => {
7151
7158
  const $ButtonMaximize = create$Button(UiStrings.Maximize, 'ChevronUp');
7152
7159
  // TODO use event delegation
7153
7160
 
7154
- const $PanelToolBar = document.createElement('div');
7155
- $PanelToolBar.className = 'PanelToolBar';
7156
- $PanelToolBar.role = ToolBar;
7157
- $PanelToolBar.append($ButtonMaximize, $ButtonClose);
7161
+ const $PanelToolbar = document.createElement('div');
7162
+ $PanelToolbar.className = 'PanelToolBar';
7163
+ $PanelToolbar.role = Toolbar;
7164
+ $PanelToolbar.append($ButtonMaximize, $ButtonClose);
7158
7165
  const $PanelActions = document.createElement('div');
7159
7166
  $PanelActions.className = 'Actions';
7160
7167
  $PanelActions.role = 'toolbar';
7161
7168
  const $PanelHeader = document.createElement('div');
7162
7169
  $PanelHeader.className = 'PanelHeader';
7163
- $PanelHeader.append($PanelTabs, $PanelActions, $PanelToolBar);
7170
+ $PanelHeader.append($PanelTabs, $PanelActions, $PanelToolbar);
7164
7171
  // const $PanelContent = document.createElement('div')
7165
7172
  // $PanelContent.id = 'PanelContent'
7166
7173
  const $Viewlet = document.createElement('div');
@@ -7276,7 +7283,7 @@ const ViewletRunAndDebug = {
7276
7283
  __proto__: null
7277
7284
  };
7278
7285
 
7279
- const handleLoadedMetaData = event => {
7286
+ const handleLoadedMetadata = event => {
7280
7287
  // TODO should send event to renderer worker, renderer worker should invoke play method
7281
7288
  const {
7282
7289
  target
@@ -7298,7 +7305,7 @@ const setScreenCapture = (state, id) => {
7298
7305
  const $Video = document.createElement('video');
7299
7306
  const screenCapture = get$2(id);
7300
7307
  $Video.srcObject = screenCapture;
7301
- $Video.onloadedmetadata = handleLoadedMetaData;
7308
+ $Video.onloadedmetadata = handleLoadedMetadata;
7302
7309
  $Viewlet.append($Video);
7303
7310
  };
7304
7311
 
@@ -7308,7 +7315,7 @@ const ViewletScreenCapture = {
7308
7315
  setScreenCapture
7309
7316
  };
7310
7317
 
7311
- const SideBar = 'Side Bar';
7318
+ const Sidebar = 'Side Bar';
7312
7319
  const StatusBar = 'Status Bar';
7313
7320
 
7314
7321
  const handleClickAction = (target, uid) => {
@@ -7328,44 +7335,44 @@ const handleHeaderClick = event => {
7328
7335
  };
7329
7336
 
7330
7337
  const create$8 = () => {
7331
- const $SideBarTitleAreaTitle = document.createElement('h2');
7332
- $SideBarTitleAreaTitle.className = 'SideBarTitleAreaTitle';
7333
- const $SideBarTitleArea = document.createElement('div');
7334
- $SideBarTitleArea.className = 'SideBarTitleArea';
7335
- $SideBarTitleArea.append($SideBarTitleAreaTitle);
7338
+ const $SidebarTitleAreaTitle = document.createElement('h2');
7339
+ $SidebarTitleAreaTitle.className = 'SideBarTitleAreaTitle';
7340
+ const $SidebarTitleArea = document.createElement('div');
7341
+ $SidebarTitleArea.className = 'SideBarTitleArea';
7342
+ $SidebarTitleArea.append($SidebarTitleAreaTitle);
7336
7343
  const $Viewlet = document.createElement('div');
7337
7344
  $Viewlet.id = 'SideBar';
7338
7345
  $Viewlet.className = 'Viewlet SideBar';
7339
7346
  $Viewlet.role = Complementary;
7340
- $Viewlet.ariaRoleDescription = SideBar;
7341
- $Viewlet.append($SideBarTitleArea);
7347
+ $Viewlet.ariaRoleDescription = Sidebar;
7348
+ $Viewlet.append($SidebarTitleArea);
7342
7349
  return {
7343
7350
  $Actions: undefined,
7344
- $SideBar: $Viewlet,
7345
- $SideBarContent: undefined,
7346
- $SideBarTitleArea,
7347
- $SideBarTitleAreaTitle,
7351
+ $Sidebar: $Viewlet,
7352
+ $SidebarContent: undefined,
7353
+ $SidebarTitleArea,
7354
+ $SidebarTitleAreaTitle,
7348
7355
  $Viewlet
7349
7356
  };
7350
7357
  };
7351
7358
  const attachEvents = state => {
7352
7359
  const {
7353
- $SideBarTitleArea
7360
+ $SidebarTitleArea
7354
7361
  } = state;
7355
- attachEvents$6($SideBarTitleArea, {
7362
+ attachEvents$6($SidebarTitleArea, {
7356
7363
  [Click]: handleHeaderClick
7357
7364
  });
7358
7365
  };
7359
7366
  const dispose$5 = state => {
7360
7367
  object(state);
7361
- state.$SideBar.replaceChildren();
7368
+ state.$Sidebar.replaceChildren();
7362
7369
  };
7363
7370
  const setTitle = (state, name) => {
7364
7371
  const {
7365
- $SideBarTitleAreaTitle
7372
+ $SidebarTitleAreaTitle
7366
7373
  } = state;
7367
- $SideBarTitleAreaTitle.title = name;
7368
- $SideBarTitleAreaTitle.textContent = name;
7374
+ $SidebarTitleAreaTitle.title = name;
7375
+ $SidebarTitleAreaTitle.textContent = name;
7369
7376
  };
7370
7377
  const setActionsDom = (state, actions, parentId, eventMap = {}) => {
7371
7378
  if (actions.length === 0) {
@@ -7373,14 +7380,14 @@ const setActionsDom = (state, actions, parentId, eventMap = {}) => {
7373
7380
  }
7374
7381
  const {
7375
7382
  $Actions,
7376
- $SideBarTitleArea
7383
+ $SidebarTitleArea
7377
7384
  } = state;
7378
7385
  const $Parent = document.createElement('div');
7379
7386
  const $NewViewlet = rememberFocus$1($Parent, actions, {}, parentId);
7380
7387
  if ($Actions) {
7381
7388
  $Actions.replaceWith($NewViewlet);
7382
7389
  } else {
7383
- $SideBarTitleArea.append($NewViewlet);
7390
+ $SidebarTitleArea.append($NewViewlet);
7384
7391
  }
7385
7392
  state.$Actions = $NewViewlet;
7386
7393
  };
@@ -7388,7 +7395,7 @@ const focus$5 = async () => {
7388
7395
  // await
7389
7396
  };
7390
7397
 
7391
- const ViewletSideBar = {
7398
+ const ViewletSidebar = {
7392
7399
  __proto__: null,
7393
7400
  attachEvents,
7394
7401
  create: create$8,
@@ -7580,7 +7587,7 @@ const focus$4 = state => {
7580
7587
  const {
7581
7588
  $Viewlet
7582
7589
  } = state;
7583
- $Viewlet.querySelector('input').focus();
7590
+ $Viewlet.querySelector(':scope input').focus();
7584
7591
  };
7585
7592
 
7586
7593
  const ViewletSourceControl = {
@@ -8170,7 +8177,7 @@ const setIframe = (state, src, sandbox = [], srcDoc = '', csp = '', credentialle
8170
8177
  const {
8171
8178
  $Viewlet
8172
8179
  } = state;
8173
- const $Parent = $Viewlet.querySelector('.WebViewWrapper');
8180
+ const $Parent = $Viewlet.querySelector(':scope .WebViewWrapper');
8174
8181
  if (!$Parent) {
8175
8182
  throw new Error('webview wrapper not found');
8176
8183
  }
@@ -8258,7 +8265,7 @@ const moduleLoaders = {
8258
8265
  [References]: () => ViewletReferences,
8259
8266
  [RunAndDebug]: () => ViewletRunAndDebug,
8260
8267
  [ScreenCapture]: () => ViewletScreenCapture,
8261
- [SideBar$1]: () => ViewletSideBar,
8268
+ [Sidebar$1]: () => ViewletSidebar,
8262
8269
  [SimpleBrowser]: () => ViewletSimpleBrowser,
8263
8270
  [SourceControl]: () => ViewletSourceControl,
8264
8271
  [StatusBar$1]: () => ViewletStatusBar,
@@ -8284,7 +8291,7 @@ const load$1 = moduleId => {
8284
8291
 
8285
8292
  const state$1 = {
8286
8293
  currentPanelView: undefined,
8287
- currentSideBarView: undefined,
8294
+ currentSidebarView: undefined,
8288
8295
  modules: Object.create(null)
8289
8296
  };
8290
8297
 
@@ -8418,7 +8425,7 @@ const setInputValues = (viewletId, items) => {
8418
8425
  setElementProperty(viewletId, name, 'value', value);
8419
8426
  }
8420
8427
  };
8421
- const setCheckBoxValue = (viewletId, name, value) => {
8428
+ const setCheckboxValue = (viewletId, name, value) => {
8422
8429
  setElementProperty(viewletId, name, 'checked', value);
8423
8430
  };
8424
8431
  const setSelectionByName = (viewletId, name, start, end) => {
@@ -8493,18 +8500,18 @@ const isSpecial = id => {
8493
8500
  return specialIds.has(id);
8494
8501
  };
8495
8502
  const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
8496
- const $PlaceHolder = document.createElement('div');
8497
- $PlaceHolder.className = `Viewlet ${viewletId}`;
8498
- setBounds$a($PlaceHolder, left, top, width, height);
8503
+ const $Placeholder = document.createElement('div');
8504
+ $Placeholder.className = `Viewlet ${viewletId}`;
8505
+ setBounds$a($Placeholder, left, top, width, height);
8499
8506
  if (isSpecial(viewletId)) {
8500
- $PlaceHolder.id = viewletId;
8507
+ $Placeholder.id = viewletId;
8501
8508
  }
8502
8509
  const parentInstance = get$a(parentId);
8503
8510
  const $Parent = parentInstance.state.$Viewlet;
8504
- $Parent.append($PlaceHolder);
8511
+ $Parent.append($Placeholder);
8505
8512
  set$9(viewletId, {
8506
8513
  state: {
8507
- $Viewlet: $PlaceHolder
8514
+ $Viewlet: $Placeholder
8508
8515
  }
8509
8516
  });
8510
8517
  };
@@ -8541,7 +8548,7 @@ const setDom2 = (viewletId, dom) => {
8541
8548
  uid = get($Viewlet);
8542
8549
  } catch {}
8543
8550
  }
8544
- // TODO optimize rendering with virtual dom diffing
8551
+ // TODO optimize rendering with virtual DOM diffing
8545
8552
  const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
8546
8553
  if (uid) {
8547
8554
  // @ts-ignore
@@ -8648,7 +8655,7 @@ const handleError$1 = (id, parentId, message) => {
8648
8655
  return;
8649
8656
  }
8650
8657
  if (instance?.state.$Viewlet) {
8651
- instance.state.$Viewlet.textContent = `${message}`;
8658
+ instance.state.$Viewlet.textContent = String(message);
8652
8659
  }
8653
8660
  // TODO error should bubble up to until highest possible component
8654
8661
  const parentInstance = get$a(parentId);
@@ -8767,22 +8774,23 @@ const replaceChildren = (parentId, childIds) => {
8767
8774
  $Parent.replaceChildren($Fragment);
8768
8775
  };
8769
8776
  const applyLateFocusMaybe = () => {
8770
- if (focusCallback !== emptyFocusCallback) {
8777
+ if (focusCallback === emptyFocusCallback) {
8778
+ return;
8779
+ }
8780
+ const {
8781
+ id,
8782
+ selector
8783
+ } = focusCallback;
8784
+ focusCallback = emptyFocusCallback;
8785
+ const instance = get$a(id);
8786
+ if (instance) {
8771
8787
  const {
8772
- id,
8773
- selector
8774
- } = focusCallback;
8775
- focusCallback = emptyFocusCallback;
8776
- const instance = get$a(id);
8777
- if (instance) {
8778
- const {
8779
- $Viewlet
8780
- } = instance.state;
8781
- const $Element = $Viewlet.querySelector(selector);
8782
- if ($Element) {
8783
- $Element.focus();
8784
- focusCallback = emptyFocusCallback;
8785
- }
8788
+ $Viewlet
8789
+ } = instance.state;
8790
+ const $Element = $Viewlet.querySelector(selector);
8791
+ if ($Element) {
8792
+ $Element.focus();
8793
+ focusCallback = emptyFocusCallback;
8786
8794
  }
8787
8795
  }
8788
8796
  };
@@ -8853,7 +8861,7 @@ const commandHandlers = {
8853
8861
  'Viewlet.replaceChildren': replaceChildren,
8854
8862
  'Viewlet.send': invoke,
8855
8863
  'Viewlet.setBounds': setBounds$1,
8856
- 'Viewlet.setCheckBoxValue': setCheckBoxValue,
8864
+ 'Viewlet.setCheckBoxValue': setCheckboxValue,
8857
8865
  'Viewlet.setCss': addCssStyleSheet,
8858
8866
  'Viewlet.setDom': setDom,
8859
8867
  'Viewlet.setDom2': setDom2,
@@ -8941,15 +8949,17 @@ const set$1 = title => {
8941
8949
 
8942
8950
  // workaround for not being setPointerCapture() not working on
8943
8951
  // synthetic events
8952
+ let originalSetPointerCapture;
8953
+ let originalReleasePointerCapture;
8944
8954
  const mock = () => {
8945
- globalThis._originalSetPointerCapture = Element.prototype.setPointerCapture;
8946
- globalThis._originalReleasePointerCapture = Element.prototype.releasePointerCapture;
8955
+ originalSetPointerCapture = Element.prototype.setPointerCapture;
8956
+ originalReleasePointerCapture = Element.prototype.releasePointerCapture;
8947
8957
  Element.prototype.setPointerCapture = () => {};
8948
8958
  Element.prototype.releasePointerCapture = () => {};
8949
8959
  };
8950
8960
  const unmock = () => {
8951
- Element.prototype.setPointerCapture = globalThis._originalSetPointerCapture;
8952
- Element.prototype.releasePointerCapture = globalThis._originalReleasePointerCapture;
8961
+ Element.prototype.setPointerCapture = originalSetPointerCapture;
8962
+ Element.prototype.releasePointerCapture = originalReleasePointerCapture;
8953
8963
  };
8954
8964
 
8955
8965
  const isFile = value => {
@@ -9086,7 +9096,7 @@ const commandMap = {
9086
9096
  'MeasureTextHeight.measureTextHeight': measureTextHeight,
9087
9097
  'Menu.focusIndex': focusIndex,
9088
9098
  'Menu.hide': hide,
9089
- 'Menu.hideSubMenu': hideSubMenu,
9099
+ 'Menu.hideSubMenu': hideSubmenu,
9090
9100
  'Menu.showControlled': showControlled,
9091
9101
  'Menu.showMenu': showMenu,
9092
9102
  'Meta.setThemeColor': setThemeColor,
@@ -9108,7 +9118,7 @@ const commandMap = {
9108
9118
  'TestFrameWork.checkSingleElementCondition': checkSingleElementCondition,
9109
9119
  'TestFrameWork.performAction': performAction,
9110
9120
  'TestFrameWork.performAction2': performAction2,
9111
- 'TestFrameWork.performKeyBoardAction': performKeyBoardAction,
9121
+ 'TestFrameWork.performKeyBoardAction': performKeyboardAction,
9112
9122
  'TestFrameWork.showOverlay': showOverlay,
9113
9123
  'TestFrameWork.transfer': transfer,
9114
9124
  'TestFrameWork.transferToWebView': transferToWebView,
@@ -9386,9 +9396,9 @@ const getIsFirefox = () => {
9386
9396
  }
9387
9397
  if (
9388
9398
  // @ts-expect-error
9389
- navigator.userAgentData?.brands) {
9399
+ globalThis.navigator.userAgentData?.brands) {
9390
9400
  // @ts-expect-error
9391
- return navigator.userAgentData.brands.includes('Firefox');
9401
+ return globalThis.navigator.userAgentData.brands.includes('Firefox');
9392
9402
  }
9393
9403
  return navigator.userAgent.toLowerCase().includes('firefox');
9394
9404
  };
@@ -9550,7 +9560,7 @@ const handleError = async (error, notify = true, prefix = '') => {
9550
9560
  };
9551
9561
 
9552
9562
  const isChromeExtensionError = error => {
9553
- return `${error}` === 'Script error.';
9563
+ return String(error) === 'Script error.';
9554
9564
  };
9555
9565
 
9556
9566
  const handleUnhandledRejection = event => {
@@ -9832,7 +9842,7 @@ const create = () => {
9832
9842
  const $Viewlet = document.createElement('div');
9833
9843
  const term = new Dl();
9834
9844
  term.open($Viewlet);
9835
- term.write('Hello from \u001B[1;3;31mxterm.js\u001B[0m $ ');
9845
+ term.write('Hello from \u{1B}[1;3;31mxterm.js\u{1B}[0m $ ');
9836
9846
  return {
9837
9847
  $Viewlet
9838
9848
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "28.0.0",
3
+ "version": "29.0.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"