Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-prompt

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-prompt - npm Package Compare versions

Comparing version 0.2.0-beta-1 to 0.2.0-beta-2

31

dist/index.cjs.js

@@ -1,31 +0,2 @@

"use strict";var Y=Object.create;var R=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var V=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ee=(e,t)=>{for(var n in t)R(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Q(t))!Z.call(e,r)&&r!==n&&R(e,r,{get:()=>t[r],enumerable:!(a=G(t,r))||a.enumerable});return e};var y=(e,t,n)=>(n=e!=null?Y(X(e)):{},D(t||!e||!e.__esModule?R(n,"default",{value:e,enumerable:!0}):n,e)),te=e=>D(R({},"__esModule",{value:!0}),e);var F=V(o=>{"use strict";var g=Symbol.for("react.element"),ne=Symbol.for("react.portal"),re=Symbol.for("react.fragment"),oe=Symbol.for("react.strict_mode"),ae=Symbol.for("react.profiler"),ie=Symbol.for("react.provider"),se=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),le=Symbol.for("react.suspense"),ce=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),L=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=L&&e[L]||e["@@iterator"],typeof e=="function"?e:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,I={};function m(e,t,n){this.props=e,this.context=t,this.refs=I,this.updater=n||j}m.prototype.isReactComponent={};m.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function B(){}B.prototype=m.prototype;function S(e,t,n){this.props=e,this.context=t,this.refs=I,this.updater=n||j}var b=S.prototype=new B;b.constructor=S;A(b,m.prototype);b.isPureReactComponent=!0;var $=Array.isArray,U=Object.prototype.hasOwnProperty,x={current:null},W={key:!0,ref:!0,__self:!0,__source:!0};function M(e,t,n){var a,r={},i=null,u=null;if(t!=null)for(a in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(i=""+t.key),t)U.call(t,a)&&!W.hasOwnProperty(a)&&(r[a]=t[a]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var l=Array(s),f=0;f<s;f++)l[f]=arguments[f+2];r.children=l}if(e&&e.defaultProps)for(a in s=e.defaultProps,s)r[a]===void 0&&(r[a]=s[a]);return{$$typeof:g,type:e,key:i,ref:u,props:r,_owner:x.current}}function he(e,t){return{$$typeof:g,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function O(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function de(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var T=/\/+/g;function C(e,t){return typeof e=="object"&&e!==null&&e.key!=null?de(""+e.key):t.toString(36)}function E(e,t,n,a,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var u=!1;if(e===null)u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case g:case ne:u=!0}}if(u)return u=e,r=r(u),e=a===""?"."+C(u,0):a,$(r)?(n="",e!=null&&(n=e.replace(T,"$&/")+"/"),E(r,t,n,"",function(f){return f})):r!=null&&(O(r)&&(r=he(r,n+(!r.key||u&&u.key===r.key?"":(""+r.key).replace(T,"$&/")+"/")+e)),t.push(r)),1;if(u=0,a=a===""?".":a+":",$(e))for(var s=0;s<e.length;s++){i=e[s];var l=a+C(i,s);u+=E(i,t,n,l,r)}else if(l=pe(e),typeof l=="function")for(e=l.call(e),s=0;!(i=e.next()).done;)i=i.value,l=a+C(i,s++),u+=E(i,t,n,l,r);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return u}function N(e,t,n){if(e==null)return e;var a=[],r=0;return E(e,a,"","",function(i){return t.call(n,i,r++)}),a}function me(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var c={current:null},P={transition:null},ve={ReactCurrentDispatcher:c,ReactCurrentBatchConfig:P,ReactCurrentOwner:x};o.Children={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(t){return t})||[]},only:function(e){if(!O(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};o.Component=m;o.Fragment=re;o.Profiler=ae;o.PureComponent=S;o.StrictMode=oe;o.Suspense=le;o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ve;o.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var a=A({},e.props),r=e.key,i=e.ref,u=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,u=x.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in t)U.call(t,l)&&!W.hasOwnProperty(l)&&(a[l]=t[l]===void 0&&s!==void 0?s[l]:t[l])}var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){s=Array(l);for(var f=0;f<l;f++)s[f]=arguments[f+2];a.children=s}return{$$typeof:g,type:e.type,key:r,ref:i,props:a,_owner:u}};o.createContext=function(e){return e={$$typeof:se,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ie,_context:e},e.Consumer=e};o.createElement=M;o.createFactory=function(e){var t=M.bind(null,e);return t.type=e,t};o.createRef=function(){return{current:null}};o.forwardRef=function(e){return{$$typeof:ue,render:e}};o.isValidElement=O;o.lazy=function(e){return{$$typeof:fe,_payload:{_status:-1,_result:e},_init:me}};o.memo=function(e,t){return{$$typeof:ce,type:e,compare:t===void 0?null:t}};o.startTransition=function(e){var t=P.transition;P.transition={};try{e()}finally{P.transition=t}};o.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};o.useCallback=function(e,t){return c.current.useCallback(e,t)};o.useContext=function(e){return c.current.useContext(e)};o.useDebugValue=function(){};o.useDeferredValue=function(e){return c.current.useDeferredValue(e)};o.useEffect=function(e,t){return c.current.useEffect(e,t)};o.useId=function(){return c.current.useId()};o.useImperativeHandle=function(e,t,n){return c.current.useImperativeHandle(e,t,n)};o.useInsertionEffect=function(e,t){return c.current.useInsertionEffect(e,t)};o.useLayoutEffect=function(e,t){return c.current.useLayoutEffect(e,t)};o.useMemo=function(e,t){return c.current.useMemo(e,t)};o.useReducer=function(e,t,n){return c.current.useReducer(e,t,n)};o.useRef=function(e){return c.current.useRef(e)};o.useState=function(e){return c.current.useState(e)};o.useSyncExternalStore=function(e,t,n){return c.current.useSyncExternalStore(e,t,n)};o.useTransition=function(){return c.current.useTransition()};o.version="18.2.0"});var v=V((_e,H)=>{"use strict";H.exports=F()});var Ee={};ee(Ee,{default:()=>Ne});module.exports=te(Ee);var _=y(v());var h=y(v()),q=()=>{},J={isActive:!1,hasConfirmed:!1,proceed:q,cancel:q},ye=()=>{let[e,t]=(0,h.useState)(J);(0,h.useEffect)(()=>(e.isActive&&(window.onbeforeunload=()=>!1),()=>{e.isActive&&(window.onbeforeunload=null)}),[e]);let n=(0,h.useCallback)(()=>new Promise((i,u)=>{t(s=>({...s,isActive:!0,proceed:i,cancel:u}))}).then(()=>(t({...e,isActive:!1,hasConfirmed:!0}),!0),()=>(t({...e,isActive:!1}),!1)),[]),a=(0,h.useCallback)(()=>{},[]);return{...e,onConfirm:n,resetConfirmation:a}},z=ye;var w=y(v());var d=y(v());var p=y(v());var k=(0,p.createContext)(null);function ge(e,t=!0){let{navigator:n}=(0,w.useContext)(k);(0,w.useEffect)(()=>{if(!t)return;let a=n.block(r=>{let i={...r,retry(){a(),r.retry()}};e(i)});return a},[n,e,t])}var K=ge;var Re=({when:e,children:t})=>{let{isActive:n,proceed:a,cancel:r,onConfirm:i,hasConfirmed:u,resetConfirmation:s}=z(),l=(0,_.useCallback)(async f=>{await i()&&(s(),f.retry())},[s,i]);return K(l,e&&!u),_.default.createElement("div",null,t({isActive:n,onConfirm:a,onCancel:r}))},Ne=Re;
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* React Router DOM v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* React Router v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use strict";var R=Object.create;var s=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var P=(e,o)=>{for(var n in o)s(e,n,{get:o[n],enumerable:!0})},m=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of A(o))!x.call(e,t)&&t!==n&&s(e,t,{get:()=>o[t],enumerable:!(r=w(o,t))||r.enumerable});return e};var S=(e,o,n)=>(n=e!=null?R(T(e)):{},m(o||!e||!e.__esModule?s(n,"default",{value:e,enumerable:!0}):n,e)),h=e=>m(s({},"__esModule",{value:!0}),e);var E={};P(E,{default:()=>N});module.exports=h(E);var l=S(require("react"));var i=require("react"),d=()=>{},p={isActive:!1,hasConfirmed:!1,proceed:d,cancel:d},g=()=>{let[e,o]=(0,i.useState)(p);(0,i.useEffect)(()=>(e.isActive&&(window.onbeforeunload=()=>!1),()=>{e.isActive&&(window.onbeforeunload=null)}),[e]);let n=(0,i.useCallback)(()=>new Promise((a,u)=>{o(c=>({...c,isActive:!0,proceed:a,cancel:u}))}).then(()=>(o({...e,isActive:!1,hasConfirmed:!0}),!0),()=>(o({...e,isActive:!1}),!1)),[]),r=(0,i.useCallback)(()=>{},[]);return{...e,onConfirm:n,resetConfirmation:r}},v=g;var f=require("react"),C=require("react-router-dom");function B(e,o=!0){let{navigator:n}=(0,f.useContext)(C.UNSAFE_NavigationContext);(0,f.useEffect)(()=>{if(!o)return;let r=n.block(t=>{let a={...t,retry(){r(),t.retry()}};e(a)});return r},[n,e,o])}var b=B;var I=({when:e,children:o})=>{let{isActive:n,proceed:r,cancel:t,onConfirm:a,hasConfirmed:u,resetConfirmation:c}=v(),k=(0,l.useCallback)(async y=>{await a()&&(c(),y.retry())},[c,a]);return b(k,e&&!u),l.default.createElement("div",null,o({isActive:n,onConfirm:r,onCancel:t}))},N=I;
//# sourceMappingURL=index.cjs.js.map

