{"_id":"nextjs-nav-guard","_rev":"11-fd405d542418213f27024cc3c95cb13b","name":"nextjs-nav-guard","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"nextjs-nav-guard","version":"1.0.0","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.0","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://github.com/br-schneider/next-nav-guard#readme","bugs":{"url":"https://github.com/br-schneider/next-nav-guard/issues"},"dist":{"shasum":"6d0f6593c9db772dac8097e8d3aca8ba7288aa45","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.0.tgz","fileCount":45,"integrity":"sha512-jUlChOLeegSp8RqYFR3u/IFCeNdPT+zHuKMZBF+RgMF8wgc8KzCo0naqKhfqoD1nFhbbgdKWAckc3rO/cQHSog==","signatures":[{"sig":"MEQCIDF72jnWd50QK3hufyOZas3jGwxfplXDtxpZ213JC9SOAiAH7DP+l/vofnBfxTaTzHRpekEwZp/jwhTVp7rfQW/U2w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40184},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"gitHead":"043f8488ea35676511ce650ee29a1f1aa8063222","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/next-nav-guard.git","type":"git"},"_npmVersion":"10.9.2","description":"Navigation guard for Next.js App Router — prevent navigation when there are unsaved changes.","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.0","tsup":"^8.2.4","react":"^19.0.0","playwright":"^1.52.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.52.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.0_1773889002112_0.5917120350991805","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"nextjs-nav-guard","version":"1.0.1","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.1","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://github.com/br-schneider/next-nav-guard#readme","bugs":{"url":"https://github.com/br-schneider/next-nav-guard/issues"},"dist":{"shasum":"5a391d6a9ac7a43bf90a0bf90763c331b46289b0","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.1.tgz","fileCount":45,"integrity":"sha512-q+I9eajCX5goFVjhdq1/utAfj7xbPGt3CUKIUVZfcrss7vYKlqxF0NX+La/jBjliJdywuopt1z/rc1ryglyjSQ==","signatures":[{"sig":"MEYCIQDfASO2pgXzi+Lo1otvdeqGGbMiBAQDuARedsvE9QBKMwIhALGmC58PMri3r2k5zFD9tCnLI5ZSsnhUHgjSrsw4QiLr","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43539},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"},"gitHead":"043f8488ea35676511ce650ee29a1f1aa8063222","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/next-nav-guard.git","type":"git"},"_npmVersion":"10.9.2","description":"Navigation guard for Next.js App Router — prevent navigation when there are unsaved changes.","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.0","tsup":"^8.2.4","react":"^19.0.0","playwright":"^1.52.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.52.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.1_1773890527240_0.9955457831872307","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"nextjs-nav-guard","version":"1.0.3","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.3","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://github.com/br-schneider/next-nav-guard#readme","bugs":{"url":"https://github.com/br-schneider/next-nav-guard/issues"},"dist":{"shasum":"d93cb783e5b9a1b3112c8c202529bbdd9b5dd350","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.3.tgz","fileCount":45,"integrity":"sha512-btXq/vFbxXagSrkwFexQNilKzbFdPcWyRhDAsoJkxp6HNQmSaitYuIYYksDX4fRYpp1abHU0m61hYgvAxeTNog==","signatures":[{"sig":"MEYCIQDHRo7gyAegvHElwNxZs6W0UyePCRGo08DzklqXRlh9IwIhAMtstCuAi4nUHY6Hhwj6+FDxrVd9ZAiyb4N8hFFGM75y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44103},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"27433a69049317041433eb0fa3be9bf3ff906fcd","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/next-nav-guard.git","type":"git"},"_npmVersion":"10.9.2","description":"Navigation guard for Next.js App Router — prevent navigation when there are unsaved changes.","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.0","tsup":"^8.2.4","react":"^19.0.0","playwright":"^1.52.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.52.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.3_1773892515641_0.3983406945739987","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"nextjs-nav-guard","version":"1.0.4","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.4","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard-personal-66985.unkey.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"2f12306f906a7a4b42b9da3d2daa469cb76015d2","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.4.tgz","fileCount":45,"integrity":"sha512-dtjy2YdvtzhbOMKtPw/hgDvYoX2UyPOlx/ww1Z7cZjJwX85pDgIq9zzRAi/c8+8kGyMMlVoFOcaLojFT9AXKkA==","signatures":[{"sig":"MEQCIDQI8SvIXsU1o9qfmZmDI5DBkC7rvj+ed7QgfYCERIptAiAw41H1+yLBy7XuvxdGANZwCcPItlUWB7mTha93G3Q0fw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44242},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"2978f6feefab6d1e1392704fa7a7582d508c1813","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"10.9.2","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"22.13.1","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.0","tsup":"^8.2.4","react":"^19.0.0","playwright":"^1.52.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.52.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.4_1774652295793_0.21659399035908877","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"nextjs-nav-guard","version":"1.0.5","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.5","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard-personal-66985.unkey.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"3bddbed664c9cc87b68445dbf18bcaf70b016af0","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.5.tgz","fileCount":45,"integrity":"sha512-wXjmxZgbkl4yjfrwULAOOhEKPUz4MNFFgfn2eaFGUbo7hCjCxCEXTG/L4Xxx+ecvZmxHA8GyWYfU+ZaSOoJZqg==","signatures":[{"sig":"MEQCIC2AY4qImrCW+2nZnPK5zWIC2i4mkQXiA1Duj2Jmxf5iAiAHnn8b+SkNRnpaVX4NTXA2vTNM550P35s4s55OV7dZPg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44049},"main":"./dist/index.js","_from":"file:nextjs-nav-guard-1.0.5.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"_resolved":"/private/var/folders/q0/qpcyw9s168gb4smm7q1c83n80000gn/T/37fb19b11743c209b015505f788c97f7/nextjs-nav-guard-1.0.5.tgz","_integrity":"sha512-wXjmxZgbkl4yjfrwULAOOhEKPUz4MNFFgfn2eaFGUbo7hCjCxCEXTG/L4Xxx+ecvZmxHA8GyWYfU+ZaSOoJZqg==","repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"10.9.4","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","_hasShrinkwrap":false,"devDependencies":{"next":"^16.2.9","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.5_1781810768933_0.18627728518683995","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"nextjs-nav-guard","version":"1.0.6","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.6","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard.vercel.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"50b5b1ffcb85fae6a7e12b333e9a8dbc80c1f227","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.6.tgz","fileCount":45,"integrity":"sha512-/II3kgWlfW3ql+hoCMOS6iF6OYwSkET2hx9slWfRf05E48uM5TYBjGFvDHY+u6kUM08DUenCbrrrRyRBBLOUJA==","signatures":[{"sig":"MEYCIQDc6HbVP0+PW+NmrlEGtTMMAXJ3u/5FjzS5z8Z/y/ypBgIhALzkunSclwHAC5lm1L8pJq3QRmlLrxDYlhFpi8vgRqUK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44556},"main":"./dist/index.js","pnpm":{"overrides":{"ws@8":"^8.21.0","glob@10":"^10.5.0","nanoid@3":"^3.3.13","undici@7":"^7.28.0","postcss@8":"^8.5.15","minimatch@9":"^9.0.9","picomatch@2":"^2.3.2","cross-spawn@7":"^7.0.6","wrangler>esbuild":"0.28.1","brace-expansion@2":"^2.1.1"}},"types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"1d15eb31681a18b3ebffa5334f9b75d6e9cda0f4","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"11.17.0","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.9","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.6_1783513205651_0.6167556957648426","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"nextjs-nav-guard","version":"1.0.7","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.7","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard.vercel.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"b88e6a673f83803ad35e8563aa2f78ae7f0aabdf","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.7.tgz","fileCount":45,"integrity":"sha512-fM9qdM98sfqpOcpEQxt95vxOijpCwXdh1f1IiQ8Zqgy8FL0OXURyp+k02FMHgtfALrvr4d7ExOAjxm11p4ZkIg==","signatures":[{"sig":"MEUCICsFKUc14GPok577jy9rNy4PyMIsLzyRtTzG3On7WpJXAiEAhPo5L3pkbhnm6DPcUZR1B0m3L2ivvvPHn/mIgQc7gPM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44551},"main":"./dist/index.js","pnpm":{"overrides":{"ws@8":"^8.21.0","glob@10":"^10.5.0","nanoid@3":"^3.3.13","undici@7":"^7.28.0","postcss@8":"^8.5.15","minimatch@9":"^9.0.9","picomatch@2":"^2.3.2","cross-spawn@7":"^7.0.6","wrangler>esbuild":"0.28.1","brace-expansion@2":"^2.1.1"}},"types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"3dbd7fb395cc2e5c9efe419e6cfc0623979f0354","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"11.17.0","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.9","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.7_1784736690174_0.9821946154368639","host":"s3://npm-registry-packages-npm-production"}},"1.0.8":{"name":"nextjs-nav-guard","version":"1.0.8","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.8","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard.vercel.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"00c4d20564e56b50554eb09863b0c4bed311462e","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.8.tgz","fileCount":45,"integrity":"sha512-Y0NgQC8px+UNPUhJWL7LTjVc7gVyREDrrShSl618A+irciiDATGaU1jmvbSZj5TYVWDKLlTqwS+Ft5xKcH3dtg==","signatures":[{"sig":"MEUCIBAYMmmYC+O3k0UPmfjiNzhpSSnvk3/hEFyOedGEdQDgAiEA544nrk0zbj2Er7YCY9+yHGZW4Kz5rxKQZnA7q4xqyjU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44619},"main":"./dist/index.js","pnpm":{"overrides":{"ws@8":"^8.21.0","sharp":"^0.35.0","glob@10":"^10.5.0","nanoid@3":"^3.3.13","undici@7":"^7.28.0","postcss@8":"^8.5.15","minimatch@9":"^9.0.9","picomatch@2":"^2.3.2","cross-spawn@7":"^7.0.6","wrangler>esbuild":"0.28.1","@hono/node-server":"^2.0.5","brace-expansion@2":"^2.1.2"}},"types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"32afe0b1ee17ec95505f40128f6e6c95abe4529c","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"11.17.0","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1","devDependencies":{"next":"^16.2.11","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.8_1784815713117_0.45610045430869883","host":"s3://npm-registry-packages-npm-production"}},"1.0.9":{"name":"nextjs-nav-guard","version":"1.0.9","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.0.9","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard.vercel.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"0805cfcd009de326af7165465900df75c64f3466","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.0.9.tgz","fileCount":45,"integrity":"sha512-3gn5Kecv6cgCXQacCXGIVJybLqPmGADJ1Ep/hi0aMQelV5zg8vBZvlkYHhVaS1d8GUY6K4mN1umrTV+KUIOjWQ==","signatures":[{"sig":"MEUCIDGcI/HaumQyHvMG5YM8bAS2YpRz3Gl/zVsNM7VcV7yAAiEA4M2gJ/HsFflJh6KRP4IDUuBs5COCN1kZu32+nYyF9P8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46108},"main":"./dist/index.js","pnpm":{"overrides":{"ws@8":"^8.21.0","sharp":"^0.35.0","glob@10":"^10.5.0","nanoid@3":"^3.3.13","undici@7":"^7.29.0","postcss@8":"^8.5.23","minimatch@9":"^9.0.9","picomatch@2":"^2.3.2","cross-spawn@7":"^7.0.6","wrangler>esbuild":"0.28.1","@hono/node-server":"^2.0.5","brace-expansion@2":"^2.1.4"}},"types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"f8725d04eb3dc18cc1c4b6536afeec3140307ae5","scripts":{"e2e":"playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","e2e:install":"playwright install","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"br-schneider","email":"brett.c.schneider@gmail.com"},"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"11.17.0","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.34.5+sha512.a4ee05f2f73658255bd6a89859c065a45c28a57daefae2c893a168ee2b73168c37b91e83e57ea67654ad03f03031746430e8bce38e362e042605fb8abc80192e","devDependencies":{"next":"^16.2.11","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.0.9_1786641104134_0.5909363957261964","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"nextjs-nav-guard","version":"1.1.0","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","_id":"nextjs-nav-guard@1.1.0","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"homepage":"https://nextjs-nav-guard.vercel.app","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"ebb3e078906bdc1b3200caa99af9d848f157b1a4","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.1.0.tgz","fileCount":51,"integrity":"sha512-J9xGM1RwUG0lSYLH5uKAuV6pFO+tdyQXE8bdVDtXGWB0t4EuNeyswNCAKPPs48a8p7cEy3KfwEZX58BNsvxs8Q==","signatures":[{"sig":"MEQCICEubpniKbm2+MC19iR6FLSgeA3F6EYCdQWUmIOKR4NhAiAyJFVhJ7KRL1yI5sf920TGT8N7WYK5PoukjnopyHOBng==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQC4MTPNxtLowsyACC3PGhlMyPVszgv0YUEoeiojKvzF/AIgFxETi5MTKji6Rm/IOmX3bQMe0GEmIelCZlHWXBDopvM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/nextjs-nav-guard@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60923},"main":"./dist/index.js","pnpm":{"overrides":{"ws@8":"^8.21.0","sharp":"^0.35.0","glob@10":"^10.5.0","nanoid@3":"^3.3.13","undici@7":"^7.29.0","postcss@8":"^8.5.23","minimatch@9":"^9.0.9","picomatch@2":"^2.3.2","cross-spawn@7":"^7.0.6","wrangler>esbuild":"0.28.1","@hono/node-server":"^2.0.5","brace-expansion@2":"^2.1.4"}},"types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"3b10c332f2182519e356ecdbbfb8ed261a65fcb6","scripts":{"e2e":"pnpm build && playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","prepack":"pnpm build","typecheck":"tsc --noEmit","e2e:install":"playwright install","e2e:production":"pnpm build && pnpm --dir example build && PLAYWRIGHT_PRODUCTION=1 playwright test","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5bd52a7c-e7b7-4aef-82f9-07f2439230ea"}},"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"11.19.1","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"sideEffects":false,"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"packageManager":"pnpm@10.34.5+sha512.a4ee05f2f73658255bd6a89859c065a45c28a57daefae2c893a168ee2b73168c37b91e83e57ea67654ad03f03031746430e8bce38e362e042605fb8abc80192e","devDependencies":{"next":"^16.2.11","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs-nav-guard_1.1.0_1789848348163_0.21658148967908342","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"_id":"nextjs-nav-guard@1.1.1","bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"dist":{"shasum":"3b5b10860dc53afe455ae67a8407315d4816013b","tarball":"https://registry.npmjs.org/nextjs-nav-guard/-/nextjs-nav-guard-1.1.1.tgz","fileCount":51,"integrity":"sha512-rNQ33W1lfjjg4zNVQP8//ZpZMy6fIXTz0LJZdOrBVTehXph4g4qABSvKZUxMPFmUdUJ4vy2wBuSyzeUPZHhh+Q==","signatures":[{"sig":"MEUCICgsxBTn1KaQJg2myz3Vu8Axz5Prju5r8TsabSEyI0QOAiEApc5H9mHyRwgUOQID8CM8E4VMC1V+V7v/ZXUM1Dm7vG8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICk62a3J7h1Rzw2Whap8+YoTepaYb3G8DE1ySe3TouADAiB+GFM2wcnSt9Vieibtn5dNaebkXZaZTAImt8FXfOckUQ=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/nextjs-nav-guard@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":61797},"main":"./dist/index.js","name":"nextjs-nav-guard","pnpm":{"overrides":{"ws@8":"^8.21.0","sharp":"^0.35.4","glob@10":"^10.5.0","nanoid@3":"^3.3.19","undici@7":"^7.29.0","postcss@8":"^8.5.23","minimatch@9":"^9.0.9","picomatch@2":"^2.3.2","cross-spawn@7":"^7.0.6","wrangler>esbuild":"0.28.1","@hono/node-server":"^2.0.5","brace-expansion@2":"^2.1.4","postcss-selector-parser@6":"^6.1.4","baseline-browser-mapping@2":"^2.11.25"}},"types":"./dist/index.d.ts","author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"2ee3112dc7aa183d6db8d0870a391cb67ac95b94","license":"MIT","scripts":{"e2e":"pnpm build && playwright test","build":"tsc -p .","watch":"tsc --watch -p .","e2e:ui":"playwright test --ui","prepack":"pnpm build","typecheck":"tsc --noEmit","e2e:install":"playwright install","e2e:base-path":"pnpm build && PLAYWRIGHT_BASE_PATH=/docs pnpm --dir example build && PLAYWRIGHT_BASE_PATH=/docs PLAYWRIGHT_PRODUCTION=1 playwright test","e2e:production":"pnpm build && pnpm --dir example build && PLAYWRIGHT_PRODUCTION=1 playwright test","check:packaging":"pnpm dlx @arethetypeswrong/cli --pack ."},"version":"1.1.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1329400d-63b9-415d-9f31-1b17c008196d"}},"homepage":"https://nextjs-nav-guard.vercel.app","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"_npmVersion":"11.19.1","description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","directories":{},"maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"sideEffects":false,"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"packageManager":"pnpm@10.34.5+sha512.a4ee05f2f73658255bd6a89859c065a45c28a57daefae2c893a168ee2b73168c37b91e83e57ea67654ad03f03031746430e8bce38e362e042605fb8abc80192e","devDependencies":{"next":"^16.3.5","react":"^19.0.0","playwright":"^1.61.0","typescript":"^5.6.2","@types/node":"^20","@types/react":"^19","@playwright/test":"^1.61.0"},"peerDependencies":{"next":"^14 || ^15 || ^16","react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nextjs-nav-guard_1.1.1_1790035160320_0.07992447923562507"}}},"time":{"created":"2026-03-19T02:56:42.008Z","modified":"2026-09-21T23:59:20.727Z","1.0.0":"2026-03-19T02:56:42.264Z","1.0.1":"2026-03-19T03:22:07.366Z","1.0.3":"2026-03-19T03:55:15.789Z","1.0.4":"2026-03-27T22:58:15.961Z","1.0.5":"2026-06-18T19:26:09.085Z","1.0.6":"2026-07-08T12:20:05.791Z","1.0.7":"2026-07-22T16:11:30.305Z","1.0.8":"2026-07-23T14:08:33.253Z","1.0.9":"2026-08-13T17:11:44.283Z","1.1.0":"2026-09-19T20:05:48.267Z","1.1.1":"2026-09-21T23:59:20.411Z"},"bugs":{"url":"https://github.com/br-schneider/nextjs-nav-guard/issues"},"author":{"name":"Brett Schneider","email":"brett.c.schneider@gmail.com"},"license":"MIT","homepage":"https://nextjs-nav-guard.vercel.app","keywords":["nextjs","navigation","guard","unsaved-changes","app-router","route-guard"],"repository":{"url":"git+https://github.com/br-schneider/nextjs-nav-guard.git","type":"git"},"description":"Prevent accidental navigation away from unsaved changes in Next.js App Router.","maintainers":[{"name":"br-schneider","email":"brett.c.schneider@gmail.com"}],"readme":"# nextjs-nav-guard\n\nNavigation guard for Next.js App Router. Prevent users from accidentally leaving pages with unsaved changes.\n\n**Version note:** The navigation concurrency fixes and `NavigationGuardLink` documented here require version `1.1.0` or later. They are not included in `1.0.9`. See the [changelog](CHANGELOG) for release details.\n\nMaintained by [Brett Schneider](https://github.com/br-schneider), based on [`next-navigation-guard`](https://github.com/LayerXcom/next-navigation-guard) by [LayerX](https://github.com/LayerXcom). This fork focuses on App Router compatibility, predictable confirmation behavior, and browser regression tests.\n\n[Documentation](https://nextjs-nav-guard.vercel.app/) · [Run the demo](#demo) · [Contribute](CONTRIBUTING.md) · [Roadmap](ROADMAP.md)\n\n[![Compatibility tests](https://github.com/br-schneider/nextjs-nav-guard/actions/workflows/e2e-tests.yml/badge.svg)](https://github.com/br-schneider/nextjs-nav-guard/actions/workflows/e2e-tests.yml)\n\n## What's different from the original?\n\n- **Next.js 16.2+ support:** fixed a runtime crash caused by `null` `history.state` in newer Next.js versions\n- **Resilient internals:** private `next/dist/*` imports are centralized; if the context cannot be loaded, router and link interception are unavailable and a development warning explains it\n- **Fixed React hooks violation:** removed a conditional `useContext` call that broke the rules of hooks\n- **Pages Router removed:** focused on App Router only; Next.js still supports Pages Router, but this package does not\n- **Better error messages:** actionable errors when the provider is missing, with code examples\n- **Predictable confirmation:** overlapping attempts are blocked until the first attempt settles; unmounting or disabling a guard cancels its pending attempt\n- **Explicit link integration:** `NavigationGuardLink` preserves `replace`, `scroll`, `onClick`, and `onNavigate`\n- **Actively maintained:** compatible with Next.js 14, 15, and 16 (including 16.2+)\n\n## Install\n\n```bash\nnpm install nextjs-nav-guard\n```\n\n## Setup\n\nWrap your app with `NavigationGuardProvider` in your root layout. Mount the provider unconditionally, including while authentication or other async content is loading. Put loading branches inside it so its history listener registers before Next.js handles browser navigation.\n\n```tsx\n// app/layout.tsx\nimport { NavigationGuardProvider } from \"nextjs-nav-guard\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang=\"en\">\n      <body>\n        <NavigationGuardProvider>{children}</NavigationGuardProvider>\n      </body>\n    </html>\n  );\n}\n```\n\n## Usage\n\n### Simple: `window.confirm()`\n\n```tsx\n\"use client\";\n\nimport { useState } from \"react\";\nimport { useNavigationGuard } from \"nextjs-nav-guard\";\n\nexport default function NameForm() {\n  const [name, setName] = useState(\"\");\n  useNavigationGuard({\n    enabled: name !== \"\",\n    confirm: () => window.confirm(\"Discard your changes?\"),\n  });\n\n  return (\n    <label>\n      Name\n      <input value={name} onChange={(event) => setName(event.target.value)} />\n    </label>\n  );\n}\n```\n\n### Custom dialog UI\n\nIf you want full control over the confirmation UI, omit the `confirm` callback. The hook returns `active`, `accept`, and `reject` to drive your own dialog:\n\n```tsx\n\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useNavigationGuard } from \"nextjs-nav-guard\";\n\nexport default function NoteForm() {\n  const [note, setNote] = useState(\"\");\n  const dialogRef = useRef<HTMLDialogElement>(null);\n  const guard = useNavigationGuard({ enabled: note !== \"\" });\n\n  useEffect(() => {\n    const dialog = dialogRef.current;\n    if (guard.active && dialog && !dialog.open) dialog.showModal();\n    if (!guard.active && dialog?.open) dialog.close();\n  }, [guard.active]);\n\n  return (\n    <>\n      <label>\n        Note\n        <textarea value={note} onChange={(event) => setNote(event.target.value)} />\n      </label>\n      <dialog ref={dialogRef} aria-label=\"Discard your changes?\" onCancel={(event) => {\n        event.preventDefault();\n        guard.reject();\n      }}>\n        <p>You have unsaved changes.</p>\n        <button onClick={guard.reject}>Keep editing</button>\n        <button onClick={guard.accept}>Discard and leave</button>\n      </dialog>\n    </>\n  );\n}\n```\n\n### Links with options and callbacks\n\nUse `NavigationGuardLink` when a link needs replacement history, scroll control, or click/navigation callbacks. It wraps Next.js Link and works with the same provider and guards.\n\n```tsx\nimport { NavigationGuardLink } from \"nextjs-nav-guard\";\n\nexport default function SettingsLink() {\n  return (\n    <NavigationGuardLink href=\"/settings\" replace scroll={false}>\n      Settings\n    </NavigationGuardLink>\n  );\n}\n```\n\n`onClick` and `onNavigate` can prevent navigation. Modified clicks, new tabs, downloads, and external links retain their normal browser behavior. Legacy Link children are not supported by this component.\n\n### Save and leave\n\nAfter a successful save, commit the clean form state before calling the router. Do not clear the dirty state if saving fails. The [complete demo](example/src/components/FormDemo.tsx) shows this with `flushSync`, a browser-local save, and `router.push()`.\n\n### Conditional guard with navigation type\n\nThe `enabled` option can be a function that receives the navigation type, letting you guard selectively:\n\n```tsx\nuseNavigationGuard({\n  enabled: ({ type }) => {\n    // Only guard against link clicks and back/forward, not refresh\n    return type !== \"refresh\" && type !== \"beforeunload\";\n  },\n  confirm: () => window.confirm(\"Discard changes?\"),\n});\n```\n\n## API\n\n### `<NavigationGuardProvider>`\n\nWrap your app with this provider. It intercepts navigation at multiple levels:\n\n- **Router methods:** `router.push()`, `router.replace()`, `router.refresh()`\n- **Link clicks:** `<Link>` and `<a>` tag clicks\n- **Browser navigation:** back and forward buttons, `history.go()`\n- **Page unload:** tab close, `window.location` changes\n\n### `useNavigationGuard(options)`\n\nRegister a navigation guard. Returns `{ active, accept, reject }`.\n\nOnly one confirmation runs at a time within a provider. The first attempted destination wins; further attempts are blocked until it settles. Every enabled guard must accept. Rejected promises and thrown callbacks block navigation.\n\nUnmounting a guard, setting `enabled: false`, or setting `disableForTesting: true` cancels its pending confirmation. These actions do not automatically perform the cancelled navigation.\n\nIn version 1.1.1 (unreleased), adding, removing, or replacing a registered guard while confirmation is pending cancels that attempt when the confirmation finishes. Start a new navigation to evaluate the current guards. Accepted links also preserve a configured Next.js `basePath` without adding it twice.\n\n#### Options\n\n| Option | Type | Default | Description |\n|---|---|---|---|\n| `enabled` | `boolean \\| (params) => boolean` | `true` | Whether the guard is active. Can be a function receiving `{ to, type }` |\n| `confirm` | `(params) => boolean \\| Promise<boolean>` | `undefined` | Sync or async confirmation callback. Return `true` to allow, `false` to block. If omitted, the hook uses async mode |\n| `disableForTesting` | `boolean` | `false` | Makes the hook a complete no-op. No provider required. Use in tests and Storybook |\n\n#### Return value\n\n| Property | Type | Description |\n|---|---|---|\n| `active` | `boolean` | `true` when a navigation attempt is pending confirmation (async mode only) |\n| `accept` | `() => void` | Allow the pending navigation |\n| `reject` | `() => void` | Block the pending navigation |\n\n#### Navigation params\n\nThe `enabled` function and `confirm` callback both receive:\n\n| Property | Type | Description |\n|---|---|---|\n| `to` | `string` | The target URL |\n| `type` | `\"push\" \\| \"replace\" \\| \"refresh\" \\| \"popstate\" \\| \"beforeunload\"` | How the navigation was triggered |\n\n### `NavigationGuard` (type export)\n\nThe callback type, exported for convenience:\n\n```tsx\nimport type { NavigationGuard } from \"nextjs-nav-guard\";\n\nconst myGuard: NavigationGuard = ({ to, type }) => {\n  return window.confirm(`Navigate to ${to}?`);\n};\n```\n\n## Migrating from `next-navigation-guard`\n\nThe API is identical. Just change the import:\n\n```diff\n- import { NavigationGuardProvider, useNavigationGuard } from \"next-navigation-guard\";\n+ import { NavigationGuardProvider, useNavigationGuard } from \"nextjs-nav-guard\";\n```\n\nIf you were using Pages Router, you'll need to switch to App Router. Pages Router support has been removed.\n\n## Limitations\n\n### Reloads and tab closes use the browser dialog\n\nCustom dialog UIs only work for client-side navigations. When the browser fires `beforeunload` (page reload, tab close, leaving for another site), browsers do not allow async work or custom UI. The library can only request the browser's built-in confirmation dialog, and its text and appearance cannot be customized.\n\n### Safari external-navigation limitation\n\nIn verification on Safari 27.0 and Playwright WebKit 26.5, cross-site navigation could leave a dirty page without firing `beforeunload`. The same behavior reproduced on a plain HTML page without React, Next.js, or this library. A tab-close prompt worked, and cancelling it preserved the unsaved text. These are separate browser behaviors.\n\nDo not treat unload protection as guaranteed protection for external links or address-bar navigation in Safari. Save drafts independently when losing work would be costly. The library cannot cancel a browser event that never fires.\n\n### Direct History API calls are not guarded\n\nCalls made directly through `window.history.pushState()` or `window.history.replaceState()` bypass the guard. If you call either method yourself, confirm the navigation before calling it.\n\n### Guarded link clicks are handled programmatically\n\nTo intercept `<Link>` and `<a>` clicks, the provider registers a capture-phase click handler. While a guard is enabled, that handler prevents the original click and stops its propagation while the confirmation is pending, then navigates via the App Router if accepted. Automatic interception cannot recover a standard Link's React-only `replace` or `scroll` props, and it suppresses the original click callbacks. Use `NavigationGuardLink` to preserve these behaviors. Automatic interception handles relative URLs; use `NavigationGuardLink` for same-origin absolute URLs.\n\n### Mount the provider before async content\n\nThe provider's history listener must register before Next.js handles `popstate`. A provider first mounted after a loading screen or session check may miss Back/Forward navigation even while link guarding works. Keep the provider mounted in the root layout and place conditional content inside it. See the [community report](https://github.com/br-schneider/nextjs-nav-guard/pull/2).\n\n### Browser limits\n\n`beforeunload` is not reliable when a mobile browser is closed from the app switcher, and browsers require prior user interaction before displaying a prompt. Pair guards with draft saving where data loss is costly. Passing `enabled: false` removes the unload listener. Function-valued predicates retain a listener and are evaluated when unloading, so stable callbacks can read current form state. Predicates should be pure. A pending confirmation is cancelled when a render observes its predicate becoming false.\n\n### Next.js 16.2 drops query-only replacements after an async guard\n\nNext.js 16.2 has an App Router regression: after an async guard is accepted, a `router.replace()` that changes only the query string may be dropped. This is a Next.js bug, fixed in Next.js 16.3.0, and the library cannot safely work around it. If your app uses this pattern, stay on 16.1.x or upgrade to Next.js 16.3.0 or later.\n\n## Compatibility\n\n| Next.js | React | Status |\n|---|---|---|\n| 14.x | 18 | Supported |\n| 15.x | 19 | Supported and tested for App Router |\n| 16.x | 19 | Supported (16.2 has a known Next.js router bug, see [Limitations](#limitations)) |\n\n## Demo\n\n```bash\ncorepack enable\npnpm install --frozen-lockfile\npnpm build\npnpm --dir example dev\n```\n\nOpen http://localhost:3000. Edit the note, try leaving, cancel with Escape, or save and leave. The demo stores a note only in your browser and does not send it to a server. `/playground` contains controls for reproducing guard lifecycle and router issues.\n\n## Community\n\nBug reports, reproductions, tests, and documentation all help. Start with the [contribution guide](CONTRIBUTING.md) and [roadmap](ROADMAP.md), or [ask a question](https://github.com/br-schneider/nextjs-nav-guard/discussions).\n\nIf you use the package in production, share the integration and the navigation paths you rely on. Contributors are credited in release notes. Thanks to [Bruno Papista](https://github.com/papistacoding) for documenting the provider mounting issue.\n\n## License\n\nMIT license. Originally created by [LayerX Inc.](https://github.com/LayerXcom)\n","readmeFilename":"README.md"}