@flighthq/screen 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
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.
- package/README.md +2 -2
- package/package.json +4 -4
- package/src/screen.test.ts +66 -39
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/screen`. The `@fligh
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/screen@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/screen@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/screen)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/screen",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/screen.test.ts
CHANGED
|
@@ -27,8 +27,12 @@ import {
|
|
|
27
27
|
getScreenDetailPermission,
|
|
28
28
|
getScreenNearestPoint,
|
|
29
29
|
getScreenNearestRect,
|
|
30
|
-
getScreens,
|
|
31
30
|
getScreenWorkArea,
|
|
31
|
+
getScreens,
|
|
32
|
+
initializeScreenInfo,
|
|
33
|
+
initializeScreenMode,
|
|
34
|
+
initializeScreenPermissionChange,
|
|
35
|
+
initializeScreenSignals,
|
|
32
36
|
requestScreenDetails,
|
|
33
37
|
screenToDipPoint,
|
|
34
38
|
screenToDipRect,
|
|
@@ -483,50 +487,21 @@ describe('getScreenWorkArea', () => {
|
|
|
483
487
|
});
|
|
484
488
|
});
|
|
485
489
|
|
|
486
|
-
describe('
|
|
487
|
-
it('
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
await expect(requestScreenDetails(host)).resolves.toBe(true);
|
|
491
|
-
expect(host.screen.details.request).toHaveBeenCalledOnce();
|
|
490
|
+
describe('initializeScreenInfo', () => {
|
|
491
|
+
it('is the construction initializer of createScreenInfo', () => {
|
|
492
|
+
expect(typeof initializeScreenInfo).toBe('function');
|
|
492
493
|
});
|
|
493
494
|
});
|
|
494
495
|
|
|
495
|
-
describe('
|
|
496
|
-
it('
|
|
497
|
-
|
|
498
|
-
const out = { x: -1, y: -1 };
|
|
499
|
-
|
|
500
|
-
expect(screenToDipPoint(screen, { x: 24, y: 46 }, out)).toBe(out);
|
|
501
|
-
expect(out).toEqual({ x: 112, y: 73 });
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
it('is safe when out aliases the input point', () => {
|
|
505
|
-
const screen = createTestScreen(1, 100, 50, 800, 600, { scaleFactor: 2 });
|
|
506
|
-
const point = { x: 24, y: 46 };
|
|
507
|
-
|
|
508
|
-
screenToDipPoint(screen, point, point);
|
|
509
|
-
|
|
510
|
-
expect(point).toEqual({ x: 112, y: 73 });
|
|
496
|
+
describe('initializeScreenMode', () => {
|
|
497
|
+
it('is the construction initializer of createScreenMode', () => {
|
|
498
|
+
expect(typeof initializeScreenMode).toBe('function');
|
|
511
499
|
});
|
|
512
500
|
});
|
|
513
501
|
|
|
514
|
-
describe('
|
|
515
|
-
it('
|
|
516
|
-
|
|
517
|
-
const out = { x: -1, y: -1, width: -1, height: -1 };
|
|
518
|
-
|
|
519
|
-
expect(screenToDipRect(screen, { x: 24, y: 46, width: 60, height: 80 }, out)).toBe(out);
|
|
520
|
-
expect(out).toEqual({ x: 112, y: 73, width: 30, height: 40 });
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
it('is safe when out aliases the input rectangle', () => {
|
|
524
|
-
const screen = createTestScreen(1, 100, 50, 800, 600, { scaleFactor: 2 });
|
|
525
|
-
const rect = { x: 24, y: 46, width: 60, height: 80 };
|
|
526
|
-
|
|
527
|
-
screenToDipRect(screen, rect, rect);
|
|
528
|
-
|
|
529
|
-
expect(rect).toEqual({ x: 112, y: 73, width: 30, height: 40 });
|
|
502
|
+
describe('initializeScreenPermissionChange', () => {
|
|
503
|
+
it('is the construction initializer of createScreenPermissionChange', () => {
|
|
504
|
+
expect(typeof initializeScreenPermissionChange).toBe('function');
|
|
530
505
|
});
|
|
531
506
|
});
|
|
532
507
|
|
|
@@ -626,3 +601,55 @@ function createTestScreen(
|
|
|
626
601
|
overrides,
|
|
627
602
|
);
|
|
628
603
|
}
|
|
604
|
+
describe('initializeScreenSignals', () => {
|
|
605
|
+
it('is the construction initializer of createScreenSignals', () => {
|
|
606
|
+
expect(typeof initializeScreenSignals).toBe('function');
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
describe('requestScreenDetails', () => {
|
|
611
|
+
it('returns whether the host granted detailed screen access', async () => {
|
|
612
|
+
const host = createScreenDetailsHost('prompt', true);
|
|
613
|
+
|
|
614
|
+
await expect(requestScreenDetails(host)).resolves.toBe(true);
|
|
615
|
+
expect(host.screen.details.request).toHaveBeenCalledOnce();
|
|
616
|
+
});
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
describe('screenToDipPoint', () => {
|
|
620
|
+
it('converts screen-local pixels to desktop DIPs and returns out', () => {
|
|
621
|
+
const screen = createTestScreen(1, 100, 50, 800, 600, { scaleFactor: 2 });
|
|
622
|
+
const out = { x: -1, y: -1 };
|
|
623
|
+
|
|
624
|
+
expect(screenToDipPoint(screen, { x: 24, y: 46 }, out)).toBe(out);
|
|
625
|
+
expect(out).toEqual({ x: 112, y: 73 });
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
it('is safe when out aliases the input point', () => {
|
|
629
|
+
const screen = createTestScreen(1, 100, 50, 800, 600, { scaleFactor: 2 });
|
|
630
|
+
const point = { x: 24, y: 46 };
|
|
631
|
+
|
|
632
|
+
screenToDipPoint(screen, point, point);
|
|
633
|
+
|
|
634
|
+
expect(point).toEqual({ x: 112, y: 73 });
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
describe('screenToDipRect', () => {
|
|
639
|
+
it('converts screen-local position and extent to desktop DIPs and returns out', () => {
|
|
640
|
+
const screen = createTestScreen(1, 100, 50, 800, 600, { scaleFactor: 2 });
|
|
641
|
+
const out = { x: -1, y: -1, width: -1, height: -1 };
|
|
642
|
+
|
|
643
|
+
expect(screenToDipRect(screen, { x: 24, y: 46, width: 60, height: 80 }, out)).toBe(out);
|
|
644
|
+
expect(out).toEqual({ x: 112, y: 73, width: 30, height: 40 });
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
it('is safe when out aliases the input rectangle', () => {
|
|
648
|
+
const screen = createTestScreen(1, 100, 50, 800, 600, { scaleFactor: 2 });
|
|
649
|
+
const rect = { x: 24, y: 46, width: 60, height: 80 };
|
|
650
|
+
|
|
651
|
+
screenToDipRect(screen, rect, rect);
|
|
652
|
+
|
|
653
|
+
expect(rect).toEqual({ x: 112, y: 73, width: 30, height: 40 });
|
|
654
|
+
});
|
|
655
|
+
});
|