WIP - add extractor, generate snippet_data
This commit is contained in:
6
node_modules/gatsby-link/.babelrc
generated
vendored
Normal file
6
node_modules/gatsby-link/.babelrc
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"presets": [
|
||||
["babel-preset-gatsby-package", { "browser": true }]
|
||||
]
|
||||
}
|
||||
|
||||
4
node_modules/gatsby-link/.eslintrc.yaml
generated
vendored
Normal file
4
node_modules/gatsby-link/.eslintrc.yaml
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
env:
|
||||
browser: true
|
||||
globals:
|
||||
___loader: false
|
||||
297
node_modules/gatsby-link/CHANGELOG.md
generated
vendored
Normal file
297
node_modules/gatsby-link/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,297 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.2.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.2.4...gatsby-link@2.2.5) (2019-08-13)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.2.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.2.3...gatsby-link@2.2.4) (2019-07-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **docs:** change relative url to absolute url for gatsby-link readme ([#16197](https://github.com/gatsbyjs/gatsby/issues/16197)) ([3eb43db](https://github.com/gatsbyjs/gatsby/commit/3eb43db))
|
||||
|
||||
## [2.2.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.2.2...gatsby-link@2.2.3) (2019-07-25)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.2.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.2.1...gatsby-link@2.2.2) (2019-07-12)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- correct links in package changelogs ([#15630](https://github.com/gatsbyjs/gatsby/issues/15630)) ([d07b9dd](https://github.com/gatsbyjs/gatsby/commit/d07b9dd))
|
||||
|
||||
## [2.2.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.2.0...gatsby-link@2.2.1) (2019-07-11)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
# [2.2.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.1.1...gatsby-link@2.2.0) (2019-06-20)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.1.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.1.0...gatsby-link@2.1.1) (2019-05-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **gatsby-link:** provide fallback for **BASE_PATH** being missing ([#13839](https://github.com/gatsbyjs/gatsby/issues/13839)) ([dc554bf](https://github.com/gatsbyjs/gatsby/commit/dc554bf))
|
||||
|
||||
# [2.1.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.17...gatsby-link@2.1.0) (2019-05-02)
|
||||
|
||||
### Features
|
||||
|
||||
- **gatsby:** add assetPrefix to support deploying assets separate from html ([#12128](https://github.com/gatsbyjs/gatsby/issues/12128)) ([8291044](https://github.com/gatsbyjs/gatsby/commit/8291044))
|
||||
|
||||
## [2.0.17](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.16...gatsby-link@2.0.17) (2019-04-30)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.0.16](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.15...gatsby-link@2.0.16) (2019-03-12)
|
||||
|
||||
### Features
|
||||
|
||||
- **gatsby-link:** adds support for partiallyActive=true to Link ([#12495](https://github.com/gatsbyjs/gatsby/issues/12495)) ([e0db681](https://github.com/gatsbyjs/gatsby/commit/e0db681))
|
||||
|
||||
## [2.0.15](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.14...gatsby-link@2.0.15) (2019-03-11)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.0.14](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.13...gatsby-link@2.0.14) (2019-03-04)
|
||||
|
||||
### Features
|
||||
|
||||
- **gatsby-link:** support RefObject ([#12174](https://github.com/gatsbyjs/gatsby/issues/12174)) ([5ab7a87](https://github.com/gatsbyjs/gatsby/commit/5ab7a87)), closes [#12014](https://github.com/gatsbyjs/gatsby/issues/12014)
|
||||
|
||||
## [2.0.13](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.12...gatsby-link@2.0.13) (2019-02-28)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.0.12](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.11...gatsby-link@2.0.12) (2019-02-22)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.0.11](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.10...gatsby-link@2.0.11) (2019-02-19)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
## [2.0.10](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.9...gatsby-link@2.0.10) (2019-02-01)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.9"></a>
|
||||
|
||||
## [2.0.9](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.8...gatsby-link@2.0.9) (2019-01-23)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.8"></a>
|
||||
|
||||
## [2.0.8](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.7...gatsby-link@2.0.8) (2019-01-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- enable ref forwarding with forwardRef ([#9892](https://github.com/gatsbyjs/gatsby/issues/9892)) ([b6d9775](https://github.com/gatsbyjs/gatsby/commit/b6d9775))
|
||||
|
||||
<a name="2.0.7"></a>
|
||||
|
||||
## [2.0.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.6...gatsby-link@2.0.7) (2018-11-29)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.6"></a>
|
||||
|
||||
## [2.0.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.5...gatsby-link@2.0.6) (2018-10-29)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.5"></a>
|
||||
|
||||
## [2.0.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.4...gatsby-link@2.0.5) (2018-10-24)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.4"></a>
|
||||
|
||||
## [2.0.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.3...gatsby-link@2.0.4) (2018-10-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- navigateTo deprecation message ([#8745](https://github.com/gatsbyjs/gatsby/issues/8745)) ([3c824f3](https://github.com/gatsbyjs/gatsby/commit/3c824f3))
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
|
||||
## [2.0.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.2...gatsby-link@2.0.3) (2018-10-01)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
|
||||
## [2.0.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.1...gatsby-link@2.0.2) (2018-09-26)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **gatsby-link:** use path prefix in navigate/replace/push calls ([#8289](https://github.com/gatsbyjs/gatsby/issues/8289)) ([df3ac18](https://github.com/gatsbyjs/gatsby/commit/df3ac18)), closes [#8155](https://github.com/gatsbyjs/gatsby/issues/8155)
|
||||
- scroll behaviour when navigating back to anchor on the same page ([#8061](https://github.com/gatsbyjs/gatsby/issues/8061)) ([ef44cff](https://github.com/gatsbyjs/gatsby/commit/ef44cff))
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
|
||||
## [2.0.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-rc.4...gatsby-link@2.0.1) (2018-09-17)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-rc.4"></a>
|
||||
|
||||
# [2.0.0-rc.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-rc.3...gatsby-link@2.0.0-rc.4) (2018-09-17)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-rc.3"></a>
|
||||
|
||||
# [2.0.0-rc.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-rc.2...gatsby-link@2.0.0-rc.3) (2018-09-13)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-rc.2"></a>
|
||||
|
||||
# [2.0.0-rc.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-rc.1...gatsby-link@2.0.0-rc.2) (2018-08-29)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-rc.1"></a>
|
||||
|
||||
# [2.0.0-rc.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-rc.0...gatsby-link@2.0.0-rc.1) (2018-08-29)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-rc.0"></a>
|
||||
|
||||
# [2.0.0-rc.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.22...gatsby-link@2.0.0-rc.0) (2018-08-21)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.22"></a>
|
||||
|
||||
# [2.0.0-beta.22](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.21...gatsby-link@2.0.0-beta.22) (2018-08-15)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.21"></a>
|
||||
|
||||
# [2.0.0-beta.21](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.20...gatsby-link@2.0.0-beta.21) (2018-08-15)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.20"></a>
|
||||
|
||||
# [2.0.0-beta.20](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.19...gatsby-link@2.0.0-beta.20) (2018-08-10)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.19"></a>
|
||||
|
||||
# [2.0.0-beta.19](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.18...gatsby-link@2.0.0-beta.19) (2018-08-09)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.18"></a>
|
||||
|
||||
# [2.0.0-beta.18](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.17...gatsby-link@2.0.0-beta.18) (2018-08-09)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.17"></a>
|
||||
|
||||
# [2.0.0-beta.17](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.15...gatsby-link@2.0.0-beta.17) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.15"></a>
|
||||
|
||||
# [2.0.0-beta.15](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.14...gatsby-link@2.0.0-beta.15) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.14"></a>
|
||||
|
||||
# [2.0.0-beta.14](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.12...gatsby-link@2.0.0-beta.14) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.12"></a>
|
||||
|
||||
# [2.0.0-beta.12](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.11...gatsby-link@2.0.0-beta.12) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.11"></a>
|
||||
|
||||
# [2.0.0-beta.11](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.10...gatsby-link@2.0.0-beta.11) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.10"></a>
|
||||
|
||||
# [2.0.0-beta.10](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.9...gatsby-link@2.0.0-beta.10) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.9"></a>
|
||||
|
||||
# [2.0.0-beta.9](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.8...gatsby-link@2.0.0-beta.9) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.8"></a>
|
||||
|
||||
# [2.0.0-beta.8](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.7...gatsby-link@2.0.0-beta.8) (2018-08-07)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.7"></a>
|
||||
|
||||
# [2.0.0-beta.7](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.6...gatsby-link@2.0.0-beta.7) (2018-08-06)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.6"></a>
|
||||
|
||||
# [2.0.0-beta.6](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.5...gatsby-link@2.0.0-beta.6) (2018-08-01)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.5"></a>
|
||||
|
||||
# [2.0.0-beta.5](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.4...gatsby-link@2.0.0-beta.5) (2018-07-21)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.4"></a>
|
||||
|
||||
# [2.0.0-beta.4](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.3...gatsby-link@2.0.0-beta.4) (2018-07-03)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.3"></a>
|
||||
|
||||
# [2.0.0-beta.3](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.2...gatsby-link@2.0.0-beta.3) (2018-06-25)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.2"></a>
|
||||
|
||||
# [2.0.0-beta.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.1...gatsby-link@2.0.0-beta.2) (2018-06-20)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.1"></a>
|
||||
|
||||
# [2.0.0-beta.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@2.0.0-beta.0...gatsby-link@2.0.0-beta.1) (2018-06-17)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
|
||||
<a name="2.0.0-beta.0"></a>
|
||||
|
||||
# [2.0.0-beta.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-link@1.6.44...gatsby-link@2.0.0-beta.0) (2018-06-17)
|
||||
|
||||
**Note:** Version bump only for package gatsby-link
|
||||
22
node_modules/gatsby-link/LICENSE
generated
vendored
Normal file
22
node_modules/gatsby-link/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gatsbyjs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
5
node_modules/gatsby-link/README.md
generated
vendored
Normal file
5
node_modules/gatsby-link/README.md
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# gatsby-link
|
||||
|
||||
All components and utility functions from this package are now exported from [`gatsby`](/packages/gatsby) package. You should not import anything from this package directly.
|
||||
|
||||
The [API reference](https://www.gatsbyjs.org/docs/gatsby-link/) has more documentation.
|
||||
58
node_modules/gatsby-link/index.d.ts
generated
vendored
Normal file
58
node_modules/gatsby-link/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
import * as React from "react"
|
||||
import { NavigateFn, LinkProps } from "@reach/router"
|
||||
|
||||
export interface GatsbyLinkProps<TState> extends LinkProps<TState> {
|
||||
/** A class to apply when this Link is active */
|
||||
activeClassName?: string
|
||||
/** Inline styles for when this Link is active */
|
||||
activeStyle?: object
|
||||
innerRef?: Function
|
||||
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void
|
||||
/** Class the link as highlighted if there is a partial match via a the `to` being prefixed to the current url */
|
||||
partiallyActive?: boolean
|
||||
/** Used to declare that this link replaces the current URL in history with the target */
|
||||
replace?: boolean
|
||||
/** The URL you want to link to */
|
||||
to: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This component is intended _only_ for links to pages handled by Gatsby. For links to pages on other
|
||||
* domains or pages on the same domain not handled by the current Gatsby site, use the normal `<a>` element.
|
||||
*/
|
||||
export default class GatsbyLink<TState> extends React.Component<
|
||||
GatsbyLinkProps<TState>,
|
||||
any
|
||||
> {}
|
||||
|
||||
/**
|
||||
* Sometimes you need to navigate to pages programmatically, such as during form submissions. In these
|
||||
* cases, `Link` won’t work.
|
||||
*/
|
||||
export const navigate: NavigateFn
|
||||
|
||||
/**
|
||||
* It is common to host sites in a sub-directory of a site. Gatsby lets you set the path prefix for your site.
|
||||
* After doing so, Gatsby's `<Link>` component will automatically handle constructing the correct URL in
|
||||
* development and production
|
||||
*/
|
||||
export const withPrefix: (path: string) => string
|
||||
export const withAssetPrefix: (path: string) => string
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* TODO: Remove for Gatsby v3
|
||||
*/
|
||||
export const push: (to: string) => void
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* TODO: Remove for Gatsby v3
|
||||
*/
|
||||
export const replace: (to: string) => void
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* TODO: Remove for Gatsby v3
|
||||
*/
|
||||
export const navigateTo: (to: string) => void
|
||||
244
node_modules/gatsby-link/index.js
generated
vendored
Normal file
244
node_modules/gatsby-link/index.js
generated
vendored
Normal file
@ -0,0 +1,244 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.withPrefix = withPrefix;
|
||||
exports.withAssetPrefix = withAssetPrefix;
|
||||
exports.navigateTo = exports.replace = exports.push = exports.navigate = exports.default = void 0;
|
||||
|
||||
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
||||
|
||||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
||||
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _router = require("@reach/router");
|
||||
|
||||
var _parsePath = require("./parse-path");
|
||||
|
||||
exports.parsePath = _parsePath.parsePath;
|
||||
|
||||
function withPrefix(path) {
|
||||
return normalizePath([typeof __BASE_PATH__ !== "undefined" ? __BASE_PATH__ : __PATH_PREFIX__, path].join("/"));
|
||||
}
|
||||
|
||||
function withAssetPrefix(path) {
|
||||
return [__PATH_PREFIX__].concat([path.replace(/^\//, "")]).join("/");
|
||||
}
|
||||
|
||||
function normalizePath(path) {
|
||||
return path.replace(/\/+/g, "/");
|
||||
}
|
||||
|
||||
var NavLinkPropTypes = {
|
||||
activeClassName: _propTypes.default.string,
|
||||
activeStyle: _propTypes.default.object,
|
||||
partiallyActive: _propTypes.default.bool // Set up IntersectionObserver
|
||||
|
||||
};
|
||||
|
||||
var handleIntersection = function handleIntersection(el, cb) {
|
||||
var io = new window.IntersectionObserver(function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (el === entry.target) {
|
||||
// Check if element is within viewport, remove listener, destroy observer, and run link callback.
|
||||
// MSEdge doesn't currently support isIntersecting, so also test for an intersectionRatio > 0
|
||||
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
||||
io.unobserve(el);
|
||||
io.disconnect();
|
||||
cb();
|
||||
}
|
||||
}
|
||||
});
|
||||
}); // Add element to the observer
|
||||
|
||||
io.observe(el);
|
||||
};
|
||||
|
||||
var GatsbyLink =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
(0, _inheritsLoose2.default)(GatsbyLink, _React$Component);
|
||||
|
||||
function GatsbyLink(props) {
|
||||
var _this;
|
||||
|
||||
_this = _React$Component.call(this, props) || this; // Default to no support for IntersectionObserver
|
||||
|
||||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "defaultGetProps", function (_ref) {
|
||||
var isPartiallyCurrent = _ref.isPartiallyCurrent,
|
||||
isCurrent = _ref.isCurrent;
|
||||
|
||||
if (_this.props.partiallyActive ? isPartiallyCurrent : isCurrent) {
|
||||
return {
|
||||
className: [_this.props.className, _this.props.activeClassName].filter(Boolean).join(" "),
|
||||
style: (0, _extends2.default)({}, _this.props.style, _this.props.activeStyle)
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
var IOSupported = false;
|
||||
|
||||
if (typeof window !== "undefined" && window.IntersectionObserver) {
|
||||
IOSupported = true;
|
||||
}
|
||||
|
||||
_this.state = {
|
||||
IOSupported: IOSupported
|
||||
};
|
||||
_this.handleRef = _this.handleRef.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
||||
return _this;
|
||||
}
|
||||
|
||||
var _proto = GatsbyLink.prototype;
|
||||
|
||||
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
||||
// Preserve non IO functionality if no support
|
||||
if (this.props.to !== prevProps.to && !this.state.IOSupported) {
|
||||
___loader.enqueue((0, _parsePath.parsePath)(this.props.to).pathname);
|
||||
}
|
||||
};
|
||||
|
||||
_proto.componentDidMount = function componentDidMount() {
|
||||
// Preserve non IO functionality if no support
|
||||
if (!this.state.IOSupported) {
|
||||
___loader.enqueue((0, _parsePath.parsePath)(this.props.to).pathname);
|
||||
}
|
||||
};
|
||||
|
||||
_proto.handleRef = function handleRef(ref) {
|
||||
var _this2 = this;
|
||||
|
||||
if (this.props.innerRef && this.props.innerRef.hasOwnProperty("current")) {
|
||||
this.props.innerRef.current = ref;
|
||||
} else if (this.props.innerRef) {
|
||||
this.props.innerRef(ref);
|
||||
}
|
||||
|
||||
if (this.state.IOSupported && ref) {
|
||||
// If IO supported and element reference found, setup Observer functionality
|
||||
handleIntersection(ref, function () {
|
||||
___loader.enqueue((0, _parsePath.parsePath)(_this2.props.to).pathname);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
_proto.render = function render() {
|
||||
var _this3 = this;
|
||||
|
||||
var _this$props = this.props,
|
||||
to = _this$props.to,
|
||||
_this$props$getProps = _this$props.getProps,
|
||||
getProps = _this$props$getProps === void 0 ? this.defaultGetProps : _this$props$getProps,
|
||||
_onClick = _this$props.onClick,
|
||||
_onMouseEnter = _this$props.onMouseEnter,
|
||||
$activeClassName = _this$props.activeClassName,
|
||||
$activeStyle = _this$props.activeStyle,
|
||||
$innerRef = _this$props.innerRef,
|
||||
partiallyActive = _this$props.partiallyActive,
|
||||
state = _this$props.state,
|
||||
replace = _this$props.replace,
|
||||
rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["to", "getProps", "onClick", "onMouseEnter", "activeClassName", "activeStyle", "innerRef", "partiallyActive", "state", "replace"]);
|
||||
var LOCAL_URL = /^\/(?!\/)/;
|
||||
|
||||
if (process.env.NODE_ENV !== "production" && !LOCAL_URL.test(to)) {
|
||||
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");
|
||||
}
|
||||
|
||||
var prefixedTo = withPrefix(to);
|
||||
return _react.default.createElement(_router.Link, (0, _extends2.default)({
|
||||
to: prefixedTo,
|
||||
state: state,
|
||||
getProps: getProps,
|
||||
innerRef: this.handleRef,
|
||||
onMouseEnter: function onMouseEnter(e) {
|
||||
if (_onMouseEnter) {
|
||||
_onMouseEnter(e);
|
||||
}
|
||||
|
||||
___loader.hovering((0, _parsePath.parsePath)(to).pathname);
|
||||
},
|
||||
onClick: function onClick(e) {
|
||||
if (_onClick) {
|
||||
_onClick(e);
|
||||
}
|
||||
|
||||
if (e.button === 0 && // ignore right clicks
|
||||
!_this3.props.target && // let browser handle "target=_blank"
|
||||
!e.defaultPrevented && // onClick prevented default
|
||||
!e.metaKey && // ignore clicks with modifier keys...
|
||||
!e.altKey && !e.ctrlKey && !e.shiftKey) {
|
||||
e.preventDefault(); // Make sure the necessary scripts and data are
|
||||
// loaded before continuing.
|
||||
|
||||
navigate(to, {
|
||||
state: state,
|
||||
replace: replace
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, rest));
|
||||
};
|
||||
|
||||
return GatsbyLink;
|
||||
}(_react.default.Component);
|
||||
|
||||
GatsbyLink.propTypes = (0, _extends2.default)({}, NavLinkPropTypes, {
|
||||
onClick: _propTypes.default.func,
|
||||
to: _propTypes.default.string.isRequired,
|
||||
replace: _propTypes.default.bool
|
||||
});
|
||||
|
||||
var showDeprecationWarning = function showDeprecationWarning(functionName, altFunctionName, version) {
|
||||
return console.warn("The \"" + functionName + "\" method is now deprecated and will be removed in Gatsby v" + version + ". Please use \"" + altFunctionName + "\" instead.");
|
||||
};
|
||||
|
||||
var _default = _react.default.forwardRef(function (props, ref) {
|
||||
return _react.default.createElement(GatsbyLink, (0, _extends2.default)({
|
||||
innerRef: ref
|
||||
}, props));
|
||||
});
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
var navigate = function navigate(to, options) {
|
||||
window.___navigate(withPrefix(to), options);
|
||||
};
|
||||
|
||||
exports.navigate = navigate;
|
||||
|
||||
var push = function push(to) {
|
||||
showDeprecationWarning("push", "navigate", 3);
|
||||
|
||||
window.___push(withPrefix(to));
|
||||
};
|
||||
|
||||
exports.push = push;
|
||||
|
||||
var replace = function replace(to) {
|
||||
showDeprecationWarning("replace", "navigate", 3);
|
||||
|
||||
window.___replace(withPrefix(to));
|
||||
}; // TODO: Remove navigateTo for Gatsby v3
|
||||
|
||||
|
||||
exports.replace = replace;
|
||||
|
||||
var navigateTo = function navigateTo(to) {
|
||||
showDeprecationWarning("navigateTo", "navigate", 3);
|
||||
return push(to);
|
||||
};
|
||||
|
||||
exports.navigateTo = navigateTo;
|
||||
73
node_modules/gatsby-link/package.json
generated
vendored
Normal file
73
node_modules/gatsby-link/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "gatsby-link@^2.2.5",
|
||||
"_id": "gatsby-link@2.2.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-qaQZZAXi6D7paxTV7VAl2P3WKcdoFosLLTCdUTWi50joNUhIxNbOf5CukQ3SuI4O1tuoP3usJsS5XhuX4+prqQ==",
|
||||
"_location": "/gatsby-link",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "gatsby-link@^2.2.5",
|
||||
"name": "gatsby-link",
|
||||
"escapedName": "gatsby-link",
|
||||
"rawSpec": "^2.2.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.2.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gatsby"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gatsby-link/-/gatsby-link-2.2.5.tgz",
|
||||
"_shasum": "d2d2a1a75447b622861e5835cd612ae1de80b749",
|
||||
"_spec": "gatsby-link@^2.2.5",
|
||||
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/gatsby",
|
||||
"author": {
|
||||
"name": "Kyle Mathews",
|
||||
"email": "mathews.kyle@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/gatsbyjs/gatsby/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"@types/reach__router": "^1.0.0",
|
||||
"prop-types": "^15.6.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "An enhanced Link component for Gatsby sites with support for resource prefetching",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@testing-library/react": "^8.0.6",
|
||||
"babel-preset-gatsby-package": "^0.2.2",
|
||||
"cross-env": "^5.1.4"
|
||||
},
|
||||
"gitHead": "8b92e16d02349d33d6abe0cc8b34b87083353028",
|
||||
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-link#readme",
|
||||
"keywords": [
|
||||
"gatsby"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "gatsby-link",
|
||||
"peerDependencies": {
|
||||
"@reach/router": "^1.1.1",
|
||||
"gatsby": "^2.0.0",
|
||||
"react": "^16.4.2",
|
||||
"react-dom": "^16.4.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gatsbyjs/gatsby.git",
|
||||
"directory": "packages/gatsby-link"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src --out-dir . --ignore **/__tests__",
|
||||
"prepare": "cross-env NODE_ENV=production npm run build",
|
||||
"watch": "babel -w src --out-dir . --ignore **/__tests__"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "2.2.5"
|
||||
}
|
||||
29
node_modules/gatsby-link/parse-path.js
generated
vendored
Normal file
29
node_modules/gatsby-link/parse-path.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.parsePath = parsePath;
|
||||
|
||||
function parsePath(path) {
|
||||
var pathname = path || "/";
|
||||
var search = "";
|
||||
var hash = "";
|
||||
var hashIndex = pathname.indexOf("#");
|
||||
|
||||
if (hashIndex !== -1) {
|
||||
hash = pathname.substr(hashIndex);
|
||||
pathname = pathname.substr(0, hashIndex);
|
||||
}
|
||||
|
||||
var searchIndex = pathname.indexOf("?");
|
||||
|
||||
if (searchIndex !== -1) {
|
||||
search = pathname.substr(searchIndex);
|
||||
pathname = pathname.substr(0, searchIndex);
|
||||
}
|
||||
|
||||
return {
|
||||
pathname: pathname,
|
||||
search: search === "?" ? "" : search,
|
||||
hash: hash === "#" ? "" : hash
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user