@lvce-editor/renderer-process 30.10.0 → 30.11.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.
@@ -118,25 +118,25 @@ const confirm$1 = message => {
118
118
  return window.confirm(message);
119
119
  };
120
120
 
121
- const state$a = {
121
+ const state$b = {
122
122
  styleSheets: Object.create(null),
123
123
  texts: Object.create(null)
124
124
  };
125
125
  const set$a = (id, sheet) => {
126
- state$a.styleSheets[id] = sheet;
126
+ state$b.styleSheets[id] = sheet;
127
127
  };
128
128
  const get$b = id => {
129
- return state$a.styleSheets[id];
129
+ return state$b.styleSheets[id];
130
130
  };
131
131
  const setText$2 = (id, text) => {
132
- state$a.texts[id] = text;
132
+ state$b.texts[id] = text;
133
133
  };
134
134
  const getText = id => {
135
- return state$a.texts[id];
135
+ return state$b.texts[id];
136
136
  };
137
137
  const remove$4 = id => {
138
- delete state$a.styleSheets[id];
139
- delete state$a.texts[id];
138
+ delete state$b.styleSheets[id];
139
+ delete state$b.texts[id];
140
140
  };
141
141
 
142
142
  const addCssStyleSheet = (id, text) => {
@@ -338,10 +338,10 @@ const createIdGenerator = () => {
338
338
  };
339
339
  const create$L = createIdGenerator();
340
340
 
341
- const state$9 = Object.create(null);
341
+ const state$a = Object.create(null);
342
342
  const acquire$1 = id => {
343
- const promise = state$9[id];
344
- delete state$9[id];
343
+ const promise = state$a[id];
344
+ delete state$a[id];
345
345
  return promise;
346
346
  };
347
347
  const getFileHandles$1 = async ids => {
@@ -351,7 +351,7 @@ const getFileHandles$1 = async ids => {
351
351
  };
352
352
  const add$1 = promise => {
353
353
  const id = create$L();
354
- state$9[id] = promise;
354
+ state$a[id] = promise;
355
355
  return id;
356
356
  };
357
357
  const addFileHandle$1 = fileHandle => {
@@ -515,14 +515,14 @@ const getEventListenerArgs = (params, event) => {
515
515
  return serialized;
516
516
  };
517
517
 
518
- const state$8 = {
518
+ const state$9 = {
519
519
  ipc: undefined
520
520
  };
521
521
  const getIpc = () => {
522
- return state$8.ipc;
522
+ return state$9.ipc;
523
523
  };
524
524
  const setIpc = value => {
525
- state$8.ipc = value;
525
+ state$9.ipc = value;
526
526
  };
527
527
 
528
528
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -1399,9 +1399,7 @@ const setStyle = ($Element, styleString) => {
1399
1399
  }
1400
1400
  };
1401
1401
 
1402
- const optionalAttributeProps = new Map([['ariaActivedescendant', 'aria-activedescendant'], ['ariaOwns', 'aria-owns']]);
1403
- const mappedAttributeProps = new Map([['ariaControls', 'aria-controls'], ['ariaLabelledBy', 'aria-labelledby']]);
1404
- const removedAttributeProps = new Map([['ariaActivedescendant', 'aria-activedescendant'], ['ariaControls', 'aria-controls'], ['ariaLabelledBy', 'aria-labelledby'], ['ariaOwns', 'aria-owns'], ['className', 'class'], ['htmlFor', 'for'], ['inputType', 'type']]);
1402
+ const removedAttributeProps = new Map([['ariaActivedescendant', 'aria-activedescendant'], ['ariaControls', 'aria-controls'], ['ariaDescribedBy', 'aria-describedby'], ['ariaInvalid', 'aria-invalid'], ['ariaLabelledBy', 'aria-labelledby'], ['ariaOwns', 'aria-owns'], ['className', 'class'], ['htmlFor', 'for'], ['inputType', 'type']]);
1405
1403
  const pixelStyleProps = new Set(['height', 'left', 'marginTop', 'paddingLeft', 'paddingRight', 'top', 'width']);
1406
1404
  const eventProps = new Set(['onBlur', 'onChange', 'onClick', 'onContextMenu', 'onBeforeInput', 'onDblClick', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onFocus', 'onFocusIn', 'onFocusOut', 'onInput', 'onKeydown', 'onKeyDown', 'onKeyUp', 'onMouseDown', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onPointerDown', 'onPointerMove', 'onPointerOut', 'onPointerOver', 'onScroll', 'onSelectionChange', 'onSubmit', 'onWheel']);
1407
1405
  const setOptionalAttribute = ($Element, attributeName, value) => {
@@ -1446,18 +1444,25 @@ const removeProp = ($Element, key) => {
1446
1444
  $Element.removeAttribute(attributeName);
1447
1445
  };
1448
1446
  const setProp = ($Element, key, value, eventMap, newEventMap) => {
1449
- const optionalAttributeName = optionalAttributeProps.get(key);
1450
- if (optionalAttributeName) {
1451
- setOptionalAttribute($Element, optionalAttributeName, value);
1452
- return;
1453
- }
1454
- const mappedAttributeName = mappedAttributeProps.get(key);
1455
- if (mappedAttributeName) {
1456
- $Element.setAttribute(mappedAttributeName, value);
1457
- return;
1458
- }
1459
- if (key === 'childCount' || key === 'type') {
1460
- return;
1447
+ switch (key) {
1448
+ case 'ariaActivedescendant':
1449
+ setOptionalAttribute($Element, 'aria-activedescendant', value);
1450
+ return;
1451
+ case 'ariaControls':
1452
+ $Element.setAttribute('aria-controls', value);
1453
+ return;
1454
+ case 'ariaDescribedBy':
1455
+ $Element.setAttribute('aria-describedby', value);
1456
+ return;
1457
+ case 'ariaInvalid':
1458
+ $Element.setAttribute('aria-invalid', value);
1459
+ return;
1460
+ case 'ariaLabelledBy':
1461
+ $Element.setAttribute('aria-labelledby', value);
1462
+ return;
1463
+ case 'ariaOwns':
1464
+ setOptionalAttribute($Element, 'aria-owns', value);
1465
+ return;
1461
1466
  }
1462
1467
  if (key === 'height' || key === 'width') {
1463
1468
  setDimension($Element, key, value);
@@ -1506,6 +1511,9 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
1506
1511
 
1507
1512
  const setProps = ($Element, props, eventMap, newEventMap) => {
1508
1513
  for (const key in props) {
1514
+ if (key === 'childCount' || key === 'type') {
1515
+ continue;
1516
+ }
1509
1517
  setProp($Element, key, props[key], eventMap, newEventMap);
1510
1518
  }
1511
1519
  };
@@ -1620,7 +1628,7 @@ const handleNavigateChild = (state, patches, patchIndex) => {
1620
1628
  return true;
1621
1629
  }
1622
1630
  const nextPatch = patches[patchIndex + 1];
1623
- if (nextPatch && nextPatch.type === Replace && patch.index === $Children.length) {
1631
+ if (nextPatch && (nextPatch.type === Replace || nextPatch.type === SetReferenceNodeUid) && patch.index === $Children.length) {
1624
1632
  const $Placeholder = document.createComment('virtual-dom-placeholder');
1625
1633
  state.current.append($Placeholder);
1626
1634
  state.current = $Placeholder;
@@ -3544,40 +3552,40 @@ const launchRendererWorker = async () => {
3544
3552
  });
3545
3553
  };
3546
3554
 
3547
- const state$7 = {
3555
+ const state$8 = {
3548
3556
  rpc: undefined
3549
3557
  };
3550
3558
  const hydrate$3 = async () => {
3551
3559
  const result = await launchRendererWorker();
3552
3560
  if (isError(result)) {
3553
- state$7.rpc = undefined;
3561
+ state$8.rpc = undefined;
3554
3562
  return result;
3555
3563
  }
3556
- state$7.rpc = result.value;
3564
+ state$8.rpc = result.value;
3557
3565
  return success(undefined);
3558
3566
  };
3559
3567
 
3560
3568
  // TODO needed?
3561
3569
  const dispose$j = () => {
3562
- if (state$7.rpc) {
3563
- state$7.rpc.dispose();
3570
+ if (state$8.rpc) {
3571
+ state$8.rpc.dispose();
3564
3572
  }
3565
3573
  };
3566
3574
  const send = (method, ...params) => {
3567
3575
  // @ts-ignore
3568
- state$7.rpc.send(method, ...params);
3576
+ state$8.rpc.send(method, ...params);
3569
3577
  };
3570
3578
  const invoke$1 = (method, ...params) => {
3571
3579
  // @ts-ignore
3572
- return state$7.rpc.invoke(method, ...params);
3580
+ return state$8.rpc.invoke(method, ...params);
3573
3581
  };
3574
3582
  const sendAndTransfer = message => {
3575
3583
  // @ts-expect-error
3576
- state$7.rpc.sendAndTransfer(message);
3584
+ state$8.rpc.sendAndTransfer(message);
3577
3585
  };
3578
3586
  const invokeAndTransfer = (method, ...params) => {
3579
3587
  // @ts-ignore
3580
- return state$7.rpc.invokeAndTransfer(method, ...params);
3588
+ return state$8.rpc.invokeAndTransfer(method, ...params);
3581
3589
  };
3582
3590
 
3583
3591
  const RendererWorker = {
@@ -3588,7 +3596,7 @@ const RendererWorker = {
3588
3596
  invokeAndTransfer,
3589
3597
  send,
3590
3598
  sendAndTransfer,
3591
- state: state$7
3599
+ state: state$8
3592
3600
  };
3593
3601
 
3594
3602
  const create$w = async ({
@@ -3663,7 +3671,7 @@ const setThemeColor = color => {
3663
3671
  };
3664
3672
 
3665
3673
  // TODO this file is not needed when all elements are position fixed
3666
- const state$6 = {
3674
+ const state$7 = {
3667
3675
  $Widgets: undefined,
3668
3676
  widgetSet: new Set()
3669
3677
  };
@@ -3675,20 +3683,20 @@ const create$Widgets = () => {
3675
3683
  };
3676
3684
  const append$1 = $Element => {
3677
3685
  // TODO should not call append in the first place if it is already in DOM
3678
- if (state$6.widgetSet.has($Element)) {
3686
+ if (state$7.widgetSet.has($Element)) {
3679
3687
  return;
3680
3688
  }
3681
- state$6.widgetSet.add($Element);
3682
- if (state$6.$Widgets) {
3689
+ state$7.widgetSet.add($Element);
3690
+ if (state$7.$Widgets) {
3683
3691
  // @ts-expect-error
3684
- state$6.$Widgets.append($Element);
3692
+ state$7.$Widgets.append($Element);
3685
3693
  } else {
3686
3694
  // @ts-expect-error
3687
- state$6.$Widgets = create$Widgets();
3695
+ state$7.$Widgets = create$Widgets();
3688
3696
  // @ts-expect-error
3689
- state$6.$Widgets.append($Element);
3697
+ state$7.$Widgets.append($Element);
3690
3698
  // @ts-expect-error
3691
- document.body.append(state$6.$Widgets);
3699
+ document.body.append(state$7.$Widgets);
3692
3700
  }
3693
3701
  };
3694
3702
  const remove$1 = $Element => {
@@ -3696,13 +3704,13 @@ const remove$1 = $Element => {
3696
3704
  // TODO $Element should always be defined
3697
3705
  return;
3698
3706
  }
3699
- state$6.widgetSet.delete($Element);
3707
+ state$7.widgetSet.delete($Element);
3700
3708
  $Element.remove();
3701
3709
  // TODO state.$Widgets should always be defined at this point
3702
- if (state$6.widgetSet.size === 0 && state$6.$Widgets) {
3710
+ if (state$7.widgetSet.size === 0 && state$7.$Widgets) {
3703
3711
  // @ts-expect-error
3704
- state$6.$Widgets.remove();
3705
- state$6.$Widgets = undefined;
3712
+ state$7.$Widgets.remove();
3713
+ state$7.$Widgets = undefined;
3706
3714
  }
3707
3715
  };
3708
3716
 
@@ -3761,14 +3769,14 @@ const dispose$i = id => {
3761
3769
  // const $Notification = state.$Notifications
3762
3770
  };
3763
3771
 
3764
- const state$5 = {
3772
+ const state$6 = {
3765
3773
  canvasObjects: Object.create(null)
3766
3774
  };
3767
3775
  const get$5 = id => {
3768
- return state$5.canvasObjects[id];
3776
+ return state$6.canvasObjects[id];
3769
3777
  };
3770
3778
  const set$6 = (canvasId, canvas) => {
3771
- state$5.canvasObjects[canvasId] = canvas;
3779
+ state$6.canvasObjects[canvasId] = canvas;
3772
3780
  };
3773
3781
 
3774
3782
  const get$4 = id => {
@@ -3882,16 +3890,16 @@ const findIndex = ($Container, $Target) => {
3882
3890
  return -1;
3883
3891
  };
3884
3892
 
3885
- const state$4 = {
3893
+ const state$5 = {
3886
3894
  /**
3887
3895
  * @type {HTMLElement|undefined}
3888
3896
  */
3889
3897
  $PreviousFocusElement: undefined};
3890
3898
  const setElement = $Element => {
3891
- state$4.$PreviousFocusElement = $Element;
3899
+ state$5.$PreviousFocusElement = $Element;
3892
3900
  };
3893
3901
  const getElement = () => {
3894
- return state$4.$PreviousFocusElement;
3902
+ return state$5.$PreviousFocusElement;
3895
3903
  };
3896
3904
 
3897
3905
  const focus$e = $Element => {
@@ -3980,7 +3988,7 @@ const FocusOutput = 28;
3980
3988
 
3981
3989
  // TODO keyboard handling
3982
3990
 
3983
- const state$3 = {
3991
+ const state$4 = {
3984
3992
  $$Menus: [],
3985
3993
  $BackDrop: undefined,
3986
3994
  anchorTime: -1,
@@ -3991,7 +3999,7 @@ const state$3 = {
3991
3999
  };
3992
4000
  const getLevel = $Menu => {
3993
4001
  // @ts-expect-error
3994
- return state$3.$$Menus.indexOf($Menu);
4002
+ return state$4.$$Menus.indexOf($Menu);
3995
4003
  };
3996
4004
  const handleMouseDown$4 = event => {
3997
4005
  const $Target = event.target;
@@ -4057,10 +4065,10 @@ const handleMouseLeave = event => {
4057
4065
 
4058
4066
  // const handleBlur = (event) => {}
4059
4067
  const handleKeyDown$5 = event => {
4060
- state$3.handleKeyDown(event);
4068
+ state$4.handleKeyDown(event);
4061
4069
  };
4062
4070
  const handleFocusOut$1 = event => {
4063
- state$3.handleFocusOut(event);
4071
+ state$4.handleFocusOut(event);
4064
4072
  };
4065
4073
  const create$Menu$1 = () => {
4066
4074
  // TODO set aria label on menu (e.g. File, Edit, Selection)
@@ -4088,7 +4096,7 @@ const create$Menu$1 = () => {
4088
4096
  return $Menu;
4089
4097
  };
4090
4098
  const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
4091
- const $Menu = state$3.$$Menus[level];
4099
+ const $Menu = state$4.$$Menus[level];
4092
4100
  if (oldFocusedIndex !== -1) {
4093
4101
  // @ts-expect-error
4094
4102
  $Menu.children[oldFocusedIndex].classList.remove('MenuItemFocused');
@@ -4110,9 +4118,9 @@ const handleBackDropMouseDown = event => {
4110
4118
  preventDefault(event);
4111
4119
  stopPropagation(event);
4112
4120
  send(/* Menu.hide */'Menu.hide');
4113
- if (state$3.$BackDrop) {
4114
- remove$1(state$3.$BackDrop);
4115
- state$3.$BackDrop = undefined;
4121
+ if (state$4.$BackDrop) {
4122
+ remove$1(state$4.$BackDrop);
4123
+ state$4.$BackDrop = undefined;
4116
4124
  }
4117
4125
  };
4118
4126
  const handleContextMenu$7 = event => {
@@ -4124,7 +4132,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4124
4132
  $BackDrop.onmousedown = handleBackDropMouseDown;
4125
4133
  $BackDrop.oncontextmenu = handleContextMenu$7;
4126
4134
  // @ts-expect-error
4127
- state$3.$BackDrop = $BackDrop;
4135
+ state$4.$BackDrop = $BackDrop;
4128
4136
  append$1($BackDrop);
4129
4137
  }
4130
4138
  const $Menu = create$Menu$1();
@@ -4132,7 +4140,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4132
4140
  setXAndY($Menu, x, y);
4133
4141
  $Menu.id = `Menu-${level}`;
4134
4142
  if (parentIndex !== -1) {
4135
- const $ParentMenu = state$3.$$Menus[level - 1];
4143
+ const $ParentMenu = state$4.$$Menus[level - 1];
4136
4144
  // @ts-expect-error
4137
4145
  const $ParentMenuItem = $ParentMenu.children[parentIndex];
4138
4146
  $ParentMenuItem.ariaExpanded = True;
@@ -4140,7 +4148,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4140
4148
  }
4141
4149
 
4142
4150
  // @ts-expect-error
4143
- state$3.$$Menus.push($Menu);
4151
+ state$4.$$Menus.push($Menu);
4144
4152
  append$1($Menu);
4145
4153
  if (level === 0) {
4146
4154
  focus$e($Menu);
@@ -4148,14 +4156,14 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4148
4156
  }
4149
4157
  };
4150
4158
  const hideSubmenu = level => {
4151
- const $$ChildMenus = state$3.$$Menus.slice(level);
4159
+ const $$ChildMenus = state$4.$$Menus.slice(level);
4152
4160
  for (const $ChildMenu of $$ChildMenus) {
4153
4161
  remove$1($ChildMenu);
4154
4162
  }
4155
- state$3.$$Menus = state$3.$$Menus.slice(0, level);
4156
- if (state$3.$$Menus.length === 0 && state$3.$BackDrop) {
4157
- remove$1(state$3.$BackDrop);
4158
- state$3.$BackDrop = undefined;
4163
+ state$4.$$Menus = state$4.$$Menus.slice(0, level);
4164
+ if (state$4.$$Menus.length === 0 && state$4.$BackDrop) {
4165
+ remove$1(state$4.$BackDrop);
4166
+ state$4.$BackDrop = undefined;
4159
4167
  }
4160
4168
  };
4161
4169
 
@@ -4197,9 +4205,9 @@ const showControlled = ({
4197
4205
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
4198
4206
  // it should be the other way around
4199
4207
  // @ts-expect-error
4200
- state$3.$Parent = $Parent;
4201
- state$3.handleFocusOut = handleFocusOut;
4202
- state$3.handleKeyDown = handleKeyDown;
4208
+ state$4.$Parent = $Parent;
4209
+ state$4.handleFocusOut = handleFocusOut;
4210
+ state$4.handleKeyDown = handleKeyDown;
4203
4211
  if ($Parent) {
4204
4212
  // state.$Menu.ariaLabel=''
4205
4213
  // state.$Menu.ariaLabelledBy =$Parent.id
@@ -4211,13 +4219,13 @@ const showControlled = ({
4211
4219
  // TODO have function to show submenu
4212
4220
 
4213
4221
  const hide = (restoreFocus = true) => {
4214
- for (const $Menu of state$3.$$Menus) {
4222
+ for (const $Menu of state$4.$$Menus) {
4215
4223
  remove$1($Menu);
4216
4224
  }
4217
- state$3.$$Menus = [];
4218
- if (state$3.$BackDrop) {
4219
- remove$1(state$3.$BackDrop);
4220
- state$3.$BackDrop = undefined;
4225
+ state$4.$$Menus = [];
4226
+ if (state$4.$BackDrop) {
4227
+ remove$1(state$4.$BackDrop);
4228
+ state$4.$BackDrop = undefined;
4221
4229
  }
4222
4230
  // TODO focus previous item
4223
4231
  if (restoreFocus) {
@@ -4970,6 +4978,28 @@ const checkConditionError = (fnName, ...params) => {
4970
4978
  return fn(...params);
4971
4979
  };
4972
4980
 
4981
+ const commandMap$2 = {
4982
+ 'TestFrameWork.checkConditionError': checkConditionError,
4983
+ 'TestFrameWork.checkMultiElementCondition': checkMultiElementCondition,
4984
+ 'TestFrameWork.checkSingleElementCondition': checkSingleElementCondition,
4985
+ 'TestFrameWork.performAction': performAction,
4986
+ 'TestFrameWork.performAction2': performAction2,
4987
+ 'TestFrameWork.performKeyBoardAction': performKeyboardAction,
4988
+ 'TestFrameWork.showOverlay': showOverlay,
4989
+ 'TestFrameWork.showTestResults': showTestResults
4990
+ };
4991
+ const state$3 = {
4992
+ rpc: undefined
4993
+ };
4994
+ const initialize = async port => {
4995
+ const rpc = await create$z({
4996
+ commandMap: commandMap$2,
4997
+ messagePort: port
4998
+ });
4999
+ await state$3.rpc?.dispose();
5000
+ state$3.rpc = rpc;
5001
+ };
5002
+
4973
5003
  const webViews = Object.create(null);
4974
5004
  const set$4 = (id, webView) => {
4975
5005
  webViews[id] = webView;
@@ -8122,8 +8152,8 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
8122
8152
  $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
8123
8153
  }
8124
8154
  $Viewlet.children[index].ariaExpanded = True;
8125
- const $$Menus = state$3.$$Menus;
8126
- state$3.$$Menus = [];
8155
+ const $$Menus = state$4.$$Menus;
8156
+ state$4.$$Menus = [];
8127
8157
  // @ts-expect-error
8128
8158
  showControlled({
8129
8159
  $Parent: $Viewlet.children[index],
@@ -9365,6 +9395,7 @@ const commandMap = {
9365
9395
  'TestFrameWork.showTestResults': showTestResults,
9366
9396
  'TestFrameWork.transfer': transfer,
9367
9397
  'TestFrameWork.transferToWebView': transferToWebView,
9398
+ 'TestWorkerRpc.initialize': initialize,
9368
9399
  'Viewlet.addKeyBindings': addKeyBindings,
9369
9400
  'Viewlet.appendViewlet': appendViewlet,
9370
9401
  'Viewlet.dispose': dispose$4,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.10.0",
3
+ "version": "30.11.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"