@lvce-editor/renderer-process 10.57.0 → 10.59.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.
@@ -1209,7 +1209,7 @@ var A = "a";
1209
1209
  var Br = "br";
1210
1210
  var Cite = "cite";
1211
1211
  var Data = "data";
1212
- var Time$1 = "time";
1212
+ var Time = "time";
1213
1213
  var Tfoot = "tfoot";
1214
1214
  var Ul = "ul";
1215
1215
  var Video$1 = "video";
@@ -1365,7 +1365,7 @@ var getElementTag = type => {
1365
1365
  case Data2:
1366
1366
  return Data;
1367
1367
  case Time2:
1368
- return Time$1;
1368
+ return Time;
1369
1369
  case Tfoot2:
1370
1370
  return Tfoot;
1371
1371
  case Ul2:
@@ -2237,14 +2237,14 @@ const handleDragOver$2 = forwardViewletCommand('handleDragOver');
2237
2237
  forwardViewletCommand('handleDrop');
2238
2238
  const handleDropFilePath = forwardViewletCommand('handleDropFilePath');
2239
2239
  const handleDropFiles = forwardViewletCommand('handleDrop');
2240
- const handleFeaturesClick$1 = forwardViewletCommand('handleFeaturesClick');
2241
- const handleClickSize$1 = forwardViewletCommand('handleClickSize');
2242
- const handleClickDisable$1 = forwardViewletCommand('handleClickDisable');
2243
- const handleClickUninstall$1 = forwardViewletCommand('handleClickUninstall');
2240
+ forwardViewletCommand('handleFeaturesClick');
2241
+ forwardViewletCommand('handleClickSize');
2242
+ forwardViewletCommand('handleClickDisable');
2243
+ forwardViewletCommand('handleClickUninstall');
2244
2244
  forwardViewletCommand('handleFilterInput');
2245
2245
  const handleFocus$b = forwardViewletCommand('handleFocus');
2246
2246
  const handleFocusIn$4 = forwardViewletCommand('handleFocusIn');
2247
- const handleIconError$1 = forwardViewletCommand('handleIconError');
2247
+ forwardViewletCommand('handleIconError');
2248
2248
  const handleImageError$1 = forwardViewletCommand('handleImageError');
2249
2249
  const handleInput$7 = forwardViewletCommand('handleInput');
2250
2250
  const handleKeyDown$5 = forwardViewletCommand('handleKeyDown');
@@ -2261,7 +2261,7 @@ const handlePointerDown$6 = forwardViewletCommand('handlePointerDown');
2261
2261
  const handlePointerMove$1 = forwardViewletCommand('handlePointerMove');
2262
2262
  forwardViewletCommand('handlePointerOver');
2263
2263
  const handlePointerUp$1 = forwardViewletCommand('handlePointerUp');
2264
- const handleReadmeContextMenu$1 = forwardViewletCommand('handleReadmeContextMenu');
2264
+ forwardViewletCommand('handleReadmeContextMenu');
2265
2265
  forwardViewletCommand('handleReplaceInput');
2266
2266
  const handleResizerClick = forwardViewletCommand('handleResizerClick');
2267
2267
  const handleResizerMove = forwardViewletCommand('handleResizerMove');
@@ -2278,7 +2278,7 @@ forwardViewletCommand('handleSliderPointerMove');
2278
2278
  const handleTabClick = forwardViewletCommand('handleTabClick');
2279
2279
  const handleTabContextMenu = forwardViewletCommand('handleTabContextMenu');
2280
2280
  const handleTabDrop = forwardViewletCommand('handleTabDrop');
2281
- const handleTabsClick$1 = forwardViewletCommand('handleTabsClick');
2281
+ forwardViewletCommand('handleTabsClick');
2282
2282
  const handleTabsDragOver = forwardViewletCommand('handleTabsDragOver');
2283
2283
  forwardViewletCommand('handleTabsPointerOut');
2284
2284
  forwardViewletCommand('handleTabsPointerOver');
@@ -2957,11 +2957,11 @@ const setBounds$3 = (state, x, y, width, height) => {
2957
2957
  const dispose$h = state => {
2958
2958
  remove$2(state.$Viewlet);
2959
2959
  };
2960
- const Events$b = ViewletFindWidgetEvents;
2960
+ const Events$a = ViewletFindWidgetEvents;
2961
2961
 
2962
2962
  const ViewletFindWidget = {
2963
2963
  __proto__: null,
2964
- Events: Events$b,
2964
+ Events: Events$a,
2965
2965
  appendWidget,
2966
2966
  create: create$H,
2967
2967
  dispose: dispose$h,
@@ -2991,7 +2991,6 @@ const EditorWidgetError = 'EditorWidgetError';
2991
2991
  const Empty = 'Empty';
2992
2992
  const Error$2 = 'Error';
2993
2993
  const Explorer = 'Explorer';
2994
- const ExtensionDetail = 'ExtensionDetail';
2995
2994
  const Extensions = 'Extensions';
2996
2995
  const FindWidget = 'FindWidget';
2997
2996
  const ImagePreview$1 = 'ImagePreview';
@@ -5291,6 +5290,113 @@ const ScreenCapture_ipc = {
5291
5290
  name: name$b
5292
5291
  };
5293
5292
 
5293
+ const getTimeStamp = () => {
5294
+ return performance.now();
5295
+ };
5296
+
5297
+ const waitForMutation = async maxDelay => {
5298
+ const disposables = [];
5299
+ await Promise.race([new Promise(resolve => {
5300
+ const timeout = setTimeout(resolve, maxDelay);
5301
+ // @ts-expect-error
5302
+ disposables.push(() => {
5303
+ clearTimeout(timeout);
5304
+ });
5305
+ }), new Promise(resolve => {
5306
+ const callback = mutations => {
5307
+ resolve(undefined);
5308
+ };
5309
+ const observer = new MutationObserver(callback);
5310
+ observer.observe(document.body, {
5311
+ childList: true,
5312
+ attributes: true,
5313
+ characterData: true,
5314
+ subtree: true,
5315
+ attributeOldValue: true,
5316
+ characterDataOldValue: true
5317
+ });
5318
+ // @ts-expect-error
5319
+ disposables.push(() => {
5320
+ observer.disconnect();
5321
+ });
5322
+ })]);
5323
+ for (const disposable of disposables) {
5324
+ // @ts-expect-error
5325
+ disposable();
5326
+ }
5327
+ };
5328
+
5329
+ const getEventClass = eventType => {
5330
+ switch (eventType) {
5331
+ case Wheel:
5332
+ return WheelEvent;
5333
+ case PointerDown:
5334
+ case PointerUp:
5335
+ case PointerMove:
5336
+ return PointerEvent;
5337
+ default:
5338
+ return Event;
5339
+ }
5340
+ };
5341
+
5342
+ const mouseEvent = (element, eventType, options) => {
5343
+ const event = new MouseEvent(eventType, options);
5344
+ element.dispatchEvent(event);
5345
+ };
5346
+ const mouseDown = (element, options) => {
5347
+ mouseEvent(element, MouseDown, options);
5348
+ };
5349
+ const mouseUp = (element, options) => {
5350
+ mouseEvent(element, MouseUp, options);
5351
+ };
5352
+ const contextMenu = (element, options) => {
5353
+ mouseEvent(element, ContextMenu, options);
5354
+ };
5355
+ const click = (element, options) => {
5356
+ mouseDown(element, options);
5357
+ mouseEvent(element, Click, options);
5358
+ mouseUp(element, options);
5359
+ if (options.button === 2 /* right */) {
5360
+ contextMenu(element, options);
5361
+ }
5362
+ };
5363
+ const hover = (element, options) => {
5364
+ mouseEvent(element, MouseEnter, options);
5365
+ };
5366
+ const type = (element, options) => {
5367
+ element.value = options.text;
5368
+ };
5369
+ const keyboardEvent = (element, eventType, options) => {
5370
+ const event = new KeyboardEvent(eventType, options);
5371
+ element.dispatchEvent(event);
5372
+ };
5373
+ const keyDown = (element, options) => {
5374
+ keyboardEvent(element, KeyDown, options);
5375
+ };
5376
+ const keyUp = (element, options) => {
5377
+ keyboardEvent(element, KeyUp, options);
5378
+ };
5379
+ const dispatchEvent = (element, options) => {
5380
+ const EventClass = getEventClass(options.type);
5381
+ const event = new EventClass(options.type, options.init);
5382
+ element.dispatchEvent(event);
5383
+ };
5384
+
5385
+ const ElementActions = {
5386
+ __proto__: null,
5387
+ click,
5388
+ contextMenu,
5389
+ dispatchEvent,
5390
+ hover,
5391
+ keyDown,
5392
+ keyUp,
5393
+ keyboardEvent,
5394
+ mouseDown,
5395
+ mouseEvent,
5396
+ mouseUp,
5397
+ type
5398
+ };
5399
+
5294
5400
  const htmlElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdo', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr'];
5295
5401
 
5296
5402
  const querySelectorByText = (root, text) => {
@@ -5366,6 +5472,30 @@ const querySelectorWithOptions = (selector, {
5366
5472
  return element;
5367
5473
  };
5368
5474
 
5475
+ // TODO this should also come in via options
5476
+ const maxTimeout$1 = 2000;
5477
+ const performAction2 = async (locator, fnName, options) => {
5478
+ object(locator);
5479
+ string(fnName);
5480
+ object(options);
5481
+ const startTime = getTimeStamp();
5482
+ const endTime = startTime + maxTimeout$1;
5483
+ let currentTime = startTime;
5484
+ const fn = ElementActions[fnName];
5485
+ while (currentTime < endTime) {
5486
+ const element = querySelectorWithOptions(locator._selector, {
5487
+ hasText: locator._hasText,
5488
+ nth: locator._nth
5489
+ });
5490
+ if (element) {
5491
+ fn(element, options);
5492
+ return;
5493
+ }
5494
+ await waitForMutation(100);
5495
+ currentTime = getTimeStamp();
5496
+ }
5497
+ };
5498
+
5369
5499
  const toBeVisible$1 = locator => {
5370
5500
  return `expected selector to be visible ${locator._selector}`;
5371
5501
  };
@@ -5502,76 +5632,6 @@ const getFunction = fnName => {
5502
5632
  }
5503
5633
  };
5504
5634
 
5505
- const mouseEvent = (element, eventType, options) => {
5506
- const event = new MouseEvent(eventType, options);
5507
- element.dispatchEvent(event);
5508
- };
5509
- const mouseDown = (element, options) => {
5510
- mouseEvent(element, MouseDown, options);
5511
- };
5512
- const mouseUp = (element, options) => {
5513
- mouseEvent(element, MouseUp, options);
5514
- };
5515
- const contextMenu = (element, options) => {
5516
- mouseEvent(element, ContextMenu, options);
5517
- };
5518
- const click = (element, options) => {
5519
- mouseDown(element, options);
5520
- mouseEvent(element, Click, options);
5521
- mouseUp(element, options);
5522
- if (options.button === 2 /* right */) {
5523
- contextMenu(element, options);
5524
- }
5525
- };
5526
- const hover = (element, options) => {
5527
- mouseEvent(element, MouseEnter, options);
5528
- };
5529
- const type = (element, options) => {
5530
- element.value = options.text;
5531
- };
5532
- const keyboardEvent = (element, eventType, options) => {
5533
- const event = new KeyboardEvent(eventType, options);
5534
- element.dispatchEvent(event);
5535
- };
5536
- const keyDown = (element, options) => {
5537
- keyboardEvent(element, KeyDown, options);
5538
- };
5539
- const keyUp = (element, options) => {
5540
- keyboardEvent(element, KeyUp, options);
5541
- };
5542
- const getEventClass = eventType => {
5543
- switch (eventType) {
5544
- case Wheel:
5545
- return WheelEvent;
5546
- case PointerDown:
5547
- case PointerUp:
5548
- case PointerMove:
5549
- return PointerEvent;
5550
- default:
5551
- return Event;
5552
- }
5553
- };
5554
- const dispatchEvent = (element, options) => {
5555
- const EventClass = getEventClass(options.type);
5556
- const event = new EventClass(options.type, options.init);
5557
- element.dispatchEvent(event);
5558
- };
5559
-
5560
- const ElementActions = {
5561
- __proto__: null,
5562
- click,
5563
- contextMenu,
5564
- dispatchEvent,
5565
- hover,
5566
- keyDown,
5567
- keyUp,
5568
- keyboardEvent,
5569
- mouseDown,
5570
- mouseEvent,
5571
- mouseUp,
5572
- type
5573
- };
5574
-
5575
5635
  const press = options => {
5576
5636
  const element = document.activeElement;
5577
5637
  keyDown(element, options);
@@ -5685,53 +5745,12 @@ const showOverlay = (state, background, text) => {
5685
5745
  $TestOverlay.textContent = text;
5686
5746
  document.body.append($TestOverlay);
5687
5747
  };
5688
- const Time = {
5689
- getTimeStamp() {
5690
- return performance.now();
5691
- }
5692
- };
5693
5748
  const maxTimeout = 2000;
5694
- const Timeout = {
5695
- async short() {
5696
- await new Promise(resolve => setTimeout(resolve, 1000));
5697
- },
5698
- async waitForMutation(maxDelay) {
5699
- const disposables = [];
5700
- await Promise.race([new Promise(resolve => {
5701
- const timeout = setTimeout(resolve, maxDelay);
5702
- // @ts-expect-error
5703
- disposables.push(() => {
5704
- clearTimeout(timeout);
5705
- });
5706
- }), new Promise(resolve => {
5707
- const callback = mutations => {
5708
- resolve(undefined);
5709
- };
5710
- const observer = new MutationObserver(callback);
5711
- observer.observe(document.body, {
5712
- childList: true,
5713
- attributes: true,
5714
- characterData: true,
5715
- subtree: true,
5716
- attributeOldValue: true,
5717
- characterDataOldValue: true
5718
- });
5719
- // @ts-expect-error
5720
- disposables.push(() => {
5721
- observer.disconnect();
5722
- });
5723
- })]);
5724
- for (const disposable of disposables) {
5725
- // @ts-expect-error
5726
- disposable();
5727
- }
5728
- }
5729
- };
5730
5749
  const performAction = async (locator, fnName, options) => {
5731
5750
  object(locator);
5732
5751
  string(fnName);
5733
5752
  object(options);
5734
- const startTime = Time.getTimeStamp();
5753
+ const startTime = getTimeStamp();
5735
5754
  const endTime = startTime + maxTimeout;
5736
5755
  let currentTime = startTime;
5737
5756
  const fn = ElementActions[fnName];
@@ -5744,8 +5763,8 @@ const performAction = async (locator, fnName, options) => {
5744
5763
  fn(element, options);
5745
5764
  return;
5746
5765
  }
5747
- await Timeout.waitForMutation(100);
5748
- currentTime = Time.getTimeStamp();
5766
+ await waitForMutation(100);
5767
+ currentTime = getTimeStamp();
5749
5768
  }
5750
5769
  };
5751
5770
  const performKeyBoardAction = (fnName, options) => {
@@ -5759,7 +5778,7 @@ class AssertionError extends Error {
5759
5778
  }
5760
5779
  }
5761
5780
  const checkSingleElementCondition = async (locator, fnName, options) => {
5762
- const startTime = Time.getTimeStamp();
5781
+ const startTime = getTimeStamp();
5763
5782
  const endTime = startTime + maxTimeout;
5764
5783
  let currentTime = startTime;
5765
5784
  const fn = SingleElementConditions[fnName];
@@ -5774,15 +5793,15 @@ const checkSingleElementCondition = async (locator, fnName, options) => {
5774
5793
  return;
5775
5794
  }
5776
5795
  }
5777
- await Timeout.waitForMutation(100);
5778
- currentTime = Time.getTimeStamp();
5796
+ await waitForMutation(100);
5797
+ currentTime = getTimeStamp();
5779
5798
  }
5780
5799
  const errorMessageFn = getFunction(fnName);
5781
5800
  const message = errorMessageFn(locator, options);
5782
5801
  throw new AssertionError(message);
5783
5802
  };
5784
5803
  const checkMultiElementCondition = async (locator, fnName, options) => {
5785
- const startTime = Time.getTimeStamp();
5804
+ const startTime = getTimeStamp();
5786
5805
  const endTime = startTime + maxTimeout;
5787
5806
  let currentTime = startTime;
5788
5807
  const fn = MultiElementConditions[fnName];
@@ -5792,8 +5811,8 @@ const checkMultiElementCondition = async (locator, fnName, options) => {
5792
5811
  if (successful) {
5793
5812
  return;
5794
5813
  }
5795
- await Timeout.waitForMutation(100);
5796
- currentTime = Time.getTimeStamp();
5814
+ await waitForMutation(100);
5815
+ currentTime = getTimeStamp();
5797
5816
  }
5798
5817
  const errorMessageFn = getFunction(fnName);
5799
5818
  const message = errorMessageFn(locator, options);
@@ -5801,12 +5820,11 @@ const checkMultiElementCondition = async (locator, fnName, options) => {
5801
5820
  };
5802
5821
 
5803
5822
  const name$a = 'TestFrameWork';
5804
-
5805
- // prettier-ignore
5806
5823
  const Commands$b = {
5807
5824
  checkMultiElementCondition: checkMultiElementCondition,
5808
5825
  checkSingleElementCondition: checkSingleElementCondition,
5809
5826
  performAction: performAction,
5827
+ performAction2: performAction2,
5810
5828
  performKeyBoardAction: performKeyBoardAction,
5811
5829
  showOverlay: showOverlay
5812
5830
  };
@@ -5941,8 +5959,6 @@ const load$1 = moduleId => {
5941
5959
  return Promise.resolve().then(function () { return ViewletError; });
5942
5960
  case Explorer:
5943
5961
  return Promise.resolve().then(function () { return ViewletExplorer; });
5944
- case ExtensionDetail:
5945
- return Promise.resolve().then(function () { return ViewletExtensionDetail; });
5946
5962
  case Extensions:
5947
5963
  return Promise.resolve().then(function () { return ViewletExtensions; });
5948
5964
  case FindWidget:
@@ -6963,11 +6979,11 @@ const ViewletActivityBarEvents = {
6963
6979
  returnValue: returnValue$5
6964
6980
  };
6965
6981
 
6966
- const Events$a = ViewletActivityBarEvents;
6982
+ const Events$9 = ViewletActivityBarEvents;
6967
6983
 
6968
6984
  const ViewletActivityBar = {
6969
6985
  __proto__: null,
6970
- Events: Events$a
6986
+ Events: Events$9
6971
6987
  };
6972
6988
 
6973
6989
  const handleAudioError = event => {
@@ -6990,11 +7006,11 @@ const ViewletAudioEvents = {
6990
7006
  handleAudioError
6991
7007
  };
6992
7008
 
6993
- const Events$9 = ViewletAudioEvents;
7009
+ const Events$8 = ViewletAudioEvents;
6994
7010
 
6995
7011
  const ViewletAudio = {
6996
7012
  __proto__: null,
6997
- Events: Events$9
7013
+ Events: Events$8
6998
7014
  };
6999
7015
 
7000
7016
  const create$v = () => {
@@ -8392,7 +8408,7 @@ const create$i = () => {
8392
8408
  $Viewlet
8393
8409
  };
8394
8410
  };
8395
- const Events$8 = ViewletExplorerEvents;
8411
+ const Events$7 = ViewletExplorerEvents;
8396
8412
  const handleError$3 = (state, message) => {
8397
8413
  object(state);
8398
8414
  string(message);
@@ -8433,7 +8449,7 @@ const setDropTargets = (state, oldDropTargets, newDropTargets) => {
8433
8449
 
8434
8450
  const ViewletExplorer = {
8435
8451
  __proto__: null,
8436
- Events: Events$8,
8452
+ Events: Events$7,
8437
8453
  create: create$i,
8438
8454
  dispose: dispose$8,
8439
8455
  focusInput,
@@ -8441,91 +8457,6 @@ const ViewletExplorer = {
8441
8457
  setDropTargets
8442
8458
  };
8443
8459
 
8444
- const handleIconError = event => {
8445
- const uid = fromEvent(event);
8446
- handleIconError$1(uid);
8447
- };
8448
- const isLink = $Element => {
8449
- return $Element.nodeName === 'A';
8450
- };
8451
- const isImage = $Element => {
8452
- return $Element.nodeName === 'IMG';
8453
- };
8454
- const handleReadmeContextMenu = event => {
8455
- preventDefault(event);
8456
- const {
8457
- clientX,
8458
- clientY,
8459
- target
8460
- } = event;
8461
- const uid = fromEvent(event);
8462
- const props = Object.create(null);
8463
- if (isLink(target)) {
8464
- props.isLink = true;
8465
- props.url = target.href;
8466
- } else if (isImage(target)) {
8467
- props.isImage = true;
8468
- props.url = target.src;
8469
- }
8470
- handleReadmeContextMenu$1(uid, clientX, clientY, props);
8471
- };
8472
- const handleTabsClick = event => {
8473
- preventDefault(event);
8474
- const {
8475
- target
8476
- } = event;
8477
- const {
8478
- name
8479
- } = target;
8480
- const uid = fromEvent(event);
8481
- handleTabsClick$1(uid, name);
8482
- };
8483
- const handleFeaturesClick = event => {
8484
- preventDefault(event);
8485
- const {
8486
- target
8487
- } = event;
8488
- const {
8489
- name
8490
- } = target;
8491
- const uid = fromEvent(event);
8492
- handleFeaturesClick$1(uid, name);
8493
- };
8494
- const handleClickSize = event => {
8495
- preventDefault(event);
8496
- const uid = fromEvent(event);
8497
- handleClickSize$1(uid);
8498
- };
8499
- const handleClickDisable = event => {
8500
- preventDefault(event);
8501
- const uid = fromEvent(event);
8502
- handleClickDisable$1(uid);
8503
- };
8504
- const handleClickUninstall = event => {
8505
- preventDefault(event);
8506
- const uid = fromEvent(event);
8507
- handleClickUninstall$1(uid);
8508
- };
8509
-
8510
- const ViewletExtensionDetailEvents = {
8511
- __proto__: null,
8512
- handleClickDisable,
8513
- handleClickSize,
8514
- handleClickUninstall,
8515
- handleFeaturesClick,
8516
- handleIconError,
8517
- handleReadmeContextMenu,
8518
- handleTabsClick
8519
- };
8520
-
8521
- const Events$7 = ViewletExtensionDetailEvents;
8522
-
8523
- const ViewletExtensionDetail = {
8524
- __proto__: null,
8525
- Events: Events$7,
8526
- setSize
8527
- };
8528
-
8529
8460
  const Polite = 'polite';
8530
8461
 
8531
8462
  const handleScrollBarThumbPointerMove = event => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "10.57.0",
3
+ "version": "10.59.0",
4
4
  "description": "",
5
5
  "main": "dist/rendererProcessMain.js",
6
6
  "type": "module",