@lvce-editor/renderer-process 15.2.0 → 15.4.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.
@@ -953,6 +953,11 @@ const render = (elements, eventMap = {}, newEventMap = {}) => {
953
953
  renderInternal($Root, elements, eventMap, newEventMap);
954
954
  return $Root;
955
955
  };
956
+ const focusElement = $Element => {
957
+ $Element.focus({
958
+ preventScroll: true
959
+ });
960
+ };
956
961
  const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
957
962
  startIgnore();
958
963
  const oldLeft = $Viewlet.style.left;
@@ -1004,18 +1009,18 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
1004
1009
  renderInto($Viewlet, dom, eventMap);
1005
1010
  }
1006
1011
  if (isRootTree) {
1007
- $Viewlet.focus();
1012
+ focusElement($Viewlet);
1008
1013
  } else if (isTreeFocused) {
1009
1014
  const $Tree = $Viewlet.querySelector('[role="tree"]');
1010
1015
  if ($Tree) {
1011
1016
  // @ts-ignore
1012
- $Tree.focus();
1017
+ focusElement($Tree);
1013
1018
  }
1014
1019
  } else if (focused) {
1015
1020
  const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
1016
1021
  if ($Focused) {
1017
1022
  // @ts-ignore
1018
- $Focused.focus();
1023
+ focusElement($Focused);
1019
1024
  }
1020
1025
  }
1021
1026
  $Viewlet.style.top = oldTop;
@@ -2032,7 +2037,8 @@ const splitLines = lines => {
2032
2037
  return lines.split(NewLine);
2033
2038
  };
2034
2039
  const getCurrentStack = () => {
2035
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
2040
+ const stackLinesToSkip = 3;
2041
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
2036
2042
  return currentStack;
2037
2043
  };
2038
2044
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -2303,6 +2309,12 @@ const invokeAndTransfer$1 = (ipc, method, ...params) => {
2303
2309
  return invokeHelper(ipc, method, params, true);
2304
2310
  };
2305
2311
 
2312
+ class CommandNotFoundError extends Error {
2313
+ constructor(command) {
2314
+ super(`Command not found ${command}`);
2315
+ this.name = 'CommandNotFoundError';
2316
+ }
2317
+ }
2306
2318
  const commands = Object.create(null);
2307
2319
  const register = commandMap => {
2308
2320
  Object.assign(commands, commandMap);
@@ -2313,7 +2325,7 @@ const getCommand = key => {
2313
2325
  const execute = (command, ...args) => {
2314
2326
  const fn = getCommand(command);
2315
2327
  if (!fn) {
2316
- throw new Error(`command not found ${command}`);
2328
+ throw new CommandNotFoundError(command);
2317
2329
  }
2318
2330
  return fn(...args);
2319
2331
  };
@@ -2370,7 +2382,7 @@ const unhandleIpc = ipc => {
2370
2382
  ipc.onmessage = null;
2371
2383
  }
2372
2384
  };
2373
- const create$f$1 = async ({
2385
+ const create$g$1 = async ({
2374
2386
  commandMap,
2375
2387
  window
2376
2388
  }) => {
@@ -2383,12 +2395,12 @@ const create$f$1 = async ({
2383
2395
  };
2384
2396
  const ElectronWindowRpcClient = {
2385
2397
  __proto__: null,
2386
- create: create$f$1
2398
+ create: create$g$1
2387
2399
  };
2388
2400
  const isWorker = value => {
2389
2401
  return value instanceof Worker;
2390
2402
  };
2391
- const create$b$1 = async ({
2403
+ const create$c$1 = async ({
2392
2404
  commandMap,
2393
2405
  url,
2394
2406
  name
@@ -2409,9 +2421,9 @@ const create$b$1 = async ({
2409
2421
  };
2410
2422
  const ModuleWorkerRpcParent = {
2411
2423
  __proto__: null,
2412
- create: create$b$1
2424
+ create: create$c$1
2413
2425
  };
2414
- const create$a$1 = async ({
2426
+ const create$b$1 = async ({
2415
2427
  commandMap,
2416
2428
  url,
2417
2429
  port,
@@ -2435,7 +2447,7 @@ const create$a$1 = async ({
2435
2447
  };
2436
2448
  const ModuleWorkerWithMessagePortRpcParent = {
2437
2449
  __proto__: null,
2438
- create: create$a$1
2450
+ create: create$b$1
2439
2451
  };
2440
2452
  const create$5$1 = async ({
2441
2453
  commandMap,
@@ -3645,7 +3657,7 @@ const toHaveAttribute$1 = (element, {
3645
3657
  const attribute = element.getAttribute(key);
3646
3658
  return attribute === value;
3647
3659
  };
3648
- const toHaveJSProperty = (element, {
3660
+ const toHaveJSProperty$1 = (element, {
3649
3661
  key,
3650
3662
  value
3651
3663
  }) => {
@@ -3686,7 +3698,7 @@ const SingleElementConditions = {
3686
3698
  toHaveClass: toHaveClass$1,
3687
3699
  toHaveCss: toHaveCss$1,
3688
3700
  toHaveId: toHaveId$1,
3689
- toHaveJSProperty,
3701
+ toHaveJSProperty: toHaveJSProperty$1,
3690
3702
  toHaveText: toHaveText$1,
3691
3703
  toHaveValue
3692
3704
  };
@@ -3798,6 +3810,22 @@ const toHaveCss = (locator, {
3798
3810
  actual
3799
3811
  };
3800
3812
  };
3813
+ const toHaveJSProperty = (locator, {
3814
+ key
3815
+ }) => {
3816
+ const [element] = querySelector(locator._selector);
3817
+ if (!element) {
3818
+ return {
3819
+ wasFound: false,
3820
+ actual: ''
3821
+ };
3822
+ }
3823
+ const actual = element[key];
3824
+ return {
3825
+ wasFound: true,
3826
+ actual
3827
+ };
3828
+ };
3801
3829
 
3802
3830
  const ConditionValues = {
3803
3831
  __proto__: null,
@@ -3807,6 +3835,7 @@ const ConditionValues = {
3807
3835
  toHaveCount,
3808
3836
  toHaveCss,
3809
3837
  toHaveId,
3838
+ toHaveJSProperty,
3810
3839
  toHaveText
3811
3840
  };
3812
3841
 
@@ -7661,7 +7690,10 @@ const setActionsDom$1 = (state, actions, childUid) => {
7661
7690
  }
7662
7691
  const eventMap = instance.factory.EventMap;
7663
7692
  setComponentUid($PanelActions, childUid);
7664
- rememberFocus($PanelActions, actions, eventMap, childUid);
7693
+ const $New = document.createElement('div');
7694
+ const $NewActions = rememberFocus($New, actions, eventMap, childUid);
7695
+ $PanelActions.replaceChildren();
7696
+ $PanelActions.append($NewActions);
7665
7697
  };
7666
7698
 
7667
7699
  const ViewletPanel = {
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "15.2.0",
4
- "description": "",
3
+ "version": "15.4.0",
5
4
  "keywords": [
6
5
  "lvce-editor",
7
6
  "renderer-process"