@@ -1,31 +0,2 @@

var K=Object.create;var k=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var V=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Z=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!X.call(e,r)&&r!==n&&k(e,r,{get:()=>t[r],enumerable:!(a=Y(t,r))||a.enumerable});return e};var y=(e,t,n)=>(n=e!=null?K(Q(e)):{},Z(t||!e||!e.__esModule?k(n,"default",{value:e,enumerable:!0}):n,e));var M=V(o=>{"use strict";var g=Symbol.for("react.element"),ee=Symbol.for("react.portal"),te=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),re=Symbol.for("react.profiler"),oe=Symbol.for("react.provider"),ae=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),ue=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),D=Symbol.iterator;function ce(e){return e===null||typeof e!="object"?null:(e=D&&e[D]||e["@@iterator"],typeof e=="function"?e:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,A={};function m(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||T}m.prototype.isReactComponent={};m.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function I(){}I.prototype=m.prototype;function C(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||T}var S=C.prototype=new I;S.constructor=C;j(S,m.prototype);S.isPureReactComponent=!0;var L=Array.isArray,B=Object.prototype.hasOwnProperty,b={current:null},U={key:!0,ref:!0,__self:!0,__source:!0};function W(e,t,n){var a,r={},i=null,u=null;if(t!=null)for(a in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(i=""+t.key),t)B.call(t,a)&&!U.hasOwnProperty(a)&&(r[a]=t[a]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var l=Array(s),f=0;f<s;f++)l[f]=arguments[f+2];r.children=l}if(e&&e.defaultProps)for(a in s=e.defaultProps,s)r[a]===void 0&&(r[a]=s[a]);return{$$typeof:g,type:e,key:i,ref:u,props:r,_owner:b.current}}function fe(e,t){return{$$typeof:g,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function x(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function pe(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var $=/\/+/g;function _(e,t){return typeof e=="object"&&e!==null&&e.key!=null?pe(""+e.key):t.toString(36)}function N(e,t,n,a,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var u=!1;if(e===null)u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case g:case ee:u=!0}}if(u)return u=e,r=r(u),e=a===""?"."+_(u,0):a,L(r)?(n="",e!=null&&(n=e.replace($,"$&/")+"/"),N(r,t,n,"",function(f){return f})):r!=null&&(x(r)&&(r=fe(r,n+(!r.key||u&&u.key===r.key?"":(""+r.key).replace($,"$&/")+"/")+e)),t.push(r)),1;if(u=0,a=a===""?".":a+":",L(e))for(var s=0;s<e.length;s++){i=e[s];var l=a+_(i,s);u+=N(i,t,n,l,r)}else if(l=ce(e),typeof l=="function")for(e=l.call(e),s=0;!(i=e.next()).done;)i=i.value,l=a+_(i,s++),u+=N(i,t,n,l,r);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return u}function R(e,t,n){if(e==null)return e;var a=[],r=0;return N(e,a,"","",function(i){return t.call(n,i,r++)}),a}function he(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var c={current:null},E={transition:null},de={ReactCurrentDispatcher:c,ReactCurrentBatchConfig:E,ReactCurrentOwner:b};o.Children={map:R,forEach:function(e,t,n){R(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return R(e,function(){t++}),t},toArray:function(e){return R(e,function(t){return t})||[]},only:function(e){if(!x(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};o.Component=m;o.Fragment=te;o.Profiler=re;o.PureComponent=C;o.StrictMode=ne;o.Suspense=se;o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=de;o.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var a=j({},e.props),r=e.key,i=e.ref,u=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,u=b.current),t.key!==void 0&&(r=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in t)B.call(t,l)&&!U.hasOwnProperty(l)&&(a[l]=t[l]===void 0&&s!==void 0?s[l]:t[l])}var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){s=Array(l);for(var f=0;f<l;f++)s[f]=arguments[f+2];a.children=s}return{$$typeof:g,type:e.type,key:r,ref:i,props:a,_owner:u}};o.createContext=function(e){return e={$$typeof:ae,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:oe,_context:e},e.Consumer=e};o.createElement=W;o.createFactory=function(e){var t=W.bind(null,e);return t.type=e,t};o.createRef=function(){return{current:null}};o.forwardRef=function(e){return{$$typeof:ie,render:e}};o.isValidElement=x;o.lazy=function(e){return{$$typeof:le,_payload:{_status:-1,_result:e},_init:he}};o.memo=function(e,t){return{$$typeof:ue,type:e,compare:t===void 0?null:t}};o.startTransition=function(e){var t=E.transition;E.transition={};try{e()}finally{E.transition=t}};o.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};o.useCallback=function(e,t){return c.current.useCallback(e,t)};o.useContext=function(e){return c.current.useContext(e)};o.useDebugValue=function(){};o.useDeferredValue=function(e){return c.current.useDeferredValue(e)};o.useEffect=function(e,t){return c.current.useEffect(e,t)};o.useId=function(){return c.current.useId()};o.useImperativeHandle=function(e,t,n){return c.current.useImperativeHandle(e,t,n)};o.useInsertionEffect=function(e,t){return c.current.useInsertionEffect(e,t)};o.useLayoutEffect=function(e,t){return c.current.useLayoutEffect(e,t)};o.useMemo=function(e,t){return c.current.useMemo(e,t)};o.useReducer=function(e,t,n){return c.current.useReducer(e,t,n)};o.useRef=function(e){return c.current.useRef(e)};o.useState=function(e){return c.current.useState(e)};o.useSyncExternalStore=function(e,t,n){return c.current.useSyncExternalStore(e,t,n)};o.useTransition=function(){return c.current.useTransition()};o.version="18.2.0"});var v=V((Ne,F)=>{"use strict";F.exports=M()});var w=y(v());var h=y(v()),H=()=>{},q={isActive:!1,hasConfirmed:!1,proceed:H,cancel:H},me=()=>{let[e,t]=(0,h.useState)(q);(0,h.useEffect)(()=>(e.isActive&&(window.onbeforeunload=()=>!1),()=>{e.isActive&&(window.onbeforeunload=null)}),[e]);let n=(0,h.useCallback)(()=>new Promise((i,u)=>{t(s=>({...s,isActive:!0,proceed:i,cancel:u}))}).then(()=>(t({...e,isActive:!1,hasConfirmed:!0}),!0),()=>(t({...e,isActive:!1}),!1)),[]),a=(0,h.useCallback)(()=>{},[]);return{...e,onConfirm:n,resetConfirmation:a}},J=me;var P=y(v());var d=y(v());var p=y(v());var O=(0,p.createContext)(null);function ve(e,t=!0){let{navigator:n}=(0,P.useContext)(O);(0,P.useEffect)(()=>{if(!t)return;let a=n.block(r=>{let i={...r,retry(){a(),r.retry()}};e(i)});return a},[n,e,t])}var z=ve;var ye=({when:e,children:t})=>{let{isActive:n,proceed:a,cancel:r,onConfirm:i,hasConfirmed:u,resetConfirmation:s}=J(),l=(0,w.useCallback)(async f=>{await i()&&(s(),f.retry())},[s,i]);return z(l,e&&!u),w.default.createElement("div",null,t({isActive:n,onConfirm:a,onCancel:r}))},rt=ye;export{rt as default};
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* React Router DOM v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* React Router v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import A,{useCallback as T}from"react";import{useState as v,useEffect as C,useCallback as s}from"react";var f=()=>{},l={isActive:!1,hasConfirmed:!1,proceed:f,cancel:f},b=()=>{let[e,o]=v(l);C(()=>(e.isActive&&(window.onbeforeunload=()=>!1),()=>{e.isActive&&(window.onbeforeunload=null)}),[e]);let n=s(()=>new Promise((r,c)=>{o(a=>({...a,isActive:!0,proceed:r,cancel:c}))}).then(()=>(o({...e,isActive:!1,hasConfirmed:!0}),!0),()=>(o({...e,isActive:!1}),!1)),[]),t=s(()=>{},[]);return{...e,onConfirm:n,resetConfirmation:t}},u=b;import{useContext as k,useEffect as y}from"react";import{UNSAFE_NavigationContext as R}from"react-router-dom";function w(e,o=!0){let{navigator:n}=k(R);y(()=>{if(!o)return;let t=n.block(i=>{let r={...i,retry(){t(),i.retry()}};e(r)});return t},[n,e,o])}var m=w;var x=({when:e,children:o})=>{let{isActive:n,proceed:t,cancel:i,onConfirm:r,hasConfirmed:c,resetConfirmation:a}=u(),d=T(async p=>{await r()&&(a(),p.retry())},[a,r]);return m(d,e&&!c),A.createElement("div",null,o({isActive:n,onConfirm:t,onCancel:i}))},F=x;export{F as default};
//# sourceMappingURL=index.esm.js.map

14

package.json
{
"name": "react-router-prompt",
"version": "0.2.0-beta-1",
"version": "0.2.0-beta-2",
"description": "React Router Navigation Prompt for v6",

@@ -39,6 +39,2 @@ "main": "dist/index.cjs.js",

"live-server": "^1.2.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-router-dom": "^6.3.0",
"rimraf": "^3.0.2",

@@ -56,3 +52,9 @@ "serve-handler": "^6.1.3",

"dist"
]
],
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-router-dom": "^6.3.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc