planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

21
node_modules/react-waypoint/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Brigade
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.

451
node_modules/react-waypoint/README.md generated vendored Normal file
View File

@@ -0,0 +1,451 @@
# React Waypoint
[![npm version](https://badge.fury.io/js/react-waypoint.svg)](http://badge.fury.io/js/react-waypoint)
[![Build Status](https://travis-ci.org/civiccc/react-waypoint.svg?branch=master)](https://travis-ci.org/civiccc/react-waypoint)
A React component to execute a function whenever you scroll to an element. Works
in all containers that can scroll, including the window.
React Waypoint can be used to build features like lazy loading content, infinite
scroll, scrollspies, or docking elements to the viewport on scroll.
Inspired by [Waypoints][waypoints], except this little library grooves the
[React][react] way.
## Demo
![Demo of React Waypoint in action](https://raw.github.com/civiccc/react-waypoint/master/react-waypoint-demo.gif)
[View demo page][demo-page]
[waypoints]: https://github.com/imakewebthings/waypoints
[react]: https://github.com/facebook/react
[demo-page]: https://civiccc.github.io/react-waypoint/
## Installation
### npm
```bash
npm install react-waypoint --save
```
### yarn
```bash
yarn add react-waypoint
```
## Usage
```jsx
import { Waypoint } from 'react-waypoint';
<Waypoint
onEnter={this._handleWaypointEnter}
onLeave={this._handleWaypointLeave}
/>
```
A waypoint normally fires `onEnter` and `onLeave` as you are scrolling, but it
can fire because of other events too:
- When the window is resized
- When it is mounted (fires `onEnter` if it's visible on the page)
- When it is updated/re-rendered by its parent
Callbacks will only fire if the new position changed from the last known
position. Sometimes it's useful to have a waypoint that fires `onEnter` every
time it is updated as long as it stays visible (e.g. for infinite scroll). You
can then use a `key` prop to control when a waypoint is reused vs. re-created.
```jsx
<Waypoint
key={cursor}
onEnter={this._loadMoreContent}
/>
```
Alternatively, you can also use an `onPositionChange` event to just get
notified when the waypoint's position (e.g. inside the viewport, above or
below) has changed.
```jsx
<Waypoint
onPositionChange={this._handlePositionChange}
/>
```
Waypoints can take a child, allowing you to track when a section of content
enters or leaves the viewport. For details, see [Children](#children), below.
```jsx
<Waypoint onEnter={this._handleEnter}>
<div>
Some content here
</div>
</Waypoint>
```
### Example: [JSFiddle Example][jsfiddle-example]
[jsfiddle-example]: http://jsfiddle.net/L4z5wcx0/7/
## Prop types
```jsx
propTypes: {
/**
* Function called when waypoint enters viewport
*/
onEnter: PropTypes.func,
/**
* Function called when waypoint leaves viewport
*/
onLeave: PropTypes.func,
/**
* Function called when waypoint position changes
*/
onPositionChange: PropTypes.func,
/**
* Whether to activate on horizontal scrolling instead of vertical
*/
horizontal: PropTypes.bool,
/**
* `topOffset` can either be a number, in which case its a distance from the
* top of the container in pixels, or a string value. Valid string values are
* of the form "20px", which is parsed as pixels, or "20%", which is parsed
* as a percentage of the height of the containing element.
* For instance, if you pass "-20%", and the containing element is 100px tall,
* then the waypoint will be triggered when it has been scrolled 20px beyond
* the top of the containing element.
*/
topOffset: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
/**
* `bottomOffset` can either be a number, in which case its a distance from the
* bottom of the container in pixels, or a string value. Valid string values are
* of the form "20px", which is parsed as pixels, or "20%", which is parsed
* as a percentage of the height of the containing element.
* For instance, if you pass "20%", and the containing element is 100px tall,
* then the waypoint will be triggered when it has been scrolled 20px beyond
* the bottom of the containing element.
*
* Similar to `topOffset`, but for the bottom of the container.
*/
bottomOffset: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
/**
* Scrollable Ancestor - A custom ancestor to determine if the
* target is visible in it. This is useful in cases where
* you do not want the immediate scrollable ancestor to be
* the container. For example, when your target is in a div
* that has overflow auto but you are detecting onEnter based
* on the window.
*
* This should typically be a reference to a DOM node, but it will also work
* to pass it the string "window" if you are using server rendering.
*/
scrollableAncestor: PropTypes.any,
/**
* fireOnRapidScroll - if the onEnter/onLeave events are to be fired
* on rapid scrolling. This has no effect on onPositionChange -- it will
* fire anyway.
*/
fireOnRapidScroll: PropTypes.bool,
/**
* Use this prop to get debug information in the console log. This slows
* things down significantly, so it should only be used during development.
*/
debug: PropTypes.bool,
},
```
All callbacks (`onEnter`/`onLeave`/`onPositionChange`) receive an object as the
only argument. That object has the following properties:
- `currentPosition` - the position that the waypoint has at the moment. One
of `Waypoint.below`, `Waypoint.above`, `Waypoint.inside`,
and `Waypoint.invisible`.
- `previousPosition` - the position that the waypoint had before. Also one
of `Waypoint.below`, `Waypoint.above`, `Waypoint.inside`,
and `Waypoint.invisible`.
In most cases, the above two properties should be enough. In some cases
though, you might find these additional properties useful:
- `event` - the native [scroll
event](https://developer.mozilla.org/en-US/docs/Web/Events/scroll) that
triggered the callback. May be missing if the callback wasn't triggered
as the result of a scroll.
- `waypointTop` - the waypoint's distance to the top of the viewport.
- `viewportTop` - the distance from the scrollable ancestor to the
viewport top.
- `viewportBottom` - the distance from the bottom of the scrollable
ancestor to the viewport top.
If you use [es6 object
destructuring](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment),
this means that you can use waypoints in the following way:
```jsx
<Waypoint onEnter={({ previousPosition, currentPosition, event }) => {
// do something useful!
}}
/>
```
If you are more familiar with plain old js functions, you'll do something like
this:
```jsx
<Waypoint onEnter={function(props) {
// here you can use `props.currentPosition`, `props.previousPosition`, and
// `props.event`
}}
/>
```
## Offsets and Boundaries
Two of the Waypoint props are `topOffset` and `bottomOffset`. To appreciate
what these can do for you, it will help to have an understanding of the
"boundaries" used by this library. The boundaries of React Waypoint are the top
and bottom of the element containing your scrollable content ([although this element
can be configured](#containing-elements-and-scrollableancestor)). When a
waypoint is within these boundaries, it is considered to be "inside." When a
waypoint passes beyond these boundaries, then it is "outside." The `onEnter` and
`onLeave` props are called as an element transitions from being inside to
outside, or vice versa.
The `topOffset` and `bottomOffset` properties can adjust the placement of these
boundaries. By default, the offset is `'0px'`. If you specify a positive value,
then the boundaries will be pushed inward, toward the center of the page. If
you specify a negative value for an offset, then the boundary will be pushed
outward from the center of the page.
Here is an illustration of offsets and boundaries. The black box is the
[`scrollableAncestor`](#containing-elements-and-scrollableancestor). The pink
lines represent the location of the boundaries. The offsets that determine
the boundaries are in light pink.
![](https://cloud.githubusercontent.com/assets/2322305/16939123/5be12454-4d33-11e6-86b6-ad431da93bf2.png)
#### Horizontal Scrolling Offsets and Boundaries
By default, waypoints listen to vertical scrolling. If you want to switch to
horizontal scrolling instead, use the `horizontal` prop. For simplicity's sake,
all other props and callbacks do not change. Instead, `topOffset` and
`bottomOffset` (among other directional variables) will mean the offset from
the left and the offset from the right, respectively, and work exactly as they
did before, just calculated in the horizontal direction.
#### Example Usage
Positive values of the offset props are useful when you have an element that
overlays your scrollable area. For instance, if your app has a `50px` fixed
header, then you may want to specify `topOffset='50px'`, so that the
`onEnter` callback is called when waypoints scroll into view from beneath the
header.
Negative values of the offset prop could be useful for lazy loading. Imagine if
you had a lot of large images on a long page, but you didn't want to load them
all at once. You can use React Waypoint to receive a callback whenever an image
is a certain distance from the bottom of the page. For instance, by specifying
`bottomOffset='-200px'`, then your `onEnter` callback would be called when
the waypoint comes closer than 200 pixels from the bottom edge of the page. By
placing a waypoint near each image, you could dynamically load them.
There are likely many more use cases for the offsets: be creative! Also, keep in
mind that there are _two_ boundaries, so there are always _two_ positions when
the `onLeave` and `onEnter` callback will be called. By using the arguments
passed to the callbacks, you can determine whether the waypoint has crossed the
top boundary or the bottom boundary.
## Children
If you don't pass a child into your Waypoint, then you can think of the
waypoint as a line across the page. Whenever that line crosses a
[boundary](#offsets-and-boundaries), then the `onEnter` or `onLeave` callbacks
will be called.
If you do pass a child, it can be a single DOM component (e.g. `<div>`) or a
composite component (e.g. `<MyComponent />`).
Waypoint needs a DOM node to compute its boundaries. When you pass a DOM
component to Waypoint, it handles getting a reference to the DOM node through
the `ref` prop automatically.
If you pass a composite component, you can wrap it with `React.forwardRef` (requires `react@^16.3.0`)
and have the `ref` prop being handled automatically for you, like this:
```jsx
class Block extends React.Component {
render() {
return <div ref={this.props.innerRef}>Hello</div>
}
}
const BlockWithRef = React.forwardRef((props, ref) => {
return <Block innerRef={ref} {...props} />
})
const App = () => (
<Waypoint>
<BlockWithRef />
</Waypoint>
)
```
If you can't do that because you are using older version of React then
you need to make use of the `innerRef` prop passed by Waypoint to your component.
Simply pass it through as the `ref` of a DOM component and you're all set. Like in
this example:
```jsx
class Block extends React.Component {
render() {
return <div ref={this.props.innerRef}>Hello</div>
}
}
Block.propTypes = {
innerRef: PropTypes.func.isRequired,
}
const App = () => (
<Waypoint>
<Block />
</Waypoint>
)
```
The `onEnter` callback will be called when *any* part of the child is visible
in the viewport. The `onLeave` callback will be called when *all* of the child
has exited the viewport.
(Note that this is measured only on a single axis. What this means is that for a
Waypoint within a vertically scrolling parent, it could be off of the screen
horizontally yet still fire an onEnter event, because it is within the vertical
boundaries).
Deciding whether to pass a child or not will depend on your use case. One
example of when passing a child is useful is for a scrollspy
(like [Bootstrap's](https://bootstrapdocs.com/v3.3.6/docs/javascript/#scrollspy)).
Imagine if you want to fire a waypoint when a particularly long piece of content
is visible onscreen. When the page loads, it is conceivable that both the top
and bottom of this piece of content could lie outside of the boundaries,
because the content is taller than the viewport. If you didn't pass a child,
and instead put the waypoint above or below the content, then you will not
receive an `onEnter` callback (nor any other callback from this library).
Instead, passing this long content as a child of the Waypoint would fire the `onEnter`
callback when the page loads.
## Containing elements and `scrollableAncestor`
React Waypoint positions its [boundaries](#offsets-and-boundaries) based on the
first scrollable ancestor of the Waypoint.
If that algorithm doesn't work for your use case, then you might find the
`scrollableAncestor` prop useful. It allows you to specify what the scrollable
ancestor is. Pass a reference to a DOM node as that prop, and the Waypoint will
use the scroll position of *that* node, rather than its first scrollable
ancestor.
This can also be the string "window", which can be useful if you are using
server rendering.
#### Example Usage
Sometimes, waypoints that are deeply nested in the DOM tree may need to track
the scroll position of the page as a whole. If you want to be sure that no other
scrollable ancestor is used (since, once again, the first scrollable ancestor is
what the library will use by default), then you can explicitly set the
`scrollableAncestor` to be the `window` to ensure that no other element is used.
This might look something like:
```jsx
<Waypoint
scrollableAncestor={window}
onEnter={this._handleWaypointEnter}
onLeave={this._handleWaypointLeave}
/>
```
## Troubleshooting
If your waypoint isn't working the way you expect it to, there are a few ways
you can debug your setup.
OPTION 1: Add the `debug={true}` prop to your waypoint. When you do, you'll see console
logs informing you about the internals of the waypoint.
OPTION 2: Clone and modify the project locally.
- clone this repo
- add `console.log` or breakpoints where you think it would be useful.
- `npm link` in the react-waypoint repo.
- `npm link react-waypoint` in your project.
- if needed rebuild react-waypoint module: `npm run build-npm`
## Limitations
In this component we make a few assumptions that we believe are generally safe,
but in some situations might present limitations.
- We determine the scrollable-ness of a node by inspecting its computed
overflow-y or overflow property and nothing else. This could mean that a
container with this style that does not actually currently scroll will be
considered when performing visibility calculations.
- We assume that waypoints are rendered within at most one scrollable container.
If you render a waypoint in multiple nested scrollable containers, the
visibility calculations will likely not be accurate.
- We also base the visibility calculations on the scroll position of the
scrollable container (or `window` if no scrollable container is found). This
means that if your scrollable container has a height that is greater than the
window, it might trigger `onEnter` unexpectedly.
## In the wild
[Organizations and projects using `react-waypoint`](INTHEWILD.md).
## Credits
Credit to [trotzig][trotzig-github] and [lencioni][lencioni-github] for writing
this component, and [Brigade][brigade-home] for open sourcing it.
Thanks to the creator of the original Waypoints library,
[imakewebthings][imakewebthings-github].
[lencioni-github]: https://github.com/lencioni
[trotzig-github]: https://github.com/trotzig
[brigade-home]: https://www.brigade.com/
[imakewebthings-github]: https://github.com/imakewebthings
## License
[MIT][mit-license]
[mit-license]: ./LICENSE
---
_Make sure to check out other popular open-source tools from the
[Brigade][civiccc-github] team: [dock], [overcommit], [haml-lint], and [scss-lint]._
[civiccc-github]: https://github.com/civiccc
[dock]: https://github.com/civiccc/dock
[overcommit]: https://github.com/sds/overcommit
[haml-lint]: https://github.com/sds/haml-lint
[scss-lint]: https://github.com/sds/scss-lint

578
node_modules/react-waypoint/cjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,578 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
var consolidatedEvents = require('consolidated-events');
var PropTypes = require('prop-types');
var React = require('react');
var reactIs = require('react-is');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
/**
* Attempts to parse the offset provided as a prop as a percentage. For
* instance, if the component has been provided with the string "20%" as
* a value of one of the offset props. If the value matches, then it returns
* a numeric version of the prop. For instance, "20%" would become `0.2`.
* If `str` isn't a percentage, then `undefined` will be returned.
*
* @param {string} str The value of an offset prop to be converted to a
* number.
* @return {number|undefined} The numeric version of `str`. Undefined if `str`
* was not a percentage.
*/
function parseOffsetAsPercentage(str) {
if (str.slice(-1) === '%') {
return parseFloat(str.slice(0, -1)) / 100;
}
return undefined;
}
/**
* Attempts to parse the offset provided as a prop as a pixel value. If
* parsing fails, then `undefined` is returned. Three examples of values that
* will be successfully parsed are:
* `20`
* "20px"
* "20"
*
* @param {string|number} str A string of the form "{number}" or "{number}px",
* or just a number.
* @return {number|undefined} The numeric version of `str`. Undefined if `str`
* was neither a number nor string ending in "px".
*/
function parseOffsetAsPixels(str) {
if (!isNaN(parseFloat(str)) && isFinite(str)) {
return parseFloat(str);
}
if (str.slice(-2) === 'px') {
return parseFloat(str.slice(0, -2));
}
return undefined;
}
/**
* @param {string|number} offset
* @param {number} contextHeight
* @return {number} A number representing `offset` converted into pixels.
*/
function computeOffsetPixels(offset, contextHeight) {
var pixelOffset = parseOffsetAsPixels(offset);
if (typeof pixelOffset === 'number') {
return pixelOffset;
}
var percentOffset = parseOffsetAsPercentage(offset);
if (typeof percentOffset === 'number') {
return percentOffset * contextHeight;
}
return undefined;
}
var ABOVE = 'above';
var INSIDE = 'inside';
var BELOW = 'below';
var INVISIBLE = 'invisible';
function debugLog() {
if (process.env.NODE_ENV !== 'production') {
var _console;
(_console = console).log.apply(_console, arguments); // eslint-disable-line no-console
}
}
/**
* When an element's type is a string, it represents a DOM node with that tag name
* https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html#dom-elements
*
* @param {React.element} Component
* @return {bool} Whether the component is a DOM Element
*/
function isDOMElement(Component) {
return typeof Component.type === 'string';
}
var errorMessage = '<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a ' + 'DOM element (e.g. <div>) nor does it use the innerRef prop.\n\n' + 'See https://goo.gl/LrBNgw for more info.';
/**
* Raise an error if "children" is not a DOM Element and there is no ref provided to Waypoint
*
* @param {?React.element} children
* @param {?HTMLElement} ref
* @return {undefined}
*/
function ensureRefIsProvidedByChild(children, ref) {
if (children && !isDOMElement(children) && !ref) {
throw new Error(errorMessage);
}
}
/**
* @param {object} bounds An object with bounds data for the waypoint and
* scrollable parent
* @return {string} The current position of the waypoint in relation to the
* visible portion of the scrollable parent. One of the constants `ABOVE`,
* `BELOW`, `INSIDE` or `INVISIBLE`.
*/
function getCurrentPosition(bounds) {
if (bounds.viewportBottom - bounds.viewportTop === 0) {
return INVISIBLE;
} // top is within the viewport
if (bounds.viewportTop <= bounds.waypointTop && bounds.waypointTop <= bounds.viewportBottom) {
return INSIDE;
} // bottom is within the viewport
if (bounds.viewportTop <= bounds.waypointBottom && bounds.waypointBottom <= bounds.viewportBottom) {
return INSIDE;
} // top is above the viewport and bottom is below the viewport
if (bounds.waypointTop <= bounds.viewportTop && bounds.viewportBottom <= bounds.waypointBottom) {
return INSIDE;
}
if (bounds.viewportBottom < bounds.waypointTop) {
return BELOW;
}
if (bounds.waypointTop < bounds.viewportTop) {
return ABOVE;
}
return INVISIBLE;
}
var timeout;
var timeoutQueue = [];
function onNextTick(cb) {
timeoutQueue.push(cb);
if (!timeout) {
timeout = setTimeout(function () {
timeout = null; // Drain the timeoutQueue
var item; // eslint-disable-next-line no-cond-assign
while (item = timeoutQueue.shift()) {
item();
}
}, 0);
}
var isSubscribed = true;
return function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
var index = timeoutQueue.indexOf(cb);
if (index === -1) {
return;
}
timeoutQueue.splice(index, 1);
if (!timeoutQueue.length && timeout) {
clearTimeout(timeout);
timeout = null;
}
};
}
function resolveScrollableAncestorProp(scrollableAncestor) {
// When Waypoint is rendered on the server, `window` is not available.
// To make Waypoint easier to work with, we allow this to be specified in
// string form and safely convert to `window` here.
if (scrollableAncestor === 'window') {
return global.window;
}
return scrollableAncestor;
}
var hasWindow = typeof window !== 'undefined';
var defaultProps = {
debug: false,
scrollableAncestor: undefined,
children: undefined,
topOffset: '0px',
bottomOffset: '0px',
horizontal: false,
onEnter: function onEnter() {},
onLeave: function onLeave() {},
onPositionChange: function onPositionChange() {},
fireOnRapidScroll: true
}; // Calls a function when you scroll to the element.
var Waypoint = /*#__PURE__*/function (_React$PureComponent) {
_inheritsLoose__default['default'](Waypoint, _React$PureComponent);
function Waypoint(props) {
var _this;
_this = _React$PureComponent.call(this, props) || this;
_this.refElement = function (e) {
_this._ref = e;
};
return _this;
}
var _proto = Waypoint.prototype;
_proto.componentDidMount = function componentDidMount() {
var _this2 = this;
if (!hasWindow) {
return;
} // this._ref may occasionally not be set at this time. To help ensure that
// this works smoothly and to avoid layout thrashing, we want to delay the
// initial execution until the next tick.
this.cancelOnNextTick = onNextTick(function () {
_this2.cancelOnNextTick = null;
var _this2$props = _this2.props,
children = _this2$props.children,
debug = _this2$props.debug; // Berofe doing anything, we want to check that this._ref is avaliable in Waypoint
ensureRefIsProvidedByChild(children, _this2._ref);
_this2._handleScroll = _this2._handleScroll.bind(_this2);
_this2.scrollableAncestor = _this2._findScrollableAncestor();
if (process.env.NODE_ENV !== 'production' && debug) {
debugLog('scrollableAncestor', _this2.scrollableAncestor);
}
_this2.scrollEventListenerUnsubscribe = consolidatedEvents.addEventListener(_this2.scrollableAncestor, 'scroll', _this2._handleScroll, {
passive: true
});
_this2.resizeEventListenerUnsubscribe = consolidatedEvents.addEventListener(window, 'resize', _this2._handleScroll, {
passive: true
});
_this2._handleScroll(null);
});
};
_proto.componentDidUpdate = function componentDidUpdate() {
var _this3 = this;
if (!hasWindow) {
return;
}
if (!this.scrollableAncestor) {
// The Waypoint has not yet initialized.
return;
} // The element may have moved, so we need to recompute its position on the
// page. This happens via handleScroll in a way that forces layout to be
// computed.
//
// We want this to be deferred to avoid forcing layout during render, which
// causes layout thrashing. And, if we already have this work enqueued, we
// can just wait for that to happen instead of enqueueing again.
if (this.cancelOnNextTick) {
return;
}
this.cancelOnNextTick = onNextTick(function () {
_this3.cancelOnNextTick = null;
_this3._handleScroll(null);
});
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (!hasWindow) {
return;
}
if (this.scrollEventListenerUnsubscribe) {
this.scrollEventListenerUnsubscribe();
}
if (this.resizeEventListenerUnsubscribe) {
this.resizeEventListenerUnsubscribe();
}
if (this.cancelOnNextTick) {
this.cancelOnNextTick();
}
}
/**
* Traverses up the DOM to find an ancestor container which has an overflow
* style that allows for scrolling.
*
* @return {Object} the closest ancestor element with an overflow style that
* allows for scrolling. If none is found, the `window` object is returned
* as a fallback.
*/
;
_proto._findScrollableAncestor = function _findScrollableAncestor() {
var _this$props = this.props,
horizontal = _this$props.horizontal,
scrollableAncestor = _this$props.scrollableAncestor;
if (scrollableAncestor) {
return resolveScrollableAncestorProp(scrollableAncestor);
}
var node = this._ref;
while (node.parentNode) {
node = node.parentNode;
if (node === document.body) {
// We've reached all the way to the root node.
return window;
}
var style = window.getComputedStyle(node);
var overflowDirec = horizontal ? style.getPropertyValue('overflow-x') : style.getPropertyValue('overflow-y');
var overflow = overflowDirec || style.getPropertyValue('overflow');
if (overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay') {
return node;
}
} // A scrollable ancestor element was not found, which means that we need to
// do stuff on window.
return window;
}
/**
* @param {Object} event the native scroll event coming from the scrollable
* ancestor, or resize event coming from the window. Will be undefined if
* called by a React lifecyle method
*/
;
_proto._handleScroll = function _handleScroll(event) {
if (!this._ref) {
// There's a chance we end up here after the component has been unmounted.
return;
}
var bounds = this._getBounds();
var currentPosition = getCurrentPosition(bounds);
var previousPosition = this._previousPosition;
var _this$props2 = this.props,
debug = _this$props2.debug,
onPositionChange = _this$props2.onPositionChange,
onEnter = _this$props2.onEnter,
onLeave = _this$props2.onLeave,
fireOnRapidScroll = _this$props2.fireOnRapidScroll;
if (process.env.NODE_ENV !== 'production' && debug) {
debugLog('currentPosition', currentPosition);
debugLog('previousPosition', previousPosition);
} // Save previous position as early as possible to prevent cycles
this._previousPosition = currentPosition;
if (previousPosition === currentPosition) {
// No change since last trigger
return;
}
var callbackArg = {
currentPosition: currentPosition,
previousPosition: previousPosition,
event: event,
waypointTop: bounds.waypointTop,
waypointBottom: bounds.waypointBottom,
viewportTop: bounds.viewportTop,
viewportBottom: bounds.viewportBottom
};
onPositionChange.call(this, callbackArg);
if (currentPosition === INSIDE) {
onEnter.call(this, callbackArg);
} else if (previousPosition === INSIDE) {
onLeave.call(this, callbackArg);
}
var isRapidScrollDown = previousPosition === BELOW && currentPosition === ABOVE;
var isRapidScrollUp = previousPosition === ABOVE && currentPosition === BELOW;
if (fireOnRapidScroll && (isRapidScrollDown || isRapidScrollUp)) {
// If the scroll event isn't fired often enough to occur while the
// waypoint was visible, we trigger both callbacks anyway.
onEnter.call(this, {
currentPosition: INSIDE,
previousPosition: previousPosition,
event: event,
waypointTop: bounds.waypointTop,
waypointBottom: bounds.waypointBottom,
viewportTop: bounds.viewportTop,
viewportBottom: bounds.viewportBottom
});
onLeave.call(this, {
currentPosition: currentPosition,
previousPosition: INSIDE,
event: event,
waypointTop: bounds.waypointTop,
waypointBottom: bounds.waypointBottom,
viewportTop: bounds.viewportTop,
viewportBottom: bounds.viewportBottom
});
}
};
_proto._getBounds = function _getBounds() {
var _this$props3 = this.props,
horizontal = _this$props3.horizontal,
debug = _this$props3.debug;
var _this$_ref$getBoundin = this._ref.getBoundingClientRect(),
left = _this$_ref$getBoundin.left,
top = _this$_ref$getBoundin.top,
right = _this$_ref$getBoundin.right,
bottom = _this$_ref$getBoundin.bottom;
var waypointTop = horizontal ? left : top;
var waypointBottom = horizontal ? right : bottom;
var contextHeight;
var contextScrollTop;
if (this.scrollableAncestor === window) {
contextHeight = horizontal ? window.innerWidth : window.innerHeight;
contextScrollTop = 0;
} else {
contextHeight = horizontal ? this.scrollableAncestor.offsetWidth : this.scrollableAncestor.offsetHeight;
contextScrollTop = horizontal ? this.scrollableAncestor.getBoundingClientRect().left : this.scrollableAncestor.getBoundingClientRect().top;
}
if (process.env.NODE_ENV !== 'production' && debug) {
debugLog('waypoint top', waypointTop);
debugLog('waypoint bottom', waypointBottom);
debugLog('scrollableAncestor height', contextHeight);
debugLog('scrollableAncestor scrollTop', contextScrollTop);
}
var _this$props4 = this.props,
bottomOffset = _this$props4.bottomOffset,
topOffset = _this$props4.topOffset;
var topOffsetPx = computeOffsetPixels(topOffset, contextHeight);
var bottomOffsetPx = computeOffsetPixels(bottomOffset, contextHeight);
var contextBottom = contextScrollTop + contextHeight;
return {
waypointTop: waypointTop,
waypointBottom: waypointBottom,
viewportTop: contextScrollTop + topOffsetPx,
viewportBottom: contextBottom - bottomOffsetPx
};
}
/**
* @return {Object}
*/
;
_proto.render = function render() {
var _this4 = this;
var children = this.props.children;
if (!children) {
// We need an element that we can locate in the DOM to determine where it is
// rendered relative to the top of its context.
return /*#__PURE__*/React__default['default'].createElement("span", {
ref: this.refElement,
style: {
fontSize: 0
}
});
}
if (isDOMElement(children) || reactIs.isForwardRef(children)) {
var ref = function ref(node) {
_this4.refElement(node);
if (children.ref) {
if (typeof children.ref === 'function') {
children.ref(node);
} else {
children.ref.current = node;
}
}
};
return /*#__PURE__*/React__default['default'].cloneElement(children, {
ref: ref
});
}
return /*#__PURE__*/React__default['default'].cloneElement(children, {
innerRef: this.refElement
});
};
return Waypoint;
}(React__default['default'].PureComponent);
if (process.env.NODE_ENV !== 'production') {
Waypoint.propTypes = {
children: PropTypes__default['default'].element,
debug: PropTypes__default['default'].bool,
onEnter: PropTypes__default['default'].func,
onLeave: PropTypes__default['default'].func,
onPositionChange: PropTypes__default['default'].func,
fireOnRapidScroll: PropTypes__default['default'].bool,
// eslint-disable-next-line react/forbid-prop-types
scrollableAncestor: PropTypes__default['default'].any,
horizontal: PropTypes__default['default'].bool,
// `topOffset` can either be a number, in which case its a distance from the
// top of the container in pixels, or a string value. Valid string values are
// of the form "20px", which is parsed as pixels, or "20%", which is parsed
// as a percentage of the height of the containing element.
// For instance, if you pass "-20%", and the containing element is 100px tall,
// then the waypoint will be triggered when it has been scrolled 20px beyond
// the top of the containing element.
topOffset: PropTypes__default['default'].oneOfType([PropTypes__default['default'].string, PropTypes__default['default'].number]),
// `bottomOffset` can either be a number, in which case its a distance from the
// bottom of the container in pixels, or a string value. Valid string values are
// of the form "20px", which is parsed as pixels, or "20%", which is parsed
// as a percentage of the height of the containing element.
// For instance, if you pass "20%", and the containing element is 100px tall,
// then the waypoint will be triggered when it has been scrolled 20px beyond
// the bottom of the containing element.
// Similar to `topOffset`, but for the bottom of the container.
bottomOffset: PropTypes__default['default'].oneOfType([PropTypes__default['default'].string, PropTypes__default['default'].number])
};
}
Waypoint.above = ABOVE;
Waypoint.below = BELOW;
Waypoint.inside = INSIDE;
Waypoint.invisible = INVISIBLE;
Waypoint.defaultProps = defaultProps;
Waypoint.displayName = 'Waypoint';
exports.Waypoint = Waypoint;

568
node_modules/react-waypoint/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,568 @@
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
import { addEventListener } from 'consolidated-events';
import PropTypes from 'prop-types';
import React from 'react';
import { isForwardRef } from 'react-is';
/**
* Attempts to parse the offset provided as a prop as a percentage. For
* instance, if the component has been provided with the string "20%" as
* a value of one of the offset props. If the value matches, then it returns
* a numeric version of the prop. For instance, "20%" would become `0.2`.
* If `str` isn't a percentage, then `undefined` will be returned.
*
* @param {string} str The value of an offset prop to be converted to a
* number.
* @return {number|undefined} The numeric version of `str`. Undefined if `str`
* was not a percentage.
*/
function parseOffsetAsPercentage(str) {
if (str.slice(-1) === '%') {
return parseFloat(str.slice(0, -1)) / 100;
}
return undefined;
}
/**
* Attempts to parse the offset provided as a prop as a pixel value. If
* parsing fails, then `undefined` is returned. Three examples of values that
* will be successfully parsed are:
* `20`
* "20px"
* "20"
*
* @param {string|number} str A string of the form "{number}" or "{number}px",
* or just a number.
* @return {number|undefined} The numeric version of `str`. Undefined if `str`
* was neither a number nor string ending in "px".
*/
function parseOffsetAsPixels(str) {
if (!isNaN(parseFloat(str)) && isFinite(str)) {
return parseFloat(str);
}
if (str.slice(-2) === 'px') {
return parseFloat(str.slice(0, -2));
}
return undefined;
}
/**
* @param {string|number} offset
* @param {number} contextHeight
* @return {number} A number representing `offset` converted into pixels.
*/
function computeOffsetPixels(offset, contextHeight) {
var pixelOffset = parseOffsetAsPixels(offset);
if (typeof pixelOffset === 'number') {
return pixelOffset;
}
var percentOffset = parseOffsetAsPercentage(offset);
if (typeof percentOffset === 'number') {
return percentOffset * contextHeight;
}
return undefined;
}
var ABOVE = 'above';
var INSIDE = 'inside';
var BELOW = 'below';
var INVISIBLE = 'invisible';
function debugLog() {
if (process.env.NODE_ENV !== 'production') {
var _console;
(_console = console).log.apply(_console, arguments); // eslint-disable-line no-console
}
}
/**
* When an element's type is a string, it represents a DOM node with that tag name
* https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html#dom-elements
*
* @param {React.element} Component
* @return {bool} Whether the component is a DOM Element
*/
function isDOMElement(Component) {
return typeof Component.type === 'string';
}
var errorMessage = '<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a ' + 'DOM element (e.g. <div>) nor does it use the innerRef prop.\n\n' + 'See https://goo.gl/LrBNgw for more info.';
/**
* Raise an error if "children" is not a DOM Element and there is no ref provided to Waypoint
*
* @param {?React.element} children
* @param {?HTMLElement} ref
* @return {undefined}
*/
function ensureRefIsProvidedByChild(children, ref) {
if (children && !isDOMElement(children) && !ref) {
throw new Error(errorMessage);
}
}
/**
* @param {object} bounds An object with bounds data for the waypoint and
* scrollable parent
* @return {string} The current position of the waypoint in relation to the
* visible portion of the scrollable parent. One of the constants `ABOVE`,
* `BELOW`, `INSIDE` or `INVISIBLE`.
*/
function getCurrentPosition(bounds) {
if (bounds.viewportBottom - bounds.viewportTop === 0) {
return INVISIBLE;
} // top is within the viewport
if (bounds.viewportTop <= bounds.waypointTop && bounds.waypointTop <= bounds.viewportBottom) {
return INSIDE;
} // bottom is within the viewport
if (bounds.viewportTop <= bounds.waypointBottom && bounds.waypointBottom <= bounds.viewportBottom) {
return INSIDE;
} // top is above the viewport and bottom is below the viewport
if (bounds.waypointTop <= bounds.viewportTop && bounds.viewportBottom <= bounds.waypointBottom) {
return INSIDE;
}
if (bounds.viewportBottom < bounds.waypointTop) {
return BELOW;
}
if (bounds.waypointTop < bounds.viewportTop) {
return ABOVE;
}
return INVISIBLE;
}
var timeout;
var timeoutQueue = [];
function onNextTick(cb) {
timeoutQueue.push(cb);
if (!timeout) {
timeout = setTimeout(function () {
timeout = null; // Drain the timeoutQueue
var item; // eslint-disable-next-line no-cond-assign
while (item = timeoutQueue.shift()) {
item();
}
}, 0);
}
var isSubscribed = true;
return function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
var index = timeoutQueue.indexOf(cb);
if (index === -1) {
return;
}
timeoutQueue.splice(index, 1);
if (!timeoutQueue.length && timeout) {
clearTimeout(timeout);
timeout = null;
}
};
}
function resolveScrollableAncestorProp(scrollableAncestor) {
// When Waypoint is rendered on the server, `window` is not available.
// To make Waypoint easier to work with, we allow this to be specified in
// string form and safely convert to `window` here.
if (scrollableAncestor === 'window') {
return global.window;
}
return scrollableAncestor;
}
var hasWindow = typeof window !== 'undefined';
var defaultProps = {
debug: false,
scrollableAncestor: undefined,
children: undefined,
topOffset: '0px',
bottomOffset: '0px',
horizontal: false,
onEnter: function onEnter() {},
onLeave: function onLeave() {},
onPositionChange: function onPositionChange() {},
fireOnRapidScroll: true
}; // Calls a function when you scroll to the element.
var Waypoint = /*#__PURE__*/function (_React$PureComponent) {
_inheritsLoose(Waypoint, _React$PureComponent);
function Waypoint(props) {
var _this;
_this = _React$PureComponent.call(this, props) || this;
_this.refElement = function (e) {
_this._ref = e;
};
return _this;
}
var _proto = Waypoint.prototype;
_proto.componentDidMount = function componentDidMount() {
var _this2 = this;
if (!hasWindow) {
return;
} // this._ref may occasionally not be set at this time. To help ensure that
// this works smoothly and to avoid layout thrashing, we want to delay the
// initial execution until the next tick.
this.cancelOnNextTick = onNextTick(function () {
_this2.cancelOnNextTick = null;
var _this2$props = _this2.props,
children = _this2$props.children,
debug = _this2$props.debug; // Berofe doing anything, we want to check that this._ref is avaliable in Waypoint
ensureRefIsProvidedByChild(children, _this2._ref);
_this2._handleScroll = _this2._handleScroll.bind(_this2);
_this2.scrollableAncestor = _this2._findScrollableAncestor();
if (process.env.NODE_ENV !== 'production' && debug) {
debugLog('scrollableAncestor', _this2.scrollableAncestor);
}
_this2.scrollEventListenerUnsubscribe = addEventListener(_this2.scrollableAncestor, 'scroll', _this2._handleScroll, {
passive: true
});
_this2.resizeEventListenerUnsubscribe = addEventListener(window, 'resize', _this2._handleScroll, {
passive: true
});
_this2._handleScroll(null);
});
};
_proto.componentDidUpdate = function componentDidUpdate() {
var _this3 = this;
if (!hasWindow) {
return;
}
if (!this.scrollableAncestor) {
// The Waypoint has not yet initialized.
return;
} // The element may have moved, so we need to recompute its position on the
// page. This happens via handleScroll in a way that forces layout to be
// computed.
//
// We want this to be deferred to avoid forcing layout during render, which
// causes layout thrashing. And, if we already have this work enqueued, we
// can just wait for that to happen instead of enqueueing again.
if (this.cancelOnNextTick) {
return;
}
this.cancelOnNextTick = onNextTick(function () {
_this3.cancelOnNextTick = null;
_this3._handleScroll(null);
});
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (!hasWindow) {
return;
}
if (this.scrollEventListenerUnsubscribe) {
this.scrollEventListenerUnsubscribe();
}
if (this.resizeEventListenerUnsubscribe) {
this.resizeEventListenerUnsubscribe();
}
if (this.cancelOnNextTick) {
this.cancelOnNextTick();
}
}
/**
* Traverses up the DOM to find an ancestor container which has an overflow
* style that allows for scrolling.
*
* @return {Object} the closest ancestor element with an overflow style that
* allows for scrolling. If none is found, the `window` object is returned
* as a fallback.
*/
;
_proto._findScrollableAncestor = function _findScrollableAncestor() {
var _this$props = this.props,
horizontal = _this$props.horizontal,
scrollableAncestor = _this$props.scrollableAncestor;
if (scrollableAncestor) {
return resolveScrollableAncestorProp(scrollableAncestor);
}
var node = this._ref;
while (node.parentNode) {
node = node.parentNode;
if (node === document.body) {
// We've reached all the way to the root node.
return window;
}
var style = window.getComputedStyle(node);
var overflowDirec = horizontal ? style.getPropertyValue('overflow-x') : style.getPropertyValue('overflow-y');
var overflow = overflowDirec || style.getPropertyValue('overflow');
if (overflow === 'auto' || overflow === 'scroll' || overflow === 'overlay') {
return node;
}
} // A scrollable ancestor element was not found, which means that we need to
// do stuff on window.
return window;
}
/**
* @param {Object} event the native scroll event coming from the scrollable
* ancestor, or resize event coming from the window. Will be undefined if
* called by a React lifecyle method
*/
;
_proto._handleScroll = function _handleScroll(event) {
if (!this._ref) {
// There's a chance we end up here after the component has been unmounted.
return;
}
var bounds = this._getBounds();
var currentPosition = getCurrentPosition(bounds);
var previousPosition = this._previousPosition;
var _this$props2 = this.props,
debug = _this$props2.debug,
onPositionChange = _this$props2.onPositionChange,
onEnter = _this$props2.onEnter,
onLeave = _this$props2.onLeave,
fireOnRapidScroll = _this$props2.fireOnRapidScroll;
if (process.env.NODE_ENV !== 'production' && debug) {
debugLog('currentPosition', currentPosition);
debugLog('previousPosition', previousPosition);
} // Save previous position as early as possible to prevent cycles
this._previousPosition = currentPosition;
if (previousPosition === currentPosition) {
// No change since last trigger
return;
}
var callbackArg = {
currentPosition: currentPosition,
previousPosition: previousPosition,
event: event,
waypointTop: bounds.waypointTop,
waypointBottom: bounds.waypointBottom,
viewportTop: bounds.viewportTop,
viewportBottom: bounds.viewportBottom
};
onPositionChange.call(this, callbackArg);
if (currentPosition === INSIDE) {
onEnter.call(this, callbackArg);
} else if (previousPosition === INSIDE) {
onLeave.call(this, callbackArg);
}
var isRapidScrollDown = previousPosition === BELOW && currentPosition === ABOVE;
var isRapidScrollUp = previousPosition === ABOVE && currentPosition === BELOW;
if (fireOnRapidScroll && (isRapidScrollDown || isRapidScrollUp)) {
// If the scroll event isn't fired often enough to occur while the
// waypoint was visible, we trigger both callbacks anyway.
onEnter.call(this, {
currentPosition: INSIDE,
previousPosition: previousPosition,
event: event,
waypointTop: bounds.waypointTop,
waypointBottom: bounds.waypointBottom,
viewportTop: bounds.viewportTop,
viewportBottom: bounds.viewportBottom
});
onLeave.call(this, {
currentPosition: currentPosition,
previousPosition: INSIDE,
event: event,
waypointTop: bounds.waypointTop,
waypointBottom: bounds.waypointBottom,
viewportTop: bounds.viewportTop,
viewportBottom: bounds.viewportBottom
});
}
};
_proto._getBounds = function _getBounds() {
var _this$props3 = this.props,
horizontal = _this$props3.horizontal,
debug = _this$props3.debug;
var _this$_ref$getBoundin = this._ref.getBoundingClientRect(),
left = _this$_ref$getBoundin.left,
top = _this$_ref$getBoundin.top,
right = _this$_ref$getBoundin.right,
bottom = _this$_ref$getBoundin.bottom;
var waypointTop = horizontal ? left : top;
var waypointBottom = horizontal ? right : bottom;
var contextHeight;
var contextScrollTop;
if (this.scrollableAncestor === window) {
contextHeight = horizontal ? window.innerWidth : window.innerHeight;
contextScrollTop = 0;
} else {
contextHeight = horizontal ? this.scrollableAncestor.offsetWidth : this.scrollableAncestor.offsetHeight;
contextScrollTop = horizontal ? this.scrollableAncestor.getBoundingClientRect().left : this.scrollableAncestor.getBoundingClientRect().top;
}
if (process.env.NODE_ENV !== 'production' && debug) {
debugLog('waypoint top', waypointTop);
debugLog('waypoint bottom', waypointBottom);
debugLog('scrollableAncestor height', contextHeight);
debugLog('scrollableAncestor scrollTop', contextScrollTop);
}
var _this$props4 = this.props,
bottomOffset = _this$props4.bottomOffset,
topOffset = _this$props4.topOffset;
var topOffsetPx = computeOffsetPixels(topOffset, contextHeight);
var bottomOffsetPx = computeOffsetPixels(bottomOffset, contextHeight);
var contextBottom = contextScrollTop + contextHeight;
return {
waypointTop: waypointTop,
waypointBottom: waypointBottom,
viewportTop: contextScrollTop + topOffsetPx,
viewportBottom: contextBottom - bottomOffsetPx
};
}
/**
* @return {Object}
*/
;
_proto.render = function render() {
var _this4 = this;
var children = this.props.children;
if (!children) {
// We need an element that we can locate in the DOM to determine where it is
// rendered relative to the top of its context.
return /*#__PURE__*/React.createElement("span", {
ref: this.refElement,
style: {
fontSize: 0
}
});
}
if (isDOMElement(children) || isForwardRef(children)) {
var ref = function ref(node) {
_this4.refElement(node);
if (children.ref) {
if (typeof children.ref === 'function') {
children.ref(node);
} else {
children.ref.current = node;
}
}
};
return /*#__PURE__*/React.cloneElement(children, {
ref: ref
});
}
return /*#__PURE__*/React.cloneElement(children, {
innerRef: this.refElement
});
};
return Waypoint;
}(React.PureComponent);
if (process.env.NODE_ENV !== 'production') {
Waypoint.propTypes = {
children: PropTypes.element,
debug: PropTypes.bool,
onEnter: PropTypes.func,
onLeave: PropTypes.func,
onPositionChange: PropTypes.func,
fireOnRapidScroll: PropTypes.bool,
// eslint-disable-next-line react/forbid-prop-types
scrollableAncestor: PropTypes.any,
horizontal: PropTypes.bool,
// `topOffset` can either be a number, in which case its a distance from the
// top of the container in pixels, or a string value. Valid string values are
// of the form "20px", which is parsed as pixels, or "20%", which is parsed
// as a percentage of the height of the containing element.
// For instance, if you pass "-20%", and the containing element is 100px tall,
// then the waypoint will be triggered when it has been scrolled 20px beyond
// the top of the containing element.
topOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
// `bottomOffset` can either be a number, in which case its a distance from the
// bottom of the container in pixels, or a string value. Valid string values are
// of the form "20px", which is parsed as pixels, or "20%", which is parsed
// as a percentage of the height of the containing element.
// For instance, if you pass "20%", and the containing element is 100px tall,
// then the waypoint will be triggered when it has been scrolled 20px beyond
// the bottom of the containing element.
// Similar to `topOffset`, but for the bottom of the container.
bottomOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};
}
Waypoint.above = ABOVE;
Waypoint.below = BELOW;
Waypoint.inside = INSIDE;
Waypoint.invisible = INVISIBLE;
Waypoint.defaultProps = defaultProps;
Waypoint.displayName = 'Waypoint';
export { Waypoint };

119
node_modules/react-waypoint/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import * as React from 'react';
export declare class Waypoint extends React.Component<Waypoint.WaypointProps, {}> {
static above: string;
static below: string;
static inside: string;
static invisible: string;
}
declare namespace Waypoint {
interface CallbackArgs {
/*
* The position that the waypoint has at the moment.
* One of Waypoint.below, Waypoint.above, Waypoint.inside, and Waypoint.invisible.
*/
currentPosition: string;
/*
* The position that the waypoint had before.
* One of Waypoint.below, Waypoint.above, Waypoint.inside, and Waypoint.invisible.
*/
previousPosition: string;
/*
* The native scroll event that triggered the callback.
* May be missing if the callback wasn't triggered as the result of a scroll
*/
event?: Event;
/*
* The waypoint's distance to the top of the viewport.
*/
waypointTop: number;
/*
* The distance from the scrollable ancestor to the viewport top.
*/
viewportTop: number;
/*
* The distance from the bottom of the scrollable ancestor to the viewport top.
*/
viewportBottom: number;
}
interface WaypointProps {
/**
* Function called when waypoint enters viewport
* @param {CallbackArgs} args
*/
onEnter?: (args: CallbackArgs) => void;
/**
* Function called when waypoint leaves viewport
* @param {CallbackArgs} args
*/
onLeave?: (args: CallbackArgs) => void;
/**
* Function called when waypoint position changes
* @param {CallbackArgs} args
*/
onPositionChange?: (args: CallbackArgs) => void;
/**
* Whether to activate on horizontal scrolling instead of vertical
*/
horizontal?: boolean;
/**
* `topOffset` can either be a number, in which case its a distance from the
* top of the container in pixels, or a string value. Valid string values are
* of the form "20px", which is parsed as pixels, or "20%", which is parsed
* as a percentage of the height of the containing element.
* For instance, if you pass "-20%", and the containing element is 100px tall,
* then the waypoint will be triggered when it has been scrolled 20px beyond
* the top of the containing element.
*/
topOffset?: string|number;
/**
* `bottomOffset` can either be a number, in which case its a distance from the
* bottom of the container in pixels, or a string value. Valid string values are
* of the form "20px", which is parsed as pixels, or "20%", which is parsed
* as a percentage of the height of the containing element.
* For instance, if you pass "20%", and the containing element is 100px tall,
* then the waypoint will be triggered when it has been scrolled 20px beyond
* the bottom of the containing element.
*
* Similar to `topOffset`, but for the bottom of the container.
*/
bottomOffset?: string|number;
/**
* A custom ancestor to determine if the target is visible in it.
* This is useful in cases where you do not want the immediate scrollable
* ancestor to be the container. For example, when your target is in a div
* that has overflow auto but you are detecting onEnter based on the window.
*/
scrollableAncestor?: any;
/**
* If the onEnter/onLeave events are to be fired on rapid scrolling.
* This has no effect on onPositionChange -- it will fire anyway.
*/
fireOnRapidScroll?: boolean;
/**
* Use this prop to get debug information in the console log. This slows
* things down significantly, so it should only be used during development.
*/
debug?: boolean;
/**
* Since React 18 Children are no longer implied, therefore we specify them here
*/
children?: React.ReactNode;
}
}

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Facebook, Inc. and its affiliates.
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.

View File

@@ -0,0 +1,104 @@
# `react-is`
This package allows you to test arbitrary values and see if they're a particular React element type.
## Installation
```sh
# Yarn
yarn add react-is
# NPM
npm install react-is
```
## Usage
### Determining if a Component is Valid
```js
import React from "react";
import * as ReactIs from "react-is";
class ClassComponent extends React.Component {
render() {
return React.createElement("div");
}
}
const FunctionComponent = () => React.createElement("div");
const ForwardRefComponent = React.forwardRef((props, ref) =>
React.createElement(Component, { forwardedRef: ref, ...props })
);
const Context = React.createContext(false);
ReactIs.isValidElementType("div"); // true
ReactIs.isValidElementType(ClassComponent); // true
ReactIs.isValidElementType(FunctionComponent); // true
ReactIs.isValidElementType(ForwardRefComponent); // true
ReactIs.isValidElementType(Context.Provider); // true
ReactIs.isValidElementType(Context.Consumer); // true
ReactIs.isValidElementType(React.createFactory("div")); // true
```
### Determining an Element's Type
#### Context
```js
import React from "react";
import * as ReactIs from 'react-is';
const ThemeContext = React.createContext("blue");
ReactIs.isContextConsumer(<ThemeContext.Consumer />); // true
ReactIs.isContextProvider(<ThemeContext.Provider />); // true
ReactIs.typeOf(<ThemeContext.Provider />) === ReactIs.ContextProvider; // true
ReactIs.typeOf(<ThemeContext.Consumer />) === ReactIs.ContextConsumer; // true
```
#### Element
```js
import React from "react";
import * as ReactIs from 'react-is';
ReactIs.isElement(<div />); // true
ReactIs.typeOf(<div />) === ReactIs.Element; // true
```
#### Fragment
```js
import React from "react";
import * as ReactIs from 'react-is';
ReactIs.isFragment(<></>); // true
ReactIs.typeOf(<></>) === ReactIs.Fragment; // true
```
#### Portal
```js
import React from "react";
import ReactDOM from "react-dom";
import * as ReactIs from 'react-is';
const div = document.createElement("div");
const portal = ReactDOM.createPortal(<div />, div);
ReactIs.isPortal(portal); // true
ReactIs.typeOf(portal) === ReactIs.Portal; // true
```
#### StrictMode
```js
import React from "react";
import * as ReactIs from 'react-is';
ReactIs.isStrictMode(<React.StrictMode />); // true
ReactIs.typeOf(<React.StrictMode />) === ReactIs.StrictMode; // true
```

View File

@@ -0,0 +1,221 @@
/**
* @license React
* react-is.development.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.
*/
'use strict';
if (process.env.NODE_ENV !== "production") {
(function() {
'use strict';
// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
// The Symbol used to tag the ReactElement-like types.
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
// -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
// stuff. Intended to enable React core members to more easily debug scheduling
// issues in DEV builds.
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
var REACT_MODULE_REFERENCE;
{
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
}
function isValidElementType(type) {
if (typeof type === 'string' || typeof type === 'function') {
return true;
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
return true;
}
}
return false;
}
function typeOf(object) {
if (typeof object === 'object' && object !== null) {
var $$typeof = object.$$typeof;
switch ($$typeof) {
case REACT_ELEMENT_TYPE:
var type = object.type;
switch (type) {
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
case REACT_SUSPENSE_LIST_TYPE:
return type;
default:
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_SERVER_CONTEXT_TYPE:
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:
case REACT_PROVIDER_TYPE:
return $$typeofType;
default:
return $$typeof;
}
}
case REACT_PORTAL_TYPE:
return $$typeof;
}
}
return undefined;
}
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false;
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
}
}
return false;
}
function isConcurrentMode(object) {
{
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
}
}
return false;
}
function isContextConsumer(object) {
return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement(object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
function isSuspenseList(object) {
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
}
exports.ContextConsumer = ContextConsumer;
exports.ContextProvider = ContextProvider;
exports.Element = Element;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment;
exports.Lazy = Lazy;
exports.Memo = Memo;
exports.Portal = Portal;
exports.Profiler = Profiler;
exports.StrictMode = StrictMode;
exports.Suspense = Suspense;
exports.SuspenseList = SuspenseList;
exports.isAsyncMode = isAsyncMode;
exports.isConcurrentMode = isConcurrentMode;
exports.isContextConsumer = isContextConsumer;
exports.isContextProvider = isContextProvider;
exports.isElement = isElement;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isLazy = isLazy;
exports.isMemo = isMemo;
exports.isPortal = isPortal;
exports.isProfiler = isProfiler;
exports.isStrictMode = isStrictMode;
exports.isSuspense = isSuspense;
exports.isSuspenseList = isSuspenseList;
exports.isValidElementType = isValidElementType;
exports.typeOf = typeOf;
})();
}

View File

@@ -0,0 +1,14 @@
/**
* @license React
* react-is.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.
*/
'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;
exports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};
exports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;

View File

@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-is.production.min.js');
} else {
module.exports = require('./cjs/react-is.development.js');
}

View File

@@ -0,0 +1,26 @@
{
"name": "react-is",
"version": "18.3.1",
"description": "Brand checking of React Elements.",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",
"directory": "packages/react-is"
},
"keywords": [
"react"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/facebook/react/issues"
},
"homepage": "https://reactjs.org/",
"files": [
"LICENSE",
"README.md",
"index.js",
"cjs/",
"umd/"
]
}

View File

@@ -0,0 +1,220 @@
/**
* @license React
* react-is.development.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.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.ReactIs = {}));
}(this, (function (exports) { 'use strict';
// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
// The Symbol used to tag the ReactElement-like types.
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
var REACT_MEMO_TYPE = Symbol.for('react.memo');
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
// -----------------------------------------------------------------------------
var enableScopeAPI = false; // Experimental Create Event Handle API.
var enableCacheElement = false;
var enableTransitionTracing = false; // No known bugs, but needs performance testing
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
// stuff. Intended to enable React core members to more easily debug scheduling
// issues in DEV builds.
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
var REACT_MODULE_REFERENCE;
{
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
}
function isValidElementType(type) {
if (typeof type === 'string' || typeof type === 'function') {
return true;
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
return true;
}
}
return false;
}
function typeOf(object) {
if (typeof object === 'object' && object !== null) {
var $$typeof = object.$$typeof;
switch ($$typeof) {
case REACT_ELEMENT_TYPE:
var type = object.type;
switch (type) {
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
case REACT_SUSPENSE_LIST_TYPE:
return type;
default:
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_SERVER_CONTEXT_TYPE:
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:
case REACT_PROVIDER_TYPE:
return $$typeofType;
default:
return $$typeof;
}
}
case REACT_PORTAL_TYPE:
return $$typeof;
}
}
return undefined;
}
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false;
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
}
}
return false;
}
function isConcurrentMode(object) {
{
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
}
}
return false;
}
function isContextConsumer(object) {
return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement(object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
function isSuspenseList(object) {
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
}
exports.ContextConsumer = ContextConsumer;
exports.ContextProvider = ContextProvider;
exports.Element = Element;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment;
exports.Lazy = Lazy;
exports.Memo = Memo;
exports.Portal = Portal;
exports.Profiler = Profiler;
exports.StrictMode = StrictMode;
exports.Suspense = Suspense;
exports.SuspenseList = SuspenseList;
exports.isAsyncMode = isAsyncMode;
exports.isConcurrentMode = isConcurrentMode;
exports.isContextConsumer = isContextConsumer;
exports.isContextProvider = isContextProvider;
exports.isElement = isElement;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isLazy = isLazy;
exports.isMemo = isMemo;
exports.isPortal = isPortal;
exports.isProfiler = isProfiler;
exports.isStrictMode = isStrictMode;
exports.isSuspense = isSuspense;
exports.isSuspenseList = isSuspenseList;
exports.isValidElementType = isValidElementType;
exports.typeOf = typeOf;
})));

View File

@@ -0,0 +1,15 @@
/**
* @license React
* react-is.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.
*/
(function(){'use strict';(function(b,c){"object"===typeof exports&&"undefined"!==typeof module?c(exports):"function"===typeof define&&define.amd?define(["exports"],c):(b=b||self,c(b.ReactIs={}))})(this,function(b){function c(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case q:switch(a=a.type,a){case d:case e:case f:case g:case h:return a;default:switch(a=a&&a.$$typeof,a){case t:case k:case l:case m:case n:case p:return a;default:return b}}case r:return b}}}var q=Symbol.for("react.element"),
r=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),e=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),k=Symbol.for("react.context"),t=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),u=Symbol.for("react.offscreen");var v=Symbol.for("react.module.reference");b.ContextConsumer=k;b.ContextProvider=p;b.Element=
q;b.ForwardRef=l;b.Fragment=d;b.Lazy=m;b.Memo=n;b.Portal=r;b.Profiler=e;b.StrictMode=f;b.Suspense=g;b.SuspenseList=h;b.isAsyncMode=function(a){return!1};b.isConcurrentMode=function(a){return!1};b.isContextConsumer=function(a){return c(a)===k};b.isContextProvider=function(a){return c(a)===p};b.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===q};b.isForwardRef=function(a){return c(a)===l};b.isFragment=function(a){return c(a)===d};b.isLazy=function(a){return c(a)===m};b.isMemo=
function(a){return c(a)===n};b.isPortal=function(a){return c(a)===r};b.isProfiler=function(a){return c(a)===e};b.isStrictMode=function(a){return c(a)===f};b.isSuspense=function(a){return c(a)===g};b.isSuspenseList=function(a){return c(a)===h};b.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===e||a===f||a===g||a===h||a===u||"object"===typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===n||a.$$typeof===p||a.$$typeof===k||a.$$typeof===l||a.$$typeof===v||void 0!==
a.getModuleId)?!0:!1};b.typeOf=c});
})();

