@lvce-editor/renderer-process 29.3.0 → 29.5.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.
@@ -1087,7 +1087,7 @@ const Quote = 93;
1087
1087
  const Star = 131;
1088
1088
  const Plus = 132;
1089
1089
 
1090
- const keyCodeMap = {
1090
+ const keyCodeMap$1 = {
1091
1091
  [Backquote$1]: Backquote,
1092
1092
  [Backquote2]: Backquote,
1093
1093
  [Backslash$1]: Backslash,
@@ -1180,7 +1180,7 @@ const keyCodeMap = {
1180
1180
  [UpArrow$1]: UpArrow
1181
1181
  };
1182
1182
  const getKeyCode = key => {
1183
- return keyCodeMap[key] || Unknown;
1183
+ return keyCodeMap$1[key] || Unknown;
1184
1184
  };
1185
1185
 
1186
1186
  const CtrlCmd = 1 << 11 >>> 0;
@@ -2315,7 +2315,7 @@ const fixElectronParameters = value => {
2315
2315
  transfer
2316
2316
  };
2317
2317
  };
2318
- const attachEvents$7 = that => {
2318
+ const attachEvents$8 = that => {
2319
2319
  const handleMessage = (...args) => {
2320
2320
  const data = that.getData(...args);
2321
2321
  that.dispatchEvent(new MessageEvent('message', {
@@ -2332,7 +2332,7 @@ class Ipc extends EventTarget {
2332
2332
  constructor(rawIpc) {
2333
2333
  super();
2334
2334
  this._rawIpc = rawIpc;
2335
- attachEvents$7(this);
2335
+ attachEvents$8(this);
2336
2336
  }
2337
2337
  }
2338
2338
  const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
@@ -4430,7 +4430,7 @@ const performAction2 = async (locator, fnName, options) => {
4430
4430
  fn(element, options);
4431
4431
  };
4432
4432
 
4433
- const toHaveText$1 = locator => {
4433
+ const getElementText = locator => {
4434
4434
  const element = querySelectorOne(locator._parsed);
4435
4435
  if (!element) {
4436
4436
  return {
@@ -4443,6 +4443,12 @@ const toHaveText$1 = locator => {
4443
4443
  wasFound: true
4444
4444
  };
4445
4445
  };
4446
+ const toHaveText$1 = locator => {
4447
+ return getElementText(locator);
4448
+ };
4449
+ const toContainText$1 = locator => {
4450
+ return getElementText(locator);
4451
+ };
4446
4452
  const toHaveAttribute$1 = (locator, {
4447
4453
  key,
4448
4454
  value
@@ -4551,6 +4557,7 @@ const toHaveJSProperty$1 = (locator, {
4551
4557
  const ConditionValues = {
4552
4558
  __proto__: null,
4553
4559
  toBeFocused: toBeFocused$1,
4560
+ toContainText: toContainText$1,
4554
4561
  toHaveAttribute: toHaveAttribute$1,
4555
4562
  toHaveClass: toHaveClass$1,
4556
4563
  toHaveCount: toHaveCount$1,
@@ -4560,10 +4567,89 @@ const ConditionValues = {
4560
4567
  toHaveText: toHaveText$1
4561
4568
  };
4562
4569
 
4570
+ const keyCodeMap = {
4571
+ ' ': {
4572
+ code: 'Space',
4573
+ keyCode: 32
4574
+ },
4575
+ '.': {
4576
+ code: 'Period',
4577
+ keyCode: 190
4578
+ },
4579
+ '>': {
4580
+ code: 'Period',
4581
+ keyCode: 190,
4582
+ shiftKey: true
4583
+ },
4584
+ Enter: {
4585
+ code: 'Enter',
4586
+ keyCode: 13
4587
+ },
4588
+ Space: {
4589
+ code: 'Space',
4590
+ key: ' ',
4591
+ keyCode: 32
4592
+ }
4593
+ };
4594
+ const getKeyboardOptions = options => {
4595
+ const key = options.key || '';
4596
+ const normalizedKey = key === 'Space' ? ' ' : key;
4597
+ if (keyCodeMap[key]) {
4598
+ const mapped = keyCodeMap[key];
4599
+ const keyCode = mapped.keyCode;
4600
+ return {
4601
+ ...options,
4602
+ ...mapped,
4603
+ key: mapped.key || normalizedKey,
4604
+ which: keyCode
4605
+ };
4606
+ }
4607
+ if (normalizedKey.length === 1) {
4608
+ const upper = normalizedKey.toUpperCase();
4609
+ const keyCode = upper.codePointAt(0);
4610
+ const code = /[A-Z]/.test(upper) ? `Key${upper}` : `Digit${upper}`;
4611
+ return {
4612
+ ...options,
4613
+ code,
4614
+ key: normalizedKey,
4615
+ keyCode,
4616
+ which: keyCode
4617
+ };
4618
+ }
4619
+ return options;
4620
+ };
4621
+ const isXtermTextArea = element => {
4622
+ return element instanceof HTMLTextAreaElement && element.classList.contains('xterm-helper-textarea');
4623
+ };
4624
+ const getPrintableKey = options => {
4625
+ if (options.key === 'Space') {
4626
+ return ' ';
4627
+ }
4628
+ if (options.key?.length === 1) {
4629
+ return options.key;
4630
+ }
4631
+ return '';
4632
+ };
4563
4633
  const press = options => {
4564
4634
  const element = document.activeElement;
4565
- keyDown(element, options);
4566
- keyUp(element, options);
4635
+ if (!element) {
4636
+ return;
4637
+ }
4638
+ const text = getPrintableKey(options);
4639
+ if (isXtermTextArea(element) && text) {
4640
+ element.value = text;
4641
+ element.dispatchEvent(new InputEvent('input', {
4642
+ bubbles: true,
4643
+ cancelable: true,
4644
+ data: text,
4645
+ inputType: 'insertText'
4646
+ }));
4647
+ element.value = '';
4648
+ return;
4649
+ }
4650
+ const keyboardOptions = getKeyboardOptions(options);
4651
+ keyDown(element, keyboardOptions);
4652
+ keyUp(element, keyboardOptions);
4567
4653
  };
4568
4654
 
4569
4655
  const KeyboardActions = {
@@ -4808,7 +4894,7 @@ const transferToWebView = objectId => {
4808
4894
  }, targetOrigin, [port]);
4809
4895
  };
4810
4896
 
4811
- const attachEvents$6 = ($Node, eventMap) => {
4897
+ const attachEvents$7 = ($Node, eventMap) => {
4812
4898
  for (const [key, value] of Object.entries(eventMap)) {
4813
4899
  $Node.addEventListener(key, value);
4814
4900
  }
@@ -5920,17 +6006,17 @@ const create$n = () => {
5920
6006
  $Viewlet
5921
6007
  };
5922
6008
  };
5923
- const attachEvents$5 = state => {
6009
+ const attachEvents$6 = state => {
5924
6010
  const {
5925
6011
  $ListItems,
5926
6012
  $ScrollBar,
5927
6013
  $Viewlet
5928
6014
  } = state;
5929
6015
  $Viewlet.addEventListener(Wheel, handleWheel$1, Passive);
5930
- attachEvents$6($ListItems, {
6016
+ attachEvents$7($ListItems, {
5931
6017
  [MouseDown]: handleMousedown
5932
6018
  });
5933
- attachEvents$6($ScrollBar, {
6019
+ attachEvents$7($ScrollBar, {
5934
6020
  [PointerDown]: handleScrollBarPointerDown$1
5935
6021
  });
5936
6022
  };
@@ -5979,7 +6065,7 @@ const setBounds$8 = (state, x, y, width, height) => {
5979
6065
 
5980
6066
  const ViewletEditorCompletion = {
5981
6067
  __proto__: null,
5982
- attachEvents: attachEvents$5,
6068
+ attachEvents: attachEvents$6,
5983
6069
  create: create$n,
5984
6070
  dispose: dispose$e,
5985
6071
  handleError: handleError$5,
@@ -6011,7 +6097,7 @@ const create$m = () => {
6011
6097
  $Viewlet
6012
6098
  };
6013
6099
  };
6014
- const attachEvents$4 = state => {
6100
+ const attachEvents$5 = state => {
6015
6101
  // TODO
6016
6102
  };
6017
6103
  const setDom$7 = (state, dom) => {
@@ -6043,7 +6129,7 @@ const ViewletEditorCompletionDetails = {
6043
6129
  __proto__: null,
6044
6130
  Events: ViewletEditorCompletionDetailsEvents,
6045
6131
  appendWidget: appendWidget$4,
6046
- attachEvents: attachEvents$4,
6132
+ attachEvents: attachEvents$5,
6047
6133
  create: create$m,
6048
6134
  dispose: dispose$d,
6049
6135
  setBounds: setBounds$7,
@@ -6250,11 +6336,11 @@ const create$k = () => {
6250
6336
  $Viewlet
6251
6337
  };
6252
6338
  };
6253
- const attachEvents$3 = state => {
6339
+ const attachEvents$4 = state => {
6254
6340
  const {
6255
6341
  $Viewlet
6256
6342
  } = state;
6257
- attachEvents$6($Viewlet, {
6343
+ attachEvents$7($Viewlet, {
6258
6344
  [ContextMenu]: handleContextMenu$2,
6259
6345
  [FocusIn]: handleFocus$5,
6260
6346
  [PointerDown]: handlePointerDown$1,
@@ -6285,7 +6371,7 @@ const setDom$4 = (state, dom) => {
6285
6371
 
6286
6372
  const ViewletEditorImage = {
6287
6373
  __proto__: null,
6288
- attachEvents: attachEvents$3,
6374
+ attachEvents: attachEvents$4,
6289
6375
  create: create$k,
6290
6376
  setDom: setDom$4,
6291
6377
  setDragging,
@@ -6977,20 +7063,20 @@ const create$c = () => {
6977
7063
  $Viewlet
6978
7064
  };
6979
7065
  };
6980
- const attachEvents$2 = state => {
7066
+ const attachEvents$3 = state => {
6981
7067
  const {
6982
7068
  $SashPanel,
6983
7069
  $SashSidebar
6984
7070
  } = state;
6985
- attachEvents$6($SashSidebar, {
7071
+ attachEvents$7($SashSidebar, {
6986
7072
  [DoubleClick]: handleSashDoubleClick,
6987
7073
  [PointerDown]: handleSashPointerDown
6988
7074
  });
6989
- attachEvents$6($SashPanel, {
7075
+ attachEvents$7($SashPanel, {
6990
7076
  [DoubleClick]: handleSashDoubleClick,
6991
7077
  [PointerDown]: handleSashPointerDown
6992
7078
  });
6993
- attachEvents$6(window, {
7079
+ attachEvents$7(window, {
6994
7080
  [Blur]: handleBlur$3,
6995
7081
  [Focus]: handleFocus$2,
6996
7082
  [KeyDown]: handleKeyDown$1,
@@ -7011,7 +7097,7 @@ const setSashes = (state, sashSidebar, sashPanel) => {
7011
7097
 
7012
7098
  const ViewletLayout = {
7013
7099
  __proto__: null,
7014
- attachEvents: attachEvents$2,
7100
+ attachEvents: attachEvents$3,
7015
7101
  create: create$c,
7016
7102
  setSashes
7017
7103
  };
@@ -7212,19 +7298,19 @@ const create$a = () => {
7212
7298
  };
7213
7299
  // await openViewlet('Terminal')
7214
7300
  };
7215
- const attachEvents$1 = state => {
7301
+ const attachEvents$2 = state => {
7216
7302
  const {
7217
7303
  $ButtonClose,
7218
7304
  $ButtonMaximize,
7219
7305
  $PanelHeader
7220
7306
  } = state;
7221
- attachEvents$6($PanelHeader, {
7307
+ attachEvents$7($PanelHeader, {
7222
7308
  [Click]: handleHeaderClick$1
7223
7309
  });
7224
- attachEvents$6($ButtonMaximize, {
7310
+ attachEvents$7($ButtonMaximize, {
7225
7311
  [Click]: handleClickMaximize
7226
7312
  });
7227
- attachEvents$6($ButtonClose, {
7313
+ attachEvents$7($ButtonClose, {
7228
7314
  [Click]: handleClickClose
7229
7315
  });
7230
7316
  };
@@ -7287,7 +7373,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
7287
7373
 
7288
7374
  const ViewletPanel = {
7289
7375
  __proto__: null,
7290
- attachEvents: attachEvents$1,
7376
+ attachEvents: attachEvents$2,
7291
7377
  create: create$a,
7292
7378
  dispose: dispose$7,
7293
7379
  focus: focus$7,
@@ -7380,11 +7466,11 @@ const create$8 = () => {
7380
7466
  $Viewlet
7381
7467
  };
7382
7468
  };
7383
- const attachEvents = state => {
7469
+ const attachEvents$1 = state => {
7384
7470
  const {
7385
7471
  $SidebarTitleArea
7386
7472
  } = state;
7387
- attachEvents$6($SidebarTitleArea, {
7473
+ attachEvents$7($SidebarTitleArea, {
7388
7474
  [Click]: handleHeaderClick
7389
7475
  });
7390
7476
  };
@@ -7422,7 +7508,7 @@ const focus$6 = async () => {
7422
7508
 
7423
7509
  const ViewletSidebar = {
7424
7510
  __proto__: null,
7425
- attachEvents,
7511
+ attachEvents: attachEvents$1,
7426
7512
  create: create$8,
7427
7513
  dispose: dispose$6,
7428
7514
  focus: focus$6,
@@ -8638,7 +8724,7 @@ const move = async (uid, selector, target) => {
8638
8724
  $Target.moveBefore($Source, null);
8639
8725
  };
8640
8726
  const attachWindowEvents = () => {
8641
- attachEvents$6(window, {
8727
+ attachEvents$7(window, {
8642
8728
  [Blur]: handleBlur$3,
8643
8729
  [Focus]: handleFocus$2,
8644
8730
  [KeyDown]: handleKeyDown$1,
@@ -9944,6 +10030,11 @@ const focus = state => {
9944
10030
  const handleMouseDown = state => {
9945
10031
  focus(state);
9946
10032
  };
10033
+ const attachEvents = state => {
10034
+ state.$Viewlet.addEventListener('mousedown', () => {
10035
+ handleMouseDown(state);
10036
+ });
10037
+ };
9947
10038
  const dispose = state => {
9948
10039
  for (const disposable of state.disposables) {
9949
10040
  disposable.dispose();
@@ -9955,6 +10046,7 @@ const dispose = state => {
9955
10046
 
9956
10047
  const ViewletTerminal2 = {
9957
10048
  __proto__: null,
10049
+ attachEvents,
9958
10050
  create,
9959
10051
  dispose,
9960
10052
  focus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "29.3.0",
3
+ "version": "29.5.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"