@flighthq/application 0.5.1-next.1069.554a2ac → 0.5.1-next.1201.9b49dee

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.
@@ -3,25 +3,20 @@ import { cancelSignal, connectSignal, emitSignal } from '@flighthq/signals/contr
3
3
  import { EntityRuntimeKey } from '@flighthq/types/contract';
4
4
  import type {
5
5
  EntityWithoutRuntime,
6
- FullscreenBackend,
6
+ HostFullscreenProvider,
7
7
  FullscreenTargetHandle,
8
- HasGraphicsRenderContextSubscription,
9
- HasGraphicsRenderSurface,
10
- HasInputDropFileSubscription,
11
- HasInputFocusSubscription,
12
- HasInputPointerLock,
13
- InputDropFileBackend,
14
- InputFocusBackend,
15
- InputPointerLockBackend,
8
+ HostRenderContextProvider,
9
+ HostRenderSurfaceProvider,
10
+ HostInputDropFileProvider,
11
+ HostInputFocusProvider,
12
+ HostInputPointerLockProvider,
16
13
  InputPointerLockExitOutcome,
17
14
  InputPointerLockRequestOutcome,
18
- InputTargetBackend,
15
+ HostInputTargetProvider,
19
16
  InputTargetHandle,
20
17
  Matrix,
21
- RenderContextBackend,
22
18
  RenderState,
23
- RenderSurfaceBackend,
24
- WindowBackend,
19
+ HostWindowProvider,
25
20
  WindowResizeTargetHandle,
26
21
  } from '@flighthq/types/contract';
27
22
 
@@ -88,7 +83,7 @@ import {
88
83
  showWindow,
89
84
  } from './window';
90
85
 