92
node_modules/react-waypoint/package.json generated vendored Normal file
View File

@@ -0,0 +1,92 @@
{
"name": "react-waypoint",
"version": "10.3.0",
"description": "A React component to execute a function whenever you scroll to an element.",
"main": "cjs/index.js",
"module": "es/index.js",
"types": "index.d.ts",
"files": [
"cjs",
"es",
"index.d.ts"
],
"repository": {
"type": "git",
"url": "https://github.com/civiccc/react-waypoint.git"
},
"homepage": "https://github.com/civiccc/react-waypoint",
"bugs": "https://github.com/civiccc/react-waypoint/issues",
"scripts": {
"build": "npm run clean && rollup -c",
"check-changelog": "expr $(git status --porcelain 2>/dev/null| grep \"^\\s*M.*CHANGELOG.md\" | wc -l) >/dev/null || (echo 'Please edit CHANGELOG.md' && exit 1)",
"check-only-changelog-changed": "(expr $(git status --porcelain 2>/dev/null| grep -v \"CHANGELOG.md\" | wc -l) >/dev/null && echo 'Only CHANGELOG.md may have uncommitted changes' && exit 1) || exit 0",
"clean": "rimraf es cjs",
"lint": "eslint . --ext .js,.jsx",
"postversion": "git commit package.json CHANGELOG.md -m \"Version $npm_package_version\" && npm run tag && git push && git push --tags && npm publish",
"prepublish": "in-publish && safe-publish-latest && npm run build || not-in-publish",
"pretest": "npm run --silent lint",
"preversion": "npm run check-changelog && npm run check-only-changelog-changed",
"tag": "git tag v$npm_package_version",
"test": "npm run test:browser && npm run test:node",
"test:node": "jest 'test/node/.*.js'",
"test:browser": "karma start --single-run",
"test:browser:watch": "karma start --no-single-run",
"performance-test:watch": "webpack --watch --config webpack.config.performance-test.js"
},
"author": "Brigade Engineering",
"license": "MIT",
"peerDependencies": {
"react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@rollup/plugin-babel": "^5.2.1",
"@types/react": "^16.14.5",
"babel-loader": "^8.0.0",
"babel-preset-airbnb": "^5.0.0",
"eslint": "^7.12.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.2",
"in-publish": "^2.0.0",
"jasmine-core": "^2.99.1",
"jest": "^26.6.3",
"karma": "^6.0.2",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-firefox-launcher": "^2.1.0",
"karma-jasmine": "^1.1.2",
"karma-webpack": "^4.0.2",
"loose-envify": "^1.4.0",
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-test-renderer": "^16.0.0 || ^17.0.0 || ^18.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.33.2",
"safe-publish-latest": "^1.1.1",
"webpack": "^4.46.0",
"webpack-cli": "^4.4.0"
},
"keywords": [
"react",
"component",
"react-component",
"scroll",
"onscroll",
"scrollspy"
],
"dependencies": {
"@babel/runtime": "^7.12.5",
"consolidated-events": "^1.1.0 || ^2.0.0",
"prop-types": "^15.0.0",
"react-is": "^17.0.1 || ^18.0.0"
},
"browserify": {
"transform": [
"loose-envify"
]
}
}