gatsby-link 4.17.0 → 4.18.0-alpha-drupal-self-reference.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ var e=require("prop-types"),t=require("react"),n=require("@gatsbyjs/reach-router"),r=require("@gatsbyjs/reach-router/lib/utils"),o=require("gatsby-page-utils/apply-trailing-slash-option");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/a(e),s=/*#__PURE__*/a(t);function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function u(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.slice(o),t=t.slice(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.slice(a),t=t.slice(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}var p=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,f=function(e){if("string"==typeof e)return!function(e){return p.test(e)}(e)},h=function(){return"production"!==process.env.NODE_ENV?"undefined"!=typeof __PATH_PREFIX__?__PATH_PREFIX__:void 0:__PATH_PREFIX__};function d(e,t){var n,r;if(void 0===t&&(t="production"!==process.env.NODE_ENV?"undefined"!=typeof __BASE_PATH__?__BASE_PATH__:void 0:__BASE_PATH__),!f(e))return e;if(e.startsWith("./")||e.startsWith("../"))return e;var o=null!=(n=null!=(r=t)?r:h())?n:"/";return""+(null!=o&&o.endsWith("/")?o.slice(0,-1):o)+(e.startsWith("/")?e:"/"+e)}var _=function(e){return null==e?void 0:e.startsWith("/")},v=function(){return"undefined"!=typeof __TRAILING_SLASH__?__TRAILING_SLASH__:void 0},y=function(e,t){if("number"==typeof e)return e;if(!f(e))return e;var n=u(e),a=n.pathname,i=n.search,s=n.hash,l=v(),c=e;return"always"!==l&&"never"!==l||(c=""+o.applyTrailingSlashOption(a,l)+i+s),_(c)?d(c):function(e,t){if(_(e))return e;var n=v(),a=r.resolve(e,t);return"always"===n||"never"===n?o.applyTrailingSlashOption(a,n):a}(c,t)},b=["to","getProps","onClick","onMouseEnter","activeClassName","activeStyle","innerRef","partiallyActive","state","replace","_location"],w={activeClassName:i.default.string,activeStyle:i.default.object,partiallyActive:i.default.bool};function P(e){/*#__PURE__*/return s.default.createElement(n.Location,null,function(t){/*#__PURE__*/return s.default.createElement(m,l({},e,{_location:t.location}))})}var m=/*#__PURE__*/function(e){var t,r;function o(t){var n;(n=e.call(this,t)||this).defaultGetProps=function(e){return(n.props.partiallyActive?e.isPartiallyCurrent:e.isCurrent)?{className:[n.props.className,n.props.activeClassName].filter(Boolean).join(" "),style:l({},n.props.style,n.props.activeStyle)}:null};var r=!1;return"undefined"!=typeof window&&window.IntersectionObserver&&(r=!0),n.state={IOSupported:r},n.abortPrefetch=null,n.handleRef=n.handleRef.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n)),n}r=e,(t=o).prototype=Object.create(r.prototype),t.prototype.constructor=t,c(t,r);var a=o.prototype;return a._prefetch=function(){var e=window.location.pathname+window.location.search;this.props._location&&this.props._location.pathname&&(e=this.props._location.pathname+this.props._location.search);var t=u(y(this.props.to,e)),n=t.pathname+t.search;if(e!==n)return ___loader.enqueue(n)},a.componentWillUnmount=function(){if(this.io){var e=this.io,t=e.instance,n=e.el;this.abortPrefetch&&this.abortPrefetch.abort(),t.unobserve(n),t.disconnect()}},a.handleRef=function(e){var t,n,r,o=this;this.props.innerRef&&Object.prototype.hasOwnProperty.call(this.props.innerRef,"current")?this.props.innerRef.current=e:this.props.innerRef&&this.props.innerRef(e),this.state.IOSupported&&e&&(this.io=(t=e,n=function(e){e?o.abortPrefetch=o._prefetch():o.abortPrefetch&&o.abortPrefetch.abort()},(r=new window.IntersectionObserver(function(e){e.forEach(function(e){t===e.target&&n(e.isIntersecting||e.intersectionRatio>0)})})).observe(t),{instance:r,el:t}))},a.render=function(){var e=this,t=this.props,r=t.to,o=t.getProps,a=void 0===o?this.defaultGetProps:o,i=t.onClick,c=t.onMouseEnter,p=t.state,h=t.replace,d=t._location,_=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}(t,b);"production"===process.env.NODE_ENV||f(r)||console.warn("External link "+r+" was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links");var v=y(r,d.pathname);return f(v)?/*#__PURE__*/s.default.createElement(n.Link,l({to:v,state:p,getProps:a,innerRef:this.handleRef,onMouseEnter:function(e){c&&c(e);var t=u(v);___loader.hovering(t.pathname+t.search)},onClick:function(t){if(i&&i(t),!(0!==t.button||e.props.target||t.defaultPrevented||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)){t.preventDefault();var n=h,r=encodeURI(v)===d.pathname;"boolean"!=typeof h&&r&&(n=!0),window.___navigate(v,{state:p,replace:n})}return!0}},_)):/*#__PURE__*/s.default.createElement("a",l({href:v},_))},o}(s.default.Component);m.propTypes=l({},w,{onClick:i.default.func,to:i.default.string.isRequired,replace:i.default.bool,state:i.default.object});var g=s.default.forwardRef(function(e,t){/*#__PURE__*/return s.default.createElement(P,l({innerRef:t},e))});exports.default=g,exports.navigate=function(e,t){window.___navigate(y(e,window.location.pathname),t)},exports.parsePath=u,exports.withAssetPrefix=function(e){return d(e,h())},exports.withPrefix=d;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/parse-path.js","../src/is-local-link.js","../src/prefix-helpers.js","../src/rewrite-link-path.js","../src/index.js"],"sourcesContent":["export function parsePath(path) {\n let pathname = path || `/`\n let search = ``\n let hash = ``\n\n const hashIndex = pathname.indexOf(`#`)\n if (hashIndex !== -1) {\n hash = pathname.slice(hashIndex)\n pathname = pathname.slice(0, hashIndex)\n }\n\n const searchIndex = pathname.indexOf(`?`)\n if (searchIndex !== -1) {\n search = pathname.slice(searchIndex)\n pathname = pathname.slice(0, searchIndex)\n }\n\n return {\n pathname: pathname,\n search: search === `?` ? `` : search,\n hash: hash === `#` ? `` : hash,\n }\n}\n","// Copied from https://github.com/sindresorhus/is-absolute-url/blob/3ab19cc2e599a03ea691bcb8a4c09fa3ebb5da4f/index.js\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\nconst isAbsolute = path => ABSOLUTE_URL_REGEX.test(path)\n\nexport const isLocalLink = path => {\n if (typeof path !== `string`) {\n return undefined\n // TODO(v5): Re-Add TypeError\n // throw new TypeError(`Expected a \\`string\\`, got \\`${typeof path}\\``)\n }\n\n return !isAbsolute(path)\n}\n","import { isLocalLink } from \"./is-local-link\"\n\nexport const getGlobalBasePrefix = () =>\n process.env.NODE_ENV !== `production`\n ? typeof __BASE_PATH__ !== `undefined`\n ? __BASE_PATH__\n : undefined\n : __BASE_PATH__\n\n// These global values are wrapped in typeof clauses to ensure the values exist.\n// This is especially problematic in unit testing of this component.\nexport const getGlobalPathPrefix = () =>\n process.env.NODE_ENV !== `production`\n ? typeof __PATH_PREFIX__ !== `undefined`\n ? __PATH_PREFIX__\n : undefined\n : __PATH_PREFIX__\n\nexport function withPrefix(path, prefix = getGlobalBasePrefix()) {\n if (!isLocalLink(path)) {\n return path\n }\n\n if (path.startsWith(`./`) || path.startsWith(`../`)) {\n return path\n }\n const base = prefix ?? getGlobalPathPrefix() ?? `/`\n\n return `${base?.endsWith(`/`) ? base.slice(0, -1) : base}${\n path.startsWith(`/`) ? path : `/${path}`\n }`\n}\n","import { resolve } from \"@gatsbyjs/reach-router/lib/utils\"\n// Specific import to treeshake Node.js stuff\nimport { applyTrailingSlashOption } from \"gatsby-page-utils/apply-trailing-slash-option\"\nimport { parsePath } from \"./parse-path\"\nimport { isLocalLink } from \"./is-local-link\"\nimport { withPrefix } from \"./prefix-helpers\"\n\nconst isAbsolutePath = path => path?.startsWith(`/`)\n\nconst getGlobalTrailingSlash = () =>\n typeof __TRAILING_SLASH__ !== `undefined` ? __TRAILING_SLASH__ : undefined\n\nfunction absolutify(path, current) {\n // If it's already absolute, return as-is\n if (isAbsolutePath(path)) {\n return path\n }\n\n const option = getGlobalTrailingSlash()\n const absolutePath = resolve(path, current)\n\n if (option === `always` || option === `never`) {\n return applyTrailingSlashOption(absolutePath, option)\n }\n\n return absolutePath\n}\n\nexport const rewriteLinkPath = (path, relativeTo) => {\n if (typeof path === `number`) {\n return path\n }\n if (!isLocalLink(path)) {\n return path\n }\n\n const { pathname, search, hash } = parsePath(path)\n const option = getGlobalTrailingSlash()\n let adjustedPath = path\n\n if (option === `always` || option === `never`) {\n const output = applyTrailingSlashOption(pathname, option)\n adjustedPath = `${output}${search}${hash}`\n }\n\n return isAbsolutePath(adjustedPath)\n ? withPrefix(adjustedPath)\n : absolutify(adjustedPath, relativeTo)\n}\n","import PropTypes from \"prop-types\"\nimport React from \"react\"\nimport { Link, Location } from \"@gatsbyjs/reach-router\"\nimport { parsePath } from \"./parse-path\"\nimport { isLocalLink } from \"./is-local-link\"\nimport { rewriteLinkPath } from \"./rewrite-link-path\"\nimport { withPrefix, getGlobalPathPrefix } from \"./prefix-helpers\"\n\nexport { parsePath, withPrefix }\n\nexport function withAssetPrefix(path) {\n return withPrefix(path, getGlobalPathPrefix())\n}\n\nconst NavLinkPropTypes = {\n activeClassName: PropTypes.string,\n activeStyle: PropTypes.object,\n partiallyActive: PropTypes.bool,\n}\n\n// Set up IntersectionObserver\nconst createIntersectionObserver = (el, cb) => {\n const io = new window.IntersectionObserver(entries => {\n entries.forEach(entry => {\n if (el === entry.target) {\n // Check if element is within viewport, remove listener, destroy observer, and run link callback.\n // MSEdge doesn't currently support isIntersecting, so also test for an intersectionRatio > 0\n cb(entry.isIntersecting || entry.intersectionRatio > 0)\n }\n })\n })\n\n // Add element to the observer\n io.observe(el)\n\n return { instance: io, el }\n}\n\nfunction GatsbyLinkLocationWrapper(props) {\n return (\n <Location>\n {({ location }) => <GatsbyLink {...props} _location={location} />}\n </Location>\n )\n}\n\nclass GatsbyLink extends React.Component {\n constructor(props) {\n super(props)\n // Default to no support for IntersectionObserver\n let IOSupported = false\n if (typeof window !== `undefined` && window.IntersectionObserver) {\n IOSupported = true\n }\n\n this.state = {\n IOSupported,\n }\n this.abortPrefetch = null\n this.handleRef = this.handleRef.bind(this)\n }\n\n _prefetch() {\n let currentPath = window.location.pathname + window.location.search\n\n // reach router should have the correct state\n if (this.props._location && this.props._location.pathname) {\n currentPath = this.props._location.pathname + this.props._location.search\n }\n\n const rewrittenPath = rewriteLinkPath(this.props.to, currentPath)\n const parsed = parsePath(rewrittenPath)\n\n const newPathName = parsed.pathname + parsed.search\n\n // Prefetch is used to speed up next navigations. When you use it on the current navigation,\n // there could be a race-condition where Chrome uses the stale data instead of waiting for the network to complete\n if (currentPath !== newPathName) {\n return ___loader.enqueue(newPathName)\n }\n\n return undefined\n }\n\n componentWillUnmount() {\n if (!this.io) {\n return\n }\n const { instance, el } = this.io\n\n if (this.abortPrefetch) {\n this.abortPrefetch.abort()\n }\n\n instance.unobserve(el)\n instance.disconnect()\n }\n\n handleRef(ref) {\n if (\n this.props.innerRef &&\n Object.prototype.hasOwnProperty.call(this.props.innerRef, `current`)\n ) {\n this.props.innerRef.current = ref\n } else if (this.props.innerRef) {\n this.props.innerRef(ref)\n }\n\n if (this.state.IOSupported && ref) {\n // If IO supported and element reference found, setup Observer functionality\n this.io = createIntersectionObserver(ref, inViewPort => {\n if (inViewPort) {\n this.abortPrefetch = this._prefetch()\n } else {\n if (this.abortPrefetch) {\n this.abortPrefetch.abort()\n }\n }\n })\n }\n }\n\n defaultGetProps = ({ isPartiallyCurrent, isCurrent }) => {\n if (this.props.partiallyActive ? isPartiallyCurrent : isCurrent) {\n return {\n className: [this.props.className, this.props.activeClassName]\n .filter(Boolean)\n .join(` `),\n style: { ...this.props.style, ...this.props.activeStyle },\n }\n }\n return null\n }\n\n render() {\n const {\n to,\n getProps = this.defaultGetProps,\n onClick,\n onMouseEnter,\n /* eslint-disable no-unused-vars */\n activeClassName: $activeClassName,\n activeStyle: $activeStyle,\n innerRef: $innerRef,\n partiallyActive,\n state,\n replace,\n _location,\n /* eslint-enable no-unused-vars */\n ...rest\n } = this.props\n\n if (process.env.NODE_ENV !== `production` && !isLocalLink(to)) {\n console.warn(\n `External link ${to} was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links`\n )\n }\n\n const prefixedTo = rewriteLinkPath(to, _location.pathname)\n if (!isLocalLink(prefixedTo)) {\n return <a href={prefixedTo} {...rest} />\n }\n\n return (\n <Link\n to={prefixedTo}\n state={state}\n getProps={getProps}\n innerRef={this.handleRef}\n onMouseEnter={e => {\n if (onMouseEnter) {\n onMouseEnter(e)\n }\n const parsed = parsePath(prefixedTo)\n ___loader.hovering(parsed.pathname + parsed.search)\n }}\n onClick={e => {\n if (onClick) {\n onClick(e)\n }\n\n if (\n e.button === 0 && // ignore right clicks\n !this.props.target && // let browser handle \"target=_blank\"\n !e.defaultPrevented && // onClick prevented default\n !e.metaKey && // ignore clicks with modifier keys...\n !e.altKey &&\n !e.ctrlKey &&\n !e.shiftKey\n ) {\n e.preventDefault()\n\n let shouldReplace = replace\n const isCurrent = encodeURI(prefixedTo) === _location.pathname\n\n if (typeof replace !== `boolean` && isCurrent) {\n shouldReplace = true\n }\n // Make sure the necessary scripts and data are\n // loaded before continuing.\n window.___navigate(prefixedTo, {\n state,\n replace: shouldReplace,\n })\n }\n\n return true\n }}\n {...rest}\n />\n )\n }\n}\n\nGatsbyLink.propTypes = {\n ...NavLinkPropTypes,\n onClick: PropTypes.func,\n to: PropTypes.string.isRequired,\n replace: PropTypes.bool,\n state: PropTypes.object,\n}\n\nexport default React.forwardRef((props, ref) => (\n <GatsbyLinkLocationWrapper innerRef={ref} {...props} />\n))\n\nexport const navigate = (to, options) => {\n window.___navigate(rewriteLinkPath(to, window.location.pathname), options)\n}\n"],"names":["path","pathname","indexOf","hashIndex","hash","slice","searchIndex","search","test","isAbsolute","env","NODE_ENV","__PATH_PREFIX__","undefined","prefix","__BASE_PATH__","isLocalLink","startsWith","getGlobalPathPrefix","base","endsWith","__TRAILING_SLASH__","relativeTo","parsePath","getGlobalTrailingSlash","option","adjustedPath","applyTrailingSlashOption","withPrefix","current","isAbsolutePath","resolve","absolutePath","absolutify","activeClassName","PropTypes","string","activeStyle","object","partiallyActive","bool","props","React","Location","GatsbyLink","_location","location","_this","defaultGetProps","isPartiallyCurrent","isCurrent","className","filter","Boolean","join","style","window","IntersectionObserver","IOSupported","state","abortPrefetch","handleRef","bind","_prefetch","this","currentPath","rewriteLinkPath","to","parsed","newPathName","enqueue","componentWillUnmount","io","instance","el","abort","unobserve","disconnect","ref","cb","innerRef","Object","prototype","hasOwnProperty","call","inViewPort","_this2","entries","forEach","entry","target","isIntersecting","intersectionRatio","observe","render","getProps","onClick","onMouseEnter","replace","rest","process","console","warn","prefixedTo","Link","e","___loader","hovering","button","_this3","defaultPrevented","metaKey","altKey","ctrlKey","shiftKey","preventDefault","encodeURI","shouldReplace","___navigate","href","Component","propTypes","NavLinkPropTypes","func","isRequired","forwardRef","GatsbyLinkLocationWrapper","options"],"mappings":"wmBAA0BA,GACxB,MAAeA,mBAIGC,EAASC,cACR,IAAfC,IACFC,EAAOH,EAASI,MAAMF,GACtBF,EAAWA,EAASI,MAAM,EAAGF,IAG/B,MAAoBF,EAASC,aAM7B,OALqB,IAAjBI,IACFC,EAASN,EAASI,MAAMC,GACxBL,EAAWA,EAASI,MAAM,EAAGC,IAGxB,CACLL,SAAUA,EACVM,aAAQA,KAAsBA,EAC9BH,WAAMA,KAAoBA,GCnB9B,MAA2B,+BAGA,SAAAJ,GACzB,sBAMA,OATiB,SAAAA,YAA2BQ,KAAKR,GASzCS,CAAWT,MCAc,wCACzBU,IAAIC,6CAENC,q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,aAMAtC,IAAAA,MACAuC,IAAAA,QACArD,IAAAA,UAEGsD,yJAGDC,QAAQ1F,IAAIC,UAA8BK,EAAYmD,IACxDkC,QAAQC,sBACWnC,+HAIrB,MAAmBD,EAAgBC,EAAItB,EAAU5C,UACjD,OAAKe,EAAYuF,gBAKf7D,wBAAC8D,UACCrC,GAAIoC,EACJ5C,MAAOA,EACPoC,SAAUA,EACVf,SAAUhB,KAAKH,UACfoC,aAAc,SAAAQ,GACRR,GACFA,EAAaQ,GAEf,MAAelF,EAAUgF,GACzBG,UAAUC,SAASvC,EAAOnE,SAAWmE,EAAO7D,SAE9CyF,QAAS,SAAAS,GAKP,GAJIT,GACFA,EAAQS,KAIK,IAAbA,EAAEG,QACDC,EAAKpE,MAAMiD,QACXe,EAAEK,kBACFL,EAAEM,SACFN,EAAEO,QACFP,EAAEQ,SACFR,EAAES,UACH,CACAT,EAAEU,iBAEF,MAAoBjB,IACFkB,UAAUb,KAAgB1D,EAAU5C,8BAElBiD,IAClCmE,GAAgB,GAIlB7D,OAAO8D,YAAYf,EAAY,CAC7B5C,MAAAA,EACAuC,QAASmB,IAIb,WAEElB,iBAhDCzD,+BAAG6E,KAAMhB,GAAgBJ,QAlHbzD,UAAM8E,WAwK/B5E,EAAW6E,eACNC,GACH1B,QAAS7D,UAAUwF,KACnBxD,GAAIhC,UAAUC,OAAOwF,WACrB1B,QAAS/D,UAAUK,KACnBmB,MAAOxB,UAAUG,SAGnB,gBAAqBuF,WAAW,SAACpF,EAAOqC,uBACtCpC,wBAACoF,KAA0B9C,SAAUF,GAASrC,yCAGxB,SAAC0B,EAAI4D,GAC3BvE,OAAO8D,YAAYpD,EAAgBC,EAAIX,OAAOV,SAAS7C,UAAW8H,yDAzNpC/H,GAC9B,SAAkBA,EAAMkB"}
@@ -0,0 +1,2 @@
1
+ import t from"prop-types";import e from"react";import{Location as n,Link as r}from"@gatsbyjs/reach-router";import{resolve as o}from"@gatsbyjs/reach-router/lib/utils";import{applyTrailingSlashOption as s}from"gatsby-page-utils/apply-trailing-slash-option";function i(){return i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i.apply(this,arguments)}function a(t){let e=t||"/",n="",r="";const o=e.indexOf("#");-1!==o&&(r=e.slice(o),e=e.slice(0,o));const s=e.indexOf("?");return-1!==s&&(n=e.slice(s),e=e.slice(0,s)),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}}const c=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=t=>{if("string"==typeof t)return!(t=>c.test(t))(t)},p=()=>"production"!==process.env.NODE_ENV?"undefined"!=typeof __PATH_PREFIX__?__PATH_PREFIX__:void 0:__PATH_PREFIX__;function h(t,e=(()=>"production"!==process.env.NODE_ENV?"undefined"!=typeof __BASE_PATH__?__BASE_PATH__:void 0:__BASE_PATH__)()){var n;if(!l(t))return t;if(t.startsWith("./")||t.startsWith("../"))return t;const r=null!=(n=null!=e?e:p())?n:"/";return`${null!=r&&r.endsWith("/")?r.slice(0,-1):r}${t.startsWith("/")?t:`/${t}`}`}const f=t=>null==t?void 0:t.startsWith("/"),u=()=>"undefined"!=typeof __TRAILING_SLASH__?__TRAILING_SLASH__:void 0,_=(t,e)=>{if("number"==typeof t)return t;if(!l(t))return t;const{pathname:n,search:r,hash:i}=a(t),c=u();let p=t;return"always"!==c&&"never"!==c||(p=`${s(n,c)}${r}${i}`),f(p)?h(p):function(t,e){if(f(t))return t;const n=u(),r=o(t,e);return"always"===n||"never"===n?s(r,n):r}(p,e)},d=["to","getProps","onClick","onMouseEnter","activeClassName","activeStyle","innerRef","partiallyActive","state","replace","_location"];function m(t){return h(t,p())}const y={activeClassName:t.string,activeStyle:t.object,partiallyActive:t.bool};function v(t){/*#__PURE__*/return e.createElement(n,null,({location:n})=>/*#__PURE__*/e.createElement(b,i({},t,{_location:n})))}class b extends e.Component{constructor(t){super(t),this.defaultGetProps=({isPartiallyCurrent:t,isCurrent:e})=>(this.props.partiallyActive?t:e)?{className:[this.props.className,this.props.activeClassName].filter(Boolean).join(" "),style:i({},this.props.style,this.props.activeStyle)}:null;let e=!1;"undefined"!=typeof window&&window.IntersectionObserver&&(e=!0),this.state={IOSupported:e},this.abortPrefetch=null,this.handleRef=this.handleRef.bind(this)}_prefetch(){let t=window.location.pathname+window.location.search;this.props._location&&this.props._location.pathname&&(t=this.props._location.pathname+this.props._location.search);const e=a(_(this.props.to,t)),n=e.pathname+e.search;if(t!==n)return ___loader.enqueue(n)}componentWillUnmount(){if(!this.io)return;const{instance:t,el:e}=this.io;this.abortPrefetch&&this.abortPrefetch.abort(),t.unobserve(e),t.disconnect()}handleRef(t){this.props.innerRef&&Object.prototype.hasOwnProperty.call(this.props.innerRef,"current")?this.props.innerRef.current=t:this.props.innerRef&&this.props.innerRef(t),this.state.IOSupported&&t&&(this.io=((t,e)=>{const n=new window.IntersectionObserver(n=>{n.forEach(n=>{t===n.target&&e(n.isIntersecting||n.intersectionRatio>0)})});return n.observe(t),{instance:n,el:t}})(t,t=>{t?this.abortPrefetch=this._prefetch():this.abortPrefetch&&this.abortPrefetch.abort()}))}render(){const t=this.props,{to:n,getProps:o=this.defaultGetProps,onClick:s,onMouseEnter:c,state:p,replace:h,_location:f}=t,u=function(t,e){if(null==t)return{};var n,r,o={},s=Object.keys(t);for(r=0;r<s.length;r++)e.indexOf(n=s[r])>=0||(o[n]=t[n]);return o}(t,d);"production"===process.env.NODE_ENV||l(n)||console.warn(`External link ${n} was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links`);const m=_(n,f.pathname);return l(m)?/*#__PURE__*/e.createElement(r,i({to:m,state:p,getProps:o,innerRef:this.handleRef,onMouseEnter:t=>{c&&c(t);const e=a(m);___loader.hovering(e.pathname+e.search)},onClick:t=>{if(s&&s(t),!(0!==t.button||this.props.target||t.defaultPrevented||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)){t.preventDefault();let e=h;const n=encodeURI(m)===f.pathname;"boolean"!=typeof h&&n&&(e=!0),window.___navigate(m,{state:p,replace:e})}return!0}},u)):/*#__PURE__*/e.createElement("a",i({href:m},u))}}b.propTypes=i({},y,{onClick:t.func,to:t.string.isRequired,replace:t.bool,state:t.object});var w=e.forwardRef((t,n)=>/*#__PURE__*/e.createElement(v,i({innerRef:n},t)));const P=(t,e)=>{window.___navigate(_(t,window.location.pathname),e)};export{w as default,P as navigate,a as parsePath,m as withAssetPrefix,h as withPrefix};
2
+ //# sourceMappingURL=index.modern.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.modern.mjs","sources":["../src/parse-path.js","../src/is-local-link.js","../src/prefix-helpers.js","../src/rewrite-link-path.js","../src/index.js"],"sourcesContent":["export function parsePath(path) {\n let pathname = path || `/`\n let search = ``\n let hash = ``\n\n const hashIndex = pathname.indexOf(`#`)\n if (hashIndex !== -1) {\n hash = pathname.slice(hashIndex)\n pathname = pathname.slice(0, hashIndex)\n }\n\n const searchIndex = pathname.indexOf(`?`)\n if (searchIndex !== -1) {\n search = pathname.slice(searchIndex)\n pathname = pathname.slice(0, searchIndex)\n }\n\n return {\n pathname: pathname,\n search: search === `?` ? `` : search,\n hash: hash === `#` ? `` : hash,\n }\n}\n","// Copied from https://github.com/sindresorhus/is-absolute-url/blob/3ab19cc2e599a03ea691bcb8a4c09fa3ebb5da4f/index.js\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\nconst isAbsolute = path => ABSOLUTE_URL_REGEX.test(path)\n\nexport const isLocalLink = path => {\n if (typeof path !== `string`) {\n return undefined\n // TODO(v5): Re-Add TypeError\n // throw new TypeError(`Expected a \\`string\\`, got \\`${typeof path}\\``)\n }\n\n return !isAbsolute(path)\n}\n","import { isLocalLink } from \"./is-local-link\"\n\nexport const getGlobalBasePrefix = () =>\n process.env.NODE_ENV !== `production`\n ? typeof __BASE_PATH__ !== `undefined`\n ? __BASE_PATH__\n : undefined\n : __BASE_PATH__\n\n// These global values are wrapped in typeof clauses to ensure the values exist.\n// This is especially problematic in unit testing of this component.\nexport const getGlobalPathPrefix = () =>\n process.env.NODE_ENV !== `production`\n ? typeof __PATH_PREFIX__ !== `undefined`\n ? __PATH_PREFIX__\n : undefined\n : __PATH_PREFIX__\n\nexport function withPrefix(path, prefix = getGlobalBasePrefix()) {\n if (!isLocalLink(path)) {\n return path\n }\n\n if (path.startsWith(`./`) || path.startsWith(`../`)) {\n return path\n }\n const base = prefix ?? getGlobalPathPrefix() ?? `/`\n\n return `${base?.endsWith(`/`) ? base.slice(0, -1) : base}${\n path.startsWith(`/`) ? path : `/${path}`\n }`\n}\n","import { resolve } from \"@gatsbyjs/reach-router/lib/utils\"\n// Specific import to treeshake Node.js stuff\nimport { applyTrailingSlashOption } from \"gatsby-page-utils/apply-trailing-slash-option\"\nimport { parsePath } from \"./parse-path\"\nimport { isLocalLink } from \"./is-local-link\"\nimport { withPrefix } from \"./prefix-helpers\"\n\nconst isAbsolutePath = path => path?.startsWith(`/`)\n\nconst getGlobalTrailingSlash = () =>\n typeof __TRAILING_SLASH__ !== `undefined` ? __TRAILING_SLASH__ : undefined\n\nfunction absolutify(path, current) {\n // If it's already absolute, return as-is\n if (isAbsolutePath(path)) {\n return path\n }\n\n const option = getGlobalTrailingSlash()\n const absolutePath = resolve(path, current)\n\n if (option === `always` || option === `never`) {\n return applyTrailingSlashOption(absolutePath, option)\n }\n\n return absolutePath\n}\n\nexport const rewriteLinkPath = (path, relativeTo) => {\n if (typeof path === `number`) {\n return path\n }\n if (!isLocalLink(path)) {\n return path\n }\n\n const { pathname, search, hash } = parsePath(path)\n const option = getGlobalTrailingSlash()\n let adjustedPath = path\n\n if (option === `always` || option === `never`) {\n const output = applyTrailingSlashOption(pathname, option)\n adjustedPath = `${output}${search}${hash}`\n }\n\n return isAbsolutePath(adjustedPath)\n ? withPrefix(adjustedPath)\n : absolutify(adjustedPath, relativeTo)\n}\n","import PropTypes from \"prop-types\"\nimport React from \"react\"\nimport { Link, Location } from \"@gatsbyjs/reach-router\"\nimport { parsePath } from \"./parse-path\"\nimport { isLocalLink } from \"./is-local-link\"\nimport { rewriteLinkPath } from \"./rewrite-link-path\"\nimport { withPrefix, getGlobalPathPrefix } from \"./prefix-helpers\"\n\nexport { parsePath, withPrefix }\n\nexport function withAssetPrefix(path) {\n return withPrefix(path, getGlobalPathPrefix())\n}\n\nconst NavLinkPropTypes = {\n activeClassName: PropTypes.string,\n activeStyle: PropTypes.object,\n partiallyActive: PropTypes.bool,\n}\n\n// Set up IntersectionObserver\nconst createIntersectionObserver = (el, cb) => {\n const io = new window.IntersectionObserver(entries => {\n entries.forEach(entry => {\n if (el === entry.target) {\n // Check if element is within viewport, remove listener, destroy observer, and run link callback.\n // MSEdge doesn't currently support isIntersecting, so also test for an intersectionRatio > 0\n cb(entry.isIntersecting || entry.intersectionRatio > 0)\n }\n })\n })\n\n // Add element to the observer\n io.observe(el)\n\n return { instance: io, el }\n}\n\nfunction GatsbyLinkLocationWrapper(props) {\n return (\n <Location>\n {({ location }) => <GatsbyLink {...props} _location={location} />}\n </Location>\n )\n}\n\nclass GatsbyLink extends React.Component {\n constructor(props) {\n super(props)\n // Default to no support for IntersectionObserver\n let IOSupported = false\n if (typeof window !== `undefined` && window.IntersectionObserver) {\n IOSupported = true\n }\n\n this.state = {\n IOSupported,\n }\n this.abortPrefetch = null\n this.handleRef = this.handleRef.bind(this)\n }\n\n _prefetch() {\n let currentPath = window.location.pathname + window.location.search\n\n // reach router should have the correct state\n if (this.props._location && this.props._location.pathname) {\n currentPath = this.props._location.pathname + this.props._location.search\n }\n\n const rewrittenPath = rewriteLinkPath(this.props.to, currentPath)\n const parsed = parsePath(rewrittenPath)\n\n const newPathName = parsed.pathname + parsed.search\n\n // Prefetch is used to speed up next navigations. When you use it on the current navigation,\n // there could be a race-condition where Chrome uses the stale data instead of waiting for the network to complete\n if (currentPath !== newPathName) {\n return ___loader.enqueue(newPathName)\n }\n\n return undefined\n }\n\n componentWillUnmount() {\n if (!this.io) {\n return\n }\n const { instance, el } = this.io\n\n if (this.abortPrefetch) {\n this.abortPrefetch.abort()\n }\n\n instance.unobserve(el)\n instance.disconnect()\n }\n\n handleRef(ref) {\n if (\n this.props.innerRef &&\n Object.prototype.hasOwnProperty.call(this.props.innerRef, `current`)\n ) {\n this.props.innerRef.current = ref\n } else if (this.props.innerRef) {\n this.props.innerRef(ref)\n }\n\n if (this.state.IOSupported && ref) {\n // If IO supported and element reference found, setup Observer functionality\n this.io = createIntersectionObserver(ref, inViewPort => {\n if (inViewPort) {\n this.abortPrefetch = this._prefetch()\n } else {\n if (this.abortPrefetch) {\n this.abortPrefetch.abort()\n }\n }\n })\n }\n }\n\n defaultGetProps = ({ isPartiallyCurrent, isCurrent }) => {\n if (this.props.partiallyActive ? isPartiallyCurrent : isCurrent) {\n return {\n className: [this.props.className, this.props.activeClassName]\n .filter(Boolean)\n .join(` `),\n style: { ...this.props.style, ...this.props.activeStyle },\n }\n }\n return null\n }\n\n render() {\n const {\n to,\n getProps = this.defaultGetProps,\n onClick,\n onMouseEnter,\n /* eslint-disable no-unused-vars */\n activeClassName: $activeClassName,\n activeStyle: $activeStyle,\n innerRef: $innerRef,\n partiallyActive,\n state,\n replace,\n _location,\n /* eslint-enable no-unused-vars */\n ...rest\n } = this.props\n\n if (process.env.NODE_ENV !== `production` && !isLocalLink(to)) {\n console.warn(\n `External link ${to} was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links`\n )\n }\n\n const prefixedTo = rewriteLinkPath(to, _location.pathname)\n if (!isLocalLink(prefixedTo)) {\n return <a href={prefixedTo} {...rest} />\n }\n\n return (\n <Link\n to={prefixedTo}\n state={state}\n getProps={getProps}\n innerRef={this.handleRef}\n onMouseEnter={e => {\n if (onMouseEnter) {\n onMouseEnter(e)\n }\n const parsed = parsePath(prefixedTo)\n ___loader.hovering(parsed.pathname + parsed.search)\n }}\n onClick={e => {\n if (onClick) {\n onClick(e)\n }\n\n if (\n e.button === 0 && // ignore right clicks\n !this.props.target && // let browser handle \"target=_blank\"\n !e.defaultPrevented && // onClick prevented default\n !e.metaKey && // ignore clicks with modifier keys...\n !e.altKey &&\n !e.ctrlKey &&\n !e.shiftKey\n ) {\n e.preventDefault()\n\n let shouldReplace = replace\n const isCurrent = encodeURI(prefixedTo) === _location.pathname\n\n if (typeof replace !== `boolean` && isCurrent) {\n shouldReplace = true\n }\n // Make sure the necessary scripts and data are\n // loaded before continuing.\n window.___navigate(prefixedTo, {\n state,\n replace: shouldReplace,\n })\n }\n\n return true\n }}\n {...rest}\n />\n )\n }\n}\n\nGatsbyLink.propTypes = {\n ...NavLinkPropTypes,\n onClick: PropTypes.func,\n to: PropTypes.string.isRequired,\n replace: PropTypes.bool,\n state: PropTypes.object,\n}\n\nexport default React.forwardRef((props, ref) => (\n <GatsbyLinkLocationWrapper innerRef={ref} {...props} />\n))\n\nexport const navigate = (to, options) => {\n window.___navigate(rewriteLinkPath(to, window.location.pathname), options)\n}\n"],"names":["path","pathname","indexOf","hashIndex","hash","slice","searchIndex","search","ABSOLUTE_URL_REGEX","test","isAbsolute","process","env","NODE_ENV","__PATH_PREFIX__","undefined","prefix","__BASE_PATH__","getGlobalBasePrefix","isLocalLink","startsWith","getGlobalPathPrefix","base","endsWith","__TRAILING_SLASH__","relativeTo","parsePath","getGlobalTrailingSlash","option","adjustedPath","applyTrailingSlashOption","withPrefix","current","isAbsolutePath","resolve","absolutePath","absolutify","activeClassName","PropTypes","string","activeStyle","object","partiallyActive","bool","props","React","Location","location","GatsbyLink","_location","Component","constructor","super","this","defaultGetProps","isPartiallyCurrent","isCurrent","className","filter","Boolean","join","style","window","IntersectionObserver","IOSupported","state","abortPrefetch","handleRef","bind","_prefetch","currentPath","rewriteLinkPath","to","parsed","newPathName","enqueue","componentWillUnmount","io","instance","el","abort","unobserve","disconnect","ref","innerRef","Object","prototype","hasOwnProperty","call","cb","entries","forEach","entry","target","isIntersecting","intersectionRatio","observe","createIntersectionObserver","inViewPort","render","getProps","onClick","onMouseEnter","replace","rest","console","warn","prefixedTo","Link","e","___loader","hovering","button","defaultPrevented","metaKey","altKey","ctrlKey","shiftKey","preventDefault","encodeURI","shouldReplace","___navigate","href","propTypes","NavLinkPropTypes","func","isRequired","forwardRef","GatsbyLinkLocationWrapper","navigate","options"],"mappings":"0dAA0BA,GACxB,MAAeA,GAAS,MACV,KACF,GAEZ,QAAkBC,EAASC,QAAS,MACjB,IAAfC,IACFC,EAAOH,EAASI,MAAMF,GACtBF,EAAWA,EAASI,MAAM,EAAGF,IAG/B,QAAoBF,EAASC,QAAS,KAMtC,OALqB,IAAjBI,IACFC,EAASN,EAASI,MAAMC,GACxBL,EAAWA,EAASI,MAAM,EAAGC,IAGxB,CACLL,SAAUA,EACVM,OAAoB,MAAZA,EAAkB,GAAIA,EAC9BH,KAAgB,MAAVA,EAAgB,GAAIA,GCnB9B,QAA2B,+BAGAJ,IACzB,GAAqB,mBAMrB,OATiBA,CAAAA,GAAQQ,EAAmBC,KAAKT,GASzCU,CAAWV,MCAc,IACP,eAA1BW,QAAQC,IAAIC,SACoB,oCAC1BC,qBACAC,EACFD,2BAEqBd,EAAMgB,EAhBE,KACP,eAA1BL,QAAQC,IAAIC,SACkB,kCACxBI,mBACAF,EACFE,cAWoCC,UACxC,IAAKC,EAAYnB,GACf,SAGF,GAAIA,EAAKoB,WAAY,OAAQpB,EAAKoB,WAAY,OAC5C,SAEF,uBAAaJ,EAAAA,EAAUK,OAA0B,IAEjD,MAAQ,SAAEC,GAAAA,EAAMC,SAAU,KAAMD,EAAKjB,MAAM,GAAI,GAAKiB,IAClDtB,EAAKoB,WAAY,KAAMpB,EAAQ,IAAGA,MCtBtC,QAAuBA,SAAQA,SAAAA,EAAMoB,WAAY,OAElB,IACE,uCAAaI,wBAAqBT,IAkBpC,CAACf,EAAMyB,KACpC,GAAqB,mBACnB,SAEF,IAAKN,EAAYnB,GACf,SAGF,MAAMC,SAAEA,EAAFM,OAAYA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AEf,QAAenF,EAAUiF,GACzBG,UAAUC,SAAStC,EAAOxE,SAAWwE,EAAOlE,SAE9C8F,QAASQ,IAKP,GAJIR,GACFA,EAAQQ,KAIK,IAAbA,EAAEG,QACD3D,KAAKT,MAAMiD,QACXgB,EAAEI,kBACFJ,EAAEK,SACFL,EAAEM,QACFN,EAAEO,SACFP,EAAEQ,UACH,CACAR,EAAES,iBAEF,MAAoBf,EACpB,QAAkBgB,UAAUZ,KAAgB1D,EAAUhD,SAE9B,qBAAYuD,IAClCgE,GAAgB,GAIlB1D,OAAO2D,YAAYd,EAAY,CAC7B1C,MAAAA,EACAsC,QAASiB,IAIb,WAEEhB,iBAhDC3D,uBAAG6E,KAAMf,GAAgBH,KAsDtCxD,EAAW2E,eACNC,GACHvB,QAAS/D,EAAUuF,KACnBrD,GAAIlC,EAAUC,OAAOuF,WACrBvB,QAASjE,EAAUK,KACnBsB,MAAO3B,EAAUG,SAGnB,QAAqBsF,WAAW,CAACnF,EAAOuC,iBACtCtC,gBAACmF,KAA0B5C,SAAUD,GAASvC,KAGnCqF,QAAW,CAACzD,EAAI0D,KAC3BpE,OAAO2D,YAAYlD,EAAgBC,EAAIV,OAAOf,SAAS9C,UAAWiI"}
package/package.json CHANGED
@@ -1,23 +1,35 @@
1
1
  {
2
2
  "name": "gatsby-link",
3
3
  "description": "An enhanced Link component for Gatsby sites with support for resource prefetching",
4
- "version": "4.17.0",
4
+ "version": "4.18.0-alpha-drupal-self-reference.18+7e41ad4fb8",
5
5
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
6
6
  "bugs": {
7
7
  "url": "https://github.com/gatsbyjs/gatsby/issues"
8
8
  },
9
+ "source": "src/index.js",
10
+ "main": "dist/index.js",
11
+ "module": "dist/index.modern.mjs",
12
+ "types": "index.d.ts",
13
+ "files": [
14
+ "dist/*"
15
+ ],
16
+ "sideEffects": false,
17
+ "scripts": {
18
+ "build": "microbundle -f cjs,modern --jsx React.createElement --generateTypes false",
19
+ "watch": "npm run build watch --no-compress",
20
+ "prepare": "cross-env NODE_ENV=production npm run clean && npm run build",
21
+ "clean": "del-cli dist/*"
22
+ },
9
23
  "dependencies": {
10
- "@babel/runtime": "^7.15.4",
11
24
  "@types/reach__router": "^1.3.10",
12
- "gatsby-page-utils": "^2.17.0",
25
+ "gatsby-page-utils": "2.18.0-alpha-drupal-self-reference.18+7e41ad4fb8",
13
26
  "prop-types": "^15.8.1"
14
27
  },
15
28
  "devDependencies": {
16
- "@babel/cli": "^7.15.4",
17
- "@babel/core": "^7.15.5",
18
29
  "@testing-library/react": "^11.2.7",
19
- "babel-preset-gatsby-package": "^2.17.0",
20
- "cross-env": "^7.0.3"
30
+ "cross-env": "^7.0.3",
31
+ "del-cli": "^3.0.1",
32
+ "microbundle": "^0.15.0"
21
33
  },
22
34
  "peerDependencies": {
23
35
  "@gatsbyjs/reach-router": "^1.3.5",
@@ -29,20 +41,13 @@
29
41
  "gatsby"
30
42
  ],
31
43
  "license": "MIT",
32
- "main": "index.js",
33
44
  "repository": {
34
45
  "type": "git",
35
46
  "url": "https://github.com/gatsbyjs/gatsby.git",
36
47
  "directory": "packages/gatsby-link"
37
48
  },
38
- "scripts": {
39
- "build": "babel src --out-dir . --ignore \"**/__tests__\"",
40
- "prepare": "cross-env NODE_ENV=production npm run build",
41
- "watch": "babel -w src --out-dir . --ignore \"**/__tests__\""
42
- },
43
- "types": "index.d.ts",
44
49
  "engines": {
45
50
  "node": ">=14.15.0"
46
51
  },
47
- "gitHead": "4046323a40c4b6222066d47fe89e088ace9571a8"
52
+ "gitHead": "7e41ad4fb8b605e6530af358f0a3eef082682f90"
48
53
  }
