Merge branch 'main' into cursors

This commit is contained in:
Vanilagy
2025-12-12 22:02:35 +01:00
23 changed files with 550 additions and 145 deletions
+31 -2
View File
@@ -685,7 +685,15 @@ export const isWebKit = () => {
}
// This even returns true for WebKit-wrapping browsers such as Chrome on iOS
return isWebKitCache = !!(typeof navigator !== 'undefined' && navigator.vendor?.match(/apple/i));
return isWebKitCache = !!(
typeof navigator !== 'undefined'
&& (
navigator.vendor?.match(/apple/i)
// Or, in workers:
|| (/AppleWebKit/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent))
|| /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)
)
);
};
let isFirefoxCache: boolean | null = null;
@@ -703,7 +711,28 @@ export const isChromium = () => {
return isChromiumCache;
}
return isChromiumCache = !!(typeof navigator !== 'undefined' && navigator.vendor?.includes('Google Inc'));
return isChromiumCache = !!(
typeof navigator !== 'undefined'
&& (navigator.vendor?.includes('Google Inc') || /Chrome/.test(navigator.userAgent))
);
};
let chromiumVersionCache: number | null = null;
export const getChromiumVersion = () => {
if (chromiumVersionCache !== null) {
return chromiumVersionCache;
}
if (typeof navigator === 'undefined') {
return null;
}
const match = /\bChrome\/(\d+)/.exec(navigator.userAgent);
if (!match) {
return null;
}
return chromiumVersionCache = Number(match[1]!);
};
/**