Skip to content

Commit d4e4ab1

Browse files
committed
chore: merge main into pull request previews
2 parents 638d361 + c75299e commit d4e4ab1

159 files changed

Lines changed: 12942 additions & 2354 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/desktop/src/window/QuitHold.test.ts‎

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -252,24 +252,31 @@ describe("makeQuitShortcutHandler", () => {
252252
expect(harness.notifications).toEqual([]);
253253
});
254254

255-
it("honors a quick double press when both key releases beat their mode reads", async () => {
256-
const resolvers: Array<(mode: QuitConfirmationMode) => void> = [];
257-
const harness = makeHarness({
258-
getMode: () => new Promise((resolve) => resolvers.push(resolve)),
259-
});
260-
await harness.send(makeInput({}));
261-
await harness.send(makeInput({ type: "keyUp" }));
262-
vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);
263-
await harness.send(makeInput({}));
264-
await harness.send(makeInput({ type: "keyUp" }));
265-
266-
resolvers[1]?.("double-click");
267-
await Promise.resolve();
268-
await Promise.resolve();
269-
270-
expect(harness.quit).toHaveBeenCalledTimes(1);
271-
expect(harness.notifications).toEqual([]);
272-
});
255+
it.each(["direct", "hold", "double-click"] as const)(
256+
"quits on a quick second press without waiting for a pending %s mode read",
257+
async (mode) => {
258+
const resolvers: Array<(mode: QuitConfirmationMode) => void> = [];
259+
const harness = makeHarness({
260+
getMode: () => new Promise((resolve) => resolvers.push(resolve)),
261+
});
262+
await harness.send(makeInput({}));
263+
await harness.send(makeInput({ type: "keyUp" }));
264+
vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);
265+
await harness.send(makeInput({}));
266+
267+
expect(harness.quit).toHaveBeenCalledTimes(1);
268+
expect(harness.notifications).toEqual([]);
269+
270+
await harness.send(makeInput({ type: "keyUp" }));
271+
272+
resolvers[0]?.(mode);
273+
await Promise.resolve();
274+
await Promise.resolve();
275+
276+
expect(harness.quit).toHaveBeenCalledTimes(1);
277+
expect(harness.notifications).toEqual([]);
278+
},
279+
);
273280