package/.babelrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "presets": [["babel-preset-gatsby-package", { "browser": true }]]
3
- }
package/.eslintrc.yaml DELETED
@@ -1,4 +0,0 @@
1
- env:
2
- browser: true
3
- globals:
4
- ___loader: false
package/index.d.ts DELETED
@@ -1,44 +0,0 @@
1
- import * as React from "react"
2
- import { NavigateFn, LinkProps } from "@reach/router"
3
-
4
- // eslint-disable-next-line @typescript-eslint/naming-convention
5
- export interface GatsbyLinkProps<TState> extends LinkProps<TState> {
6
- /** A class to apply when this Link is active */
7
- activeClassName?: string
8
- /** Inline styles for when this Link is active */
9
- activeStyle?: object
10
- onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void
11
- /** Class the link as highlighted if there is a partial match via a the `to` being prefixed to the current url */
12
- partiallyActive?: boolean
13
- /** Used to declare that this link replaces the current URL in history with the target */
14
- replace?: boolean
15
- /** Used to pass state data to the linked page.
16
- * The linked page will have a `location` prop containing a nested `state` object structure containing the passed data.
17
- */
18
- state?: TState
19
- /** The URL you want to link to */
20
- to: string
21
- }
22
-
23
- /**
24
- * This component is intended _only_ for links to pages handled by Gatsby. For links to pages on other
25
- * domains or pages on the same domain not handled by the current Gatsby site, use the normal `<a>` element.
26
- */
27
- export default class GatsbyLink<TState> extends React.Component<
28
- GatsbyLinkProps<TState>,
29
- any
30
- > {}
31
-
32
- /**
33
- * Sometimes you need to navigate to pages programmatically, such as during form submissions. In these
34
- * cases, `Link` won’t work.
35
- */
36
- export const navigate: NavigateFn
37
-
38
- /**
39
- * It is common to host sites in a sub-directory of a site. Gatsby lets you set the path prefix for your site.
40
- * After doing so, Gatsby's `<Link>` component will automatically handle constructing the correct URL in
41
- * development and production
42
- */
43
- export const withPrefix: (path: string) => string
44
- export const withAssetPrefix: (path: string) => string
package/index.js DELETED
@@ -1,295 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- exports.__esModule = true;
6
- exports.navigate = exports.default = void 0;
7
- exports.withAssetPrefix = withAssetPrefix;
8
- exports.withPrefix = withPrefix;
9
-
10
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
-
12
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
13
-
14
- var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
15
-
16
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
-
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
-
20
- var _react = _interopRequireDefault(require("react"));
21
-
22
- var _reachRouter = require("@gatsbyjs/reach-router");
23
-
24
- var _parsePath = require("./parse-path");
25
-
26
- exports.parsePath = _parsePath.parsePath;
27
-
28
- var _isLocalLink = require("./is-local-link");
29
-
30
- var _rewriteLinkPath = require("./rewrite-link-path");
31
-
32
- var _excluded = ["to", "getProps", "onClick", "onMouseEnter", "activeClassName", "activeStyle", "innerRef", "partiallyActive", "state", "replace", "_location"];
33
-
34
- function withPrefix(path, prefix) {
35
- var _ref, _prefix;
36
-
37
- if (prefix === void 0) {
38
- prefix = getGlobalBasePrefix();
39
- }
40
-
41
- if (!(0, _isLocalLink.isLocalLink)(path)) {
42
- return path;
43
- }
44
-
45
- if (path.startsWith("./") || path.startsWith("../")) {
46
- return path;
47
- }
48
-
49
- var base = (_ref = (_prefix = prefix) !== null && _prefix !== void 0 ? _prefix : getGlobalPathPrefix()) !== null && _ref !== void 0 ? _ref : "/";
50
- return "" + (base !== null && base !== void 0 && base.endsWith("/") ? base.slice(0, -1) : base) + (path.startsWith("/") ? path : "/" + path);
51
- } // These global values are wrapped in typeof clauses to ensure the values exist.
52
- // This is especially problematic in unit testing of this component.
53
-
54
-
55
- var getGlobalPathPrefix = function getGlobalPathPrefix() {
56
- return process.env.NODE_ENV !== "production" ? typeof __PATH_PREFIX__ !== "undefined" ? __PATH_PREFIX__ : undefined : __PATH_PREFIX__;
57
- };
58
-
59
- var getGlobalBasePrefix = function getGlobalBasePrefix() {
60
- return process.env.NODE_ENV !== "production" ? typeof __BASE_PATH__ !== "undefined" ? __BASE_PATH__ : undefined : __BASE_PATH__;
61
- };
62
-
63
- function withAssetPrefix(path) {
64
- return withPrefix(path, getGlobalPathPrefix());
65
- }
66
-
67
- var NavLinkPropTypes = {
68
- activeClassName: _propTypes.default.string,
69
- activeStyle: _propTypes.default.object,
70
- partiallyActive: _propTypes.default.bool
71
- }; // Set up IntersectionObserver
72
-
73
- var createIntersectionObserver = function createIntersectionObserver(el, cb) {
74
- var io = new window.IntersectionObserver(function (entries) {
75
- entries.forEach(function (entry) {
76
- if (el === entry.target) {
77
- // Check if element is within viewport, remove listener, destroy observer, and run link callback.
78
- // MSEdge doesn't currently support isIntersecting, so also test for an intersectionRatio > 0
79
- cb(entry.isIntersecting || entry.intersectionRatio > 0);
80
- }
81
- });
82
- }); // Add element to the observer
83
-
84
- io.observe(el);
85
- return {
86
- instance: io,
87
- el: el
88
- };
89
- };
90
-
91
- function GatsbyLinkLocationWrapper(props) {
92
- return /*#__PURE__*/_react.default.createElement(_reachRouter.Location, null, function (_ref2) {
93
- var location = _ref2.location;
94
- return /*#__PURE__*/_react.default.createElement(GatsbyLink, (0, _extends2.default)({}, props, {
95
- _location: location
96
- }));
97
- });
98
- }
99
-
100
- var GatsbyLink = /*#__PURE__*/function (_React$Component) {
101
- (0, _inheritsLoose2.default)(GatsbyLink, _React$Component);
102
-
103
- function GatsbyLink(props) {
104
- var _this;
105
-
106
- _this = _React$Component.call(this, props) || this; // Default to no support for IntersectionObserver
107
-
108
- _this.defaultGetProps = function (_ref3) {
109
- var isPartiallyCurrent = _ref3.isPartiallyCurrent,
110
- isCurrent = _ref3.isCurrent;
111
-
112
- if (_this.props.partiallyActive ? isPartiallyCurrent : isCurrent) {
113
- return {
114
- className: [_this.props.className, _this.props.activeClassName].filter(Boolean).join(" "),
115
- style: (0, _extends2.default)({}, _this.props.style, _this.props.activeStyle)
116
- };
117
- }
118
-
119
- return null;
120
- };
121
-
122
- var IOSupported = false;
123
-
124
- if (typeof window !== "undefined" && window.IntersectionObserver) {
125
- IOSupported = true;
126
- }
127
-
128
- _this.state = {
129
- IOSupported: IOSupported
130
- };
131
- _this.abortPrefetch = null;
132
- _this.handleRef = _this.handleRef.bind((0, _assertThisInitialized2.default)(_this));
133
- return _this;
134
- }
135
-
136
- var _proto = GatsbyLink.prototype;
137
-
138
- _proto._prefetch = function _prefetch() {
139
- var currentPath = window.location.pathname + window.location.search; // reach router should have the correct state
140
-
141
- if (this.props._location && this.props._location.pathname) {
142
- currentPath = this.props._location.pathname + this.props._location.search;
143
- }
144
-
145
- var rewrittenPath = (0, _rewriteLinkPath.rewriteLinkPath)(this.props.to, currentPath);
146
- var parsed = (0, _parsePath.parsePath)(rewrittenPath);
147
- var newPathName = parsed.pathname + parsed.search; // Prefetch is used to speed up next navigations. When you use it on the current navigation,
148
- // there could be a race-condition where Chrome uses the stale data instead of waiting for the network to complete
149
-
150
- if (currentPath !== newPathName) {
151
- return ___loader.enqueue(newPathName);
152
- }
153
-
154
- return undefined;
155
- };
156
-
157
- _proto.componentWillUnmount = function componentWillUnmount() {
158
- if (!this.io) {
159
- return;
160
- }
161
-
162
- var _this$io = this.io,
163
- instance = _this$io.instance,
164
- el = _this$io.el;
165
-
166
- if (this.abortPrefetch) {
167
- this.abortPrefetch.abort();
168
- }
169
-
170
- instance.unobserve(el);
171
- instance.disconnect();
172
- };
173
-
174
- _proto.handleRef = function handleRef(ref) {
175
- var _this2 = this;
176
-
177
- if (this.props.innerRef && Object.prototype.hasOwnProperty.call(this.props.innerRef, "current")) {
178
- this.props.innerRef.current = ref;
179
- } else if (this.props.innerRef) {
180
- this.props.innerRef(ref);
181
- }
182
-
183
- if (this.state.IOSupported && ref) {
184
- // If IO supported and element reference found, setup Observer functionality
185
- this.io = createIntersectionObserver(ref, function (inViewPort) {
186
- if (inViewPort) {
187
- _this2.abortPrefetch = _this2._prefetch();
188
- } else {
189
- if (_this2.abortPrefetch) {
190
- _this2.abortPrefetch.abort();
191
- }
192
- }
193
- });
194
- }
195
- };
196
-
197
- _proto.render = function render() {
198
- var _this3 = this;
199
-
200
- var _this$props = this.props,
201
- to = _this$props.to,
202
- _this$props$getProps = _this$props.getProps,
203
- getProps = _this$props$getProps === void 0 ? this.defaultGetProps : _this$props$getProps,
204
- _onClick = _this$props.onClick,
205
- _onMouseEnter = _this$props.onMouseEnter,
206
- $activeClassName = _this$props.activeClassName,
207
- $activeStyle = _this$props.activeStyle,
208
- $innerRef = _this$props.innerRef,
209
- partiallyActive = _this$props.partiallyActive,
210
- state = _this$props.state,
211
- replace = _this$props.replace,
212
- _location = _this$props._location,
213
- rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props, _excluded);
214
-
215
- if (process.env.NODE_ENV !== "production" && !(0, _isLocalLink.isLocalLink)(to)) {
216
- console.warn("External link " + to + " was detected in a Link component. Use the Link component only for internal links. See: https://gatsby.dev/internal-links");
217
- }
218
-
219
- var prefixedTo = (0, _rewriteLinkPath.rewriteLinkPath)(to, _location.pathname);
220
-
221
- if (!(0, _isLocalLink.isLocalLink)(prefixedTo)) {
222
- return /*#__PURE__*/_react.default.createElement("a", (0, _extends2.default)({
223
- href: prefixedTo
224
- }, rest));
225
- }
226
-
227
- return /*#__PURE__*/_react.default.createElement(_reachRouter.Link, (0, _extends2.default)({
228
- to: prefixedTo,
229
- state: state,
230
- getProps: getProps,
231
- innerRef: this.handleRef,
232
- onMouseEnter: function onMouseEnter(e) {
233
- if (_onMouseEnter) {
234
- _onMouseEnter(e);
235
- }
236
-
237
- var parsed = (0, _parsePath.parsePath)(prefixedTo);
238
-
239
- ___loader.hovering(parsed.pathname + parsed.search);
240
- },
241
- onClick: function onClick(e) {
242
- if (_onClick) {
243
- _onClick(e);
244
- }
245
-
246
- if (e.button === 0 && // ignore right clicks
247
- !_this3.props.target && // let browser handle "target=_blank"
248
- !e.defaultPrevented && // onClick prevented default
249
- !e.metaKey && // ignore clicks with modifier keys...
250
- !e.altKey && !e.ctrlKey && !e.shiftKey) {
251
- e.preventDefault();
252
- var shouldReplace = replace;
253
-
254
- var isCurrent = encodeURI(prefixedTo) === _location.pathname;
255
-
256
- if (typeof replace !== "boolean" && isCurrent) {
257
- shouldReplace = true;
258
- } // Make sure the necessary scripts and data are
259
- // loaded before continuing.
260
-
261
-
262
- window.___navigate(prefixedTo, {
263
- state: state,
264
- replace: shouldReplace
265
- });
266
- }
267
-
268
- return true;
269
- }
270
- }, rest));
271
- };
272
-
273
- return GatsbyLink;
274
- }(_react.default.Component);
275
-
276
- GatsbyLink.propTypes = (0, _extends2.default)({}, NavLinkPropTypes, {
277
- onClick: _propTypes.default.func,
278
- to: _propTypes.default.string.isRequired,
279
- replace: _propTypes.default.bool,
280
- state: _propTypes.default.object
281
- });
282
-
283
- var _default = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
284
- return /*#__PURE__*/_react.default.createElement(GatsbyLinkLocationWrapper, (0, _extends2.default)({
285
- innerRef: ref
286
- }, props));
287
- });
288
-
289
- exports.default = _default;
290
-
291
- var navigate = function navigate(to, options) {
292
- window.___navigate((0, _rewriteLinkPath.rewriteLinkPath)(to, window.location.pathname), options);
293
- };
294
-
295
- exports.navigate = navigate;
package/is-local-link.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.isLocalLink = void 0;
5
- // Copied from https://github.com/sindresorhus/is-absolute-url/blob/3ab19cc2e599a03ea691bcb8a4c09fa3ebb5da4f/index.js
6
- var ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
7
-
8
- var isAbsolute = function isAbsolute(path) {
9
- return ABSOLUTE_URL_REGEX.test(path);
10
- };
11
-
12
- var isLocalLink = function isLocalLink(path) {
13
- if (typeof path !== "string") {
14
- return undefined; // TODO(v5): Re-Add TypeError
15
- // throw new TypeError(`Expected a \`string\`, got \`${typeof path}\``)
16
- }
17
-
18
- return !isAbsolute(path);
19
- };
20
-
21
- exports.isLocalLink = isLocalLink;
package/parse-path.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.parsePath = parsePath;
5
-
6
- function parsePath(path) {
7
- var pathname = path || "/";
8
- var search = "";
9
- var hash = "";
10
- var hashIndex = pathname.indexOf("#");
11
-
12
- if (hashIndex !== -1) {
13
- hash = pathname.slice(hashIndex);
14
- pathname = pathname.slice(0, hashIndex);
15
- }
16
-
17
- var searchIndex = pathname.indexOf("?");
18
-
19
- if (searchIndex !== -1) {
20
- search = pathname.slice(searchIndex);
21
- pathname = pathname.slice(0, searchIndex);
22
- }
23
-
24
- return {
25
- pathname: pathname,
26
- search: search === "?" ? "" : search,
27
- hash: hash === "#" ? "" : hash
28
- };
29
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.rewriteLinkPath = void 0;
5
-
6
- var _utils = require("@gatsbyjs/reach-router/lib/utils");
7
-
8
- var _applyTrailingSlashOption = require("gatsby-page-utils/apply-trailing-slash-option");
9
-
10
- var _parsePath2 = require("./parse-path");
11
-
12
- var _isLocalLink = require("./is-local-link");
13
-
14
- var _ = require(".");
15
-
16
- // Specific import to treeshake Node.js stuff
17
- var isAbsolutePath = function isAbsolutePath(path) {
18
- return path === null || path === void 0 ? void 0 : path.startsWith("/");
19
- };
20
-
21
- var getGlobalTrailingSlash = function getGlobalTrailingSlash() {
22
- return typeof __TRAILING_SLASH__ !== "undefined" ? __TRAILING_SLASH__ : undefined;
23
- };
24
-
25
- function absolutify(path, current) {
26
- // If it's already absolute, return as-is
27
- if (isAbsolutePath(path)) {
28
- return path;
29
- }
30
-
31
- var option = getGlobalTrailingSlash();
32
- var absolutePath = (0, _utils.resolve)(path, current);
33
-
34
- if (option === "always" || option === "never") {
35
- return (0, _applyTrailingSlashOption.applyTrailingSlashOption)(absolutePath, option);
36
- }
37
-
38
- return absolutePath;
39
- }
40
-
41
- var rewriteLinkPath = function rewriteLinkPath(path, relativeTo) {
42
- if (typeof path === "number") {
43
- return path;
44
- }
45
-
46
- if (!(0, _isLocalLink.isLocalLink)(path)) {
47
- return path;
48
- }
49
-
50
- var _parsePath = (0, _parsePath2.parsePath)(path),
51
- pathname = _parsePath.pathname,
52
- search = _parsePath.search,
53
- hash = _parsePath.hash;
54
-
55
- var option = getGlobalTrailingSlash();
56
- var adjustedPath = path;
57
-
58
- if (option === "always" || option === "never") {
59
- var output = (0, _applyTrailingSlashOption.applyTrailingSlashOption)(pathname, option);
60
- adjustedPath = "" + output + search + hash;
61
- }
62
-
63
- return isAbsolutePath(adjustedPath) ? (0, _.withPrefix)(adjustedPath) : absolutify(adjustedPath, relativeTo);
64
- };
65
-
66
- exports.rewriteLinkPath = rewriteLinkPath;
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json"
3
- }