Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(web): add view transition navigation helper
Richie McIlroy8f3fe3b4859c
diff --git a/apps/web/utils/view-transition.ts b/apps/web/utils/view-transition.tsnew file mode 100644index 000000000..e4d086cb7--- /dev/null+++ b/apps/web/utils/view-transition.ts@@ -0,0 +1,23 @@+export function navigateWithTransition(+ transitionName: string,+ navigate: () => void,+) {+ if (typeof document === "undefined") {+ navigate();+ return;+ }+ if (typeof document.startViewTransition !== "function") {+ navigate();+ return;+ }+ const html = document.documentElement;+ html.dataset.viewTransition = transitionName;+ const transition = document.startViewTransition(() => {+ navigate();+ });+ transition.finished.finally(() => {+ if (html.dataset.viewTransition === transitionName) {+ delete html.dataset.viewTransition;+ }+ });+}