274281
it("discards a stale mode resolution from a superseded press", async () => {
275282
// Press #1's mode is still pending when the user releases and
@@ -378,6 +385,38 @@ describe("makeQuitShortcutHandler", () => {
378385
expect(harness.notifications).toEqual([HOLD_DOWN, UP]);
379386
});
380387

388+
it("quits on a quick second press in hold mode when the first release is unseen", async () => {
389+
const harness = makeHarness();
390+
await harness.send(makeInput({}));
391+
vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);
392+
await harness.send(makeInput({}));
393+
394+
expect(harness.concealWindow).not.toHaveBeenCalled();
395+
expect(harness.quit).toHaveBeenCalledTimes(1);
396+
expect(harness.notifications).toEqual([HOLD_DOWN, UP]);
397+
});
398+
399+
it("does not count auto-repeat as a second press", async () => {
400+
const harness = makeHarness();
401+
await harness.send(makeInput({}));
402+
await harness.holdFor(QUIT_DOUBLE_PRESS_MS - 100);
403+
404+
expect(harness.quit).not.toHaveBeenCalled();
405+
expect(harness.notifications).toEqual([HOLD_DOWN]);
406+
});
407+
408+
it("does not count a released tap after another shortcut interrupts it", async () => {
409+
const harness = makeHarness();
410+
await harness.send(makeInput({}));
411+
await harness.send(makeInput({ type: "keyUp" }));
412+
await harness.send(makeInput({ key: "c" }));
413+
vi.advanceTimersByTime(100);
414+
await harness.send(makeInput({}));
415+
416+
expect(harness.quit).not.toHaveBeenCalled();
417+
expect(harness.notifications).toEqual([HOLD_DOWN, UP, HOLD_DOWN]);
418+
});
419+
381420
it("cancels the hold when another key interrupts it", async () => {
382421
const harness = makeHarness();
383422
await harness.send(makeInput({}));

‎apps/desktop/src/window/QuitHold.ts‎

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const QUIT_DOUBLE_PRESS_MS = 500;
1212
// tap release can go completely unseen and a release-based timer would quit
1313
// anyway. Once held, quitting waits for Q keyUp or a quiet grace period after
1414
// repeats stop so they cannot reach the next app. Keyboards with
15-
// auto-repeat disabled fall back to the application menu Quit action.
15+
// auto-repeat disabled must use a double press or the application menu Quit action.
16+
// Supporting holds without repeats requires a native physical key-state check.
1617
export const QUIT_HOLD_RELEASE_GRACE_MS = 600;
1718
// A slow repeat rate can exceed the fixed grace. Waiting for two observed
1819
// cadences keeps the timer behind the next repeat without slowing normal rates.
@@ -52,8 +53,8 @@ export function makeQuitShortcutHandler(
5253
let lastRepeatAt = 0;
5354
let repeatCadenceMs = 0;
5455
// Incremented when a press is superseded or explicitly cancelled. A plain
55-
// key release does not invalidate its pending mode read: direct mode and a
56-
// completed second press must still be honored after that read settles.
56+
// key release does not invalidate its pending mode read: a direct-mode
57+
// press must still quit after that read settles.
5758
let generation = 0;
5859

5960
const clearWatchdog = () => {
@@ -64,9 +65,9 @@ export function makeQuitShortcutHandler(
6465
};
6566

6667
const release = (cancelPendingMode = true, keepDoublePressHint = false) => {
68+
if (cancelPendingMode) generation += 1;
6769
if (!holding && !notified) return;
6870
const keepHint = keepDoublePressHint && mode === "double-click" && notified;
69-
if (cancelPendingMode) generation += 1;
7071
holding = false;
7172
armed = false;
7273
quitOnRelease = false;
@@ -85,6 +86,7 @@ export function makeQuitShortcutHandler(
8586
// Dismisses any overlay first so a cancelled quit cannot leave a stale hint.
8687
const quitNow = () => {
8788
release();
89+
lastPressAt = 0;
8890
options.quit();
8991
};
9092

@@ -138,13 +140,10 @@ export function makeQuitShortcutHandler(
138140
// quit shortcut, so it must not cancel an active double-press window.
139141
if (key === modifierKey && !input.alt && !input.shift) return;
140142

141-
// Any other key (or an extra modifier) pressed mid-hold breaks the
142-
// gesture; without this the hold timer keeps running through the
143-
// interruption and the next qualifying repeat would quit early. The
144-
// interrupted press also stops counting toward a double press, but only
145-
// here, not in release(), which runs mid-restart on an unseen-release
146-
// re-press and must not wipe that press's own tap timestamp.
147-
if ((holding || notified) && !input.isAutoRepeat) {
143+
// Other keys cancel the hold and the first tap, even after release.
144+
// Keep this separate from release(), which also runs when a fresh Q
145+
// keydown follows a keyUp that macOS did not deliver.
146+
if (!input.isAutoRepeat) {
148147
lastPressAt = 0;
149148
release();
150149
}
@@ -171,6 +170,13 @@ export function makeQuitShortcutHandler(
171170
if (holding || notified) release();
172171

173172
generation += 1;
173+
// Every mode accepts two presses. Quit before reading settings so a slow
174+
// read cannot delay the second press. Repeats never reach this branch.
175+
if (previousPressAt !== 0 && now - previousPressAt <= QUIT_DOUBLE_PRESS_MS) {
176+
quitNow();
177+
return;
178+
}
179+
174180
const pressGeneration = generation;
175181
holding = true;
176182
heldSince = now;
@@ -181,13 +187,6 @@ export function makeQuitShortcutHandler(
181187
quitNow();
182188
return;
183189
}
184-
// Keep a second press as an escape hatch when macOS misses the events
185-
// that would complete a hold.
186-
if (previousPressAt !== 0 && now - previousPressAt <= QUIT_DOUBLE_PRESS_MS) {
187-
quitNow();
188-
return;
189-
}
190-
191190
if (resolvedMode === "double-click") {
192191
const remainingMs = QUIT_DOUBLE_PRESS_MS - (Date.now() - now);
193192
if (remainingMs <= 0) {

‎apps/marketing/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"dependencies": {
1313
"@t3tools/shared": "workspace:*",
14-
"astro": "^7.0.3"
14+
"astro": "^7.0.3",
15+
"sharp": "0.34.5"
1516
},
1617
"devDependencies": {
1718
"@astrojs/check": "^0.9.7",
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
https://scripts.sil.org/OFL
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
5+
This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
File renamed without changes.
30.6 KB
Binary file not shown.
61.3 KB
Binary file not shown.
Binary file not shown.
8.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)