@lvce-editor/renderer-process 23.0.0 → 23.2.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.
@@ -973,14 +973,6 @@ const getEventListenerArg = (param, event) => {
973
973
  return event.target.checked;
974
974
  case 'event.target.className':
975
975
  return event.target.className;
976
- case 'event.target.dataset.groupIndex':
977
- return event.target.dataset.groupIndex;
978
- case 'event.target.dataset.id':
979
- return event.target.dataset.id;
980
- case 'event.target.dataset.index':
981
- return event.target.dataset.index;
982
- case 'event.target.dataset.name':
983
- return event.target.dataset.name;
984
976
  case 'event.target.href':
985
977
  return event.target.href;
986
978
  case 'event.target.name':
@@ -1002,6 +994,10 @@ const getEventListenerArg = (param, event) => {
1002
994
  case 'event.y':
1003
995
  return event.y;
1004
996
  default:
997
+ if (param.startsWith('event.target.dataset')) {
998
+ const rest = param.slice('event.target.dataset.'.length);
999
+ return event.target.dataset[rest];
1000
+ }
1005
1001
  return param;
1006
1002
  }
1007
1003
  };
@@ -1095,12 +1091,20 @@ const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
1095
1091
  break;
1096
1092
  case NavigateChild:
1097
1093
  {
1098
- const $Child = $Current.childNodes[patch.index];
1094
+ const $Children = $Current.childNodes;
1095
+ const $Child = $Children[patch.index];
1099
1096
  if (!$Child) {
1097
+ const nextPatch = patches[patchIndex + 1];
1098
+ if (nextPatch && nextPatch.type === Replace && patch.index === $Children.length) {
1099
+ const $Placeholder = document.createComment('virtual-dom-placeholder');
1100
+ $Current.append($Placeholder);
1101
+ $Current = $Placeholder;
1102
+ break;
1103
+ }
1100
1104
  console.error('Cannot navigate to child: child not found at index', {
1101
1105
  $Current,
1102
1106
  index: patch.index,
1103
- childCount: $Current.childNodes.length
1107
+ childCount: $Children.length
1104
1108
  });
1105
1109
  return;
1106
1110
  }
@@ -2247,12 +2251,12 @@ const getErrorConstructor = (message, type) => {
2247
2251
  switch (type) {
2248
2252
  case DomException:
2249
2253
  return DOMException;
2250
- case TypeError$1:
2251
- return TypeError;
2252
- case SyntaxError$1:
2253
- return SyntaxError;
2254
2254
  case ReferenceError$1:
2255
2255
  return ReferenceError;
2256
+ case SyntaxError$1:
2257
+ return SyntaxError;
2258
+ case TypeError$1:
2259
+ return TypeError;
2256
2260
  default:
2257
2261
  return Error;
2258
2262
  }
@@ -2408,27 +2412,27 @@ const getErrorProperty = (error, prettyError) => {
2408
2412
  if (error && error.code === E_COMMAND_NOT_FOUND) {
2409
2413
  return {
2410
2414
  code: MethodNotFound,
2411
- message: error.message,
2412
- data: error.stack
2415
+ data: error.stack,
2416
+ message: error.message
2413
2417
  };
2414
2418
  }
2415
2419
  return {
2416
2420
  code: Custom,
2417
- message: prettyError.message,
2418
2421
  data: {
2419
- stack: getStack(prettyError),
2420
- codeFrame: prettyError.codeFrame,
2421
- type: getErrorType(prettyError),
2422
2422
  code: prettyError.code,
2423
- name: prettyError.name
2424
- }
2423
+ codeFrame: prettyError.codeFrame,
2424
+ name: prettyError.name,
2425
+ stack: getStack(prettyError),
2426
+ type: getErrorType(prettyError)
2427
+ },
2428
+ message: prettyError.message
2425
2429
  };
2426
2430
  };
2427
2431
  const create$1$1 = (id, error) => {
2428
2432
  return {
2429
- jsonrpc: Two$1,
2433
+ error,
2430
2434
  id,
2431
- error
2435
+ jsonrpc: Two$1
2432
2436
  };
2433
2437
  };
2434
2438
  const getErrorResponse = (id, error, preparePrettyError, logError) => {
@@ -2439,8 +2443,8 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
2439
2443
  };
2440
2444
  const create$J = (message, result) => {
2441
2445
  return {
2442
- jsonrpc: Two$1,
2443
2446
  id: message.id,
2447
+ jsonrpc: Two$1,
2444
2448
  result: result ?? null
2445
2449
  };
2446
2450
  };
@@ -2450,14 +2454,14 @@ const getSuccessResponse = (message, result) => {
2450
2454
  };
2451
2455
  const getErrorResponseSimple = (id, error) => {
2452
2456
  return {
2453
- jsonrpc: Two$1,
2454
- id,
2455
2457
  error: {
2456
2458
  code: Custom,
2459
+ data: error,
2457
2460
  // @ts-ignore
2458
- message: error.message,
2459
- data: error
2460
- }
2461
+ message: error.message
2462
+ },
2463
+ id,
2464
+ jsonrpc: Two$1
2461
2465
  };
2462
2466
  };
