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