@lvce-editor/renderer-process 22.0.0 → 22.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.
@@ -10,7 +10,7 @@ class AssertionError extends Error {
10
10
  }
11
11
  }
12
12
  const Object$1 = 1;
13
- const Number = 2;
13
+ const Number$1 = 2;
14
14
  const Array$1 = 3;
15
15
  const String$1 = 4;
16
16
  const Boolean$1 = 5;
@@ -20,7 +20,7 @@ const Unknown$1 = 8;
20
20
  const getType = value => {
21
21
  switch (typeof value) {
22
22
  case 'number':
23
- return Number;
23
+ return Number$1;
24
24
  case 'function':
25
25
  return Function;
26
26
  case 'string':
@@ -47,7 +47,7 @@ const object = value => {
47
47
  };
48
48
  const number = value => {
49
49
  const type = getType(value);
50
- if (type !== Number) {
50
+ if (type !== Number$1) {
51
51
  throw new AssertionError('expected value to be of type number');
52
52
  }
53
53
  };
@@ -63,6 +63,12 @@ const string = value => {
63
63
  throw new AssertionError('expected value to be of type string');
64
64
  }
65
65
  };
66
+ const boolean = value => {
67
+ const type = getType(value);
68
+ if (type !== Boolean$1) {
69
+ throw new AssertionError('expected value to be of type boolean');
70
+ }
71
+ };
66
72
 
67
73
  const readText = async () => {
68
74
  return navigator.clipboard.readText();
@@ -661,6 +667,7 @@ const setProp = ($Element, key, value, eventMap, newEventMap) => {
661
667
  case 'onMouseMove':
662
668
  case 'onMouseOut':
663
669
  case 'onMouseOver':
670
+ case 'onMouseUp':
664
671
  case 'onPointerDown':
665
672
  case 'onPointerMove':
666
673
  case 'onPointerOut':
@@ -857,7 +864,7 @@ const enabled = () => {
857
864
  return ignore;
858
865
  };
859
866
  let id$1 = 0;
860
- const create$D = () => {
867
+ const create$E = () => {
861
868
  return ++id$1;
862
869
  };
863
870
  const state$8 = Object.create(null);
@@ -872,7 +879,7 @@ const getFileHandles$1 = async ids => {
872
879
  return handles;
873
880
  };
874
881
  const add = promise => {
875
- const id = create$D();
882
+ const id = create$E();
876
883
  state$8[id] = promise;
877
884
  return id;
878
885
  };
@@ -1518,7 +1525,7 @@ const getWorkerDisplayName$1 = name => {
1518
1525
  }
1519
1526
  return `${name} worker`;
1520
1527
  };
1521
- const create$C = async ({
1528
+ const create$D = async ({
1522
1529
  name,
1523
1530
  url
1524
1531
  }) => {
@@ -1585,7 +1592,7 @@ const wrap = worker => {
1585
1592
 
1586
1593
  const IpcParentWithModuleWorker$2 = {
1587
1594
  __proto__: null,
1588
- create: create$C,
1595
+ create: create$D,
1589
1596
  wrap
1590
1597
  };
1591
1598
 
@@ -1593,7 +1600,7 @@ const isMessagePort$1 = value => {
1593
1600
  return value instanceof MessagePort;
1594
1601
  };
1595
1602
 
1596
- const create$B = async ({
1603
+ const create$C = async ({
1597
1604
  url
1598
1605
  }) => {
1599
1606
  string(url);
@@ -1614,10 +1621,10 @@ const create$B = async ({
1614
1621
 
1615
1622
  const IpcParentWithMessagePort$2 = {
1616
1623
  __proto__: null,
1617
- create: create$B
1624
+ create: create$C
1618
1625
  };
1619
1626
 
1620
- const create$A = async url => {
1627
+ const create$B = async url => {
1621
1628
  const referencePort = await new Promise(resolve => {
1622
1629
  globalThis.acceptReferencePort = resolve;
1623
1630
  import(url);
@@ -1628,7 +1635,7 @@ const create$A = async url => {
1628
1635
 
1629
1636
  const IpcParentWithReferencePort = {
1630
1637
  __proto__: null,
1631
- create: create$A
1638
+ create: create$B
1632
1639
  };
1633
1640
 
1634
1641
  const normalizeLine = line => {
@@ -2397,7 +2404,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
2397
2404
  const errorProperty = getErrorProperty(error, prettyError);
2398
2405
  return create$1$1(id, errorProperty);
2399
2406
  };
2400
- const create$z = (message, result) => {
2407
+ const create$A = (message, result) => {
2401
2408
  return {
2402
2409
  jsonrpc: Two$1,
2403
2410
  id: message.id,
@@ -2406,7 +2413,7 @@ const create$z = (message, result) => {
2406
2413
  };
2407
2414
  const getSuccessResponse = (message, result) => {
2408
2415
  const resultProperty = result ?? null;
2409
- return create$z(message, resultProperty);
2416
+ return create$A(message, resultProperty);
2410
2417
  };
2411
2418
  const getErrorResponseSimple = (id, error) => {
2412
2419
  return {
@@ -2733,7 +2740,7 @@ const PlainMessagePortRpcParent = {
2733
2740
  };
2734
2741
 
2735
2742
  // TODO add test
2736
- const create$y = async ({
2743
+ const create$z = async ({
2737
2744
  name,
2738
2745
  port,
2739
2746
  url
@@ -2749,7 +2756,7 @@ const create$y = async ({
2749
2756
 
2750
2757
  const IpcParentWithModuleWorkerWithMessagePort = {
2751
2758
  __proto__: null,
2752
- create: create$y
2759
+ create: create$z
2753
2760
  };
2754
2761
 
2755
2762
  const Web = 1;
@@ -2782,7 +2789,7 @@ const platform = getPlatform();
2782
2789
  const isElectron = platform === Electron;
2783
2790
 
2784
2791
  // TODO use handleIncomingIpc function
2785
- const create$x = async ({
2792
+ const create$y = async ({
2786
2793
  ipcId,
2787
2794
  port
2788
2795
  }) => {
@@ -2800,7 +2807,7 @@ const create$x = async ({
2800
2807
 
2801
2808
  const IpcParentWithElectron = {
2802
2809
  __proto__: null,
2803
- create: create$x
2810
+ create: create$y
2804
2811
  };
2805
2812
 
2806
2813
  const getModule = method => {
@@ -2911,7 +2918,7 @@ const hydrate$3 = async () => {
2911
2918
  };
2912
2919
 
2913
2920
  // TODO needed?
2914
- const dispose$h = () => {
2921
+ const dispose$i = () => {
2915
2922
  if (state$7.rpc) {
2916
2923
  // @ts-expect-error
2917
2924
  state$7.rpc.dispose();
@@ -2936,7 +2943,7 @@ const invokeAndTransfer = (method, ...params) => {
2936
2943
 
2937
2944
  const RendererWorker = {
2938
2945
  __proto__: null,
2939
- dispose: dispose$h,
2946
+ dispose: dispose$i,
2940
2947
  hydrate: hydrate$3,
2941
2948
  invoke: invoke$1,
2942
2949
  invokeAndTransfer,
@@ -2945,7 +2952,7 @@ const RendererWorker = {
2945
2952
  state: state$7
2946
2953
  };
2947
2954
 
2948
- const create$w = async ({
2955
+ const create$x = async ({
2949
2956
  method,
2950
2957
  ...options
2951
2958
  }) => {
@@ -3066,7 +3073,7 @@ const create$Notification = message => {
3066
3073
  $Notification.textContent = message;
3067
3074
  return $Notification;
3068
3075
  };
3069
- const create$v = (type, message) => {
3076
+ const create$w = (type, message) => {
3070
3077
  // TODO this pattern might be also useful for activitybar, sidebar etc., creating elements as late as possible, only when actually needed
3071
3078
  const $Notification = create$Notification(message);
3072
3079
  append$1($Notification);
@@ -3111,7 +3118,7 @@ const createWithOptions = (type, message, options) => {
3111
3118
  const $Notification = create$NotificationWithOptions(message, options);
3112
3119
  append$1($Notification);
3113
3120
  };
3114
- const dispose$g = id => {
3121
+ const dispose$h = id => {
3115
3122
  // const $Notification = state.$Notifications
3116
3123
  };
3117
3124
 
@@ -3128,7 +3135,7 @@ const set$6 = (canvasId, canvas) => {
3128
3135
  const get$4 = id => {
3129
3136
  return get$5(id);
3130
3137
  };
3131
- const create$u = async (canvasId, objectId) => {
3138
+ const create$v = async (canvasId, objectId) => {
3132
3139
  const canvas = document.createElement('canvas');
3133
3140
  const offscreenCanvas = canvas.transferControlToOffscreen();
3134
3141
  set$6(canvasId, canvas);
@@ -3256,7 +3263,7 @@ const getElement = () => {
3256
3263
  return state$4.$PreviousFocusElement;
3257
3264
  };
3258
3265
 
3259
- const focus$d = $Element => {
3266
+ const focus$e = $Element => {
3260
3267
  if ($Element === document.activeElement) {
3261
3268
  return;
3262
3269
  }
@@ -3425,10 +3432,10 @@ const handleMouseLeave = event => {
3425
3432
  const handleKeyDown$5 = event => {
3426
3433
  state$3.handleKeyDown(event);
3427
3434
  };
3428
- const handleFocusOut = event => {
3435
+ const handleFocusOut$1 = event => {
3429
3436
  state$3.handleFocusOut(event);
3430
3437
  };
3431
- const create$Menu = () => {
3438
+ const create$Menu$1 = () => {
3432
3439
  // TODO set aria label on menu (e.g. File, Edit, Selection)
3433
3440
  const $Menu = document.createElement('ul');
3434
3441
  $Menu.className = 'Menu';
@@ -3447,7 +3454,7 @@ const create$Menu = () => {
3447
3454
  // passive: true,
3448
3455
  // })
3449
3456
  $Menu.onkeydown = handleKeyDown$5;
3450
- $Menu.addEventListener(FocusOut, handleFocusOut);
3457
+ $Menu.addEventListener(FocusOut, handleFocusOut$1);
3451
3458
  $Menu.oncontextmenu = handleContextMenu$8;
3452
3459
  // $ContextMenu.onfocus = handleFocus
3453
3460
  // $ContextMenu.onblur = handleBlur
@@ -3489,7 +3496,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mous
3489
3496
  state$3.$BackDrop = $BackDrop;
3490
3497
  append$1($BackDrop);
3491
3498
  }
3492
- const $Menu = create$Menu();
3499
+ const $Menu = create$Menu$1();
3493
3500
  renderInto($Menu, dom);
3494
3501
  setXAndY($Menu, x, y);
3495
3502
  $Menu.id = `Menu-${level}`;
@@ -3505,7 +3512,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom, mous
3505
3512
  state$3.$$Menus.push($Menu);
3506
3513
  append$1($Menu);
3507
3514
  if (level === 0) {
3508
- focus$d($Menu);
3515
+ focus$e($Menu);
3509
3516
  send('Focus.setFocus', FocusMenu);
3510
3517
  }
3511
3518
  };
@@ -4230,6 +4237,12 @@ const transferToWebView = objectId => {
4230
4237
  }, '*', [port]);
4231
4238
  };
4232
4239
 
4240
+ const attachEvents$6 = ($Node, eventMap) => {
4241
+ for (const [key, value] of Object.entries(eventMap)) {
4242
+ $Node.addEventListener(key, value);
4243
+ }
4244
+ };
4245
+
4233
4246
  const set$3 = setComponentUid;
4234
4247
  const get = getComponentUid;
4235
4248
  const fromEvent = getComponentUidFromEvent;
@@ -4299,7 +4312,7 @@ const showError = (message, y, x) => {
4299
4312
  $ImagePreviewImage
4300
4313
  };
4301
4314
  };
4302
- const create$t = (uri, top, left) => {
4315
+ const create$u = (uri, top, left) => {
4303
4316
  const $ImagePreviewImage = document.createElement('img');
4304
4317
  $ImagePreviewImage.className = 'ImagePreviewImage';
4305
4318
  $ImagePreviewImage.src = uri;
@@ -4324,14 +4337,14 @@ const create$t = (uri, top, left) => {
4324
4337
  const update = (state, uri) => {
4325
4338
  state.$ImagePreviewImage.uri = uri;
4326
4339
  };
4327
- const dispose$f = state => {
4340
+ const dispose$g = state => {
4328
4341
  remove$1(state.$ImagePreview);
4329
4342
  };
4330
4343
 
4331
4344
  const ImagePreview$1 = {
4332
4345
  __proto__: null,
4333
- create: create$t,
4334
- dispose: dispose$f,
4346
+ create: create$u,
4347
+ dispose: dispose$g,
4335
4348
  showError,
4336
4349
  update
4337
4350
  };
@@ -4387,7 +4400,7 @@ const handleContextMenu$7 = event => {
4387
4400
  } = event;
4388
4401
  return ['handleContextMenu', button, clientX, clientY];
4389
4402
  };
4390
- const returnValue$7 = true;
4403
+ const returnValue$8 = true;
4391
4404
 
4392
4405
  const ViewletActivityBarEvents = {
4393
4406
  __proto__: null,
@@ -4395,14 +4408,14 @@ const ViewletActivityBarEvents = {
4395
4408
  handleContextMenu: handleContextMenu$7,
4396
4409
  handleFocus: handleFocus$9,
4397
4410
  handleMouseDown: handleMouseDown$3,
4398
- returnValue: returnValue$7
4411
+ returnValue: returnValue$8
4399
4412
  };
4400
4413
 
4401
- const Events$4 = ViewletActivityBarEvents;
4414
+ const Events$5 = ViewletActivityBarEvents;
4402
4415
 
4403
4416
  const ViewletActivityBar = {
4404
4417
  __proto__: null,
4405
- Events: Events$4
4418
+ Events: Events$5
4406
4419
  };
4407
4420
 
4408
4421
  const executeViewletCommand = (uid, command, ...args) => {
@@ -4427,7 +4440,7 @@ const forwardViewletCommand = name => {
4427
4440
  forwardViewletCommand('clearFilter');
4428
4441
  forwardViewletCommand('close');
4429
4442
  forwardViewletCommand('closeEditor');
4430
- forwardViewletCommand('closeMenu');
4443
+ const closeMenu$1 = forwardViewletCommand('closeMenu');
4431
4444
  forwardViewletCommand('compositionEnd');
4432
4445
  forwardViewletCommand('compositionStart');
4433
4446
  forwardViewletCommand('compositionUpdate');
@@ -4441,7 +4454,7 @@ forwardViewletCommand('handleBeforeInput');
4441
4454
  forwardViewletCommand('handleBeforeInputFromContentEditable');
4442
4455
  const handleBlur$8 = forwardViewletCommand('handleBlur');
4443
4456
  const handleButtonClick = forwardViewletCommand('handleButtonClick');
4444
- const handleClick$5 = forwardViewletCommand('handleClick');
4457
+ const handleClick$6 = forwardViewletCommand('handleClick');
4445
4458
  const handleClickAction$2 = forwardViewletCommand('handleClickAction');
4446
4459
  forwardViewletCommand('handleClickAdd');
4447
4460
  const handleClickAt$3 = forwardViewletCommand('handleClickAt');
@@ -4468,15 +4481,15 @@ forwardViewletCommand('handleClickDisable');
4468
4481
  forwardViewletCommand('handleClickUninstall');
4469
4482
  forwardViewletCommand('handleFilterInput');
4470
4483
  const handleFocus$8 = forwardViewletCommand('handleFocus');
4471
- const handleFocusIn$3 = forwardViewletCommand('handleFocusIn');
4484
+ const handleFocusIn$4 = forwardViewletCommand('handleFocusIn');
4472
4485
  forwardViewletCommand('handleIconError');
4473
4486
  const handleImageError = forwardViewletCommand('handleImageError');
4474
4487
  const handleInput$6 = forwardViewletCommand('handleInput');
4475
4488
  const handleKeyDown$4 = forwardViewletCommand('handleKeyDown');
4476
4489
  forwardViewletCommand('handleListBlur');
4477
4490
  forwardViewletCommand('handleListFocus');
4478
- forwardViewletCommand('handleMenuClick');
4479
- forwardViewletCommand('handleMenuMouseOver');
4491
+ const handleMenuClick$1 = forwardViewletCommand('handleMenuClick');
4492
+ const handleMenuMouseOver$1 = forwardViewletCommand('handleMenuMouseOver');
4480
4493
  const handleMouseDown$2 = forwardViewletCommand('handleMouseDown');
4481
4494
  forwardViewletCommand('handleMouseMove');
4482
4495
  const handleMouseOut$1 = forwardViewletCommand('handleMouseOut');
@@ -4548,21 +4561,21 @@ const ViewletAudioEvents = {
4548
4561
  handleAudioError
4549
4562
  };
4550
4563
 
4551
- const Events$3 = ViewletAudioEvents;
4564
+ const Events$4 = ViewletAudioEvents;
4552
4565
 
4553
4566
  const ViewletAudio = {
4554
4567
  __proto__: null,
4555
- Events: Events$3
4568
+ Events: Events$4
4556
4569
  };
4557
4570
 
4558
- const create$s = () => {
4571
+ const create$t = () => {
4559
4572
  const $Viewlet = document.createElement('div');
4560
4573
  $Viewlet.className = 'Viewlet Clock';
4561
4574
  return {
4562
4575
  $Viewlet
4563
4576
  };
4564
4577
  };
4565
- const dispose$e = state => {};
4578
+ const dispose$f = state => {};
4566
4579
  const refresh$4 = () => {};
4567
4580
  const setTime = (state, time) => {
4568
4581
  object(state);
@@ -4572,8 +4585,8 @@ const setTime = (state, time) => {
4572
4585
 
4573
4586
  const ViewletClock = {
4574
4587
  __proto__: null,
4575
- create: create$s,
4576
- dispose: dispose$e,
4588
+ create: create$t,
4589
+ dispose: dispose$f,
4577
4590
  refresh: refresh$4,
4578
4591
  setTime
4579
4592
  };
@@ -4601,7 +4614,7 @@ const stopTracking$1 = ($Target, pointerId, handlePointerMove, handlePointerUp)
4601
4614
  // TODO use pointerlost event instead
4602
4615
  $Target.removeEventListener(PointerUp, handlePointerUp);
4603
4616
  };
4604
- const create$r = (pointerDown, pointerMove, pointerUp) => {
4617
+ const create$s = (pointerDown, pointerMove, pointerUp) => {
4605
4618
  const shared = (fn, event) => {
4606
4619
  const message = fn(event);
4607
4620
  if (!message || message.length === 0) {
@@ -4634,7 +4647,7 @@ const create$r = (pointerDown, pointerMove, pointerUp) => {
4634
4647
  };
4635
4648
 
4636
4649
  const handleOffset = 20;
4637
- const handleSliderPointerDown = create$r(event => {
4650
+ const handleSliderPointerDown = create$s(event => {
4638
4651
  const {
4639
4652
  clientX,
4640
4653
  clientY
@@ -4658,12 +4671,12 @@ const handlePointerDown$2 = event => {
4658
4671
  }
4659
4672
  return [];
4660
4673
  };
4661
- const returnValue$6 = true;
4674
+ const returnValue$7 = true;
4662
4675
 
4663
4676
  const ViewletColorPickerEvents = {
4664
4677
  __proto__: null,
4665
4678
  handlePointerDown: handlePointerDown$2,
4666
- returnValue: returnValue$6
4679
+ returnValue: returnValue$7
4667
4680
  };
4668
4681
 
4669
4682
  const setColor = (state, color) => {
@@ -4716,14 +4729,14 @@ const ViewletDebugConsoleEvents = {
4716
4729
  handleInput: handleInput$5
4717
4730
  };
4718
4731
 
4719
- const create$q = () => {
4732
+ const create$r = () => {
4720
4733
  const $Viewlet = document.createElement('div');
4721
4734
  $Viewlet.className = 'Viewlet DebugConsole';
4722
4735
  return {
4723
4736
  $Viewlet
4724
4737
  };
4725
4738
  };
4726
- const setDom$8 = (state, dom) => {
4739
+ const setDom$9 = (state, dom) => {
4727
4740
  const {
4728
4741
  $Viewlet
4729
4742
  } = state;
@@ -4732,8 +4745,8 @@ const setDom$8 = (state, dom) => {
4732
4745
 
4733
4746
  const ViewletDebugConsole = {
4734
4747
  __proto__: null,
4735
- create: create$q,
4736
- setDom: setDom$8
4748
+ create: create$r,
4749
+ setDom: setDom$9
4737
4750
  };
4738
4751
 
4739
4752
  const handleKeyDown$3 = event => {
@@ -4769,7 +4782,7 @@ const setValue$2 = (state, value) => {
4769
4782
  const $Input = $Viewlet.querySelector('input');
4770
4783
  $Input.value = value;
4771
4784
  };
4772
- const focus$c = state => {
4785
+ const focus$d = state => {
4773
4786
  const {
4774
4787
  $Viewlet
4775
4788
  } = state;
@@ -4780,7 +4793,7 @@ const focus$c = state => {
4780
4793
  const ViewletDefineKeyBinding = {
4781
4794
  __proto__: null,
4782
4795
  Events: ViewletDefineKeyBindingEvents,
4783
- focus: focus$c,
4796
+ focus: focus$d,
4784
4797
  setValue: setValue$2
4785
4798
  };
4786
4799
 
@@ -4793,7 +4806,7 @@ const setMaskImage = ($Element, icon) => {
4793
4806
  }
4794
4807
  };
4795
4808
 
4796
- const create$p = icon => {
4809
+ const create$q = icon => {
4797
4810
  const $Icon = document.createElement('div');
4798
4811
  $Icon.className = 'MaskIcon';
4799
4812
  setMaskImage($Icon, icon);
@@ -4803,7 +4816,7 @@ const create$p = icon => {
4803
4816
 
4804
4817
  const create$Button = (label, icon) => {
4805
4818
  // TODO icon div might not be needed (unnecessary html element)
4806
- const $Icon = create$p(icon);
4819
+ const $Icon = create$q(icon);
4807
4820
  const $Button = document.createElement('button');
4808
4821
  $Button.className = 'IconButton';
4809
4822
  $Button.title = label;
@@ -4812,19 +4825,19 @@ const create$Button = (label, icon) => {
4812
4825
  return $Button;
4813
4826
  };
4814
4827
 
4815
- const handleClick$4 = index => {
4828
+ const handleClick$5 = index => {
4816
4829
  send(/* Dialog.handleClick */'Dialog.handleClick', /* index */index);
4817
4830
  };
4818
4831
 
4819
- const handleClick$3 = event => {
4832
+ const handleClick$4 = event => {
4820
4833
  const {
4821
4834
  target
4822
4835
  } = event;
4823
4836
  const index = getNodeIndex(target);
4824
- handleClick$4(index);
4837
+ handleClick$5(index);
4825
4838
  };
4826
4839
 
4827
- const create$o = () => {
4840
+ const create$p = () => {
4828
4841
  const $DialogTitle = document.createElement('h2');
4829
4842
  $DialogTitle.id = 'DialogTitle';
4830
4843
  const $DialogCloseButton = create$Button('Close', 'Close');
@@ -4851,7 +4864,7 @@ const create$o = () => {
4851
4864
  $Dialog.setAttribute(AriaLabelledBy, 'DialogTitle');
4852
4865
  $Dialog.setAttribute(AriaDescribedBy, 'DialogBodyErrorMessage');
4853
4866
  $Dialog.append($DialogHeader, $DialogBody);
4854
- $Dialog.onclick = handleClick$3;
4867
+ $Dialog.onclick = handleClick$4;
4855
4868
  return {
4856
4869
  $DialogBodyErrorCodeFrame,
4857
4870
  $DialogBodyErrorMessage,
@@ -4905,7 +4918,7 @@ const setErrorStack = (state, errorStack) => {
4905
4918
 
4906
4919
  const ViewletDialog = {
4907
4920
  __proto__: null,
4908
- create: create$o,
4921
+ create: create$p,
4909
4922
  postAppend,
4910
4923
  setButtons,
4911
4924
  setCodeFrame,
@@ -4968,7 +4981,7 @@ const handleContextMenu$5 = event => {
4968
4981
  } = event;
4969
4982
  return ['handleContextMenu', button, clientX, clientY];
4970
4983
  };
4971
- const handleSashCornerPointerDown = create$r(event => {
4984
+ const handleSashCornerPointerDown = create$s(event => {
4972
4985
  const {
4973
4986
  clientX,
4974
4987
  clientY
@@ -4987,7 +5000,7 @@ const handleSashCornerPointerDown = create$r(event => {
4987
5000
  } = event;
4988
5001
  return ['handleSashCornerPointerUp', clientX, clientY];
4989
5002
  });
4990
- const returnValue$5 = true;
5003
+ const returnValue$6 = true;
4991
5004
 
4992
5005
  const ViewletE2eTestEvents = {
4993
5006
  __proto__: null,
@@ -4995,7 +5008,7 @@ const ViewletE2eTestEvents = {
4995
5008
  handleContextMenu: handleContextMenu$5,
4996
5009
  handleLoad: handleLoad$3,
4997
5010
  handleSashCornerPointerDown,
4998
- returnValue: returnValue$5
5011
+ returnValue: returnValue$6
4999
5012
  };
5000
5013
 
5001
5014
  // TODO could use browser view when running in electron
@@ -5065,14 +5078,14 @@ const handleContextMenu$4 = event => {
5065
5078
  } = event;
5066
5079
  return ['handleContextMenu', button, clientX, clientY];
5067
5080
  };
5068
- const returnValue$4 = true;
5081
+ const returnValue$5 = true;
5069
5082
 
5070
5083
  const ViewletE2eTestsEvents = {
5071
5084
  __proto__: null,
5072
5085
  handleClickAt: handleClickAt$1,
5073
5086
  handleContextMenu: handleContextMenu$4,
5074
5087
  handleLoad: handleLoad$2,
5075
- returnValue: returnValue$4
5088
+ returnValue: returnValue$5
5076
5089
  };
5077
5090
 
5078
5091
  const sendToIframe = (contentWindow, message, origin, transfer) => {
@@ -5137,10 +5150,10 @@ const ViewletE2eTests = {
5137
5150
 
5138
5151
  const Script = 2;
5139
5152
 
5140
- const handleFocusIn$2 = event => {
5153
+ const handleFocusIn$3 = event => {
5141
5154
  preventDefault(event);
5142
5155
  const uid = fromEvent(event);
5143
- handleFocusIn$3(uid);
5156
+ handleFocusIn$4(uid);
5144
5157
  };
5145
5158
  const handleBlur$6 = event => {
5146
5159
  preventDefault(event);
@@ -5151,7 +5164,7 @@ const handleBlur$6 = event => {
5151
5164
  const ViewletEditorCodeGeneratorEvents = {
5152
5165
  __proto__: null,
5153
5166
  handleBlur: handleBlur$6,
5154
- handleFocusIn: handleFocusIn$2
5167
+ handleFocusIn: handleFocusIn$3
5155
5168
  };
5156
5169
 
5157
5170
  const setBounds$9 = (state, x, y, width, height) => {
@@ -5167,10 +5180,10 @@ const appendWidget$5 = state => {
5167
5180
  } = state;
5168
5181
  append$1($Viewlet);
5169
5182
  };
5170
- const dispose$d = state => {
5183
+ const dispose$e = state => {
5171
5184
  remove$1(state.$Viewlet);
5172
5185
  };
5173
- const focus$b = (state, key, source) => {
5186
+ const focus$c = (state, key, source) => {
5174
5187
  if (!key) {
5175
5188
  return;
5176
5189
  }
@@ -5193,17 +5206,11 @@ const ViewletEditorCodeGenerator = {
5193
5206
  __proto__: null,
5194
5207
  Events: ViewletEditorCodeGeneratorEvents,
5195
5208
  appendWidget: appendWidget$5,
5196
- dispose: dispose$d,
5197
- focus: focus$b,
5209
+ dispose: dispose$e,
5210
+ focus: focus$c,
5198
5211
  setBounds: setBounds$9
5199
5212
  };
5200
5213
 
5201
- const attachEvents$6 = ($Node, eventMap) => {
5202
- for (const [key, value] of Object.entries(eventMap)) {
5203
- $Node.addEventListener(key, value);
5204
- }
5205
- };
5206
-
5207
5214
  const Passive = {
5208
5215
  passive: true
5209
5216
  };
@@ -5317,7 +5324,7 @@ const setNegativeMargin = (state, negativeMargin) => {
5317
5324
  setTop($ListItems, negativeMargin);
5318
5325
  };
5319
5326
 
5320
- const create$n = () => {
5327
+ const create$o = () => {
5321
5328
  const $ListItems = document.createElement('div');
5322
5329
  $ListItems.className = 'ListItems';
5323
5330
  $ListItems.role = ListBox;
@@ -5358,7 +5365,7 @@ const attachEvents$5 = state => {
5358
5365
  // TODO show should be passed active cursor position
5359
5366
  // this would make this function easier to test as it would avoid dependency on globals of other files
5360
5367
 
5361
- const setDom$7 = (state, dom) => {
5368
+ const setDom$8 = (state, dom) => {
5362
5369
  const {
5363
5370
  $ListItems,
5364
5371
  $Viewlet
@@ -5370,7 +5377,7 @@ const setDom$7 = (state, dom) => {
5370
5377
  // TODO recycle nodes
5371
5378
  // TODO set right aria attributes on $EditorInput
5372
5379
  };
5373
- const dispose$c = state => {
5380
+ const dispose$d = state => {
5374
5381
  remove$1(state.$Viewlet);
5375
5382
  // state.$EditorInput.removeAttribute('aria-activedescendant')
5376
5383
  };
@@ -5401,12 +5408,12 @@ const setBounds$8 = (state, x, y, width, height) => {
5401
5408
  const ViewletEditorCompletion = {
5402
5409
  __proto__: null,
5403
5410
  attachEvents: attachEvents$5,
5404
- create: create$n,
5405
- dispose: dispose$c,
5411
+ create: create$o,
5412
+ dispose: dispose$d,
5406
5413
  handleError: handleError$6,
5407
5414
  setBounds: setBounds$8,
5408
5415
  setContentHeight,
5409
- setDom: setDom$7,
5416
+ setDom: setDom$8,
5410
5417
  setNegativeMargin,
5411
5418
  setScrollBar: setScrollBar$2,
5412
5419
  setSize,
@@ -5416,15 +5423,15 @@ const ViewletEditorCompletion = {
5416
5423
  const handleClose = () => {
5417
5424
  return ['closeDetails'];
5418
5425
  };
5419
- const returnValue$3 = true;
5426
+ const returnValue$4 = true;
5420
5427
 
5421
5428
  const ViewletEditorCompletionDetailsEvents = {
5422
5429
  __proto__: null,
5423
5430
  handleClose,
5424
- returnValue: returnValue$3
5431
+ returnValue: returnValue$4
5425
5432
  };
5426
5433
 
5427
- const create$m = () => {
5434
+ const create$n = () => {
5428
5435
  const $Viewlet = document.createElement('div');
5429
5436
  $Viewlet.className = 'Viewlet EditorCompletionDetails';
5430
5437
  $Viewlet.id = 'CompletionsDetails';
@@ -5435,7 +5442,7 @@ const create$m = () => {
5435
5442
  const attachEvents$4 = state => {
5436
5443
  // TODO
5437
5444
  };
5438
- const setDom$6 = (state, dom) => {
5445
+ const setDom$7 = (state, dom) => {
5439
5446
  const {
5440
5447
  $Viewlet
5441
5448
  } = state;
@@ -5450,7 +5457,7 @@ const appendWidget$4 = state => {
5450
5457
  } = state;
5451
5458
  append$1($Viewlet);
5452
5459
  };
5453
- const dispose$b = state => {
5460
+ const dispose$c = state => {
5454
5461
  remove$1(state.$Viewlet);
5455
5462
  };
5456
5463
  const setBounds$7 = (state, x, y, width, height) => {
@@ -5465,10 +5472,10 @@ const ViewletEditorCompletionDetails = {
5465
5472
  Events: ViewletEditorCompletionDetailsEvents,
5466
5473
  appendWidget: appendWidget$4,
5467
5474
  attachEvents: attachEvents$4,
5468
- create: create$m,
5469
- dispose: dispose$b,
5475
+ create: create$n,
5476
+ dispose: dispose$c,
5470
5477
  setBounds: setBounds$7,
5471
- setDom: setDom$6
5478
+ setDom: setDom$7
5472
5479
  };
5473
5480
 
5474
5481
  // TODO not sure whether created dom node
@@ -5484,14 +5491,14 @@ const ViewletEditorCompletionDetails = {
5484
5491
 
5485
5492
  // TODO aria alert
5486
5493
 
5487
- const create$l = () => {
5494
+ const create$m = () => {
5488
5495
  const $Viewlet = document.createElement('div');
5489
5496
  $Viewlet.className = 'Viewlet EditorError';
5490
5497
  return {
5491
5498
  $Viewlet
5492
5499
  };
5493
5500
  };
5494
- const setDom$5 = (state, dom) => {
5501
+ const setDom$6 = (state, dom) => {
5495
5502
  const {
5496
5503
  $Viewlet
5497
5504
  } = state;
@@ -5506,13 +5513,13 @@ const setBounds$6 = (state, x, y, width, height) => {
5506
5513
 
5507
5514
  const ViewletEditorError = {
5508
5515
  __proto__: null,
5509
- create: create$l,
5516
+ create: create$m,
5510
5517
  setBounds: setBounds$6,
5511
- setDom: setDom$5
5518
+ setDom: setDom$6
5512
5519
  };
5513
5520
 
5514
- const returnValue$2 = true;
5515
- const handleSashPointerDown$2 = create$r(event => {
5521
+ const returnValue$3 = true;
5522
+ const handleSashPointerDown$2 = create$s(event => {
5516
5523
  const {
5517
5524
  clientX,
5518
5525
  clientY
@@ -5535,7 +5542,7 @@ const handleSashPointerDown$2 = create$r(event => {
5535
5542
  const ViewletEditorHoverEvents = {
5536
5543
  __proto__: null,
5537
5544
  handleSashPointerDown: handleSashPointerDown$2,
5538
- returnValue: returnValue$2
5545
+ returnValue: returnValue$3
5539
5546
  };
5540
5547
 
5541
5548
  const setBounds$5 = (state, x, y, width, height) => {
@@ -5551,7 +5558,7 @@ const appendWidget$3 = state => {
5551
5558
  } = state;
5552
5559
  append$1($Viewlet);
5553
5560
  };
5554
- const setDom$4 = (state, dom) => {
5561
+ const setDom$5 = (state, dom) => {
5555
5562
  const {
5556
5563
  $Viewlet
5557
5564
  } = state;
@@ -5563,7 +5570,7 @@ const ViewletEditorHover = {
5563
5570
  Events: ViewletEditorHoverEvents,
5564
5571
  appendWidget: appendWidget$3,
5565
5572
  setBounds: setBounds$5,
5566
- setDom: setDom$4
5573
+ setDom: setDom$5
5567
5574
  };
5568
5575
 
5569
5576
  const LeftClick = 0;
@@ -5665,7 +5672,7 @@ const handleFocus$6 = event => {
5665
5672
  handleFocus$8(uid);
5666
5673
  };
5667
5674
 
5668
- const create$k = () => {
5675
+ const create$l = () => {
5669
5676
  const $Viewlet = document.createElement('div');
5670
5677
  $Viewlet.className = 'Viewlet EditorImage';
5671
5678
  return {
@@ -5698,7 +5705,7 @@ const setDragging = (state, isDragging) => {
5698
5705
  } = state;
5699
5706
  $Viewlet.classList.toggle('Dragging', isDragging);
5700
5707
  };
5701
- const setDom$3 = (state, dom) => {
5708
+ const setDom$4 = (state, dom) => {
5702
5709
  const {
5703
5710
  $Viewlet
5704
5711
  } = state;
@@ -5708,13 +5715,13 @@ const setDom$3 = (state, dom) => {
5708
5715
  const ViewletEditorImage = {
5709
5716
  __proto__: null,
5710
5717
  attachEvents: attachEvents$3,
5711
- create: create$k,
5712
- setDom: setDom$3,
5718
+ create: create$l,
5719
+ setDom: setDom$4,
5713
5720
  setDragging,
5714
5721
  setTransform
5715
5722
  };
5716
5723
 
5717
- const create$j = () => {
5724
+ const create$k = () => {
5718
5725
  const $Viewlet = document.createElement('div');
5719
5726
  $Viewlet.className = 'Viewlet EditorText';
5720
5727
  $Viewlet.textContent = 'loading...';
@@ -5722,7 +5729,7 @@ const create$j = () => {
5722
5729
  $Viewlet
5723
5730
  };
5724
5731
  };
5725
- const dispose$a = state => {};
5732
+ const dispose$b = state => {};
5726
5733
  const refresh$3 = (state, context) => {
5727
5734
  object(state);
5728
5735
  string(context.content);
@@ -5731,20 +5738,20 @@ const refresh$3 = (state, context) => {
5731
5738
 
5732
5739
  const ViewletEditorPlainText = {
5733
5740
  __proto__: null,
5734
- create: create$j,
5735
- dispose: dispose$a,
5741
+ create: create$k,
5742
+ dispose: dispose$b,
5736
5743
  refresh: refresh$3
5737
5744
  };
5738
5745
 
5739
- const handleFocusIn$1 = event => {
5746
+ const handleFocusIn$2 = event => {
5740
5747
  preventDefault(event);
5741
5748
  const uid = fromEvent(event);
5742
- handleFocusIn$3(uid);
5749
+ handleFocusIn$4(uid);
5743
5750
  };
5744
5751
 
5745
5752
  const ViewletEditorSourceActionsEvents = {
5746
5753
  __proto__: null,
5747
- handleFocusIn: handleFocusIn$1
5754
+ handleFocusIn: handleFocusIn$2
5748
5755
  };
5749
5756
 
5750
5757
  const setBounds$4 = (state, x, y, width, height) => {
@@ -5760,7 +5767,7 @@ const appendWidget$2 = state => {
5760
5767
  } = state;
5761
5768
  append$1($Viewlet);
5762
5769
  };
5763
- const dispose$9 = state => {
5770
+ const dispose$a = state => {
5764
5771
  remove$1(state.$Viewlet);
5765
5772
  };
5766
5773
 
@@ -5768,7 +5775,7 @@ const ViewletEditorSourceActions = {
5768
5775
  __proto__: null,
5769
5776
  Events: ViewletEditorSourceActionsEvents,
5770
5777
  appendWidget: appendWidget$2,
5771
- dispose: dispose$9,
5778
+ dispose: dispose$a,
5772
5779
  setBounds: setBounds$4
5773
5780
  };
5774
5781
 
@@ -6002,7 +6009,7 @@ const handlePaste = event => {
6002
6009
  const text = getText(clipboardData);
6003
6010
  return ['paste', text];
6004
6011
  };
6005
- const handleScrollBarVerticalPointerDown = create$r(event => {
6012
+ const handleScrollBarVerticalPointerDown = create$s(event => {
6006
6013
  const {
6007
6014
  clientY
6008
6015
  } = event;
@@ -6125,7 +6132,7 @@ const setLineInfos = (state, dom) => {
6125
6132
  // 1. create -> only create dom elements
6126
6133
  // 2. render -> fill elements with attributes and data
6127
6134
  // that way all dom nodes can be recycled
6128
- const create$i = () => {
6135
+ const create$j = () => {
6129
6136
  const $EditorInput = document.createElement('textarea');
6130
6137
  $EditorInput.className = 'EditorInput';
6131
6138
  $EditorInput.ariaAutoComplete = List;
@@ -6271,7 +6278,7 @@ const setSelections$1 = (state, cursorInfos, selectionInfos) => {
6271
6278
  setCursors(state, cursorInfos);
6272
6279
  setSelections$2(state, selectionInfos);
6273
6280
  };
6274
- const setFocused$1 = async (state, isFocused) => {
6281
+ const setFocused$2 = async (state, isFocused) => {
6275
6282
  const {
6276
6283
  $EditorInput
6277
6284
  } = state;
@@ -6292,7 +6299,7 @@ const setDecorationsDom$1 = (state, decorations) => {
6292
6299
  setDecorationsDom$2(state, decorations);
6293
6300
  };
6294
6301
 
6295
- const create$h = create$i;
6302
+ const create$i = create$j;
6296
6303
  const setText$1 = setText$2;
6297
6304
  const setSelections = setSelections$1;
6298
6305
  const setIncrementalEdits = setIncrementalEdits$1;
@@ -6328,20 +6335,20 @@ const hideOverlayMessage = state => {
6328
6335
  }
6329
6336
  }
6330
6337
  };
6331
- const setFocused = setFocused$1;
6332
- const focus$a = setFocused$1;
6338
+ const setFocused$1 = setFocused$2;
6339
+ const focus$b = setFocused$2;
6333
6340
  const setDecorationsDom = setDecorationsDom$1;
6334
6341
 
6335
6342
  const ViewletEditorText = {
6336
6343
  __proto__: null,
6337
- create: create$h,
6338
- focus: focus$a,
6344
+ create: create$i,
6345
+ focus: focus$b,
6339
6346
  handleError: handleError$4,
6340
6347
  hideOverlayMessage,
6341
6348
  highlightAsLink,
6342
6349
  renderGutter,
6343
6350
  setDecorationsDom,
6344
- setFocused,
6351
+ setFocused: setFocused$1,
6345
6352
  setIncrementalEdits,
6346
6353
  setScrollBar,
6347
6354
  setScrollBarHorizontal,
@@ -6350,7 +6357,7 @@ const ViewletEditorText = {
6350
6357
  showOverlayMessage
6351
6358
  };
6352
6359
 
6353
- const create$g = () => {
6360
+ const create$h = () => {
6354
6361
  const $Viewlet = document.createElement('div');
6355
6362
  $Viewlet.className = 'Viewlet EditorTextError';
6356
6363
  return {
@@ -6366,11 +6373,11 @@ const setMessage$3 = (state, message) => {
6366
6373
 
6367
6374
  const ViewletEditorTextError = {
6368
6375
  __proto__: null,
6369
- create: create$g,
6376
+ create: create$h,
6370
6377
  setMessage: setMessage$3
6371
6378
  };
6372
6379
 
6373
- const create$f = () => {
6380
+ const create$g = () => {
6374
6381
  const $Viewlet = document.createElement('div');
6375
6382
  $Viewlet.className = 'Viewlet EditorWidgetError EditorOverlayMessage';
6376
6383
  return {
@@ -6393,12 +6400,12 @@ const setBounds$3 = (state, x, y, width, height) => {
6393
6400
 
6394
6401
  const ViewletEditorWidgetError = {
6395
6402
  __proto__: null,
6396
- create: create$f,
6403
+ create: create$g,
6397
6404
  setBounds: setBounds$3,
6398
6405
  setMessage: setMessage$2
6399
6406
  };
6400
6407
 
6401
- const create$e = () => {
6408
+ const create$f = () => {
6402
6409
  const $Viewlet = document.createElement('div');
6403
6410
  $Viewlet.dataset.viewlet = 'Empty';
6404
6411
  $Viewlet.className = 'Viewlet';
@@ -6407,18 +6414,18 @@ const create$e = () => {
6407
6414
  };
6408
6415
  };
6409
6416
  const refresh$2 = (state, context) => {};
6410
- const focus$9 = state => {};
6411
- const dispose$8 = state => {};
6417
+ const focus$a = state => {};
6418
+ const dispose$9 = state => {};
6412
6419
 
6413
6420
  const ViewletEmpty = {
6414
6421
  __proto__: null,
6415
- create: create$e,
6416
- dispose: dispose$8,
6417
- focus: focus$9,
6422
+ create: create$f,
6423
+ dispose: dispose$9,
6424
+ focus: focus$a,
6418
6425
  refresh: refresh$2
6419
6426
  };
6420
6427
 
6421
- const create$d = () => {
6428
+ const create$e = () => {
6422
6429
  const $Viewlet = document.createElement('div');
6423
6430
  $Viewlet.className = 'Viewlet EmptyEditor';
6424
6431
  return {
@@ -6428,10 +6435,10 @@ const create$d = () => {
6428
6435
 
6429
6436
  const ViewletEmptyEditor = {
6430
6437
  __proto__: null,
6431
- create: create$d
6438
+ create: create$e
6432
6439
  };
6433
6440
 
6434
- const create$c = () => {
6441
+ const create$d = () => {
6435
6442
  const $Viewlet = document.createElement('div');
6436
6443
  $Viewlet.className = 'Viewlet Error';
6437
6444
  return {
@@ -6447,7 +6454,7 @@ const setMessage$1 = (state, message) => {
6447
6454
 
6448
6455
  const ViewletError = {
6449
6456
  __proto__: null,
6450
- create: create$c,
6457
+ create: create$d,
6451
6458
  setMessage: setMessage$1
6452
6459
  };
6453
6460
 
@@ -6517,7 +6524,7 @@ const handleFocusClose = event => {
6517
6524
  const handleFocusReplaceAll = event => {
6518
6525
  return ['FindWidget.handleFocusReplaceAll'];
6519
6526
  };
6520
- const returnValue$1 = true;
6527
+ const returnValue$2 = true;
6521
6528
 
6522
6529
  const ViewletFindWidgetEvents = {
6523
6530
  __proto__: null,
@@ -6537,10 +6544,10 @@ const ViewletFindWidgetEvents = {
6537
6544
  handleReplaceFocus,
6538
6545
  handleReplaceInput,
6539
6546
  handleToggleReplaceFocus,
6540
- returnValue: returnValue$1
6547
+ returnValue: returnValue$2
6541
6548
  };
6542
6549
 
6543
- const create$b = () => {
6550
+ const create$c = () => {
6544
6551
  const $Viewlet = document.createElement('div');
6545
6552
  $Viewlet.className = 'Viewlet FindWidget';
6546
6553
  $Viewlet.role = Group;
@@ -6548,7 +6555,7 @@ const create$b = () => {
6548
6555
  $Viewlet
6549
6556
  };
6550
6557
  };
6551
- const focus$8 = (state, key, source) => {
6558
+ const focus$9 = (state, key, source) => {
6552
6559
  if (!key) {
6553
6560
  return;
6554
6561
  }
@@ -6582,7 +6589,7 @@ const appendWidget$1 = state => {
6582
6589
  } = state;
6583
6590
  append$1($Viewlet);
6584
6591
  };
6585
- const setDom$2 = (state, dom) => {
6592
+ const setDom$3 = (state, dom) => {
6586
6593
  const {
6587
6594
  $Viewlet
6588
6595
  } = state;
@@ -6594,20 +6601,20 @@ const setBounds$2 = (state, x, y, width, height) => {
6594
6601
  } = state;
6595
6602
  setBounds$a($Viewlet, x, y, width, height);
6596
6603
  };
6597
- const dispose$7 = state => {
6604
+ const dispose$8 = state => {
6598
6605
  remove$1(state.$Viewlet);
6599
6606
  };
6600
- const Events$2 = ViewletFindWidgetEvents;
6607
+ const Events$3 = ViewletFindWidgetEvents;
6601
6608
 
6602
6609
  const ViewletFindWidget = {
6603
6610
  __proto__: null,
6604
- Events: Events$2,
6611
+ Events: Events$3,
6605
6612
  appendWidget: appendWidget$1,
6606
- create: create$b,
6607
- dispose: dispose$7,
6608
- focus: focus$8,
6613
+ create: create$c,
6614
+ dispose: dispose$8,
6615
+ focus: focus$9,
6609
6616
  setBounds: setBounds$2,
6610
- setDom: setDom$2,
6617
+ setDom: setDom$3,
6611
6618
  setValue: setValue$1
6612
6619
  };
6613
6620
 
@@ -6629,7 +6636,7 @@ const ViewletLocationsEvents = {
6629
6636
  handleLocationsMouseDown
6630
6637
  };
6631
6638
 
6632
- const setFocusedIndex = (state, oldFocusedIndex, newFocusedIndex) => {
6639
+ const setFocusedIndex$1 = (state, oldFocusedIndex, newFocusedIndex) => {
6633
6640
  const {
6634
6641
  $Viewlet
6635
6642
  } = state;
@@ -6652,7 +6659,7 @@ const handleError$3 = (state, message) => {
6652
6659
  } = state;
6653
6660
  $Message.textContent = message;
6654
6661
  };
6655
- const focus$7 = state => {
6662
+ const focus$8 = state => {
6656
6663
  const {
6657
6664
  $Locations
6658
6665
  } = state;
@@ -6664,9 +6671,9 @@ const focus$7 = state => {
6664
6671
  const ViewletImplementations = {
6665
6672
  __proto__: null,
6666
6673
  Events: ViewletLocationsEvents,
6667
- focus: focus$7,
6674
+ focus: focus$8,
6668
6675
  handleError: handleError$3,
6669
- setFocusedIndex
6676
+ setFocusedIndex: setFocusedIndex$1
6670
6677
  };
6671
6678
 
6672
6679
  const handleScrollBarPointerDown = event => {
@@ -6757,11 +6764,11 @@ const setColumnWidths = (state, columnWidth1, columnWidth2, columnWidth3) => {
6757
6764
  $Resizer1.style.left = `${paddingLeft + columnWidth1}px`;
6758
6765
  $Resizer2.style.left = `${paddingLeft + columnWidth1 + columnWidth2}px`;
6759
6766
  };
6760
- const Events$1 = ViewletkeyBindingsEvents;
6767
+ const Events$2 = ViewletkeyBindingsEvents;
6761
6768
 
6762
6769
  const ViewletKeyBindings = {
6763
6770
  __proto__: null,
6764
- Events: Events$1,
6771
+ Events: Events$2,
6765
6772
  setColumnWidths,
6766
6773
  setScrollBar: setScrollBar$2,
6767
6774
  setSize,
@@ -7266,7 +7273,7 @@ const handleBlur$3 = () => {
7266
7273
  const handleKeyDown$1 = handleKeyDown$2;
7267
7274
  const handleKeyUp = handleKeyUp$1;
7268
7275
 
7269
- const create$a = () => {
7276
+ const create$b = () => {
7270
7277
  // TODO use aria role splitter once supported https://github.com/w3c/aria/issues/1348
7271
7278
  const $SashSideBar = document.createElement('div');
7272
7279
  $SashSideBar.className = 'Viewlet Sash SashVertical';
@@ -7322,7 +7329,7 @@ const setSashes = (state, sashSideBar, sashPanel) => {
7322
7329
  const ViewletLayout = {
7323
7330
  __proto__: null,
7324
7331
  attachEvents: attachEvents$2,
7325
- create: create$a,
7332
+ create: create$b,
7326
7333
  setSashes
7327
7334
  };
7328
7335
 
@@ -7362,7 +7369,12 @@ const StatusBar = 'StatusBar';
7362
7369
  const Storage = 'Storage';
7363
7370
  const Terminal = 'Terminal';
7364
7371
  const Terminals = 'Terminals';
7372
+ const TitleBar = 'TitleBar';
7373
+ const TitleBarButtons = 'TitleBarButtons';
7374
+ const TitleBarIcon = 'TitleBarIcon';
7375
+ const TitleBarMenuBar = 'TitleBarMenuBar';
7365
7376
  const Video = 'Video';
7377
+ const TitleBarTitle = 'TitleBarTitle';
7366
7378
  const EditorSourceActions = 'EditorSourceActions';
7367
7379
  const E2eTests = 'E2eTests';
7368
7380
  const E2eTest = 'E2eTest';
@@ -7372,7 +7384,7 @@ const EditorTextError = 'EditorTextError';
7372
7384
  const EditorRename = 'EditorRename';
7373
7385
  const EditorCodeGenerator = 'EditorCodeGenerator';
7374
7386
 
7375
- const create$9 = () => {
7387
+ const create$a = () => {
7376
7388
  const $ViewletOutputContent = document.createElement('div');
7377
7389
  $ViewletOutputContent.className = 'OutputContent';
7378
7390
  $ViewletOutputContent.role = Log;
@@ -7404,9 +7416,9 @@ const handleError$2 = (state, error) => {
7404
7416
  string(error);
7405
7417
  state.content.textContent = error;
7406
7418
  };
7407
- const focus$6 = state => {
7419
+ const focus$7 = state => {
7408
7420
  object(state);
7409
- focus$d(state.$ViewletOutputContent);
7421
+ focus$e(state.$ViewletOutputContent);
7410
7422
  send('Focus.setFocus', FocusOutput);
7411
7423
  };
7412
7424
 
@@ -7419,15 +7431,15 @@ const disposeFindWidget = state => {
7419
7431
  return;
7420
7432
  }
7421
7433
  };
7422
- const dispose$6 = state => {};
7434
+ const dispose$7 = state => {};
7423
7435
 
7424
7436
  const ViewletOutput = {
7425
7437
  __proto__: null,
7426
7438
  clear: clear$1,
7427
- create: create$9,
7428
- dispose: dispose$6,
7439
+ create: create$a,
7440
+ dispose: dispose$7,
7429
7441
  disposeFindWidget,
7430
- focus: focus$6,
7442
+ focus: focus$7,
7431
7443
  handleError: handleError$2,
7432
7444
  openFindWidget,
7433
7445
  setText
@@ -7478,7 +7490,7 @@ const UiStrings = {
7478
7490
  Close: 'Close',
7479
7491
  Maximize: 'Maximize'
7480
7492
  };
7481
- const create$8 = () => {
7493
+ const create$9 = () => {
7482
7494
  const $PanelTabs = document.createElement('div');
7483
7495
  $PanelTabs.className = 'PanelTabs';
7484
7496
  $PanelTabs.role = TabList;
@@ -7540,14 +7552,14 @@ const setTabsDom$1 = (state, dom) => {
7540
7552
  };
7541
7553
 
7542
7554
  // TODO add test for focus method
7543
- const focus$5 = state => {
7555
+ const focus$6 = state => {
7544
7556
  object(state);
7545
7557
  if (!state.currentViewlet) {
7546
7558
  return;
7547
7559
  }
7548
7560
  state.currentViewlet.factory.focus(state.currentViewlet.state);
7549
7561
  };
7550
- const dispose$5 = state => {
7562
+ const dispose$6 = state => {
7551
7563
  if (state.$PanelContent) {
7552
7564
  state.$PanelContent.remove();
7553
7565
  state.$PanelContent = undefined;
@@ -7592,9 +7604,9 @@ const setActionsDom$1 = (state, actions, childUid) => {
7592
7604
  const ViewletPanel = {
7593
7605
  __proto__: null,
7594
7606
  attachEvents: attachEvents$1,
7595
- create: create$8,
7596
- dispose: dispose$5,
7597
- focus: focus$5,
7607
+ create: create$9,
7608
+ dispose: dispose$6,
7609
+ focus: focus$6,
7598
7610
  setActionsDom: setActionsDom$1,
7599
7611
  setSelectedIndex,
7600
7612
  setTabsDom: setTabsDom$1
@@ -7603,9 +7615,9 @@ const ViewletPanel = {
7603
7615
  const ViewletReferences = {
7604
7616
  __proto__: null,
7605
7617
  Events: ViewletLocationsEvents,
7606
- focus: focus$7,
7618
+ focus: focus$8,
7607
7619
  handleError: handleError$3,
7608
- setFocusedIndex
7620
+ setFocusedIndex: setFocusedIndex$1
7609
7621
  };
7610
7622
 
7611
7623
  const ViewletRunAndDebug = {
@@ -7620,7 +7632,7 @@ const handleLoadedMetaData = event => {
7620
7632
  target.play();
7621
7633
  };
7622
7634
 
7623
- const create$7 = () => {
7635
+ const create$8 = () => {
7624
7636
  const $Viewlet = document.createElement('div');
7625
7637
  $Viewlet.className = 'Viewlet ScreenCapture';
7626
7638
  return {
@@ -7640,7 +7652,7 @@ const setScreenCapture = (state, id) => {
7640
7652
 
7641
7653
  const ViewletScreenCapture = {
7642
7654
  __proto__: null,
7643
- create: create$7,
7655
+ create: create$8,
7644
7656
  setScreenCapture
7645
7657
  };
7646
7658
 
@@ -7660,7 +7672,7 @@ const handleHeaderClick = event => {
7660
7672
  }
7661
7673
  };
7662
7674
 
7663
- const create$6 = () => {
7675
+ const create$7 = () => {
7664
7676
  const $SideBarTitleAreaTitle = document.createElement('h2');
7665
7677
  $SideBarTitleAreaTitle.className = 'SideBarTitleAreaTitle';
7666
7678
  const $SideBarTitleArea = document.createElement('div');
@@ -7689,7 +7701,7 @@ const attachEvents = state => {
7689
7701
  [Click]: handleHeaderClick
7690
7702
  });
7691
7703
  };
7692
- const dispose$4 = state => {
7704
+ const dispose$5 = state => {
7693
7705
  object(state);
7694
7706
  state.$SideBar.replaceChildren();
7695
7707
  };
@@ -7717,16 +7729,16 @@ const setActionsDom = (state, actions, parentId, eventMap = {}) => {
7717
7729
  }
7718
7730
  state.$Actions = $NewViewlet;
7719
7731
  };
7720
- const focus$4 = async () => {
7732
+ const focus$5 = async () => {
7721
7733
  // await
7722
7734
  };
7723
7735
 
7724
7736
  const ViewletSideBar = {
7725
7737
  __proto__: null,
7726
7738
  attachEvents,
7727
- create: create$6,
7728
- dispose: dispose$4,
7729
- focus: focus$4,
7739
+ create: create$7,
7740
+ dispose: dispose$5,
7741
+ focus: focus$5,
7730
7742
  setActionsDom,
7731
7743
  setTitle
7732
7744
  };
@@ -7838,7 +7850,7 @@ const getButtonIndex = $Node => {
7838
7850
  }
7839
7851
  return index;
7840
7852
  };
7841
- const handleClick$2 = event => {
7853
+ const handleClick$3 = event => {
7842
7854
  const {
7843
7855
  target
7844
7856
  } = event;
@@ -7856,7 +7868,7 @@ const handleClick$2 = event => {
7856
7868
  if (index === -1) {
7857
7869
  return;
7858
7870
  }
7859
- handleClick$5(uid, index);
7871
+ handleClick$6(uid, index);
7860
7872
  };
7861
7873
  const handleMouseOver = event => {
7862
7874
  const {
@@ -7900,7 +7912,7 @@ const handleInput$1 = event => {
7900
7912
 
7901
7913
  const ViewletSourceControlEvents = {
7902
7914
  __proto__: null,
7903
- handleClick: handleClick$2,
7915
+ handleClick: handleClick$3,
7904
7916
  handleContextMenu: handleContextMenu$1,
7905
7917
  handleFocus,
7906
7918
  handleInput: handleInput$1,
@@ -7909,7 +7921,7 @@ const ViewletSourceControlEvents = {
7909
7921
  handleWheel: handleWheel$3
7910
7922
  };
7911
7923
 
7912
- const focus$3 = state => {
7924
+ const focus$4 = state => {
7913
7925
  const {
7914
7926
  $Viewlet
7915
7927
  } = state;
@@ -7919,24 +7931,24 @@ const focus$3 = state => {
7919
7931
  const ViewletSourceControl = {
7920
7932
  __proto__: null,
7921
7933
  Events: ViewletSourceControlEvents,
7922
- focus: focus$3
7934
+ focus: focus$4
7923
7935
  };
7924
7936
 
7925
- const handleClick$1 = event => {
7937
+ const handleClick$2 = event => {
7926
7938
  const uid = fromEvent(event);
7927
7939
  const {
7928
7940
  clientX,
7929
7941
  clientY
7930
7942
  } = event;
7931
- handleClick$5(uid, clientX, clientY);
7943
+ handleClick$6(uid, clientX, clientY);
7932
7944
  };
7933
7945
 
7934
7946
  const ViewletStatusBarEvents = {
7935
7947
  __proto__: null,
7936
- handleClick: handleClick$1
7948
+ handleClick: handleClick$2
7937
7949
  };
7938
7950
 
7939
- const create$5 = () => {
7951
+ const create$6 = () => {
7940
7952
  const $Viewlet = document.createElement('div');
7941
7953
  $Viewlet.id = 'StatusBar';
7942
7954
  $Viewlet.className = 'Viewlet StatusBar';
@@ -7944,18 +7956,18 @@ const create$5 = () => {
7944
7956
  $Viewlet.role = Status;
7945
7957
  $Viewlet.ariaRoleDescription = StatusBar$1;
7946
7958
  $Viewlet.ariaLive = 'off'; // see https://github.com/microsoft/vscode/issues/94677
7947
- $Viewlet.addEventListener('click', handleClick$1);
7959
+ $Viewlet.addEventListener('click', handleClick$2);
7948
7960
  return {
7949
7961
  $Viewlet
7950
7962
  };
7951
7963
  };
7952
- const setDom$1 = (state, dom) => {
7964
+ const setDom$2 = (state, dom) => {
7953
7965
  const {
7954
7966
  $Viewlet
7955
7967
  } = state;
7956
7968
  renderInto($Viewlet, dom, ViewletStatusBarEvents);
7957
7969
  };
7958
- const focus$2 = state => {
7970
+ const focus$3 = state => {
7959
7971
  object(state);
7960
7972
  const {
7961
7973
  $Viewlet
@@ -7965,26 +7977,26 @@ const focus$2 = state => {
7965
7977
 
7966
7978
  const ViewletStatusBar = {
7967
7979
  __proto__: null,
7968
- create: create$5,
7969
- focus: focus$2,
7970
- setDom: setDom$1
7980
+ create: create$6,
7981
+ focus: focus$3,
7982
+ setDom: setDom$2
7971
7983
  };
7972
7984
 
7973
- const handleClick = event => {
7985
+ const handleClick$1 = event => {
7974
7986
  const uid = fromEvent(event);
7975
- handleClick$5(uid);
7987
+ handleClick$6(uid);
7976
7988
  };
7977
7989
 
7978
7990
  const ViewletStorageEvents = {
7979
7991
  __proto__: null,
7980
- handleClick
7992
+ handleClick: handleClick$1
7981
7993
  };
7982
7994
 
7983
- const Events = ViewletStorageEvents;
7995
+ const Events$1 = ViewletStorageEvents;
7984
7996
 
7985
7997
  const ViewletStorage = {
7986
7998
  __proto__: null,
7987
- Events
7999
+ Events: Events$1
7988
8000
  };
7989
8001
 
7990
8002
  const handleClickTab = event => {
@@ -7996,7 +8008,7 @@ const handleClickTab = event => {
7996
8008
  handleClickTab$2(uid, index);
7997
8009
  };
7998
8010
 
7999
- const create$4 = () => {
8011
+ const create$5 = () => {
8000
8012
  const $Viewlet = document.createElement('div');
8001
8013
  $Viewlet.className = 'Viewlet Terminals';
8002
8014
  return {
@@ -8023,10 +8035,421 @@ const setTabsDom = (state, dom) => {
8023
8035
 
8024
8036
  const ViewletTerminals = {
8025
8037
  __proto__: null,
8026
- create: create$4,
8038
+ create: create$5,
8027
8039
  setTabsDom
8028
8040
  };
8029
8041
 
8042
+ const isInsideTitleBarMenu = $Element => {
8043
+ return $Element.classList.contains('MenuItem') || $Element.classList.contains('Menu') || $Element.classList.contains('TitleBarTopLevelEntry') || $Element.classList.contains('TitleBarMenuBar');
8044
+ };
8045
+ const handleFocusOut = event => {
8046
+ const {
8047
+ relatedTarget,
8048
+ target
8049
+ } = event;
8050
+ if (relatedTarget && isInsideTitleBarMenu(relatedTarget)) {
8051
+ return;
8052
+ }
8053
+ if (target && isInsideTitleBarMenu(target)) {
8054
+ return;
8055
+ }
8056
+ const uid = fromEvent(event);
8057
+ closeMenu$1(uid);
8058
+ };
8059
+ const handlePointerOver = event => {
8060
+ const {
8061
+ target
8062
+ } = event;
8063
+ const index = getIndex(target);
8064
+ const uid = fromEvent(event);
8065
+ handleMouseOver$1(uid, index);
8066
+ };
8067
+ const handlePointerOut = event => {
8068
+ const {
8069
+ target
8070
+ } = event;
8071
+ const index = getIndex(target);
8072
+ const uid = fromEvent(event);
8073
+ handleMouseOut$1(uid, index);
8074
+ };
8075
+ const getIndex = $Target => {
8076
+ if ($Target.classList.contains('TitleBarTopLevelEntry')) {
8077
+ return getNodeIndex($Target);
8078
+ }
8079
+ return -1;
8080
+ };
8081
+ const handleClick = event => {
8082
+ const {
8083
+ button,
8084
+ target
8085
+ } = event;
8086
+ const index = getIndex(target);
8087
+ const uid = fromEvent(event);
8088
+ handleClick$6(uid, button, index);
8089
+ };
8090
+ const getLevelAndIndex = event => {
8091
+ const {
8092
+ target
8093
+ } = event;
8094
+ const $Menu = target.closest('.Menu');
8095
+ const index = findIndex($Menu, target);
8096
+ const {
8097
+ id
8098
+ } = $Menu;
8099
+ const level = Number.parseInt(id.slice(5));
8100
+ return {
8101
+ index,
8102
+ level
8103
+ };
8104
+ };
8105
+ const handleMenuMouseOver = event => {
8106
+ // TODO just send pixel coordinates instead
8107
+ const {
8108
+ index,
8109
+ level
8110
+ } = getLevelAndIndex(event);
8111
+ const uid = fromEvent(event);
8112
+ handleMenuMouseOver$1(uid, level, index);
8113
+ };
8114
+ const handleMenuClick = event => {
8115
+ const {
8116
+ index,
8117
+ level
8118
+ } = getLevelAndIndex(event);
8119
+ const uid = fromEvent(event);
8120
+ handleMenuClick$1(uid, level, index);
8121
+ };
8122
+ const handleFocusIn$1 = event => {
8123
+ const uid = fromEvent(event);
8124
+ handleFocus$8(uid);
8125
+ };
8126
+
8127
+ const ViewletTitleBarMenuBarEvents = {
8128
+ __proto__: null,
8129
+ handleClick,
8130
+ handleFocusIn: handleFocusIn$1,
8131
+ handleFocusOut,
8132
+ handleMenuClick,
8133
+ handleMenuMouseOver,
8134
+ handlePointerOut,
8135
+ handlePointerOver
8136
+ };
8137
+
8138
+ const activeId = 'TitleBarEntryActive';
8139
+ const dispose$4 = state => {};
8140
+ const focus$2 = state => {
8141
+ const {
8142
+ $TitleBarMenuBar
8143
+ } = state;
8144
+ $TitleBarMenuBar.firstChild.focus();
8145
+ };
8146
+
8147
+ // TODO set proper tabIndex 0 to focused item https://www.w3.org/TR/wai-aria-practices/examples/menubar/menubar-1/menubar-1.html
8148
+
8149
+ // TODO screenreader doesn't read top level label
8150
+ // when menu is open,
8151
+ // first item is selected,
8152
+ // right is clicked it just reads
8153
+ // "Expanded" instead of "Selection Expanded"
8154
+
8155
+ // TODO sometimes screenreader reads too much (e.g. "File, expanded, opens menu, expanded")
8156
+
8157
+ // TODO don't focus on separators
8158
+
8159
+ // TODO don't focus on hover
8160
+ // only focus on hover when it has already focus or the menu has focus
8161
+
8162
+ // TODO title bar menu bar is very inefficient:
8163
+
8164
+ // before: 5 times recalculate style
8165
+ // 1.37ms Recalculate style
8166
+ // 83us Update Layer tree
8167
+ // 0.34ms paint
8168
+ // 0.79ms composite layer
8169
+ // 0.23ms Hit test
8170
+ // 1.42ms Recalculate style
8171
+ // 1.44ms Recalculate style
8172
+ // 2.08ms Recalculate style
8173
+ // 0.44ms Recalculate style
8174
+ // 0.52ms Layout
8175
+ // 0.16ms Update Layer Tree
8176
+ // 48us hit test
8177
+ // 16us Update Layer Tree
8178
+ // 0.36ms paint
8179
+ // 0.33ms composite layer
8180
+
8181
+ // now: 2 recalculate styles
8182
+ // 0.43ms recalculate style
8183
+ // 0.53ms recalculate style
8184
+ // 0.19ms layout
8185
+ // 0.16ms update layer tree
8186
+ // 30us hit test
8187
+ // 17us update layer tree
8188
+ // 0.17ms paint
8189
+ // 0.19ms composite layers
8190
+
8191
+ const setFocusedIndex = (state, unFocusIndex, focusIndex, oldIsMenuOpen, newIsMenuOpen) => {
8192
+ object(state);
8193
+ number(unFocusIndex);
8194
+ number(focusIndex);
8195
+ const {
8196
+ $Viewlet
8197
+ } = state;
8198
+ if (focusIndex !== -1) {
8199
+ $Viewlet.focus();
8200
+ $Viewlet.setAttribute(AriaActiveDescendant, activeId);
8201
+ }
8202
+ };
8203
+
8204
+ // TODO the focus variable is confusing: false means keep focus in menubar, true means focus the menu
8205
+ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex, focus, x, y, width, height) => {
8206
+ object(state);
8207
+ number(unFocusIndex);
8208
+ number(index);
8209
+ number(level);
8210
+ array(menuItems);
8211
+ number(menuFocusedIndex);
8212
+ boolean(focus);
8213
+ number(x);
8214
+ number(y);
8215
+ number(width);
8216
+ number(height);
8217
+ const {
8218
+ $Viewlet
8219
+ } = state;
8220
+ // TODO this code is very unclean
8221
+ $Viewlet.addEventListener('mouseenter', handlePointerOver, {
8222
+ capture: true
8223
+ });
8224
+ if (unFocusIndex !== -1) {
8225
+ $Viewlet.children[unFocusIndex].ariaExpanded = False;
8226
+ $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
8227
+ }
8228
+ $Viewlet.children[index].ariaExpanded = True;
8229
+ const $$Menus = state$3.$$Menus;
8230
+ state$3.$$Menus = [];
8231
+ // @ts-expect-error
8232
+ showControlled({
8233
+ $Parent: $Viewlet.children[index],
8234
+ handleFocusOut: handleFocusOut,
8235
+ height,
8236
+ items: menuItems,
8237
+ level,
8238
+ width,
8239
+ x,
8240
+ y
8241
+ });
8242
+ if (menuFocusedIndex !== -1) {
8243
+ focusIndex(0, -1, menuFocusedIndex);
8244
+ }
8245
+ for (const $Menu of $$Menus) {
8246
+ remove$1($Menu);
8247
+ }
8248
+ };
8249
+
8250
+ // TODO there need to be two variants of closeMenu: one just closes menu, another close menu and focuses top level entry
8251
+ const closeMenu = (state, unFocusIndex, index) => {
8252
+ const {
8253
+ $Viewlet
8254
+ } = state;
8255
+ if (unFocusIndex !== -1) {
8256
+ $Viewlet.children[unFocusIndex].ariaExpanded = False;
8257
+ $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
8258
+ }
8259
+ if (index !== -1) {
8260
+ $Viewlet.children[index].focus();
8261
+ }
8262
+ hide(/* restoreFocus */false);
8263
+ $Viewlet.removeEventListener('mouseenter', handlePointerOver, {
8264
+ capture: true
8265
+ });
8266
+ };
8267
+ const create$Menu = () => {
8268
+ const $Menu = document.createElement('div');
8269
+ $Menu.className = 'Menu';
8270
+ $Menu.role = Menu;
8271
+ $Menu.tabIndex = -1;
8272
+ // $ContextMenu.onmousedown = contextMenuHandleMouseDown
8273
+ // TODO mousedown vs click? (click is usually better but mousedown is faster, why wait 100ms?)
8274
+ // $Menu.addEventListener('mousedown', handleMouseDown)
8275
+ // $Menu.addEventListener('mouseenter', handleMouseEnter, {
8276
+ // capture: true,
8277
+ // })
8278
+ // $Menu.addEventListener('mouseleave', handleMouseLeave, {
8279
+ // capture: true,
8280
+ // })
8281
+ // $Menu.addEventListener('mousemove', handleMouseMove, {
8282
+ // passive: true,
8283
+ // })
8284
+ // $Menu.onkeydown = handleKeyDown
8285
+ // $Menu.addEventListener('focusout', handleFocusOut)
8286
+ // $Menu.oncontextmenu = handleContextMenu
8287
+ // $ContextMenu.onfocus = handleFocus
8288
+ // $ContextMenu.onblur = handleBlur
8289
+ return $Menu;
8290
+ };
8291
+
8292
+ // TODO recycle menus
8293
+ const setMenus = (state, changes, uid) => {
8294
+ array(changes);
8295
+ number(uid);
8296
+ state.$$Menus ||= [];
8297
+ const {
8298
+ $$Menus
8299
+ } = state;
8300
+ for (const change of changes) {
8301
+ const type = change[0];
8302
+ switch (type) {
8303
+ case 'addMenu':
8304
+ {
8305
+ const menu = change[1];
8306
+ const dom = change[2];
8307
+ const $Menu = create$Menu();
8308
+ set$3($Menu, uid);
8309
+ $Menu.onmouseover = handleMenuMouseOver;
8310
+ $Menu.onclick = handleMenuClick;
8311
+ const {
8312
+ focusedIndex,
8313
+ height,
8314
+ level,
8315
+ width,
8316
+ x,
8317
+ y
8318
+ } = menu;
8319
+ setBounds$a($Menu, x, y, width, height);
8320
+ renderInto($Menu, dom);
8321
+ $Menu.id = `Menu-${level}`;
8322
+ append$1($Menu);
8323
+ if (focusedIndex !== -1) {
8324
+ const $Child = $Menu.children[focusedIndex];
8325
+ // @ts-expect-error
8326
+ $Child.focus();
8327
+ }
8328
+ $$Menus.push($Menu);
8329
+ break;
8330
+ }
8331
+ case 'closeMenus':
8332
+ {
8333
+ const keepCount = change[1];
8334
+ const $$ToDispose = $$Menus.slice(keepCount);
8335
+ for (const $ToDispose of $$ToDispose) {
8336
+ remove$1($ToDispose);
8337
+ }
8338
+ $$Menus.length = keepCount;
8339
+ break;
8340
+ }
8341
+ case 'updateMenu':
8342
+ {
8343
+ const menu = change[1];
8344
+ const newLength = change[2];
8345
+ const dom = change[3];
8346
+ const {
8347
+ focusedIndex,
8348
+ height,
8349
+ level,
8350
+ width,
8351
+ x,
8352
+ y
8353
+ } = menu;
8354
+ const $Menu = $$Menus[level];
8355
+ setBounds$a($Menu, x, y, width, height);
8356
+ renderInto($Menu, dom);
8357
+ if (level === newLength - 1) {
8358
+ if (focusedIndex === -1) {
8359
+ $Menu.focus();
8360
+ } else {
8361
+ const $Child = $Menu.children[focusedIndex];
8362
+ $Child.focus();
8363
+ }
8364
+ }
8365
+ break;
8366
+ }
8367
+ // No default
8368
+ }
8369
+ }
8370
+ };
8371
+
8372
+ const ViewletTitleBarMenuBar = {
8373
+ __proto__: null,
8374
+ Events: ViewletTitleBarMenuBarEvents,
8375
+ closeMenu,
8376
+ dispose: dispose$4,
8377
+ focus: focus$2,
8378
+ openMenu,
8379
+ setFocusedIndex,
8380
+ setMenus
8381
+ };
8382
+
8383
+ const activeClassName = 'TitleBarActive';
8384
+ const setFocused = (state, isFocused) => {
8385
+ const {
8386
+ $Viewlet
8387
+ } = state;
8388
+ $Viewlet.classList.toggle(activeClassName, isFocused);
8389
+ };
8390
+
8391
+ const ViewletTitleBar = {
8392
+ __proto__: null,
8393
+ Events: ViewletTitleBarMenuBarEvents,
8394
+ closeMenu,
8395
+ dispose: dispose$4,
8396
+ focus: focus$2,
8397
+ openMenu,
8398
+ setFocused,
8399
+ setFocusedIndex,
8400
+ setMenus
8401
+ };
8402
+
8403
+ /**
8404
+ *
8405
+ * @param {MouseEvent} event
8406
+ */
8407
+ const handleTitleBarButtonsClick = event => {
8408
+ const {
8409
+ target
8410
+ } = event;
8411
+ return ['handleClick', target.className];
8412
+ };
8413
+ const returnValue$1 = true;
8414
+
8415
+ const ViewletTitleBarButtonsEvents = {
8416
+ __proto__: null,
8417
+ handleTitleBarButtonsClick,
8418
+ returnValue: returnValue$1
8419
+ };
8420
+
8421
+ const ViewletTitleBarButtons = {
8422
+ __proto__: null,
8423
+ Events: ViewletTitleBarButtonsEvents
8424
+ };
8425
+
8426
+ const Events = {};
8427
+
8428
+ const ViewletTitleBarIcon = {
8429
+ __proto__: null,
8430
+ Events
8431
+ };
8432
+
8433
+ const create$4 = () => {
8434
+ const $Viewlet = document.createElement('div');
8435
+ $Viewlet.className = 'Viewlet TitleBarTitle';
8436
+ return {
8437
+ $Viewlet
8438
+ };
8439
+ };
8440
+ const setDom$1 = (state, dom) => {
8441
+ const {
8442
+ $Viewlet
8443
+ } = state;
8444
+ renderInto($Viewlet, dom);
8445
+ };
8446
+
8447
+ const ViewletTitleBarTitle = {
8448
+ __proto__: null,
8449
+ create: create$4,
8450
+ setDom: setDom$1
8451
+ };
8452
+
8030
8453
  const handleVideoError$1 = (code, message) => {
8031
8454
  send('Video.handleVideoError', code, message);
8032
8455
  };
@@ -8259,6 +8682,16 @@ const load$1 = moduleId => {
8259
8682
  return Promise.resolve().then(function () { return ViewletTerminal; });
8260
8683
  case Terminals:
8261
8684
  return ViewletTerminals;
8685
+ case TitleBar:
8686
+ return ViewletTitleBar;
8687
+ case TitleBarButtons:
8688
+ return ViewletTitleBarButtons;
8689
+ case TitleBarIcon:
8690
+ return ViewletTitleBarIcon;
8691
+ case TitleBarMenuBar:
8692
+ return ViewletTitleBarMenuBar;
8693
+ case TitleBarTitle:
8694
+ return ViewletTitleBarTitle;
8262
8695
  case Video:
8263
8696
  return ViewletVideo;
8264
8697
  case WebView:
@@ -8575,6 +9008,15 @@ const move = async (uid, selector, target) => {
8575
9008
  // @ts-ignore
8576
9009
  $Target.moveBefore($Source, null);
8577
9010
  };
9011
+ const attachWindowEvents = () => {
9012
+ attachEvents$6(window, {
9013
+ [Blur]: handleBlur$3,
9014
+ [Focus]: handleFocus$2,
9015
+ [KeyDown]: handleKeyDown$1,
9016
+ [KeyUp]: handleKeyUp,
9017
+ [Resize]: handleResize
9018
+ });
9019
+ };
8578
9020
 
8579
9021
  // TODO this code is bad
8580
9022
  const sendMultiple = commands => {
@@ -8613,6 +9055,10 @@ const sendMultiple = commands => {
8613
9055
  ariaAnnounce(viewletId);
8614
9056
  break;
8615
9057
  }
9058
+ case 'Viewlet.attachWindowEvents':
9059
+ // @ts-ignore
9060
+ attachWindowEvents(viewletId, method, ...args);
9061
+ break;
8616
9062
  case 'Viewlet.create':
8617
9063
  {
8618
9064
  create$3(viewletId, method);
@@ -8879,6 +9325,8 @@ const getFn = command => {
8879
9325
  return appendViewlet;
8880
9326
  case 'Viewlet.ariaAnnounce':
8881
9327
  return ariaAnnounce;
9328
+ case 'Viewlet.attachWindowEvents':
9329
+ return attachWindowEvents;
8882
9330
  case 'Viewlet.create':
8883
9331
  return create$3;
8884
9332
  case 'Viewlet.createFunctionalRoot':
@@ -9162,7 +9610,7 @@ const commandMap = {
9162
9610
  'GetFilePathElectron.getFilePathElectron': getFilePathElectron,
9163
9611
  'HandleMessagePort.handleMessagePort': handleMessagePort,
9164
9612
  'InitData.getInitData': getInitData,
9165
- 'IpcParent.create': create$w,
9613
+ 'IpcParent.create': create$x,
9166
9614
  'KeyBindings.setIdentifiers': setIdentifiers,
9167
9615
  'Layout.getBounds': getBounds,
9168
9616
  'Location.getHref': getHref,
@@ -9177,10 +9625,10 @@ const commandMap = {
9177
9625
  'Menu.showControlled': showControlled,
9178
9626
  'Menu.showMenu': showMenu,
9179
9627
  'Meta.setThemeColor': setThemeColor,
9180
- 'Notification.create': create$v,
9628
+ 'Notification.create': create$w,
9181
9629
  'Notification.createWithOptions': createWithOptions,
9182
- 'Notification.dispose': dispose$g,
9183
- 'OffscreenCanvas.create': create$u,
9630
+ 'Notification.dispose': dispose$h,
9631
+ 'OffscreenCanvas.create': create$v,
9184
9632
  'OffscreenCanvas.create2': create2,
9185
9633
  'Open.openUrl': openUrl,
9186
9634
  'Performance.getMemory': getMemory,
@@ -9241,7 +9689,7 @@ const getConfiguredEditorWorkerUrl = () => {
9241
9689
  const editorWorkerUrl = getConfiguredEditorWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/editor-worker/dist/editorWorkerMain.js`;
9242
9690
 
9243
9691
  const launchEditorWorker = async port => {
9244
- const ipc = await create$w({
9692
+ const ipc = await create$x({
9245
9693
  method: ModuleWorkerWithMessagePort,
9246
9694
  name: 'Editor Worker',
9247
9695
  port,
@@ -9269,7 +9717,7 @@ const extensionHostWorkerUrl = getConfiguredExtensionHostWorkerUrl() || `${asset
9269
9717
 
9270
9718
  const launchExtensionHostWorker = async port => {
9271
9719
  const name = isElectron ? 'Extension Host (Electron)' : 'Extension Host';
9272
- const ipc = await create$w({
9720
+ const ipc = await create$x({
9273
9721
  method: ModuleWorkerWithMessagePort,
9274
9722
  name,
9275
9723
  port,
@@ -9297,7 +9745,7 @@ const getConfiguredSyntaxHighlightingWorkerUrl = () => {
9297
9745
  const syntaxHighlightingWorkerUrl = getConfiguredSyntaxHighlightingWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
9298
9746
 
9299
9747
  const launchSyntaxHighlightingWorker = async port => {
9300
- const ipc = await create$w({
9748
+ const ipc = await create$x({
9301
9749
  method: ModuleWorkerWithMessagePort,
9302
9750
  name: 'Syntax Highlighting Worker',
9303
9751
  port,
@@ -9330,7 +9778,7 @@ const launchWorkers = () => {
9330
9778
  const handleFocusIn = event => {
9331
9779
  preventDefault(event);
9332
9780
  const uid = fromEvent(event);
9333
- handleFocusIn$3(uid);
9781
+ handleFocusIn$4(uid);
9334
9782
  };
9335
9783
  const handleBlur$1 = event => {
9336
9784
  const uid = fromEvent(event);
@@ -9693,6 +10141,7 @@ const main = async () => {
9693
10141
  state$1.modules[EditorRename] = ViewletEditorRename;
9694
10142
  state$1.modules[EditorSourceActions] = ViewletEditorSourceActions;
9695
10143
  state$1.modules[FindWidget] = ViewletFindWidget;
10144
+ state$1.modules[TitleBar] = ViewletTitleBar;
9696
10145
  // TODO this is discovered very late
9697
10146
  await launchWorkers();
9698
10147
  setIpc(RendererWorker);