2463
2467
  const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
@@ -2487,35 +2491,35 @@ const normalizeParams = args => {
2487
2491
  if (args.length === 1) {
2488
2492
  const options = args[0];
2489
2493
  return {
2494
+ execute: options.execute,
2490
2495
  ipc: options.ipc,
2496
+ logError: options.logError || defaultLogError,
2491
2497
  message: options.message,
2492
- execute: options.execute,
2493
- resolve: options.resolve || defaultResolve,
2494
2498
  preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
2495
- logError: options.logError || defaultLogError,
2496
- requiresSocket: options.requiresSocket || defaultRequiresSocket
2499
+ requiresSocket: options.requiresSocket || defaultRequiresSocket,
2500
+ resolve: options.resolve || defaultResolve
2497
2501
  };
2498
2502
  }
2499
2503
  return {
2504
+ execute: args[2],
2500
2505
  ipc: args[0],
2506
+ logError: args[5],
2501
2507
  message: args[1],
2502
- execute: args[2],
2503
- resolve: args[3],
2504
2508
  preparePrettyError: args[4],
2505
- logError: args[5],
2506
- requiresSocket: args[6]
2509
+ requiresSocket: args[6],
2510
+ resolve: args[3]
2507
2511
  };
2508
2512
  };
2509
2513
  const handleJsonRpcMessage = async (...args) => {
2510
2514
  const options = normalizeParams(args);
2511
2515
  const {
2512
- message,
2513
- ipc,
2514
2516
  execute,
2515
- resolve,
2516
- preparePrettyError,
2517
+ ipc,
2517
2518
  logError,
2518
- requiresSocket
2519
+ message,
2520
+ preparePrettyError,
2521
+ requiresSocket,
2522
+ resolve
2519
2523
  } = options;
2520
2524
  if ('id' in message) {
2521
2525
  if ('method' in message) {
@@ -2576,7 +2580,6 @@ const registerPromise = map => {
2576
2580
  };
2577
2581
  };
2578
2582
 
2579
- // @ts-ignore
2580
2583
  const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
2581
2584
  const {
2582
2585
  id,
@@ -3807,7 +3810,8 @@ const querySelectorByText = (root, text) => {
3807
3810
  return elements;
3808
3811
  };
3809
3812
  const querySelectorByCss = selector => {
3810
- return Array.from(document.querySelectorAll(selector));
3813
+ // @ts-ignore
3814
+ return [...document.querySelectorAll(selector)];
3811
3815
  };
3812
3816
  const isElement = selector => {
3813
3817
  return htmlElements.includes(selector);
@@ -10002,7 +10006,7 @@ const RE_PATH_3 = /@(.*):(\d+):(\d+)$/; // Firefox
10002
10006
  */
10003
10007
  const getFile = lines => {
10004
10008
  for (const line of lines) {
10005
- if (line.match(RE_PATH_1) || line.match(RE_PATH_2) || line.match(RE_PATH_3)) {
10009
+ if (RE_PATH_1.test(line) || RE_PATH_2.test(line) || RE_PATH_3.test(line)) {
10006
10010
  return line;
10007
10011
  }
10008
10012
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "23.0.0",
3
+ "version": "23.2.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"