91
- type RecordingWindowBackend = Required<WindowBackend> & {
86
+ type RecordingWindowBackend = Required<HostWindowProvider> & {
92
87
  readonly calls: string[];
93
88
  emitCloseRequest(): boolean;
94
89
  emitClosed(): void;
@@ -98,31 +93,31 @@ type RecordingWindowBackend = Required<WindowBackend> & {
98
93
  emitVisibility(visible: boolean): void;
99
94
  };
100
95
 
101
- type RecordingFullscreenBackend = Required<FullscreenBackend> & {
96
+ type RecordingFullscreenBackend = Required<HostFullscreenProvider> & {
102
97
  readonly calls: string[];
103
98
  emit(fullscreen: boolean): void;
104
99
  };
105
100
 
106
- type RecordingInputDropFileBackend = InputDropFileBackend & {
101
+ type RecordingInputDropFileBackend = HostInputDropFileProvider & {
107
102
  readonly calls: string[];
108
103
  emit(path: string): void;
109
104
  };
110
105
 
111
- type RecordingInputFocusBackend = InputFocusBackend & {
106
+ type RecordingInputFocusBackend = HostInputFocusProvider & {
112
107
  readonly calls: string[];
113
108
  emitBlur(): void;
114
109
  emitFocus(): void;
115
110
  };
116
111
 
117
- type RecordingInputPointerLockBackend = InputPointerLockBackend & { readonly calls: string[] };
112
+ type RecordingInputPointerLockBackend = HostInputPointerLockProvider & { readonly calls: string[] };
118
113
 
119
- type RecordingRenderContextBackend = RenderContextBackend & {
114
+ type RecordingRenderContextBackend = HostRenderContextProvider & {
120
115
  readonly calls: string[];
121
116
  emitLost(): void;
122
117
  emitRestored(): void;
123
118
  };
124
119
 
125
- type RecordingRenderSurfaceBackend = RenderSurfaceBackend & { readonly calls: string[] };
120
+ type RecordingRenderSurfaceBackend = HostRenderSurfaceProvider & { readonly calls: string[] };
126
121
 
127
122
  type TestHost = {
128
123
  readonly graphics: {
@@ -138,11 +133,11 @@ type TestHost = {
138
133
  readonly window: RecordingWindowBackend;
139
134
  };
140
135
 
141
- type WindowTargetHost = HasGraphicsRenderContextSubscription &
142
- HasGraphicsRenderSurface &
143
- HasInputDropFileSubscription &
144
- HasInputFocusSubscription &
145
- HasInputPointerLock;
136
+ type WindowTargetHost = { readonly graphics: { readonly renderContext: HostRenderContextProvider } } & {
137
+ readonly graphics: { readonly renderSurface: HostRenderSurfaceProvider };
138
+ } & { readonly input: { readonly dropFile: HostInputDropFileProvider } } & {
139
+ readonly input: { readonly focus: HostInputFocusProvider };
140
+ } & { readonly input: { readonly pointerLock: HostInputPointerLockProvider } };
146
141
 
147
142
  function makeRenderState(): RenderState {
148
143
  return { renderTransform2D: { a: 0, b: 0, c: 0, d: 0, tx: 0, ty: 0 } } as unknown as RenderState;
@@ -464,7 +459,7 @@ describe('attachWindow', () => {
464
459
  const win = createApplicationWindow();
465
460
  const handle = { id: 41 };
466
461
 
467
- expect(attachWindow(host, win, handle, 'host')).toBe(true);
462
+ expect(attachWindow(host.window, win, handle, 'host')).toBe(true);
468
463
  expect(seen).toEqual([{ handle, win }]);
469
464
  });
470
465
 
@@ -481,11 +476,11 @@ describe('attachWindow', () => {
481
476
  const first = createApplicationWindow();
482
477
  const second = createApplicationWindow();
483
478
 
484
- expect(attachWindow(host, first, { id: 1 }, 'host')).toBe(true);
485
- expect(attachWindow(host, second, { id: 2 }, 'flight')).toBe(true);
479
+ expect(attachWindow(host.window, first, { id: 1 }, 'host')).toBe(true);
480
+ expect(attachWindow(host.window, second, { id: 2 }, 'flight')).toBe(true);
486
481
  expect(attached).toEqual([first, second]);
487
- expect(closeWindow(host, first)).toBe(true);
488
- expect(closeWindow(host, first)).toBe(true);
482
+ expect(closeWindow(host.window, first)).toBe(true);
483
+ expect(closeWindow(host.window, first)).toBe(true);
489
484
  expect(closed).toEqual([first]);
490
485
  });
491
486
 
@@ -498,10 +493,10 @@ describe('attachWindow', () => {
498
493
  let forwarded = 0;
499
494
  connectSignal(win.onClose, () => closed++);
500
495
  connectSignal(win.onFullscreenChanged, () => forwarded++);
501
- expect(attachWindow(host, win, { id: 1 }, 'flight')).toBe(true);
502
- attachWindowFullscreen(host, win);
496
+ expect(attachWindow(host.window, win, { id: 1 }, 'flight')).toBe(true);
497
+ attachWindowFullscreen(host.ui.fullscreen, win);
503
498
 
504
- expect(closeWindow(host, win)).toBe(true);
499
+ expect(closeWindow(host.window, win)).toBe(true);
505
500
  notifyWindowClosed(win);
506
501
  host.ui.fullscreen.emit(true);
507
502
  expect(closed).toBe(1);
@@ -515,10 +510,10 @@ describe('attachWindow', () => {
515
510
  let closed = 0;
516
511
  connectSignal(win.onClose, () => closed++);
517
512
 
518
- expect(attachWindow(host, win, { id: 1 }, 'host')).toBe(true);
519
- expect(closeWindow(host, win)).toBe(true);
520
- expect(attachWindow(host, win, { id: 1 }, 'host')).toBe(true);
521
- expect(closeWindow(host, win)).toBe(true);
513
+ expect(attachWindow(host.window, win, { id: 1 }, 'host')).toBe(true);
514
+ expect(closeWindow(host.window, win)).toBe(true);
515
+ expect(attachWindow(host.window, win, { id: 1 }, 'host')).toBe(true);
516
+ expect(closeWindow(host.window, win)).toBe(true);
522
517
  expect(closed).toBe(2);
523
518
  });
524
519
 
@@ -527,8 +522,8 @@ describe('attachWindow', () => {
527
522
  const active = createTestHost();
528
523
  const win = createApplicationWindow();
529
524
 
530
- expect(attachWindow(origin, win, { id: 1 }, 'host')).toBe(true);
531
- expect(closeWindow(active, win)).toBe(true);
525
+ expect(attachWindow(origin.window, win, { id: 1 }, 'host')).toBe(true);
526
+ expect(closeWindow(active.window, win)).toBe(true);
532
527
 
533
528
  expect(origin.window.calls).toEqual(['attach:host', 'close']);
534
529
  expect(active.window.calls).toEqual([]);
@@ -542,7 +537,7 @@ describe('attachWindowClose', () => {
542
537
  connectSignal(win.onClose, () => {
543
538
  closed = true;
544
539
  });
545
- attachWindowClose(host, win);
540
+ attachWindowClose(host.window, win);
546
541
  host.window.emitClosed();
547
542
  expect(closed).toBe(true);
548
543
  });
@@ -554,7 +549,7 @@ describe('attachWindowClose', () => {
554
549
  requested = true;
555
550
  cancelSignal(win.onCloseRequest);
556
551
  });
557
- attachWindowClose(host, win);
552
+ attachWindowClose(host.window, win);
558
553
 
559
554
  expect(host.window.emitCloseRequest()).toBe(true);
560
555
  expect(requested).toBe(true);
@@ -568,7 +563,7 @@ describe('attachWindowDropFile', () => {
568
563
  connectSignal(win.onDropFile, (path) => {
569
564
  received = path;
570
565
  });
571
- attachWindowDropFile(host, win, createInputTarget());
566
+ attachWindowDropFile(host.input.dropFile, win, createInputTarget());
572
567
  host.input.dropFile.emit('test.png');
573
568
 
574
569
  expect(received).toBe('test.png');
@@ -580,8 +575,8 @@ describe('attachWindowDropFile', () => {
580
575
  const win = createApplicationWindow();
581
576
  const target = createInputTarget();
582
577
 
583
- attachWindowDropFile(origin, win, target);
584
- attachWindowDropFile(replacement, win, target);
578
+ attachWindowDropFile(origin.input.dropFile, win, target);
579
+ attachWindowDropFile(replacement.input.dropFile, win, target);
585
580
  detachWindowDropFile(win);
586
581
 
587
582
  expect(origin.input.dropFile.calls).toEqual(['subscribe', 'release']);
@@ -596,7 +591,7 @@ describe('attachWindowFocus', () => {
596
591
  connectSignal(win.onFocusIn, () => {
597
592
  called = true;
598
593
  });
599
- attachWindowFocus(host, win, createInputTarget());
594
+ attachWindowFocus(host.input.focus, win, createInputTarget());
600
595
  host.input.focus.emitFocus();
601
596
  expect(called).toBe(true);
602
597
  });
@@ -607,7 +602,7 @@ describe('attachWindowFocus', () => {
607
602
  connectSignal(win.onFocusOut, () => {
608
603
  called = true;
609
604
  });
610
- attachWindowFocus(host, win, createInputTarget());
605
+ attachWindowFocus(host.input.focus, win, createInputTarget());
611
606
  host.input.focus.emitBlur();
612
607
  expect(called).toBe(true);
613
608
  });
@@ -618,8 +613,8 @@ describe('attachWindowFocus', () => {
618
613
  const win = createApplicationWindow();
619
614
  const target = createInputTarget();
620
615
 
621
- attachWindowFocus(origin, win, target);
622
- attachWindowFocus(replacement, win, target);
616
+ attachWindowFocus(origin.input.focus, win, target);
617
+ attachWindowFocus(replacement.input.focus, win, target);
623
618
  detachWindowFocus(win);
624
619
 
625
620
  expect(origin.input.focus.calls).toEqual(['subscribe', 'release']);
@@ -634,7 +629,7 @@ describe('attachWindowFullscreen', () => {
634
629
  connectSignal(win.onFullscreenChanged, () => {
635
630
  called = true;
636
631
  });
637
- attachWindowFullscreen(host, win);
632
+ attachWindowFullscreen(host.ui.fullscreen, win);
638
633
  host.ui.fullscreen.emit(true);
639
634
  expect(win.fullscreen).toBe(true);
640
635
  expect(called).toBe(true);
@@ -652,7 +647,7 @@ describe('attachWindowMove', () => {
652
647
  moved = true;
653
648
  });
654
649
 
655
- attachWindowMove(host, win);
650
+ attachWindowMove(host.window, win);
656
651
  host.window.emitMove(100, 200);
657
652
 
658
653
  expect(moved).toBe(true);
@@ -669,7 +664,7 @@ describe('attachWindowMove', () => {
669
664
  moved = true;
670
665
  });
671
666
 
672
- attachWindowMove(host, win);
667
+ attachWindowMove(host.window, win);
673
668
  host.window.emitMove(50, 50);
674
669
 
675
670
  expect(moved).toBe(false);
@@ -684,7 +679,7 @@ describe('attachWindowOrientation', () => {
684
679
  called = true;
685
680
  });
686
681
 
687
- attachWindowOrientation(host, win);
682
+ attachWindowOrientation(host.window, win);
688
683
  host.window.emitOrientation();
689
684
  expect(called).toBe(true);
690
685
  });
@@ -697,7 +692,7 @@ describe('attachWindowRenderContext', () => {
697
692
  connectSignal(win.onRenderContextLost, () => {
698
693
  called = true;
699
694
  });
700
- attachWindowRenderContext(host, win, createInputTarget());
695
+ attachWindowRenderContext(host.graphics.renderContext, win, createInputTarget());
701
696
  host.graphics.renderContext.emitLost();
702
697
  expect(called).toBe(true);
703
698
  });
@@ -708,7 +703,7 @@ describe('attachWindowRenderContext', () => {
708
703
  connectSignal(win.onRenderContextRestored, () => {
709
704
  called = true;
710
705
  });
711
- attachWindowRenderContext(host, win, createInputTarget());
706
+ attachWindowRenderContext(host.graphics.renderContext, win, createInputTarget());
712
707
  host.graphics.renderContext.emitRestored();
713
708
  expect(called).toBe(true);
714
709
  });
@@ -719,8 +714,8 @@ describe('attachWindowRenderContext', () => {
719
714
  const win = createApplicationWindow();
720
715
  const target = createInputTarget();
721
716
 
722
- attachWindowRenderContext(origin, win, target);
723
- attachWindowRenderContext(replacement, win, target);
717
+ attachWindowRenderContext(origin.graphics.renderContext, win, target);
718
+ attachWindowRenderContext(replacement.graphics.renderContext, win, target);
724
719
  detachWindowRenderContext(win);
725
720
 
726
721
  expect(origin.graphics.renderContext.calls).toEqual(['subscribe', 'release']);
@@ -735,7 +730,7 @@ describe('attachWindowRenderState', () => {
735
730
  win.height = 600;
736
731
  win.devicePixelRatio = 2;
737
732
  const state = makeRenderState();
738
- attachWindowRenderState(host, win, state, createInputTarget());
733
+ attachWindowRenderState(host.graphics.renderSurface, win, state, createInputTarget());
739
734
  expect(host.graphics.renderSurface.calls).toEqual(['resize:1600,1200']);
740
735
  expect(state.renderTransform2D?.a).toBe(2);
741
736
  expect(state.renderTransform2D?.d).toBe(2);
@@ -747,7 +742,7 @@ describe('attachWindowRenderState', () => {
747
742
  win.height = 600;
748
743
  win.devicePixelRatio = 1;
749
744
  const state = makeRenderState();
750
- attachWindowRenderState(host, win, state, createInputTarget());
745
+ attachWindowRenderState(host.graphics.renderSurface, win, state, createInputTarget());
751
746
  win.width = 400;
752
747
  win.devicePixelRatio = 2;
753
748
  emitSignal(win.onResize);
@@ -763,7 +758,7 @@ describe('attachWindowRenderState', () => {
763
758
  win.height = 200;
764
759
  const state = makeRenderState();
765
760
 
766
- attachWindowRenderState(origin, win, state, createInputTarget());
761
+ attachWindowRenderState(origin.graphics.renderSurface, win, state, createInputTarget());
767
762
  host = active;
768
763
  win.width = 640;
769
764
  emitSignal(win.onResize);
@@ -778,18 +773,18 @@ describe('attachWindowRenderState', () => {
778
773
  const target = createInputTarget();
779
774
  const win = createApplicationWindow();
780
775
 
781
- attachWindowDropFile(composedHost, win, target);
782
- attachWindowFocus(composedHost, win, target);
783
- attachWindowRenderContext(composedHost, win, target);
784
- attachWindowRenderState(composedHost, win, makeRenderState(), target);
785
- await lockApplicationPointer(composedHost, target);
776
+ attachWindowDropFile(composedHost.input.dropFile, win, target);
777
+ attachWindowFocus(composedHost.input.focus, win, target);
778
+ attachWindowRenderContext(composedHost.graphics.renderContext, win, target);
779
+ attachWindowRenderState(composedHost.graphics.renderSurface, win, makeRenderState(), target);
780
+ await lockApplicationPointer(composedHost.input.pointerLock, target);
786
781
 
787
782
  expect(targetHost.input.dropFile.calls).toEqual(['subscribe']);
788
783
  expect(targetHost.input.focus.calls).toEqual(['subscribe']);
789
784
  expect(targetHost.graphics.renderContext.calls).toEqual(['subscribe']);
790
785
  expect(targetHost.graphics.renderSurface.calls).toEqual(['resize:0,0']);
791
786
  expect(targetHost.input.pointerLock.calls).toEqual(['request']);
792
- await exitApplicationPointerLock(targetHost);
787
+ await exitApplicationPointerLock(targetHost.input.pointerLock);
793
788
  });
794
789
  });
795
790
 
@@ -801,7 +796,7 @@ describe('attachWindowResize', () => {
801
796
  called = true;
802
797
  });
803
798
 
804
- attachWindowResize(host, win, createWindowResizeTarget());
799
+ attachWindowResize(host.window, win, createWindowResizeTarget());
805
800
  host.window.emitResize(1280, 720, 2);
806
801
 
807
802
  expect(called).toBe(true);
@@ -814,8 +809,8 @@ describe('attachWindowResize', () => {
814
809
  const win = createApplicationWindow();
815
810
  let resized = 0;
816
811
  connectSignal(win.onResize, () => resized++);
817
- attachWindowResize(host, win, createWindowResizeTarget());
818
- attachWindowResize(host, win, createWindowResizeTarget());
812
+ attachWindowResize(host.window, win, createWindowResizeTarget());
813
+ attachWindowResize(host.window, win, createWindowResizeTarget());
819
814
 
820
815
  host.window.emitResize(320, 240, 1);
821
816
  expect(resized).toBe(1);
@@ -832,7 +827,7 @@ describe('attachWindowVisibility', () => {
832
827
  called = true;
833
828
  });
834
829
 
835
- attachWindowVisibility(host, win);
830
+ attachWindowVisibility(host.window, win);
836
831
  host.window.emitVisibility(false);
837
832
 
838
833
  expect(called).toBe(true);
@@ -845,7 +840,7 @@ describe('attachWindowVisibility', () => {
845
840
  called = true;
846
841
  });
847
842
 
848
- attachWindowVisibility(host, win);
843
+ attachWindowVisibility(host.window, win);
849
844
  host.window.emitVisibility(true);
850
845
 
851
846
  expect(called).toBe(true);
@@ -856,7 +851,7 @@ describe('centerWindow', () => {
856
851
  it('delegates to the backend', () => {
857
852
  const backend = recordingWindowBackend();
858
853
  host = createTestHost(backend);
859
- centerWindow(host, createApplicationWindow());
854
+ centerWindow(host.window, createApplicationWindow());
860
855
  expect(backend.calls).toContain('center');
861
856
  });
862
857
  });
@@ -870,7 +865,7 @@ describe('closeWindow', () => {
870
865
  connectSignal(win.onClose, () => {
871
866
  closed = true;
872
867
  });
873
- expect(closeWindow(host, win)).toBe(true);
868
+ expect(closeWindow(host.window, win)).toBe(true);
874
869
  expect(backend.calls).toContain('close');
875
870
  expect(closed).toBe(true);
876
871
  });
@@ -880,7 +875,7 @@ describe('closeWindow', () => {
880
875
  host = createTestHost(backend);
881
876
  const win = createApplicationWindow();
882
877
  connectSignal(win.onCloseRequest, () => cancelSignal(win.onCloseRequest));
883
- expect(closeWindow(host, win)).toBe(false);
878
+ expect(closeWindow(host.window, win)).toBe(false);
884
879
  expect(backend.calls).not.toContain('close');
885
880
  });
886
881
 
@@ -889,8 +884,8 @@ describe('closeWindow', () => {
889
884
  let closed = 0;
890
885
  connectSignal(win.onClose, () => closed++);
891
886
 
892
- expect(closeWindow(host, win)).toBe(true);
893
- expect(closeWindow(host, win)).toBe(true);
887
+ expect(closeWindow(host.window, win)).toBe(true);
888
+ expect(closeWindow(host.window, win)).toBe(true);
894
889
 
895
890
  expect(closed).toBe(1);
896
891
  expect(host.window.calls).toEqual(['close']);
@@ -972,7 +967,7 @@ describe('detachWindowClose', () => {
972
967
  connectSignal(win.onClose, () => {
973
968
  closed = true;
974
969
  });
975
- attachWindowClose(host, win);
970
+ attachWindowClose(host.window, win);
976
971
  detachWindowClose(win);
977
972
  host.window.emitClosed();
978
973
  expect(closed).toBe(false);
@@ -986,7 +981,7 @@ describe('detachWindowDropFile', () => {
986
981
  connectSignal(win.onDropFile, () => {
987
982
  called = true;
988
983
  });
989
- attachWindowDropFile(host, win, createInputTarget());
984
+ attachWindowDropFile(host.input.dropFile, win, createInputTarget());
990
985
  detachWindowDropFile(win);
991
986
  host.input.dropFile.emit('ignored.txt');
992
987
 
@@ -1002,7 +997,7 @@ describe('detachWindowFocus', () => {
1002
997
  connectSignal(win.onFocusIn, () => {
1003
998
  called = true;
1004
999
  });
1005
- attachWindowFocus(host, win, createInputTarget());
1000
+ attachWindowFocus(host.input.focus, win, createInputTarget());
1006
1001
  detachWindowFocus(win);
1007
1002
  host.input.focus.emitFocus();
1008
1003
  expect(called).toBe(false);
@@ -1017,7 +1012,7 @@ describe('detachWindowFullscreen', () => {
1017
1012
  connectSignal(win.onFullscreenChanged, () => {
1018
1013
  called = true;
1019
1014
  });
1020
- attachWindowFullscreen(host, win);
1015
+ attachWindowFullscreen(host.ui.fullscreen, win);
1021
1016
  detachWindowFullscreen(win);
1022
1017
  host.ui.fullscreen.emit(true);
1023
1018
  expect(called).toBe(false);
@@ -1034,7 +1029,7 @@ describe('detachWindowMove', () => {
1034
1029
  moved = true;
1035
1030
  });
1036
1031
 
1037
- attachWindowMove(host, win);
1032
+ attachWindowMove(host.window, win);
1038
1033
  detachWindowMove(win);
1039
1034
  host.window.emitMove(100, 100);
1040
1035
 
@@ -1049,7 +1044,7 @@ describe('detachWindowOrientation', () => {
1049
1044
  connectSignal(win.onOrientationChanged, () => {
1050
1045
  called = true;
1051
1046
  });
1052
- attachWindowOrientation(host, win);
1047
+ attachWindowOrientation(host.window, win);
1053
1048
  detachWindowOrientation(win);
1054
1049
  host.window.emitOrientation();
1055
1050
 
@@ -1064,7 +1059,7 @@ describe('detachWindowRenderContext', () => {
1064
1059
  connectSignal(win.onRenderContextLost, () => {
1065
1060
  called = true;
1066
1061
  });
1067
- attachWindowRenderContext(host, win, createInputTarget());
1062
+ attachWindowRenderContext(host.graphics.renderContext, win, createInputTarget());
1068
1063
  detachWindowRenderContext(win);
1069
1064
  host.graphics.renderContext.emitLost();
1070
1065
  expect(called).toBe(false);
@@ -1079,7 +1074,7 @@ describe('detachWindowRenderState', () => {
1079
1074
  win.height = 600;
1080
1075
  win.devicePixelRatio = 1;
1081
1076
  const state = makeRenderState();
1082
- attachWindowRenderState(host, win, state, createInputTarget());
1077
+ attachWindowRenderState(host.graphics.renderSurface, win, state, createInputTarget());
1083
1078
  detachWindowRenderState(win);
1084
1079
  win.width = 400;
1085
1080
  emitSignal(win.onResize);
@@ -1090,7 +1085,7 @@ describe('detachWindowRenderState', () => {
1090
1085
  describe('detachWindowResize', () => {
1091
1086
  it('disconnects the observer', () => {
1092
1087
  const win = createApplicationWindow();
1093
- attachWindowResize(host, win, createWindowResizeTarget());
1088
+ attachWindowResize(host.window, win, createWindowResizeTarget());
1094
1089
  detachWindowResize(win);
1095
1090
  host.window.emitResize(640, 480, 2);
1096
1091
 
@@ -1107,7 +1102,7 @@ describe('detachWindowVisibility', () => {
1107
1102
  called = true;
1108
1103
  });
1109
1104
 
1110
- attachWindowVisibility(host, win);
1105
+ attachWindowVisibility(host.window, win);
1111
1106
  detachWindowVisibility(win);
1112
1107
  host.window.emitVisibility(false);
1113
1108
 
@@ -1118,8 +1113,8 @@ describe('detachWindowVisibility', () => {
1118
1113
  describe('disposeApplicationWindow', () => {
1119
1114
  it('runs all teardown so attached observers stop firing', () => {
1120
1115
  const win = createApplicationWindow();
1121
- attachWindowResize(host, win, createWindowResizeTarget());
1122
- attachWindowFullscreen(host, win);
1116
+ attachWindowResize(host.window, win, createWindowResizeTarget());
1117
+ attachWindowFullscreen(host.ui.fullscreen, win);
1123
1118
 
1124
1119
  disposeApplicationWindow(win);
1125
1120
 
@@ -1137,14 +1132,14 @@ describe('disposeApplicationWindow', () => {
1137
1132
 
1138
1133
  describe('exitApplicationFullscreen', () => {
1139
1134
  it('delegates to the fullscreen capability', async () => {
1140
- await expect(exitApplicationFullscreen(host)).resolves.toBe(true);
1135
+ await expect(exitApplicationFullscreen(host.ui.fullscreen)).resolves.toBe(true);
1141
1136
  expect(host.ui.fullscreen.calls).toEqual(['exit']);
1142
1137
  });
1143
1138
  });
1144
1139
 
1145
1140
  describe('exitApplicationPointerLock', () => {
1146
1141
  it('delegates to the input pointer-lock command capability', async () => {
1147
- await expect(exitApplicationPointerLock(host)).resolves.toEqual({ reason: 'ok' });
1142
+ await expect(exitApplicationPointerLock(host.input.pointerLock)).resolves.toEqual({ reason: 'ok' });
1148
1143
  expect(host.input.pointerLock.calls).toEqual(['exit']);
1149
1144
  });
1150
1145
 
@@ -1160,9 +1155,9 @@ describe('exitApplicationPointerLock', () => {
1160
1155
  return attempts === 1 ? { reason } : { reason: 'ok' };
1161
1156
  };
1162
1157
 
1163
- await lockApplicationPointer(origin, createInputTarget());
1164
- await expect(exitApplicationPointerLock(active)).resolves.toEqual({ reason });
1165
- await expect(exitApplicationPointerLock(active)).resolves.toEqual({ reason: 'ok' });
1158
+ await lockApplicationPointer(origin.input.pointerLock, createInputTarget());
1159
+ await expect(exitApplicationPointerLock(active.input.pointerLock)).resolves.toEqual({ reason });
1160
+ await expect(exitApplicationPointerLock(active.input.pointerLock)).resolves.toEqual({ reason: 'ok' });
1166
1161
 
1167
1162
  expect(origin.input.pointerLock.calls).toEqual(['request', 'exit:1', 'exit:2']);
1168
1163
  expect(active.input.pointerLock.calls).toEqual([]);
@@ -1180,9 +1175,9 @@ describe('exitApplicationPointerLock', () => {
1180
1175
  return { reason: 'ok' };
1181
1176
  };
1182
1177
 
1183
- await lockApplicationPointer(origin, createInputTarget());
1184
- await expect(exitApplicationPointerLock(active)).rejects.toThrow('busy');
1185
- await expect(exitApplicationPointerLock(active)).resolves.toEqual({ reason: 'ok' });
1178
+ await lockApplicationPointer(origin.input.pointerLock, createInputTarget());
1179
+ await expect(exitApplicationPointerLock(active.input.pointerLock)).rejects.toThrow('busy');
1180
+ await expect(exitApplicationPointerLock(active.input.pointerLock)).resolves.toEqual({ reason: 'ok' });
1186
1181
 
1187
1182
  expect(origin.input.pointerLock.calls).toEqual(['request', 'exit:1', 'exit:2']);
1188
1183
  expect(active.input.pointerLock.calls).toEqual([]);
@@ -1194,7 +1189,7 @@ describe('flashWindowFrame', () => {
1194
1189
  const backend = recordingWindowBackend();
1195
1190
  host = createTestHost(backend);
1196
1191
  const win = createApplicationWindow();
1197
- flashWindowFrame(host, win);
1192
+ flashWindowFrame(host.window, win);
1198
1193
  expect(backend.calls).toContain('flashWindowFrame');
1199
1194
  });
1200
1195
  });
@@ -1204,7 +1199,7 @@ describe('focusWindow', () => {
1204
1199
  const backend = recordingWindowBackend();
1205
1200
  host = createTestHost(backend);
1206
1201
  const win = createApplicationWindow();
1207
- focusWindow(host, win);
1202
+ focusWindow(host.window, win);
1208
1203
  expect(win.focused).toBe(true);
1209
1204
  expect(backend.calls).toContain('focus');
1210
1205
  });
@@ -1214,7 +1209,7 @@ describe('getWindowBounds', () => {
1214
1209
  it('fills the out bounds from the backend', () => {
1215
1210
  host = createTestHost();
1216
1211
  const out = { x: 0, y: 0, width: 0, height: 0 };
1217
- expect(getWindowBounds(host, createApplicationWindow(), out)).toBe(out);
1212
+ expect(getWindowBounds(host.window, createApplicationWindow(), out)).toBe(out);
1218
1213
  expect(out.width).toBe(3);
1219
1214
  expect(host.window.calls).toEqual(['getBounds']);
1220
1215
  });
@@ -1225,7 +1220,7 @@ describe('hideWindow', () => {
1225
1220
  const backend = recordingWindowBackend();
1226
1221
  host = createTestHost(backend);
1227
1222
  const win = createApplicationWindow();
1228
- hideWindow(host, win);
1223
+ hideWindow(host.window, win);
1229
1224
  expect(win.visible).toBe(false);
1230
1225
  expect(backend.calls).toContain('hide');
1231
1226
  });
@@ -1240,17 +1235,17 @@ describe('initializeApplicationWindow', () => {
1240
1235
  describe('lockApplicationPointer', () => {
1241
1236
  it('passes the opaque target to the pointer-lock command capability', async () => {
1242
1237
  const target = createInputTarget();
1243
- await expect(lockApplicationPointer(host, target)).resolves.toEqual({ reason: 'ok' });
1238
+ await expect(lockApplicationPointer(host.input.pointerLock, target)).resolves.toEqual({ reason: 'ok' });
1244
1239
  expect(host.input.pointerLock.calls).toEqual(['request']);
1245
- await exitApplicationPointerLock(host);
1240
+ await exitApplicationPointerLock(host.input.pointerLock);
1246
1241
  });
1247
1242
 
1248
1243
  it('exits through the successful request origin after a different host becomes active', async () => {
1249
1244
  const origin = createTestHost();
1250
1245
  const active = createTestHost();
1251
1246
 
1252
- await lockApplicationPointer(origin, createInputTarget());
1253
- await exitApplicationPointerLock(active);
1247
+ await lockApplicationPointer(origin.input.pointerLock, createInputTarget());
1248
+ await exitApplicationPointerLock(active.input.pointerLock);
1254
1249
 
1255
1250
  expect(origin.input.pointerLock.calls).toEqual(['request', 'exit']);
1256
1251
  expect(active.input.pointerLock.calls).toEqual([]);
@@ -1272,9 +1267,11 @@ describe('lockApplicationPointer', () => {
1272
1267
  return { reason };
1273
1268
  };
1274
1269
 
1275
- await lockApplicationPointer(origin, createInputTarget());
1276
- await expect(lockApplicationPointer(declined, createInputTarget())).resolves.toEqual({ reason });
1277
- await exitApplicationPointerLock(active);
1270
+ await lockApplicationPointer(origin.input.pointerLock, createInputTarget());
1271
+ await expect(lockApplicationPointer(declined.input.pointerLock, createInputTarget())).resolves.toEqual({
1272
+ reason,
1273
+ });
1274
+ await exitApplicationPointerLock(active.input.pointerLock);
1278
1275
 
1279
1276
  expect(origin.input.pointerLock.calls).toEqual(['request', 'exit']);
1280
1277
  expect(declined.input.pointerLock.calls).toEqual([`request:${reason}`]);
@@ -1291,9 +1288,9 @@ describe('lockApplicationPointer', () => {
1291
1288
  throw new Error('defect');
1292
1289
  };
1293
1290
 
1294
- await lockApplicationPointer(origin, createInputTarget());
1295
- await expect(lockApplicationPointer(rejected, createInputTarget())).rejects.toThrow('defect');
1296
- await exitApplicationPointerLock(active);
1291
+ await lockApplicationPointer(origin.input.pointerLock, createInputTarget());
1292
+ await expect(lockApplicationPointer(rejected.input.pointerLock, createInputTarget())).rejects.toThrow('defect');
1293
+ await exitApplicationPointerLock(active.input.pointerLock);
1297
1294
 
1298
1295
  expect(origin.input.pointerLock.calls).toEqual(['request', 'exit']);
1299
1296
  expect(rejected.input.pointerLock.calls).toEqual(['request:rejected']);
@@ -1305,9 +1302,9 @@ describe('lockApplicationPointer', () => {
1305
1302
  const replacement = createTestHost();
1306
1303
  const active = createTestHost();
1307
1304
 
1308
- await lockApplicationPointer(origin, createInputTarget());
1309
- await lockApplicationPointer(replacement, createInputTarget());
1310
- await exitApplicationPointerLock(active);
1305
+ await lockApplicationPointer(origin.input.pointerLock, createInputTarget());
1306
+ await lockApplicationPointer(replacement.input.pointerLock, createInputTarget());
1307
+ await exitApplicationPointerLock(active.input.pointerLock);
1311
1308
 
1312
1309
  expect(origin.input.pointerLock.calls).toEqual(['request']);
1313
1310
  expect(replacement.input.pointerLock.calls).toEqual(['request', 'exit']);
@@ -1322,8 +1319,8 @@ describe('maximizeWindow', () => {
1322
1319
  const win = createApplicationWindow();
1323
1320
  let count = 0;
1324
1321
  connectSignal(win.onMaximize, () => count++);
1325
- maximizeWindow(host, win);
1326
- maximizeWindow(host, win);
1322
+ maximizeWindow(host.window, win);
1323
+ maximizeWindow(host.window, win);
1327
1324
  expect(win.maximized).toBe(true);
1328
1325
  expect(count).toBe(1);
1329
1326
  expect(backend.calls).toContain('maximize');
@@ -1339,7 +1336,7 @@ describe('minimizeWindow', () => {
1339
1336
  connectSignal(win.onMinimize, () => {
1340
1337
  called = true;
1341
1338
  });
1342
- minimizeWindow(host, win);
1339
+ minimizeWindow(host.window, win);
1343
1340
  expect(win.minimized).toBe(true);
1344
1341
  expect(called).toBe(true);
1345
1342
  });
@@ -1351,7 +1348,7 @@ describe('notifyWindowClosed', () => {
1351
1348
  const order: string[] = [];
1352
1349
  let forwarded = 0;
1353
1350
  connectSignal(win.onFullscreenChanged, () => forwarded++);
1354
- attachWindowFullscreen(host, win);
1351
+ attachWindowFullscreen(host.ui.fullscreen, win);
1355
1352
  connectSignal(win.onClose, () => {
1356
1353
  order.push('close');
1357
1354
  host.ui.fullscreen.emit(true);
@@ -1370,7 +1367,7 @@ describe('notifyWindowClosed', () => {
1370
1367
  const win = createApplicationWindow();
1371
1368
  let forwarded = 0;
1372
1369
  connectSignal(win.onFullscreenChanged, () => forwarded++);
1373
- attachWindowFullscreen(host, win);
1370
+ attachWindowFullscreen(host.ui.fullscreen, win);
1374
1371
  connectSignal(win.onClose, () => {
1375
1372
  throw new Error('close listener failed');
1376
1373
  });
@@ -1388,7 +1385,7 @@ describe('openWindow', () => {
1388
1385
  const backend = recordingWindowBackend();
1389
1386
  host = createTestHost(backend);
1390
1387
  const win = createApplicationWindow();
1391
- expect(openWindow(host, win, { title: 'Game', width: 640, height: 480, alwaysOnTop: true })).toBe(true);
1388
+ expect(openWindow(host.window, win, { title: 'Game', width: 640, height: 480, alwaysOnTop: true })).toBe(true);
1392
1389
  expect(win.title).toBe('Game');
1393
1390
  expect(win.width).toBe(640);
1394
1391
  expect(win.alwaysOnTop).toBe(true);
@@ -1399,7 +1396,7 @@ describe('openWindow', () => {
1399
1396
  const backend = recordingWindowBackend();
1400
1397
  host = createTestHost(backend);
1401
1398
  const win = createApplicationWindow();
1402
- openWindow(host, win, { title: 'Centered', center: true });
1399
+ openWindow(host.window, win, { title: 'Centered', center: true });
1403
1400
  expect(backend.calls.filter((call) => call === 'center')).toHaveLength(1);
1404
1401
  });
1405
1402
 
@@ -1407,7 +1404,7 @@ describe('openWindow', () => {
1407
1404
  const backend = recordingWindowBackend();
1408
1405
  host = createTestHost(backend);
1409
1406
  const win = createApplicationWindow();
1410
- openWindow(host, win, { title: 'Normal' });
1407
+ openWindow(host.window, win, { title: 'Normal' });
1411
1408
  expect(backend.calls).not.toContain('center');
1412
1409
  });
1413
1410
 
@@ -1420,17 +1417,17 @@ describe('openWindow', () => {
1420
1417
  connectSignal(win.onClose, () => closed++);
1421
1418
  connectSignal(win.onFullscreenChanged, () => forwarded++);
1422
1419
 
1423
- expect(openWindow(host, win)).toBe(true);
1424
- attachWindowFullscreen(host, win);
1425
- expect(closeWindow(host, win)).toBe(true);
1420
+ expect(openWindow(host.window, win)).toBe(true);
1421
+ attachWindowFullscreen(host.ui.fullscreen, win);
1422
+ expect(closeWindow(host.window, win)).toBe(true);
1426
1423
  host.ui.fullscreen.emit(true);
1427
1424
  expect(forwarded).toBe(0);
1428
1425
 
1429
- expect(openWindow(host, win)).toBe(true);
1430
- attachWindowFullscreen(host, win);
1426
+ expect(openWindow(host.window, win)).toBe(true);
1427
+ attachWindowFullscreen(host.ui.fullscreen, win);
1431
1428
  host.ui.fullscreen.emit(true);
1432
1429
  expect(forwarded).toBe(1);
1433
- expect(closeWindow(host, win)).toBe(true);
1430
+ expect(closeWindow(host.window, win)).toBe(true);
1434
1431
  host.ui.fullscreen.emit(true);
1435
1432
 
1436
1433
  expect(closed).toBe(2);
@@ -1455,8 +1452,8 @@ describe('openWindow', () => {
1455
1452
  let closed = 0;
1456
1453
  connectSignal(win.onClose, () => closed++);
1457
1454
 
1458
- expect(openWindow(origin, win)).toBe(true);
1459
- expect(closeWindow(active, win)).toBe(true);
1455
+ expect(openWindow(origin.window, win)).toBe(true);
1456
+ expect(closeWindow(active.window, win)).toBe(true);
1460
1457
 
1461
1458
  expect(calls).toEqual(['origin:open', 'origin:close']);
1462
1459
  expect(closed).toBe(1);
@@ -1466,7 +1463,7 @@ describe('openWindow', () => {
1466
1463
  describe('prepareElementForInput', () => {
1467
1464
  it('passes the opaque target to the explicit input preparation capability', () => {
1468
1465
  const prepare = vi.fn();
1469
- const backend = allocateEntity<InputTargetBackend>();
1466
+ const backend = allocateEntity<HostInputTargetProvider>();
1470
1467
  backend.prepare = prepare;
1471
1468
  const target = (() => {
1472
1469
  const out = allocateEntity<any>();
@@ -1474,7 +1471,7 @@ describe('prepareElementForInput', () => {
1474
1471
  return finishEntity(out);
1475
1472
  })();
1476
1473
 
1477
- prepareElementForInput({ input: { target: backend } }, target);
1474
+ prepareElementForInput({ input: { target: backend } }.input.target, target);
1478
1475
 
1479
1476
  expect(prepare).toHaveBeenCalledOnce();
1480
1477
  expect(prepare).toHaveBeenCalledWith(target);
@@ -1485,7 +1482,7 @@ describe('requestApplicationFullscreen', () => {
1485
1482
  it('passes the opaque target to the fullscreen capability', async () => {
1486
1483
  const target = allocateEntity<FullscreenTargetHandle>();
1487
1484
  target.__brand = 'FullscreenTargetHandle' as const;
1488
- await expect(requestApplicationFullscreen(host, target)).resolves.toBe(true);
1485
+ await expect(requestApplicationFullscreen(host.ui.fullscreen, target)).resolves.toBe(true);
1489
1486
  expect(host.ui.fullscreen.calls).toEqual(['request']);
1490
1487
  });
1491
1488
  });
@@ -1494,7 +1491,7 @@ describe('requestWindowAttention', () => {
1494
1491
  it('delegates to the backend', () => {
1495
1492
  const backend = recordingWindowBackend();
1496
1493
  host = createTestHost(backend);
1497
- requestWindowAttention(host, createApplicationWindow(), true);
1494
+ requestWindowAttention(host.window, createApplicationWindow(), true);
1498
1495
  expect(backend.calls).toContain('requestAttention:true');
1499
1496
  });
1500
1497
  });
@@ -1517,12 +1514,12 @@ describe('restoreWindow', () => {
1517
1514
  const backend = recordingWindowBackend();
1518
1515
  host = createTestHost(backend);
1519
1516
  const win = createApplicationWindow();
1520
- maximizeWindow(host, win);
1517
+ maximizeWindow(host.window, win);
1521
1518
  let restored = false;
1522
1519
  connectSignal(win.onRestore, () => {
1523
1520
  restored = true;
1524
1521
  });
1525
- restoreWindow(host, win);
1522
+ restoreWindow(host.window, win);
1526
1523
  expect(win.maximized).toBe(false);
1527
1524
  expect(restored).toBe(true);
1528
1525
  expect(backend.calls).toContain('restore');
@@ -1534,7 +1531,7 @@ describe('setWindowAlwaysOnTop', () => {
1534
1531
  const backend = recordingWindowBackend();
1535
1532
  host = createTestHost(backend);
1536
1533
  const win = createApplicationWindow();
1537
- setWindowAlwaysOnTop(host, win, true);
1534
+ setWindowAlwaysOnTop(host.window, win, true);
1538
1535
  expect(win.alwaysOnTop).toBe(true);
1539
1536
  expect(backend.calls).toContain('setAlwaysOnTop:true');
1540
1537
  });
@@ -1545,7 +1542,7 @@ describe('setWindowContentProtection', () => {
1545
1542
  const backend = recordingWindowBackend();
1546
1543
  host = createTestHost(backend);
1547
1544
  const win = createApplicationWindow();
1548
- setWindowContentProtection(host, win, true);
1545
+ setWindowContentProtection(host.window, win, true);
1549
1546
  expect(backend.calls).toContain('setContentProtection:true');
1550
1547
  });
1551
1548
  });
@@ -1557,8 +1554,8 @@ describe('setWindowFullscreen', () => {
1557
1554
  const win = createApplicationWindow();
1558
1555
  let count = 0;
1559
1556
  connectSignal(win.onFullscreenChanged, () => count++);
1560
- setWindowFullscreen(host, win, true);
1561
- setWindowFullscreen(host, win, true);
1557
+ setWindowFullscreen(host.window, win, true);
1558
+ setWindowFullscreen(host.window, win, true);
1562
1559
  expect(win.fullscreen).toBe(true);
1563
1560
  expect(count).toBe(1);
1564
1561
  });
@@ -1569,7 +1566,7 @@ describe('setWindowHasShadow', () => {
1569
1566
  const backend = recordingWindowBackend();
1570
1567
  host = createTestHost(backend);
1571
1568
  const win = createApplicationWindow();
1572
- setWindowHasShadow(host, win, false);
1569
+ setWindowHasShadow(host.window, win, false);
1573
1570
  expect(backend.calls).toContain('setHasShadow:false');
1574
1571
  });
1575
1572
  });
@@ -1579,7 +1576,7 @@ describe('setWindowIcon', () => {
1579
1576
  const backend = recordingWindowBackend();
1580
1577
  host = createTestHost(backend);
1581
1578
  const win = createApplicationWindow();
1582
- setWindowIcon(host, win, 'icon.png');
1579
+ setWindowIcon(host.window, win, 'icon.png');
1583
1580
  expect(win.icon).toBe('icon.png');
1584
1581
  expect(backend.calls).toContain('setIcon:icon.png');
1585
1582
  });
@@ -1590,7 +1587,7 @@ describe('setWindowMaximumSize', () => {
1590
1587
  const backend = recordingWindowBackend();
1591
1588
  host = createTestHost(backend);
1592
1589
  const win = createApplicationWindow();
1593
- setWindowMaximumSize(host, win, 1920, 1080);
1590
+ setWindowMaximumSize(host.window, win, 1920, 1080);
1594
1591
  expect(win.maxWidth).toBe(1920);
1595
1592
  expect(win.maxHeight).toBe(1080);
1596
1593
  expect(backend.calls).toContain('setMaximumSize:1920,1080');
@@ -1601,7 +1598,7 @@ describe('setWindowMenuBarVisible', () => {
1601
1598
  it('delegates to the backend', () => {
1602
1599
  const backend = recordingWindowBackend();
1603
1600
  host = createTestHost(backend);
1604
- setWindowMenuBarVisible(host, createApplicationWindow(), false);
1601
+ setWindowMenuBarVisible(host.window, createApplicationWindow(), false);
1605
1602
  expect(backend.calls).toContain('setMenuBarVisible:false');
1606
1603
  });
1607
1604
  });
@@ -1611,7 +1608,7 @@ describe('setWindowMinimumSize', () => {
1611
1608
  const backend = recordingWindowBackend();
1612
1609
  host = createTestHost(backend);
1613
1610
  const win = createApplicationWindow();
1614
- setWindowMinimumSize(host, win, 320, 240);
1611
+ setWindowMinimumSize(host.window, win, 320, 240);
1615
1612
  expect(win.minWidth).toBe(320);
1616
1613
  expect(win.minHeight).toBe(240);
1617
1614
  });
@@ -1622,7 +1619,7 @@ describe('setWindowOpacity', () => {
1622
1619
  const backend = recordingWindowBackend();
1623
1620
  host = createTestHost(backend);
1624
1621
  const win = createApplicationWindow();
1625
- setWindowOpacity(host, win, 0.5);
1622
+ setWindowOpacity(host.window, win, 0.5);
1626
1623
  expect(win.opacity).toBe(0.5);
1627
1624
  expect(backend.calls).toContain('setOpacity:0.5');
1628
1625
  });
@@ -1632,7 +1629,7 @@ describe('setWindowParent', () => {
1632
1629
  it('delegates to the backend with null', () => {
1633
1630
  const backend = recordingWindowBackend();
1634
1631
  host = createTestHost(backend);
1635
- setWindowParent(host, createApplicationWindow(), null);
1632
+ setWindowParent(host.window, createApplicationWindow(), null);
1636
1633
  expect(backend.calls).toContain('setParent:null');
1637
1634
  });
1638
1635
  });
@@ -1646,7 +1643,7 @@ describe('setWindowPosition', () => {
1646
1643
  connectSignal(win.onMove, () => {
1647
1644
  moved = true;
1648
1645
  });
1649
- setWindowPosition(host, win, 100, 50);
1646
+ setWindowPosition(host.window, win, 100, 50);
1650
1647
  expect(win.x).toBe(100);
1651
1648
  expect(win.y).toBe(50);
1652
1649
  expect(moved).toBe(true);
@@ -1657,7 +1654,7 @@ describe('setWindowProgress', () => {
1657
1654
  it('delegates to the backend', () => {
1658
1655
  const backend = recordingWindowBackend();
1659
1656
  host = createTestHost(backend);
1660
- setWindowProgress(host, createApplicationWindow(), 0.25);
1657
+ setWindowProgress(host.window, createApplicationWindow(), 0.25);
1661
1658
  expect(backend.calls).toContain('setProgress:0.25');
1662
1659
  });
1663
1660
  });
@@ -1667,7 +1664,7 @@ describe('setWindowResizable', () => {
1667
1664
  const backend = recordingWindowBackend();
1668
1665
  host = createTestHost(backend);
1669
1666
  const win = createApplicationWindow();
1670
- setWindowResizable(host, win, false);
1667
+ setWindowResizable(host.window, win, false);
1671
1668
  expect(win.resizable).toBe(false);
1672
1669
  expect(backend.calls).toContain('setResizable:false');
1673
1670
  });
@@ -1682,7 +1679,7 @@ describe('setWindowSize', () => {
1682
1679
  connectSignal(win.onResize, () => {
1683
1680
  resized = true;
1684
1681
  });
1685
- setWindowSize(host, win, 800, 600);
1682
+ setWindowSize(host.window, win, 800, 600);
1686
1683
  expect(win.width).toBe(800);
1687
1684
  expect(win.height).toBe(600);
1688
1685
  expect(resized).toBe(true);
@@ -1694,7 +1691,7 @@ describe('setWindowSkipTaskbar', () => {
1694
1691
  const backend = recordingWindowBackend();
1695
1692
  host = createTestHost(backend);
1696
1693
  const win = createApplicationWindow();
1697
- setWindowSkipTaskbar(host, win, true);
1694
+ setWindowSkipTaskbar(host.window, win, true);
1698
1695
  expect(win.skipTaskbar).toBe(true);
1699
1696
  expect(backend.calls).toContain('setSkipTaskbar:true');
1700
1697
  });
@@ -1705,7 +1702,7 @@ describe('setWindowTitle', () => {
1705
1702
  const backend = recordingWindowBackend();
1706
1703
  host = createTestHost(backend);
1707
1704
  const win = createApplicationWindow();
1708
- setWindowTitle(host, win, 'My App');
1705
+ setWindowTitle(host.window, win, 'My App');
1709
1706
  expect(win.title).toBe('My App');
1710
1707
  expect(backend.calls).toContain('setTitle:My App');
1711
1708
  });
@@ -1715,8 +1712,8 @@ describe('showWindow', () => {
1715
1712
  const backend = recordingWindowBackend();
1716
1713
  host = createTestHost(backend);
1717
1714
  const win = createApplicationWindow();
1718
- hideWindow(host, win);
1719
- showWindow(host, win);
1715
+ hideWindow(host.window, win);
1716
+ showWindow(host.window, win);
1720
1717
  expect(win.visible).toBe(true);
1721
1718
  expect(backend.calls).toContain('show');
1722
1719
  });